Translated

This commit is contained in:
Jonathan Kang 2016-02-24 16:44:12 +08:00
parent f50d7a402a
commit d2818a9bc4
2 changed files with 79 additions and 80 deletions

View File

@ -1,80 +0,0 @@
JonathanKang is translating
[Free Download] Vi Cheat Sheet For Beginners
================================================
![](http://itsfoss.com/wp-content/uploads/2016/01/VI.jpg)
I have often shared my Linux experience with you. Today I am going to share my **Vi cheat sheet** that has often saved me time in googling for a quick command.
## Basic Vi commands
This is not a detailed tutorial to teach you each and every aspect of [Vi editor](https://en.wikipedia.org/wiki/Vi). In fact, its not a tutorial at all. Its just a collection of basic Vi commands and their brief description for a quick reference.
command|explain
:--|:--
:x |Save the file and quit
:q!|Quit without saving the file
i|Insert starting left of the cursor
a|Append starting right of the cursor
ESC|Exit insert/append mode
arrows|Move cursor
/text|Search string text (case sensitive)
n|Search next occurrence of the searched item
x|Delete character under the cursor
dd|Delete line under the cursor
u|Undo last change
:0|Beginning of the file
:n|Go to line n
G|End of the file
^|Beginning of the line
$|End of the line
:set list|See special characters in the file
yy|Copy the line into the buffer
5yy|Copy 5 lines into the buffer
p|Paste buffer after the current line
You can download the above cheat sheet in a PDF format from the link below:
[Download Vi Cheat Sheet](https://drive.google.com/file/d/0By49_3Av9sT1X3dlWkNQa3g2b2c/view?usp=sharing)
You can print it and keep it at your desk or just save it for offline use.
## Why I created the Vi cheat sheet?
Several years ago, when I started working in Linux terminal, the idea of using a command line editor horrified me. I had used desktop Linux before but it was my personal computer so I happily used the GUI text editor like Gedit. But in the working environment, I was stuck with the command line and there was no scope of using a graphical editor.
I was forced to use Vi for basic edits in the files on remote Linux boxes and this is where I identified and started to admire the power of command line editing tool Vi.
Since, at that time, I was new at Vi editor, I found myself baffling with it. The first time, I could not even come out of the file because I did not know how to close Vi editor. No shame in accepting that I had to Google it.
So, I decided to make a list of all the basic commands that I used frequently for editing in Vi. This list or cheat sheet, as you may call it, helped me a lot in my early days with Vi. With time, I grew up with Vi and now I dont even need to look at the Vi cheat sheet because I have the commands memorized by heart.
## Why should you use Vi cheat sheet?
I can understand your situation if you are just getting started with Vi. Your favorite Ctrl+S doesnt work for saving files. Ctrl+C and Ctrl+V were supposed to be the universal shortcut for copy and paste but it wont work in Vi universe.Thousands of people use cheat sheets
Thousands of people use such cheat sheets for various programming languages and `/` or tools that give them a quick reference to commonly used steps `/` commands. Trust me, using cheat sheets among the best practices advised to programmers.
This Vi cheat sheet will help you a lot if you are just starting with Vi or if you infrequently use the Vi editor (so you keep forgetting the commands). You can save it and use it for quick reference in future, that too offline.
## Do you like it?
So far, I have refrained myself from going into too much on terminal side. How do you find this post? Do you want me to share more such cheat sheets and downloadable items? Your suggestions are welcomed.
------------------------------------------------------------------------------
via: http://itsfoss.com/download-vi-cheat-sheet/
作者:[ABHISHEK][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://itsfoss.com/author/abhishek/

View File

@ -0,0 +1,79 @@
【免费下载】初学者Vi备忘单
================================================
![](http://itsfoss.com/wp-content/uploads/2016/01/VI.jpg)
一直以来我都在给你们分享我使用Linux的经验。今天我想分享我的**Vi备忘单**。这份备忘单节省了我很多时间因为我再也不用使用Google去搜索这些命令了。
## Basic Vi commands
## 基本Vi命令
这并不是一个详尽的教程来教你[Vi编辑器](https://en.wikipedia.org/wiki/Vi)的每一个方面。事实上这根本就不是一个教程。这仅仅是一些基本Vi命令以及这些命令简单介绍的集合。
命令|解释
:--|:--
:x |保存文件并退出
:q!|退出但不保存文件
i|在光标左侧插入
a|在光标右侧插入
ESC|退出插入模式
arrows|移动光标
/text|搜索字符串text大小写敏感
n|跳到下一个搜索结果
x|删除当前光标处的字符
dd|删除当前光标所在的行
u|撤销上次改变
:0|将光标移动到文件开头
:n|将光标移动到第n行
G|将光标移动到文件结尾
^|将光标移动到该行开头
$|将光标移动到该行结尾
:set list|查看文件中特殊字符
yy|复制光标所在行
5yy|复制从光标所在行开始的5行
p|在光标所在行下面粘贴
你可以通过下面的链接下载PDF格式的Vi备忘录
[下载Vi备忘录](https://drive.google.com/file/d/0By49_3Av9sT1X3dlWkNQa3g2b2c/view?usp=sharing)
你可以把它打印出来放到你的办公桌上,或者把它保存到你的电脑上来使用。
## 我为什么要建立这个Vi备忘录
几年前当我刚刚接触Linux终端时使用命令行编辑器这个主意使我一惊。我之前在我自己的电脑上使用过桌面版本的Linux所以我很乐意使用像Gedit这样的有图形界面的编辑器。但是在工作环境中我不得不使用命令行并且无法使用图形界面版的编辑器。
我就这么被强迫地使用Vi来对远程Linux终端上的文件做一些基本的编辑。从这时候我开始了解并钦佩Vi的强大之处。
因为在那时候我还是一个Vi新手所以我经常对Vi一些操作很困惑。仍然记得第一次使用Vi的时候由于我不知道如何退出Vi所以我都无法关闭某个文件。我也只能通过Google搜索来找到解决办法。我不得不接受这个尴尬的事实。
从那以后我就决定制作一个列表来列出我经常会用到的基本Vi操作。这个列表或者你可能称它为备忘录。在我早期使用Vi的时候它对我非常有用。慢慢地我对Vi更加熟悉我已经可以熟记那些基本编辑命令。到现在我甚至不需要再去查看我的Vi备忘录了。
## 你为什么需要Vi备忘录
我能理解一个刚刚接触Vi的人的感受。你最喜欢的Ctrl+S快捷键不能像在其他编辑器那样方便地保存文件。Ctrl+C和Ctrl+V理应是通用的用来复制和粘贴的快捷键但是在Vi中却不是这样。
很多人都在使用类似的备忘录帮助他们熟悉各种编程语言以及用来进行快速检索的“/”工具。相信我,使用备忘录会给程序员日常工作带来很大便利。
如果你刚刚开始接触Vi或者你经常使用但是总是记不住Vi操作那么这份Vi备忘录对于你来说是非常有用的。你可以把它保存下来留作以后查询使用。
## 你怎么看待这份备忘录?
至今为止,我一直在克制我自己不要过于以来终端。我想知道你是怎么发现这篇文章的?你是否想让我分享更多类似的备忘录出来以供你们下载?我很期待你的意见和建议。
------------------------------------------------------------------------------
via: http://itsfoss.com/download-vi-cheat-sheet/
作者:[ABHISHEK][a]
译者:[JonathanKang](https://github.com/JonathanKang)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://itsfoss.com/author/abhishek/