/Don-vim

vim settings

Primary LanguageVim Script

Don-vim : One Vim Configuration (中文版)

  _____                          _
 |  __ \                        (_)
 | |  | | ___  _ __ ________   ___ _ __ ___
 | |  | |/ _ \| '_ \______\ \ / / | '_ ` _ \
 | |__| | (_) | | | |      \ V /| | | | | | |
 |_____/ \___/|_| |_|       \_/ |_|_| |_| |_|

Introduction

Don-vim is a vim configuration for Vim, Gvim and MacVim, and it is compatible on Windows, Linux, *nix and Mac. The distribution is fully customisable using ~/.vimrc.local, ~/.vimrc.bundles.local, and ~/.vimrc.before.local files.

Screenshot

Dark theme screenshot

dark_screenshot

Installation

Requirements

Plugins' Names Requirements Solutions
neocomplete lua install vim with lua

Font Requirements

For developers, I recommend to use the font named Inconsolata

Ubuntu Installation

sudo apt-get install aptitude
sudo aptitude install exuberant-ctags ack-grep git build-essential cmake python-dev cscope pylint vim

Automatic Installation

wget "https://raw.githubusercontent.com/peidong/Don-vim/master/script/base-donvim-osx-linux.sh" -O base-donvim-osx-linux.sh && wget "https://raw.githubusercontent.com/peidong/Don-vim/master/script/install-donvim-osx-linux.sh" -O install-donvim-osx-linux.sh && bash install-donvim-osx-linux.sh

Manually Installation

cd ~
git clone https://github.com/peidong/Don-vim.git
mv Don-vim .vim
cd .vim
ln -s $(pwd)/vimrc/.vimrc ~/.vimrc
cp ~/.vim/vimrc/.vimrc.before.local ~/.vimrc.before.local
cp ~/.vim/vimrc/.vimrc.bundles.local ~/.vimrc.bundles.local
cp ~/.vim/vimrc/.vimrc.local ~/.vimrc.local
cp ~/.vim/config/.ycm_extra_conf.py ~/.ycm_extra_conf.py
cp ~/.vim/config/.tmux.conf ~/.tmux.conf
mkdir ~/.undodir/
mkdir -p ~/.vim/bundle/repos/github.com/Shougo/dein.vim
git clone https://github.com/Shougo/dein.vim ~/.vim/bundle/repos/github.com/Shougo/dein.vim

Then vim, and :call dein#install()

cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer --omnisharp-completer --gocode-completer

Automatic Update

wget "https://raw.githubusercontent.com/peidong/Don-vim/master/script/base-donvim-osx-linux.sh" -O base-donvim-osx-linux.sh && wget "https://raw.githubusercontent.com/peidong/Don-vim/master/script/update-donvim-osx-linux.sh" -O update-donvim-osx-linux.sh && bash update-donvim-osx-linux.sh

Mac OSX Installation

How to install MacVim

./configure --with-features=huge --enable-cscope --enable-largefile --enable-luainterp=yes --enable-multibyte --enable-mzschemeinterp --enable-perlinterp=yes --enable-pythoninterp=yes --with-python-config-dir=/usr/lib/python2.7/config --enable-rubyinterp=yes --enable-tclinterp

install pip

Install vimrc

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install ack cmake ctags cscope
sudo pip install pylint

Automatic Installation

curl https://raw.githubusercontent.com/peidong/Don-vim/master/script/base-donvim-osx-linux.sh -L > base-donvim-osx-linux.sh && curl https://raw.githubusercontent.com/peidong/Don-vim/master/script/install-donvim-osx-linux.sh -L > install-donvim-osx-linux.sh && bash install-donvim-osx-linux.sh

Manually Installation

cd ~
git clone https://github.com/peidong/Don-vim.git
mv Don-vim .vim
cd .vim
ln -s $(pwd)/vimrc/.vimrc ~/.vimrc
cp ~/.vim/vimrc/.vimrc.before.local ~/.vimrc.before.local
cp ~/.vim/vimrc/.vimrc.bundles.local ~/.vimrc.bundles.local
cp ~/.vim/vimrc/.vimrc.local ~/.vimrc.local
cp ~/.vim/config/.ycm_extra_conf.py ~/.ycm_extra_conf.py
cp ~/.vim/config/.tmux.conf ~/.tmux.conf
mkdir ~/.undodir/
mkdir -p ~/.vim/bundle/repos/github.com/Shougo/dein.vim
git clone https://github.com/Shougo/dein.vim ~/.vim/bundle/repos/github.com/Shougo/dein.vim

Then vim, and :call dein#install()

cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer --omnisharp-completer --gocode-completer

Automatic Update

curl https://raw.githubusercontent.com/peidong/Don-vim/master/script/base-donvim-osx-linux.sh -L > base-donvim-osx-linux.sh && curl https://raw.githubusercontent.com/peidong/Don-vim/master/script/update-donvim-osx-linux.sh -L > update-donvim-osx-linux.sh && bash update-donvim-osx-linux.sh

Installing on Windows

Installing dependencies

Install Vim

After the installation of Vim you must add a new directory to your environment variables path.

Open Vim and write the following command, it will show the installed directory:

:echo $VIMRUNTIME
C:\Program Files (X86)\Vim\vim74

Then you need to add it to your environment variable path. After that try execute vim within command prompt (press Win-R, type cmd, press Enter) and you’ll see the default vim page.

Install msysgit

After installation try running git --version within command prompt (press Win-R, type cmd, press Enter) to make sure all good:

C:\> git --version
git version 1.7.4.msysgit.0

Setup Curl

Instructions blatently copied from vundle readme Installing Curl on Windows is easy as [Curl] is bundled with [msysgit]! But before it can be used with [Vundle] it's required make curl run in command prompt. The easiest way is to create curl.cmd with this content

@rem Do not use "echo off" to not affect any child calls.
@setlocal

@rem Get the abolute path to the parent directory, which is assumed to be the
@rem Git installation root.
@for /F "delims=" %%I in ("%~dp0..") do @set git_install_root=%%~fI
@set PATH=%git_install_root%\bin;%git_install_root%\mingw64\bin;%PATH%

@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
@if not exist "%HOME%" @set HOME=%USERPROFILE%

@curl.exe %*

And copy it to C:\Program Files\Git\cmd\curl.cmd, assuming [msysgit] was installed to c:\Program Files\Git

to verify all good, run:

C:\> curl --version
curl 7.21.1 (i686-pc-mingw32) libcurl/7.21.1 OpenSSL/0.9.8k zlib/1.2.3
Protocols: dict file ftp ftps http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp
Features: Largefile NTLM SSL SSPI libz

Setup vimrc

Automatic Installation

Type "Windows+x" to open a command window with Administrative right

curl -OL https://raw.githubusercontent.com/peidong/Don-vim/master/script/install-donvim-windows.cmd && call install-donvim-windows.cmd

Manually Installation

cd %userprofile%
git clone https://github.com/peidong/Don-vim.git
move Don-vim .vim
mklink .vimrc .vim\vimrc\.vimrc
copy .vim\vimrc\.vimrc.before.local vimrc.before.local
copy .vim\vimrc\.vimrc.bundles.local vimrc.bundles.local
copy .vim\vimrc\.vimrc.local vimrc.local
mkdir .vim\bundle
mkdir %userprofile%\.undodir
git clone https://github.com/Shougo/neobundle.vim .vim\bundle\neobundle.vim

Then vim, and :NeoBundleInstall

Download vimproc_win32/win64.dll, and copy them to .vim\bundle\vimproc.vim\lib

Automatic Update

Type "Windows+x" to open a command window with Administrative right

curl -OL https://raw.githubusercontent.com/peidong/Don-vim/master/script/update-donvim-windows.cmd && call update-donvim-windows.cmd

Keymap

Normal Mode

Pure vimscript plugins
Plugin 'mattn/emmet-vim'
Keybinding Description
C-y , Emmet-vim
Plugin 'brookhong/cscope.vim'
Keybinding Description
<leader> b c scan the cursor word
Plugin 'majutsushi/tagbar'
Keybinding Description
<leader> b t Open Tagbar list.
Plugin 'scrooloose/nerdtree'
Keybinding Description
<leader> b f Open file list.<CR>:open,r:refresh,I:show or show off hidden files,m:show functions list
x close the tree
X close the tree(recursive)
r refresh the tree
R refresh the tree(recursive)
p jump to the parent
P jump to the parent(root)
j(k) down(up)
K(J) big down(up)
o open
i(s) split up/down(left/right)
c change to root
q close
Plugin 'mbbill/undotree'
Keybinding Description
<leader> b u show undo list
Plugin 'xuhdev/vim-latex-live-preview'
Keybinding Description
:LLPStartPreview Using pdf to preview Latex
Plugin 'lervag/vimtex'
Keybinding Description
] ] Create close envelope
Plugin 'tpope/vim-surround'
Keybinding Description
ds delete a surrounding
cs change a surrounding
ys<motion> add a surrounding
yS add a surrounding and place the surrounded text on a new line + indent it
yss add a surrounding to the whole line
ySs add a surrounding to the whole line, place it on a new line + indent it
ySS same as ySs
Plugin 'kien/ctrlp.vim'
Keybinding Description
C-p invoke CtrlP in find file mode
C-j(k) navigate the result list
Enter open the file
Plugin 'gcmt/wildfire.vim'
Keybinding Description
Enter select the area
Backspace backward
Plugin 'tpope/vim-fugitive'
Keybinding Description
:Gcommit git commit
:Gpush git push
:Gdiff git diff
:Gstatus git status
D git diff
C-n(p) next(previous) file
- add file
cc git commit
q quit
Plugin 'tomtom/tcomment_vim'
Keybinding Description
gc<motion> Comment/uncomment the context
gcc Comment/uncomment the line
g><motion> Comment the context
g>c Comment the line
g<<motion> Uncomment the context
g<c Uncomment the line
Plugin 'easymotion/vim-easymotion'
Keybinding Description
<leader> <leader> f ? Jump to the ? word
<leader> <leader> j(k) Jump to the next(below) lines
<leader> <leader> w(e) Jump to the words begining(end)
<leader> <leader> . repeat jump
v <leader> <leader> f ? Select to the ? word
d <leader> <leader> f ? Delete to the ? word
y <leader> <leader> f ? Copy to the ? word
Plugin 'terryma/vim-multiple-cursors'
Keybinding Description
C-n search the next word
C-p search the previous word
C-x search skip
Plugin 'vim-ctrlspace'
Keybinding Description
C-<space> show tab buffers
j(k) down(up)
<return> open file
v(V) vertical split open (cursor in ctrlspace)
s(S) split open (cursor in ctrlspace)
<ESC>/q close
Other plugins
Plugin 'Valloric/YouCompleteMe'
Keybinding Description
<leader> c j d :YcmCompleter GoToDeclaration<CR>
<leader> c j e :YcmCompleter GoToDefinition<CR>
Plugin 'dyng/ctrlsf.vim'
Keybinding Description
<leader> r t :CtrlSF<CR>:search the cursor word,q:quit,p:see details
p Preview
q Quit search mode
Plugin 'MikeCoder/markdown-preview.vim'
Keybinding Description
<leader> b m Markdown Preview in Github format

Insert Mode

Keybinding Description
jj <ESC> : return to Normal Mode