-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Difference between Emacs and Vim on handling _
as word boundary
#9740
Comments
What Vim calls a word, Emacs calls a symbol. However, I like the Emacs definition of a word better now. |
I have this in my config to change the behaviour. (with-eval-after-load 'evil |
I had this setup as well @olymk2 but it felt weird, so I got used to navigating by Not saying it's a solution fit for everyone but navigating only with |
Thats not the full truth. Whether a character is treated is part of a word or symbol is determined by a major mode's syntax table. At any rate I dont think adding something like this to spacemacs is a good idea. Changing syntax definitions opens up a gaping abyss of subtle, difficult to track & debug bugs since everything that uses syntax tables - from autocompletion to syntax highlighting - would be affected by such a change. |
As @Alexander-Miller said, it would be unwise for Spacemacs to change this. However nothing is stopping your from updating the syntax table for your desired mode(s) so that |
Does that mean that the issue is decided and closed, as it is advised to update the syntax table instead of changing anything in Spacemacs? |
@rudolfkral I don't have final say for if it is decided, but as alexander said, it would effect other things, so we'll close this. |
This expands the entry on including underscores and dashes in word motions to discuss `*` and `#` searches. There is a new solution for them is different, and simpler, than the solution for the other motions (but it is difficult to find). For me, personally, this obviates the necessity of messing with the syntax definitions. Some related issues: syl20bnr#9740, syl20bnr#1248, syl20bnr#1261. Many thanks to lyro@ for fixing emacs-evil/evil#360.
This expands the entry on including underscores and dashes in word motions to discuss `*` and `#` searches. There is a new solution for them is different, and simpler, than the solution for the other motions (but it is difficult to find). For me, personally, this obviates the necessity of messing with the syntax definitions. Some related issues: #9740, #1248, #1261. Many thanks to lyro@ for fixing emacs-evil/evil#360.
This expands the entry on including underscores and dashes in word motions to discuss `*` and `#` searches. There is a new solution for them is different, and simpler, than the solution for the other motions (but it is difficult to find). For me, personally, this obviates the necessity of messing with the syntax definitions. Some related issues: syl20bnr#9740, syl20bnr#1248, syl20bnr#1261. Many thanks to lyro@ for fixing emacs-evil/evil#360.
This expands the entry on including underscores and dashes in word motions to discuss `*` and `#` searches. There is a new solution for them is different, and simpler, than the solution for the other motions (but it is difficult to find). For me, personally, this obviates the necessity of messing with the syntax definitions. Some related issues: syl20bnr#9740, syl20bnr#1248, syl20bnr#1261. Many thanks to lyro@ for fixing emacs-evil/evil#360.
In Vim,
_
is considered a word character. Soofoo_bar_baz
is one word.In Emacs,
_
is considered a separate word alltogether. Sofoo_bar_baz
is five words.Now, the Unicode standard agrees with what Vim does, and this is also the behaviour I am used to from many different contexts (browsers, command-line interfaces, ritch text editors etc): In many applications, using Ctrl+arrow keys lets you skip back and forth to the beginnings/ends of words quickly.
Because in the end, evil-mode is not entirely like vim, it adheres to emacs' rules of word boundary choice, which means that using the
w
andb
commands in evil-mode will give different results than when using them in command-line vim.Now I'm not sure what the proper approach might be here; There are ways to override how
_
works in most modes (see this stackoverflow answer), but this might not be a silver bullet solution:Maybe the best thing we could do is to add a configuration option in the
.spacemacs
for this?The text was updated successfully, but these errors were encountered: