Skip to content

Instantly share code, notes, and snippets.

@mahcloud
Created July 28, 2015 18:30
Show Gist options
  • Select an option

  • Save mahcloud/393b8a2a958405c4f997 to your computer and use it in GitHub Desktop.

Select an option

Save mahcloud/393b8a2a958405c4f997 to your computer and use it in GitHub Desktop.
My vimrc file
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
" you can find below. If you wish to change any of those settings, you should
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
" everytime an upgrade of the vim packages is performed. It is recommended to
" make changes after sourcing debian.vim since it alters the value of the
" 'compatible' option.
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim
" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible
" Vim5 and later versions support syntax highlighting. Uncommenting the
" following enables syntax highlighting by default.
" if has("syntax")
" syntax on
" endif
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
set term=screen-256color-bce
set number
syntax enable
let g:solarized_termcolors=256
" let g:solarized_termcolors = &t_Co
let g:solarized_termtrans = 1
set background=dark
colorscheme solarized
" Uncomment the following to have Vim jump to the last position when
" reopening a file
"if has("autocmd")
" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"endif
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
if has("autocmd")
filetype plugin indent on
endif
filetype off
call pathogen#infect()
call pathogen#helptags()
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd " Show (partial) command in status line.
"set showmatch " Show matching brackets.
"set ignorecase " Do case insensitive matching
"set smartcase " Do smart case matching
"set incsearch " Incremental search
"set autowrite " Automatically save before commands like :next and :make
"set hidden " Hide buffers when they are abandoned
"set mouse=a " Enable mouse usage (all modes)
" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
filetype plugin on
set binary noeol
:ab setphp :setfiletype php
:ab sethtml :setfiletype html
function! Compass()
:!compass
endfunction
function! SetPHP()
:setfiletype php
endfunction
function! SetJavaScript()
:setfiletype javascript
endfunction
function! SetHtml()
:setfiletype html
endfunction
nnoremap <Leader>php :call SetPHP()<Enter>
nnoremap <Leader>html :call SetHtml()<Enter>
nnoremap <Leader>JavaScript :call SetJavaScript()<Enter>
nnoremap <Leader>compass :call Compass()<Enter>
command PHP :call SetPHP()
command HTML :call SetHtml()
command JavaScript :call SetJavaScript()
command Compass :call Compass()
:autocmd FileType mail :nmap <F8> :w<CR>:!aspell -e -c %<CR>:e<CR>
:set backspace=indent,eol,start
:set hlsearch
:set viminfo='50,<1000,s100,:0,n~/.viminfo'
:let mapleader = ","
"au BufRead,BufNewFile *.js set ts=4
au BufRead,BufNewFile *.json set filetype=json
au BufRead,BufNewFile *.scss set filetype=scss
au BufRead,BufNewFile *.scss set et
au BufRead,BufNewFile *.scss set sw=2
au BufRead,BufNewFile *.scss set sts=2
au BufRead,BufNewFile *.scss set smarttab
au BufRead,BufNewFile *.es6 set filetype=scss
au BufRead,BufNewFile *.es6 set et
au BufRead,BufNewFile *.es6 set sw=2
au BufRead,BufNewFile *.es6 set sts=2
au BufRead,BufNewFile *.es6 set smarttab
au BufRead,BufNewFile *.es6 set filetype=ruby
au BufRead,BufNewFile *.rb set et
au BufRead,BufNewFile *.rb set sw=2
au BufRead,BufNewFile *.rb set sts=2
au BufRead,BufNewFile *.rb set smarttab
au BufRead,BufNewFile *.coffee set et
au BufRead,BufNewFile *.coffee set sw=2
au BufRead,BufNewFile *.coffee set sts=2
au BufRead,BufNewFile *.coffee set smarttab
au BufRead,BufNewFile *.coffee set filetype=ruby
au BufRead,BufNewFile *.feature set et
au BufRead,BufNewFile *.feature set sw=2
au BufRead,BufNewFile *.feature set sts=2
au BufRead,BufNewFile *.feature set smarttab
au BufRead,BufNewFile *.rake set et
au BufRead,BufNewFile *.rake set sw=2
au BufRead,BufNewFile *.rake set sts=2
au BufRead,BufNewFile *.rake set smarttab
au BufRead,BufNewFile *.erb set et
au BufRead,BufNewFile *.erb set sw=2
au BufRead,BufNewFile *.erb set sts=2
au BufRead,BufNewFile *.erb set smarttab
"au BufRead,BufNewFile *.erb set filetype=erb
au BufRead,BufNewFile *.haml set et
au BufRead,BufNewFile *.haml set sw=2
au BufRead,BufNewFile *.haml set sts=2
au BufRead,BufNewFile *.haml set smarttab
"au BufRead,BufNewFile *.haml set filetype=haml
au BufRead,BufNewFile *.builder set et
au BufRead,BufNewFile *.builder set sw=2
au BufRead,BufNewFile *.builder set sts=2
au BufRead,BufNewFile *.builder set smarttab
au BufRead,BufNewFile *.builder set filetype=ruby
au BufRead,BufNewFile Rakefile set et
au BufRead,BufNewFile Rakefile set sw=2
au BufRead,BufNewFile Rakefile set sts=2
au BufRead,BufNewFile Rakefile set smarttab
au BufRead,BufNewFile Rakefile set filetype=ruby
au BufRead,BufNewFile Capfile set et
au BufRead,BufNewFile Capfile set sw=2
au BufRead,BufNewFile Capfile set sts=2
au BufRead,BufNewFile Capfile set smarttab
au BufRead,BufNewFile Capfile set filetype=ruby
au BufRead,BufNewFile Gemfile set et
au BufRead,BufNewFile Gemfile set sw=2
au BufRead,BufNewFile Gemfile set sts=2
au BufRead,BufNewFile Gemfile set smarttab
au BufRead,BufNewFile Gemfile set filetype=ruby
au BufRead,BufNewFile *.yml set et
au BufRead,BufNewFile *.yml set sw=2
au BufRead,BufNewFile *.yml set sts=2
au BufRead,BufNewFile *.yml set smarttab
au BufRead,BufNewFile *.yml set filetype=ruby
au BufRead,BufNewFile *.god set et
au BufRead,BufNewFile *.god set sw=2
au BufRead,BufNewFile *.god set sts=2
au BufRead,BufNewFile *.god set smarttab
au BufRead,BufNewFile *.god set filetype=ruby
au BufRead,BufNewFile 1kb-cron set filetype=crontab
augroup json_autocmd
autocmd!
autocmd FileType json set autoindent
autocmd FileType json set formatoptions=tcq2l
autocmd FileType json set textwidth=78 shiftwidth=2
autocmd FileType json set softtabstop=2 tabstop=8
autocmd FileType json set expandtab
autocmd FileType json set foldmethod=syntax
augroup END
" Commenting blocks of code.
autocmd FileType ruby let b:comment_leader = '# '
noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment