Просмотр исходного кода

move various settings into their own .zsh files

Also start setting up for .ssh/config to specify usernames for hosts
cinaeco 13 лет назад
Родитель
Сommit
cda5f20527

+ 19 - 0
ssh/config

@@ -0,0 +1,19 @@
+
+## shortcuts to other machines
+alias murray='ssh weiyi@murray'
+alias nile='ssh weiyi@nile'
+alias niles='ssh weiyi@nile-stage'
+alias orinoco='ssh weiyi@orinoco'
+alias orinocos='ssh weiyi@orinoco-stage'
+alias beni='ssh root@beni'
+alias feni='ssh root@feni'
+alias kwai='ssh weiyi@kwai'
+alias dev5='ssh root@dev5'
+alias danshui='ssh weiyi@danshui'
+alias elrond='ssh weiyi@elrond'
+alias samwise='ssh weiyi@samwise'
+alias blackomelette='ssh cinaeco@10.0.1.20'
+alias pavo='ssh cinaeco@pavo'
+alias ursa='ssh cinaeco@ursa'
+alias fornax='ssh administrator@fornax'
+

+ 12 - 0
zsh/oh-my-zsh-custom/auto-ssh.zsh

@@ -0,0 +1,12 @@
+#
+# Automagic ssh to known hosts.
+# Thanks to:
+# https://github.com/dangerous/dotfiles
+# Works in conjunction with .ssh/config for username@hostname
+#
+local _myhosts
+_myhosts=( ${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*} )
+
+for host in $_myhosts; do
+  alias $host="ssh $host"
+done

+ 3 - 0
zsh/oh-my-zsh-custom/cinaeco.zsh-theme

@@ -50,6 +50,9 @@ function precmd() {
 $fg[cyan][%m]  $fg[yellow]%3~  $(git_prompt_info)'
 }
 
+## Set tab title to hostname
+print -Pn "\e]1;`hostname | cut -d. -f1`\a"
+
 PROMPT='%{$fg[magenta]%}→ %{$reset_color%}'
 RPROMPT='$(vi_mode_prompt_info) %{$fg[cyan]%}%n %{$reset_color%}%T %{$fg[white]%}%h%{$reset_color%}'
 

+ 3 - 23
zsh/oh-my-zsh-custom/dev.zsh

@@ -1,22 +1,6 @@
-## shortcuts to other machines
-alias murray='ssh weiyi@murray'
-alias nile='ssh weiyi@nile'
-alias niles='ssh weiyi@nile-stage'
-alias orinoco='ssh weiyi@orinoco'
-alias orinocos='ssh weiyi@orinoco-stage'
-alias beni='ssh root@beni'
-alias feni='ssh root@feni'
-alias kwai='ssh weiyi@kwai'
-alias dev5='ssh root@dev5'
-alias danshui='ssh weiyi@danshui'
-alias elrond='ssh weiyi@elrond'
-alias samwise='ssh weiyi@samwise'
-alias blackomelette='ssh cinaeco@10.0.1.20'
-alias pavo='ssh cinaeco@pavo'
-alias ursa='ssh cinaeco@ursa'
-alias fornax='ssh administrator@fornax'
-
-## shortcuts for development
+#
+# shortcuts for development
+#
 alias authlog='tail -F /jails/alcatraz/usr/local/www-conf/logs/auth-phplog'
 alias deliverylog='tail -F /jails/alcatraz/usr/local/www-conf/logs/delivery-phplog'
 alias oarslog='tail -F /jails/alcatraz/usr/local/www-conf/logs/oars-phplog'
@@ -28,10 +12,6 @@ alias cds='cd /jails/alcatraz/usr/local/www/schools'
 alias migrate='li3 migration db:migrate'
 alias sqlo='mysql -u oars -p'
 
-## proxy setup
-alias proxy='export http_proxy=http://192.168.1.248:3128;export HTTP_PROXY=$http_proxy;export https_proxy=$http_proxy;export HTTPS_PROXY=$http_proxy;export ftp_proxy=$http_proxy;export FTP_PROXY=$http_proxy;'
-alias noproxy='export http_proxy='';export HTTP_PROXY=$http_proxy;export https_proxy=$http_proxy;export HTTPS_PROXY=$http_proxy;export ftp_proxy=$http_proxy;export FTP_PROXY=$http_proxy;'
-
 ## shortcuts for Jails setup
 #alias guantanamo-start='env -i /usr/sbin/chroot /jails/guantanamo /usr/local/apache2/bin/httpd -k start'
 #alias guantanamo-graceful='env -i /usr/sbin/chroot /jails/guantanamo /usr/local/apache2/bin/httpd -k graceful'

+ 12 - 0
zsh/oh-my-zsh-custom/proxy.zsh

@@ -0,0 +1,12 @@
+#
+# Proxy settings
+# Thanks to:
+# https://github.com/dangerous/dotfiles
+#
+alias proxy='export http_proxy=http://192.168.1.248:3128;export HTTP_PROXY=$http_proxy;export https_proxy=$http_proxy;export HTTPS_PROXY=$http_proxy;export ftp_proxy=$http_proxy;export FTP_PROXY=$http_proxy;'
+alias noproxy='export http_proxy='';export HTTP_PROXY=$http_proxy;export https_proxy=$http_proxy;export HTTPS_PROXY=$http_proxy;export ftp_proxy=$http_proxy;export FTP_PROXY=$http_proxy;'
+
+# run only if I am at work
+if [ `ifconfig | grep -P '(10.10.0.|192.168.2)' | wc -l` = 1 ]; then
+  proxy
+fi

+ 1 - 2
zsh/zshrc

@@ -22,7 +22,7 @@ DISABLE_AUTO_UPDATE="true"
 # DISABLE_LS_COLORS="true"
 
 # Uncomment following line if you want to disable autosetting terminal title.
-# DISABLE_AUTO_TITLE="true"
+DISABLE_AUTO_TITLE="true"
 
 # Uncomment following line if you want red dots to be displayed while waiting for completion
 # COMPLETION_WAITING_DOTS="true"
@@ -129,4 +129,3 @@ fi
 if [[ -r ~/.zshlocal ]]; then
     source ~/.zshlocal
 fi
-print -Pn "\e]1;`hostname | cut -d. -f1`\a"