diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-30 21:37:19 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-30 21:37:19 +1200 |
commit | bfb65858ea696cf1ed5ad2c8ed6d2174c28a7801 (patch) | |
tree | a8801816dbfcc1777e3ea27fca05cf0a302d5f4c /autoload/cursorline_current.vim | |
parent | Merge branch 'release/v0.5.0' (diff) | |
parent | Bump VERSION (diff) | |
download | vim-cursorline-current-bfb65858ea696cf1ed5ad2c8ed6d2174c28a7801.tar.gz vim-cursorline-current-bfb65858ea696cf1ed5ad2c8ed6d2174c28a7801.zip |
Merge branch 'release/v1.0.0'v1.0.0
* release/v1.0.0:
Add comments
Remove unneeded part of documentation
Correct winnr() call
Restore BufEnter hook
Use much shorter implementation for Load()
Remove BufEnter hook
Run load and restore functions only with multiwin
Pare down variable names and usage
Merge autocmd definitions
Remove support for g:cursorline_current_insert
Strip comments out from plugin file
Factor out functions into autoload
Diffstat (limited to 'autoload/cursorline_current.vim')
-rw-r--r-- | autoload/cursorline_current.vim | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/autoload/cursorline_current.vim b/autoload/cursorline_current.vim new file mode 100644 index 0000000..648d633 --- /dev/null +++ b/autoload/cursorline_current.vim @@ -0,0 +1,17 @@ +" Suspend 'cursorline' when a window is inactive or inserting +function! cursorline_current#Suspend() abort + let w:cursorline = &l:cursorline + let &l:cursorline = 0 +endfunction + +" Restore 'cursorline' when a window is active and non-insert +function! cursorline_current#Restore() abort + let &l:cursorline = get(w:, 'cursorline', &g:cursorline) +endfunction + +" Call cursorline_current#Suspend() on all windows besides the current one +function! cursorline_current#Load() abort + let wcur = winnr() + windo if winnr() != wcur | call cursorline_current#Suspend() | endif + execute wcur . 'wincmd w' +endfunction |