This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/doc/HOWTOs.org
Eivind Fonn 48d660fd98 Document evilified modes
[ci-skip]
2015-10-05 12:07:45 +02:00

3.7 KiB

Compilation of quick HOW-TOs for Spacemacs

Disable a package completely

To completely disable a package and effectively uninstalling it even if it is part of your used layers, look for the variable dotspacemacs-excluded-packages in your dotfile and add the package name to it:

  (setq-default dotspacemacs-excluded-packages '(package1 package2 ...))

Disable a package only for a specific major-mode

This is done by removing the hook added by Spacemacs. For example to remove flycheck support in python buffers, look for the function dotspacemacs/user-config in your dotfile and add the following code:

    (remove-hook 'python-mode-hook 'flycheck-mode)

Hint to know the name of the major-mode of the current buffer press: SPC h d v major-mode RET

Disable company for a specific major-mode

It may be handy to disable company for a given mode if you plan on configuring auto-complete instead. On easy way to do it is to use the macro spacemacs|disable-company in the function dotspacemacs/user-config of your dotfile. The following snippet disables company for python-mode:

    (spacemacs|disable-company python-mode)

Change special buffer rules

To change the way spacemacs marks buffers as useless, you can customize spacemacs-useless-buffers-regexp which marks buffers matching the regexp as useless. The variable spacemacs-useful-buffers-regexp marks buffers matching the regexp as useful buffers. Both can be customized the same way.

Examples:

    ;; Only mark helm buffers as useless
    (setq spacemacs-useless-buffers-regexp '("\\*helm\.\+\\*"))

    ;; Marking the *Messages* buffer as useful
    (push "\\*Messages\\*" spacemacs-useful-buffers-regexp)

Enable navigation by visual lines

Add the following snippet to your dostpacemacs/config function:

    ;; Make evil-mode up/down operate in screen lines instead of logical lines
    (define-key evil-motion-state-map "j" 'evil-next-visual-line)
    (define-key evil-motion-state-map "k" 'evil-previous-visual-line)
    ;; Also in visual mode
    (define-key evil-visual-state-map "j" 'evil-next-visual-line)
    (define-key evil-visual-state-map "k" 'evil-previous-visual-line)

Disable evilification of a mode

You can ensure a mode opens in emacs state by using evil-set-initial-state.

  (evil-set-initial-state 'magit-status-mode 'emacs)

You can also do this using buffer name regular expressions. E.g. for magit, which has a number of different major modes, you can catch them all with

  (push '("*magit" . emacs) evil-buffer-regexps)

This should make all original magit bindings work in the major modes in question. To enable the leader key in this case, you may have to define a binding in the mode's map, e.g. for magit-status-mode,

  (define-key magit-status-mode-map
    dotspacemacs-leader-key evil-leader--default-map)