Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
95 additions
and
46 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,116 @@ | ||
call pathogen#infect() | ||
|
||
syntax on | ||
set hlsearch | ||
set expandtab | ||
set tabstop=2 | ||
set shiftwidth=2 | ||
set autoindent | ||
set smartindent | ||
set ignorecase | ||
set softtabstop=2 | ||
set shiftwidth=4 | ||
set softtabstop=4 | ||
set tabstop=4 | ||
set foldmethod=marker | ||
set background=dark | ||
set nowrap | ||
set expandtab | ||
set textwidth=0 | ||
map <F2> :w!<CR> | ||
map <F9> :! gcc -Wall -o %< %<CR> | ||
map <F10> :! ./%<<CR> | ||
if has("autocmd") | ||
" Drupal *.module and *.install files. | ||
augroup module | ||
autocmd BufRead,BufNewFile *.module set filetype=php | ||
autocmd BufRead,BufNewFile *.install set filetype=php | ||
autocmd BufRead,BufNewFile *.test set filetype=php | ||
augroup END | ||
endif | ||
syntax on | ||
set pastetoggle=<F12> | ||
au BufEnter,BufRead *.inc setf php | ||
au BufEnter,BufRead *.tpl setf php | ||
au BufNewFile,BufRead *.tpl setf php | ||
au BufNewFile,BufRead *.inc setf php | ||
au BufRead,BufNewFile *.go set filetype=go | ||
set mouse=a | ||
set number | ||
set autoindent | ||
set ttymouse=xterm2 | ||
filetype on | ||
" for C-like programming, have automatic indentation: | ||
autocmd FileType c,cpp,slang,php,js set cindent | ||
|
||
iabbr Hook <C-R>=HookFunc()<CR> | ||
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS | ||
autocmd FileType js set omnifunc=javascriptcomplete#CompleteJS | ||
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags | ||
autocmd FileType htm set omnifunc=htmlcomplete#CompleteTags | ||
autocmd FileType css set omnifunc=csscomplete#CompleteCSS | ||
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags | ||
autocmd FileType php set omnifunc=phpcomplete#CompletePHP | ||
let php_sql_query=1 | ||
let php_htmlInStrings=1 | ||
set makeprg=php\ -l\ % | ||
set errorformat=%m\ in\ %f\ on\ line\ %l | ||
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif | ||
autocmd InsertLeave * if pumvisible() == 0|pclose|endif | ||
|
||
" HookFunc(): Drupal helper function | ||
function! HookFunc() | ||
let f = substitute(expand("%:t"), ".module", "", "g") | ||
return "function " . f . "_" | ||
endfunction | ||
if has("autocmd") && exists("+omnifunc") | ||
autocmd Filetype * | ||
\ if &omnifunc == "" | | ||
\ setlocal omnifunc=syntaxcomplete#Complete | | ||
\ endif | ||
endif | ||
|
||
let g:syntastic_phpcs_conf=" --standard=Drupal --extensions=php,module,inc,install,test,profile,theme" | ||
|
||
if has('statusline') | ||
set laststatus=2 | ||
" Broken down into easily includeable segments | ||
set statusline=%<%f\ " Filename | ||
" Broken down into easily includeable segments | ||
set statusline=%<%f\ " Filename | ||
set statusline+=%w%h%m%r " Options | ||
set statusline+=%{fugitive#statusline()} " Git Hotness | ||
set statusline+=\ [%{&ff}/%Y] " filetype | ||
set statusline+=\ [%{getcwd()}] " current dir | ||
set statusline+=%{fugitive#statusline()} " Git Hotness | ||
set statusline+=\ [%{&ff}/%Y] " filetype | ||
set statusline+=\ [%{getcwd()}] " current dir | ||
set statusline+=%#warningmsg# | ||
set statusline+=%{SyntasticStatuslineFlag()} | ||
set statusline+=%* | ||
let g:syntastic_enable_signs=1 | ||
set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info | ||
set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info | ||
endif | ||
|
||
set dictionary-=~/.vim/php/functionlist.txt dictionary+=~/.vim/php/functionlist.txt | ||
set complete-=k complete+=k | ||
|
||
function InsertTabWrapper() | ||
let col = col('.') - 1 | ||
if !col || getline('.')[col - 1] !~ '\k' | ||
return "\<tab>" | ||
else | ||
return "\<c-p>" | ||
let g:stop_autocomplete=0 | ||
function! CleverTab(type) | ||
if a:type=='omni' && !pumvisible() | ||
let col = col('.') - 1 | ||
if !col || getline('.')[col - 1] !~ '\k' | ||
let g:stop_autocomplete=1 | ||
return "\<TAB>" | ||
elseif !&omnifunc && &omnifunc != '' | ||
return "\<C-X>\<C-O>\<C-P>" | ||
endif | ||
elseif a:type=='keyword' && !pumvisible() && !g:stop_autocomplete | ||
return "\<C-X>\<C-N>\<C-P>" | ||
elseif a:type=='next' | ||
if pumvisible() | ||
let g:stop_autocomplete=0 | ||
return "\<C-N>" | ||
elseif g:stop_autocomplete | ||
let g:stop_autocomplete=0 | ||
else | ||
return "\<C-N>" | ||
endif | ||
elseif a:type=='back' | ||
if pumvisible() | ||
return "\<C-P>" | ||
endif | ||
endif | ||
return '' | ||
endfunction | ||
inoremap <silent><TAB> <C-R>=CleverTab('omni')<CR><C-R>=CleverTab('keyword')<CR><C-R>=CleverTab('next')<CR> | ||
inoremap <silent><S-TAB> <C-R>=CleverTab('back')<CR> | ||
" Remap the tab key to select action with InsertTabWrapper | ||
inoremap <tab> <c-r>=InsertTabWrapper()<cr> | ||
set list | ||
set listchars=tab:>-,trail:- | ||
set showmode " always show command or insert mode | ||
set ruler | ||
set showmatch | ||
set whichwrap=b,s,<,>,[,] | ||
|
||
imap § <Esc> | ||
map § <Esc> | ||
" More common in PEAR coding standard | ||
inoremap { {<CR>}<C-O>O | ||
" Maybe this way in other coding standards | ||
" inoremap { <CR>{<CR>}<C-O>O | ||
|
||
set background=dark | ||
set mouse=a | ||
set foldmethod=marker | ||
" Standard mapping after PEAR coding standard | ||
" Maybe this way in other coding standards | ||
" inoremap ( ( )<LEFT><LEFT> | ||
|
||
"; i command mode ger ; i slutet på raden | ||
noremap ; :s/\([^;]\)$/\1;/<cr> | ||
noremap <tab> :%s/\t/ /g<cr> |