![]() To do this add the following lines to your. We can customise the fzf experience a stage further by adding some options to fzf. I didn't have to locate the file before hand by going through directories, I just did a fuzzy find. I then hit enter again to open than file in MacVim. I can then hit enter when it's found the file I'm after, exiting fzf. Then I start typing meshcutup and fzf fuzzy finds files that match. You'll see that at first I type 'pde which looks for files with an exact word match for files with pde, the Processing file extension. You can see how I can then fuzzy find for this file: I know it's called meshcutup so in the command line I type mvim and then hit CTRL-t to fire up fzf which is now bound to this key mapping. In this example I want to edit a file in MacVim. ![]() Basic Useīelow shows how fzf works straight out of the box. You'll then want to install the special key bindings by running this in the command line: /usr/local/opt/fzf/installįzf is now setup and ready to go. Once you have Homebrew installed in the command line type: brew install fzf The best way to install it on a Mac is using the package manager Homebrew. ![]() What's fzf? Well from the readme: "It's an interactive Unix filter for command-line that can be used with any list files, command history, processes, hostnames, bookmarks, git commits, etc." Essentially you can pipe lists into it, filter that list and then use the output however you see fit - opening that file, changing a directory etc etc. It's completely changed how I now find things in the terminal so I wanted to share setting it up and how I use it. Yet there's an easier way involving fuzzy finding using a lovely thing called fzf. Often times I'm navigating files in the command line, which can be a bit laborious or involve drilling down into directories, remembering structure and the like. It's usually always the case that I have a terminal session open somewhere on my Mac - either managing a Git repo, working with a Nodejs instance or a myriad of other reasons. The Art of Form and Code Crazy-Fast Finding and Opening Files on the Command Line ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |