diff --git a/README.md b/README.md index c7bbd20..d1d413b 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ - [Getting help offline](#getting-help-offline) - [Getting help online](#getting-help-online) - [Managing plugins](#managing-plugins) +- [Block insert](#block-insert) #### [Debugging](#debugging-1) - [General tips](#general-tips) @@ -258,6 +259,37 @@ in alphabetic sequence: Plug is my favorite, but your mileage may vary. +#### Block insert + +This is a technique to insert the same text on multiple consecutive lines at the +same time. See this +[demo](https://raw.githubusercontent.com/mhinz/vim-galore/master/pics/block_insert.gif). + +Switch to visual block mode with ``. Afterwards go down for a few lines. +Hit `I` or `A` and start entering your text. + +It might be a bit confusing at first, but text is always entered for the current +line and only after finishing the current insertion, the same text will be +applied to all other lines of the prior visual selection. + +So a simple example is `3jItext`. + +If you have lines of different length and want to append the same text right +after the end of each line, do this: `3j$Atext`. + +Sometime you need to place the cursor somewhere after the end of the current +line. You can't do that by default, but you can set the `virtualedit` option: +```viml +set virtualedit=all +``` +Afterwards `$10l` or `90|` work even after the end of the line. + +See `:h blockwise-examples` for more info. It might seem complicated at first, +but quickly becomes second nature. + +If you want to get real fancy, have a look at +[multiple-cursors](https://github.com/terryma/vim-multiple-cursors). + ## Debugging #### General tips diff --git a/pics/block_insert.gif b/pics/block_insert.gif new file mode 100644 index 0000000..8c7b012 Binary files /dev/null and b/pics/block_insert.gif differ