Tuesday, July 31, 2012

Enable option / disable option

On Superuser I found this nice way to highlight the word under the
cursor for the whole page:
:autocmd CursorMoved * exe printf('match IncSearch /\V\<%s\>/',
escape(expand('<cword>'), '/\'))

http://superuser.com/questions/255024/vim-highlighting-a-search-term-without-moving-the-cursor

I would like to enable / disable this feature, for instance on
<leader>h. Is there any way to do this? I could write a function to
set the option, but how to disable it afterwards, and how to check the
state so that the same key could toggle?

Thanks.

--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

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

No comments:

Post a Comment