文本编辑器的使用

vi编辑器

(1)打开文件:在服务器,自己的目录下面,可以运行命令

vi test.sh 
  • 点击“i”进入编辑
  • 点击“Esc”退出编辑
  • 点击“:wq”保存并退出文件,其中w代表write(写入),q代表quit(退出)
(2)删除小技巧:在非编辑模式下
  • ‘dd’ 删除光标所在行
  • ‘d12’删除光标所在以下12行
  • ‘x’ 删除光标所在位置的一个字符
(3)其它详细介绍,请参考 鸟哥的Linux私房菜,或者百度一下


emacs编辑器

(1)打开文件:在服务器,自己的目录下面,可以运行命令

emacs run.sh 

将会出来图形界面,如下图所示:

编辑之后:

  • 保存:Ctrl+x+s
  • 退出:Ctrl+x+c
(2)另外,emacs可以很方便的把C++ code自动对齐,这一点对于写code来说非常有用:
  • 比如,这个code对齐就很槽糕
  • 首先,选择整个文本文件:
  • 然后,选择对齐
  • 最后,就得到了对齐后的文件:

(3)其它快捷方式,可以参考 Emacs手册

VS code 教程

返回上一页

-- HangYin - 2018-10-14

Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng emacs_1.PNG r1 manage 76.0 K 2018-10-14 - 16:34 HangYin  
PNGpng emacs_2.PNG r1 manage 144.5 K 2018-10-14 - 16:48 HangYin  
PNGpng emacs_3.PNG r1 manage 136.1 K 2018-10-14 - 16:48 HangYin  
PNGpng emacs_4.PNG r1 manage 215.1 K 2018-10-14 - 16:48 HangYin  
PNGpng emacs_5.PNG r1 manage 153.7 K 2018-10-14 - 16:48 HangYin  
PNGpng i.PNG r1 manage 0.9 K 2018-10-14 - 15:59 HangYin  
PNGpng vi_esc.PNG r1 manage 3.9 K 2018-10-14 - 15:59 HangYin  
PNGpng vi_wq.PNG r1 manage 2.3 K 2018-10-14 - 15:59 HangYin  
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r3 - 2021-07-05 - HangYin
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback