vim-dwiw2015


Ⅰ. 插件描述

Minimalist Vim distribution

Ⅱ. 基本信息

创建日期:  2014-03-07
使用用户:  1
Github星:  14
插件作者:  Michael Kropat

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'mkropat/vim-dwiw2015'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'mkropat/vim-dwiw2015'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'mkropat/vim-dwiw2015'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/mkropat/vim-dwiw2015

Ⅳ. 文档说明

# 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](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
  • 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](bootstrap.sh) 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](bootstrap.ps1) 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

ShortcutDescription
Ctrl-Aselect all
Ctrl-Ssave
Ctrl-Zundo (GUI only)

Normal / Visual Mode

ShortcutDescription
Ctrl-Qenter Visual Block mode
Ctrl-Vpaste from clipboard (GUI only)
Ctrl-/toggles commenting of selected line(s) (Terminal only; not all terminals supported)
Q{motion}format specified lines (like gq)
gQenter Ex mode (since Q is re-mapped)
jmove down one line on the screen
gjmove down one line in the file
kmove up one line on the screen
gkmove up one line in the file

Normal Mode Only

ShortcutDescription
&repeat last :s substitue (preserves flags)
Yyank to end of line (to be consistent with C and D)
Enterinsert blank line above current
Ctrl-Tabswitch to next tab (GUI only)
Ctrl-Shift-Tabswitch to previous tab (GUI only)
Ctrl-Lclear search term highlighting

Visual Mode Only

ShortcutDescription
Ctrl-Ccopy selection to clipboard (GUI only)
Ctrl-Xcut selection to clipboard (GUI only)

Insert Mode

ShortcutDescription
Tabindent at beginning of line, otherwise autocomplete
Shift-Tabselect previous autocompletion
Ctrl-Qinsert literal character
Ctrl-Vpaste 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

Screenshot

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

Screenshot

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
(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

Screenshot

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

  1. Without reading other people's .vimrc files and plug-in
  2. code, I'd have gotten nowhere. Particular shout-outs go to:

License

Copyright © Michael Kropat. Distributed under the same terms as Vim itself.
See :help license.

添加新评论