Wednesday, June 13, 2018

Re: How can I set cursorline only during a search?

Am 13.06.2018 um 21:04 schrieb Bok Woon Chua:
> I don't use the cursorline, but I would find it helpful to set it
> during a whenever I press 'n' or 'N' to make the line of the current
> search match pop out. However once I press anything other than n or
> N, I'd like to turn the cursorline off. I can do something like
> 'nnoremap n :setlocal cursorline<CR>n', but I'm not sure how I can
> conditionally turn it off provided the next key I press isn't an 'n'
> or 'N'. Any ideas how I could do this?

cool demo for the incomplete mapping technique ...

nnoremap <script><silent> n n:set cul<CR><SID>_search__
nnoremap <script><silent> N N:set cul<CR><SID>_search__

nnoremap <script> <SID>_search__n n<SID>_search__
nnoremap <script> <SID>_search__N N<SID>_search__
nnoremap <silent> <SID>_search__ :set nocul<CR>

--
Andy

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