Use virtcol in blockwise visual mode

This commit is contained in:
Junegunn Choi
2015-10-01 19:32:36 +09:00
parent 504eab0f59
commit 0db4ea6132
2 changed files with 40 additions and 2 deletions

View File

@@ -1050,12 +1050,15 @@ function! s:process(range, mode, n, ch, opts, regexp, rules, bvis)
\ get(dict, 'align', recur == 2 ? s:alternating_modes(a:mode) : a:mode),
\ recur)
let ve = &virtualedit
set ve=all
let args = [
\ {}, split(mode_sequence, '\zs'),
\ {}, {}, a:range[0], a:range[1],
\ a:bvis ? min([col("'<"), col("'>")]) : 1,
\ (!recur && a:bvis) ? max([col("'<"), col("'>")]) : 0,
\ a:bvis ? min([virtcol("'<"), virtcol("'>")]) : 1,
\ (!recur && a:bvis) ? max([virtcol("'<"), virtcol("'>")]) : 0,
\ nth, recur, dict ]
let &ve = ve
while len(args) > 1
let args = call('s:do_align', args)
endwhile

View File

@@ -1557,6 +1557,41 @@ Expect clojure:
10 20)]
(prn [a bbb ccccc]))
Given clojure:
{:user {:plugins [[cider/cider-nrepl "0.9.1"]
[lein-kibit "0.0.8"]
[lein-licenses "0.1.1"]
[lein-marginalia "0.8.0"] ; lein marg
[codox "0.8.13"] ; lein doc
[com.jakemccrary/lein-test-refresh "0.10.0"] ; lein test-refresh
[lein-pprint "1.1.2"]
[lein-exec "0.3.5"]
[jonase/eastwood "0.2.1"]]
:dependencies [[slamhound "1.5.5"]]
:aliases {"slamhound" ["run" "-m" "slam.hound"]}
:signing {:gpg-key "FEF9C627"}}}
Do (Virtual column should be used in blockwise-visual mode):
f[
vi[
\<C-V>
$20l
\<Enter>\<Space>
Expect clojure:
{:user {:plugins [[cider/cider-nrepl "0.9.1"]
[lein-kibit "0.0.8"]
[lein-licenses "0.1.1"]
[lein-marginalia "0.8.0"] ; lein marg
[codox "0.8.13"] ; lein doc
[com.jakemccrary/lein-test-refresh "0.10.0"] ; lein test-refresh
[lein-pprint "1.1.2"]
[lein-exec "0.3.5"]
[jonase/eastwood "0.2.1"]]
:dependencies [[slamhound "1.5.5"]]
:aliases {"slamhound" ["run" "-m" "slam.hound"]}
:signing {:gpg-key "FEF9C627"}}}
###########################################################
Given (hard-tab indentation (#19)):