https://github.com/mkropat/vim-dwiw2015
Minimalist Vim distribution
https://github.com/mkropat/vim-dwiw2015
vim
Last synced: 12 months ago
JSON representation
Minimalist Vim distribution
- Host: GitHub
- URL: https://github.com/mkropat/vim-dwiw2015
- Owner: mkropat
- Created: 2014-03-07T02:42:39.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2019-06-26T13:38:02.000Z (almost 7 years ago)
- Last Synced: 2025-04-13T01:40:02.548Z (about 1 year ago)
- Topics: vim
- Language: PowerShell
- Homepage:
- Size: 61.5 KB
- Stars: 14
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# dwiw2015.vim — Vim Do What I Want
*Sensible Defaults For A Modern Text Editor*
__2017/4/23 Update:__ Now that [Vim 8 is out](https://github.com/vim/vim/blob/master/runtime/doc/version8.txt), 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](https://github.com/tpope/vim-sensible/), **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](https://github.com/gmarik/Vundle.vim)
- Includes a __small__ [curated set of plug-ins](#modern-features) 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](bootstrap.sh) for details.
### Windows
Assuming you have [Chocolatey](http://chocolatey.org/) 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](bootstrap.ps1) for details.
Alternatively, you can download the [bootstrap script](bootstrap.ps1) 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](plugin/dwiw2015.vim).
### 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](https://github.com/rking/ag.vim) — like `grep`, but better
- [ctrlp.vim](https://github.com/kien/ctrlp.vim) — fuzzy file, buffer, mru, tag, etc finder
- [vim-airline](https://github.com/bling/vim-airline) — lean & mean status/tabline for Vim that's light as air
- [vim-commentary](https://github.com/tpope/vim-commentary) — comment and un-comment lines easily
- [vim-sensible](https://github.com/tpope/vim-sensible) — defaults everyone can agree on
- [vim-sleuth](https://github.com/tpope/vim-sleuth) — heuristically set buffer options
- [Vundle](https://github.com/gmarik/Vundle.vim) — the plug-in manager for Vim
### Plug-in Management
Install packages straight from Vim at any time with
[Vundle](https://github.com/gmarik/Vundle.vim). For example, to install Tim
Pope's fantastic Git wrapper, available on Github at
[tpope/vim-fugitive](https://github.com/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](http://kien.github.io/ctrlp.vim/). 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](http://geoff.greer.fm/2011/12/27/the-silver-searcher-better-than-ack/)
a.k.a. `ag`. Using the [ack.vim plug-in](https://github.com/mileszs/ack.vim)
(configured for `ag`), you can search straight from Vim with the command `:Ack
`.
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](https://github.com/bling/vim-airline), 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](https://github.com/tpope/vim-sleuth) 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](https://code.google.com/p/vim/issues/detail?id=210). 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](https://github.com/tpope/vim-sensible) and [vimrc](https://github.com/tpope/tpope/blob/master/.vimrc)
* Gary Bernhardt's [vimrc](https://github.com/garybernhardt/dotfiles/blob/master/.vimrc)
* Steve Losh's [Learn Vimscript the Hard Way](http://learnvimscriptthehardway.stevelosh.com/), [Vim blog post](http://stevelosh.com/blog/2010/09/coming-home-to-vim/) and [vimrc](https://bitbucket.org/sjl/dotfiles/src/tip/vim/vimrc)
* Bailey Ling's [vimrc](https://github.com/bling/dotvim/blob/master/vimrc)
* Steve Francia's [everything and the kitchen sink Vim distribution](http://vim.spf13.com/)
## License
Copyright © Michael Kropat. Distributed under the same terms as Vim itself.
See `:help license`.