Closed hbarcelos closed 4 years ago
Today I found out that this actually is not actually vim-styled-components
fault.
The actual culprit: https://github.com/gko/vim-coloresque/issues/20
I was using vim-coloresque
alongside this plugin and the problem is here:
" try to include CSS3 definitions from multiple files
" this is only possible on vim version above 7
if v:version >= 700
try
syn include @CSS3 syntax/css/*.vim
catch
endtry
endif
Since this plugin imports all syntax for CSS files and vim-coloresque
overrides iskeyword
, the word
text object gets messed up.
Hi, I'm a long-time user of Vim and recently I started working with styled components.
I'm a heavy user of Vim's text objects and I noticed something that has been bugging me for a while when the
vim-styled-components
plugin is loaded.More specifically, the word text object has historically a pretty well definition of what is a "word". Characters like
-
or.
are considered to be word delimiters, so native Vim finds that there are 5 words in the following line:If I need to consider the whole
very.deep.prop.being.accessed
, instead of thew
(lowercase) motion, I can use theW
(uppercase) motion.With native Vim, if I have this:
Where
|
is my cursor, if I press diw, I will end up with:However, if
vim-styled-components
is enabled:If I hit diw, I get:
Looks like this plugin is messing with the definition of what is a word. Now
-
and.
are not word delimiters anymore.I get that CSS properties uses
kebab-case
and this change could make sense when I'm inside a styled block, however this behavior is observed in any*{j,t}sx?
file.I would argue that even changing this behavior only within styled blocks is not desirable, because it is fundamentally changed one of the most fundamental concepts of Vim and I couldn't find a way to disable this.