mirror of
https://github.com/neovim/neovim.git
synced 2026-07-09 10:59:38 +00:00
feat(cmdwin): allow tabpage actions
This commit is contained in:
@@ -1209,6 +1209,11 @@ opens in Normal mode. The last line contains the command as typed so far. The
|
||||
The window height is decided by 'cmdwinheight' (if there is room). The window
|
||||
is full width and is positioned just above the command-line.
|
||||
|
||||
Window and tabpage commands work as usual while cmdwin is open: you can
|
||||
navigate, resize, close and open windows/tabpages. The mouse works as in any
|
||||
window: clicks focus other windows, and statuslines and vertical separators
|
||||
can be dragged to resize.
|
||||
|
||||
*E1292*
|
||||
Only one command-line window can be open at a time.
|
||||
|
||||
@@ -1223,12 +1228,8 @@ but it's not possible to open another cmdwin from there. There is no
|
||||
nesting.
|
||||
|
||||
*E11*
|
||||
|CTRL-W| commands work as usual: you can navigate between, split, resize, and
|
||||
close windows while the command-line window is open. E11 is still emitted by
|
||||
operations that would leave or repurpose the cmdwin: opening a new tab page
|
||||
(CTRL-W_T, |:tabnew|) or turning its buffer into a terminal (|:terminal|).
|
||||
The cmdwin buffer is pinned by 'winfixbuf', so its window cannot switch to a
|
||||
different buffer.
|
||||
The cmdwin buffer cannot be used as a |:terminal|. Its window cannot switch to
|
||||
a different buffer ('winfixbuf').
|
||||
|
||||
|
||||
CLOSE
|
||||
@@ -1284,9 +1285,6 @@ If you don't want these mappings, disable them with: >
|
||||
au CmdwinEnter [:>] nunmap <buffer> <Tab>
|
||||
You could put these lines in your vimrc file.
|
||||
|
||||
The mouse works as in any window: clicks focus other windows, and statuslines
|
||||
and vertical separators can be dragged to resize.
|
||||
|
||||
The |getcmdwintype()| function returns the type of the command-line being
|
||||
edited as described in |cmdwin-char|.
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ EDITOR
|
||||
kind/menu/info/abbr for the popup menu.
|
||||
• |cmdwin| (|q:|, |q/|, |q?|, |c_CTRL-F|) is implemented as a "normal"
|
||||
buffer+window instead of a nested-state modal loop:
|
||||
• You can create (and navigate) windows while cmdwin is active. Chaos!
|
||||
• You can create/navigate windows/tabpages while cmdwin is active. Chaos!
|
||||
• 'inccommand' works in cmdwin!
|
||||
• API calls (e.g. |nvim_buf_delete()|) that previously failed with
|
||||
"E11: Invalid in command-line window" while cmdwin was open, now work
|
||||
|
||||
@@ -4469,10 +4469,6 @@ tabpage_T *win_new_tabpage(int after, char *filename, bool enter, win_T **first)
|
||||
{
|
||||
tabpage_T *old_curtab = curtab;
|
||||
|
||||
if (enter && cmdwin_buf != NULL) {
|
||||
emsg(_(e_cmdwin));
|
||||
return NULL;
|
||||
}
|
||||
if (window_layout_locked(CMD_tabnew)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -618,7 +618,7 @@ describe('tabpage/previous', function()
|
||||
-- it('does not switch to previous via :tabn #<CR> after entering operator pending',
|
||||
-- does_not_switch_to_previous_after_entering_operator_pending(':tabn #<CR>'))
|
||||
|
||||
local function cmdwin_prevents_tab_switch(characters, completion_visible)
|
||||
local function cmdwin_allows_tab_switch(characters)
|
||||
return function()
|
||||
-- Add three tabs for a total of four
|
||||
command('tabnew')
|
||||
@@ -633,25 +633,19 @@ describe('tabpage/previous', function()
|
||||
|
||||
local cmdline_win_id = eval('win_getid()')
|
||||
|
||||
-- At this point switching to the previous tab should have no effect.
|
||||
-- Switching to the previous tab now works.
|
||||
feed(characters)
|
||||
|
||||
-- Attempting to switch tabs maintains the current window.
|
||||
eq(cmdline_win_id, eval('win_getid()'))
|
||||
eq(completion_visible, eval('complete_info().pum_visible'))
|
||||
|
||||
-- The current tab is still the fourth.
|
||||
eq(4, eval('tabpagenr()'))
|
||||
|
||||
-- The previous tab is still the third.
|
||||
eq(3, eval("tabpagenr('#')"))
|
||||
-- Focus moved out of the cmdwin to the previous (third) tab.
|
||||
t.neq(cmdline_win_id, eval('win_getid()'))
|
||||
eq(3, eval('tabpagenr()'))
|
||||
end
|
||||
end
|
||||
|
||||
it('cmdwin prevents tab switch via g<Tab>', cmdwin_prevents_tab_switch('g<Tab>', 0))
|
||||
it('cmdwin prevents tab switch via <C-W>g<Tab>', cmdwin_prevents_tab_switch('<C-W>g<Tab>', 0))
|
||||
it('cmdwin prevents tab switch via <C-Tab>', cmdwin_prevents_tab_switch('<C-Tab>', 0))
|
||||
it('cmdwin prevents tab switch via :tabn #<CR>', cmdwin_prevents_tab_switch(':tabn #<CR>', 0))
|
||||
it('cmdwin allows tab switch via g<Tab>', cmdwin_allows_tab_switch('g<Tab>'))
|
||||
it('cmdwin allows tab switch via <C-W>g<Tab>', cmdwin_allows_tab_switch('<C-W>g<Tab>'))
|
||||
it('cmdwin allows tab switch via <C-Tab>', cmdwin_allows_tab_switch('<C-Tab>'))
|
||||
it('cmdwin allows tab switch via :tabn #<CR>', cmdwin_allows_tab_switch(':tabn #<CR>'))
|
||||
|
||||
it(':tabs indicates correct prevtab curwin', function()
|
||||
-- Add three tabs for a total of four
|
||||
|
||||
Reference in New Issue
Block a user