On 2022-05-22, Bram Moolenaar wrote:
>> I thought maybe I could fix this with autocommands, but I can't get it
>> to work, e.g.. I thought this might work:
>> 
>> autocmd CmdlineEnter / mark S
>> autocmd CmdlineChanged * normal g`S
>> 
>> But that doesn't do anything, any ideas?
>
> Not sure if there is a way to do this currently.  There actually is code
> to restrict the matches to a line range, it is used for a command like
> ":1,30s/pat".  So you could somehow fill in the line numbers at the top
> and bottom of the window, type the pattern, then remove the text before
> the pattern when starting to search.  But that's an ugly hack.
Hah! I guess you mean something like this:
nno / :call feedkeys(":" . line('w0') . "," . line('w$') . "s /")<CR>
cnoremap <expr> <CR> (getcmdline() =~ '^\d\+,\d\+s /' ? "<Home><S-Right><C-U><Del><CR>" : "<CR>")
It's a bit scary, but it does sorta work! Do you think that will break
anything?
>
> I'm not against adding an option for this, but we currently have no
> option to change how 'incsearch' works.  Adding Yet Another Option?
>
Naturally, I vote yes :)
Tavis.
-- 
 _o)            $ lynx lock.cmpxchg8b.com
 /\\  _o)  _o)  $ finger taviso@sdf.org
_\_V _( ) _( )  @taviso
-- 
-- 
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/t6e9b5%24nf2%241%40ciao.gmane.io.
No comments:
Post a Comment