Emacs - 删除第一个非空白字符
我正在寻找从当前光标位置删除到第一个非空白字符的键绑定/功能
示例:
function f() {|
test();
| - 光标位置
我想删除“t”字母的所有内容
I'm looking for key binding / function which delete from current cursor position to first non blank character
example:
function f() {|
test();
| - cursor position
I want delete everything to "t" letter
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
在“c-mode”中,有 'Mx c-hungry-delete -forward',也绑定到 Cc Cd。因此,您可以在您使用的任何编程模式下创建该绑定。
或者,您可以获取包 'hungry-delete' 并使用它来覆盖删除命令删除所有空格(而不是单个空格)。
In 'c-mode' there is 'M-x c-hungry-delete-forward', which is also bound to C-c C-d. So, you can create that binding in whatever programming mode you're using.
Alternatively, you can grab the package 'hungry-delete' and use that to override the deletion commands to delete all the whitespace (as opposed to a single space).
Mz t t(根据需要替换t:)。
M-z t t (substitute t as needed :).
已经提出了很多好的选择。在 Emacs 24(目前处于预测试阶段)中,您可以将 M-- 指定为
just-one-space
或 M-SPC 来执行以下操作:你问。Lots of good options have been presented. In Emacs 24 (currently in pretest), you can specify M-- to
just-one-space
or M-SPC to do exactly what you ask.为此,我使用自定义宏:(
只需将这个小宏放入您的 .emacs 配置中)
当然,您可以根据需要重命名该宏。
因此,以下状态:
变为:
To do this, I use a custom macro :
(just put this small macro in your .emacs config)
Of course, you can rename the macro like you want.
So, the following state :
Becomes :
使用
Mx delete-blank-lines
(也绑定到Cx Co
)。从帮助文档 (
Ch k Cx Co
) 中:Use
M-x delete-blank-lines
(which is also bound toC-x C-o
).From the help-docs (
C-h k C-x C-o
):