Skip to content

Commit 6cb5653

Browse files
committed
Fix one line selection command execution
1 parent 2359889 commit 6cb5653

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

autoload/executor.vim

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ func! s:execute(start_line, end_line, count, command)
2727
endfunc
2828

2929
func! s:selection(start_line, end_line)
30-
let l:lines = getline(a:start_line, a:end_line)
31-
return join(l:lines, "\n") . "\n"
30+
return getline(a:start_line, a:end_line)
3231
endfunc
3332

3433
func! s:command(command)
@@ -41,8 +40,14 @@ func! s:command(command)
4140
endfunc
4241

4342
func! s:result(command, selection, count)
43+
if len(a:selection) == 1
44+
let l:command = a:command . ' ' . a:selection[0]
45+
return system(l:command)
46+
endif
47+
4448
if a:count
45-
return system(a:command, a:selection)
49+
let l:selection = join(a:selection, "\n") . "\n"
50+
return system(a:command, l:selection)
4651
endif
4752

4853
return system(a:command)
@@ -77,7 +82,7 @@ func! s:buffer_name(command)
7782
let l:buffer_name = substitute(l:buffer_name, '{command}', a:command, 'g')
7883
let l:buffer_name = substitute(l:buffer_name, '{filename}', expand('%:t'), 'g')
7984

80-
return l:buffer_name
85+
return escape(l:buffer_name, '|')
8186
endfunc
8287

8388
func! s:set_buffer_defaults()

0 commit comments

Comments
 (0)