10 ms·
Why, oh why, do those nutheads use vi? (2007)
- wz1000 11y agoThe vim commandline together with the power of regexs make it very convenient to convert text from one format to another. It works something like this(https://vimeo.com/15443936 https://vimeo.com/15443936). I don't know how many hours I've saved on things like this due to vim.
- agumonkey 11y agoI learned vi allowed normal commands as part of :g/..../ matching.
- raverbashing 11y agoIt would be good if they used extended regexes, but oh well...
- jmcomets 11y agoUse \v after the first slash to turn on extended regexes. ;)
- pinzlert 11y agoI've been using Vim for about 2 years now, mostly because I can't figure out how to exit it. ;)
- pavlov 11y agoIsn't that one of the formative Unix moments for every newbie: some program throws you into vi and you have no idea how to get out. It's like getting your head stuffed into a toilet bowl at a boys' boarding school. Afterwards, you feel like part of the gang.
- archagon 11y agoBack at my first job, since it was a fairly infrequent occurrence, I would occasionally ask my boss how to get out of vim. He would laugh and enter some new convoluted command every time!
- StavrosK 11y agoWell, it does tell you how to exit if you press ctrl+c...
- maaaats 11y agoWhen I was new with SSH and everything, I managed to enter vim on my session on a server I was managing. Didn't manage to exit. So quit the SSH session and logged back in, still in vim, what to do? Well, I logged in as another user and rebooted the server. Not my proudest moment.
- hk__2 11y agoEmacs is the same: when you don’t know it you can’t guess you have to type ^X^C to exit it.
- wz1000 11y agoMost people use the X client for Emacs, so you can just close the window in most cases.
- tormeh 11y agoOh, boy, I laughed.
- deleted 11y ago[deleted]
- TazeTSchnitzel 11y agoHah, at least it's not ed. https://www.gnu.org/fun/jokes/ed.hup https://www.gnu.org/fun/jokes/ed.hup
- geocar 11y agoI liked ed because I could see what I was writing when I was done editing. I could also see what I was looking at when I opened the editor. These two things were worth the other inconveniences of ed, IMO, until I discovered automatic tiling window managers...
- tomjen3 11y agoEd is pretty useful the moment you have to search and edit some giant file that will make Emacs vomit.
- scotty79 11y agoJust close PuTTy. That's what we were doing at school.
- lqdc13 11y agoI love vim. vimscript on the other hand... Also it's gimped without addons which you very much miss when using someone else's machine. And if they happened to not have compiled with clipboard support, you're in a world of hurt.
- arianvanp 11y agoAnd that's where neovim comes in. I makes me so excited. You can write plugins in any language. which is just plain awesome. I switched to the neovim alpha in archlinux last week. Wasn't the most painless process but it worked. pacaur hung installing it so I had to makepkg the package manually and get the dependencies manually. But hey it works. The dependencies seem to change quite often as well so sometimes you end up with dangling dependencies that you don't need anymore. But apart from that, once it's installed, You won't even notice you're not using vim. + The fact that it has a fully fledged terminal emulator built in is pretty slick.
- Svenstaro 11y agoDon't you worry, I'm going to pull neovim into Arch once there has been a stable release. This should make it much simpler to install.
- weego 11y agoYes, there are definite reasons why the vi/vim editing model is just superior to any other out there Zealots trying to convert unbelievers is plain obnoxious. Your choice of editor isn't a religion so use what you use and I'll use what I use and you don't have to worry that what I'm using isn't what you are.
- ai_ja_nai 11y agoProbably it's just driven by the use cases: most vi users (probably) come from server side, where you don't have a mouse. Vi is particularly effective in those circumstances
- wz1000 11y agoVi is particularly effective because you don't have to use a mouse, even if you have one.
- dstanko 11y agoSo I suppose you're replying to this in your lynx browser?
- tyrfing 11y agoNope! With VimFx: https://addons.mozilla.org/en-US/firefox/addon/vimfx/ https://addons.mozilla.org/en-US/firefox/addon/vimfx/
- wz1000 11y agoClose but no cigar. I use Vimperator! With that, tmux, xmonad and vim I rarely if ever have to use the mouse.
- dstanko 11y agoWell good for you! I am impressed seriously! It is 2015 and arguments like "we don't need no stinking mice" are still used to defend vi. If all that effort was put into building a better shell that works with a mouse (or trackpad if you use them apples), where would we be right now?
- erokar 11y ago<esc>:q!
- Theodores 11y ago> Correct-conception #1: steep learning curve I was fortunate to learn vi by rote, in a series of lectures where there was no computer in the room. Yep, copying the likes of ':wq' from the hand-written blackboard to A4 paper, along with all of the other 'handy' commands, some of which such as 'yank' I do not use to this day. This was a whole different way of learning with the notes referred to rather than things getting 'Googled'. Was this a better way to learn vi? I don't meet so many 'vi' experts these days, if anything I feel embarrassed to be using 'vi' and associated command line tools like 'grep' when everyone else has some auto-completing high-speed IDE instead. I have to 'psr-fix' my code to make it sufficiently elegant. The problem for me is that I can do most things in 'vi' without having to hunt around for menus etc. Therefore, moving to the new is hard for me. In some ways I am like a secretary knowing 'Wordperfect' 25 years ago and unable to adapt to 'MS Word 2.0c' due to the same UI problem and convenience of known tools (Wordperfect, Vim). I also do not feel that 'vi' works well in a team, people with Mac-gui-loveliness computers just can't edit things on your computer on an ad-hoc basis, some visual editor has to be found just for them. If you are a vim person then these funny new-fangled 'gui' editors are really dangerous. It is far to easy for the document to end up with mystery 'j' characters added to the first line, ':wq!' added somewhere at the end, maybe with some randon 'ijk's' in the middle. If you are a vim person then every editor should have an 'insert' and 'normal' mode, not just 'insert'. The rest of the world doesn't see that though. With people that do use 'vim' I have noticed that everyone does things differently. Some people will regularly use a feature that you never use, to make you wonder why you don't know that trick. Life without the correct, personalised '.vimrc' file is also quite hard, however, I have found some of these that others use to be overly 'souped up', for instance the search, I really do not like the search-as-you-type option, old-school is better, where you need to press enter. So everyone finds their own dialect of 'vim'. Like car drivers, everyone thinks they are a good 'vim driver' apart from those that haven't learnt to drive. And they shouldn't. Amazing that vim is, it is a relic of former times, there are better tools with better 'UX paradigms'. In my field none of the 'programming gods' use 'vim' as they can't get to their productivity levels with it, so they use modern IDE's for their work, retaining enough 'vim' for any server side config file editing.
- mercurial 11y ago> If you are a vim person then these funny new-fangled 'gui' editors are really dangerous. It is far to easy for the document to end up with mystery 'j' characters added to the first line, ':wq!' added somewhere at the end, maybe with some randon 'ijk's' in the middle. If you are a vim person then every editor should have an 'insert' and 'normal' mode, not just 'insert'. The rest of the world doesn't see that though. Turns that many of these (including IDEs like Visual Studio or Eclipse) have add-ons or built-in modes which emulate a useful subset of vim's behaviour. > Life without the correct, personalised '.vimrc' file is also quite hard Is it? For server-side work, I have a "light" vimrc of a few lines with sensible settings (status bar, nohidden, expandtab, this kind of thing). It is trivial to recreate if I don't have a copy. I have a longer vimrc and quite a few add-ons, but it's for more specialized work, not really anything I need for editing a remote configuration file. > In my field none of the 'programming gods' use 'vim' as they can't get to their productivity levels with it, so they use modern IDE's for their work, retaining enough 'vim' for any server side config file editing. In a large part, it depends on the language you use. Nobody sensible would work on a mid-size Java project in vim.
- bootload 11y agoVi vs Emacs again? "No, they are not dinosaurs who don't want to catch up with the times - the community of vi users just keeps growing: myself, I only got started 2 years ago" Using batch to write FORTRAN, the editor was a card punch. On the Deck-writers (teletype) and VT100 terminals, I used to write Pascal, Ed was the only choice. Early Linux use forced your hand, Ed (again? NO) or Vi. This is because Emacs is a 30Mb download and where space was a premium. [0] Try using anything but Vi or Ed with Busybox. [1] So I stick to Vi(m). I can use any cli editor but with much time and effort in Vi usage why change? I can but why? [0] esr, "A Tale of Five Editors", http://catb.org/~esr/writings/taoup/html/ch13s02.html http://catb.org/~esr/writings/taoup/html/ch13s02.html [1] grep "emacs" here ~ http://www.busybox.net/downloads/BusyBox.html http://www.busybox.net/downloads/BusyBox.html
- father_of_two 11y agoI started using vi in the 90s and got very used to it. It's still my standard text editor (the nvi implementation, that is). I've never grasped vim. It was too slow at the time and the extended command set consumed all the free keys I use to have available to do my own macros (eg: 'q' 'g'). I reckon vim grew to be much more than an editor, it is now an editing plataform, capable of so many things, and contains lots of shortcuts / builtins for common text-editing situations. The article above contains many vim-only commands. For example 'di>' ("delete inner angle-block") doesn't exist on standard vi, neither the '>aB' ("indent a Block").
- geocar 11y agovim is very slow; "classic" vi, and more reasonable clones like nvi are much faster and that seems completely wrong to me. It also has terrible defaults (like kindergarden-useless syntax highlighting which only make it slower!). I have hopes that neovim will sort some of that out -- it makes a certain amount of sense that vim is slow because of some baggage it carries, but I'll admit they aren't very high hopes: I've been using emacs recently. How funny is that? That I use emacs because vim is too slow!
- cturner 11y agoHaha. When I first this, I thought your problems might be from editing large files with syntax highlighting switched on. Or doing PHP or JSP, which I've found to struggle in the past. But then I saw the username. Indeed, if you're writing lots of code with hardly any newlines (like k lang), you will probably have performance issues with vim. > It also has terrible defaults This can vary from distribution-to-distribution. Certainly the default debian setup comes with annoyingly intrusive defaults, some of them used to have an impact on speed. Three settings you probably want in your $HOME/.vimrc on debian: filetype indent off filetype plugin off filetype plugin indent off [this might be obsolete - that config is more than a decade old]
- xixixao 11y agoFor the article: If you try to argue for superiority, you should probably check the alternatives first and give an example where your preferred choice is obviously superior - the example of adding an empty body to each method is a great example where Sublime with multiple cursors beats vim (sure you can get them in vim to, but it doesn't show vim being superior). For vim itself: I have seen friends trying to learn it. I have seen PhDs and postdocs use it. I have seen coworkers use it. The only people who I could see were editing text as fast as friends/PhDs/coworkers using Sublime were my tech leads. The smartest most proficient and effective programmers I have ever met. Everyone else was slower, at times wrestled with the editor (by this I mean that they executed commands and had to redo them because they didn't do what they wanted). I guess the conclusion is that people can learn to use vim as proficiently as Sublime, but most will fail or it will take them years (and I mean 5 or 10 years). Actually, two of my tech leads, when I showed them some trick in Sublime were like: I should look into this. Maybe I'll just boldly argue that vim is inferior after all :).
- jostylr 11y agoI started with Textmate, liked it, but then the community lost interest. I followed them to Sublime. I never got comfortable with Sublime though it is hard to recollect why. I just kept getting frustrated with it. Then people started talking about Sublime 3, Atom, and all that editor hotness. I wanted something stable, something I could learn once and be comfortable with it being around for a long time. I had tried Emacs years ago and found it unpleasant, to say the least. I looked into Vim. It became very addictive but it does take a bit of time to learn. I love the action followed by motion idea. I found the built in tutorial decent as well as Painless Vim to be a decent starting point: https://leanpub.com/painless_vim https://leanpub.com/painless_vim About a year into my Vim conversion, I get around decently and love doing the editing stuff. But I do feel that I need to go over tricks and tips again.
- pinkunicorn 11y agoI basically started learning Vim because.. well it was a hipster thing. The first two years, I really did not know how to actually learn it. All I would do is enter insert mode, move around with arrows and ":wq". But then after 6 months, I started with basic commands, like "55gg" to move to the 55th line etc, "G" to the last line and "gg" to the first line. Then came buffers, I started opening multiple files and started using minibufexplorer(my entry point into plugins). This went on for another 6 months. Next came actions and boy oh boy, I became the hipster vim user in college. While editing CSV files(like deleting all instances of a particular row having text "abc"), I used Vim instead of awk/sed just because I wanted to learn more. Fast forward a year, I call myself a basic vimmer and superior to others at my workplace by just knowing search, moving around, actions, buffers, a cool autocomplete plugin and other plugins here and there. Throughout the learning process one thing I observed was that, its just not enough to read about a cool article about Vim and leave it there. I would keep repeating the sequence of actions mentioned in the article atleast ten times every day and would find some usage for it during programming. I would intentionally force myself to use it, until at some point, the action I just learnt magically comes in as a replacement for a dumb action I was about to do. At that point I would know I've mastered it.
- p0nce 11y agoI'm still stuck in the first step because I have simply no interest in learning vim. I only know a small subset of commands. No I feel a bit like missing out.
- jqm 11y agoI'm guessing a small subset of commands is about all that many productive Vim users know. You don't have to know everything to make good use of the tool.
- TazeTSchnitzel 11y agoFor me, vim didn't have a steep learning curve. I've barely scratched the surface of its command set and basically know very little of it, but I didn't need it to be incredible, just better than TextMate.
- daemonk 11y agoI mainly use vi for working remotely on a server. It's just easier than using X or something. But I use sublime or some other graphical editor when I am on my own computer.
- AlexeyBrin 11y agoYou can use Sublime to do remote editing if you wish.
- jsmeaton 11y agoI'll bite. What's the best way of doing this?
- linktohack 11y agormate with rsub FTW
- AlexeyBrin 11y agoPersonally I use Sublime with rmate https://github.com/textmate/rmate https://github.com/textmate/rmate (works with TextMate and Sublime), but there are alternatives like sftp http://wbond.net/sublime_packages/sftp http://wbond.net/sublime_packages/sftp
- scotty79 11y agoI wonder if you could bind mouse gestures to vim normal mode commands and use left hand for typing stuff and right hand to do magic.
- fit2rule 11y agoI've been a vi user for 25 or so years, and I really only know a few commands - how to search/replace, repeat last operation, search for the thing under the cursor, yank/paste, #[cmd], block mode, set mouse=a, and so on. In that capacity I have supported myself as a software developer, productively, with much satisfaction in my selection of editing tool. So I'm often quite delighted at learning new things with it, even still! And to be frank, I think this is one of the things I most like about vim - even though I've been using it for years, there are still undiscovered treats yet to be revealed to me, over and over. When I discovered cscope integration, some 10 years ago, it was like getting an OS upgrade .. in my editor! :)
- bsaul 11y agofunny how people pay attention to how fast it is to change a piece of text in a editor. Most of my time programming is spent on a piece of paper or a whiteboard designing my data structures and algorithms. Actual typing , especially with an ide providing auto completion, is the thing that takes me the least amount of time, by far.
- toxik 11y agoI don't believe that to be true, and I have never met a developer who thought that to be true. Sketches and diagrams can design a large system, but at the end of the day, unless you're a systems architect or something, you're going to have to get your hands dirty.
- edejong 11y agoThe best and lowest-maintenance pieces of code our team has written were carefully designed and thought out before a line of code was written. I'd say 20% of the actual work was coding, 30%/30% for design and testing and 10%/10% for requirements analysis and deployment. However, often we know that we don't know how to properly design something and we start implementing too early. The end result is sth like: 50% coding, 30% testing and the rest is squeezed into testing, deployment and requirements analysis.
- bsaul 11y agoStarting on a paper instead of coding directly is really the key to the best quality software i've done. Funilly i realized that very early at university, where i had to perform a code exercice while on holidays, but forgot to take my computer with my me. I did it on paper, then typed it when coming back home, and got the best grade.
- nothrabannosir 11y agoEven if that is true, we remain human and annoyance is not typically subject to reason. When I'm typing in Visual Studio and I find myself spending a second moving the cursor from the top of the screen to the middle, it's a second that breaks my train of thought. Ugh, now I'm thinking about this editor. Instead of typing M and continuing with what I was doing. I can imagine it to be a little like holding a speech with a stutter. Sure, most of your time is spent on prep. That doesn't make the pauses less annoying when you're actually talking. But I don't stutter, so maybe that's ridiculous.
- rekoros 11y agoI once worked at a company where I had to use Visual Studio. Now I can't believe I cared that much about it, but I basically refused to write code without vi. ViEmu saved the day, it was absolute magic. I also really wanted vi bindings for navigation in team chat (isn't it the most obvious thing ever?), so that's how we made it work in Kato (https://kato.im/articles/en/power-users/keyboard-control https://kato.im/articles/en/power-users/keyboard-control)
- Illniyar 11y agoFrankly I find vim an hindrance to the type of projects I work on. One of the most common things I use an IDE for is navigation (between files) and vim is not very good at it compared to IDEs, here's why: * no tabs * no project structure * in my IDE (eclipse based or intellij based) I can ctrl-click a class/object/other to navigate into that object's definition * in my IDE I can search for classnames, I can press ctrl-T to find who inherits from something, ctrl-alt-H to find who uses something etc... when I find myself actually writing code, it's usually a line or two in each of several files (because modern programming paradigms tell us we should split code as much as possible), or modifying some copy pasted snippet I found on google - so navigation is extremely important even when editing. beyond that, there are simply some things that help writing code that a text editor cannot do: * auto-complete(with annotation to tell you what the function variables are) * debug inside your IDE * run code-lint, auto-build on typing to detect errors, etc... * auto refactor (I.E. extract method, move variable, extract class etc...) * format all your files according to your pre-specified project guideline. * sharing you IDE configuration with other contributors * showing when files are/aren't in version control and integrating version control so that you view history in your IDE. There are probably projects out there where a full-featured text editor is a real game-changer and is worth the days/weeks it'll take to use it intuitively, but I never worked or know anyone who worked on such a project (even when I started projects from scratch);
- wz1000 11y agoMost if not all of of these can be achieved using plugins. Some are present by default. > no tabs It does have tabs, they're just called buffers instead(there is something called "tabs" too, but they're not what you expect tabs to be) > sharing you IDE configuration with other contributors Sharing your vim configuration is as simple as sharing your .vimrc
- Illniyar 11y agoI think the major benefit I derive from what I mentioned is the constant visual cues and the immediate availability. With buffers (unless I'm missing something) you need to type a command to list all your 'tabs' and another command to get to the tab in question. Project structure is similar - it's always visible, and you can always see what other files are close by. I don't think that can be achieved with plugins, though I never knew there were plugins until now. Do people who use vim regularly install plugins for it?
- thomasahle 11y agoAdmittedly I haven't been using vim more than a few months, but I wonder why all the move commands are based on text structures, such as lines, spaces etc. Wouldn't it be more useful to have commands for going to expressions, blocks, scopes and other code level structures? I see vim people suggesting always leaving blank lines around functions, so you may use paragraph shortcuts to move them around. Why?
- mattmanser 11y agoBecause then it has to know what all those things are, and to know it has to parse and even compile the code. Basically a whole load of effort which isn't transferrable between languages.
- thomasahle 11y agoSurely the implementation effort can't be the reason. For an editor so focused on efficiency..
- Anthony-G 11y agoSome users also use Vim for editing plain English. I compose most of my emails in Vim and am currently (re-)acquainting myself with Mutt to avoid switching back and forth between GUI windows -- though maybe I just have a masochistic streak.
- thomasahle 11y agoThat makes somewhat sense, though it does feel like coding takes up 95% of vim usage demonstrated in blog posts.
- gargarplex 11y agoI was exposed to vi 15 years ago but not until recently have I decided to get better at it. This article was great and helped a lot. It's a fun skill to improve.
- joezydeco 11y agoEmbedded developer here. A lot of times I need to edit a file on the target and I can easily put vi on the target system through busybox. Having the same editor on both sides is a nice thing.
- deleted 11y ago[deleted]
- Anthony-G 11y agoAs a long-time vi/Vim user, I thought this article provides an excellent explanation for non-vi/Vim users for the reasons why enthusiasts choose to use such an old and unusual (for those coming from a GUI background) editor. In particular, the author emphasises that you leave Insert mode as soon as you've stopped typing. When I first started using Vim, I used to spend too much time in Insert mode while moving around using the arrow keys. What I learned from the article: If you're not positioned on a parenthesis, the `%` command will “scan character by character to the right, until the first one is found, and then moving to the character matching that one”. Until now, I’d always been using one of the `f`, `;`, `T` family of commands to move to a parenthesis or equivalent character. This will be a real time saver.