를 사용 :r !command
하여 다음 행에 출력을 추가하십시오.
커서의 명령 출력을 같은 줄에 추가 할 수 있습니까?
답변
삽입 및 명령 행 모드에 대한 다음 맵핑은 어떻습니까?
" i_CTRL-R_` Insert the output of an external command.
" c_CTRL-R_`
function! s:QueryExternalCommand( newlineReplacement )
call inputsave()
let l:command = input('$ ', '', 'shellcmd')
call inputrestore()
return (empty(l:command) ?
\ '' :
\ substitute(substitute(system(l:command), '\n\+$', '', ''), '\n', a:newlineReplacement, 'g')
\)
endfunction
inoremap <C-r>` <C-g>u<C-r>=<SID>QueryExternalCommand('\r')<CR>
cnoremap <C-r>` <C-r>=<SID>QueryExternalCommand('\\n')<CR>