The Kakoune way

I come back to kakoune from some days ago after around 4 years. I discovered lot of plug-in are now public archive (kak-tree, tagbar ...and even fzf.kak that I’m trying to make my own with color(with bat) now to find file and string( Fzf.kak with bat and line numbers - #7 by lauccode ). Can we continue to use them or should we use another one ?

Kakoune is particular for me. Because we can really connect to another tools. But for me kamp, kks, kakoune.cr are obscure plugins. I didn’t start to use them. It is a new concept for me. Do we need to use those new plugins to use Kakoune as an IDE ? Could you explain how are the usefull cases ? I need to use them to use fzf with Kakoune rather than fzf.kak ?

I have poor knows in shell and it seems it is really needed to take advantage of Kakoune. Is there some tutos to start to be able to catch well kakrc+shell and to be able to really improve kakoune the way we want ?

1 Like

Hi, @lauccode!

The reason the aforementioned plugins are archived is that @andreyorst stopped using Kakoune and, understandably, lose interest in maintaining them.

The good news is that, specif for fzf.kak there are two alternatives that come to my mind.

First, if you do want to stay with the fzf program, you can take a look at popup.kak by @enricozb (an amazing plugin by the way; congrats, Enrico!). By using it, filtering files with fzf is just a matter of calling

popup --title open --kak-script %{edit %opt{popup_output}} -- fzf

The other alternative is a plugin called Peneira, developed by me. It’s a general purpose fuzzy finder you can use for many use cases: filtering files, or lines inside a file, or jump to symbols in a source code… you can even easily define your own custom filters, like @mbauhardt did here.

The advantage of both alternatives, compared to fzf.kak is that you don’t need to run Kakoune inside a tmux session. They are very tightly integrated in Kakoune’s UI.

I hope any one of them can be useful for you.

2 Likes

Thanks !
I could install and test successfully both.
Popup can be used to have fzf + ripgrep + bat calling script and it is working very well.
I like Peneira to filter in a file also with color.

Hi @lauccode I am using this simple command from fzf-tmux

map global user -docstring 'open fuzzy finder' f ': edit %sh{fzf-tmux --color=16 --preview "bat --theme=Nord --style=numbers,changes --color always {}" -}<ret>'

Check it in context.

But you need to use fzf-tmux installed ?

But that comes with fzf

$ pacman -Ql fzf | grep tmux
fzf /usr/bin/fzf-tmux
fzf /usr/share/man/man1/fzf-tmux.1.gz

Eh , Yes, you are right :sweat_smile:
I tried, this is working well.
Do you use a similar way to search words with ripgrep ?

I just use the Kakoune’s grep command with rg:

I thought I could search from ripgrep with fzf-tmux by adapting the script “frf” by replacing tmux by fzf-tmux :

#!/usr/bin/env bash

# 1. Search for text in files using Ripgrep
# 2. Interactively narrow down the list using fzf
# 3. Open the file in Vim
rg --color=always --line-number --no-heading --smart-case "${*:-}" |
  fzf-tmux --ansi \
      --color "hl:-1:underline,hl+:-1:underline:reverse" \
      --delimiter : \
      --preview 'batcat --color=always {1} --highlight-line {2}' \
      --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' \
      --bind 'enter:become(kak {1} +{2})'

And call it with :
map global user -docstring 'open fuzzy grep finder (TMUX)' g ': edit %sh{frf -}<ret>'

But I don’t know how to adapt the end of “frf” script to open in already kakoune session and not trying to open new kak from terminal ?

I could adapt to open the file with :
--bind 'enter:become(echo {1})',

But don’t have the line number, so I could adapt by :
--bind 'enter:become(echo {1} {2})',

But prob is that I guess kak do :e 'path_n_fileName 13' rather that :e path_n_fileName 13

If someone could help ?

–bind ‘enter:become(echo {1} {2})’

Is sent back 'path_n_fileName 13' , I guess it should work with path_n_fileName 13.

Maybe I should ask to fzf developer or if someone know how to process the response ?

I found a solution and I explain how I did here :
How to use kak_selection? - Help - Kakoune Community Hub

1 Like