Interactive Vim tutorial
71–80 of 230 posts
Re: Interactive Vim tutorial
#72Went through the tutorial, but I still don't think I really get why so many people seem to like Vim so much. The only thing there I noticed which was new to me from a functionality standpoint was the repeated commands feature. Anyone have some better examples of things you can do with Vim that make it worth learning over a GUI-based editor like Atom?
ci( - Change inside parentheses ci" ci' ci}
If your cursor is anywhere inside a set of parentheses, (if, while, for, function call, aka this happens a lot) and you need to change everything inside the parentheses, just type ci( and it deletes everything inside the parens and puts you in insert mode so you can start typing. Guess what ci" and ci' do? How often do you need to rewrite a string? This is huge.
dd - Delete line
Deletes the whole line with a quick double tap of a home row key. So much faster than highlighting the whole line with the mouse and hitting backspace twice, or hitting home, shift+ctrl end, backspace backspace. Want to delete 3 lines? 3dd.
A
Move to the end of the current line and start typing. Super simple and nice to have.
w
Move to the beginning of the next word. Way more ergonomic than ctrl+right arrow.
yyp
Copy the current line and paste it below the current line. Super simple, super fast.
Those are the commands that make Vim matter to me. Once you put in the time to make them muscle memory, you'll never look back. There are of course tons of other commands, but I can say that those are the ones that changed how editing text feels to me.
Re: Interactive Vim tutorial
#73A little off-topic, but if you like working in Vim, try using cVim[1] for Chrome. It really makes your browsing experience a lot faster, especially if you're on a laptop. [1] https://chrome.google.com/webstore/detail/cvim/ihlenndgcmojh...
The most disappointing thing about using an extension for this is when I open dev tools or a tab fails to load. I love luakit because the browser itself lets you set up vim like commands. Unfortunately I had to give up trying to build it for macOS
Re: Interactive Vim tutorial
#74Alternatively, don't try to hurry enlightenment. First, learn :q! Next h,j,k,l Then i and ESC Finally :w Now you know vim. Don't let people tell you you're using too many keystrokes. Are you still reaching for the mouse? If not, you're using vim just fine. Most of the good stuff in vim, you'll learn accidentally, because you're in normal mode when you think you're in insert mode, or because you have caps lock on in n…
Re: Interactive Vim tutorial
#75Alternatively, don't try to hurry enlightenment. First, learn :q! Next h,j,k,l Then i and ESC Finally :w Now you know vim. Don't let people tell you you're using too many keystrokes. Are you still reaching for the mouse? If not, you're using vim just fine. Most of the good stuff in vim, you'll learn accidentally, because you're in normal mode when you think you're in insert mode, or because you have caps lock on in n…
Re: Interactive Vim tutorial
#76Not to be that that guy but I’m gonna go ahead and plug spacemacs here. Using it in Vim (EVIL) mode I found it to be basically like vim navigationally speaking, plus they have a built completer for commands and you can even get help with commands in real time using ? And just start typing. Not a knock against Vim just something I found to be very beginner friendly
nnoremap h j Is this possible yet in their elisp config?
(define-key evil-normal-state-map "h" 'evil-next-line)
into your dotspacemacs/user-config.Re: Interactive Vim tutorial
#77I've tried learning VIM a few times and always gave up, and feel like my editors shortcuts cover most cases anyway. There's also not that many times where I feel like coding speed is required. Honestly curious how much more productive you guys feel after learning VIM.
Re: Interactive Vim tutorial
#78Went through the tutorial, but I still don't think I really get why so many people seem to like Vim so much. The only thing there I noticed which was new to me from a functionality standpoint was the repeated commands feature. Anyone have some better examples of things you can do with Vim that make it worth learning over a GUI-based editor like Atom?
1. The main benefit of vim or any editor is not some fancy feature like macros or visual block editing. Although vim has those and they are great, they only become useful in about 20% of situations. When coding, you spend much more time reading code than writing it. That's why vim has you in Normal mode most of the time, where you can't type at all, and the whole keyboard becomes a tool for navigating. Reaching for the mouse incurs an unconscious mental cost that affects the way you read and write code. Editor ergonomics do impact your codebase.
2. Vim's ratio of power to learning difficulty is the best out there, because once you learn one word of vim's "language", you can combine it with every other word you know and it will behave how you expect.
3. I never try to convince people to switch to the actual vim editor because it requires a ton of customization just to be usable, and overall it's not that great. It's filled with cruft and weird things like a custom scripting language. The only important part is the key bindings, and you can get those in any modern editor. I use about 4 different editors and IDEs on 3 platforms on a daily basis. I never had to learn all their crappy keyboard shortcuts because they all have vim key bindings.
Re: Interactive Vim tutorial
#79Honestly though, is it even worth learning? I've tried learning VIM a few times and always gave up, and feel like my editors shortcuts cover most cases anyway. There's also not that many times where I feel like coding speed is required. Honestly curious how much more productive you guys feel after learning VIM.
Re: Interactive Vim tutorial
#80Honestly though, is it even worth learning? I've tried learning VIM a few times and always gave up, and feel like my editors shortcuts cover most cases anyway. There's also not that many times where I feel like coding speed is required. Honestly curious how much more productive you guys feel after learning VIM.
I use it constantly when configuring Linux machines, which is only an ancillary part of my job, just for the regex search to find the line I want to tweak. Since servers don't generally offer a GUI, it's the simplest way to replicate that feature.