This is vim plugin to run command in terminal with Vim8.
TermRun
command executes any command and outputs the result to terminal window.TermRunQuick
command executes a quick command for each filetype.TermRunTest
command executes a test command for each filetype.TermRunResume
command executes the last executedTermRun*
command.
Run the TermRun command as shown below. The argument is executed as it is and the result is output to the Terminal window.
:TermRun ls -l
Executes the command set for each filetype.
- With no arguments, it will be executed with the preset contents.
TermRunQuick
targets the current buffer.- The target of
TermRunTest
is specified by the setting.
- If an argument is given, it will be executed as an argument of each command.
filetype | quick command | test command |
---|---|---|
sh | bash | - |
go | go run | go test |
mardkwon | glow | - |
Execute the same TermRun
, TermRunQuick
or TermRunTest
command
that was executed immediately before.
g:termrun_config
is a dictionary with a step structure.
The following settings are examples and are the default settings.
let g:termrun_config = {
\ '_': { 'opts': {} },
\ 'sh': {
\ 'quick': { 'cmd': ['bash'] },
\ 'opts': {}
\ },
\ 'go': {
\ 'quick':{ 'cmd': ['go', 'run'] },
\ 'test': { 'cmd': ['go', 'test'], 'target': '%:p:h' },
\ 'opts': {}
\ },
\ 'markdown': {
\ 'quick': { 'cmd': ['glow'] },
\ 'opts': {'vertical': v:true, 'term_cols': &columns/2}
\ }
\ }
- The first key is the filetype.
- filetype
_
is used as a filetype independent setting.
- filetype
quick
andtest
are dictionaries with the following keys.cmd
is List of execution commands and arguments.target
is String that test target directory or file.- The set character string is expanded with
expand()
in vim function.
- The set character string is expanded with
opts
can have the same options asterm_start()
. See:h term_start()