Skip to content

Instantly share code, notes, and snippets.

@karbassi
Forked from fc/gist:16331
Created October 12, 2008 18:18
Show Gist options
  • Save karbassi/16448 to your computer and use it in GitHub Desktop.
Save karbassi/16448 to your computer and use it in GitHub Desktop.
if has('win32')
set backupdir=C:/cygwin_updated/var/vim/backup
set directory=C:/cygwin_updated/var/vim/tmp
elseif has('win32unix')
if exists("*mkdir")
if !isdirectory('/var/vim/')
mkdir('/var/vim/')
endif
if !isdirectory('/var/vim/backup/')
mkdir('/var/vim/backup/')
endif
if !isdirectory('/var/vim/tmp/')
mkdir('/var/vim/tmp/')
endif
endif
set backupdir=/var/vim/backup
set directory=/var/vim/tmp
elseif has('unix')
if !isdirectory($HOME.'/.vim/')
call mkdir($HOME . '/.vim/')
endif
if !isdirectory($HOME.'/.vim/backup/')
call mkdir($HOME . '/.vim/backup')
endif
if !isdirectory($HOME.'/.vim/tmp/')
call mkdir($HOME . '/.vim/tmp/')
endif
set backupdir=$HOME/.vim/backup
set directory=$HOME/.vim/tmp
endif
" if gvim
if has('gui_running')
"set guioptions-=T
"set guioptions-=m
set guioptions=
" maximize
if has('win32')
au GUIEnter * simalt ~x
endif
endif
" if cygwin
"if has('win32unix')
" "colorscheme elflord
" colorscheme darkblue
"else
" colorscheme darkblue
"endif
colorscheme darkblue
"options
set autoindent
set backspace=2
set backup
set expandtab
set fileformat=unix
set filetype=on
set foldenable
set foldmethod=marker
set guicursor=a:blinkon0
set hidden
set history=500
set hlsearch
set incsearch
set mouse=n
set nocompatible
set noerrorbells
set number
set ruler
set shiftwidth=4
set shortmess=filnxtToOI
set showcmd
set softtabstop=4
set tabstop=4
set undolevels=2000
set whichwrap=<,>,h,l
set wildmenu
set wildmode=list:full
"if has("statusline")
" set statusline=%<%F%=%([%M%R%H%W]\ %)%l,%c%V\ %P\ (%n)
"endif
" testing..nah
"set virtualedit=all
filetype on " Enable filetype detection
filetype indent on " Enable filetype-specific indenting
filetype plugin on " Enable filetype-specific plugins
syntax on
"map
map <F2> :set hlsearch!<CR>:set hlsearch?<CR>
map <F3> :resize +10<CR>:echo '+10'<CR>
map <F4> :resize -10<CR>:echo '-10'<CR>
"autoindent on/off
map <F5> :set autoindent!<CR>:set autoindent?<CR>
map <F8> :set paste!<CR>:set paste?<CR>
"execute file
"map <F6> :execute '!' . expand('%:p')<CR>
" next/prev buffers
map <C-W>h :bprevious<CR>
map <C-W>l :bnext<CR>
" prevent man lookup
map K <UP>
" automatically highlight blocks..
noremap V V%
" netrw
"let g:netrw_ignorenetrc =0
function HTMLSetup()
inoremap <buffer> =" =""<ESC>i
inoremap <buffer> =' =''<ESC>i
endfunction
function PhpSetup()
inoremap <buffer> [' ['']<ESC>hi
inoremap <buffer> =<SPACE>" =<SPACE>"";<ESC>hi
inoremap <buffer> =<SPACE>' =<SPACE>'';<ESC>hi
inoremap <buffer> if<SPACE>( if<SPACE>()<SPACE>{<CR><CR>}<ESC>kkf(a
inoremap <buffer> =" =""<ESC>i
inoremap <buffer> =' =''<ESC>i
inoremap <buffer> {<cr> {<cr>}<esc>O
if filereadable($HOME.'/.vim/php-doc.vim')
source $HOME/.vim/php-doc.vim
inoremap <buffer> <C-O> <ESC>:call PhpDocSingle()<CR>i
nnoremap <buffer> <C-O> :call PhpDocSingle()<CR>
vnoremap <buffer> <C-O> :call PhpDocRange()<CR>
let g:pdv_cfg_Package = ""
let g:pdv_cfg_Version = "$id$"
let g:pdv_cfg_Author = "Clayton Smith <[email protected]>"
let g:pdv_cfg_Copyright = ""
"let g:pdv_cfg_License = PHP Version 3.0 {@link http://www.php.net/license/3_0.txt}
let g:pdv_cfg_License = ""
"imap <C-o> :set paste<CR>:exe PhpDoc()<CR>:set nopaste<CR>i
endif
endfunction
function RubySetup()
inoremap <buffer> #{ #{}<ESC>i
endfunction
function OcamlSetup()
" BUG
"" If 'shellpipe' is empty, the {errorfile} part will be omitted. This is useful
"" for compilers that write to an errorfile themselves (e.g., Manx's Amiga C).
"set makeprg=ocaml\ %:p
"map <F8> :make<CR>
"run script
map <buffer> <F7> :!ocaml %:p<CR>
endfunction
" same as autochdir but is portable
autocmd BufEnter * silent! lcd %:p:h:gs/ /\\ /
" setup
autocmd BufEnter *.phtml,*.php,*.thtml :call PhpSetup()
autocmd BufEnter *.ml :call OcamlSetup()
autocmd BufEnter *.html :call HTMLSetup()
autocmd BufEnter *.rb :call RubySetup()
autocmd BufEnter *.phtml,*.thtml :set filetype=php
autocmd BufEnter *.as :set filetype=javascript
if version >= 700
" easier cycling through tabs
map tl :tabnext<CR>
map th :tabprev<CR>
map tn :tabnew<CR>
map td :tabclose<CR>
" create new tab, note: overrides tag stack, :h <CTRL-T> for details atat
"nmap <C-t> :tabnew<CR>
" move current buffer to new tab
function MoveBufferToTab()
let l:current = bufnr('%')
close
tablast
tabnew
exe "b ". l:current
endfunction
map to :call MoveBufferToTab()<CR>
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment