juliusHuelsmann / st-history-vim

Development of the "vim patch" and a minimalist "history patch" for the suckless simple terminal (st).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to user vw instead vE

zaiqiang-dong opened this issue · comments

hi,sir:
when i select xxx_xxx_xxx , need press vE,the vw slect xxx only. how to config use vw select all xxx_xxx_xxx?
Thranks ,Brs.

Hi! I am unsure if you potentially use a different string than the one from your question or if you are using an old version of vim-browse, I cannot reproduce the behavior you described in the question.

Behavior on the current version

on the following text:

xxx_xxx_xxx next_word ...

with cursor position on the first x.

Selection when using vE when on the first letter (indicated by [ ])

[xxx_xxx_xxx] next_word ...

Selection when using vW

[xxx_xxx_xxx n]ext_word

In general, w/W selects until the beginning of the next word (including the delimiter and the next word's first char) and e/E until the word's last letter.
Capitalization of the letter determines the set of delimiters defined as follows in the config[.def].h:

char const wDelS[] = "!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~";
char const wDelL[] = " \t";xxx

Note that _ is not in the list of delimiters of either category.
So, in your example, ve resp vw should already do the trick.

Behavior on different string.

If your string were

xxx-xxx-xxx next_word

vw would only select xxx- and ve only xxx. However, as - is not in the array wDelL, vE and vw select the entire strings xxx-xxx-xxx n resp. xxx-xxx-xxx.

If you'ld like this to be the default behavior of vw resp ve, simply remove - from wDelS in your config.h.

I hope this helps! This wiki entry summarizes some of the commands mentioned above, and the implementation of the word movement in particular is in line 134 of file normalMode.c. If you really want to change the behavior of w by those of e, you could swap cases or simply change characters there, the simplest solution would be to delcare cs as non-const (*) and prepend swapping keys (**).

(*): Declare cs as non-const:
Replace

int executeMotion(char const cs, int len, KeySym const *const ks) {

with

int executeMotion(char cs, int len, KeySym const *const ks) { 

(**): Insert this code somewhere (e.g. line 134) or at the function's beginning.

cs = cs == 'w'  ? 'e' : cs == 'e' : 'w';

but i think this might not be what you want

Edit
I think in your fork you use an old version of vim-browse, maybe you'ld like to update to version 2 which is available at the suckless release page, although I have to say that there is a bug withistoryh the shipped history patch (see issues). You can try out if the new patch is problematic for you workflow by trying out the patch's new version here.

You can also change the behavior in your version in normalMode.c on your version, although the code changed a bit

Thank you very much, your answer is very useful,I will update to version 2 and recofnig it .

Awesome :) If you have to go through the hussle of updating your vim-browse version, I recommend checking out the release page, because it takes some time until the new versions are released at the st website (i think the current version is not online yet).

whth latest version patch i can not add scroll patch, how to fix it?
Is there documentation on how to use it ,like go to first line whit "gg" can be find answer.

Hi! the second version uses a custom scroll patch maintained in this repo, if you rely on some of scrollback's feature you might not be able to upgrade, otherwise just apply the patch without any prerequisite patches

OK, Thanks.