Giter Site home page Giter Site logo

dot-vimrc's Introduction

WangChen's Vim config

I use vundle to manage my plugins, which makes my .vim directory clean and tidy.

Code Completions

Such as completions for variable names and function names(neocomplcache), expanding snippets(snipMate), auto closing brackets/brace/quote(delimitMate) and fast expand expressions to HTML(Emmet-vim).

  • neocomplcache - Ultimate auto completion system for Vim.
  • snipMate - Plugin for using TextMate-style snippets in Vim.
  • supertab - Perform all your vim insert mode completions with Tab.
  • Emmet-vim - High speed HTML and CSS coding.
  • delimitMate - Provides auto-balancing and some expansions for parens, quotes, etc.

Tutorial

:help neocomplcache
:help SnipMate
:help supertab
:help delimitMate

Shortcuts

  • Tab -> Rotate across the completion list
  • Tab -> Expand snippets or jump to the next placeholder of snippet
  • Ctrl + j -> Call zen-coding expansion on html tags

Dependencies

Compile Vim with --enable-pythoninterp and --enable-rubyinterp to enable powerful syntax completion supplied by neocomplcache.

brew install macvim --override-system-vim  # OS X
pacman -S gvim                             # ArchLinux
sudo apt-get install vim-gtk               # Ubuntu

Screenshots

Completions Snippets

Sometimes we need to jump to previous positions to copy/paste or do some fixes:

Fast navigation

  • matchit - Extended % matching for HTML, LaTeX, and many other languages.
  • EasyMotion - Vim motions on speed!

Tutorial

:help easymotion

Shortcuts

  • % -> Jump between brackets and html/xml tags
  • <leader> + w -> Beginning of the word.
  • <leader> + f + {char} -> Find {char} to the right.

Doing fixes should be as fast as possible!

Fast editing

  • surround - Easily delete, change and add such surroundings in pairs.
  • nerdcommenter - Easy commenting of code for many filetypes.
  • IndentGuides - A Vim plugin for visually displaying indent levels in code.

Tutorial

:help text-objexts
:help surround
:help tabular

Shortcuts

  • % -> Jump between brackets and html/xml tags
  • <leader> + c + <space> -> Toggle comment
  • F3 -> Toggle Gundo viewer
  • F4 -> Toggle Indent Guides

IDE features

  • nerdtree - A tree explorer plugin for navigating the filesystem.
  • tagbar - Displays the tags of the current file in a sidebar.
  • ack-vim - Front for the Perl module App::Ack.
  • ctrlp - Fuzzy file, buffer, mru and tag finder.
  • powerline - The ultimate vim statusline utility.
  • fugitive - a Git wrapper so awesome, it should be illegal.
  • syntastic - Syntax checking hacks for vim.

Dependencie

pacman -S ack ctags                  # ArchLinux
sudo apt-get install ack-grep ctags  # Ubuntu
brew install ack ctags               # OS X

For syntax check tools:

Languages Lint Tools Install guide
C gcc built-in
CPP g++ built-in
CSS csslint npm install -g csslint
Erlang escript built-in
Go go built-in
HTML tidy built-in
Java javac built-in
Javascript jshint npm install -g jshint
Json jsonlint npm install -g jsonlint
Lisp clisp built-in
Lua luac built-in
Perl perl built-in
PHP php built-in
Python pyflakes sudo pip install pyflakes
Ruby ruby built-in
XML xmllint built-in
YAML js-yaml npm install -g js-yaml
Latex latex built-in

Shortcuts

  • F5 -> Toggle tagbar
  • F6 -> Toggle Nerd-tree file viewer
  • Ctrl + p -> Toggle ctrlp
  • Alt + 1~9 -> Switch between multiple buffers
  • Ctrl + h/j/k/l -> Moving between spilt windows
  • :Ack or <leader> + a -> Toggle Ack searching

Screenshots

Vim IDE 1 Vim IDE 2

Other Utils

  • fcitx-status - automatic change status of fcitx in vim.
  • togglemouse - Toggles the mouse focus between Vim and your terminal emulator, allowing terminal emulator mouse commands, like copy/paste.

Shortcuts

  • F12 -> Toggle Mouse

Better syntax/indent for language enhancement

  • Server
    • php
  • Web
    • html5
    • javascript
    • jquery
  • Markup language
    • markdown
    • textile

Themes

  • blackboard - Textmate's Blackboard theme for vim (with iTerm2 theme)
  • molokai - A port of the monokai scheme for TextMate
  • solarized - precision colorscheme for the vim text editor
  • vividchalk - colorscheme based on the Vibrant Ink theme for TextMate
  • distinguished - A dark vim color scheme for 256-color terminals.
  • tomorrow - Tomorrow Theme for Vim
  • fisa - soft color scheme for terminals with 256 colors Clone in Mac

Additional functions

  1. File encoding auto detection
  • Hightlight current line and column
  • Automatically jump to the last edited location
  • :w/:wq error correction
  • Remove trailing white space(run :FixWhitespace in vim)
  • Code folding is disabled, enable it as you wish
  • w!! to write if you forget add sudo
  • Indent style:
    • JavaScript - Use soft-tabs with a two space indent(According to this Post).
    • HTML/CSS - Use soft-tabs with a two space indent(According to Google and Github's HTML/CSS style guide, just Google it).
    • PHP - Use soft-tabs with a two space indent(According to Apache PHP Style Guide).
    • Python - Use soft-tabs with a four space indent(PEP8).

Installation

  1. Backup your old vim configuration files:

     mv ~/.vim ~/.vim.orig
     mv ~/.vimrc ~/.vimrc.orig
    
  2. Clone and install this repo:

     git clone git://github.com/wangvsa/dot-vimrc.git ~/.vim
     ln -s ~/.vim/vimrc ~/.vimrc
    
  3. Setup Vundle:

     git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
    
  4. Install bundles. Launch vim(ignore the errors and they will disappear after installing needed plugins)and run:

     :BundleInstall
    

Thst's it!

How to manage this vimrc?

All plugins are listed in file bundles.vim with detailed comments, just add plugins as you like.

  1. :BundleClean to clean up unused plugins
  2. :BundleInstall to install newly added plugins
  3. :BundleInstall! to upgrade all plugins

Other configurations are also well organized in vimrc.

Known issues

  • Compeletions are not well supported for statically typed languages(c/c++)
  • Snippets are not shown in completions popups
  • May has some conflicts with GVIM

dot-vimrc's People

Contributors

wangvsa avatar humiaozuzu avatar

Watchers

albert avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.