sponsor Vim development Vim logo Vim Book Ad

JumpToVerticalBlock : Like W / E, but vertically in the same column.

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

created by
Ingo Karkat
 
script type
utility
 
description
DESCRIPTION
There are far fewer vertical motions, especially those that maintain the
current column (which can be influenced via 'nostartofline'). Mostly, one uses
k / j to move up / down. With 'relativenumber', this can already be quite
precise, but it's tedious to handle the [count] yourself. Many text formats
have a natural structure of different indents and line lengths. So, like word-
and WORD-wise motion within a line, a notion of vertical "blocks", comprised
of a sequence of non-whitespace characters under each other, can be helpful
for quick navigation.

This plugin provides ]w and ]W mappings that move vertically along the
current screen column, to the beginning or end of a block of non-whitespace
characters. That is, they operate like W and E, but vertically.

SEE ALSO
- The JumpToVerticalOccurrence.vim plugin (vimscript #4841) has several
  other vertical motions, like a vertical version of f{char}, and a move to
  the next line with non-whitespace in the current column.
- Check out the CountJump.vim plugin page (vimscript #3130) for a full list
  of motions and text objects powered by it.

RELATED WORKS
- columnMove (vimscript #5402) moves to the end / start of vertical blocks of
  non-whitespace; i.e. it has a single mapping combining ]w and ]W. So far
  uses character columns instead of virtual screen ones. It inspired this
  plugin.

USAGE
]w                      To [count]'th next start of a block of non-whitespace
                        characters at the current screen column.
                        Like W, but vertically.
]W                      To [count]'th next end of a block of non-whitespace
                        characters at the current screen column.
                        Like E, but vertically.
[w                      To [count]'th previous start of a block of
                        non-whitespace characters at the current screen column.
                        Like B, but vertically.
[W                      To [count]'th previous end of a block of
                        non-whitespace characters at the current screen column.
                        Like gE, but vertically.

EXAMPLE
With the cursor starting at 0, it will move to positions 1, 2, ... when
invoking the command next to it:

]w   3]w   ]W
|    |     |
0....0.....0.....3..2.

1......
..............
..       ..1.    2...
.......          ...1
....
        ........
        .........1
        ...2..
2....1
....
...........3.....0..0
                 |  |
                 [w [W
 
install details
INSTALLATION
The code is hosted in a Git repo at
    https://github.com/inkarkat/vim-JumpToVerticalBlock
You can use your favorite plugin manager, or "git clone" into a directory used
for Vim packages. Releases are on the "stable" branch, the latest unstable
development snapshot on "master".

This script is also packaged as a vimball. If you have the "gunzip"
decompressor in your PATH, simply edit the *.vmb.gz package in Vim; otherwise,
decompress the archive first, e.g. using WinZip. Inside Vim, install by
sourcing the vimball or via the :UseVimball command.
    vim JumpToVerticalBlock*.vmb.gz
    :so %
To uninstall, use the :RmVimball command.

DEPENDENCIES
- Requires Vim 7.0 or higher.
- Requires the CountJump plugin (vimscript #3130), version 1.90 or higher.

CONFIGURATION
For a permanent configuration, put the following commands into your vimrc:

To change the default motion mappings, use:
    let g:JumpToVerticalBlock_ToBeginMapping = 'w'
    let g:JumpToVerticalBlock_ToEndMapping = 'W'
To also change the [ / ] prefix to something else, follow the instructions for
CountJump-remap-motions.
 

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
JumpToVerticalBlock-1.00.vmb.gz 1.00 2018-02-11 7.0 Ingo Karkat Initial upload
ip used for rating: 13.59.218.147

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