Wednesday, August 24, 2011

Re: Make :saveas save to path of current file

On Aug 22, 6:47 pm, Ben Fritz <fritzophre...@gmail.com> wrote:
> On Aug 22, 10:20 am, lessthanideal <geoffrey.w...@thomsonreuters.com>
> wrote:
> > "All on one line
> > command! -nargs=1 SaveasSamePath exe "sav " . expand("%:p:h") . "/" .
> > expand("<args>")
>
> > "Remap so I get my command
> > nnoremap :sav :SaveasSamePath
>
> > "... and so I can still get the original if I need it by typing it in
> > full
> > nnoremap :saveas :saveas
>
> I'd suggest a command-line abbreviation rather than a normal-mode
> mapping to accomplish this:

" Abbreviation replacing mappings I had before
ca sav SaveasSamePath

> If your mappings screw up a plugin, that's the plugin's fault. They
> ought to be using commands such as :normal! (with the '!') to avoid
> user mappings if they assume any behavior at all.

I didn't know about the abbreviation feature at all, thanks for
pointing
it out. Yes, the behaviour when typing the command in is much
nicer, no waiting for the 'timeout' period. Also, I assume (from
":help :normal" not mentioning it) that this will not cause problems
for even badly written plugins.

regards,
Geoff

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: