s90198123 / vimfiles

vim modern ide for web dev: command-t, easymotion, matchit, neocomplcache, snipmate, surround, yankring, nerdtree, bufexplorer, autojump, minibufexpl, fugitive, tagbar, rails, play! framework
8 stars 0 forks source link

h1. Vim

It is recommended that you use gVim in either Windows or Linux and MacVim for Mac. Download from:

h1. Bundled Plugins

h2. Util

h2. Explorer and Buffer

h2. ruby

h2. Git

h2. Web and Syntax Highlight

h2. Java

h1. Usage

Troubleshoot: Because of the large amount of submodules, if you ever have any trouble after pulling from the repository, it will be easier to just back up your old .vim folder and just git clone a new version.

h2. Linux and Mac

use command 'curl'

  curl -o - https://raw.github.com/s90198123/vimfiles/master/install_vim.sh | sh  

or 'wget'

  wget -O - https://raw.github.com/s90198123/vimfiles/master/install_vim.sh | sh  

h2. Windows

Clone this repo into your home directory either as .vim (linux/mac) or vimfiles (Windows). Such as:


git clone git://github.com/s90198123/vimfiles.git ~/vimfiles
run this to get the snippets submodule:

cd ~/vimfiles
git submodule update --init
On Windows you should create a _vimrc (underline instead of dot) and add the following line inside:

source ~/vimfiles/vimrc
This way you can override the default configuration by adding your own inside this file. On Windows you should create a _gvimrc (underline instead of dot) and add the following line inside:

source ~/vimfiles/gvimrc
This way you can override the default GUI configuration by adding your own inside this file. h1. Color Scheme see more theme in "here":http://www.vi-improved.org/color_sampler_pack/ find colorscheme in ~/.vim/vimrc and replace by your favorite theme reference: "janus#ColorScheme":https://github.com/carlhuda/janus h1. Help Tags At first usage of vim, type ":" while in command mode and execute: call pathogen#helptags() This will make the plugins documentations available upon :help h1. Dependencies You will need these dependencies figured out: * Ruby (for the command-t plugin) * Exuberant Ctags (http://ctags.sourceforge.net/) * Ncurses-term (in Linux only) In Ubuntu, for example, you will have to do:

apt-get install exuberant-ctags ncurses-term
In OS X, you can install ctags with homebrew

brew install ctags
On Windows you have to download Ctags and add ctags.exe in your PATH. Mac OS X and most Linux distros come with Ruby already. If you're in Windows look for Luis Lavena's latest Ruby Installer (http://rubyforge.org/projects/rubyinstaller/) h1. IMPORTANT: Command-T The latest version replaces the old Fuzzy Finder with a new one called "Command-T" form wincent.com. I've replaced the old "Command-T" key binding that used to open new tabs and assigned it to this new plugin so it behaves the same as Textmate. You may have problems in Mac/Linux because this plugin requires a native extension, so you will have to do this:

rvm use system # use this line if using rvm
cd ~/.vim/bundle/Command-T/ruby/command-t
ruby extconf.rb
make
This means that you need to have your Ruby source files and GCC also installed. A binary for Windows is already bundled so it should just work. I've also included a binary compiled for Ruby Enterprise Edition, but if you are using other Ruby distros, you will need to recompile. There are binaries for Mac and Windows. The Mac version is compiled against the default system Ruby for Mac OS X 10.6.5. The Windows version is compiled against Ruby Installer 1.8.7-p330. h2. Ubuntu 11.04 and/or Vim 7.3.35 Ubuntu 11.04 comes bundled with Vim 7.3.35, which has "flaky" Ruby support. Even if you do everything right, you might see the following crashes when trying to use Command-T:

Vim: Caught deadly signal SEGV
Vim: Finished.

Segmentation fault
If this happens to you, update Vim to 7.3.154:

hg clone https://vim.googlecode.com/hg/ ~/vim
cd ~/vim
hg update -C v7-3-154
./configure --enable-rubyinterp --with-features=huge --enable-gui=gnome2
make
sudo make install
More details can be found "here":http://kresimirbojcic.com/2011/05/14/installing-command-t-ubunutu-11.04-ruby-1.9.2.html Note that the options '--with-features=huge --enable-gui=gnome2' are not mentioned on the post above but they are necessary to also update the graphical version of vim (gvim). h1. IMPORTANT: Autojump.vim see "joelthelion@github.com/autojump/wiki":https://github.com/joelthelion/autojump/wiki to install native support, and see "trotter@github.com/autojump.vim":https://github.com/trotter/autojump.vim how to use in vim h1. INSTALL & UPGRADE PLUGIN BUNDLES All plugins were checked out as git submodules, which can be upgraded with git pull. For example, to upgrade Command-T

cd ~/.vim/bundle/command-t
git pull
To install a new plugin as a git submoudle, type the following commands.

cd ~/.vim
git submodule add [GIT-REPOSITORY-URL] bundle/[PLUGIN-NAME]
To install the plugin, when github has new plugins and local repository exists, type the following commands.

cd ~/.vim
git pull
git submodule upgrade --init
h1. Vim Customize map key h2. Leader key and Navigation
  
let mapleader=","
let g:mapleader=","
  
  
map  h
map  j
map  k
map  l
  
h2. Buffer Navigation
  
map  gB :bp
map  gb :bn
map  g0 :bf
map  g$ :bl
  
h2. Plugins
  
nnoremap  :CommandT

nnoremap  :GundoToggle
nnoremap u :GundoToggle

nnoremap   :NERDTreeToggle
nnoremap  g :NERDTreeToggle

nnoremap   :TagbarToggle
nnoremap  tb :TagbarToggle

nnoremap   :YRShow
nnoremap  y :YRShow

nnoremap   :YRSearch
nnoremap  gy :YRSearch
  
h1. Plugin: SnipMate h2. Where is the snippets?

~/.vim/snippets
h2. How can i create a snippets? there is two way to create. 1. ~/.vim/snippets/{filetype}/{shortcut}.snippet - first, find or create the directory naming by file type in ~/.vim/snippets (ex. ~/.vim/snippets/html), second, create the snippets naming by shortcut name (ex. ~/.vim/snippets/html/div.snippet), finally, put the snippet text in here.

${2}
2. ~/.vim/snippets/{filetype}.snippets - put the snippet text in this file, the syntax like

snippet div
    
${2}
you can reference more in ~/.vim/snippets/ h1. Plugin: Neocomplcache To read doc about this plugin usage, type following commands.

  :help neocomplcache

h2. Usage when keyword match the pattern, it will pop a menu, then use and to select next or prev, type to confirm your selection. or if keyword match the snippet pattern, you can type to do omni-completion, when enter snippet-completion mode, do same as prev step. h2. Alternative plugin if don't like this plugin, can use 'SuperTab' to replace it, and it can work well with 'vjde', but neocomplcache can't. h3. File Completion use to do file-completion (origin is ) h3. Omni Completion HTML, Javascript, CSS: use to do omni-completion. (see next for java) h3. Java-Completion Support use to do keyword / auto completion. (only java-base api, by plugin/vjde) use to do omni completion. (by plugin/javacomplete, origin is ) h1. Play! Framework Support type will generate model

package models;

import java.util.*;
import javax.persistence.*;

import play.db.jpa.*;
import play.data.validation.*;

@Entity
public class User extends Model {
    public String name;
}
type will generate controller

package controllers;

import play.*;
import play.mvc.*;
import play.data.validation.*;

import java.util.*;

import models.*;

public class Users extends Controller {

    public static void index() {
    render();
    }
}
more info in ~/.vim/snippets/java.snippets , ~/.vim/snippets/html.snippets h1. Learn Vim Visit the following sites to learn more about Vim: * "Learn Vim Progressively":http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/ * "Learn Vim Progressively for CN":http://coolshell.cn/articles/5426.html * "Search and replace for CN":http://greenisland.csie.nctu.edu.tw/wp/2005/09/02/302/ * "Vim Introduction and Tutorial":http://blog.interlinked.org/tutorials/vim_tutorial.html * "Vim Text Objects: The Definitive Guide":http://blog.carbonfive.com/2011/10/17/vim-text-objects-the-definitive-guide/ * "Vimcasts":http://vimcasts.org * "Vim: revisited":http://mislav.uniqpath.com/2011/12/vim-revisited/ * "Learn Vimscript the Hard Way":http://learnvimscriptthehardway.stevelosh.com/ There are many sites teaching Vim, if you know of any other that are easy to follow for newcomers, let me know. h1. Cheat Sheet * "Vgod: Vim cheat sheet for programmers":http://blog.vgod.tw/2009/12/08/vim-cheat-sheet-for-programmers/ * "Vim Cheat Sheet and Tutorial":http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html * "Vim Shortcut Wallpaper":https://github.com/LevelbossMike/vim_shortcut_wallpaper h1. TODO "https://github.com/carlhuda/janus":https://github.com/carlhuda/janus "https://github.com/vgod/vimrc":https://github.com/vgod/vimrc h1. Yes! We need your help to make it better We want to offer a better, useful, and modern vim for newer, just like a ide or a powerful text-editor, but the origin vim is lack of many advanced features, and without some awesome plugins, so we create this project. And we want to follow the rule "DRY: Don't Repeat Youself":http://en.wikipedia.org/wiki/Don%27t_repeat_yourself , and "KISS: Keep It Simple & Stupid":http://en.wikipedia.org/wiki/KISS_principle As you see this project, we have a lot of Issues and many unknown and awesome Plugins in Future. We need Volunteers to help, like disscusing or answering with issues, writing doc, find more useful plugins, and test plugins, and so on. h2. How to make it better? * Create issues for suggestion: like improving vimrc setting, or add awesome plugin and so on * Test Plugin and Talk about your experience with it * Join the issue comment * Solve issue: fork this project and create branch to solve issue, then you can send pull request, we will merge it asap. * Write Document or Wiki PS. we will pretty thank for your help:) h1. Credits * Original project and most of the heavy lifting: @scrooloose * All the cool plugins for Rails, Cucumber and more: @timpope * Great Command-T plugin by: Wincent * Hacks and some snippets: @akitaonrails