/evil-better-visual-line

Slightly more useful evil bindings for j and k

Primary LanguageEmacs LispGNU General Public License v3.0GPL-3.0

Evil Better Visual Line

http://melpa.org/packages/evil-better-visual-line-badge.svg

Back in my vim days, I much preferred to default to moving on visual lines as opposed to source lines, perhaps best expressed with the following lines from my .vimrc:

nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk

However, this rebinding is somewhat annoying in visual line and visual block mode, as moving on visual lines is almost never the intent in those modes. This package provides two commands, evil-better-visual-line-next-line and evil-better-visual-line-previous-line, which act like gj and gk unless in either of those modes (or states in evil terminology), in which case they act like j and k. evil-better-visual-line-on is also provided as a convenient way of binding these two commands to j and k.

Installation

Melpa:

Install from MELPA directly with M-x package-install evil-better-visual-line. See the melpa repository for details about how to set up MELPA if you have not already done so.

use-package

I would recommend jwiegley’s excellent use-package to install if you can:

(use-package evil-better-visual-line
  :ensure t
  :config
  (evil-better-visual-line-on))

I have a layer in my .spacemacs.d set up to load this package and call evil-better-visual-line-on, which you can add to your own private layer directory if you would like to use this package with spacemacs.

Manually:

Download with:

git clone git@github.com:YourFin/evil-better-visual-line.git

Make sure that the resulting folder is in your load path. Example in .emacs.d/init.el for .emacs.d/evil-better-visual-line:

(add-to-list 'load-path (expand-file-name "/evil-better-visual-mave"))

Random folder on your system:

(add-to-list 'load-path "/path/to/evil-better-visual-mave")

And then turn it on:

(require 'evil-better-visual-line)
(evil-better-visual-line-on)