-
-
Notifications
You must be signed in to change notification settings - Fork 178
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
[BUG] insert_mappings=false
not working
#605
Comments
My fix was removing before vim.keymap.set({ "n", "t" }, "<leader>th", "<cmd>:1ToggleTerm direction=horizontal<CR>")
vim.keymap.set({ "n", "t" }, "<leader>tt", "<cmd>:2ToggleTerm direction=horizontal<CR>")
vim.keymap.set({ "n", "t" }, "<leader>tn", "<cmd>:3ToggleTerm direction=horizontal<CR>")
vim.keymap.set({ "n", "t" }, "<leader>ts", "<cmd>:4ToggleTerm direction=horizontal<CR>")
vim.keymap.set({ "n", "t" }, "<leader>tc", "<cmd>:ToggleTermToggleAll<CR>") after vim.keymap.set("n", "<leader>th", "<cmd>:1ToggleTerm direction=horizontal<CR>")
vim.keymap.set("n", "<leader>tt", "<cmd>:2ToggleTerm direction=horizontal<CR>")
vim.keymap.set("n", "<leader>tn", "<cmd>:3ToggleTerm direction=horizontal<CR>")
vim.keymap.set("n", "<leader>ts", "<cmd>:4ToggleTerm direction=horizontal<CR>")
vim.keymap.set("n", "<leader>tc", "<cmd>:ToggleTermToggleAll<CR>") complete return {
"akinsho/nvim-toggleterm.lua",
opts = {
auto_scroll = true,
close_on_exit = true,
hide_numbers = true,
insert_mappings = false, -- Relevant
persist_size = true,
shade_terminals = false,
start_in_insert = true,
terminal_mappings = false, -- Relevant
},
config = function(_, opts)
local toggle_term = require("toggleterm")
-- Windows
if vim.fn.has("win32") == 1 then
opts.shell_command = "pwsh.exe -NoLogo"
end
toggle_term.setup(opts)
vim.keymap.set(
"n",
"<leader>th",
"<CMD>:1ToggleTerm direction=horizontal<CR>",
{ desc = "ToggleTerm: Horizontal 1" }
)
vim.keymap.set(
"n",
"<leader>tt",
"<CMD>:2ToggleTerm direction=horizontal<CR>",
{ desc = "ToggleTerm: Horizontal 2" }
)
vim.keymap.set(
"n",
"<leader>tn",
"<CMD>:3ToggleTerm direction=horizontal<CR>",
{ desc = "ToggleTerm: Horizontal 3" }
)
vim.keymap.set(
"n",
"<leader>ts",
"<CMD>:4ToggleTerm direction=horizontal<CR>",
{ desc = "ToggleTerm: Horizontal 4" }
)
vim.keymap.set("n", "<leader>tc", "<CMD>:ToggleTermToggleAll<CR>", { desc = "ToggleTerm: Toggle All" })
function _G.set_terminal_keymaps()
local opts = { buffer = 0 }
vim.keymap.set("t", "<esc>", [[<C-\><C-n>]], opts)
vim.keymap.set("t", "jk", [[<C-\><C-n>]], opts)
vim.keymap.set("t", "<C-h>", [[<Cmd>wincmd h<CR>]], opts)
vim.keymap.set("t", "<C-j>", [[<Cmd>wincmd j<CR>]], opts)
vim.keymap.set("t", "<C-k>", [[<Cmd>wincmd k<CR>]], opts)
vim.keymap.set("t", "<C-l>", [[<Cmd>wincmd l<CR>]], opts)
vim.keymap.set("t", "<C-w>", [[<C-\><C-n><C-w>]], opts)
end
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()")
end,
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there an existing issue for this?
Current Behavior
I have this configuration:
with leader being spacebar, when hitting spacebar to separate words it keeps waiting for the next key and only option it apears in
which key
is toggle termExpected Behavior
insert_mappings=false
should prevent me from hitting<leader>t
to close the terminal while writingSteps To Reproduce
leader
<leader>t]
Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: