迁移到 Vim 的 10 个难关
你必须得承认,每当你看到别人使用 Vim,你就在想他是不是知道一些你不知道的事情。否则他为什么要用这么一个过时的编辑器,或者说开源垃圾?
除非你花至少一个月的时间每天使用这个编辑器,否则你是不会喜欢它的。这也是为什么很多新手会尝试一两天,然后就被它恶心到了,然后就永远不在碰它的原因。不幸的是,假如这些开发者能够挺过前期的痛苦,等待他们的将是无敌的速度和灵活性。
1. 太多的模式可以选择
Vim 和 TextMate 有很多不同,你常常会遇到它不让你输入,让你抓狂。Vim 有很多不同的模式,在不同的模式下,不同的按键有不同的功能。更让人崩溃的是,大写和小写的功能也天差地别。
也许你很奇怪一个命令搞了半天就是为了删除五行文字。是的,但是当你掌握它后,你会发现编辑的速度快了很多。
2. 古老的编辑器
Vim 的年龄是很大的,超过30岁了!但是 Vim 是一直在被开发和维护的。最新的 7.3 版本是2010年发布的。还有,Vim 和 Vi 是不一样的,如果你只用过 Vi 那么建议你试试 Vim,你会有惊喜的。
3. 我喜欢 TextMate 代码片段功能
你也许很快就会发现 Vim 不能胜任某项工作,但是很有可能某个插件已经实现了你想要的功能。例如 TextMate 代码片段(snippets)功能,Vim 并没有这个功能,但是有一个 snipMate 插件可以实现一模一样的功能。
4. 我不能使用上下键
首先,Vim 是可以用上下键的,你说的可能是 Vi。但是大部分 Vim 的用户不用这些按键:
h,j,k,l被映射到了左,下,上,右:
没有选择 - 以前的机器没有上下左右按键
更少的移动 - 大部分情况你的手是在键盘的第二排,所以用这样的映射会让你的手尽量少的移动,可以让你更快的在文档的不同部分移动。
5. 我是设计师!
是的,Vim 并不适合每一个人。如果你经常和 HTML,CSS 打交道的话,Vim 可能不适合你。不过你也可以尝试一下。也许 Coda 更适合你。
6. Vim 并不提供我现有编辑器的功能
你错了,每一款编辑器都有它的长处。Vim 的长处就是强大,灵活,有成千上百的插件,而且免费。几乎你能想到的功能,都有插件提供。
snipMate:可以让你输入 + tab ,展开整个 div,超级好用!
Surround:把一部分文字用标签括号等标记出来。
NerdTree:查看文件系统,打开文件或者目录。
TComment:简单快速的注释掉代码中的某些行。
Sparkup:类似 ZenCoding,但同时也支持给元素赋值,比如:
ul > li { My list item text. }
7. 我的 Vimrc 文件是空白
这是我用 Vim 遇到的第一个问题。当你第一次启动 Vim 的时候,你会发现没有代码高亮,没有语法格式,没有自动缩进等等,什么都没有!刚开始的时候设置 Vim 的配置文件是比较头疼的,不过网上有很多现成的可以参考。
8. 我不想使用命令行
我也是,还好有图形界面的 Vim,比如 MacVim,GVim。
9. 没有老师学起来太累
请查看这个 Venturing into Vim 四周的课程。这个课程的特点是,我是在我学习 Vim 的时候录制的。
10. 我不能编辑远程的文件
你当然可以,也许没有 Coda 那么友好,但是 Transmit FTP 插件是可以提供这个功能的。
当然,你有成千上万的理由拒绝 Vim。它的学习曲线很高,需要你对代码编辑有一个全新的认识。但这些都不足以说明 Vim 不值得你认真学习一下!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to Remap CapsLock to ESC on iPad Keyboard Are you ready to make CapsLock the ESC key on your iPad? Here's all you need to do: Open the Settings app on your iPad Go to "General" then go to "Keyboard" Go to "Hardware Keyboard" Select "Modifier Keys" Select "CapsLockKey" and select "Escape" as Modifier Keys Now you're ready to try out the new hardware ESC key on your iPad by pressing CapsLock. Go to any application that uses the Escape key and you can test it immediately, such as vi/vim. Now you can use a physical keyboard from

The method of deleting even-numbered lines is as follows: :g/^/+1d The :gbobal command is used above. The gbobal command format is as follows: :[range]global/{pattern}/{command}global command is actually divided into two steps: first Scan all the lines within the range specified by [range] and mark the lines matching {pattern}; then execute the {command} command on the marked lines in sequence. If the marked lines are marked during the command operation on the previous matching lines, If you delete, move or merge, the mark will automatically disappear without executing the {command} command on the line. {command} can be an ex command or separated by |

In PHP development, using Vim is very common. However, you may encounter some problems installing Vim in Alpine Linux. This article will share how to install Vim on Alpine Linux.

Preface: vim is a powerful text editing tool, which is very popular on Linux. Recently, I encountered a strange problem when using vim on another server: when I copied and pasted a locally written script into a blank file on the server, automatic indentation occurred. To use a simple example, the script I wrote locally is as follows: aaabbbcccddd. When I copy the above content and paste it into a blank file on the server, what I get is: aabbbcccddd. Obviously, this is what vim does automatically for us. Format indentation. However, this automatic is a bit unintelligent. Record the solution here. Solution: Set the .vimrc configuration file in our home directory, new

How to save and exit vim: 1. Use shortcut keys to save and exit; 2. Use a separate command to save and exit; 3. Use automatic commands to save and exit; 4. Use shortcut keys to save the file.

Vim's split-screen function is implemented by splitting windows, which is a great tool for improving work efficiency. Whether we want to display two files at the same time, or display two different locations of a file at the same time, or compare two files side by side, etc., these can be achieved through split screen, which is very convenient for code comparison and copy and paste.

Manually modify the syntax file for downloading the nginx configuration file: nginx.vimwgethttp://www.vim.org/scripts/download_script.php?src_id=14376-onginx.vimCopy the file to the /usr/share/vim/vim74/syntax directory (It can also be a single-user directory ~/.vim/syntax/). Modify vim/usr/share/vim/vim74/filetype.vim to add aubufread,bufnewfile/etc/nginx/*,/usr/local/n

CentOS uses vim/vi to encrypt and decrypt files 1. Use vim/vi to encrypt: Advantages: After encryption, if you don’t know the password, you cannot see the plain text, including root users; Disadvantages: It is obvious that others know the encryption , it is easy for others to destroy encrypted files, including content destruction and deletion; I believe everyone is familiar with the vi editor. There is a command in vi to encrypt files. For example: 1) First, in the root master Create an experimental file text.txt under the directory /root/: [root@www~]#vim/vitext.txt2) Enter the editing mode, press ESC after entering the content, and then enter: X (note the capital X), Enter; 3)
