noctuid / evil-textobj-column

Column Text Objects for Evil
GNU General Public License v3.0
14 stars 1 forks source link

[[http://melpa.org/#/evil-textobj-column][file:http://melpa.org/packages/evil-textobj-column-badge.svg]]

Currently, there is no outer text object. In many cases, the inner and outer text objects in the vim plugin behaved the same, and I never found myself using the outer text object. If someone wants one, I can try to add one. Another difference from the original plugin is that a word column will never be composed of only whitespace.

This package takes a fairly generic approach for determining what a column is. If you find a situation where you think the selection should be different or there is clearly a bug, please make an issue.

If you are using a comment text object (for example the one from [[https://github.com/luxbock/evil-cleverparens][evil-cleverparens]]), you may want to use something like =k= instead.

For example, this is how ~evil-textobj-column-word~ is defined:

+begin_src emacs-lisp

(evil-define-text-object evil-textobj-column-word (count &optional beg end type) (evil-textobj-column-create-range #'evil-forward-word-begin

'evil-backward-word-begin

                                #'evil-forward-word-end))

+end_src

This functionality is probably most useful for variants of an evil word (e.g. maybe a camel case word). Using different motions may introduce new edge cases, so please make an issue if you encounter any problems.

The upper and lower column boundaries are determined by moving up or down until the new word (by default) start no longer matches the initial column (or the end or start of the buffer is reached).

The right column boundary is determined by the maximum column reachable by the forward-end motion.