-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathUNIX_shell.vch
executable file
·106 lines (77 loc) · 3.5 KB
/
UNIX_shell.vch
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
include "machines.vch";
PLACE(before, after) := $before $after {left_ Len($after) };
SHELL(pathname) := Replace($pathname, " ", "\ ");
##
## miscellaneous Shell commands
##
<common_actions> := (edit="vim" | source="source");
<common_actions> (vim | bash) config = "$1 ~/.$2rc"{Enter};
history = {Ctrl+r};
break = {Ctrl+c};
break end of file = {Ctrl+d};
escape process = {esc}{ctrl+z};
(foreground="fg" | background="bg") process =
$1{enter};
double dash = "--";
Bash Tag File Update =
"ctags -R --c++-kinds=+p --fields=+iaS --extra=+q ."{Enter};
make tar = "tar -cf ";
extract tar = "tar -xf ";
confirm force remove file = "rm -r";
back directory 1..9 = Repeat($1, ../) {Enter};
change ownership = "chown -R tan:tan ";
change (permissions | mode) = "chmod -R 755 ";
home root = "~/";
enter list = "{enter}ls{enter}";
change absolute directory = "cd -P .{enter}";
present working directory = "pwd";
# TODO: seems ridiculous to do it like this, find a better way
(vim=vimdiff|normal=diff|normal brief="diff -q") diff = "$1 \{,\}{Left_2}{Del}{Left_3}{Del}{Right}";
cygwin password = "^2A";
(sub|SVM=svn) (checkout|diff|commit|update|remove|checkout bug=co -b|log=log_grep|start bug=start_bug|status) = "$1 $2 ";
start environment 1..5 = "source \$ENV$1/bin/activate{enter}";
stop environment = "deactivate{enter}";
Jango export (test|development=dev)settings = "export DJANGO_SETTINGS_MODULE=home_test.settings.$1_settings";
Django (shell|database shell=dbshell|sink=syncdb|sink input="syncdb < input"|run="runserver 127.0.0.1:8100"|dump=dumpdata) = "python manage.py $1{enter}";
pip (freeze|completion|install|list|help) = "pip $1";
pip option (bash|upgrade|outdated|local|no index="no-index"|find links="find-links") = " --$1 ";
network stats = "netstat -nl{enter}";
##
## Directory information/listing commands
##
<show> := ( show = ""
| show some of = " | head"
| show a lot of = " | head -n 50"
| local show = {ctrl+a}l{ctrl+e} # for use with sftp
);
<desc> := (long = -l | full = -A | recent = -t | recursive = -R | human = -h);
<show> [<desc> [<desc> [<desc>]]] directory =
ls When($2," $2") When($3," $3") When($4," $4") $1{enter};
<show> <desc> directory = ls $2 $1{enter};
<show> directory = ls $1{enter};
show disk space = "df -h .{enter}"; # Empty();
<usage> := (usage="-h" | usage kilobytes="" | usage megabytes="-m");
show disk <usage> = "du $1 -s -- ""`ls --color=none -A`"" .{enter}"; # Empty();
##
## Macros for (s)ftp/ssh:
##
# make ssh connection to given machine, user pair:
secure login [to] <machine> = "ssh -X $1{enter}";
S F T P <machine> = "sftp $1{enter}";
# see local show ... directory above (= lls ...)
multiple get = "mget ";
local change directory = "lcd ";
local working directory = lpwd{enter};
##
## Macros for scp:
##
# add -p to preserve times, permissions:
<scp> := ( secure copy = "scp" | secure recursive copy = "scp -r"
| recursive secure copy = "scp -r"
| secure clone = "scp -p -r");
CopyFrom(scp, origin) := PLACE("$scp " SHELL($origin), " .");
CopyTo (scp, target) := PLACE("$scp ", " " SHELL($target));
#<scp> from <machine> [/ <UNIX> [/ <COM>]] =
#CopyFrom($1,"$2:" When($3,$3/) When($4,$4/));
#<scp> to <machine> [/ <UNIX> [/ <COM>]] =
#CopyTo ($1,"$2:" WHEN3($3,$3/,~/) When($4,$4/));