notomo/cmdbuf.nvim

github github
command-line plugin
star 27
stars
alert-circle 0
open issues
users 3
subscribers
git-branch 0
forks
CREATED

2021-01-30

UPDATED

5 days ago

packer

require('packer').startup(function()
  use 'notomo/cmdbuf.nvim'
end)

paq

require "paq" { 
  'notomo/cmdbuf.nvim'
}

cmdbuf.nvim

ci

The builtin command-line window is a special window.
For example, you cannot leave it by wincmd.
This plugin provides command-line window functions by normal buffer and window.

Example

nnoremap q: <Cmd>lua require('cmdbuf').split_open(vim.o.cmdwinheight)<CR>
cnoremap <C-f> <Cmd>lua require('cmdbuf').split_open(
  \ vim.o.cmdwinheight,
  \ {line = vim.fn.getcmdline(), column = vim.fn.getcmdpos()}
  \ )<CR><C-c>

" Custom buffer mappings
augroup cmdbuf_setting
  autocmd!
  autocmd User CmdbufNew call s:cmdbuf()
augroup END
function! s:cmdbuf() abort
  nnoremap <nowait> <buffer> q <Cmd>quit<CR>
  nnoremap <buffer> dd <Cmd>lua require('cmdbuf').delete()<CR>
endfunction

" open lua command-line window
nnoremap ql <Cmd>lua require('cmdbuf').split_open(
  \ vim.o.cmdwinheight,
  \ {type = "lua/cmd"}
  \ )<CR>

" q/, q? alternative
nnoremap q/ <Cmd>lua require('cmdbuf').split_open(
  \ vim.o.cmdwinheight,
  \ {type = "vim/search/forward"}
  \ )<CR>
nnoremap q? <Cmd>lua require('cmdbuf').split_open(
  \ vim.o.cmdwinheight,
  \ {type = "vim/search/backward"}
  \ )<CR>