I am fairly new to Vim. I keep my notes in .md files and would like to access them with CtrlP from several different directories. I would like to set a specific filter on them, because now loading all the files and changing the search patter quickly slows down vim a lot.

I understand that there are wildignore and ctrlp_custom_ignore for ignoring specific files formats. However, based on this issue, for filtering for particular patterns, I might need to use ctrlp_user_command instead.

Currently, I have the default setting:

let g:ctrlp_user_command = 'rg %s --files --hidden --color=never --glob ""'

I tried to adjust it based on the issue but the examples there use find instead of rg and I am confused with the vim regex (I am familiar with regex mainly in python and somehow in js).

Many thanks in advance.

1 Answer 1


If I'm understanding you correctly, and your goal is for CtrlP only to list files that have an .md extension, you just need to alter the --glob field in the rg command you included in your question:

let g:ctrlp_user_command = 'rg %s --files --hidden --color=never --glob "*.md"'
  • Yes, this did what I was aiming for. Thanks!
    – nocibambi
    Commented Sep 5, 2019 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.