Hello,

I recently added the statements to my ~/.vimrc (found in the FAQ)
that cause vim to return to it's last position in a file, e.g.:

  autocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
    \ | execute "normal g`\"" | endif

I have noticed that command line use of +/pat has some undesirable
interactions with this new "jump to last" feature...  For example,
it can cause the cursor to jump to the N+1 'pat' with each new
invocation as `" keeps getting changing to the Nth 'pat' (I hope
that makes sense).

Anywho, here's the pseudo-code of what I would like to do:

  if plus_slash_pat_used_at_invocation()
    " do nothing (+/pat works and finds 1st match)
  else
    autocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") 
      \ | execute "normal g`\"" | endif 
  endif

Unfortunately, I can't figure out how to determine if +/pat is used
at invocation.  The @/ register is not reliable to test as it may be
set from a previous editing session and args() seems to only list
file names, so I'm stumped!

Maybe my whole approach is misguided...?

Your help is appreciated!

Thanks!

- Tor


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to