Skip to content

Instantly share code, notes, and snippets.

@binarypie
Forked from paulrouget/.tmux.conf
Created February 15, 2012 07:41
Show Gist options
  • Save binarypie/1834199 to your computer and use it in GitHub Desktop.
Save binarypie/1834199 to your computer and use it in GitHub Desktop.
Paul's configurations files
set -g default-terminal "screen-256color"
set -g status-utf8 on
bind M source-file ~/.tmux/mac.session
bind L source-file ~/.tmux/linux.session
# set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# THEME
set -g status-bg black
set -g status-fg white
set -g status-left-length 30
set -g status-right-length 60
set -g status-left ' #[default]'
set -g status-right '#[fg=colour235]Inbox: #[fg=yellow]#(ls ~/Mails/INBOX/new | wc -l | tr -d " ")#[fg=colour235]/#(ls ~/Mails/INBOX/cur ~/Mails/INBOX/new | wc -l | tr -d " ") | Bugzilla: #[fg=yellow]#(ls ~/Mails/bugzilla/new | wc -l | tr -d " ")#[fg=colour235]/#(ls ~/Mails/bugzilla/cur ~/Mails/bugzilla/new| wc -l | tr -d " ") | ml: #[fg=yellow]#(ls ~/Mails/lists/new | wc -l | tr -d " ")#[fg=colour235]/#(ls ~/Mails/lists/cur ~/Mails/lists/new | wc -l | tr -d " ")#[default] #[fg=colour198]%H:%M#[default]'
setw -g window-status-format '#[fg=colour235]#I #[fg=white]#W#[default] '
#FIXME: I want to be able to use: ⮁
setw -g window-status-current-format '#[bg=white,fg=black]⮀ #W #[bg=black,fg=white]⮀'
######################### SCREEN BINDINGS ######################
# $Id: screen-keys.conf,v 1.7 2010/07/31 11:39:13 nicm Exp $
#
# By Nicholas Marriott. Public domain.
#
# This configuration file binds many of the common GNU screen key bindings to
# appropriate tmux key bindings. Note that for some key bindings there is no
# tmux analogue and also that this set omits binding some commands available in
# tmux but not in screen.
#
# Note this is only a selection of key bindings and they are in addition to the
# normal tmux key bindings. This is intended as an example not as to be used
# as-is.
# Set the prefix to ^A.
unbind C-b
set -g prefix ^A
bind a send-prefix
# Bind appropriate commands similar to screen.
# lockscreen ^X x
unbind ^X
bind ^X lock-server
unbind x
bind x lock-server
# screen ^C c
unbind ^C
bind ^C new-window
bind c new-window
# detach ^D d
unbind ^D
bind ^D detach
# displays *
unbind *
bind * list-clients
# next ^@ ^N sp n
unbind ^@
bind ^@ next-window
unbind ^N
bind ^N next-window
unbind " "
bind " " next-window
unbind n
bind n next-window
# title A
unbind A
bind A command-prompt "rename-window %%"
# other ^A
unbind ^A
bind ^A last-window
# prev ^H ^P p ^?
unbind ^H
bind ^H previous-window
unbind ^P
bind ^P previous-window
unbind p
bind p previous-window
unbind BSpace
bind BSpace previous-window
# windows ^W w
unbind ^W
bind ^W list-windows
unbind w
bind w list-windows
# quit \
unbind \
bind \ confirm-before "kill-server"
# kill K k
unbind K
bind K confirm-before "kill-window"
unbind k
bind k confirm-before "kill-window"
# redisplay ^L l
unbind ^L
bind ^L refresh-client
unbind l
bind l refresh-client
# split -v |
unbind |
bind | split-window
# :kB: focus up
unbind Tab
bind Tab select-pane -t:.+
unbind BTab
bind BTab select-pane -t:.-
# " windowlist -b
unbind '"'
bind '"' choose-window
"""""""""""""""""""" PLUGINS
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'matchit.zip'
Bundle 'The-NERD-Commenter'
Bundle 'The-NERD-tree'
Bundle 'vim-powerline'
Bundle 'Command-T'
"""""""""""""""""""" GLOBAL
let mapleader=","
colorscheme molokai
set gfn=terminus
set go=
syntax on
filetype plugin indent on
set encoding=utf-8
set hidden
set showcmd
set nowrap
set backspace=indent,eol,start
set autoindent
set copyindent
set number
set shiftround
set ignorecase
set smartcase
set hlsearch
set incsearch
set history=1000
set undolevels=1000
set title
set visualbell
set noerrorbells
set list
set listchars=tab:>.,trail:.,extends:#,nbsp:.
set ttyfast
set mouse=
set nocompatible
set backup
set backupdir=~/.vim_backup
set noswapfile
set fileformats=unix,dos,mac
set laststatus=2
set expandtab
set softtabstop=2 tabstop=2 shiftwidth=2
set ruler
set wildignore=*.swp,*.bak
set wildmode=longest,list
"""""""""""""""""""" KEYBINDINGS
map cc <leader>c<space>
map # {v}! par 72<CR>
map & {v}! par 72j<CR>
map <F6> :setlocal spell! spelllang=en<CR>
map <F12> :set invhls<CR>
cmap <C-g> <C-u><ESC>
command! -bang W w<bang>
"""""""""""""""""""" PLUGINS
"let g:Powerline_symbols = 'fancy'
let g:CommandTMaxFiles=5000
let g:CommandTMaxHeight=12
map <C-o> :CommandT<CR>
let g:CommandTAcceptSelectionMap = '<CR>'
let g:CommandTCancelMap = '<C-g>'
let NERDChristmasTree = 1
let NERDTreeSortOrder = ['\/$', '\.js*', '\.cpp$', '\.h$', '*']
nmap <c-b> :NERDTreeToggle<cr>
nmap <C-n> <c-w><left><down><c-w><c-w>
nmap <C-p> <c-w><left><up><c-w><c-w>
nmap <C-o> <c-w><left><CR>
"""""""""""""""""""" FILES SPECIFIC
au BufRead mutt-* set ft=mail
au BufRead mutt-* set invhls
au BufNewFile *.html 0r ~/.vim/templates/html.txt
au BufRead,BufNewFile *.jsm setfiletype javascript
au BufRead,BufNewFile *.xul setfiletype xml
au filetype html,xml set listchars-=tab:>.
"""""""""""""""""""" CUSTOM FUNCTIONS
""" Toggle relative/absolute numbering
function! NumberToggle()
if(&relativenumber == 1)
set number
else
set relativenumber
endif
endfunc
nnoremap <F10> :call NumberToggle()<cr>
""" FocusMode
function! ToggleFocusMode()
if (&foldcolumn != 12)
set laststatus=0
set numberwidth=10
set foldcolumn=12
set noruler
hi FoldColumn ctermbg=none
hi LineNr ctermfg=0 ctermbg=none
hi NonText ctermfg=0
else
set laststatus=2
set numberwidth=4
set foldcolumn=0
set ruler
execute 'colorscheme ' . g:colors_name
endif
endfunc
nnoremap <F1> :call ToggleFocusMode()<cr>
#!/usr/bin/node
var exec = require('child_process').exec;
var fs = require('fs');
exec('hg root', function(err, stdout, stderr) {
if (err) throw err;
var root = stdout;
root = root.substr(0, root.length - 1);
exec('hg qqueue', function (err, stdout, stderr) {
if (err) throw err;
var queues = stdout.split("\n");
for (var i = 0; i < queues.length - 1; i++) {
var queue = queues[i];
var idx = queue.indexOf(" (active)");
if (idx > -1) {
queues[i] = {name: queue.substr(0, idx), active: true};
} else {
queues[i] = {name: queue, active: false};
}
}
delete queues[queues.length - 1];
var count = queues.length - 1;
queues.forEach(function(queue) {
fs.readFile(root + "/.hg/patches-" + queue.name + "/series", function (err, data) {
if (err) throw err;
queue.patches = data.toString().split("\n");
queue.patches.pop();
if (queue.active) {
fs.readFile(root + "/.hg/patches-" + queue.name + "/status", function (err, data) {
if (err) throw err;
data = data.toString().split(":");
var current = data[data.length - 1];
current = current.substr(0, current.length - 1);
queue.current = current;
count--;
if (count == 0) dump(queues);
});
} else {
count--;
if (count == 0) dump(queues);
}
});
});
});
});
function fg(val) { return "\033[38;5;" + val + "m"; }
function bg(val) { return "\033[48;5;" + val + "m"; }
function dump(queues) {
queues.forEach(function(q) {
str = q.active ? fg(15) : fg(238);
str += fixedSize(q.name, 20);
str += " - ";
if (!q.current) str += fg(238);
for (var i = 0; i < q.patches.length; i++) {
var p = q.patches[i];
str += " " + p + " ";
if (i != q.patches.length - 1) str += "⮁";
if (p == q.current) str += fg(238);
};
console.log(str);
});
}
function fixedSize(msg, count) {
if (msg.length > count) {
msg = msg.substr(0, count - 1);
msg += "…";
} else {
while (msg.length != count) {
msg += " ";
}
}
return msg;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment