Эх сурвалжийг харах

Change spelling, trailing, indent and folding highlighting

Weiyi Lou 10 жил өмнө
parent
commit
59989f360a

+ 3 - 3
vim/plugins.vim

@@ -24,19 +24,17 @@ Plug 'tpope/vim-endwise'
 Plug 'tpope/vim-fugitive'
 Plug 'tpope/vim-repeat'
 Plug 'vim-pandoc/vim-pandoc'
-Plug 'vim-pandoc/vim-pandoc-syntax'
 Plug 'vim-scripts/visualrepeat'
 " }}}
 
 " Visual {{{
 Plug 'Sclarki/airline-surarken'
 Plug 'Sclarki/neonwave.vim'
+Plug 'Yggdroot/indentLine'
 Plug 'altercation/vim-colors-solarized'
 Plug 'bling/vim-airline'
 Plug 'junegunn/goyo.vim'
 Plug 'junegunn/limelight.vim'
-Plug 'kshenoy/vim-signature'
-Plug 'nathanaelkane/vim-indent-guides'
 Plug 'romainl/flattened'
 " }}}
 
@@ -76,6 +74,7 @@ Plug 'LnL7/vim-nix'
 Plug 'elzr/vim-json'
 Plug 'scrooloose/syntastic'
 Plug 'sheerun/vim-polyglot'
+Plug 'vim-pandoc/vim-pandoc-syntax'
 Plug 'vim-scripts/yaml.vim'
 " }}}
 
@@ -84,6 +83,7 @@ Plug 'vim-scripts/yaml.vim'
 "Plug 'haya14busa/incsearch.vim' - interferes with macros
 "Plug 'scrooloose/nerdtree' - moved away from drawer-style browser to netrw.
 "Plug 'terryma/vim-expand-region' - cool, but often slower than text objects.
+"Plug 'kshenoy/vim-signature' - nice, but mostly unused.
 "
 "Plug 'MarcWeber/vim-addon-mw-utils' -\
 "Plug 'ervandew/supertab' ------------|

+ 10 - 6
vim/settings/colorscheme-statusline.vim

@@ -44,12 +44,16 @@ function! SetTheme(name)
   endif
 endfunction
 
-function! MuteSpellCheckHighlights()
-  hi clear SpellBad   | hi SpellBad cterm=underline
-  " Highlights must be cleared first, or linking will fail.
-  hi clear SpellCap   | hi link SpellCap SpellBad
-  hi clear SpellLocal | hi link SpellLocal SpellBad
-  hi clear SpellRare  | hi link SpellRare SpellBad
+" General Colorscheme overrides
+autocmd ColorScheme * call CustomHighlights()
+function! CustomHighlights()
+  highlight ExtraWhitespace ctermbg=red guibg=red
+  " Mute spellcheck highlighting
+  " Highlights must be cleared first, or `link` will fail.
+  highlight clear SpellBad   | highlight SpellBad cterm=underline
+  highlight clear SpellCap   | highlight link SpellCap SpellBad
+  highlight clear SpellLocal | highlight link SpellLocal SpellBad
+  highlight clear SpellRare  | highlight link SpellRare SpellBad
 endfunction
 
 call Dark()

+ 1 - 1
vim/settings/folding.vim

@@ -48,7 +48,7 @@ if has('folding')
   " }}}
 
   " Fold Highlighting {{{
-  highlight Folded term=none cterm=none ctermfg=darkgrey ctermbg=none guifg=darkgrey guibg=none
+  "highlight Folded term=none cterm=none ctermfg=darkgrey ctermbg=none guifg=darkgrey guibg=none
   " }}}
 
   " Fold Text {{{

+ 16 - 18
vim/settings/white_space.vim

@@ -1,22 +1,20 @@
-" Remove trailing spaces before save
-if has("autocmd")
-  " Are there really any files we care about that Need trailing white space?
-  "autocmd FileType c,cpp,java,go,php,javascript,python,twig,xml,yml
-  autocmd BufWritePre * call StripTrailingWhitespace()
-
-  function! StripTrailingWhitespace()
-    " Preparation: save last search, and cursor position.
-    let _s=@/
-    let l = line(".")
-    let c = col(".")
-    " do the business:
-    %s/\s\+$//e
-    " clean up: restore previous search history, and cursor position
-    let @/=_s
-    call cursor(l, c)
-  endfunction
+" Highlight trailing whitespace, except where still typing
+autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
+autocmd InsertLeave * match ExtraWhitespace /\s\+$/
 
-endif
+" Remove trailing spaces before save
+autocmd BufWritePre * call StripTrailingWhitespace()
+function! StripTrailingWhitespace()
+  " Save last search, and cursor position.
+  let _s=@/
+  let l = line(".")
+  let c = col(".")
+  " Do it.
+  %s/\s\+$//e
+  " Restore previous search history, and cursor position
+  let @/=_s
+  call cursor(l, c)
+endfunction
 
 " Add extra lines up and down
 nnoremap <Leader>j o<Esc>k

+ 1 - 1
vim/vimrc

@@ -48,7 +48,7 @@ set sidescrolloff=10
 set linebreak                  " Break on words when wrapping.
 
 set list
-set listchars=tab:>\ ,trail:_,extends:#,nbsp:#
+set listchars=tab:>\ ,extends:#,nbsp:#
 
 " Persistent undo is great!
 if has('persistent_undo')