Skip to content

Commit

Permalink
Merge pull request #1047 from fukamachi/vi-ex-keymap
Browse files Browse the repository at this point in the history
Allow to use C-n & C-p to choose from the history in Ex mode.
  • Loading branch information
cxxxr authored Sep 2, 2023
2 parents 60716ba + 197df95 commit 8baebb7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion extensions/vi-mode/binds.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
:lem-vi-mode/ex
:lem-vi-mode/visual)
(:import-from :lem-core
:keymap-table))
:keymap-table)
(:import-from :lem/prompt-window
:prompt-previous-history
:prompt-next-history))
(in-package :lem-vi-mode/binds)

(define-key *motion-keymap* "0" 'vi-move-to-beginning-of-line/universal-argument-0)
Expand Down Expand Up @@ -138,6 +141,9 @@
(define-key *replace-state-keymap* "C-g" 'escape)
(define-key *replace-state-keymap* "Escape" 'escape)

(define-key *ex-keymap* "C-p" 'prompt-previous-history)
(define-key *ex-keymap* "C-n" 'prompt-next-history)

(define-key *outer-text-objects-keymap* "w" 'vi-a-word)
(define-key *inner-text-objects-keymap* "w" 'vi-inner-word)
(define-key *outer-text-objects-keymap* "\"" 'vi-a-double-quote)
Expand Down
6 changes: 4 additions & 2 deletions extensions/vi-mode/ex.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
:vi-visual-end)
(:import-from :lem-vi-mode/utils
:expand-filename-modifiers)
(:export :vi-ex))
(:export :vi-ex
:*ex-keymap*))
(in-package :lem-vi-mode/ex)

(defvar *ex-keymap* (make-keymap :name '*ex-keymap*))
Expand Down Expand Up @@ -73,7 +74,8 @@
:end (line-end e)))))
(lem/completion-mode::completion-buffer
comp-str))))))
:history-symbol 'vi-ex))))))
:history-symbol 'vi-ex
:special-keymap *ex-keymap*))))))

(defun execute-ex (string)
(let ((lem-vi-mode/ex-core:*point* (current-point)))
Expand Down

0 comments on commit 8baebb7

Please sign in to comment.