nvim: move packer autocmd back; remove detect-language.nvim

The plugins' configurations are lazy-loaded, so better not doing the
autocmd early (improve startup time a little bit)
This commit is contained in:
Hoang Nguyen 2021-11-30 13:46:49 +07:00
parent 64d40962e6
commit 1cc8d84e41
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
4 changed files with 9 additions and 14 deletions

View File

@ -57,18 +57,12 @@ local augroups = {
{'FileType', 'markdown', 'lua WhichkeyMarkdown()'}
},
plugins = {
-- Re-compile packer_compile.lua on config changed
{'BufWritePost', '*.lua', 'lua Packer_compile_on_save()'},
-- Autohide tabline on dashboard
{'FileType', 'alpha', 'set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2'},
-- Wrap in Telescope preview window
{'User', 'TelescopePreviewerLoaded', 'setlocal wrap'},
-- Lsp lightbulb
{'CursorHold', '*', 'lua Lightbulb_codeaction()'},
-- Refresh indent blankline more often (since it is lazy-loaded)
-- {'CursorMoved', '* IndentBlanklineRefresh'},
-- Auto-detect syntax
-- {'BufNewFile', '* DetectLanguageBufEnable'},
-- Change directory more eagerly
-- {'BufEnter', '* lua Set_window_project_dir()'}
}

View File

@ -50,6 +50,7 @@ packer.init {
luarocks = {python_cmd = 'python3'}
}
-- Re-compile packer_compile.lua on config changed
function Packer_compile_on_save()
local file = fn.expand('%:p')
local filename = fn.expand('%:p:t')
@ -59,5 +60,13 @@ function Packer_compile_on_save()
cmd('source <afile> | PackerCompile')
end
end
vim.api.nvim_exec(
[[
augroup packer
autocmd!
autocmd BufWritePost *.lua lua Packer_compile_on_save()
augroup END
]],
false)
return packer

View File

@ -217,10 +217,6 @@ function M.treesitter()
require('mappings').treesitter()
end
-- function M.detect_language()
-- require('detect-language').setup()
-- end
-- function M.spellsitter()
-- require('spellsitter').setup {
-- -- Whether enabled, can be a list of filetypes, e.g. {'python', 'lua'}

View File

@ -37,10 +37,6 @@ M['p00f/nvim-ts-rainbow'] = {after = 'nvim-treesitter'}
M['windwp/nvim-ts-autotag'] = {after = 'nvim-treesitter'}
M['romgrk/nvim-treesitter-context'] = {after = 'nvim-treesitter'}
M['JoosepAlviste/nvim-ts-context-commentstring'] = {after = 'nvim-treesitter'}
-- M['spywhere/detect-language.nvim'] = {
-- event = 'BufNewFile',
-- config = conf.detect_language
-- }
-- M['lewis6991/spellsitter.nvim'] = {
-- event = {'BufRead', 'BufNewFile'},
-- config = conf.spellsitter