Skip to content

Instantly share code, notes, and snippets.

@kolo
Created November 29, 2016 15:32
Show Gist options
  • Save kolo/94007f336c103f8389d2723e0d06b628 to your computer and use it in GitHub Desktop.
Save kolo/94007f336c103f8389d2723e0d06b628 to your computer and use it in GitHub Desktop.
Minimal vimrc
set nocompatible
" vim-plug
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall | source $MYVIMRC
endif
call plug#begin('~/.vim/bundle')
call plug#end()
try | lang en_US | catch | endtry
"---------------------------------------------------------------------------
" Encoding:
"
set encoding=utf-8
setglobal fenc=utf-8
set fileformat=unix
set fileformats=unix,dos
"---------------------------------------------------------------------------
" Search:
"
set ignorecase
set smartcase
set incsearch
set nohlsearch
set wrapscan
"---------------------------------------------------------------------------
" Edit:
"
set smarttab
set expandtab
set tabstop=2
set shiftwidth=2
set backspace=indent,eol,start
" Use grep.
set grepprg=grep\ -inH
" Exclude = from isfilename.
set isfname-==
" More natural split opening
set splitbelow
set splitright
" Tab completion
set wildmode=list:longest,list:full
"---------------------------------------------------------------------------
" View:
"
syntax enable
set number
if has("statusline") && !&cp
set laststatus=2 " always show the status bar
" Start the status line
set statusline=%f\ %m\ %r
set statusline+=Line:%l/%L[%p%%]
set statusline+=Col:%v
set statusline+=Buf:#%n
set statusline+=[%b][0x%B]
endif
if exists('+breakindent')
set breakindent
set wrap
else
set nowrap
endif
" Highlight tabs and trailing space
set listchars=tab:→\ ,trail:·
" Highlight current line
" set cursorline
" Disable bell.
set t_vb=
set novisualbell
" Don't create backup.
set nowritebackup
set nobackup
set noswapfile
set backupdir-=.
"---------------------------------------------------------------------------
" FileType:
"
set autoindent smartindent
" ruby
au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,*.thor,config.ru,Capfile,*.cap,} set ft=ruby
" json
au BufNewFile,BufRead *.json set ft=javascript
autocmd Filetype javascript setlocal tabstop=2 shiftwidth=2 expandtab
autocmd Filetype html setlocal tabstop=4 shiftwidth=4 expandtab
autocmd Filetype go setlocal tabstop=4 shiftwidth=4 noexpandtab
"---------------------------------------------------------------------------
" Misc
"
" Include user's local vim config
if filereadable(expand("~/.vimrc.local"))
source ~/.vimrc.local
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment