Last active
December 18, 2015 05:39
-
-
Save brycefisher/5734279 to your computer and use it in GitHub Desktop.
Drupal Optimized Crossplatform vimrc
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
"-------About----- | |
" I use this .vimrc and the accompanying git repo of plugins, | |
" colorschemes, and other config files on Windows Vista, | |
" Windows 7, Ubuntu 12.04, and Mac OSX 10.7 on a daily basis. | |
" | |
" Pull requests and comments welcome! | |
"------INSTALLATION--- | |
" $ git clone --recursive https://github.com/brycefisher/vimfiles.git ~/.vim | |
" Download and install Source Code Pro font (from Adobe): | |
" https://github.com/adobe/source-code-pro/blob/master/Roman/Regular/font.ttf | |
" $ git clone https://gist.github.com/5734279.git ~/myvimrc | |
" $ ln -s ~/myvimrc/.vimrc ~/.vimrc | |
"-------General---- | |
set nocompatible | |
set autochdir " always switch to the current file directory | |
"-------Errors----- | |
set noerrorbells | |
"-------DRUPAL Coding Style---- | |
set smartindent | |
set tabstop=2 | |
set shiftwidth=2 | |
set expandtab | |
"-------File Formatting------- | |
set enc=utf-8 "Default to UTF8 | |
set fileformats=unix,dos,mac " support all three, in this order | |
"Useful for checking if the BOM is set a file (can cause weird problems in HTML on some browsers) | |
"------White Space----------- | |
match ErrorMsg '\s\+$' | |
"--------GUI OPTIONS-------- | |
set rnu "Relative line numbers | |
set fo=tcrq | |
set showmode | |
set showcmd | |
let loaded_matchparen = 1 "Do NOT match parens -- this is really painful when doing vim in the shell. | |
set ruler | |
set nowrap | |
set guioptions+=b "horizontal scrollbar | |
set background=dark | |
colorscheme base16-default | |
if has("gui_macvim") | |
set guifont=Source_Code_Pro:h14 | |
elseif has("gui_gtk") | |
set guifont="Source Code Pro":h10 | |
else | |
set guifont=Source_Code_Pro:h10 | |
endif | |
if has("gui_running") | |
set lines=999 columns=999 "maximize gvim window size | |
endif | |
"--------Drupal------------ | |
syntax on | |
filetype on | |
au BufNewFile,BufRead *.module set filetype=php | |
au BufNewFile,BufRead *.install set filetype=php | |
au BufNewFile,BufRead *.test set filetype=php | |
au BufNewFile,BufRead *.view set filetype=php | |
au BufNewFile,BufRead *.inc set filetype=php | |
"-------LESS-------- | |
au BufNewFile,BufRead *.less set filetype=less | |
"-------SEARCH OPTIONS------ | |
set incsearch " show 'best match so far' as you type | |
set hlsearch " hilight the items found by the search | |
set ignorecase " ignores case of letters on searches | |
set smartcase " Override the 'ignorecase' option if the search pattern contains upper case characters | |
highlight search guifg=yellow guibg=darkred | |
"-------Windows----------- | |
if has("gui_win32") | |
source $VIMRUNTIME\mswin.vim | |
endif | |
"------- Turn backup off --- | |
set nobackup | |
set nowritebackup | |
set noswapfile | |
"------- Pathogen | |
execute pathogen#infect() | |
"------- Airline | |
set laststatus=2 | |
"------- Key Mappings ------ | |
let g:mapleader="," | |
"NERDTree | |
nnoremap <Leader>n :NERDTreeToggle<CR> | |
"Gundo Shortcut | |
nnoremap <Leader>t :GundoToggle<CR> | |
"PHP Integrations | |
nnoremap <Leader>p :! php -d display_errors=1 -l "%"<CR> | |
nnoremap <Leader>pa "zyw:exec "Open http://php.net/".@z<CR> | |
if has("gui_win32") | |
nnoremap <Leader>pe :sp C:\Windows\Temp\php-error.log<CR><C-W>J | |
endif | |
"JSHINT Integration | |
nnoremap <Leader>j :! jshint "%"<CR> | |
"Ruby Integration | |
nnoremap <Leader>r :! ruby -c "%"<CR> | |
"Git integrations | |
"@TODO Integrate with fugitive OR remove fugitive | |
nnoremap <Leader>gb :exe "! git blame -L " . line('.') . " %"<CR> | |
nnoremap <Leader>gs :! git status<CR> | |
nnoremap <Leader>ga :! git add %<CR> | |
nnoremap <Leader>gc :! git commit -m " | |
nnoremap <Leader>gps :! git push<CR> | |
nnoremap <Leader>gpl :! git pull<CR> | |
"Drush integrations | |
nnoremap <Leader>dr :!drush | |
nnoremap <Leader>drc :! drush cc all<CR> | |
nnoremap <Leader>drupdb :!drush updb<CR> | |
nnoremap <Leader>dren :!drush en -y | |
nnoremap <Leader>drdis :!drush dis -y | |
"Search JQuery API Docs online against the word under cursor | |
nnoremap <Leader>jqa "zyw:exec "Open http://api.jquery.com/?s=".@z<CR> | |
"Search Drupal 6 API docs for word under cursor | |
nnoremap <Leader>da "zyw:exec ":Open https://api.drupal.org/api/drupal/6/search/".@z<CR> | |
"Jump start a DuckDuckGo Search | |
nnoremap <Leader>ddg :Open https://duckduckgo.com/?q= | |
"Remove Trailing Whitespace | |
nnoremap <Leader>rtw :%s/\s\+$//e<CR> | |
"----Windows Style Crutches for Linux | |
if has("gui_gtk") | |
" backspace in Visual mode deletes selection | |
vnoremap <BS> d | |
" CTRL-X is Cut | |
vnoremap <C-X> "+x | |
" CTRL-C is Copy | |
vnoremap <C-C> "+y | |
" CTRL-V is Paste | |
vnoremap <C-V> "+gP | |
inoremap <C-V> <ESC>"+gP<CR>i | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added new drush keyboard shortcuts for even tighter integration with Drupal.