1
0
mirror of https://github.com/skywind3000/z.lua synced 2026-03-13 19:29:49 +00:00

improve powershell 7 compatibility

This commit is contained in:
skywind3000
2021-02-15 00:02:23 +08:00
parent 7a8acd469d
commit 501f619f94
3 changed files with 28 additions and 9 deletions

View File

@@ -65,7 +65,12 @@ z -b foo # 跳转到父目录中名称以 foo 开头的那一级
antigen bundle skywind3000/z.lua
就可以了(主要要放在 antigen apply 语句之前)。
**注意**:使用 WSL-1 的用户,需要安装 `lua-filesystem` 包:
sudo apt-get install lua-filesystem
这是由于 wsl-1 的 [bug](https://github.com/microsoft/WSL/issues/5505) 引起的,使用 lua-filesystem 可以避免该问题。
- Fish Shell:
@@ -83,7 +88,7 @@ z -b foo # 跳转到父目录中名称以 foo 开头的那一级
在你 Power Shell 的配置文件 `profile.ps1` 中放入下面语句:
iex ($(lua /path/to/z.lua --init powershell) -join "`n")
Invoke-Expression (& { (lua /path/to/z.lua --init powershell) -join "`n" })
- Windows cmd (with clink):

View File

@@ -69,13 +69,19 @@ z -b foo # cd to the parent directory starting with foo
and perhaps this:
export _ZL_ECHO=1
eval "$(lua /path/to/z.lua --init bash enhanced once echo)"
if you want `z.lua` print the new directory after cd.
If you want `fzf` tab completion use:
For `fzf` tab completion use:
eval "$(lua /path/to/z.lua --init bash enhanced once fzf)"
**NOTE**: For wsl-1 users, `lua-filesystem` must be installed:
sudo apt-get install lua-filesystem
To avoid a wsl-1 [defect](https://github.com/microsoft/WSL/issues/5505).
- Zsh:
@@ -85,6 +91,8 @@ z -b foo # cd to the parent directory starting with foo
Options like "enhanced" and "once" can be used after `--init` too. It can also be initialized from "skywind3000/z.lua" with your zsh plugin managers (antigen / oh-my-zsh).
**NOTE**: for wsl-1 users, `lua-filesystem` must be installed.
- Posix Shells:
put something like this in your `.profile`:
@@ -113,21 +121,26 @@ z -b foo # cd to the parent directory starting with foo
put something like this in your `profile.ps1`:
iex ($(lua /path/to/z.lua --init powershell) -join "`n")
Invoke-Expression (& { (lua /path/to/z.lua --init powershell) -join "`n" })
- Windows cmd (with clink):
- copy z.lua and z.cmd to clink's home directory
- 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:
- copy z.lua and z.cmd to cmder/vendor
- Copy z.lua and z.cmd to cmder/vendor
- Add cmder/vendor to `%PATH%`
- Ensure that "lua" can be called in `%PATH%`
- Windows WSL-1:
- Install `lua-filesystem` module.
- Initialize z.lua as in Linux.
## Options

5
z.lua
View File

@@ -4,7 +4,7 @@
-- z.lua - a cd command that learns, by skywind 2018, 2019, 2020
-- Licensed under MIT license.
--
-- Version 1.8.11, Last Modified: 2020/12/31 02:05
-- Version 1.8.12, Last Modified: 2020/12/31 02:05
--
-- * 10x faster than fasd and autojump, 3x faster than z.sh
-- * available for posix shells: bash, zsh, sh, ash, dash, busybox
@@ -51,7 +51,8 @@
-- Power Shell Install:
--
-- * put something like this in your config file:
-- iex ($(lua /path/to/z.lua --init powershell) -join "`n")
-- Invoke-Expression (& {
-- (lua /path/to/z.lua --init powershell) -join "`n" })
--
-- Windows Install (with Clink):
-- * copy z.lua and z.cmd to clink's home directory