Skip to content

Commit 3851bed

Browse files
authored
fix: visual mappings only operate on a single selected file #245
Problem: `{Visual}O` and similar commands only operate on a single file since 6233243 #235. Solution: Use `line('v')` and `line('.')` to get the visual range when the `<Cmd>` mappings are used.
1 parent b660af1 commit 3851bed

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

autoload/dirvish.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,9 @@ func! dirvish#open(...) range abort
534534
endif
535535

536536
if a:0 > 1
537-
call s:open_selected(a:1, a:2, a:firstline, a:lastline)
537+
" Detect whether a <Cmd> mapping or the legacy fallback is being used
538+
let l:visual_lines = mode(0) == 'n' ? [a:firstline, a:lastline] : [line('v'), line('.')]
539+
call s:open_selected(a:1, a:2, min(l:visual_lines), max(l:visual_lines))
538540
return
539541
endif
540542

0 commit comments

Comments
 (0)