diff options
| author | Jack Jamison <jackqjamison@gmail.com> | 2026-05-13 19:32:22 -0400 |
|---|---|---|
| committer | Jack Jamison <jackqjamison@gmail.com> | 2026-05-13 19:32:22 -0400 |
| commit | 2f3f91682f7b4a33f1791781bfa8eca4f7c9527a (patch) | |
| tree | eaf91e90301d87363bcb22dcd5c2253e0b0bad6d /archive/.config/nvim/lua/autocmds.lua | |
| parent | be8c956b0e819f2db0c6ae3598b6590b62982a83 (diff) | |
new system on gentoo
Diffstat (limited to 'archive/.config/nvim/lua/autocmds.lua')
| -rw-r--r-- | archive/.config/nvim/lua/autocmds.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/archive/.config/nvim/lua/autocmds.lua b/archive/.config/nvim/lua/autocmds.lua new file mode 100644 index 0000000..bff808a --- /dev/null +++ b/archive/.config/nvim/lua/autocmds.lua @@ -0,0 +1,22 @@ +-- Wrap and check for spell in text filetypes. +vim.api.nvim_create_autocmd('FileType', { + group = vim.api.nvim_create_augroup('wrap_spell', { clear = true }), + pattern = { 'gitcommit', 'markdown' }, + callback = function() + vim.opt_local.wrap = true + vim.opt_local.spell = true + end, +}) + +-- Go to last loc when opening a buffer. +vim.api.nvim_create_autocmd('BufReadPost', { + group = vim.api.nvim_create_augroup('last_loc', { clear = true }), + callback = function() + local mark = vim.api.nvim_buf_get_mark(0, '"') + local lcount = vim.api.nvim_buf_line_count(0) + if mark[1] > 0 and mark[1] <= lcount then + -- Protected call to catch errors. + pcall(vim.api.nvim_win_set_cursor, 0, mark) + end + end, +}) |
