Skip to content

Commit

Permalink
feat(keymaps): added floating terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jan 5, 2023
1 parent 6824254 commit 18756a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lua/lazyvim/config/keymaps.lua
Expand Up @@ -88,6 +88,10 @@ if vim.fn.has("nvim-0.9.0") == 1 then
vim.keymap.set("n", "<leader>hl", vim.show_pos, { desc = "Highlight Groups at cursor" })
end

-- floating terminal
vim.keymap.set("n", "<leader>ot", function() util.float_term(nil, { cwd = util.get_root() }) end, { desc = "Terminal (root dir)" })
vim.keymap.set("n", "<leader>oT", function() require("lazyvim.util").float_term() end, { desc = "Terminal (cwd)" })

-- windows
vim.keymap.set("n", "<leader>ww", "<C-W>p", { desc = "other-window" })
vim.keymap.set("n", "<leader>wd", "<C-W>c", { desc = "delete-window" })
Expand Down
1 change: 1 addition & 0 deletions lua/lazyvim/util.lua
Expand Up @@ -61,6 +61,7 @@ function M.telescope(builtin, opts)
end

function M.float_term(cmd, opts)
cmd = cmd or { vim.env.SHELL or vim.o.shell }
opts = vim.tbl_deep_extend("force", {
terminal = true,
close_on_exit = true,
Expand Down

0 comments on commit 18756a6

Please sign in to comment.