Skip to content

Instantly share code, notes, and snippets.

@shmup
Created March 4, 2011 10:01
Show Gist options
  • Save shmup/854422 to your computer and use it in GitHub Desktop.
Save shmup/854422 to your computer and use it in GitHub Desktop.
v, a wrapper for vim
My friend just created a wrapper for vim and I think you'll love it. v is a bash
script/vim wrapper that uses viminfo to list files previously edited in vim. In
addition, you can easily open the last edited file or a particular file from the
list witha few strokes.
=================================================
https://github.com/rupa/v
=================================================
OPTIONS
-a don't skip deleted files
-l when multiple matches, show a list
-[0-9] edit nth most recent file
--debug dry run
--help show a brief help message
EXAMPLES
v list and choose from all files
v -1 reopen most recently opened file
v -2 reopen most recently opened file
v foo bar edit first file matching foo and bar
v -l foo bar list and choose files matching foo and bar
=================================================
Allow me to give you a rundown.
Just typing v lists, as such:
jared@shmupc:~$ v
[EDIT: list is much longer, I believe that viminfo keeps track of the last 100 edited files]
7 /var/log/apache2/error.log.1
6 ~/.bashrc
5 /var/www/minecrack/status.php
4 /var/www/minecrack/herpderp1.php
3 /var/www/minecrack/herpderp2.php
2 /var/www/minecrack/herpderp3.php
1 /etc/php5/apache2/php.ini
>
From there I could type a number from above to have vim automatically load it.
I could also type *v vent* and it would open the last file in the list that had the word vent in it.
As well, typing v vent 2 would open /var/www/minecrack/vent2.php.
Right now he really wants to know if he should change some of the functionality, and is looking for
opinions. For example, v by itself used to automatically load the last file, instead of listing.
You'd then have to v -l when wanting to see a list.
Let me know what you guys think.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment