Created
June 1, 2023 11:32
-
-
Save jssteinberg/49a41c52cbfa34918a7eaf8293595b42 to your computer and use it in GitHub Desktop.
SPACE CONFIRMS - maps to cmdline that are confirmed with <space>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" SPACE CONFIRMS - maps to cmdline that are confirmed with <space> | |
" Setup: | |
" <space> is enter key in command mode if space_confirms | |
cno <expr> <space> exists("g:space_confirms") ? "<cr>" : " " | |
" space_confirms is unlet by autocmd so it's deactivated | |
augroup space_confirms | au! | |
au CmdlineLeave * if exists("g:space_confirms") | unlet g:space_confirms | en | |
augroup end | |
" Mappings: | |
" search in normal and visual mode | |
nn s <cmd>let g:space_confirms=1<cr>/ | |
xn s <cmd>let g:space_confirms=1<cr>/ | |
" backward search in normal mode | |
nn S <cmd>let g:space_confirms=1<cr>? | |
" switch buffer in normal mode | |
nn <leader><tab> <cmd>let g:space_confirms=1<cr>:buffer <c-z> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
An extension of https://gist.github.com/jssteinberg/56a53783dbb39ffc6a410fe548564aa9
Use to confirm Vim commands from mappings. Can replace plugins like search motions plugins (leap.nvim, lightspeed.nvim, vim-sneak, etc) and buffer switcher plugins.
Use with options: