-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzshrc_functions
More file actions
executable file
·70 lines (56 loc) · 1.71 KB
/
zshrc_functions
File metadata and controls
executable file
·70 lines (56 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
###################################################################################
# function to try .zsh_functions, do an ls -F and go in the directory blabla bla
###################################################################################
function cl() {
DIR="$*";
# if no DIR given, go home
if [ $# -lt 1 ]; then
DIR=$HOME;
fi;
builtin cd "${DIR}" && \
# use your preferred ls command
ls -F --color=auto
}
# function to copy files zsh in ~/Document/projetGit/scriptPerso
function safe_zsh() {
DIR=$HOME;
}
######################################################################################
# m'obliger a utiliser les alias
######################################################################################
function check-alias-and-accept {
if [ $BUFFER ]; then
ALIAS=`alias -L | grep -e "=[\'\"]\?${BUFFER}[\'\"]\?$"`
if [ $ALIAS ]; then
echo
echo "You have this alias:"
echo
echo $ALIAS
echo
echo "Use it!"
zle kill-whole-line
zle reset-prompt
else
zle accept-line
fi
else
zle accept-line
fi
}
zle -N check-alias-and-accept
bindkey '^J' check-alias-and-accept
bindkey '^M' check-alias-and-accept
######################################################################################
# pour ne pas oublier un alias explicite, affiche l'entree juste apres l'alias
######################################################################################
preexec_functions=()
function expand_aliases {
input_command=$1
expanded_command=$2
if [ $input_command != $expanded_command ]; then
print -nP $PROMPT
echo $expanded_command
fi
}
preexec_functions+=expand_aliases