4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: When using the 'editexisting.vim' script and a file is being
12 edited in another tab page the window is split. The "+123"
14 Solution: Make the tab page with the file the current tab page. Set
15 v:swapcommand when starting up to the first "+123" or "-c" command
17 Files: runtime/macros/editexisting.vim, src/main.c
20 *** ../vim-7.0.218/runtime/macros/editexisting.vim Sun Apr 30 20:33:40 2006
21 --- runtime/macros/editexisting.vim Sat Mar 17 22:21:30 2007
24 " Vim Plugin: Edit the file with an existing Vim if possible
25 " Maintainer: Bram Moolenaar
26 ! " Last Change: 2006 Apr 30
28 " This is a plugin, drop it in your (Unix) ~/.vim/plugin or (Win32)
29 " $VIM/vimfiles/plugin directory. Or make a symbolic link, so that you
31 " Vim Plugin: Edit the file with an existing Vim if possible
32 " Maintainer: Bram Moolenaar
33 ! " Last Change: 2007 Mar 17
35 " This is a plugin, drop it in your (Unix) ~/.vim/plugin or (Win32)
36 " $VIM/vimfiles/plugin directory. Or make a symbolic link, so that you
39 " Function used on the server to make the file visible and possibly execute a
41 func! EditExisting(fname, command)
42 ! let n = bufwinnr(a:fname)
46 exe "split " . escape(a:fname, ' #%"|')
49 " Function used on the server to make the file visible and possibly execute a
51 func! EditExisting(fname, command)
52 ! " Get the window number of the file in the current tab page.
53 ! let winnr = bufwinnr(a:fname)
55 ! " Not found, look in other tab pages.
56 ! let bufnr = bufnr(a:fname)
57 ! for i in range(tabpagenr('$'))
58 ! if index(tabpagebuflist(i + 1), bufnr) >= 0
59 ! " Make this tab page the current one and find the window number.
60 ! exe 'tabnext ' . (i + 1)
61 ! let winnr = bufwinnr(a:fname)
68 ! exe winnr . "wincmd w"
70 exe "split " . escape(a:fname, ' #%"|')
72 *** ../vim-7.0.218/src/main.c Tue Feb 27 16:51:07 2007
73 --- src/main.c Sun Mar 18 21:51:48 2007
77 create_windows(¶ms);
78 TIME_MSG("opening buffers");
81 + /* clear v:swapcommand */
82 + set_vim_var_string(VV_SWAPCOMMAND, NULL, -1);
85 /* Ex starts at last line of the file */
87 curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
96 + /* If there is a "+123" or "-c" command, set v:swapcommand to the first
98 + if (parmp->n_commands > 0)
100 + p = alloc((unsigned)STRLEN(parmp->commands[0]) + 3);
103 + sprintf((char *)p, ":%s\r", parmp->commands[0]);
104 + set_vim_var_string(VV_SWAPCOMMAND, p, -1);
112 *** ../vim-7.0.218/src/version.c Thu Mar 15 22:54:51 2007
113 --- src/version.c Sun Mar 18 21:49:11 2007
117 { /* Add new patch number below this line */
123 FATHER: You only killed the bride's father - that's all -
124 LAUNCELOT: Oh dear, I didn't really mean to...
125 FATHER: Didn't mean to? You put your sword right through his head!
126 LAUNCELOT: Gosh - Is he all right?
127 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
129 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
130 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
131 \\\ download, build and distribute -- http://www.A-A-P.org ///
132 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///