sponsor Vim development Vim logo Vim Book Ad

patternjump : Move cursor as you like.

 script karma  Rating 0/0, Downloaded by 2781  Comments, bugs, improvements  Vim wiki

created by
Masaaki Nakamura
 
script type
utility
 
description
Patternjump give you a effective way to move cursor in various modes. The rules to move cursor can be easily optimized by using regular expression. Those rules defined by regular expression are called patterns in this introduction. Numbers of patterns can be registered and cursor would be moved to the closest candidate in them. This plugin serves two keymappings.  One searches candidates for forward direction, and the other searches them for backward direction.

Suppose that your cursor is on the first character of a line like this:

    let foo = "bar"

If you define a pattern "bar", of course, it matches with "bar". Thus using the keymapping which searches candidates in forward direction, cursor will move on a word "bar". Here I should say there are two types of patterns, head-patterns and tail-patterns. All the patterns should belong to either head or tail patterns, you can choose which when you register a new pattern. If "bar" belongs to head-patterns, cursor will move on 'b' of "bar". And if "bar" belongs to tail-patterns, cursor will move on 'r' of "bar".

    head-pattern :
        let foo = "#bar"                         '#' represents cursor position

    tail-pattern :
        let foo = "bar#"                         '#' represents cursor position

I guess you have found that the pattern "bar" seems like not useful. So "bar" is not included in default patterns. Alternatively, a pattern '\<\h\k\+\>' is included in default patterns. This pattern matches with a independent word determined by the option 'iskeyword' in a source code.  Therefore cursor will stop at "let", "foo", "bar". I think they are the very what we want to correct when we review a source code in many cases.

Latest version : https://github.com/machakann/vim-patternjump
 
install details
Unzip and just put all folders in your ~/.vim.
 

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
patternjump-2.1.1.zip 2.1.1 2015-10-09 7.4 Masaaki Nakamura Bug fixes.
patternjump-2.1.0.zip 2.1.0 2015-02-27 7.4 Masaaki Nakamura Implement new search engine.
    * obsolete 'wrap_line' option
    * obsolete 'move_afap' option
    * obsolete 'swap_head_tail' option
    * obsolete 'cache_name' option
    * add 'timeout' option
patternjump-2.0.1.zip 2.0.1 2014-06-21 7.0 Masaaki Nakamura Fix a bug on backward searching.
patternjump-2.0.0.zip 2.0.0 2014-04-06 7.0 Masaaki Nakamura * Bug fixes.
* New feature : now patternjump can move cursor to vicinal lines.
patternjump-1.0.3.zip 1.0.3 2014-03-26 7.0 Masaaki Nakamura Fix the bug with 'set encoding=utf-8' environments.
patternjump-1.0.2.zip 1.0.2 2014-03-10 7.0 Masaaki Nakamura Bug fixes.
patternjump-1.0.1.zip 1.0.1 2014-03-08 7.0 Masaaki Nakamura Bug fixes.
patternjump-1.0.0.zip 1.0.0 2014-03-02 7.0 Masaaki Nakamura Initial upload
ip used for rating: 44.220.184.63

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github