ctrlpvim / ctrlp.vim

Active fork of kien/ctrlp.vim—Fuzzy file, buffer, mru, tag, etc finder.
ctrlpvim.github.com/ctrlp.vim
Other
5.57k stars 259 forks source link

ignore dir in most recent #560

Closed ask1234560 closed 3 years ago

ask1234560 commented 3 years ago

Hi

i want to ignore /tmp directory in most recent files, how can i do it.

i am using this, but its not working

let g:ctrlp_custom_ignore = {
  \ 'dir':  '\v\/tmp$',
  \ }
hugoppp commented 3 years ago

This is also a problem if you use CtrlP with vim-fugitive, because vim fugitive opens everything in a buffer. So after every commit, you have a ".git/COMIT_EDITMSG" in your MRU.

ask1234560 commented 3 years ago

So what does g:ctrlp_custom_ignore do

ask1234560 commented 3 years ago
" ignore patterns in CtrlPMRU
fun! Ctrlpmru()
    :CtrlPMRU<CR>
    :silent !sed -i.bak -e '/\.git\//d' -e '/\/tmp\//d' "$XDG_CACHE_HOME/ctrlp/mru/cache.txt"
endf

I fixed it by adding the above code in init.vim and binding nnoremap <silent> <Leader>m :call Ctrlpmru()<CR>. It deletes the pattern after it invoked CtrlPMRU, to avoid latency.

hugoppp commented 3 years ago

I fixed it by adding the above code in init.vim and binding nnoremap <silent> <Leader>m :call Ctrlpmru()<CR>. It deletes the pattern after it invoked CtrlPMRU, to avoid latency.

Just tried it and it does not really work like I would like it to. It only filters out the lines after restarting vim, as the cache file is probably stored in memory.