14 set listchars=tab:>·,trail:¤
28 " set format textwidth so that the text fits in a 80 columns window
31 " Command line completion
32 set wildmode=list:longest,full
45 set cinkeys=0{,0},!^F,o,O,e " default is: 0{,0},0),:,0#,!^F,o,O,e
50 " Use TAB key in normal mode to switch buffers
52 nnoremap <S-TAB> <C-W>W
54 " use ² (square) two switch between alternate buffer
57 " These settings are from http://clavier-dvorak.org/wiki/Utilisateur:Kaze/vimrc
58 " but a little customized
59 " I need another Esc key
62 inoremap <S-Tab> <Tab>
63 vnoremap <S-Tab> <Tab>
64 inoremap <S-Return> <Esc>
65 vnoremap <S-Return> <Esc>
66 inoremap <M-Return> <Esc>
67 vnoremap <M-Return> <Esc>
71 noremap <S-Space> <C-d>
74 map <F10> :set paste<CR>
75 map <F9> :set nopaste<CR>
76 imap <F10> <C-O>:set paste<CR>
80 nnoremap <Leader>q :.,$g/^/ normal@
81 vnoremap <Leader>q :g/^/ normal@
83 nnoremap <Leader>g :noau vim /
\x12\x17/ ./**/*
88 if has( "gui_running" )
91 set guifont=ProggySquareTT\ 12
94 " color scheme for the console
99 " settings for idutils.vim plugin
100 let g:IGlidcmd="D:\\gnu\\bin\\lid.exe -R grep"
101 nnoremap <Leader>l :IDGrep
\x12\x17<CR>
103 "return '[\s]' if trailing white space is detected
105 function! StatuslineTrailingSpaceWarning()
106 if !exists("b:statusline_trailing_space_warning")
107 if search('\s\+$', 'nw') != 0
108 let b:statusline_trailing_space_warning = '[\s]'
110 let b:statusline_trailing_space_warning = ''
113 return b:statusline_trailing_space_warning
116 "return '[&et]' if &et is set wrong
117 "return '[mixed-indenting]' if spaces and tabs are used to indent
118 "return an empty string if everything is fine
119 function! StatuslineTabWarning()
120 if !exists("b:statusline_tab_warning")
121 let tabs = search('^\t', 'nw') != 0
122 let spaces = search('^ ', 'nw') != 0
125 let b:statusline_tab_warning = '[mixed-indenting]'
126 elseif (spaces && !&et) || (tabs && &et)
127 let b:statusline_tab_warning = '[&et]'
129 let b:statusline_tab_warning = ''
132 return b:statusline_tab_warning
135 "return a warning for "long lines" where "long" is either &textwidth or 80 (if
136 "no &textwidth is set)
138 "return '' if no long lines
139 "return '[#x,my,$z] if long lines are found, were x is the number of long
140 "lines, y is the median length of the long lines and z is the length of the
142 function! StatuslineLongLineWarning()
143 if !exists("b:statusline_long_line_warning")
144 let long_line_lens = s:LongLines()
146 if len(long_line_lens) > 0
147 let b:statusline_long_line_warning = "[" .
148 \ '#' . len(long_line_lens) . "," .
149 \ 'm' . s:Median(long_line_lens) . "," .
150 \ '$' . max(long_line_lens) . "]"
152 let b:statusline_long_line_warning = ""
155 return b:statusline_long_line_warning
158 "return a list containing the lengths of the long lines in this buffer
159 function! s:LongLines()
160 let threshold = (&tw ? &tw : 80)
161 let spaces = repeat(" ", &ts)
163 let long_line_lens = []
167 let len = strlen(substitute(getline(i), '\t', spaces, 'g'))
169 call add(long_line_lens, len)
174 return long_line_lens
177 "find the median of the given array of numbers
178 function! s:Median(nums)
179 let nums = sort(a:nums)
186 return (nums[l/2] + nums[(l/2)-1]) / 2
193 set statusline=%f "tail of the filename
195 "display a warning if fileformat isnt unix
196 set statusline+=%#warningmsg#
197 set statusline+=%{&ff!='unix'?'['.&ff.']':''}
200 "display a warning if file encoding isnt utf-8
201 set statusline+=%#warningmsg#
202 set statusline+=%{(&fenc!='utf-8'&&&fenc!='')?'['.&fenc.']':''}
205 set statusline+=%h "help file flag
206 set statusline+=%y "filetype
207 set statusline+=%r "read only flag
208 set statusline+=%m "modified flag
210 "display a warning if &et is wrong, or we have mixed-indenting
211 set statusline+=%#error#
212 set statusline+=%{StatuslineTabWarning()}
215 set statusline+=%{StatuslineTrailingSpaceWarning()}
217 set statusline+=%#warningmsg#
220 "display a warning if &paste is set
221 set statusline+=%#error#
222 set statusline+=%{&paste?'[paste]':''}
225 set statusline+=%= "left/right separator
226 set statusline+=%{StatuslineCurrentHighlight()}\ \ "current highlight
227 set statusline+=%c, "cursor column
228 set statusline+=%l/%L "cursor line/total lines
229 set statusline+=\ %P "percent through file
230 set laststatus=2 " Always show status line
232 "return the syntax highlight group under the cursor ''
233 function! StatuslineCurrentHighlight()
234 let name = synIDattr(synID(line('.'),col('.'),1),'name')
238 return '[' . name . ']'
242 "recalculate the trailing whitespace warning when idle, and after saving
243 autocmd cursorhold,bufwritepost * unlet! b:statusline_trailing_space_warning