vim编辑模式、vim命令模式
vim编辑模式git
使用vim filename 进入的界面是通常模式,在这个模式下虽然咱们可以查看,复制,剪切,粘贴,可是不能编辑新的内容,如何能直接写入东西呢?这就须要进入编辑模式了,从通常模式进入编辑模式有不少个按键均可以实现,可是不一样的按键进入编辑模式是有区别的vim
vim工具还有一个命令模式,在通常模式下输入“:、/”就能够进入命令模式,在命令模式下咱们能够搜索某个字符串,也能够实现保存,替换,退出,显示行号,高亮显示等操做。windows
:set nonu 不显示行号bash
vim 实践less
[root@bogon ~]# vim test.txt [root@bogon ~]# cp /etc/dnsmasq.conf /tmp/1.txt [root@bogon ~]# vim /tmp/1.txt
# Configuration file for dnsmasq. # # Format is one option per line, legal options are the same # as the long options legal on the command line. See # "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details. # Listen on this specific port instead of the standard DNS port # (53). Setting this to zero completely disables DNS function, # leaving only DHCP and/or TFTP. #port=5353 # The following two options make you a better netizen, since they # tell dnsmasq to filter out queries which the public DNS cannot # answer, and which load the servers (especially the root servers) # unnecessarily. If you have a dial-on-demand link they also stop # these requests from bringing up the link unnecessarily. # Never forward plain names (without a dot or domain part) #domain-needed # Never forward addresses in the non-routed address spaces. #bogus-priv # Uncomment these to enable DNSSEC validation and caching: # (Requires dnsmasq to be built with DNSSEC option.) #conf-file=%%PREFIX%%/share/dnsmasq/trust-anchors.conf #dnssec # Replies which are not DNSSEC signed may be legitimate, because the domain # is unsigned, or may be forgeries. Setting this option tells dnsmasq to # check that an unsigned reply is OK, by finding a secure proof that a DS # record somewhere between the root and the domain does not exist. # The cost of setting this is that even queries in unsigned domains will need # one or more extra DNS queries to verify. #dnssec-check-unsigned # Uncomment this to filter useless windows-originated DNS requests
分别向下、向右、向左、向右移动6个字符(6j 6l 6h 6l)dom
搜索文件中出现的dnsmasq字符串,并数一下该字符串出现的次数(输入/dnsmsq,而后按n)。工具
把从第1行到第10行出现的dnsmasq字符串替换成dns(:1,10s/dnsmasq/dns/g)ui
还原上一步操做(u)this
把光标移动到第25行,删除字符串1y(输入25G后回车,而后按j向右移动光标找到ly,按v选中,而后按x)spa
删除第50行
删除第37行至第42行的全部内容(37G 6dd)
复制第48行的内容并将其粘贴到第52行下面(48G yy 52G p)。