https://github.com/BurntSushi/ripgrep#quick-examples-comparing-tools
Ripgrep is faster in many cases. And it can also be used outside of Git.
What I personally like is that ripgrep automatically searches recursively. And it combines well with fzf.
I also add this to my ~/.bashrc
:
# Don't put duplicate lines in the history. See bash(1) for more options. # ignoredups - causes lines matching the previous history entry to not be # saved # ignorespace - lines which begin with a space character are not saved in the # history list # ignoreboth - shorthand for ignorespace and ignoredups # erasedups - causes all previous lines matching the current line to be # removed from the history list before that line is saved export HISTCONTROL=ignoreboth:erasedups
# append to the history file, don't overwrite it shopt -s histappend
These settings keep the history clean, let you add to it from multiple terminals at once, and they help when searching history with Ctrl-r
or fzf.
I use fzf plugin to open files really fast:
call plug#begin(stdpath('data') . '/plugged')
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
call plug#end()
map <leader>b <cmd>Buffers<CR>
map <leader>f <cmd>GFiles<CR>
map <leader>F <cmd>Files<CR>
map <leader>l <cmd>Files %:h<CR>
As the maintainer of fzf, I find this feature very intriguing. fzf is an ncurses program that takes up the whole screen, so I'm using some hacks involving tmux splits or external terminal emulators when launching fzf from inside vim or gvim. With this, I might be able to integrate fzf into native vim splits and it would be great, especially so for gvim.
You might try the plugins fzf or ctrl-p.
From the fzf github:
grep --line-buffered --color=never -r "" * | fzf
ag --nobreak --nonumbers --noheading . | fzf
So yeah, give those a try. I don't know about ctrl-p from experience, but I seem to remember seeing some people do something similar.
I think NERDTree is a bit over used/overrated, I would suggest vim-vinegar instead, and maybe FZF with FZF.vim.
Most of the time I just need logs or have to exec into a container. Therefore I enhanced my zshrc file and since Im already an fzf user it wasnt much I had to add. You can find my stuff here: https://gist.github.com/zepptron/9635568b9d90d858daca7780feb8c4b7
It seems that your comment contains 1 or more links that are hard to tap for mobile users. I will extend those so they're easier for our sausage fingers to click!
Here is link number 1 - Previous text "fzf"
^Please ^PM ^/u/eganwall ^with ^issues ^or ^feedback! ^| ^Delete
Switch from grep
to <code>rg</code>
Switch from find
to <code>fd</code>
use <code>fzf</code> for everything
Since many of you guys are facing issues with ctrlp (I didn't; but I also did not use its advanced features) you can try fzf
Works well and also for your shell.
Yes, and fzf works beautifully inside it. That means Neovim can have extremely performant fuzzy-search across very large file trees.
For comparison, try fzf in emacs ansi-term (don't bother with eshell).
Use :Ex
to open the file explorer (:Vex
for new vertical split with the explorer, :Sex
for horizontal, :Tex
for tab). If you use vim-vinegar, substitute :Ex
with -
and keep pressing -
to go to the parent directory. If I know which file I want to open beforehand, I use fzf, which allows to open files in splits or tabs too.
To move the working directory to the current file's path, I use :cd %:p:h
, which I have mapped to <leader>cd
.
These are just commands for exploring files, there are many more for just empty buffers and stuff.
Check out `fzf` with bash history: https://github.com/junegunn/fzf/wiki/Examples#command-history
You can even have it work when you hit `C-r`! =D
I think fzf is pretty good for the job.
You can do git status | fzf
and fuzzy search what you are looking for. But if this is a common use case you can do git ls-files -m | fzf
to eliminate the noise in git status.
This is pretty cool! I'll consider adding it to my tools.
Currently, I use fzf to fuzzy (or exact) search shell history, bound to Ctrl-R; when entering a cryptic/complex command that I'll likely use again, I'll just comment after the command. Example: yay -Syu #this updates all the things
This way, I have some concise documentation of what the command does, and I can directly search for those keywords. Searching "update" would give that command as a result, for example.
For commonly used code snippets I use:
sheet | fzf
(for which I created an alias called sheetf
)You can see this in action and find some of the other tools I use regularly and tweaks I did to my terminal experience in my Linux Development Setup
On top of the CTRL-R suggestions, you can also try https://github.com/junegunn/fzf (fuzzy search for reverse history). That plus the vim plugin makes it a breeze to switch files or open in new window/tab
fzf dominates this use case, in my opinion. Nice to see more options out there, though a python dependency is just as annoying as a ruby dependency.
Still looking for something more cross-platform like the_platinum_searcher.
I guess an alternative is to use fzf instead of Tab for completion -- it will pick an actual file. That would fix the root problem of tab completion not working how you want.
A low-tech solution is to use *
: vim mo*
would open all the name matches and you could :n
to switch between them.
My favorite thing about this tool is how well it integrates with other tools. See here for examples: https://github.com/junegunn/fzf/wiki/examples
Since it just takes a list from stdin and sends it's output to stdout, it integrates naturally with other unix commands.
It has been two years since I last posted about the update of vim-clap. A lot of features have been added to vim-clap since then, check out the CHANGELOG if you are interested. Today I want to share with you a feature that I want to support in vim-clap for quite a long time: the search syntax of fzf, which is powerful yet pretty handy in my opinion. Feel free to try #738 and leave some feedback.
fzf is not particularly intelligent when it comes to matching, at least not as intelligent as other matchers (like cpsm for ctrlp) due to the fact that it's not specific to file matching, but works with any kind of data. Still, you can do some things, as pointed out in this comment: https://github.com/junegunn/fzf/issues/886#issuecomment-289656836
Editing: Let me point out something first: don't set those settings globally if you use some of the other commands that come with fzf, like Lines, because those will be affected and will be rendered essentially useless.
It's mentioned in this issue https://github.com/junegunn/fzf/issues/809. The workaround is to disable the height option in the neovim terminal, by adding this into your init.vim:
let $FZF_DEFAULT_OPTS .= ' --no-height'
I need to improve my google-fu. I found something fairly useful after messing around with search terms until I came up with "zsh file search" and removed "incremental" and various other words.
https://github.com/junegunn/fzf
I got that installed via Homebrew, and it works really nicely with the following:
FZF_DEFAULT_OPTS='--reverse --border --exact'
Plus there's loads of options you can set.
Pretty nice tool.
Ctrl-R
is also a great tool for this if you remember parts of the command.
Just press Ctrl-R
in the terminal and start typing what you remember. Even more useful with fzf, as you get a list. (pretty sure that fzf is all that is needed to make it better.)
It seems that your comment contains 1 or more links that are hard to tap for mobile users. I will extend those so they're easier for our sausage fingers to click!
Here is link number 1 - Previous text "fzf"
^Please ^PM ^/u/eganwall ^with ^issues ^or ^feedback! ^| ^Delete
I use fzf.vim with ag (silver searcher) https://github.com/junegunn/fzf.vim https://github.com/junegunn/fzf
FZF is for shell while fzf.vim is a plugin that uses fzf for vim. Ag is better for searching codebases and is faster because it ignores git directories and gitignores.
fzf is probably my biggest recommendation. Integrates with various standard shell commands (eg, ctrl-r history searching) and makes them all "fuzzy-finder" style prompts. Also has a bunch of example integrations for vim and tmux. It's really configurable and once you start using it it's hard to go back.
That would be fzf: https://github.com/junegunn/fzf
I love everything junegunn does :D
Here is the instructions for the bindings: https://gist.github.com/junegunn/8b572b8d4b5eddd8b85e5f4d40f17236
from my dots: https://github.com/p1xelHer0/dotfiles/blob/master/conf/osx/zsh/fzf.zsh
Man if that works for you then of course it makes sense.
Also fzf is your friend. It finds files recursively as you type the name of it, then you can select a file and it gets printed out. You can use it like this for example: nano $(fzf)
, then you type the part of the file that you remember, select it and that's it. I use to open my pdfs since you can give it a initial input (dont recall the flag, not on my pc now), so if you give it something like .pdf$
it will query for all files ending with pdf
.
It's maybe confusing to describe how it works but then you try it you'll get right away.
Also it's a very hackable program, you can do a lot of crazy things with it.
I think you will have to write something in bash/zsh etc to do this as it is down to the specific shell to implement. If you look at fzf or skim, they have shell functions that do the command manipulation.
As far as I know, this isn't possible in pure rust.
Okay..sorry but...
>I generally prefer keeping my system clean and tidy and control file locations as much as possible. That's why I've downloaded a standalone binary version of fzf and just dropped it to /usr/local/bin.
sounds a bit misguided in this case. It's not that the packages in ubuntu installs endless files...basically you just got rid of the man pages (Why wouldn't you want those?), the documentation files for the different shells that explain exactly what you ask for and the config file for the fish shell...
But if you want to stick with your set-up you can check the docs and examples in the source-code then copy and adjust them to your system.
It isn't by using the :edit
command, but you should checkout fzf. It's made by the same guy who made vim-plug
and it's fantastic. I used to use CtrlP
, but that hadn't been updated since 2015, so I switched this week to fzf and absolutely love it. My work flow has sped up so much
FZF should have a default binding to do that already...
ALT-C - cd into the selected directory
Set FZF_ALT_C_COMMAND to override the default command Set FZF_ALT_C_OPTS to pass additional options
So in my case using bash shell, pressing 'esc-c' works as described
i would suggest checking out fzf for this.
the other commentors command will work but if there are miultiple files it will open them all in buffers which might not be what you want. but if you pipe it into fzf thatll let you interactively choose a file from the output of find and then open it in vi - like this:
vi $(find . -name file.txt | fzf)
also look into fd if youre going to use this often, since its significantly faster than find.
FZF is my one true love. Now I fuzzy-completeify everything. The vim plugin is key.
In the Readme the developer says the plugin is not designed to be configurable/flexible but it is actually insanely so. Some [examples](https://github.com/junegunn/fzf/wiki/Examples-(vim\)) on how to make your own completion lists.
Fzf is probably the biggest productivity boost I've gotten recently both inside and outside of vim. For anyone unfamiliar with Fzf I highly recommend checking out the examples on their wiki.
If you use vim-commentary, add this to your vimrc so you can use commentary in Django templates:
autocmd FileType htmldjango setlocal commentstring={#\ %s\ #}
That's the only Django specific thing I had in my vimrc back when I was a Django developer. The rest is more generic, like using ALE for linting and fzf for file finding.
I personally prefer to use path-extractor + fzf (https://github.com/edi9999/path-extractor + https://github.com/junegunn/fzf), where the first one is responsible of filtering the pathnames, and fzf for interactive selection. This way, you choose which interactive filter you want to use.
For 6., there is wild-menu that is like ido-mode. For more advanced completion, and at more places, you can try fzf, which is closer to ivy or helm, but there is no 'generic completion' nor standard completion method as far as I can tell. I wish I am wrong! :)
Do you have the latest version? Not sure if it's related but there was a fix regardingchdir
a few weeks ago. So try :PlugUpdate
and see if it helps. Also check if you have the same issue with :Files some_dir
(it's a command from fzf.vim
repo, similar to :FZF
).
> fzf will match search terms out of order and parts of search terms large distances away, significantly throwing off its accuracy.
Is that before or after the recent change to the ranking algorithm?
https://github.com/junegunn/fzf/commit/2f6d23b91e845f53e746e7cf74477a735ec88a85
https://github.com/junegunn/fzf/commit/4bde8de63f187e487ff5bc40c1d7803ca882ff9c
> I'm working on my own fuzzy finder.
...instead of sending a patch to fzf?
I suppose I should not be surprised, re-using existing work seems to be the last thing anyone considers.
If you're still using CtrlP for fuzzy finding then I recommend checking out FZF (https://github.com/junegunn/fzf). It's way faster. It acts as a basic neovim plugin out of the box but the developer has also put together a plugin with more advanced stuff like buffer searching.
fzf is fast, for a start. It's ridiculously quick. Speed was/is the primary advantage that led me to move.
It's also available everywhere and not just vim. It's also very easy to use/customize. You can map keys to, for example, select from recently opened files, or change colorschemes, or open a tmux pane on the right of your current pane (trivial examples, but very easy to do).
Take a look: https://github.com/junegunn/fzf
> fzf is a single ruby executable script you dont have to compile it or even install it
Correction: fzf was started as a ruby script but completely rewritten in Go this year. The ruby version is no longer updated and much slower than the new go version. There are prebuilt binaries for osx and linux that you can simply download and use it.
It looks like you already found the answer but FYI, @gleachkr wrote a command called FZFLines which does fuzzy search across all open buffers using fzf. If you know some Vimscript, it's really easy to customize.
Mine alternatives/helpers bringing a new extra functionality are the following: - https://github.com/facebook/pathpicker/ - Facebook PathPicker is a simple command line tool that solves the perpetual problem of selecting files out of bash output. - https://github.com/jhspetersson/fselect - Find files with SQL-like queries - https://github.com/junegunn/fzf - fzf is a general-purpose command-line fuzzy finder.
Yup, I use that method all the time. Most of the time you'll find that they've already precompiled the binary you need. Here's a good example: fzf. Already has the Windows binaries prebuilt, so if you don't know how, don't have the time, or just plain don't want to build it, you don't have to.
Just pop it in your %PATH%
and you're all set.
you'll need the two files ending in ".bash" from https://github.com/junegunn/fzf/tree/master/shell
you'd also need to set some env vars, mainly FZF_DEFAULT_OPTS, FZF_DEFAULT_COMMAND, FZF_CTRL_T_COMMAND, and FZF_ALT_C_COMMAND
make sure you put all this in your bashrc directly, because having them in different files according to purpose may be unclean and untidy
You should use set
not let
, the fzf README-VIM has the correct form.
If you use let
then you need something like let &runtimepath .= ",/usr/bin/fzf"
(the comma acts as a separator).
Relevant: :h set+=
, :h let-option
It is probably possible, but looks quite harmful. There are quite a few ways to enable spell autocorrection in different applications (like OO-writer or vim). But think about terminal or password dialog. You probably don't want spell correction to work automatically everywhere. If we are talking about app names the zsh (and fish) completion is capable of fixing small errors like switched letters. There is also fzf project which provides fuzzy search through files, commands history and even more.
This one: Using fzf as interative Ripgrep launcher
#!/usr/bin/env bash
# 1. Search for text in files using Ripgrep # 2. Interactively restart Ripgrep with reload action # 3. Open the file in Vim RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case " INITIAL_QUERY="${*:-}" IFS=: read -ra selected < <( FZF_DEFAULT_COMMAND="$RG_PREFIX $(printf %q "$INITIAL_QUERY")" \ fzf --ansi \ --disabled --query "$INITIAL_QUERY" \ --bind "change:reload:sleep 0.1; $RG_PREFIX {q} || true" \ --delimiter : \ --preview 'bat --color=always {1} --highlight-line {2}' \ --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' ) [ -n "${selected[0]}" ] && vim "${selected[0]}" "+${selected[1]}"
I try to keep my plugins to a minimum. The only plugin I would absolutely recommend is some sort of file-explorer. Vim has one, but I like using fzf. You will probably want a plugin manager, too. Vim-plug works well for all of my needs. Other than that, I would just try to find plugins that would suit your needs. You may have to try several that do the same and decide on your own which you like more.
Two options.
I prefer fzf, it completely changed how I work in the shell and in Vim.
Some tips:
Not sure about the Windows side of things, but at least for Linux, install fzf and get familiar with CTL-R and CTL-T. Being able to quickly look up commands you've already run is indispensable. Working on the command line often means dabbling through trial and error and tweaking your commands, so not having to retype them is super handy. fzf adds onto the default CTL-R search by adding a fuzzy search.
This might help for Powershell:
https://github.com/kelleyma49/PSFzf
Here's the original project:
https://github.com/junegunn/fzf
On Linux also, again not sure how this plays with a Window environment, but look into ZSH for own development machine instead of using Bash. It has a lot of quality of life improvements that make for a better day-to-day experience in the terminal.
This might be the way to set that up:
https://www.howtogeek.com/258518/how-to-use-zsh-or-another-shell-in-windows-10/
Before you do any of that though, I'd make sure to look around for "best practices" with the Windows Subsystem for Linux, and see if you can find a consensus on what popular utilities, tools, configurations, programs, etc. people are using.
Yeah, I already looked into it. I even tried to look into the source code because I couldn't get the behaviour I want out of it. I have a way to kind off get what I want if I type :::<PATTERN>
But with that 'hack', I cannot use the search syntax
You could make a global hotkey to open a floating shell and use something like fzf to narrow
I saw this great idea also: https://peterlyons.com/problog/2018/11/fuzzball-desktop-automation
It seems that your comment contains 1 or more links that are hard to tap for mobile users. I will extend those so they're easier for our sausage fingers to click!
Here is link number 1 - Previous text "FZF"
^Please ^PM ^/u/eganwall ^with ^issues ^or ^feedback! ^| ^Delete
> junegunn/fzf is not a Vim plugin. Did you mean junegunn/fzf.vim
junegunn/fzf
contain Vim plugin that is simple wrapper for <code>fzf</code> and is required by junegunn/fzf.vim
is set of commands that uses previous plugin.
Side note on learning Linux: check out fzf. You're going to need to use the terminal, might as well start with a tool that helps you dig up old commands and search for files more easily.
Basically, it lets somebody do fuzzy matching on whatever they can pipe into the fzy
on the command line. It's a very, very handy tool when you know what the name of something is in a large list, but want a quick way to search for it. Some places you'll find fuzzy matching are:
vim
ecosystem, like CtrlP and fzf.vim.Here's some examples showing how it works:
fzy
repo.>Using the directory tree is a thousand times faster than typing it would be.
Not with fzf. The bigger your database is the faster it will be to find something with fuzzy search. Imagine if to google shit, instead of knowing how to google and relying on google's algorythms, you had to manually browse through a categories tree with your mouse.
Using a mouse to navigate files feels super sluggish to me.
Hi, for the plugin manager I'd suggest vim-plug, it's the go-to for both vim and neovim users these days and comes out on top in terms of both features and performance.
Ale and Neomake have overlapping feature sets, do a lot of the same things and are working towards a lot of the same things, there are minor implementation differences but there's unlikely to be a large difference between the experience provided unless you're working with more obscure languages.
Deoplete and Ultisnips are both fine choices, as for nerdtree I'm not sure of any direct replacements. I rely more on the shell and terminal tools but that's really a different work-flow.
You could also probably write a vim command that would fuzzy find the current directory pretty easily with fzf. If you aren't using it you're missing out!
vim-gutentags to handle tag generation.
fzf for a generalized fuzzy-finder that can be fed many different sources.
This example config to pipe the current tags file into fzf.
For searching through your history I recommend fzf, a fuzzy finder. You can pipe your history to FZF and then search it very quickly.
And Alt-.
is a short cut for bangbucks. It requires less key presses.
Surprising to see that there are no mentions for autojump. It keeps tracks of the directories you visit and lets you jump to them using a part of their name.
For example, I probably have multiple directories with the word haskell
in them. But the one I am in most frequently is ~/programming/haskell
which means that j haskell
takes me directly there. If it guesses wrong, you can manually adjust the directory's score up or down, using autojump -i
and autojump -d
respectively, while in the directory whose score you want to modify.
I use it constantly and it has almost replaced cd for me in many cases. I feel completely handicapped without it.
For finding files or directories in deep directory trees that I don't hang around in often enough for autojump
to know about them, I use fzf. The installation script sets up bindings, replacing some like ^R
with much better alternatives. One of them is ALT-C
which cd's directly into a directory somewhere in the hierarchy. I think my window manager overrides that and I haven't really looked into it, so I just use cd ^T
which lets me select any file or directory I want.
I really liked ctrlp for vim and found myself missing the convenience in the shell. I made fzsl, https://github.com/jsbronder/fzsl, prior to finding the many similar projects that already existed because it was an excuse to do some actual py3 coding. I continue to use it over more mature projects like https://github.com/junegunn/fzf as it scratches my itch.
FZF is very nice, but it works best with terminal vim. If you're using MacVim, for example, it doesn't really integrate in the same way that CtrlP or FuzzyFinder do.
Instead it spawns a new iTerm window, and that's after you add some applescript.
It's nice from the cmdline, but for buffer switching I'll stick with FuzzyFinder.
Thanks I'll take a look at vim-renaner
That was exactly my thought for unite. This could be amazing. I've been playing around with fzf in the terminal outside vim. It can basically do fuzzy matching of any data you pass into and you can then use the output for anything; opening files, recursively changing directory, killing processes or searching command history.
fzf.vim is just a wrapper to fzf. Looking at the vim examples https://github.com/junegunn/fzf/wiki/Examples-(vim) it looks like you can do pretty much the same in vim including Fuzzy cmdline completion.
I saw a video on youtube about fzf snippets in bash/zsh which makes me think it could be done in vim as well.
> because it prioritizes the most recent entries over better matches, and the fuzzy search is very fuzzy indeed.
Yes, that's the default behavior, which I personally find it more useful as I almost always prefer recent commands when doing the reverse scan, but nothing stops you from changing it.
Edit the generated ~/.fzf.bash
or ~/.fzf.zsh
and remove +s
option (which is short for --no-sort
) from the relevant section (bind '"\C-r": ..
for bash, fzf-history-widget
for zsh), and fzf will prioritize better matches.
As for less fuzzyness, I recommend using <em>extended search mode</em> by default by adding -x
to your $FZF_DEFAULT_OPTS
. With this mode, you can "quote" a search term by prefixing it with a single quote and turn it into exact-search term.
Hi, thanks for the comment.
I don't think it was necessarily unfair but I see your point. I am aware of the input-caching of Command-T, but the same thing can be said for fzf. fzf can take input from any command, so it's pretty easy to write a script that caches the previous result of find, and just cat
s it afterwards.
I wholeheartedly agree that the matcher of Command-T is the fastest of all. And find it really unfortunate that CRuby can't make use of multiple cores. That's why I went into detail about the possibility of using multiple processes (instead of threads), and it showed more than 2X performance boost in limited scenarios.
Edit: I answered to your comment in the issue as well. Thanks!
The default Ctrl-r
is great. I've enhanced mine with fzf.
Someone else here mentioned history substring search using the up and down keys. To do that, add the following to your ~/.inputrc
# By default up/down are bound to previous-history # and next-history respectively. The following does the # same but gives the extra functionality where if you # type any text (or more accurately, if there is any text # between the start of the line and the cursor), # the subset of the history starting with that text # is searched (like 4dos for e.g.). # Note to get rid of a line just Ctrl-c "\e[B": history-search-forward "\e[A": history-search-backward
Nice project. I like the ctags integration, it would be even more attractive with support for cscope and gtags though. That way it can be used as an unified method for symbol lookup.
I found a few areas for improvement: - it much slower than fzf for traversing large git repositories (at least with the fzf speedup that I posted here: https://github.com/junegunn/fzf/issues/31) - It uses more memory than fzf - It lags when I type my search string. - Installing it from source without root was painful. I don't have root access on the build server that I use. That use case might be a bit specific to my particular need though.
I look forward to checking out future versions.
I have been considering this issue for some days now. This tool may be helpful: fzf - command-line fuzzy finder it could help you find results in the files. Good luck
Not sure. If the [fzf search syntax](https://github.com/junegunn/fzf#search-syntax) doesn't do it for you then you will have to do it through a manual command.
I keep impressing people using fzf with ripgrep (see https://github.com/junegunn/fzf/blob/master/ADVANCED.md#using-fzf-as-interative-ripgrep-launcher ). Just put the data in a folder in nice textual format (I use yaml) and fire up fzf (bonus points for using a mapping).
I prefer fzf, a tool you must install when you use the command line. It comes with a built in keybind that maps CTRL-r to fuzzy search your history (and a lot more features).
try zsh w/ https://github.com/junegunn/fzf and zsh-users/zsh-autosuggestions before you invest in a separate tool...with these its easy to pull up some command you ran before even without thinking about it
And then what do you do to run the command after you grepped the history?
I would suggesting installing the <code>fzf</code> package from your distro. It replaces Ctrl+r with basically what you're doing, but it lets you interactively search with fuzzy finding, and then puts it back into the command line when you press Enter. It also gives you Ctr+t to insert files names, and Alt+c to change directories in a similar manner.
And then what do you do to run the command after you grepped the history?
I would suggesting installing the <code>fzf</code> package from your distro. It replaces Ctrl+r with basically what you're doing, but it lets you interactively search with fuzzy finding, and then puts it back into the command line when you press Enter. It also gives you Ctr+t to insert files names, and Alt+c to change directories in a similar manner.
Good on you for trying to write it yourself!
I found it worked out of the box when installing using the instructions from thefzf
repository.
https://github.com/junegunn/fzf#key-bindings-for-command-line
Nice. How about with fuzzy finding (fzf) too? :)
#!/usr/bin/env bash
vim_help_tags=/usr/local/share/vim/vim82/doc/tags [[ ! -f $vim_help_tags ]] && exit 1
tag=$(fzf -0 --nth=1 --with-nth=1 < $vim_help_tags | cut -f1) vim -c ":help $tag | only"
It only searches Vim's help docs, and not plugins, but it's good enough for me.
install fzf and "source" fzf's key binding and completion scripts (see https://github.com/junegunn/fzf/tree/master/shell for the file); usually this means you add source ...
to your ~/.bashrc
or similar
once you do that, login again, then type kill
then hit TAB
You can pipe arbitrary text into it like most unix tools. It just acts as an interactive filter on whatever the input text is. There are also several flags that allow you to configure the preview window.
The beauty of the tool is that it is written in go, which means the binaries are statically compiled and should run anywhere. That is, you can just copy the tool to /usr/bin without having to worry about system dependencies being incompatible.
You can install it like so:
`curl -L 'https://github.com/junegunn/fzf/releases/download/0.28.0/fzf-0.28.0-linux\_amd64.tar.gz'|sudo tar xzvCf /usr/bin -`
on any x86 linux system. I highly recommend checking out the project page and adding it to your list of system utilities.
Fd is indeed a great tool. Fzf is also a great tool. And if you use fd as the search utility for fzf (for example, export FZF_DEFAULT_COMMAND='fd --type f) then it becomes really good.
Yah, but anyway if you want ot go full native VIM here are some utilities I recommend
FuzzyFile Search - https://github.com/junegunn/fzf
CoC for language server support - https://github.com/neoclide/coc.nvim
For having a file tree - https://github.com/preservim/nerdtree
Essentially with these 3 plugins you have a minimal VIM setup, along with the main features you would want from VSCode.
I try to code like this every so often, but always end up going back to VSCode + VIM bindings. Since it a smoother experience overall.
There’s a few zsh-isms that would need to be replaced, not too terrible, I can certainly give it a pass as soon as I get some time IRL. The basic gist is that it uses the fc
command (present in Bash and Zsh) that shows your command history with an index number. By choosing the index number associated with the command you want to bookmark, the script copies the command from your history into a separate file in your home directory. From there you can list all your bookmarked commands. Retrieving a bookmarked command also uses fc
— it copies the command from your bookmarks and appends it to your history so it can be recalled simply by pressing the ⬆️ key.
fc
itself is a little difficult to grok at first, but it’s pretty versatile: https://datacadamia.com/lang/bash/fc
fzf
is an external program that can make interactive menus (I guess is a good way of explaining it). You don’t technically need it but it’s handy to have: https://github.com/junegunn/fzf
Hope that all makes sense. Sorry for the lack of comments in the script, I wrote it up quick one day and never really intended it as a real open source software package.
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
i have to add something like this, also i press ctrl+t
to get the completion of fzf
, and tab
for normal completion.
also https://github.com/junegunn/fzf if it don't work try to install from here
I used to use nerdtree that I felt slow to manoeuvre with. Then I discovered fzf, felt amazing. I could reach everything with minimal effort, config and it served me perfectly. That is why I integrated it into my workflow. Since then I tried telescope.nvim cuz of the hype. Works almost the same as fzf but with some extra nice to have stuff.
Looks like you received some great replies here so I’ll add one more little thing.
If you like the idea of what the wildcard can do for you consider setting up <strong>fzf</strong> a fuzzy search tool for the command line. I think you would really like it. Another tool that you can use in combination with fzf is <strong>ripgrep</strong> a line oriented and recursive search tool. Together they are quite powerful and can even be <strong>configured with vim</strong>.
I thinks it's working like intended. Looking for all the files. If you move between directories the number would be less like you are experiencing when you move from `home`.
Maybe something like this could help https://github.com/junegunn/fzf#respecting-gitignore
Yes but I think you can't do that in an alias / function etc. (can you?). vim $(fzf)
and some variations on it are suggested in the fzf readme https://github.com/junegunn/fzf#usage so it's not an unusual construct.
fzf with fd works well of course, there is fzf.el and fuzzy-finder.el which "integrate" fzf. Unfortunately the integration is not on the UI level, both packages run fzf in an Emacs terminal. There is no other possibility, since neither fzf nor skim support a "pipe mode" (https://github.com/junegunn/fzf/issues/1416). counsel-fzf works differently, it uses fzf as a backend which is restarted every time. This approach has the downside that the candidates are regenerated every time.