diff options
| author | Justine Smithies <justine@smithies.me.uk> | 2025-11-04 20:34:36 +0000 |
|---|---|---|
| committer | Justine Smithies <justine@smithies.me.uk> | 2025-11-04 20:34:36 +0000 |
| commit | 067b0e87aae4cf81b4dfd0907c6ce1d3650b7523 (patch) | |
| tree | 58512324aa4b6479b328d3424f4507fa7bb9e9ef /.config/nvim/lua/config/autocmd.lua | |
| parent | b3a0a68af5dcb496fdd1b8a40bd0f5a9904659b8 (diff) | |
Initial commit
Diffstat (limited to '.config/nvim/lua/config/autocmd.lua')
| -rw-r--r-- | .config/nvim/lua/config/autocmd.lua | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/.config/nvim/lua/config/autocmd.lua b/.config/nvim/lua/config/autocmd.lua new file mode 100644 index 0000000..6f90977 --- /dev/null +++ b/.config/nvim/lua/config/autocmd.lua @@ -0,0 +1,43 @@ +local autocmd = vim.api.nvim_create_autocmd -- Create autocommand + +-- Remove end of buffer ~ on buffer enter +autocmd('BufEnter', { + pattern = '*', + command = "let &fcs='eob: '" +}) + +-- Turn off line numbers and signcolumn on entering terminal +autocmd("TermOpen", { + callback = function() + vim.opt_local.number = false + vim.opt_local.relativenumber = false + vim.opt_local.signcolumn = 'no' + end, + desc = "Disable line numbers and signcolumnn in terminal", +}) + +-- Insert mode on entering terminal +autocmd('TermOpen', { + pattern = '*', + command = 'startinsert' +}) + +-- Insert mode off on Terminal exit +autocmd('BufLeave', { + pattern = 'term://*', + command = 'stopinsert' +}) + +-- Close terminal buffer on process exit +autocmd('TermClose', { + pattern = 'term://*', + command = 'call nvim_input("<CR>")' +}) + +-- Replacement for vim-highlightedyank +autocmd("TextYankPost", { + desc = "Highlight selection on yanked text", + callback = function() + vim.highlight.on_yank({ higroup = 'IncSearch', timeout = 500 }) + end, +}) |
