Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Version 22

* The internally used "only" command was occasionally issuing an "Already one window" message, which is now prevented.
* SavePosn() issued an error message when ZoomWin was handling - fixed!
* Saves/restores yank registers for every zoom/unzoom.
  • Loading branch information...
commit fd3d1e91da17ece3f505f815c7c8db209b17f693 1 parent 6768a63
cecamp authored April 10, 2006 vim-scripts committed November 06, 2010

Showing 1 changed file with 81 additions and 11 deletions. Show diff stats Hide diff stats

  1. 92  plugin/ZoomWin.vim
92  plugin/ZoomWin.vim
... ...
@@ -1,8 +1,8 @@
1 1
 " ZoomWin:	Brief-like ability to zoom into/out-of a window
2 2
 " Author:	Charles Campbell
3 3
 "			original version by Ron Aaron
4  
-" Date:		May 10, 2005
5  
-" Version:	21
  4
+" Date:		Apr 07, 2006
  5
+" Version:	22
6 6
 " History: see :help zoomwin-history {{{1
7 7
 " GetLatestVimScripts: 508 1 :AutoInstall: ZoomWin.vim
8 8
 
@@ -12,8 +12,9 @@ if &cp || exists("g:loaded_ZoomWin")
12 12
  finish
13 13
 endif
14 14
 let s:keepcpo        = &cpo
15  
-let g:loaded_ZoomWin = "v21"
  15
+let g:loaded_ZoomWin = "v22"
16 16
 set cpo&vim
  17
+"DechoTabOn
17 18
 
18 19
 " ---------------------------------------------------------------------
19 20
 "  Public Interface: {{{1
@@ -72,6 +73,7 @@ fun! ZoomWin()
72 73
 
73 74
   if winbufnr(2) == -1
74 75
     " there's only one window - restore to multiple-windows mode {{{2
  76
+"	call Decho("there's only one window - restore to multiple windows")
75 77
 
76 78
     if exists("s:sessionfile") && filereadable(s:sessionfile)
77 79
 	  " save position in current one-window-only
@@ -84,6 +86,7 @@ fun! ZoomWin()
84 86
 	  let ei_keep= &ei
85 87
 	  set ei=all
86 88
       exe 'silent! so '.s:sessionfile
  89
+"	  Decho("@@<".@@.">")
87 90
       let v:this_session= s:sesskeep
88 91
 
89 92
       if exists("s:savedposn1")
@@ -110,6 +113,7 @@ fun! ZoomWin()
110 113
     endif
111 114
 
112 115
   else " there's more than one window - go to only-one-window mode {{{2
  116
+"	call Decho("there's multiple windows - goto one-window-only")
113 117
 
114 118
     let s:winkeep    = winnr()
115 119
     let s:sesskeep   = v:this_session
@@ -120,11 +124,13 @@ fun! ZoomWin()
120 124
 "     call Dret("ZoomWin : commandline window error")
121 125
 	 return
122 126
 	endif
  127
+"	call Decho("1: @@<".@@.">")
123 128
 
124 129
 	" disable all events (autocmds)
125 130
 "	call Decho("disable events")
126 131
     let ei_keep= &ei
127 132
 	set ei=all
  133
+"	call Decho("2: @@<".@@.">")
128 134
 
129 135
     " save window positioning commands
130 136
 "	call Decho("save window positioning commands")
@@ -132,26 +138,62 @@ fun! ZoomWin()
132 138
     call s:GotoWinNum(s:winkeep)
133 139
 
134 140
     " set up name of session file
  141
+"	call Decho("3: @@<".@@.">")
135 142
     let s:sessionfile= tempname()
  143
+"	call Decho("4: @@<".@@.">")
136 144
 
137 145
     " save session
138 146
 "	call Decho("save session")
139 147
     let ssop_keep = &ssop
140 148
     let &ssop     = 'blank,help,winsize'
  149
+"	call Decho("5: @@<".@@.">")
141 150
     exe 'mksession! '.s:sessionfile
  151
+"	call Decho("6: @@<".@@.">")
  152
+	let keepyy= @@
  153
+	let keepy0= @0
  154
+	let keepy1= @1
  155
+	let keepy2= @2
  156
+	let keepy3= @3
  157
+	let keepy4= @4
  158
+	let keepy5= @5
  159
+	let keepy6= @6
  160
+	let keepy7= @7
  161
+	let keepy8= @8
  162
+	let keepy9= @9
142 163
     set lz ei=all bh=
  164
+	if v:version >= 700
  165
+     exe "keepalt keepmarks new! ".s:sessionfile
  166
+     keepjumps keepmarks v/wincmd\|split\|resize/d
  167
+     keepalt w!
  168
+     keepalt bw!
  169
+	else
143 170
      exe "new! ".s:sessionfile
144 171
      v/wincmd\|split\|resize/d
145 172
      w!
146  
-	 bw!
  173
+     bw!
  174
+    endif
  175
+	let @@= keepyy
  176
+	let @0= keepy0
  177
+	let @1= keepy1
  178
+	let @2= keepy2
  179
+	let @3= keepy3
  180
+	let @4= keepy4
  181
+	let @5= keepy5
  182
+	let @6= keepy6
  183
+	let @7= keepy7
  184
