From 6e30af8ab70ecf4d9e7d33c46cfb849368e118e2 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Tue, 14 Dec 2021 19:00:29 -0500 Subject: [PATCH] add autocommands add autocommands fix fix s fix close --- init.lua | 1 + lua/user/autocommands.lua | 33 +++++++++++++++++++++++++++++++++ lua/user/bufferline.lua | 8 ++++---- lua/user/lualine.lua | 2 +- lua/user/whichkey.lua | 16 +--------------- 5 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 lua/user/autocommands.lua diff --git a/init.lua b/init.lua index 7dc5c05..6b87573 100644 --- a/init.lua +++ b/init.lua @@ -18,3 +18,4 @@ require "user.impatient" require "user.indentline" require "user.alpha" require "user.whichkey" +require "user.autocommands" diff --git a/lua/user/autocommands.lua b/lua/user/autocommands.lua new file mode 100644 index 0000000..549f510 --- /dev/null +++ b/lua/user/autocommands.lua @@ -0,0 +1,33 @@ +vim.cmd [[ + augroup _general_settings + autocmd! + autocmd FileType qf,help,man,lspinfo nnoremap q :close + autocmd TextYankPost * silent!lua require('vim.highlight').on_yank({higroup = 'Search', timeout = 200}) + autocmd BufWinEnter * :set formatoptions-=cro + autocmd FileType qf set nobuflisted + augroup end + + augroup _git + autocmd! + autocmd FileType gitcommit setlocal wrap + autocmd FileType gitcommit setlocal spell + augroup end + + augroup _markdown + autocmd! + autocmd FileType markdown setlocal wrap + autocmd FileType markdown setlocal spell + augroup end + + augroup _auto_resize + autocmd! + autocmd VimResized * tabdo wincmd = + augroup end + + augroup _alpha + autocmd! + autocmd User AlphaReady set showtabline=0 | autocmd BufUnload set showtabline=2 + augroup end + +]] + diff --git a/lua/user/bufferline.lua b/lua/user/bufferline.lua index 81015c5..7d98cf0 100644 --- a/lua/user/bufferline.lua +++ b/lua/user/bufferline.lua @@ -92,12 +92,12 @@ bufferline.setup { }, close_button = { - guifg = { attribute = "fg", highlight = "TabLineSel" }, - guibg = { attribute = "bg", highlight = "TabLineSel" }, + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, }, close_button_visible = { - guifg = { attribute = "fg", highlight = "TabLineSel" }, - guibg = { attribute = "bg", highlight = "TabLineSel" }, + guifg = { attribute = "fg", highlight = "TabLine" }, + guibg = { attribute = "bg", highlight = "TabLine" }, }, -- close_button_selected = { -- guifg = {attribute='fg',highlight='TabLineSel'}, diff --git a/lua/user/lualine.lua b/lua/user/lualine.lua index 50484cb..3318ecd 100644 --- a/lua/user/lualine.lua +++ b/lua/user/lualine.lua @@ -68,7 +68,7 @@ lualine.setup({ theme = "auto", component_separators = { left = "", right = "" }, section_separators = { left = "", right = "" }, - disabled_filetypes = { "dashboard", "NvimTree", "Outline" }, + disabled_filetypes = { "alpha", "dashboard", "NvimTree", "Outline" }, always_divide_middle = true, }, sections = { diff --git a/lua/user/whichkey.lua b/lua/user/whichkey.lua index 56f18f9..994435f 100644 --- a/lua/user/whichkey.lua +++ b/lua/user/whichkey.lua @@ -87,8 +87,7 @@ local mappings = { ["e"] = { "NvimTreeToggle", "Explorer" }, ["w"] = { "w!", "Save" }, ["q"] = { "q!", "Quit" }, - ["/"] = { "lua require('Comment').toggle()", "Comment" }, - ["c"] = { "Bdelete! %d", "Close Buffer" }, + ["c"] = { "Bdelete!", "Close Buffer" }, ["h"] = { "nohlsearch", "No Highlight" }, ["f"] = { "lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})", @@ -184,18 +183,5 @@ local mappings = { }, } -local vopts = { - mode = "v", -- VISUAL mode - prefix = "", - buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings - silent = true, -- use `silent` when creating keymaps - noremap = true, -- use `noremap` when creating keymaps - nowait = true, -- use `nowait` when creating keymaps -} -local vmappings = { - ["/"] = { "lua require('Comment.api').gc(vim.fn.visualmode())", "Comment" }, -} - which_key.setup(setup) which_key.register(mappings, opts) -which_key.register(vmappings, vopts)