summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/nvim/lazy-lock.json1
-rw-r--r--.config/nvim/lua/keymaps.lua8
-rw-r--r--.config/nvim/lua/plugins/toggleterm.lua20
3 files changed, 25 insertions, 4 deletions
diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json
index 0f91793..53c47a8 100644
--- a/.config/nvim/lazy-lock.json
+++ b/.config/nvim/lazy-lock.json
@@ -35,6 +35,7 @@
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
"todo-comments.nvim": { "branch": "main", "commit": "51e10f838e84b4756c16311d0b1ef0972c6482d2" },
+ "toggleterm.nvim": { "branch": "main", "commit": "066cccf48a43553a80a210eb3be89a15d789d6e6" },
"tokyonight.nvim": { "branch": "main", "commit": "81c867c5f638597a82c82094dcb90ed42444dabc" },
"vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" },
"vim-tmux-navigator": { "branch": "master", "commit": "5b3c701686fb4e6629c100ed32e827edf8dad01e" },
diff --git a/.config/nvim/lua/keymaps.lua b/.config/nvim/lua/keymaps.lua
index 7eb208d..637ddd1 100644
--- a/.config/nvim/lua/keymaps.lua
+++ b/.config/nvim/lua/keymaps.lua
@@ -17,10 +17,10 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
-- Window resizing
local resize = 2
-vim.keymap.set('n', '<C-Left>', string.format(':vertical resize -%d<CR>', resize), { desc = 'Resize Left' })
-vim.keymap.set('n', '<C-Up>', string.format(':resize -%d<CR>', resize), { desc = 'Resize Up' })
-vim.keymap.set('n', '<C-Down>', string.format(':resize +%d<CR>', resize), { desc = 'Resize Down' })
-vim.keymap.set('n', '<C-Right>', string.format(':vertical resize +%d<CR>', resize), { desc = 'Resize Right' })
+vim.keymap.set({ 'n', 't' }, '<C-Left>', string.format(':vertical resize -%d<CR>', resize), { desc = 'Resize Left' })
+vim.keymap.set({ 'n', 't' }, '<C-Up>', string.format(':resize -%d<CR>', resize), { desc = 'Resize Up' })
+vim.keymap.set({ 'n', 't' }, '<C-Down>', string.format(':resize +%d<CR>', resize), { desc = 'Resize Down' })
+vim.keymap.set({ 'n', 't' }, '<C-Right>', string.format(':vertical resize +%d<CR>', resize), { desc = 'Resize Right' })
-- Keep selection after < and >
vim.keymap.set('v', '<', '<gv', {})
diff --git a/.config/nvim/lua/plugins/toggleterm.lua b/.config/nvim/lua/plugins/toggleterm.lua
new file mode 100644
index 0000000..54126a4
--- /dev/null
+++ b/.config/nvim/lua/plugins/toggleterm.lua
@@ -0,0 +1,20 @@
+return {
+ -- TODO: Consider maybe not using this, and just using tmux panes
+ 'akinsho/toggleterm.nvim',
+ version = '*',
+ config = function()
+ require('toggleterm').setup({})
+ function _G.set_terminal_keymaps()
+ local opts = { buffer = 0 }
+ vim.keymap.set('t', '<esc>', [[<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,
+}