This is vim plugin to run command in terminal with Vim8.
TermRuncommand executes any command and outputs the result to terminal window.TermRunQuickcommand executes a quick command for each filetype.TermRunTestcommand executes a test command for each filetype.TermRunResumecommand 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 -lExecutes the command set for each filetype.
- With no arguments, it will be executed with the preset contents.
TermRunQuicktargets the current buffer.- The target of
TermRunTestis 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
quickandtestare dictionaries with the following keys.cmdis List of execution commands and arguments.targetis 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
optscan have the same options asterm_start(). See:h term_start()