-3

Why should PHP developer use/learn VI editor ?

I mean there are 10 most amazing editors like PHPStorm, Netbeans which increases developers productivity.

Lets just consider PHPStorm. I never got amazed by editor like PHPStorm.

It has 1000s of features. Right from syntax hints, showing weak errors, warnings, notices etc.

When we compare number of features provided by VI Editor & those provided by editors like PHPStorm, we see it like 10 vs 1000 features.

My question is : Why should I learn to use Vi editor?

P.S. I am intermediate linux(Ubuntu) user.

Edit : Who told me to learn VI ? => Normally its required skill in Job Listing for PHP developer

Thanks.

closed as primarily opinion-based by Bart van Ingen Schenau, durron597, user22815, user40980, user53019 Jun 15 '15 at 20:03

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Who told you should learn vi? – choroba Jun 14 '15 at 6:37
  • Normally its required skill in Job Listing for PHP developer – Pratik Jun 14 '15 at 6:39
  • 1
    Because when you have to fix something on-the-fly on the production server, because the problem shows up only there, and the problem is extremely urgent, do not expect there a PHPStorm or Netbeans etc. to be preinstalled there. – Doc Brown Jun 14 '15 at 7:10
  • 1
    You could use emacs (or even nano) instead of vi – Basile Starynkevitch Jun 14 '15 at 7:30
  • @BasileStarynkevitch , Hi , I mean any gnu / linux editor vs Strong powerful IDE like PHPStorm. – Pratik Jun 14 '15 at 7:42
7

One possible reason is that you might need to edit PHP files from remote and it is much faster to access the server via SSH than remote desktop.

However, protocols such as SSH only give you access to the command (textual) interface of the server, i.e. the Terminal/Command prompt. Editors such as Netbeans require a graphical interface, yes you can access the server via remote desktop but anybody who has done it knows it is painfully slow and unproductive.

VI/VIM is a text-based editor, it does not require a graphical interface, which is preinstalled on most Unix/Linus platforms, and can run in a Terminal, thus it is especially convenient for editing files from remote when you only have access to the command interface of the server. Another common use for VI/VIM is to edit system administration files which require root privileges (I'm referring to Unix/Linux platforms) since VI/VIM can easily be run with the "sudo" command.

  • I just want to add that editing files on production is bad. Thought someone should say it. That being said, vi is a common tool (on almost every Linux/Unix install ever) so better at least learn esc + :wq! – coteyr Jun 14 '15 at 14:14
5

Simple answer: Because you will need it.

On productive unix/linux environments you will likely only find vi/vim as editor.

Also you will not be allowed to install additional software on the productive server (like your favourite IDE).

Additionally most server environments will have no GUI (when speaking of unix/linux) Therefore remote desktop is no option there.

So you have to live with a simple editor (like vi) via ssh.

2

IMHO "because you may need to edit files on the production server and there is no IDE/GUI on production servers" can't be the answer.

  1. In any professional shop an ordinary developer has no access to the production server. If the shop has a a size of > 10 employees they will have a system administrator/devops team for that.

  2. Even if we assume the team is so small that it has no system administration/devops people then maybe the developer has also the role of system administrator/devops, which means that he may needs vim (or emacs, nano ...) as part of this role.

  3. All the IDEs have the possibility (native or via plugin) to access files on a remove file system by just tunnelling through SSH/FTP or whatever is available to reach the servers. So even if the shop has no deployment process or the deployment is broken, you'll easily be able to edit files on the server without vim.

Why should a PHP developer use/learn VI editor then?

This are the reasons I can think of:

  1. All of the tools you mentioned in your question are also available with vim. Syntax highlighting, xdebug, etc. are all there. You just need to install plugins and configure vim to fit your demands. Obviously "phpStorm" is an IDE fitted for PHP development so it has all those out of the box, while vim is an extendable text-editor, which means you have to put a lot of work to make it fit your workflow. You may have a look at this video which shows a fantastic tmux + vim setup - you'll notice his vim doesn't look like your vim anymore.

  2. I think when mastered a no-mouse-only-keyboard-workflow is effectively faster. This takes a lot of practive, but when you stand next to a vim-magician you'll just be buffed how fast he is. A working pace that IMHO can never be reached by regular IDEs.

  3. Because not everything works out of the box, you'll get a lot more insight how things actually work behind the scenes. Again this is of course a huge time investment when compared to an out-of-the-box solution.

  4. As already outlined vim comes pretty bare-bone when compared to a full blown IDE. This also gives you the chance to create a personal workflow by yourself. All the keybindings, macros, plugins, visual appereance - the whole behaviour of the editor is under your control. You form your own personal workflow instead of using that given by the IDE.

  5. Using it brings a geeky-warm-feeling of beeing oldschool.


So to sum up, it's a huge investment of time to learn it, but it may make sense because you gain a lot of insight and are able to form your own workflow.

If you are not only a developer, but also in the role of a system administrator or DevOps it is a clearly needed skill for interacting with the servers.

Not the answer you're looking for? Browse other questions tagged or ask your own question.