mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-08 09:53:51 -05:00
@@ -1088,10 +1088,12 @@ endfunction
|
||||
|
||||
function! s:align(bang, live, visualmode, first_line, last_line, expr)
|
||||
" Heuristically determine if the user was in visual mode
|
||||
if empty(a:visualmode)
|
||||
if a:visualmode == 'command'
|
||||
let vis = a:first_line == line("'<") && a:last_line == line("'>")
|
||||
let bvis = vis && visualmode() == "\<C-V>"
|
||||
" Visual-mode explicitly given
|
||||
elseif empty(a:visualmode)
|
||||
let vis = 0
|
||||
let bvis = 0
|
||||
else
|
||||
let vis = 1
|
||||
let bvis = a:visualmode == "\<C-V>"
|
||||
|
||||
@@ -26,8 +26,8 @@ if exists("g:loaded_easy_align_plugin")
|
||||
endif
|
||||
let g:loaded_easy_align_plugin = 1
|
||||
|
||||
command! -nargs=* -range -bang EasyAlign <line1>,<line2>call easy_align#align('<bang>' == '!', 0, '', <q-args>)
|
||||
command! -nargs=* -range -bang LiveEasyAlign <line1>,<line2>call easy_align#align('<bang>' == '!', 1, '', <q-args>)
|
||||
command! -nargs=* -range -bang EasyAlign <line1>,<line2>call easy_align#align(<bang>0, 0, 'command', <q-args>)
|
||||
command! -nargs=* -range -bang LiveEasyAlign <line1>,<line2>call easy_align#align(<bang>0, 1, 'command', <q-args>)
|
||||
|
||||
let s:last_command = 'EasyAlign'
|
||||
|
||||
@@ -99,7 +99,7 @@ function! s:generic_easy_align_op(type, vmode, live)
|
||||
if get(g:, 'easy_align_need_repeat', 0)
|
||||
execute range . g:easy_align_last_command
|
||||
else
|
||||
execute range . "call easy_align#align('<bang>' == '!', a:live, vmode, '')"
|
||||
execute range . "call easy_align#align(0, a:live, vmode, '')"
|
||||
end
|
||||
call s:set_repeat()
|
||||
finally
|
||||
|
||||
@@ -247,3 +247,17 @@ Expect:
|
||||
servaddr.sin_port = htons(SERV_PORT);
|
||||
|
||||
Include: include/teardown.vader
|
||||
|
||||
Given:
|
||||
hello = world bye all
|
||||
hello world = bye all
|
||||
hello world = foo all
|
||||
|
||||
Do (#105: Incorrectly detection of blockwise visual mode):
|
||||
\<c-v>jj\<esc>
|
||||
\<Space>Aip=
|
||||
|
||||
Expect:
|
||||
hello = world bye all
|
||||
hello world = bye all
|
||||
hello world = foo all
|
||||
|
||||
Reference in New Issue
Block a user