Using FZF to Preview Text Files on the Command Line and within Vim

Поделиться
HTML-код
  • Опубликовано: 19 янв 2025

Комментарии • 32

  • @medkha8210
    @medkha8210 7 месяцев назад +2

    I suspect the preview options is build with xargs command that's why there is this '{}', it's part of xargs syntax as it reads from the standard input and in this case splits the output of fzf and execute each line with the command you specified in preview

  • @tomontheinternet
    @tomontheinternet 3 года назад +1

    Thanks Nick. It was cool hearing you on the Changelog

  • @WaylonWalker
    @WaylonWalker 3 года назад +2

    Fantastic, I've never use --bind with fzf, super helpful.

  • @Redyf
    @Redyf 8 месяцев назад +1

    exactly what I was looking for, thanks

  • @warrenhenning8064
    @warrenhenning8064 3 года назад +2

    This is what tech RUclips should be like. If only

  • @markbatty
    @markbatty 3 года назад +1

    Another great tip Nick!

  • @Linux.Learner
    @Linux.Learner 7 месяцев назад +1

    THANK YOU SIRE☺

  • @ricardokullock2535
    @ricardokullock2535 3 года назад +2

    FZF is great. I've been experimenting with telescope, with recently migrating to neovim 0.5 and a lua config.
    I still use fzf on the command line though. I use it a lot to navigate directories with alt-c
    The --bind is new to me, never thought I could page through the preview!

    • @jimshtepa5423
      @jimshtepa5423 3 года назад

      could you please advise what the best way to update to nvim .5 other than deleting the existing nvim and downloading new one?

    • @ricardokullock2535
      @ricardokullock2535 3 года назад

      @@jimshtepa5423 I use Manjaro, so I just waited until it was in the repositories. That's a good thing about a rolling release. On the other hand, a recently I had some trouble updating the updater :D

    • @jimshtepa5423
      @jimshtepa5423 3 года назад

      @@ricardokullock2535 thank you, understood

  • @rem45acp
    @rem45acp Год назад

    How can I paste text into the preview prompt in vim? For example, type the :Files command. The preview window comes up and you can enter text for the file you want to search. How do you paste text into there? Ctrl-v and pasting from buffer not working

    • @NickJanetakis
      @NickJanetakis  Год назад

      I think that'll depend on your terminal. With the Microsoft Terminal (and many others) you can do CTRL+Shift+V.

  • @nraw_
    @nraw_ Год назад

    Thanks for this vid! Is there a way to enable the preview on the ctrl + T shortcut?

    • @NickJanetakis
      @NickJanetakis  Год назад +1

      Yep, there is FZF_CTRL_T_OPTS which is available to set where you can define your custom flags such as performing a preview. For example you can run this from your terminal: export FZF_CTRL_T_OPTS="--preview='head -n 30 {}'" , and then when you hit CTRL + T it will preview the match and insert it into your prompt without executing it. If you want that to always happen you can put that env var in your bashrc or equivalent file so it's set every time you spawn a new shell.

  • @md.mohiuddin
    @md.mohiuddin Месяц назад +1

    Thanks a lot.

  • @jayachandrank2875
    @jayachandrank2875 2 месяца назад

    Vim fzf :Files working well but the file preview not showing. How to solve it.

    • @NickJanetakis
      @NickJanetakis  2 месяца назад

      Are you running Vim in a decent sized window? I know if the window is too small, the preview won't show.

    • @jayachandrank2875
      @jayachandrank2875 2 месяца назад

      @NickJanetakis in windows terminal. Preview not showing at all

    • @NickJanetakis
      @NickJanetakis  2 месяца назад

      Terminal window size still applies.

  • @saulalberto6102
    @saulalberto6102 Год назад

    Hi, great video. Is there any way in that you can edit the file, in the preview window? Without open it in a new tab. Greetings from Mexico.

    • @NickJanetakis
      @NickJanetakis  Год назад

      Hi, thanks. I haven't tried but that would be a neat feature. If you explore this idea let us know!

  • @ytbone9430
    @ytbone9430 Месяц назад

    Hello! o) Is there any tool on Linux, which can preview ANY kind of file like this? I mean pictures, config-files, videos, pdfs etc.. ? Something basic like Windows "Explorer" at least? I am using "Directory Opus" on Windows but need something similar on Linux. Honestly, setting up fzf to only preview plain text files is kind of last century to me, there is something else out there, please don't anybody say no! o)

    • @NickJanetakis
      @NickJanetakis  Месяц назад

      I don't use native Linux so I haven't checked into that. I'm sure there would be a graphical file manager that could at least show thumbnails of files that offer it like images, pdfs and videos? Just by Googling for tools similar to Directory Opus there's alternativeto.net/software/directory-opus/?platform=linux, you may want to try those out to begin with.

  • @painedpineapple
    @painedpineapple 3 года назад +1

    This is gold

  • @itsanandyadav
    @itsanandyadav 2 года назад

    How to disable preview in vim ?

    • @NickJanetakis
      @NickJanetakis  2 года назад +1

      I never checked, I would check fzf's docs, there's probably an option to disable it.

  • @julianomoraisbarbosa
    @julianomoraisbarbosa 3 года назад +1

    fzf !!!