diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-13 00:10:15 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-13 00:10:15 +1200 |
commit | 58e445ebf6b7ffb8a7743d81419833821f9a667b (patch) | |
tree | 85470e213624757430bfbcc3f9269e1853001216 | |
parent | Merge branch 'release/v1.0.0' (diff) | |
parent | Bump VERSION (diff) | |
download | vim-vertical-region-58e445ebf6b7ffb8a7743d81419833821f9a667b.tar.gz vim-vertical-region-58e445ebf6b7ffb8a7743d81419833821f9a667b.zip |
Merge branch 'release/v1.1.0'v1.1.0
* release/v1.1.0:
Remove unneeded variable scoping
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | autoload/vertical_region.vim | 28 | ||||
-rw-r--r-- | plugin/vertical_region.vim | 4 |
3 files changed, 17 insertions, 17 deletions
@@ -1 +1 @@ -1.0.0 +1.1.0 diff --git a/autoload/vertical_region.vim b/autoload/vertical_region.vim index 9dd171f..1c8567d 100644 --- a/autoload/vertical_region.vim +++ b/autoload/vertical_region.vim @@ -7,22 +7,22 @@ function! vertical_region#Map(count, up, mode) abort endif " Get line and column number - let l:num = line('.') - let l:col = col('.') + let num = line('.') + let col = col('.') " Move up or down through buffer, counting hits as we go - let l:hits = 0 - while a:up ? l:num > 1 : l:num < line('$') + let hits = 0 + while a:up ? num > 1 : num < line('$') " Increment or decrement line number - let l:num += a:up ? -1 : 1 + let num += a:up ? -1 : 1 " If the line has any non-space characters up to the current column, we " have a hit; break the loop as soon as we have the count we need - let l:line = getline(l:num) - if strpart(l:line, 0, l:col) =~# '\S' - let l:hits += 1 - if l:hits == a:count + let line = getline(num) + if strpart(line, 0, col) =~# '\S' + let hits += 1 + if hits == a:count break endif endif @@ -31,14 +31,14 @@ function! vertical_region#Map(count, up, mode) abort " If not moving linewise for operator mode and not in first column, move to " same column after line jump; is there a way to do this in one jump? - let l:keys = l:num . 'G0' + let keys = num . 'G0' if a:mode ==# 'o' - let l:keys = 'V' . l:keys - elseif l:col > 1 - let l:keys .= l:col - 1 . 'l' + let keys = 'V' . keys + elseif col > 1 + let keys .= col - 1 . 'l' endif " Run normal mode commands - execute 'normal! ' . l:keys + execute 'normal! ' . keys endfunction diff --git a/plugin/vertical_region.vim b/plugin/vertical_region.vim index c1fc56f..eebcc72 100644 --- a/plugin/vertical_region.vim +++ b/plugin/vertical_region.vim @@ -7,13 +7,13 @@ " Author: Tom Ryder <tom@sanctum.geek.nz> " License: Same as Vim itself " -if exists('g:loaded_vertical_region') || &compatible +if exists('loaded_vertical_region') || &compatible finish endif if v:version < 700 finish endif -let g:loaded_vertical_region = 1 +let loaded_vertical_region = 1 " Define plugin maps nnoremap <silent> <Plug>(VerticalRegionUp) |