Ⅰ. 插件描述
Apply action to output of :terminal. It's simple.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'pocke/tnite-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'pocke/tnite-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'pocke/tnite-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/pocke/tnite.vim
Ⅳ. 文档说明
tnite.vim
Apply action to output of :terminal.
It's simple.
Usage
Call tnite#start(command, action, option).
Command
String or List.
Tnite executes the command, and pass the output to action.
Actions
edit: Open a file in current buffer.tabedit: Open files with a new tab.switch: Switch to a window that opens the specified file if it is opened. If not, fallback toeditaction.switchtab: Same asswitchaction, but it fallback totabedit.jump: Jump to the line number.
See g:tnite#actions for more information.
Options
jump_to_line
Default: false
Jump to specified line number. Format is file_name:lineno.
Example: autoload/tnite.vim:42
Example
" Find a file from git with peco, and open it in a new tab.
nnoremap <silent><Space>f :<C-u>call tnite#start(["sh", "-c", "git ls-files \| peco --initial-filter Fuzzy"], "tabedit", {})<CR>
" Grep with word under the cursor.
nnoremap <silent><Space>g :<C-u>call tnite#start(["sh", "-c", "git grep --line-number " . shellescape(expand('<cword>')) . " \| peco --initial-filter Fuzzy \| cut -d : -f 1,2"], "tabedit", { "jump-to_line": v:true })
" Grep the current buffer and jump to the specified line.
nnoremap <silent><Space>j :<C-u>call tnite#start(["sh", "-c", "nl -b a -w1 -s ':\t' " . shellescape(expand('%:p')) . "\| peco \| cut -d : -f 1"], "jump", {})