I'm thinking about a feature which I think would improve my workflow a lot. I don't know if it already exists..
The feature is about moving the cursor vertically over code blocks without losing its horizontal position in a speedy way. I would regard it as a more convenient alternative for { and }. Or you could say it would be the vertical equivalent for w/e and b.
What I really don't like about { and } is that I lose the horizontal position of the cursor.
The behavior of the feature for moving the cursor should be like this:
- Move the cursor up/down to the next line that is preceded or followed by an empty line. (ignore white spaces)
- Don't lose the horizontal position of the cursor. If the line is shorter put the cursor on the last position of that line, but remember the position it came from. Even if you hit j or k afterwards the cursor should maintain its initial horizontal position. (same behavior as j/k)
Example for moving down: (moving up behaves the same, just in the other direction.)
X0
indicates the initial position.
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAA[X0]AAAAAAA
AAAAAAAAAAAAA
AAAAAAAAA[X1]
BBBBBBBBBBB[X2]BBBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBBBBB
BBBBBBBBBBB[X3]BBBBBBBB
CCCCCCCCCCC[X4]CCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCC[X5]
If I hit k on the last line it would go back to position 11, right under X4
.
Do you know of such a feature or do you know how I could create it?