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
82856bfb
Unverified
Commit
82856bfb
authored
Oct 11, 2020
by
VectorW
Committed by
GitHub
Oct 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
globalias: allow filtering values not to be expanded (#9331)
parent
fb80eb8e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
README.md
plugins/globalias/README.md
+18
-1
globalias.plugin.zsh
plugins/globalias/globalias.plugin.zsh
+4
-2
No files found.
plugins/globalias/README.md
View file @
82856bfb
...
@@ -17,6 +17,9 @@ Then just press `SPACE` to trigger the expansion of a command you've written.
...
@@ -17,6 +17,9 @@ Then just press `SPACE` to trigger the expansion of a command you've written.
If you only want to insert a space without expanding the command line, press
If you only want to insert a space without expanding the command line, press
`CTRL`
+
`SPACE`
.
`CTRL`
+
`SPACE`
.
if you would like to filter out any values from expanding set
`GLOBALIAS_FILTER_VALUES`
to
an array of said values. See
[
Filtered values
](
#filtered-values
)
.
## Examples
## Examples
#### Glob expressions
#### Glob expressions
...
@@ -37,7 +40,6 @@ $ ls folder/file.json anotherfolder/another.json
...
@@ -37,7 +40,6 @@ $ ls folder/file.json anotherfolder/another.json
$ mkdir "`date -R`"
$ mkdir "`date -R`"
# expands to
# expands to
$ mkdir Tue,\ 04\ Oct\ 2016\ 13:54:03\ +0300
$ mkdir Tue,\ 04\ Oct\ 2016\ 13:54:03\ +0300
```
```
#### Aliases
#### Aliases
...
@@ -60,3 +62,18 @@ $ S<space>
...
@@ -60,3 +62,18 @@ $ S<space>
# expands to:
# expands to:
$ sudo systemctl
$ sudo systemctl
```
```
#### Filtered values
```
# .zshrc
alias l='ls -lh'
alias la='ls --color=auto -lah'
GLOBALIAS_FILTER_VALUES=(l)
$ l<space>
# does not expand
$ la<space>
# expands to:
$ ls --color=auto -lah
```
plugins/globalias/globalias.plugin.zsh
View file @
82856bfb
globalias
()
{
globalias
()
{
zle _expand_alias
if
[[
$GLOBALIAS_FILTER_VALUES
[(
Ie
)
$LBUFFER
]
-eq
0
]]
;
then
zle expand-word
zle _expand_alias
zle expand-word
fi
zle self-insert
zle self-insert
}
}
zle
-N
globalias
zle
-N
globalias
...
...
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