Dotfiles/site-modules/core/files/vim/plugin/run.vim
Ade Attwood 490cd76629 refactor(vim): remove exit after run command
I am finding my self wanting to view the output of command nowadays,
rather then wanting to run a quick command and see if its passed or not.
By removing the exit at the end of the command the terminal dose not
close now. If I want the terminal to close I can still append the
command with `&& exit` when using `Run`
2022-12-03 16:14:29 +00:00

29 lines
728 B
VimL

"
" Runs a shell command in the neovim terminal. This will open up a buffered
" terminal in a split at the bottom
"
" a:command
" The command you want the run in the terminal
"
function! s:aa_run(command)
if strlen($TMUX) > 0
if (&columns > 180)
let l:split = '-h'
else
let l:split = '-v'
endif
execute 'silent !tmux split-window -p 50 ' . l:split . ' && tmux send-keys "' . a:command . '" C-m'
return
endif
if has('nvim')
if (&columns > 180)
execute 'VTerm ' . a:command
else
execute 'HTerm ' . a:command
endif
endif
endfunction
command! -nargs=* -complete=shellcmd Run call s:aa_run(<q-args>)