Hey again, everyone.
So, 3 more questions for y’all
-
How to implement Vim’s
autochdir
feature.Something nice I had found in Vim was this feature
autochdir
, which simple justcd
's into the directory that the opened file is in. This is separated for different files, which is nice.Is this possible in Kakoune? I do have this command written up
define-command autocd -docstring %{ Command to change the directory to the location of the currently opened file. } %{ nop %sh{ if [ "$PWD" != $(dirname $kak_buffile) ]; then cd "$(dirname $kak_buffile)" || return else return fi } }
But having this run on
BufOpenFile
orWinCreate
doesn’t do anything (and neither does havingevaluate-commands
instead ofnop
). -
Rest arguments for commands
I know especially in Common Lisp, functions can have “rest” arguments which would look like
(defun some-function (arg1 &rest args) ;; body in here )
And
args
would represent some variable length list.%arg{}
in Kakoune is eithern
or it’s@
, which we all know%arg{@}
is the same as$@
in shell script.So in my command that I have, called
rlwrap
I do thisevaluate-commands %sh{ cmd="$1" shift args="$@" }
which feels hacky however it’s seems to be the simplest option because POSIX Shell doesn’t have arrays like Bash does. If this were Bash, you could do
"${@: 2}"
.Is this really the only option at the moment?
-
Return values from
eval %sh{}
Is it at all possible to pass values that were made in a
%sh{}
block and pass them back in Kakoune code?So say
%{ # some Kakoune stuff here %sh{ var=$something } # we then do something with var here }
would
return
orexport
allow for this? -
Highlighter for only numbers
I know Screwtape gave a little tutorial and there’s this regex in that:
(\+|-)?[0-9]+(\.[0-9]+)?
.But well,
-
I’m an idiot, and I had it working but now it isn’t
I can’t remember what I did to have this work, but this is what I have now
face global Numbers ${brmagenta},${bg}+b add-highlighter shared/numbers regex (\+|-)?[0-9]+(\.[0-9]+) 0:Numbers
-
This doesn’t highlight what I wish it would, and I’m awful at regex.
I would like to highlight digit, digits with decimals, percentages, and not numbers next to or surround by characters. Again, I’m terrible at remember everything about regex so I wouldn’t exactly know how to do that.
-
Thanks, everyone.