-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: No such shell function `__zsh_simple_abbreviations::expand' (#32)
Closes #12 Fixing the issue where if you never set or unset an abbreviation then you would get the error "No such shell function `__zsh_simple_abbreviations::expand'" if you used a space. Because the function was bound to the key but as the main function is autoloaded the function `__zsh_simple_abbreviations::expand' is never loaded.
- Loading branch information
1 parent
9326ef1
commit 054a5dc
Showing
6 changed files
with
57 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import pexpect | ||
import os | ||
|
||
|
||
full_path = os.path.realpath(__file__) | ||
test_directory = os.path.dirname(full_path) | ||
|
||
zsh = pexpect.spawnu('/usr/bin/env zsh --no-rcs', | ||
env=os.environ | {'PROMPT': '>'}) | ||
|
||
# Ready to take a command. | ||
zsh.expect('>') | ||
# Source the plugin and do not set an abbreviation. | ||
zsh.sendline( | ||
f"source \"{test_directory}/../zsh-simple-abbreviations.zsh\"") | ||
|
||
# Ready to take a command. | ||
zsh.expect('>') | ||
before = zsh.after | ||
# Run any command. | ||
zsh.sendline("echo hello ") | ||
|
||
# Ready to take a command. | ||
zsh.expect('>') | ||
output = (before + zsh.before) | ||
# Assert the expand abbreviation function is not an issue. | ||
assert "zsh: command not found: echohello" not in output | ||
assert "\nhello" in output | ||
|
||
# Done with test close Zsh. | ||
zsh.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env zsh | ||
|
||
emulate -L zsh -o extended_glob | ||
local MATCH | ||
# Can't use KEY_REGEX, but should match it. | ||
LBUFFER=${LBUFFER%%(#m)[-_a-zA-Z0-9]#} | ||
# If matches set abbreviation add that else just add what we attempted to match on. | ||
LBUFFER+=${${ZSH_SIMPLE_ABBREVIATIONS[$MATCH]}:-$MATCH} | ||
# Causes the syntax highlighting. | ||
zle self-insert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env zsh | ||
|
||
# Adds a space to the end of the command buffer. | ||
LBUFFER+=" " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters