From 2d754e4f3ddd1955fc6f80dfc3cec79616b77c2d Mon Sep 17 00:00:00 2001 From: Bruno Miguel Silva Date: Thu, 9 Jan 2014 17:22:08 +0000 Subject: [PATCH 1/5] changed LANG env var --- bash/bash_profile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/bash_profile b/bash/bash_profile index fc6b398..d4846d0 100644 --- a/bash/bash_profile +++ b/bash/bash_profile @@ -1,7 +1,7 @@ export EDITOR='vi' export WORKON_HOME=$HOME/.virtualenvs export LC_CTYPE="en_US.UTF-8" -export LANG="en_US" +export LANG="en_US.UTF-8" alias tmux='tmux -u' alias t='tmux.py' From 14d536d5830a415485886db83478cdd47f9ba086 Mon Sep 17 00:00:00 2001 From: Bruno Miguel Silva Date: Sun, 12 Jan 2014 23:09:55 +0000 Subject: [PATCH 2/5] fixed bug in finding hostname --- bash/bash_profile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/bash_profile b/bash/bash_profile index d4846d0..0870c41 100644 --- a/bash/bash_profile +++ b/bash/bash_profile @@ -14,7 +14,7 @@ alias ls='ls -G' alias ll='ls -lG' if [[ -r $HOME/.host_nickname ]]; then - HOST_NICKNAME=`cat .host_nickname` + HOST_NICKNAME=`cat ${HOME}/.host_nickname` else HOST_NICKNAME=`hostname -s` fi From 3507d8de47cba7fcfd4f0a4d68e81ceebb40766f Mon Sep 17 00:00:00 2001 From: Bruno Miguel Silva Date: Mon, 13 Jan 2014 12:03:48 +0000 Subject: [PATCH 3/5] In ubuntu use bash_aliases instead --- bash/bash_aliases | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/bash/bash_aliases b/bash/bash_aliases index fac031f..b56e9bc 100644 --- a/bash/bash_aliases +++ b/bash/bash_aliases @@ -1,12 +1,25 @@ -function parse_git_branch { - git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' -} +export EDITOR='vi' +export WORKON_HOME=$HOME/.virtualenvs +export LC_CTYPE="en_US.UTF-8" +export LANG="en_US.UTF-8" -if [ -f $HOME/.srv_name ]; then - SRV_NAME=`cat $HOME/.srv_name` - PS1='\u@\h($SRV_NAME):\W $(parse_git_branch)\n\$ ' +alias tmux='tmux -u' +alias t='tmux.py' +alias reKill='reKill.py' +alias pysmtp='python -m smtpd -n -c DebuggingServer localhost:1025' +alias resetterminal='echo -n -e "\033]0;\007"' +alias gitpretty="git log --pretty=format:'%h : %Cblue%aN%Creset : %Cred%d%Creset : %s' --graph" + +if [[ -r $HOME/.host_nickname ]]; then + HOST_NICKNAME=`cat ${HOME}/.host_nickname` else - PS1='\u@\h:\W $(parse_git_branch)\n\$ ' + HOST_NICKNAME=`hostname -s` fi -export PS1 +export PS1="\u@${HOST_NICKNAME}:\W \$ " + +if [[ -r $HOME/.${HOST_NICKNAME}_bash_profile ]]; then + source $HOME/.${HOST_NICKNAME}_bash_profile +else + echo "WARNING: Can't find custom bash_profile" +fi From 4968e7d06edc3a11760cc1ab3c2743b8d3460273 Mon Sep 17 00:00:00 2001 From: Bruno Miguel Silva Date: Fri, 14 Feb 2014 18:01:55 +0000 Subject: [PATCH 4/5] Added tabnumbers to vim --- vim/vimrc | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/vim/vimrc b/vim/vimrc index e2b961f..9c2c725 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -146,3 +146,39 @@ if 'VIRTUAL_ENV' in os.environ: activate_this = os.path.join(project_base_dir, 'bin/activate_this.py') execfile(activate_this, dict(__file__=activate_this)) EOF + +" +" Put Tab numbers on tabline +" http://vim.wikia.com/wiki/Show_tab_number_in_your_tab_line +" +if exists("+showtabline") + function MyTabLine() + let s = '' + let t = tabpagenr() + let i = 1 + while i <= tabpagenr('$') + let buflist = tabpagebuflist(i) + let winnr = tabpagewinnr(i) + let s .= '%' . i . 'T' + let s .= (i == t ? '%1*' : '%2') + let s .= ' ' + let s .= i . ')' + "let s .= ' %*' + let s .= (i == t ? ' %*' : ' ') " Added by BMS + let s .= (i == t ? '%#TabLineSel#' : '%#TabLine#') + let file = bufname(buflist[winnr - 1]) + let file = fnamemodify(file, ':p:t') + if file == '' + let file = '[No Name]' + endif + let s .= file + let s .= ' %*' " Added by BMS + let i = i + 1 + endwhile + let s .= '%T%#TabLineFill#%=' + let s .= (tabpagenr('$') > 1 ? '%999XX' : 'X') + return s + endfunction + set stal=2 + set tabline=%!MyTabLine() +endif From adbc2159863aee4d228bf4fe88b48208dbc9cdc5 Mon Sep 17 00:00:00 2001 From: Bruno Miguel Silva Date: Thu, 27 Feb 2014 16:32:34 +0000 Subject: [PATCH 5/5] added scripts dir --- scripts/tmux.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 scripts/tmux.py diff --git a/scripts/tmux.py b/scripts/tmux.py new file mode 100755 index 0000000..b1fffed --- /dev/null +++ b/scripts/tmux.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +import os +import subprocess + +print "TMUX: %s" % os.getenv("TMUX", "") +print "SSH_TTY: %s" % os.getenv("SSH_TTY", "") +print "SSH_AUTH_SOCK: %s" % os.getenv("SSH_AUTH_SOCK", "") +print "HOME: %s" % os.getenv("HOME", "") + +if os.getenv("TMUX") is None: + if os.getenv("SSH_TTY") is not None: + if os.getenv("SSH_AUTH_SOCK") is not None: + sock_file = os.path.join(os.getenv("HOME"), ".wrap_auth_sock") + try: + #always try to remove + os.remove(sock_file) + except OSError: + pass + os.symlink(os.getenv("SSH_AUTH_SOCK"), sock_file) + os.environ['SSH_AUTH_SOCK'] = sock_file + + try: + subprocess.check_call(["tmux", "attach-session", "-t", "sshwrap"]) + except subprocess.CalledProcessError: + print "lets create session" + os.environ['STY'] = "tmux-sshwrap" + os.execlpe("tmux", "tmux", "new-session", "-s", "sshwrap", + os.environ)