aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-05-30 21:18:54 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-05-30 21:18:54 +1200
commit85df533cd92d1c78e425225416247d488dfed67d (patch)
treeee717120f3c343d7e79b0c0998b4f23c7c42788b
parentRemove BufEnter hook (diff)
downloadvim-cursorline-current-85df533cd92d1c78e425225416247d488dfed67d.tar.gz
vim-cursorline-current-85df533cd92d1c78e425225416247d488dfed67d.zip
Use much shorter implementation for Load()
-rw-r--r--autoload/cursorline_current.vim15
1 files changed, 1 insertions, 14 deletions
diff --git a/autoload/cursorline_current.vim b/autoload/cursorline_current.vim
index 0c56c8d..c8bec6f 100644
--- a/autoload/cursorline_current.vim
+++ b/autoload/cursorline_current.vim
@@ -11,20 +11,7 @@ endfunction
" Call cursorline_current#Suspend() on all windows besides the current one
function! cursorline_current#Load() abort
-
- " Cache current window index
let wcur = winnr()
-
- " Iterate through all the windows and suspend all but the current one
- for wnum in range(1, winnr('$'))
- if wnum == wcur
- continue
- endif
- execute wnum . 'wincmd w'
- call cursorline_current#Suspend()
- endfor
-
- " Return to the window in which we started
+ windo if winnr('.') != wcur | call cursorline_current#Suspend() | endif
execute wcur . 'wincmd w'
-
endfunction