Created
May 20, 2014 14:35
-
-
Save hansent/5289ca68d93675ded5f5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
filetype off | |
" Vundle | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
let g:vundle_default_git_proto = 'git' | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'ColorSchemeMenuMaker' | |
Plugin 'Lokaltog/vim-distinguished' | |
Plugin 'Lokaltog/vim-easymotion' | |
Plugin 'Rykka/colorv.vim' | |
Plugin 'Shougo/neocomplete.vim' | |
Plugin 'Shougo/neosnippet-snippets' | |
Plugin 'Shougo/neosnippet.vim' | |
Plugin 'Shougo/unite.vim' | |
Plugin 'Shougo/vimfiler.vim' | |
Plugin 'Shougo/wildfire.vim' | |
Plugin 'Valloric/MatchTagAlways' | |
"Plugin 'ap/vim-css-color' | |
Plugin 'bilalq/lite-dfm' | |
Plugin 'bling/vim-airline' | |
Plugin 'desert-warm-256' | |
Plugin 'digitaltoad/vim-jade' | |
Plugin 'flazz/vim-colorschemes' | |
Plugin 'goatslacker/mango.vim' | |
Plugin 'godlygeek/tabular' | |
Plugin 'groenewege/vim-less' | |
Plugin 'honza/vim-snippets' | |
Plugin 'kshenoy/vim-signature' | |
Plugin 'leshill/vim-json' | |
Plugin 'marijnh/tern_for_vim' | |
Plugin 'mattn/emmet-vim' | |
Plugin 'mattn/webapi-vim' | |
Plugin 'mbbill/undotree' | |
Plugin 'mhinz/vim-signify' | |
Plugin 'mhinz/vim-startify' | |
Plugin 'moll/vim-node' | |
Plugin 'mustache/vim-mustache-handlebars' | |
Plugin 'othree/html5.vim' | |
Plugin 'pangloss/vim-javascript' | |
Plugin 'scrooloose/nerdcommenter' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'scrooloose/syntastic' | |
Plugin 'terryma/vim-multiple-cursors' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'tpope/vim-surround' | |
Plugin 'vim-scripts/Rainbow-Parenthsis-Bundle' | |
Plugin 'wavded/vim-stylus' | |
call vundle#end() | |
let mapleader="," | |
filetype plugin indent on | |
syntax on | |
colorscheme hybrid | |
set guifont=Source\ Code\ Pro\ for\ Powerline:h14 | |
" Mappings | |
"============================================================================== | |
"edit vimrc | |
noremap <leader>vv :e ~/.vimrc<CR> | |
"F!%*ing WRITE IT | |
cmap W! w !sudo tee % >/dev/null | |
"fix indent for whole file | |
noremap <leader>gg gg=G`` | |
" remove trailing whitespace | |
noremap <leader>w :call StripTrailingWhiteSpace()<CR> | |
"keep selection for indnet in visual mode | |
vnoremap > >gv | |
vnoremap < <gv | |
"match bracktes | |
nnoremap <C-tab> v% | |
vnoremap <C-tab> % | |
"buffer window | |
nnoremap <c-left> <c-w><left> | |
nnoremap <c-right> <c-w><right> | |
nnoremap <c-up> <c-w><up> | |
nnoremap <c-down> <c-w><down> | |
"focus mode | |
nnoremap <Leader>z :LiteDFMToggle<CR> | |
"emmet select enclosing tag | |
"map <A-up> <C-y>d | |
"map <A-down> <C-y>D | |
nnoremap <D-e> :NERDTreeToggle<CR> | |
" Remove the Windows ^M - when the encodings gets messed up | |
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm | |
" Toggle paste mode on and off | |
nnoremap <leader>pp :setlocal paste!<cr> | |
"plugin options | |
"============================================================================= | |
" Use NeoComplete | |
let g:neocomplete#enable_at_startup = 1 | |
let g:neocomplete#force_overwrite_completefunc = 1 | |
let g:neocomplete#data_directory = '~/.vim/neocomplcache' | |
let g:neocomplete#auto_completion_start_length = 2 | |
let g:neocomplete#manual_completion_start_length = 0 | |
let g:neocomplete#min_keyword_length = 3 | |
let g:neocomplete#enable_auto_close_preview = 1 | |
" NeoSnippet | |
let g:neosnippet#enable_snipmate_compatibility = 1 | |
" Plugin key-mappings. | |
imap <C-k> <Plug>(neosnippet_expand_or_jump) | |
smap <C-k> <Plug>(neosnippet_expand_or_jump) | |
xmap <C-k> <Plug>(neosnippet_expand_target) | |
" SuperTab like snippets behavior. | |
imap <expr><TAB> neosnippet#expandable_or_jumpable() ? | |
\ "\<Plug>(neosnippet_expand_or_jump)" | |
\: pumvisible() ? "\<C-n>" : "\<TAB>" | |
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? | |
\ "\<Plug>(neosnippet_expand_or_jump)" | |
\: "\<TAB>" | |
" Unite | |
let g:unite_prompt = ' >' | |
let g:unite_enable_start_insert = 1 | |
let g:unite_winheight = 10 | |
let g:unite_source_history_yank_enable = 1 | |
call unite#filters#matcher_default#use(['matcher_fuzzy']) | |
nnoremap <leader>e :<C-u>Unite -buffer-name=files -default-action=above -start-insert file_rec<cr> | |
nnoremap <leader>o :<C-u>Unite -buffer-name=outline -default-action=above -start-insert outline<cr> | |
nnoremap <leader>b :<C-u>Unite -buffer-name=buffer -default-action=above buffer<cr> | |
nnoremap <leader>y :<C-u>Unite history/yank<CR> | |
"airline | |
let g:airline_powerline_fonts = 1 | |
let g:airline#extensions#whitespace#enabled = 1 | |
let g:bufferline_echo = 1 | |
autocmd VimEnter * AirlineTheme powerlineish | |
autocmd VimEnter * AirlineRefresh | |
"wildfire | |
let g:wildfire_objects = { | |
\ "*" : ["i'", 'i"', "i)", "i]", "i}", "ip"], | |
\ "html,xml" : ["at"], | |
\ } | |
"zoom window | |
let g:lite_dfm_left_offset = 5 | |
"editor settings | |
"==================================================================== | |
filetype plugin indent on | |
set encoding=utf-8 | |
set ffs=unix,dos,mac | |
"tabing | |
set tabstop=4 | |
set expandtab | |
set shiftwidth=4 | |
set smarttab | |
set backspace=indent,eol,start | |
"visual and visual-block mode | |
set ve=all | |
"search | |
set hlsearch | |
set incsearch | |
set smartcase | |
"misc | |
set autoread | |
set hidden | |
set number | |
set laststatus=2 | |
set cursorline | |
set showmatch | |
set virtualedit=onemore | |
set winminheight=1 | |
set mousefocus | |
"wildmenu | |
set wildmenu | |
set wildmode=list:longest | |
set wildignore+=*DS_Store* | |
set wildignore=*.o,*.obj,*~ | |
"line wrapping | |
set nowrap | |
set whichwrap+=<,>,h,l,[,] | |
"allow hidden buffer and backup files somewhere else | |
set hidden | |
set backupdir=~/.vim/sessions | |
set dir=~/.vim/sessions | |
set viminfo+=n~/.vim/viminfo | |
"save undo history | |
if has("persistent_undo") | |
set undofile | |
set undodir=$HOME/.vim/undo | |
set undolevels=1000 | |
set undoreload=10000 | |
endif | |
" turn off any kind of bell | |
set gcr=a:blinkon0 | |
set noerrorbells | |
set vb | |
set guioptions-=T "dont show gui toolbar | |
set guioptions-=r "remove right- and left-hand scrollbars | |
set guioptions-=L | |
set guioptions-=m "dont show menu | |
"filetype behaviour / auto commands | |
"============================================================================= | |
"reload vimrc on save | |
autocmd BufWritePost ~/.vimrc source ~/.vimrc | |
" When editing a file, always jump to the last known cursor position. | |
autocmd BufReadPost * | |
\ if line("'\"") > 0 && line("'\"") <= line("$") | | |
\ exe "normal g`\"" | | |
\ endif | |
"smart tab in html files so we can tab complete emmet completions | |
autocmd FileType html imap <buffer><expr><tab> <sid>expand_html_tab() | |
" functions | |
"============================================================================= | |
fun! StripTrailingWhiteSpace() | |
let l = line(".") | |
let c = col(".") | |
%s/\s\+$//e | |
call cursor(l, c) | |
endfun | |
function! Jsformat() | |
let regel=line(".") | |
%!jsfmt --format=true | |
call cursor(regel, 1) | |
endfunction | |
function! s:expand_html_tab() | |
" first try to expand any neosnippets | |
if neosnippet#expandable_or_jumpable() | |
return "\<Plug>(neosnippet_expand_or_jump)" | |
endif | |
" try to determine if we're within quotes or tags. | |
" if so, assume we're in an emmet fill area. | |
let line = getline('.') | |
if col('.') < len(line) | |
let line = matchstr(line, '[">][^<"]*\%'.col('.').'c[^>"]*[<"]') | |
if len(line) >= 2 | |
return "\<C-y>n" | |
endif | |
endif | |
" go to next item in a popup menu. | |
" this will insert a snippet if it's selected in the menu | |
" due to neosnippets being the first check. | |
if pumvisible() | |
return "\<C-n>" | |
endif | |
" expand anything emmet thinks is expandable. | |
" I'm not sure anything happens below this block. | |
if emmet#isExpandable() | |
return "\<C-y>," | |
endif | |
" return a regular tab character | |
return "\<tab>" | |
endfunction | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment