fix: allow to easily exit terminal mode
This commit is contained in:
parent
13407572ac
commit
a2211292a7
@ -7,10 +7,13 @@ local saga = require("lspsaga")
|
|||||||
saga.init_lsp_saga()
|
saga.init_lsp_saga()
|
||||||
|
|
||||||
local options = { noremap = true, silent = true }
|
local options = { noremap = true, silent = true }
|
||||||
local remap = { noremap = false }
|
local remap = { noremap = true }
|
||||||
|
|
||||||
g.mapleader = " "
|
g.mapleader = " "
|
||||||
|
|
||||||
|
-- Allows to easily exit terminal mode
|
||||||
|
map('t', '<Esc>', [[<C-\><C-n>]], remap)
|
||||||
|
|
||||||
map("n", "<C-o>", ":Telescope find_files<CR>", options)
|
map("n", "<C-o>", ":Telescope find_files<CR>", options)
|
||||||
map("n", "<C-f>", ":lua require'telescope.builtin'.live_grep{ cwd = vim.fn.getcwd() }<CR>", options)
|
map("n", "<C-f>", ":lua require'telescope.builtin'.live_grep{ cwd = vim.fn.getcwd() }<CR>", options)
|
||||||
-- map("n", "<C-p>", ":Telescope command_center<CR>", options)
|
-- map("n", "<C-p>", ":Telescope command_center<CR>", options)
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
local Terminal = require("toggleterm.terminal").Terminal
|
local Terminal = require("toggleterm.terminal").Terminal
|
||||||
local lazygit =
|
local lazygit = Terminal:new({
|
||||||
Terminal:new(
|
|
||||||
{
|
|
||||||
cmd = "lazygit",
|
cmd = "lazygit",
|
||||||
dir = "git_dir",
|
dir = "git_dir",
|
||||||
direction = "float",
|
direction = "float",
|
||||||
@ -9,15 +7,10 @@ Terminal:new(
|
|||||||
winblend = 0,
|
winblend = 0,
|
||||||
border = "shadow"
|
border = "shadow"
|
||||||
},
|
},
|
||||||
on_open = function(term)
|
|
||||||
vim.cmd("startinsert!")
|
|
||||||
vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", { noremap = true, silent = true })
|
|
||||||
end,
|
|
||||||
on_close = function()
|
on_close = function()
|
||||||
Terminal:close()
|
Terminal:close()
|
||||||
end
|
end
|
||||||
}
|
})
|
||||||
)
|
|
||||||
|
|
||||||
function _Lazygit_toggle()
|
function _Lazygit_toggle()
|
||||||
lazygit:toggle()
|
lazygit:toggle()
|
||||||
@ -25,18 +18,12 @@ end
|
|||||||
|
|
||||||
vim.api.nvim_set_keymap("n", "<C-g>", "<cmd>lua _Lazygit_toggle()<CR>", { noremap = true, silent = true })
|
vim.api.nvim_set_keymap("n", "<C-g>", "<cmd>lua _Lazygit_toggle()<CR>", { noremap = true, silent = true })
|
||||||
|
|
||||||
local pnpm =
|
local pnpm = Terminal:new({
|
||||||
Terminal:new(
|
|
||||||
{
|
|
||||||
cmd = "pnpm dev",
|
cmd = "pnpm dev",
|
||||||
dir = "git_dir",
|
dir = "git_dir",
|
||||||
size = 5,
|
size = 5,
|
||||||
direction = "vertical",
|
direction = "vertical"
|
||||||
on_close = function(term)
|
})
|
||||||
Terminal:close()
|
|
||||||
end
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
function _Pnpm_toggle()
|
function _Pnpm_toggle()
|
||||||
pnpm:toggle()
|
pnpm:toggle()
|
||||||
@ -44,19 +31,16 @@ end
|
|||||||
|
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>d", "<cmd>lua _Pnpm_toggle()<CR>", { noremap = true, silent = true })
|
vim.api.nvim_set_keymap("n", "<Leader>d", "<cmd>lua _Pnpm_toggle()<CR>", { noremap = true, silent = true })
|
||||||
|
|
||||||
local chtConfig =
|
local chtConfig = Terminal:new({
|
||||||
Terminal:new(
|
|
||||||
{
|
|
||||||
cmd = "cht",
|
cmd = "cht",
|
||||||
direction = "float"
|
direction = "float"
|
||||||
}
|
})
|
||||||
)
|
|
||||||
|
|
||||||
function _chtConfig_toggle()
|
function _ChtConfig_toggle()
|
||||||
chtConfig:toggle()
|
chtConfig:toggle()
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.api.nvim_set_keymap("n", "<Leader><C-l>", "<cmd>lua _chtConfig_toggle()<CR>", { noremap = true, silent = true })
|
vim.api.nvim_set_keymap("n", "<Leader><C-l>", "<cmd>lua _ChtConfig_toggle()<CR>", { noremap = true, silent = true })
|
||||||
|
|
||||||
require("toggleterm").setup {
|
require("toggleterm").setup {
|
||||||
shade_terminals = true
|
shade_terminals = true
|
||||||
|
Loading…
Reference in New Issue
Block a user