Giter VIP home page Giter VIP logo

ctrlp.vim's Introduction

ctrlp.vim

Full path fuzzy file, buffer, mru, tag, ... finder for Vim.

  • Written in pure Vimscript for MacVim, gVim and Vim 7.0+.
  • Full support for Vim's regexp as search patterns.
  • Built-in Most Recently Used (MRU) files monitoring.
  • Built-in project's root finder.
  • Open multiple files at once.
  • Create new files and directories.
  • Extensible.

ctrlp

Install

vim 8+ manages packages all on its own. Installing ctrlp is this simple:

mkdir -p ~/.vim/pack/plugins/start
git clone --depth=1 https://github.com/ctrlpvim/ctrlp.vim.git ~/.vim/pack/plugins/start/ctrlp

Of course you can use your favorite plugin manager or check the quick installation guide for a primitive installation method.

Basic Usage

  • Run :CtrlP or :CtrlP [starting-directory] to invoke CtrlP in find file mode.
  • Run :CtrlPBuffer or :CtrlPMRU to invoke CtrlP in find buffer or find MRU file mode.
  • Run :CtrlPMixed to search in Files, Buffers and MRU files at the same time.

Check :help ctrlp-commands and :help ctrlp-extensions for other commands.

Once CtrlP is open:
  • Press <F5> to purge the cache for the current directory to get new files, remove deleted files and apply new ignore options.
  • Press <c-f> and <c-b> to cycle between modes.
  • Press <c-d> to switch to filename only search instead of full path.
  • Press <c-r> to switch to regexp mode.
  • Use <c-j>, <c-k> or the arrow keys to navigate the result list.
  • Use <c-t> or <c-v>, <c-x> to open the selected entry in a new tab or in a new split.
  • Use <c-n>, <c-p> to select the next/previous string in the prompt's history.
  • Use <c-y> to create a new file and its parent directories.
  • Use <c-z> to mark/unmark multiple files and <c-o> to open them.

Run :help ctrlp-mappings or submit ? in CtrlP for more mapping help.

  • Submit two or more dots .. to go up the directory tree by one or multiple levels.
  • End the input string with a colon : followed by a command to execute it on the opening file(s): Use :25 to jump to line 25. Use :diffthis when opening multiple files to run :diffthis on the first 4 files.

