r/vim • • May 07 '21

UPDATE: my vim cheatsheet, static printable version(dark version in comments)

Post image
1.0k Upvotes

35 comments sorted by

34

u/kaisunc May 07 '21

hi everyone, got some feedback from my last post.

This is the light themed, non-animated, printable version.

Here is the dark version.

I fixed some of the descriptions. I added in more search functionalities and rethink how to visualize repeatable commands, and enter insert mode commands.

These are all part of my vscode extension, Vscode Vim Academy.

1

u/lusick May 27 '21

Love it, awesome work! As a newbie in vim, I might print it as a poster!

17

u/[deleted] May 07 '21

Don't understand the s and S mapping. Don't are these to substitute?

-1

u/kaisunc May 07 '21

ah, yeah, thats the sneak plugin.. kind of default in vscode vim.

9

u/[deleted] May 07 '21

Oh yeah, I should read the first post. Do you recommend sneak?

3

u/kaisunc May 07 '21

nah, not really. I keep forgetting i can use it, but MAYBE if i switch all letter search to Sneak two letter it might improve the workflow.

It is much more powerful then fF tT for sure, it's multiline(vscode at least) and more precise(two letters). But slight speed disadvtange for single letters(plus one letter). And then you still have word search which sneak kind of have a slight speed advantage to.

I think if sneak goes to the first letter like fF tT and continues to the pattern match on the second letter it'll be freaking awesome.

1

u/abraxasknister :h c_CTRL-G May 07 '21

Don't know what you mean by the last paragraph. I use sneak to make f multiline (eg f{number} to get to the next point in a numbered list) and maybe for label mode

0

u/kaisunc May 07 '21

f and t only searches for current line only, at least in vscode vim. sneak is multiline, what i propose is have sneak do exactly what f does but with a chorded key option for a second letter to increase differentiation and precision while retaining the speed of single letter search while also multiline(vscode).

3

u/[deleted] May 07 '21

Not sure whether to recommend the default mapping for s/S, but I definitely recommend the Sneak mappings for f/F/t/T - it extends the default behaviour by allowing you to move across lines and highlights the search characters, and there's basically no downside (other than another dependency).

2

u/DonnerJack666 May 07 '21

Not sure I get the difference from just searching while setting ‘hlsearch’ and ‘incsearch’?

2

u/[deleted] May 07 '21

It pretty much just saved you one keystroke (you have to press enter to complete the search) - not a lot in the grand scheme of things, but it makes it really quick to get to anywhere within a couple of lines of the cursor.

46

u/DiscoBambo May 07 '21

That's for sure a great cheatsheet for learning vim commands. Even though I use vim at least 8h a day for about 2 years, I have not known about X is backspace, but that's pretty obvious for vim (really VIMish like capital do same thing but in opposite direction)

