Tuesday, November 8, 2016

Re: Mapping to search for current line

Le mardi 8 novembre 2016 06:03:29 UTC+1, skeept a écrit :
> I tried the following mapping for searching for the current line:
>
> nnoremap gsl /<ctrl-r>=getline('.')<CR><CR>
>
> unfortunately this actually searchs for the string I give it literally.
>
> So I defined instead the mapping
>
> nnoremap gsl /^R=getline('.')^M
>
> where ^R is obtained with typing ctrl-v followed by ctrl-r and ^M is ctrl-v followed by <enter>
>
> Unfortunately now when I open the file where I define this mapping I get the message
> [CR missing][dos] and the file shows up with dos format.
>
>
> The question:
>
> Is there a way to define the mapping where I don't have to use the control charathers explicitly in the mapping?
> Also is there a popular plugin that defines these types of mappings?
>
> Thank you!
>
> --
> Jorge Rodrigues

In your first attempt, <ctrl-r> should be <C-r>. See :help key-notation.

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