Basic Options

  • Change the default mapping and the default command to invoke CtrlP:

    let g:ctrlp_map = '<c-p>'
    let g:ctrlp_cmd = 'CtrlP'
  • When invoked without an explicit starting directory, CtrlP will set its local working directory according to this variable:

    let g:ctrlp_working_path_mode = 'ra'

    'c' - the directory of the current file.
    'a' - the directory of the current file, unless it is a subdirectory of the cwd
    'r' - the nearest ancestor of the current file that contains one of these directories or files: .git .hg .svn .bzr _darcs
    'w' - modifier to "r": start search from the cwd instead of the current file's directory
    0 or '' (empty string) - disable this feature.

    If none of the default markers (.git .hg .svn .bzr _darcs) are present in a project, you can define additional ones with g:ctrlp_root_markers:

    let g:ctrlp_root_markers = ['pom.xml', '.p4ignore']

    If more than one mode is specified, they will be tried in order until a directory is located.

  • If a file is already open, open it again in a new pane instead of switching to the existing pane

    let g:ctrlp_switch_buffer = 'et'

  • Exclude files and directories using Vim's wildignore and CtrlP's own g:ctrlp_custom_ignore. If a custom listing command is being used, exclusions are ignored:

    set wildignore+=*/tmp/*,*.so,*.swp,*.zip     " MacOSX/Linux
    set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe  " Windows
    
    let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
    let g:ctrlp_custom_ignore = {
      \ 'dir':  '\v[\/]\.(git|hg|svn)$',
      \ 'file': '\v\.(exe|so|dll)$',
      \ 'link': 'some_bad_symbolic_links',
      \ }
  • Use a custom file listing command:

    let g:ctrlp_user_command = 'find %s -type f'        " MacOSX/Linux
    let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d'  " Windows
  • Ignore files in .gitignore

      let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']

Check :help ctrlp-options for other options.

License

CtrlP is distributed under Vim's license.

ctrlp.vim's People

Contributors

aaronjensen avatar andrei-stepanov avatar blueyed avatar codepiano avatar d11wtq avatar dkasak avatar edlanglois avatar ingomeyer441 avatar kien avatar konfekt avatar ludovicchabant avatar majutsushi avatar mattn avatar nfvs avatar noscript avatar ornicar avatar paretje avatar prabirshrestha avatar ptzz avatar rgrinberg avatar ryanoasis avatar shun095 avatar syohex avatar tacahiroy avatar taoso avatar thatsmydoing avatar thomie avatar travv0 avatar tsuyoshicho avatar ydzhou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ctrlp.vim's Issues

ignore patterns read from file

As far as I've learned, there is an option to ignore specific files/dirs/symlinks, via:

let g:ctrlp_custom_ignore = {
  \ 'dir':  '\v[\/]\.(git|hg|svn)$',
  \ 'file': '\v\.(exe|so|dll)$',
  \ 'link': 'some_bad_symbolic_links',
  \ }

Not sure about the name of the property, but I'd like to have an option, where ctrlp plugin would read .gitignore file and ignore all those specified. Similar could be available for .hgignore

As I use git a lot and projects have already .gitignore file present with all content I don't care about.

Highlight only individual characters makes ctrlp slow on long filenames.

Hi,

The following 3 commits:
b5f8261
3559e2b
417ab86

make ctrlp very slow if the matching line is too long. As an example, I created a simple dummy repository with the following file structure:

./this/other/longnamedirectory/controllers/mainTheme/MainViewController.h
./this/other/longnamedirectory/controllers/mainTheme/MainViewController2.h
./this/other/longnamedirectory/controllers/mainTheme/MainViewControllerExtended.cc
./this/other/longnamedirectory/controllers/mainTheme/MainViewController2.cc
./this/other/longnamedirectory/controllers/mainTheme/MainViewController.cc
./this/other/longnamedirectory/controllers/mainTheme/MainViewControllerExtended.h

If you type "mainviewcontroller", the last letters already add a long delay during typing. I noticed this because some of the repositories that I work with are even longer than that sometimes.

Would be nice to be able to either make this individual characters highlight be optional, or remove it at all (I'm sorry, I don't think it really helps).

Custom Mode API

Just a little feature idea, was thinking about this after reading about vim-projectionist. Forgive me if this is all in vain and there is actually something implemented to enable this or something similar already.

I often repeat myself typing specific strings when I want to reach a file, that is named or placed in a structured way.

Let's say I am working with angularJS and I want to open a specific template file, which is stored in somewhere in a folder that is called templates and is definetely an .html file. (there are other and probably better ways to place template files in angular projects, but this is just an example to clarify my point). Let's say the full filename of this template starting from the project root is app/templates/my_module/confirmation_dialog.html

In this case I would probably hit <ctrl>-p and type tplconfirmahtml to make use of fuzzy matching and get there somewhat accurately.

The idea now would be to add an API to define custom modes on a project basis to make this more accurate and faster, enabling us to enter just the part of the filename we really care about.

E.g., I add a dictionary to my project root, named .ctrlp_custom_modes.json with the following content

{
  "templates": "app/templates/@@input@@.html"
}

On vim's startup, this file would be read in and add a templates mode to ctrlp, which we could probably also directly access through a shortcut.

This custom mode would simply wrap the input of a user when he tries to fuzzy-match a file with the string given in this dictionary, where @@input@@ is a placeholder for the user input.

If I bring up this mode and type mm/co, ctrlp would really search as if I had typed app/templates/mm/co.html which would almost be a sure match (that is if i don't add any typos...).

As this is a quite unsophisticated way of implementing it and just using the regular fuzzy-matching routines, some false positives might show up, but I guess this is ok - especially since this is also very powerful and could in fact be considered a feature.

A second example, again Angular specific: Another way to declare filenames is by suffixing them according to what kind of structure they contain. A path to a directive might look like /client/my_module/my_feature/user_list.directive.js

The custom mode definition would be

{
  "directives" : "client/@@input@@.directive.js"
}

to add a directives mode that looks for a .directive.js file anywhere inside the client directory.

The file could probably also specify the shortcuts to bring up ctrlp in a custom mode by predefining a couple of plugs (which you then define in your .vimrc). One would probably never have a use for more than 5 (or let's say 10, if people want to get crazy), so we could predefine ctrlp_custom_mode plugs 1-10 and a project based shortcut list could look like:

{
  "directives" : "1"
  "templates" : "2"
}

to start ctrp in the directives mode through the ctrlp_custom_mode1 plug and the templates mode through the ctrlp_custom_mode2 plug.

So guys, what do you think? Would you think this is useful to have? I think this would be quite easy to implement as well - when one knows where to start. I'd be very grateful for any pointers to the code from people who know the ctrlp codebase a bit, which would save lots of time in case I start to implement this myself ;)

Thanks!

For specified directory issue

When I'm working in a large project, too many dirs and subdirs existed, how can I add multiple specified directorys into ctrlp? This will be easier than use wild ignored option to add files you want. Like cscope's "cs add xxx".

Is it possible to trigger a refresh when no entries are found in a search?

This is my use case. I create a file outside of vim (possibly copying an existing file), then I want to open it in vim using ctrlp. I have to always press f5 first before ctrlp will find it, but I think it would be nice to have ctrlp do an autorefresh when "NO ENTRIES" are found for the current search.

suggestion for directory navigator

I use vim all the time, and my files are locate in many place on my computer. I often forget where my file be. I do not like to use nerdtree.
then I found http://miechu.pl/proto/, this software is great.
can ctrlp add this function ?
I will be happy if I could use ctrlp plugin like that software.

Include currently opened file in results

Sometimes, when I switching back to terminal from another app and hit Ctrl-P I cannot locate the file. I try try again, maybe even refresh cache, before I realize the file is already opened in current window.

I wish there was an option not to exclude current file from results.

Same as kien#580

Ctrlp opens new file

In neovim and vime, I'm getting this odd issue

If you try to open a file, it will cut the path name, so

"js/angular/controller/headerBarController.js" [New DIRECTORY]

becomes

"ular/controller/headerBarController.js" [New DIRECTORY]

Not sure if this is known. Here is the configuration for ctrlp in my .nvimrc

let g:ctrlp_user_command = 'ag %s -i --nogroup --hidden
    \ --ignore .git
    \ --ignore .svn
    \ --ignore .hg
    \ --ignore .DS_Store
    \ --ignore "**/*.pyc"
    \ --ignore lib
    \ -g ""'
  let g:ctrlp_regexp = 1
  let g:ctrlp_use_caching = 0
  let g:ctrlp_working_path_mode = 0
  let g:ctrlp_switch_buffer = 0

getting system files when using ctrl-p

When not defining any options for ctrl-p in my vimrc the default behavior on one of my computers is this:

if I do ctrl-p in directory containing repo, i get all contents of directory but if i don't have a .svn or .git etc in my directory tree, ctrl-p starts searching my whole system! If i understand correctly it should be searching the current working directory.

The command CtrlPCurWD seems to work fine and does the correct thing,

if I let g:ctrl_working_path_mode to 'ra', nothing changes in the way it works.

g:ctrlp_working_path_mode doesn't seem to be set when I start vim. Is this normal? Should I be able to check if this is set when using :let g:ctrl_working_path_mode?

Wondering if this is the place I should be posting these questions? Should I use StackOverflow if i'm not sure about it being a bug?

CtrlPBuf Delete Buffer Bug

If you delete the currently open buffer, it completely borks the the view.

Before:

before

After:
after

The natural behavior should be that it goes to the last buffer, or if none exist, it goes to a No Name blank buffer. It's quite jarring have the entire CtrlP display take over the window.

How to change/remove the ">" that comes with CtrlP listing

I am not talking about the prompt having ">>>" , but about the items in the list having a ">" at the beginning . It is actually redundant and not useful . I prefer to keep UI simple .
Is it possible to remove that ">" or change it something better ?

So now it should look like :

cool
okay
>>> Buffer

and not like :

> cool
> okay
>>> Buffer

Any pointers ?

CtrlP Breaks with Dashes in Path

I ran into an issue with CtrlP not being able to find files for a particular project, and after some searching online found this thread on the original CtrlP repo. As mentioned there, the issue seems to be that there are dashes in the path name – other people experienced that issue, and it seems to be the problem for me as well. Since this repo is actually still under development, I figured it made sense to submit an issue here, too, since it hasn't been fixed since the fork.

ctrlp bookmark mode

Bookmark mode is very useful, but operating is inconvenient.
when we use ' :CtrlPBookmarkDirAdd'
step 1: display
Directory to bookmark: 'current word directory'
I think this step is unnecessary and can be omitted

step 2: display
Bookmark as: 'current word directory'
Here is the alias, don't need to put the full path

I also want to bookmark for a single file, instead of the directory

ctrlp + ag not showing $HOME dir's dotfiles

As per the title, I have switched to using 'ag', and things like my .vimrc and .zshrc aren't showing up.

This is what I have in my .vimrc:
http://i.imgur.com/Xadinf4.png

From what I understand if the user sets a ctrlp_user_command, the ctrlp_show_hidden gets ignored right?
If that's the case, then I still don't know why my dotfiles aren't showing up.

Alternate listing representation: split filenames and directory path

Is it possible to have an option to list the buffers/files in two columns, with the basename in the first column and the directory/path in the second:

filename1.txt       path/to/here
filename2.py       another/path/to/here

I understand that this might not work for all workflows, but it can be very useful for others. Visually being able to pick out filenames is easy with the above scheme.

Giving preferences to exact match

Crossposting from kien#562

First let me say how much I love CtrlP. It's super useful and powerful. Thanks so much, Kien!

An enhancement that I would find very helpful would be that when I'm not in regex mode, the list would automatically sort with preference to exact matches. Exact matches of filename would come first, then exact matches anywhere in the path (if in path mode), then fuzzy (aka spread out) matches in the filename, then fuzzy matches anywhere in the path.

For example, in my current project, I'm looking for this file:

public/angular/estimate_form/views/main.html

But if I just type "main.html" (in path/non-regex mode), I get a whole bunch of files that spell out all of those letters over the whole path. Sometimes there's a "main" all together, sometimes there's an "html" all together, and sometimes those letters are all spread out:

app/views/estimates/rfqs/index.html.erb
app/views/companies/settings.html.erb
doc/app/classes/MainController.html
doc/app/classes/FormattingHelper.html
app/views/companies/index.html.erb
app/views/equipment_items/_packing.html.erb
app/views/companies/new.html.erb
doc/app/classes/WideFormatSection.html
app/views/main/index.html.erb
app/views/main/about.html.erb
doc/app/classes/InventoryItemLocation.html
doc/app/classes/CompanyInformation.html

