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