Loading ...
Sorry, an error occurred while loading the content.

Auto-raise existing Vim window on attempt to re-edit?

Expand Messages
  • Valery Kondakoff
    Hello, Steve! Tuesday, November 4, 2003, 6:43:56 PM, you wrote: SH You should find that the autocmds I included accomplish the same task SH without having to
    Message 1 of 9 , Nov 5, 2003
    • 0 Attachment
      Hello, Steve!

      Tuesday, November 4, 2003, 6:43:56 PM, you wrote:

      SH> You should find that the autocmds I included accomplish the same task
      SH> without having to pass the function call on startup.

      Sorry, it seems I can't find no autocommands in the function that you
      post. There is the entire function:

      -----
      function! Singleserver()
      " always merge a new instance of Vim into a (single) existing one

      " don't use in terminal!
      if !has("gui_running")
      return
      endif

      " if this isn't the primary server
      if v:servername !=? "GVIM"

      " compose command to re-open this file if real
      if bufexists(bufnr("%"))
      " get file name/path
      let myfile = expand("%:p")
      " reverse backslashes (Windows and Unix compatibility)
      let myfile = substitute(myfile, '\\', '/', 'g')
      " escape spaces
      let myfile = escape(myfile, ' ')
      " command to edit current file and maintain position
      let mycmd = '<C-o>:edit +' . line('.') . ' ' . myfile . '<CR>'
      " compose command to open a new buffer
      else
      let mycmd = '<C-o>:enew<CR>'
      endif

      " pass file open/position command to primary server
      call remote_send('GVIM', mycmd)
      " call primary server to foreground
      call remote_foreground('GVIM')
      " quit this server
      confirm qall

      end

      endfunction
      ----

      >>
      >> If there is a way to eliminate 'Swap already exists' message?

      SH> I've not been able to find a way, other than turning off swap files
      SH> with :set noswapfile. You could probably derive some very nasty hack
      SH> where it is only momentarily turned off as the two servers are merged,
      SH> passing the file info back and forth a few times, but it seems like
      SH> too much overhead for me.

      Yes, thank you for an explanation.

      SH> Besides Vim never crashes, so who needs swap files? :)

      :)

      --
      Best regards,
      Valery mailto:strauss@...

      PGP key: mailto:pgp-public-keys@...?subject=GET%20strauss@...

      np: 01 - Горький Ангел [stopped]
    • Steve Hall
      From: Valery Kondakoff, Nov 5, 2003 10:37 AM ... Please refer to my first post: http://groups.yahoo.com/group/vim/message/44631 -- Steve Hall [
      Message 2 of 9 , Nov 5, 2003
      • 0 Attachment
        From: Valery Kondakoff, Nov 5, 2003 10:37 AM
        > Tuesday, November 4, 2003, 6:43:56 PM, you wrote:
        > >
        > > You should find that the autocmds I included accomplish the same
        > > task without having to pass the function call on startup.
        >
        > Sorry, it seems I can't find no autocommands in the function that
        > you post.

        Please refer to my first post:

        http://groups.yahoo.com/group/vim/message/44631


        --
        Steve Hall [ digitect@... ]
      Your message has been successfully submitted and would be delivered to recipients shortly.