Run, view, and manage UNIX shell commands with ease from your favorite code editor.
This plugin relies on channels, introduced in Vim 8.0. This is only partially supported in Neovim because of its different implementation of job control.
Running external commands with Vim has always been clunky to work with.
:!apt update (can't edit while running)
:!apt update & (stdout hijacks your screen)
:!apt update > some/file.log & (logs available only when done)
In most cases, it would be a lot more convenient to just open up a new
terminal (maybe with :term
, tmux
, or a new window in your OS) and run your
command from there.
But what if you don't want to worry about managing several active terminal sessions? Maybe you'd prefer to just keep one window open - Vim - and run processes without losing too much screen real estate.
This plugin attempts to solve that problem and provide a more intuitive experience around running processess asynchronously.
Using vim-plug:
Plug 'ledesmablt/vim-run'
Using Vim's built-in package support:
mkdir -p ~/.vim/pack/plugins/start
cd ~/.vim/pack/plugins/start
git clone http://github.com/ledesmablt/vim-run
vim -c 'helptags vim-run/doc' -c quit
" start jobs
:Run [<command>]
:RunQuiet [<command>]
:RunWatch [<command>]
:RunSplit [<command>]
:RunVSplit [<command>]
:RunNoStream [<command>]
:RunAgain [<index>]
:RunAgainEdit [<index>]
:RunSendKeys [<text>]
" kill jobs
:RunKill [<job_key>]
:RunKillAll
" view & manage jobs
:RunListToggle
:RunClear
:RunClearDone
:RunClearFailed
:RunClearKilled
" manage log files
:RunSaveLog [<job_key>]
:RunBrowseLogs [<limit>]
:RunDeleteLogs
let g:rundir = ~/.vim/rundir
let g:run_shell = $SHELL
let g:run_use_loclist = 0
let g:run_quiet_default = 0
let g:run_autosave_logs = 0
let g:run_nostream_default = 0
let g:run_browse_default_limit = 10
More details in the docs - :h vim-run