Merge parts from sensible.vim into vimrc

Merge parts of Tim Pope's "sensible.vim"
<https://github.com/tpope/vim-sensible>.
This commit is contained in:
Anthony Rose 2017-04-06 09:03:26 +01:00
parent 5f96ba1cda
commit 8bbb132415
3 changed files with 38 additions and 189 deletions

View file

@ -1,95 +0,0 @@
# sensible.vim
Think of sensible.vim as one step above `'nocompatible'` mode: a universal
set of defaults that (hopefully) everyone can agree on.
* If you're new to Vim, you can install this as a starting point, rather than
copying some random vimrc you found.
* If you're pair programming and you can't agree on whose vimrc to use, this
can be your neutral territory.
* If you're administrating a server with an account that's not exclusively
yours, you can `scp` this up to make things a bit more tolerable.
* If you're troubleshooting a plugin and need to rule out interference from
your vimrc, having this installed will ensure you still have some basic
amenities.
## Installation
If you don't have a preferred installation method, I recommend
installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and
then simply copy and paste:
cd ~/.vim/bundle
git clone git://github.com/tpope/vim-sensible.git
## Features
See the [source][] for the authoritative list of features. (Don't worry, it's
mostly `:set` calls.) Here's a taste:
* `'backspace'`: Backspace through anything in insert mode.
* `'incsearch'`: Start searching before pressing enter.
* `'listchars'`: Makes `:set list` (visible whitespace) prettier.
* `'scrolloff'`: Always show at least one line above/below the cursor.
* `'autoread'`: Autoload file changes. You can undo by pressing `u`.
* `runtime! macros/matchit.vim`: Load the version of matchit.vim that ships
with Vim.
[source]: https://github.com/tpope/vim-sensible/tree/master/plugin/sensible.vim
## FAQ
> How can I see what this plugin actually does?
The [source][] is authoritative. Use `:help 'option'` to see the
documentation for an option. If you install [scriptease.vim][], you can press
`K` on an option (or command, or function) to jump to its documentation.
[scriptease.vim]: https://github.com/tpope/vim-scriptease
> How can I override a setting?
Normally, sensible.vim loads after your vimrc, making it a bit tricky to
override (although you could use `after/plugin/sensible.vim`). If you want to
load it earlier, add the following line to you vimrc, then put your overrides
below.
runtime! plugin/sensible.vim
Feel free to [let me know][GitHub issues] which setting you object to, so I
can reassess whether it makes sense to include it.
## Contributing
I want this to be a plugin nobody objects to installing. [Let me
know][GitHub issues] if you have any objections to *anything*. There are a
handful of settings I figured *might* be controversial, but I included
anyways, just to settle the question once and for all. It won't take much
persuasion for me to remove them. Everything else is negotiable.
Feel free to ask a question if you're not sure why I've set something, as I
haven't put much effort into documenting that.
I'm a stickler for [commit messages][], so if you send me a pull request with
so much as a superfluous period in the subject line, I will close it without
so much as a second thought, and save my precious attention for someone who
can actually follow directions.
[GitHub issues]: http://github.com/tpope/vim-sensible/issues
[commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
## Self-Promotion
Like sensible.vim? Follow the repository on
[GitHub](https://github.com/tpope/vim-sensible) and vote for it on
[vim.org](http://www.vim.org/scripts/script.php?script_id=4391). And if
you're feeling especially charitable, follow [tpope](http://tpo.pe/) on
[Twitter](http://twitter.com/tpope) and
[GitHub](https://github.com/tpope).
This pairs great with [sleuth.vim](https://github.com/tpope/vim-sleuth).
## License
Copyright © Tim Pope. Distributed under the same terms as Vim itself.
See `:help license`.

View file

@ -1,93 +0,0 @@
" sensible.vim - Defaults everyone can agree on
" Maintainer: Tim Pope <http://tpo.pe/>
" Version: 1.1
if exists('g:loaded_sensible') || &compatible
finish
else
let g:loaded_sensible = 1
endif
if has('autocmd')
filetype plugin indent on
endif
if has('syntax') && !exists('g:syntax_on')
syntax enable
endif
" Use :help 'option' to see the documentation for the given option.
set autoindent
set backspace=indent,eol,start
set complete-=i
set smarttab
set nrformats-=octal
set ttimeout
set ttimeoutlen=100
set incsearch
" Use <C-L> to clear the highlighting of :set hlsearch.
if maparg('<C-L>', 'n') ==# ''
nnoremap <silent> <C-L> :nohlsearch<C-R>=has('diff')?'<Bar>diffupdate':''<CR><CR><C-L>
endif
set laststatus=2
set ruler
set wildmenu
if !&scrolloff
set scrolloff=1
endif
if !&sidescrolloff
set sidescrolloff=5
endif
set display+=lastline
if &encoding ==# 'latin1' && has('gui_running')
set encoding=utf-8
endif
if &listchars ==# 'eol:$'
set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
endif
if v:version > 703 || v:version == 703 && has("patch541")
set formatoptions+=j " Delete comment character when joining commented lines
endif
if has('path_extra')
setglobal tags-=./tags tags-=./tags; tags^=./tags;
endif
if &shell =~# 'fish$' && (v:version < 704 || v:version == 704 && !has('patch276'))
set shell=/bin/bash
endif
set autoread
if &history < 1000
set history=1000
endif
if &tabpagemax < 50
set tabpagemax=50
endif
if !empty(&viminfo)
set viminfo^=!
endif
set sessionoptions-=options
" Allow color schemes to do bright colors without forcing bold.
if &t_Co == 8 && $TERM !~# '^linux\|^Eterm'
set t_Co=16
endif
" Load matchit.vim, but only if the user hasn't installed a newer version.
if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# ''
runtime! macros/matchit.vim
endif
inoremap <C-U> <C-G>u<C-U>
" vim:set ft=vim et sw=2:

39
vimrc
View file

@ -1,3 +1,10 @@
" Anthony Perkins
" https://github.com/acperkins/vimfiles
" Distributed under the VIM license. See ':help license' for a copy.
"
" Includes parts from Tim Pope's «sensible.vim»
" <https://github.com/tpope/vim-sensible>.
if version < 800
silent! runtime pack/acp/opt/vim-pathogen/autoload/pathogen.vim
silent! execute pathogen#infect('pack/acp/start/{}')
@ -27,42 +34,70 @@ nnoremap <left> <nop>
nnoremap <right> <nop>
nnoremap <up> <nop>
set autoindent
set autoread
set background=dark
set backspace=indent,eol,start
set colorcolumn=73
set complete-=i
set cursorcolumn
set cursorline
set directory=$TEMP//,/tmp//,.
set display+=lastline
set encoding=utf-8
set expandtab
set guioptions=cr
set guioptions+=c
set guioptions-=m
set guioptions-=T
set history=1000
set ignorecase
set incsearch
set laststatus=2
set linebreak
set list
set modelines=0
set nofoldenable
set nojoinspaces
set nrformats-=octal
set number
set omnifunc=syntaxcomplete#Complete
set printoptions=paper:A4,duplex:off,header:0
set relativenumber
set ruler
set sessionoptions-=options
set shiftwidth=4
set smartcase
set smarttab
set spl=en_gb nospell
set tabstop=4
set textwidth=72
set ttimeout
set ttimeoutlen=100
set ttyfast
set viminfo="NONE"
set wildmenu
set wrap
silent! colorscheme desert
silent! filetype plugin indent on
silent! syntax on
if has("patch-7.3.541")
set formatoptions+=j
endif
if has("patch-7.4.710")
set listchars=eol,tab:→ ,trail:~,extends:>,precedes:<,space
else
set listchars=eol,tab:→ ,trail:~,extends:>,precedes:<
endif
if !empty(&viminfo)
set viminfo^=!
endif
if &t_Co == 8 && $TERM !~# '^linux\|^Eterm'
set t_Co=16
endif
if has("gui_running")
if has("gui_gtk2")
set guifont=Monospace\ Regular\ 10
@ -80,3 +115,5 @@ if has("gui_running")
endtry
endif
" vim:set ft=vim et sw=4: