Ⅰ. 插件描述
Terminal and Repl Extensions - for neovimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'vigemus/trex-nvim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'vigemus/trex-nvim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'vigemus/trex-nvim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vigemus/trex.nvim
Ⅳ. 文档说明
# TREX - Terminal and Repl Extensions
Trex extends iron.nvim by adding sugar
coating to repl management.
Still highly experimental but you are more then welcome to use and open
issues/PRs.
How it works
Trex exposes two commands that allow you to invoke repls: TrexInvoke [{ft}]
It optionally takes a filetype. If you don't supply an ft, it will infer based
on current buffers filetype.
It adds a minibuffer below the REPl, with the following properties:
" commands
TrexFlush "Flushes current scratch buffer to repl
TrexPrev "Cycles the history backward to the previous used command
TrexNext "Cycles the history forward to the next used command
" Mappings
<localleader>h <Cmd>TrexPrev<CR>
<localleader>l <Cmd>TrexNext<CR>
<localleader><CR> <Cmd>TrexFlush<CR>Under the hood
It relies on iron to get the correct repl and send chunks of data to it.
It manages the ui and command history and outsources the rest to iron.
Why not part of iron?
I don't want to bloat users with features they won't want/need.
No cost involved in adding extensions to existing plugins thanks to lua.
But VimL allows those as well.
True, but then you have function and command calls throught the code without
explicit dependencies.
By doing local iron = require("iron") an explicit dependency on external
resources exists, making it easier to spot.
But this has no major advantage for the user.
Indeed, the user sees the same thing. But it becomes a major advantage to those
who maintain the plugin. For example, it allows a much easier to understand
codebase.