Skip to content

Instantly share code, notes, and snippets.

@vlad-bezden
Last active April 7, 2017 19:55
Show Gist options
  • Save vlad-bezden/5c3311dc76eb131ce30548b82ba39be9 to your computer and use it in GitHub Desktop.
Save vlad-bezden/5c3311dc76eb131ce30548b82ba39be9 to your computer and use it in GitHub Desktop.
vim configuration
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
if empty(&shellxquote)
let l:shxq_sav = ''
set shellxquote&
endif
let cmd = '"' . $VIMRUNTIME . '\diff"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
if exists('l:shxq_sav')
let &shellxquote=l:shxq_sav
endif
endfunction
" Must come first because it changes other options
set nocompatible
" Turn on syntax highlighting
syntax enable
" Turn on file type detection
filetype plugin indent on
" Load the matchit plugin
runtime macros/matchit.vim
" Display incomplete commands
set showcmd
" Display the mode you're in
set showmode
" Intuitive backspacing
set backspace=indent,eol,start
" Handle multiple buffers better
set hidden
" Enhanced command line completion
set wildmenu
" Complete files like a shell
set wildmode=list:longest
" Case-insensitive searching
set ignorecase
" But case-sensitive if expression contains a capital letter
set smartcase
" Show line numbers
set number
" Show cursor position
set ruler
" Highlight matches as you type
set incsearch
" Highlight matches
set hlsearch
" Turn on line wrapping
set wrap
" Show 3 lines of context around the cursor
set scrolloff=3
" Set the terminal's title
set title
" No beeping
set visualbell
" store backup, undo and swap files into temp directory
set directory=$HOME/temp//
set backupdir=$HOME/temp//
set undodir=$HOME/temp//
" Don't make a backup before overwriting a file
set nobackup
" And again
set nowritebackup
" Keep swap files in one location
set directory=$HOME/.vim/tmp//,.
" Automaticatlly use the current file's directory as the working directory
set autochdir
" Set tab stop to be 2 spaces
set tabstop=2
set shiftwidth=2
set expandtab
" Show the status line all the time
set laststatus=2
" Useful status information at bottom of screen
set statusline=[%n]\ %<%.99f\ %h%w%m%r%y\ %{exists('*CapsLockStatusline')?CapsLockStatusline():''}%=%-16(\ %l,%c-%v\ %)%P
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment