diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-09 11:47:48 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-09 11:47:48 +1200 |
commit | 90ffeabc80c0f27748213d30952ad00a8e57b097 (patch) | |
tree | bb51756b17370bcbcab3ff26b59ee29918a4ec5d | |
parent | Merge branch 'release/v0.3.0' (diff) | |
parent | Bump VERSION (diff) | |
download | vim-cursorline-current-90ffeabc80c0f27748213d30952ad00a8e57b097.tar.gz vim-cursorline-current-90ffeabc80c0f27748213d30952ad00a8e57b097.zip |
Merge branch 'release/v0.4.0'v0.4.0
* release/v0.4.0:
Remove unneeded variable scoping
Switch to two-spacing
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | doc/cursorline_current.txt | 6 | ||||
-rw-r--r-- | plugin/cursorline_current.vim | 18 |
4 files changed, 15 insertions, 15 deletions
@@ -2,13 +2,13 @@ cursorline\_current.vim ======================= This plugin tweaks the behaviour of the `'cursorline'` option to enable it only -in the current window and when not in insert mode. It essentially makes +in the current window and when not in insert mode. It essentially makes `'cursorline'` follow the cursor in normal mode as much as possible. License ------- -Copyright (c) [Tom Ryder][1]. Distributed under the same terms as Vim itself. +Copyright (c) [Tom Ryder][1]. Distributed under the same terms as Vim itself. See `:help license`. [1]: https://sanctum.geek.nz/ @@ -1 +1 @@ -0.3.0 +0.4.0 diff --git a/doc/cursorline_current.txt b/doc/cursorline_current.txt index 1a84ece..a6a4514 100644 --- a/doc/cursorline_current.txt +++ b/doc/cursorline_current.txt @@ -4,7 +4,7 @@ DESCRIPTION *cursorline_current* This plugin tweaks the behaviour of the 'cursorline' option to enable it only in the current window, when not in insert mode, and (if supported) when Vim -has focus. It essentially makes 'cursorline' follow the cursor in normal mode +has focus. It essentially makes 'cursorline' follow the cursor in normal mode as much as possible. It uses the global value of 'cursorline' as its default, and should also @@ -12,14 +12,14 @@ correctly handle local values for windows. REQUIREMENTS *cursorline_current-requirements* -This plugin only loads if 'compatible' is not set. It requires the |+autocmd| +This plugin only loads if 'compatible' is not set. It requires the |+autocmd| and |+windows| features. OPTIONS *cursorline_current-options* *g:cursorline_current_insert* Set `g:cursorline_current_insert` to 0 in your |vimrc| if you don't like the -cursor line switching off while you're in insert mode. This option defaults to +cursor line switching off while you're in insert mode. This option defaults to 1. AUTHOR *cursorline_current-author* diff --git a/plugin/cursorline_current.vim b/plugin/cursorline_current.vim index 43bf882..b0c38b4 100644 --- a/plugin/cursorline_current.vim +++ b/plugin/cursorline_current.vim @@ -1,18 +1,18 @@ " " cursorline_current: If 'cursorline' is globally on, only enable it for the -" current window, and only when not in insert mode. Essentially, make +" current window, and only when not in insert mode. Essentially, make " 'cursorline' follow the actual normal-mode cursor as much as possible. " " Author: Tom Ryder <tom@sanctum.geek.nz> " License: Same as Vim itself " -if exists('g:loaded_cursorline_current') || &compatible +if exists('loaded_cursorline_current') || &compatible finish endif if !has('autocmd') || !has('windows') || v:version < 700 finish endif -let g:loaded_cursorline_current = 1 +let loaded_cursorline_current = 1 " Suspend 'cursorline' when a window is inactive or inserting function! s:Suspend() abort @@ -30,19 +30,19 @@ endfunction function! s:Load() abort " Cache current window index - let l:wcur = winnr() + let wcur = winnr() " Iterate through all the windows and suspend all but the current one - for l:wnum in range(1, winnr('$')) - if l:wnum == l:wcur + for wnum in range(1, winnr('$')) + if wnum == wcur continue endif - execute l:wnum . 'wincmd w' + execute wnum . 'wincmd w' call s:Suspend() endfor " Return to the window in which we started - execute l:wcur . 'wincmd w' + execute wcur . 'wincmd w' endfunction @@ -53,7 +53,7 @@ augroup cursorline_current " Turn off 'cursorline' for other windows on load autocmd VimEnter * call s:Load() - " Turn off 'cursorline' when leaving a window or losing focus. We call the + " Turn off 'cursorline' when leaving a window or losing focus. We call the " restore again on BufEnter to handle existent local buffer values for the " option overwriting the window value (Vim bug?) autocmd WinLeave,FocusLost * call s:Suspend() |