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.

179 lines
6.2 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. set updatetime=100 " Make some plugins snappier
  69. " Turn off search highlighting with Enter
  70. nnoremap <silent> <CR> :nohlsearch<CR><CR>
  71. " Center page on search
  72. noremap n nzz
  73. noremap N Nzz
  74. noremap * *zz
  75. noremap # #zz
  76. noremap g* g*zz
  77. noremap g# g#zz
  78. " Better scrolling keys
  79. noremap <C-n> <C-e>
  80. noremap <C-p> <C-y>
  81. inoremap <C-n> <C-o><C-e>
  82. inoremap <C-p> <C-o><C-y>
  83. " Allow saving files with sudo after starting vim
  84. cmap w!! w !sudo tee > /dev/null %
  85. autocmd FileType plaintex,tex,latex syntax spell toplevel
  86. autocmd FileType plaintex,tex,latex set tw=80
  87. autocmd FileType pug,jade set tw=80
  88. autocmd FileType text set tw=80 nocindent
  89. set backspace=indent,eol,start
  90. set ruler
  91. au BufNewFile,BufRead *.cu set filetype=c
  92. au BufNewFile,BufRead *.tp set filetype=taskpaper
  93. aug python
  94. " to override ftype/python.vim
  95. au FileType python setlocal ts=4 sts=4 sw=4 noexpandtab
  96. aug end
  97. " Source a global configuration file if available
  98. if filereadable("/etc/vim/vimrc.local")
  99. source /etc/vim/vimrc.local
  100. endif
  101. syntax spell toplevel
  102. let g:tex_flavor = 'latex'
  103. function! BuildYCM(info)
  104. " info is a dictionary with 3 fields
  105. " - name: name of the plugin
  106. " - status: 'installed', 'updated', or 'unchanged'
  107. " - force: set on PlugInstall! or PlugUpdate!
  108. if a:info.status == 'installed' || a:info.force
  109. !./install.py --all
  110. endif
  111. endfunction
  112. let g:YouCompleteMeLazyLoaded = 0
  113. function! LazyLoadingYMC()
  114. if g:YouCompleteMeLazyLoaded == 0
  115. let g:YouCompleteMeLazyLoaded = 1
  116. call plug#load('YouCompleteMe') | call youcompleteme#Enable()
  117. endif
  118. endfunction
  119. autocmd BufRead * call timer_start(1, {id->execute('call LazyLoadingYMC()')} )
  120. "autocmd BufWinEnter * call timer_start(1, {id->execute('call LazyLoadingYMC()')} )
  121. "autocmd InsertEnter * call LazyLoadingYMC()
  122. "autocmd CursorHold * call LazyLoadingYMC()
  123. "autocmd CursorHoldI * call LazyLoadingYMC()
  124. call plug#begin('~/.vim/vim-plug')
  125. Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
  126. Plug 'ycm-core/YouCompleteMe', { 'do': function('BuildYCM'), 'on': [] }
  127. Plug 'lervag/vimtex'
  128. Plug 'dense-analysis/ale'
  129. Plug 'godlygeek/tabular'
  130. Plug 'airblade/vim-gitgutter'
  131. Plug 'tpope/vim-surround'
  132. Plug 'tpope/vim-unimpaired'
  133. Plug 'tpope/vim-speeddating'
  134. Plug 'tpope/vim-repeat'
  135. call plug#end()
  136. " press / instead of _
  137. nnoremap <C-_> :NERDTreeToggle<CR>
  138. nnoremap <F2> :ALEToggle<CR>
  139. nmap <silent> [W <Plug>(ale_first)
  140. nmap <silent> ]W <Plug>(ale_last)
  141. nmap <silent> [w <Plug>(ale_previous_wrap)
  142. nmap <silent> ]w <Plug>(ale_next_wrap)
  143. nmap <silent> [e <Plug>(ale_previous_wrap_error)
  144. nmap <silent> ]e <Plug>(ale_next_wrap_error)
  145. let g:ycm_autoclose_preview_window_after_insertion = 1
  146. let g:ycm_autoclose_preview_window_after_completion = 1
  147. let g:ale_enabled = 0
  148. " enable vimtex completions for YCM
  149. if !exists('g:ycm_semantic_triggers')
  150. let g:ycm_semantic_triggers = {}
  151. endif
  152. autocmd VimEnter * let g:ycm_semantic_triggers.tex=g:vimtex#re#youcompleteme