LoginSignup
3
1

More than 5 years have passed since last update.

オレオレVIM設定(随時更新)

Last updated at Posted at 2018-06-11

(追加機能)

  • nerdtreeでファイルツリーからダイレクト編集
  • uniteでファイル履歴を表示
  • tcomment_vimで選択行をコメントアウト

Plugin managerインストール


 curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

color themeインストール


cd .vim
git clone https://github.com/w0ng/vim-hybrid.git
cd vim-hybrid/colors
cp hybrid.vim ~/.vim/colors

.vimrc設定


set number
set tabstop=4
set autoindent
set t_Co=256

call plug#begin('~/.vim/plugged')

" Make sure you use single quotes

" NerdTree
Plug 'scrooloose/nerdtree', { 'on':  ['NERDTreeToggle'] }

" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
Plug 'junegunn/vim-easy-align'

" vim hybrid
Plug 'w0ng/vim-hybrid'
set background=dark
colorscheme hybrid

" neocomplete
Plug 'https://github.com/Shougo/neocomplete.vim'

" neomru
Plug 'https://github.com/Shougo/neomru.vim'

" unite
Plug 'https://github.com/Shougo/unite.vim'

" Any valid git URL is allowed
Plug 'https://github.com/junegunn/vim-github-dashboard.git'

" Multiple Plug commands can be written in a single line using | separators
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'

" On-demand loading
Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeToggle' }
"Plug 'tpope/vim-fireplace', { 'for': 'clojure' }

" Plugin outside ~/.vim/plugged with post-update hook
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }

" Unmanaged plugin (manually installed and updated)
Plug '~/my-prototype-plugin'

" tcomment_vim
Plug 'tomtom/tcomment_vim'

" Initialize plugin system
call plug#end()

" Setting for color theme
hi LineNr ctermbg=0 ctermfg=0
hi CursorLineNr ctermbg=2 ctermfg=0
set cursorline
hi clear CursorLine

" Setting for NerdTree
"map  :NERDTreeToggle
nnoremap  :NERDTreeToggle
map   :tabn
map   :tabp
map   :tabnew

" Setting for neocomplete
highlight Pmenu ctermbg=4
highlight PmenuSel ctermbg=1
highlight PMenuSbar ctermbg=4

" 補完ウィンドウの設定
set completeopt=menuone

" 補完ウィンドウの設定
set completeopt=menuone

" rsenseでの自動補完機能を有効化
let g:rsenseUseOmniFunc = 1
" let g:rsenseHome = '/usr/local/lib/rsense-0.3'

" auto-ctagsを使ってファイル保存時にtagsファイルを更新
let g:auto_ctags = 1

" 起動時に有効化
let g:neocomplcache_enable_at_startup = 1

" 大文字が入力されるまで大文字小文字の区別を無視する
let g:neocomplcache_enable_smart_case = 1

" _(アンダースコア)区切りの補完を有効化
let g:neocomplcache_enable_underbar_completion = 1

let g:neocomplcache_enable_camel_case_completion  =  1

" 最初の補完候補を選択状態にする
let g:neocomplcache_enable_auto_select = 1

" ポップアップメニューで表示される候補の数
let g:neocomplcache_max_list = 20

" シンタックスをキャッシュするときの最小文字長
let g:neocomplcache_min_syntax_length = 3

" 補完の設定
autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
if !exists('g:neocomplete#force_omni_input_patterns')
  let g:neocomplete#force_omni_input_patterns = {}
endif
let g:neocomplete#force_omni_input_patterns.ruby = '[^.*\t]\.\w*\|\h\w*::'

if !exists('g:neocomplete#keyword_patterns')
        let g:neocomplete#keyword_patterns = {}
endif
let g:neocomplete#keyword_patterns['default'] = '\h\w*'

" Settings for unite
" unite.vimの設定
noremap  :Unite -buffer-name=file file " ファイル一覧
noremap  :Unite file_mru " 最近使ったファイル一覧

au FileType unite nnoremap     unite#do_action('split') " ウィンドウを分割して開く
au FileType unite inoremap     unite#do_action('split')

" ESCキーを2回押すと終了する
au FileType unite nnoremap    q
au FileType unite inoremap    q

プラグインインストール


vim
:PlugInstall

ショートカット

  • NerdTree切り替え:Ctrl-E
  • NerdTreeタブ切り替え(Prev):Ctrl-H
  • NerdTreeタブ切り替え(Next):Ctrl-L
  • NerdTree新規タブ作成:Ctrl-N
  • Uniteファイル履歴参照:Ctrl-U+Ctrl-R
  • Uniteファイル一覧:Ctrl-U+Ctrl-F
  • カーソル選択時ハイライト:hi CursorLineNr ctermbg=2 ctermfg=0
  • Neocomplete保管:tabキー
  • Unite起動:コマンドモードでUnite {file|buffer|file_mru}
  • Unite終了:Uniteモード内でq
  • tcomment_vimコメントアウト/コメントイン:Shift+Vで範囲選択してからCtrl+-(ハイフン)を2回

スクリーンショット

sample_ss.png

参考リンク

https://qiita.com/mochizukikotaro/items/def041700846adb903fe
http://kengotakimoto.com/post-2351/
https://qiita.com/ykyk1218/items/ab1c89c4eb6a2f90333a#%E3%82%AB%E3%83%BC%E3%82%BD%E3%83%AB%E3%81%AE%E9%80%9F%E5%BA%A6%E3%82%92%E5%A4%89%E3%81%88%E3%82%8B

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1