diff options
author | Bram Moolenaar <Bram@vim.org> | 2011-06-19 05:09:16 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2011-06-19 05:09:16 +0200 |
commit | 251e19127170e7387da1f10b9c99c957b16477fc (patch) | |
tree | b286383f88539796b7ce8d724cf9872f8910bf72 /runtime/optwin.vim | |
parent | d6761c3cdf9d15c0f64253dcd8049ff9f25aa987 (diff) | |
download | vim-git-251e19127170e7387da1f10b9c99c957b16477fc.tar.gz |
Updated runtime files.
Diffstat (limited to 'runtime/optwin.vim')
-rw-r--r-- | runtime/optwin.vim | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/runtime/optwin.vim b/runtime/optwin.vim index 82276a65b..4ff90bb22 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -1,7 +1,7 @@ " These commands create the option window. " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2010 Dec 02 +" Last Change: 2011 Jun 13 " If there already is an option window, jump to that one. if bufwinnr("option-window") > 0 @@ -10,7 +10,7 @@ if bufwinnr("option-window") > 0 if @% == "option-window" finish endif - exe "norm! \<C-W>w" + wincmd w if s:thiswin == winnr() break endif @@ -26,12 +26,8 @@ set cpo&vim fun! <SID>CR() " If on a continued comment line, go back to the first comment line - let lnum = line(".") + let lnum = search("^[^\t]", 'bWcn') let line = getline(lnum) - while line[0] == "\t" - let lnum = lnum - 1 - let line = getline(lnum) - endwhile " <CR> on a "set" line executes the option line if match(line, "^ \tset ") >= 0 @@ -82,11 +78,11 @@ fun! <SID>Find(lnum) if getline(a:lnum - 1) =~ "(local to" let local = 1 let thiswin = winnr() - exe "norm! \<C-W>p" + wincmd p if exists("b:current_syntax") && b:current_syntax == "help" - exe "norm! \<C-W>j" + wincmd j if winnr() == thiswin - exe "norm! \<C-W>j" + wincmd j endif endif else @@ -111,10 +107,10 @@ fun! <SID>Update(lnum, line, local, thiswin) if name == "pt" && &pt =~ "\x80" let val = <SID>PTvalue() else - exe "let val = substitute(&" . name . ', "[ \\t\\\\\"|]", "\\\\\\0", "g")' + let val = escape(eval('&' . name), " \t\\\"|") endif if a:local - exe "norm! " . a:thiswin . "\<C-W>w" + exe a:thiswin . "wincmd w" endif if match(a:line, "=") >= 0 || (val != "0" && val != "1") call setline(a:lnum, " \tset " . name . "=" . val) @@ -139,7 +135,7 @@ set notitle noicon nosc noru " Relies on syntax highlighting to be switched on. let s:thiswin = winnr() while exists("b:current_syntax") && b:current_syntax == "help" - exe "norm! \<C-W>w" + wincmd w if s:thiswin == winnr() break endif @@ -147,7 +143,7 @@ endwhile " Open the window new option-window -setlocal ts=15 tw=0 noro +setlocal ts=15 tw=0 noro buftype=nofile " Insert help and a "set" command for each option. call append(0, '" Each "set" line shows the current value of an option (on the left).') @@ -162,9 +158,7 @@ call append(6, '" Hit <Space> on a "set" line to refresh it.') " Init a local binary option fun! <SID>BinOptionL(name) - exe "norm! \<C-W>p" - exe "let val = &" . a:name - exe "norm! \<C-W>p" + let val = getwinvar(winnr('#'), '&' . a:name) call append("$", substitute(substitute(" \tset " . val . a:name . "\t" . \!val . a:name, "0", "no", ""), "1", "", "")) endfun @@ -177,16 +171,13 @@ endfun " Init a local string option fun! <SID>OptionL(name) - exe "norm! \<C-W>p" - exe "let val = substitute(&" . a:name . ', "[ \\t\\\\\"|]", "\\\\\\0", "g")' - exe "norm! \<C-W>p" + let val = escape(getwinvar(winnr('#'), '&' . a:name), " \t\\\"|") call append("$", " \tset " . a:name . "=" . val) endfun " Init a global string option fun! <SID>OptionG(name, val) - call append("$", " \tset " . a:name . "=" . substitute(a:val, '[ \t\\"|]', - \ '\\\0', "g")) + call append("$", " \tset " . a:name . "=" . escape(a:val, " \t\\\"|")) endfun let s:idx = 1 @@ -315,6 +306,8 @@ if has("cscope") call append("$", " \tset cspc=" . &cspc) call append("$", "cscopequickfix\twhen to open a quickfix window for cscope") call <SID>OptionG("csqf", &csqf) + call append("$", "cscoperelative\tfile names in a cscope file are relative to that file") + call <SID>BinOptionG("csre", &csre) endif @@ -1342,3 +1335,5 @@ let &ru = s:old_ru let &sc = s:old_sc let &cpo = s:cpo_save unlet s:old_title s:old_icon s:old_ru s:old_sc s:cpo_save s:idx s:lnum + +" vim: ts=8 sw=2 sts=2 |