3

You can use :cnoremap, which works for search / but also for Ex commands, that you enter with :. See :help :map-modes for more information on the map modes available. (To be exact, there are a few more cases where the command-line mappings apply, such as the input() function, or entering an expression for the expression register with <C-R>= from Insert ...


2

Since you're looking at pairing open/close tags across multiple lines (enclosing a block) and in your case it makes sense to insert the closing tag when breaking the line, my suggestion is to add a mapping to the Enter key in Insert mode and then use an <expr> to decide whether we need to add the closing tag. You can make that decision based on the ...


2

Use nmap instead of nnoremap for <Plug> mappings: nmap mk <Plug>MarkdownPreviewToggle The <Plug> mappings are defined by plug-ins, so you need to be able to expand other mappings in your expansion in this case.


2

All you need to do is insert <C-\> before the <C-o>. inoremap <C-_> <C-\><C-o>dB Help for i_CTRL-\_CTRL-O says: CTRL-\ CTRL-O : like CTRL-O but don't move the cursor That's it. Well except for a caveat or two which I'll reproduce here for your convenience ;) ... The CTRL-O command sometimes has a side effect: If the cursor ...


2

:help maparg() explains that maparg('<C-L>', 'n') will return the normal mode mapping assigned to control-L. When there is no mapping for <C-L>, then it will return an empty string...so it's politely checking for the existence of a mapping before assign the mapping. Concerning ==# with an empty string, some plugin authors automatically use ==# ...


2

You can also try :normal command: :normal gAip*& And then @: to repeat last command. Or if you want to map it: nmap <buffer> gT gAip*&


1

operatorfunc is very limited and can't take arguments or be set to e.g., lambdas. A "standard" way to handle this situation is to use an expression map to a setup wrapper function, and keep the argument in a global or script-context variable. This means unfortunately that the operator is not reentrant, but this is rarely needed. This is the ...


1

When I try your mapping for <C-/> nothing happens for me either. I've also had my own issues when I wanted to use <A-/> as well. As @b-layer and @filbranden pointed out, there are certain key combinations that are difficult to map, if not impossible. If you need more mapping key combinations, @b-layer referenced how to set up mapping the Alt key ...


1

Rather than rolling your own mappings for this purpose, I'd recommend adopting the excellent vim-unimpaired plug-in, which defined two specific mappings for this purpose: [n Go to the previous SCM conflict marker or diff/patch hunk. Try d[n inside a conflict. ]n Go to the next SCM conflict ...


Only top voted, non community-wiki answers of a minimum length are eligible