From 44216b0a2c84791ca923994210327454d73af592 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 23 Nov 2014 03:39:33 +0900 Subject: [PATCH] Do nothing when nomodifiable (#43) --- plugin/easy_align.vim | 6 ++++++ test/extra.vader | 13 +++++++++++++ test/include/setup.vader | 5 +++++ 3 files changed, 24 insertions(+) create mode 100644 test/extra.vader diff --git a/plugin/easy_align.vim b/plugin/easy_align.vim index 78d2766..57aa4c5 100644 --- a/plugin/easy_align.vim +++ b/plugin/easy_align.vim @@ -75,6 +75,12 @@ function! s:set_repeat() endfunction function! s:generic_easy_align_op(type, vmode, live) + if !&modifiable + if a:vmode + normal! gv + endif + return + endif let sel_save = &selection let &selection = "inclusive" diff --git a/test/extra.vader b/test/extra.vader new file mode 100644 index 0000000..acaec97 --- /dev/null +++ b/test/extra.vader @@ -0,0 +1,13 @@ +Include: include/setup.vader + +Before: + set nomodifiable +After: + set modifiable + AssertEqual "hello\nworld\n", @" +Given: + hello + world +Do (#43 Do nothing when nomodifiable): + vip\\\y + diff --git a/test/include/setup.vader b/test/include/setup.vader index ef1b919..2e98af8 100644 --- a/test/include/setup.vader +++ b/test/include/setup.vader @@ -31,3 +31,8 @@ Execute (Clean up test environment): vmap . (EasyAlignRepeat) silent! call plug#load('vim-easy-align') + +Before: +After: +Given: +