With my current results list height (25), I actually don't get my desired file at all.

Of course, if I switch to regex mode, or if I use filename mode or "filename;path", I get better results. But when I do any of those things, there are drawbacks that come from them. For example, in regex mode I have to be precise with spelling and in filename mode I can't do "a/c/main_controller". So I have to be switching between modes to get different benefits at different times.

If the results were already ordered in the way I described above, my file would probably be the very first one in the list, but I could still use paths if desired. I could set it to path/non-regex by default, and pretty much leave it there all the time without thinking about modes, which one to switch to, etc.

I could see this feature either as just the default way it works or as an option that could be set in vimrc.

Again, thanks for the great plugin, and thanks for considering my suggestion.

mrufiles keeps truncating the buffer

despite setting:
let g:ctrlp_mruf_max = 400000
in my vimrc, my cache file keeps getting cutoff around 400 files. I'm not sure which part of the code is filtering out entires.

Ctrlp occasionally expands mappings while inserting into search buffer

Sometimes when I'm inputting my search query into ctrlp, it inappropriately expands maps.

For example, I have:

" does some stuff and calls :diffupdate
nmap <unique> du <Plug>(diffusable-update)

Sometimes when I type a filename that includes the characters 'du', ctrlp will flash an error message about no diff and omit those characters. I assume this has something to do with ctrlp operating in normal mode (and not insert mode), but I'm not sure whether that's true.

Experienced with bc94048 and back on kien's original repo.

Similarly, keys may be dropped when using feedkeys (trying to pre-fill
current filename):

:nnoremap du :diffupdate<CR>
:edit findutils.cpp
:call feedkeys(":CtrlP\<cr>".expand('%:t:r'), "t")

I've encountered it mostly with leader maps where leader is Space and as seen
above, I map Space in ctrlp's prompt. But I've seen it with other mappings too.

This issue seems to occur more frequently when g:ctrlp_lazy_update is
enabled (I used 100), but also occurs with it disabled.

I have some other unusual ctrlp settings too:

let g:ctrlp_regexp = 1
let g:ctrlp_prompt_mappings = { 'PrtAdd(".*")': ['<space>'] }

" I usually generate a filelist file in the root of my project that tells me
" where all the interesting files are. That's far faster than searching. For
" small projects, I don't bother and fallback to .git.
if has("win32")
    " cygwin cat suddenly stopped working.
    let filelist_cmd = 'type %s\\filelist'
else
    let filelist_cmd = 'cat %s/filelist'
endif
let g:ctrlp_user_command = {
            \   'types': {
            \       1: ['filelist', filelist_cmd],
            \       2: ['.git', 'cd %s && git ls-files'],
            \   }
            \}
unlet filelist_cmd
let g:ctrlp_root_markers = ['filelist', '.git']

