Ⅰ. 插件描述
terminal inside vim, low dependencyⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'zsaberlv0/zfvimterminal'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'zsaberlv0/zfvimterminal'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'zsaberlv0/zfvimterminal'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/zsaberlv0/zfvimterminal
Ⅳ. 文档说明
terminal inside vim, inspired from mattn/vim-terminal

if you like my work, check here for a list of my vim plugins
Difference
Compared to
Vim8's :terminallow dependency, require
+channelonly, easily works on Windows, bothcmd.exeorCygwin bash- fallback to
system()if+channelnot supported
- fallback to
- all keymaps works inside terminal window
- easily to copy command output
Compared to mattn/vim-terminal
- support NeoVim
- use vim's
:commandcomplete to input shell commands, should be more friendly to use
Requirement
- (required)
v:version >= 703, older version may work, but not tested - (optional)
has('channel')for async shell run - (optional)
exists('*getcompletion')for command complete
How to use
use Vundle or any other plugin manager you like to install
Plugin 'ZSaberLv0/ZFVimJob' " required for job impl Plugin 'ZSaberLv0/ZFVimTerminal' " recommended key map nnoremap <leader>zs :ZFTerminal<space>use
:ZFTerminal [your_cmd]to run terminal, use<tab>to complete command or file names- take care of special chars of vim cmdline,
:h cmdline-special
- take care of special chars of vim cmdline,
<esc>to quit input, you may visual select and copy the text inside the terminal window- use
i/I/a/A/o/Oto start input again - use
qto kill and close terminal,
we would create new terminal session for next:ZFTerminalcall - use
xto hide terminal,
we would use existing terminal session for next:ZFTerminalcall - during editing the shell command, you may also use this keymap
cnoremap :: <c-c>q:k$to edit the command itself quickly
Configs
g:ZFVimTerminal_shellwhich shell to use, default:
let g:ZFVimTerminal_shell = ''
when empty, we would try to detect a proper one, possible values:
* `cmd` : for Windows
* `sh` : for Windows Cygwin
* `sh --login` : for others
g:ZFVimTerminal_windowConfigterminal window's config, see Log window for more info
those keymaps would be made by default
nnoremap <buffer> i :<c-u>ZFTerminal<space> nnoremap <buffer> I :<c-u>ZFTerminal<space> nnoremap <buffer> o :<c-u>ZFTerminal<space> nnoremap <buffer> O :<c-u>ZFTerminal<space> nnoremap <buffer> a :<c-u>ZFTerminal<space> nnoremap <buffer> A :<c-u>ZFTerminal<space> nnoremap <buffer> <cr> :<c-u>ZFTerminal<cr> nnoremap <buffer> p :<c-u>ZFTerminal <c-r>" nnoremap <buffer> P :<c-u>ZFTerminal <c-r>" nnoremap <buffer> q :ZFTerminalClose<cr> nnoremap <buffer> x :ZFTerminalHide<cr> nnoremap <buffer> <c-c> :ZFTerminalCtrlC<cr>
you may add your own keymaps by:
autocmd FileType ZFTerminal nnoremap <buffer> q :ZFTerminalClose<cr>g:ZFVimTerminalCompatibleModewhether run in compatible mode, default: 0
when run in compatible, we use
system()instead ofjobto run shellg:ZFVimTerminal_autoDetectShellEndwhether use special tricks to detect shell command end, default:
let g:ZFVimTerminal_autoDetectShellEnd = 1
when on, we use `echo` to output special string to detect whether user input command has end,
if any strange things occurred,
you may disable this feature
g:ZFVimTerminal_autoEnterInsertwhether auto enter insert mode after running a command, default:
let g:ZFVimTerminal_autoEnterInsert = 1g:ZFVimTerminal_termEncoding/g:ZFVimTerminal_termEncodingCompatiblethe encoding of your terminal, default:
let g:ZFVimTerminal_termEncoding = 'auto'
when not empty, we would try to convert encoding by `iconv()` to `&encoding`,
see `:h encoding-values` for possible value, see also `:h termencoding`
use 'auto' to enable auto detect:
* for Windows without `sh` executable, try to detect by `chcp`
* otherwise, `utf-8` would be used
g:ZFVimTerminal_shellPrefix/g:ZFVimTerminal_shellPrefixCompatibleshell prefix, can be string or
function()g:ZFVimTerminal_CRFixhow to resolve
\r, default isclearLine, posible values:clearLine: same as default shell, clear current linenewLine: treat\ras\nkeep: do not modify, keep original