My Best Vimrc Setting
この記事について
- おすすめプラグインを紹介
- プラグインをインストールする際に参考にしたリンク先など
vimrc
ファイル一部公開
英語なのですが、よかったら参考にしてみてください。
他に使えるプラグインなどがあればぜひ教えて下さい!
Goal
- To teach you my best
~/.vimrc
file setting - Also tell you the best plugins which I love
- Some life-changing tips about vim
Plugin
- pathgon
- MUST for installing other plugins
- nerdtree
- really cool plugin for showing directory
- syntastic
- syntax checking hacks for vim
- powerline
- powerful tool for updating your vim status bar
- tagbar
- showing tag bar on the right side
Usage of Plugin
Pathgon
Nerdtree
- user
m
for creating/deleting/copying file- if you add
/
then the file would be a new directory
- if you add
ctl + w
twice for changing edtior/NERDTree windows- change tabs
t
for opening in a new tabgt
for moving to the next tabgT
for mobing to the previous tab
Syntastic
:SyntasticCheck
for manually checking:Errors
for showing all checked errors
Powerline
Installation
Powerline is a little bit complicated for installation.
@see
http://qiita.com/tkhr/items/8cc17c02dea1803be9c6
@see
https://powerline.readthedocs.org/en/latest/installation/osx.html#fonts-installation
Mac OS X
- 1. Install font
- https://github.com/powerline/fonts
- run ./install.sh
for installing all fonts (its useful)
- 2. Install brew/python(including pip)
- https://powerline.readthedocs.org/en/latest/installation/osx.html
- 3. changes Terminal/iTerm's font to the powerline font
- and then restart
Tagbar
@see
https://github.com/majutsushi/tagbar
- 1. install ctags-exuberant with brew :
brew install ctags-exuberant
- 2. install Tagbar with pathogen
- 3. update your
~/.vimrc
:w
Markdown Highlight
You can add markdown highligh by adding markdown2ctags.
@see
https://github.com/jszakmeister/markdown2ctags
- 1. download
markdown2ctags.py
from the above github repo - 2. add below code in
vimrc
(change the path to the markdown2ctags.py)
let g:tagbar_type_markdown = {
\ 'ctagstype': 'markdown',
\ 'ctagsbin' : '/path/to/markdown2ctags.py',
\ 'ctagsargs' : '-f - --sort=yes',
\ 'kinds' : [
\ 's:sections',
\ 'i:images'
\ ],
\ 'sro' : '|',
\ 'kind2scope' : {
\ 's' : 'section',
\ },
\ 'sort': 0,
\ }
Links & Article
- http://statico.github.io/vim.html
- this is the first and the best article to know what kind of customize you can on your vim
Tips
- use
ctrl + c
instead ofesc
to return Normal mode
How to add colorscheme to your vim
$ mkdir ~/.vim/colors/
$ mv /path/to/your/colorscheme.vim ~/.vim/colors
And add this to your vimrc
file.
syntax on
colorscheme yourColorScheme
How do you add NERDTree to your vimrc
@see
http://stackoverflow.com/questions/1447334/how-do-you-add-nerdtree-to-your-vimrc
Add this to your vimrc
file.
autocmd VimEnter * NERDTree
Last: My Vim.rc
" enable pathogen
execute pathogen#infect()
" initialization
syntax on
colorscheme twilight
autocmd VimEnter * NERDTree
autocmd VimEnter * TagbarToggle
set number
" syntastic recommended settings
" @see https://github.com/scrooloose/syntastic#3-recommended-settings
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" Powerline
" @see https://powerline.readthedocs.org/en/master/usage/other.html#vim-statusline
" @see http://qiita.com/tkhr/items/8cc17c02dea1803be9c6
python from powerline.vim import setup as powerline_setup
python powerline_setup()
python del powerline_setup
set laststatus=2
set showtabline=2
set noshowmode
" markdown2ctags
" > adds markdown-generator to tagbar
" @see https://github.com/jszakmeister/markdown2ctags
let g:tagbar_type_markdown = {
\ 'ctagstype': 'markdown',
\ 'ctagsbin' : '~/.vim/bundle/markdown2ctags/markdown2ctags.py',
\ 'ctagsargs' : '-f - --sort=yes',
\ 'kinds' : [
\ 's:sections',
\ 'i:images'
\ ],
\ 'sro' : '|',
\ 'kind2scope' : {
\ 's' : 'section',
\ },
\ 'sort': 0,
\ }