Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
12

:CtrlPLine is actually supposed to work on listed buffers. If you absolutely want to use that feature on every file in your project, you could add them to the argument list (and thus the buffer list) with something like: :argadd **/*.php but that doesn't sound like a very good idea for performance reasons. Using :vimgrep or :grep sounds a lot better to ...


10

You can paste from any register (including the clipboard) into CtrlP, as explained in :help ctrlp-pasting: <Insert>, *'ctrlp-pasting'* <MiddleMouse> Paste the clipboard content into the prompt. <c-\> Open a console dialog to paste <cword>, <cfile>, the content of ...


7

A similar question was just asked on the Vim reddit here. I started using ctrlp-cmatcher myself quite awhile ago which I find to be much more intelligent at matching the right file. Note that it does require a compiled component. Otherwise you'll have to try some of the approaches in the article.


7

You can customize the function handling the opening of files, as explained at :help 'g:ctrlp_open_func'. You could try something similar to this: function! CtrlPOpenFunc(action, line) if a:action =~ '^h$' " Get the filename let filename = fnameescape(fnamemodify(a:line, ':p')) " Close CtrlP call ctrlp#exit() call ctrlp#...


6

Finally found a way to do this that doesn't involve closing NERDTree all the time. I made a function that cycles through the open windows until it finds a writable buffer, then runs ctrl-p there: function! CtrlPCommand() let c = 0 let wincount = winnr('$') " Don't open it here if current buffer is not writable (e.g. NERDTree) while !empty(...


6

If I'm not mistaken, you want to change g:ctrlp_working_path_mode: https://github.com/kien/ctrlp.vim/blob/master/doc/ctrlp.txt#L178 let g:ctrlp_working_path_mode = '0'


5

There are a few options depending on the layout of directories. If all these repos are contained in a single root folder that you want to search, then you can search that directory explicitly by running :CtrlP myproject. Alternatively, I believe you could say let g:ctrlp_root_markers=['.root'] and make a .root file in the root (myproject) directory. If for ...


4

with the help from VanLaser in the comments above,I eventually find out how to do that on Windows: set path+=C:/Program\\\ Files\\\ (x86)/Microsoft\\\ Visual\\\ Studio\\\ 12.0/VC/include set path+=C:/Program\\\ Files\\\ (x86)/Microsoft\\\ SDKs/Windows/v7.1A/Include just add these two lines in my vimrc then it would work. Those two C:/xxxxx are my system %...


4

CtrlP has a few different modes, Ctrl-R and Ctrl-D. Ctrl-R uses your input as raw Regex, meaning you'll only find matches with people in it explicitly. Ctrl-D matches only the filename, ignoring the path. I believe the default CtrlP functionality is just joining .* to every character as a raw character, so a period is treated as a period. If you knew in ...


4

The instructions found at http://kien.github.io/ctrlp.vim assume you don't have a plugin manager. So it tells you to do the runtime path fiddling yourself (which is an incorrect assumption in this case). If you read :help 'spellfile': When a word is added while this option is empty Vim will set it for you: Using the first directory in 'runtimepath' that is ...


3

You can use ctrl-e to cancel a selection, and ctrl-y to accept it (followed by ESC to go to normal mode). People usually use ESC to cancel a selection (escape from whatever happens), and also map Enter to complete a selection, if one is active: inoremap <expr> <silent> <cr> pumvisible() ? "<c-y>" : "<cr>" If you still want to "...


3

2 ways of doing that: On your terminal, move to your project directory then execute vim. Manually specify the working directory into vim using :cd command (You can check the current working directory with :pwd). Extra CtrlP If you're using ag with ctrlp, you can create a .agignore file into your working directory, and specify there what ctrlp should ...


3

From @jonasl answer, you could also do: let g:ctrlp_cmd = ':NERDTreeClose\|CtrlP'


3

I've tripped on this one too many times too: I've solved it by remapping the <c-p> to closing NERDTree (if open) and then opening CtrlP. Put this in your .vimrc: let g:ctrlp_map = '' nnoremap <c-p> :NERDTreeClose\|CtrlP<CR> Explanation: The first line makes CtrlP not overwrite your custom mapping. And the second ...


2

To expand on @DJ Madeira's answer, I made this function reusable, since I am also using ctrl+l for MRU list " CtrlP " Use this function to prevent CtrlP opening files inside non-writeable buffers, e.g. NERDTree function! SwitchToWriteableBufferAndExec(command) let c = 0 let wincount = winnr('$') " Don't open it here if current buffer is not ...


2

This is really hacky, but it worked for me, if you source this mapping nnoremap <Leader>pf :let @p=expand("%")<CR>:tabclose<CR>"pp then put your cursor where you want the filename to be put use Ctrl + p, as normal to find your file, then open the file in a new tab (open a file in a new tab from inside Ctrl-p is Ctrl + t) run my leader ...


2

It is possible using the dirvish file explorer, which by the way is much faster than the native netrw. This plugin allows to manipulate the content of its buffer (see "How do I filter" in :h dirvish-faq) and has an option to automatically execute a command. Keep in mind that it operates on the full path and directories have trailing slashes, so to keep ...


2

From :h 'g:ctrlp_match_current_file': Includes the current file in the match entries: let g:ctrlp_match_current_file = 1 You can add the line to your vimrc if you want the behavior to be permanent.


2

Set ctrlp_bufname_mod on your .vimrc file: let g:ctrlp_bufname_mod = ':p' You can finetune this, check filename-modifiers in CtrlP docs (:help filename-modifiers)


1

You can do the mapping by yourself: Ctrlp provides an ex command to trigger the fuzzy finding: :CtrlP so you can create an insert mode mapping which will switch to command mode and trigger the command: inoremap <C-p> <Esc>:CtrlP<CR>` Note that as <C-p> is used to navigate the pop up menu, this mapping could create a unwanted ...


1

this one works for me nnoremap <silent> <C-y> :CtrlPBuffer<CR>


1

You can use the dictonary variable g:ctrlp_prompt_mappings that is read by CtrlP. You just need to specify the keys you want to change. Read :h g:ctrlp_prompt_mappings for more info. In order to get what you describe in your question try this in your vimrc file: let g:ctrlp_prompt_mappings = { \ 'PrtSelectMove("j")': ['<c-j>', '<down>'], ...


1

I think you should be able to achieve this by using the 'wildignore' option. set wildignore+=*/ignoredir1/**/*,*/ignoredir2/**/*,*/ignoredir3/**/* CtrlP respects this by default, and NERDTree will if you tell it to in your .vimrc: let NERDTreeRespectWildIgnore=1 Unfortunately, this isn't a whitelist, so you will need to manually add in all the things you ...


1

All I had to do was to configure the css type for ctrlp to complete the ctags kinds, as mentioned in the docs, thanks @grodzik: let g:ctrlp_buftag_types = { \ 'css' : '--css-types=vcitm', \ } This configures to complete the ctags kinds "v", "c", "i", "t" and "m", They are configured in ctags: --langmap=css:.css.less.scss --regex-css=/^[ \t]*@([A-Za-z0-9_-]...


1

The CtrlP buffer has the name ControlP, so you should just be able to check this: autocmd CursorHold * if bufname("%") != 'ControlP' | call TagbarCurrentTag() | endif


1

You can enable caching, if it is not enabled already: let g:ctrlp_use_caching = 1 It significantly reduces lag and is ideal if there aren't a lot of changes inside the directory, ie not a lot of new or deleted files. However, as files are added or removed or renamed, the file index will become stale, and it needs to be refreshed (ie re-indexed) by ...


1

Functions from other answers didn't work for me, but I found a simple solution that works if you always keep NERDTree open like I do. There's no command to unfocus NERDTree, but we can focus it and then switch to the previous window to ensure it's unfocused. Note that this will cause it to open if it wasn't. let g:ctrlp_map = '' map <C-P> :...


1

This is solved by removing mac_precompose_path from the Vim source code. A fork where this is fixed can be found here: https://github.com/OskarPersson/vim I tested this by creating a Homebrew formula of the repository above.


1

You should use thoses plugins Sidesearch or fzf Both allow to search in recursive directories using silversearch-ag fzf allow to search on the listed files which include your string.


1

It's possibly your working path mode - check the ctrlp help for g:ctrlp_working_path_mode. I'm not sure what the default is, but I seem to recall that when I didn't explicitly set it I also got weirdness. Since I am mostly working in source controlled projects I use let g:ctrlp_working_path_mode = 'r' but otherwise using let g:ctrlp_working_path_mode = 'c' ...


Only top voted, non community-wiki answers of a minimum length are eligible