Vim Treat' - '作为单词的一部分,如果后面是字母,但是'>'

发布于 2025-02-08 08:05:00 字数 410 浏览 2 评论 0 原文

有没有办法告诉VIM处理 this-is-One-word this-> - 并不是其中的一部分word(例如 dw 时)。

编辑以进行澄清:

我已经 - 设置为单词的一部分,因此在的开头 dw this-is-In-One-word 删除所有这些。但是,如果我有代码 $ logger-≫ info 并将我的光标指向logger,则点击 dw ,它包括 - 剩下的 $> info 而不是 $ - > info 我想要的。

Is there a way to tell vim to treat this-is-one-word but this-> the - isn't part of the word (when doing dw for example).

Edit for clarification:

I have - set to be part of a word, so doing dw at the start of this-is-one-word deletes all of that. However, if I have the code $logger->info and point my cursor at logger then hit dw it includes the - which leaves $>info instead of $->info which is what I want.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

活泼老夫 2025-02-15 08:05:00

不确定我正确理解您的问题, dw 仅删除字符串 this-is-is-One-word

通常,如果我想删除<代码> this-is-One-word ,我将使用 dt&lt; space&gt; 假设有一个&lt; space&gt; 之后

not sure I understand your question correctly, dw only deletes this for string this-is-one-word

in general if I want to delete this-is-one-word, I would use dt<space> assuming there is a <space> after

怂人 2025-02-15 08:05:00

阅读:HISKEYWORD 。但是我想不可能实现自己想要的东西。无论如何,至少您有一个起点:

:setlocal iskeyword+=-

注意:帮助说它是本地与缓冲区的,这就是为什么 setLocal set set 相反的原因。

例如,应将其放置在/after/ftplugin/css.vim 中,例如,这种方式 - 将仅在该特定的Filetype中成为单词的一部分。

这篇文章您可以阅读有关/ftplugin之间差异的信息/之后/ftplugin

Read on :h iskeyword. But I guess it is not possible to achieve what you want. Anyway, at least you have a start point:

:setlocal iskeyword+=-

Note: The help says it is local to buffer, that's why setlocal in opposition to set.

This should be placed at /after/ftplugin/css.vim for example, this way the character - will be part of the word only in that particular filetype.

In this post you can read about differences between /ftplugin and /after/ftplugin.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文