@@ -27,8 +27,7 @@ func! s:execute(start_line, end_line, count, command)
2727endfunc
2828
2929func ! 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 )
3231endfunc
3332
3433func ! s: command (command )
@@ -41,8 +40,14 @@ func! s:command(command)
4140endfunc
4241
4342func ! 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, ' | ' )
8186endfunc
8287
8388func ! s: set_buffer_defaults ()
0 commit comments