-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
135 lines (121 loc) · 4.7 KB
/
.vimrc
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
set nu
set autoindent
set enc=utf-8
set fileencodings=utf-8,euc-jp,sjis,cp932
set hlsearch
set noet
set pastetoggle=<C-E>
" バッファをクリップボードと共有します
set clipboard+=unnamed
set nobackup
set noswapfile
set nocompatible
" 検索時に大文字小文字をいい感じに扱う
set ignorecase
set smartcase
set noundofile
set showcmd
set nf=alpha
set tabstop=2
set shiftwidth=2
set expandtab
filetype off
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim
call neobundle#begin(expand('~/.vim/bundle/'))
NeoBundleFetch 'Shougo/neobundle.vim'
NeoBundle 'Shougo/vimproc.vim', {
\ 'build' : {
\ 'windows' : 'tools\\update-dll-mingw',
\ 'cygwin' : 'make -f make_cygwin.mak',
\ 'mac' : 'make',
\ 'linux' : 'make',
\ 'unix' : 'gmake',
\ },
\ }
NeoBundle 'glidenote/memolist.vim'
NeoBundle 'tpope/vim-surround'
NeoBundle 'tpope/vim-fugitive'
NeoBundle 'typescript-vim'
NeoBundle 'kchmck/vim-coffee-script'
NeoBundle 'tpope/vim-markdown'
NeoBundle 'thinca/vim-quickrun'
" NeoBundle 'Align'
NeoBundle 'tyru/open-browser.vim'
NeoBundle 'vim-scripts/vim-auto-save'
NeoBundle "kien/ctrlp.vim"
NeoBundle 'nazo/pt.vim'
NeoBundle 'mattn/emmet-vim'
call neobundle#end()
endif
" Emmetで使いたかったのでinsert modeのときも使えるように
let imapleader="C-y"
" leaderをスペースに変更
let mapleader=" "
" リンクをオープン
vnoremap <C-o> y:!open<Space><C-r>"<CR><CR>
" カーソル下のURLをブラウザで開く
nmap <Leader>o <Plug>(openbrowser-open)
vmap <Leader>o <Plug>(openbrowser-open)
"<C-j>2回でハイライト消去
nnoremap <C-j><C-j> :<C-u>nohlsearch<CR><Esc>
"putをやりやすく
vnoremap <silent> <C-p> "0p<CR>
" memolist
nnoremap <Leader>mn :MemoNew<CR>
nnoremap <Leader>ml :MemoList<CR>
nnoremap <Leader>mg :MemoGrep<CR>
let g:memolist_memo_suffix = "md"
let g:memolist_template_dir_path = "~/memolist_templates"
nnoremap [q :cprevious<CR> " 前へ
nnoremap ]q :cnext<CR> " 次へ
nnoremap [Q :<C-u>cfirst<CR> " 最初へ
nnoremap ]Q :<C-u>clast<CR> " 最後へ
command! -nargs=* -range GitBrowseRemote !git browse-remote --rev -L<line1>,<line2> <f-args> -- %
"vim-auto-save
let g:auto_save = 1
" 便利
inoremap <C-j> <ESC>
nnoremap <Leader>t :<C-u>tabe<CR>
nnoremap <Leader>w :<C-u>q<CR>
nnoremap <Leader>v :<C-u>vsp<CR>
nnoremap <Leader>s :<C-u>sp<CR>
inoremap <C-f> <Right>
inoremap <C-b> <Left>
" 英かなでC-pを↑にマップしているのを打ち消す
inoremap <UP> <C-p>
" quickrunのバッファエリアをスペース+qで閉じる
nnoremap <Leader>q : <C-u>bw! \[quickrun\ output\]<CR>
" ctrlP用のキーマップ 参考: https://qiita.com/oahiroaki/items/d71337fb9d28303a54a8
nnoremap <Leader>[ :<C-u>CtrlP<CR>
nnoremap <Leader>p :<C-u>CtrlPBuffer<CR>
" https://gist.github.com/pinzolo/8168337
function! s:Clip(data)
let @*=a:data
echo "clipped: " . a:data
endfunction
command! -nargs=0 ClipPath call s:Clip(expand('%:p'))
command! -nargs=0 ClipFile call s:Clip(expand('%:t'))
command! -nargs=0 ClipDir call s:Clip(expand('%:p:h'))
".rhtml, .rbでタブ幅を2に変更
au BufNewFile,BufRead *.slim setlocal tabstop=2 shiftwidth=2 expandtab fenc=utf8
au BufNewFile,BufRead *.erb setlocal tabstop=2 shiftwidth=2 expandtab fenc=utf8
au BufNewFile,BufRead *.rhtml setlocal tabstop=2 shiftwidth=2 expandtab fenc=utf8
au BufNewFile,BufRead *.html setlocal tabstop=2 shiftwidth=2 expandtab fenc=utf8
au BufNewFile,BufRead *.css setlocal tabstop=2 shiftwidth=2 expandtab fenc=utf8
au BufNewFile,BufRead *.rb setlocal tabstop=2 shiftwidth=2 expandtab fenc=utf8
au BufNewFile,BufRead *.thor setlocal tabstop=2 shiftwidth=2 expandtab fenc=utf8 filetype=ruby
au BufNewFile,BufRead *.rake setlocal tabstop=2 shiftwidth=2 expandtab fenc=utf8
au BufNewFile,BufRead *.py setlocal tabstop=4 shiftwidth=4 expandtab fenc=utf8
au BufNewFile,BufRead *.irb setlocal tabstop=2 shiftwidth=2 expandtab fenc=utf8
au BufNewFile,BufRead *.yml setlocal tabstop=2 shiftwidth=2 expandtab fenc=utf8
au BufNewFile,BufRead *.pp setlocal tabstop=2 shiftwidth=2 expandtab fenc=utf8
au BufNewFile,BufRead *.js setlocal tabstop=4 shiftwidth=4 expandtab fenc=utf8
au BufNewFile,BufRead *.ts setlocal tabstop=4 shiftwidth=4 expandtab fenc=utf8 filetype=typescript
au BufNewFile,BufRead *.coffee setlocal tabstop=2 shiftwidth=2 expandtab fenc=utf8
au BufNewFile,BufRead *.php setlocal tabstop=4 shiftwidth=4 expandtab fenc=euc-jp
au BufNewFile,BufRead *.sql setlocal tabstop=2 shiftwidth=2 expandtab fenc=utf8
au BufNewFile,BufRead *.yaml setlocal tabstop=2 shiftwidth=2 expandtab fenc=utf8
au BufNewFile,BufRead *.c setlocal tabstop=2 shiftwidth=2 expandtab fenc=utf8
au BufNewFile,BufRead *.md setlocal fenc=utf8
syntax on