What would be the easiest way to have the same kind of behavior that is in vim for the word back and forth navigation? In vim when you press "w
" it moves a cursor forward one word, where word consists of a sequence of letters, digits and underscores, or a sequence of other non-blank characters, separated with white space (spaces, tabs, eol). In emacs on the other hand it skips until the end of the next word and the word is defined per mode in the syntax table.
For example: having a cursor at the beginning of the line following shows where vim put a cursor when you do forward-word
("w
") operation:
opt1.arg = opt2.arg
^ ^^ ^ ^ ^^ ^
In emacs it is like:
opt1.arg = opt2.arg
^ ^ ^ ^ ^
It really depends on a one's preference, but I tend to like the vim style better and I was wondering what is the easiest way to have the same in emacs. I guess I'm not alone who switched from vim to emacs so perhaps someone already has a solution, ideally for the kill-word
and backward-kill-word
as well :)
I know you can get something similar by combination of M-f
, M-b
etc., but that is not the point. I also don't want to start a discussion which approach is better - the topis is well discussed in here.
I don't know why jpkotta's answer was deleted, but here it is again:
@ mods, I don't know why this answer would be deleted, so if you choose to delete this answer too, I'd appreciate an explanation.
Mostly a duplicate of this, which says:
Then bind whatever keys you want to
forward-to-word
andbackward-to-word
. For killing, create some simple functions that wrap these functions and do kill.You can actually use
'viper-forward-word