tris203 / precognition.nvim

💭👀precognition.nvim - Precognition uses virtual text and gutter signs to show available motions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proposal - configurable horizontal and vertical motion display

josh-nz opened this issue · comments

There are a few motion hints that Precognition displays that I don't require, such as G, gg, 0, $. These just add unwanted noise.

I'm proposing adding configuration to allow users to decide which motions should be displayed. I've had a quick look at the code and I think I can at least have a first pass at implementing this (tests aside, which I might break).

Before starting,

  1. Is this something that would be beneficial to others?
  2. Is there any desired format for what the configuration should look like?

Is it preferable to be explicit about every option, eg:

features = {
  G = true,
  gg = false, ...
}

or is it better to go with either a list of enabled features (so everything off by default), or a list of disabled features (so everything on by default), eg:

disabled = { "G", "gg", ... }

I think I'm leaning towards the later, and having everything on by default since that is really the point of the plugin, with optional disabling.

Thanks for the suggestion @josh-nz

This can already be done in horizontal motions by setting

    hints = { Zero = {  prio = 0 } },

It can't currently be done for gutterhints, but that would just be a case of implementing prior for the gutterhints, which shouldn't be too hard! As you can mostly reuse the logic from the horizontal hints

Logic from here:

local hint = config.hints[mark].text or mark

to:

if config.gutterHints[hint] and loc ~= 0 and loc ~= nil then

Even though I have the priority stuff in my config (although commented out), it still completely slipped my mind that this was a feature when I opened this issue. My apologies, in the future I should try to remember to throughly review the docs before opening issues to help prevent wasted time.

I have however had an attempt at implementing support for the gutter hint priorities, based on your suggestions. See #43