Skip to content

Commit

Permalink
Merge pull request #1216 from mychris/patch/current-directory
Browse files Browse the repository at this point in the history
Adds the commend current-directory and the ex command pwd.
  • Loading branch information
cxxxr authored Jan 1, 2024
2 parents 45aa62b + 17c292a commit 700d217
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions extensions/vi-mode/ex-command.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,7 @@
(define-ex-command "^noh(?:lsearch)?$" (range argument)
(declare (ignore range argument))
(lem/isearch:isearch-end))

(define-ex-command "^pwd?$" (range argument)
(declare (ignore range argument))
(lem:current-directory))
9 changes: 9 additions & 0 deletions src/commands/file.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
:revert-buffer
:revert-buffer-function
:change-directory
:current-directory
:prompt-for-files-recursively))
(in-package :lem-core/commands/file)

Expand Down Expand Up @@ -373,3 +374,11 @@
(uiop:chdir directory)
(setf *default-pathname-defaults* (uiop:getcwd)))
t)

(define-command current-directory (&optional insert) ("P")
"Display the directory of the active buffer.
With prefix argument INSERT, insert the directory of the active buffer at point."
(let ((dir (buffer-directory)))
(if insert
(insert-string (current-point) dir)
(message "Directory ~a" dir))))

0 comments on commit 700d217

Please sign in to comment.