aboutsummaryrefslogtreecommitdiff
path: root/lua/cursorline.lua
blob: 3a486d3a16744912fd93ab7fec03ca441d237270 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
local autocmd = vim.api.nvim_create_autocmd

local set_cursorline = function()
	local buf = vim.api.nvim_get_current_buf()

	-- Do not set cursorline if telescope is open.
	if vim.bo[buf].filetype == "TelescopePrompt" then
		vim.cmd("set nocul")
	else
		vim.cmd("set cul")
	end
end

autocmd("InsertEnter",
{pattern="*", callback=set_cursorline
})

autocmd("InsertLeave",
{pattern="*", command="set nocul"
})