On 2022-10-29, Carl Ponder wrote:
> Based on this posting
> https://vim.fandom.com/wiki/Searching_for_expressions_which_include_slashes
> I tried re-mapping the '/' in my ~/.vimrc
>
> command! -nargs=1 / let @/ = <q-args>|set hlsearch
>
> but it didn't work.
That won't work because user-defined commands must begin with an
upper-case letter. See
:help user-commands
To remap a command such as /, you must use a mapping, such as this
example:
:cnoremap <CR> <C-\>eescape(getcmdline(), '/')<CR><CR>:cunmap <lt>CR><CR>
See
:help map-overview
:help x_CTRL-\_e
:help getcmdline()
:helpgrep \cctrl-\\.\?e
and the mappings in the file
$VIMRUNTIME/macros/less.vim
That mapping is probably too simple, but it worked in the few test
cases I tried.
HTH,
Gary
--
--
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20221030002100.GE14398%40phoenix.