From 98e0b493acae87202fba2294550957c9b5902b97 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 16 Sep 2015 03:08:08 +0900 Subject: [PATCH] Apply filter option to substrings in blockwise-visual mode --- autoload/easy_align.vim | 5 +++-- test/interactive.vader | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/autoload/easy_align.vim b/autoload/easy_align.vim index fd8750b..2e693a0 100644 --- a/autoload/easy_align.vim +++ b/autoload/easy_align.vim @@ -358,9 +358,10 @@ function! s:do_align(todo, modes, all_tokens, all_delims, fl, ll, fc, lc, nth, r " Phase 1 for line in range(a:fl, a:ll) - if f == 1 && getline(line) !~ fx + let snip = a:lc > 0 ? getline(line)[a:fc-1 : a:lc-1] : getline(line) + if f == 1 && snip !~ fx continue - elseif f == -1 && getline(line) =~ fx + elseif f == -1 && snip =~ fx continue endif diff --git a/test/interactive.vader b/test/interactive.vader index ebcf23f..273c779 100644 --- a/test/interactive.vader +++ b/test/interactive.vader @@ -1535,6 +1535,28 @@ Expect: bbbbb=bbbbb=bbbbb aaa = aaa = aaa +Given clojure (filter with blockwise-visual mode): + (let [a 1 + bbb 2 + ccccc (range + 10 20)] + (prn [a bbb ccccc])) + +Do (filter with blockwise-visual mode): + f[ + vi[ + \ + \ + \g/^\S\ + \ + +Expect clojure: + (let [a 1 + bbb 2 + ccccc (range + 10 20)] + (prn [a bbb ccccc])) + ########################################################### Given (hard-tab indentation (#19)):