tnite.vim


Ⅰ. 插件描述

Apply action to output of :terminal. It's simple.

Ⅱ. 基本信息

创建日期:  2019-06-07
使用用户:  3
Github星:  6
插件作者:  Masataka Pocke Kuwabara

Ⅲ. 安装方法

使用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 to edit action.
  • switchtab: Same as switch action, but it fallback to tabedit.
  • 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", {})

添加新评论