1
0
mirror of https://github.com/skywind3000/z.lua synced 2026-03-27 18:19:50 +00:00

Remove ^Ms

This commit is contained in:
0xC0FFEE
2019-01-17 20:17:00 +01:00
parent 94c7709e15
commit 592771f70a

108
README.md
View File

@@ -19,7 +19,7 @@ For example, `z foo bar` would match `/foo/bar` but not `/bar/foo`.
- Supports Windows cmd (with clink) and cmder
- Self contained, no dependence on awk/gawk
- Compatible with lua 5.1, 5.2 and 5.3+
- New "$_ZL_ADD_ONCE" to allow updating database only if `$PWD` changed.
- New "$_ZL_ADD_ONCE" to allow updating database only if `$PWD` changed.
- Enhanced matching mode with "$_ZL_MATCH_MODE" set to 1.
@@ -39,33 +39,33 @@ z -i foo # cd with interactive selection
## Install
- bash:
put something like this in your `.bashrc`:
eval "$(lua /path/to/z.lua --init bash)"
- zsh:
put something like this in your `.zshrc`:
eval "$(lua /path/to/z.lua --init zsh)"
- posix shells:
- bash:
put something like this in your `.bashrc`:
eval "$(lua /path/to/z.lua --init bash)"
- zsh:
put something like this in your `.zshrc`:
eval "$(lua /path/to/z.lua --init zsh)"
- posix shells:
put something like this in your `.profile`:
eval "$(lua /path/to/z.lua --init posix)"
(sh, ash, dash and busybox have been tested)
- Windows (with clink):
- Windows (with clink):
- copy z.lua and z.cmd to clink's home directory
- Add clink's home to `%PATH%` (z.cmd can be called anywhere)
- Ensure that "lua" can be called in `%PATH%`
- Windows cmder:
- Windows cmder:
- copy z.lua and z.cmd to cmder/vendor
- Add cmder/vendor to `%PATH%`
@@ -77,11 +77,11 @@ z -i foo # cd with interactive selection
- set `$_ZL_CMD` in .bashrc/.zshrc to change the command (default z).
- set `$_ZL_DATA` in .bashrc/.zshrc to change the datafile (default ~/.zlua).
- set `$_ZL_NO_PROMPT_COMMAND` if you're handling PROMPT_COMMAND yourself.
- set `$_ZL_EXCLUDE_DIRS` to an array of directories to exclude.
- set `$_ZL_ADD_ONCE` to '1' to update database only if `$PWD` changed.
- set `$_ZL_MAXAGE` to define a aging threshold (default is 5000).
- set `$_ZL_EXCLUDE_DIRS` to an array of directories to exclude.
- set `$_ZL_ADD_ONCE` to '1' to update database only if `$PWD` changed.
- set `$_ZL_MAXAGE` to define a aging threshold (default is 5000).
- set `$_ZL_CD` to specify your own cd command.
- set `$_ZL_ECHO` to 1 to display new directory name after cd.
- set `$_ZL_ECHO` to 1 to display new directory name after cd.
- set `$_ZL_MATCHMODE` to 1 to enable enhanced matching.
## Aging
@@ -101,27 +101,27 @@ To z.lua, a directory that has low ranking but has been accessed recently will q
z.lua has two different matching methods: 0 for default, 1 for enhanced:
### Default matching
By default, z.lua uses default matching method similar to the original z.sh. Paths must be match all of the regexes in order.
- cd to a directory contains foo:
j foo
- cd to a directory ends with foo:
j foo$
- use multiple arguments:
Assuming the following database:
30 /home/user/mail/inbox
10 /home/user/work/inbox
`"z in"` would cd into `/home/user/mail/inbox` as the higher weighted entry. However you can pass multiple arguments to z.lua to prefer a different entry. In the above example, `"z w in"` would then change directory to `/home/user/work/inbox`.
### Default matching
By default, z.lua uses default matching method similar to the original z.sh. Paths must be match all of the regexes in order.
- cd to a directory contains foo:
j foo
- cd to a directory ends with foo:
j foo$
- use multiple arguments:
Assuming the following database:
30 /home/user/mail/inbox
10 /home/user/work/inbox
`"z in"` would cd into `/home/user/mail/inbox` as the higher weighted entry. However you can pass multiple arguments to z.lua to prefer a different entry. In the above example, `"z w in"` would then change directory to `/home/user/work/inbox`.
### Enhanced matching
Enhanced matching can be enabled by export the environment:
@@ -129,13 +129,13 @@ Enhanced matching can be enabled by export the environment:
export _ZL_MATCH_MODE=1
For a given set of queries (the set of command-line arguments passed to z.lua), a path is a match if and only if:
1. Queries match the path in order (same as default method).
2. The last query matches the last segment of the path.
If no match is found, it will fall back to default matching method.
- match the last segment of the path:
- match the last segment of the path:
Assuming the following database:
@@ -148,7 +148,7 @@ If no match is found, it will fall back to default matching method.
Since the last segment of a path is always easier to be recalled, it is sane to give it higher priority. You can also achieve this by typing `"z space$"` in both methods, but `"z wo"` is easier to type.
- cd to the existent path if there is no match:
- cd to the existent path if there is no match:
Sometimes if you use:
@@ -238,11 +238,11 @@ As you see, z.lua is the fastest one and requires less resource.
Releated projects:
- [rupa/z](https://github.com/rupa/z): origin z.sh implementation
- [JannesMeyer/z.ps](https://github.com/JannesMeyer/z.ps): z for powershell
## License
Licensed under MIT license.
- [rupa/z](https://github.com/rupa/z): origin z.sh implementation
- [JannesMeyer/z.ps](https://github.com/JannesMeyer/z.ps): z for powershell
## License
Licensed under MIT license.