如何删除Emacs中的当前行? [英] How can I delete the current line in Emacs?
本文介绍了如何删除Emacs中的当前行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
与vi的 dd 相当的emacs是什么?我想删除当前行。尝试 CTRL + k ,但只会从当前位置删除。
解决方案
Ca#转到行首开始
Ck#当前点
还有
CS-backspace#Ctrl-Shift-Backspace
它调用 Mx kill-whole-line
。
如果你想设置一个不同的全局键绑定,你可以把它放在〜/ .emacs中:
$ b $ (全局设置密钥\C-cd'kill-whole-line)#将`Cc d`设置为'Mx kill-whole-line`
如果要删除多行全部,可以在命令前加一个数字:
Cu 5 CS-backspace#删除5行全部
M-5 CS -backspace#删除5条全行
Cu CS-backspace#删除4条全行。没有数字的铜默认为4
Cu -5 CS-backspace#删除以前的5条全线
M - 5 CS-backspace#删除以前的5条全线
有时我还会发现 Cx z
帮助:
CS-backspace#delete 1整行
Cx z#重复上次命令
z#再次重复最后一个命令。
#按需要按z次数。
#任何其他键正常运行,并结束重复命令。
What is the emacs equivalent of vi's dd? I want to delete the current line. Tried CTRL + k but it only deletes from current position.
解决方案
C-a # Go to beginning of line
C-k # Kill line from current point
There is also
C-S-backspace # Ctrl-Shift-Backspace
which invokes M-x kill-whole-line
.
If you'd like to set a different global key binding, you'd put this in ~/.emacs:
(global-set-key "\C-cd" 'kill-whole-line) # Sets `C-c d` to `M-x kill-whole-line`
If you want to delete a number of whole lines, you can prefix the command with a number:
C-u 5 C-S-backspace # deletes 5 whole lines
M-5 C-S-backspace # deletes 5 whole lines
C-u C-S-backspace # delete 4 whole lines. C-u without a number defaults to 4
C-u -5 C-S-backspace # deletes previous 5 whole lines
M--5 C-S-backspace # deletes previous 5 whole lines
Sometimes I also find C-x z
helpful:
C-S-backspace # delete 1 whole line
C-x z # repeat last command
z # repeat last command again.
# Press z as many times as you wish.
# Any other key acts normally, and ends the repeat command.
这篇关于如何删除Emacs中的当前行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文