andreyorst / fzf.kak Goto Github PK
View Code? Open in Web Editor NEWFZF for Kakoune
License: MIT License
FZF for Kakoune
License: MIT License
I sometimes run kak
from a particular directory within a git repo (e.g. if it's a big repo, and I only care about a smaller part). If I then try to use fzf-vcs
, whichever file I chose, it will fail to open since it will use the relative path from the root of the repository.
A related question is whether all files should be listed in this case or only those beneath the cwd. In my opinion, the latter would be a better (default) behavior.
I'm trying to figure out how to get this plugin to work with skim interactive mode. When I'm grepping, I essentially want this to run:
sk --interactive --cmd 'rg {}'
Any ideas on how to achieve this?
All buffers are shown in one line:
Possible solution hint:
fzf wiki page says:
# the original version no longer works since kak_buflist is no longer ":" separated.
# this one works even you have single quote or newline in file names.
define-command -docstring 'Invoke fzf to select a buffer' fzf-buffer %{
evaluate-commands %sh{
BUFFER=$(
(
eval "set -- $kak_buflist"
while [ $# -gt 0 ]; do
printf "%s\0" "$1"
shift
done
) |
fzf-tmux -d 15 --read0
)
BUFFER=${BUFFER/\'/\'\'}
if [ -n "$BUFFER" ]; then
printf "buffer '%s'" "${BUFFER}"
fi
}
}
Kakoune version: kakoune git 6c54c474
OS version: MacOS 10.14.1
sh
executable version: zsh 5.6.2 (x86_64-apple-darwin18.0.0)
fzf version: 0.17.5 (b46227d)
Can you please add fd support?
When I set set-option global fzf_file_command 'fd --type f --follow'
, I got following:
I suppose there should be info box message, instead of that line.
First of all, thanks for this plugin, it's great and works very well.
However, I noticed there is no way to grep files using FZF, only skim
. Are there any technical reasons for that? It would be awesome if grepping was available for FZF, as that's the fuzzy finder I'm used to.
Thanks!
As in the screenshots, the popup of fzf inside of Kakoune should list files, and filter them as you type.
The fzf section of Kakoune is blank. No files are listed. Likewise typing in the window does not show any additional results.
Strangely, using v
for the VCS files works great, and as expected.
Is this user error? Running fzf by itself from the CLI works as expected.. so I'm not sure what I'd be doing wrong. And largely, fzf.kak seems to be working in other modes. Buffer, Search, Edit VCS Repo all seem to work fine. The plain file listing does not.
Kakoune version: Kakoune v2018.09.04-33-gba9d97ff
OS version: MacOS 10.14
sh
executable version: GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)
fzf version: 0.17.5 (brew)
find
version:
ag
version:
fg
version:
git
version:
ctags
version:
again.
Hi! I am quite sure this is not an issue since it should be pretty simple to add the flag to ignore the files in the gitignore but I have tried many combinations with find, grep, ag and I can't seem to make it work... Essentially I was setting the commands from set-option global fzf_find_command
and set-option global fzf_grep_command
.
Thanks in advance. ๐
b
After selecting the buffer, you should be able to <c-v> or <c-s>
to re-split the pane.
This should potentially apply to not just buffers, but anything else you might want to fuzzy open in the future.
You're only able to press <ret>
and open in the current pane / replace the current buffer.
Didn't attach a detailed sys report since I don't have anything much customized, this is a fzf.kak internal.
If I select a file using the fzf finder it is not actually opened
Possibly I am missing some dependencies?
I installed using plug
.
I get no errors in the debug log of kakoune.
f
to open fileThe file should be opened in the buffer
There is a message asking me to choose between opening in a new buffer or a new window, however, after choosing still nothing happens.
Kakoune version: r7039.d1274836-1
OS version: Arch Linux 4.19.6-arch1-1-ARCH
sh
executable version: GNU bash, version 4.4.23(1)-release (x86_64-unknown-linux-gnu)
fzf version: 0.17.5
find
version: find (GNU findutils) 4.6.0
The only way I got fzf.kak
to work in iTerm (macOS) was using it inside a tmux session. It would be awesome to have native support for iTerm. Unfortunately, I have no idea where to start.
Currently, when I type :fzf-mode<ret>f
I get the following error message: termcd option is not set
. It appears that this functionality is only implemented for x11 and tmux.
Maybe we can use iTerms osascript
support similar to this PR?
In the mean time, is there a way to run fzf only with a single line in the status bar of Kakoune, without opening a new buffer?
Thank you very much!
This issue will track features, announce updates, changelogs, etc.
Subscribe if you interested.
Hello! I know that you are recommending the use of plug.kak to install this plugin, but I don't have a use for a plugin manager right now, as having plugins as Git submodules in my autoload directory has been enough for now. I just wanted to report a problem that happens when using this native loading mechanism: since kakoune does find . -L -type f -name '*.kak'
(source) to find plugin files, it will first find the modules files and then the main file of the FZF plugin:
> find -L . -type f -name '*.kak'
./rc/fzf-modules/fzf-cd.kak
./rc/fzf-modules/sk-grep.kak
./rc/fzf-modules/fzf-search.kak
./rc/fzf-modules/fzf-vcs.kak
./rc/fzf-modules/fzf-ctags.kak
./rc/fzf-modules/fzf-file.kak
./rc/fzf-modules/fzf-buffer.kak
./rc/fzf-modules/VCS/fzf-svn.kak
./rc/fzf-modules/VCS/fzf-hg.kak
./rc/fzf-modules/VCS/fzf-bzr.kak
./rc/fzf-modules/VCS/fzf-git.kak
./rc/fzf.kak
This then means that these files will be sourced in the wrong order, leading to these errors:
/home/dryvenn/.config/kak/autoload/fzf/rc/fzf-modules/fzf-cd.kak:32:1331: 'map' no such keymap mode: 'fzf'
Autoload: could not load /home/dryvenn/.config/kak/autoload/fzf/rc/fzf-modules/fzf-cd.kak
/home/dryvenn/.config/kak/autoload/fzf/rc/fzf-modules/fzf-search.kak:11:733: 'map' no such keymap mode: 'fzf'
Autoload: could not load /home/dryvenn/.config/kak/autoload/fzf/rc/fzf-modules/fzf-search.kak
/home/dryvenn/.config/kak/autoload/fzf/rc/fzf-modules/fzf-vcs.kak:14:893: 'map' no such keymap mode: 'fzf'
Autoload: could not load /home/dryvenn/.config/kak/autoload/fzf/rc/fzf-modules/fzf-vcs.kak
/home/dryvenn/.config/kak/autoload/fzf/rc/fzf-modules/fzf-ctags.kak:14:899: 'map' no such keymap mode: 'fzf'
Autoload: could not load /home/dryvenn/.config/kak/autoload/fzf/rc/fzf-modules/fzf-ctags.kak
/home/dryvenn/.config/kak/autoload/fzf/rc/fzf-modules/fzf-file.kak:27:1210: 'map' no such keymap mode: 'fzf'
Autoload: could not load /home/dryvenn/.config/kak/autoload/fzf/rc/fzf-modules/fzf-file.kak
/home/dryvenn/.config/kak/autoload/fzf/rc/fzf-modules/fzf-buffer.kak:11:733: 'map' no such keymap mode: 'fzf'
Autoload: could not load /home/dryvenn/.config/kak/autoload/fzf/rc/fzf-modules/fzf-buffer.kak
I don't know what's the best course of action here, the easy solution would probably be renaming the main file.
I made a dirty hack in my own config: symlinking the main file up into my autoload directory so it's sourced first (but then it gets sourced twice...).
Kakoune v2019.01.20
Ubuntu 18.10
When doing file search, preview just doesn't work:
fish: Illegal command name โ(highlight --failsafe -O ansi 'Cargo.lock' || cat 'Cargo.lock')
highlight --failsafe -O ansi 'Cargo.lock' || cat 'Cargo.lock') 2>/dev/null | head -n 100
I'm at
commit 1bcee973ab0285649df52fe200cd84575c4d20aa (grafted, HEAD -> master, origin/master, origin/HEAD)
Author: Andrey Orst <[email protected]>
Date: Fri Nov 16 18:37:34 2018 +0300
Revert "search for tag file in every previous directory until reach home"
This reverts commit 850139e30e11dcad807c1d8de47a8803851c6224.
and Kakoune v2018.10.27.
fzf opens and closes immediately
consulting the thread of #15 did not help debugging the undesired behaviour
@andreyorst How can I debug the failing call of fzf from kak?
kak somefile.txt
ctrl+p
f
fzf window should open and not close immediately
fzf window opens and closes immediately without showing error message
Kakoune version: v2020.09.01
iTerm2 version: 3.3.12
OS version: macOS 10.13.6
sh
executable version: fish, version 3.1.2 (issue persists with bash & zsh)
fzf version: 0.24.3 (brew)
~/.config/kak/kakrc
source "%val{config}/plugins/plug.kak/rc/plug.kak"
plug "andreyorst/plug.kak" noload config %{}
plug "andreyorst/fzf.kak"
map global normal <c-p> ': fzf-mode<ret>'
I've noticed that grep with skim, overrides my "
register. Is it possible to preserve it?
I've tried -save-regs dquote
like below, but it didn't help.
evaluate-commands -save-regs dquote -buffer *grep* %{
set-register dquote %arg{1}
execute-keys gjPo
}
When running a single kakoune session with two connected clients that are in different tmux sessions, the fzf split can open in the wrong client.
#!/bin/sh
tmux='tmux -L tempsocket'
$tmux new-session -s a -d
$tmux new-session -s b -d
$tmux send-keys -t a 'kak -s kak-session' Enter
$tmux send-keys -t b 'kak -c kak-session' Enter
$tmux send-keys -t b ':fzf-mode' Enter 'b'
$tmux attach -t b
# $tmux kill-server
The fzf split should be done in the client in tmux session b
.
The fzf split shows up in the first client in tmux session a
.
Changing this possibly requires some support from kakoune because currently both clients execute commands as if they were in the same tmux session. It's not a huge issue though.
Kakoune version: 2019.07.01-1
OS: Arch linux
sh
version: GNU bash, version 5.0.11(1)-release (x86_64-pc-linux-gnu)
sk
version 0.6.9
Having space in filename will cause wrong file open with fzf-file, and wrong buffers.
Hi,
if [ -n "${kak_client_env_TMUX}" ]; then
preview_position="pos=right:${kak_opt_fzf_preview_width};"
# tmux height should be changed when preview is on
tmux_height="${kak_opt_fzf_preview_tmux_height}"
else
# this code chooses preview position depending on window width at runtime
preview_position="sleep 0.1; [ \$(tput cols) -gt \$(expr \$(tput lines) \* 2) ] && pos=right:${kak_opt_fzf_preview_width} || pos=top:${kak_opt_fzf_preview_height};"
fi
https://github.com/andreyorst/fzf.kak/blob/master/rc/fzf.kak#L146
this won't let me put the preview on pos=top
since I'm on tmux.
hi
tried making a module to work with https://github.com/alexherbo2/yank-ring.kak .
Here is what I got done
try %{ declare-user-mode fzf }
map global fzf -docstring "open yank-ring" 'y' '<esc>: fzf-yank-ring<ret>'
define-command -hidden fzf-yank-ring %{ evaluate-commands %sh{
yanks=$(mktemp ${TMPDIR:-/tmp}/kak-fzf-yanks.XXXXXX)
eval "set -- $kak_opt_yank_ring_history"
while [ $# -gt 0 ]; do
printf "%s\0" "$1" >> $yanks
shift
done
message="Set buffer to edit in current client.
<ret>: switch to selected buffer.
<c-w>: open buffer in new window"
[ ! -z "${kak_client_env_TMUX}" ] && tmux_keybindings="
<c-s>: open buffer in horizontal split
<c-v>: open buffer in vertical split"
printf "%s\n" "info -title 'fzf yanks' '$message$tmux_keybindings'"
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
printf "%s\n" "fzf -fzf-args %{--read0} -kak-cmd %{set-register dquote} -items-cmd %{(cat $yanks ; rm $yanks)}"
}}
It's incomplete. It bugs out on newlines and I want my yanks to keep their lines, obviously. It looks alright in fzf; everything is on 1 line all well, supposedly the newlines are still in there too, but selecting a yank only takes the part after the last newline. I think it's the set-register dquote
part.
Thoughts? How do I wrap the string that gets out of fzf?
I'm new to kakoune, and I tried installing your plugin like so:
plug "andreyorst/fzf.kak" config %{
set-option global fzf_preview_tmux_height '25%'
}
But the preview window still takes up 70% of the height of the window, and :echo %opt{fzf_preview_tmux_height}
outputs 70%.
Any ideas?
Hello, I don't understand this thing in Configuration section of readme: so in order to change variable values use defer "fzf %{ ... }". defer
is not bash command, not kakoune command, not in the source of plug.kak, what is it?
PS there's also a typo "requier-module fzf" -> "require-module fzf"
How to grep file contents and get the file, line and column in results. And also the preview.
Hi,
I really like your plugin especially the option to save and load projects. However, I am using alexherbo2/connect-fzf
module as it displays way faster the fzf-files results as compared to your plugin. For some reason, your plugin takes some time to display the file results.
Since you seem to have stopped the active maintenance of this plugin for now, I would like to use the projects feature of your plugin and the connect-fzf plugin for regular file search. However, if I install both (using your plug.kak
plugin manager), it creates conflicts and your plugin pretty much stops working.
I tried messing around with your plugin to get both working without luck. I would appreciate it if you can shed some light on how I can keep your plugin projects feature while still using connect-fzf.
Thanks in advance!
None of the shortcuts work with tmux, I mean no new pane opens.
Despite the fact that I post updates of fzf.kak at r/kakoune and at Kakoune Discourse Board I want to have a single place where Ideas and suggestions can go, so I could have easy track of them. Ihis issue isn't for feature requests, but for discussion of ideas, and overall suggestions to the plugin. If you know what you want and can describe it well please open feature request.
:edit
to add files to some history file.When finally digging in the source I was astonished at first sight that fzf.kak
was 1640 lines!
I thought "what? how could this plugin be so big?".
It turns out that about 1200 of this lines are dedicated to support ctags functionalities. For many esoteric languages rarely seen in the modern wild. I understand your desire to offer a complete experience but I also feel that it's way too much and a bit out of the core scope of this plugin.
Moreover ctags possibilities are quite redundant (and somehow not as powerful) to the ones found in LSP.
So I would suggest to split the fzf-tag part in a companion file.
This way with plug.kak
with the noload
switch, everyone is in control and can source the part they need:
plug "andreyorst/fzf.kak" "noload" %{
source "%val{config}/plugins/fzf.kak/rc/fzf.kak"
source "%val{config}/plugins/fzf.kak/rc/fzf-tag.kak" # optional
}
There is only ..
in fzf panel without directories listing.
I suspect there are some differences between mac's find and gnu find.
Also I'd like to set custom command (blsd for example) for fzf-cd
to avoid such issues.
Currently if you use skim as your fzf_implementation
, you are presented with nice, highlighted previews during a file search (f
in fzf-mode). However, the g
command that provides an interactive grep-with-skim option does not have this nice preview/highlighting and instead shows a single-line excerpt next to each result as you search.
We can improve upon this drastically and not only provide the preview window in the grep option, but also center the preview on the matching line, highlighted. In fact, I had achieved this functionality on startup of kakoune before I discovered your plugin. Here's what it looks like:
Here's the shell code I used:
rkak() {
kak $( \
sk --ansi -i -c 'rg --hidden --line-number --color=always "{}"' --delimiter ':' --preview 'bat --style=numbers,changes --highlight-line {1} --line-range $(preview_start {1}): --color always {0}' | \
sd '([^:]+):(\d+).*' '$1 +$2' \
)
}
What's happening here is that sk --preview
can pass parameters describing the file to be previewed as well as the line number of the match. {1}
in this context gives us the matching line, so I pass this to bat
's --highlight-line
, then tell bat to show only lines centered on that line using a helper script. You can ignore the sd
part as that is what was formatting the filename and line number so that kakoune could open it at the matched line, which you've already figured out in your implementation.
Here's the contents of the preview_start command:
#!/bin/bash
line_to_center=`echo -n $1 | sd "'" ''`
half_height=$((`tput lines` / 2))
if (( $line_to_center > $half_height )); then
echo -n $(( $line_to_center - $half_height ))
else
echo -n 0
fi
Basically this is using tput lines
to find the height of the window (which fzf.kak should already have knowledge of so no need to use), then integer divides by 2, subtracts that from the highlighted line number that was passed in, and returns that number. When passed to --line-range
in bat
, we don't need to specify the ending line number, so it gets passed as --line-range <start_line>:
.
I don't have a very good grasp of how to write plugins for kak, nor do I have much familiarity with the workings of this plugin in particular. Perhaps with the description above you have enough to add the functionality? If not, I can try and dig in and add it to the module, but itll probably take a while.
Running any file related command from fzf mode results in new terminal window blinking for a split of a second. It closes immediately after that. Info box stays open. I did bisect on changes since v0.1.2 and first bad commit is 8ae03b1
Buffer selector, change directory and buffer search works fine.
Kakoune version: v2018.09.04
OS version: Void 4.18.13_1 x86_64 GenuineIntel uptodate rFFFFFFFF
sh
executable version: dash-0.5.10.2
fzf version: 0.17.5
Edit:
It seems that fzf_preview
was true by default, disabling it fixes the problem.
Okay, I don't have any compatible highlighter installed so it fails because fzf_preview
is true by default.
I'd like to have a convenient way to automatically add projects.
For that I think we should expose a command like fzf-save-path-as-project
but without the prompt.
So I can use, say :fzf-project-add /path/to/project project-name
to add the current project on startup, or when changing directories.
I propose that when only one parameter is given, the name should default to the basename.
Right now I'm using this:
eval %sh{
project_root="$(git rev-parse --show-toplevel)"
if [ -n "$project_root" ]; then
line="$(basename "$project_root"): $project_root"
grep -qFx "$line" "$kak_opt_fzf_projects_file" || {
echo "$line" >> "$kak_opt_fzf_projects_file"
}
fi
}
with a new command this can be simplified
eval %sh{
project_root="$(git rev-parse --show-toplevel)"
if [ -n "$project_root" ]; then
printf %s\\n "fzf-project-add $project_root"
fi
}
How about a delete buffer hotkey into the buffer menu?
minimal_kakrc
source "%val{config}/plugins/plug.kak/rc/plug.kak"
plug "andreyorst/fzf.kak" tag "v1.0.1"
# foo %{
kak -n minimal_kakrc -e 'source minimal_kakrc; fzf-mode; execute-keys g'
The cursor should jump to and select line 3.
It doesn't, and there's an error message in the debug buffer:
error running command 'evaluate-commands -client client0 %{fzf-sk-grep-handler %{minimal_kakrc:3:# foo %{}}
evaluate-commands -client client0 %{buffer %opt{fzf_sk_first_file}}
': parse error: 0:36: unterminated string '%{...}'
Kakoune version: Kakoune v2019.01.20
fzf.kak
v1.0.1 (I believe master has the same issue)
It looks like fzf was refactored into a bunch of modules, and not all the options I had previously set are mentioned in the README. Below was a best-guess attempt at updating my fzf.kak config to the latest version in a way that I think defer
s the right modules.
plug "andreyorst/fzf.kak" config %{
map global normal <c-p> ': fzf-mode<ret>'
} defer "fzf-file" %{
set-option global fzf_file_command 'fdfind --hidden --type f --exclude .git'
set-option global fzf_highlight_command 'bat'
} defer "fzf-cd" %{
set-option global fzf_cd_command 'fdfind --follow --hidden --type d --exclude .git'
} defer "fzf-grep" %{
set-option global fzf_grep_command 'rg'
}
The fzf prompt is always empty when doing a search, as though the fzf_use_main_selection were false. This is the case when testing with kitty, tmux, or st in an x11 window manager (dwm).
It should also be noted that :echo %opt{fzf_use_main_selection}
prints true
.
kak
Following the above steps, the main selection should populate as the search term in step 4.
See step 4 in "Steps to reproduce section".
Kakoune version: Kakoune v2020.09.01-404-g212242cc
OS version: Ubuntu 20.04
sh
executable version: zsh 5.8 (x86_64-ubuntu-linux-gnu)
fzf version: 0.20.0
At some point it will be useful to support the released version of kakoune, I think most other plugins do that by default.
Right now, b924eaa seems to work with stable. Maybe we can have a branch for that, it should be easy to check out the branch when installing with plug.
printf
instead of echo
Everything happens in v1.0.0
branch. Suggestions/Ideas are welcome.
Changelog:
fzf-vcs-mode
shortcut was changed form V to Alt+v, in the same way how shortcuts work in Kakoune - v tries to be smart, and Alt+v allows explicitly choosing VCS.fzf-buffer
command now not have the ability to delete buffers. I've found this really less used myself, and supporting it involved having basically copy of whole main fzf command, so I've decided to disable it until I find another way of making custom commands for fzf shortcuts.fzf-tag
- lost the ability to apply ctags kind filters on the go. Again, this was hardcoded in the main fzf command making it harder to integrate with other modules, and usually not needed, since most of the time I open fzf-tag
and narrow through list. However I kept the filtering function in the same fashion how fzf-vcs
is done.fzf-cd
yet again this command stored a copy of a fzf
command, therefore was revamped to use generic fzf
command provided by script. This involves adding extra commands
parameter to fzf
fzf
now has 4 parameters instead of 3. New parameter is a workaround of providing compaund commands, like fzf-search
and fzf-cd
. In case of fzf-search
we actually executing keys gx
to jump to search result, and in fzf-cd
we call to fzf-cd
again. This parameter may be removed if I find a better way of combining commands.printf
replaced all echo
callsHi! I am quite sure this is not an issue since it should be pretty simple to add the flag to ignore the files in the gitignore but I have tried many combinations with find, grep, ag and I can't seem to make it work... Essentially I was setting the commands from set-option global fzf_find_command
and set-option global fzf_grep_command
.
Thanks in advance. ๐
I usually use fzf-vcs
to open files from a git repository. In that case I get the full paths to the files. I find this not ideal: a common prefix carries zero information but fzf
will try to match against that as well, making some suggestions less relevant.
There are two ways in which this could be improved, I think::
I have a slight preference for 2, since for large repositories that allows one to focus only on a section of it (which again, reduces the number of suggestions, etc), but otherwise both would be fine for me.
Spring is all on it's way, birds sing, blossoms grow, code is being rewritten.
Some critical moments need to be visited:
terminal
command that should be used instead of termcmd
option. This will fix #40. Althought this may require to fully rewrite fzf.kak, I was planning to do it anyway.fzf
command is ugly af. Argument handling is painful and other things are way too complicated, which results in really awkward methods of writing supplement scripts. I suppose a full featured argument parsing algorithm will clean this mess up.Opening a new file from the vcs chooser mode makes both the original window from which the fzf chooser was entered from, and the new window it creates show the new buffer. Instead the original window should continue to display whatever buffer it did before opening the chooser.
1.Have a buffer open in a window.
2.Use fzf vcs file chooser to select a not yet open file.
3.Both windows will now show the new buffer.
I would expect only the new window to show the new buffer.
Both the original and the new window display the new buffer
Kakoune version:
OS version: Ubuntu 16.04
sh
executable version: zsh 5.7.1
fzf version: 0.18.0
git
version: 2.23
Since fzf is good at fuzzy finding it would be nice to have search and jump to line
command that would serach current buffer using fzf.
I toyed with this idea a little, here is a prototype. It returns line number that can be used with select command. WDYT?
nl -b a -n ln some-file | fzf --reverse | cut -f '1'
I've used ctrl-w to delete the previous word for so long that it's hard-coded into me... It's quite bothersome to open a new window by accident every time.
Hi, thanks for all the work on this!
Since commit 9b07bdd, the fzf window pops up and vanishes instantly. The temporary fzfcmd
script requires some posix features that fish doesn't implement. Tmux tries to execute it in the default shell, which fails with fish.
The patch below fixes this by explicitly calling sh. It will also not spawn fish at all in my example, because tmux doesn't call the shell if the command consists of multiple words.
set -g default-shell "/usr/bin/fish"
in ~/.tmux.conf
fzf.kak
:fzf<ret>
Kakoune v2019.01.20
fzf 0.17.5
tmux 2.8
fish 3.0.2
diff --git a/rc/fzf.kak b/rc/fzf.kak
index 4076143..f78c4ff 100644
--- a/rc/fzf.kak
+++ b/rc/fzf.kak
@@ -176,7 +176,7 @@ fzf -params .. %{ evaluate-commands %sh{
# if height contains `%' then `-p' will be used
[ -n "${tmux_height%%*%}" ] && measure="-l" || measure="-p"
# `terminal' doesn't support any kind of width and height parameters, so tmux panes are created by tmux itself
- cmd="nop %sh{ command tmux split-window ${measure} ${tmux_height%%%*} '${fzfcmd}' }"
+ cmd="nop %sh{ command tmux split-window ${measure} ${tmux_height%%%*} sh '${fzfcmd}' }"
else
cmd="terminal %{${fzfcmd}}"
fi
Skim looks like fully compatible to fzf while providing nice additional features. It can be used as additional fuzzy finder for commands like grep, or a drop in replacement for fzf.
Hi Andrey. Thanks for making this great plugin.
I've been using the following shell script for a while:
#!/bin/sh
# sleep needed to get real dimensions
sleep 0.1
COLUMNS=$(tput cols)
LINES=$(tput lines)
# multiply by 2 to roughly approximate the size of a cell
LINES=$(expr $LINES \* 2)
[ $COLUMNS -gt $LINES ] && pos=right:50% || pos=top:60%
export FZF_DEFAULT_COMMAND='rg --files'
fzf \
--select-1 \
--multi \
--preview="~/bin/preview.rb {} | head -n 100" \
--preview-window=$pos \
--bind 'ctrl-t:toggle-preview' \
--bind 'ctrl-x:execute($EDITOR {})' \
| xargs $EDITOR
Here's a screenshot to explain what it does:
They are 2 terminals: one with kakoune on the left and one with fzf on the right.
What I enjoy about this setup is that I can navigate the fzf list on the bottom right and having the preview of the file on the top right.
Meanwhile, if the terminals are splitted the other way around, with kakoune in the top terminal and fzf in the bottom one, the preview goes on the right side of the fzf terminal:
Would it be possible to integrate the fzf preview in your plugin as well? Thanks!
It'd be nice if fzf.kak could open windows using the command terminal-tab
instead of terminal
.
A solution for this could be allowing the user to enter what command to use to open the new window. This new feature could replace the existing conditional code for tmux/x11 separation, and depend entirely on user configuration.
fzf_window_cmd
: "terminal-tab ..." or "tmux-terminal-window ..."fzf_split_cmd
: "terminal-tab ..." or "terminal ..." or "command tmux split window ..."A list of projects that user can save and open later.
This requires a command to remember current working path as a project, and a mapping that loads list of projects. Projects should be stored in a file somewhere like ~/.cache/fzf-projects/projects
. After project is opened, file chooser should be launched automatically.
Inspired by Emacs package projectile
Not sure if thats issue of the plugin or my configuration, since module system made everything a bit more complicated.
This is all the line relevant to fzf in my kakrc:
hook global ModuleLoaded fzf %{
set global fzf_implementation sk
set global fzf_file_command fd
set global fzf_highlight_cmd bat
set global fzf_sk_grep_command 'rg -LHn'
}
On the first invokation of :fzf-mode
kakoune writes this error to *debug*
:
error running hook ModuleLoaded(fzf)/: 4:78: 'set' option not found: 'fzf_highlight_cmd'. Use declare-option first
... but opens the usermode menu anyway.
Consecutive invocations of fzf-mode
work normally.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.