Skip to content

Latest commit

 

History

History
360 lines (237 loc) · 8.41 KB

CUSTOMIZATIONS.org

File metadata and controls

360 lines (237 loc) · 8.41 KB

CUSTOMIZATIONS

Helper Functions

meow-define-keys

Define key bindings in a state.

(meow-define-keys
 ;; state
 'normal

 ;; bind to a command
 '("a" . meow-append)

 ;; bind to a keymap
 (cons "h" help-map)

 ;; bind to a keybinding
 '("x" . "C-x C-x"))

meow-normal-define-key

Similar to meow-define-keys. Define key in NORMAL state.

meow-leader-define-key

Similar to meow-define-keys. Define key in leader keymap.

The keymap used is the one listed in meow-keymap-alist.

By default, it is mode-specific-map.

meow-motion-overwrite-define-key

Similar to meow-define-keys. Define key in MOTION state.

Meow will remap overwritten commands to a keybinding with HYPER modifier.

For example, if you define j as C-N , the original command on j will be bound to H-j.

meow-setup-indicator

A helper function that puts an indicator at the beginning of mode-line. If you want customize mode-line by hand, see `meow-indicator`.

Example usage:

(meow-setup-indicator)

meow-indicator

Return an indicator string that you can use in your `mode-line-format`.

Example usage:

(setq-default mode-line-format '((:eval (meow-indicator)) ...))

meow-thing-register

Register a thing which can be used for meow-beginning/end/inner/bounds-of-thing. To bind it to a key, check variable meow-char-thing-table.

Check function’s documentation for usage examples.

meow-define-state

Define a custom state.

Example usage:

(setq meow-paren-keymap (make-keymap))
(meow-define-state paren
  "meow state for interacting with smartparens"
  :lighter " [P]"
  :keymap meow-paren-keymap)

;; meow-define-state creates the variable
(setq meow-cursor-type-paren 'hollow)

(meow-define-keys 'paren
  '("<escape>" . meow-normal-mode)
  '("l" . sp-forward-sexp)
  '("h" . sp-backward-sexp)
  '("j" . sp-down-sexp)
  '("k" . sp-up-sexp)
  '("n" . sp-forward-slurp-sexp)
  '("b" . sp-forward-barf-sexp)
  '("v" . sp-backward-barf-sexp)
  '("c" . sp-backward-slurp-sexp)
  '("u" . meow-undo))

This function generates several new objects named based on the NAME parameter passed in. See the function’s docstring for a list of them.

Similarly to define-minor-mode, your last parameter to meow-define-state may be a single lisp form that is run every time the internal minor mode is entered and exited.

If you already have a minor mode that you just need to register with meow, then see the documentation for the internal function meow-register-state.

Variables

meow-mode-state-list

Default:

((fundamental-mode . normal)
 (text-mode . normal)
 (prog-mode . normal)
 (conf-mode . normal)
 (json-mode . normal)
 ...)

A list of rules to specify the initial Meow state for major mode.

Value should be a list, each item is (major-mode . init-state). The init-state can be any state, including custom ones.

By default, Meow will use motion for special modes (in which none of the alphabet keys trigger a `self-insert` command), and normal for other modes.

meow-expand-exclude-mode-list

Default: (markdown-mode org-mode)

A list of major modes where expand feature should be disabled.

The expand feature use overlay for display, and it may not work well with texts with inconsistent sizes.

meow-expand-hint-counts

Default:

((word . 30)
 (line . 30)
 (block . 30)
 (find . 30)
 (till . 30))

The maximum numbers for expand hints of each type.

meow-expand-hint-remove-delay

Default: 1.0

The delay before the position hint disappears.

meow-selection-command-fallback

Default:

((meow-change . meow-change-char)
 (meow-kill . meow-C-k)
 (meow-cancel-selection . keyboard-quit)
 (meow-pop-selection . meow-pop-grab)
 (meow-beacon-change . meow-beacon-change-char))

Fallback behaviours for selection-only commands when there’s no selection.

meow-keypad-message

Default: t

Whether to log keypad messages in minibuffer.

meow-keypad-start-keys

Default: '((?c . ?c) (?h . ?h) (?x . ?x))

Alist of keys to begin keypad translation. For instance, given the default value, pressing “c” in keypad mode will look up it’s value in the alist, and add “C-c” to the keypad.

meow-keypad-self-insert-undefined

Default: t

Whether to self-insert a key when it is undefined in the keypad. If set to t, then pressing and undefined key in the keypad that is bound to self insert will insert that character. If nil, then ignore the key.

meow-char-thing-table

Default:

((?r . round)
 (?s . square)
 (?c . curly)
 (?g . string)
 (?e . symbol)
 (?w . window)
 (?b . buffer)
 (?p . paragraph)
 (?l . line)
 (?d . defun)
 (?. . sentence))

Mapping from char to thing.

Used by meow-beginning-of-thing, meow-end-of-thing, meow-inner-of-thing and meow-bounds-of-thing.

meow-replace-state-name-list

Default:

((normal . "NORMAL")
 (motion . "MOTION")
 (keypad . "KEYPAD")
 (insert . "INSERT")
 (beacon . "BEACON"))

A association list of state symbols to strings describing the state.

meow-indicator-face-alist

Default:

((normal . meow-normal-indicator)
 (motion . meow-motion-indicator)
 (keypad . meow-keypad-indicator)
 (insert . meow-insert-indicator)
 (beacon . meow-beacon-indicator))

An association list of meow state symbols to indicator face symbols.

meow-display-thing-help

Default: t

Whether to display the help prompt for meow-inner/bounds/begin/end-of-thing.

meow-keypad-describe-delay

Default: 0.5

The delay in seconds before popup keybinding descriptions appear.

meow-grab-fill-commands

Default: (meow-query-replace meow-query-replace-regexp)

A list of commands that meow will auto fill with grabbed content.

meow-goto-line-function

Default: nil

Function to use in meow-goto-line.

Nil means find the command by key binding.

meow-visit-collect-min-length

Default: 1

Minimal length when collecting symbols for meow-visit.

meow-visit-sanitize-completion

Default: t

Whether let meow-visit display symbol regexps in a sanitized format.

meow-use-clipboard

Default: nil

Whether to use system clipboard. Not recommended.

meow-use-keypad-when-execute-kbd

Default: t

Whether to use KEYPAD when the result of executing kbd string is a keymap.

meow-keypad-meta-prefix

Default: ?m

The prefix represent M- in KEYPAD state.

meow-keypad-ctrl-meta-prefix

Default: ?g

The prefix represent C-M- in KEYPAD state.

meow-keypad-literal-prefix

Default: 32 (SPC character)

The prefix represent no modifier in KEYPAD state.

meow-expand-selection-type

Default: select

The type of selection activated by meow-expand-* commands.

meow-motion-remap-prefix

Default: “H-”

The prefix string used when remapping an occupied key in MOTION state.

For examples:

"C-x C-v" will remap the occupied j to C-x C-v j.
"C-M-" will remap the occupied j to C-M-j.

meow-state-mode-alist

Association list of symbols of meow states to their corresponding mode functions.

meow-update-cursor-functions-alist

Association list of predicates to functions.

This list is used to update the cursor type and face. The first value whose predicate evaluates to true will have its corresponding key run. This key should use meow--set-cursor-type and meow--set-cursor-color to update the cursor.

You may customize this list for more complex modifications to the cursor. For instance, to change the face of the insert cursor to a hollow cursor only in org-mode, use

(defun meow--update-cursor-custom ()
  (progn
    (meow--set-cursor-type 'hollow)
    (meow--set-cursor-color 'meow-insert-cursor)))
(add-to-list 'meow-update-cursor-functions-alist
             '((lambda () (and (meow-insert-mode-p)
                               (eq major-mode 'org-mode)))
               . meow--update-cursor-custom))

Note that the both the car and cdr must be functions.

However, for simple changes to the insert cursor it would be sufficient to change the variable meow-cursor-type-insert.

meow-keymap-alist

Association list of symbols to their corresponding keymaps. Used to generate meow-*-define-key helpers.