Commit Graph

181 Commits

Author SHA1 Message Date
/dev/mataha 8fe5f48726
Merge 227997e516 into 67ca1bc959 2026-03-25 23:01:27 -04:00
Ajeet D'Souza fb1495b0ad
Handle prompts ending in space (#1189) 2026-03-01 15:32:40 +05:30
Chawye Hsu f07a76e115
pwsh: handling `z ~` and `z` separately (#1161)
* pwsh: handling `z ~` and `z` separately

This patch enables the capability of navigating to the current user's home
directory with `z` when cwd is on a PSDrive that does not have a definition
of the `HOME` location.

Context: The fact that `~` can be counterintuitive on PowerShell, as it's
relative to the cwd, **and its value is defined with a `.Home` property of
cwd's PSProvider\[1]. Not all PSProviders however define this property, leaving
that sometimes you cannot navigate to the undefined `HOME` location with `~`.

To validate this, you can use `Get-PSDrive` to iterate your PSDrives and see
which providers define a `Home` property. On Windows,

```plain
Get-PSDrive C,HKLM | select Name,{$_.Provider.Name},{$_.Provider.Home}

Name $_.Provider.Name $_.Provider.Home
---- ---------------- ----------------
C    FileSystem       C:\Users\<username>
HKLM Registry
```

or on Linux/macOS,

```plain
Get-PSDrive /,Function | select Name,{$_.Provider.Name},{$_.Provider.Home}

Name     $_.Provider.Name $_.Provider.Home
----     ---------------- ----------------
/        FileSystem       /Users/<username>
Function Function
```

When cwd is on a PSDrive without a defined `HOME` location, the original
`Set-Location` alias `cd` in PowerShell handles this case by falling back
to the user's home directory when no argument is provided\[2], and when `~`
is explicitly provided, it results in an error.

```plain
PS C:\> Set-Location Function:
PS Function:\> cd ~
Home location for this provider is not set. To set the home location, call "(get-psprovider 'Function').Home = 'path'".
PS Function:\> cd
PS C:\Users\<username>\>
```

This patch implements the same behavior for `z` by handling `z ~` and `z` separately.

\[1]: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_providers
\[2]: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/set-location?#-path

Signed-off-by: Chawye Hsu <su+git@chawyehsu.com>

* No explicit case needed for ~

---------

Signed-off-by: Chawye Hsu <su+git@chawyehsu.com>
Co-authored-by: Ajeet D'Souza <98ajeet@gmail.com>
2026-03-01 12:43:50 +05:30
mataha 227997e516 Switch code page to UTF-8 in a separate command 2026-02-17 21:36:34 +01:00
mataha 31f6595f54 Point `cmd.exe` users to the registry key 2026-02-17 21:36:34 +01:00
mataha e7ff4382b7 Handle UTF-8 output correctly in `cmd.exe` 2026-02-17 21:36:34 +01:00
mataha 28bddb9389 Switch to labeled comments 2026-02-17 21:36:34 +01:00
mataha e79df688ee Fix stdin end of input 2026-02-17 21:36:34 +01:00
mataha 9d9d605d50 Make clippy and rustfmt happy 2026-02-17 20:19:18 +01:00
mataha cca937c907 WIP 2026-02-17 20:18:36 +01:00
mataha bb75058ce6 Be consistent when comparing comptime strings 2026-02-17 20:18:36 +01:00
mataha 864f8cad91 WIP 2026-02-17 20:18:33 +01:00
mataha acb9e95e7e Add common shorthands as command aliases 2026-02-17 20:16:52 +01:00
mataha 3883fcd487 Initialize hook only if it's a `pwd` hook 2026-02-17 20:16:52 +01:00
mataha 435a62266a Tighten the check for command-line context 2026-02-17 20:16:52 +01:00
mataha 8d61617c6a Quit if Command Extensions are disabled 2026-02-17 20:16:52 +01:00
mataha 1ee0195a0d Sanitize trailing backslash when in root directory 2026-02-17 20:16:52 +01:00
mataha e7dba81869 Quote external command macros directly 2026-02-17 20:16:52 +01:00
mataha 3f2283c502 Fall back to being `cd` if directory exists 2026-02-17 20:16:52 +01:00
mataha 6f3d0a24b8 Don't hardcode command names 2026-02-17 20:16:52 +01:00
mataha 0d0f557580 Make the Command Extensions requirement more clear 2026-02-17 20:16:52 +01:00
mataha ae74cea6ac Don't run with Command Extensions disabled 2026-02-17 20:16:52 +01:00
mataha ed35b884db Make sure `OLDPWD` is not set 2026-02-17 20:16:52 +01:00
mataha c21e82ac49 Fix whitespace suppression in `cmd.exe` template 2026-02-17 20:16:52 +01:00
mataha 23e4e78431 Disable delayed expansion in `cmd init` 2026-02-17 20:16:52 +01:00
mataha 06c19d8d31 Make percent characters work in all contexts 2026-02-17 20:16:52 +01:00
mataha 85b2596b29 Add support for `cmd.exe` (experimental) 2026-02-17 20:16:01 +01:00
Andrew Bradley d7458b756e
Support symlinks on Windows (#1149) 2026-02-02 11:07:36 +05:30
Simon Olofsson 324b0d35e7
fish: clear existing completions before defining aliases (#1165)
Fish ships with built-in completions for common commands like `j` (share/completions/j.fish for autojump). These override zoxide's completions when using `--cmd j`. Clear them before defining aliases.
2026-01-30 16:54:27 +05:30
Ajeet D'Souza d304543d2e
Remove uses of builtin from POSIX (#1146) 2025-11-18 20:14:28 +05:30
Mark Derricutt ecf72c9cfd
Update zoxide to support Fish 4.1.x (#1046) 2025-11-18 14:49:41 +05:30
Ajeet D'Souza 0c55cb9621
Avoid wrecking pipestatus in Bash (#1141) 2025-11-18 06:32:03 +05:30
Sandro 5fde31383f
Don't downcast PROMPT_COMMAND (#1036) 2025-11-02 04:43:18 +05:30
Tony 6324b4e347
Add support for multi digits dirstack entry (e.g. +12). (#1080) 2025-06-17 15:27:46 +05:30
Steven Xu db14bdc2ff
nushell: use sigil operator (#1070) 2025-05-31 04:53:54 +05:30
smolsbs ee8bbe57d3
Fixed the arg[0] argument position (#1056) 2025-05-16 03:19:09 -07:00
Koichi Murase 9c0dcf12f3
Run the cd command after "cd ... <space><tab>" in Bash integration (#1055) 2025-05-14 08:38:54 +05:30
benz 628f8542a0
Fixes #995: Wildcard expansion for PowerShell (#1001)
Co-authored-by: Ajeet D'Souza <98ajeet@gmail.com>
2025-05-13 17:48:55 +05:30
Ajeet D'Souza 8e14038811 Fix lints 2025-05-12 06:22:54 -07:00
Ajeet D'Souza 1d08fe2b84 Add doctor for POSIX shells 2025-05-11 23:24:35 -07:00
Ajeet D'Souza 36537410cd Doctor should handle PROMPT_COMMAND being an array 2025-05-10 23:41:55 -07:00
Ajeet D'Souza 306d7ae143 Fix shellcheck lint 2025-05-10 21:52:39 -07:00
Ajeet D'Souza 9768e645c7 Remove unneeded quotes 2025-05-10 11:27:02 -07:00
Ajeet D'Souza 8f0288b0c9 Check if zoxide is running under VS Code 2025-05-10 10:22:20 -07:00
Koichi Murase 6ec0436859
Add fixes to Bash integration (#1048) 2025-05-10 13:21:47 +05:30
Ajeet D'Souza 095b270fea csh -> tcsh 2025-05-06 00:26:07 -07:00
Ajeet D'Souza 09aa626a86
Add support for csh (#1047) 2025-05-06 11:28:54 +05:30
Lisa FS 7691d7e9a5
nushell: fix jumping to symlinks that are not in the database (#1032)
Expand path before checking for its type. This solves the issue of ignoring symlinks.
2025-04-13 08:46:27 -05:00
Brian 6902d375c5
powershell: Ignore errors from `__zoxide_hooked` (#1038) 2025-04-10 15:46:57 +05:30
Ajeet D'Souza 6679619c00 bash: rewrite prompt after space-tab 2025-03-19 06:01:14 +05:30