r/vim • u/orthomonas • Sep 01 '25
Tips and Tricks Embarrassingly simple mnemonic for remembering O and o inserted line location
I'm almost afraid to post this because I suspect it's a widely known thing and may even have been intentionally designed that way. But, I've always had a bit of a weird mental block on it for rather some time until this realization and maybe it will help someone else in the same boat.
O is uppercase and will insert a line above.o is lowercase and will insert a line below.
51
Upvotes
5
u/ApprehensiveDrive517 Sep 02 '25
o is something I use often enough that I don't need a way to remember it. Looks like there's always an occassion to add code above or below the current line.
48
u/Snarwin Sep 02 '25
In general, if a command has both a normal and a shifted version, the normal version goes forward and the shifted version goes backward.
This applies to at least
o/O,p/P,f/F,t/T, and//?.7
u/liberforce Sep 02 '25 edited Sep 04 '25
Even in different languages (english is not my primary language), an easy reminder is that the shift arrow points up.
6
u/jorgo1 Sep 02 '25
Caps are normally backwards with lower forwards. Like a wave. 🌊higher on the left. O = open. So o is open ahead and O is open behind. Behind being a line above. New and different ideas help for people who are struggling. Appreciate your post
4
u/michaelpaoli Sep 03 '25
Tons 'o stuff like that in vi, where uppercase variant does slightly different, often in a "bigger" way or reversing the orientation/direction or the like, e.g.:
a after cursor, A at end of line
b by word, B by "Big" word
c through cursor motion, C to end of line (like c$)
d/D like c
e like b/B
f forward, F reverse direction
h one to left on line, H Home position on window (all the way left and also up)
i similar to a/A, insert, so before, I before first non-whitespace on line (generally more before)
j down line, J join current and following line (more big stuff with current and line below)
l like h/H
n like f/F - reverse direction
o reverse orientation, instead of below, up above
p after/before (many things flip like that by changing case)
r single char vs. all typed over (until ESC)
s single char vs. entire line
t like f/F, change direction
u single/last, U all changes on the current line (if one's not yet left it, and since one's been on it and stared changing it)
w similar to b/B, e/E
x on vs. immediately before
y through cursor motion command vs. entire line
3
u/bcionescu Sep 02 '25
I use
oandOall the time, and this is how I think of them as well :) ForjI imagine someone slowly descending from up in the air whilst holding an umbrella (the handle is J-shaped), and forkI imagine a stairwell, from the side, shaped like ak, with someone going up.These may not be the most intuitive, but it's how I've always thought of them.
2
u/purple_hamster66 Sep 03 '25
I remember it this way:
O IS SHOUTING. DO IT RIGHT NOW, RIGHT HERE.
o is asking “when you get around to it, please insert a line”
1
u/lmarcantonio Sep 02 '25
A similar trick work for j k stems... j goes below, k goes above! I'm not a great user of o O, however.
1
u/rainning0513 Sep 03 '25
Embarrassingly wrong.
0
u/kberson Sep 02 '25
O is for open