{"id":16406475,"url":"https://github.com/wincent/vim-university","last_synced_at":"2025-04-07T16:18:58.844Z","repository":{"id":43095027,"uuid":"469681884","full_name":"wincent/vim-university","owner":"wincent","description":"A curriculum for leveling up your Vim","archived":false,"fork":false,"pushed_at":"2024-03-28T21:02:40.000Z","size":16,"stargazers_count":264,"open_issues_count":1,"forks_count":10,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-31T14:11:28.825Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/wincent.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}},"created_at":"2022-03-14T10:21:49.000Z","updated_at":"2025-02-20T14:35:03.000Z","dependencies_parsed_at":"2024-03-28T22:23:00.299Z","dependency_job_id":"d1c3a0ba-f665-442f-b865-e3718ffd9da0","html_url":"https://github.com/wincent/vim-university","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wincent%2Fvim-university","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wincent%2Fvim-university/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wincent%2Fvim-university/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wincent%2Fvim-university/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wincent","download_url":"https://codeload.github.com/wincent/vim-university/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247685628,"owners_count":20979085,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-11T06:09:53.904Z","updated_at":"2025-04-07T16:18:58.816Z","avatar_url":"https://github.com/wincent.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vim University\n\nDespite its reputation for minimalism, Vim has a surprising depth that rewards study. Here we list many of its most loved features, some tips, and a list of ideas for things to study or practice to take your Vim usage to the next level.\n\n## Where to get help\n\n- `:h` (`:help!`)\n- `:h tutor`\n\n## Laying out your workspace\n\n- Splits:\n  - `:sp`\n  - `:vs`\n  - `:on`\n  - `CTRL-W {H,J,K,L}` move window to edge.\n  - `CTRL-W r` rotate windows.\n  - `CTRL-W _` maximize current window (vertically); count to size to specific height `10 CTRL-W _`.\n  - `CTRL-W |` maximize current window (horizontally).\n  - `CTRL-W =` equalize window sizes (vertically and horizontally).\n  - `CTRL-W t` jump to topmost window.\n  - `CTRL-W b` jump to bottommost window.\n  - [Common re-mappings](https://github.com/wincent/wincent/blob/b94dafbe4caefa76305e90a37ad9342264fff5af/aspects/nvim/files/.config/nvim/plugin/mappings/normal.lua#L39-L42):\n    - `CTRL-h` → `CTRL-W h` to focus window on left.\n    - `CTRL-j` → `CTRL-W j` to focus window below.\n    - `CTRL-k` → `CTRL-W k` to focus window above.\n    - `CTRL-l` → `CTRL-W l` to focus window on right.\n- Tabs\n  - `:tabe`\n  - `CTRL-W T`\n  - `gt`/`gT` next/previous\n  - `{count}gt` jump to `{count}` indexed tab\n- tmux (Codespaces):\n  - Splits (panes)\n  - Windows\n  - Sessions\n- Foreground/backgrounding (`CTRL-Z`) vs `:terminal`\n- Folds\n  - `zm`: increase fold level (mnemonic: \"more\").\n  - `zM`: increase fold level to maximum.\n  - `zr`: reduce fold level (mnemonic: \"reduce\").\n  - `zR`: reduce fold level to minimum.\n  - `zc`: close fold, `zC` close folds recursively.\n  - `zo`: open fold, `zO` open folds recursively.\n  - `za`: toggle fold (Pro-tip™️: `\u003cTab\u003e` is a good for [mapping to this](https://github.com/wincent/wincent/blob/b94dafbe4caefa76305e90a37ad9342264fff5af/aspects/nvim/files/.config/nvim/plugin/mappings/normal.lua#L9-L10)).\n  - `zA`: toggle fold recursively.\n  - `zv`: unfold folds to view cursor line (mnemonic: \"view\").\n  - `:set foldlevelstart=1` (start with everything folded, `99` = start with nothing folded).\n  - `:set foldmethod=indent` vs `marker` (eg. [`~/.config/nvim/init.lua`](https://github.com/wincent/wincent/blob/b94dafbe4caefa76305e90a37ad9342264fff5af/aspects/nvim/files/.config/nvim/init.lua#L471)).\n\n## Navigation\n\n- Movements/motions:\n  - `H`, `L`, `M` move cursor to high, middle, low positions.\n  - `CTRL-F` forward full screen, `CTRL-B` backward full screen.\n  - `CTRL-D` down half screen, `CTRL-U` up half screen.\n  - `{`, `}` move to previous/next blank line.\n  - `gg` jump to top of buffer, `G` jump to bottom of buffer.\n  - `%` jump to matching brace.\n  - Relative line numbers:\n    - `:set number`\n    - `:set relativenumber`\n    - `{count}j`: move down `{count}` lines\n    - `{count}k`: move up `{count}` lines\n  - Absolute line numbers:\n    - `{count}G`: go to line `{count}`\n    - `:[range]`: go to line `[range]` (eg. `:50`)\n- Scrolling:\n  - `CTRL-E` scroll up by one line, `CTRL-Y` scroll down by one line (cursor stays).\n  - `zz` center current cursor line in viewport.\n  - `zt` scroll current cursor line to top of viewport.\n  - `zb` scroll current cursor line to bottom of viewport.\n- Fuzzy finders:\n  - https://github.com/nvim-telescope/telescope.nvim\n  - https://github.com/wincent/command-t\n- NvimTree: https://github.com/kyazdani42/nvim-tree.lua\n  - `\u003cLocalLeader\u003ef`: To reveal in tree.\n- vim-vinegar: https://github.com/tpope/vim-vinegar\n- vim-dirvish: https://github.com/justinmk/vim-dirvish\n- vim-projectionist: https://github.com/tpope/vim-projectionist\n  - `:A` go to alternate file\n  - `:AS` open alternate in split\n  - `:AV` open alternate in a horizontal split\n  - Sample configurations: [`~/.config/nvim/after/plugin/projectionist.lua`](https://github.com/wincent/wincent/blob/b94dafbe4caefa76305e90a37ad9342264fff5af/aspects/nvim/files/.config/nvim/after/plugin/projectionist.lua)\n- LSP-powered navigation\n  - Example project: [`~/code/masochist/next`](https://github.com/wincent/masochist/tree/next)\n  - Go-to-definition, hover, autocomplete, inline diagnostics.\n- Search-based navigation\n  - Quickfix list\n    - `:cn`\n    - `:cp`\n    - `:cnf`\n    - `:cpf`\n    - `:colder`\n    - `:cnewer`\n    - Pro-tip™️: `\u003cUp\u003e`, `\u003cDown\u003e`, `\u003cLeft\u003e`, `\u003cRight\u003e` are good for mapping to these.\n  - Location list:\n    - `:ln`\n    - `:lp`\n    - `:lnf`\n    - `:lpf`\n    - `:lolder`\n    - `:lnewer`\n  - Plug-ins:\n    - Ferret: https://github.com/wincent/ferret\n    - vcs-jump: https://github.com/wincent/vcs-jump\n- Within-file find-and-replace:\n  - `:%s/`\n  - Scalpel: https://github.com/wincent/scalpel\n- Jump list:\n  - `:jumps`\n  - `CTRL-o`, `CTRL-i`/`\u003cTab\u003e`\n  - Filewise jumplist mappings: [`~/.config/nvim/plugin/mappings/leader.lua`](https://github.com/wincent/wincent/blob/b94dafbe4caefa76305e90a37ad9342264fff5af/aspects/nvim/files/.config/nvim/plugin/mappings/leader.lua#L47-L49).\n  - Mappings to store big jumps in jump list: [`~/.config/nvim/plugin/mappings/normal.lua`](https://github.com/wincent/wincent/blob/b94dafbe4caefa76305e90a37ad9342264fff5af/aspects/nvim/files/.config/nvim/plugin/mappings/normal.lua#L56-L58)\n- `CTRL-^`: go to previous buffer (suggested mapping: `\u003cLeader\u003e\u003cLeader\u003e`).\n- `gf`: go to file under cursor.\n- `CTRL-W f`: go to file under cursor, in split.\n\n## Editor fundamentals\n\n- Motions\n  - `h`, `j`, `k`, `l` for movement\n  - `gj`, `gk` for virtual movement\n  - `w` forward to beginning of word, or `W` (WORD)\n  - `b` back to beginning of word, or `B` (WORD)\n  - `e` forward to end of word, or `E` (WORD)\n  - `ge` back to end of last word, or `gE` (WORD)\n- `f` (mnemonic: \"find\"), `F` (in reverse)\n- `t` (mnemonic: \"up to\", \"until\"), `T` (in reverse)\n- `;` repeat last `f`/`F`/`t`/`T` operation\n- `,` repeat last `f`/`F`/`t`/`T` operation, but in opposite direction\n- `.`\n- `*`, `#` + `n`/`N`\n- `/{pattern}` + `?{pattern}`\n- Composite commands:\n  - `xp`: swap two characters (really, `x`, `p`).\n  - `ggn`: go to first match in file (really, `gg` + `n`).\n  - `GN`: go to last match in file (really, `G` + `N`).\n- Common editor operations\n  - `o` open line below for editing in INSERT mode.\n  - `O` open line above for editing in INSERT mode.\n  - `A` enter INSERT mode at end of line.\n  - `I` enter INSERT mode at beginning of line.\n- Useful \"fundamental\" plugins:\n  - repeat.vim: https://github.com/tpope/vim-repeat (repeat entire mapping instead of last thing in it).\n  - surround.vim: https://github.com/tpope/vim-surround\n    - `cs{from}{to}`: change surrounds.\n    - `ds{delimiter}`: delete surrounds.\n    - `ys{motion}{delimiter}`: add surrounds (mnemonic: \"yes, surround\").\n\n## Tools\n\n- Marks\n  - `a-z` are in-file marks, `A-Z` are global marks.\n  - Special marks include:\n    - `[`: last yanked text.\n    - `\u003c`: last visual selection (`\u003e` is end of last visual selection).\n    - `^`: last place we left INSERT mode.\n    - `.`: place where last change was made.\n  - Set a mark: `:mark {mark}` (or shorter, `:k{mark}`).\n  - Go to mark \u003ccode\u003e`{mark}\u003c/code\u003e (exact position within line).\n  - Go to mark `'{mark}` (beginning of line contents).\n  - For convenience: https://github.com/kshenoy/vim-signature\n    - `m{mark}`: to toggle mark; `m,` to place next available mark.\n    - `dm{mark}`: delete a mark.\n  - Jumping between marks without naming them:\n    - `]'` next (or \u003ccode\u003e]`\u003c/code\u003e).\n    - `['` previous (or \u003ccode\u003e[`\u003c/code\u003e).\n- Registers\n  - `:di`/`:registers`\n  - `\"{register}y{motion}` and `\"{register}p` or `\"{register}P`\n- Macros\n  - Recording a macro: `q{register}` (uppercase appends).\n  - Replaying a macro: `@{register}` (`@@` repeats last replay command).\n  - Editing macros: `\"{register}p` → edit → `\"{register}yy`\n    - `\u003cCTRL-v\u003e` can be handy here for typing literal control characters.\n  - Replay plug-in: https://github.com/wincent/replay (default mapping: `\u003cCR\u003e`)\n- Command-mode tricks:\n  - Global operations\n    - `:g/foo/ d` delete lines matching \"foo\" (`d` is an \"Ex\" command; can use others, like `:s` etc).\n    - `:v/foo/ d` delete lines not matching \"foo\".\n    - `:%sort` sort everything (`:%sort n` sort numerically; for other modifiers, see `:h :sort`).\n  - Regex patterns:\n    - Magic and \"very magic\":\n      - Loupe: https://github.com/wincent/loupe\n    - Perlisms in Vim syntax (these in \"very magic\" syntax):\n      - Non-greedy mappings:\n        - `a{-}` (ie. like `a*?`)\n        - `a{-1,}` (ie. like `a+?`)\n      - Positive look-ahead (zero-width match): `ab@=` (ie. like `a(?=b)`).\n      - Negative look-behind (zero-width match): `ab@!` (ie. like `a(?!b)`).\n      - Positive look-behind (zero-width match): `a@\u003c=b` (ie. like `a($\u003c=b)`).\n      - Negative look-behind (zero-width match): `a@\u003c!` (ie. like `a(?\u003c!b)`).\n      - Easy to remember:\n        - `\\zs` do a zero-width match anywhere, setting start of match to that position; eg:\n          - Positive look-behind: `a\\zsb`\n        - `\\ze` do a zero-width match anywhere, setting end of match to that position; eg:\n          - Positive look-ahead: `a\\zeb`\n    - Replacement modifiers:\n      - `\\u` makes next character uppercase\n      - `\\U` makes everything uppercase until `\\E`/`\\e`\n      - `\\l` makes next character lowercase\n      - `\\L` makes everything lowercase until `\\E`/`\\e`\n\n## Miscellaneous tips\n\n- Indenting and dedenting:\n  - VISUAL mode: `\u003e\u003e`, `\u003c\u003c`\n  - INSERT mode: `CTRL-d` (mnemonic: \"dedent\"), `CTRL-t` (mnemonic: \"tab\")\n- In INSERT mode, `CTRL-O` to execute one command and return to insert mode.\n- `gv` reselect last VISUAL selection\n- `ga` show ASCII value at current position\n- `g8` show UTF-8 value at current position\n- `g CTRL-g` show current cursor position and total counts (columns, lines, words, bytes)\n- `gu{motion}` make lowercase\n- `gU{motion}` make uppercase\n- `g~{motion}` toggle case\n- `gq{motion}` format lines\n- `CTRL-a` increment number\n- `CTRL-x` decrement number\n- In INSERT mode, `CTRL-r ={expr}` to insert the value of an expression.\n\n## Customizing Vim\n\n- Leader mappings:\n  - `:let mapleader = \" \"` (Vimscript), or `vim.g.mapleader = ' '` (Lua)\n  - [`~/.config/nvim/plugin/mappings/leader.lua`](https://github.com/wincent/wincent/blob/b94dafbe4caefa76305e90a37ad9342264fff5af/aspects/nvim/files/.config/nvim/plugin/mappings/leader.lua)\n- Local leader:\n  - `:let maplocalleader = \"\\\\\"` (Vimscript), or `vim.g.maplocalleader = '\\\\'` (Lua)\n- ftplugins\n  - `'gitcommit'`: [`~/.config/nvim/ftplugin/gitcommit.lua`](https://github.com/wincent/wincent/blob/b94dafbe4caefa76305e90a37ad9342264fff5af/aspects/nvim/files/.config/nvim/ftplugin/gitcommit.lua)\n  - `'markdown'`: [`~/.config/nvim/ftplugin/markdown.lua`](https://github.com/wincent/wincent/blob/b94dafbe4caefa76305e90a37ad9342264fff5af/aspects/nvim/files/.config/nvim/ftplugin/markdown.lua)\n- Lua\n  - https://wincent.dev/wiki/Lua_development_in_Neovim\n- Useful plug-ins:\n  - undotree: https://github.com/mbbill/undotree\n  - vim-easydir: https://github.com/duggiefresh/vim-easydir\n  - vim-fugitive: https://github.com/tpope/vim-fugitive\n  - vim-lion: https://github.com/tommcdo/vim-lion\n  - And many others: https://github.com/wincent/wincent/blob/main/.gitmodules\n- Pro-tip™️: Map `\u003cleader\u003eq` to `:q`, to avoid accidentally typing `q:`.\n- Useful settings\n  - `'colorcolumn'`\n  - `'cursorline'`\n  - `'shortmess'`\n  - `'switchbuf'` (see `usetab`, `uselast`)\n  - `'virtualedit'` (`block`)\n\n## Debugging and troubleshooting\n\n- `:verbose set ...?`\n- `:verbose map \u003cprefix\u003e`\n- `'verbose'` and `'verboselog'`\n- Startup profiling: `vim --startuptime log.txt`\n\n## Resources\n\n- Screencasts and streams:\n  - [@greghurrell (YouTube)](https://wincent.dev/link/screencasts)\n  - [@teej_dv (Twitch)](https://www.twitch.tv/teej_dv)\n  - [@ThePrimeagen (Twitch)](https://www.twitch.tv/theprimeagen)\n  - [vimcasts.org](http://vimcasts.org/)\n- Forums:\n  - [/r/neovim](https://www.reddit.com/r/neovim)\n  - [/r/vim](https://www.reddit.com/r/vim/)\n  - [neovim/neovim (Gitter)](https://gitter.im/neovim/neovim)\n- Books:\n  - [\"Practical Vim\" by Drew Neil](https://pragprog.com/titles/dnvim2/practical-vim-second-edition/)\n  - [\"Vim Reference Guide\" by Sundeep Agarwal](https://learnbyexample.github.io/vim_reference/)\n- Games and challenges:\n  - [www.vimgolf.com](https://www.vimgolf.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwincent%2Fvim-university","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwincent%2Fvim-university","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwincent%2Fvim-university/lists"}