Closed JaredVogt closed 8 years ago
Added following chunk of code
" ------------------------------------------------------------------------------
" cmdline section - default to command window for cmdline mode
" ------------------------------------------------------------------------------
" default to opening command window
execute "nnoremap : :" . &cedit . "a"
execute "xnoremap : :" . &cedit . "a"
execute "nnoremap / /" . &cedit . "a"
execute "xnoremap / /" . &cedit . "a"
execute "nnoremap ? ?" . &cedit . "a"
execute "xnoremap ? ?" . &cedit . "a"
" access cmdline by appending with q
nnoremap q: :
xnoremap q: :
nnoremap q/ /
xnoremap q/ /
nnoremap q? ?
xnoremap q? ?
" enable <esc> for command window
autocmd CmdwinEnter * nnoremap <buffer> <esc> :q<cr>
" override "new line" on <CR> in normal mode (from http://stackoverflow.com/questions/24599217/remap-enter-in-normal-mode-but-not-in-command-line)
augroup commandlinewindow
autocmd!
autocmd CmdwinEnter * nnoremap <buffer> <CR> <CR>
autocmd BufReadPost quickfix nnoremap <buffer> <CR> <CR>
augroup END
Not sure that the <esc>
is working as expected - have to hit it twice (once to get out of insert mode... ah - if not in insert mode, it prob does work!). Can also hit <Leader>q
to close.
https://www.reddit.com/r/vim/comments/4omgit/editing_commands_in_the_command_line/
<C-f>
A number of people have pointed out the cmdline window. I strongly prefer it to the normal one and have adjusted things to prioritize it:
If you'd like, you can effectively set that to default over the normal cmdline with:
Note : + cedit is preferable to q: as q: breaks macros where : + cedit does not.
You can retain access to the normal cmdline by prefixing with q (effectively swapping q: with :):
One can normally leave the normal cmdline with; however, this doesn't work by default in the cmdline window. This can be made to work with:
autocmd CmdwinEnter * nnoremap <buffer> <esc> :q<cr>