-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.vimrc_vundle
224 lines (205 loc) · 6.57 KB
/
.vimrc_vundle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
" 一旦ファイルタイプ関連を無効化する
filetype off
filetype plugin indent off
" encoding関係
set encoding=utf-8
scriptencoding utf-8
set fileencoding=utf-8 " 保存時の文字コード
set fileencodings=utf-8,ucs-boms,euc-jp,cp932 " 読み込み時の文字コードの自動判別. 左側が優先される set fileformats=unix,mac,dos " 改行コードの自動判別. 左側が優先される
set ambiwidth=double " □や○文字が崩れる問題を解決
" vi互換無効
set nocompatible
"新しい行のインデントを現在行と同じにする
set autoindent
"開いているファイルのディレクトリに移動する
set autochdir
"クリップボードをWindowsと連携
set clipboard=unnamed
"タブの代わりに空白文字を挿入する
set expandtab
"ファイル内の <Tab> が対応する空白の数
set tabstop=2
" 連続した空白に対してタブキーやバックスペースキーでカーソルが動く幅
set softtabstop=2
"行番号を表示する
set number
"シフト移動幅
set shiftwidth=2
"インクリメンタルサーチを行う
set incsearch
"カーソルを行頭、行末で止まらないようにする
" set whichwrap=b,s,h,l,<,>,[,]
" 検索文字列が小文字の場合は大文字小文字を区別なく検索する(noignorecase)
set ignorecase
" 検索文字列に大文字が含まれている場合は区別して検索する(nosmartcase)
set smartcase
"新しい行を作ったときに高度な自動インデントを行う
set smartindent
" 検索文字をハイライト
set hlsearch
" 括弧の対応をハイライト
set showmatch
" Vimの「%」を拡張する
" Vimに同梱されているmatchitプラグインを有効化
source $VIMRUNTIME/macros/matchit.vim
" 入力中のコマンドを表示
set showcmd
" 行送り
set scrolloff=5
" softtabstopはTabキー押し下げ時の挿入される空白の量,0の場合はtabstopと同じ,BSにも影響する
set softtabstop=0
" ステータスライン関連
set laststatus=2
" 折りたたみをマーカーで
set fdm=marker
" Tabを可視化する
set list
set listchars=tab:>.,trail:_
" カーソルライン
" set cursorline
set wildmenu
" pasteモードの切替トグル
" * vim-bracketed-paste がtmuxの最新versionで動かないので暫定的に使用
set pastetoggle=<C-p>
" tagsジャンプの時に複数ある時は一覧表示
nnoremap <C-]> g<C-]>
" Escの2回押しでハイライト消去
nmap <Esc><Esc> :nohlsearch<CR><Esc>
" vimにcoffeeファイルタイプを認識させる
au BufRead,BufNewFile,BufReadPre *.coffee set filetype=coffee
" mdをmarkdownに認識させる
au BufRead,BufNewFile *.md set filetype=markdown
" インデントを設定
autocmd FileType coffee setlocal sw=2 sts=2 ts=2 et
" Gemfileをruby syntaxに
autocmd BufNewFile,BufRead Gemfile set filetype=ruby
" Vundle(vim plugin管理)
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
" 導入したいプラグインを以下に列挙
" Plugin '[Github Author]/[Github repo]' の形式で記入
" ファイルをtree表示してくれる
Plugin 'scrooloose/nerdtree'
" color scheme
Plugin 'tomasr/molokai'
" コメントON/OFFを手軽に実行 (gc)
Plugin 'tomtom/tcomment_vim'
" window sizeを簡単に変える (C-eがデフォルト)
Plugin 'jimsei/winresizer'
" align
Plugin 'junegunn/vim-easy-align'
" ペーストするさいに、自動でset pasteする
Plugin 'ConradIrwin/vim-bracketed-paste'
" Ruby向けにendを自動挿入してくれる
Plugin 'tpope/vim-endwise'
" %で括弧だけじゃなく、if end なども行き来できるようになる
Plugin 'ruby-matchit'
" vimからgitが使える
Plugin 'tpope/vim-fugitive'
" 下のbarにカラー付きで情報を出してくれる
Plugin 'itchyny/lightline.vim'
call vundle#end()
filetype plugin indent on
" その他のカスタム設定を以下に書く
" ------------------------------------
" colorscheme
" ------------------------------------
syntax on
colorscheme molokai
" iTerm2で半透明にしているが、vimのcolorschemeを設定すると背景も変更されるため
highlight Normal ctermbg=none
" ------------------------------------
" vim-easy-align.vim
" ------------------------------------
" Start interactive EasyAlign in visual mode (e.g. vip<Enter>)
vmap <Enter> <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. <Leader>aip)
nmap <Leader>a <Plug>(EasyAlign)
" ------------------------------------
" nerdtree.vim
" ------------------------------------
" Ctrl+nで起動させる
map <C-n> :NERDTreeToggle<CR>
" 備忘録
" o 表示
" go 表示(移動なし)
" t 新しいタブで開く
" T open in new tab silently middle-click
" i 分割して開く
" gi 分割して表示(移動無し)
" s 縦分割して表示
" gs 縦分割して表示(移動なし)
" 隠しファイルをデフォルトで表示させる
let NERDTreeShowHidden = 1
" ------------------------------------
" lightline.vim
" ------------------------------------
if !has('gui_running')
set t_Co=256
endif
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'fugitive', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'fugitive': 'MyFugitive',
\ 'readonly': 'MyReadonly',
\ 'modified': 'MyModified',
\ 'filename': 'MyFilename'
\ },
\ 'separator': { 'left': '⮀', 'right': '⮂' },
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
\ }
function! MyModified()
if &filetype == "help"
return ""
elseif &modified
return "+"
elseif &modifiable
return ""
else
return ""
endif
endfunction
function! MyReadonly()
if &filetype == "help"
return ""
elseif &readonly
return "⭤"
else
return ""
endif
endfunction
function! MyFugitive()
if exists("*fugitive#head")
let _ = fugitive#head()
return strlen(_) ? '⭠ '._ : ''
endif
return ''
endfunction
function! MyFilename()
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
\ ('' != expand('%:p') ? expand('%:p') : '[No Name]') .
\ ('' != MyModified() ? ' ' . MyModified() : '')
endfunction
" split modeの切替
" https://qiita.com/tekkoc/items/98adcadfa4bdc8b5a6ca
nnoremap s <Nop>
" 分割
nnoremap ss :<C-u>sp<CR>
nnoremap sv :<C-u>vs<CR>
" window間移動
nnoremap sj <C-w>j
nnoremap sk <C-w>k
nnoremap sl <C-w>l
nnoremap sh <C-w>h
" windowごと移動
nnoremap sJ <C-w>J
nnoremap sK <C-w>K
nnoremap sL <C-w>L
nnoremap sH <C-w>H
" ファイルタイプ関連を有効にする
filetype plugin indent on