Don't set cursorline if we're not gonna see anything
dblume

dblume commited on 2024-03-26 22:48:32
Showing 1 changed files, with 4 additions and 1 deletions.


I only use cursorline for the style of the number column,
so only set it if I set number or relativenumber. It slows
drawing a little.
... ...
@@ -12,7 +12,7 @@ set undofile        " undo even after closing and reopening a file
12 12
 set noshowcmd       " Show size of selected area in visual mode on last line
13 13
 set noruler         " Show coordinates on status line
14 14
 set hidden          " Don't abandon Scratch buffer when hidden.
15
-set cursorline      " For CursorLineNR formatting similar to pre 8.0.
15
+"set cursorline     " For CursorLineNR formatting similar to pre 8.0.
16 16
 set culopt=number   " Otherwise diff views have an underline. neovim issue 9800
17 17
 
18 18
 " Make j and k move to the next row, not file line
... ...
@@ -307,6 +307,9 @@ augroup END
307 307
   autocmd BufEnter *
308 308
   \ let b:git_branch = GitBranch() |
309 309
   \ let b:enc_fmt = EncodingAndFormat()
310
+
311
+  " I only use a cursorline style for the number column
312
+  autocmd OptionSet number,relativenumber if v:option_new | set cursorline | endif
310 313
 endif
311 314
 
312 315
 " This requires vim to be compiled with +python
313 316