使用Emacs从区域中的每一行删除第一个"x"字符

phi*_*ilg 15 emacs character line

我想删除区域中每一行的前x个字符.

是否有任何键绑定可用于不使用正则表达式?

Lin*_*cer 20

执行此操作的最佳方法是使用"矩形"命令族.例如,标记区域的开头.转到区域的末尾并将该点放在X列.运行命令kill-rectangle使用C-x r k.

当然,这不仅限于删除行首的字符.


ste*_*tew 7

如果标记位于第0列,则将该点放在第x列上并使用kill-rectange:

C-x r k runs the command kill-rectangle, which is an interactive
autoloaded Lisp function in `rect.el'.

It is bound to C-x r k.

(kill-rectangle START END &optional FILL)

Delete the region-rectangle and save it as the last killed one.

When called from a program the rectangle's corners are START and END.
You might prefer to use `delete-extract-rectangle' from a program.
Run Code Online (Sandbox Code Playgroud)