`w` and `e` and `b` skip one character words

a b c d

Try pressing w, e, and b on that line.
Sometimes, the key presses miss one character words.
For example, try pressing w with the cursor on a. w skips a.

For example, try pressing w with the cursor on a. w skip a.

FYI in Kakoune there’s no “Cursor”. Your cursor is actually a sngle-character selection. So when you press w while “cursor” rests on a single-char word, it selects the next word, because that word was already selected

it’s not anything to do with single character words. if you have the cursor on the last character in a word pressing w selects the whitespace between that word and the next. this is the only situation where pressing w does not select the current head of the selection.

I think the reason is that kakoune decides to select the next (e) or previous (b) word rather than the current if the head of the selection is at the last or first character respectively. So w works the same as e, but it seems like it would be more intuitive if it treated the end of the whitespace as the marker to move forward, not the end of the current word. but likely there is some other scenario where the current behavior makes more sense.

well, w selects til the end of the word, so if you’re on the word end already it selects the next one. single characters fall into this category

it doesn’t select the next one if the cursor is at the end of the word though, which is what I think OP is wondering about. It selects the whitespace in between the words. It’s just more noticeable with single characters because your cursor is always at the end.

([] marcs current selection)

vai[v]     vaiv    vaiv

Press w

vaiv[     ]vaiv    vaiv

Press w

vaiv     [vaiv    ]vaiv

This is correct behavior. w marks the word forward from cursor. I suppose the expected result was:

vai[v]     vaiv    vaiv

Press w

vai[v     ]vaiv    vaiv

Press w

vaiv     [vaiv    ]vaiv

If that’s the desired result use W on single char word to fix current anchor position for the first move

I don’t think so, given that it’s inconsistent. “w marks the word forward from the cursor” is just a natural language description. The precise description:

«w sets the beginning of the selection to the cursor character and the cursor the the end of the word if the cursor is not currently there (with the definition of word given by a regex), or selects the next word otherwise.»

is simpler than another one that also discriminates in the case that the cursor is at the end of the non-blank characters of the word (which apparently does not serve any purpose).

The current behavior of w, e, and b is confusing.

The model for cursor and selection should be explained with high precision or changed.
Just lay out the programming variables and the algorithm for cursor and selection.
Plain english explanation is failing.

Hi timber, w e b check this earlier thread out with new bindings for those keys.

and here is @alexherbo2 old word-select.kak commit that I like for w

  # <https://github.com/alexherbo2/word-select.kak/blob/c46f0c117d1e704fb674c7770d4e6a53677bdbca/rc/word-movement.kak#L11>
  define-command whitespace-next 'execute-keys \"_/\s+<ret>'         -docstring 'whitespace next'
  define-command whitespace-previous 'execute-keys \"_<a-/>\s+<ret>' -docstring 'whitespace previous'

  map global normal w ': whitespace-next<ret>'
  map global normal W ': whitespace-previous<ret>'

cya timber.

You are confusing me even further.

Sorry about that, not my intention. Let me know if there’s anything you need help with or just keep reading the discuss kakoune post from the top search box in town.

Screenshot 2021-07-04 185945

click and win! Bye :wave: