sponsor Vim development Vim logo Vim Book Ad

throughpairs :   spread or shrink the space of parenthesis symmetrically & smart traverse paren

 script karma  Rating 10/10, Downloaded by 1769  Comments, bugs, improvements  Vim wiki

created by
Han-seok Ryu
 
script type
ftplugin
 
description
1. traverse


map  <M-f> : forward traverse parentheses,  will stop at end position
imap <M-b> : backward traverse parentheses, will stop at start position



let abc = func( foo( xyz ), love( child(toy, food(water) ), parent ) )
                                        |                                               |  |              |  |
                         |      |                   |          |               |          



2. spread or shrink


imap <M-l> : spread out parentheses
imap <M-h> : shink parentheses



3. easy pass


<C-j> especially, in python coding can pass through "..." '...' (...) [...] <...> in insert mode selectively
      if the cursor meet keyword (say, class object(abc), if (...), for(...), etc.)
      <C-j> key will work as <right arrow> or <tab> or <enter> or spot ":" and <enter>
      so as to user don't care about which key to press.

    ("'[{word▌}]'")
    ("'[{word}▌]'")
    ("'[{word}]▌'")
    ("'[{word}]'▌")
    ("'[{word}]'"▌)
    ("'[{word}]'")▌      


        in python
            def func(▄)
            def func():
                ▄

        in C
            void func(▄)
            void func() {
                ▄
            }

    else works like enter key if the pos of cursor is at last column.


You can add or modify
let g:closingList = ["'",'"',")","]",">","}","$",'']

in which <C-j> key can pass through.



Note : all work will be done in insert mode except <M-f>

 
install details
drop in your vimfiles/plugin

or

using Bundle

in your .vimrc ( _vimrc for windows )
Bundle 'https://github.com/escher9/throughpairs'

 

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
throughpairs.zip 1.0 2013-11-23 7.3 Han-seok Ryu remap
throughpairs.zip 1.0 2013-11-22 7.3 Han-seok Ryu initial stable
easy-through-pairing.vim 0.5 2013-05-13 7.3 Han-seok Ryu Initial upload
ip used for rating: 216.73.216.208

Questions about Vim should go to the maillist. Help Uganda.     Vim at Github