/vimfiles

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

Primary LanguageVim Script

Vim

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

Bundled Plugins

Util

  • Ack – type :Ack [search pattern] to search your entire project
  • Align – align blocks of text using equal sign, make comment boxes and more
  • AutoJump – Adds autojump support to vim
  • Command-T – the fastest and most intuitive way for opening files in your project
  • matchit – extended % matching for HTML, LaTeX, and many other languages
  • neocomplcache – Ultimate auto-completion system for Vim.
  • supertab – pseudo auto-complete with tab
  • surround – add, change, remove surrounding parentheses, brackets, quotes, etc
  • vim-snipmate – support for textmate-like snippets for several languages
  • snipmate-snippets – vim-snipmate default snippets
  • vim-easymotion – Vim motions on speed!
  • yankring – Maintains a history of previous yanks, changes and deletes

Explorer and Buffer

  • bufexplorer – manage your file buffers
  • minibufexpl – Elegant buffer explorer – takes very little screen space
  • NERD_commenter – support to comment lines of code
  • NERD_tree – project pane that you can open with [leader] p
  • taglist – Source code browser (supports C/C++, java, perl, python, tcl, sql, php, etc)
  • tagbar – Vim plugin that displays tags in a window, ordered by class etc.
  • vim-statline – Add useful informations to Vim statusline

ruby

  • cucumber – support for cucumber features such as syntax highlight, indentation, etc
  • endwise – support to close Ruby blocks such as ‘if’, ‘do’ with ‘end’
  • vim-ruby-sinatra – syntax highlight for Sinatra
  • vim-ruby – syntax highlight, smart identation, auto-complete for Ruby
  • rails – lot’s of tools to make it easier to manage your Rails projects
  • vim-rvmRVM support for Vim
  • vim-textobj-rubyblock – smart block selection in Ruby code
  • ragtag – easier way to create tags for html, erb, etc
  • vim-bundler – Bundler support for Vim

Git

  • fugitive – support for Git, adding convenient commands such as :Gstatus, :Gread, :Gmove

Web and Syntax Highlight

  • haml – syntax highlight for HAML
  • html5.vim – omnicomplete function and syntax for HTML5
  • markdown – syntax highlight for Markdown
  • syntastic – checks for syntax errors in many languages
  • textile – syntax highlight for Textile
  • vim-coffee-script – syntax highlight for Coffee Script
  • vim-jade – Vim syntax highlighting for the Jade templating engine
  • vim-jquery – Vim syntax file to add some colorations for jQuery keywords and css selectors
  • vim-preview – [leader] P previews Markdown, Rdoc, Textile, html. Requires Ruby and other gems.
  • vividchalk – color scheme inspired by the classic Vibrant for Textmate
  • Zencoding – powerful way for HTML abbreviations (learn here: http://code.google.com/p/zen-coding/). Type abbreviation and press Ctrl+Y+comma (c-y ,)

Java

  • javacomplete – Omni Completion for JAVA
  • vjde – Vim – Just a Development Envirement (Java/C++)

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.

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  

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.

Color Scheme

see more theme in here

find colorscheme in ~/.vim/vimrc and replace by your favorite theme

reference: janus#ColorScheme

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

Dependencies

You will need these dependencies figured out:

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/)

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.

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
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).

IMPORTANT: Autojump.vim

see joelthelion@github.com/autojump/wiki to install native support,

and see trotter@github.com/autojump.vim how to use in vim

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

Vim Customize map key

Leader key and Navigation

  
let mapleader=","
let g:mapleader=","
  
  
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
  

Buffer Navigation

  
map <silent> gB :bp<cr>
map <silent> gb :bn<cr>
map <silent> g0 :bf<cr>
map <silent> g$ :bl<cr>
  

Plugins

  
nnoremap <CR> :CommandT<CR>

nnoremap <F4> :GundoToggle<CR>
nnoremap <leader>u :GundoToggle<CR>

nnoremap <silent> <F5> :NERDTreeToggle<CR>
nnoremap <silent> <leader>g :NERDTreeToggle<CR>

nnoremap <silent> <F6> :TagbarToggle<CR>
nnoremap <silent> <leader>tb :TagbarToggle<CR>

nnoremap <silent> <F9> :YRShow<cr>
nnoremap <silent> <leader>y :YRShow<cr>

nnoremap <silent> <F10> :YRSearch<cr>
nnoremap <silent> <Leader>gy :YRSearch<cr>
  

Plugin: SnipMate

Where is the snippets?


~/.vim/snippets

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.


<div id="${1: default}">${2}</div>

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


snippet div
    <div id="${1: default}">
        ${2}
    </div>

you can reference more in ~/.vim/snippets/

Plugin: Neocomplcache

To read doc about this plugin usage, type following commands.


  :help neocomplcache

Usage

when keyword match the pattern, it will pop a menu, then use <C-N> and <C-P> to select next or prev, type <C-K> to confirm your selection.

or if keyword match the snippet pattern, you can type <TAB> to do omni-completion, when enter snippet-completion mode, do same as prev step.

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.

File Completion

use <C-f> to do file-completion (origin is <C-x><C-f>)

Omni Completion

HTML, Javascript, CSS: use <tab> to do omni-completion. (see next for java)

Java-Completion Support

use <tab> to do keyword / auto completion. (only java-base api, by plugin/vjde)

use <C-o> to do omni completion. (by plugin/javacomplete, origin is <C-x><C-o>)

Play! Framework Support

type <m><tab> 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 <c><tab> 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

Learn Vim

Visit the following sites to learn more about Vim:

There are many sites teaching Vim, if you know of any other that are easy
to follow for newcomers, let me know.

Cheat Sheet

TODO

https://github.com/carlhuda/janus

https://github.com/vgod/vimrc

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 , and KISS: Keep It Simple & Stupid

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.

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:)

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