Skip to content

Commit

Permalink
feat(nvim): add augroup for auto cursorline autocmd
Browse files Browse the repository at this point in the history
  • Loading branch information
kutsan committed Jan 19, 2025
1 parent 41ae131 commit 0ed5ca1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .config/nvim/plugin/autocmds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ vim.api.nvim_create_autocmd('VimResized', {

vim.api.nvim_create_autocmd({ 'InsertLeave', 'WinEnter' }, {
desc = 'Show cursor line only in active window.',
group = vim.api.nvim_create_augroup(
'AutoCursorlineShowCursorline',
{ clear = true }
),
callback = function()
if vim.w.auto_cursorline then
vim.wo.cursorline = true
Expand All @@ -110,6 +114,10 @@ vim.api.nvim_create_autocmd({ 'InsertLeave', 'WinEnter' }, {
})
vim.api.nvim_create_autocmd({ 'InsertEnter', 'WinLeave' }, {
desc = 'Show cursor line only in active window.',
group = vim.api.nvim_create_augroup(
'AutoCursorlineHideCursorline',
{ clear = true }
),
callback = function()
if vim.wo.cursorline then
vim.w.auto_cursorline = true
Expand Down

0 comments on commit 0ed5ca1

Please sign in to comment.