Skip to content

Commit

Permalink
fix php auto header
Browse files Browse the repository at this point in the history
  • Loading branch information
lovelock committed Apr 27, 2015
1 parent cc176be commit dec2e6e
Showing 1 changed file with 48 additions and 50 deletions.
98 changes: 48 additions & 50 deletions vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ syntax on

" import bundle configuration
if filereadable(expand("~/.vimrc.bundles"))
source ~/.vimrc.bundles
source ~/.vimrc.bundles
endif

" Enable filetype plugins
Expand Down Expand Up @@ -72,7 +72,7 @@ set whichwrap+=<,>,h,l

" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse-=a
set mouse-=a
endif

" Increment as decimal
Expand Down Expand Up @@ -229,16 +229,16 @@ map <leader>cd :cd %:p:h<cr>:pwd<cr>
" Specify the behavior when switching between buffers
try
set switchbuf=useopen,usetab,newtab
set stal=2
set switchbuf=useopen,usetab,newtab
set stal=2
catch
endtry

" Return to last edit position when opening files (You want this!)
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" Remember info about open buffers on close
set viminfo^=%

Expand Down Expand Up @@ -266,17 +266,17 @@ vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z
if has("mac") || has("macunix")
nmap <D-j> <M-j>
nmap <D-k> <M-k>
vmap <D-j> <M-j>
vmap <D-k> <M-k>
nmap <D-j> <M-j>
nmap <D-k> <M-k>
vmap <D-j> <M-j>
vmap <D-k> <M-k>
endif

" Delete trailing white space on save, useful for Python and CoffeeScript ;)
func! DeleteTrailingWS()
exe "normal mz"
%s/\s\+$//ge
exe "normal `z"
exe "normal mz"
%s/\s\+$//ge
exe "normal `z"
endfunc
autocmd BufWrite *.py :call DeleteTrailingWS()
autocmd BufWrite *.coffee :call DeleteTrailingWS()
Expand All @@ -303,11 +303,11 @@ au FocusGained * :set relativenumber
autocmd InsertEnter * :set norelativenumber number
autocmd InsertLeave * :set relativenumber
function! NumberToggle()
if(&relativenumber == 1)
set norelativenumber number
else
set relativenumber
endif
if(&relativenumber == 1)
set norelativenumber number
else
set relativenumber
endif
endfunc
nnoremap <C-n> :call NumberToggle()<cr>
Expand All @@ -334,22 +334,22 @@ autocmd! bufwritepost .vimrc source % " linux。
" => Better paste mode
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! HideNumber()
if(&relativenumber == &number)
set relativenumber! number!
elseif(&number)
set number!
else
set relativenumber!
endif
set number?
if(&relativenumber == &number)
set relativenumber! number!
elseif(&number)
set number!
else
set relativenumber!
endif
set number?
endfunc
nnoremap <F2> :call HideNumber()<CR>
nnoremap <F3> :set list! list?<CR>
nnoremap <F4> :set wrap! wrap?<CR>
"set paste
"set paste
set pastetoggle=<F5> " when in insert mode, press <F5> to go to
" paste mode, where you can paste mass data
" that won't be autoindented
" paste mode, where you can paste mass data
" that won't be autoindented

" disbale paste mode when leaving insert mode
au InsertLeave * set nopaste
Expand Down Expand Up @@ -456,14 +456,12 @@ function! AutoSetFileHead()
endif

if &filetype == 'php'
call setline(1, "<?php")
call append(1, "");
call setline(1, "\<\?php")
endif

if &filetype == 'ruby'
call setline(1, "\#!/usr/bin/env ruby")
call append(1, "");
fi
endif

normal G
normal o
Expand Down Expand Up @@ -553,21 +551,21 @@ endfunction
" Don't close window, when deleting a buffer
command! Bclose call <SID>BufcloseCloseIt()
function! <SID>BufcloseCloseIt()
let l:currentBufNum = bufnr("%")
let l:alternateBufNum = bufnr("#")

if buflisted(l:alternateBufNum)
buffer #
else
bnext
endif

if bufnr("%") == l:currentBufNum
new
endif

if buflisted(l:currentBufNum)
execute("bdelete! ".l:currentBufNum)
endif
let l:currentBufNum = bufnr("%")
let l:alternateBufNum = bufnr("#")

if buflisted(l:alternateBufNum)
buffer #
else
bnext
endif

if bufnr("%") == l:currentBufNum
new
endif

if buflisted(l:currentBufNum)
execute("bdelete! ".l:currentBufNum)
endif
endfunction

0 comments on commit dec2e6e

Please sign in to comment.