From 3eb908d588d1c1cd6bb5abd1886b9bec4fab701f Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Tue, 28 Jan 2014 17:50:44 +0000 Subject: [PATCH] More readable sign initialisation code. Not much more, admittedly. --- .vimrc | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/.vimrc b/.vimrc index 65e88b3..c2705ed 100644 --- a/.vimrc +++ b/.vimrc @@ -942,12 +942,30 @@ fun! Cycle_Signs(resize) "{{{2 while strlen(l:signs) let l:sign = matchstr(l:signs, '^[A-Za-z]\+\(:.\)*[.=-][^ ]\+') - let l:sign = substitute(l:sign, ':.', "", "") - let l:sign = substitute(l:sign, '=', " texthl=MarkSign text=", "") - let l:sign = substitute(l:sign, '\.', " texthl=MarkDot text=", "") - let l:sign = substitute(l:sign, '-', " texthl=MarkLine linehl=MarkLine text=", "") + let l:name = substitute(l:sign, '[:.=-].*', "", "") + 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, '^:', "", "") + let l:ascii = matchstr(l:ascii, '^.') + else + let l:ascii = l:mark + endif + let l:ascii = substitute(l:ascii, '"', '\\"', "") + let l:type = substitute(l:sign, '^:.', "", "") + let l:type = matchstr(l:type, '^.') + + let l:hl = "" + if l:type == "=" + let l:hl = "texthl=MarkSign text=" + elseif l:type == "." + let l:hl = "texthl=MarkDot text=" + elseif l:type == "-" + let l:hl = "texthl=MarkLine text=" + endif - exe "sign define Mark" . l:sign + exe "sign define Mark" . l:name . " " . l:hl . l:mark let l:signs = substitute(l:signs, '^[^ ]\+ *', "", "") endwhile -- 2.7.4