1 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2 " Multi-version vimrc compatible with version 4 and above. vim:set fdm=marker:
3 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5 " Note that "if <condition> | call Something() | endif" syntax is unsupported
6 " in Vim 4 so we write all our functions out the long way. It does work in
7 " autocommand definitions, however.
9 " Vim 4 complains if version isn't set in the configuration file.
12 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
13 " Handle options safe to use in version 4. Vim 4 parses but ignores the
14 " "if version" syntax used later in this file so we don't use it. No attempt
15 " is made to make this configuration compatible with Vim 3.
16 " Some of these settings should strictly be wrapped inside "if has()" blocks
17 " but that would cause them not to be ignored by Vim 4.
18 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
20 " No compatibility mode.
25 " And use spaces not tabs.
27 " And << and >> indent by 2.
29 " Backspace deletes full tab width at the start of a line.
32 " Allow backspace to delete before start of line.
35 " Don't jump to the start of the line when using H, L etc.
40 " Show partial commands in the ruler.
42 " And always show the status line.
47 se cinkeys=0{,0},0),:,!^F,o,O,e
53 " Don't be bugged by messages at the bottom of the screen.
59 " Case-insensitive search.
61 " But override by typing capitals.
64 " Look for ctags in home directory first.
65 se tags=~/.tags,./tags,tags
67 " Don't timeout waiting to interpet, eg, <ESC>OA as an escape code.
70 " Use ^B to search backward when completing.
72 " Use ^L to show matching completions but don't select one.
73 inoremap <C-l> <C-n><C-p>
81 if (has("win32") || has("win64")) && version >= "504"
82 se rtp=~/.vim,$VIMRUNTIME
85 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
86 " Handle options only available in Vim 5 and above.
87 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
88 if version >= "500" "{{{1
91 " Tell Vim we use dark backgrounds in our terminals.
92 if ! has("gui_running")
96 " Allow mouse use in a terminal but only if it can work.
97 if has("xterm_clipboard")
101 " Update more quickly. For use with sign highlighting as polling for
102 " CursorMove makes redrawing slow.
107 " Enable tab-completion prompting for commands.
110 " Don't list object files when globbing files to load.
111 se wildignore+=*.o,*.obj
112 " So there's no need to assign them low priority.
113 se suffixes-=*.o,*.obj
116 " Save sessions in UNIX format with / as file separator. This is
122 " How often do we need to use ^A/^X on octals?
125 " Nuke any pre-existing autocommands.
140 " Save the current window dimensions so we can restore them when we quit.
141 if ! exists("g:oldcols")
142 let g:oldcols=&columns
144 if ! exists("g:oldlines")
145 let g:oldlines=&lines
148 " More GUI options. Add icon and tearoffs.
154 " Allow dynamic window resize even if we aren't in an xterm.
155 se t_WS=
\e[8;%p1%d;%p2%dt
157 " Highlight search results.
158 if has("extra_search")
162 " Syntax highlighting. New versions will use syn enable instead.
167 if has("user_commands")
174 " Forget the Ex mode mapping.
178 " Position the compview plugin window.
179 au Display BufEnter -SearchResults- set buftype=nowrite | set nonumber | wincmd J
183 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
184 " Handle options only available in Vim 5.2 and above.
185 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
186 if version >= "502" "{{{1
189 " Helper to initialise a variable.
190 fun! Prep_Var(var, value) "{{{2
194 exe "let " . a:var . "=" . a:value
197 " Set up our variables.
198 fun! Iain_Vars() "{{{2
199 call Prep_Var("w:iainlist", 0)
200 call Prep_Var("b:iainhex", 0)
201 call Prep_Var("b:iainverbose", 0)
202 " Window Flags: (F)ocused, (I)nsert mode, Cursor (H)old.
203 call Prep_Var("b:iainstatus", "'Fih'")
204 call Prep_Var("g:iainextracolumnsnumber", "''")
205 call Prep_Var("g:iainextracolumnslist", "''")
206 call Prep_Var("b:iaincul", 0)
208 call Prep_Var("g:marksigns", 0)
209 call Prep_Var("g:firstsign", 100)
211 call Prep_Var("g:resizable", "''")
214 " Show the window title.
215 fun! Show_TitleString() "{{{2
219 " Vim 5 doesn't have printf.
222 let l:ts1=" " . l:ts1
224 let l:ts1=l:ts1 . ": " . expand('%t')
226 let l:ts1=l:ts1 . " (" . getcwd() . ")"
227 if has("clientserver")
228 let l:ts1=l:ts1 . " " . v:servername
233 " Toggle case-sensitivity.
234 fun! Invert_Case() "{{{2
238 " Can we resize this window?
239 fun! Can_Resize() "{{{2
242 if g:resizable == "0" || g:resizable == "1"
246 " Do we KNOW we can(not) resize?
247 if has("gui_running")
249 elseif $RESIZABLE == &term
251 elseif $RESIZABLE == "0"
254 " Assume we can. Allow overriding.
260 " Grow or shrink the window width.
261 fun! Resize_Columns(op, ...) "{{{2
271 " Vim 5 hardcodes the size of numbers column to 8.
272 if version >= "700" && has("linebreak")
273 let l:columns = &numberwidth
281 exe "let l:resize=" . &columns . a:op . l:columns
282 let l:resize = "se columns=" . l:resize
284 " HACK: Inside screen there is an extra line for the status bar. Vim
285 " manages the resize by sending an escape sequence to set the number of
286 " lines and number of columns in one action. To do this it will first query
287 " the number of lines and then set <same number of lines> by <new number of
288 " columns>. Because of the extra line for the status bar this results in
289 " the real terminal being shrunk by a line. We ask for the terminal to grow
290 " by a line so it ends up actually being the same.
291 if &term =~ '^screen'
292 let l:resize = l:resize . " lines=" . (&lines + 1)
298 " Grow or shrink the window height.
299 fun! Resize_Lines(op, lines) "{{{2
308 exe "let l:resize=" . &lines . a:op . a:lines
309 if &term =~ '^screen'
310 let l:resize = l:resize + 1
312 let l:resize = "se lines=" . l:resize
317 " Set extra columns depending on window status.
318 fun! Extra_Columns(extra, var, ...) "{{{2
319 " Vim 6 doesn't have winnr("$"). Determine which windows are open
320 " ourselves by using :windo to incremement a counter. As Vim 5
321 " doesn't have :windo we require Vim 6 for this.
329 " Remember which window we're in.
330 let l:winnr = winnr()
331 let l:num_windows = 0
332 windo let l:num_windows = l:num_windows + 1
333 " Switch back to the window we were in.
334 exe l:winnr . "wincmd w"
341 let l:condition = a:1
347 while l:n < l:num_windows
348 " If window w exists then getwinvar(w, "&modified") will be 0 or 1.
349 if getwinvar(l:i, "&modified") =~ '^\d'
353 exe "if getwinvar(" . l:i . ", '" . a:var . "') " . l:condition . " | let l:val = 1 | endif"
355 exe "let l:windows = '" . l:windows . ":" . l:i . "'"
361 let l:extra = "g:iainextracolumns" . a:extra
362 exe "let l:val = " . l:extra
363 exe "let " . l:extra . " = '" . l:windows . "'"
365 if l:windows == l:val
376 " Toggle number display.
377 fun! Number(resize) "{{{2
379 let &number = ! &number
381 " Ensure we keep track of any extra columns even if we aren't resizing.
382 " This prevents confusion when number is set at startup.
383 let l:extra = Extra_Columns("number", "&number")
386 call Resize_Columns(l:extra)
390 " Restore window size.
391 if has("autocmd") && ! has("gui_running")
392 au Display VimLeave * if exists("g:oldcols") | call Resize_Columns("-", (&columns - g:oldcols)) | endif
393 au Display VimLeave * if exists("g:oldlines") | call Resize_Lines("-", (&lines - g:oldlines)) | endif
398 au Mode BufEnter * if &ft == "make" | call MakeMode_map() | endif
399 au Mode BufLeave * if &ft == "make" | call MakeMode_unmap() | endif
402 " Entering Make mode.
403 fun! MakeMode_map() "{{{2
412 fun! MakeMode_unmap() "{{{2
418 " Function to create mappings with either a hardcoded \ or <Leader>.
419 fun! Mapping(keysequence,mapping) "{{{2
421 exec "map \\" . a:keysequence . " " . a:mapping
423 exec "map <Leader>" . a:keysequence . " " . a:mapping
427 " Use - and = to create underlines.
428 call Mapping("-", "yyp:s/./-/g<RETURN>:let @/=''<RETURN>:<RETURN>")
429 call Mapping("=", "yyp:s/./=/g<RETURN>:let @/=''<RETURN>:<RETURN>")
431 " Change to ts=2 with \2.
432 call Mapping("2", ":se ts=2<CR>:<CR>")
433 " Change to ts=4 with \4.
434 call Mapping("4", ":se ts=4<CR>:<CR>")
435 " Change to ts=8 with \8.
436 call Mapping("8", ":se ts=8<CR>:<CR>")
437 " Change to ts=16 with \6.
438 call Mapping("6", ":se ts=16<CR>:<CR>")
439 " Change to ts=32 with \3.
440 call Mapping("3", ":se ts=32<CR>:<CR>")
441 " Toggle paste mode with \p.
442 call Mapping("p", ":se paste!<CR>:<CR>")
443 " Swap case-sensitivity with \c.
444 call Mapping("C", ":call Invert_Case()<CR>:<CR>")
445 " Change number mode with \n.
446 call Mapping("n", ":call Number(1)<CR>:<CR>")
447 " Expand or shrink window size with \> and \<.
448 call Mapping(">", ":call Resize_Columns('+')<CR>:<CR>")
449 call Mapping("<", ":call Resize_Columns('-')<CR>:<CR>")
450 " Clear search pattern with \/.
451 call Mapping("/", ":let @/=\"\"<CR>:<CR>")
453 " Set graphical window title.
454 if has("win32") || has("win64")
455 " Windows taskbar entries are probably too small to show full titles.
458 se titlestring=%{Show_TitleString()}
461 " Vim tip 99: What's the highlighting group under the cursor?
462 call Mapping("h", ":echo \"hi<\" . synIDattr(synID(line(\".\"),col(\".\"),1),\"name\") . '> trans<' . synIDattr(synID(line(\".\"),col(\".\"),0),\"name\") . \"> lo<\" . synIDattr(synIDtrans(synID(line(\".\"),col(\".\"),1)),\"name\") . \">\"<CR>")
464 fun! Uncluttered_Buffer() "{{{2
465 if exists("uncluttered_buffer")
466 if uncluttered_buffer == 1
485 if &ft == 'gitcommit'
492 fun! Startup_Resize() "{{{2
495 " Resize for numbers.
497 if version >= "700" && has("linebreak")
498 let l:columns = &numberwidth
508 let l:columns = l:columns + 2
513 if g:oldcols < (80 + l:columns)
514 call Resize_Columns("+", l:columns)
518 " Change status bar colour when various things happen.
519 " Flags: H/h: Cursor held/moved.
520 " F/f: Focus gained/lost.
521 " I/i: Insert mode entered/left.
522 fun! Highlight_StatusLine(flag) "{{{2
523 if ! has("statusline")
526 " Get current status.
529 " Change the status based on the flag. XXX: Does Vim let us to do flags?
532 let b:iainstatus = substitute(b:iainstatus, a:flag, a:flag, "")
535 let l:normalcolour = "darkblue"
536 let l:editingcolour = "darkmagenta"
537 let l:warningcolour = "darkred"
538 let l:readonlycolour = "red"
541 let l:colour = l:normalcolour
542 " Maybe override depending on status.
543 if b:iainstatus =~# "H"
544 if b:iainstatus =~# "I"
545 " Held in insert mode. Add extra highlight if we don't have focus.
546 if b:iainstatus =~# "f"
547 let l:colour = l:warningcolour
549 let l:colour = l:editingcolour
553 if b:iainstatus =~# "I"
554 " Regular insert mode.
555 let l:colour = l:editingcolour
559 " Override again if readonly.
560 if l:colour != l:normalcolour
561 if getbufvar("", "&ro")
562 let l:colour = l:readonlycolour
566 let l:termcolour = Iain_Colour(l:colour)
568 exec "highlight StatusLine gui=none term=none cterm=none guifg=white guibg=" . l:colour . " ctermfg=white ctermbg=" . l:termcolour
569 exec "highlight User1 gui=bold term=bold cterm=bold guifg=white guibg=" . l:colour . " ctermfg=white ctermbg=" . l:termcolour
572 fun! Iain_Colour(colour) "{{{2
574 if a:colour == "darkblue"
576 elseif a:colour == "darkmagenta"
578 elseif a:colour == "darkred"
580 elseif a:colour == "red"
584 if a:colour == "darkblue"
586 elseif a:colour == "darkmagenta"
588 elseif a:colour == "darkred"
590 elseif a:colour == "red"
599 au StatusLine VimEnter * call Highlight_StatusLine("")
601 " Show numbers by default.
602 au Display VimEnter * if ! Uncluttered_Buffer() | call Number(0) | endif
606 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
607 " Handle options only available in Vim 5.4 and above.
608 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
609 if version >= "504" "{{{1
612 " Helper for status line.
613 " Show space, underscore or dollar sign depending on list mode.
614 fun! Show_List() "{{{2
619 elseif <SID>Has_Unicode()
636 " Helper for status line.
637 " Show c or C to denote case-sensitivity.
638 fun! Show_Case() "{{{2
646 " Helper for status line.
647 " Show the size of the tabstop.
648 fun! Show_Tabstop() "{{{2
652 " Helper for status line.
653 " Show p when paste mode is on.
654 fun! Show_Paste() "{{{2
662 " Show the status line.
663 fun! Show_StatusLine() "{{{2
664 if ! has("statusline")
668 let l:sl1='%2n\:\ %<%1*%f%0*\ [%{Show_List()}%{Show_Case()}%{Show_Tabstop()}%{Show_Paste()}%Y%M%R]\ '
669 let l:sl3='L:%1*%4.6l%0*/%-4.6L\ C:%1*%3.6c%0*\ \|\ %P'
672 let l:hexformat='0\x%02B'
675 let l:sl1=l:sl1 . v:version . '\ %='
676 let l:sl2=l:hexformat . '\ \|\ P:%4.6o\ '
678 let l:sl1=l:sl1 . '%='
681 exec "set statusline=" . l:sl1 . l:sl2 . l:sl3
684 " Show the status line for the first time.
685 call Show_StatusLine()
688 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
689 " Handle options only available in Vim 6 and above.
690 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
691 if version >= "600" "{{{1
698 " Remember quickfix state.
703 " Set indenting by filetype.
706 " Less intrusive syntax highlighting.
712 if has("gui_running")
713 if has("win32") || has("win64")
714 exe "silent se guifont=DejaVu_Sans_Mono:h10:cANSI"
716 exe "silent se guifont=DejaVu\\ Sans\\ Mono\\ 10"
719 if has("gui_running") || &t_Co > 16
720 exe "silent colo iain"
723 " Ignore whitespace when diffing.
725 se diffopt=filler,iwhite
730 " Remember that we are opening the quickfix window.
731 au Mode BufWinEnter quickfix let g:quickfixing=1
732 au Mode BufUnload * if &ft == "qf" | let g:quickfixing=0 | endif
735 " Allow in-place editing of crontabs.
736 au Mode FileType crontab set backupcopy=yes
739 " Make * and # work the way you expect in visual mode.
740 vnoremap * y/\V<C-R>=substitute(escape(@@,"/\\"),"\n","\\\\n","ge")<CR><CR>
741 vnoremap # y?\V<C-R>=substitute(escape(@@,"?\\"),"\n","\\\\n","ge")<CR><CR>
743 " Set mark and update highlighting.
745 au Signs BufReadPost * call <SID>Highlight_Signs()
746 au Signs CursorHold * call <SID>Highlight_Signs()
749 " Helper to set buffer variable for a given sign.
750 fun! <SID>Prep_Sign(sign) "{{{2
751 if ! exists("b:sign" . a:sign) || ! g:marksigns
752 exe "let b:sign" . a:sign . "=0"
756 fun! <SID>Place_Sign(number, line, old, name) "{{{2
761 exe "sign unplace " . (g:firstsign + a:number) . " buffer=" . bufnr("")
762 " Don't place the sign if it would conflict with the last change sign.
763 exe "sign place " . (g:firstsign + a:number) . " line=" . a:line . " name=" . a:name . " buffer=" . bufnr("")
767 fun! <SID>Highlight_Signs(...) "{{{2
768 if ! has("signs") || ! g:marksigns || Uncluttered_Buffer()
772 let l:signs = g:iainsigns
775 while strlen(l:signs)
776 let l:sign = matchstr(l:signs, '^[A-Za-z]\+\(:.\)*[.=-][^ ]\+')
778 let l:name = substitute(l:sign, '[:.=-].*', "", "")
779 let l:var = tolower(l:name)
780 let l:sign = substitute(l:sign, '^[A-Za-z]\+', "", "")
781 let l:ascii = matchstr(l:sign, '^:.')
782 let l:mark = substitute(l:sign, '^\(:.\)*[.=-]', "", "")
784 let l:ascii = substitute(l:ascii, '^:', "", "")
788 let l:ascii = substitute(l:ascii, '"', '\\"', "")
790 call <SID>Prep_Sign(l:var)
791 exe "let " . l:var . " = <SID>Place_Sign(" . l:i . ", line(\"'" . l:ascii . "\"), b:sign" . l:var . ", \"Mark" . l:name . "\")"
794 let l:signs = substitute(l:signs, '^[^ ]\+ *', "", "")
799 fun! <SID>Cycle_Signs(resize) "{{{2
804 let g:marksigns = ! g:marksigns
806 " Retrofit arrays on to Vim 6.
807 if ! exists("g:iainsigns")
808 " Signs are defined in g:iainsigns. The syntax is as follows:
810 " Sign ::= Name (':' Mark)* Type Symbol
811 " Type ::= '=' | '-' | '.'
813 " Signs with Type '=' will be highlighted with the MarkSign group.
814 " Signs with Type '-' will be highlighted with the MarkLine group.
815 " Signs with Type '.' will be highlighted with the MarkDot group.
816 " Define the Mark where Symbol is not also the mark name, eg "']".
817 if <SID>Has_Unicode()
818 let g:iainsigns = "Dash:'=’ Dot:..• Quote:\"=” Caret:^.ʌ"
820 let g:iainsigns = "Dash=' Dot:..* Quote=\" Caret.^"
822 let g:iainsigns = g:iainsigns . " Less=< Greater=> Left=( Right=) SquareLeft=[ SquareRight=] BraceLeft={ BraceRight=} a-a b-b c-c d-d e-e f-f A-A B-B C-C D-D E-E F-F"
826 " Signs to highlight marks.
827 " Syntax won't work properly in Vim 6.
828 let l:signs = g:iainsigns
830 while strlen(l:signs)
831 let l:sign = matchstr(l:signs, '^[A-Za-z]\+\(:.\)*[.=-][^ ]\+')
833 let l:sign = substitute(l:sign, ':.', "", "")
834 let l:sign = substitute(l:sign, '=', " texthl=MarkSign text=", "")
835 let l:sign = substitute(l:sign, '\.', " texthl=MarkDot text=", "")
836 let l:sign = substitute(l:sign, '-', " texthl=MarkLine linehl=MarkLine text=", "")
838 exe "sign define Mark" . l:sign
840 let l:signs = substitute(l:signs, '^[^ ]\+ *', "", "")
844 call Resize_Columns("+", 2)
846 call <SID>Highlight_Signs()
850 exe "sign unplace " . (g:firstsign + l:i)
854 let l:signs = g:iainsigns
856 while strlen(l:signs)
857 let l:sign = matchstr(l:signs, '^[A-Za-z]\+')
859 exe "sign undefine Mark" . l:sign
860 call <SID>Prep_Sign(tolower(l:sign))
861 let l:signs = substitute(l:signs, '^[^ ]\+ *', "", "")
865 call Resize_Columns("-", 2)
870 " Do we have Unicode?
871 fun! <SID>Has_Unicode() "{{{2
872 if ! has('multi_byte')
880 if &tenc =~? '^u\(tf\|cs\)'
884 if ! strlen(&tenc) && &enc =~? '^u\(tf\|cs\)'
892 fun! Cycle_List() "{{{2
893 " Pretty UTF-8 listchars.
894 if <SID>Has_Unicode()
895 let basic='tab:»·,trail:…,extends:«,precedes:»'
898 let basic=basic . ',nbsp:•'
901 let basic='tab:\\_,trail:_,extends:<,precedes:>'
904 let basic=basic . ',nbsp:+'
908 let w:iainlist = w:iainlist + 1
914 elseif w:iainlist == 1
915 exec "setlocal lcs=" . basic
918 exec "setlocal lcs=" . basic . "," . eol
922 call Resize_Columns(Extra_Columns("list", "iainlist", " == 2"), 1)
925 " Cycle between hex and decimal display of toolbar stuff.
926 fun! Cycle_HexStatusLine() "{{{2
928 let b:iainhex = ! b:iainhex
929 call Show_StatusLine()
932 " Cycle verbose display of toolbar stuff.
933 fun! Cycle_VerboseStatusLine() "{{{2
935 let b:iainverbose = ! b:iainverbose
936 call Show_StatusLine()
939 " Toggle quickfix window.
940 fun! Cycle_Quickfix() "{{{2
944 if g:quickfixing == 1
952 " Swap hex/decimal statusline with \x.
953 call Mapping("x", ":call Cycle_HexStatusLine()<CR>:<CR>")
954 " Change statusline verbosity with \v.
955 call Mapping("V", ":call Cycle_VerboseStatusLine()<CR>:<CR>")
956 " Cycle list styles with \l.
957 call Mapping("l", ":call Cycle_List()<CR>:<CR>")
958 " Toggle tags with \t.
959 call Mapping("t", ":Tlist<CR>")
960 " Change foldmethod with \f.
961 call Mapping("f", ":se foldenable!<CR>:<CR>")
962 " Toggle quickfix window with \q.
963 call Mapping("q", ":call Cycle_Quickfix()<CR>:<CR>")
964 " Rerun filetype detection with \s. The s is for syntax, as this will be
965 " updated as a side-effect.
966 call Mapping("S", ":filetype detect<CR>:<CR>")
967 " Toggle marks with \m.
968 call Mapping("m", ":call <SID>Cycle_Signs(1)<CR>:<CR>")
971 " Show signs by default.
972 au Display VimEnter * call <SID>Cycle_Signs(0)
976 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
977 " Handle options only available in Vim 7 and above.
978 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
979 if version >= "700" "{{{1
982 " Helper to show tab name.
983 fun! <SID>TabName(label, gui) "{{{2
984 let l:label = a:label
986 let l:label = "No Name"
988 let l:label = "[" . l:label . "]"
991 let l:label = fnamemodify(l:label, ":t")
992 if strlen(l:label) >= 18
993 let l:label = l:label[0:17] . ".."
999 " Find out if any buffer was modified.
1000 fun! <SID>TabModified(buflist) "{{{2
1002 while l:i < len(a:buflist)
1003 if getbufvar(a:buflist[l:i], "&modified") == 1
1012 fun! Show_TabLine() "{{{2
1013 let l:s = "%#TabLineFill#Tabs:"
1016 while l:i < tabpagenr("$")
1019 let l:buflist = tabpagebuflist(l:i)
1020 let l:winnr = tabpagewinnr(l:i)
1021 let l:n = tabpagewinnr(l:i, "$")
1022 let l:label = <SID>TabName(bufname(l:buflist[l:winnr - 1]), 0)
1023 let l:modified = <SID>TabModified(l:buflist)
1025 " Choose highlighting.
1026 if l:i == tabpagenr()
1027 let l:s .= "%#TabLineSel#[" . l:n . l:modified . " " . l:label . "]"
1029 let l:s .= "%#TabLine# " . l:n . l:modified . " " . l:label . " "
1034 let l:s .= "%#TabLine#%T"
1038 " Per tab label for the GUI.
1039 fun! Show_GUITabLine() "{{{2
1040 let l:buflist = tabpagebuflist(v:lnum)
1041 let l:winnr = tabpagewinnr(v:lnum)
1042 let l:s = tabpagewinnr(v:lnum, "$")
1043 let l:label = <SID>TabName(bufname(l:buflist[l:winnr - 1]), 1)
1044 let l:modified = <SID>TabModified(l:buflist)
1046 let l:s .= l:modified . " " . l:label
1050 " Toggle highlighting cursor line when focus changes.
1051 fun! <SID>ToggleCursorLine() "{{{2
1054 if b:iainstatus =~# "f" && b:iainstatus =~# "H" && b:iainstatus =~# "I"
1055 " Focus lost while held in insert mode.
1056 let b:iaincul = getbufvar("", "&cursorline")
1059 setlocal nocursorline
1064 se tabline=%!Show_TabLine()
1065 se guitablabel=%!Show_GUITabLine()
1069 au StatusLine CursorHoldI * call Highlight_StatusLine("H")
1070 au StatusLine CursorMovedI * call Highlight_StatusLine("h")
1071 au StatusLine FocusGained * call Highlight_StatusLine("F")
1072 au StatusLine FocusLost * call Highlight_StatusLine("f")
1073 au StatusLine InsertEnter * call Highlight_StatusLine("I")
1074 au StatusLine InsertLeave * call Highlight_StatusLine("i")
1077 au Display FocusGained,FocusLost * call <SID>ToggleCursorLine()
1081 au Signs InsertEnter * call <SID>Highlight_Signs()
1082 au Signs InsertLeave * call <SID>Highlight_Signs()
1086 " Limit the size of the popup menu when completing.
1087 if has("insert_expand")
1091 " Make diffs vertical by default.
1093 se diffopt+=vertical
1096 " Set size of numbers column.
1101 " Add "previous tab" mapping as gb.
1102 map gb :tabprevious<CR>:<CR>
1105 if has("gui_macvim")
1109 " Yet more GUI options. Add tabs.
1115 let g:p4EnableMenu=1
1116 let g:p4Presets='P4CONFIG'
1119 let g:bufExplorerShowRelativePath=1
1120 let g:bufExplorerSplitOutPathName=0
1123 " Resize after startup.
1124 if version >= "500" "{{{1
1126 au Display VimEnter * call Startup_Resize()