emacsspacemacs

Spacemacs: settings of l (or h) to move from the end of the line to the beginning of the next line(or vice versa)


In the case of vim it is possible to set it as follows.

set whichwrap+=<,>,[,]

How can I set it for Spacemacs(vim editing style)?


Solution

  • It is not a Spacemacs-specific "issue", it comes from the included evil-mode Emacs package.

    Short answer:

    (setq evil-cross-lines t)

    ... before evil-mode is loaded.

    In .spacemacs, this can be under dotspacemacs/user-init

    Long answer:

    Pressing Ctrl-h k followed by l or h shows you what commands are bound to these keys, and (in recent emacs versions), the keymap in which they are defined. The commands (or rather, motions) are evil-forward-char and evil-backward-char, respectively. Looking at their definition, in evil-commands.el, it can be seen that their movement is restricted to the current line - or not - based on the value of the variable evil-cross-lines, which is by default nil. And the docstring of this variable confirms it: "Whether motions may cross newlines".