Skip to content

postsolar/jump.kak

Repository files navigation

Jump — another Kakoune jump-mode plugin

Screenshot

Differences from existing alternatives

  • No known bugs
  • Handling of text with multi-byte (Unicode) characters
  • Dimmed text when entering jump mode (face used is configurable)
  • Highlighted labels (face used is configurable)
  • Jumps in both directions with single command
  • You can make a jump which would discard your current selection, add the target word as a new selection, or extend current primary selection
  • The label to be applied is calculated based on the distance from the cursor. That is, if you have labels like aabz, then the ones closest to your cursor will be aa, ab, ac, and so on, whereas the ones furthest from your cursor will be bx, by, bz, irrespective of whether the label comes before or after the cursor line and column.
  • Powered by Node

Dependencies

You should have node installed and available in your PATH.

Installation

Just clone the repository into your autoload/ folder.

If you clone it elsewhere, you will also need to source the file jump.kak. For example, you can add this command to your kakrc:

source path/to/plugin/jump.kak

If you're having troubles with installation or something else, feel free to ask for help via issues.

Usage

Simply enter the command :jumpJump, and then enter the characters of the label you want to jump to. If you wish to add the target word as a new selection, use :jumpJump -add If you wish to extend current selection up to and including the word under a given label, use :jumpJump -extend.

You can add the following mappings to your kakrc:

map global normal <ret> :jumpJump <ret>
map global normal <a-ret> :jumpJump -add <ret>
map global normal <s-ret> :jumpJump -extend <ret>

Configuration

The following options are exposed:

  1. jumpLabelsCharacters Characters to be used in labels. Must be at least 10 characters long.

Default value: "abcdefghijklmnopqrstuvwxyz"

  1. jumpExtraWordCharacters Additional characters, aside from alphanumerics, to consider as part of contiguous words for generating labels.

Default value: %opt{extra_word_chars}

  1. jumpLabelFace Face to use for highlighting jump labels. Set to default to not apply any highlighting at all.

Default value: 'rgb:f07a2b+f' (slightly dark bright orange — works well on dark and light colorschemes)

  1. jumpDimFace Face to use for dimming out non-label text. Set to default to not apply any dimming at all.

Default value: comment

TODO

  • Different faces for the first and following characters of a label.
  • Incrementally remove highlighting when entering the characters for the label to jump to. That is, if c is entered as the first character, every non-c label should be removed from the view, and every first c within every label which starts with c should be highlighted differently.
  • Allow labels of any length. Currently the only possible length of a label is two characters.