1 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2 " Multi-version vimrc compatible with version 4 and above.
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 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
17 " No compatibility mode.
22 se rtp=~/.vim,$VIMRUNTIME
27 " And use spaces not tabs.
29 " And << and >> indent by 2.
31 " Backspace deletes full tab width at the start of a line.
34 " Allow backspace to delete before start of line.
37 " Don't jump to the start of the line when using H, L etc.
42 " Show partial commands in the ruler.
44 " And always show the status line.
49 se cinkeys=0{,0},0),:,!^F,o,O,e
55 " Don't be bugged by messages at the bottom of the screen.
61 " Case-insensitive search.
63 " But override by typing capitals.
66 " Look for ctags in home directory first.
67 se tags=~/.tags,./tags,tags
69 " Don't timeout waiting to interpet, eg, <ESC>OA as an escape code.
72 " Use ^B to search backward when completing.
74 " Use ^L to show matching completions but don't select one.
75 inoremap <C-l> <C-n><C-p>
81 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
82 " Handle options only available in Vim 5 and above.
83 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
87 " Tell Vim we use dark backgrounds in our terminals.
88 if ! has("gui_running")
92 " Allow mouse use in a terminal but only if it can work.
93 if has("xterm_clipboard")
97 " Update more quickly. For use with sign highlighting as polling for
98 " CursorMove makes redrawing slow.
103 " Enable tab-completion prompting for commands.
105 " Don't list object files when globbing files to load.
106 se wildignore+=*.o,*.obj
107 " So there's no need to assign them low priority.
108 se suffixes-=*.o,*.obj
110 " Save sessions in UNIX format with / as file separator. This is
114 " How often do we need to use ^A/^X on octals?
117 " Nuke any pre-existing autocommands.
130 " Save the current window width so we can restore it when we quit.
131 if ! exists("g:oldcols")
132 let g:oldcols=&columns
135 " More GUI options. Add icon and tearoffs.
139 " Allow dynamic window resize even if we aren't in an xterm.
140 se t_WS=
\e[8;%p1%d;%p2%dt
142 " Highlight search results.
145 " Set graphical window title.
146 se titlestring=%{Show_TitleString()}
148 " Syntax highlighting. New versions will use syn enable instead.
158 " Set up our variables.
160 if ! exists("b:iainlist")
163 if ! exists("b:iainhex")
166 if ! exists("b:iainverbose")
167 let b:iainverbose = 0
169 if ! exists("b:iainstatus")
170 " Window Flags: (F)ocused, (I)nsert mode, Cursor (H)old.
171 let b:iainstatus = "Fih"
173 if ! exists("g:iainextracolumns")
174 let g:iainextracolumns = 0
177 if ! exists("g:marksigns")
180 if ! exists("g:firstsign")
181 let g:firstsign = 100
186 " Helper for status line.
187 " Show space, underscore or dollar sign depending on list mode.
193 elseif b:iainlist == 1
202 " Helper for status line.
203 " Show c or C to denote case-sensitivity.
212 " Helper for status line.
213 " Show the size of the tabstop.
218 " Helper for status line.
219 " Show p when paste mode is on.
228 " Show the window title.
229 fun! Show_TitleString()
233 " Vim 5 doesn't have printf.
236 let l:ts1=" " . l:ts1
238 let l:ts1=l:ts1 . ": " . expand('%t')
240 let l:ts1=l:ts1 . " (" . getcwd() . ")"
241 if has("clientserver")
242 let l:ts1=l:ts1 . " " . v:servername
247 " Show the status line.
248 fun! Show_StatusLine()
250 let l:sl1='%2n\:\ %<%f\ [%{Show_List()}%{Show_Case()}%{Show_Tabstop()}%{Show_Paste()}%Y%M%R]\ %='
251 let l:sl3='L:%4.6l/%-4.6L\ C:%3.6c\ \|\ %P'
254 let l:hexformat='0\x%02B'
257 let l:sl2=l:hexformat . '\ \|\ P:%4.6o\ '
261 exec "set statusline=" . l:sl1 . l:sl2 . l:sl3
264 " Toggle case-sensitivity.
269 " Grow or shrink the window size.
270 fun! Resize_Columns(op, ...)
272 " Vim 5 hardcodes the size of numbers column to 8.
274 let l:columns = &numberwidth
282 exe "let l:resize=" . &columns . a:op . l:columns
283 let l:resize = "se columns=" . l:resize
285 " HACK: Inside screen there is an extra line for the status bar. Vim
286 " manages the resize by sending an escape sequence to set the number of
287 " lines and number of columns in one action. To do this it will first query
288 " the number of lines and then set <same number of lines> by <new number of
289 " columns>. Because of the extra line for the status bar this results in
290 " the real terminal being shrunk by a line. We ask for the terminal to grow
291 " by a line so it ends up actually being the same.
292 if &term =~ '^screen'
293 let l:resize = l:resize . " lines=" . (&lines + 1)
299 " Toggle number display.
302 let &number = ! &number
306 let l:num_numbers = 0
307 while l:i <= winnr("$")
308 if getwinvar(l:i, "&number") == 1
309 let l:num_numbers = l:num_numbers + 1
314 if l:num_numbers == 0
315 let g:iainextracolumns = 0
317 call Resize_Columns("-")
319 elseif g:iainextracolumns == 0
320 let g:iainextracolumns = 1
322 call Resize_Columns("+")
328 " Restore window size.
329 au Display VimLeave * if exists("g:oldcols") | call Resize_Columns("-", (&columns - g:oldcols)) | endif
332 au Mode BufEnter * if &ft == "make" | call MakeMode_map() | endif
333 au Mode BufLeave * if &ft == "make" | call MakeMode_unmap() | endif
335 " Entering Make mode.
345 fun! MakeMode_unmap()
351 " Show the status line for the first time.
352 call Show_StatusLine()
354 " Function to create mappings with either a hardcoded \ or <Leader>.
355 fun! Mapping(keysequence,mapping)
357 exec "map \\" . a:keysequence . " " . a:mapping
359 exec "map <Leader>" . a:keysequence . " " . a:mapping
363 " Use - and = to create underlines.
364 call Mapping("-", "yyp:s/./-/g<RETURN>:let @/=''<RETURN>:<RETURN>")
365 call Mapping("=", "yyp:s/./=/g<RETURN>:let @/=''<RETURN>:<RETURN>")
367 " Change to ts=2 with \2.
368 call Mapping("2", ":se ts=2<CR>:<CR>")
369 " Change to ts=4 with \4.
370 call Mapping("4", ":se ts=4<CR>:<CR>")
371 " Change to ts=8 with \8.
372 call Mapping("8", ":se ts=8<CR>:<CR>")
373 " Change to ts=16 with \6.
374 call Mapping("6", ":se ts=16<CR>:<CR>")
375 " Change to ts=32 with \3.
376 call Mapping("3", ":se ts=32<CR>:<CR>")
377 " Toggle paste mode with \p.
378 call Mapping("p", ":se paste!<CR>:<CR>")
379 " Swap case-sensitivity with \c.
380 call Mapping("c", ":call Invert_Case()<CR>:<CR>")
381 " Change number mode with \n.
382 call Mapping("n", ":call Number(1)<CR>:<CR>")
383 " Expand or shrink window size with \> and \<.
384 call Mapping(">", ":call Resize_Columns('+')<CR>:<CR>")
385 call Mapping("<", ":call Resize_Columns('-')<CR>:<CR>")
386 " Clear search pattern with \/.
387 call Mapping("/", ":let @/=\"\"<CR>:<CR>")
389 " Forget the Ex mode mapping.
392 " Vim tip 99: What's the highlighting group under the cursor?
393 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>")
395 fun! Uncluttered_Buffer()
396 if exists("uncluttered_buffer")
397 if uncluttered_buffer == 1
416 if &ft == 'gitcommit'
423 fun! Startup_Resize()
426 " Resize for numbers.
429 let l:columns = &numberwidth
439 let l:columns = l:columns + 2
444 if g:oldcols < (80 + l:columns)
445 call Resize_Columns("+", l:columns)
449 " Show numbers by default.
450 au Display VimEnter * if ! Uncluttered_Buffer() | call Number(0) | endif
452 " Position the compview plugin window.
453 au Display BufEnter -SearchResults- set buftype=nowrite | set nonumber | wincmd J
456 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
457 " Handle options only available in Vim 6 and above.
458 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
466 " Remember quickfix state.
469 " Set indenting by filetype.
472 " Less intrusive syntax highlighting.
476 if has("gui_running")
479 se guifont=DejaVu_Sans_Mono:h10:cANSI
481 se guifont=DejaVu\ Sans\ Mono\ 10
486 if has("gui_running") || &t_Co > 16
493 " Ignore whitespace when diffing.
494 se diffopt=filler,iwhite
496 " Expand window when doing a vertical diff.
499 let &columns = &columns * 2
503 " Remember that we are opening the quickfix window.
504 au Mode BufWinEnter quickfix let g:quickfixing=1
505 au Mode BufUnload * if &ft == "qf" | let g:quickfixing=0 | endif
507 " Allow in-place editing of crontabs.
508 au Mode FileType crontab set backupcopy=yes
510 " Make * and # work the way you expect in visual mode.
511 vnoremap * y/\V<C-R>=substitute(escape(@@,"/\\"),"\n","\\\\n","ge")<CR><CR>
512 vnoremap # y?\V<C-R>=substitute(escape(@@,"?\\"),"\n","\\\\n","ge")<CR><CR>
514 " Set mark and update highlighting.
516 au Signs BufEnter * call <SID>Highlight_Signs()
517 au Signs CursorHold * call <SID>Highlight_Signs()
520 fun! <SID>Prep_Signs()
521 if ! exists("b:signdot") || ! g:marksigns
524 if ! exists("b:signdash") || ! g:marksigns
527 if ! exists("b:signquote") || ! g:marksigns
530 if ! exists("b:signcaret") || ! g:marksigns
533 if ! exists("b:signless") || ! g:marksigns
536 if ! exists("b:signgreater") || ! g:marksigns
539 if ! exists("b:signleft") || ! g:marksigns
542 if ! exists("b:signright") || ! g:marksigns
545 if ! exists("b:signsquareleft") || ! g:marksigns
546 let b:signsquareleft=0
548 if ! exists("b:signsquareright") || ! g:marksigns
549 let b:signsquareright=0
551 if ! exists("b:signbraceleft") || ! g:marksigns
552 let b:signbraceleft=0
554 if ! exists("b:signbraceright") || ! g:marksigns
555 let b:signbraceright=0
557 if ! exists("b:signa") || ! g:marksigns
560 if ! exists("b:signb") || ! g:marksigns
563 if ! exists("b:signc") || ! g:marksigns
566 if ! exists("b:signd") || ! g:marksigns
569 if ! exists("b:signe") || ! g:marksigns
572 if ! exists("b:signf") || ! g:marksigns
575 if ! exists("b:signA") || ! g:marksigns
578 if ! exists("b:signB") || ! g:marksigns
581 if ! exists("b:signC") || ! g:marksigns
584 if ! exists("b:signD") || ! g:marksigns
587 if ! exists("b:signE") || ! g:marksigns
590 if ! exists("b:signF") || ! g:marksigns
595 fun! <SID>Place_Sign(number, line, old, name)
600 exe "sign unplace " . (g:firstsign + a:number) . " buffer=" . bufnr("")
601 " Don't place the sign if it would conflict with the last change sign.
602 exe "sign place " . (g:firstsign + a:number) . " line=" . a:line . " name=" . a:name . " buffer=" . bufnr("")
606 fun! <SID>Highlight_Signs(...)
607 if ! has("signs") || ! g:marksigns || Uncluttered_Buffer()
611 call <SID>Prep_Signs()
613 let b:signdot = <SID>Place_Sign(0, line("'."), b:signdot, "MarkDot")
614 let b:signdash = <SID>Place_Sign(1, line("''"), b:signdash, "MarkDash")
615 let b:signquote = <SID>Place_Sign(2, line("'\""), b:signquote, "MarkQuote")
616 let b:signcaret = <SID>Place_Sign(3, line("'^"), b:signcaret, "MarkCaret")
617 let b:signless = <SID>Place_Sign(4, line("'<"), b:signless, "MarkLess")
618 let b:signgreater = <SID>Place_Sign(5, line("'>"), b:signgreater, "MarkGreater")
619 let b:signleft = <SID>Place_Sign(6, line("'("), b:signleft, "MarkLeft")
620 let b:signright = <SID>Place_Sign(7, line("')"), b:signright, "MarkRight")
621 let b:signsquareleft = <SID>Place_Sign(8, line("'["), b:signsquareleft, "MarkSquareLeft")
622 let b:signsquareright = <SID>Place_Sign(9, line("']"), b:signsquareright, "MarkSquareRight")
623 let b:signbraceleft = <SID>Place_Sign(10, line("'{"), b:signbraceleft, "MarkBraceLeft")
624 let b:signbraceright = <SID>Place_Sign(11, line("'}"), b:signbraceright, "MarkBraceRight")
626 let b:signa = <SID>Place_Sign(12, line("'a"), b:signa, "Marka")
627 let b:signb = <SID>Place_Sign(13, line("'b"), b:signb, "Markb")
628 let b:signc = <SID>Place_Sign(15, line("'c"), b:signc, "Markc")
629 let b:signd = <SID>Place_Sign(16, line("'d"), b:signd, "Markd")
630 let b:signe = <SID>Place_Sign(17, line("'e"), b:signe, "Marke")
631 let b:signf = <SID>Place_Sign(18, line("'f"), b:signf, "Markf")
632 let b:signA = <SID>Place_Sign(19, line("'A"), b:signA, "MarkA")
633 let b:signB = <SID>Place_Sign(20, line("'B"), b:signB, "MarkB")
634 let b:signC = <SID>Place_Sign(21, line("'C"), b:signC, "MarkC")
635 let b:signD = <SID>Place_Sign(22, line("'D"), b:signD, "MarkD")
636 let b:signE = <SID>Place_Sign(23, line("'E"), b:signE, "MarkE")
637 let b:signF = <SID>Place_Sign(24, line("'F"), b:signF, "MarkF")
641 fun! <SID>Cycle_Signs(resize)
646 let g:marksigns = ! g:marksigns
649 " Signs to highlight marks.
650 " Syntax won't work properly in Vim 6.
651 if <SID>Has_Unicode()
652 sign define MarkDash text=’ texthl=MarkSign
653 sign define MarkDot text=• texthl=MarkDot
654 sign define MarkQuote text=” texthl=MarkSign
656 sign define MarkDash text=' texthl=MarkSign
657 sign define MarkDot text=* texthl=MarkDot
658 sign define MarkQuote text=" texthl=MarkSign
660 sign define MarkCaret text=^ texthl=MarkDot
661 sign define MarkLess text=< texthl=MarkSign
662 sign define MarkGreater text=> texthl=MarkSign
663 sign define MarkLeft text=( texthl=MarkSign
664 sign define MarkRight text=) texthl=MarkSign
665 sign define MarkSquareLeft text=[ texthl=MarkSign
666 sign define MarkSquareRight text=] texthl=MarkSign
667 sign define MarkBraceLeft text={ texthl=MarkSign
668 sign define MarkBraceRight text=} texthl=MarkSign
669 sign define Marka text=a texthl=MarkSign linehl=MarkLine
670 sign define Markb text=b texthl=MarkSign linehl=MarkLine
671 sign define Markc text=c texthl=MarkSign linehl=MarkLine
672 sign define Markd text=d texthl=MarkSign linehl=MarkLine
673 sign define Marke text=e texthl=MarkSign linehl=MarkLine
674 sign define Markf text=f texthl=MarkSign linehl=MarkLine
675 sign define MarkA text=A texthl=MarkSign linehl=MarkLine
676 sign define MarkB text=B texthl=MarkSign linehl=MarkLine
677 sign define MarkC text=C texthl=MarkSign linehl=MarkLine
678 sign define MarkD text=D texthl=MarkSign linehl=MarkLine
679 sign define MarkE text=E texthl=MarkSign linehl=MarkLine
680 sign define MarkF text=F texthl=MarkSign linehl=MarkLine
683 call Resize_Columns("+", 2)
685 call <SID>Highlight_Signs()
687 exe "sign unplace " . (g:firstsign + 0)
688 exe "sign unplace " . (g:firstsign + 1)
689 exe "sign unplace " . (g:firstsign + 2)
690 exe "sign unplace " . (g:firstsign + 3)
691 exe "sign unplace " . (g:firstsign + 4)
692 exe "sign unplace " . (g:firstsign + 5)
693 exe "sign unplace " . (g:firstsign + 6)
694 exe "sign unplace " . (g:firstsign + 7)
695 exe "sign unplace " . (g:firstsign + 8)
696 exe "sign unplace " . (g:firstsign + 9)
697 exe "sign unplace " . (g:firstsign + 10)
698 exe "sign unplace " . (g:firstsign + 11)
699 exe "sign unplace " . (g:firstsign + 12)
700 exe "sign unplace " . (g:firstsign + 13)
701 exe "sign unplace " . (g:firstsign + 14)
702 exe "sign unplace " . (g:firstsign + 15)
703 exe "sign unplace " . (g:firstsign + 16)
704 exe "sign unplace " . (g:firstsign + 17)
705 exe "sign unplace " . (g:firstsign + 18)
706 exe "sign unplace " . (g:firstsign + 19)
707 exe "sign unplace " . (g:firstsign + 20)
708 exe "sign unplace " . (g:firstsign + 21)
709 exe "sign unplace " . (g:firstsign + 22)
710 exe "sign unplace " . (g:firstsign + 23)
711 exe "sign unplace " . (g:firstsign + 24)
713 sign undefine MarkDash
714 sign undefine MarkDot
715 sign undefine MarkQuote
716 sign undefine MarkCaret
717 sign undefine MarkLess
718 sign undefine MarkGreater
719 sign undefine MarkLeft
720 sign undefine MarkRight
721 sign undefine MarkSquareLeft
722 sign undefine MarkSquareRight
723 sign undefine MarkBraceLeft
724 sign undefine MarkBraceRight
738 call <SID>Prep_Signs()
740 call Resize_Columns("-", 2)
745 fun! <SID>Has_Unicode()
746 if ! has('multi_byte')
754 if &tenc =~? '^u\(tf\|cs\)'
758 if ! strlen(&tenc) && &enc =~? '^u\(tf\|cs\)'
767 " Pretty UTF-8 listchars.
768 if <SID>Has_Unicode()
769 let basic='tab:»·,trail:…,extends:«,precedes:»'
772 let basic=basic . ',nbsp:•'
775 let basic='tab:\\_,trail:_,extends:<,precedes:>'
778 let basic=basic . ',nbsp:+'
782 let b:iainlist = b:iainlist + 1
784 call Resize_Columns("-", 1)
789 elseif b:iainlist == 1
790 exec "set lcs=" . basic
793 call Resize_Columns("+", 1)
794 exec "set lcs=" . basic . "," . eol
799 " Cycle between hex and decimal display of toolbar stuff.
800 fun! Cycle_HexStatusLine()
802 let b:iainhex = ! b:iainhex
803 call Show_StatusLine()
806 " Cycle verbose display of toolbar stuff.
807 fun! Cycle_VerboseStatusLine()
809 let b:iainverbose = ! b:iainverbose
810 call Show_StatusLine()
813 " Toggle quickfix window.
814 fun! Cycle_Quickfix()
815 if g:quickfixing == 1
823 " Swap hex/decimal statusline with \x.
824 call Mapping("x", ":call Cycle_HexStatusLine()<CR>:<CR>")
825 " Change statusline verbosity with \v.
826 call Mapping("v", ":call Cycle_VerboseStatusLine()<CR>:<CR>")
827 " Cycle list styles with \l.
828 call Mapping("l", ":call Cycle_List()<CR>:<CR>")
829 " Toggle tags with \t.
830 call Mapping("t", ":Tlist<CR>")
831 " Change foldmethod with \f.
832 call Mapping("f", ":se foldenable!<CR>:<CR>")
833 " Toggle quickfix window with \q.
834 call Mapping("q", ":call Cycle_Quickfix()<CR>:<CR>")
835 " Rerun filetype detection with \s. The s is for syntax, as this will be
836 " updated as a side-effect.
837 call Mapping("s", ":filetype detect<CR>:<CR>")
838 " Toggle marks with \m.
839 call Mapping("m", ":call <SID>Cycle_Signs(1)<CR>:<CR>")
841 fun! <SID>Iain_Colour(colour)
843 if a:colour == "darkblue"
845 elseif a:colour == "darkmagenta"
847 elseif a:colour == "darkred"
849 elseif a:colour == "red"
853 if a:colour == "darkblue"
855 elseif a:colour == "darkmagenta"
857 elseif a:colour == "darkred"
859 elseif a:colour == "red"
867 " Change status bar colour when various things happen.
868 " Flags: H/h: Cursor held/moved.
869 " F/f: Focus gained/lost.
870 " I/i: Insert mode entered/left.
871 fun! Highlight_StatusLine(flag)
872 " Get current status.
875 " Change the status based on the flag. XXX: Does Vim let us to do flags?
876 let re = "[" . tolower(a:flag) . toupper(a:flag) . "]"
877 let b:iainstatus = substitute(b:iainstatus, re, a:flag, "")
879 let l:normalcolour = "darkblue"
880 let l:editingcolour = "darkmagenta"
881 let l:warningcolour = "darkred"
882 let l:readonlycolour = "red"
885 let l:colour = l:normalcolour
886 " Maybe override depending on status.
887 if b:iainstatus =~# "H"
888 if b:iainstatus =~# "I"
889 " Held in insert mode. Add extra highlight if we don't have focus.
890 if b:iainstatus =~# "f"
891 let l:colour = l:warningcolour
893 let l:colour = l:editingcolour
897 if b:iainstatus =~# "I"
898 " Regular insert mode.
899 let l:colour = l:editingcolour
903 " Override again if readonly.
904 if l:colour != l:normalcolour
905 if getbufvar("", "&ro")
906 let l:colour = l:readonlycolour
910 let l:termcolour = <SID>Iain_Colour(l:colour)
912 exec "highlight StatusLine gui=bold term=bold cterm=bold guifg=white guibg=" . l:colour . " ctermfg=white ctermbg=" . l:termcolour
915 au Display VimEnter * call Highlight_StatusLine("")
917 " Show signs by default.
918 au Display VimEnter * call <SID>Cycle_Signs(0)
921 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
922 " Handle options only available in Vim 7 and above.
923 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
927 " Helper to show tab name.
928 fun! <SID>TabName(label, gui)
929 let l:label = a:label
931 let l:label = "No Name"
933 let l:label = "[" . l:label . "]"
936 let l:label = fnamemodify(l:label, ":t")
937 if strlen(l:label) >= 18
938 let l:label = l:label[0:17] . ".."
944 " Find out if any buffer was modified.
945 fun! <SID>TabModified(buflist)
947 while l:i < len(a:buflist)
948 if getbufvar(a:buflist[l:i], "&modified") == 1
958 let l:s = "%#TabLineFill#Tabs:"
961 while l:i < tabpagenr("$")
964 let l:buflist = tabpagebuflist(l:i)
965 let l:winnr = tabpagewinnr(l:i)
966 let l:n = tabpagewinnr(l:i, "$")
967 let l:label = <SID>TabName(bufname(l:buflist[l:winnr - 1]), 0)
968 let l:modified = <SID>TabModified(l:buflist)
970 " Choose highlighting.
971 if l:i == tabpagenr()
972 let l:s .= "%#TabLineSel#[" . l:n . l:modified . " " . l:label . "]"
974 let l:s .= "%#TabLine# " . l:n . l:modified . " " . l:label . " "
979 let l:s .= "%#TabLine#%T"
983 " Per tab label for the GUI.
984 fun! Show_GUITabLine()
985 let l:buflist = tabpagebuflist(v:lnum)
986 let l:winnr = tabpagewinnr(v:lnum)
987 let l:s = tabpagewinnr(v:lnum, "$")
988 let l:label = <SID>TabName(bufname(l:buflist[l:winnr - 1]), 1)
989 let l:modified = <SID>TabModified(l:buflist)
991 let l:s .= l:modified . " " . l:label
995 se tabline=%!Show_TabLine()
996 se guitablabel=%!Show_GUITabLine()
998 au StatusLine CursorHoldI * call Highlight_StatusLine("H")
999 au StatusLine CursorMovedI * call Highlight_StatusLine("h")
1000 au StatusLine FocusGained * call Highlight_StatusLine("F")
1001 au StatusLine FocusLost * call Highlight_StatusLine("f")
1002 au StatusLine InsertEnter * call Highlight_StatusLine("I")
1003 au StatusLine InsertLeave * call Highlight_StatusLine("i")
1006 au Signs InsertEnter * call <SID>Highlight_Signs()
1007 au Signs InsertLeave * call <SID>Highlight_Signs()
1010 " Limit the size of the popup menu when completing.
1013 " Make diffs vertical by default.
1014 se diffopt+=vertical
1016 " Set size of numbers column.
1019 " Add "previous tab" mapping as gb.
1020 map gb :tabprevious<CR>:<CR>
1023 if has("gui_macvim")
1027 " Yet more GUI options. Add tabs.
1031 let g:p4EnableMenu=1
1032 let g:p4Presets='P4CONFIG'
1036 " Resize after startup.
1037 au Display VimEnter * call Startup_Resize()