nvim-fzf-commands
nvim-fzf-commands copied to clipboard
require("fzf-commands").files() ... stops on ... --line-range=:$(($FZF_PREVIEW_LINES
I'm on windows 11.
got a keymap
vim.keymap.set('n','<leader>xx',function () require("fzf-commands").files() end)
when I run it the floating window pops up and leaves in a blink.
the message at the topline reads ...
unknown option--line-range=:$(($FZF_PREVIEW_LINES
Bash and bat are on the system ...
Any ideas ?
thx
It doesn't look like your bash is interpreting the inline math operators... Not sure why. Is this bash emulation or the real bash itself?
on Pwsh ...
⮞ bash --version GNU bash, version 5.1.16(1)-release (x86_64-pc-msys) Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
Interesting...
What does this output?
A=45
echo $(($A + 3))
On bash... 48
Just pushed a commit, it's possible that the preview command wasn't being run by bash. Perhaps it isn't the default shell. Could you try it now?
on windows and nvim nightly only plugins ...
use 'junegunn/fzf' use 'vijaymarupudi/nvim-fzf' use 'vijaymarupudi/nvim-fzf-commands'
and only this command ...
vim.keymap.set('n', '<leader>f', '<cmd>lua require("fzf-commands").files()<cr>',{desc= "files"})
preview pops up in a blink and says
unknown option : -c
That's pretty odd, it looks like bash
, when run using fzf
, is not bash. Could you try running this snippet?
local fzf = require('fzf')
coroutine.wrap(function() print(fzf.fzf({"1", "2", "3"}, "--preview 'bash -c \"echo testing\"'")) end)()
the ZFZ_window pops up, I can read ...
unknow option -c
and there is output
nil 2
don't know if this helps... I have also tried this. Maybe it helps to shed some light. I have set up these...
vim.env.BAT_STYLE="numbers,changes"
vim.env.FZF_DEFAULT_OPTS=[[--no-mouse --layout=default --preview-window=hidden:border-left --margin=0 --padding=1 --pointer=⏵ --marker=+ --info=inline --tabstop=4 --no-bold --bind=f2:toggle-preview,f3:toggle-preview-wrap,shift-down:preview-down,shift-up:preview-up,ctrl-d:half-page-down,ctrl-u:half-page-up,ctrl-f:page-down,ctrl-b:page-up,ctrl-a:toggle-all,ctrl-l:clear-query,ctrl-s:toggle-sort]]
vim.env.FZF_DEFAULT_COMMAND=[[rg --files --no-ignore --hidden --follow --glob "!.git/*" --color=auto]]
vim.env.FZF_PREVIEW_COMMAND=[[bat --decorations=always --paging=never --italic-text=never --color=always --theme=ansi --wrap=never {}]]
and when I call ...
FZF --preview
I get the window and all works but when I toggle the preview to see it, I get ...
'--expect' is not recognized as an internal or ex
The plot thickens...
I think this is conflating fzf's default vim support with nvim-fzf
. The command you're running is for the plugin from fzf.
Yes, I know. It was just some extra information. The original command still gives the same problem. unknown option -c
Got it.
I think this should help diagnose the problem. Can you post what is being displayed in the preview window?
local fzf = require('fzf')
coroutine.wrap(function() print(fzf.fzf({"1", "2", "3"}, "--preview 'bash --version'")) end)()
I have the same problem loading the lua snippet above gives: unknown option --version
It's not clear to me why the subshell that fzf spawns to execute the preview command does not execute bash
. Since I do not have a Windows computer, I'm not quite sure what's happening here. Step 1 would be to figure out what the environment in that subshell, and what shell that is.
By the way is there a reason to use Bash at all? The preview in Telescope and bqf seems to be neovim native. The bqf code in particular looks simple enough.
bash
is needed as fzf
launches a shell for the preview, and nvim-fzf
is about using fzf
for its speed. The shell part is to calculate the number of lines for bat
to show, so that there won't be a scrollbar and so that bat
won't read the entire file, which can take a very long time if the file is large.
On Sat, Jan 7, 2023, 09:21 Vijay Marupudi @.***> wrote:
fzf launches a shell for the preview,
But this is for compatibility with vim. In neovim there are native methods to get preview. I don't know exactly how, but telescope and bqf launch native preview. This has advantage of TS based highlighting, speed etc.
— Reply to this email directly, view it on GitHub https://github.com/vijaymarupudi/nvim-fzf-commands/issues/6#issuecomment-1374514075, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQGIZQVBHJUWDYGG4G3N7TWRGCXRANCNFSM6AAAAAASD2BHG4 . You are receiving this because you commented.Message ID: @.***>
That's not for compatibility with vim
, that's just what fzf
does with the --preview
argument. You can use nvim
for previewing items with nvim-fzf
, but that involves running a new neovim instance that communicates with the main instance using the shell command and a named pipe. Either way, there's not getting away from shell commands.
In the case of this, we're using an external command, bat
. Shell commands are the way to get fzf to preview using an external command.
that makes sense.
On Mon, Jan 9, 2023, 09:58 Vijay Marupudi @.***> wrote:
That's not for compatibility with vim, that's just what fzf does with the --preview argument. You can use nvim for previewing items with nvim-fzf, but that involves running a new neovim instance that communicates with the main instance using the shell command and a named pipe. Either way, there's not getting away from shell commands.
In the case of this, we're using an external command, bat. Shell commands are the way to get fzf to preview using an external command.
— Reply to this email directly, view it on GitHub https://github.com/vijaymarupudi/nvim-fzf-commands/issues/6#issuecomment-1375851431, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQGIZT5R2RZXM5E3MJKJDDWRQYRFANCNFSM6AAAAAASD2BHG4 . You are receiving this because you commented.Message ID: @.***>