CLI config/dotfiles
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.

177 lines
6.1 KiB

  1. " All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
  2. " /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
  3. " you can find below. If you wish to change any of those settings, you should
  4. " do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
  5. " everytime an upgrade of the vim packages is performed. It is recommended to
  6. " make changes after sourcing debian.vim since it alters the value of the
  7. " 'compatible' option.
  8. " Uncomment the next line to make Vim more Vi-compatible
  9. " NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
  10. " options, so any other options should be set AFTER setting 'compatible'.
  11. "set compatible
  12. " Vim5 and later versions support syntax highlighting. Uncommenting the
  13. " following enables syntax highlighting by default.
  14. if has("syntax")
  15. set t_Co=256
  16. syntax on
  17. " Uncomment the following 'let' lines if using xter16 color scheme
  18. " Select colormap: 'soft', 'softlight', 'standard', or 'allblue'
  19. let xterm16_colormap = 'allblue'
  20. " Select brightness: 'low', 'med', 'high', 'default', or custom levels
  21. let xterm16_brightness = 'high'
  22. "Other override options:
  23. let xterm16fg_Cursor = '555'
  24. let xterm16bg_Normal = 'none'
  25. "Set color scheme
  26. colorscheme xterm16
  27. endif
  28. " If using a dark background within the editing area and syntax highlighting
  29. " turn on this option as well
  30. set background=dark
  31. " Uncomment the following to have Vim jump to the last position when
  32. " reopening a file
  33. if has("autocmd")
  34. au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
  35. endif
  36. " Uncomment the following to have Vim load indentation rules and plugins
  37. " according to the detected filetype.
  38. if has("autocmd")
  39. filetype plugin indent on
  40. endif
  41. " The following are commented out as they cause vim to behave a lot
  42. " differently from regular Vi. They are highly recommended though.
  43. set showcmd " Show (partial) command in status line.
  44. set showmatch " Show matching brackets.
  45. set ignorecase " Do case insensitive matching
  46. set smartcase " Do smart case matching
  47. "set incsearch " Incremental search
  48. "set autowrite " Automatically save before commands like :next and :make
  49. "set hidden " Hide buffers when they are abandoned
  50. set mouse=a " Enable mouse usage (all modes)
  51. "set nohlsearch " Turn off search highlighting
  52. set hlsearch " Turn on search highlighting
  53. "set expandtab " Turn tabs to spaces
  54. set shiftwidth=4 " Auto-indent amount when using cindent, <<, >>, etc.
  55. set softtabstop=4 " How many spaces represent a tab
  56. set tabstop=4 " Real tab size
  57. set autoindent " Indent level of new line set by previous line
  58. "set smartindent " Attempt to intelligently guess level of indent for new line
  59. set cindent " Attempt to intelligently guess level of indent for new line
  60. set cinkeys-=0# " Don't un-indent comments
  61. set indentkeys-=0# " Don't un-indent comments
  62. set nf=octal,hex,alpha " additional ctrl-a increments
  63. set spell spelllang=en_us " Set spell check language
  64. set scrolloff=5 " Add visible lines beyond cursor at top or bottom of window
  65. set linebreak " Soft wrap whole words together
  66. set breakindent " Indent linebreaks to match
  67. set showbreak=\ \ \ ⇲ " Visual linebreak indicator
  68. " Turn off search highlighting with Enter
  69. nnoremap <silent> <CR> :nohlsearch<CR><CR>
  70. " Center page on search
  71. noremap n nzz
  72. noremap N Nzz
  73. noremap * *zz
  74. noremap # #zz
  75. noremap g* g*zz
  76. noremap g# g#zz
  77. " Better scrolling keys
  78. noremap <C-n> <C-e>
  79. noremap <C-p> <C-y>
  80. inoremap <C-n> <C-o><C-e>
  81. inoremap <C-p> <C-o><C-y>
  82. " Allow saving files with sudo after starting vim
  83. cmap w!! w !sudo tee > /dev/null %
  84. autocmd FileType plaintex,tex,latex syntax spell toplevel
  85. autocmd FileType plaintex,tex,latex set tw=80
  86. autocmd FileType pug,jade set tw=80
  87. autocmd FileType text set tw=80 nocindent
  88. set backspace=indent,eol,start
  89. set ruler
  90. au BufNewFile,BufRead *.cu set filetype=c
  91. au BufNewFile,BufRead *.tp set filetype=taskpaper
  92. aug python
  93. " to override ftype/python.vim
  94. au FileType python setlocal ts=4 sts=4 sw=4 noexpandtab
  95. aug end
  96. " Source a global configuration file if available
  97. if filereadable("/etc/vim/vimrc.local")
  98. source /etc/vim/vimrc.local
  99. endif
  100. syntax spell toplevel
  101. let g:tex_flavor = 'latex'
  102. function! BuildYCM(info)
  103. " info is a dictionary with 3 fields
  104. " - name: name of the plugin
  105. " - status: 'installed', 'updated', or 'unchanged'
  106. " - force: set on PlugInstall! or PlugUpdate!
  107. if a:info.status == 'installed' || a:info.force
  108. !./install.py --all
  109. endif
  110. endfunction
  111. let g:YouCompleteMeLazyLoaded = 0
  112. function! LazyLoadingYMC()
  113. if g:YouCompleteMeLazyLoaded == 0
  114. let g:YouCompleteMeLazyLoaded = 1
  115. call plug#load('YouCompleteMe') | call youcompleteme#Enable()
  116. endif
  117. endfunction
  118. autocmd BufRead * call timer_start(1, {id->execute('call LazyLoadingYMC()')} )
  119. "autocmd BufWinEnter * call timer_start(1, {id->execute('call LazyLoadingYMC()')} )
  120. "autocmd InsertEnter * call LazyLoadingYMC()
  121. "autocmd CursorHold * call LazyLoadingYMC()
  122. "autocmd CursorHoldI * call LazyLoadingYMC()
  123. call plug#begin('~/.vim/vim-plug')
  124. Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
  125. Plug 'ycm-core/YouCompleteMe', { 'do': function('BuildYCM'), 'on': [] }
  126. Plug 'lervag/vimtex'
  127. Plug 'dense-analysis/ale'
  128. Plug 'godlygeek/tabular'
  129. Plug 'tpope/vim-surround'
  130. Plug 'tpope/vim-unimpaired'
  131. Plug 'tpope/vim-speeddating'
  132. Plug 'tpope/vim-repeat'
  133. call plug#end()
  134. " press / instead of _
  135. nnoremap <C-_> :NERDTreeToggle<CR>
  136. nnoremap <F2> :ALEToggle<CR>
  137. nmap <silent> [W <Plug>(ale_first)
  138. nmap <silent> ]W <Plug>(ale_last)
  139. nmap <silent> [w <Plug>(ale_previous_wrap)
  140. nmap <silent> ]w <Plug>(ale_next_wrap)
  141. nmap <silent> [e <Plug>(ale_previous_wrap_error)
  142. nmap <silent> ]e <Plug>(ale_next_wrap_error)
  143. let g:ycm_autoclose_preview_window_after_insertion = 1
  144. let g:ycm_autoclose_preview_window_after_completion = 1
  145. let g:ale_enabled = 0
  146. " enable vimtex completions for YCM
  147. if !exists('g:ycm_semantic_triggers')
  148. let g:ycm_semantic_triggers = {}
  149. endif
  150. autocmd VimEnter * let g:ycm_semantic_triggers.tex=g:vimtex#re#youcompleteme