Related error posted on reddit (except this one's using a map to stuff chars into ctrlp):
http://www.reddit.com/r/vim/comments/27epkg/switching_between_likenamed_files_with_ctrlp_no/ci0d715

"E715: Dictionary required" occurred when first invoke ctrlp

I installed ctrlp.vim via vim-bootstrap. The error occurred when I first invoke ctrlp with ",e" shortcut and disappeared after ctrlp caching index.

qq20150131-1 2x

I started vim with "vi -V9vim.log" so I could post log of runtime:

Searching for "/Users/mailto1587/.vim/bundle/jedi-vim/autoload/tagbar.vim"
Searching for "/Users/mailto1587/.vim/bundle/syntastic/autoload/tagbar.vim"
Searching for "/Users/mailto1587/.vim/bundle/tagbar/autoload/tagbar.vim"
chdir(/Users/mailto1587/.vim/bundle/tagbar/autoload)
fchdir() to previous dir
line 3: sourcing "/Users/mailto1587/.vim/bundle/tagbar/autoload/tagbar.vim"
filetype detection:ON  plugin:ON  indent:ON
finished sourcing /Users/mailto1587/.vim/bundle/tagbar/autoload/tagbar.vim
continuing in function airline#extensions#tagbar#currenttag
Calling shell to execute: "('/usr/local/bin/ctags' --version) >/var/folders/jz/9wq61hrs1m70qw6mz38cyd580000gn/T/vUno1nA/1 2>&1"
Calling shell to execute: "('/usr/local/bin/ctags' --list-languages) >/var/folders/jz/9wq61hrs1m70qw6mz38cyd580000gn/T/vUno1nA/2 2>&1"
chdir(/Users/mailto1587/case)
fchdir() to previous dir

Searching for "autoload/ctrlp.vim" in "/Users/mailto1587/.vim,/Users/mailto1587/.vim/bundle/nerdtree/,/Users/mailto1587/.vim/bundle/vim-commentary/,/Users/mailto1587/.vim/bundle/vim-fugitive/,/Users/mailto1587/.vim/bundle/ctrlp.vim/,/Users/mailto1587/.vim/bundle/vim-airline/,/Users/mailto1587/.vim/bundle/vim-gitgutter/,/Users/mailto1587/.vim/bundle/vim-polyglot/,/Users/mailto1587/.vim/bundle/grep.vim/,/Users/mailto1587/.vim/bundle/CSApprox/,/Users/mailto1587/.vim/bundle/vimproc.vim/,/Users/mailto1587/.vim/bundle/vimshell.vim/,/Users/mailto1587/.vim/bundle/ultisnips/,/Users/mailto1587/.vim/bundle/vim-snippets/,/Users/mailto1587/.vim/bundle/molokai/,/Users/mailto1587/.vim/bundle/vim-bootstrap-updater/,/Users/mailto1587/.vim/bundle/c.vim/,/Users/mailto1587/.vim/bundle/jedi-vim/,/Users/mailto1587/.vim/bundle/syntastic/,/Users/mailto1587/.vim/bundle/tagbar/,/Users/mailto1587/.vim/bundle/indentLine/,/Users/mailto1587/.vim/bundle/syntastic/,/Users/mailto1587/.vim/bundle/HTML-AutoCloseTag/,/Users/mailto1587/.vim/bund
Searching for "/Users/mailto1587/.vim/autoload/ctrlp.vim"
Searching for "/Users/mailto1587/.vim/bundle/nerdtree/autoload/ctrlp.vim"
Searching for "/Users/mailto1587/.vim/bundle/vim-commentary/autoload/ctrlp.vim"
Searching for "/Users/mailto1587/.vim/bundle/vim-fugitive/autoload/ctrlp.vim"
Searching for "/Users/mailto1587/.vim/bundle/ctrlp.vim/autoload/ctrlp.vim"
chdir(/Users/mailto1587/.vim/bundle/ctrlp.vim/autoload)
fchdir() to previous dir
sourcing "/Users/mailto1587/.vim/bundle/ctrlp.vim/autoload/ctrlp.vim"
finished sourcing /Users/mailto1587/.vim/bundle/ctrlp.vim/autoload/ctrlp.vim
Executing FuncUndefined Auto commands for "*"
autocommand call neobundle#autoload#function()

Searching for "autoload/ctrlp/utils.vim" in "/Users/mailto1587/.vim,/Users/mailto1587/.vim/bundle/nerdtree/,/Users/mailto1587/.vim/bundle/vim-commentary/,/Users/mailto1587/.vim/bundle/vim-fugitive/,/Users/mailto1587/.vim/bundle/ctrlp.vim/,/Users/mailto1587/.vim/bundle/vim-airline/,/Users/mailto1587/.vim/bundle/vim-gitgutter/,/Users/mailto1587/.vim/bundle/vim-polyglot/,/Users/mailto1587/.vim/bundle/grep.vim/,/Users/mailto1587/.vim/bundle/CSApprox/,/Users/mailto1587/.vim/bundle/vimproc.vim/,/Users/mailto1587/.vim/bundle/vimshell.vim/,/Users/mailto1587/.vim/bundle/ultisnips/,/Users/mailto1587/.vim/bundle/vim-snippets/,/Users/mailto1587/.vim/bundle/molokai/,/Users/mailto1587/.vim/bundle/vim-bootstrap-updater/,/Users/mailto1587/.vim/bundle/c.vim/,/Users/mailto1587/.vim/bundle/jedi-vim/,/Users/mailto1587/.vim/bundle/syntastic/,/Users/mailto1587/.vim/bundle/tagbar/,/Users/mailto1587/.vim/bundle/indentLine/,/Users/mailto1587/.vim/bundle/syntastic/,/Users/mailto1587/.vim/bundle/HTML-AutoCloseTag/,/Users/mailto1587/.vi
Searching for "/Users/mailto1587/.vim/autoload/ctrlp/utils.vim"
Searching for "/Users/mailto1587/.vim/bundle/nerdtree/autoload/ctrlp/utils.vim"
Searching for "/Users/mailto1587/.vim/bundle/vim-commentary/autoload/ctrlp/utils.vim"
Searching for "/Users/mailto1587/.vim/bundle/vim-fugitive/autoload/ctrlp/utils.vim"
Searching for "/Users/mailto1587/.vim/bundle/ctrlp.vim/autoload/ctrlp/utils.vim"
chdir(/Users/mailto1587/.vim/bundle/ctrlp.vim/autoload/ctrlp)
fchdir() to previous dir
line 40: sourcing "/Users/mailto1587/.vim/bundle/ctrlp.vim/autoload/ctrlp/utils.vim"
finished sourcing /Users/mailto1587/.vim/bundle/ctrlp.vim/autoload/ctrlp/utils.vim
continuing in function ctrlp#init..<SNR>125_Reset..<SNR>125_opts
chdir(/Users/mailto1587/case)
fchdir() to previous dir
Reading viminfo file "/Users/mailto1587/.viminfo" marks
Error detected while processing function ctrlp#init..ctrlp#setlines..ctrlp#files..<SNR>125_InitCustomFuncs:
line    1:
E715: Dictionary required
Error detected while processing function ctrlp#init..ctrlp#setlines..ctrlp#files..<SNR>125_CloseCustomFuncs

How do I figure out it? Best regards!

How Do I Search By Tag?

I added tag to the ctrlp extensions and I see it in the prompt, but for regex and filename I can press <C-R> and <C-D> respectively, but I looked all over in the docs and I can't find how to switch to tag mode.

I also looked at the default list of key mappings and I don't see it in there either.

g:ctrlp_user_command examples are misleading

The g:ctrlp_user_command examples show %s being used in a context where it would not be unreasonable to assume that it is the project root, where in reality it is the "current" directory. This makes the example somewhat misleading.

For example, it's not unreasonable to expect that using: let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files'] would list all the files in the git project, where in reality it only lists files beneath the current file.

