Advertisement
alaestor

[VIM] vimrc old

May 4th, 2017
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 3.80 KB | None | 0 0
  1. source $VIMRUNTIME/mswin.vim
  2. behave mswin
  3.  
  4. " In keeping with FGL standards, this vimrc favors tabs over spaces
  5. " Alaestor's _vimrc file (2017 FGL)
  6.  
  7. "CUSTOM KEY MAPS
  8. " Esc remove search highlighting
  9. " < indent {} block to the left
  10. " > indent {} block to the right
  11. " <leader>[ folds file entirely, and opens one level.
  12. " <leader>] expands all folds
  13. " <leader><backspace> removes trailing whitespace
  14. " <leader>= reindent file and remove trailing whitespace
  15. " F2 toggle error highlighting
  16. " F3 toggle viewing whitespace characters
  17. " F4 identify syntax highlighting group
  18.  
  19. "TROLL REMAPS
  20. " <leader>~ replace newlines with spaces, remove redundant whitespace
  21. " <leader>` put a space before every newline
  22.  
  23.  
  24. set nocompatible
  25. syntax on
  26. filetype plugin on
  27. filetype indent on
  28.  
  29.  
  30. "file finding (':find *.cpp' and ':b ' for buffers)
  31. set path+=** "recursive
  32. set wildmenu
  33. set ignorecase
  34. set smartcase
  35.  
  36.  
  37. "folding
  38. set mouse=a
  39. set foldcolumn=1
  40. set foldlevelstart=1 "start folded
  41. set foldnestmax=10
  42. set foldmethod=syntax "indent or manual or syntax
  43.  
  44.  
  45. "editor layout
  46. set visualbell t_vb=
  47. au GuiEnter * set visualbell t_vb=
  48. set laststatus=2
  49. set number
  50. set numberwidth=5
  51. set lazyredraw
  52. set ruler
  53. set nowrap
  54.  
  55.  
  56. "control
  57. set backspace=indent,eol,start
  58. set sc
  59.  
  60.  
  61. "matching pairs
  62. set matchpairs+=<:>
  63.  
  64.  
  65. "whitespace characters
  66. set shiftwidth=4
  67. set tabstop=4
  68.     "indenting style... I love cindent!!!
  69.     "issue: templates. +0 no indent to incomplete line. fixes, but not optimal.
  70. set cindent
  71. set cinoptions=h0,:0,=s,l1,cs,C1,(s,)50,*300,U1,Ws,m1,N-s,+0
  72.     "disable automatic comment-insertion when you newline
  73. autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
  74. set listchars=tab:>-,trail:¬,extends:>,precedes:<,eol:»,nbsp:#,space:·
  75. "set list to default on
  76.     "keybind
  77. nnoremap <F3> :set invlist<CR>
  78.  
  79.  
  80. "highlighting
  81. colorscheme FGL_custom
  82. "   errors
  83. set hlsearch
  84. let s:ehl = 0
  85. function! ToggleEH()
  86.     if s:ehl == 0
  87.         let s:ehl = 1
  88.         let w:hlWidthLimit = matchadd("ErrorMsg",'\%>79v.\+',-1)
  89.         let w:hlRedundant = matchadd("ErrorMsg",'\(\s\+$\| \+\ze\t\|\t\zs \+\)\(\%#\)\@!',-1)
  90.         let w:hlDoubleSpace = matchadd("ErrorMsg",'\ \ ',-1)
  91.     else
  92.         let s:ehl = 0
  93.         call matchdelete(w:hlWidthLimit)
  94.         call matchdelete(w:hlRedundant)
  95.         call matchdelete(w:hlDoubleSpace)
  96.     endif
  97. endfunction
  98. call ToggleEH() " to default on
  99.     "keybind
  100. nnoremap <F2> :call ToggleEH()<CR>
  101. nnoremap <F4> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
  102.  
  103.  
  104.  
  105. "keymapping utility
  106.     "unhighlight search terms
  107. nnoremap <Esc> :noh<CR><Esc>
  108.     "easily indent {} blocks from normal mode
  109. nnoremap < <Esc>viB<
  110. nnoremap > <Esc>viB>
  111.     "fold and expand
  112. nnoremap <leader>[ zMzr
  113. nnoremap <leader>] zR
  114.     "remove trailing whitespace
  115. nmap <leader><Backspace> :%s/\s\+$//e<CR>:%s/\ \ /\ /e<CR>
  116.     "reformat indent and remove trailing whitespace
  117. nnoremap <leader>= mzgg=G:%s/\s\+$//e<CR>:%s/\ \ /\ /e<CR>:noh<CR><Esc>`z
  118.     "trolly: replace newlines with spaces, remove redundant whitespace
  119. nnoremap <leader>~ :%s/\n/\ /<CR>:%s/\s\+\s/\ /<CR>:noh<CR><Esc>
  120.     "trolly: put a space before every newline
  121. nnoremap <leader>` :%s/$/\ /e<CR>:noh<CR><Esc>
  122.  
  123. "loose file definitions
  124.     "backup files
  125. set backup "nobackup
  126. set writebackup "nowritebackup
  127. set backupdir=%TMP%//
  128.     "swap file
  129. set swapfile "noswapfile
  130. set directory=%TMP%//
  131.     "undo file
  132. set undofile "noundofile
  133. set undolevels=500 "1000
  134. set undoreload=5000 "10000
  135. set undodir=%TMP%//
  136.  
  137. "useful links
  138. "https://youtu.be/XA2WjJbmmoM 'How to Do 90% of What Plugins Do'
  139. "http://vim.wikia.com/wiki/Vim_Tips_Wiki
  140. "http://vimdoc.sourceforge.net/htmldoc/indent.html#cinoptions-values
  141. "http://vimdoc.sourceforge.net/htmldoc/indent.html#cinkeys-format
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement