Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
5a729f66
Commit
5a729f66
authored
Sep 15, 2018
by
Marc Cornellà
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib: fix history wrapper when passing numbers
If a number is passed without explicitly passing `-l`, it will now behave as if using the history builtin, instead of throwing an error.
parent
315eb773
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
history.zsh
lib/history.zsh
+3
-5
No files found.
lib/history.zsh
View file @
5a729f66
## History wrapper
function
omz_history
{
# Delete the history file if `-c' argument provided.
# This won't affect the `history' command output until the next login.
local
clear list
zparseopts
-E
c
=
clear
l
=
list
if
[[
-n
"
$clear
"
]]
;
then
...
...
@@ -12,9 +11,8 @@ function omz_history {
# if -l provided, run as if calling `fc' directly
builtin fc
"
$@
"
else
# otherwise, call `fc -l 1` to show all available
# history (and pass additional parameters)
builtin fc
"
$@
"
-l
1
# unless a number is provided, show all history events (starting from 1)
[[
${
@[-1]
}
=
*
[
0-9]
*
]]
&&
builtin fc
-l
"
$@
"
||
builtin fc
-l
"
$@
"
1
fi
}
...
...
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