sponsor Vim development Vim logo Vim Book Ad

move-less : plugin for faster navigation without changing the cursor position

 script karma  Rating 12/3, Downloaded by 2112  Comments, bugs, improvements  Vim wiki

created by
Andreas Schnapp
 
script type
utility
 
description
This plugin is a tool for navigating inside of a file without moving the cursor to another line.
The idea is that you fold the space between your line and the target destination and then jump to the target position.

To archive this there is a so called move-less-mode which you can enter by typing <leader>m.

You can now also use it to generate a temporary upper and or bottom folding. So, you can place to distance section from the upper and the bottom together. (see meaning of 'p' while in move less mode)

If you want to remap the setting you can just create a mapping which calls the function MoveLessMode.

If you are in the move-less mode you can navigate like the following:

j: Type once and your line will be displayed at the top (if possible). Every further click will fold lines below your cursor. So you can see the text under your cursor. The number of lines which are fold are defined by the scroll attribute.

k: Type once and your line will be displayed at the bottom (if possible). Every further click will fold lines below your cursor, so you can see the upper text. The number of lines which are fold are defined by the scroll attribute.

J: Type once and your line will be displayed at the top (if possible). Any further click will reduce the fold below your cursor position. So, that you are able to see text again which you already have fold (kind of an undo of j)

K: Type once and your line will be displayed at the bottom. Any further click will reduce the fold above your cursor position. So, that you are able to see text again which you already have fold (kind of an undo of k)

k: Type once and your line will be displayed at the middle. Any further click will fold the text above and below your cursor position. So, that you are able to search your target positon in both directions.

h: Type once and your line will be displayed at the middle. Any further click will reduce the fold above and below your cursor position. So, you can see the text again which you already fold. It's kind of an undo for k.

<esc>: Abort move less mode and delete all foldings, you are not able to jump to Any distance place now.

p: Stop the move less mode but let the folding remain (p)ermanently. In fact it's just more permanent then the normal behaviour it's also temporary until you use the mode less mode next time. If you just want to unfold later you can go to move less mode and end it directly with . This new feature permanent feature should be handy if you want to edit two places in the file which has a big distance.

Any other key: Move less mode will directly be ended, but folding will be temporary remain. From now on, you can jump over the folding to get to your target position. You can use Any vim method you like for this action. For example move-less is intended to work pretty well with easymotion.
After such an action the folding will be immediately removed. It is only intended to be used for navigation without moving.

It's also available at github:
https://github.com/anschnapp/move-less
 
install details
 

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
move-less-1.4.tar.gz 1.4 2019-02-06 7.0 Andreas Schnapp * record the jump over the fold regardless if the user navigation was a jump command
* Provides mappings for shortcuts used in MoveLess Mode
move-less-1.3.tar.gz 1.3 2018-07-06 7.0 Andreas Schnapp If move less mode is ended with p (for permanent) the folding will remain.
Handy for editing far away distances form up and below together.

Then you can more easily yank, paste, replace, create macros etc. between this two places.
move-less-1.2.1.tar.gz 1.2.1 2018-05-09 7.0 Andreas Schnapp * just fix a bug when ending move less mode via ESC
move-less-1.2.tar.gz 1.2 2018-05-09 7.0 Andreas Schnapp * move-less navigation will not add entries to the jumplist any more
* make buffer local variables more unique to avoid collisions
move-less-1.1.tar.gz 1.1 2018-04-30 7.0 Andreas Schnapp * support a walk over the folding where the folding remains until the cursor is outside of the folding area
* if the move less mode was ended but no jump or walk over the fold appears the move less code will be continued where it was stopped when it is started again
* remove duplicate tag in move less doc
move-less.tar.gz 1.0 2018-04-22 7.0 Andreas Schnapp Initial upload
ip used for rating: 3.145.166.7

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