Skip to content

Instantly share code, notes, and snippets.

@rsslldnphy
Last active August 29, 2015 14:06
Show Gist options
  • Save rsslldnphy/db910b5ae5d9c6da6493 to your computer and use it in GitHub Desktop.
Save rsslldnphy/db910b5ae5d9c6da6493 to your computer and use it in GitHub Desktop.
TMUX stuff
set-option -g default-command "reattach-to-user-namespace -l bash"
# Smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys 'C-\\') || tmux select-pane -l"
bind x confirm kill-session
call pathogen#infect()
set nocompatible
source ~/.vim/scripts/profile.vim
source ~/.vim/scripts/functional.vim
source ~/.vim/scripts/testing.vim
source ~/.vim/scripts/util.vim
source ~/.vim/scripts/mappings.vim
source ~/.vim/scripts/nerdtree.vim
source ~/.vim/scripts/clojure.vim
source ~/.vim/scripts/ruby.vim
source ~/.vim/scripts/erlang.vim
source ~/.vim/scripts/filetypes.vim
if $TERM == "xterm-256color"
set t_Co=256
endif
nnoremap Q noop
colorscheme flatlandia
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#branch#enabled = 1
let g:airline#extensions#tabline#fnamecollapse = 0
let g:airline#extensions#tabline#buffer_nr_show = 1
let g:airline#extensions#tabline#fnamemod = ':t'
" Show the status line
set laststatus=2
highlight LineNr ctermfg=grey
augroup fireplace_connect
autocmd!
augroup END
let g:paredit_electric_return = 0
map <leader>, :A<CR>
map <C-x><C-r> :Eval (user/reset)<cr>
map <C-x><C-c> :!tmux confirm kill-session<CR>
#!/bin/bash
PROJECT_NAME=`basename $(pwd)`
PROJECT_DIR=`pwd`
NREPL_PORT=$(cat .nrepl-port 2> /dev/null || echo 8000)
echo ""
echo "*************************************************************"
echo "******************* IT'S CLOJURE TIME! **********************"
echo "*************************************************************"
echo ""
echo "Setting up workspace for the $PROJECT_NAME project."
echo -n "Loading NREPL on port $NREPL_PORT."
say "Its Clojur time!"
tmux has-session -t $PROJECT_NAME &> /dev/null
if [ $? != 0 ] ; then
tmux new-session -s $PROJECT_NAME -n script -d
tmux rename-window "$PROJECT_NAME-CODE"
tmux new-window -n "$PROJECT_NAME-REPL" "cd $PROJECT_DIR && LEIN_REPL_PORT=$NREPL_PORT lein repl"
tmux new-window -n "$PROJECT_NAME-TESTS" "cd $PROJECT_DIR; lein autoexpect"
tmux select-window -t "$PROJECT_NAME-CODE"
tmux send-keys "cd $PROJECT_DIR; reattach-to-user-namespace -l vim project.clj" C-m
say "Loading n repple on port $NREPL_PORT"
while ! nc -z localhost $NREPL_PORT; do echo -n '.'; say "cough"; sleep 1; done
say "phew, finally. lets hack on $PROJECT_NAME"
echo ""
tmux send-keys ":Connect nrepl://localhost:$NREPL_PORT" C-m C-m
fi
tmux bind r select-window -t "$PROJECT_NAME-REPL"
tmux bind t select-window -t "$PROJECT_NAME-TESTS"
tmux bind c select-window -t "$PROJECT_NAME-CODE"
tmux attach -t $PROJECT_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment