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)。