zoukankan      html  css  js  c++  java
  • 如何用Vim提高开发效率

                    <section class="" style="display:none;" data-tools="新媒体管家" data-label="powered by xmt.cn"></section><blockquote><p><span style="color: rgb(0, 82, 255);font-size: 14px;"><strong>来自:随手记技术团队(微信号:sui-tech)</strong></span></p></blockquote><p><br></p><p style="margin-bottom: 16px;padding-bottom: 0.3em;font-weight: bold;font-size: 1.75em;white-space: normal;box-sizing: border-box;line-height: 1.225;border-bottom: 1px solid rgb(238, 238, 238);color: rgb(51, 51, 51);">背景</p><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">虽然笔者是Android开发工程师,但也接触过各种IDE(不限于Android开发)。不同的IDE往往都有不同的快捷键,我们总不能对每种IDE都进行配置吧。实际上,现在大部分IDE都能通过插件的形式支持Vim了。所以,只需要掌握Vim的基本使用,在支持Vim的IDE都能很快上手,熟悉的操作,熟悉的手感。</p><h2 style="margin-top: 1em;margin-bottom: 16px;padding-bottom: 0.3em;font-weight: bold;font-size: 1.75em;white-space: normal;box-sizing: border-box;line-height: 1.225;border-bottom: 1px solid rgb(238, 238, 238);color: rgb(51, 51, 51);">Vim模式</h2><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">Vim可分为3种模式,分别是Normal模式、Visual模式和Insert模式。以下的基本操作都是在Normal模式进行。三种模式的区别这里不详解了,Bing搜索有很多相关的基础教程。<br style="box-sizing: border-box;">三者的关系可用下图简单描述<br style="box-sizing: border-box;"></p><p style="white-space: normal;"><img data-s="300,640" data-type="jpeg" data-src="https://mmbiz.qpic.cn/mmbiz_jpg/k2yQfhlbU3rugw073ibYs1LelJibkQMzkQRndvGRjM3WNCrJUlrSCIsmEC8rPic2OTfwblj2e6AJn8TG8lyBSTLXA/?wx_fmt=jpeg" class="" data-ratio="1.0952380952380953" data-w="546" style=" 556px !important; height: auto !important; visibility: visible !important;" _width="556px" src="https://mmbiz.qpic.cn/mmbiz_jpg/k2yQfhlbU3rugw073ibYs1LelJibkQMzkQRndvGRjM3WNCrJUlrSCIsmEC8rPic2OTfwblj2e6AJn8TG8lyBSTLXA/?wx_fmt=jpeg&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1&amp;wx_co=1" crossorigin="anonymous" data-fail="0"></p><h2 style="margin-top: 1em;margin-bottom: 16px;padding-bottom: 0.3em;font-weight: bold;font-size: 1.75em;white-space: normal;box-sizing: border-box;line-height: 1.225;border-bottom: 1px solid rgb(238, 238, 238);color: rgb(51, 51, 51);">基本操作</h2><h3 style="margin-top: 1em;margin-bottom: 16px;font-weight: bold;font-size: 1.5em;white-space: normal;box-sizing: border-box;line-height: 1.43;color: rgb(51, 51, 51);">光标移动</h3><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">注意区分字母大小写</p><h4 style="margin-top: 1em;margin-bottom: 16px;font-weight: bold;font-size: 1.25em;white-space: normal;box-sizing: border-box;line-height: 1.4;color: rgb(51, 51, 51);">上下左右</h4><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">直接看表格,简单易懂。一开始会有点别扭,但是熟悉之后你会爱上他的。</p><table width="736"><thead style="box-sizing: border-box;"><tr style="box-sizing: border-box;border-top: 1px solid rgb(204, 204, 204);"><th style="padding: 6px 13px;border-top- 1px;border-top-color: rgb(221, 221, 221);box-sizing: border-box;"><br></th><th style="padding: 6px 13px;border-top- 1px;border-top-color: rgb(221, 221, 221);box-sizing: border-box;">k(上)</th><th style="padding: 6px 13px;border-top- 1px;border-top-color: rgb(221, 221, 221);box-sizing: border-box;"><br></th></tr></thead><tbody style="box-sizing: border-box;"><tr style="box-sizing: border-box;border-top: 1px solid rgb(204, 204, 204);"><td style="padding: 6px 13px;box-sizing: border-box;">h (左)</td><td style="padding: 6px 13px;box-sizing: border-box;"><br></td><td style="padding: 6px 13px;box-sizing: border-box;">l (右)</td></tr><tr style="box-sizing: border-box;background-color: rgb(248, 248, 248);border-top: 1px solid rgb(204, 204, 204);"><td style="padding: 6px 13px;box-sizing: border-box;"><br></td><td style="padding: 6px 13px;box-sizing: border-box;">j (下)</td><td style="padding: 6px 13px;box-sizing: border-box;"><br></td></tr></tbody></table><p style="white-space: normal;"><img data-type="gif" data-src="https://mmbiz.qpic.cn/mmbiz_gif/k2yQfhlbU3rugw073ibYs1LelJibkQMzkQ1Jp7fg8v0srbVomrHIU8QrvGIqqKoSjicuLCWMeibxPIOLev7hqnVg7w/?wx_fmt=gif" class=" __bg_gif" data-ratio="0.5625" data-w="1280" style=" 556px !important; height: auto !important; visibility: visible !important;" _width="556px" src="https://mmbiz.qpic.cn/mmbiz_gif/k2yQfhlbU3rugw073ibYs1LelJibkQMzkQ1Jp7fg8v0srbVomrHIU8QrvGIqqKoSjicuLCWMeibxPIOLev7hqnVg7w/?wx_fmt=gif&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1" data-order="0" data-fail="0"></p><h4 style="margin-top: 1em;margin-bottom: 16px;font-weight: bold;font-size: 1.25em;white-space: normal;box-sizing: border-box;line-height: 1.4;color: rgb(51, 51, 51);">单词间定位</h4><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">键位</p><blockquote style="margin-bottom: 16px;padding-right: 15px;padding-left: 15px;border-left- 4px;border-left-color: rgb(221, 221, 221);white-space: normal;box-sizing: border-box;color: rgb(119, 119, 119);"><p style="box-sizing: border-box;">如果是大写,则单词允许包含标点<br style="box-sizing: border-box;">w(向前跳到单词词首)<br style="box-sizing: border-box;">e(向前跳到单词词尾)<br style="box-sizing: border-box;">b(向后跳到单词词首)</p></blockquote><p style="white-space: normal;"><img data-type="gif" data-src="https://mmbiz.qpic.cn/mmbiz_gif/k2yQfhlbU3rugw073ibYs1LelJibkQMzkQicicA2FACM90pTbdtJkGux12B5SHfVGGQamPIqK77XMhlY0ictzNESGQg/?wx_fmt=gif" class=" __bg_gif" data-ratio="0.5625" data-w="1280" style=" 556px !important; height: auto !important; visibility: visible !important;" _width="556px" src="https://mmbiz.qpic.cn/mmbiz_gif/k2yQfhlbU3rugw073ibYs1LelJibkQMzkQicicA2FACM90pTbdtJkGux12B5SHfVGGQamPIqK77XMhlY0ictzNESGQg/?wx_fmt=gif&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1" data-order="1" data-fail="0"></p><h4 style="margin-top: 1em;margin-bottom: 16px;font-weight: bold;font-size: 1.25em;white-space: normal;box-sizing: border-box;line-height: 1.4;color: rgb(51, 51, 51);">行内定位</h4><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">键位</p><blockquote style="margin-bottom: 16px;padding-right: 15px;padding-left: 15px;border-left- 4px;border-left-color: rgb(221, 221, 221);white-space: normal;box-sizing: border-box;color: rgb(119, 119, 119);"><p style="box-sizing: border-box;">$(定位到行尾)<br style="box-sizing: border-box;">0(定位到行首)<br style="box-sizing: border-box;">^(定位到行首,忽略空格)<br style="box-sizing: border-box;">f<ch style="box-sizing: border-box;">&nbsp;正向搜索ch字符,ch如果是字母则区分大小写<br style="box-sizing: border-box;">F<ch style="box-sizing: border-box;">&nbsp;反向搜索ch字符,ch如果是字母则区分大小写</ch></ch></p></blockquote><p style="white-space: normal;"><img data-type="gif" data-src="https://mmbiz.qpic.cn/mmbiz_gif/k2yQfhlbU3rugw073ibYs1LelJibkQMzkQrgKUNN7xTFmYmWVPdTqia0yDVRp4RG95icjWNMU0aVYIa7qUeMAckBBQ/?wx_fmt=gif" class=" __bg_gif" data-ratio="0.5625" data-w="1280" style=" 556px !important; height: auto !important; visibility: visible !important;" _width="556px" src="https://mmbiz.qpic.cn/mmbiz_gif/k2yQfhlbU3rugw073ibYs1LelJibkQMzkQrgKUNN7xTFmYmWVPdTqia0yDVRp4RG95icjWNMU0aVYIa7qUeMAckBBQ/?wx_fmt=gif&amp;tp=webp&amp;wxfrom=5&amp;wx_lazy=1" data-order="2" data-fail="0"></p><h4 style="margin-top: 1em;margin-bottom: 16px;font-weight: bold;font-size: 1.25em;white-space: normal;box-sizing: border-box;line-height: 1.4;color: rgb(51, 51, 51);">块定位</h4><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">键位</p><blockquote style="margin-bottom: 16px;padding-right: 15px;padding-left: 15px;border-left- 4px;border-left-color: rgb(221, 221, 221);white-space: normal;box-sizing: border-box;color: rgb(119, 119, 119);"><p style="box-sizing: border-box;">{(跳到上一个代码块)<br style="box-sizing: border-box;">}(跳到下一个代码块)<br style="box-sizing: border-box;">%(定位到另一个匹配的括号)</p></blockquote><p style="white-space: normal;"><img data-type="gif" data-src="https://mmbiz.qpic.cn/mmbiz_gif/k2yQfhlbU3rugw073ibYs1LelJibkQMzkQfD1gonWExx5JNoqdVBJ4UxEyIQp8goXpQ0y5GH0GsRREw7BbxDHibnQ/?wx_fmt=gif" class="img_loading __bg_gif" data-ratio="0.5625" data-w="1280" _width="677px" src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" style=" 677px !important; height: 380.813px !important;" data-order="3"></p><h4 style="margin-top: 1em;margin-bottom: 16px;font-weight: bold;font-size: 1.25em;white-space: normal;box-sizing: border-box;line-height: 1.4;color: rgb(51, 51, 51);">页面定位</h4><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">键位</p><blockquote style="margin-bottom: 16px;padding-right: 15px;padding-left: 15px;border-left- 4px;border-left-color: rgb(221, 221, 221);white-space: normal;box-sizing: border-box;color: rgb(119, 119, 119);"><p style="margin-bottom: 16px;box-sizing: border-box;">gg(定位到页面的第一行)<br style="box-sizing: border-box;">G(定位到页面的最后一行)<br style="box-sizing: border-box;">H(定位到当前页面的顶部,High首字母大写)<br style="box-sizing: border-box;">M(定位到当前页面的中部,Middle首字母大写)<br style="box-sizing: border-box;">L(定位到当前页面的底部,Low首字母大写)</p><p style="margin-bottom: 16px;box-sizing: border-box;">nG或ngg(定位到指定行,n表示行数,需大于0,<br style="box-sizing: border-box;">如果大于最大行数,则会直接跳转到页面最后一行)</p><p style="box-sizing: border-box;">m&lt;a&gt;和'&lt;a&gt;(这是一对很强大的命令,可标记一个位置,然后在同页面快速定位到该标志。m表示mark,a是一个字母,可以是26字母的其中一个,'是单引号,后面跟上前面标记的字母)</p></blockquote><p style="white-space: normal;"><img data-type="gif" data-src="https://mmbiz.qpic.cn/mmbiz_gif/k2yQfhlbU3rugw073ibYs1LelJibkQMzkQhMjiaTvIET8ia5uD65RCUCtpT64Kdh6Ym1uLkvo4w88rQVN1tBO2xYvA/?wx_fmt=gif" class="img_loading __bg_gif" data-ratio="0.5625" data-w="1280" style=" 556px !important; height: 312.75px !important;" _width="556px" src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" data-order="4"></p><h3 style="margin-top: 1em;margin-bottom: 16px;font-weight: bold;font-size: 1.5em;white-space: normal;box-sizing: border-box;line-height: 1.43;color: rgb(51, 51, 51);">屏幕滚动</h3><h4 style="margin-top: 1em;margin-bottom: 16px;font-weight: bold;font-size: 1.25em;white-space: normal;box-sizing: border-box;line-height: 1.4;color: rgb(51, 51, 51);">整屏滚动</h4><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">键位</p><blockquote style="margin-bottom: 16px;padding-right: 15px;padding-left: 15px;border-left- 4px;border-left-color: rgb(221, 221, 221);white-space: normal;box-sizing: border-box;color: rgb(119, 119, 119);"><p style="box-sizing: border-box;">Ctrl + f (向下滚动一屏内容,Foward首字母小写)<br style="box-sizing: border-box;">Ctrl + b (向上滚动一屏内容,Backward首字母小写)</p></blockquote><p style="white-space: normal;"><img data-type="gif" data-src="https://mmbiz.qpic.cn/mmbiz_gif/k2yQfhlbU3rugw073ibYs1LelJibkQMzkQRSqlkb1hmI2fIcKibsh4CTdu1VVUVIokeMyHOPQuTo8gVup0efO9wZQ/?wx_fmt=gif" class="img_loading __bg_gif" data-ratio="0.5625" data-w="1280" style=" 556px !important; height: 312.75px !important;" _width="556px" src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" data-order="5"></p><h4 style="margin-top: 1em;margin-bottom: 16px;font-weight: bold;font-size: 1.25em;white-space: normal;box-sizing: border-box;line-height: 1.4;color: rgb(51, 51, 51);">半屏滚动</h4><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">键位</p><blockquote style="margin-bottom: 16px;padding-right: 15px;padding-left: 15px;border-left- 4px;border-left-color: rgb(221, 221, 221);white-space: normal;box-sizing: border-box;color: rgb(119, 119, 119);"><p style="box-sizing: border-box;">Ctrl + d(向下滚动半屏内容,Down首字母小写)<br style="box-sizing: border-box;">Ctrl + u(向上滚动半屏内容,Up首字母小写)</p></blockquote><p style="white-space: normal;"><img data-type="gif" data-src="https://mmbiz.qpic.cn/mmbiz_gif/k2yQfhlbU3rugw073ibYs1LelJibkQMzkQYjHAgvXmNHjm0HnqRXIOpdpxT5j11bAF7vs417PKYcdPjQBZjgZDnA/?wx_fmt=gif" class="img_loading __bg_gif" data-ratio="0.5625" data-w="1280" style=" 556px !important; height: 312.75px !important;" _width="556px" src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" data-order="6"></p><h4 style="margin-top: 1em;margin-bottom: 16px;font-weight: bold;font-size: 1.25em;white-space: normal;box-sizing: border-box;line-height: 1.4;color: rgb(51, 51, 51);">行滚动</h4><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">键位</p><blockquote style="margin-bottom: 16px;padding-right: 15px;padding-left: 15px;border-left- 4px;border-left-color: rgb(221, 221, 221);white-space: normal;box-sizing: border-box;color: rgb(119, 119, 119);"><p style="box-sizing: border-box;">Ctrl + e(向下滚动一行内容)&nbsp;<br style="box-sizing: border-box;">Ctrl + y(向上滚动一行内容)</p></blockquote><p style="white-space: normal;"><img data-type="gif" data-src="https://mmbiz.qpic.cn/mmbiz_gif/k2yQfhlbU3rugw073ibYs1LelJibkQMzkQVck8BEcPP8FVlr1247yoC7jhGib1Dd1YmJrbyib39lyXRXLKJe8CGwkQ/?wx_fmt=gif" class="img_loading __bg_gif" data-ratio="0.5625" data-w="1280" style=" 556px !important; height: 312.75px !important;" _width="556px" src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" data-order="7"></p><h3 style="margin-top: 1em;margin-bottom: 16px;font-weight: bold;font-size: 1.5em;white-space: normal;box-sizing: border-box;line-height: 1.43;color: rgb(51, 51, 51);">编辑模式</h3><h4 style="margin-top: 1em;margin-bottom: 16px;font-weight: bold;font-size: 1.25em;white-space: normal;box-sizing: border-box;line-height: 1.4;color: rgb(51, 51, 51);">插入</h4><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">键位</p><blockquote style="margin-bottom: 16px;padding-right: 15px;padding-left: 15px;border-left- 4px;border-left-color: rgb(221, 221, 221);white-space: normal;box-sizing: border-box;color: rgb(119, 119, 119);"><p style="box-sizing: border-box;">i(在光标处插入,insert首字母小写)<br style="box-sizing: border-box;">I(在行首插入,insert首字母大写)<br style="box-sizing: border-box;">a(在光标处后一个字符插入,append首字母小写)<br style="box-sizing: border-box;">A(在行尾插入,append首字母大写)<br style="box-sizing: border-box;">o(在上一行插入)<br style="box-sizing: border-box;">O(在下一行插入)<br style="box-sizing: border-box;">cc/S(清除当前行并进入插入模式)<br style="box-sizing: border-box;">s(清除当前字符并进入插入模式)</p></blockquote><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">恩,这个很简单,就不贴图了。</p><h4 style="margin-top: 1em;margin-bottom: 16px;font-weight: bold;font-size: 1.25em;white-space: normal;box-sizing: border-box;line-height: 1.4;color: rgb(51, 51, 51);">查找</h4><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">键位</p><blockquote style="margin-bottom: 16px;padding-right: 15px;padding-left: 15px;border-left- 4px;border-left-color: rgb(221, 221, 221);white-space: normal;box-sizing: border-box;color: rgb(119, 119, 119);"><p style="box-sizing: border-box;">/pattern(正向查找)<br style="box-sizing: border-box;">?pattern(反向查找)<br style="box-sizing: border-box;">n(查找下一个)<br style="box-sizing: border-box;">N(查找上一个)<br style="box-sizing: border-box;">*(当光标定位在某个单词时,查找下一个该单词)<br style="box-sizing: border-box;">#(当光标定位在某个单词时,查找上一个该单词)</p></blockquote><p style="white-space: normal;"><img data-type="gif" data-src="https://mmbiz.qpic.cn/mmbiz_gif/k2yQfhlbU3rugw073ibYs1LelJibkQMzkQuVrT7GciaKAKvX8fbySjIv2WyiboXqB9X1ic0LTI4PoI3V1iaC2cnETeTw/?wx_fmt=gif" class="img_loading __bg_gif" data-ratio="0.5625" data-w="1280" _width="677px" src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" style=" 677px !important; height: 380.813px !important;" data-order="8"></p><h4 style="margin-top: 1em;margin-bottom: 16px;font-weight: bold;font-size: 1.25em;white-space: normal;box-sizing: border-box;line-height: 1.4;color: rgb(51, 51, 51);">替换</h4><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">键位</p><blockquote style="margin-bottom: 16px;padding-right: 15px;padding-left: 15px;border-left- 4px;border-left-color: rgb(221, 221, 221);white-space: normal;box-sizing: border-box;color: rgb(119, 119, 119);"><p style="box-sizing: border-box;">:%s/old/new/g(全局替换old为new)<br style="box-sizing: border-box;">:s/old/new/g(替换当前行old为new)</p></blockquote><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);"><strong style="box-sizing: border-box;">注意,替换操作仅在当前页面生效,使用该替换操作需谨慎。<br style="box-sizing: border-box;">建议使用IDE自带的重命名操作,可以将对应的引用也一起重命名!</strong></p><p style="white-space: normal;"><img data-type="gif" data-src="https://mmbiz.qpic.cn/mmbiz_gif/k2yQfhlbU3rugw073ibYs1LelJibkQMzkQzRwkVQ2NlulJqmeMPOAuwOjWsuT1Q2LCBlusTVLz755gPG2Klhce7Q/?wx_fmt=gif" class="img_loading __bg_gif" data-ratio="0.5625" data-w="1280" _width="677px" src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" style=" 677px !important; height: 380.813px !important;" data-order="9"></p><h4 style="margin-top: 1em;margin-bottom: 16px;font-weight: bold;font-size: 1.25em;white-space: normal;box-sizing: border-box;line-height: 1.4;color: rgb(51, 51, 51);">剪切、复制、粘贴</h4><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">键位</p><blockquote style="margin-bottom: 16px;padding-right: 15px;padding-left: 15px;border-left- 4px;border-left-color: rgb(221, 221, 221);white-space: normal;box-sizing: border-box;color: rgb(119, 119, 119);"><p style="box-sizing: border-box;">dd(剪切当前行的内容)<br style="box-sizing: border-box;">D(剪切光标后到行尾的内容)<br style="box-sizing: border-box;">yy/Y(复制当前行的内容)<br style="box-sizing: border-box;">p(粘贴到光标后)<br style="box-sizing: border-box;">P(粘贴到光标前)</p></blockquote><p style="white-space: normal;"><img data-type="gif" data-src="https://mmbiz.qpic.cn/mmbiz_gif/k2yQfhlbU3rugw073ibYs1LelJibkQMzkQAYR77kCKdKPIBFcyQ0QtZaoAQHr1R3InrLyiboovxGDJ5sE2LHvwREA/?wx_fmt=gif" class="img_loading __bg_gif" data-ratio="0.5625" data-w="1280" _width="677px" src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" style=" 677px !important; height: 380.813px !important;" data-order="10"></p><h4 style="margin-top: 1em;margin-bottom: 16px;font-weight: bold;font-size: 1.25em;white-space: normal;box-sizing: border-box;line-height: 1.4;color: rgb(51, 51, 51);">撤销</h4><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">键位</p><blockquote style="margin-bottom: 16px;padding-right: 15px;padding-left: 15px;border-left- 4px;border-left-color: rgb(221, 221, 221);white-space: normal;box-sizing: border-box;color: rgb(119, 119, 119);"><p style="box-sizing: border-box;">u(撤销上一步,IDE一般都是Cmd + Z)</p></blockquote><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">这个简单,也不贴图了。</p><h2 style="margin-top: 1em;margin-bottom: 16px;padding-bottom: 0.3em;font-weight: bold;font-size: 1.75em;white-space: normal;box-sizing: border-box;line-height: 1.225;border-bottom: 1px solid rgb(238, 238, 238);color: rgb(51, 51, 51);">组合操作</h2><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">组合操作可以看作是op+i/a+scope公式的应用,解释一下这个公式,op就是我们前面提到的插入(c)、剪切(d)、复制(y)以及还未提到的选择(v),i表示scope范围内,a表示包含scope标签,scope就是操作的范围了。这样讲比较抽象,下面举例几个常用组合。</p><h3 style="margin-top: 1em;margin-bottom: 16px;font-weight: bold;font-size: 1.5em;white-space: normal;box-sizing: border-box;line-height: 1.43;color: rgb(51, 51, 51);">选择文本</h3><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">键位</p><blockquote style="margin-bottom: 16px;padding-right: 15px;padding-left: 15px;border-left- 4px;border-left-color: rgb(221, 221, 221);white-space: normal;box-sizing: border-box;color: rgb(119, 119, 119);"><p style="box-sizing: border-box;">以下如果将i换成a,则会将符号也包含进去<br style="box-sizing: border-box;">vib(选中小括号内的内容)<br style="box-sizing: border-box;">viB(选中大括号内的内容)<br style="box-sizing: border-box;">vi"(选中双引号内的内容)<br style="box-sizing: border-box;">vi'(选中单引号内的内容)<br style="box-sizing: border-box;">vi&lt;(选中尖括号内的内容)</p></blockquote><p style="white-space: normal;"><img data-type="gif" data-src="https://mmbiz.qpic.cn/mmbiz_gif/k2yQfhlbU3rugw073ibYs1LelJibkQMzkQLiakFxU9XQk8y600nPoyuSRrw2Mp6HOfTCYR3sQnSmr2wlmdA8z4TSQ/?wx_fmt=gif" class="img_loading __bg_gif" data-ratio="0.5625" data-w="1280" style=" 556px !important; height: 312.75px !important;" _width="556px" src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" data-order="11"></p><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">同理,将选择操作(v)替换成插入(c)、剪切(d)或者复制(y),也能实现类似的效果。</p><h2 style="margin-top: 1em;margin-bottom: 16px;padding-bottom: 0.3em;font-weight: bold;font-size: 1.75em;white-space: normal;box-sizing: border-box;line-height: 1.225;border-bottom: 1px solid rgb(238, 238, 238);color: rgb(51, 51, 51);">神奇操作</h2><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">IDE支持跳转到变量(方法)的定义处或者调用处,Vim也支持,而且也很方便。只需要将光标定位到方法名,然后输入<code style="box-sizing: border-box;">gd</code>即可。配合Android Studio的Navigate Back,可以十分方便地查看方法的调用。<br style="box-sizing: border-box;"></p><p style="white-space: normal;"><img data-type="gif" data-src="https://mmbiz.qpic.cn/mmbiz_gif/k2yQfhlbU3rugw073ibYs1LelJibkQMzkQiaPBGDJHKG1vMAorkY2SibTlznp5OrvY4S7MIdElE3ryXiaDTZ5Y1eEkQ/?wx_fmt=gif" class="img_loading __bg_gif" data-ratio="0.5625" data-w="1280" style=" 556px !important; height: 312.75px !important;" _width="556px" src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" data-order="12"></p><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">Navigate Back设置<br style="box-sizing: border-box;"></p><p style="white-space: normal;"><img data-s="300,640" data-type="jpeg" data-src="https://mmbiz.qpic.cn/mmbiz_jpg/k2yQfhlbU3rugw073ibYs1LelJibkQMzkQrmPWmM5QnCIguX6A3YAJ5yKq2UPs7bTWdLQ86Fj8ibG7XnRW43Zb3bw/?wx_fmt=jpeg" class="img_loading" data-ratio="0.1527777777777778" data-w="720" style=" 556px !important; height: 84.9444px !important;" _width="556px" src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" crossorigin="anonymous"></p><h2 style="margin-top: 1em;margin-bottom: 16px;padding-bottom: 0.3em;font-weight: bold;font-size: 1.75em;white-space: normal;box-sizing: border-box;line-height: 1.225;border-bottom: 1px solid rgb(238, 238, 238);color: rgb(51, 51, 51);">碎语</h2><p style="margin-bottom: 16px;white-space: normal;box-sizing: border-box;color: rgb(51, 51, 51);">当掌握了Vim,以后如果使用了新的IDE或者开发环境,只要支持Vim,我们就能很快的熟悉开发环境。当然,很多IDE提供了更完善的快捷键,笔者的观点是,Vim和IDE配合着使用,互补缺点。</p><h2 style="margin-top: 1em;margin-bottom: 16px;padding-bottom: 0.3em;font-weight: bold;font-size: 1.75em;white-space: normal;box-sizing: border-box;line-height: 1.225;border-bottom: 1px solid rgb(238, 238, 238);color: rgb(51, 51, 51);">参考链接</h2><ul class="list-paddingleft-2" style=""><li><p>https://jasonliao.me/posts/2016-08-09-you-dont-know-vim.html</p></li><li><p>https://vim.rtorr.com/lang/zh_cn/</p></li></ul><p><br></p><p style="max- 100%;min-height: 1em;color: rgb(62, 62, 62);"><span style="max- 100%;font-size: 14px;box-sizing: border-box !important;word-wrap: break-word !important;"></span></p><hr><p style="max- 100%;min-height: 1em;color: rgb(62, 62, 62);"><span style="max- 100%;font-size: 14px;box-sizing: border-box !important;word-wrap: break-word !important;">●本文编号408,以后想阅读这篇文章直接输入<span style="max- 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max- 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max- 100%;box-sizing: border-box !important;word-wrap: break-word !important;">408</span></span></span>即可</span><br style="max- 100%;box-sizing: border-box !important;word-wrap: break-word !important;"></p><p style="max- 100%;min-height: 1em;color: rgb(62, 62, 62);"><span style="max- 100%;font-size: 14px;box-sizing: border-box !important;word-wrap: break-word !important;">●输入m获取到文章目录</span></p><section style="max- 100%;box-sizing: border-box;color: rgb(62, 62, 62);"><section class="" style="max- 100%;box-sizing: border-box;word-wrap: break-word !important;"><section class="" style="margin-top: 10px;margin-bottom: 10px;max- 100%;box-sizing: border-box;text-align: center;word-wrap: break-word !important;"><section class="" style="padding-right: 1em;padding-left: 1em;display: inline-block;max- 100%;box-sizing: border-box;word-wrap: break-word !important;"><span class="" style="padding: 0.3em 0.5em;max- 100%;box-sizing: border-box;display: inline-block;border-radius: 0.5em;font-size: 14.08px;color: rgb(255, 255, 255);background-color: rgb(249, 110, 87);word-wrap: break-word !important;"><section style="max- 100%;box-sizing: border-box;word-wrap: break-word !important;"><span style="max- 100%;font-size: 16px;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max- 100%;box-sizing: border-box !important;word-wrap: break-word !important;">推荐↓↓↓</strong></span></section></span></section><section class="" style="margin-top: -1em;padding: 20px 10px 10px;max- 100%;box-sizing: border-box;border- 1px;border-style: solid;border-color: rgb(192, 200, 209);background-color: rgb(239, 239, 239);word-wrap: break-word !important;"><section class="" style="max- 100%;box-sizing: border-box;word-wrap: break-word !important;"><section class="" style="max- 100%;box-sizing: border-box;word-wrap: break-word !important;"><section class="" style="max- 100%;box-sizing: border-box;text-align: left;word-wrap: break-word !important;"><p style="max- 100%;box-sizing: border-box;min-height: 1em;font-family: 微软雅黑;text-align: center;word-wrap: break-word !important;"><img class="img_loading" data-ratio="1" data-s="300,640" data-src="http://mmbiz.qpic.cn/mmbiz_jpg/NVvB3l3e9aGibFVibyhQI2g6JBZO1syjD69AKEBLtomeOCd9wauvOKkyPHJ5XXicmGISk95qIcefufXQnQ0EicxIYA/?wx_fmt=jpeg" data-type="jpeg" data-w="200" style="color: rgb(62, 62, 62); font-family: 微软雅黑; font-size: 13px; text-align: center; white-space: normal; background-color: rgb(255, 255, 255); box-sizing: border-box !important; overflow-wrap: break-word !important; visibility: visible !important;  200px !important; height: 200px !important;" width="auto" _width="auto" src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==" crossorigin="anonymous"></p><p style="max- 100%;box-sizing: border-box;min-height: 1em;font-family: 微软雅黑;text-align: center;word-wrap: break-word !important;"><span style="max- 100%;color: rgb(64, 118, 0);box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max- 100%;box-sizing: border-box !important;word-wrap: break-word !important;">C/C++编程</strong></span></p></section></section></section></section></section></section></section><p style="max- 100%;min-height: 1em;color: rgb(62, 62, 62);font-size: 16px;white-space: normal;background-color: rgb(255, 255, 255);line-height: 25.6px;widows: 1;font-family: 微软雅黑;text-align: center;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max- 100%;line-height: 25.6px;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max- 100%;font-size: 14px;box-sizing: border-box !important;word-wrap: break-word !important;"></span></strong><strong style="max- 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max- 100%;font-size: 14px;box-sizing: border-box !important;word-wrap: break-word !important;">更多推荐</span></strong><strong style="max- 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max- 100%;font-size: 14px;box-sizing: border-box !important;word-wrap: break-word !important;">《</span></strong><a href="https://mp.weixin.qq.com/s?__biz=MzIxNjA5MTM2MA==&amp;mid=2652433904&amp;idx=2&amp;sn=71bb42696ab0b9e47bb60d5750022151&amp;chksm=8c62127fbb159b69f0838c9f47786f0ef615cd0f918ded865361f44b5d8ddde122f46f5e5f34&amp;scene=21#wechat_redirect" target="_blank" style="color: rgb(69, 154, 233);outline: 0px;max- 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max- 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max- 100%;color: rgb(255, 169, 0);box-sizing: border-box !important;word-wrap: break-word !important;">18个技术类公众微信</span></strong></a><span style="max- 100%;font-size: 14px;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max- 100%;box-sizing: border-box !important;word-wrap: break-word !important;"><span style="max- 100%;font-size: 16px;box-sizing: border-box !important;word-wrap: break-word !important;">》</span></strong></span><span style="max- 100%;line-height: 25.6px;white-space: pre-wrap;box-sizing: border-box !important;word-wrap: break-word !important;"><strong style="max- 100%;box-sizing: border-box !important;word-wrap: break-word !important;"></strong></span></p><p style="max- 100%;min-height: 1em;color: rgb(62, 62, 62);"><span style="max- 100%;font-size: 14px;color: rgb(136, 136, 136);box-sizing: border-box !important;word-wrap: break-word !important;">涵盖:程序人生、算法与数据结构、黑客技术与网络安全、大数据技术、前端开发、Java、Python、Web开发、安卓开发、iOS开发、C/C++、.NET、Linux、数据库、运维等。</span></p>
                </div>
  • 相关阅读:
    Django组件-cookie与session
    Js获取标签高度
    js动态添加事件
    div 显示与隐藏
    JS字符串截取
    网页事件
    js_event.keycode值大全
    DOS删除服务
    判断字符串的编码
    《把时间当作朋友》读书笔记(二)-- 困境
  • 原文地址:https://www.cnblogs.com/jpfss/p/10812565.html
Copyright © 2011-2022 走看看