|
|
|
|
|
by unoti
5650 days ago
|
|
> The only thing I really miss from Emacs is being able to "Ctrl-K" 3 times and pressing "Ctrl-Y" once to move 3 lines. With Vim you have to count the number of lines ahead of the operation, which is a real speedbump. I agree this is a big problem, and here are 2 ways I combat this in vi. One way to combat this: Use } and {. These cursor controls in vi move to the next blank line. If you structure your source code such that you have paragraphs sections or blank lines between major operations, this works very well. Arguably, good code should have a brief comment explaining what or why something is happening, followed by somewhere between 1 and 8 lines that do the work. If your code follows this style, then the } and { keys in vi navigate that code ultra quickly. Say you've got 2 paragraphs that now need to go into an if statement, you press 2}>> and it just indented those lines for you, without you having to count how many lines it was. Another way to combat the problem of counting lines is with named markers. Go to the first line and press mk. This creates mark k. Go to the end of the section you're interested in, and do something like >'k. This indents the code starting from point k down to where you're at. |
|