6 ms·
As a front end web developer, I am not really sure I understand any "advantages" to VIM or VI, or any command-line based edit for that matter. Sure, they might
by antonpug 11y ago
As a front end web developer, I am not really sure I understand any "advantages" to VIM or VI, or any command-line based edit for that matter. Sure, they might be great if you're doing scripting, messing around with the back end, or dong DB stuff. But for me, writing day-to-day JS, HTML, CSS code, VIM seems like a very huge burden. It's like trying to unscrew a screw with scissors when you have a screwdriver laying next to you. Why not just use a good, well-rounded editor like Sublime or Atom, or even Eclipse, for that matter..? I often see web developer, dabbling in front end code, doing their coding in VIM. Yuck. Someone explain?
- alphabetam 11y agoBecause Vim can be faster than Sublime. Or at least just as fast.
- zeteo 11y agoVIM has a learning curve, but once you're over the hump you can do many kinds of edits much faster than using the mouse. You need to join two lines of text? It's one key press. Transpose two lines of text? Three key presses. Also macros are very easy to define and use (once you understand how they work).
- antonpug 11y agoWhat would you say is the learning curve? From someone who is used to GUI editors, moving to VIM...how long until you're actually reaping the benefits?
- commandar 11y agoMy experience was a couple of weeks using it full time to really get comfortable with the basics. From that point you'll be constantly learning new ways of doing things better because vim is really more of a language than anything.
- Arcanum-XIII 11y agoIt took me a week to be comfortable with the mode change, then 1 month to be relatively comfortable with Vim... and 5 more month to properly reap some of his advantage when editing text. It may seem a long time, but it's taking me the same time to be comfortable with emacs right now, and from what I remember, with other editor more or less the same difficulties arise (I've never tried Sublime enough for example, but for Textmate it took me less time only because the feature set is narrower... habits themselves took the same time to kick in)
- MichaelGG 11y agoPlay VIM Adventures[1]. Even doing a few levels was enough for me to start enjoying benefits. And I didn't switch from Visual Studio for the bulk of code editing, I just added VsVim. That way I'm not forced into VIM. I can use as much or as little as I want. No pressure. (Though all my config editing is over SSH and VIM itself is great there.) The biggest, easiest, thing for me was macros. Being able to easily and quickly record a macro and apply it over many lines - that's slick. Like converting a CREATE TABLE to a set of ORM instructions, or into a structure. Before I'd use some half cooked regex and clean up after. Now I just edit one l line while in a macro then run it N times. Apart from that, it's just a ton of little things that add up. Also: ViEmu for Office. VimFx for Firefox (there's one for Chrome too, Vimium). Browsing without the mouse is really great; quite elegant. 1: http://vim-adventures.com/ http://vim-adventures.com/
- zeteo 11y agoSpend 2-3 hours and learn the basic movement methods, this brings you at a comparable speed with a mouse-based editor. After a week of using you'll develop muscle memory and you're already faster. At least that's my experience with teaching other people so far.
- merijnv 11y agoIt took me a day to use it as "notepad with syntax highlighting", couple of weeks before I started preferring normal mode to insert mode, and from there on I slowly evolved my configuration and the tricks I use/learn. Nowadays when using vim I occasionally have people ask me "how did you do that?" and I won't even know what keys I typed. The keybindings are as natural as walking/grabbing things and require as much conscious thoughts. I usually have to redo it in slow motion to see what I did... I can highly recommend Bram Moolenaar's essay on "The Seven Habits of Effective Text Editing" (http://www.moolenaar.net/habits.html http://www.moolenaar.net/habits.html), it has a vim focus, but I think his points are editor agnostic Edit: I started using vim as a windows GUI person in university since I wanted to edit over SSH and vim was the only editor with syntax highlighting on the servers. So it's not like I was a terminal wizard back then (I am now :p)
- canistr 11y agoVIM/VI aren't simply editors themselves. Most editors have a VIM/VI-like plugin to give VIM users the ability to navigate their code in same style. I use VIM plugins heavily in Sublime (the Vintage plugin) and Android Studio.
- jkyle 11y agoI'll start off with the best advice I ever ran across with regards to the beat to death "choosing an editor" question: > Try all the popular ones, give them all a fair shot like several weeks of exclusive use. Pick one. Practice it. Move on to more interesting problems. Vim is a good well-rounded editor that can do anything Sublime or Atom can do. And it did them before Sublime or Atom existed. It has Gui's that feel native. Every new generational crop of editors, I give the new guys a fair shot. Use them for a few weeks, but usually end up back on Vim after that. Last one that really "shook things up" was TextMate...though all editors have those features now. So, to your question specifically: Why vim? I could go on about keyboard efficiency or home row or more terse key combos to get the same thing done or blah blah blah. But really, none of that is true. The reason I use vim is simple: It's feature full, does everything I need, I know it and know it well, and.... I've got better things to do then learn another editor as well.
- m0th87 11y agoYou could turn this around and make it an argument against vim, if you're an experienced sublime/emacs/whatever user.
- jkyle 11y agoThat's my point. What editor you use is, largely, inconsequential when it comes to getting work done. They're all very comparable in features. Use whatever you like. It's about the code, not the editor.
- jakeway 11y agoI think you missed the point. I believe the idea is that there isn't One Editor To Rule Them All. You can try out new text editors, but in the end, just pick whichever one feels right for you, and move on.
- Touche 11y ago> Why not just use a good, well-rounded editor like Sublime or Atom, or even Eclipse, for that matter..? Because those editors use GUI that isn't optimized for editing text. They use the same widgets that are used by the Volume Manager, the Finder, the web browser. Vim's interface is geared only towards editing text.
- dtech 11y agoAh yes, the infamous volume-manager-that-you-have-to-adjust-with-a-text-field, I hate that thing. According to you VIM isn't optimized for editing text. It uses a UI (terminal) that was designed for entering batch commands and displaying their output.
- Touche 11y agoThe terminal isn't a UI, and VIM doesn't use any UI toolkit, not even curses, but rather is completely custom. This enables it to specialize in text manipulation, whereas graphical editors like Sublime build on top of the OS-provided UI and keyboard conventions. Some prefer the latter because it is more "familiar", but personally I think the fact that VIM is its own thing is what makes it special.
- zxcvcxz 11y ago>It's like trying to unscrew a screw with scissors when you have a screwdriver laying next to you. I kind of felt the same way when I first started learning vim. It seems "foreign" at first, but now that I'm able to use it pretty proficiently I think this is a bad comparison. Vim is more like a power screwdriver that not just anyone can handle, but once you get the hang of it you never want to use a regular screwdriver again. Vim, unlike other editors, usually requires customization though, so you really have to emerge your self in vim to get up-and-running whereas with an editor like atom you're typically good to go.
- digitalzombie 11y agoI'm a full stack dev and I use vim for everything. From back end system admin to front end. I don't need any IDE fancy stuff when MVC is pretty straight forward. If I need to split screen or jump between window it's tmux or vsplit/split on vim really. I don't use many commands with VIM. Plus most front end tools are cmdline. bower, composer (for php), grunt, npm, etc... I also use vagrant to run my projects and ansible those are mostly cmdline. I guess in general, I like the fact I have everything in control in one terminal. I don't have to jump or juggle between different programs. IDE, Commandline, and bunch of other programs. Some IDE might have bower, grunt, etc.. extension tuck in somewhere where I have to search for. No thanks. I got tmux and I don't have to jump between window just to restart or do stuff with vagrant either. edit: I know about 15 at max vim command. >___<. And like maybe 8 commands for tmux.
- rakoo 11y ago> Why not just use a good, well-rounded editor like Sublime or Atom I'd like to ask you the same question: what makes you think Sublim or Atom is a superior text editor (not: I'm not talking IDE) ? Personally I took the time to learn and be proficient with vim; it is now my editor of choice because it gives me a lot of power and doesn't get in the way. It did take time, but it was worth it. I'm pretty sure if I chose another editor I would be equally proficient; it's not so much about vim being the best one, it's more about how I'm efficient with it today. I guess you've been turned down by vim because it's hard to start with, and in that sense Sublime or Atom are certainly better text editors ... but it doesn't matter, because the learning phase is only temporary.
- lorenzfx 11y ago> Why not just use a good, well-rounded editor like Sublime or Atom, or even Eclipse, for that matter..? What makes Vim NOT not a good, well-rounded editor in your opinion?
- WorldWideWayne 11y agoI would say Vim is not good or well rounded until you cobble together a set of addons that let you do things that many IDEs (and text editors) do out of the box.
- falcolas 11y agoVim is a text editor, not an IDE. It can be, as you point out, made to act like an IDE with enough plugins - but it is still not an IDE. Comparing Vim to other text editors (sublime text, etc.) is a much more apt comparison.
- WorldWideWayne 11y agoEven as a text editor - it doesn't come with things like bookmarks, navigable hyperlinks, syntax highlighting, collapsible sections, etc without plugins.
- rylee 11y ago>bookmarks :h mark >syntax highlighting :h syntax >collapsible sections :h folds You've got me on navigable hyperlinks with a simple setting or key stroke out of the box, but it's trivial to write a binding to open the URI beneath the cursor.
- WorldWideWayne 11y agoI hear you - but I'd say that next to nobody just uses mark or syntax or folds because they're extremely bare-bones implementations of those features.
- rebootthesystem 11y agoNo, you understand just fine. VIM has developed mostly irrational cult following. It exists because it came from an era when computer keyboards were not much more than typewriter keyboards. In that context you needed to get creative in order to interact with any software. I was building and messing with computers as far back as 1978, so yeah, I lived that era. And, yes, I too wrote editors and programs that operated in similar fashion. The motivation wasn't to make it more efficient or to keep your hands on the keyboard. The mouse did not exist. All you had was a crippled keyboard. I don't know anyone of my generation that doesn't simply laugh or look at the cult of vim and isn't perplexed by some of what proponents of the cult say. We ran as fast as we could from those kinds of interfaces once the computer keyboard developed further and the GUI took to the world. The people who had to use that shit 'cause there was no other choice dropped it like hot potatoes as soon as they could. Here's reality from the perspective of designing, building and programming all sorts of computers for over 30 years: If you are spending so much time typing that fractions of a second at the keyboard make a significant impact on the development cycle, you are a hack and don't know what you are doing. Real software and hardware engineers spend far more time designing and planning than coding. Coding is the end result of a process and, in terms of time, is often dwarfed by design and debugging. As an example, we are in the middle of a month-long process of designing a database for a project. Not one line of code has been written. Every day is devoted to database structure discussions and documentation. Once settled, the DB code might take a week to write. We are also designing an FPGA-based board as part of the same project. Over three months have gone into research, circuit design and other tasks. The time coding in Verilog won't even compare to the effort before getting to that point. And then there's debugging and the inevitable pivot or two. There's nothing whatsoever an editor can do to impact this development cycle in a measurable way. We use several GUI-based code editors. Nobody here is saying "if I could only keep my hands on the keyboard for another few seconds I could...". If they did, the laughter in the room would be so loud you could measure it with a seismograph because it is so utterly ridiculous. Do I use vim? Of course, only when I have no other choice.
- hsitz 11y ago"Real software and hardware engineers spend far more time designing and planning than coding. Coding is the end result of a process and, in terms of time, is often dwarfed by design and debugging." This part of your post is correct. If you don't spend much time coding then you don't have much reason to use Vim. ON the other hand, for those "fake" software guys who do spend a lot of time coding, especially editing code, then . . .
- ksk 11y agoYour evaluation and thinking is entirely correct. For most mainstream development the vast majority of your time will be spent on things (debugging, testing, stepping through, reading documentation, refactoring, etc) that don't involve typing/modifying reams of text. Furthermore, if you're using languages like C++, Vim has very poor refactoring support when compared with commercial tools like Visual Assist. Having said that, you can get a decent IDE with Vim plugins - for free. You don't have to learn or use Vim's text manipulation commands at all, if you don't want to.
- emilecantin 11y agoI think vim is especially well-suited to front-end dev, as it is one of the software areas that doesn't depend heavily on an IDE (as opposed to, say, Java). For me, vim keybindings are wired into my brain after a few years of use, and it lightens my cognitive load, just as it is stated in TFA. So, to answer your question: > Why not just use a good, well-rounded editor like Sublime or Atom, or even Eclipse, for that matter..? - Sublime: Closed-source. - Eclipse: I don't need that big of an environment just for editing text. - Atom: That one actually tempts me. I gave it a try, with the vim keybindings plugin, and it had a slight delay when executing commands that made me go away. I'm keeping a close eye on neovim integration, though; it sounds very promising.
- dmix 11y agoIt doesn't matter what type of dev you are front/back-end, Vim is (one) of the best text editors for coding period. I use it for both front and backend, and for note-taking when I'm doing UX design. Or when I'm writing blog posts. Or when I need to write a long email. I also use Vim bindings in my browser thx to cVim.
- jotux 11y ago>they might be great if you're doing scripting, messing around with the back end, or dong DB stuff. But for me, writing day-to-day JS, HTML, CSS code, VIM seems like a very huge burden. Why is back-end different from front-end? It's all text on a screen. Your statement amounts to, "It might be good for writing and viewing text on a screen but for me, someone writing and viewing text on a screen, it seems like a burden."
- ugh123 11y agoVIM's (and others like it) strengths are in its configurability and movement commands and lack need for the arrow-keys. So much so that theres a VIM plugin for just about every popular editor, including Sublime and Atom. I believe the need for fancier editors like Sublime and Atom has come about because VIM's development has waned and its code base is hard to update and innovate on.
- tincholio 11y agoYour problem with vim is that you don't grok vi: http://stackoverflow.com/a/1220118/885262 http://stackoverflow.com/a/1220118/885262
- super_mario 11y agoDon't think of Vi or Vim as of regular editor. Think of it as functional programming language for text transformation, because that is what it essentially is. General form of vim command is nOm: repeat n-times operator O on text the motion command m moves over. So, for example, 5dw says "delete 5 words" because w command moves to next word, d operator stands "delete". The nice thing about this is that once you learn new motion command or operator, you become instantly more powerful. For example, after you learn that ) moves to the next sentence, you can now delete whole sentences with d). After you learn about change c operator, you can now change whole sentence with c). This essentially deletes the sentence and puts you in insert mode so you can type in the replacement text. There are also text objects that allow you to apply operator on the object. For example if you are anywhere inside if (.) condition, you can type ci(, which stands for change inner ( i.e. change everything inside brackets, to quickly change the condition. Similarly, there is inner word, paragraph, XML tag, brace {, etc text objects, so it is fast to delete/modify etc entire blocks of code. Vim also has Perl compatible regex engine, which allows you to do sweeping changes and transformation of text. The operators work with search motion as well, so you can do things like d/regex i.e. delete everything from current cursor position to first match of regex etc. The :g ex command alone alows you to do fairly complex transformations, for example :g/pattern/d delete all lines that match pattern, or :g/pattern/m$ move all lines matching a pattern to end of file, or something more complex: :.,$g/^\d/exe "normal! \<C-A>" Increment each number at the start of a line, from the current line to end-of-file, by one. Of course there are a plethora of motion commands that allows you to quickly get to the line, character etc where you want to edit, all without taking your hand from the keyboard. In fact, most times you will be editing text well before the person using a mouse finds their mouse cursor. This is all just scratching the surface (Vim has over 2000 commands), but hopefully it gives you the flavor of the experience editing in Vim. Getting proficient in Vim is liberating, it allows you to bend text effortlessly to your will without too much thinking really. It's programming your text, and in my mind a very valuable skill, just like learning the UNIX/POSIX command line is incredibly valuable (it's another functional programming environment where individual commands are your functions/filters and shell is executing them and you can string these filters together in unique ways to do all kinds of powerful things that simply don't have an equivalent in the GUI). Command line and Vim multiply you as developer and there is nothing in the GUI world that can come even close to this experience.
- copsarebastards 11y ago> Why not just use a good, well-rounded editor like Sublime or Atom, or even Eclipse, for that matter..? Vim is a good, well-rounded editor.
- belovedeagle 11y agoAnd Eclipse isn't an editor at all.