47 lines
3.6 KiB
Org Mode
47 lines
3.6 KiB
Org Mode
#+TITLE: Counsel-projectile -- Ivy UI for Projectile
|
|
#+OPTIONS: num:nil
|
|
|
|
[[https://melpa.org/#/counsel-projectile][[[https://melpa.org/packages/counsel-projectile-badge.svg]]]]
|
|
|
|
* Description
|
|
:PROPERTIES:
|
|
:CUSTOM_ID: description
|
|
:END:
|
|
[[https://github.com/bbatsov/projectile][Projectile]] has native support for using [[https://github.com/abo-abo/swiper][ivy]] as its completion system. Counsel-projectile provides further ivy integration into projectile by taking advantage of ivy's mechanism to select from a list of actions and/or apply an action without leaving the completion session. It is inspired by [[https://github.com/bbatsov/helm-projectile][helm-projectile]].
|
|
* Installation
|
|
:PROPERTIES:
|
|
:CUSTOM_ID: installation
|
|
:END:
|
|
Install the package from [[https://melpa.org][MELPA]] or [[https://github.com/dimitri/el-get][el-get]], or clone this repository somewhere in your load path.
|
|
* Basic setup
|
|
:PROPERTIES:
|
|
:CUSTOM_ID: basic-setup
|
|
:END:
|
|
You can use counsel-projectile (and in particular call the command ~counsel-projectile~ described below with ~C-c p SPC~) without setting up anything. If you want counsel-projectile to install replacements for some standard projectile commands (see below again), add the following to your init file:
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(counsel-projectile-on)
|
|
#+END_SRC
|
|
* Usage
|
|
:PROPERTIES:
|
|
:CUSTOM_ID: usage
|
|
:END:
|
|
The main command is ~counsel-projectile~, and can be called with ~C-c p SPC~ (assuming the variable ~projectile-keymap-prefix~ has been left at its default value, ~C-c p~). This command behaves differently depending on whether you call it from inside a project or not:
|
|
- If you are not inside a project, it calls the function ~counsel-projectile-switch-project~. This uses ivy to display a list of all known projects and let you select a project to switch to. You can choose from a number of actions to be applied upon switching (using ~M-o~ or ~C-M-o~, as usual with ivy).
|
|
- If you are inside a project, it instead uses ivy to display a list of all project buffers and files. The project buffers are fontified, and the project files that are not currently open are shown as "virtual buffers" with a different font (as in the function ~ivy-switch-buffer~). You can choose to visit the selected file / display the selected buffer in the current or another window. If you would rather switch to a different project, you can so with ~M-SPC~.
|
|
|
|
Counsel-projectile also provides replacements for several standard projectile commands, which take advantage of ivy to let you choose from several actions. To install these replacements, call the command ~counsel-projectile-on~. Here are the currently defined replacements, with their default key-bindings:
|
|
- ~C-c p f~ ~counsel-projectile-find-file~: find a project file,
|
|
- ~C-c p d~ ~counsel-projectile-find-dir~: find a project directory,
|
|
- ~C-c p b~ ~counsel-projectile-switch-to-buffer~: switch to a project buffer,
|
|
- ~C-c p s s~ ~counsel-projectile-ag~: search project files with ag,
|
|
- ~C-c p p~ ~counsel-projectile-switch-project~: switch to another project (see above).
|
|
|
|
If your default action for switching to a project (stored in the variable ~projectile-switch-project-action~) is ~projectile-find-file~ (the default), then ~counsel-projectile-on~ also replaces it with ~counsel-projectile~.
|
|
|
|
You can call the command ~counsel-projectile-off~ to undo all changes made by ~counsel-projectile-on~.
|
|
* Contributors
|
|
:PROPERTIES:
|
|
:CUSTOM_ID: contributors
|
|
:END:
|
|
Many thanks to [[https://github.com/abo-abo][abo-abo]] and [[https://github.com/DamienCassou][DamienCassou]] who encouraged and helped me to start this repository.
|