place.vim


Ⅰ. 插件描述

Enter pieces of text without moving

Ⅱ. 基本信息

创建日期:  2017-12-21
使用用户:  8
Github星:  43
插件作者:  Joe Reynolds

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/joereynolds/place.vim

Ⅳ. 文档说明

# place.vim

place.vim allows you to add insertions to your text without moving your cursor.
If you suffer from the following problems, this plugin might be for you:

  • Forgotten to add a ';' at the end of a line.
  • Forgotten var, let, $ or any other variant at the beginning of a line.
  • Wanted to insert some text without having to enter insert mode, move to the place, leave insert mode, and go back

Mapping

Add a mapping of your choice to get place.vim working for you.

Example:

nmap ga <Plug>(place-insert)
nmap gb <Plug>(place-insert-multiple)

Examples

(Examples are using ga as the prefix key but it can be anything you want)

place.vim works in the 'vim' way. Here are a few examples of what it does

| denotes cursor position

1

function(na|me, $age)
gab$

Results in

function($name, $age)

2

$thi|s->doSomeStuff = 5
ga$;

Results in

$this->doSomeStuff = 5;

3

It also supports multiple line motions

This
is
a
really long
line
gaG.

Results in

This
is
a
really long
line.

4

A more complex motion (t)

T|his is Y sentence
gatYM

Results in

This is MY sentence

FAQ

I want to enter 'var' or 'let' like you said I could in the README!

Sure thing, there's a separate mapping <Plug>(place-insert-multiple) to map to.
Read the docs.

Now, when you finish your motion, an input box will appear with what you want to insert.

添加新评论