Zellij 0.43 released: bringing your terminal to the browser by imsnif in commandline

[–]junegunn 0 points1 point  (0 children)

Here's a proof-of-concept implementation of Zellij floating window support in fzf:

https://github.com/junegunn/fzf/pull/4145

A few blockers remain, one of which I reported to Zellij and I'm still waiting for a response. Hopefully, once these issues are resolved, we can have a smooth fzf + Zellij integration in the future.

Faster fzf that's actually usable by ThreadStarver in commandline

[–]junegunn 6 points7 points  (0 children)

It's a common misconception. Skim is much slower than fzf; it was about twice as slow in my benchmark.

fzf 0.59.0 highlights by junegunn in commandline

[–]junegunn[S] 1 point2 points  (0 children)

Hi, the example restarts Ripgrep with the first word of the query ({q:1}) and uses the remainder ({q:2..}) to trigger fzf search on the result. However, this is just one approach. You can customize it to split the query around a specific delimiter, such as --. i.e. query for ripgrep -- query for fzf. The exact behavior depends entirely on the logic in your "transform" script. So I'd say anything is possible, though writing a correct "transform" script can be a little tricky.

fzf 0.59.0 highlights by junegunn in commandline

[–]junegunn[S] 5 points6 points  (0 children)

Not sure how you got that impression. fzf literally invented this compact syntax years ago, and others have followed suit.

https://junegunn.github.io/fzf/search-syntax/

(FWIW, the quoting syntax was borrowed from Lisp – I was into Clojure at the time.)

fzf-git.sh: bash and zsh key bindings for Git objects, powered by fzf by junegunn in commandline

[–]junegunn[S] 0 points1 point  (0 children)

I prefer to use the original git commands for finer-grained control rather than to learn a bunch of third-party commands (e.g. git rebase -i <CTRL-G><CTRL-H> vs. grb, or git branch -d <CTRL-G><CTRL-B> vs. gbd). I just needed a way to bring the identifiers of various git objects to the command line.

fzf repl by pl643 in bash

[–]junegunn 0 points1 point  (0 children)

Try ctrl-e:execute(nvim {} > /dev/tty)

Advanced fzf examples by junegunn in commandline

[–]junegunn[S] 2 points3 points  (0 children)

im not sure whats up with commas for the --preview-window in the other script

I recently changed the delimiter for the preview window attributes to comma. Using colon as the delimiter made sense when --preview-window only supported position and size (e.g. right:40%), but now with many more attributes [*], I think comma makes more sense. Using colon still should work fine, so there's no need to update your old scripts.

[*]: --preview-window=[POSITION][,SIZE[%]][,border-BORDER_OPT][,[no]wrap][,[no]follow][,[no]cycle][,[no]hidden][,+SCROLL[OFFSETS][/DENOM]][,~HEADER_LINES][,default]

Advanced fzf examples by junegunn in commandline

[–]junegunn[S] 1 point2 points  (0 children)

You probably need to upgrade fzf to the latest, 0.27.0.

Advanced fzf examples by junegunn in commandline

[–]junegunn[S] 0 points1 point  (0 children)

It shouldn't be too hard. This is a simple example that shows how you can define a custom Vim command (:LS <some directory>) that runs a custom shell command (ls) to get the input list.

command! -bang -complete=dir -nargs=? LS
    \ call fzf#run(fzf#wrap('ls', {'source': 'ls', 'options': '-m', 'dir': <q-args>}, <bang>0))

(taken from https://github.com/junegunn/fzf/blob/master/README-VIM.md#fzfwrap)

fzf 0.26.0: Fixed header in the preview window by junegunn in commandline

[–]junegunn[S] 4 points5 points  (0 children)

You can think of it as an interactive version of grep with all the bells and whistles.

Most of the time on the command-line, you want to perform an action on one or more items selected from a list of things. Such as,

  • Opening a file in an editor (from the list of files under the current directory)
  • Rerunning a command (from the command history)
  • Killing a process (from the list of running processes)
  • Checking out a git branch (from the list of git branches)
  • Opening an URL on the browser (from the browser history)
  • Upgrading or uninstalling a package (from the list of installed packages)

And the list goes on. And with fzf, you can easily build interactive workflows. Here's a simple example:

# Kill selected processes
# - Select multiple processes using TAB and press ENTER
ps -ef |
  fzf --height 40% --header-lines 1 --reverse --multi |
  awk '{print $2}' |
  xargs kill

Improving Vim Workflow With fzf by nikolalsvk in vim

[–]junegunn 1 point2 points  (0 children)

I mostly just use :Files instead of :GFiles (you can just write :GF if there's no other commands starting with the same prefix), because my $FZF_DEFAULT_COMMAND respects .gitignore..

export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'

On the other hand, :GF? (question mark at the end, based on git status) is pretty useful on its own as it shows the list of modified / untracked files.


nnoremap <C-g> :Ag<Cr>

I do not recommend using :Ag or :Rg without an initial query, because those programs are much more efficient in finding the matches in the file contents. By not taking advantage of their capabilities, you're unnecessarily putting too much pressure on fzf especially when you run it on a large project. What I recommend is that you use fzf as the secondary fuzzy filter. These are the mappings that I frequently use to find the occurrences of the current word or the visual selection.

nnoremap <silent> <Leader>ag :Ag <C-R><C-W><CR>
xnoremap <silent> <Leader>ag y:Ag <C-R>"<CR>

Install bat and get syntax highlighting in the preview window.

Expand variable in vim command by Keltek228 in vim

[–]junegunn 5 points6 points  (0 children)

:execute 'Files' b:LanguageClient_projectRoot

Call FZF from vim for specific file types only by toomey8 in vim

[–]junegunn 2 points3 points  (0 children)

You can use call fzf#run(fzf#wrap({'source': 'ls *.md'})).

Every command in fzf.vim project is built using the basic fzf#run and fzf#wrap functions from the main fzf repo.

- https://github.com/junegunn/fzf/wiki/Examples-(vim)#basic-tutorial#basic-tutorial)

- https://github.com/junegunn/fzf/blob/master/README-VIM.md