Advertisement
Guest User

Untitled

a guest
Jan 25th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 11.19 KB | None | 0 0
  1. "standard vim settings
  2. :set nocompatible
  3. filetype off
  4. :set backupcopy=yes
  5. :set encoding=utf-8
  6. :set showcmd
  7. :set modelines=0
  8. :nmap <F1> <nop>
  9. set mouse=a
  10. set exrc
  11. "colorscheme
  12. syntax on
  13. let g:nord_italic_comments = 1
  14. let g:nord_comment_brightness = 20
  15. colorscheme nord
  16. "Get rid of TODO highlighting
  17. hi Todo guibg=NONE
  18.  
  19. " nvim-specific settings
  20. if has('nvim')
  21.     " Use system clipboard
  22.     set clipboard=unnamed
  23.     set clipboard+=unnamedplus
  24. else
  25.     " Use system clipboard
  26.     :set clipboard=unnamedplus
  27.  
  28.     set t_Co=256
  29.     highlight Normal ctermbg=233 "fix background colors
  30.     highlight NonText ctermbg=233 "fix background colors
  31.     highlight LineNr ctermbg=234
  32.     highlight Cursorline ctermbg=234
  33.     highlight SignColumn ctermbg=234
  34. endif
  35.  
  36. let g:SignatureMarkTextHL = "SignColumn"
  37.  
  38. "tab settings
  39. set softtabstop=4
  40. set shiftwidth=4
  41. set tabstop=4
  42. set hidden
  43. set expandtab
  44. set cursorline
  45. set backspace=indent,eol,start
  46. set showmode!
  47. set undofile
  48. set ruler
  49. set colorcolumn=80
  50. set lazyredraw
  51. let mapleader = "\<Space>"
  52. "search settings -- NOTE: because of EnchantedVim we are always running in \v
  53. set ignorecase
  54. set smartcase
  55. set gdefault
  56. set incsearch
  57. set showmatch
  58. set hlsearch
  59. nnoremap <leader>/ :noh<cr> "<leader>/ to clear highlighting
  60. "repetition settings
  61. vnoremap . :normal .<CR>
  62. nnoremap ' `
  63. nnoremap ` @a
  64. vnoremap ` :normal @a<CR>
  65. "hotkeys
  66. nnoremap , ;
  67. vnoremap , ;
  68. nnoremap ; %
  69. nnoremap <silent> tt :tabnew<CR>
  70. nnoremap <silent> [g :tabprevious<CR>
  71. nnoremap <silent> ]g :tabnext<CR>
  72. nnoremap <silent> vv :vsp<CR>
  73. nnoremap <silent> ss :sp<CR>
  74.  
  75. "splitting
  76. :set splitright
  77. :set splitbelow
  78.  
  79. "add multi-line movement to jump list
  80. nnoremap <expr> k (v:count > 1 ? "m'" . v:count : '') . 'k'
  81. nnoremap <expr> j (v:count > 1 ? "m'" . v:count : '') . 'j'
  82.  
  83. "hi Normal guibg=NONE ctermbg=NONE "Transparency
  84. :set number
  85. :set relativenumber
  86. set ttimeoutlen=0 "NOTE: if this causes issues, set to 5; reduces time to esc
  87. set timeoutlen=1000
  88.  
  89. "vim-plug setup and plugins
  90. call plug#begin('~/.vim/plugged')
  91. " Settings
  92. Plug 'tpope/vim-sensible' "Sensible basic options
  93. Plug 'coot/EnchantedVim' "Persistent verymagic searches
  94.  
  95. " Basic editing
  96. Plug 'ntpeters/vim-better-whitespace' "Whitespace stripping on save
  97. Plug 'Raimondi/delimitMate' "Autocomplete parentheses, etc
  98.  
  99. " Aesthetics
  100. Plug 'mhinz/vim-signify' "Git changes displayed in gutter and statusline, faster
  101. Plug 'kshenoy/vim-signature' "Mark display
  102. Plug 'vim-airline/vim-airline' "Status line
  103. Plug 'vim-airline/vim-airline-themes' "Themes for airline
  104. Plug 'arcticicestudio/nord-vim' "Nord colorscheme
  105. Plug 'kien/rainbow_parentheses.vim' "Colorful nested parentheses
  106.  
  107. " Hotkeys (small)
  108. Plug 'scrooloose/nerdcommenter' "Enables commenting commands
  109. Plug 'tpope/vim-surround' "adds ds (delete surrounding x), cs, yss (place) commands
  110. Plug 'tpope/vim-unimpaired' "Smarter mapping pairs (]b, etc)
  111. Plug 'easymotion/vim-easymotion' "Letter-jump motion upgrades
  112. Plug 'christoomey/vim-tmux-navigator' "Navigate tabs with C-l, etc
  113. Plug 'qpkorr/vim-bufkill' "Close buffers without closing windows
  114.  
  115. " Tools (big)
  116. Plug 'scrooloose/nerdtree' "File viewer panel
  117. Plug 'tpope/vim-fugitive' "Git integration
  118. Plug 'ctrlpvim/ctrlp.vim' "Fuzzy file finder
  119. Plug 'sjl/gundo.vim' "Graphical undo tree
  120. Plug 'majutsushi/tagbar' "Displays tag data, display with <leader>b
  121. Plug 'vimwiki/vimwiki' "Personal wiki for note-taking
  122. Plug 'w0rp/ale' "Asynch linting
  123.  
  124. " Completion and snippets
  125. Plug 'ncm2/ncm2' "More powerful completion engine
  126. Plug 'Shougo/neosnippet' "Faster snippet engine
  127. Plug 'honza/vim-snippets'  "Snippet database
  128. Plug 'Shougo/neosnippet-snippets'
  129. Plug 'Shougo/neoinclude.vim' "Include autocompletion
  130. Plug 'Shougo/neco-syntax' "Syntax autocompletion
  131.  
  132. " Completion sources
  133. Plug 'ncm2/ncm2-bufword' "Words in buffer
  134. Plug 'ncm2/ncm2-path' "Path
  135. Plug 'ncm2/ncm2-tagprefix' "Tags
  136. Plug 'ncm2/ncm2-syntax' "Language syntax
  137. Plug 'ncm2/ncm2-neoinclude' "Includes
  138. Plug 'ncm2/ncm2-jedi' "Python
  139. Plug 'ncm2/ncm2-pyclang' "C/C++
  140. Plug 'ncm2/ncm2-vim' "Vimscript
  141.  
  142. " Language-specific
  143. Plug 'Shougo/neco-vim' "Vim syntax autocompletion
  144. Plug 'roxma/ncm-clang' "C/C++ autocompletion
  145. Plug 'Vimjas/vim-python-pep8-indent' "Python indentation
  146.  
  147. " Dependencies / Fixes
  148. Plug 'coot/CRDispatcher' "Utility plugin used by enchantedvim
  149. Plug 'jistr/vim-nerdtree-tabs' "Makes nerdtree work across tabs
  150. Plug 'tpope/vim-repeat' "Repetition for various plugins
  151. Plug 'xolox/vim-misc' "Dependency of easytags
  152. Plug 'xolox/vim-easytags' "Generates tag files
  153. Plug 'skywind3000/asyncrun.vim' "Asynch run shell commands; NOTE: nvim-specific
  154. Plug 'roxma/nvim-yarp' "Remote plugin framework
  155.  
  156. " Disabled
  157. " Plug 'zxqfl/tabnine-vim' "ML-sourced autocomplete: TODO: Make work with ncm2
  158. " Plug 'mileszs/ack.vim'
  159. " Plug 'maxbrunsfeld/vim-yankstack'
  160. " Plug 'ap/vim-css-color'
  161.  
  162. call plug#end()
  163.  
  164. " configure ncm2
  165. autocmd BufEnter * call ncm2#enable_for_buffer()
  166. set completeopt=noinsert,menuone,noselect
  167. " NOTE: select and use shift-k to see function documentation in python!
  168. set shortmess+=c "Remove completion menu messages
  169. let ncm2#popup_delay = 5 "make ncm2 faster
  170. " let ncm2#complete_length = [[1,1]]
  171. " let g:ncm2#matcher = 'substrfuzzy'
  172.  
  173. " Use tab to select menu
  174. inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
  175. inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
  176. inoremap <silent> <expr> <CR> (pumvisible() && empty(v:completed_item)) ?  "\<c-y>\<cr>" : "\<CR>"
  177. " integrate neosnippet
  178. imap <c-k>     <Plug>(neosnippet_expand_or_jump)
  179. vmap <c-k>     <Plug>(neosnippet_expand_or_jump)
  180. smap <c-k>     <Plug>(neosnippet_expand_or_jump)
  181.  
  182. inoremap <silent> <c-u> <c-r>=cm#sources#neosnippet#trigger_or_popup("\<Plug>(neosnippet_expand_or_jump)")<cr>
  183. vmap <c-u>     <Plug>(neosnippet_expand_target)
  184. " expand parameters
  185. let g:neosnippet#enable_completed_snippet=1
  186. " interval before computing calculation to make typing faster
  187. " let g:cm_complete_start_delay=0
  188.  
  189. " Configure neosnippet
  190. autocmd InsertLeave * NeoSnippetClearMarkers "Delete markers when we leave insert mode
  191. let g:neosnippet#snippets_directory='~/.vim/snippets'
  192.  
  193. " Configure sources
  194. let g:ncm2_pyclang#library_path = '/usr/lib'
  195.  
  196. "Gundo setup
  197. nnoremap <leader>h :GundoToggle<CR>
  198.  
  199. "Ctrlp setup
  200. let g:ctrlp_switch_buffer = 0 "Allow opening the same buffer twice
  201. " let g:ctrlp_custom_ignore = '\v(doxygen)|(\.(swp|git|gitkeep))$'
  202. if executable('rg')
  203.     set grepprg=ag\ --nogroup\ --nocolor
  204.     let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""'
  205. endif
  206.  
  207. "Git setup
  208. let g:airline#extensions#hunks#non_zero_only = 1  "Only display 'hunks' if diff is nonzero
  209.  
  210. " Signify (git diff in sign column) setup
  211. let g:signify_vcs_list = ['git']
  212. let g:signify_line_highlight = 0
  213. let g:signify_sign_change = '~'
  214. highlight clear DiffAdd "Signify colors: currently none
  215. highlight clear DiffChange
  216. highlight clear DiffDelete
  217. highlight clear SignifySignAdd
  218. highlight clear SignifySignChange
  219. highlight clear SignifySignDelete
  220.  
  221. "vim-airline setup
  222. let g:airline_powerline_fonts = 1 "Preload powerline fonts
  223. set laststatus=2 "Always show statusline
  224. let g:airline_theme='nord'
  225. let g:airline#extensions#tabline#enabled = 1
  226. let g:airline#extensions#ale#enabled = 1
  227. let g:airline#extensions#tagbar#enabled = 0
  228. let g:airline_detect_paste=0
  229.  
  230. "vim-better-whitespace setup
  231. autocmd BufEnter * EnableStripWhitespaceOnSave
  232. autocmd BufEnter * DisableWhitespace
  233.  
  234. "vim-sensible setup
  235. runtime! plugin/sensible.vim
  236.  
  237. "delimitmate setup
  238. let delimitMate_expand_cr = 1
  239. augroup mydelimitMate
  240.     au!
  241.     au FileType markdown let b:delimitMate_nesting_quotes = ["`"]
  242.     au FileType tex let b:delimitMate_quotes = ""
  243.     au FileType tex let b:delimitMate_matchpairs = "(:),{:},`:'"
  244.     au FileType python let b:delimitMate_nesting_quotes = ['"', "'"]
  245. augroup end
  246.  
  247. "nerdtree setup
  248. :map <leader>nt :NERDTreeTabsToggle<CR>
  249. let NERDTreeIgnore = ['\.pyc$', '__pycache__$[[dir]]']
  250.  
  251. "NERD commenter setup
  252. let g:NERDSpaceDelims = 1 " Space after comment delimiters
  253. let g:NERDTrimTrailingWhitespace = 1
  254. let g:NERDDefaultAlign = 'left'
  255.  
  256. " Ale setup
  257. let g:ale_lint_on_enter = 1
  258. let g:ale_lint_on_text_changed = 'always' "Set to 'never' for moar speed
  259. let g:ale_lint_on_insert_leave = 0
  260. let g:ale_lint_on_save = 1
  261. " let g:ale_set_loclist = 0
  262. " let g:ale_set_quickfix = 1
  263. let g:ale_open_list = 'never'
  264. let g:ale_list_vertical = 0
  265.  
  266. let g:ale_linters = {
  267. \   'python': ['flake8', 'prospector', 'mypy'],
  268. \   'c': ['clang', 'clangtidy', 'gcc']
  269. \}
  270.  
  271. let g:ale_echo_msg_format = '%linter%: %s'
  272.  
  273. " pylint setup
  274. let g:ale_python_pylint_options = '--rcfile /home/whillikers/.pylintrc'
  275.  
  276. " Close preview window when autocompletion is finished
  277. autocmd CompleteDone * pclose
  278.  
  279. " Continuously make latex files on save
  280. autocmd BufWritePost *.tex :AsyncRun pdflatex *.tex
  281.  
  282. "rainbowparentheses setup
  283. let g:rbpt_max = 3
  284. " au VimEnter * RainbowParenthesesToggle
  285. " au Syntax * RainbowParenthesesLoadRound
  286. " au Syntax * RainbowParenthesesLoadSquare
  287. " au Syntax * RainbowParenthesesLoadBraces
  288.  
  289. "easytags setup
  290. set tags=./tags;,~/.vimtags
  291. let g:easytags_events = ['BufReadPost', 'BufWritePost']
  292. let g:easytags_async = 1
  293. let g:easytags_dynamic_files = 2
  294. let g:easytags_resolve_links = 1
  295. let g:easytags_suppress_ctags_warning = 1
  296.  
  297. "tagbar setup
  298. nmap <silent> <leader>b :TagbarToggle<CR>
  299.  
  300. "vimwiki setup
  301. let g:vimwiki_list = [
  302.                         \{'path': '~/doc/notes/vimwiki/index.wiki'},
  303.                     \]
  304.  
  305. " C/C++ setup
  306. autocmd BufNewFile,BufRead *.h if !empty(globpath('.', '*.c')) | setlocal ft=c | endif
  307. let g:ale_c_clangtidy_checks = ['*', '-llvm-include-order', '-google-readability-todo', '-clang-diagnostic-error', '-header-filter']
  308. let g:ale_c_clang_options = '-std=c11 -Wall'
  309.  
  310. " Avoid redrawing on every entered character by turning off arabic shaping
  311. if has('arabic')
  312.     set noarabicshape
  313. endif
  314.  
  315. " Ocaml setup
  316. set wildignore+=*.cmi,*.cmo,*.dta,*.dat
  317.  
  318. "end-of-file stuff
  319. filetype plugin indent on
  320. " ## added by OPAM user-setup for vim / base ## 93ee63e278bdfc07d1139a748ed3fff2 ## you can edit, but keep this line
  321. let s:opam_share_dir = system("opam config var share")
  322. let s:opam_share_dir = substitute(s:opam_share_dir, '[\r\n]*$', '', '')
  323.  
  324. let s:opam_configuration = {}
  325.  
  326. function! OpamConfOcpIndent()
  327.   execute "set rtp^=" . s:opam_share_dir . "/ocp-indent/vim"
  328. endfunction
  329. let s:opam_configuration['ocp-indent'] = function('OpamConfOcpIndent')
  330.  
  331. function! OpamConfOcpIndex()
  332.   execute "set rtp+=" . s:opam_share_dir . "/ocp-index/vim"
  333. endfunction
  334. let s:opam_configuration['ocp-index'] = function('OpamConfOcpIndex')
  335.  
  336. function! OpamConfMerlin()
  337.   let l:dir = s:opam_share_dir . "/merlin/vim"
  338.   execute "set rtp+=" . l:dir
  339. endfunction
  340. let s:opam_configuration['merlin'] = function('OpamConfMerlin')
  341.  
  342. let s:opam_packages = ["ocp-indent", "ocp-index", "merlin"]
  343. let s:opam_check_cmdline = ["opam list --installed --short --safe --color=never"] + s:opam_packages
  344. let s:opam_available_tools = split(system(join(s:opam_check_cmdline)))
  345. for tool in s:opam_packages
  346.   " Respect package order (merlin should be after ocp-index)
  347.   if count(s:opam_available_tools, tool) > 0
  348.     call s:opam_configuration[tool]()
  349.   endif
  350. endfor
  351. " ## end of OPAM user-setup addition for vim / base ## keep this line
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement