gabrielgio.lua @ 3b1b874ac22ef5626098bd7a0b761167aeb6374a

 1local key = require("gabrielgio.key")
 2
 3require("toggleterm").setup()
 4
 5local function isempty(s)
 6	return s == nil or s == ""
 7end
 8
 9local lastCommand = ""
10
11key.nnoremap("<C-n>", ":Neogit kind=replace<cr>")
12key.nnoremap("<C-p>", ":ToggleTerm size=40 direction=float<cr>")
13key.nnoremap("<C-l>", ":ToggleTerm size=200 direction=vertical<cr>")
14key.nnoremap("<C-y>", function()
15	local user_input = vim.fn.input("$ ")
16
17	if isempty(user_input) then
18		user_input = lastCommand
19	end
20
21	if not isempty(user_input) then
22		vim.cmd(string.format("TermExec cmd='%s'", user_input))
23		lastCommand = user_input
24	end
25end)
26key.tnoremap("<Esc>", "<C-\\><C-n>")
27key.tnoremap("<C-p>", "<C-\\><C-n>:ToggleTerm<cr>")
28key.tnoremap("<C-l>", "<C-\\><C-n>:ToggleTerm<cr>")