Created
July 12, 2014 02:32
-
-
Save t17a/ce001314c47a40471131 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function zshaddhistory() { # {{{ | |
# http://mollifier.hatenablog.com/entry/20090728/p1 | |
local line cmd | |
line=${1%%$'\n'} | |
cmd=${line%% *} | |
# Add command to history if it meets the following conditions | |
[[ ${#line} -ge 5 | |
&& ${cmd} != (l|l[sal]) | |
&& ${cmd} != (c|cd) | |
&& ${cmd} != (m|man) | |
&& ${cmd} != (r[mr]) | |
]] | |
} # }}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for sharing, this is very useful.