X-Git-Url: http://git.iain.cx/?p=profile.git;a=blobdiff_plain;f=.vimrc;h=14401a6a5b86ff59cb66306c196826d19785c4ed;hp=88ef3728d47685c7526138f65306f96844e37707;hb=25a417ee465581aa4fefa8430ae6aca85d093787;hpb=be85ae95c38edb120b6fa31456647d5e602fd46a diff --git a/.vimrc b/.vimrc index 88ef372..14401a6 100644 --- a/.vimrc +++ b/.vimrc @@ -818,6 +818,53 @@ fun! Show_SearchForward() "{{{2 return "" endfun "}}}2 +" Helper for status line. +" Show marks set in cursor line. +fun! Show_Marks() "{{{2 + if ! exists("g:iainsigns") + return "" + endif + + let l:marks = "" + + let l:signs = g:iainsigns + let l:sign = "" + let l:cursorline = line(".") + while strlen(l:signs) + let l:sign = matchstr(l:signs, '^[A-Za-z]\+\(:.\)*[.=>-][^ ]\+') + let l:sign = substitute(l:sign, '^[A-Za-z]\+', "", "") + let l:ascii = matchstr(l:sign, '^:.') + let l:mark = substitute(l:sign, '^\(:.\)*[.=>-]', "", "") + if strlen(l:ascii) + let l:ascii = substitute(l:ascii, '^:', "", "") + else + let l:ascii = l:mark + endif + let l:ascii = substitute(l:ascii, '"', '\\"', "") + + if l:ascii == "o" + let l:line = "." + else + let l:line = "'" . l:ascii + endif + + " Ignore cursor line which will always match. + if l:line != "." + if l:cursorline == line(l:line) + let l:marks = l:marks . l:mark + endif + endif + + let l:signs = substitute(l:signs, '^[^ ]\+ *', "", "") + endwhile + + if l:marks == "" + return "" + else + return "M:" . l:marks . " " + endif +endfun "}}}2 + " Show the status line. fun! Show_StatusLine() "{{{2 if ! has("statusline") @@ -825,7 +872,7 @@ fun! Show_StatusLine() "{{{2 endif call Iain_Vars() let l:sl1='%2n\:\ %<%1*%f%0*\ [%{Show_Encoding()}%{Show_List()}%{Show_Bind()}%{Show_Case()}%{Show_Tabstop()}%{Show_Paste()}%{Show_VirtualEdit()}%{Show_Undo()}%Y%M%R%{Show_SearchForward()}]%{Show_Alt()}\ ' - let l:sl3='L:%1*%4.6l%0*/%-4.6L\ C:%1*%3.6c%V%0*\ \|\ %P' + let l:sl3='%{Show_Marks()}L:%1*%4.6l%0*/%-4.6L\ C:%1*%3.6c%V%0*\ \|\ %P' let l:hexformat='%b' if b:iainhex let l:hexformat='0\x%02B'