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.

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