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