From a6d084fe44090fd32e33ab828aae6c8198cfdd8c Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 6 Aug 2024 16:41:25 +0300 Subject: feat(filetype): Move and improve terminal mode autoinsert --- lua/filetype.lua | 9 ++++++--- lua/text.lua | 6 ------ 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'lua') diff --git a/lua/filetype.lua b/lua/filetype.lua index 9e83e0c..9f7e2b3 100644 --- a/lua/filetype.lua +++ b/lua/filetype.lua @@ -1,8 +1,11 @@ --[=[ Terminal buffers ]=]-- -vim.api.nvim_create_autocmd("TermOpen", { - command = "setlocal nonu | startinsert" -}) +vim.api.nvim_create_autocmd({ "TermOpen", "BufEnter" }, { callback = function (ev) + if vim.bo.buftype == "terminal" then + vim.wo.number = false + vim.cmd("startinsert") + end +end }) vim.api.nvim_create_autocmd("TermClose", { command = "quit!" }) diff --git a/lua/text.lua b/lua/text.lua index 6a95095..2538284 100644 --- a/lua/text.lua +++ b/lua/text.lua @@ -32,12 +32,6 @@ vim.o.shiftwidth = 4 -- Indent with 4 spaces vim.o.splitbelow = true vim.o.splitright = true -vim.api.nvim_create_autocmd({ "BufEnter" }, { callback = function (ev) - if vim.bo.buftype == "terminal" then - vim.cmd("startinsert") - vim.wo.number = false - end -end }) vim.o.number = true vim.o.signcolumn = "number" -- cgit v1.3.1-23-gd82d