nvimrc 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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. " see https://github.com/tmux/tmux/issues/543
  46. set clipboard=unnamed
  47. " jump between split lines
  48. map j gj
  49. map k gk
  50. nnoremap <silent> <BS> :TmuxNavigateLeft<cr>
  51. set relativenumber " aka :set rnu
  52. "map mapleader / to (german layout)
  53. let mapleader = ","
  54. " execute current file
  55. nnoremap <leader>e :!'%:p'<CR>
  56. " Run `make` in current directory
  57. nnoremap <leader>m :!make<CR>
  58. " open build/*.pdf
  59. nnoremap <leader>o :!open build/*.pdf<CR>
  60. " open Nerdtree with CTRL+n
  61. map <C-n> :NERDTreeToggle<CR>
  62. " open Tagbar with CTRL+m
  63. map <C-m> :TagbarToggle<CR>
  64. " toggle background with CTRL+I
  65. map <C-I> :let &background = (&background == "dark" ? "light" : "dark")<CR>
  66. " :w for :W
  67. command W w
  68. command Wq wq
  69. command Q q
  70. command Qa qa
  71. command WQ wq
  72. " color scheme
  73. colo solarized
  74. set ai " Set auto inline on
  75. set number " Show line numbers
  76. syntax on " Set syntax highlighting on
  77. set tabstop=4 " width of tab
  78. " should be redundant after tabstop and expandtab,
  79. " but vim-snipmate is messing up (?)
  80. set softtabstop=4
  81. set shiftwidth=4
  82. set expandtab " use 'tabstop' spaces instead of tab
  83. set colorcolumn=80 " Bar hinting for 80 chars
  84. set breakindent "baby, yeah!
  85. set mouse=a " activate mouse support
  86. set ignorecase " ignore case while searching
  87. " handling backupfiles
  88. set backupdir=~/.config/nvim/backup//
  89. set directory=~/.config/nvim/swap//
  90. set undodir=~/.config/nvim/undo//
  91. " YCM Configuration
  92. " dont use python-mode autocomplete obsolete now, because of YCM
  93. let g:ycm_filetype_whitelist = {'cpp': 1, 'py': 1, 'python': 1, 'arduino': 1, 'js': 1}
  94. " set ycm_extra_conf
  95. let g:ycm_global_ycm_extra_conf = '~/.ycm.py'
  96. " turn off the ycm diagnostic because of struggling with root
  97. "let g:ycm_show_diagnostics_ui = 0
  98. let g:ycm_autoclose_preview_window_after_insertion = 1
  99. let g:ycm_autoclose_preview_window_after_completion = 1
  100. let g:ycm_path_to_python_interpreter='/usr/local/bin/python'
  101. " NERDTree Configuration
  102. " hide some fileextenxions
  103. let NERDTreeIgnore = ['\.pyc$']
  104. " vim-fugitive
  105. " gdiff vertical instead of horizontal
  106. set diffopt+=vertical
  107. " Airline stuff
  108. let g:airline_powerline_fonts = 1
  109. let g:airline#extensions#tabline#enabled = 1
  110. let g:airline#extensions#tabline#buffer_nr_show = 1
  111. " multiple-cursors mapping
  112. let g:multi_cursor_use_default_mapping=0
  113. let g:multi_cursor_next_key='<C-d>'
  114. let g:multi_cursor_quit_key='<Esc>'
  115. " configure UltiSnips
  116. let g:UltiSnipsExpandTrigger='<C-j>'
  117. let g:UltiSnipsJumpForwardTrigger='<C-j>'
  118. let g:UltiSnipsJumpBackwardTrigger='<C-k>'
  119. " vCoolor config
  120. let g:vcoolor_map = '<C-c>'
  121. let g:vcool_ins_rgb_map = '' " Insert rgb color.
  122. let g:vcool_ins_hsl_map = '' " Insert hsl color.
  123. let g:vcool_ins_rgba_map = '' " Insert rgba color.
  124. " vim-javascript config
  125. let g:javascript_enable_domhtmlcss = 1
  126. " limelight+goyo settings, automatically fire up limelight with goyo
  127. let g:limelight_conceal_ctermfg = 'gray'
  128. autocmd! User GoyoEnter Limelight
  129. autocmd! User GoyoLeave Limelight!
  130. " map `,g` to start goyo
  131. nnoremap <leader>g :Goyo<CR>
  132. " Enable emmet-vim just for html/css
  133. let g:user_emmet_isntall_global = 0
  134. autocmd FileType html,css EmmetInstall
  135. " configure flake8
  136. " bind `,f` to Flake8
  137. nnoremap <leader>f :call Flake8()<CR>
  138. " instant markdown
  139. let g:instant_markdown_autostart = 0
  140. " activate mouse support
  141. set mouse=a
  142. set scrolloff=5
  143. " add some cpp-keywords
  144. syn keyword cppExceptions noexcept using
  145. " allow mouse clicks to change cursor position
  146. set noequalalways
  147. " list whitespaces and some other characters
  148. set listchars=tab:>-,trail:~
  149. set list
  150. " use latex flavour for plaintex files
  151. let g:tex_flavour="latex"
  152. " set some default options for my personal latexmk
  153. let g:vimtex_latexmk_options=" -lualatex
  154. \ -jobname=./build/document
  155. \ -interaction=nonstopmode
  156. \ -halt-on-error
  157. \ -pvc"
  158. " let youcompleteme complete tex
  159. if !exists('g:ycm_semantic_triggers')
  160. let g:ycm_semantic_triggers = {}
  161. endif
  162. let g:ycm_semantic_triggers.tex = [
  163. \ 're!\\[A-Za-z]*cite[A-Za-z]*(\[[^]]*\]){0,2}{[^}]*',
  164. \ 're!\\[A-Za-z]*ref({[^}]*|range{([^,{}]*(}{)?))',
  165. \ 're!\\hyperref\[[^]]*',
  166. \ 're!\\includegraphics\*?(\[[^]]*\]){0,2}{[^}]*',
  167. \ 're!\\(include(only)?|input){[^}]*',
  168. \ 're!\\\a*(gls|Gls|GLS)(pl)?\a*(\s*\[[^]]*\]){0,2}\s*\{[^}]*',
  169. \ 're!\\includepdf(\s*\[[^]]*\])?\s*\{[^}]*',
  170. \ 're!\\includestandalone(\s*\[[^]]*\])?\s*\{[^}]*',
  171. \ ]