Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Vim(wincmd):E11: Invalid in command-line window #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion lua/Navigator/navigate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ local function back_to_mux(at_edge)
return N.last_pane or at_edge
end

---Checks whether is command-line window
---@return boolean
local function is_command_line_window()
local window_type = vim.fn.getcmdwintype()
if window_type == ':' then
return true
end
return false
end

---For smoothly navigating through neovim splits and mux panes
---@param direction string
function N.navigate(direction)
Expand All @@ -74,7 +84,11 @@ function N.navigate(direction)

local mux_last_pane = direction == 'p' and N.last_pane
if not mux_last_pane then
cmd('wincmd ' .. direction)
if is_command_line_window() then
print('Vim(wincmd):E11: Invalid in command-line window; <CR> executes, CTRL-C quits')
else
cmd('wincmd ' .. direction)
end
end

-- After navigation, if the old window and new window matches
Expand Down