It would be helpful if the documentation could be updated so that:

  1. The meaning of %s is made clear, and
  2. The examples show how to list all the files in the git / hg / $project root, instead of only files beneath the current working directory.

<Plug>CtrlP

Could we add <Plug> usages so that mappings can look like

nmap <leader>m <Plug>CtrlPMRU<CR>

instead of

nnoremap <leader>m <ESC>CtrlPMRU<CR>

I tried to do this in my .vimrc and it didn't work. Let me know if you can already do this.

CtrlPTag jumps to wrong name

Here's an example, I have these entries in my tags file:

Benchmark   Criterion/Types.hs  331 ;" t
Benchmark   Criterion/Types.hs  333 ;" C

When I select one of them in CtrlPTag buffer, both of them jump to line 333, instead of first one jumping to 331.

Speculation: I think what's happening is that if I have multiple entries with same names, it jumps to only one of them, no matter which one I select in CtrlPTag buffer.

Any ideas?

In *some* situations, CtrlP sets soft-wrapping on or fails to restore the `wrap` state

To replicate:

  1. Ensure that soft-wrapping is off: set nowrap in .vimrc
  2. Start Vim without any files ($ vim).
  3. Run :CtrlP and select a file for opening. wrap will still be false.
  4. Run :CtrlP again and select another file. wrap will now be on.

Alternatively:

  1. Ensure that soft-wrapping is off: set nowrap in .vimrc
  2. Open any file for editing in Vim.
  3. Run :CtrlP again and select another file. wrap will now be on.

It appears that the two conditions required are: the current file must be any valid buffer (i.e., not [No Name]) and a file must be selected. The problem comes even with, e.g., CtrlPBuffer.

switch_buffer not working properly

Setting ctrlp_switch_buffer to include 'E' should switch to a buffer if it already exists (emulating the switchbuf=useopen behavior). The default is set to 'Et'.

However, the 'E' setting does not work due to a bug in the code.

https://github.com/ctrlpvim/ctrlp.vim/blob/master/autoload/ctrlp.vim#L1003-1004

In the ctrlp#acceptfile() function

if ( s:jmptobuf =~ md || ( s:jmptobuf && md =~ '[et]' ) ) && bufnr > 0
        \ && !( md == 'e' && bufnr == bufnr('%') )

the term after the || should be checking if s:jmptobuf exists and that md matches '[et]'.
However, in Vim, when String is compared to Number (&& in this case), the String is first converted to Number (see :h expr2). However, if the String does not start with a digit, the result is 0 (see :h Variables). This means that the s:jmptobuf && md =~ '[et]' term is always 0.
When md='e', s:jmptobuf =~md is 0 since 'Et' !~# 'e' and the issue occurs. Only when md='e|t', the first term is 1 hence it will not encounter the conversion issue.

The term should be changed to

strlen(s:jmptobuf) && s:jmptobuf !~# '\v^0$'  && md =~ '[et]'

to check for the 0 and empty terms in g:ctrlp_switch_buffer.

Tested and works on Ubuntu and Windows.

CtrlPTag results accuracy

First of all thanks for such a great project. I am cross-posting this issue from the previous repository because it seems inactivate and this looks like a new official repo for CtrlP.

I'm having issue with searching a class name within a ctags file, this particular class name has a keyword that exists in many other classes, the list of classes are like these:

  • Institution
  • BasicInstitution
  • InstitutionViewSet
  • InstitutionForm

There are about 124 classes that use the word Institution in it, now when I search using the word Institution or institution in non-regex mode, I was expecting to get Institution but instead I was getting Basic Institution and other class which are not started with the word Institution (but still has Institution in their second or third word).

screen shot 2014-09-01 at 8 52 21 am

Now if I type instviewset, I get InstitutionViewSet as expected, so that's great.

screen shot 2014-09-01 at 8 52 40 am

I can only get the class Institution by switching to regex and typing ^Institution.

screen shot 2014-09-01 at 8 53 01 am

I was kinda expecting to get Institution class just by typing Institution without having to frequently switch modes (preferably non-regex), in other words 'get the simplest most matching results'. How do I do this?.

Here's the simplified file containing all the classes: https://gist.github.com/kecebongsoft/90d0d7245853a8e37f64

And here's the ctags file: https://gist.github.com/kecebongsoft/2c3d62479e46f530e9fc

Thanks.

Setting ctrlp_match_func results in no matches

Hi,

I'm trying to use an external match function, but no matter what I do, my initial list of files is blank if I set a ctrlp_match_func.

I initially thought that this was a problem with the match function, but I'm thinking it's a problem with ctrlp.
For example, I've tried both https://github.com/FelikZ/ctrlp-py-matcher and https://github.com/JazzCore/ctrlp-cmatcher, but neither of those work.

In fact, the behavior is the same if I put in a nonsense function name:

let g:ctrlp_match_func = {'match' : 'nosuchfunction' }

filtering with the new buffer explorer

I think I found a weakness in the new buffer explorer. let's suppose I've loaded the files

app/code/local/Foo/Bar/Helper/Pdf.php
app/code/local/Xxx/Yyy/Helper/Data.php
etc...

If I open :CtrlPBuffer and type helperp I can't select Helper/Pdf.php, as the filtering is done on filename + path instead of path + filename, which imho is counter-intuitive...

(please see attached file, sorry for the bit of censorship)

untitled

Custom working directories question

Hi guys!

I'm using ctrlp to program some PHP projects that follow the following structure, more or less:

/company-project
/company-project/app/
/company-project/app/config
/company-project/random-directory-1
/company-project/src
/company-project/random-directory-2
/company-project/vendors/
/company-project/vendors/random-vendor-1
/company-project/vendors/random-vendor-2
/company-project/vendors/company
/company-project/vendors/random-vendor-3
/company-project/vendors/random-vendor-4
/company-project/vendors/symfony
/company-project/vendors/random-vendor-5
/company-project/vendors/random-vendor-6
/company-project/random-directory-3
/company-project/web

Ideally i'd like ctrlp to index the only following directories:

/company-project/app/config
/company-project/src
/company-project/vendors/company
/company-project/vendors/symfony
/company-project/web

There is a .git directory inside /company-project and then there are .git directories inside every directory inside vendors e.g. in /company-project/vendors/any-vendor since they are downloaded with the composer php dependency manager.

I've thought about adding a .ctrlpfile inside the directories that interest me and then adding it to the g:ctrlp_root_markers var but the documentation says that these are additional markers and i think the .git ones inside the vendors would screw the whole thing.

Do you think this can be solved with some configuration tips somehow?

Thanks!

CtrlP project switcher

I have a project called ctrlp-project. It's a simple project switcher that looks at either predefined directories with repositories or scans your $HOME for any top-level directory that contains git repositories. Once you've selected a project, it will immediately spawn a normal CtrlP in that project root, so you can split, vsplit or whatever with whatever file you are navigating to.

It looks nice too

It's very useful and I've been using it daily for over a year. No more quitting vim or navigating with a :cd or :lcd with a thousand ../../ or similar! At this computer (which I've had since January) I've done more than 500 switches according to my cachefile.

I was thinking of making it more production grade:

  • Cross platform (it's semi-UNIX specific right now)
  • Documentation (README and doc/)
  • Support for more VCSs than just git

I feel like this functionality fits very well in the core of a fuzzy switcher. I would love to spend some time to actually make it better and prepare a pull request. Would this be something that could be interesting to integrate into this project?

Add tags-cn to .gitignore

I manage plugins with pathogen and have it automatically call pathogen#helptags() in my .vimrc to keep tags files up to date.

Can you please add tags-cn to the .gitignore (like tags is already) so that git does not complain there is untracked content?

Thanks,

File Indexing and a Random Feature Request

I want to start with, forgive me if these problems have already been solved, please point them out if so, however I've had some thoughts around using CtrlP for a while now that I think would be very helpful.

Out of the box, I use these custom CtrlP commands, mostly because they seem to be blazingly fast in most situations:

if has("unix")
  let my_ctrlp_user_command = "" .
    \ "find %s '(' -type f -or -type l ')' -not -path '*/\\.*/*' | " .
    \ ctrlp_filter_greps .
    \ " | head -" . g:ctrlp_max_files

  let g:ctrlp_user_command = ['.git/', my_ctrlp_git_command,
    \ my_ctrlp_user_command]
elseif has('win32')
  let my_ctrlp_user_command = "" .
    \ "dir %s /-n /b /s /a-d" .
    \ ctrlp_filter_greps

  let g:ctrlp_user_command = ['.git/', my_ctrlp_git_command,
    \ my_ctrlp_user_command]
else
  let g:ctrlp_user_command = ['.git/', my_ctrlp_git_command]
endif

I don't know Vimscript very well, but the way I understand it: it uses git for generating indexes along with unix find, which is vastly superior performance-wise to the built in stuff.

So point number one would be, couldn't these types of settings be incorporated directly into CtrlP? Perhaps hidden behind a config option or two? Maybe they already are, it's tough to keep track of all the Vim plugins I use and what changes they incorporate.

Next on the list is filtering the results returned. Currently I use:

let ctrlp_filter_greps = "".
  \ "egrep -iv '\\.(" .
  \ "jar|class|swp|swo|log|so|o|pyc|pyo|jpe?g|eps|png|gif|mo|po|DS_Store" .
  \ "|a|beam|tar.gz|tar.bz2|map" .
  \ ")$' | " .
  \ "egrep -v '^(\\./)?(" .
  \ ".git/|.rbc/|.hg/|.svn/|.vagrant/|node_modules/|website/source/node_modules/|bower_components/|compressed/|_site/" .
  \ "|static_components/|bin/|env/|build/|static/compressed/|.sass-cache/|Session.vim" .
  \ ")'"

let my_ctrlp_git_command = "" .
  \ "cd %s && git ls-files . -co | " .
  \ ctrlp_filter_greps

Which is a great general catch all, but it get's a bit messy since these are global to all uses of CtrlP.

I would love for a way to still have these global filters, but then also be able to create like a .ctrlprc file in my specific project folders to hide various folders or filetypes relevant to that project.

A classic example, some projects I work on use Sass. Sass auto generates files with the same name just with a different extension in a different folder, for example: sass/file.sass gets generated to css/file.css. Obviously you can see how when fuzzy searching for files this becomes a bit of a pain. I would love to apply a filter to this project alone to hide all .css files. Obviously this is bad as a global setting because I have other projects where there are no sass files, and instead just css files.

Accept/cancel input programmatically in extensions

(This is a duplicate of kien#524)

https://github.com/phalkunz/ctrlp-related is a very useful plugin that lists related files relative to the current file. However, often times there are no related files, or only one - in that case, it would be useful to cancel ctrlp or accept the one result respectively, programmatically from the extension.

Currently, there isn't a good way to do that. I've succeed in almost possibly getting this working using feedkeys, but it requires managing the global g:ctrlp_buffer_func in an incredibly error-prone way.

An official supported option to enable this behavior would be very welcome.

<F5> closes ctrlp and uppercases letters

When I have the :CtrlP dialog open and hit <F5>, it closes the ctrlp dialog and uppercases 5 letters from the original cursor position in the file.

I noticed this behavior after I moved from kien's version to this one. I have not overridden any default ctrlp_prompt_mappings and I currently do not have anything mapped to <F5>.

turn on lazy_update cause a result window flash

after turn on lazy_update:
let g:ctrlp_lazy_update = 1

when I select any item in result window with <c-z>, the window flashing...
Is it a bug?

suggestion:
I think ctrlp should add "quick dir switch" function that can let me switch directory more quickly.
By now I perform this by "fuzzyfinder" plugin.

Use of clearmatches() is clobbering other plugins

I opened this issue with the plugin vim-css-color, and the author believes that it has something to do with ctrlp's use of clearmatches.

I don't know anything about vimscript, but does his findings make sense here?

The clearmatches call needs to be replaced with a matchdelete loop like in line 215, and the corresponding matchadd must be done as in line 221 + 222, which requires a variable set up like in line 257.

screenshot

CtrlPMixed searches entire machine

I like to use :CtrlPMixed by default so I don't have to think too much, but it's searching through all my files, instead of the directories it should be searching in according to the g:ctrlp_working_path_mode. :CtrlP and CtrlPCurWD work fine though, so it seems to be a bug only with the :CtrlPMixed command.

I'm running vim 7.4 on Mac OS X 10.10.2 and I barely changed any of the CtrlP configuration settings (only set g:ctrlp_cmd = 'CtrlPMixed' and g:ctrlp_working_path_mode = 'ra' to see if that would fix it) so that shouldn't be the problem.

Syntax highlight for CtrlP extensions

There is an old problem with matches highlighting in extensions:

kien#498

Highlight only works for file paths, due to hardcoded check.

Just curious what you think about adding one callback towards the end of the Render method. Something like

  let s:external_postrender = s:getextvar('postrender')
  if (s:external_postrender > -1)
    execute 'call ' s:external_postrender . '("' . a:pat .'")'
  en

This would potentially let plugin developers react on changes.

loading empty buffer when reopening a file

I've a weird issue and I'm not sure how to debug this one or it might be a bug (I don't think so).

When I open a file with ctrlp and close this file (with hidden buffers set / set hidden) and try to open the same file again I get an empty buffer and the file name is the buffer id of the given file.

image

I've tried it without any other plugin enabled and a fresh vimrc as well. Same issue.

CtrlPBufTag opens the number of the buffer instead of the buffer itself

The command CtrlPBufTag opens a new file whose name is the number of the current buffer instead of the buffer.
For example, if I'm editing the file /user/myproject/file.py whose buffer number is 7, running CtrlPBufTag in this file will open /user/myproject/7.

I'm not sure but this may be related to a recent commit modifying the way the buffers are displayed using a new buffer explorer mode. (8fc9a41)

BookmarkDir broken

As soon as a character is typed after :CtrlPBookmarkDir, the tabulator space between the folder and the bookmark title becomes a litteral\t that and joins the bookmark path and title.

This is on Linux, Vim 7.4.560

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.