LoginSignup
0

More than 3 years have passed since last update.

posted at

updated at

エンジニア2年目のVim設定ファイルを公開する

初期のvim環境

vimって何やねん

配属されていきなり、vimを使えと言われても、まだ何もわかってないですよ私。
バックスペース押しても文字は消えないし、普通に入力しても編集できないし、何これ。
そんなレベルだもの、もちろんvimの設定ファイル .vimrc なんて知らない訳であって。
素のvimを使っていたら、先輩に「このくらいは設定した方がいいよ」と渡された.vimrcがこちらです。


set number "行番:q号を表示する
set title "編集中のファイル名を表示
set showmatch "括弧入力時の対応する括弧を表示
syntax on "コードの色分け
set smartindent "オートインデント
set ts=4 "タブキースペース
set sw=4 "勝手にずれるスペース
set incsearch " インクリメンタルサーチ. 1文字入力毎に検索を行う
set ignorecase "大文字/小文字を区別せず検索
set smartcase " 検索パターンに大文字を含んでいたら大文字小文字を区別する
set hlsearch "検索結果をハイライト
" ESCキー2度押しでハイライトの切り替え
nnoremap <silent><Esc><Esc> :<C-u>set nohlsearch!<CR>
set cindent
set expandtab

本当に最低限ってところですね。でも、タブキーの操作など、そこそこ満足して使っていました。

エディタ入れようかなあ

でも、エディタって見やすいんですよ。VS CodeとかSublime textとか。
結局フロントのコードを書くときはvimではなくVSCode使うことの方が多いですね。

まとめ

最後に一挙記載します。快適なVimライフをお過ごしください。

dein.toml
# 基本は github.com のレポジトリーを指定するだけ
[[plugins]]
repo = 'Shougo/dein.vim'

# git clone 後、実行すべきコマンドがある場合はこんな感じ
[[plugins]]
repo = 'Shougo/vimproc.vim'
hook_post_update = '''
  if dein#util#_is_windows()
    let cmd = 'tools\\update-dll-mingw'
  elseif dein#util#_is_cygwin()
    let cmd = 'make -f make_cygwin.mak'
  elseif executable('gmake')
    let cmd = 'gmake'
  else
    let cmd = 'make'
  endif
  let g:dein#plugin.build = cmd
'''

# ブランチやタグを指定したいとき
[[plugins]]
repo = 'delphinus35/typescript-vim'
rev  = 'colorize-template-strings'

# 特定の条件で読み込みたいとき
[[plugins]]
repo = 'elzr/vim-json'
if   = '''! has('kaoriya')'''

# 依存関係を指定したいとき(下で見やすくするライン)
[[plugins]]
repo    = 'vim-airline/vim-airline'
depends = ['vim-airline-themes']

[[plugins]]
repo = 'vim-airline/vim-airline-themes'

# かっこ閉じ
[[plugins]]
repo = 'Townk/vim-autoclose'

# syntaxエラー表示
[[plugins]]
repo =  'scrooloose/syntastic'

# 末尾の全角と半角空白があれば赤くハイライト
# :FixWhitespaceで全て削除できる
[[plugins]]
repo = 'bronson/vim-trailing-whitespace'

# git関連、変更・追加・削除箇所がわかる
[[plugins]]
repo = 'tpope/vim-fugitive'
[[plugins]]
repo = 'airblade/vim-gitgutter'

# ctrl+pで曖昧検索ができる, 新たにファイル開ける
[[plugins]]
repo = 'ctrlpvim/ctrlp.vim'

# 検索結果の件数を表示
[[plugins]]
repo = 'osyo-manga/vim-anzu'

# ディレクトリ表示に使いたい
[[plugins]]
repo = 'scrooloose/nerdtree'

# vue.js用
[[plugins]]
repo = 'posva/vim-vue'

# nginxの設定ファイル用
[[plugins]]
repo = 'chr4/nginx.vim'

参考記事

https://qiita.com/zwirky/items/0209579a635b4f9c95ee
https://qiita.com/nabewata07/items/d92655485622aeb847a8

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
What you can do with signing up
0