~gpanders/dotfiles

aa7f35c908534aa4b9ffcb5e02832b8bcdf76173 — Gregory Anders 2 months ago c14a6e0
nvim: set cursorline autocmds in init.vim
2 files changed, 2 insertions(+), 10 deletions(-)

M .config/nvim/init.vim
D .config/nvim/plugin/cursorline.vim
M .config/nvim/init.vim => .config/nvim/init.vim +2 -0
@@ 134,6 134,8 @@ autocmd!
autocmd BufWinEnter * if &previewwindow | nnoremap <buffer> q <C-W>q | endif
autocmd TextYankPost * lua vim.highlight.on_yank {higroup="Visual", timeout=150, on_visual=true}
autocmd TermOpen * setlocal statusline=%{b:term_title} | startinsert
autocmd InsertEnter,WinLeave,FocusLost * setlocal nocursorline
autocmd InsertLeave,WinEnter,FocusGained * if mode() !=# 'i' | let &l:cursorline = 1 | endif

if argc() == 0 && filereadable('Session.vim')
  if v:vim_did_enter

D .config/nvim/plugin/cursorline.vim => .config/nvim/plugin/cursorline.vim +0 -10
@@ 1,10 0,0 @@
if exists('g:loaded_cursorline') || !has('syntax')
  finish
endif
let g:loaded_cursorline = 1

augroup cursorline
  autocmd!
  autocmd InsertEnter,WinLeave * let b:cul = &l:cursorline | let &l:cursorline = 0
  autocmd InsertLeave,WinEnter * if exists('b:cul') | let &l:cursorline = b:cul | endif
augroup END