Hi,
I try to setup Kakoune to complete files in dirname ${kak_buffile}
. According to the docs %/
should do it, but does not seem to work for me.
(I usually start Kakoune in $HOME
with kak -d -s main
and connect to it with kak -c main
)
So I have tried to add the folder manually:
hook global BufCreate ^[^*]+$ %{
evaluate-commands %sh{
path=$(dirname "$kak_buffile")
printf %s\\n "set-option -add buffer path ${path}"
}
}
It does somewhat works, but now using :edit
will only complete files in the current directory, no results from $HOME
. 
Btw /usr/include/
completion does not work for me either. I think I have misunderstood the concept, but I can not figure it out.
Thanks,
Commands defined with -file-completion
have the same completions as :edit
.
The path option is currently only used for the gf
command. I think it could conceivably be extended to be honored for edit -existing
, but providing completions based on it would be noisy.
You can use something like define-command -shell-script-candidates %{ find -type f $kak_opt_path }
.
Commands defined with -file-completion
have the same completions as
:edit
.
The path option is currently only used for the gf
command. I think it
could conceivably be extended to be honored for edit -existing
, but
providing completions based on it would be noisy.
Well, :doc options says:
directories to search for gf command and filenames completion
So I still think it should do what i have thought it would be.
You can use something like define-command -shell-script-candidates %{ find -type f $kak_opt_path }
.
For the record this one works:
define-command -params 1 -shell-script-candidates "find . $(dirname $kak_buffile) -type f" myedit %{
edit $1
}
OTOH I have realized that as I am running kak in $HOME
this completion
does not help me at all, as I still have to type in the whole path to
load a file.
So I either use per project Kakoune to shorten the path or have to type
in the whole thing as it is ambiguous otherwise. Lesson learned.
Thanks for the help anyway!