sponsor Vim development Vim logo Vim Book Ad

markjump.vim : Code transversal functions, move to prev/next marker, insert/strip markers.

 script karma  Rating 1/1, Downloaded by 1413  Comments, bugs, improvements  Vim wiki

created by
Robert KellyIV
script type
This is a normal PLUGIN not ftplugin.

Marker chars are configurable.
You can define global or buffer variables to specify the marker chars for both left and right chars. Buffer vars if present are used before global chars

The default marker chars are the same as Luc Hermitte's bracketing.base.vim which is the same as Stephen Riehm's braketing macros. Which is to say «»

If you do not have digraphs enabled these chars are still easy to insert via
<c-k><< which gives you  '«' and <c-k>>> which is '»' (far easier to use the included commands however)

:MN        Search forward for the next occurance of marker chars
:MP        Search backwards for the next occurance of marker chars
:MI          Insert marker chars, usefull for <c-o>:MI text to have markers around it<cr>
:MIV       Wrap the visual selection (single line) with marker chars
:MA        Append marker chars (like a)
:MAV     Same as :MIV
:MS        Strip marker chars, positioning is a touch picky; place cursor in the markers and all is well.

Insert mode mappings:
<plug>MjMark         Defaults to `ˇmark!`        Insert marker chars, cursor AFTER the marker chars.
<plug>MjJump        Defaults to `ˇjump!`        Jump to the next marker (as :MN)

VISUAL mode mappings:
<plug>MjMark         Defaults to `ˇmark!`        Wrap marker chars around the selection. (as MIV)

NOTE if you already have insert and or visual mappings for ˇmark!/ˇjump! these will NOT be made.

Key mappings:
<plug>MjPrev           Defaults to <M-Insert> in normal, insert and visual.       Jumps to previous markers, as :MP
<plug>MjNext             Defaults to <M-Del> in normal, insert and visual.        Jumps to next marker, as :MN
<plug>MjInsMarker        Defaults to <M-m> in insert.       Shortcut for `<c-o>:MI ` Just hit <m-m>type your words<cr>

If there is gui and has menu adds the following plugin menu items:
Plugin.markjump.Prev  Marker
Plugin.markjump.Next Marker
Plugin.markjump.Insert Marker
Plugin.markjump.Append Marker
Plugin.markjump.Strip Markers

Strip markers mens to remove the marker chars from either side; cursor generally needs to be within the marker chars.

This script would not be what it is with out Luc Hermitte's input!
install details
This may clash with other bracketing/mark jump type scripts; I've tried to minimise such colisions by giving way to existing mappings/commands. Even with existing scripts the commands defined in this script will probably be available, so you can at least take this for a test run to see if it meets your likes.
Install, drop in PLUGIN (not ftplugin) folder.
Unistall, as easy as removing from your plugin folder. (and if you have made any maps to this you'll want to do something with those as well)
Test drive:
install, open a test file and :MI some text<cr>   then move cursor and play wiht :MN and :MP

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
markjump.vim 0.29 2002-11-14 6.0 Robert KellyIV Initial upload
ip used for rating:

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.