You are not logged in.
qfi is a command line tool for UNIX-like systems, for quickly editing commonly used files and switching to commonly used directories. I found myself editing the same files quite often on my system and typing out the full path to each file seemed like a waste of time, so I created qfi. I tried to make this program simple and easy to learn so that it doesn't take more time to learn than it saves.
The idea of qfi is that you can create shorter names for files and directories that you use often. I call these shorter names targets. To add a new target, you call qfi with the -a option, the target name, and the file/directory:
$ qfi -a php /etc/php/php.ini
Now whenever you want to edit that file, you can just call qfi with the target name:
$ qfi php
which will open up the file with sudoedit.
About that... if the file is owned by root user, it will use sudoedit, if it's owned by use it will use $EDITOR, and if $EDITOR is not defined it will use vi. If you have a better idea of how the editor-choosing should behave let me know, and I'll change it if I like it.
EDIT: Targets can now point to directories, in which case your shell will switch to that directory. You must source the wrapper.sh script in your shell rc-file to turn directory-switching.
Here is a quick run-down of the command line options. You can add a target with:
$ qfi -a <target> <filename>
You can delete a targets with:
$ qfi -d <target>
You can change the file that a target points to with:
$ qfi -m <target> <filename>
You can rename a target with:
$ qfi -r <target> <newname>
Finally, you can list targets, or optionally see where a target points to with:
$ qfi -l [target]
Targets are maintained as symbolic links inside of qfi's configuration directory, which is in $HOME/.config/qfi, or $XDG_CONFIG_HOME/qfi if $XDG_CONFIG_HOME is defined.
qfi only depends on Perl and sudo. It also comes with zsh and bash completion for targets and options. bash-completion must be installed for bash completion, but zsh completion works right out of the box.
Github page, with a slightly lengthier description.
Last edited by dudefellaguy (2014-01-06 02:49:08)
Offline
I just use aliases:
$ type pc
pc is aliased to `sudo vim /etc/pacman.conf'
qfi reminds me of surfraw :-)
Last edited by karol (2014-01-02 23:18:04)
Offline
I used to use aliases, but I like qfi better because adding and changing shortcuts is faster, and I don't have to restart all of my shells afterwards. It also keeps the files in a separate namespace, so, if I want shortcuts to a lot of different files, I don't have to worry about overriding actual commands. Also, if I forget the exact name of the target, I can just use tab-completion, which I couldn't do with aliases, because I would get a huge list of results.
Speaking of aliases, I have qfi aliased to q and I have "pac" as a target to "/etc/pacman.conf" so I can just type
$ q pac
to open up that file. It's only three more characters, and I get the aforementioned benefits. I could also just make it "p", so I could just run:
$ q p
By the way, surfraw looks like a pretty nifty project, I'll have to look into it. Thanks!
Offline
I'm not sure what you mean by "restarting your shells". It should be enough to source the file with aliases e.g.
$ type src
src is aliased to `. /etc/bash.bashrc.local'
but yes, you have to source it for every shell (terminal) you have already opened.
Another tool qfi reminds me of is autojump and friends.
I think qfi deserves a page in our wiki. Are you planning on adding it or should I do it?
Offline
I'm not sure what you mean by "restarting your shells". It should be enough to source the file with aliases e.g.
That works the majority of the time, but if I were to rename an alias, the old one would hang around until I unaliased it, or restarted the shell. It's really not that big of a deal, it's just one more thing to do.
I have actually used autojump before, but it seems to decide what jumps best are best by gathering statistical information on your habits. I wanted something with more explicit control.
Offline
Another tool qfi reminds me of is autojump and friends.
I think qfi deserves a page in our wiki. Are you planning on adding it or should I do it?
It would be super awesome if you created a wiki page for it, you're more than welcome to!
Speaking of autojump, I just released a new version that allows you create targets that point to directories, in which case your shell will change into that directory. So, if you create a wiki page, don't forget to include that.
Offline
This is a neat tool for the terminal.
It somewhat reminds me of fasd, too. I have added some custom aliases to simplify opening files and directories with it.
https://bbs.archlinux.org/viewtopic.php?pid=1114141
Last edited by progandy (2014-01-06 02:51:34)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
fasd, v, z, autojump - they're all nice.
Is there a name for such tools?
Offline
Directory Navigation Assistants?
All the best,
-HG
Offline