cp-find-dir: Add actions to visit dir externally / as root
This commit is contained in:
parent
9660cf8434
commit
5aa8a0bc8e
2 changed files with 20 additions and 4 deletions
10
README.md
10
README.md
|
|
@ -125,9 +125,9 @@ This command is a replacement for `projectile-find-file`. It displays a list of
|
|||
| :----------- | :----------------------------------------------------------------------- |
|
||||
| <kbd>o</kbd> | Open file in current window (default action) |
|
||||
| <kbd>j</kbd> | Open file in other window |
|
||||
| <kbd>x</kbd> | Open file externally (does nothing for buffers) |
|
||||
| <kbd>r</kbd> | Open file as root (does nothing for buffers) |
|
||||
| <kbd>m</kbd> | Find file manually: call `counsel-find-file` from file's directory |
|
||||
| <kbd>x</kbd> | Open file externally |
|
||||
| <kbd>r</kbd> | Open file as root |
|
||||
| <kbd>m</kbd> | Find file manually: call `counsel-find-file` from file's directory |
|
||||
| <kbd>p</kbd> | Switch project: call `counsel-projectile-switch-project` (see above) |
|
||||
## The `counsel-projectile-find-dir` command
|
||||
Default key binding: <kbd>C-c p d</kbd>.
|
||||
|
|
@ -137,7 +137,9 @@ This command is a replacement for `projectile-find-dir`. It displays a list of a
|
|||
| Key | Action |
|
||||
| :----------- | :------------------------------------------------------------------- |
|
||||
| <kbd>o</kbd> | Open directory with `dired` in current window (default action) |
|
||||
| <kbd>j</kbd> | Open director with `dired` in other window |
|
||||
| <kbd>j</kbd> | Open directory with `dired` in other window |
|
||||
| <kbd>x</kbd> | Open directory externally |
|
||||
| <kbd>r</kbd> | Open directory as root |
|
||||
| <kbd>m</kbd> | Find file manually: call `counsel-find-file` from directory |
|
||||
| <kbd>p</kbd> | Switch project: call `counsel-projectile-switch-project` (see above) |
|
||||
## The `counsel-projectile-switch-to-buffer` command
|
||||
|
|
|
|||
|
|
@ -404,6 +404,10 @@ The sorting function can be modified by adding an entry for
|
|||
"current window")
|
||||
("j" counsel-projectile-find-dir-action-other-window
|
||||
"other window")
|
||||
("x" counsel-projectile-find-dir-action-extern
|
||||
"open externally")
|
||||
("r" counsel-projectile-find-dir-action-root
|
||||
"open as root")
|
||||
("m" counsel-projectile-find-file-action-find-file-manually
|
||||
"find file manually")
|
||||
("p" (lambda (_) (counsel-projectile-switch-project))
|
||||
|
|
@ -427,6 +431,16 @@ The sorting function can be modified by adding an entry for
|
|||
(dired-other-window (projectile-expand-root dir))
|
||||
(run-hooks 'projectile-find-dir-hook))
|
||||
|
||||
(defun counsel-projectile-find-dir-action-extern (dir)
|
||||
"Visit DIR externally and run `projectile-find-dir-hook'."
|
||||
(counsel-find-file-extern (projectile-expand-root dir))
|
||||
(run-hooks 'projectile-find-dir-hook))
|
||||
|
||||
(defun counsel-projectile-find-file-action-root (dir)
|
||||
"Visit DIR as root and run `projectile-find-dir-hook'."
|
||||
(counsel-find-file-as-root (projectile-expand-root dir))
|
||||
(run-hooks 'projectile-find-dir-hook))
|
||||
|
||||
;;;###autoload
|
||||
(defun counsel-projectile-find-dir (&optional arg)
|
||||
"Jump to a directory in the current project.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue