vim-swap : Reorder delimited items.
script karma |
Rating 19/7,
Downloaded by 2899 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Masaaki Nakamura |
|
script type |
utility |
|
description |
vim-swap is an plugin to reorder delimited items. Considering the following code snippet, it is easy to swap "arg2" and "arg3" but is annoying work that swaps "arg1" and "arg2" since user have to manage a word and a delimiter separately.
call foo(arg1, arg2, arg3)
This plugin serves mappings to make easier to do that kind of operations. This plugin defines three mappings in default, g<, g>, gs. g< swaps the item under the cursor with the former item. Moving cursor on the "arg2" and pressing g<, then it swaps "arg2" and the former one, "arg1", to get:
call foo(arg2, arg1, arg3)
g> swaps the item under the cursor with the latter item. Moving cursor on the "arg2" and pressing g>, then it swaps "arg2" and the latter one, "arg3", to get:
call foo(arg1, arg3, arg2)
gs works more interactive. It starts "swap mode", as if there was the sub-mode of vim editor. In the mode, use h/l to swap items, j/k to choose item, numbers 1 ~ 9 to select nth item, u/<C-r> to undo/redo, and as you know <Esc> to exit "swap mode".
Latest version: https://github.com/machakann/vim-swap |
|
install details |
Unzip and put all folders in your ~/.vim. |
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 142.132.191.50
|