-
-
Notifications
You must be signed in to change notification settings - Fork 610
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
Vim(normal):Can't re-enter normal mode from terminal mode #3018
Labels
Comments
The fixs looks reasonable, however I can't reproduce the issue with the standard vim term. Please provide a clean room replication with floaterm and your keybinds so that I can validate the fix. |
@alex-courtis vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.cmd([[set packpath=/tmp/nvt-min/site]])
local package_root = "/tmp/nvt-min/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
require("packer").startup({
{
"wbthomason/packer.nvim",
"nvim-tree/nvim-tree.lua",
"nvim-tree/nvim-web-devicons",
-- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
"voldikss/vim-floaterm",
},
config = {
package_root = package_root,
compile_path = install_path .. "/plugin/packer_compiled.lua",
display = { non_interactive = true },
},
})
end
if vim.fn.isdirectory(install_path) == 0 then
print("Installing nvim-tree and dependencies.")
vim.fn.system({ "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path })
end
load_plugins()
require("packer").sync()
vim.cmd([[autocmd User PackerComplete ++once echo "Ready!" | lua setup()]])
vim.opt.termguicolors = true
vim.opt.cursorline = true
-- MODIFY NVIM-TREE SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
_G.setup = function()
require("nvim-tree").setup({
view = {
centralize_selection = true,
},
})
vim.keymap.set("n", "<C-e>", "<cmd>NvimTreeToggle<cr>")
vim.keymap.set("n", "<C-o>", "<cmd>FloatermToggle<cr>")
vim.keymap.set("t", "<C-o>", "<cmd>FloatermToggle<cr>")
vim.keymap.set("n", "<C-n>", "<cmd>FloatermNew<cr>")
vim.keymap.set("t", "<C-n>", "<cmd>FloatermNew<cr>")
vim.keymap.set("n", "<C-h>", "<cmd>FloatermPrev<cr>")
vim.keymap.set("t", "<C-h>", "<cmd>FloatermPrev<cr>")
end
-- UNCOMMENT this block for diagnostics issues, substituting pattern and cmd as appropriate.
-- Requires diagnostics.enable = true in setup.
--[[
vim.api.nvim_create_autocmd("FileType", {
pattern = "lua",
callback = function()
vim.lsp.start {
name = "my-luals",
cmd = { "lua-language-server" },
root_dir = vim.loop.cwd(),
}
end,
})
]] The steps is as follows:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
When I focus on nvim tree panel, I open vim-floaterm and switch floaterm, it occurs error:
2024-12-06.23.00.29.1.mov
I have read the source code of nvim-tree.lua and I found the reason. When I switch floaterm, the cursor will focus on nvim-tree panel quickly and the mode now is the terminal mode. Because I config
centralize_selection = true
, it will usezz
to centralize selection but now is terminal mode, cannot usezz
command and it causes error.The relevant source code is as follows:
So I think we should first determine whether the mode is terminal mode or not, like this:
Neovim version
Operating system and version
macOS 15.1.1
Windows variant
No response
nvim-tree version
ca7c4c3
Clean room replication
empty
Steps to reproduce
<leader>e
to focus nvim tree panel<C-o>
to open vim-floaterm<C-h/l>
to switch vim-floatermExpected behavior
Not display error when I switch vim-floaterm.
Actual behavior
It occurs error when I switch vim-floaterm.
The text was updated successfully, but these errors were encountered: