aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Bynens <mathias@qiwi.be>2011-10-17 10:53:13 +0200
committerMathias Bynens <mathias@qiwi.be>2011-10-17 10:53:13 +0200
commit1874ffff560a039639bc1f9f70a41fbb2488f77e (patch)
tree305e4d35c5c2fd351996590047b73e07e5269e3b
parent74b3792583815905c0277ded70c65b2c563f6c3a (diff)
downloaddotfiles-1874ffff560a039639bc1f9f70a41fbb2488f77e.tar.gz
dotfiles-1874ffff560a039639bc1f9f70a41fbb2488f77e.tar.bz2
dotfiles-1874ffff560a039639bc1f9f70a41fbb2488f77e.zip
Add .vimrc, heavily based on the one @gf3 uses. Fixes #4.
-rw-r--r--.vimrc62
1 files changed, 62 insertions, 0 deletions
diff --git a/.vimrc b/.vimrc
new file mode 100644
index 0000000..468ce92
--- /dev/null
+++ b/.vimrc
@@ -0,0 +1,62 @@
+" Make vim more useful
+set nocompatible
+" Allow cursor keys in insert mode
+set esckeys
+" Optimize for fast terminal connections
+set ttyfast
+" Add the g flag to search/replace by default
+set gdefault
+" Use UTF-8 without BOM
+set encoding=utf-8 nobomb
+" Change mapleader
+let mapleader=","
+" Don’t add empty newlines at the end of files
+set binary
+set noeol
+
+" Enable line numbers
+set number
+" Enable syntax highlighting
+syntax on
+" Highlight current line
+set cursorline
+" Show “invisible” characters
+set lcs=tab:›\ ,trail:·,eol:¬,nbsp:_
+set list
+" Highlight searches
+set hlsearch
+" Ignore case of searches
+set ignorecase
+" Highlight dynamically as pattern is typed
+set incsearch
+" Always show status line
+set laststatus=2
+" Enable mouse in all modes
+set mouse=a
+" Disable error bells
+set noerrorbells
+" Don’t reset cursor to start of line when moving around.
+set nostartofline
+" Show the cursor position
+set ruler
+" Don’t show the intro message when starting vim
+set shortmess=atI
+" Show the current mode
+set showmode
+" Show the filename in the window titlebar
+set title
+" Use relative line numbers
+set relativenumber
+au BufReadPost * set relativenumber
+" Start scrolling three lines before the horizontal window border
+set scrolloff=3
+
+" Strip trailing whitespace (,ss)
+function! StripWhitespace ()
+ let save_cursor = getpos(".")
+ let old_query = getreg('/')
+ :%s/\s\+$//e
+ call setpos('.', save_cursor)
+ call setreg('/', old_query)
+endfunction
+noremap <leader>ss :call StripWhitespace ()<CR> \ No newline at end of file