Closed dennisbakhuis closed 9 months ago
I think I solved my own problem 🎉
The "open_mapping" of course had a verbose {i,t}map <leader>
.
For future selfs and people like me, this is my working config:
return {
'akinsho/toggleterm.nvim',
version = "*",
config = function()
require("toggleterm").setup {
size = function(term)
if term.direction == "horizontal" then
return 15
elseif term.direction == "vertical" then
return vim.o.columns * 0.4
end
end,
-- open_mapping = [[<leader>tt]],
start_in_insert = true,
insert_mappings = false,
persist_size = true,
direction = "horizontal",
}
-------------------------
-- additional keybindings
-------------------------
-- toggle terminal
vim.keymap.set('n', '<C-Enter>', [[<Cmd>ToggleTerm<CR>]], {})
vim.keymap.set('t', '<C-Enter>', [[<Cmd>ToggleTerm<CR>]], {})
-- open a vertical terminal if new
vim.keymap.set('n', '<leader>tv', [[<Cmd>ToggleTerm direction=vertical<CR>]], {})
-- open a horizontal terminal if new
vim.keymap.set('n', '<leader>th', [[<Cmd>ToggleTerm direction=horizontal<CR>]], {})
-- move to other windows
vim.keymap.set('t', '<C-h>', [[<C-\><C-n><C-w>h]], {noremap = true})
vim.keymap.set('t', '<C-j>', [[<C-\><C-n><C-w>j]], {noremap = true})
vim.keymap.set('t', '<C-k>', [[<C-\><C-n><C-w>k]], {noremap = true})
vim.keymap.set('t', '<C-l>', [[<C-\><C-n><C-w>l]], {noremap = true})
-- copy to clipboard
vim.keymap.set('t', '<C-y>', [[<C-\><C-n>"+yi]], {noremap = true})
-- paste from clipboard
vim.keymap.set('t', '<C-p>', [[<C-\><C-n>"+pi]], {noremap = true})
end,
}
Thanks again for this nice plugin.
So are you saying that insert_mappings = false
did not work?
Hey there! I'm really curious about this too! Could you share how you managed to solve the problem? I'm struggling with it as well, and I'd really appreciate your help in clarifying things for me. Thanks a bunch!
Is there an existing issue for this?
Current Behavior
When using ToggleTerm in the terminal the lags as if a is pressed.
Using
verbose imap <leader>
andverbose tmap <leader>
no mappings are found. In ToggleTerm config I explicitly setinsert_mapping = false
.With the regular
:terminal
the space is not lagging.Expected Behavior
I expect the to be not lagging
Steps To Reproduce
Anything else?
Thanks for this nice plugin
I feel a bit stupid for not finding the reason why it is lagging but I also do not seem to find a solution so I have a feeling it is how I have configured it.