aboutsummaryrefslogtreecommitdiff
path: root/lua/pml68/configs
diff options
context:
space:
mode:
authorpml68 <tutorialmester@gmail.com>2024-03-19 19:01:17 +0100
committerpml68 <tutorialmester@gmail.com>2024-03-19 19:01:17 +0100
commitee6ffc7ba80dc4a17080fec5285a976e7db18d37 (patch)
tree6e9c4804a39ed368e75cf4521d6c62e6f209376f /lua/pml68/configs
parentfeat: add line number keymaps (diff)
downloadnvim-ee6ffc7ba80dc4a17080fec5285a976e7db18d37.tar.gz
feat: add keymaps for moving in and out of terminal
Diffstat (limited to '')
-rw-r--r--lua/pml68/configs/toggleterm.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/lua/pml68/configs/toggleterm.lua b/lua/pml68/configs/toggleterm.lua
index 6bf4f14..ada288c 100644
--- a/lua/pml68/configs/toggleterm.lua
+++ b/lua/pml68/configs/toggleterm.lua
@@ -13,3 +13,15 @@ function _lazygit_toggle()
end
vim.keymap.set("n", "<leader>g", "<cmd> lua _lazygit_toggle() <CR>", {noremap = true, silent = true})
+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
+
+vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')