39 lines
2.3 KiB
Markdown
39 lines
2.3 KiB
Markdown
![](/../images/2017-12-02/a.png)
|
|
<time datetime="2018-02-23">2018-02-23</time>
|
|
|
|
This is a dangerous thing to claim, but in regards to using vim... there isn't actually that much to learn.
|
|
|
|
It's easy to jump to the beginning or end of words, sentences, inside parenthesis or the entire document.
|
|
|
|
Second, coding is often mostly about editing, and boy (*copyrighted mouse whiste*) does Vim make that easy.
|
|
|
|
Cut everything inside a deliminator? easy. Cut the next two lines? You didn't even have time to blink. Change a word? Double easy.
|
|
|
|
The problem is that normal actions are a bother for a first timer: Search for a word? Press _forward slash_. Go to the next word? Press lower case n. Previous? Capital N. Save/Quit the document? Oof, that's a little different. Open another file while inside Vim? Difficult __and__ write the fucking path yourself, you lazy millenial. Or install a plugin. Fucking plugins. It's insane to ask that as the first thing to do, but you will god damn need some plugins.
|
|
|
|
Really, most introductions and guides make it sound like Vim is this huge task to overcome, when really, it can be summarized to just a few smart commands:
|
|
|
|
---
|
|
|
|
* [c]hange [i]nside [deliminator]/[w]ord
|
|
* [c]hange [a] [deliminator]/[w]ord
|
|
|
|
Can be used to delete a word, sentence, everything inside a method, or perhaps a string value. They're mostly the same command. Pressing _ciw_ or _ci"_ or _ca{_ might sound difficult, but seriously, think about how often you ned to select, cut or delete something inside a string or curly brace when you code?
|
|
|
|
---
|
|
|
|
* {number} [d]elete [d]elete
|
|
* {number} [y]ank [y]ank
|
|
|
|
Respectively cuts or copies a number of lines. Without number, it's just the current line. Can be pasted. This is the simplest command. Pressing _2dd_ or simply _dd_ and then p somewhere else to paste, is such a delicious way to move stuff around in code. Did you need that line to come before that one? _dd_, *move cursor up* and p. Done. And yes I know simply pressing _ctrl c_ or _ctrl x_ in Sublime Text cuts the copies or cuts the current line, but this. is. better.
|
|
|
|
---
|
|
|
|
* [p]aste
|
|
|
|
Pastes the last cut/copy below current line. Using capital [P], you paste above current line.
|
|
|
|
---
|
|
|
|
Of course there is more to Vim, but these are really the most important tools. I use them _a fucking lot_ when working.
|