Skip to content

Instantly share code, notes, and snippets.

@igstan
Created May 15, 2009 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igstan/112367 to your computer and use it in GitHub Desktop.
Save igstan/112367 to your computer and use it in GitHub Desktop.
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let eq = ''
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
set guifont=Monaco:h14
syntax on
colorscheme vilight
set tabstop=4
set shiftwidth=4
set expandtab
set softtabstop=4
set autoindent
set lines=40 columns=120
" Maximize window
" au GUIEnter * simalt ~x
set nu!
" No icon toolbar
set guioptions-=T
" Customize statusbar
set statusline=%F%m%r%h%w\ [FORMAT=%{toupper(&ff)}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
set laststatus=2
" UNIX line endings
set ff=unix
" Thinner text cursor
set gcr=i-ci:ver10-Cursor/lCursor
set nowrap
set backupdir=$TMPDIR,$TEMP,$TMP,.
set directory=$TMPDIR,$TEMP,$TMP,.
" set cursorline
" http://www.nabble.com/How-to-map-special-keys-like-shift,-tab,-ctl-td14848673.html
nnoremap <C-Tab> :call<sid>CycleTabpages(1)<cr>
nnoremap <C-S-Tab> :call<sid>CycleTabpages(0)<cr>
func! <sid>CycleTabpages(forw)
if a:forw
normal! gt
else
normal! gT
endif
while 1
redraw
echo "Cycle Tab pages (Shift-Tab/Tab)"
let c = s:Getchar()
if c == "\t"
normal! gt
elseif c == "\<S-Tab>"
normal! gT
else
exe "norm! :\<C-U>"
call feedkeys(c)
break
endif
endwhile
endfunc
func! s:Getchar()
let c = getchar()
if c != 0
let c = nr2char(c)
endif
return c
endfunc
set showtabline=2 " always show tabs in gvim, but not vim
" set up tab labels with tab number, buffer name, number of windows
function! GuiTabLabel()
let label = ''
let bufnrlist = tabpagebuflist(v:lnum)
" Append the tab number
let label = tabpagenr().'. '
" Append the buffer name
let name = bufname(bufnrlist[tabpagewinnr(v:lnum) - 1])
if name == ''
" give a name to no-name documents
if &buftype=='quickfix'
let name = '[Quickfix List]'
else
let name = '[No Name]'
endif
else
" get only the file name
let name = fnamemodify(name,":t")
endif
let label .= name
" Add '+' if one of the buffers in the tab page is modified
for bufnr in bufnrlist
if getbufvar(bufnr, "&modified")
let label .= ' *'
break
endif
endfor
" Append the number of windows in the tab page
" let wincount = tabpagewinnr(v:lnum, '$')
" return label . ' [' . wincount . ']'
return label
endfunction
" set up tab tooltips with every buffer name
function! GuiTabToolTip()
let tip = ''
let bufnrlist = tabpagebuflist(v:lnum)
for bufnr in bufnrlist
" separate buffer entries
if tip!=''
let tip .= ' | '
endif
" Add name of buffer
let name=bufname(bufnr)
if name == ''
" give a name to no name documents
if getbufvar(bufnr,'&buftype')=='quickfix'
let name = '[Quickfix List]'
else
let name = '[No Name]'
endif
endif
let tip.=name
" add modified/modifiable flags
if getbufvar(bufnr, "&modified")
let tip .= ' [+]'
endif
if getbufvar(bufnr, "&modifiable")==0
let tip .= ' [-]'
endif
endfor
return tip
endfunction
set guitablabel=%{GuiTabLabel()}
set guitabtooltip=%{GuiTabToolTip()}
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
autocmd BufWritePre *.py normal m`:%s/\s\+$//e ``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment