diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index 397cd86..2af02a3 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -2,36 +2,8 @@ -- https://github.com/elianiva/dotfiles/ - with much gratitude local api = vim.api --- Highlight whatever is being yanked -vim.api.nvim_create_autocmd({ "TextYankPost" }, { - command = 'silent! lua require"vim.highlight".on_yank{timeout=500}', - desc = "Highlight yanked text whenevery yanking something", - group = vim.api.nvim_create_augroup('highlightyanks', { clear = true }) -}) - --- Special setting for editing gopass files - make sure nothing leaks outside the directories it is supposed to -vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, { - pattern = { - "/dev/shm/gopass.*", "/dev/shm/pass.?*/?*.txt", - "$TMPDIR/pass.?*/?*.txt", "/tmp/pass.?*/?*.txt" - }, - command = '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 }) -}) - 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 }) -}) - local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ @@ -50,6 +22,7 @@ vim.opt.rtp:prepend(lazypath) vim.g.mapleader = " " require('settings') +require('autocmds') require("lazy").setup("plugins") require('look') require('maps') diff --git a/nvim/.config/nvim/lua/autocmds.lua b/nvim/.config/nvim/lua/autocmds.lua new file mode 100644 index 0000000..909817a --- /dev/null +++ b/nvim/.config/nvim/lua/autocmds.lua @@ -0,0 +1,27 @@ +-- Highlight whatever is being yanked +vim.api.nvim_create_autocmd({ "TextYankPost" }, { + command = 'silent! lua require"vim.highlight".on_yank{timeout=500}', + desc = "Highlight yanked text whenevery yanking something", + group = vim.api.nvim_create_augroup('highlightyanks', { clear = true }) +}) + +-- Special setting for editing gopass files - make sure nothing leaks outside the directories it is supposed to +vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, { + pattern = { + "/dev/shm/gopass.*", "/dev/shm/pass.?*/?*.txt", + "$TMPDIR/pass.?*/?*.txt", "/tmp/pass.?*/?*.txt" + }, + command = '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 }) +}) + +-- 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 }) +})