diff --git a/README.md b/README.md index 7e89377..b4f4153 100644 --- a/README.md +++ b/README.md @@ -122,10 +122,48 @@ The demo below shows the `:Wsimilar` Ex command in action. see `:h wordpress-wpseek-integration` for more. +## Getting Started + +The repository includes a [minimal Vimrc][19] for trying out WordPress.vim without +affecting your existing Vim configuration. Plugin management is done with +[Vundle][12]. + +First backup your existing vimrc. + +```bash +$ mv ~/.vimrc ~/.vimrc_backup +``` + +Then download the [minimal vimrc][19] to a temporary directory like +`/tmp/wordpress_vim`. + +```bash +$ mkdir -p /tmp/wordpress_vim +$ wget -O /tmp/wordpress_vim/vimrc https://raw.githubusercontent.com/dsawardekar/wordpress.vim/develop/examples/minimal_vimrc +``` + +Link the tmp vimrc to your `$HOME` vimrc. + +```bash +$ ln -s /tmp/wordpress_vim/vimrc ~/.vimrc +``` + +Now start Vim. + +The first time the `vimrc` will download Vundle to the `/tmp/wordpress_vim` directory and then +proceed to install the required plugins using Vundle. Plugins will be +installed in the subdirectory `/tmp/wordpress_vim/bundle`. + +Installation may take a few minutes. Once completed you will have a custom vim +configuration separate from your existing one. + +To move to your old configuration simply link your backup vimrc back to the +`$HOME` vimrc. + ## Installation ##### 1. With [Vundle][12] -`Bundle 'dsawardekar/wordpress.vim'` +`Plugin 'dsawardekar/wordpress.vim'` ##### 2. With [NeoBundle][13] `NeoBundle 'dsawardekar/wordpress.vim'` @@ -219,6 +257,8 @@ MIT License. Copyright © 2014 Darshan Sawardekar. [15]: https://github.com/tyru/open-browser.vim [16]: http://wpseek.com/ [17]: https://github.com/kien/ctrlp.vim +[18]: https://raw.githubusercontent.com/dsawardekar/wordpress.vim/develop/examples/minimal_vimrc.vim +[19]: https://github.com/dsawardekar/wordpress.vim/develop/examples/minimal_vimrc.vim [20]: http://i.imgur.com/YClNJML.png [21]: http://i.imgur.com/3i7qrHJ.gif diff --git a/examples/minimal_vimrc.vim b/examples/minimal_vimrc.vim new file mode 100644 index 0000000..ec6cc25 --- /dev/null +++ b/examples/minimal_vimrc.vim @@ -0,0 +1,136 @@ +" turn of Vi compatibility mode +set nocompatible + +" plugins will be stored relative to current file {{{1 +" Eg:- ~/.vim/vimrc.vim => ~/.vim/bundle +let plugins_dir_name = 'bundle' +let vimrc_path = resolve(expand('')) +let vimrc_dir = fnamemodify(vimrc_path, ':h') +let plugins_dir = vimrc_dir . '/' . plugins_dir_name +let plugins_dir_exists = isdirectory(plugins_dir) +let vundle_dir = plugins_dir . '/' . 'vundle' +let hybrid_dir = plugins_dir . '/' . 'vim-hybrid' +let vundle_dir_exists = isdirectory(vundle_dir) +" }}}1 + +" install vundle if not found {{{1 +if !vundle_dir_exists + call mkdir(vundle_dir, 'p') + let install_cmds = [] + + call add(install_cmds, 'echo "Installing Vundle ..."') + call add(install_cmds, 'git clone https://github.com/gmarik/vundle.git ' . vundle_dir) + + " allows using hybrid color scheme during the plugin installs + call add(install_cmds, 'echo "Installing Hybrid Color Scheme ..."') + call add(install_cmds, 'git clone https://github.com/w0ng/vim-hybrid.git ' . hybrid_dir) + execute ':set rtp+=' . hybrid_dir + + let install_cmd = ":silent !" . join(install_cmds, ' && ') + execute install_cmd +endif +" }}}1 + +" vundle configuration {{{1 +filetype off +execute ':set rtp+=' . vundle_dir +call vundle#rc(plugins_dir) +" }}}1 + +" vim defaults {{{1 +set showcmd +set hidden +set number +set modelines=0 +set nomodeline +set ruler +set wildmode=list:full +set undolevels=100 +set wildignore=.svn,CVS,.git,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,*.pdf,*.bak,*.beam,*.pyc +set encoding=utf-8 +set laststatus=2 +set t_Co=256 +set timeout +set timeoutlen=500 +set ttimeoutlen=500 +set synmaxcol=512 +set ttyfast +set scrolloff=5 +set backspace=indent,eol,start +set autoindent +" }}}1 + +" plugin configuration {{{1 +" airline +let g:airline_theme='hybrid' + +" Ultisnips +" switch triggers to maintain compatibility with SuperTab & YCM +let g:UltiSnipsExpandTrigger = "" +let g:UltiSnipsJumpForwardTrigger = "" +let g:UltiSnipsJumpBackwardTrigger = "" + +" Ctrlp +set wildignore+=vendor/*,docs/*,node_modules/*,components/*,build/*,dist/* + +" SuperTab +let g:SuperTabDefaultCompletionType = "context" +let g:SuperTabCompletionContexts = ['s:ContextText', 's:ContextDiscover'] +let g:SuperTabContextTextOmniPrecedence = ['&omnifunc', '&completefunc'] +let g:SuperTabContextDiscoverDiscovery = ["&completefunc:", "&omnifunc:"] + +" }}}1 + +" vundle managed plugins {{{1 +" core +Plugin 'gmarik/vundle' + +" colorschemes +Plugin 'w0ng/vim-hybrid' + +" status bar +Plugin 'bling/vim-airline' + +" code browsing +Plugin 'kien/ctrlp.vim' + +" autocompletion +Plugin 'ervandew/supertab' + +" snippets +Plugin 'SirVer/ultisnips' + +" language common +Plugin 'scrooloose/syntastic' + +" php +Plugin 'StanAngeloff/php.vim' +Plugin 'shawncplus/phpcomplete.vim' + +" general web dev +Plugin 'tpope/vim-markdown' +Plugin 'tyru/open-browser.vim' + +" wordpress +Plugin 'dsawardekar/wordpress.vim' +" }}}1 + +" vundle installation {{{1 +" use hybrid if present +silent! colorscheme hybrid + +if !vundle_dir_exists + redraw! + PluginInstall +end +" }}}1 + +" appearance {{{1 +" omnicompletion config +set completeopt=menu,menuone,longest +set pumheight=15 +" }}}1 + +" vundle complete, turn back filetypes +filetype plugin indent on +syntax on