SyntaxMotion.vim : Cursor motion & visual selection by syntax highlighting group
| script karma
Downloaded by 735
Comments, bugs, improvements
script versions (upload new version)
|This plugin provides cursor motion by syntax highlighting groups in normal
and visual mode:
- type \<right> (actually <Leader><right>) to move the cursor forward to
the end of the syntax group where cursor is located.
- type \<left> (actually <Leader><right>) to move the cursor forward to
the beginning of the syntax group where cursor is located.
For example, when inside a string, pressing \<right> moves to the end of
the string. When inside a comment, pressing \<left> moves to the
beginning of the comment. You can extrapolate this behavior to any kind
of syntax group.
Repeating the motion multiple times will move to the next syntax
highlighting group (forward or backward). A repeat count number can also be
given before typing \<left> or \<right>. For example, typing 3\<left>
moves the cursor to the left by 3 syntax elements.
Strictly speaking, motion actually moves to the start or end of the text
which has the same "color" (rather than same "syntax group") as the color
of the text where cursor is originally located. So if your color scheme
defines the same colors for multiple syntax groups, motion may actually span
multiple consecutive syntax groups if they have the same colors. Motion is
based on syntax highlighting colors rather than syntax highlighting groups
to make behavior more intuitive (what you see is what you get) since users
see colors on the screen but may not be aware of different syntax highlight
Plugin also provides a way to select the text visually around the position
of the cursor with the same syntax group as where cursor is located:
- type va<right> to visually select the text with the same syntax as
where cursor is located, and move the cursor to the end of the selected
- type va<left> to visually select the text with the same syntax as
where cursor is located, and move the cursor to the beginning of the
Syntax highlighting must be enabled for the plugin to work.
License: The VIM LICENSE applies to SyntaxMotion.vim (see ":help copyright"
except use "SyntaxMotion.vim" instead of "Vim").
- write a proper help page
- provide mapping in operator pending mode
|Drop SyntaxMotion.vim into your favorite plugin directory: ~/.vim/plugin/ on Unix, $HOME/vimfiles/plugin or $VIM/vimfiles/plugin on Windows).
Click on the package to download.
ip used for rating: 188.8.131.52