+	let @8= keepy8
  185
+	let @9= keepy9
  186
+"	call Decho("7: @@<".@@.">")
147 187
 
148 188
     " restore user's session options and restore event handling
149 189
 "	call Decho("restore user session options and event handling")
150 190
     set nolz
151 191
     let &ssop = ssop_keep
152  
-    only!
  192
+    silent! only!
  193
+"	call Decho("8: @@<".@@.">")
153 194
     let &ei   = ei_keep
154 195
     echomsg expand("%")
  196
+"	call Decho("9: @@<".@@.">")
155 197
   endif
156 198
 
157 199
   " restore user option settings {{{2
@@ -178,6 +220,12 @@ endfun
178 220
 fun! s:SavePosn(savewinhoriz)
179 221
 "  call Dfunc("SavePosn(savewinhoriz=".a:savewinhoriz.") file<".expand("%").">")
180 222
   let swline    = line(".")
  223
+  if swline == 1 && getline(1) == ""
  224
+   " empty buffer
  225
+   let savedposn= "silent b ".winbufnr(0)
  226
+"   call Dret("SavePosn savedposn<".savedposn.">")
  227
+   return savedposn
  228
+  endif
181 229
   let swcol     = col(".")
182 230
   let swwline   = winline()-1
183 231
   let swwcol    = virtcol(".") - wincol()
@@ -315,18 +363,30 @@ unlet s:keepcpo
315 363
 " HelpExtractor:
316 364
 "  Author:	Charles E. Campbell, Jr.
317 365
 "  Version:	3
318  
-"  Date:	Sep 09, 2004
  366
+"  Date:	May 25, 2005
319 367
 "
320 368
 "  History:
  369
+"    v3 May 25, 2005 : requires placement of code in plugin directory
  370
+"                      cpo is standardized during extraction
321 371
 "    v2 Nov 24, 2003 : On Linux/Unix, will make a document directory
322 372
 "                      if it doesn't exist yet
323 373
 "
324 374
 " GetLatestVimScripts: 748 1 HelpExtractor.vim
325 375
 " ---------------------------------------------------------------------
326 376
 set lz
327  
-let s:keepcpo= &cpo
  377
+let s:HelpExtractor_keepcpo= &cpo
328 378
 set cpo&vim
329  
-let docdir = substitute(expand("<sfile>:r").".txt",'\<plugin[/\\].*$','doc','')
  379
+let docdir = expand("<sfile>:r").".txt"
  380
+if docdir =~ '\<plugin\>'
  381
+ let docdir = substitute(docdir,'\<plugin[/\\].*$','doc','')
  382
+else
  383
+ if has("win32")
  384
+  echoerr expand("<sfile>:t").' should first be placed in your vimfiles\plugin directory'
  385
+ else
  386
+  echoerr expand("<sfile>:t").' should first be placed in your .vim/plugin directory'
  387
+ endif
  388
+ finish
  389
+endif
330 390
 if !isdirectory(docdir)
331 391
  if has("win32")
332 392
   echoerr 'Please make '.docdir.' directory first'
@@ -358,17 +418,21 @@ set nolz
358 418
 unlet docdir
359 419
 unlet curfile
360 420
 "unlet docfile
361  
-let &cpo= s:keepcpo
362  
-unlet s:keepcpo
  421
+let &cpo= s:HelpExtractor_keepcpo
  422
+unlet s:HelpExtractor_keepcpo
363 423
 finish
364 424
 
365 425
 " ---------------------------------------------------------------------
366 426
 " Put the help after the HelpExtractorDoc label...
367 427
 " HelpExtractorDoc:
368  
-*ZoomWin.txt*	Zoom into/out-of a window		May 10, 2005
  428
+*ZoomWin.txt*	Zoom into/out-of a window		Apr 10, 2006
369 429
 Authors: Charles E. Campbell, Jr.			*zoomwin*
370 430
          Ron Aaron
371 431
 Version: 21
  432
+Copyright: (c) 2004-2005 by Charles E. Campbell, Jr.	*zoomwin-copyright*
  433
+           The VIM LICENSE applies to ZoomWin.vim and ZoomWin.txt
  434
+           (see |copyright|) except use "ZoomWin" instead of "Vim"
  435
+	   No warranty, express or implied.  Use At-Your-Own-Risk.
372 436
 
373 437
 ==============================================================================
374 438
 1. Usage						*zoomwin-usage*
@@ -393,6 +457,12 @@ Version: 21
393 457
 ==============================================================================
394 458
 3. History						*zoomwin-history*
395 459
 
  460
+	v22 Apr 10, 2006 : * "only" was occasionally issuing an "Already one
  461
+	                     window" message, which is now prevented
  462
+			   * SavePosn() issued error message when handling an
  463
+			     empty buffer
  464
+			   * saves yank registers and restores them on each
  465
+			     zoom/unzoom
396 466
 	v21 Oct 12, 2004 : * v14 fixed a bug when wmw and/or wmv equal to 0;
397 467
 			     v21 will invoke the patch only if the version <= 603.
398 468
 			     For vim version 6.3 users, this fix allows more files

0 notes on commit fd3d1e9

Please sign in to comment.
Something went wrong with that request. Please try again.