From 6c69440f84bbeede5f3288935c3d504658d92017 Mon Sep 17 00:00:00 2001 From: Squibid Date: Fri, 23 Dec 2022 15:11:12 -0500 Subject: allow to auto open term bufers and close them easier along with some more code window ignores --- init.lua | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index fafa001..9cb7d5c 100644 --- a/init.lua +++ b/init.lua @@ -100,6 +100,13 @@ a.nvim_create_autocmd('TermOpen', { command = 'startinsert | set winfixheight' }) +-- close terminal buffers after shell dies +a.nvim_create_autocmd('TermClose', { + group = 'bufcheck', + pattern = 'term://*', + command = 'call nvim_input("")' +}) + -- start git messages in insert mode a.nvim_create_autocmd('FileType', { group = 'bufcheck', @@ -113,8 +120,11 @@ a.nvim_create_autocmd('FileType', { local default_opts = { noremap = true, silent = true } local expr_opts = { noremap = true, expr = true, silent = true } --- use esc to close term -a.nvim_set_keymap("t", "", "", default_opts) +-- esc to go to normal mode in term bufers +a.nvim_set_keymap("t", "", "", default_opts) + +-- open term buffer +a.nvim_set_keymap("n", "to", "vw:term", default_opts) -- open file viewer a.nvim_set_keymap("n", "", ":Explore", default_opts) @@ -232,6 +242,17 @@ custom.inactive = { z = { bg = colors.grey }, } +local function diff_source() + local gitsigns = vim.b.gitsigns_status_dict + if gitsigns then + return { + added = gitsigns.added, + modified = gitsigns.changed, + removed = gitsigns.removed + } + end +end + require('lualine').setup { options = { icons_enabled = false, @@ -268,7 +289,7 @@ require('lualine').setup { } } }, - lualine_c = {'diff'}, + lualine_c = { { 'diff', source = diff_source } }, lualine_x = { { 'fileformat', color = { gui = 'bold' } @@ -462,6 +483,7 @@ return require('packer').startup(function(use) exclude_filetypes = { "netrw", "help", + "term", "packer", }, }) -- cgit v1.2.1