1

I am enjoying hardmode and have definitely seen improvement. However the one item I am dealing with is selecting, moving, copying only two lines at the time. Current line +1 or -1.

Before hardmode the way I would select three lines of code in visual mode would be with the motion:

V2j

Since HardMode disables the "j" key what would be a good substitute to such move?

About HardMode:

Hard Mode is a plugin which disables the arrow keys, the hjkl keys, the page up/down keys, and a handful of other keys which allow one to rely on character-wise navigation. The philosophy behind Hard Mode is that you'll never master Vim's advanced motion and search functionality if you can fall back on the anti-pattern of fumbling around your code with the arrow keys.

https://github.com/wikitopian/hardmode

Helmut Granda
  • 4,565
  • 7
  • 35
  • 51
  • Please clarify. What is "hardmode"? Can you give an example of what you are trying to do? Your description of your problem is very hard to understand. – Ben May 05 '16 at 22:44
  • Added Hardmode description and link to source – Helmut Granda May 06 '16 at 00:03
  • Just want to leave this here: https://github.com/takac/vim-hardtime. Instead of getting rid of hjkl, it throttles their use. There's nothing wrong with `V4j`, but there is with `Vjjjj` (IMO of course). – Marcus Buffett May 08 '16 at 02:57

2 Answers2

3

For me, HardMode is all about changing your mindset about how you move in vim. Really getting comfortable with text objects, searching etc.

In this case, you can just use 3V (3 <S-v>) to select 3 lines.

I'd urge you to learn some ex commands while you work in HardMode. Like use

:8,15d  " To delete lines from line no. 8 through 15
:8,15co .  "To copy range of lines 8 through 15 to current cursor position.

You can also use

:.+3  " To move down
:.-3  " To move up 3 lines

but then you'll be totally missing the point. Just use HardMode for what it's meant to be. Which is learn a few things in a constrained situation.

sudo bangbang
  • 27,127
  • 11
  • 75
  • 77
  • Thanks for the tips. I was having an issue which is what threw me off. When I was doing 1V my selection was jumping to (current line)+33 and so forth. – Helmut Granda May 06 '16 at 17:20
1

I think I see the point of hardmode now, and you got an answer for how to select multiple lines in visual mode. That answer is correct, but maybe you don't need to select at all? You mentioned copying, or moving, a few lines. For that, try using counts with your yank/delete commands. Example, to copy 5 lines:

5yy

To delete 3 lines:

3dd

Ben
  • 8,725
  • 1
  • 30
  • 48