" Show the status line.
fun! Show_StatusLine() "{{{2
call Iain_Vars()
- let l:sl1='%2n\:\ %<%f\ [%{Show_List()}%{Show_Case()}%{Show_Tabstop()}%{Show_Paste()}%Y%M%R]\ '
- let l:sl3='L:%4.6l/%-4.6L\ C:%3.6c\ \|\ %P'
+ let l:sl1='%2n\:\ %<%1*%f%0*\ [%{Show_List()}%{Show_Case()}%{Show_Tabstop()}%{Show_Paste()}%Y%M%R]\ '
+ let l:sl3='L:%1*%4.6l%0*/%-4.6L\ C:%1*%3.6c%0*\ \|\ %P'
let l:hexformat='%b'
if b:iainhex
let l:hexformat='0\x%02B'
endif
endfun "}}}2
+" Change status bar colour when various things happen.
+" Flags: H/h: Cursor held/moved.
+" F/f: Focus gained/lost.
+" I/i: Insert mode entered/left.
+fun! Highlight_StatusLine(flag) "{{{2
+ " Get current status.
+ call Iain_Vars()
+
+ " Change the status based on the flag. XXX: Does Vim let us to do flags?
+ let l:ic = &ic
+ set ic
+ let b:iainstatus = substitute(b:iainstatus, a:flag, a:flag, "")
+ let &ic = l:ic
+
+ let l:normalcolour = "darkblue"
+ let l:editingcolour = "darkmagenta"
+ let l:warningcolour = "darkred"
+ let l:readonlycolour = "red"
+
+ " Default colour.
+ let l:colour = l:normalcolour
+ " Maybe override depending on status.
+ if b:iainstatus =~# "H"
+ if b:iainstatus =~# "I"
+ " Held in insert mode. Add extra highlight if we don't have focus.
+ if b:iainstatus =~# "f"
+ let l:colour = l:warningcolour
+ else
+ let l:colour = l:editingcolour
+ endif
+ endif
+ else
+ if b:iainstatus =~# "I"
+ " Regular insert mode.
+ let l:colour = l:editingcolour
+ endif
+ endif
+
+ " Override again if readonly.
+ if l:colour != l:normalcolour
+ if getbufvar("", "&ro")
+ let l:colour = l:readonlycolour
+ endif
+ endif
+
+ let l:termcolour = Iain_Colour(l:colour)
+
+ exec "highlight StatusLine gui=none term=none cterm=none guifg=white guibg=" . l:colour . " ctermfg=white ctermbg=" . l:termcolour
+ exec "highlight User1 gui=bold term=bold cterm=bold guifg=white guibg=" . l:colour . " ctermfg=white ctermbg=" . l:termcolour
+endfun "}}}2
+
+fun! Iain_Colour(colour) "{{{2
+ if &t_Co == 88
+ if a:colour == "darkblue"
+ return 17
+ elseif a:colour == "darkmagenta"
+ return 33
+ elseif a:colour == "darkred"
+ return 32
+ elseif a:colour == "red"
+ return 64
+ endif
+ elseif &t_Co == 256
+ if a:colour == "darkblue"
+ return 17
+ elseif a:colour == "darkmagenta"
+ return 90
+ elseif a:colour == "darkred"
+ return 88
+ elseif a:colour == "red"
+ return 196
+ endif
+ else
+ return a:colour
+ endif
+endfun "}}}2
+
+au StatusLine VimEnter * call Highlight_StatusLine("")
+
" Show numbers by default.
au Display VimEnter * if ! Uncluttered_Buffer() | call Number(0) | endif
sign define MarkDash text=’ texthl=MarkSign
sign define MarkDot text=• texthl=MarkDot
sign define MarkQuote text=” texthl=MarkSign
+ sign define MarkCaret text=ʌ texthl=MarkDot
else
sign define MarkDash text=' texthl=MarkSign
sign define MarkDot text=* texthl=MarkDot
sign define MarkQuote text=" texthl=MarkSign
+ sign define MarkCaret text=^ texthl=MarkDot
endif
- sign define MarkCaret text=^ texthl=MarkDot
sign define MarkLess text=< texthl=MarkSign
sign define MarkGreater text=> texthl=MarkSign
sign define MarkLeft text=( texthl=MarkSign
" Toggle marks with \m.
call Mapping("m", ":call <SID>Cycle_Signs(1)<CR>:<CR>")
-fun! <SID>Iain_Colour(colour) "{{{2
- if &t_Co == 88
- if a:colour == "darkblue"
- return 17
- elseif a:colour == "darkmagenta"
- return 33
- elseif a:colour == "darkred"
- return 32
- elseif a:colour == "red"
- return 64
- endif
- elseif &t_Co == 256
- if a:colour == "darkblue"
- return 17
- elseif a:colour == "darkmagenta"
- return 90
- elseif a:colour == "darkred"
- return 88
- elseif a:colour == "red"
- return 196
- endif
- else
- return a:colour
- endif
-endfun "}}}2
-
-" Change status bar colour when various things happen.
-" Flags: H/h: Cursor held/moved.
-" F/f: Focus gained/lost.
-" I/i: Insert mode entered/left.
-fun! Highlight_StatusLine(flag) "{{{2
- " Get current status.
- call Iain_Vars()
-
- " Change the status based on the flag. XXX: Does Vim let us to do flags?
- let re = "[" . tolower(a:flag) . toupper(a:flag) . "]"
- let b:iainstatus = substitute(b:iainstatus, re, a:flag, "")
-
- let l:normalcolour = "darkblue"
- let l:editingcolour = "darkmagenta"
- let l:warningcolour = "darkred"
- let l:readonlycolour = "red"
-
- " Default colour.
- let l:colour = l:normalcolour
- " Maybe override depending on status.
- if b:iainstatus =~# "H"
- if b:iainstatus =~# "I"
- " Held in insert mode. Add extra highlight if we don't have focus.
- if b:iainstatus =~# "f"
- let l:colour = l:warningcolour
- else
- let l:colour = l:editingcolour
- endif
- endif
- else
- if b:iainstatus =~# "I"
- " Regular insert mode.
- let l:colour = l:editingcolour
- endif
- endif
-
- " Override again if readonly.
- if l:colour != l:normalcolour
- if getbufvar("", "&ro")
- let l:colour = l:readonlycolour
- endif
- endif
-
- let l:termcolour = <SID>Iain_Colour(l:colour)
-
- exec "highlight StatusLine gui=bold term=bold cterm=bold guifg=white guibg=" . l:colour . " ctermfg=white ctermbg=" . l:termcolour
-endfun "}}}2
-
-au Display VimEnter * call Highlight_StatusLine("")
-
" Show signs by default.
au Display VimEnter * call <SID>Cycle_Signs(0)
endif "}}}1