aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-08-10 01:18:08 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-08-10 01:18:08 +1200
commitaee7d1f40ee7bdaa3b9f1154329322c9b0305b8c (patch)
treeadfe2abac4f26444d92bc6349a24de577ee5b71d
parentbd64d69db2bbb426fe9f4b439af4c3a9ed30f3ee (diff)
downloaddotfiles-aee7d1f40ee7bdaa3b9f1154329322c9b0305b8c.tar.gz
Spin out vertical_region.vim into submodule
-rw-r--r--.gitmodules3
-rw-r--r--vim/autoload/vertical_region.vim37
m---------vim/bundle/vertical_region0
-rw-r--r--vim/plugin/vertical_region.vim29
4 files changed, 3 insertions, 66 deletions
diff --git a/.gitmodules b/.gitmodules
index 38a03a11..9f9f3f62 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -50,6 +50,9 @@
[submodule "vim/bundle/uncap_ex"]
path = vim/bundle/uncap_ex
url = https://sanctum.geek.nz/code/vim-uncap-ex.git
+[submodule "vim/bundle/vertical_region"]
+ path = vim/bundle/vertical_region
+ url = https://sanctum.geek.nz/code/vim-vertical-region.git
[submodule "vim/bundle/vimrc_reload_filetype"]
path = vim/bundle/vimrc_reload_filetype
url = https://sanctum.geek.nz/code/vim-vimrc-reload-filetype.git
diff --git a/vim/autoload/vertical_region.vim b/vim/autoload/vertical_region.vim
deleted file mode 100644
index 6f2cf8d6..00000000
--- a/vim/autoload/vertical_region.vim
+++ /dev/null
@@ -1,37 +0,0 @@
-" Function for expression maps returning navigaton keys to press
-function! vertical_region#Map(count, up, mode) abort
-
- " Get line and column number
- let l:num = line('.')
- let l: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('$')
-
- " Increment or decrement line number
- let l: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
- break
- endif
- endif
-
- endwhile
-
- " 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 . 'G'
- if a:mode !=# 'o' && l:col > 1
- let l:keys .= l:col - 1 . 'l'
- endif
-
- " Return normal mode commands
- return l:keys
-
-endfunction
diff --git a/vim/bundle/vertical_region b/vim/bundle/vertical_region
new file mode 160000
+Subproject 59ddae4b2adb102a37378814cce1a1ddbb72c2b
diff --git a/vim/plugin/vertical_region.vim b/vim/plugin/vertical_region.vim
deleted file mode 100644
index ddf83a53..00000000
--- a/vim/plugin/vertical_region.vim
+++ /dev/null
@@ -1,29 +0,0 @@
-"
-" vertical_region.vim: Move to a line that has non-space characters before or
-" in the current column, usually to find lines that begin or end blocks in
-" languages where indenting is used to show or specify structure.
-"
-" Author: Tom Ryder <tom@sanctum.geek.nz>
-" License: Same as Vim itself
-"
-if exists('g:loaded_vertical_region') || &compatible
- finish
-endif
-if v:version < 700
- finish
-endif
-let g:loaded_vertical_region = 1
-
-" Define plugin maps
-nnoremap <expr> <Plug>(VerticalRegionUpNormal)
- \ vertical_region#Map(v:count1, 1, 'n')
-nnoremap <expr> <Plug>(VerticalRegionDownNormal)
- \ vertical_region#Map(v:count1, 0, 'n')
-onoremap <expr> <Plug>(VerticalRegionUpOperator)
- \ vertical_region#Map(v:count1, 1, 'o')
-onoremap <expr> <Plug>(VerticalRegionDownOperator)
- \ vertical_region#Map(v:count1, 0, 'o')
-xnoremap <expr> <Plug>(VerticalRegionUpVisual)
- \ vertical_region#Map(v:count1, 1, 'x')
-xnoremap <expr> <Plug>(VerticalRegionDownVisual)
- \ vertical_region#Map(v:count1, 0, 'x')