मैं ctrlp
साथ ag
सुझाव के रूप में here उपयोग करते हैं,:मैं गिट रेपो के बाहर एजी के साथ सही ढंग से काम करने के लिए ctrlp को कैसे कॉन्फ़िगर कर सकता हूं?
if executable('ag')
set grepprg=ag\ --nogroup\ --nocolor
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
let g:ctrlp_use_caching = 0
else
let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$'
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . --cached --exclude-standard --others']
endif
यह अच्छा काम करता है अगर मैं इसे अंदर एक .git
फ़ोल्डर के साथ एक परियोजना फ़ोल्डर से vim चल रहा हूँ। हालांकि, जब भी मैं एक निर्देशिका से विम चलाता हूं जो एक गिट प्रोजेक्ट की जड़ नहीं है, तो मुझे एक खाली फ़ाइल सूची (कोई परिणाम नहीं) मिलता है। साथ निम्न फ़ोल्डर पदानुक्रम, स्पष्ट करने के लिए:
Proj1/ # ctrlp works; finds foo.js and bar.js (unless they are .gitignored)
.git/
bin/
foo.js
bar.js
Proj2/ # ctrlp doesn't work; has empty file list
bin/
foo.py
bar.py
वास्तविक ag
आदेश, ag %s -l --nocolor -g ""
, ठीक काम करता है जब मैं एक ही निर्देशिका में कमांड लाइन से चलाने (यह सभी फ़ाइलों को पाता है)।
map <c-p> :CtrlP<cr>
map <c-t> :CtrlPTag<cr>
let g:ctrlp_dotfiles = 1
let g:ctrlp_show_hidden = 1
let g:ctrlp_cmd = 'CtrlPMixed' " search anything (in files, buffers and MRU files at the same time.)
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra' " search for nearest ancestor like .git, .hg, and the directory of the current file
let g:ctrlp_match_window = 'top,order:ttb'
let g:ctrlp_max_height = 12 " maxiumum height of match window
let g:ctrlp_switch_buffer = 'et' " jump to a file if it's open already
let g:ctrlp_use_caching = 1 " enable caching
let g:ctrlp_clear_cache_on_exit = 0 " speed up by not removing clearing cache evertime
let g:ctrlp_mruf_max = 250 " number of recently opened files
if exists('g:ctrlp_user_command')
unlet g:ctrlp_user_command
end
if exists('g:ctrlp_custom_ignore')
unlet g:ctrlp_custom_ignore
end
if executable('ag')
set grepprg=ag\ --nogroup\ --nocolor
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'"
let g:ctrlp_use_caching = 0
else
let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$'
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . --cached --exclude-standard --others']
endif
let g:ctrlp_prompt_mappings = {
\ 'AcceptSelection("e")': ['<c-t>'],
\ 'AcceptSelection("t")': ['<cr>', '<2-LeftMouse>'],
\ 'ToggleType(1)': ['<c-u>', '<c-up>'],
\ 'ToggleType(-1)': ['<c-y>', '<c-down>'],
\ 'PrtExit()': ['<c-l>', '<esc>', '<c-c>', '<c-g>'],
\ 'PrtSelectMove("j")': ['<c-n>', '<down>'],
\ 'PrtSelectMove("k")': ['<c-p>', '<up>'],
\ 'PrtHistory(-1)': ['<c-j>'],
\ 'PrtHistory(1)': ['<c-k>'],
\ }
let g:ctrlp_buftag_types = {
\ 'coffee' : '--language-force=coffee --coffee-types=cmfvf'
\ }
मैं कैसे ctrlp/ag
एक Git रेपो के बाहर सही ढंग से काम करने के लिए प्राप्त कर सकते हैं:
यहाँ मेरी ctrlp
config की सम्पूर्णता है?
क्या आपने अपने प्रश्न की पहली पंक्ति में सही लिंक दिया था? मुझे इसके साथ संबंधित कुछ भी नहीं दिख रहा है – yolenoyer
इसके बारे में क्षमा करें - लिंक अपडेट किया गया। यहां एक और अलग vimrc है (https://github.com/skwp/dotfiles/blob/master/vim/settings/ctrlp.vim) थोड़ा अलग 'ag' कमांड के साथ, जिसका मेरे लिए एक ही व्यवहार है (यानी, काम नहीं करता है)। – Sasgorilla
क्या आपको '1'' के साथ मिलता है: निष्पादन योग्य ('ag') echo echo? – Tacahiroy