(in-package :editor) ;; Modes (defmode "Vim Command" :setup-function 'setup-vim-command) (defmode "Vim Insert") (defun setup-vim-command (buffer) (use-buffer buffer (setf *vim-last-movement* nil *vim-pending-action* nil *vim-last-action* nil))) (defun vim-command-mode-p () (and (current-buffer) (find "Vim Command" (buffer-mode-names (current-buffer)) :test #'string=))) (defcommand "Vim Command Mode" (p) "Start Vim Command mode" "Start Vim Command mode" (declare (ignore p)) (setf (buffer-minor-mode (current-buffer) "Vim Insert") nil) (setf (buffer-minor-mode (current-buffer) "Vim Command") t)) (defcommand "Vim Mode" (p) "" "" (vim-command-mode-command p)) (defcommand "Vim Insert Mode" (p) "" "" (declare (ignore p)) (setf (buffer-minor-mode (current-buffer) "Vim Insert") t) (setf (buffer-minor-mode (current-buffer) "Vim Command") nil)) (defcommand "Exit Vim Mode" (p) "Exit Vim Command Mode" "Exit Vim Command Mode" (declare (ignore p)) (setf (buffer-minor-mode (current-buffer) "Vim Command") nil) (setf (buffer-minor-mode (current-buffer) "Vim Insert") nil)) (defcommand "Vim Scroll Window Down" (p) "" "" (scroll-window-down-command (or p 1))) (defcommand "Vim Scroll Window Up" (p) "" "" (scroll-window-up-command (or p 1))) (defcommand "Vim Repeat" (p) "" "" (funcall *vim-last-action* p)) (defcommand "Vim Append Text at End of Line" (p) "" "" (declare (ignore p)) (end-of-line-command nil) (vim-insert-mode-command nil)) (defcommand "Vim Insert Text at Beginning of Line" (p) "" "" (declare (ignore p)) (back-to-indentation-command nil) (vim-insert-mode-command nil)) (defcommand "Vim Open Line Down" (p) "" "" (declare (ignore p)) (line-end (current-point)) (new-line-command nil) (vim-insert-mode-command nil)) (defcommand "Vim Open Line Up" (p) "" "" (declare (ignore p)) (line-start (current-point)) (open-line-command nil) (vim-insert-mode-command nil)) (defcommand "Vim Save All Files" (p) "" "" (declare (ignore p)) (save-all-files-command t)) (defcommand "Vim Save All Files and Exit" (p) "" "" (declare (ignore p)) (save-all-files-command t) (lispworks-tools::confirm-quit-lispworks)) ;; This isn't really the right way (i.e. the Vim way) to do a ;; setting like this. Oh well. #+nil (defcommand "Vim Toggle hlsearch" (p) "" "" (setq v+hlsearch (cond ((not p) (not v+hlsearch)) ((plusp p) t) (t nil))) (if v+hlsearch (highlight-search) (font-lock-fontify-buffer-command nil))) #+nil (progn (defcommand "Vim Test" (p) "" "" (set-current-mark (current-point)) (next-line-command nil) (kill-region-command nil)) (bind-vim-command "Vim Test" ",,") ) ; progn ; (defcommand "Vim Jump To Match" (p) "Currently only works on ()" "" ; (declare (ignore p))