mirror of
https://github.com/boxpositron/absolute-vim.git
synced 2026-02-28 11:40:36 +00:00
style(toggleterm.lua): fix indentation and alignment for better readability
feat(toggleterm.lua): add lazygit terminal setup with custom configurations feat(toggleterm.lua): add keymap to toggle lazygit terminal with leader key feat(toggleterm.lua): comment out keymap for opening a general terminal
This commit is contained in:
@@ -2,35 +2,35 @@ local toggle_term = require("toggleterm")
|
|||||||
local Terminal = require("toggleterm.terminal").Terminal
|
local Terminal = require("toggleterm.terminal").Terminal
|
||||||
|
|
||||||
toggle_term.setup({
|
toggle_term.setup({
|
||||||
direction = "float",
|
direction = "float",
|
||||||
})
|
})
|
||||||
|
|
||||||
local opts = { noremap = true, silent = true }
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
local lazygit = Terminal:new({
|
local lazygit = Terminal:new({
|
||||||
cmd = "lazygit",
|
cmd = "lazygit",
|
||||||
dir = "git_dir",
|
dir = "git_dir",
|
||||||
direction = "float",
|
direction = "float",
|
||||||
float_opts = {
|
float_opts = {
|
||||||
border = "double",
|
border = "double",
|
||||||
},
|
},
|
||||||
-- function to run on opening the terminal
|
-- function to run on opening the terminal
|
||||||
on_open = function(term)
|
on_open = function(term)
|
||||||
vim.cmd("startinsert!")
|
vim.cmd("startinsert!")
|
||||||
vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", opts)
|
vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", opts)
|
||||||
end,
|
end,
|
||||||
-- function to run on closing the terminal
|
-- function to run on closing the terminal
|
||||||
on_close = function(term)
|
on_close = function(term)
|
||||||
vim.cmd("startinsert!")
|
vim.cmd("startinsert!")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
function _LAZYGIT_TOGGLE()
|
function _LAZYGIT_TOGGLE()
|
||||||
lazygit:toggle()
|
lazygit:toggle()
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.desc = "Open lazygit"
|
opts.desc = "Open lazygit"
|
||||||
vim.api.nvim_set_keymap("n", "<leader>gs", "<cmd>lua _LAZYGIT_TOGGLE()<CR>", opts)
|
vim.api.nvim_set_keymap("n", "<leader>gs", "<cmd>lua _LAZYGIT_TOGGLE()<CR>", opts)
|
||||||
|
|
||||||
opts.desc = "Open a terminal"
|
-- opts.desc = "Open a terminal"
|
||||||
vim.api.nvim_set_keymap("n", "<C-`>", "<cmd>ToggleTerm<CR>", opts)
|
-- vim.api.nvim_set_keymap("n", "<C-`>", "<cmd>ToggleTerm<CR>", opts)
|
||||||
|
|||||||
Reference in New Issue
Block a user