On Tuesday, 24 July 2012 05:32:58 UTC+1, sinbad wrote:
> how to limit the search to the current line while using / or ?
If you know the line number you can include \%106l in the search
pattern to match line 106 only.
You can also use Ctrl-R to call function line(".") to get the
current row number into the search pattern when you are typing it.
Putting it together you can make a mapping to do it for you such as
this command:
:noremap <F12> /\%<C-R>=line(".")<CR>l
Then use F12 instead of the / key
If you want / to always do this you can just do
:noremap / /\%<C-R>=line(".")<CR>l
although that might break any other configurations that assume
/ behaves in the usual way.
You can try the :noremap commands from the command mode
and if you like the behaviour, put them in your vimrc
file for future use.
regards,
Geoff
--
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