vim-dwiw2015
vim-dwiw2015 copied to clipboard
Minimalist Vim distribution
dwiw2015.vim — Vim Do What I Want
Sensible Defaults For A Modern Text Editor
2017/4/23 Update: Now that Vim 8 is out, a number of improvements that this distribution makes no longer make sense (thanks to better defaults and built-in plugin suport). It is unlikely future development will go into dwiw2015.vim, outside of re-working it into a brand new distribution built for Vim 8.
Building on top of Tim Pope's sensible.vim, vim-dwiw is a minimal Vim distribution that sets up Vim with the behavior and features that you would expect from a modern text editor.
Benefits at a glance:
- One-step install for Windows, Linux, and OS X
- No cruft in your
.vimrc, since default settings are cleanly segregated into a plug-in - Modern plug-in management with Vundle
- Includes a small curated set of plug-ins to provide modern text editor functionality
- Optimized for both Terminal and GUI Vim
Vim-dwiw is well suited for new Vim users. It smoothes out the roughest of edges of Vim (the stuff that no longer makes sense today), but in a way that doesn't try to change or go far beyond the core Vim behavior.
And for experienced users, vim-dwiw cuts out the boilerplate code that you and
everyone else puts in their .vimrc, making it that much easier to get Vim
configured on a new machine.
Installation
Linux, OS X, and Friends
One command will get you going:
curl -sS https://raw.githubusercontent.com/mkropat/vim-dwiw2015/master/bootstrap.sh | sh
It should be safe to run — even on an existing Vim set up. See the bootstrap script source for details.
Windows
Assuming you have Chocolatey installed, open a command prompt and run:
cinst vim-dwiw2015
It should be safe to run — even on an existing Vim set up. See the bootstrap script source for details.
Alternatively, you can download the bootstrap script and run it manually from the PowerShell console:
& .\bootstrap.ps1
Plug-in Only
If you already have Vundle set up and the plug-ins you want installed, you can
include just the dwiw2015.vim plug-in by adding the following lines to your
.vimrc:
Plugin 'tpope/vim-sensible'
Plugin 'mkropat/vim-dwiw2015'
(dwiw2015.vim pairs best with vim-sensible)
And then run the following from Vim:
:PluginInstall
Updating
If you've already installed vim-dwiw, you can update the dwiw2015.vim plug-in and all other installed plugins to the latest version by running the following from Vim:
:PluginUpdate
Default Settings
The authoritative source for the provided default settings is the (well-documented) source file itself.
New Key Shortcuts
Vim-dwiw adds in the most ubiquitous editor shortcuts, and makes some old key mappings act a little more modern.
All Modes
| Shortcut | Description |
|---|---|
| Ctrl-A | select all |
| Ctrl-S | save |
| Ctrl-Z | undo (GUI only) |
Normal / Visual Mode
| Shortcut | Description |
|---|---|
| Ctrl-Q | enter Visual Block mode |
| Ctrl-V | paste from clipboard (GUI only) |
| Ctrl-/ | toggles commenting of selected line(s) (Terminal only; not all terminals supported) |
Q{motion} |
format specified lines (like gq) |
| gQ | enter Ex mode (since Q is re-mapped) |
| j | move down one line on the screen |
| gj | move down one line in the file |
| k | move up one line on the screen |
| gk | move up one line in the file |
Normal Mode Only
| Shortcut | Description |
|---|---|
| & | repeat last :s substitue (preserves flags) |
| Y | yank to end of line (to be consistent with C and D) |
| Enter | insert blank line above current |
| Ctrl-Tab | switch to next tab (GUI only) |
| Ctrl-Shift-Tab | switch to previous tab (GUI only) |
| Ctrl-L | clear search term highlighting |
Visual Mode Only
| Shortcut | Description |
|---|---|
| Ctrl-C | copy selection to clipboard (GUI only) |
| Ctrl-X | cut selection to clipboard (GUI only) |
Insert Mode
| Shortcut | Description |
|---|---|
| Tab | indent at beginning of line, otherwise autocomplete |
| Shift-Tab | select previous autocompletion |
| Ctrl-Q | insert literal character |
| Ctrl-V | paste from clipboard (GUI only) |
Overriding the Defaults
Add your custom settings to .vimrc after the hook line source … dwiw-loader.vim. The dwiw-loader.vim script pre-loads both the
dwiw2015.vim and sensible.vim plugins, allowing you to set custom overrides
in your .vimrc.
Modern Features
Vim-dwiw ships with a number of plug-ins out-of-the-box:
- ag.vim — like
grep, but better - ctrlp.vim — fuzzy file, buffer, mru, tag, etc finder
- vim-airline — lean & mean status/tabline for Vim that's light as air
- vim-commentary — comment and un-comment lines easily
- vim-sensible — defaults everyone can agree on
- vim-sleuth — heuristically set buffer options
- Vundle — the plug-in manager for Vim
Plug-in Management
Install packages straight from Vim at any time with
Vundle. For example, to install Tim
Pope's fantastic Git wrapper, available on Github at
tpope/vim-fugitive, simply add the
following line to your .vimrc:
Plugin 'tpope/vim-fugitive'
Then run :PluginInstall.
To update all installed plugins to the latest version, run :PluginUpdate.
Fuzzy-Filename Open

