diff --git a/plugin/easy_align.vim b/plugin/easy_align.vim index 30af664..dc5092e 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: +