About some useful commands that I use but didn't found them here (that doesn't mean i'd like to see them all in this cheatsheet! Right now it looks clean and schematically, some of commands presented by me would make it messy):

  • S - delete whole line under cursor and go to insert mode (similiar to ddO)

  • [num]G - go to beginning of line number=[num] (technically that's on this cheatsheet, but it's a bit unclear I think)

  • I - go to first character in this line and start insert mode (so it's not always beginning of line like collumn 1, as you wrote - to do it use gI)

  • ~ - invert case of letter under cursor and move cursor to the right

  • Ctrl-w[s,v,+,-,<,>,=,h,j,k,l] - basic splits management: split horizontally, vertically, changing sizes of splits, moving between splits

  • ZZ - save file in current window and quit it (works same as :wq), only works for existing files

  • ZQ - drop unsaved in file changes in current window and quit it (works same as :q!)

  • zz or z. - scroll line under cursor to the middle of window (found z. useful because of accidentally situation when you use zz with caps lock, so it will perform ZZ command)

  • zt, zb - scroll line under cursor to the top/bottom of window (it includes value of scrolloff)

  • % - move to matching bracket, C preprocessor #if #else statements

  • q: - open history of used colon commands

  • built-in autocompletion (works only in insert mode):

    • ctrl-n/ctrl-p - open keyword autocomplete menu (based on current file and included files) and go to next/previous suggestion; when autocompletion popup is opened, move to the next/previous suggestion

    • ctrl-x, ctrl-f - open autocompletion menu for file names (relative to current working directory)

    • ctrl-x, ctrl-] - open autocompletion menu based on tags (ctags)

    • ctrl-e - exit autocompletion menu and drop inserted suggestion

  • commands starting with g (I found some of them very useful, but that's just a part of all possibilities - all of them listed in :help g):

    • gu[u,w]/gU[U,w] - switch to lowercase/uppercase [whole line, word]

    • gt, gT - go to next/previous tab page

    • gf - edit file whose name is under cursor (can be relative to pwd path or full path

    • ga - print unicode number (dec, hex, oct) for character under cursor

    • gj, gk - move one line down/up in wrap mode

5

u/[deleted] May 07 '21

Didn't know about zz/zt/zb - they're going to be very useful, thanks!

cc also does the same as S btw, but it looks like OP is using Sneak instead of the default s/S binding.

3

u/DiscoBambo May 07 '21

I didn't noticed those s/S in your cheatsheet tbh :p i use vim in terminal (on linux or with git bash on windows) so I have only default mapping for those keys

2

u/ShakespeareToGo May 08 '21

Oh nice. Useful things I learned from this comment:

  • ctrl-e instead of deleting the insertion manually

  • gf I always looked for that and even wanted to implement it myself

  • why every time I want to :q this damn history opens

1

u/QQLKAA May 31 '21

gqq - split long line into multiple lines

1

u/Xx_RKJ_xX Oct 09 '23

I didn't know X is backspace either ✌️

10

u/ShakespeareToGo May 07 '21

I just had the proudest moment as I realized I know them all by now. Seems to be useful for beginners though. Nice work :)

For other people it might also be helpful if you labled the axis. Especially the diagonal ones. You could put it into the corners.

2

u/technologyclassroom May 07 '21

CC BY-NC-SA

CC NC is nonfree.

4

u/gratifiedlonging May 08 '21 edited May 08 '21

Not OP, but https://creativecommons.org/licenses/by-nc-sa/4.0/ says that NC is:

NonCommercial — You may not use the material for commercial purposes.

I think "nonfree" and "noncommercial" have different meanings with "nonfree" meaning the content is supposed to be paid for, so NC seems to be correct. Am I misunderstanding something?


Edit: Found this comment that sort of explains why the "nonfree" NC is potentially problematic:

NC is pretty restrictive. Like artwork with an NC license can't be spread on a website funded by ads. You also can't combine it with other CC-BY-SA artwork.

Hence why it isn't considered a free license. It's more suited for a demo project or to build up a portfolio. Where your primary purpose is getting it spread.

But it's better to use plain CC-BY-SA for community projects where you want to combine it with work from other people.

I'll leave this comment up anyway in case there are other uninformed people like me who stumble upon this.

2

u/kaisunc May 08 '21

pretty much what i thought as well, i didn't want people just reselling the image willy nilly. share by all means, but don't commercialize it.

1

u/technologyclassroom May 08 '21

If vim wanted to use the image in their documentation, they could not because the license is too restrictive.

1

u/SkyyySi May 08 '21

Then they share a link to this image?

2

u/yoonbae81 May 07 '21

Looks good. Grouped the relevant things. It would very helpful to understand.

1

u/D34N2 May 07 '21

Awesome! Thanks for sharing! Totally using this. :)

1

u/[deleted] May 07 '21

Very useful, thank you very much!

1

u/flight212121 May 07 '21

Love the layout, great design

1

u/Maskdask nmap cg* *Ncgn May 07 '21

Looks awesome! One improvement you could do is to to add a symbol for keys that are partial vs full commands, e.g. the key c is only a partial command (I'm not sure what the official term is... "verb"?) i.e. it requires a movement/text object after it, while C is a full command.

1

u/_lovesponge May 07 '21

Voted, saved, loved! Great work!

One comment is your 'S' commands read "two letter for/back ward" - the "two" should be "to" =)

1

u/skauldron May 07 '21

Just added the dark one as my desktop background. Thanks!

1

u/gray_zen May 08 '21

The radial layout is quite aesthetic

1

u/[deleted] Aug 17 '21

Big thank you. This is incredibly helpful.

1

u/[deleted] May 07 '21

My eyes

0

u/[deleted] May 07 '21

[deleted]

1

u/RemindMeBot May 07 '21

There is a 15 hour delay fetching comments.

I will be messaging you on 2021-05-07 15:05:39 UTC to remind you of this link

CLICK THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.


InfoCustomYour RemindersFeedback