V(1) User Commands V(1) NAME v - z for vim SYNOPSIS v [-a] [-c] [-l] [-[0-9]] [--debug] [--help] [regex1 regex2 ... regexn] AVAILABILITY bash, vim INSTALLATION Put v somewhere in $PATH (e.g. /usr/local/bin/). For the manual page, put v.1 somewhere in $MANPATH (e.g. /usr/local/man/man1/). DESCRIPTION v uses viminfo's list of recently edited files to open one quickly no matter where you are in the filesystem. By default, it will open the most recently edited file matching all of the provided regular expressions. OPTIONS -a don't skip deleted files -c restrict matches to subdirectories of the current dir -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 -0 reopen most recently edited file v foo bar edit first file matching foo and bar v -c foo bar choose files in current dir matching foo and bar v -l foo bar list and choose files matching foo and bar NOTES Shell variables, such as $, must be escaped if used in regular expres- sions. Behavior The default behavior is to open the most recent file that matches the search terms, even if there are multiple matches. You may find it useful to alias vl='v -l'. When there are multiple matches, this will prompt for a choice, rather than editing the first match. The author is still not sure which behavior should be the default, and has chosen one provisionally. SEE ALSO vim(1), regex(7) Please file bugs at https://github.com/rupa/v/ v February 2011 V(1)
Category: Linux / Shell command line productivity |
Watchers: 12 |
Star: 432 |
Fork: 52 |
Last update: Dec 2, 2023 |
installation guides would be awesome+ for nubs like me.
thank you.
Hello,
Wondering if it is possible to have a zsh version of this?
Thanks Joe
i got errors when using v because I had register lines starting with ‘>’ in my ~/.viminfo file. by just splitting on space characters this can be avoided since register contents are indented with a tab character.
dfg
I have in my .bashrc the following function definition for vim.
function vim {
vim_orig=$(which 2>/dev/null vim)
$vim_orig --serverlist | grep -q FOO
# if server is running
if [ $? -eq 0 ]; then
$vim_orig --servername FOO --remote-silent "$@"
else
$vim_orig "$@" --servername FOO
fi
}
This enables me to use the remote vim feature in a non-gui vim using an xterm like gnome terminal.
v does not inherit the alias and function definitions because of this in .bashrc (as it should be)
[ -z "$PS1" ] && return
So I'm using the following alias:
alias v='vim="eval $(type vim | tail -n +2); vim" v'
to force v to use my function definition.
This pull request (my first one, I might have screwed something, but I hope not) changes the quoting of the $vim variable in v to enable this behaviour.
I noticed there's no open-source license included in this repo (first noticed in #10); unfortunately, that means this project doesn't meet Homebrew's Acceptable Formulae list for inclusion in the core Homebrew tap. Can you either:
- Add an open-source license to this repo
- Create your own tap so we can migrate the
v
formula there
If I haven't heard a reply in the next week or two, I'll open a PR in homebrew-core to delete the v
formula. Thanks in advance for your help 🙂
Hi, I created Awesome package manager and I can install your repo using it.
After installing the Awesome:
awesome -i rupa/v
# or
awesome install rupa/v
If you can put it in your README, it will be awesome.
Thanks.
Shin
I made v work with fzf. First, modify v not to display the choice dialog when using the -l
flag, then use this shell function to call it:
v() {
if [[ -z "$@" ]]; then
local -r choice="$(command v -l 2>&1 | fzf +s --tac --height 15 --reverse | sed -r 's/^[0-9,. \t]*//')"
if [[ ! -z "$choice" ]]; then
local -r file="${choice/#~/$HOME}"
vim "$file"
fi
else
command v "$@"
fi
}
i am sorry , just a try
This is more useful behaviour than matching against every regex.
E.g. if I have
$ v -l
2 ~/.../json/navigation.json
1 ~/.../app.js
0 ~/.../sass/theme.sass
I want v app the
to start vim with two buffers, one of ~/.../app.js
and the other of ~/.../sass/theme.sass
.
When you call z
with no arguments, it just prints the frecency list.
When you call v
with no arguments, you're presented with a prompt to enter a choice.
This isn't very useful because most vim users will have many files in their recently accessed list, and after they're presented with the list they can just re-run v
with the filename they want.
v1.1(Jul 20, 2016)
-c restricts matches to subdirs of $PWD