Tuesday, February 26, 2013

Re: How to refresh (reload) an opened file?

On Tuesday, February 26, 2013 1:49:20 PM UTC-6, Sven Guckes wrote:
>
> you can probably map this to a key...
>
>
>
> map <f9> :new|:r #|:1d
>
>
>
> but when i enter this mapping then the '#' is
>
> expanded right away and gives me an error:
>
>
>
> E484: Can't open file #
>
>
>
> how to stop that from happening again?
>


In mappings you must either escape the | or use <Bar>.

map <f9> :new\|:r #\|:1d
map <f9> :new<Bar>:r #<Bar>:1d

Otherwise, Vim sees this as:

map <F9> :new

Followed by a separate :r # command.

Actually, this is best written without the redundant : characters, and you will need to end command-line mode with <CR>:

map <f9> :new\|r #\|1d<CR>

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment