23

I'm having this occasional problem:

In macvim I create a new file in the current directory using

:e foo.coffee

I save that file and continue working in macvim. I close and restart macvim, and use <Leader>T to try to open that file but it's not being listed.

I see foo.bar in the directory and can open it manually, but why is not available for CommandT? Is there a way to sort of punch CommandT in the head and refresh the files available to it?

Thanks

Marty Cortez
  • 2,325
  • 1
  • 17
  • 22

3 Answers3

31

You can also use <C-f> (that's control-f), when CommandT is open.

Ref: https://github.com/wincent/Command-T under the section titled:

The following mappings are active when either the prompt or the file listing has focus

(I would like to link to the heading, but the README is plain text, so there are no heading anchors).

Amiel Martin
  • 4,636
  • 1
  • 29
  • 28
16

Yes, I also have a mapping for it, but you can type the command manually if you so like:

noremap <F5> :CommandTFlush<CR>
deviousdodo
  • 9,177
  • 2
  • 29
  • 34
  • what does `noremap` do? entering `:CommandTFlush` doesn't seem to do it for me .... – Marty Cortez Apr 04 '12 at 18:04
  • `noremap` just adds a mapping for the normal mode. If you enter `:CommandTFlush` from the command line and it doesn't work, there's probably another issue. I believe you are starting vim from your home directory, so CommandT will only search for a certain number of files and then stop, but I cannot be sure. – deviousdodo Apr 05 '12 at 09:07
  • yeah, i'm getting `Not an editor command: CommandTFlush`. I installed [yadr](https://github.com/skwp/dotfiles); they must be using something else. thanks for your help anyways. – Marty Cortez Apr 05 '12 at 17:09
  • 2
    looks like yadr is using CtrlP, and has CtrlP's flush `:ClearCtrlPCache` command bound to Cmd-Shift-P (https://github.com/skwp/dotfiles/blob/master/vim/plugin/settings/ctrlp.vim) – ThePants Apr 05 '12 at 21:20
  • 1
    in the end it turned out that this was because i was starting macvim using `mvim .`. doing it that way doesn't connect to the pasteboard or refresh files in the directory (probably other things too). i had to do `open -a MacVim` and everything worked fine. thanks for your help! – Marty Cortez Apr 06 '12 at 15:48
7

Typing this in mvim worked out for me in the end:

:ClearCtrlPCache

Marty Cortez
  • 2,325
  • 1
  • 17
  • 22