Results 1 to 4 of 4

Thread: Vim - use CtrlP with the same directory after opening a file ...

Hybrid View

  1. #1
    Join Date
    Sep 2010
    Beans
    34

    Cool Vim - use CtrlP with the same directory after opening a file ...

    Hello,

    I'm learning vim currently, and I when I use the "Ctrl-P" plugin - I'm able to quickly find a file in the project directory.

    Code:
     :CtrlP /path/to/the/project/root      ===>      Enter     ===>     <C-d>    ===>     and start typing the name of the file.
    So, my question is: after I open the file - in new tab or in split - how can I call CtrlP again, pointing to the same doc root? ... Cause if I just type :CtrlP - it is pointing to the folder where the last opened file is.

    And I want CtrlP to point to the doc root again, without typing the whole

    Code:
    :CtrlP /path/to/the/project/root    ===>    Enter ......
    Thanks in advance ...

  2. #2
    Join Date
    Feb 2009
    Beans
    1,469

    Re: Vim - use CtrlP with the same directory after opening a file ...

    I'm not familiar with that plugin, but can't you just hit :<Up> and use the last run command?

    Barring that, does it default to the current working directory? Because you can use the :cd command to change your working directory. (Or just cd to the project root before you run vim.)

  3. #3
    Join Date
    Apr 2009
    Location
    Germany
    Beans
    2,134
    Distro
    Ubuntu Development Release

    Re: Vim - use CtrlP with the same directory after opening a file ...

    see the help of ctrlp:
    g:ctrlp_root_markers for the root modes, most useful is probably the 'r' which will search for the root of a version control
    there is also g:ctrlp_root_markers to define own roots

  4. #4
    Join Date
    Sep 2010
    Beans
    34

    Red face Solved :) ...

    Well, the little trick with entering the root directory of the project, and then run vim - did the job ...

    So, when I enter the project root folder, run vim, hit <C-p>, quick-find a file and open it, and after that hit <C-p> again - then CtrlP plugin is automatically set to search in the project root again ...

    Thank you ...
    Last edited by mind_exploit; September 13th, 2013 at 03:19 PM. Reason: Typo ...

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •