Created
April 28, 2010 10:31
-
-
Save rob-b/381977 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# This is an example of using HGEDITOR to create of diff to review the | |
# changes while commiting. | |
# If you want to pass your favourite editor some other parameters | |
# only for Mercurial, modify this: | |
case "${EDITOR}" in | |
"") | |
EDITOR="vi" | |
;; | |
emacs) | |
EDITOR="$EDITOR -nw" | |
;; | |
gvim|vim|"gvim -v") | |
EDITOR="$EDITOR -f -o" | |
;; | |
esac | |
HGTMP="" | |
cleanup_exit() { | |
rm -rf "$HGTMP" | |
} | |
# Remove temporary files even if we get interrupted | |
trap "cleanup_exit" 0 # normal exit | |
trap "exit 255" 1 2 3 6 15 # HUP INT QUIT ABRT TERM | |
HGTMP="${TMPDIR-/tmp}/hgeditor.$RANDOM.$RANDOM.$RANDOM.$$" | |
(umask 077 && mkdir "$HGTMP") || { | |
echo "Could not create temporary directory! Exiting." 1>&2 | |
exit 1 | |
} | |
( | |
grep '^HG: changed' "$1" | cut -b 13- | while read changed; do | |
"$HG" diff "$changed" >> "$HGTMP/diff" | |
done | |
) | |
cat "$1" > "$HGTMP/msg" | |
MD5=$(which md5sum 2>/dev/null) || \ | |
MD5=$(which md5 2>/dev/null) | |
[ -x "${MD5}" ] && CHECKSUM=`${MD5} "$HGTMP/msg"` | |
if [ -s "$HGTMP/diff" ]; then | |
$EDITOR "$HGTMP/msg" "$HGTMP/diff" || exit $? | |
else | |
$EDITOR "$HGTMP/msg" || exit $? | |
fi | |
[ -x "${MD5}" ] && (echo "$CHECKSUM" | ${MD5} -c >/dev/null 2>&1 && exit 13) | |
mv "$HGTMP/msg" "$1" | |
e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ui] | |
username = Rob Berry | |
ssh = ssh -C | |
ignore = $HOME/.hgignore | |
editor = $HOME/.bin/hgeditor | |
[extensions] | |
hgext.record= | |
hgext.graphlog= | |
hgext.churn= | |
hgext.pager= | |
hgext.hgshelve= | |
hgext.mq= | |
color= | |
fetch= | |
rebase= | |
[color] | |
status.modified = yellow | |
status.added = green | |
status.removed = red | |
status.unknown = white red_background | |
[pager] | |
pager = LESS='FSRX' less | |
ignore = shelve, push, record, pull | |
attend = annotate, cat, diff, export, glog, log, qdiff slog, dlog, nlog, sglog, help | |
[diff] | |
git = True | |
[alias] | |
slog = log --style=$HOME/.dotfiles/mercurial-cli-templates/map-cmdline.slog | |
dlog = log --style=$HOME/.dotfiles/mercurial-cli-templates/map-cmdline.dlog | |
nlog = log --style=$HOME/.dotfiles/mercurial-cli-templates/map-cmdline.nlog | |
sglog = log --style=$HOME/.dotfiles/mercurial-cli-templates/map-cmdline.sglog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set blink-matching-paren on | |
"\e[1~": beginning-of-line | |
"\e[4~": end-of-line | |
"\e[5~": beginning-of-history | |
"\e[6~": end-of-history | |
"\e[3~": delete-char | |
"\e[2~": quoted-insert | |
"\e[5C": forward-word | |
"\e[5D": backward-word | |
"\e\e[C": forward-word | |
"\e\e[D": backward-word | |
"\e[A":history-search-backward | |
"\e[B":history-search-forward | |
set completion-ignore-case On |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"2.0 (created: 2009/03/28 23:48:07) | |
" set runtimepath=/home/rob/.vimperator | |
set guioptions=rbnT | |
set complete=sl | |
set wildoptions=auto | |
colors default | |
" don't focus on form inputs when the page loads | |
" set focuscontent | |
" key mapping | |
map gb gT | |
":noremap <C-c> <C-v><C-c> | |
":noremap <C-v> <C-v><C-v> | |
:autocmd LocationChange .* :js modes.passAllKeys = /www\.google\.com\/reader\/view/.test(buffer.URL) | |
source! ~/.vimperatorrc.local | |
" vim: set ft=vimperator: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" vi < vim | |
set nocompatible | |
syntax on | |
let python_highlight_all = 1 | |
set viminfo='1000,f1,:1000,/1000 | |
set history=500 | |
" use ack instead of grep | |
set grepprg=ack\ -H | |
" Automatically reload .vimrc when changing | |
autocmd! bufwritepost .vimrc source % | |
set autoread | |
" Use filetype plugins | |
filetype plugin on | |
filetype on | |
" Store temporary files in a central spot | |
set backupdir=~/.vim/tmp,~/.tmp,~/tmp,/var/tmp,/tmp | |
set directory=~/.vim/tmp,~/.tmp,~/tmp,/var/tmp,/tmp | |
"===== | |
" file presentation | |
"===== | |
filetype indent on | |
set autoindent | |
set smartindent | |
set backspace=indent,eol,start | |
set textwidth=80 | |
set nowrap | |
set tabstop=4 | |
set shiftwidth=4 | |
set expandtab | |
set softtabstop=4 | |
" don't force # to column 0 | |
inoremap # X<BS># | |
" use two space tabs for ruby | |
autocmd FileType ruby setlocal shiftwidth=2 softtabstop=2 et | |
" function to turn on ruby tab setup | |
function! TwoTabs() | |
set shiftwidth=2 | |
set softtabstop=2 | |
endfunction | |
nmap <F9> mz:execute TwoTabs()<CR>'z | |
" display whitespace at start and end of lines | |
set list | |
set listchars=tab:>-,trail:- | |
"===== | |
" vim presentation | |
"===== | |
" Show line numbers by default | |
set number | |
" 256 colours | |
set t_Co=256 | |
colorscheme darkspectrum | |
" just in case the host termcap on this machine sucks, give me color. | |
if &term =~ "xterm" || &term =~ "screen" | |
set t_Co=256 | |
if has("terminfo") | |
set t_Sf=[3%p1%dm | |
set t_Sb=[4%p1%dm | |
else | |
set t_Sf=[3%dm | |
set t_Sb=[4%dm | |
endif | |
endif | |
" Show nice info in ruler | |
set ruler | |
set laststatus=2 | |
" show encoding in statusline if available | |
if has("statusline") | |
set statusline=%<%f\ %h%m%r%=%{\"[\".(&fenc==\"\"?&enc:&fenc).((exists(\"+bomb\")\ &&\ &bomb)?\",B\":\"\").\"]\ \"}%k\ %-14.(%l,%c%V%)\ %P | |
endif | |
" Enable folding | |
set foldenable | |
" set foldmethod=indent | |
" Autoclose folds, when moving out of them | |
set foldclose=all | |
" Use incremental searching | |
set incsearch | |
set ignorecase | |
set smartcase | |
" Do highlight search results | |
set hlsearch | |
" Jump 5 lines when running out of the screen | |
set scrolljump=5 | |
" Indicate jump out of the screen when 3 lines before end of the screen | |
set scrolloff=3 | |
" tab complete menu | |
set wildmenu | |
set wildmode=longest,full | |
" set behaviour for onmicomplete menu | |
set completeopt=longest,menuone | |
if has("gui_running") | |
if has("macunix") | |
set guifont=Andale\ Mono:h12 | |
else | |
set gfn=Inconsolata\ 10 | |
endif | |
set guioptions-=T | |
set guioptions-=e | |
set guioptions-=r | |
set guioptions-=L | |
endif | |
"===== | |
" Mappings | |
"===== | |
" unhighlight search results | |
map <silent> <C-N> :noh<CR> | |
" save current file as root | |
cmap w!! w !sudo tee % | |
" make :W the same as :w | |
cmap W w | |
" Toggle file browser and tag list | |
nmap <silent> nt :NERDTreeToggle<CR> | |
nmap <silent> tl :TlistToggle<CR><C-w>h | |
" Don't move the curosr when highlighting | |
nmap * *N | |
nmap # #N | |
" clean whitespace only lines | |
map <silent> <leader>cel mz:%s:\s\+$::<CR>'z:delmarks z<CR> | |
" execute current ruby file | |
map <C-F11> <Esc>:!ruby %<CR> | |
" search for the word under the cursor in all files | |
" in this directory and below | |
map <F4> :execute "vimgrep /" . expand("<cword>") . "/j **" <Bar> cw<CR> | |
" toggle showmarks | |
map <silent> <F7> <ESC>:ShowMarksToggle<CR> | |
" load project | |
map np :Project $HOME/.vim/projects/ | |
map <silent><F2> <Plug>ToggleProject | |
" tab bindings | |
map <C-t> <Esc>:tabe<CR> | |
map gb <Esc>:tabprevious<CR> | |
" easier omnicomplete binding | |
inoremap <Nul> <C-x><C-o> | |
" leave insert mode | |
imap ;; <Esc> | |
" shortcut to paste from clipboard | |
map <C-p> "+gp | |
"===== | |
" plugin settings | |
"===== | |
"let g:EnhCommentifyUseAltKeys = 'yes' | |
let g:EnhCommentifyPretty = 'yes' | |
let g:EnhCommentifyRespectIndent = 'yes' | |
let g:EnhCommentifyUseSyntax = 'yes' | |
let g:EnhCommentifyUseBlockIndent = 'yes' | |
let g:EnhCommentifyMultiPartBlocks = 'yes' | |
let g:EnhCommentifyAlignRight = 'yes' | |
" showmarks settings | |
let g:showmarks_enable=0 | |
let showmarks_include = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
let g:showmarks_textlower="\t" | |
let g:showmarks_textupper="\t" | |
let g:showmarks_textother="\t" | |
" snipmate settings | |
" autocmd FileType python set ft=python.django | |
autocmd FileType html set ft=html.django_template | |
" taglist | |
let Tlist_Exist_OnlyWindow = 1 | |
let Tlist_Compact_Format = 1 | |
let Tlist_Close_On_Select = 1 | |
let Tlist_Enable_Fold_Column = 0 | |
" set the supertab complete type | |
let g:SuperTabDefaultCompletionType = "<C-X><C-O>" | |
" include the rope.vim | |
so ~/.vim/ropevim/rope.vim | |
" fuzzyfinder | |
map <leader>t :FufFile<CR> | |
"===== | |
" highlighting | |
"===== | |
" mark line chars in excess of 80 | |
hi LineTooLong cterm=bold ctermfg=LightYellow ctermbg=Black guibg=Black | |
match LineTooLong /\%81v.\+/ | |
" set highlight colours for the omnicomplete menu | |
hi Pmenu ctermfg=0 ctermbg=DarkGreen guifg=#ffffff guibg=#cb2f27 | |
hi PmenuSel ctermfg=0 ctermbg=LightGreen guifg=#ffffff guibg=#ff3333 | |
hi PmenuSbar ctermfg=9 ctermbg=0 guifg=#ffffff guibg=#cb2f27 | |
hi PmenuThumb ctermfg=0 ctermbg=7 guifg=#ffffff guibg=#cb2f27 | |
" colours for the showmarks plugin | |
" hi ShowMarksHLl cterm=bold ctermbg=none | |
hi ShowMarksHLl cterm=bold ctermbg=none ctermfg=blue guifg=#038bbe guibg=NONE | |
hi ShowMarksHLu cterm=bold ctermbg=none ctermfg=red | |
hi ShowMarksHLo cterm=bold ctermbg=none ctermfg=yellow | |
hi ShowMarksHLm cterm=bold ctermbg=none ctermfg=green | |
hi SignColumn cterm=bold ctermbg=none guibg=NONE | |
" hi LineNr guibg=NONE | |
" taglist | |
hi MyTagListFileName guibg=NONE guifg=green | |
" pyflakes | |
hi SpellBad guibg=#c2473b | |
" copy to the xclipboard | |
set clipboard+=unnamed | |
"===== | |
" abbreviations | |
"===== | |
ab bl <Esc>bi{% block <Esc>ea %}{% endblock %}<Esc>h%i | |
fun! LoadRopeProject() | |
if (isdirectory(getcwd() . "/.ropeproject")) | |
echo "Load ropevim" | |
:call RopeOpenProject() | |
endif | |
endfun | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment