7 ms·
Let's stop telling programming newbies to learn Vim (or Emacs)
- jarin 14y agoHere's the thing about Vim or Emacs: Nobody can tell you when you need to switch to one of them. Your heart will tell you.
- maxk42 14y agoSometimes your boss will tell you.
- jfaucett 14y agoI agree with you at least for me thats how it was :) Don't get me wrong both are are great, heck an editor you write yourself in a day will do the job. But since we developers spend so much time with the editor I think it does sort of become a personal thing where you just have a "good feeling" in whatever you use (for me that match was emacs :)
- Shorel 14y agoI kept reading about vim, emacs, notepad++ and a bazillion other 'great' editors for years. No one ever made me quit Editplus. No one, until Sublime Text, that is. So that's true, you have to follow your heart.
- BklynJay 14y agoQ: What's the best way to generate a random string? A: Ask a first-year CS student to quit out of Vim.
- sbov 14y agoA: Ask a vim user to quit out of emacs.
- pestaa 14y agoFirst-year CS students don't read what's printed on the screen? Good lord how can we expect the average user to do the same?
- mdwrigh2 14y agoAsk a first-year CS student to quit out of ed.
- 4ad 14y agoFrom command mode, it's the same, from insert mode you need to know how to get to command mode, so it's harder to get out of vi compared to ed.
- trankas 14y agoBack in my college years, the first time I tried the Vim editor, I couldn't quit the editor, but was knowledgeable enough to kill Vim's process. And yet, later on, when understood the editor's philosophy, I felt enlightened.
- vampirechicken 14y agoYou have to ssh into my machine and fix a configuration file. The only editors on the machine are ed, ex, and vi/vim. You're dead int he water and useless to me. learn the 22 vi keystrokes. It won't kill you. It will make you stronger. Editors that make me take may hands off the keyboard in order to click around in the gui to move around my files are productivity killers.
- weaksauce 14y agoI agree. Is it really that hard to turn vim into a regular text editor? Hell it's even easier to use macvim and all you need to know is i and escape to make it behave "normal"
- sergiotapia 14y ago>are productivity killers Don't state this as if it were fact. They're productivity killer for you. Because you have been using Vim for so long. A person who is balls deep familiar with Sublime Text 2 or Visual Studio will be just as fast due to experience.
- mdwrigh2 14y ago> A person who is balls deep familiar with Sublime Text 2 or Visual Studio will be just as fast due to experience. I wouldn't state this as if it were fact either. The biggest gain for me is the ability to quickly and easily script my text editor to do tasks for me. Sublime Text 2 has a macro system, but it looks neither quick nor easy to write scripts for. Visual Studio looks like it no longer supports macros as of VS2012.
- gknoy 14y agoHowever, there's a huge leap in productivity between having an editor whose keybinds you know (and can use without a mouse), and one which you have extended with extensive macros. That's like the difference between an out-of-the-box Emacs and SLIME. Your Vim setup is awesome, but for a newbie to vim like me, it'll take a long time before I'm more productive using it -- not only would I need to internalize the keybinds and text processing tools, but I would also then have to start adding custom scripts and stuff, in order to do other things. (run unit tests, evaluate a block of code in an interpreter, etc)
- mtoddh 14y agoOne of the first reasons I ever heard for learning either vi or emacs was that they were the only editors that were basically prevalent everywhere, regardless what flavor of unix you found yourself on. Not so much because of how powerful they were.
- robert_nsu 14y agoUsing vim helped me write better (or smarter) regular expressions. I tell people starting out with vim to stick with it and it will help them in the long run.
- slmbrhrt 14y agoI'm finding more and more often that the best way to teach someone about a feature of their own favorite text editor is to threaten to walk them through doing it in vim. Magically, they've found the plugin or option before I can make it back to their desk with my solution.
- deleted 14y ago[deleted]
- japhyr 14y agoI teach high school math and science and once a year I teach a programming class, which currently focuses on Python. I then mentor a few students who are interested in following up on the class on their own. My preferred editor is emacs, but there is no way I'd try to have people use emacs in their first programming class. We are using Ubuntu computers, and I am currently having students work in Geany. Are there any other suggestions for editors on ubuntu machines, that are friendly to new programmers?
- telemachos 14y agoIf you want to teach someone a command line editor (that's an if, but at some point it will be useful - at the very least as a backup), then nano or pico (pico is often - maybe always - a symlink to nano) is a good idea. It would be unpleasant to edit in nano/pico full time (no syntax highlighting or indentation help, etc.), but if you have to do something through ssh and emacs or vim are still too much, they get the job done. What makes them new-user-friendly is that they keep a "menu" of basic commands visible at the bottom of the screen. So you can always see how to save, quit, etc. For GUI editors, Gedit and Kate were pretty popular for (K)ubuntu and other Debian derivatives.
- sergiotapia 14y agoI agree with learning or at least being a bit familiar with nano. It's probably the best way to edit a small one-off file via SSH. Imagine you want to quickly change a directory path in httpd.conf, instead of downloading the file, editing and then uploading it via FTP - just nano that sumbitch and you're done. I learn how to use it in about 30 minutes. That's really all it takes to get the basics down.
- bazzargh 14y agoI would disagree that that's the easiest way. C-x C-f /ssh:user@host:/path/to/httpd.conf ... and I have it open in my local emacs, with my own settings, with colour and indenting, and no lag when I'm editing. (this is called tramp mode) And if I then typed M-x eshell, I'd have a shell at the directory where I opened that file, and the nano users would start shouting 'burn the witch!'. Other editors also support remote editing over ssh - no need to download/upload, the editor takes care of that for you. Working this way, I don't even have to trust that the remote server has nano or emacs or whatever - which it often doesn't.
- matthuggins 14y agoI've been coding since I was 12 (I'm now 30), and it's what I do day-in and day-out. I consider myself to be a pretty solid programmer (Ruby being my primary language for the past 3+ years), and I prefer IDEs like TextMate and RubyMine. IDEs like VIM have too steep of a learning curve when you're trying to just get some work done, and I can do anything (at least anything that I've ever needed to do) with my IDE of choice than I can do with vim.
- jodrellblank 14y agoWould you please clarify if you have learned vim or not?
- killface 14y agoThat's a trick question. You never learn vim. You just suck less at it as time goes by.
- albemuth 14y agoNo way of not sounding pedantic but neither TextMate nor Vim are IDEs.
- matthuggins 14y agoTouché, you're technically correct. (The best kind of correct.)
- tkahn6 14y agoLearning emacs or vim is worth it if only just so you can use it in a tmux/screen session.
- BruceIV 14y agoAgreed. And, not to start the great text editor holy war, but some variant of vi will be pre-installed on almost any *NIX system (although it's been replaced by nano in a lot of newer Linux distros)
- shanelja 14y agoIt might just be me, but personally I don't understand what is so bad about plain old Notepad. Everythng I've ever coded (except when at work where I'm forced to use others) has been done on Notepad (or, if I'm feeling in the mood to have some colours on the screen, Notepad++) and I've never had any issues. Why spend so long worrying about your IDE of choice when they are all effectively glorified text editors? edit: I'm glad that my comment provoked such a fantastic discussion
- agscala 14y agoThere's nothing wrong with using notepad, but you can be significantly more productive with other editors
- shanelja 14y agoReally? You honestly believe that? Will it make me type faster and think faster? I spent 6 months working in a doctors office were I had to type every word spoken for 7 hours a day, the block here is not my efficiency, it is in fact my intelligence.
- gavinlynch 14y ago"Will it make me type faster and think faster?" No, but syntax highlighting greatly enhances code readability and your brains ability to recognize what types of objects or properties or functions are being represented in code. Associating the color blue with a variable declaration, for example, is just there as a visual cue or shortcut for your brain. I understand your point that it can be done perfectly fine with notepad, but let's not pretend that these visual cues don't give your brain a jump-start.
- shanelja 14y agoOh, I agree, the syntax highlighting does help when I'm reading back through it, but in the act of actually coding I find it a distraction, I prefer not to look while I code and the colours draw my eyes.
- habitue 14y agoI feel like emacs is being unfairly lumped in with vim as "one of those powerful editors that are a million years old". The difficulty he is describing here applies to vim/vi only (modal text editing). With emacs the default setup has menus, typing inserts text into the document. You can do file->save. It is newbie friendly because you can learn bits and pieces of the powerful stuff as you go
- pestaa 14y agoTo be fair, gVim adds relatively the same features, file/save, etc.
- gavinlynch 14y agoI would definitely not call emacs "newbie friendly"
- xyzzyz 14y agoThis is only partially true, as Emacs still has very nonstandard default key bindings. I feel that if Emacs developers enabled more standard bindings by default (i.e. cua-mode, C-o for opening files, C-s for saving, etc), Emacs could win _a lot_ of new users, because, well, it wouldn't be much different than gedit in terms of basic usage. Traditional key bindings could be enabled by a single line in ~/.emacs .
- snogglethorpe 14y agoMaybe, but it would also cause complete havoc, because the "standard GUI" keybindings conflict with enormous swathes of Emacs standard keybindings (remember, some of them conflict with Emacs key prefixes...), and Emacs has a lot of keybindings. Once you've started to move stuff around, the conflicts cascade, and there's simply no easy way to recover, especially as many keybindings are made in 3rd-party packages, over which there's little control. Given that there's actually a rather small number of "standard GUI" keybindings, it actually seems much more tractable to simply ask people to relearn those. It simply isn't a huge burden compared to the alternative... The sort of people who would be completely loathe to relearn the few "standard GUI" bindings will probably use the mouse/menus instead anyway (and I've observed many newbies happily using Emacs without ever touching the keyboard except when entering text!).
- DanielBMarkham 14y agoMixed feelings about this. I think there is another skill, somewhat related to programming, that we need to teach before programming: text slicing and dicing. The entire point of a programmable powerful editor is to apply text transforms more quickly than you could with click and type. If that's important, then we should teach it first. I personally believe it is important because of the huge productivity multiplier it gives programmers.
- Shorel 14y agoNow I'm thinking about Bart Simpson writing the 30+ sentences in the blackboard in one go, by using 30+ input cursors in parallel.
- evoxed 14y agoRelated: I think perhaps the most valuable aspect of teaching beginners how to use vim/emacs (in a basic sense at least) is that it isn't necessarily just for programming. You can "practice" with just about everything you write, and if you stick with it become even more efficient in all your other work outside of programming. I started writing almost all of my letters and essays in vim because it's so much faster and in one environment that I can modify to my own needs.
- esrauch 14y agoWhat kind of settings do you use when in letter-writing-mode? I feel like vim is fairly useless to me for anything that isn't 80 (or 100) character max line based, which isn't how I write letters at all. If I autowrap then its a giant pain to reflow the text (maybe there's an easy way to do that), and if I don't then simple navigation is a giant pain.
- plorkyeran 14y agogq rewraps the current selection.
- evoxed 14y ago:set tw=80 :set wm=4 (wrap margin) Or :help gq to see plorkyeran's suggestion.
- jeffehobbs 14y agoStrongly agree. Also: nano.