llvm.org GIT mirror llvm / d30103d
Improve the vim code for highlighting trailing whitespace and lines longer than 80 columns. This replaces the heavy-handed "textwidth" mechanism, and makes the trailing-whitespace highlighting lazy so that it isn't constantly jumping on the user during typing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97267 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 9 years ago
1 changed file(s) with 25 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
99 " It's VIM, not VI
1010 set nocompatible
1111
12 " Wrap text at 80 cols
13 set textwidth=80
14
1512 " A tab produces a 2-space indentation
1613 set softtabstop=2
1714 set shiftwidth=2
1815 set expandtab
1916
20 " Highlight trailing whitespace
17 " Highlight trailing whitespace and lines longer than 80 columns.
18 highlight LongLine ctermbg=DarkYellow guibg=DarkYellow
2119 highlight WhitespaceEOL ctermbg=DarkYellow guibg=DarkYellow
22 match WhitespaceEOL /\s\+$/
20 if v:version >= 702
21 " Lines longer than 80 columns.
22 au BufWinEnter * let w:m0=matchadd('LongLine', '\%>80v.\+', -1)
23
24 " Whitespace at the end of a line. This little dance suppresses
25 " of whitespace that has just been typed.
26 au BufWinEnter * let w:m1=matchadd('WhitespaceEOL', '\s\+$', -1)
27 au InsertEnter * call matchdelete(w:m1)
28 au InsertEnter * let w:m2=matchadd('WhitespaceEOL', '\s\+\%#\@
29 au InsertLeave * call matchdelete(w:m2)
30 au InsertLeave * let w:m1=matchadd('WhitespaceEOL', '\s\+$', -1)
31 else
32 au BufRead,BufNewFile * syntax match LongLine /\%>80v.\+/
33 au InsertEnter * syntax match WhitespaceEOL /\s\+\%#\@
34 au InsertLeave * syntax match WhitespaceEOL /\s\+$/
35 endif
2336
2437 " Enable filetype detection
2538 filetype on
6982 augroup filetype
7083 au! BufRead,BufNewFile *.td set filetype=tablegen
7184 augroup END
85
86 " Additional vim features to optionally uncomment.
87 "set showcmd
88 "set showmatch
89 "set showmode
90 "set incsearch
91 "set ruler