Skip to content

Commit

Permalink
fix(keymaps): terminal show/hide
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jun 6, 2023
1 parent 41765a4 commit 1897617
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lua/lazyvim/config/keymaps.lua
Expand Up @@ -127,19 +127,19 @@ end

-- floating terminal
local lazyterm = function() Util.float_term(nil, { cwd = Util.get_root() }) end
map("n", "<leader>ft", lazyterm, { desc = "Terminal (root dir)" })
map("n", "<leader>ft", lazyterm, { desc = "Terminal (root dir)" })
map("n", "<leader>fT", function() Util.float_term() end, { desc = "Terminal (cwd)" })
map("n", "<c-/>", lazyterm, { desc = "Terminal (root dir)" })
map("n", "<c-_>", "<c-/>", { remap = true, desc = "which_key_ignore" })
map("n", "<c-_>", lazyterm, { desc = "which_key_ignore" })

-- Terminal Mappings
map("t", "<esc><esc>", "<c-\\><c-n>", { desc = "Enter Normal Mode" })
map("t", "<C-h>", "<cmd>wincmd h<cr>", { desc = "Go to left window"})
map("t", "<C-j>", "<cmd>wincmd j<cr>", { desc = "Go to lower window"})
map("t", "<C-k>", "<cmd>wincmd k<cr>", { desc = "Go to upper window"})
map("t", "<C-l>", "<cmd>wincmd l<cr>", { desc = "Go to right window"})
map("t", '<C-/>', "<cmd>close<cr>", {desc = "Hide Terminal"})
map("t", "<c-_>", "<c-/>", { remap = true, desc = "which_key_ignore" })
map("t", "<C-h>", "<cmd>wincmd h<cr>", { desc = "Go to left window" })
map("t", "<C-j>", "<cmd>wincmd j<cr>", { desc = "Go to lower window" })
map("t", "<C-k>", "<cmd>wincmd k<cr>", { desc = "Go to upper window" })
map("t", "<C-l>", "<cmd>wincmd l<cr>", { desc = "Go to right window" })
map("t", "<C-/>", "<cmd>close<cr>", { desc = "Hide Terminal" })
map("t", "<c-_>", "<cmd>close<cr>", { desc = "which_key_ignore" })

-- windows
map("n", "<leader>ww", "<C-W>p", { desc = "Other window", remap = true })
Expand Down

4 comments on commit 1897617

@fredrikaverpil
Copy link
Contributor

@fredrikaverpil fredrikaverpil commented on 1897617 Jun 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@folke I noticed that I was unable to toggle the terminal with <C-/> when in tmux, but this works as of this release. Was it because of this change?
Anyway - this is so awesome. I love the work you are doing on LazyVim! πŸ˜„

@folke
Copy link
Collaborator Author

@folke folke commented on 1897617 Jun 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, apparently <c-/> doesn't work in a lot of terminals. The work-around is to map <c-_> instead.

@rofrol
Copy link

@rofrol rofrol commented on 1897617 Jun 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using c-\ but not in tmux, only in iterm2.

@fredrikaverpil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, apparently <c-/> doesn't work in a lot of terminals. The work-around is to map <c-_> instead.

Interesting. So the workaround was to just add the <C-_> keymap?
Sounds like this SO answer explains it.

Please sign in to comment.