From 45beac95bd05339c85251aedbf71b3b965c46a14 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 13 May 2019 00:09:52 +1200 Subject: Remove unneeded variable scoping --- autoload/vertical_region.vim | 28 ++++++++++++++-------------- plugin/vertical_region.vim | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) 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 " 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 (VerticalRegionUp) -- cgit v1.2.3