Introducing quickscope.kak

Hi,

I have started using Kakoune half a year ago. I have used vim mostly before, but I can not say I am a vim poweruser by any means. Just some config file editing and so.

I try to use Kakoune the right way. This means using hjkl for moving and w, e and b for words and so. I try to go step-by-step, finding lame use cases and fixing them by training good habits.

I have noticed myself moving around lines hammering j and k, so I have tried to fix that
this way. I was able to set up my terminal to work with those bindings, but it only helped me with large jumps, and not within line movements.

Now I try to solve that with f and t, but it is quite hard to figure out the right jump char.
To solve this I have written a little plugin for myself:
quickscope.kak

Let me know if You find it useful and do not hesitate to report here or on Nest if I have messed up something.

Thank You!

4 Likes

Hi @Voroskoi! You can also consider using ModeChange hooks rather than mappings to enable/disable highlighting. The hook_param values are push:normal:next-key[to-char] and pop:next-key[to-char]:normal respectively for entering and exiting f/t/<a-f>/<a-t> from normal mode.

If you need to know what key was pressed to change modes, you can use a separate hook like this.

1 Like

Thanks for the tip, it is done.

Hi,

Couple changes, I do not plan to add any more feature to this plugin:

  • Fixed multibyte character highlighting.
  • Also introducing quickscope user mode which (when enabled) pops up a menu to for repeated calling without reentering search key. (Idea comes from fandt plugin by @listentolist)

Thanks!

1 Like

Hi,

With pijul rewrite nest.pijul.com is unavailable most of the time, so i decided to move quickscope.kak to git, which makes it easier to use with plug.kak:
https://sr.ht/~voroskoi/quickscope.kak/

I have also rewritten quickscope in lua. I have experienced a little lagging with the python version on cold start, now it is below 100 ms constantly.

Lua rewrite probably introduced couple brand new bugs, as i had to write my own string partitioning function with lua patterns instead of python re plugin regex matching. The latest python version is available in python branch, so You can switch back if something brakes badly. Feel free to file a bug report in those cases.

Thanks,

1 Like

I think I’ll try this out next week. Will let you know how it goes.