Vim's built-in file opener and swtiching (see :help :e and :help :b) works
fine, but for truly fast file-switching you need a fuzzy-file opener, like the
ctrlp plug-in. Pressing Ctrl-P
in normal mode activates the the plug-in. Once activated, start typing any
part of the filename you're interested (partial/paths work too) and press
Enter to open the file.
Find In Files

Vim already provides an interface to the grep command with :grep, however
the grep command is less than ideal for searching most directories, because
it automatically searches inside lots of irrelevant filetypes (like compiled
files, version control internals, etc.).
A better alternative is The Silver
Searcher
a.k.a. ag. Using the ack.vim plug-in
(configured for ag), you can search straight from Vim with the command :Ack <search terms>.
Note: before ag.vim can be used, the The Silver Searcher must be installed.
Fortunately, packages exist for all the major platforms (called perhaps
silversearcher-ag or the_silver_searcher) and it's installed automatically
for you on Windows by Chocolatey!
Informative Statusline

Vim-dwiw includes the vim-airline plug-in, which packs a whole lot of information into your status while looking great at the same time.
Toggle Line Commenting With a Single Keypress
(Terminal Only) Press Ctrl-/ to comment out the current line (or un-comment it, if it's currently commented out). Select multiple lines in Visual mode and press Ctrl-/ to comment them all out.
(All Versions) Or more powerfully, use Vim motions with gc to comment out any sized block of code:
- gcap — comment out the current paragraph
- gcG — comment out the rest of the file
- etc.
Auto-Detection of Indent Settings
We all have our preferred idea of how far to indent and when to use tabs vs
spaces, but when editing a file created by someone else, the important thing is
to stay consistent with their indent settings. The sleuth.vim
plug-in inspects newly opened files and
sets the relevant settings (shiftwidth and expandtab) automatically.
Troubleshooting
Slow Scrolling
If you experience slow scrolling in :list mode in a file with long lines, the
issue may be a result of the font in use misisng certain
characters. As a
workaround, you can set the following in your .vimrc to display ascii
characters (which are present in any font):
set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
Inspiration
I may be proficient at editing with Vim, but I'm a novice when it comes to Vim
customization. Without reading other people's .vimrc files and plug-in
source code, I'd have gotten nowhere. Particular shout-outs go to:
- Tim Pope's vim-sensible and vimrc
- Gary Bernhardt's vimrc
- Steve Losh's Learn Vimscript the Hard Way, Vim blog post and vimrc
- Bailey Ling's vimrc
- Steve Francia's everything and the kitchen sink Vim distribution
License
Copyright © Michael Kropat. Distributed under the same terms as Vim itself.
See :help license.