Contents

1-2-3TMS观看记录3

Editors(vim)

久仰vim大名,Carrie Anne老师口中的,“你不能否认,vim是世界上最好用的编辑器” vim 是一种mode editor,当你打开vim的时候,它就处于normal mode,输入i后进入insert mode,敲击esc退出insert mode,返回normal mode 在insert mode 你会进入text buffer来输入文字,而在normal mode你将可以通过输入命令来导航进入相应的工作区 这里还有很多其他的工作区,通过键盘从normal mode来进入 * R:replace mode * v:visual mode * shift-V:visual -line * ctrl-v:visual -block * ::command line 一些normal键盘的作用 x:删除后面的一个字母, u:undo撤销 ::进入command line,just like vim command rather than shell command

  • :q:退出vim
  • :wsave the file
  • :helpshow u the help,such as :help :w :w 和w不同,他们在不同的模式下
  • :sp:将一个文件以两个窗口打开,^Wj向下切换,^Wk向上切换!https://mayue-1312060474.cos.ap-chengdu.myqcloud.com/picgo/The-missing-semester%E8%A7%82%E7%9C%8B%E8%AE%B0%E5%BD%953_image_1.png
  • :qa 关闭所有windows
  • :newtab: 打开一个新的tab

normal mode有什么用

normal mode 让vim本身就像是一个编程语言,你可以通过你的熟悉,将各种用法链接在一起形成一个应用,从而使你的editor变成最适合你的editor

  • hjkl:移动光标
  • w和b:分别是向前和向后移动一个单词
  • e:移动到下一个单词的最后一个字母
  • 0 ; $ ; ^:分别是移动到行首;行末;行第一个非空字符处
  • ^u ^d:like scroll up and down
  • G g:一个向上页面一个向下一个页面
  • L M H:移动到当前页面的低;中;高
  • f:find the first one after the present character,like fc,and capital F means back
  • t:jump to one character,but before the character.
  • o O:create a new line below or above.
  • dw de:delete the word or the end of the word.
  • ce:change the end of the word.
  • dd cc:delete the line and cc will put u in insert mode.
  • x:delete the next character
  • r:exchange the character with what u input in.
  • ^r:means redo:撤回撤销,重做
  • y means copy,yank;p for paste; yy copy the line yw copy the word,when u are in visual mode,just type the v key,and now when u move ur cursor,u will select the content.
  • **visual line mode,V:will allow u only to select lines;^v visual block,will allow u to select a block of text like rectangular在visual mode你依旧可以使用一些normal 命令来帮助你选中内容 https://mayue-1312060474.cos.ap-chengdu.myqcloud.com/picgo/The-missing-semester%E8%A7%82%E7%9C%8B%E8%AE%B0%E5%BD%953_image_2.png
  • ~: 翻转选中的大小写
  • a i,a means around,i means inside, d i [;d a (,will delete include the brackt
  • / u can search in this quickly way.
  • . dot will do the same thing u just have done.

自定义

  • 编辑~/.vimrc,来配置你的vim功能
  • 丰富的插件系统,你可以安装你需要的插件

总结

我是22年的暑假阶段接触vim,其实之前也进入过vim,只是打开之后完全不知道怎么用,当时弄了好久才退出,就一直不敢碰了。在暑假的时候,一生一芯的项目里,需要用到vim,我利用vimtutor这个工具进行了一定的学习, https://mayue-1312060474.cos.ap-chengdu.myqcloud.com/picgo/The-missing-semester%E8%A7%82%E7%9C%8B%E8%AE%B0%E5%BD%953_image_3.png 不过到最后也只是记得i插入模式可以输入,:wq退出,加个!起强制退出的作用,然后我便一直这么用了下来,说实话只会这些,vim对我而言只是一个可以打字的地方,并不能起到什么效率的提高,希望在这堂课之后我可以更多的使用vim的一些特性,来提高效率吧。

Flag Counter