エンジニアリングとお金の話

都内で働くエンジニアの日記です。

【技術】vimの設定を見直した

【SPONSORED LINK】

去年の同じ時期ぐらいからvimを使い始めたのだが、色々不便に思う事があったので設定をちょこちょこと見直す事にした。
(去年書いた記事はこちらhttp://hatakazu.hatenablog.com/entry/2012/01/17/003234

修正した内容は以下の通り。

・開いたファイルのディレクトリに自動的に移動
・NERDTreeプラグイン追加
vim-django-supportプラグイン追加

特にNERDTreeが便利でvim上でフォルダを移動するのが苦で無くなったのは大きい。
f:id:hatakazu93:20130106223251j:plain

vimを使い始めて1年ぐらいなるが、まだまだ分からない事が多々ある。早く使いこなせる様に勉強して行きたい。

ちなみに今回修正したvimrcはこちら。

"python用 インデント設定
autocmd FileType python setl autoindent  "オートインデント有効化
autocmd FileType python setl smartindent "スマートインデント有効化
autocmd FileType python setl cinwords=if,elif,else,for,while,try,except,finally,def,class "該当するワード時に自動的にインデント

"タブ設定
set expandtab      "タブを半角空白として設定
set tabstop=8      "タブを半角スペース8文字として表示(pythonのインタプリタはタブ文字を8文字として扱う為)
set softtabstop=4  "タブ入力時半角スペース4文字として表示
set shiftwidth=4   "インデント時に半角スペース4文字として表示

"コード編集設定
filetype plugin indent on  "ファイル形式別プラグイン有効化
syntax enable              "シンタックスハイライト

"文字コード設定
set enc=utf-8

"行数設定
set number

"バックアップファイル設定
set nobackup
set noswapfile

"背景色設定
colorscheme torte

"補完設定
set completeopt=menu

"カレントディレクトリ設定(自動的に開いたファイルのディレクトリに移動)
if exists('+autochdir')
  set autochdir
endif

"bundle設定
filetype off
set rtp+=$HOME/vimfiles/bundle/vundle
call vundle#rc( '$HOME/vimfiles/bundle' )

"NERDTree
Bundle 'git://github.com/scrooloose/nerdtree.git'
nmap <F9> :NERDTreeToggle<CR>

"quickrun
Bundle 'git://github.com/thinca/vim-quickrun.git'
let g:quickrun_config={}
let g:quickrun_config["_"] = {'into':1}

"vimfiler
Bundle 'git://github.com/Shougo/vimfiler.git'

"unitevim
Bundle 'git://github.com/Shougo/unite.vim.git'

"indent-guides
Bundle 'git://github.com/nathanaelkane/vim-indent-guides.git'
let g:indent_guides_enable_on_vim_startup=1
let g:indent_guides_color_change_percent=30
let g:indent_guides_guide_size=1

"ref
Bundle 'git://github.com/thinca/vim-ref.git'
let g:ref_use_vimproc = 0
if exists('*ref#register_detection')
	" filetypeが分からんならalc
	call ref#register_detection('_', 'alc')
endif

"gist
Bundle 'git://github.com/mattn/gist-vim.git'
let g:github_user='hatakazu'
let g:github_token='gistのトークン'

"neocomplecache
Bundle 'git://github.com/Shougo/neocomplcache.git'
let g:neocomplcache_enable_at_startup = 1 " 起動時に有効化

"pythoncomplete
Bundle 'git://github.com/vim-scripts/pythoncomplete.git'
autocmd FileType python set omnifunc=pythoncomplete#Complete

"vim-django-support
Bundle 'git://github.com/lambdalisue/vim-django-support.git'

filetype plugin indent on