技术控

    今日:104| 主题:49431
收藏本版 (1)
最新软件应用技术尽在掌握

[其他] Vim Misconceptions

[复制链接]
乜許、悲傷 发表于 2016-10-6 00:16:52
127 1

立即注册CoLaBug.com会员,免费获得投稿人的专业资料,享用更多功能,玩转个人品牌!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
Vim isn’t the best tool for every task, and there’s no reason you shouldn’t stick to your GUI IDE if you know it like the back of your hand and are highly productive in it. The very basic best practices for text editing in general apply just as well to more familiar editing interfaces as they do to Vim, so nobody should be telling you that Vim is right for everyone and everything and that you’re wrong not to use it.
  However, because Vim and    vi-like editors in general have a lot of trouble shaking off the connotations of their serverside, terminal-only, mouseless past, there are a few persistent objections to even    tryingVim that seem to keep cropping up. If you’re someone curious about Vim but you heard it was useless for any of the following reasons, or if you’re an experienced user looking to convince a hesitant neophyte to try Vim, the following list might clear a few things up.  
  Vim takes too long to learn

  If you want analogues to all of the features in your IDE, that would likely take some time, just as it would in any other new editor. However, if all you need to start is to be able to enter text, move around, and load and save files, you just need to know:
  
       
  •       ito enter insert mode,      Escto leave it   
  • Arrow keys to move around in both modes   
  •       :e <filename>to load a document   
  •       :w <filename>to save a document   
  •       :qto quit,      :q!to ignore unsaved changes  
  To do pretty much everything Windows Notepad would let you do, on top of that you’d only need to learn:
  
       
  •       ddto cut a line   
  •       yyto copy a line   
  •       pto paste a line   
  •       /<pattern>to search for text   
  •       nto go to the next result   
  •       :s/pattern/replacementto replace text  
  From that point, you only get faster as you learn how to do new things. So saying that Vim takes weeks to learn is a bit disingenuous when the essentials can easily be mastered with a few minutes’ practice.
  Granted, the arrow keys are a bit of ananti-pattern, but you can worry about that later.  
  Vim has no GUI

  Vim has a    GUI versioncalled Gvim for both Windows and Unix. For Mac OS X, the    MacVimport is preferred. For experienced users the GUI’s only real advantage over the terminal version is a wider color palette, but it has a toolbar and other GUI elements which some new users may find useful.  
  Vim doesn’t have spell checking

  Vim allows    spell checkingwith system dictionaries, using    :set spelland    :set spelllang. Misspelt and unknown words are highlighted appropriately.  
  Vim doesn’t have syntax highlighting

  Vim has support for    syntax highlightingthat can be turned on with    :syntax enable, for a very wide variety of programming languages, markup languages, and configuration file syntaxes.  
  Vim only allows eight colours

  This is a limitation of terminal emulators rather than of Vim itself, but most modern GUI terminal emulators allow256 colours anyway with a little extra setup. The GUI version, Gvim, has full color support with the familiar    rrggbbcolor definitions.  
  Vim doesn’t have class/function folding

  Vim does in fact have    support for folding, based on both code structure and manually defined boundaries. See    :help foldingfor details.  
  Vim doesn’t have autocompletion

  Vim allows basic completion using words already in the current buffer, and also more advanced          omnicompletion    using language dictionaries for constants, variables, classes, and functions.  
  Vim doesn’t have a file browser

  Vim has had the    Netrw pluginbundled for some time, which provides a pretty capable filesystem browser.  
  Vim can’t do network editing

  Again, the bundled Netrw plugin handles this. Editing files over FTP and SCP links is pretty transparent. You can open a file on a remote server by entering the following, which will prompt for your username and password:
  1. :e ftp://ftp.example.com/index.html
复制代码
When you’re done editing, you just enter    :wto save the file, and it’s automatically uploaded for you. You can record your FTP credentials in a    .netrcfile to save having to type in usernames and passwords all the time. URIs with    scp://work the same way; with a good    public key infrastructureset up, you can use Vim quite freely as a network-transparent editor.  
  Vim doesn’t have tabs or windows

  The model Vim uses fortabs and windows is rather different from most GUI editors, but both are supported and have been for some time.  
  Vim has too many modes

  It has three major modes: normal mode, insert mode, and command mode. There’s a fourth that’s Vim-specific, called visual mode, for selecting text.
  Most editors are modal in at least some respect; when you bring up a dialog box, or enter a prefix key to another command, you’re effectively changing modes. The only real difference is that context shifts in Vim are at first less obvious; the screen doesn’t look too different between normal, insert, and command mode.
  The    showmodeoption helps to distinguish between insert and normal mode, a common frustration for beginners. This gets easier when you get into the habit of staying out of insert mode when not actually entering text.  
  Vim doesn’t work with the mouse

  Vim    works fine with the mouse, in both Gvim and    xterm-like terminal emulators, if you really want it. You can change the position of the cursor, scroll through the document, and select text as normal. Setting the below generally does the trick:  
  1. :set mouse=a
复制代码
However, even a little experience in Vim may show you that you don’t need the mouse as much as you think. Careful use of the keyboard allows much more speed and precision, and it’s quite easy to run a complex editing session without even moving from the keyboard’s “home row”, let alone all the way over to the mouse.
  Vim doesn’t do Unicode

  Vim supports Unicode encodings with the    encodingoption. It’s likely you’ll only need to put the below in your    .vimrcfile and then    never really think about encodingin your editor again:  
  1. :set encoding=utf-8
复制代码
Vim isn’t being developed or maintained

  The original author of Vim, and its current maintainer and release manager, is    Bram Moolenaar. At the time of writing, he is working for Google, and is paid to spend some of his time developing Vim. The development mailing list for Vim is very active, and patches are submitted and applied to the publically accessible Mercurial repository on a regular basis. Vim is not a dead project.  
  Vim is closed source

  Vim isn’t proprietary or closed source, and never has been. It uses its own GPL-compatible license called the    Vim license.  
  The original    viused to be proprietary because Bill Joy based the code on the    classic UNIX text editor      ed    , but its source code has now been    releasedunder a BSD-style license.
友荐云推荐




上一篇:10 Desktop snaps written in September
下一篇:Logging conversations with RedBot
酷辣虫提示酷辣虫禁止发表任何与中华人民共和国法律有抵触的内容!所有内容由用户发布,并不代表酷辣虫的观点,酷辣虫无法对用户发布内容真实性提供任何的保证,请自行验证并承担风险与后果。如您有版权、违规等问题,请通过"联系我们"或"违规举报"告知我们处理。

dylxzl 发表于 2016-10-6 04:35:49
谁能明白谁的深爱,谁又能理解谁的离开...
回复 支持 反对

使用道具 举报

*滑动验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

我要投稿

推荐阅读

扫码访问 @iTTTTT瑞翔 的微博
回页顶回复上一篇下一篇回列表手机版
手机版/CoLaBug.com ( 粤ICP备05003221号 | 文网文[2010]257号 )|网站地图 酷辣虫

© 2001-2016 Comsenz Inc. Design: Dean. DiscuzFans.

返回顶部 返回列表