Tuesday, February 4, 2014

Re: Custom in search cmd line

On Tuesday, February 4, 2014 6:01:04 AM UTC-6, coot_. wrote:
> Hello,
>
>
>
> I would like this two maps to work:
>
> cno <Plug>SearchCmdWin :call setline(line('.'), '\v' . getline(line('.')))<cr>
>
> cno <expr> <c-f> getcmdtype() == '/' ? '<c-f><Plug>SearchCmdWin' : '<c-f>'
>
>
>
> i.e. in the search command line I would like <c-f> to open the command
>
> line window and change the current line by inserting \v. The second map
>
> is not called, or maybe it is done to early and so the first line is not
>
> changed.
>
>

A couple problems I can see right away:

1. you used "cno" for both mappings, including the second one. To call one mapping from the other, you cannot use "cno". "cno" explicitly tells Vim NOT to expand other mappings when executing the mapping.
2. For the first mapping, "cno" will not trigger anyway, because you are trying to execute it in the command-line window. The command-line window can be in normal or insert mode just like any other window, it is NOT a special command-line mode. Command-line mappings do not apply to the command-line-window.

Why not solve both problems, by creating just a single mapping? If it's too complex for a one-liner, then use and <expr> mapping and write a function.

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