Menu

#101 ap/ip movements must match complete method

none
open
nobody
movements (1)
3
2014-02-20
2014-02-20
rhk
No

I often use vap/vip or yap/yip commands to duplicate a method. This assumes, that a "vi-paragraph" is a method.

It works perfectly - except there is an empty line in the method itself. Which is - unfortunately - the correct vi understanding of a paragraph.

Is there a way to specify a paragraph to be started at the beginning of a method/block (including modifiers and annotations) and last until the end of a method (the closing '}') with vip/yip/dip or until the next empty line after the method with vap/yap/dap, even if there are empty lines in the method/block?

Please note: There are different keyboard-layouts, where you must request the '{' or '}' movements-keys by pressing different meta-keys which brings funny contortions of your fingers... so I won't use these movements but will use the 'ap' or 'ip' movements.

Discussion

  • Ernie Rael

    Ernie Rael - 2014-02-20

    Maybe you can define a keybinding to do what you are looking for. The ]M motion might be useful in that regard. Keybindings could also allow you to map '}' to a simpler key combination.

    The jVi source is available if you wish to build your own version with some customizations.

     
  • Ernie Rael

    Ernie Rael - 2014-02-20
     

Log in to post a comment.

MongoDB Logo MongoDB