vim-operator-inserttext


Ⅰ. 插件描述

evaluation a text by any function

Ⅱ. 基本信息

创建日期:  2014-07-17
使用用户:  1
Github星:  3
插件作者:  syngan

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'syngan/vim-operator-inserttext'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'syngan/vim-operator-inserttext'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'syngan/vim-operator-inserttext'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/syngan/vim-operator-inserttext

Ⅳ. 文档说明

vim-operator-evalf

Build Status

関数の出力結果を挿入するオペレータです。

  • Required: vim-operator-user
function! Hoge(motion, wise_name, ...)
    " wise_name = 'char', 'line' or 'block'
    return "<<" . a:motion . ">>"
endfunction

" motion の前に Hoge({motion}, {wise_name}) の実行結果を挿入する
map <expr> ss operator#evalf#mapexpr(function('Hoge'), -1)

" motion の後ろに Hoge({motion}, {wise_name}) の実行結果を挿入する
map <expr> ss operator#evalf#mapexpr(function('Hoge'), +1)

" motion の内容を Hoge({motion}, {wise_name}) の実行結果に置き換える.
" blockwise の場合には最終行を実行結果で置き換える.
map <expr> ss operator#evalf#mapexpr(function('Hoge'),  0)



" func({str}, {motion} {definition})
function! In2Pre(str, ...)
    return mconv#in2pre(a:str)
endfunction

let g:operator#evalf#config = {
\    'prefix': {'func': function('In2Pre') },
\}

" 実行後に g:operator#evalf#config で定義した関数を入力する.
" 挿入先は関数名の最初か最後に -/0/+ で指定する
map ss <Plug>(operator-evalf)

添加新评论