{"id":18610987,"url":"https://github.com/beangreen247/vim-cheat-sheet","last_synced_at":"2026-04-16T18:07:52.446Z","repository":{"id":153757239,"uuid":"227336326","full_name":"BeanGreen247/Vim-Cheat-Sheet","owner":"BeanGreen247","description":"A cheat sheet for Vim","archived":false,"fork":false,"pushed_at":"2019-12-29T12:20:43.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-03-02T02:19:19.966Z","etag":null,"topics":["arch","beangreen247","board","bsd","cheat","key","linux","marks","master","opensource","sheet","ubuntu","vim"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BeanGreen247.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-11T10:17:06.000Z","updated_at":"2023-09-21T13:02:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"f69b1556-4a9c-4098-a8bd-e90036710a46","html_url":"https://github.com/BeanGreen247/Vim-Cheat-Sheet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BeanGreen247/Vim-Cheat-Sheet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeanGreen247%2FVim-Cheat-Sheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeanGreen247%2FVim-Cheat-Sheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeanGreen247%2FVim-Cheat-Sheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeanGreen247%2FVim-Cheat-Sheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BeanGreen247","download_url":"https://codeload.github.com/BeanGreen247/Vim-Cheat-Sheet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeanGreen247%2FVim-Cheat-Sheet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31897927,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T17:33:00.867Z","status":"ssl_error","status_checked_at":"2026-04-16T17:32:57.401Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arch","beangreen247","board","bsd","cheat","key","linux","marks","master","opensource","sheet","ubuntu","vim"],"created_at":"2024-11-07T03:12:19.524Z","updated_at":"2026-04-16T18:07:52.421Z","avatar_url":"https://github.com/BeanGreen247.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vim Cheat Sheet\r\n## Global\r\n```\r\n:help keyword - open help for keyword     \r\n:saveas file - save file as\r\n:close - close current pane\r\nK - open man page for word under the cursor\r\n```\r\n\r\n## Cursor movement \r\n```\r\nh - move cursor left\r\nj - move cursor down\r\nk - move cursor up\r\nl - move cursor right\r\nH - move to top of screen\r\nM - move to middle of screen\r\nL - move to bottom of screen\r\nw - jump forwards to the start of a word\r\nW - jump forwards to the start of a word (words can contain punctuation)\r\ne - jump forwards to the end of a word\r\nE - jump forwards to the end of a word (words can contain punctuation)\r\nb - jump backwards to the start of a word\r\nB - jump backwards to the start of a word (words can contain punctuation)\r\n% - move to matching character (default supported pairs: '()', '{}', '[]' - use \u003ccode\u003e:h matchpairs\u003c/code\u003e in vim for more info)\r\n0 - jump to the start of the line\r\n^ - jump to the first non-blank character of the line\r\n$ - jump to the end of the line\r\ng_ - jump to the last non-blank character of the line\r\ngg - go to the first line of the document\r\nG - go to the last line of the document\r\n5G - go to line 5\r\nfx - jump to next occurrence of character x\r\ntx - jump to before next occurrence of character x\r\nFx - jump to previous occurence of character x\r\nTx - jump to after previous occurence of character x\r\n; - repeat previous f, t, F or T movement\r\n, - repeat previous f, t, F or T movement, backwards\r\n} - jump to next paragraph (or function/block, when editing code)\r\n{ - jump to previous paragraph (or function/block, when editing code)\r\nzz - center cursor on screen\r\nCtrl + e - move screen down one line (without moving cursor)\r\nCtrl + y - move screen up one line (without moving cursor)\r\nCtrl + b - move back one full screen\r\nCtrl + f - move forward one full screen\r\nCtrl + d - move forward 1/2 a screen\r\nCtrl + u - move back 1/2 a screen\r\n**Tip**\r\nPrefix a cursor movement command with a number to repeat it. For example, 4j moves down 4 lines.\r\n```\r\n  \r\n## Insert mode - inserting/appending text\r\n```\r\ni - insert before the cursor\r\nI - insert at the beginning of the line\r\na - insert (append) after the cursor\r\nA - insert (append) at the end of the line\r\no - append (open) a new line below the current line\r\nO - append (open) a new line above the current line\r\nea - insert (append) at the end of the word\r\nEsc - exit insert mode\r\n```\r\n\r\n## Editing     \r\n```            \r\nr - replace a single character\r\nJ - join line below to the current one with one space in between\r\ngJ - join line below to the current one without space in between\r\ngwip - reflow paragraph\r\ncc - change (replace) entire line\r\nC - change (replace) to the end of the line\r\nc$ - change (replace) to the end of the line\r\nciw - change (replace) entire word\r\ncw - change (replace) to the end of the word\r\ns - delete character and substitute text\r\nS - delete line and substitute text (same as cc)\r\nxp - transpose two letters (delete and paste)\r\nu - undo\r\nCtrl + r - redo\r\n. - repeat last command\r\n```\r\n\r\n## Marking text (visual mode)\r\n```\r\nv - start visual mode, mark lines, then do a command (like y-yank)\r\nV - start linewise visual mode\r\no - move to other end of marked area\r\nCtrl + v - start visual block mode\r\nO - move to other corner of block\r\naw - mark a word\r\nab - a block with ()\r\naB - a block with {}\r\nib - inner block with ()\r\niB - inner block with {}\r\nEsc - exit visual mode\r\n```\r\n\r\n## Visual commands\r\n```\r\n\u0026gt; - shift text right\r\n\u0026lt; - shift text left\r\ny - yank (copy) marked text\r\nd - delete marked text\r\n~ - switch case\r\n```\r\n\r\n## Registers\r\n```\r\n:reg - show registers content\r\n\"xy - yank into register x\r\n\"xp - paste contents of register x\r\n**Tip** Registers are being stored in ~/.viminfo, and will be loaded again on next restart of vim.\r\n**Tip** Register 0 contains always the value of the last yank command.\r\n```\r\n\r\n## Marks\r\n```\r\n:marks - list of marks\r\nma - set current position for mark A\r\n`a - jump to position of mark A\r\ny`a - yank text to position of mark A\r\n```\r\n\r\n## Macros\r\n```\r\nqa - record macro a\r\nq - stop recording macro\r\n@a - run macro a\r\n@@ - rerun last run macro\r\n```\r\n\r\n## Cut and paste\r\n```\r\nyy - yank (copy) a line\r\n2yy - yank (copy) 2 lines\r\nyw - yank (copy) the characters of the word from the cursor position to the start of the next word\r\ny$ - yank (copy) to end of line\r\np - put (paste) the clipboard after cursor\r\nP - put (paste) before cursor\r\ndd - delete (cut) a line\r\n2dd - delete (cut) 2 lines\r\ndw - delete (cut) the characters of the word from the cursor position to the start of the next word\r\nD - delete (cut) to the end of the line\r\nd$ - delete (cut) to the end of the line\r\nx - delete (cut) character\r\n```\r\n\r\n## Exiting\r\n```\r\n:w - write (save) the file, but don't exit\r\n:w !sudo tee % - write out the current file using sudo\r\n:wq or :x or ZZ - write (save) and quit\r\n:q - quit (fails if there are unsaved changes)\r\n:q! or ZQ - quit and throw away unsaved changes\r\n:wqa - write (save) and quit on all tabs\r\n```\r\n\r\n## Search and replace\r\n```\r\n/pattern - search for pattern\r\n?pattern - search backward for pattern\r\n\\vpattern - 'very magic' pattern: non-alphanumeric characters are interpreted as special regex symbols (no escaping needed)\r\nn - repeat search in same direction\r\nN - repeat search in opposite direction\r\n:%s/old/new/g - searchAndReplace.commands .colonPercentForwardSlashOldForwardSlashNewForwardSlashg\r\n:%s/old/new/gc - searchAndReplace.commands .colonPercentForwardSlashOldForwardSlashNewForwardSlashgc\r\n:noh - remove highlighting of search matches\r\n```\r\n\r\n## Search in multiple files\r\n```\r\n:vimgrep /pattern/ {`{file}`} - search for pattern in multiple files\r\n:vimgrep /foo/ **/*\r\n:cn - jump to the next match\r\n:cp - jump to the previous match\r\n:copen - open a window containing the list of matches\r\n```\r\n\r\n## Working with multiple files\r\n```\r\n:e file - edit a file in a new buffer\r\n:bnext or :bn -\r\ngo to the next buffer\r\n:bprev or :bp -\r\ngo to the previous buffer\r\n:bd - delete a buffer (close a file)\r\n:ls - list all open buffers\r\n:sp file - open a file in a new buffer and split window\r\n:vsp file - open a file in a new buffer and vertically split window\r\nCtrl + ws - split window\r\nCtrl + ww - switch windows\r\nCtrl + wq - quit a window\r\nCtrl + wv - split window vertically\r\nCtrl + wh - move cursor to the left window (vertical split)\r\nCtrl + wl - move cursor to the right window (vertical split)\r\nCtrl + wj - move cursor to the window below (horizontal split)\r\nCtrl + wk - move cursor to the window above (horizontal split)\r\n```\r\n\r\n## Tabs\r\n```\r\n:tabnew or :tabnew {page.words.file} - open a file in a new tab\r\nCtrl + wT - move the current split window into its own tab\r\ngt or :tabnext or :tabn - move to the next tab\r\ngT or :tabprev or :tabp - move to the previous tab\r\n#gt - move to tab number #\r\n:tabmove # - move current tab to the #th position (indexed from 0)\r\n:tabclose or :tabc - close the current tab and all its windows\r\n:tabonly or :tabo - close all tabs except for the current one\r\n:tabdo command - run the \u003ccode\u003ecommand\u003c/code\u003e on all tabs (e.g. \u003ccode\u003e:tabdo q\u003c/code\u003e - closes all opened tabs)\r\n```    ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeangreen247%2Fvim-cheat-sheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeangreen247%2Fvim-cheat-sheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeangreen247%2Fvim-cheat-sheet/lists"}