Vim Setting

July 22, 2015

My Vim setting (.vimrc) is reorganized today. Most of these settings are referred from Vim Wiki Mainly, it supports basic auto read, line number, ruler (specifically for Vim on Mac, this is not necessary for Linux). Also it enables auto spell check with underline highlight for spell bad words and others, and the functionality of returning to the last edit position for opening files is added to it. The last line of basic setting part adds a user defined command Clean for removing spaces at the end of each line.

Another parts of the .vimrc file enables Vundle with plugins julia-vim, tabular and vim-markdown. A few settings of vim-markdown are also presented next to Vundle.

The detailed .vimrc file is attached as follows. And an updating list and a TODO list are added at the end of this post. Hopefully, it will be helpful for others.

" Configuration file for vim
" Edited by Yingzhou Li

" Basic setting for vim
set history=20
set autoread
set number
set ruler                           " status bar setting for Mac

" Setting for spell check
autocmd BufRead *.txt,*.tex,*.md,*.markdown setlocal spell
set spelllang=en_us

" Setting for indent
set tabstop=4
set shiftwidth=4
set softtabstop=4
set autoindent
set expandtab

set viminfo=%,'500,\"500,n~/.viminfo

" Setting for highlight
syntax on
highlight Comment ctermfg=Yellow
highlight clear SpellBad
highlight SpellBad term=standout ctermfg=1 term=underline cterm=underline
highlight clear SpellCap
highlight SpellCap term=underline cterm=underline
highlight clear SpellRare
highlight SpellRare term=underline cterm=underline
highlight clear SpellLocal
highlight SpellLocal term=underline cterm=underline

" Return to last edit position when opening files
autocmd BufReadPost *
	\ if line("'\"") > 0 && line("'\"") <= line("$") |
	\   exe "normal! g`\"" |
	\ endif

" Remove space at the end of each line
command Clean :%s/\s\+$//e

" Setting for Vundle, julia-vim
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'JuliaLang/julia-vim'
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
call vundle#end()
filetype plugin indent on

" Setting for Markdown+LaTeX
let g:vim_markdown_folding_disabled=1
let g:vim_markdown_math=1
let g:vim_markdown_frontmatter=1


  1. Vim installation

    The vimrc file here only support self-installed vim. The installation instructions for different platforms are different. Here is an example for Ubuntu:

    sudo apt-get install vim
  2. Vundle

    The installation of Vundle is available here.

  3. Download the vimrc file.

  4. Copy .vimrc to your user folder.

    cp /path/to/vimrc ~/.vimrc
  5. Install plugins.

    vim ~/.vimrc

Updating List:

  1. 2015-07-22: Added new .vimrc file.
  2. 2015-08-24: Specified spell check for *.txt, *.tex, *.md, *.markdown files only.
  3. 2015-09-23: Updated this page and added vim installation step in the installation instruction.

TODO List:


Yingzhou Li


I'm a graduate student at Stanford University. Follow me on Github and Bitbucket. Hopefully, you will find my code useful. You are also welcome to either email me or post comments below to discuss on these posts.