diff runtime/optwin.vim @ 2908:fd09a9c8468e

Updated runtime files.
author Bram Moolenaar <bram@vim.org>
date Sun, 19 Jun 2011 05:09:16 +0200
parents 916c90b37ea9
children 8dcf3ea92b63
line wrap: on
line diff
--- 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, this
   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"
 
 " 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