M-m(back-to-indentation)将点移动到该行上的第一个非空白字符.我想做相反的事情:将点移动到该行上的最后一个非空格字符.我一直无法找到一个"内置"命令,而且我对ELisp不够熟悉,所以请任何帮助.
(defun my-move-end-of-line-before-whitespace ()
"Move to the last non-whitespace character in the current line."
(interactive)
(move-end-of-line nil)
(re-search-backward "^\\|[^[:space:]]"))
Run Code Online (Sandbox Code Playgroud)
通常在这种情况下,我想获得最后一个非空白字符并删除尾随空格,所以我使用这个:
M-\ runs the command delete-horizontal-space, which is an interactive
compiled Lisp function in `simple.el'.
Run Code Online (Sandbox Code Playgroud)
在极少数情况下,我想保留空白,我只使用M-b M-f( backward-word, forward-word),这通常足够接近。
| 归档时间: |
|
| 查看次数: |
2267 次 |
| 最近记录: |