Monday, April 21, 2014

Re: S&R with search input from a file

On 2014-04-21 08:37, Jeri Raye wrote:
> :s/..$
> doesn't work at my windows system
> I use:
> execute "normal! \<end>xx"

This should work on all versions of vim, regardless of operating
system. How are you determining that it isn't working? Is it giving
you an error? Is it not removing the last two characters (the "\|")
from the line? If you are having a problem, you could tweak the
first couple steps to

:1,$-s/$/\\|/

which will tack them onto every line *except* the last one, saving
you that ":s/..$/" step.

> Then it fails on
> 0y$
>
> I get the error message E488: Trailing characters

This sounds like you're trying to do this in some mode that isn't
normal-mode. Perhaps command-mode?

You could yank the entire line and then just remove the newline at
the end if that's easier.

> I also noticed that the <C-R> mapping in the last substitute
> command is already used in another plugin.
> Is there a workaround for?

You mean...other than not remapping away something that is incredibly
valuable? ;-) You can always map something else to it:

:cnoremap <f4> <c-r>

-tim




--
--
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/d/optout.

No comments: