nvim: Change init autocmds to lua versions
With neovim 0.7 bringing autocmd bindings in lua, we can now rely on a built-in api instead of having to use our own helper function. Last missing migration is the lsp formatting autogroup.
This commit is contained in:
parent
cbf1e4e8e2
commit
a0968bcf93
1 changed files with 22 additions and 29 deletions
|
@ -1,6 +1,5 @@
|
||||||
-- much of this config comes from
|
-- many ideas for this config come from
|
||||||
-- https://github.com/elianiva/dotfiles/ - with much gratitude
|
-- https://github.com/elianiva/dotfiles/ - with much gratitude
|
||||||
local augroup = require("helpers.augroup")
|
|
||||||
local api = vim.api
|
local api = vim.api
|
||||||
|
|
||||||
require('settings')
|
require('settings')
|
||||||
|
@ -9,34 +8,28 @@ require('look')
|
||||||
require('maps')
|
require('maps')
|
||||||
|
|
||||||
-- Highlight whatever is being yanked
|
-- Highlight whatever is being yanked
|
||||||
augroup({
|
vim.api.nvim_create_autocmd({ "TextYankPost" }, {
|
||||||
{
|
command = 'silent! lua require"vim.highlight".on_yank{timeout=500}',
|
||||||
'TextYankPost', '*',
|
desc = "Highlight yanked text whenevery yanking something",
|
||||||
'silent! lua require"vim.highlight".on_yank{timeout=500}'
|
group = vim.api.nvim_create_augroup('highlightyanks', { clear = true }),
|
||||||
}
|
})
|
||||||
}, 'highlightyanks')
|
|
||||||
|
|
||||||
-- Compile on plugin edits
|
|
||||||
augroup({{'BufWritePost', 'plugins.lua', 'PackerCompile'}}, 'compilepackages')
|
|
||||||
|
|
||||||
-- Special setting for editing gopass files - make sure nothing leaks outside the directories it is supposed to
|
-- Special setting for editing gopass files - make sure nothing leaks outside the directories it is supposed to
|
||||||
augroup({
|
vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, {
|
||||||
{
|
pattern = { "/dev/shm/gopass.*", "/dev/shm/pass.?*/?*.txt", "$TMPDIR/pass.?*/?*.txt", "/tmp/pass.?*/?*.txt" },
|
||||||
'BufNewFile,BufRead', '/dev/shm/gopass.*',
|
command = 'setlocal noswapfile nobackup noundofile nowritebackup viminfo=',
|
||||||
'setlocal noswapfile nobackup noundofile nowritebackup viminfo='
|
desc = "Don't leak any information when editing potential password files",
|
||||||
}, {
|
group = vim.api.nvim_create_augroup('passnoleak', { clear = true }),
|
||||||
'BufNewFile,BufRead', '/dev/shm/pass.?*/?*.txt',
|
})
|
||||||
'setlocal noswapfile nobackup noundofile nowritebackup viminfo='
|
|
||||||
}, {
|
|
||||||
'BufNewFile,BufRead', '$TMPDIR/pass.?*/?*.txt',
|
|
||||||
'setlocal noswapfile nobackup noundofile nowritebackup viminfo='
|
|
||||||
}, {
|
|
||||||
'BufNewFile,BufRead', '/tmp/pass.?*/?*.txt',
|
|
||||||
'setlocal noswapfile nobackup noundofile nowritebackup viminfo='
|
|
||||||
}
|
|
||||||
}, 'passnoleak')
|
|
||||||
|
|
||||||
-- fixing neovim opening up at same moment as alacritty (see https://github.com/neovim/neovim/issues/11330)
|
|
||||||
augroup({{'VimEnter', '*', 'silent exec "!kill -s SIGWINCH $PPID"'}}, 'fixsize')
|
|
||||||
|
|
||||||
api.nvim_exec('runtime abbrev.vim', false)
|
api.nvim_exec('runtime abbrev.vim', false)
|
||||||
|
|
||||||
|
-- fixing neovim opening up at same moment as alacritty (see https://github.com/neovim/neovim/issues/11330)
|
||||||
|
vim.api.nvim_create_autocmd({ "VimEnter" }, {
|
||||||
|
callback = function()
|
||||||
|
local pid, WINCH = vim.fn.getpid(), vim.loop.constants.SIGWINCH
|
||||||
|
vim.defer_fn(function() vim.loop.kill(pid, WINCH) end, 20)
|
||||||
|
end,
|
||||||
|
desc = "Fix neovim sizing issues if opening same time as alacritty",
|
||||||
|
group = vim.api.nvim_create_augroup('alacritty_fixsize', { clear = true }),
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in a new issue