Skip to content

Commit c67fc84

Browse files
author
Masafumi Yokoyama
committed
Add ctrlp settings and update nerdtree settings
1 parent dcc3a09 commit c67fc84

File tree

3 files changed

+71
-1
lines changed

3 files changed

+71
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
% echo "source ~/.vim.d/leader.vim" >> ~/.vimrc
99
% echo "source ~/.vim.d/plugin.vim" >> ~/.vimrc
1010
% echo "source ~/.vim.d/japanese.vim" >> ~/.vimrc
11+
% echo "source ~/.vim.d/plugin-settings/ctrlp.vim" >> ~/.vimrc # experimental
1112

1213
## カスタマイズ
1314

@@ -29,3 +30,4 @@ TODO
2930
* [VimScriptざっくりチュートリアル(バッファ編集編) - かせいさんとこ](http://d.hatena.ne.jp/kasei_san/20130714/p1)
3031
* [Vim でコピペするときの Tips - 反省はしても後悔はしない](http://cohama.hateblo.jp/entry/20130108/1357664352)
3132
* [Vimでの日本語編集がはかどるキーマッピング - Qiita](https://qiita.com/ssh0/items/9e7f0d8b8f033183dd0b)
33+
* [ctrlp.vimの使い方まとめ - Qiita](https://qiita.com/oahiroaki/items/d71337fb9d28303a54a8)

leader.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ noremap <Leader>qo :copen<CR>
2929
noremap <Leader>b :BufExplorer<CR>
3030
3131
" 開いているファイルをNERDTreeで表示
32-
noremap <Leader>tf :NERDTreeFind<CR>
32+
noremap <Leader>t :NERDTreeFind<CR>
3333
3434
" カーソル位置の単語でgrep
3535
"" tpope/vim-fugitive

plugin-settings/ctrlp.vim

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
" ctrlpvim/ctrlp.vim
2+
3+
let NERDTreeQuitOnOpen = 1
4+
let NERDTreeWinSize = 75
5+
if !argc()
6+
autocmd vimenter * NERDTreeClose
7+
autocmd vimenter * CtrlPMRUFiles
8+
endif
9+
10+
" ref: https://postd.cc/how-to-boost-your-vim-productivity/
11+
let g:ctrlp_use_caching = 0
12+
if executable('pt')
13+
set grepprg=pt\ --nogroup\ --nocolor
14+
let g:ctrlp_user_command = 'pt %s -l --nocolor -g ""'
15+
elseif executable('ag')
16+
set grepprg=ag\ --nogroup\ --nocolor
17+
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
18+
else
19+
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f']
20+
endif
21+
22+
" ref: https://qiita.com/oahiroaki/items/d71337fb9d28303a54a8
23+
nnoremap <Leader>e :<C-u>CtrlPMRUFiles<CR>
24+
nnoremap <Leader>ea :<C-u>CtrlPMixed<CR>
25+
nnoremap <Leader>eb :<C-u>CtrlPBuffer<CR>
26+
nnoremap <Leader>ed :<C-u>CtrlPDir<CR>
27+
nnoremap <Leader>ef :<C-u>CtrlP<CR>
28+
nnoremap <Leader>el :<C-u>CtrlPLine<CR>
29+
nnoremap <Leader>em :<C-u>CtrlPMRUFiles<CR>
30+
nnoremap <Leader>eq :<C-u>CtrlPQuickfix<CR>
31+
nnoremap <Leader>es :<C-u>CtrlPMixed<CR>
32+
nnoremap <Leader>et :<C-u>CtrlPTag<CR>
33+
34+
" ref: https://qiita.com/tekkoc/items/8c78e01167953ab513f9
35+
let g:ctrlp_prompt_mappings = {
36+
\ 'PrtBS()': ['<c-h>'],
37+
\ 'PrtDeleteWord()': ['<c-w>'],
38+
\ 'PrtCurEnd()': ['<c-e>'],
39+
\ 'PrtCurLeft()': ['<c-b>'],
40+
\ 'PrtCurRight()': ['<c-f>'],
41+
\ 'PrtSelectMove("j")': ['<c-j>'],
42+
\ 'PrtSelectMove("k")': ['<c-k>'],
43+
\ 'PrtHistory(-1)': ['<c-n>'],
44+
\ 'PrtHistory(1)': ['<c-p>'],
45+
\ 'AcceptSelection("e")': ['<cr>'],
46+
\ 'ToggleRegex()': ['<c-r>'],
47+
\ 'ToggleByFname()': ['<c-d>'],
48+
\ 'PrtExit()': ['<c-l>', '<esc>', '<c-c>'],
49+
\ 'ToggleFocus()': ['<nop>'],
50+
\ 'PrtExpandDir()': ['<nop>'],
51+
\ 'AcceptSelection("h")': ['<nop>'],
52+
\ 'AcceptSelection("t")': ['<nop>'],
53+
\ 'AcceptSelection("v")': ['<nop>'],
54+
\ 'ToggleType(1)': ['<nop>'],
55+
\ 'ToggleType(-1)': ['<nop>'],
56+
\ 'PrtInsert()': ['<nop>'],
57+
\ 'PrtCurStart()': ['<nop>'],
58+
\ 'PrtClearCache()': ['<nop>'],
59+
\ 'PrtDeleteEnt()': ['<nop>'],
60+
\ 'CreateNewFile()': ['<nop>'],
61+
\ 'MarkToOpen()': ['<nop>'],
62+
\ 'OpenMulti()': ['<nop>'],
63+
\ 'PrtDelete()': ['<nop>'],
64+
\ 'PrtSelectMove("t")': ['<nop>'],
65+
\ 'PrtSelectMove("b")': ['<nop>'],
66+
\ 'PrtSelectMove("u")': ['<nop>'],
67+
\ 'PrtSelectMove("d")': ['<nop>'],
68+
\ }

0 commit comments

Comments
 (0)