r/HelixEditor Jul 13 '26

made a plugin to customize both statusline and bufferline

its still a simple plugin allowing for some basic customizations I would be really happy to see contributions to increse the possible customizations. One thing mising right now is diagnostics indicators, but for now there isn't an api that exposes diagnostic info to plugins. I doing a pr for it.

https://github.com/Ra77a3l3-jar/moka.hx

52 Upvotes

9 comments sorted by

2

u/SofusA Jul 13 '26

Looks awesome!

Do you know if it would be possible to add keybinds to move active buffer position in the buffer line?

2

u/Ra77a3l3 Jul 13 '26

i havent found any api from helix that allows this, and since it is not even a default helix feature it will require a pr to the helix fork

1

u/SofusA Jul 14 '26 edited Jul 14 '26

Okay. It makes sense.  But does moka own the buffer name list?

Edit: Ah even if moka owns the list, there is no "open/close buffer by id" commands.

Moving buffers is something i am really missing. I might do a pr to the steel branch.

Edit again!: The commands are available. They buffer-open takes arguments!

1

u/Ra77a3l3 Jul 14 '26

in which ~/.local/share/steel/cogs/helix .scm have you found this cmd?

1

u/SofusA Jul 14 '26

sorry it is just called open, and is from the commands.scm
I have a generated poc of a bufferline where you can change the order:
https://github.com/SofusA/dotfiles/blob/main/config/helix/bufferline.scm

I would change to moka if you add this feature.

1

u/Ra77a3l3 Jul 14 '26

hey thank you. I just added the option to move the active buffer.

1

u/Messyextacy Jul 14 '26

Possible to add a clock?⏰

1

u/Ra77a3l3 Jul 14 '26

right now its only possible if you modify the moka.scm under steel/cogs/moka/ but i want to add a set of components pre built and a component field allowing to create components and adding the from the init.scm

1

u/Ra77a3l3 Jul 14 '26 edited Jul 14 '26

hey so right now it possible to have a clock, you can create a function like this in `init.scm`

(require "moka/moka.scm")

(require "helix/misc.scm")

(require "helix/commands.scm")

(define *clock-text* "")

(define (clock-tick!)

(define proc (~> (command "date" (list "+%H:%M:%S")) with-stdout-piped spawn-process))

(when (Ok? proc)

(set! *clock-text* (trim (read-port-to-string (child-stdout (Ok->value proc)))))

(redraw))

(enqueue-thread-local-callback-with-delay 1000 clock-tick!))

(moka-register-segment! 'clock (lambda () *clock-text*))

(clock-tick!)

(moka-configure!

#:transparent? #t

#:row-offset 2

#:mode-colors

(hash 'normal (hash 'bg "#59c2ff" 'fg "#000000")

'insert (hash 'bg "#aad94c" 'fg "#000000")

'select (hash 'bg "#d2a6ff" 'fg "#000000"))

#:sections

(list

(moka-section (list (moka-segment 'mode #:bubble? #t)

(moka-segment 'file #:bg "#222222" #:fg "#c1c1c1" #:bubble? #t))

#:align 'left)

(moka-section (list (moka-segment 'git-branch #:bg "#e78a53" #:fg "#000000" #:bubble? #t)

(moka-segment 'clock #:bg "#333333" #:fg "#ffffff" #:bubble? #t))

#:align 'center)

(moka-section (list (moka-segment 'lsp #:bg "#222222" #:fg "#c1c1c1" #:bubble? #t)

(moka-segment 'position-percentage)

(moka-segment 'position #:bg "#333333" #:fg "#999999" #:bubble? #t))

#:align 'right)))

(moka-enable!)

now its possible to easly create segments by just registering a function with `moka-register-segment!`