# A [modular][] (Neo)Vim configuration! Nearly every (Neo)Vim configuration you find online is composed of a single, giant `vimrc` file. But _this one is different_: it's [modular], relying on (Neo)Vim's behavior of loading all `plugin/**/*.vim` files on startup to cleanly partition your settings, mappings, bundles, and other configuration into separate files that each focus on a single topic and _do one thing well_. ## Features * Modularity of bundles, filetypes, colorschemes, and Vim settings. * Lazy loading of filetype-specific bundles to start Vim up quickly. * Parallel installation and updating of bundles from Git repositories. * Easy upgrades with intelligent and automated Git conflict resolution. * Shell scripts for bundle management: insert, delete, rename, and more. ## Organization * [Branches](#branches) * [Scripts](#scripts) * [Bundles](#bundles) * [Configs](#configs) * [Dependencies](#dependencies) * [Installation](#installation) * [Usage](#usage) * [Bundling](#bundling) * [Updating](#updating) * [Tracking](#tracking) * [Locking](#locking) * [Shortcuts](#shortcuts) * [Mnemonics](#mnemonics) * [Cheatsheet](#cheatsheet) * [Control](#control) * [Command](#command) * [Motion](#motion) * [Selection](#selection) * [Clipboard](#clipboard) * [Completion](#completion) * [Folding](#folding) * [URxvt integration](#urxvt-integration) * [Manuals](#manuals) * [bin/clean](#binclean) * [bin/delete](#bindelete) * [bin/insert](#bininsert) * [bin/locate](#binlocate) * [bin/orphans](#binorphans) * [bin/rebase](#binrebase) * [bin/rebase-autocon](#binrebase-autocon) * [bin/rebase-stacked](#binrebase-stacked) * [bin/rename](#binrename) * [bin/rename-editor](#binrename-editor) * [bin/rename-fromto](#binrename-fromto) * [bin/setup](#binsetup) * [bin/update](#binupdate) * [bin/usage](#binusage) * [bin/usage-readme](#binusage-readme) * [References](#references) * [License](#license) ### Branches * The **[origin]** branch is a "bare bones" template for anyone to start with. * The **[basics]** branch is a rudimentary configuration of the Standard Vim. * The **[qwerty]** branch is an enhanced configuration meant for QWERTY typists. * The **[dvorak]** branch is an optimized configuration meant for Dvorak typists --- those who [type in Dvorak]( http://www.dvzine.org/zine/01-toc.html ). * The **[engram]** branch is an optimized configuration meant for Engram typists --- those who type in [Arno's Engram keyboard layout]( https://engram.dev ). * The **[master]** branch is the frontier, where I experiment with new plugins. [origin]: https://github.com/sunaku/.vim/tree/origin#readme [basics]: https://github.com/sunaku/.vim/tree/basics#readme [qwerty]: https://github.com/sunaku/.vim/tree/qwerty#readme [dvorak]: https://github.com/sunaku/.vim/tree/dvorak#readme [engram]: https://github.com/sunaku/.vim/tree/engram#readme [master]: https://github.com/sunaku/.vim/tree/master#readme ### Scripts * `bin/*` scripts automate common tasks. See below for their usage manuals. ### Bundles * `**/*.get` files specify URLs of Git repositories to clone for your bundles. * `**/*.set` files specify branch names or commit SHAs to check out from Git. * `**/*.run` files specify shell commands to run after updating your bundles. * `bundle/*/*/` directories are eagerly loaded Vim scripts; see [Unbundle]. * `ftbundle/*/*/` directories are lazily loaded, filetype-specific bundles. ### Configs * `plugin/**/*.vim` configure Vim _before_ it finishes starting up. * `bundle/*/*.vim` configure your bundles _before_ they are loaded. * `ftbundle/*/*.vim` configure your ftbundles _before_ they are loaded. * `ftplugin/{*,/*}.vim` configure your filetypes _when_ they are loaded. * `after/colors/*.vim` configure your colorschemes _after_ they are applied. * `after/plugin/**/*.vim` configure Vim _after_ all of the above is finished. ## Dependencies * [Vim](http://www.vim.org/) 7+ or [NeoVim](https://neovim.io/) 0.1+ * [Git](http://git-scm.com/) 1.5+ * [POSIX](http://pubs.opengroup.org/onlinepubs/9699919799/) environment (Linux, BSD, MacOSX, etc.) Special note to Microsoft Windows users: simply * replace `~/.vim` with `%USERPROFILE%\vimfiles` * replace `~/.vimrc` with `%USERPROFILE%\_vimrc` in all commands listed throughout this document. * [xargs](http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man1/xargs.1) with support for the `-r` command-line option: > Do not run the command if there are no arguments. Normally the > command is executed at least once even if there are no arguments. [Unbundle]: https://github.com/sunaku/vim-unbundle ## Installation Backup your configuration: mv ~/.vim ~/.vim.bak mv ~/.config/nvim ~/.config/nvim.bak # for NeoVim Install this configuration: git clone https://github.com/sunaku/.vim.git ~/.vim ln -s ~/.vim ~/.config/nvim # for NeoVim cd ~/.vim bin/setup Select a Git branch to use: bin/setup origin # template bin/setup basics # template + basics bin/setup qwerty # template + basics + my flair bin/setup dvorak # template + basics + my flair + dvorak bin/setup engram # template + basics + my flair + engram bin/setup master # template + basics + my flair + engram + new stuff ## Usage See usage information: bin/usage See usage information for provided *SCRIPT*: bin/usage SCRIPT ### Bundling Add bundle from *URL* under *CATEGORY*: bin/insert URL bundle/CATEGORY Add bundle from *URL* under *CATEGORY* with *BUNDLE_NAME*: bin/insert URL bundle/CATEGORY/BUNDLE_NAME Add ftbundle from *URL* for *FILETYPE*: bin/insert URL ftbundle/FILETYPE Add ftbundle from *URL* for *FILETYPE* with *BUNDLE_NAME*: bin/insert URL ftbundle/FILETYPE/BUNDLE_NAME Add bundle from Github *USER*/*REPO* under *CATEGORY*: bin/insert USER/REPO bundle/CATEGORY Add bundle from Github *USER*/*REPO* under *CATEGORY* with *BUNDLE_NAME*: bin/insert USER/REPO bundle/CATEGORY/BUNDLE_NAME Add ftbundle from Github *USER*/*REPO* for *FILETYPE*: bin/insert USER/REPO ftbundle/FILETYPE Add ftbundle from Github *USER*/*REPO* for *FILETYPE* with *BUNDLE_NAME*: bin/insert USER/REPO ftbundle/FILETYPE/BUNDLE_NAME Rename bundles with names matching *BUNDLE_NAME* (regexp): bin/rename BUNDLE_NAME Rename all bundles from the comfort of Vim: bin/rename-editor BUNDLE_NAME Rename a `*.get` file from its current name to a new one: bin/rename-fromto CURRENT_GET_FILE NEW_GET_FILE Delete bundles with names matching *BUNDLE_NAME* (regexp): bin/delete BUNDLE_NAME Lists untracked `*.get` files and bundles lacking `*.get` files: bin/orphans Deletes untracked `*.get` files and bundles lacking `*.get` files: bin/clean # asks you for confirmation bin/clean -f # no confirmation; force it ### Updating Update installed bundles and ftbundles: bin/update Update this Vim configuration framework: bin/rebase # asks to confirm bin/clean bin/rebase -f # no confirmation; force it Do all that periodically via crontab(1): @daily cd ~/.vim && bin/rebase -f && bin/update ### Tracking Track a certain Git *BRANCH* by creating a `*.set` file for your *BUNDLE*: echo BRANCH > BUNDLE.set Remove *BRANCH* tracking for your *BUNDLE* by deleting its `*.set` file: rm BUNDLE.set ### Locking Lock a *BUNDLE* to a certain Git *COMMITISH* to prevent it from being updated: cd BUNDLE git checkout COMMITISH Unlock a locked *BUNDLE*, so it can be updated, by checking out its `master`: cd BUNDLE git checkout master ## Shortcuts This branch of the Vim configuration defines the following shortcuts, which assume that you type in [Arno's Engram keyboard layout]( https://engram.dev ). If this assumption doesn't apply to you, then try the [qwerty] branch instead. * `,` is the ``, used in _some_ shortcuts in this configuration. * ` ` (space bar) precedes _most_ shortcuts in this configuration. Press it and wait a moment to view a searchable menu of all shortcuts. To use it in a `:normal` command, type ` ` twice and then ` `: ```vim :normal ^V ic ``` * ` ` immediately opens a searchable menu of all shortcuts. ### Mnemonics Inspired by the "verb then subject" design of Vim's own normal mode shortcuts, I have attempted to mirror its mnemonic devices in my own ` ` shortcuts: | Shortcuts | Key | Mnemonic | Same as Vim? | | ---------- | -------- | --------------- | ------------ | | ` a` | a | **a**ppend | Yes | | ` o` | o | **o**pen | Yes | | ` e` | e | **e**xpose | No | | ` u` | u | **u**ndo | Yes | | ` i` | i | **i**nsert | Yes | | ` d` | d | **d**elete | Yes | | ` h` | h | diff (**h**unk) | No | | ` t` | t | **t**oggle | No | | ` n` | n | **n**ext | Yes | | ` w` | w | **w**rite | No | | ` v` | v | **v**isual | Yes | | ` z` | z | fold | Yes | | ` ,` | , | execute | No | | ` .` | . | repeat | Yes | | ` p` | p | **p**aste | Yes | | ` y` | y | **y**ank | Yes | | ` f` | f | **f**ormat | No | | ` c` | c | **c**hange | Yes | | ` r` | r | **r**ead | No | ### Cheatsheet This table is *always* available (and searchable) in Vim: press **space bar** twice! Shortcut | Description -------- | ----------- ``-`` | (EasyMotion) Repeat last motion forward. ``0gt`` | expose last tab ``1gt`` | expose first tab ``2gt`` | expose tab 2 ``3gt`` | expose tab 3 ``4gt`` | expose tab 4 ``5gt`` | expose tab 5 ``6gt`` | expose tab 6 ``7gt`` | expose tab 7 ``8gt`` | expose tab 8 ``9gt`` | expose tab 9 `` `` | (Coc) Jump to next placeholder in snippet expansion. `` `` | (Coc) Jump to previous placeholder in snippet expansion. `` `` | exit/quit vim `` `` | strip trailing whitespace in buffer and write buffer to file `` `` | exit/quit vim forcefully `` k`` | (dasht) search ALL the docsets at command prompt `` K`` | (dasht) search ALL the docsets for cursor word or selected text `` `` | minimum window height `` `` | minimum window width `` `` | maximum window width `` `` | maximum window height `` [[`` | (blockinsert) blockwise surround at start and end of line `` []`` | (blockinsert) blockwise insert at start then end of line `` ]]`` | (blockinsert) blockwise surround at start and end of line `` a`` | (blockinsert) blockwise append at end of line `` b`` | (CamelCaseMotion) go to start of current word in camel/snake case `` e`` | (CamelCaseMotion) go to end of current word in camel/snake case `` gd`` | (Coc) Open the definition of the symbol under the cursor. `` ge`` | (CamelCaseMotion) go to end of previous word in camel/snake case `` gi`` | (Coc) Open the implementation of the symbol under the cursor. `` gR`` | (Coc) Open the references of the symbol under the cursor. `` gy`` | (Coc) Open the type definition of the symbol under the cursor. `` i`` | (blockinsert) blockwise insert at start of line `` k`` | (dasht) search related docsets at command prompt `` K`` | (dasht) search related docsets for cursor word or selected text `` o`` | switch to most recently focused tab `` p`` | paste after cursor, adding a space `` P`` | paste before cursor, adding a space `` q[[`` | (blockinsert) blockwise execute at start and end of line `` q[]`` | (blockinsert) blockwise execute at start then end of line `` q]]`` | (blockinsert) blockwise execute at start and end of line `` qa`` | (blockinsert) blockwise execute at end of line `` qi`` | (blockinsert) blockwise execute at start of line `` tb`` | (test) run all tests in buffer `` tn`` | (test) run test under cursor `` ts`` | (test) run all tests in suite `` tt`` | (test) repeat recent test run `` tv`` | (test) expose recently ran test `` w`` | (CamelCaseMotion) go to start of next word in camel/snake case `` `` | decrease window height ``
`` | decrease window width `` `` | increase window width `` `` | increase window height `` !T`` | (table-mode) evaluate "tmf:" formula line `` $t`` | move tab to last place `` *g`` | (fugitive) git grep: search repository for word under cursor `` +w`` | increase window size `` -w`` | decrease window size `` //`` | (fuzzysearch) fuzzy-regex search in buffer `` /d`` | (clap) find line under working directory `` /g`` | (fugitive) git grep: search repository `` 0T`` | (table-mode) sort current column at cursor `` 0w`` | minimum window size `` 1T`` | (table-mode) add fomula for current table cell `` 1w`` | maximum window size `` `` | show shortcut menu and run chosen shortcut `` =c`` | (NERDCommenter) comment, aligning both delimiters `` =T`` | (table-mode) realign table columns `` =w`` | (visual-split) resize window to selection `` >t`` | move tab right `` ?g`` | (fugitive) git grep: search repository for Vim search pattern `` ^t`` | move tab to first place `` `` | fallback to shortcut menu on partial entry `` ac`` | (NERDCommenter) append comment at end of line `` Ac`` | (NERDCommenter) comment from cursor to end of line `` aC`` | (NERDCommenter) comment, nesting `` ag`` | (fugitive) git commit --amend `` Ag`` | (fugitive) git commit --amend --reuse-message=HEAD `` at`` | append new tab `` At`` | append new tab in last place `` aw`` | split window right `` c*`` | (traces) interactive search and replace for word at cursor `` c/`` | (traces) interactive search and replace in selection or buffer `` c?`` | (abolish) interactive search and replace in selection or buffer `` cf`` | (eunuch) rename file `` Cg`` | (fugitive) git mv -f: rename file forcefully `` cg`` | (fugitive) git mv: rename file `` cq`` | (qfreplace) interactively change lines in quickfix window `` d$`` | (better-whitespace) strip trailing whitespace in buffer `` db`` | (sayonara) close buffer while retaining window `` DB`` | (wipeout) destroy all buffers not open in any tabs or windows `` Db`` | close all buffers `` dc`` | (NERDCommenter) uncomment, deleting comment delimiters `` dE`` | (errormarker) remove all error markers from signcolumn `` df`` | (eunuch) prompt to delete file `` Dg`` | (fugitive) git rm -f: delete file from repository forcefully `` dg`` | (fugitive) git rm: delete file from repository `` DT`` | (table-mode) delete current column or [count] right columns `` dT`` | (table-mode) delete current row or [count] rows `` Dt`` | close other tabs `` dt`` | close tab `` Dw`` | close other windows `` dw`` | close window `` Dz`` | close all other folds in buffer `` e/`` | (fzf) repeat search from history `` e:`` | (fzf) run command from menu `` e;`` | (fzf) repeat command from history `` e `` | (fzf) trigger mapping / keybinding / shortcut `` ea`` | (projectionist) expose alternate file `` eA`` | (projectionist) expose available projections `` ec`` | (clap) apply colorscheme `` eD`` | (NERDTree) find current buffer in tree `` ed`` | (NERDTree) open tree and focus it `` ee`` | (clap) expose clap providers `` eE`` | (errormarker) expose error message for cursor position `` eF`` | (fzf) apply filetype `` Ef`` | edit file as... `` Eg`` | (fugitive) return to editing git buffer `` eg`` | (fzf) browse git log `` eG`` | (fzf) browse git log for buffer `` ej`` | (clap) expose jumplist `` eL`` | (fzf) expose line in any buffer `` el`` | (fzf) expose line in buffer `` em`` | (clap) expose mark in buffer `` eQ`` | (clap) expose location list `` eq`` | (clap) expose quickfix list `` er`` | (clap) expose registers `` et`` | (fzf) expose tag in any buffer `` eT`` | (fzf) expose tag in buffer `` Et`` | (taglist) show tag name at cursor `` ew`` | (fzf) expose window in any tab `` ex`` | (scratch) expose scratch buffer `` ey`` | (clap) expose yanks `` f"`` | convert single to double quotes at cursor `` f'`` | convert double to single quotes at cursor `` f(`` | format function call, removing parentheses `` f)`` | format function call, adding parentheses `` f-`` | format as separator, appending minus signs to end of line `` f1`` | format as markdown title heading `` `` ``
f2`` | format as markdown section heading `` `` ``
f:`` | format ruby quotes to symbol at cursor `` f;`` | format ruby symbol to quotes at cursor `` f `` | indent with spaces in buffer `` f `` | indent with tabs in buffer `` f=`` | format as separator, appending equal signs to end of line `` f_`` | format as separator, repeating last character to end of line `` fa`` | (argwrap) toggle multi-line syntax at cursor `` fA`` | (FIGlet) decorate {motion} or visual selection as ASCII art `` fC`` | (FIGlet) comment {motion} or visual selection as ASCII art `` fc`` | format as markdown fenced code block `` fh`` | format line as comment section, surrounding with blank comment lines `` fH`` | format line as comment section, surrounding with minus sign separators `` fJ`` | format elixir pipeline at cursor: join into a single line `` fK`` | format elixir pipeline at cursor: split into multiple lines `` fP`` | format elixir function call to pipeline at cursor `` fp`` | format elixir pipeline to function call at cursor `` fs`` | (switch) cycle through alternate syntax at cursor `` fT`` | (table-mode) tabelize selection, using \| as delimiter `` FT`` | (table-mode) tableize selection, asking for delimiter `` ft`` | format as markdown table heading `` `` `` GG`` | (fugitive) git blame: who changed which line `` gg`` | (fugitive) open git status window `` gh`` | (GitGutter) preview git hunk at cursor `` gT`` | (table-mode) inspect table, for defining formulas `` h,`` | diff obtain hunk from left window `` h.`` | diff obtain hunk from right window `` h<`` | diff put hunk into left window `` h>`` | diff put hunk into right window `` ha`` | (conflict-marker) resolve merge conflict by keeping both versions `` hb`` | diff buffer against original version `` hg`` | (fugitive) git diff: show changes against repository `` hn`` | (conflict-marker) resolve merge conflict by deleting both versions `` ho`` | (conflict-marker) resolve merge conflict by keeping our version `` ht`` | (conflict-marker) resolve merge conflict by keeping their version `` Ic`` | (NERDCommenter) comment, aligning left delimiter `` ic`` | (NERDCommenter) comment, inserting comment delimiters `` iC`` | (NERDCommenter) comment, minimally `` IC`` | (NERDCommenter) comment, sexily `` iD`` | (projectionist) change buffer's working directory to innermost root `` id`` | (projectionist) change working directory to innermost root `` if`` | (projectionist) create file relative to innermost root `` ig`` | (fugitive) git commit: record new commit `` it`` | insert new tab `` It`` | insert new tab in first place `` iw`` | split window left `` Ix`` | (scratch) clear scratch buffer and enter insert mode in it `` ix`` | (scratch) enter insert mode in scratch buffer `` nt`` | expose next tab `` Nt`` | expose previous tab `` o.`` | (fzf) reopen file from history `` ob`` | (fzf) open buffer `` Od`` | (unite) expose filer in buffer's directory `` od`` | (unite) expose filer in working directory `` Of`` | (fzf) open file under buffer's directory `` of`` | (fzf) open file under working directory `` og`` | (fzf) open git file (tracked by git) `` oG`` | (fzf) open git file that has changes `` oh`` | (fzf) open help topic `` oH`` | (helpful) search for helptags and display Vim version information `` Ow`` | (visual-split) split window above `` ow`` | (visual-split) split window below `` ox`` | (slimux) select target pane interactively `` Pc`` | (NERDCommenter) duplicate above cursor and comment `` pc`` | (NERDCommenter) duplicate below cursor and comment `` pp`` | paste after cursor, adding an extra newline `` pP`` | paste after cursor, surrounding with newlines `` PP`` | paste before cursor, adding an extra newline `` Pp`` | paste before cursor, surrounding with newlines `` pw`` | (windowswap) paste window `` q.`` | (coc-fzf) Continue listing `` q `` | (coc-fzf) expose Coc functionality `` qa`` | (Coc) Perform codeAction of selected region. `` qa`` | (coc-clap) Show actions `` qc`` | (coc-clap) Show commands `` qd`` | (coc-fzf) Show all diagnostics `` qD`` | (coc-fzf) Show diagnostics for current buffer `` qe`` | (coc-clap) Manage extensions `` qf`` | (Coc) Perform autofix of issue at cursor line. `` qi`` | (coc-marketplace) Show available plugins for installation ``