emacs-evil / evil

The extensible vi layer for Emacs.
GNU General Public License v3.0
3.33k stars 282 forks source link

a few motion commands #51

Open TheBB opened 12 years ago

TheBB commented 12 years ago

Originally reported by: jimgreen (Bitbucket: jimgreen, GitHub: jimgreen)


would the following movement commands be incorporated to evil someday, they are quite useful in navigating in source codes. pls let me know if it is useful to put in to feature request tracker as well. Thanks and happy holidays!

Jim.

                                           [(

[( go to [count] previous unmatched '('. exclusive motion. {not in Vi}

                                           [{

[{ go to [count] previous unmatched '{'. exclusive motion. {not in Vi}

                                           ])

]) go to [count] next unmatched ')'. exclusive motion. {not in Vi}

                                           ]}

]} go to [count] next unmatched '}'. exclusive motion. {not in Vi} ]m ]m Go to [count] next start of a method (for Java or similar structured language). When not before the start of a method, jump to the start or end of the class. When no '{' is found after the cursor, this is an error. exclusive motion. {not in Vi}

                                           ]M

]M Go to [count] next end of a method (for Java or similar structured language). When not before the end of a method, jump to the start or end of the class. When no '}' is found after the cursor, this is an error. exclusive motion. {not in Vi}

                                           [m

[m Go to [count] previous start of a method (for Java or similar structured language). When not after the start of a method, jump to the start or end of the class. When no '{' is found before the cursor this is an error. exclusive motion. {not in Vi}

                                           [M

[M Go to [count] previous end of a method (for Java or similar structured language). When not after the end of a method, jump to the start or end of the class. When no '}' is found before the cursor this is an error. exclusive motion. {not in Vi}


TheBB commented 12 years ago

Original comment by Frank Fischer (Bitbucket: lyro, GitHub: lyro):


Add motions to unmatched enclosing parenthesis.

This includes the ViM commands [(, ]), [{ and ]} (addresses #51).

wasamasa commented 7 years ago

This seems to only be missing the method movement commands: https://github.com/vim/vim/blob/60402d68da09997cacdeec71fd22c9344f8f40d5/src/normal.c#L6519-L6646

edkolev commented 7 years ago

I use the following spartan version:

  (general-nmap "[ m" 'beginning-of-defun)
  (general-nmap "] m" 'end-of-defun)

I could try to add support for COUNT and remove the general.el dependency. However, support for jumping to the next/prev class might not be as simple.