used to store my vim configurations
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
img
nvim
.gitignore
README.md
tmux.conf
vimrc
zshrc

README.md

This repository contains three configuration files:

  • vimrc
  • neovim
  • zshrc
  • tmux.conf

VIM & Neovim

  1. It works fine on Mac OSX with VIM 8.0+ and Neovim 0.1.7.
  2. It should be OK for Linux with same version.

Install & Upgrade

Install

  1. Clone vim.d

     git clone https://github.com/feiyuw/vim.d.git ~/workspace/vim.d
    
  2. Create ~/.vimrc

     ln -s ~/workspace/vim.d/vimrc ~/.vimrc  # vim
     ln -s ~/workspace/vim.d/nvim ~/.config  # neovim
    
  3. Open nvim, execute :PlugInstall

  4. Patch powerline font

    mkdir ~/.fonts
    git clone https://github.com/powerline/fonts.git ~/.fonts/powerline-fonts
    cd ~/.fonts/powerline-fonts
    ./install.sh
  5. Install cpsm

    sudo apt install libboost-all-dev python-dev
    cd ~/.config/nvim/plugged/cpsm
    ./install.sh
  6. Install YouCompleteMe

    cd ~/.config/nvim/plugged/YouCompleteMe
    ./install.py --go-completer
    
    pip install neovim # for neovim support
  7. Open nvim again, enjoy!

Upgrade

  1. Update vim.d
    cd ~/workspace/vim.d
    git pull
  1. Open nvim, execute :PlugClean
  2. Open nvim, execute :PlugUpdate

Plugins

The plugins I used are:

  • tomasr/molokai
  • nixprime/cpsm
  • ctrlpvim/ctrlp.vim
  • tacahiroy/ctrlp-funky
  • scrooloose/nerdtree
  • vim-scripts/NERD_tree-Project
  • scrooloose/nerdcommenter
  • plasticboy/vim-markdown
  • majutsushi/tagbar
  • vim-airline/vim-airline
  • vim-airline/vim-airline-themes
  • tpope/vim-fugitive
  • Valloric/YouCompleteMe
  • w0rp/ale
  • mfukar/robotframework-vim
  • ntpeters/vim-better-whitespace
  • elzr/vim-json
  • pangloss/vim-javascript
  • mxw/vim-jsx
  • othree/html5.vim
  • airblade/vim-gitgutter
  • wavded/vim-stylus
  • moll/vim-node
  • jiangmiao/auto-pairs
  • ekalinin/Dockerfile.vim
  • fatih/vim-go
  • christoomey/vim-tmux-navigator

Shortcuts

  1. ,e

    open file

  2. ,s

    open file in split window

  3. ,vs

    open file in vertical split window

  4. ,m

    comment/uncomment code

  5. ,f

    open function list of current file, like Ctrl-R in sublime

  6. <F4>

    open/close tag bar on the right panel

  7. <F5>

    execute "make test" in project root

  8. <F12>

    open/close project browser on the left panel

  9. <Ctrl-Tab>

    in normal mode, switch files in minibuffer; in insert mode, used to select code snippet

  10. <Ctrl-p>

    in insert mode, used to open specified file quickly; see detail in ctrlp.vim plugin

  11. ,;

    auto complete

  12. ,c

    copy to system clipboard

  13. ,v

    paste from system clipboard

Some Tips

Edit file in column

  1. in normal mode, <Ctrl-v> start to select column, <Shift-v> to select multiple lines
  2. after select several columns,
    • I used to add content before cursor column
    • A used to add content after cursor column
    • r used to modify content under cursor
    • x used to delete content under cursor

Quick Move

  1. <Ctrl-o> move to previous edit position
  2. <Ctrl-i> move to forward edit position
  3. b move to previous word, w move to next word
    • try B and W, and see what's the difference
  4. { move to previous block, } move to next block
  5. 0 move to start of the line, $ move to end of the line
    • ^ move to first char of the line
  6. gg move to the start of the file, G move to the end of the file
  7. <Ctrl-]> jump to the definition of content under cursor, while <Ctrl-t> jump back

Quick Edit

  1. u undo, <Ctrl-r> redo
  2. . report last step
  3. di' delete content in '
  4. dt' delete content from current position to '
  5. cw modify the current word
  6. caw modify the current word
  7. c0 modify from start to current position
  8. c$ modify from current position to end of this line
  9. R update the content until got ESC

Macro

  1. qa start to record macro a
  2. execute some steps
  3. q stop to record
  4. @a execute the macro
  5. @@ execute the last executed macro

VIM on Terminal

  1. I use "gnome-terminal", suggest modify the color schema similar with vim.
  2. See http://stackoverflow.com/a/7734960/3659453

Screenshot

panel usage

Reference

  1. VIM Tips
  2. VIM scripts
  3. ctrlp.vim introduction
  4. Practical VIM

Tmux

ln -s ~/workspace/vim.d/tmux.conf ~/.tmux.conf
# enjoy

Reference

  1. upgrade tmux from 1.8 to 2.0 on ubuntu 14.04
  2. dayid's tmux & screen cheat-sheet