10 ms·
Getting started with vim
- MichaelGG 10y agoVim keybindings are amazing. Easiest way to think of it is to think of how frustrating it is watching someone do everything with a mouse, not knowing any shortcuts. Clicking File -> Exit instead of the window's X. Or deleting a whole line of text just to change one word. Not knowing Ctrl-X/C/V. That's how I feel when I work with someone editing text files without Vim. Once again I'll recommend Vim Adventures[1]. It's fun enough even my 8-yr-old daughter wanted to play/learn. You learn a few keys at a time; no big deal. Meanwhile, install Vim emulation in your current text editor. Slowly you'll learn keys. Your desire for knowledge will increase, and you'll start picking up the ideas mentioned in the article. Within a few months you'll be flying and wonder how you ever coded without it. The key is making it a natural thing, not forcing yourself to "learn Vim". At least for me, those approaches failed due to the short-term productivity decrease. 1: https://vim-adventures.com/ https://vim-adventures.com/
- koolba 10y agoWhoa that's seriously fun! This makes vimtutor look like pong.
- colbyh 10y agoabsolutely agreed on vim-adventures. I generally play the game once a year or so out of pure enjoyment as well as a way to remind myself of all the areas where I'm getting lazy or relying too much on a plugin!
- crowbahr 10y agoMy 1 gripe with vim adventures is the whole subscription based model for a game. I went ahead and shelled out for the full thing but after 6 months I was no longer allowed access because my subscription had expired. That's some bullshit.
- pmoriarty 10y agoDon't you miss the days when you could just buy software once for a reasonable price and own it forever?
- crowbahr 10y agoEven though my development role means I do SAAS yes, yes I do miss owning software forever.
- MichaelGG 10y agoYeah I'm not in love with that part. But... It's still worth it.
- crowbahr 10y agoI hate that part... but I learned vim...
- sharmi 10y agoShortcut Foo's vim dojos are also a good way to learn all the shortcuts in vim once you have got the basics down (opening and closing files, insert mode etc) Each dojo trains you on a few related set of vim actions. Practice one dojo at a time and try to use it during your regular editing. Once you have incorporated it into your existing workflow, move to the next dojo. https://www.shortcutfoo.com/app/dojos/vim https://www.shortcutfoo.com/app/dojos/vim
- melling 10y agoModal keybindings seem to be the most efficient way to work in an editor. Xah Lee created one for emacs. Has anyone given it a try? http://ergoemacs.org/misc/ergoemacs_vi_mode.html http://ergoemacs.org/misc/ergoemacs_vi_mode.html https://github.com/xahlee/xah-fly-keys https://github.com/xahlee/xah-fly-keys
- exDM69 10y agoMy advice: don't go wild with plugins or vimrc hacks. Get sensible.vim for sensible defaults and work with that. Vanilla vim is good enough for most editing and coding needs.
- JupiterMoon 10y agoMy retort. Install YouCompleteMe because if you don't have high quality auto-complete your editor will feel rubbish compared to an IDE and you will end up moving.
- RandomInteger4 10y agoIs autocomplete really necessary though?
- joatmon-snoo 10y agoYES. Oh GOD yes. Some of the worst D'oh moments I've had came from before I added tab completion to my .vimrc, because it almost completely eliminated errors that my typos introduced.
- jasonkostempski 10y agoDo you have any suggestions about how it may not be, or are you just pondering the idea? I really want there to be something that has the benefits without the Intellisense-level overhead, I haven't seen it though.
- Normal_gaussian 10y agoI find autocomplete annoying. I also suspect autocomplete to be the leading cause of a particular set of subtle bugs - ones where the words on the page seem right but the function chosen has a surprising and uncatered for side affect. When you reinforce to people that it is OK to code blindly ahead, grasping for the right calls at the last second you will end up with poorer quality code (although, it may be typed faster).
- jimnotgym 10y agoFor someone mostly playing with Python, and using Atom, what is the great step forward that editors like Vim and Emacs offer? I read things like this occasionally and still don't really get why? Why is the learning curve worth it?
- beachstartup 10y agospeed and efficiency. some people don't care about those things, some people do.
- jimnotgym 10y agoExactly the kind of thing I have read. But nothing explaining how it achieves that So it has keyboard shortcuts, and I guess I could add those to another editor... Is it one of those things you just have to take someones word for it, have a go with it and see?
- thomasahle 10y agoYou can get vim-shortcuts for other editors. I really like using those in Intellij for example. One thing I have noticed however is, that once you are good at the vim keyboard shortcut "language" (as someone described it above), you tend to use other features in the editor a lot less. And if you don't use the features, you might as well just use vim neat.
- beachstartup 10y agoin your editor, without leaving the keyboard, how would you search-and-replace using a 2-variable regex, only between lines 275 and 1305, and then turn every instance of 'TEST_' into a lowercase, but only on the lines that didn't match?
- pyoung 10y agoHow often do you find yourself doing operations like this? I feel like it would take me more time to formulate and confirm that your set of commands are correct than it would for me to just ctrl+f to each instance and then ctrl-v the ones that needed to be changed. Don't get me wrong, I think it is really cool that you can do this, but it feels like this requires a level of fu that is beyond most typical programmers.
- atsaloli 10y agoI'm looking forward to teaching a Vim class in Seattle next month. https://www.casitconf.org/casitconf17/tutorials/ https://www.casitconf.org/casitconf17/tutorials/ I've got some resources for learning Vim on http://www.verticalsysadmin.com/vi.htm http://www.verticalsysadmin.com/vi.htm
- danidiaz 10y agoVim itself comes with a user manual, besides the command reference. :h user-manual Another site with good general advice is https://www.vi-improved.org/ https://www.vi-improved.org/
- whatupmd 10y agoThank you for writing this great summary. Just last week I was was trying to compile such a list as a 'novice' user and this has everything I had bookmarked and much more. My focus was on portability, I switch systems alot, I don't know how practical carrying all these plugins around is but have not given vundle a try yet. I have to say that working with VIM feels like a weekly/monthly epiphany's. I will discover something new that can be incorporated into my workflow and can't believe what I'd been missing all along.
- vertex-four 10y agoIf vim doesn't click for you, I'd really suggest trying kakoune. It swaps vim's behaviour around - where vim commands are "verb-object", kakoune's default behaviour is to allow you to select things, and perform an action on them once you know what you're operating on. Movement is precisely equivalent to selection - w is "select the next word", W is "expand the selection across the next word". The visual feedback makes it easier to pick up (for me), and also makes building up complicated sequences of actions very easy. Multi-selection ties into that as well - a common workflow for me when editing is to select an object (a-a or a-i), split it by some regex into multiple selections (s), then perform my changes on those selections.
- nathcd 10y agoI've had a really easy and enjoyable transition from vim to kakoune in the last month or so. The only thing I'm bothered by is the lack of text wrapping.[1] I've also started playing with VSCode and have found it great as well. It's the first time in a number of years I've played with anything other than vim. [1] https://github.com/mawww/kakoune/issues/484 https://github.com/mawww/kakoune/issues/484
- thetic 10y agoThis sounds like visual mode.
- majewsky 10y agoI saw Kakoune last week on HN and think about giving it a shot. Can you comment on how extensible it is? Are there extensions available, and can I write my own?
- vertex-four 10y agoI've not played much with extending it past writing a couple of hooks. It has a decent enough hook system. What would you like to try and replicate in it?
- joncp 10y agoIf you're in the Visual Studio ecosystem, I enthusiasically recommend ViEmu. It let's you learn the vi keystrokes a little bit at a time, all the while being able to fall back to the VS keys when you don't know how to do something the vim way. It really flattens out the learning curve tremendously.
- chestervonwinch 10y agoI like this quote: > Vim is a small language for editing text that ships with a small user interface. Pardon my ignorance, but are the two separable? Could someone write a GUI interface that uses the vim text editing language underneath? I know of gvim, but this seems to be just vim with a menu bar.
- mrkgnao 10y agoThere are plenty of Vim emulator plugins for "GUI editors" like Atom (or even the Visual Studio family, as a comment in this thread mentions) that do just that!
- falcolas 10y agoSadly, most do it poorly. There's a lot more to Vim than 'hjklia'.
- chestervonwinch 10y agoYes, I've used them in emacs, atom, etc. They're useful, but often feel unnatural. I was looking for something that was built from the ground up specifically as "vim editing with a nice interface" -- maybe this is neovim, as someone else suggested.
- johnchristopher 10y agoNope, VIM the UX (keys and movement) and VIM the application are not separated at the moment. It would be great to be able to use VIM key movement as drop-in replacement for any text field OS wide but the VIM interface (the command line) plays an important role in the UI and I don't see how it could be swept aside without losing some VIM core functionality: EG how do you :%s///gi without the overlay command line ?
- majewsky 10y agoI actually have a design document from 5 years ago lying around in my backup that outlines a desktop shell based on (and expanding on) vim's UX. I should get back to that project one day.
- sayelt 10y agoAt work nobody understands why I use Vim, I'm tired of having to explain myself to my coworkers and hearing all the time "Why don't you just switch to Atom?"
- threatofrain 10y agoI have trouble understanding Vim as well. It seems to be good at code editing, where I find that I'm not bottlenecked there. I'm bottlenecked at my ability to plan and think about programs. Once I have either a plan or comprehension of a program, I move at lightspeed, and typing becomes a small proportion of software production time. When editing an unknown codebase, it becomes even more imperative to have comprehension + plan before making an edit. Also, since its my ability to comprehend and plan that is so strained, I'm not sympathetic to Vim's lack of anything like intellisense, or cross-file grammar and type awareness + autocomplete.
- 2muchcoffeeman 10y agoExactly why I use vim bindings in Intellj. Typing may be a small part, but there's no reason not to make that part efficient.
- deleted 10y ago[deleted]
- maouida 10y agoI started to used VIM seriously last month. My biggest concern so far is editing new files. Too much switching between INSERT and NORMAL modes. This is not a problem when editing existing files. Also I think some keyboard shortcuts are not comfortable on an AZERTY keyboard layout.
- johnchristopher 10y ago> Also I think some keyboard shortcuts are not comfortable on an AZERTY keyboard layout. Agreed. That's why I switched to the US international layout. Took me only one week to train my fingers. And it's not that hard when I have to use someone else's computer (somehow I didn't forget the azerty layout :D).
- d0vs 10y agoHave you remapped Caps lock to Escape yet?
- u801e 10y agoI just use ctrl-[ to go back to normal mode. I actually do use the CAPS LOCK key for typing in all caps on occasion, so I would rather not remap it.
- astrobe_ 10y agoOne trick is to postpone the correction of a typo for instance until you're done with your current editing. And there's also plenty of ways to switch between modes: i,I, o, O, a, A, and ^o and ^d (insert mode) which are occasionally handy. Also people often duplicate Esc to the "jk" combination. I personally use ^L instead, but for no particular reason. On AZERTY keyboards, the nastiest shortcut for me is ^[ ("jump to tag", which is ctrl-AltGr-5). I simply remapped it to F2. A second one is ` (backtick, altGr-7), which I remapped to ' (tick). I did not move tick somewhere else, it wasn't useful enough to me to bother doing it. See :map and :noremap for how to do these things.
- maxboisvert 10y agoFor an easy start, use a sane defaults plugin like sensible.vim [1] or vim-simple-defaults [2] (more opiniated). Also, use vim-plug [3] with few plugin like ctrlp, nerdtree, nerdcommenter and vim-simple-complete [4].) [1] https://github.com/tpope/vim-sensible https://github.com/tpope/vim-sensible [2] https://github.com/maxboisvert/vim-simple-defaults https://github.com/maxboisvert/vim-simple-defaults [3] https://github.com/junegunn/vim-plug https://github.com/junegunn/vim-plug [4] https://github.com/maxboisvert/vim-simple-complete https://github.com/maxboisvert/vim-simple-complete I am the author of [2] and [4].