sponsor Vim development Vim logo Vim Book Ad

place.vim : Enter characters without moving

 script karma  Rating 11/11, Downloaded by 949  Comments, bugs, improvements  Vim wiki

created by
Joe Reynolds
 
script type
utility
 
description
Note that development happens on Github

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

![](https://i.imgur.com/N3rcDUi.gif)

## Mapping

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

Example:

```
nmap ga <Plug>(place-insert)
```

## 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.

Either that or you can enable it globally:

`let g:place_single_character_mode = 0`

Now, when you finish your motion, an input box will appear with what you want to insert.
This is turned off by default because I imagine the majority of people want to insert small things like $ or ;.
 
install details
Using vim-plug you can do the following

Plug 'joereynolds/place.vim'
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
place.vim 0.2 2017-12-25 7.4 Joe Reynolds Features
=======

- Remove default mapping of ga and expose <Plug> mapping instead
- Expose <Plug> mapping to insert multiple characters
- Blink on insertion for visual feedback
- Add support for the following motions:
    - gg
    - F
    - T
    - f
    - {
    - }
- Make plugin repeatable with . command if repeat.vim is installed
- Don't jump the cursor on undo of insertion made by place.vim
    


place.vim.zip 0.1 2017-12-22 7.0 Joe Reynolds Initial upload
ip used for rating: 3.83.81.42

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github