Friday, 27 January 2017

emacs 按列块删除

“emacs 里面那个默认的列编辑不会出来像 vim 里面那样的矩形选区(不过有别的方法好像可以做到),所以当你选择的时候,还是按行来选择的,你只需要关心选择的起始点和结束点之间的那个矩形就好了,你的操作只会在里面起作用。” 之前我总是视图用vim 的方式理解emacs, 发现每次ctrl + x + r + k 都不能删除列方块,原来emacs 根本不会像vim 那样标记列矩阵块!而是从开始行的开始字符到终止行的终止字符直接所有的内容都被高亮选中,但是不用担心,删除的时候实际只会删除开始字符和终止字符直接的矩形块,别的会保留! ~ 看来转换思维很重要。

kill-rectangle

try to delete the middle column
3c21 646f 6374
6874 6d6c 3e3c
2063 6861 7273
202f 3e0a 3c6d
6965 7770 6f72
2277 6964 7468
 
CommandKeyPurpose
kill-rectangle【Ctrl+x r k】Delete selected column of text.
  1. Put your cursor before “646f”.
  2. Call set-mark-command 【Ctrl+Space】.
  3. Move cursor to end of “6964”. (move down 5 lines and right 3 columns).  At this time, the screen will looks like below (unlike vim, only the middle columns to be deleted are marked)







4. Call kill-rectangle. 


No comments:

Post a Comment