sponsor Vim development Vim logo Vim Book Ad

place.vim : Enter characters without moving

 script karma  Rating 3/3, Downloaded by 51    Comments, bugs, improvements  Vim wiki

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


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


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)
Results in
function($name, $age)

### #2
$thi|s->doSomeStuff = 5
Results in
$this->doSomeStuff = 5;

### #3

It also supports multiple line motions
really long
Results in
really long

### #4

A more complex motion (t)
T|his is Y sentence
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:

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.
SourceForge.net Logo