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.

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