Closed useredsa closed 4 years ago
I prefer a different implementation, similar to swaymsg
output. When the output is the terminal, pretty-print, and use the shell quoting when redirected. Ideally, I would prefer JSON over shell, but we have not.
Your implementation quotes everything as a single argument, breaking multi-edits. I’m afraid handling properly the quoting will uglify all the script implementations. I will take a look how we can keep the scripts well readable.
See https://github.com/mawww/kakoune/issues/3783 for the JSON quoting feature.
Ok, I took a look. How about adding support for :edit
and :buffer
to take their input from stdin
?
In the scripts, it will look like:
find -type f | dmenu | :edit
:ls | dmenu | :buffer
It is not perfect as we take one argument per line, not allowing :edit +<line>:<column> <file>
with a filter program.
But the modification for :ls
would be appropiate, right?
Your implementation quotes everything as a single argument, breaking multi-edits.
Is it possible to select multiple entries with rofi
?
Not sure, if we use a filter program, we don’t need the quoting. The output should be the same as find
, that is one entry per line.
I prefer a different implementation, similar to
swaymsg
output. When the output is the terminal, pretty-print, and use the shell quoting when redirected. Ideally, I would prefer JSON over shell, but we have not.Your implementation quotes everything as a single argument, breaking multi-edits. I’m afraid handling properly the quoting will uglify all the script implementations. I will take a look how we can keep the scripts well readable.
See mawww/kakoune#3783 for the JSON quoting feature.
We could quote only the $(:ls ....)
and move the kak_escape
to :buffer
and :edit
I belive. Then it's a matter of passing multiple commands to :buffer
or :edit
.
Not sure, if we use a filter program, we don’t need the quoting. The output should be the same as
find
, that is one file per line.
It doesn't change the expected output, it precisely guarantees that it does that instead of printing multiple lines for the same buffer.
#!/bin/sh
# List buffers
kak_quoted_buflist=$(:get -quoting shell %val{buflist})
eval "set -- $kak_quoted_buflist"
printf '%s\n' "$@"
prints
*debug*
*scratch*
So I think this one is necessary.
Ah, you are right. We still outputs one buffer per line, but we need the -quoting shell
before passing to printf
.
Your implementation quotes everything as a single argument, breaking multi-edits.
Is it possible to select multiple entries with
rofi
?
Actually, we can consider the output of rofi
to be a single element. Otherwise, how can we differentiate between <buffer> <line> <number>
when we have a buffer with spaces? Only with quoting, but we shouldn't start to produce quotes with rofi.
That would mean that the inner quotes are necessary.
btw, how do you develop plugins now with plug.kak? I was used my plugins to always be sync, but now I need to plug-install
to sync the pool with the local repositories. There is some defer I find elegant, because you can develop without affecting your kakrc, but it is less straightforward.
btw, how do you develop plugins now with plug.kak? I was used my plugins to always be sync, but now I need to
plug-install
to sync the pool with the local repositories. There is some defer I find elegant, because you can develop without affecting your kakrc, but it is less straightforward.
I think this belongs somewhere else?
yep xd
Fixed o/
@useredsa To summarize, I replaced the :edit $(list | dmenu)
pattern with list | dmenu | :edit
.
@useredsa To summarize, I replaced the
:edit $(list | dmenu)
pattern withlist | dmenu | :edit
.
I was still having the same problem.
The problem is with kak -p
:
~ $ kak -p <session>
eval -try-client client0 echo '3 3'
makes kakoune echo 3 3
instead of 3 3
.
EDIT: That is actually only expected because of eval. The problem is we are not quoting right.
Your evaluate-commands
does not quote each argument to pass to kak -p <session>
, but the :send
command does.
I tried the fuzzy finders with a 'b' c.txt
and a "b" c.txt
and it works.
I tried the fuzzy finders with
a 'b' c.txt
anda "b" c.txt
and it works.
I'm trying rofi-buffers and it doesn't
Added :send -verbatim buffer
.
@useredsa To summarize, I replaced the
:edit $(list | dmenu)
pattern withlist | dmenu | :edit
.
I believe this is causing kak-desktop
to not work, because :edit
expects input from the standard input when it's called with kak-desktop
.
Isn't it better to take both input and arguments or maybe take arguments if there is no input instead of checking whether we are in a terminal. Or maybe even writing :edit -
when you want to process the input. We can aso create another command called :edit-stdin
.
12577666359ec38c1adcb78ced570944f7da7f9a
rofi-buffers
wouldn't work with buffers with spaces or similar. Pretty often:*man whatever*
.I have not checked the whole codebase for similar issues that require
-quoting shell
or quotes in front of a:command
.