feat(nvim): only show cursorline on active buffer
This commit is contained in:
		
							parent
							
								
									6b70074004
								
							
						
					
					
						commit
						6dc90947a5
					
				
					 1 changed files with 16 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -18,6 +18,22 @@ local function set_autocmd()
 | 
			
		|||
    "VimResized *",
 | 
			
		||||
    { command = ":wincmd =" }
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  -- Cursorline highlighting control.
 | 
			
		||||
  --  Only have it on in the current buffer.
 | 
			
		||||
  local group = vim.api.nvim_create_augroup("CursorLineControl", { clear = true })
 | 
			
		||||
  local set_cursorline = function(event, value, pattern)
 | 
			
		||||
    vim.api.nvim_create_autocmd(event, {
 | 
			
		||||
      group = group,
 | 
			
		||||
      pattern = pattern,
 | 
			
		||||
      callback = function()
 | 
			
		||||
        vim.opt_local.cursorline = value
 | 
			
		||||
      end,
 | 
			
		||||
    })
 | 
			
		||||
  end
 | 
			
		||||
  set_cursorline("WinLeave", false)
 | 
			
		||||
  set_cursorline("WinEnter", true)
 | 
			
		||||
  set_cursorline("FileType", false, "TelescopePrompt")
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
local function set_filetypes()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue