Fed is a command-line tool for speeding up the editing of files with minimal typing by eliminating the need to navigate directories.
You can find fed on Github: https://github.com/choptastic/fed
Gone are the days of typing cd some/deep/path
followed by vim mysource.cc
. Even with tab-completion, this is a pain. You know that mysource.css
is in some/deep/path
in your project, and you have files scattered about in other directories like some/other/place
and mysterious/place/i/rarely/go/but/sometimes/i/must/venture/here
. Typing those full path names is a waste of time. A huge waste of time? No. But a waste nonetheless. Fed is here to save the day.
Fed is a wrapper for your editors. Its name stands for (F)inding (ED)itor It does not assume you use a certain editor: it lets you configure it. Further, it lets you configure which editor you wish to use for which files globally or on a per project basis. Say you have a typical web app with source code, CSS files, and images. You can configure it so that it will automatically open gimp
when it's given an image file, or VLC when given a video file.
Fed can be given partial names, and it will find all the matching files in the project's tree, and if there's only one matching file, just open it. If there are more than one, it'll ask you which one you meant. Fed knows the root your project so you can edit any file from any location in your project tree by just typing part of the name.
$ pwd /home/gumm/code/demo/some/really/deep/other $ tree /home/gumm/code/demo/ /home/gumm/code/demo/ ├── a │  └── shallow │  └── path │  ├── dirt.erl │  └── puddle.erl ├── another │  └── not │  └── exactly │  └── shallow │  └── path │  └── controller.erl └── some ├── one.css └── really └── deep ├── other │  └── place │  ├── copper.erl │  └── mordor.erl ├── path │  └── gold.erl └── silver.erl 14 directories, 8 files $ fed dirt Project Root: /home/gumm/code/demo Loaded Config: editor => vim no_exist => fail multiple_matches => ask ignore => ["~$", "\.beam$", "\.o$"] alt_roots => [".git", ".hg"] Found Files: ./a/shallow/path/dirt.erl (Opens vim on dirt.erl)
So even though dirt.erl is in a completely different tree off the root of our project, fed will find it and open it appropriately.
Assuming the same directory structure above, observe:
$ fed co Project Root: /home/gumm/code/demo Loaded Config: editor => vim no_exist => fail multiple_matches => ask ignore => ["~$", "\.beam$", "\.o$"] alt_roots => [".git", ".hg"] Found Files: ./some/really/deep/other/place/copper.erl ./another/not/exactly/shallow/path/controller.erl Multiple Matching Files: (1): ./some/really/deep/other/place/copper.erl (2): ./another/not/exactly/shallow/path/controller.erl Which file to load [1-2 or (f)ail]?:
Sure enough, Fed found two files that start with "co" and so it must ask us what we mean, so it lists all the matching files, and let us choose.
To get started with Fed, clone it and install it.
$ git clone git://github.com/choptastic/fed Cloning into 'fed'... remote: Counting objects: 98, done. remote: Compressing objects: 100% (70/70), done. remote: Total 98 (delta 49), reused 68 (delta 19) Receiving objects: 100% (98/98), 16.07 KiB, done. Resolving deltas: 100% (49/49), done. $ cd fed $ sudo make install ./install.sh Installing fed. fed installed as /usr/bin/fed $ fed fed :: The (F)inding (ED)itor. Version 0.0.1 (2013-10-08) Usage: fed -init # Initializes fed for the local project fed -global # Initializes fed configuration for all your projects fed Filename # Searches for Filename in the project and opens it in your editor
And you're good to begin editing.
It's recommended that you type fed -global
to get started to establish some basics (like which editor to use by default).
Back in February, I made a proof-of-concept of this for myself, which was just a dumb shell script that filtered out a few files, and automatically opened vim. Since then, I've found that the paradigm does indeed help speed up my development so I took the time to finally fully flesh it out.
There are some improvements on the way as well, including fuzzy searching, but this will hold me over for now, especially in my web development, as it's nice to just type fed delete
and it will open delete.png
in gimp, and if there is another conflict, it'll let me choose what I mean.
As I'm a guy who definitely eats his own dogfood, Fed will continue to get updates.
If you're interested in Fed, check it out on github at: https://github.com/choptastic/fed