Skip to content

Instantly share code, notes, and snippets.

@mv
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mv/02ba369029c27a9fdc9b to your computer and use it in GitHub Desktop.
Save mv/02ba369029c27a9fdc9b to your computer and use it in GitHub Desktop.
cat > /etc/vimrc <<'EOF'
syntax on
filetype indent plugin on
set nocompatible " Use Vim defaults (much better!)
set bs=indent,eol,start " allow backspacing over everything in insert mode
set viminfo='20,\"50 " read/write a .viminfo file, don't store more than 50 lines of registers
set history=50 " keep 50 lines of command line history
set fileencodings=utf-8,latin1
" Only do this part when compiled with support for autocommands
if has("autocmd")
augroup vim_server
" In text files, always limit the width of text to 78 characters
autocmd BufRead *.txt set tw=78
autocmd BufRead,BufReadPost,FileType * set formatoptions=qrc
autocmd BufNewFile,BufRead *.rb setlocal filetype=ruby
autocmd BufNewFile,BufRead Rakefile,Capfile setlocal filetype=ruby
autocmd BufNewFile,BufRead Vagrantfile setlocal filetype=ruby
autocmd FileType ruby setlocal ts=2 sts=2 sw=2 et nowrap
autocmd BufRead,BufNewFile *.pp setlocal ts=2 sts=2 sw=2 et nowrap filetype=puppet
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal! g'\"" |
\ endif
augroup END
endif
" Case:
set ignorecase " case insensitive:
set infercase " if there are caps adjust auto-completion
" TabStops:
set tabstop=4 " real tabs will show 8 spaces
set softtabstop=4 " how many spaces in a tabstop
set shiftwidth=4 " sw: indent size
set expandtab " no tabs - space in place of tabstops
set smarttab " sta: space in place of tabs in a new line
" Indent:
set autoindent " ai: pre-req for si
set smartindent " si: on
set copyindent " ci: copy same character used in previous indent line
set shiftround " round indent to shiftwidth
" Search:
set nohlsearch " Highlight search terms: off on start
set incsearch " Highlight dynamically as they are typed.
set gdefault " global search/replace by default
set report=0 " report all lines changed
" Line Breaks:
set linebreak " when wrapping, uses chars listed in breakt
set breakat=\ ^I!@*-+;:,./? " when wrapping, break at these characters
set showbreak=… " what to show at the start of a wrapped line
set iskeyword+=48-57,192-255
set iskeyword+=_,$,@,%,# " none of these are word dividers
" Matching Brackets:
set showmatch " show matching brackets
set matchtime=5 " ms blinking showmatch
" Wrapping Text:
set backspace=indent,eol,start " make backspace a more flexible
set nowrap " do not break lines
" Visible Characters:
set nolist " [no]list invisible chars
set listchars=tab:▸\ ,trail:·,eol:¬,extends:>,precedes:<
set nostartofline " keep cursor in same column when moving up/down
" Terminal vim:
set bg=dark
set t_Co=256 " Assume: Terminal 256 colors
colorscheme desert " try it first...
colorscheme wombat256mod " ...switch if present
set nu " line numbers
set ruler " show the cursor position always
set paste " correct paste on terminal
" Command Line:
set showcmd
set wildmode=list:longest " command line complete
""" Toggles
" on/off highlight search"
nmap ,h :set invhls<CR>
" on/off list chars
nmap ,l :set invlist<CR>
" on/off linenumbers
nmap ,n :set invnu<CR>
" Source a global configuration file if available
" if filereadable("/etc/vimrc.local")
" source /etc/vimrc.local
" endif
" vim:ft=vim
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment