Thread: [Vim-latex-cvs] vimfiles/plugin remoteOpen.vim,1.1,1.2
Brought to you by:
srinathava,
tmaas
From: <sri...@us...> - 2003-06-14 04:43:11
|
Update of /cvsroot/vim-latex/vimfiles/plugin In directory sc8-pr-cvs1:/tmp/cvs-serv13376 Modified Files: remoteOpen.vim Log Message: Change: Previously, if a file was not opened in any other session, then it would open it in a new session. But for projects with lots of files, this can become painful. Therefore, instead of opening in new sessions each time, open files in the same session we used the first time we had to create a session. Index: remoteOpen.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/plugin/remoteOpen.vim,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** remoteOpen.vim 8 Jun 2003 23:42:44 -0000 1.1 --- remoteOpen.vim 14 Jun 2003 04:43:07 -0000 1.2 *************** *** 37,40 **** --- 37,41 ---- " anywhere and if so, opens it there instead of in this session. function! RemoteOpen(arglist) + " First construct line number and filename from argument. a:arglist is of " the form: *************** *** 55,58 **** --- 56,60 ---- exec "e ".filename exec linenum + normal! zv return endif *************** *** 60,74 **** " Otherwise, loop through all available servers let servers = serverlist() let i = 1 let server = s:Strntok(servers, "\n", i) while server != '' " Ask each server if that file is being edited by them. let bufnum = remote_expr(server, "bufnr('".filename."')") ! " If it isnt... if bufnum != -1 ! " ask the server to edit that file and come to the background. ! call remote_send(server, "\<C-\>\<C-n>:drop ".filename."\<CR>:".linenum."\<CR>") call remote_foreground(server) " quit this vim session --- 62,95 ---- " Otherwise, loop through all available servers let servers = serverlist() + " If there are no servers, open file locally. + if servers == '' + exec "e ".filename + exec linenum + let g:Remote_Server = 1 + normal! zv + return + endif let i = 1 let server = s:Strntok(servers, "\n", i) + let firstServer = v:servername while server != '' + " Find out if there was any server which was used by remoteOpen before + " this. If a new gvim session was ever started via remoteOpen, then + " g:Remote_Server will be set. + if remote_expr(server, 'exists("g:Remote_Server")') + let firstServer = server + endif + " Ask each server if that file is being edited by them. let bufnum = remote_expr(server, "bufnr('".filename."')") ! " If it is... if bufnum != -1 ! " ask the server to edit that file and come to the foreground. ! " set a variable g:Remote_Server to indicate that this server ! " session has at least one file opened via RemoteOpen ! call remote_send(server, "\<C-\>\<C-n>:drop ".filename."\<CR>:".linenum."\<CR>:normal! zv\<CR>") ! call remote_send(server, ":let g:Remote_Server = 1\<CR>") call remote_foreground(server) " quit this vim session *************** *** 82,88 **** endwhile ! " If there is no server which was editing this file, then open it up here. ! exec "e ".filename ! exec linenum endfunction " }}} " Strntok: extract the n^th token from a list {{{ --- 103,117 ---- endwhile ! " If none of the servers have the file open, then open this file in the ! " first server. This has the advantage if yap tries to make vim open ! " multiple vims, then at least they will all be opened by the same gvim ! " server. ! call remote_send(firstServer, "\<C-\>\<C-n>:drop ".filename."\<CR>:".linenum."\<CR>:normal! zv\<CR>") ! call remote_send(firstServer, ":let g:Remote_Server = 1\<CR>") ! call remote_foreground(firstServer) ! " quit this vim session ! if v:servername != firstServer ! q ! endif endfunction " }}} " Strntok: extract the n^th token from a list {{{ |
From: Mikolaj M. <mi...@wp...> - 2003-06-30 23:09:29
|
On Fri, Jun 13, 2003 at 09:43:09PM -0700, sri...@us... wrote: > Update of /cvsroot/vim-latex/vimfiles/plugin > In directory sc8-pr-cvs1:/tmp/cvs-serv13376 > Modified Files: > remoteOpen.vim > Log Message: > Change: Previously, if a file was not opened in any other session, then it > would open it in a new session. But for projects with lots of > files, this can become painful. Therefore, instead of opening in > new sessions each time, open files in the same session we used the > first time we had to create a session. Why in plugin directory? It means it will be sourced everytime Vim run, not only with LaTeX files. m. |
From: Srinath A. <sr...@ee...> - 2003-07-01 00:27:15
|
On Tue, 1 Jul 2003, Mikolaj Machowski wrote: > > Modified Files: > > remoteOpen.vim > > Log Message: > > Change: Previously, if a file was not opened in any other session, then it > > would open it in a new session. But for projects with lots of > > files, this can become painful. Therefore, instead of opening in > > new sessions each time, open files in the same session we used the > > first time we had to create a session. > > Why in plugin directory? It means it will be sourced everytime Vim run, > not only with LaTeX files. > Because if you double-click on a dvi file when gvim is not already open, it will not work with this file being an ftplugin... basically a command like gvim -c ":RemoteOpen something" something will succeed only if :RemoteOpen is available as soon as vim starts up. Srinath |