12 ms·
Why Vi Rocks
- munk-a 7y agoThere appears to be a small issue with this article, it seems to have confused vi with the widely favored editor nano. It might be good for an editor to fix this omission as I'm sure it was in error. /s
- veryworried 7y agoNo mention of vim or neovim?
- deleted 7y ago[deleted]
- omaranto 7y agoHalf of it is "Why standard unix utilities rock".
- cwbrandsma 7y agoI’ve learned some vi, and emacs, Visual Studio, VS Code, XCode, IntelliJ, and Android Studio. All the examples listed are pretty uncommon or trivial in any of the other IDEs (aside from the regex part, which is cool, but I never want to be in a place where I have to regex my code...ever). 90% of the time I’m doing simple code maintenance, with an occasional refactoring. And I know devs that swear by vi...they are developing any faster than I am, and I touch my mouse about as much as they do (hardly ever). My favorite is still Visual Studio with Resharper, worst is XCode.
- depressed 7y agoSearching with regexes is more likely to be useful when trolling through log or data files than code. Even then, the most common cases for me are searching for a string only at the beginning or ending of a line, or only searching for instances that are not part of a larger word.
- joevandyk 7y agoI search for /def.*partial_name/ frequently when I can’t quite remember what a method is called in Ruby.
- thethirdone 7y ago> but I never want to be in a place where I have to regex my code...ever). I use regex search and replace fairly often; why are you so opposed to it? If I need to change $t1 into t1 in a group of 6 lines (something I did today), its pretty easy to just make that replacement automatically. Doing it by hand would just take longer. > ... with an occasional refactoring That's exactly what I use the feature for.
- mypalmike 7y agoIn a refactoring IDE, you never risk overmatching or under-scoping. You just rename the syntactic object and it's renamed exactly where it needs to be, including possibly on the filesystem and in git.
- thethirdone 7y agoImportantly, you don't get that safety in comments or strings. The nice thing about replacing via vim is that you can restrict it to a selected block which also gives you a type of safety. Particularly for the situation I used replacement today, an IDE couldn't make it better and doing it only on a range was helpful.
- mypalmike 7y agoFair enough. An IDE will generally present you with matching strings on a project level and let you select which ones to change. But if you know where to look, replace within selection seems useful. Apparently IntelliJ supports that, but I've never thought to use it.
- tacomplain 7y agoFirst, I also had trouble with XCode. About the regex in vi: there is a technique of writing/maintaining code based on substitutions instead of inserting/deleting. It can be very powerful but you have to "write" your code thinking about the patterns and maintaining some kind of structure. I am not saying that it is good or recommended. It's interesting. I coded for like 5 years like that. I was maintaining a codebase completely solo. When working with a not very synchronized team or having tools like resharp or omnisharp etc avaliable, I don't think it would pay off.
- brandonmenc 7y agoAt any rate, it's a good thing that literally every single IDE can do search and replace with regexes.
- org3432 7y ago> And I know devs that swear by vi...they are developing any faster than I am I hear about this from time to time, but have never seen it people do it successfully first hand, what I do see is silly mistakes in their checkins; incomplete variable renames, formatting is off, syntax errors, switching between browsers and their code while looking at manuals, or other obvious mistakes that can be caught inline by IDEs while you type.
- nouveaux 7y agoI see the same thing from people using vscode. Its safe to say that those who know their tools well will be more productive than those who do not.
- org3432 7y agoI think VS Code has the same issues I see it with that too, I haven't noticed it as much with VisualStudio and JetBrains' IDEs. Agree completely on knowing how to use your tools, it's like a carpenter showing up for work with a rusty hand saw and thinking they're going to make a house with it.
- colordrops 7y agoHmm, I've got syntax/compile checking, linting, automatic code formatting and generation, and code completion based on context in vim right now. I don't see how any of the problems you mention are vim specific.
- org3432 7y agoWhat packages are you using and what language out of curiosity?
- colordrops 7y agoC++ and JavaScript. I've got about 60 plugins installed and a highly configured vimrc. Some of the important ones: w0rp/ale junegun/fzf junegun/fzf.vim majutsushi/tagbar scrooloose/nerdtree jistr/vim-nerdtree-tabs erahhal/nerdtree-ack tpope/vim-commentary joegesualdo/jsdoc.vim Raimondi/delimitMate tpope/vim-surround vim-scripts/AutoComplPop Shougo/deoplete.nvim carlitux/deoplete-ternjs marijnh/tern_for_vim Rip-Rip/clang_complete SirVer/ultisnips tpope/vim-fugitive mhinz/vim-signify vim-scripts/DirDiff.vim sheerun/vim-polyglot pangloss/vim-javascript vim-utils/vim-man
- billfruit 7y agoI am writing this from emacs experience (some if not all these features are in vi as well), there are features from emacs that make a real difference in writing programs especially: * Unlimited yanking from kill rings: ie pasting text from history of the clipboard.(This is one thing I have most difficulty with when switching from emacs to modern editors) * Macro recording and playback : recording an arbitrary set of edit operations and then replaying them any number of times. * two or more code frames/windows side by side, even displaying the same file Surprisingly modern IDE guis seems not designed for it, eclipse can do it but clumsily. * Remote file editing: use the IDE tools to edit file residing on another computer. * Column edits or rectangle edits. Selecting a vertical column or rectangle of text and copying, moving it to another place.
- max76 7y ago> some if not all these features are in vi as well I'm not sure exactly which vim features are also in vi. Vim has been a daily use tool for me since about 2007. Vim has really good Macro recording. Vim + Tmux is great for side by side code frames, and there are plugins for showing multiple buffers in one Vim instance. Remote file editing is good with SSH + Vim. Vim has multiple registries for yanking/putting. Vim has column editing functionality. Almost anything Emacs does out of the box Vim can do with either a plugin or with an external program pairing. I prefer Vim's keybindings because there are less "chords" (Ctrl-C and Ctrl-V are copy and paste chords, they requiring pressing two buttons at the same time). Too many chords causing my pinky fingers to become tired. Vimscript is a surprisingly powerful language for dealing with text data, but it's cryptic the first decade you are exposed to it. EDIT: I'm more interesting in the code people write than the way people write it, but I wanted to share some of my vim knowledge and point of view.
- byte1918 7y agoIf you're still working with VS & Resharper and your projects allow you to, have a look at Rider from JetBrains. It supports the same color scheme & hotkeys as VS + Resharper out of the box so the transition is very smooth, you'll be productive in minutes after installing it. Also, if you were using VsVim, you can use IdeaVim for Rider and in addition you can install KJump plugin (it's what easy-motion is for vim). Since setting this up, rider & webstorm have become my favorite developer tools I have ever worked with and I feel they are superior to VS & VSCode (the things I was using before).
- andrewfromx 7y agoi see people struggling, fighting with Intelli-J every day. I wish I could give them vim as a gift. All the extra stuff you think you can't possibly give up you don't need. I'm a professional text file editor. Vim is like playing the piano. I guess what I'm saying is learn to play the piano for real, and don't spend your life in a piano-player-helper IDE thing.
- mda 7y agoSure, but I bet Intellij is a bit better when it comes to debugging java applications. A good IDE beats the crap out of Vim for a lot of tasks.
- flukus 7y ago> Sure, but I bet Intellij is a bit better when it comes to debugging java applications. I don't know about intelliJ specifically, but a good debugger beats the crap off the limited interface an IDE provides to them. It looks like IntelliJ only offers basic breakpoint/step through, etc. For a quick overview of what you're missing out on checkout "Give me 15 minute and I'll change you min on GDB": https://www.youtube.com/watch?v=PorfLSr3DDI https://www.youtube.com/watch?v=PorfLSr3DDI (hopefully the right video, can't check at work)
- chimpburger 7y agoWe have this and it works very well https://github.com/JetBrains/ideavim https://github.com/JetBrains/ideavim Plain Vim does not have the semantic / refactoring capabilities of a real IDE. This plugin gives the best of both worlds.
- greysonp 7y agoVim is a fantastic text editor, but it is not an IDE replacement. Here's just a few IntelliJ features I use daily that Vim doesn't have: Go to declaration, find usages, rename method/class, change method signature, auto-import, shortcut to override method, easy-to-configure style rules, really good code completion, quick access to javadoc. I could keep going. Again, not hating on Vim. I use Vim keybindings in IntelliJ! I just don't think it's the best tool for working in large codebases.
- adrianrocamora 7y agoI've been using Neovim consistently for the last few months and it's a game-changer. Terminals within Neovim that I can paste into/from my Vimwiki files or source files is amazing. It's not very different from a Vim setup and using it with the Qt GUI on Windows gets rid if the issue of having everything close when eventually having to call <C-w>. Meanwhile, in my linux environment it runs like a charm on a terminal.
- milin 7y agoSame here neovim with session management and tmux with session management, with tmux russerect and tmux continuum. And with the language server integration in neovim, its a swiss army knife that works well with most modern languages and devops.
- colordrops 7y agoI've got resurrect and continuum installed and all they ever seem to do is load up an empty vim window that is rendered improperly. What is your setup?
- milin 7y agomostly https://github.com/tmux-plugins/tmux-resurrect/blob/master/docs/restoring_vim_and_neovim_sessions.md https://github.com/tmux-plugins/tmux-resurrect/blob/master/d....
- umvi 7y agoVim is like Dvorak. The cognitive burden for remembering which key maps to what is high unless you use it 24/7.
- joevandyk 7y agoUsing it 3/2 is probably enough...
- base698 7y agoIt's actually not that hard: The formula: number(Optional) action movement Examples: 2 dl - delete two characters right dw - delete a word yb - copy back a word y/foo - copy to the search foo 4cw - change the next four words actions: yank(copy, delete, change) movements: /(search), t(til character), f(to character), many many others (l, h, j, k, *, #, T, F) Combine as you see fit.
- nitemice 7y ago`action [number] movement` also works, and makes more sense to my brain.
- dilyevsky 7y agoI use it 4-8/5. Works out OK
- butterisgood 7y agoJust use it a perfect 5/7
- anotherevan 7y agoDoes anyone use Vim on a Dvorak keyboard?
- geowwy 7y agoI use vim with colemak.
- 7y ago
- rococode 7y agoIntelliJ with the IdeaVim plugin is my goto editor nowadays. As others have said, I honestly don't find myself using the really fancy features of vim that often. What I do use frequently are basic motions together with yanking, deletions, word movement (w/e/b), marks, indents, centering (zz), page scrolls (ctrl+u/d), and using searches (f and /) to jump around in code quickly. For those purposes, IdeaVim works just fine, and gives me all the little speed boosts of vim with the added bonus of (in my opinion) a much more robust coding environment. It even makes some functions better; for example, `gd` works super well and nearly instantly in IntelliJ since the definitions are supplied by the IDE's 'Go To Declaration' rather than some hacky vim plugin. Other editors have similarly sufficient vim plugins, e.g. VSCodeVim.
- foob 7y agoHave they fixed the issues with where the cursor ends up after certain operations? It's been a couple of years since I've used it, so I can't give an explicit example, but there were multiple common operations where the cursor would end up in a different location afterwards than it does in vim. This was really difficult for me because I still used vim a lot for other things, and it felt like it was actively eroding my muscle memory to use two conflicting implementations.
- lukecameron 7y agoI use IdeaVim at my day job and can confirm it's gotten better. There are still some rough edges, especially around handling movements like L, M, and H which don't always go where you expect them to. And some operations like undo don't play well with the vim commands such as undo. And yes, I completely agree about switching between vim and ideavim for different languages, the experience is very different and the sight differences are very noticeable.
- rococode 7y agoFor the most part it does what I want it to do. As the other responder said, undo/redo can occasionally have some issues if you mix them with the IDE's version of those. I also have problems with the tag stack and jumplist (like ctrl+i/o) having serious latency problems so I stick to marks and `` as much as I can. The last thing I have problems with is when the IDE changes your code for you during an action - for example an auto-import when you type out a new class. The repeat action tends to mess up in those cases, trying to redo both your own typing and whatever the IDE did. Again, I'm not a power user so to me these are the main issues and they're tolerable. For cursor movements I don't do anything too tricky, and all the movements I'm aware of do what I expect them to do.
- amanzi 7y ago"vi is the de facto standard Unix editor, you find it in every *NIX derived OS" I was going mention a recent article I heard about that vi was going to be removed from upcoming Ubuntu distributions, but it appears that was an April Fools joke... <insert curmudgeon grumbling here>
- bgorman 7y agoThe few times I have encountered nvi, it was just off enough from vim to give me a headache. Somehow it is worse than busybox vi, where I at least know to stick to primitive operations.
- ausjke 7y agovim for command line, pycharm for python, webstorm for web, geany for everything else that needs a GUI, works great!! used vscode for 2 years on and off, finally decided to part away two months ago and bought webstorm instead, the time spent on vscode with all the configuration and plugins and settingsync(which is not reliable) is way more expensive than webstorm's license fee(same as pycharm)
- ChuckMcM 7y agoSince I "grew up" with vi I mostly use vi when using vim, but I do appreciate syntax coloring. I find it easier to scan comments that way and pick out constants.
- asciimov 7y agoWhy do I use vi(m)? * Eclipse - Forced to use this in University in the early aughts. I would say that crashing and clobbering systems was its best feature. You moved your mouse it crashed; thought about saving crash; need an update, now you need to format and clean install windows; want to print, printing works! want to compile, your gonna need to try again after restarting windows... * SSH - In University we had some awesome terminal servers that were a joy to work with. I could access all my work from anywhere, regardless of how limited my local machine was. Vim was always there, chugging right along.