24
Aug 28 '19
I do not recommend beginners (or anyone else for that matter) to use this.
Trying to use vim like notepad by translating things into copy-paste commands is confusing and kind of pointless.
People should instead learn about registers, and vim language, i.e. operator + (object / movement). Trying to memorize this cheatsheet without understanding the core philosophy is just making things more complicated than they need to be.
19
7
u/benoliver999 Aug 28 '19
The more I think about it, the more I think that the cut/copy/paste features are what make me so quick in vim.
2
u/Skaarj Aug 28 '19
So, gp is new for me. However, to me it seems the same as p followed by move right. Is there a special case that I am missing where gp does something special/useful?
2
Aug 28 '19
Pasting with p cursor stay static (it doesn't change position). Pasting with gp or gP, cursor is moved to the end of the text you pasted.
3
u/Skaarj Aug 28 '19
Pasting with p cursor stay static (it doesn't change position).
That is not true. I just tried with (even with
vim -u NONE) and my cursor is on the last character of the end of the text I pasted withp.2
u/Probotect0r Aug 28 '19
gp is useful for when you are pasting lines, instead of just words. When pasting lines (say after using yy), your cursor stays in the same spot.
1
u/Botskiitto Aug 28 '19
Can confirm, also I don't really see a use case for the gp but please someone prove us wrong.
10
u/crajun gave up on vim Aug 28 '19
‘]p’ to paste and auto indent is something I use several times a day.
5
u/Reasintper Aug 28 '19
also, for the command line:
:. <-- . is current line
:.,+3 <-- plus the next 3 lines
:.,+3y <-- yank them :)
from the : you can also do m=move and t=copy so
:.t0 <-- copy the current line to the 0th position in the buffer
:.m$ <-- move the current line to the last line of the buffer
maybe this is off topic, but seemed related to me
1
u/meathead_joe Nov 08 '25
late reply, but I couldn't remember this command for anything. Thanks so much!
4
u/Reasintper Aug 28 '19
Vim "can" use the clipboard by adding
set clipboard=unnamedplus,unnamed
To the end of my .vimrc file I can simply use things like ggyG or yy and move to another application and sh-insert or ctrl-v to my heart's content :) Or just as well, I can copy a block of text from this webpage with the mouse or ctrl-c and move over to vim and use p or shift-insert.
5
u/hangulsve Aug 28 '19
I don't know if every command has a "sentence" to remember it by, but for example "yiw" can be memorised with/means "yank inner word".
5
Aug 28 '19
[removed] — view removed comment
7
u/hangulsve Aug 28 '19
Yeah it's like if you know the parts you can assemble what you want to do.
I want to y: yank, d: delete, c: change, etc.
Where? i: in, a: around, etc.
What? w: word, (: parentheses, ": quotes, [: curly-brackets, etc.
2
2
u/gderti Aug 28 '19
Has anyone else asked?? Will there be/is there some Reddit way to group these, to me, WONDERFUL cheatsheets and see them all or reference them all together? Everyone has shown me some nuance that I've missed or forget. They're the perfect set of help, as far as I'm concerned...
Thank you.
4
u/starship-unicorn Aug 28 '19
OP has said they plan to post a consolidated document once they have worked their way through the series.
2
u/christian-mann nnoremap ; : Aug 28 '19
Search "you don't grok vi stackoverflow" and then come back and see the simplicity here
3
u/BloodyNobody Aug 28 '19
Vim doesn't put text on clipboard, but in registers.
Gvim, on the otherhand, has a clipboard register: +
To copy to it, enter
:"+y6
u/Chessifer Aug 28 '19
Vim also has those registers (:"+y and :"*y)
0
Aug 28 '19 edited Aug 28 '19
Because I tend to use the clipboard register pretty frequently, I remapped "*y and "*p to ;;y and ;;p. Much easier to type ;)
It does interfere a little with ; to go to the next instance of f/F/t/T<char>, so maybe others may want to choose a different key. (it doesn't stop ; from working, but introduces a slight lag)
I typically use / or ? for searching, so it doesn't bother me too much.
0
u/graywh Aug 28 '19
only if it's actually gvim (generally)
2
Aug 28 '19
All it requires is that your Vim is compiled with
+clipboard(IIRC), which is the case for the Vim that comes with many GVim packages1
2
1
1
u/mlopes neovim Aug 29 '19
You can also start your copy command with ”+ to yank to clipboard, as long as your vim is compiled with clipboard support.
1
Aug 29 '19
Something that I have been trying to find for a long time. Is there a way to delete lines/blocks/motions without modifying the registers?
1
u/ultrablastTTV Jun 18 '25
Вообще комменты не читайтей тут одни душнилы. Для работы при ребейзе самое то
1
u/javajunkie314 Aug 28 '19
For some reason I'd never considered %y. I've always used ggVGy. So thanks for that.
68
u/ceplma Aug 28 '19 edited Aug 28 '19
I have doubts about this approach. You try to translate vim to the more common Copy/Cut/Paste operations, but I am afraid the result is that both reader is confused and vim looks silly (because it looks ridiculously complicated). I would rather teach new users about objects and movements, which I think is a way more important thing about vim than whole hjkl (I still use arrow keys quite frequently and I don’t think there is anything wrong with it).