Initial commit

This commit is contained in:
Chris Sexton 2015-03-05 11:54:46 -05:00
commit 327084bf27
3 changed files with 983 additions and 0 deletions

1
AUTHORS Executable file
View File

@ -0,0 +1 @@
Chris Sexton <chris.sexton at gmail dot com>

14
LICENSE Executable file
View File

@ -0,0 +1,14 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

968
setup.sh Normal file
View File

@ -0,0 +1,968 @@
#!/bin/bash -e
CMD="$0"
[ "$NAME" ] || NAME=
[ "$EMAIL" ] || EMAIL=
[ "$IRCSERVER" ] || IRCSERVER=irc.freenode.net
[ "$IRCPORT" ] || IRCPORT=6667
[ "$IRCNICK" ] || IRCNICK=coward
[ "$IRCPASS" ] || IRCPASS=
die() { echo "$1" 1>&2 && show_help && [ "$2" ] && [ "$2" -ge 0 ] && exit "$2" || exit 1; }
# Show help function to be used below
show_help() {
awk 'NR>1{print} /^(###|$)/{exit}' "$CMD"
echo "USAGE: $(basename "$CMD") [arguments]"
echo "ARGS:"
MSG=$(awk '/^NARGS=-1; while/,/^esac; done/' "$CMD" | sed -e 's/^[[:space:]]*/ /' -e 's/|/, /' -e 's/)//' | grep '^ -')
EMSG=$(eval "echo \"$MSG\"")
echo "$EMSG"
}
# Parse command line options (odd formatting to simplify show_help() above)
NARGS=-1; while [ "$#" -ne "$NARGS" ]; do NARGS=$#; case $1 in
# SWITCHES
-h|--help) # This help message
show_help; exit 1; ;;
-n|--name) # Name for git
shift && NAME="$1" && shift; ;;
-e|--email) # Email for git
shift && EMAIL="$1" && shift; ;;
-s|--server) # server for irssi
shift && IRCSERVER="$1" && shift; ;;
-P|--port) # port for irssi
shift && IRCPORT="$1" && shift; ;;
-N|--nick) # nick for irssi
shift && IRCNICK="$1" && shift; ;;
-p|--password) # password for irssi
shift && IRCPASS="$1" && shift; ;;
esac; done
[ "$NAME" ] || die "You must provide a name!"
[ "$EMAIL" ] || die "You must provide an email!"
fn_distro(){
if [ -f /etc/lsb-release ]; then
os=$(lsb_release -s -d)
elif [ -f /etc/debian_version ]; then
os="Debian $(cat /etc/debian_version)"
elif [ -f /etc/redhat-release ]; then
os=$(cat /etc/redhat-release)
else
os="$(uname -s) $(uname -r)"
fi
}
UNAMESTR=$(uname)
if [[ "$UNAMESTR" == 'Linux' ]]; then
fn_distro
if [[ "$os" == Ubuntu* ]]; then
sudo apt-get install -y build-essential git irssi vim-nox zsh tmux
fi
elif [[ "$UNAMESTR" == 'Darwin' ]]; then
# Probably need to set up brew and brew install some stuff here...
true
fi
read -r -d '' GITIGNOREGLOBAL <<'GITIGNOREGLOBAL'
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
# It's better to unpack these files and commit the raw source because
# git has its own built in compression methods.
*.7z
*.jar
*.rar
*.zip
*.gz
*.bzip
*.xz
*.lzma
#packing-only formats
*.iso
*.tar
#package management formats
*.dmg
*.xpi
*.gem
*.egg
*.deb
*.rpm
# Logs and databases #
######################
*.log
*.sql
*.sqlite
# OS generated files #
######################
.DS_Store
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Windows image file caches
Thumbs.db
# Folder config file
Desktop.ini
# NPM
.npmignore
# Other stuff
*~
.*.sw?
.tern-port
e6Views
vaViews
todo.txt
GITIGNOREGLOBAL
echo "$GITIGNOREGLOBAL" > "$HOME"/.gitignore_global
read -r -d '' GITCONFIG <<'GITCONFIG'
[user]
name = %NAME%
email = %EMAIL%
[core]
autocrlf = input
whitespace = fix,space-before-tab,tab-in-indent,trailing-space
excludesfile = /Users/csexton/.gitignore_global
[alias]
st = status
co = checkout
di = diff
wc = whatchanged
br = branch
lg = "log --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
unstage = "reset HEAD --"
spencer = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cD) %C(bold blue)<%an>%Creset' --author Spencer --since
since = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cD) %C(bold blue)<%an>%Creset' --author Chris --since
standup = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cD) %C(bold blue)<%an>%Creset' --author Chris --since yesterday
yolo = "!git commit -am 'DEAL WITH IT' && git push -f"
ribbon = tag --force _ribbon origin/master
ketchup = log --patch --reverse --topo-order --first-parent -m _ribbon..origin/master
mergedown = merge --no-ff --log
g = grep --break --heading --line-number
check = "!git g '// todo'; git g '// fix'; git g '// review'; git g 'debugger';"
incoming = "!git remote update -p; git log ..@{u}"
outgoing = log @{u}..
[branch "master"]
remote = origin
merge = refs/heads/master
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[merge]
log = true
[url "git@github.com:"]
insteadOf = "gh:"
pushInsteadOf = "github:"
pushInsteadOf = "git://github.com/"
[url "git://github.com/"]
insteadOf = "github:"
[url "git@gist.github.com:"]
insteadOf = "gst:"
pushInsteadOf = "gist:"
pushInsteadOf = "git://gist.github.com/"
[url "git://gist.github.com/"]
insteadOf = "gist:"
[push]
default = simple
[credential]
helper = osxkeychain
GITCONFIG
echo "$GITCONFIG" | sed -e "s/%NAME%/$NAME/" | sed -e "s/%EMAIL%/$EMAIL/" > "$HOME"/.gitconfig
read -r -d '' TMUXCONF <<'TMUXCONF'
# fix colors
set -g default-terminal "screen-256color"
# Arrow movement: nice
bind -n S-down new-window
bind -n S-left prev
bind -n S-right next
bind -n C-S-left swap-pane -U
bind -n C-S-right swap-pane -D
bind -r [ swap-window -t -1
bind -r ] swap-window -t +1
bind r source-file ~/.tmux.conf \; display-message " Config reloaded."
bind R source-file ~/.tmux.conf \; display-message " Config reloaded."
# All sutff for a status bar
set-option -g status on
set-option -g status-interval 2
set-option -g status-utf8 on
set-option -g status-justify "centre"
set-option -g status-left-length 60
set-option -g status-right-length 90
set -g status-bg black
set -g status-fg white
set -g status-left "#H: #T"
set -g status-right "%H:%M %d-%h-%Y"
set -g window-status-format "#I:#W"
set -g window-status-current-format "|#I:#W|"
set -g status-interval 1
set -g status-justify left # align window list
# default statusbar colors
set -g status-fg white
set -g status-bg default
# default window title colors
set-window-option -g window-status-fg black
set-window-option -g window-status-bg default
set-window-option -g window-status-attr dim
# active window title colors
set-window-option -g window-status-current-fg white
set-window-option -g window-status-current-bg default
set-window-option -g window-status-current-attr bold
# command/message line colors
set -g message-fg white
set -g message-bg black
set -g message-attr bright
# Fix window size on new connections
set -g aggressive-resize on
# resize
unbind Left
unbind Right
unbind Down
unbind Up
bind -r Left resize-pane -L 2
bind -r Right resize-pane -R 2
bind -r Down resize-pane -D 2
bind -r Up resize-pane -U 2
# Toggle mouse on with ^B m
# Useful for cut/paste interop
bind m \
set -g mouse-resize-pane on \;\
set -g mouse-select-pane on \;\
set -g mouse-select-window on \;\
set -g mode-mouse on \;\
display 'Mouse: ON'
bind C-v paste-buffer
# Toggle mouse off with ^B M
bind M \
set -g mouse-resize-pane off \;\
set -g mouse-select-pane off \;\
set -g mouse-select-window off \;\
set -g mode-mouse off \;\
display 'Mouse: OFF'
set-window-option -g mode-keys vi
unbind T
unbind N
bind -r T clock-mode
bind -r N next-window
# Dvorak vs qwerty vi keys
unbind h
unbind t
unbind d
unbind n
bind -r h select-pane -U
bind -r t select-pane -D
bind -r d select-pane -L
bind -r n select-pane -R
# I use ^b^A to switch panes quickly
unbind ^A
bind ^A select-pane -t :.+
bind ^O select-pane -t :.-
# Fix scrolling?
#set -g terminal-overrides 'xterm*:smcup@:rmcup@'
set -g history-limit 10000
# Clear terminal scrollback on ^k
bind -n C-k send-keys -R \; clear-history\; send-keys C-m
# Easy splits
bind-key | split-window -h
bind-key \ split-window -h
bind-key - split-window -v
bind-key k kill-pane
bind-key K kill-window
#set-option -g default-command "reattach-to-user-namespace -l zsh"
##CLIPBOARD selection integration
##Requires prefix key before the command key
#Copy tmux paste buffer to CLIPBOARD
#bind C-c run "tmux show-buffer | pbcopy"
#Copy CLIPBOARD to tmux paste buffer and paste tmux paste buffer
#bind C-v run "tmux set-buffer -- \"$(pbpaste)\"; tmux paste-buffer"
# Nested tmux support
bind-key b send-prefix
# Multiple server support
bind s set -g synchronize-panes
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
bind-key -t vi-copy 'd' cursor-left
bind-key -t vi-copy 'h' cursor-down
bind-key -t vi-copy 't' cursor-up
bind-key -t vi-copy 'n' cursor-right
bind-key -t vi-copy 'l' search-again
# Move panes between windows
bind -r < join-pane -t -1.0
bind -r > join-pane -t +1.0
# Reminder: ^b ! breaks panes out
TMUXCONF
echo "$TMUXCONF" > "$HOME"/.tmux.conf
read -r -d '' VIMRC <<'VIMRC'
set nocompatible " be iMproved
let iCanHazPlugged=1
let vim_plug_file=expand("~/.vim/autoload/plug.vim")
if !filereadable(vim_plug_file)
echo "Installing vim-plug"
echo ""
silent !mkdir -p ~/.vim/autoload
silent !curl -fLo ~/.vim/autoload/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
let iCanHazPlugged=0
endif
call plug#begin()
" My Plugs here:
"
" original repos on github
Plug 'majutsushi/tagbar'
" Plug 'altercation/vim-colors-solarized'
" Github repos of the user 'vim-scripts'
" => can omit the username part for some plugins
Plug 'Raimondi/delimitMate'
Plug 'ctrlp.vim'
Plug 'ervandew/supertab'
Plug 'fisadev/FixedTaskList.vim'
Plug 'fisadev/vim-ctrlp-cmdpalette'
Plug 'fatih/vim-go'
Plug 'https://github.com/scrooloose/nerdtree.git', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] }
Plug 'https://github.com/tpope/vim-fugitive.git'
Plug 'https://github.com/vim-scripts/LustyJuggler.git'
Plug 'lilydjwg/colorizer'
Plug 'moll/vim-bbye'
Plug 'syntastic'
Plug 'terryma/vim-multiple-cursors'
Plug 'vim-airline'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'leafgarland/typescript-vim'
Plug 'guns/xterm-color-table.vim'
" This one is sort of large, so disabling unless I really need it.
" Plug 'klen/python-mode'
" non github repos
" Plug 'git://git.wincent.com/command-t.git'
" ...
call plug#end()
if iCanHazPlugged == 0
echo "Installing plugs"
echo ""
:PlugUpdate
endif
"====[ Set various behavior preferences ]==================
set tabstop=4
set shiftwidth=4
set softtabstop=4
set noexpandtab
set smartindent
filetype indent off
filetype plugin on
syntax on
set t_Co=256
set background=dark
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set ignorecase " Do case insensitive matching
set smartcase " Do smart case matching
"set incsearch " Incremental search
set autowrite " Automatically save before commands like :next and :make
set hidden " Hide buffers when they are abandoned
set mouse=a " Enable mouse usage (all modes) in terminals
set scrolloff=3
set hls
set browsedir=buffer
colorscheme desert
"====[ Change various key bindings ]=======================
vnoremap < <gv
vnoremap > >gv
nnoremap < <<
nnoremap > >>
set nu
" Dvorak it!
no d h
no h j
no t k
no n l
no j d
no l n
no L N
" Replaces s with the :, I prefer having s around...
" no s :
" no S :
" Added benefits
no - $
no _ ^
no N <C-w><C-w>
no D <C-w>W
no S <C-w><C-r>
no H 20<down>
no T 20<up>
no <Leader>h H
no <Leader>m M
no <Leader>l L
map Q <Nop>
nnoremap <C-u> :redo<cr>
nnoremap <F5> :set paste!<CR>
command! W :w
set backspace=2
set wildchar=<Tab> wildmenu wildmode=full
set wildcharm=<C-Z>
" shush the bell
set noerrorbells
set vb
set t_vb=
set directory^=$HOME/.vim_swap/ "put all swap files together in one place
let mapleader = ","
nmap <silent> <Leader>. :LustyJuggler<CR>
let g:LustyJugglerKeyboardLayout = "dvorak"
nnoremap <silent> <Leader>/ :nohlsearch<CR>
nnoremap <Leader>q :Bdelete!<CR>
"====[ Enable ctrlp settings ]=============================
augroup ctrlp
autocmd!
let g:ctrlp_map='<Leader>p'
let g:ctrlp_working_path_mode=''
let g:ctrlp_cmd = 'CtrlPMixed'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip
let g:ctrlp_user_command="find %s ! -wholename '*/.git/*' ! -wholename '*/node_modules/*' ! -wholename '*/report/*' -type f"
augroup END
"====[ Set syntastic options ]=============================
" Syntastic options
let g:syntastic_check_on_open=1
let g:syntastic_enable_signs=1
let g:syntastic_error_symbol='✗'
let g:syntastic_warning_symbol='⚠'
let g:syntastic_enable_balloons = 1
let g:syntastic_auto_loc_list=2
let g:syntastic_loc_list_height=6
let g:syntastic_cpp_checkers = ['clang_checker -std=c++1y']
let g:syntastic_stl_format = '[%E{Err: %fe #%e}%B{, }%W{Warn: %fw #%w}]'
"====[ Set JavaScript options ]============================
augroup jsopts
autocmd!
autocmd BufNewFile,BufRead *.json set ft=javascript
function! TrimWhiteSpace()
%s/\s\+$//e
endfunction
let g:tlist_javascript_settings = 'javascript;a:array;b:boolean;c:class;f:function;m:method;n:number;o:object;p:property;s:string;v:variable'
au FileType javascript setlocal equalprg=~/local/bin/js-beautify\ -f\ -\ -q\ -t\ -w\ 120\ -b\ \"end-expand\"
au FileType javascript set suffixesadd=.js,.json
au FileType javascript set includeexpr=FindRequire(v:fname)
autocmd FileType javascript autocmd FileWritePre * :call TrimWhiteSpace()
autocmd FileType javascript autocmd FileAppendPre * :call TrimWhiteSpace()
autocmd FileType javascript autocmd FilterWritePre * :call TrimWhiteSpace()
autocmd FileType javascript autocmd BufWritePre * :call TrimWhiteSpace()
let g:syntastic_javascript_checkers = ['jshint']
"let g:syntastic_javascript_jshint_args = "--config ~/.jshintrc"
" Code Folding
au FileType javascript syntax region foldBraces start=/{/ end=/}/ transparent fold keepend extend
au FileType javascript setlocal foldmethod=syntax
au FileType javascript setlocal foldlevel=99
augroup END
"====[ Set golang options ]================================
augroup golang
autocmd!
" autocmd FileType go autocmd BufWritePre <buffer> Fmt
let g:go_disable_autoinstall = 1
let g:go_fmt_command = 'goimports'
augroup END
"====[ Set NERDTree options ]==============================
augroup nerdtree
autocmd!
" Make NERDTree start on startup
"autocmd vimenter * if !argc() | NERDTree | endif
nnoremap <silent> <Leader>d :NERDTreeFind<CR>
nnoremap <C-d> :NERDTreeToggle<CR>
" 'Disable' these, they're obnoxious:
let NERDTreeMapOpenInTab='zzzzzz'
let NERDTreeMapOpenInTabSilent='zzzzzzz'
augroup END
let g:airline_powerline_fonts=1
let g:airline_enable_syntastic=1
"let g:airline_theme='dark'
"====[ Enable relative line numbers ]======================
function! NumberToggle()
if(&relativenumber == 1)
set number
set norelativenumber
else
set number
set relativenumber
endif
endfunc
nnoremap <C-r> :call NumberToggle()<cr>
"====[ Make the 81st column stand out ]====================
" EITHER the entire 81st column, full-screen...
"highlight ColorColumn ctermbg=magenta
"set colorcolumn=81
" OR ELSE just the 81st column of wide lines...
highlight ColorColumn ctermbg=magenta
call matchadd('ColorColumn', '\%81v', 100)
" OR ELSE on April Fools day...
"highlight ColorColumn ctermbg=red ctermfg=blue
"exec 'set colorcolumn=' . join(range(2,80,3), ',')
"====[ Fix listchars ]====================================
exec "set listchars=tab:\uBB\uBB,trail:\uB7,nbsp:~"
nnoremap <F6> :set list!<CR>
"nnoremap <C-l> :set list!<CR>
"====[ Enable dragging ]==================================
vmap <expr> <LEFT> DVB_Drag('left')
vmap <expr> <RIGHT> DVB_Drag('right')
vmap <expr> <UP> DVB_Drag('up')
vmap <expr> <DOWN> DVB_Drag('down')
vmap <expr> D DVB_Duplicate()
"====[ Python settings ]==================================
let g:pymode_indent = 0
let g:pymode_rope = 0
let g:pymode_folding = 0
let g:pymode_lint_ignore = "W191,E251,E203,E221,E126,E128"
let NERDTreeIgnore=['.pyc$']
let g:pymode_doc = 0
au FileType python set noexpandtab
au FileType python set tabstop=4
"====[ General Text Editing settings ]====================
au BufNewFile,BufRead *.md set filetype=markdown
command! Check new|0read !check
"====[ Supertab settings ]================================
let g:SuperTabDefaultCompletionType = "context"
"====[ Mulitple Cursors Settings ]========================
let g:multi_cursor_next_key='<C-n>'
"====[ Task List Settings ]===============================
map <leader>t :TaskList<CR>
"====[ Indent Guides ]====================================
let g:indent_guides_guide_size = 1
autocmd VimEnter * :IndentGuidesEnable
let g:indent_guides_auto_colors = 0
hi IndentGuidesOdd ctermbg=0
hi IndentGuidesEven ctermbg=235
nnoremap <C-l> :IndentGuidesToggle<CR>
"====[ TypeScript ]=======================================
autocmd BufNewFile,BufRead *.ts set ft=typescript
let g:typescript_compiler_options = " -t ES5 -m commonjs"
let g:syntastic_typescript_tsc_args = "-t ES5 -m commonjs"
VIMRC
echo "$VIMRC" > "$HOME"/.vimrc
if [[ ! -d ~/.oh-my-zsh ]]; then
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
fi
if [[ ! "$SHELL" =~ .*zsh ]]; then
chsh -s "$(which zsh)"
fi
read -r -d '' ZSHRC <<'ZSHRC'
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="geoffgarside"
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"
# Comment this out to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"
# Uncomment to change how many often would you like to wait before auto-updates occur? (in days)
# export UPDATE_ZSH_DAYS=13
# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"
# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment following line if you want to disable command autocorrection
DISABLE_CORRECTION="true"
# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git archlinux fasd golang mercurial node npm screen ssh-agent sublime systemd vundle)
source $ZSH/oh-my-zsh.sh
# Customize to your needs...
export PATH=$PATH:$HOME/bin:$HOME/go/bin:/usr/local/games:/usr/local/sbin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/qt4/bin:$HOME/bin:$HOME/src/go/bin
alias aoeu='setxkbmap us'
alias asdf='setxkbmap dvorak'
alias grep='grep --color --exclude-dir=.svn --exclude-dir=node_modules'
alias egrep='egrep --color --exclude-dir=.svn --exclude-dir=node_modules'
alias vi='vim'
alias ll='ls -al'
alias l='ls -Cf'
alias h='fasd_cd -d'
calc(){ awk "BEGIN{ print $* }" ;}
GREP_OPTIONS='-D skip --binary-files=without-match --ignore-case'
export LESS='RFiX'
export PAGER="less -R -FiX"
alias subo='sublime -n'
export EDITOR=vim
alias asshole='sudo $(fc -l -n -1)'
export GOPATH=~/
setopt interactivecomments
unsetopt beep
bindkey '^[#' pound-insert
if [ -f $HOME/.zshlc ]
then
source $HOME/.zshlc
fi
ZSHRC
echo "$ZSHRC" > "$HOME"/.zshrc
mkdir -p ~/bin
read -r -d '' TMUXSH <<'TMUXSH'
#!/bin/bash
#
# Modified TMUX start script from:
# http://forums.gentoo.org/viewtopic-t-836006-start-0.html
#
# Store it to `~/bin/tmx` and issue `chmod +x`.
#
# Works because bash automatically trims by assigning to variables and by
# passing arguments
trim() { echo $1; }
base_session="$1"
if [[ -z "$1" ]]; then
base_session="default"
fi
# Only because I often issue `ls` to this script by accident
if [[ "$1" == "ls" ]]; then
tmux ls
exit
fi
# This actually works without the trim() on all systems except OSX
tmux_nb=$(trim `tmux ls | grep "^$base_session" | wc -l`)
if [[ "$tmux_nb" == "0" ]]; then
echo "Launching tmux base session $base_session ..."
tmux new-session -s $base_session
else
# Make sure we are not already in a tmux session
if [[ -z "$TMUX" ]]; then
echo "Launching copy of base session $base_session ..."
# Session is is date and time to prevent conflict
session_id=`date +%Y%m%d%H%M%S`
# Create a new session (without attaching it) and link to base session
# to share windows
tmux new-session -d -t $base_session -s $session_id
if [[ "$2" == "1" ]]; then
# Create a new window in that session
tmux new-window
fi
# Attach to the new session & kill it once orphaned
tmux attach-session -t $session_id \; set-option destroy-unattached
fi
fi
TMUXSH
echo "$TMUXSH" >~/bin/tmux.sh
mkdir -p ~/.irssi
read -r -d '' IRSSI <<'IRSSI'
servers = (
{
address = "%SERVER%";
chatnet = "net";
port = "%PORT%";
password = "%PASSWORD%";
use_ssl = "yes";
ssl_verify = "no";
autoconnect = "yes";
}
);
chatnets = {
net = { type = "IRC"; };
};
channels = (
);
aliases = {
J = "join";
LEAVE = "part";
W = "who";
Q = "QUERY";
};
statusbar = {
# formats:
# when using {templates}, the template is shown only if it's argument isn't
# empty unless no argument is given. for example {sb} is printed always,
# but {sb $T} is printed only if $T isn't empty.
items = {
# start/end text in statusbars
barstart = "{sbstart}";
barend = "{sbend}";
topicbarstart = "{topicsbstart}";
topicbarend = "{topicsbend}";
# treated "normally", you could change the time/user name to whatever
time = "{sb $Z}";
user = "{sb {sbnickmode $cumode}$N{sbmode $usermode}{sbaway $A}}";
# treated specially .. window is printed with non-empty windows,
# window_empty is printed with empty windows
window = "{sb $winref:$tag/$itemname{sbmode $M}}";
window_empty = "{sb $winref{sbservertag $tag}}";
prompt = "{prompt $[.15]itemname}";
prompt_empty = "{prompt $winname}";
topic = " $topic";
topic_empty = " Irssi v$J - http://www.irssi.org";
# all of these treated specially, they're only displayed when needed
lag = "{sb Lag: $0-}";
act = "{sb Act: $0-}";
more = "-- more --";
};
# there's two type of statusbars. root statusbars are either at the top
# of the screen or at the bottom of the screen. window statusbars are at
# the top/bottom of each split window in screen.
default = {
# the "default statusbar" to be displayed at the bottom of the window.
# contains all the normal items.
window = {
disabled = "no";
# window, root
type = "window";
# top, bottom
placement = "bottom";
# number
position = "1";
# active, inactive, always
visible = "active";
# list of items in statusbar in the display order
items = {
barstart = { priority = "100"; };
time = { };
user = { };
window = { };
topic = { };
window_empty = { };
lag = { priority = "-1"; };
act = { priority = "10"; };
more = { priority = "-1"; alignment = "right"; };
barend = { priority = "100"; alignment = "right"; };
};
};
# statusbar to use in inactive split windows
window_inact = {
type = "window";
placement = "bottom";
position = "1";
visible = "inactive";
items = {
barstart = { priority = "100"; };
window = { };
window_empty = { };
more = { priority = "-1"; alignment = "right"; };
barend = { priority = "100"; alignment = "right"; };
};
};
# we treat input line as yet another statusbar :) It's possible to
# add other items before or after the input line item.
prompt = {
type = "root";
placement = "bottom";
# we want to be at the bottom always
position = "100";
visible = "always";
items = {
prompt = { priority = "-1"; };
prompt_empty = { priority = "-1"; };
# treated specially, this is the real input line.
input = { priority = "10"; };
};
};
# topicbar
topic = {
type = "root";
placement = "nowhere";
position = "100000";
visible = "never";
items = {
topicbarstart = { priority = "100"; };
topic = { };
topic_empty = { };
topicbarend = { priority = "100"; alignment = "right"; };
};
};
};
};
settings = {
core = {
real_name = "%NICK%";
user_name = "%NICK%";
nick = "%NICK%";
};
"fe-text" = { actlist_sort = "refnum"; };
"fe-common/core" = {
theme = "dma147";
completion_char = ",";
autolog = "yes";
};
};
hilights = (
{ text = "%NICK%"; nick = "yes"; word = "yes"; },
{ text = "chris"; nick = "yes"; word = "yes"; }
);
logs = { };
IRSSI
echo "$IRSSI" | sed -e "s/%PASSWORD%/$IRCPASS/" | sed -e "s/%NICK%/$IRCNICK/" | sed -e "s/%SERVER%/$IRCSERVER/" | sed -e "s/%PORT%/$IRCPORT/" > "$HOME"/.irssi/config