1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 05:40:05 +08:00

Update visual_selection function (#4078)

This commit is contained in:
Wang Shidong 2021-02-10 14:55:39 +08:00 committed by GitHub
parent a61ae055b1
commit 7ae9fb4f83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,7 +64,15 @@ function! s:get_visual_selection() abort
if len(lines) == 0
return ''
endif
let lines[-1] = lines[-1][: column_end - (&selection ==# 'inclusive' ? 1 : 2)]
let lines[0] = lines[0][column_start - 1:]
" check v-block mode
if visualmode() ==# "\<C-v>"
for i in range(len(lines))
let lines[i] = lines[i][: column_end - (&selection ==# 'inclusive' ? 1 : 2)]
let lines[i] = lines[i][column_start - 1:]
endfor
else
let lines[-1] = lines[-1][: column_end - (&selection ==# 'inclusive' ? 1 : 2)]
let lines[0] = lines[0][column_start - 1:]
endif
return join(lines, "\n")
endfunction