Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
85d94955
Commit
85d94955
authored
Nov 27, 2015
by
Marc Cornellà
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4181 from posva/z
Update z version to 5dc2a86
parents
96108e11
d3363964
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
269 additions
and
234 deletions
+269
-234
README
plugins/z/README
+26
-17
z.1
plugins/z/z.1
+23
-12
z.sh
plugins/z/z.sh
+220
-205
No files found.
plugins/z/README
View file @
85d94955
...
@@ -6,7 +6,7 @@ NAME
...
@@ -6,7 +6,7 @@ NAME
z - jump around
z - jump around
SYNOPSIS
SYNOPSIS
z [-chlrt] [regex1 regex2 ... regexn]
z [-chlrt
x
] [regex1 regex2 ... regexn]
AVAILABILITY
AVAILABILITY
bash, zsh
bash, zsh
...
@@ -15,10 +15,13 @@ DESCRIPTION
...
@@ -15,10 +15,13 @@ DESCRIPTION
Tracks your most used directories, based on 'frecency'.
Tracks your most used directories, based on 'frecency'.
After a short learning phase, z will take you to the most 'frecent'
After a short learning phase, z will take you to the most 'frecent'
directory that matches ALL of the regexes given on the command line.
directory that matches ALL of the regexes given on the command line, in
order.
For example, z foo bar would match /foo/bar but not /bar/foo.
OPTIONS
OPTIONS
-c restrict matches to subdirectories of the current directory
.
-c restrict matches to subdirectories of the current directory
-h show a brief help message
-h show a brief help message
...
@@ -28,10 +31,12 @@ OPTIONS
...
@@ -28,10 +31,12 @@ OPTIONS
-t match by recent access only
-t match by recent access only
-x remove the current directory from the datafile
EXAMPLES
EXAMPLES
z foo cd to most frecent dir matching foo
z foo cd to most frecent dir matching foo
z foo bar cd to most frecent dir matching foo
and
bar
z foo bar cd to most frecent dir matching foo
, then
bar
z -r foo cd to highest ranked dir matching foo
z -r foo cd to highest ranked dir matching foo
...
@@ -55,8 +60,9 @@ NOTES
...
@@ -55,8 +60,9 @@ NOTES
Set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution.
Set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution.
Set $_Z_NO_PROMPT_COMMAND to handle PROMPT_COMMAND/precmd your-
Set $_Z_NO_PROMPT_COMMAND to handle PROMPT_COMMAND/precmd your-
self.
self.
Set $_Z_EXCLUDE_DIRS to an array of directories to exclude.
Set $_Z_EXCLUDE_DIRS to an array of directory trees to exclude.
(These settings should go in .bashrc/.zshrc before the lines
Set $_Z_OWNER to allow usage when in 'sudo -s' mode.
(These settings should go in .bashrc/.zshrc before the line
added above.)
added above.)
Install the provided man page z.1 somewhere like
Install the provided man page z.1 somewhere like
/usr/local/man/man1.
/usr/local/man/man1.
...
@@ -64,12 +70,12 @@ NOTES
...
@@ -64,12 +70,12 @@ NOTES
Aging:
Aging:
The rank of directories maintained by z undergoes aging based on a sim-
The rank of directories maintained by z undergoes aging based on a sim-
ple formula. The rank of each entry is incremented every time it is
ple formula. The rank of each entry is incremented every time it is
accessed. When
the sum of ranks is greater than 6000, all ranks are
accessed. When
the sum of ranks is over 9000, all ranks are multiplied
multiplied
by 0.99. Entries with a rank lower than 1 are forgotten.
by 0.99. Entries with a rank lower than 1 are forgotten.
Frecency:
Frecency:
Frecency is a portmant
ae
u of 'recent' and 'frequency'. It is a weighted
Frecency is a portmant
ea
u of 'recent' and 'frequency'. It is a weighted
rank that
depends on how often and how recently something occu
red. As
rank that
depends on how often and how recently something occur
red. As
far as I know, Mozilla came up with the term.
far as I know, Mozilla came up with the term.
To z, a directory that has low ranking but has been accessed recently
To z, a directory that has low ranking but has been accessed recently
...
@@ -107,16 +113,19 @@ ENVIRONMENT
...
@@ -107,16 +113,19 @@ ENVIRONMENT
resolving of symlinks. If it is not set, symbolic links will be
resolving of symlinks. If it is not set, symbolic links will be
resolved when added to the datafile.
resolved when added to the datafile.
In bash, z
prepends a command to the PROMPT_COMMAND environment vari-
In bash, z
appends a command to the PROMPT_COMMAND environment variable
able to maintain its database. In zsh, z appends a function _z_precmd
to maintain its database. In zsh, z appends a function _z_precmd to the
to the
precmd_functions array.
precmd_functions array.
The environment variable $_Z_NO_PROMPT_COMMAND can be set if you want
The environment variable $_Z_NO_PROMPT_COMMAND can be set if you want
to handle PROMPT_COMMAND or precmd yourself.
to handle PROMPT_COMMAND or precmd yourself.
The environment variable $_Z_EXCLUDE_DIRS can be set to an array of
The environment variable $_Z_EXCLUDE_DIRS can be set to an array of
directories to exclude from tracking. $HOME is always excluded. Direc-
directory trees to exclude from tracking. $HOME is always excluded.
tories must be full paths without trailing slashes.
Directories must be full paths without trailing slashes.
The environment variable $_Z_OWNER can be set to your username, to
allow usage of z when your sudo enviroment keeps $HOME set.
FILES
FILES
Data is stored in $HOME/.z. This can be overridden by setting the
Data is stored in $HOME/.z. This can be overridden by setting the
...
...
plugins/z/z.1
View file @
85d94955
...
@@ -4,7 +4,7 @@ NAME
...
@@ -4,7 +4,7 @@ NAME
z \- jump around
z \- jump around
.SH
.SH
SYNOPSIS
SYNOPSIS
z [\-chlrt] [regex1 regex2 ... regexn]
z [\-chlrt
x
] [regex1 regex2 ... regexn]
.SH
.SH
AVAILABILITY
AVAILABILITY
bash, zsh
bash, zsh
...
@@ -13,12 +13,14 @@ DESCRIPTION
...
@@ -13,12 +13,14 @@ DESCRIPTION
Tracks your most used directories, based on 'frecency'.
Tracks your most used directories, based on 'frecency'.
.P
.P
After a short learning phase, \fBz\fR will take you to the most 'frecent'
After a short learning phase, \fBz\fR will take you to the most 'frecent'
directory that matches ALL of the regexes given on the command line.
directory that matches ALL of the regexes given on the command line, in order.
For example, \fBz foo bar\fR would match \fB/foo/bar\fR but not \fB/bar/foo\fR.
.SH
.SH
OPTIONS
OPTIONS
.TP
.TP
\fB\-c\fR
\fB\-c\fR
restrict matches to subdirectories of the current directory
.
restrict matches to subdirectories of the current directory
.TP
.TP
\fB\-h\fR
\fB\-h\fR
show a brief help message
show a brief help message
...
@@ -31,13 +33,16 @@ match by rank only
...
@@ -31,13 +33,16 @@ match by rank only
.TP
.TP
\fB\-t\fR
\fB\-t\fR
match by recent access only
match by recent access only
.TP
\fB\-x\fR
remove the current directory from the datafile
.SH EXAMPLES
.SH EXAMPLES
.TP 14
.TP 14
\fBz foo\fR
\fBz foo\fR
cd to most frecent dir matching foo
cd to most frecent dir matching foo
.TP 14
.TP 14
\fBz foo bar\fR
\fBz foo bar\fR
cd to most frecent dir matching foo
and
bar
cd to most frecent dir matching foo
, then
bar
.TP 14
.TP 14
\fBz -r foo\fR
\fBz -r foo\fR
cd to highest ranked dir matching foo
cd to highest ranked dir matching foo
...
@@ -76,10 +81,13 @@ Set \fB$_Z_NO_RESOLVE_SYMLINKS\fR to prevent symlink resolution.
...
@@ -76,10 +81,13 @@ Set \fB$_Z_NO_RESOLVE_SYMLINKS\fR to prevent symlink resolution.
Set \fB$_Z_NO_PROMPT_COMMAND\fR to handle \fBPROMPT_COMMAND/precmd\fR yourself.
Set \fB$_Z_NO_PROMPT_COMMAND\fR to handle \fBPROMPT_COMMAND/precmd\fR yourself.
.RE
.RE
.RS
.RS
Set \fB$_Z_EXCLUDE_DIRS\fR to an array of directories to exclude.
Set \fB$_Z_EXCLUDE_DIRS\fR to an array of directory trees to exclude.
.RE
.RS
Set \fB$_Z_OWNER\fR to allow usage when in 'sudo -s' mode.
.RE
.RE
.RS
.RS
(These settings should go in .bashrc/.zshrc before the line
s
added above.)
(These settings should go in .bashrc/.zshrc before the line added above.)
.RE
.RE
.RS
.RS
Install the provided man page \fBz.1\fR somewhere like \fB/usr/local/man/man1\fR.
Install the provided man page \fBz.1\fR somewhere like \fB/usr/local/man/man1\fR.
...
@@ -88,12 +96,12 @@ Install the provided man page \fBz.1\fR somewhere like \fB/usr/local/man/man1\fR
...
@@ -88,12 +96,12 @@ Install the provided man page \fBz.1\fR somewhere like \fB/usr/local/man/man1\fR
Aging:
Aging:
The rank of directories maintained by \fBz\fR undergoes aging based on a simple
The rank of directories maintained by \fBz\fR undergoes aging based on a simple
formula. The rank of each entry is incremented every time it is accessed. When
formula. The rank of each entry is incremented every time it is accessed. When
the sum of ranks is
greater than 6000, all ranks are multiplied by 0.99. Entries
the sum of ranks is
over 9000, all ranks are multiplied by 0.99. Entries with a
with a
rank lower than 1 are forgotten.
rank lower than 1 are forgotten.
.SS
.SS
Frecency:
Frecency:
Frecency is a portmant
ae
u of 'recent' and 'frequency'. It is a weighted rank
Frecency is a portmant
ea
u of 'recent' and 'frequency'. It is a weighted rank
that depends on how often and how recently something occured. As far as I
that depends on how often and how recently something occur
r
ed. As far as I
know, Mozilla came up with the term.
know, Mozilla came up with the term.
.P
.P
To \fBz\fR, a directory that has low ranking but has been accessed recently
To \fBz\fR, a directory that has low ranking but has been accessed recently
...
@@ -131,7 +139,7 @@ The environment variable \fB$_Z_NO_RESOLVE_SYMLINKS\fR can be set to prevent
...
@@ -131,7 +139,7 @@ The environment variable \fB$_Z_NO_RESOLVE_SYMLINKS\fR can be set to prevent
resolving of symlinks. If it is not set, symbolic links will be resolved when
resolving of symlinks. If it is not set, symbolic links will be resolved when
added to the datafile.
added to the datafile.
.P
.P
In bash, \fBz\fR
pre
pends a command to the \fBPROMPT_COMMAND\fR environment
In bash, \fBz\fR
ap
pends a command to the \fBPROMPT_COMMAND\fR environment
variable to maintain its database. In zsh, \fBz\fR appends a function
variable to maintain its database. In zsh, \fBz\fR appends a function
\fB_z_precmd\fR to the \fBprecmd_functions\fR array.
\fB_z_precmd\fR to the \fBprecmd_functions\fR array.
.P
.P
...
@@ -139,8 +147,11 @@ The environment variable \fB$_Z_NO_PROMPT_COMMAND\fR can be set if you want to
...
@@ -139,8 +147,11 @@ The environment variable \fB$_Z_NO_PROMPT_COMMAND\fR can be set if you want to
handle \fBPROMPT_COMMAND\fR or \fBprecmd\fR yourself.
handle \fBPROMPT_COMMAND\fR or \fBprecmd\fR yourself.
.P
.P
The environment variable \fB$_Z_EXCLUDE_DIRS\fR can be set to an array of
The environment variable \fB$_Z_EXCLUDE_DIRS\fR can be set to an array of
director
i
es to exclude from tracking. \fB$HOME\fR is always excluded.
director
y tre
es to exclude from tracking. \fB$HOME\fR is always excluded.
Directories must be full paths without trailing slashes.
Directories must be full paths without trailing slashes.
.P
The environment variable \fB$_Z_OWNER\fR can be set to your username, to
allow usage of \fBz\fR when your sudo enviroment keeps \fB$HOME\fR set.
.SH
.SH
FILES
FILES
Data is stored in \fB$HOME/.z\fR. This can be overridden by setting the
Data is stored in \fB$HOME/.z\fR. This can be overridden by setting the
...
...
plugins/z/z.sh
View file @
85d94955
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment