How can I get Emacs Projectile to operate like VScode's "C-p" ?

Caleb Jay

I have installed Projectile on my emacs26 installation. My configuration looks like as below:

(projectile-mode +1)
(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(projectile-global-mode) ;; to enable in all buffers
(setq projectile-enable-caching t) ;; to prevent constantly reindexing projectsx

I installed Projectile using Melpa.

I would like Projectile to find files in a project similar to how the command C-p works in vscode. Given the following directory:

src/
  views/
    cars.html
    dogs.html
  models/
    animals/
      dogs.js
      cats.js
    vehicles/
      cars.js
      trucks.js

In vscode if I do C-p dogs (no <RET>), I would see a selectable list containing dogs.html and dogs.js. As far as I can tell, this is duplicated by Projectile's C-c p f. The problem is when I do a search like models/dogs. In vscode, this would return only dogs.js, in Projectile, it returns nothing (reasonable, but not what I want).

I have large collections/model directories with many subdirectories and so I'm hoping to emulate this vscode behavior in Emacs if possible.

How can I have Projectile (or another Emacs plugin) file-search similarly to how vscode's C-p file-searches when dealing with multi-nested directories?

I investigated projectile-fix, but it does not seem to do as I want, and is also apparently incompatible with Helm, which I am starting to use and like.

legoscia

By default, Projectile uses Ido for completion. (Check the value of the variable projectile-completion-system to see if this has been configured differently in your Emacs.)

In Ido, you can type a part of the file name, and then hit C-SPC to restrict the list of items to what you've currently typed. So in your example you would type models C-SPC dogs to get to dogs.js.

If you have configured Projectile to use Helm, you can use a space character between the portions of the match: typing models dogs should narrow the list of matches down to dogs.js.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do I get Emacs projectile-mode to ignore most of the files that show up in a virtualenv Cython project?

How can I set a lifespan for a projectile?

Can I get split screen in Notepad++ like Emacs?

how to get focus on jmenu so that i can use keyboard to operate

How can I get the "dir" and "copy" commands to operate on "*.xyz" but not "*.xyz~"?

My projectile system not working, what's wrong with it, how can I fix it?

How can I utilize the whole terminal, like htop or emacs do?

How can I get the FirebaseInstanceId using VSCode?

How can I get data attributes from rlang's .data like I can with .?

How can I move a sprite while simultaneously firing a projectile in SpriteKit?

How to force emacs projectile to reinitialize a project?

How can I operate on a particular column?

How can I operate date variables in javascript?

How to get emacs-like keybindings in Pharo?

How can I get lodash type info to work in VSCode?

vscode extension. How can I get a file body by filename

What is the moving line at the top of vscode, and how can I get rid of it?

How can I get Web API autocomplete/IntelliSense in VSCode?

Emacs: can't autostart projectile installed through MELPA

How can I display the what's new window again in VSCode

How can I disable VSCode's suggestions for language keywords?

how can I change the button's order of the status bar in vscode?

How can I perform the equivalent regex searching operation in emacs like vim?

How can I get the ping results (like roundtrip time and ping status) when I ping to multiple IP's at the same time with PingAsync?

How to override emacs-projectile default configuration for project?

Emacs - How to automate adding new projects in BOTH - projectile and treemacs?

When creating a VSCode snippet, how can I transform a variable to title-case (like TitleCase)?

How do I get statistics for the VsCode extension? like downloads&uninstalls

How can I connect to vscode's built-in tsserver? What is the port number of vscode tsserver?