aboutsummaryrefslogtreecommitdiff
path: root/lua/cursorline.lua
diff options
context:
space:
mode:
authornathan11 <thenathansmithsmith@gmail.com>2023-07-25 00:52:07 -0600
committernathan11 <thenathansmithsmith@gmail.com>2023-07-25 00:52:07 -0600
commit0f8c62f2d18fd86e2bad01a33e5e9beb4e2ef77b (patch)
treee098cecfe770af08bd77eda320f8a0260c3c68c6 /lua/cursorline.lua
first commit
Diffstat (limited to 'lua/cursorline.lua')
-rw-r--r--lua/cursorline.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/lua/cursorline.lua b/lua/cursorline.lua
new file mode 100644
index 0000000..3a486d3
--- /dev/null
+++ b/lua/cursorline.lua
@@ -0,0 +1,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"
+})