summaryrefslogtreecommitdiffstats
path: root/runtime/defaults.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-07-28 22:24:15 +0200
committerBram Moolenaar <Bram@vim.org>2016-07-28 22:24:15 +0200
commit8c08b5b569e2a9e9f63dea514591ecfa2d3bb392 (patch)
tree4303829cd42d4910ee0d0dfc35687c7b313c5e14 /runtime/defaults.vim
parenteac784eced501c54d2c99e18a1af96cd996f3a6c (diff)
patch 7.4.2111v7.4.2111
Problem: Defaults are very conservative. Solution: Move settings from vimrc_example.vim to defaults.vim. Load defaults.vim if no .vimrc was found.
Diffstat (limited to 'runtime/defaults.vim')
-rw-r--r--runtime/defaults.vim109
1 files changed, 109 insertions, 0 deletions
diff --git a/runtime/defaults.vim b/runtime/defaults.vim
new file mode 100644
index 0000000000..f83e8bb55a
--- /dev/null
+++ b/runtime/defaults.vim
@@ -0,0 +1,109 @@
+" The default vimrc file.
+"
+" Maintainer: Bram Moolenaar <Bram@vim.org>
+" Last change: 2016 Jul 28
+"
+" This is loaded if no vimrc file was found.
+" Except when Vim is run with "-u NONE" or "-C".
+" Individual settings can be reverted with ":set option&".
+" Other commands can be reverted as mentioned below.
+
+" When started as "evim", evim.vim will already have done these settings.
+if v:progname =~? "evim"
+ finish
+endif
+
+" Use Vim settings, rather than Vi settings (much better!).
+" This must be first, because it changes other options as a side effect.
+set nocompatible
+
+" Allow backspacing over everything in insert mode.
+set backspace=indent,eol,start
+
+set history=200 " keep 200 lines of command line history
+set ruler " show the cursor position all the time
+set showcmd " display incomplete commands
+set wildmenu " display completion matches in a status line
+
+" Do incremental searching when it's possible to timeout.
+if has('reltime')
+ set incsearch
+endif
+
+" Do not recognize octal numbers for Ctrl-A and Ctrl-X, most users find it
+" confusing.
+set nrformats-=octal
+
+" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries.
+if has('win32')
+ set guioptions-=t
+endif
+
+" Don't use Ex mode, use Q for formatting.
+" Revert with ":unmap Q".
+map Q gq
+
+" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
+" so that you can undo CTRL-U after inserting a line break.
+" Revert with ":iunmap <C-U>".
+inoremap <C-U> <C-G>u<C-U>
+
+" In many terminal emulators the mouse works just fine. By enabling it you
+" can position the cursor, Visually select and scroll with the mouse.
+if has('mouse')
+ set mouse=a
+endif
+
+" Switch syntax highlighting on when the terminal has colors or when using the
+" GUI (which always has colors).
+if &t_Co > 2 || has("gui_running")
+ " Revert with ":syntax off".
+ syntax on
+
+ " I like highlighting strings inside C comments.
+ " Revert with ":unlet c_comment_strings".
+ let c_comment_strings=1
+endif
+
+" Only do this part when compiled with support for autocommands.
+if has("autocmd")
+
+ " Enable file type detection.
+ " Use the default filetype settings, so that mail gets 'tw' set to 72,
+ " 'cindent' is on in C files, etc.
+ " Also load indent files, to automatically do language-dependent indenting.
+ " Revert with ":filetype off".
+ filetype plugin indent on
+
+ " Put these in an autocmd group, so that you can revert them with:
+ " ":augroup vimStartup | au! | augroup END"
+ augroup vimStartup
+ au!
+
+ " When editing a file, always jump to the last known cursor position.
+ " Don't do it when the position is invalid or when inside an event handler
+ " (happens when dropping a file on gvim).
+ autocmd BufReadPost *
+ \ if line("'\"") >= 1 && line("'\"") <= line("$") |
+ \ exe "normal! g`\"" |
+ \ endif
+
+ augroup END
+
+endif " has("autocmd")
+
+" Convenient command to see the difference between the current buffer and the
+" file it was loaded from, thus the changes you made.
+" Only define it when not defined already.
+" Revert with: ":delcommand DiffOrig".
+if !exists(":DiffOrig")
+ command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
+ \ | wincmd p | diffthis
+endif
+
+if has('langmap') && exists('+langnoremap')
+ " Prevent that the langmap option applies to characters that result from a
+ " mapping. If unset (default), this may break plugins (but it's backward
+ " compatible).
+ set langnoremap
+endif