** Installation =kakoune.el= is on melpa, so for users of =use-package=, installation should be as simple as
(use-package kakoune)
.
Goals
This is not meant to be a feature-complete emulation of kakoune, like evil is to vim. Evil is a massive undertaking, which reimplements a huge number of editing primitives from scratch. By contrast, kakoune.el uses emacs's native behavior wherever possible. In particular, it binds absolutely no keys in "insert mode," letting you gradually adjust to "normal mode" at your own pace. To actually access normal mode, you can either call =(ryo-modal-mode)= with =M-x=, or bind a key globally. For the true modal experience: =(global-set-key (kbd "
The following is my entire configuration that I use every day with respect to overriding and extending the functionality provided by this package.
(use-package kakoune ;; Having a non-chord way to escape is important, since key-chords don't work in macros :bind ("C-z" . ryo-modal-mode) :hook (after-init . my/kakoune-setup) :config (defun ryo-enter () "Enter normal mode" (interactive) (ryo-modal-mode 1)) (defun my/kakoune-setup () "Call kakoune-setup-keybinds and then add some personal config." (kakoune-setup-keybinds) (setq ryo-modal-cursor-type 'box) (add-hook 'prog-mode-hook #'ryo-enter) (define-key ryo-modal-mode-map (kbd "SPC h") 'help-command) ;; Access all C-x bindings easily (define-key ryo-modal-mode-map (kbd "z") ctl-x-map) (ryo-modal-keys ("," save-buffer) ("P" counsel-yank-pop) ("m" mc/mark-next-like-this) ("M" mc/skip-to-next-like-this) ("n" mc/mark-previous-like-this) ("N" mc/skip-to-previous-like-this) ("M-m" mc/edit-lines) ("*" mc/mark-all-like-this) ("v" er/expand-region) ("C-v" set-rectangular-region-anchor) ("M-s" mc/split-region) (";" (("q" delete-window) ("v" split-window-horizontally) ("s" split-window-vertically))) ("C-h" windmove-left) ("C-j" windmove-down) ("C-k" windmove-up) ("C-l" windmove-right) ("C-u" scroll-down-command :first '(deactivate-mark)) ("C-d" scroll-up-command :first '(deactivate-mark)))))
;; This overrides the default mark-in-region with a prettier-looking one, ;; and provides a couple extra commands (use-package visual-regexp :ryo ("s" vr/mc-mark) ("?" vr/replace) ("M-/" vr/query-replace))
;; Emacs incremental search doesn't work with multiple cursors, but this fixes that (use-package phi-search :bind (("C-s" . phi-search) ("C-r" . phi-search-backward)))
;; Probably the first thing you'd miss is undo and redo, which requires an extra package ;; to work like it does in kakoune (and almost every other editor). (use-package undo-tree :config (global-undo-tree-mode) :ryo ("u" undo-tree-undo) ("U" undo-tree-redo) ("SPC u" undo-tree-visualize) :bind (:map undo-tree-visualizer-mode-map ("h" . undo-tree-visualize-switch-branch-left) ("j" . undo-tree-visualize-redo) ("k" . undo-tree-visualize-undo) ("l" . undo-tree-visualize-switch-branch-right)))
It's kind of a lot, but it does provide a good example of how to override defaults and bind your own keys to your own commands. I use this daily, along with the rest of the commands provided by the package, and am very happy with it.
** Known bugs