Dotfiles for different machines on different branches.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.9 KiB

11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
  1. let mapleader =","
  2. if ! filereadable(expand('~/.config/nvim/autoload/plug.vim'))
  3. echo "Downloading junegunn/vim-plug to manage plugins..."
  4. silent !mkdir -p ~/.config/nvim/autoload/
  5. silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ~/.config/nvim/autoload/plug.vim
  6. autocmd VimEnter * PlugInstall
  7. endif
  8. "set bg=light
  9. set go=a
  10. set mouse=a
  11. set nohlsearch
  12. set clipboard=unnamedplus
  13. " Some basics:
  14. nnoremap c "_c
  15. set nocompatible
  16. filetype plugin on
  17. syntax on
  18. set encoding=utf-8
  19. set number relativenumber
  20. " Enable autocompletion:
  21. set wildmode=longest,list,full
  22. " Disables automatic commenting on newline:
  23. autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
  24. " Setting Tab-length
  25. set tabstop=4
  26. set softtabstop=4
  27. set shiftwidth=4
  28. " Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
  29. set splitbelow splitright
  30. " Clean LaTex build files
  31. autocmd VimLeave *.tex !texclear %
  32. " Copy selected text to system clipboard (requires gvim/nvim/vim-x11 installed):
  33. vnoremap <C-c> "+y
  34. map <C-p> "+P
  35. " Save file as sudo on files that require root permission
  36. cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!
  37. " Mapping Dictionaries
  38. map <F5> :setlocal spell! spelllang=de<CR>
  39. map <F6> :set spelllang=en_us<CR>
  40. " Read files correctly
  41. autocmd BufRead,BufNewFile *.tex set filetype=tex
  42. " Compiler for languages
  43. map <leader>c :w! \| !compiler <c-r>%<CR>
  44. " Open corresponding file (pdf/html/...)
  45. map <leader>p :!opout <c-r>%<CR><CR>
  46. " Delete trailing whitespaces on save
  47. autocmd BufWritePre * %s/\s\+$//e
  48. " Plugin section
  49. call plug#begin('~/.config/nvim/plugged')
  50. Plug 'neoclide/coc.nvim', {'branch': 'release'} " Autocomplete
  51. Plug 'lervag/vimtex' , { 'for' : 'tex'} " tex library for coc autocompletion
  52. Plug 'donRaphaco/neotex', { 'for': 'tex'} " Asynchronous pdf rendering
  53. Plug 'preservim/nerdtree' " Filetree
  54. Plug 'majutsushi/tagbar' " Show tags
  55. Plug 'airblade/vim-gitgutter' " Git Upgrades
  56. Plug 'FredKSchott/CoVim' "Use vim together
  57. Plug 'qpkorr/vim-renamer' " Bulk renamer
  58. call plug#end()
  59. " Coc extensions
  60. let g:coc_global_extensions = ['coc-snippets', 'coc-vimtex']
  61. " tab through suggestions
  62. let g:coc_snippet_next = '<tab>'
  63. inoremap <silent><expr> <TAB>
  64. \ pumvisible() ? "\<C-n>" :
  65. \ <SID>check_back_space() ? "\<TAB>" :
  66. \ coc#refresh()
  67. " jump to next placeholder
  68. inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
  69. " ending suggestions
  70. function! s:check_back_space() abort
  71. let col = col('.') - 1
  72. return !col || getline('.')[col - 1] =~# '\s'
  73. endfunction
  74. " expand snippets on enter
  75. inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<CR>"
  76. "tagbar
  77. map <F3> :TagbarToggle<CR>
  78. "nerdtree
  79. map <F2> :NERDTreeToggle<CR>
  80. autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
  81. let g:NERDTreeWinPos = "left"
  82. "neotex
  83. let g:neotex_enabled = 2
  84. " CoVim
  85. let CoVim_default_name = "TiynGER"
  86. let CoVim_default_port = "7000"