Skip to content

Instantly share code, notes, and snippets.

@onjin
Created October 11, 2010 06:30
Show Gist options
  • Save onjin/620110 to your computer and use it in GitHub Desktop.
Save onjin/620110 to your computer and use it in GitHub Desktop.
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set backup " keep a backup file
endif
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set number
set cursorline
set nocursorcolumn
set ignorecase
" Don't use Ex mode, use Q for formatting
map Q gq
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
colors ron
colorscheme native
source $VIMRUNTIME/menu.vim
set wildmenu
set cpo-=<
set wcm=<C-Z>
map <F4> :emenu <C-Z>
set hidden
nmap ZZ :close<CR>
"set go-=m go-=T go-=l go-=L go-=r go-=R go-=b go-=F
set go-=T go-=l go-=L go-=r go-=R go-=b go-=F
endif
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
au BufRead,BufNewFile *.e{build,class} let is_bash=1|setfiletype sh
au BufRead,BufNewFile *.e{build,class} set ts=4 sw=4 noexpandtab
else
set autoindent " always set autoindenting on
endif " has("autocmd")
" my changes
set tabstop=4
set shiftwidth=4
set expandtab
set ai
set si
set sm
set exrc
source ~/.vim/php-doc.vim
inoremap <C-D> <ESC>:call PhpDocSingle()<CR>i
nnoremap <C-D> :call PhpDocSingle()<CR>
vnoremap <C-D> :call PhpDocRange()<CR>
" maps
map <c-w>m :WManager<cr>
map <c-w>M :WMClose<cr>
map <c-w><c-f> :FirstExplorerWindow<cr>
map <c-w><c-b> :BottomExplorerWindow<cr>
map <c-w><c-t> :WMToggle<cr>
nnoremap <silent> <F8> :TlistToggle<CR>
map <c-i>t :Tlist<cr>
map <c-i>c :TlistClose<cr>
map <c-i>u :TlistUpdate<cr>
" better splitting
set wmh=0
map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_
set wmw=0
nmap <c-h> <c-w>h<c-w><bar>
nmap <c-l> <c-w>l<c-w><bar>
" php make
"map <c-m> :w<cr>:make % make=1<cr>
" abbre
iab etd@ throw new Exception('@TODO');
iab statuc static
set foldmethod=manual
set foldnestmax=3
set foldlevel=1
set formatoptions=tcrq
set nojoinspaces
set laststatus=2
set modeline modelines=2
set ruler
set report=0
set showcmd
set showmode
set smartcase
set smarttab
"if version >= 540
" augroup filetype
" autocmd FileType xml '[,']!xsltproc ~/.vim/indent.xsl %
" augroup END
"ndif
" other autocmds
"f version>540
" autocmd!
"ndif
set tag=tags;/
vmap \em :call ExtractMethod()<cr>
function! ExtractMethod() range
let name = inputdialog("Name of new method:")
'<
exe "normal O\<bs>private " . name ."()\<cr>{\<esc>"
'>
exe "normal oreturn ;\<cr>}\<esc>k"
s/return/\/\/ return/ge
normal j%
normal kf(
exe "normal yyPi// = \<esc>wdwA;\<esc>"
normal ==
normal j0w
endfunction
" xml
let g:xml_syntax_folding=1
au FileType xml setlocal foldmethod=syntax
" python
python << EOF
import os
import sys
import vim
for p in sys.path:
if os.path.isdir(p):
vim.command(r"set path+=%s" % (p.replace(" ", r"\ ")))
EOF
au FileType py set tags+=$HOME/.vim/tags/python.ctags
" ctrl left right to nawigate
"map <silent><C-Left> <C-T>
"map <silent><C-Right> <C-]>
" Omnicomplete auf Strg+Space mappen
" inoremap <expr> <C-Space> pumvisible() \|\| &omnifunc == '' ?
" \ "\<lt>C-n>" :
" \ "\<lt>C-x>\<lt>C-o><c-r>=pumvisible() ?" .
" \ "\"\\<lt>c-n>\\<lt>c-p>\\<lt>c-n>\" :" .
" \ "\" \\<lt>bs>\\<lt>C-n>\"\<CR>"
"
"autocmd FileType php set omnifunc=phpcomplete#CompletePHP
"imap <C-@> <C-Space>
autocmd FileType php filetype plugin on
python << EOL
import vim
def EvaluateCurrentRange():
eval(compile('\n'.join(vim.current.range),'','exec'),globals())
EOL
map <C-h> :py EvaluateCurrentRange()<cr>
" autocmd BufNewFile,BufRead *.py compiler pyflakes
map <F12> :silent! make<CR><C-l>:cc<CR>
imap <F12> <Esc>:silent! make<CR><C-l>:cc<CR>
map <F11> :cn<CR>
imap <F11> <Esc>:cn<CR>
if exists("PIDA_EMBEDDED")
" your vim-in-pida vimrc commands here
" colorscheme ir_black
colorscheme native
source $VIMRUNTIME/menu.vim
set wildmenu
set cpo-=<
set wcm=<C-Z>
map <F4> :emenu <C-Z>
set hidden
nmap ZZ :close<CR>
else
colorscheme native
endif
" spelling
if v:version >= 700
" Enable spell check for text files
autocmd BufNewFile,BufRead *.txt setlocal spell spelllang=pl
endif
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplcache.
let g:neocomplcache_enable_at_startup = 1
" Use smartcase.
let g:neocomplcache_enable_smart_case = 1
" Use camel case completion.
let g:neocomplcache_enable_camel_case_completion = 1
" Use underbar completion.
let g:neocomplcache_enable_underbar_completion = 1
" Set minimum syntax keyword length.
let g:neocomplcache_min_syntax_length = 3
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
" Define dictionary.
let g:neocomplcache_dictionary_filetype_lists = {
\ 'default' : '',
\ 'vimshell' : $HOME.'/.vimshell_hist',
\ 'scheme' : $HOME.'/.gosh_completions'
\ }
" Define keyword.
if !exists('g:neocomplcache_keyword_patterns')
let g:neocomplcache_keyword_patterns = {}
endif
let g:neocomplcache_keyword_patterns['default'] = '\h\w*'
" Plugin key-mappings.
imap <C-k> <Plug>(neocomplcache_snippets_expand)
smap <C-k> <Plug>(neocomplcache_snippets_expand)
inoremap <expr><C-g> neocomplcache#undo_completion()
inoremap <expr><C-l> neocomplcache#complete_common_string()
" SuperTab like snippets behavior.
"imap <expr><TAB> neocomplcache#sources#snippets_complete#expandable() ? "\<Plug>(neocomplcache_snippets_expand)" : pumvisible() ? "\<C-n>" : "\<TAB>"
" Recommended key-mappings.
" <CR>: close popup and save indent.
" inoremap <expr><CR> neocomplcache#smart_close_popup() . (&indentexpr != '' ? "\<C-f>\<CR>X\<BS>":"\<CR>")
" <TAB>: completion.
" inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" <C-h>, <BS>: close popup and delete backword char.
" inoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>"
" inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>"
" inoremap <expr><C-y> neocomplcache#close_popup()
" inoremap <expr><C-e> neocomplcache#cancel_popup()
" AutoComplPop like behavior.
"let g:neocomplcache_enable_auto_select = 1
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
" Enable heavy omni completion.
if !exists('g:neocomplcache_omni_patterns')
let g:neocomplcache_omni_patterns = {}
endif
"let g:neocomplcache_omni_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::'
"autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
map ,v :sp ~/.vimrc<cr> " edit my .vimrc file in a split
map ,e :e ~/.vimrc<cr> " edit my .vimrc file
map ,u :source ~/.vimrc<cr> " update the system settings from my vimrc file
" ISharkng
map ,iq :cd ~/develop/ishark/isharkng-rel-5.0<cr>
map ,iw :cd ~/develop/ishark/isharkng-rel-5.1<cr>
map ,ie :cd ~/develop/ishark/isharkng-rel-5.2<cr>
map ,ir :cd ~/develop/ishark/isharkng-rel-5.3<cr>
map ,pi :!phing compile-i18n<cr>
map ,t :!gnome-terminal&<cr>
" Window movements; I do this often enough to warrant using up M-arrows on this"
nnoremap <M-Right> <C-W><Right>
nnoremap <M-Left> <C-W><Left>
nnoremap <M-Up> <C-W><Up>
nnoremap <M-Down> <C-W><Down>
" Open window below instead of above"
nnoremap <C-W>N :let sb=&sb<BAR>set sb<BAR>new<BAR>let &sb=sb<CR>
" Vertical equivalent of C-w-n and C-w-N"
nnoremap <C-w>v :vnew<CR>
nnoremap <C-w>V :let spr=&spr<BAR>set nospr<BAR>vnew<BAR>let &spr=spr<CR>
" I open new windows to warrant using up C-M-arrows on this"
nmap <C-M-Up> <C-w>n
nmap <C-M-Down> <C-w>N
nmap <C-M-Right> <C-w>v
nmap <C-M-Left> <C-w>V
" hard columns limit
" set columns=80
" soft limit / split
set textwidth=80
" highlite 77-81 chars
" au BufWinEnter * let w:m1=matchadd('Search', '\%<81v.\%>77v', -1)
"
" highlite lines > 80 chars
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment