nvimrc 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. " set the runtime path to include Vundle and initialize
  2. call plug#begin('~/.config/nvim/plugged')
  3. Plug 'Valloric/YouCompleteMe'
  4. Plug 'majutsushi/tagbar'
  5. Plug 'scrooloose/nerdtree'
  6. Plug 'tpope/vim-fugitive'
  7. Plug 'tpope/vim-sensible'
  8. Plug 'airblade/vim-gitgutter'
  9. Plug 'mhinz/vim-startify'
  10. " Define runtime-path (rtp) if there is no explicit repo for vim
  11. Plug 'altercation/vim-colors-solarized'
  12. Plug 'vim-airline/vim-airline'
  13. Plug 'vim-airline/vim-airline-themes'
  14. Plug 'terryma/vim-multiple-cursors'
  15. Plug 'suan/vim-instant-markdown'
  16. Plug 'godlygeek/tabular'
  17. Plug 'tpope/vim-markdown'
  18. Plug 'KabbAmine/vCoolor.vim'
  19. Plug 'nvie/vim-flake8'
  20. Plug 'SirVer/ultisnips'
  21. Plug 'octol/vim-cpp-enhanced-highlight'
  22. Plug 'junegunn/goyo.vim'
  23. Plug 'junegunn/limelight.vim'
  24. Plug 'lervag/vimtex'
  25. Plug 'ap/vim-css-color'
  26. Plug 'mattn/emmet-vim'
  27. Plug 'ctrlpvim/ctrlp.vim'
  28. "Plug 'scrooloose/nerdcommenter'
  29. Plug 'tpope/vim-commentary'
  30. Plug 'pangloss/vim-javascript'
  31. Plug 'easymotion/vim-easymotion'
  32. Plug 'tpope/vim-unimpaired'
  33. Plug 'othree/yajs.vim'
  34. Plug 'tpope/vim-surround'
  35. Plug 'christoomey/vim-tmux-navigator'
  36. " All of your Plugins must be added before the following line
  37. call plug#end() " required
  38. "
  39. " U S E R S E T U P
  40. "
  41. " Recursive file search
  42. set path+=**
  43. " Make watchdogs possible
  44. set backupcopy=yes
  45. " jump between split lines
  46. map j gj
  47. map k gk
  48. " navigate split panes with ctrl-h/j/k/l
  49. nnoremap <c-j> <c-w>j
  50. nnoremap <c-k> <c-w>k
  51. nnoremap <c-l> <c-w>l
  52. nnoremap <c-h> <c-w>h
  53. set relativenumber " aka :set rnu
  54. "map mapleader / to (german layout)
  55. let mapleader = ","
  56. " execute current file
  57. nnoremap <leader>e :!'%:p'<CR>
  58. " Run `make` in current directory
  59. nnoremap <leader>m :!make<CR>
  60. " open build/*.pdf
  61. nnoremap <leader>o :!open build/*.pdf<CR>
  62. " open Nerdtree with CTRL+n
  63. map <C-n> :NERDTreeToggle<CR>
  64. " open Tagbar with CTRL+m
  65. map <C-m> :TagbarToggle<CR>
  66. " toggle background with CTRL+I
  67. map <C-I> :let &background = (&background == "dark" ? "light" : "dark")<CR>
  68. " :w for :W
  69. command W w
  70. command Wq wq
  71. command Q q
  72. command Qa qa
  73. command WQ wq
  74. " color scheme
  75. colo solarized
  76. set ai " Set auto inline on
  77. set number " Show line numbers
  78. syntax on " Set syntax highlighting on
  79. set tabstop=4 " width of tab
  80. " should be redundant after tabstop and expandtab,
  81. " but vim-snipmate is messing up (?)
  82. set softtabstop=4
  83. set shiftwidth=4
  84. set expandtab " use 'tabstop' spaces instead of tab
  85. set colorcolumn=80 " Bar hinting for 80 chars
  86. set breakindent "baby, yeah!
  87. set mouse=a " activate mouse support
  88. set ignorecase " ignore case while searching
  89. " handling backupfiles
  90. set backupdir=~/.config/nvim/backup//
  91. set directory=~/.config/nvim/swap//
  92. set undodir=~/.config/nvim/undo//
  93. " YCM Configuration
  94. " dont use python-mode autocomplete obsolete now, because of YCM
  95. let g:ycm_filetype_whitelist = {'cpp': 1, 'py': 1, 'python': 1, 'arduino': 1, 'js': 1}
  96. " set ycm_extra_conf
  97. let g:ycm_global_ycm_extra_conf = '~/.ycm.py'
  98. " turn off the ycm diagnostic because of struggling with root
  99. "let g:ycm_show_diagnostics_ui = 0
  100. let g:ycm_autoclose_preview_window_after_insertion = 1
  101. let g:ycm_autoclose_preview_window_after_completion = 1
  102. let g:ycm_path_to_python_interpreter='/usr/local/bin/python'
  103. " NERDTree Configuration
  104. " hide some fileextenxions
  105. let NERDTreeIgnore = ['\.pyc$']
  106. " vim-fugitive
  107. " gdiff vertical instead of horizontal
  108. set diffopt+=vertical
  109. " Airline stuff
  110. let g:airline_powerline_fonts = 1
  111. let g:airline#extensions#tabline#enabled = 1
  112. let g:airline#extensions#tabline#buffer_nr_show = 1
  113. " multiple-cursors mapping
  114. let g:multi_cursor_use_default_mapping=0
  115. let g:multi_cursor_next_key='<C-d>'
  116. let g:multi_cursor_quit_key='<Esc>'
  117. " configure UltiSnips
  118. let g:UltiSnipsExpandTrigger='<C-j>'
  119. let g:UltiSnipsJumpForwardTrigger='<C-j>'
  120. let g:UltiSnipsJumpBackwardTrigger='<C-k>'
  121. " vCoolor config
  122. let g:vcoolor_map = '<C-c>'
  123. let g:vcool_ins_rgb_map = '' " Insert rgb color.
  124. let g:vcool_ins_hsl_map = '' " Insert hsl color.
  125. let g:vcool_ins_rgba_map = '' " Insert rgba color.
  126. " vim-javascript config
  127. let g:javascript_enable_domhtmlcss = 1
  128. " limelight+goyo settings, automatically fire up limelight with goyo
  129. let g:limelight_conceal_ctermfg = 'gray'
  130. autocmd! User GoyoEnter Limelight
  131. autocmd! User GoyoLeave Limelight!
  132. " map `,g` to start goyo
  133. nnoremap <leader>g :Goyo<CR>
  134. " Enable emmet-vim just for html/css
  135. let g:user_emmet_isntall_global = 0
  136. autocmd FileType html,css EmmetInstall
  137. " configure flake8
  138. " bind `,f` to Flake8
  139. nnoremap <leader>f :call Flake8()<CR>
  140. " instant markdown
  141. let g:instant_markdown_autostart = 0
  142. " activate mouse support
  143. set mouse=a
  144. set scrolloff=5
  145. " add some cpp-keywords
  146. syn keyword cppExceptions noexcept using
  147. " allow mouse clicks to change cursor position
  148. set noequalalways
  149. " list whitespaces and some other characters
  150. set listchars=tab:>-,trail:~
  151. set list
  152. " use latex flavour for plaintex files
  153. let g:tex_flavour="latex"
  154. " set some default options for my personal latexmk
  155. let g:vimtex_latexmk_options=" -lualatex
  156. \ -jobname=./build/document
  157. \ -interaction=nonstopmode
  158. \ -halt-on-error
  159. \ -pvc"
  160. " let youcompleteme complete tex
  161. if !exists('g:ycm_semantic_triggers')
  162. let g:ycm_semantic_triggers = {}
  163. endif
  164. let g:ycm_semantic_triggers.tex = [
  165. \ 're!\\[A-Za-z]*cite[A-Za-z]*(\[[^]]*\]){0,2}{[^}]*',
  166. \ 're!\\[A-Za-z]*ref({[^}]*|range{([^,{}]*(}{)?))',
  167. \ 're!\\hyperref\[[^]]*',
  168. \ 're!\\includegraphics\*?(\[[^]]*\]){0,2}{[^}]*',
  169. \ 're!\\(include(only)?|input){[^}]*',
  170. \ 're!\\\a*(gls|Gls|GLS)(pl)?\a*(\s*\[[^]]*\]){0,2}\s*\{[^}]*',
  171. \ 're!\\includepdf(\s*\[[^]]*\])?\s*\{[^}]*',
  172. \ 're!\\includestandalone(\s*\[[^]]*\])?\s*\{[^}]*',
  173. \ ]