terminal mode works!

This commit is contained in:
Zynh0722 2023-04-07 02:24:37 -07:00
parent 7f602c8277
commit a009f4db44
2 changed files with 27 additions and 2 deletions

View file

@ -12,6 +12,21 @@ vim.api.nvim_create_autocmd('TextYankPost', {
-- autocmd TermOpen * startinsert
-- ]]
vim.api.nvim_create_autocmd("TermOpen", {
command = "startinsert"
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter", "WinEnter", "TermOpen" }, {
callback = function()
vim.o.relativenumber = false
vim.o.number = false
vim.cmd.startinsert()
end,
pattern = { "term://*" }
})
vim.api.nvim_create_autocmd({ "BufLeave" }, {
callback = function() vim.cmd.stopinsert() end,
pattern = { "term://*" }
})
vim.api.nvim_create_autocmd({ "TermClose" }, {
callback = function() vim.api.nvim_input("<CR>") end,
})

View file

@ -41,6 +41,16 @@ vim.keymap.set("n", "<C-j>", "<C-w>j")
vim.keymap.set("n", "<C-k>", "<C-w>k")
vim.keymap.set("n", "<C-l>", "<C-w>l")
vim.keymap.set("i", "<C-h>", "<C-w>h")
vim.keymap.set("i", "<C-j>", "<C-w>j")
vim.keymap.set("i", "<C-k>", "<C-w>k")
vim.keymap.set("i", "<C-l>", "<C-w>l")
vim.keymap.set("t", "<C-h>", "<C-w>h")
vim.keymap.set("t", "<C-j>", "<C-w>j")
vim.keymap.set("t", "<C-k>", "<C-w>k")
vim.keymap.set("t", "<C-l>", "<C-w>l")
vim.keymap.set("n", "<C-z>", function()
vim.cmd.vsplit()
vim.cmd.terminal()