Skip to content

Instantly share code, notes, and snippets.

@hdragomir
Last active Oct 12, 2015
Embed
What would you like to do?
By popular demand
autocmd!
set nocompatible
let mapleader = ","
filetype on
set title
set ai
set relativenumber
set cursorline
set expandtab expandtab
set smartindent
set tabstop=2
set shiftwidth=2
set fdm=indent
setlocal fdm=indent
highlight Pmenu ctermfg=1 ctermbg=4 guibg=grey30
set bs=indent,eol,start
au BufNewFile,BufRead *.js* set filetype=javascript
au BufNewFile,BufRead *.less set filetype=less
au BufNewFile,BufRead Podfile set filetype=ruby
au BufNewFile,BufRead *.podspec set filetype=ruby
au BufNewFile,BufRead *.coffee set filetype=coffee
au BufNewFile,BufReadPost *.coffee setl foldmethod=indent nofoldenable
au BufNewFile,BufRead *.hulk set filetype=html
set listchars=tab:▸\ ,trail:.,extends:>,precedes:<,nbsp:.
set list
set textwidth=0
set wrapmargin=0
if &t_Co > 2 || has("gui_running")
syntax on
endif
set t_Co=256
set nobackup
set nowritebackup
set backupdir=~/.vim/backups
set directory=~/.vim/swaps
set undodir=~/.vim/undo
filetype plugin on
autocmd FileType javascript setlocal expandtab shiftwidth=2 softtabstop=2 foldmethod=syntax
autocmd FileType css setlocal foldmethod=indent shiftwidth=2 tabstop=2
function! JavaScriptFold()
setl foldmethod=syntax
setl foldlevelstart=1
syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend
function! FoldText()
return substitute(getline(v:foldstart), '{.*', '{...}', '')
endfunction
setl foldtext=FoldText()
endfunction
au FileType javascript call JavaScriptFold()
au FileType less call JavaScriptFold()
au FileType css call JavaScriptFold()
colorscheme herald
if has("gui_running")
set guioptions=egmrt
endif
set encoding=utf-8
set scrolloff=3
set autoindent
set showmode
set showcmd
set hidden
set wildmenu
set wildmode=list:longest
set visualbell
set ttyfast
set ruler
set backspace=indent,eol,start
set laststatus=2
set undofile
nnoremap / /\v
vnoremap / /\v
nnoremap ? ?\v
vnoremap ? ?\v
set ignorecase
set smartcase
set gdefault
set incsearch
set showmatch
set matchtime=2
set laststatus=2
set hlsearch
nnoremap <tab> %
vnoremap <tab> %
inoremap jj <ESC>j
inoremap kk <ESC>k
nnoremap j gj
vnoremap j gj
nnoremap k gk
vnoremap k gk
set nowrap
set guifont=Monaco:h14
set modelines=0
nnoremap <leader><space> :noh<return>
nnoremap <leader>gs :Gstatus<return>
nnoremap <leader>g :!git<space>
nnoremap <leader>a :Ack<space>-i<space>
nnoremap <leader>A :Ack<space>-i<space><C-R><C-W><CR>
nnoremap <leader>f :grep<space>-re<space><C-R><C-W><space>.<CR>
nnoremap <leader>fnd :grep<space>-re<space><C-R><C-W><space>%:p:h<CR>
nnoremap <leader>cd :lcd %:p:h<CR>
nnoremap <leader>s :%s/<C-R><C-W>/
fun! Dos2unix()
%s/
/\r/
endfun
fun! CMDC ()
! pbcopy < %
endfun
fun! <SID>StripTrailingWhitespaces()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces()
so ~/.vimrc-emmet
au BufWritePost .vimrc so ~/.vimrc
autocmd vimenter * if !argc() | NERDTree | endif
map <C-n> :NERDTreeToggle<CR>
map <leader>jt <Esc>:%!json_xs -f json -t json-pretty<CR>
map <leader>o :FufFileWithCurrentBufferDir<CR>
map <leader>O :FufFileWithFullCwd<CR>
execute pathogen#infect()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment