Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
527 lines (431 sloc) 19.1 KB
" Set highlighting on"
:syntax on
set nocompatible " be iMproved, required
filetype off " required
set shell=/bin/bash
" Conceals javascript functions to f
set cole=2
let g:javascript_conceal = 1
" Redraw after performing script
set lazyredraw
" Auto-reload modified files (with no local changes)
:set autoread
:au FileChangedShell * echo "Warning: File changed on disk"
" Turn off backup and swap files
set nobackup
set nowritebackup
set noswapfile
" Incasesensitive search
"set incsearch
"set ignorecase
set smartcase " Ignore case if search pattern is all lowercase,
" Huh? what is this again?
let javascript_enable_domhtmlcss = 1
set mouse=a
" Wah, switch of the noise!
set noerrorbells visualbell t_vb= " No noise
" set the runtime path to include Vundle and initialize
set rtp+=~/dev/dotfiles/vim/vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
call vundle#begin('~/dev/dotfiles/vim/vim/bundle')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim' " Package manager
Plugin 'tyru/open-browser.vim' " Open link with CTRL G
Plugin 'vim-airline/vim-airline' " Nice statusbar
Plugin 'vim-airline/vim-airline-themes' " Nice statusbar
Plugin 'Shutnik/jshint2.vim' " Correct me on my javascript syntax
Plugin 'flazz/vim-colorschemes' " I can haz colors?
Plugin 'pangloss/vim-javascript' " Proper javascript syntax highlighting
Plugin 'plasticboy/vim-markdown' " Bowdown bitches for my markdown [1]
Plugin 'esneider/YUNOcommit.vim' " commit reminder for vim
"Plugin 'reedes/vim-lexical' " Spell-checks for writing
Plugin 'reedes/vim-colors-pencil' "Colorscheme for writing
Plugin 'reedes/vim-wordy' " Uncover usage problems in your writing
Plugin 'tpope/vim-fugitive' " Git on stereoids, well known to be awesome
Plugin 'kien/rainbow_parentheses.vim' " Rainbow parantheses highlighting
Plugin 'groenewege/vim-less' " Highlighting for less
Plugin 'scrooloose/nerdtree' " Folder viewing
Plugin 'scrooloose/syntastic' " Syntax validator, with options to follow styleguides
Plugin 'shime/livedown' " Live markdown previen, lets test it!
Plugin 'digitaltoad/vim-jade' " highlight jade
Plugin 'tommcdo/vim-fugitive-blame-ext' " Show commit messages in Gblame
Plugin 'tpope/vim-surround' " why didn't I use this one earlier? Nice tool to add/remove/change delimeters around strings
Plugin 'tpope/vim-repeat' " Allows vim-surround to repeat itself with the . command
Plugin 'tpope/vim-speeddating' " In/De-crement dates/time and more with CTRL-A/CTRL-X
Plugin 'godlygeek/tabular' " Serious hotness when needing to tab some stuff nicely, such as dicts or tables
Plugin 'airblade/vim-gitgutter' " Show +/- signs in front of the lines based on the git diff
Plugin 'mattboehm/vim-accordion' " Cool way to split windows
Plugin 'rondale-sc/vim-spacejam' " Auto remove whitespace
Plugin 'othree/html5.vim' " Don't freak out on HTML5 tags. OK?!!!
Plugin 'idanarye/vim-merginal' " Make git merging easier, run with :Merginal
Plugin 'koron/nyancat-vim' " just to shut down the emacs users [2]
"Plugin 'jaxbot/browserlink.vim' " Live update with browser and sync between inspect element
Plugin 'reedes/vim-textobj-sentence' " Better sententce hopping with ( and )
Plugin 'tpope/vim-liquid' " Vim doesn't choke anymore on some little jekyll code in HTML. Smooth!
Plugin 'ryanss/vim-hackernews' " HackerNews in vim! Open with :HackerNews
Plugin 'vim-latex/vim-latex' "LaTeX syntax highlighting in vim!
Plugin 'burnettk/vim-angular.git' " Shortcuts for angular file navigation
Plugin 'othree/javascript-libraries-syntax.vim' "Syntax for JavaScript libraries, including Angular. This is the hotness you want to autocomplete ng-repeat et al. in your html.
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim' "
Plugin 'garbas/vim-snipmate' " I think this is needed for other snippet plugins
Plugin 'honza/vim-snippets' " Snippets! Autocomplete after tabbing etc
Plugin 'matthewsimo/angular-vim-snippets' "Quick snippets for angular, such as ngfor<tab>
Plugin 'claco/jasmine.vim' " Jasmin plugin for unit testing
Plugin 'vim-scripts/FuzzyFinder' " Fuzzy file browser
Plugin 'vim-scripts/L9' " This was needed for fuzzyfinder
Plugin 'vasconcelloslf/vim-interestingwords' " highlight current word everywhere with shortcut
Plugin 'bonsaiben/bootstrap-snippets' " Bootstrap snippets
Plugin 'thinca/vim-localrc' " adopt vimrc in project directory
Plugin 'Chiel92/vim-autoformat' " Autoformat code
Plugin 'mhinz/vim-startify' " Nice start screen
Plugin 'easymotion/vim-easymotion' " nicest thing about vim, fast movement
Plugin 'editorconfig/editorconfig-vim' "Apparently the-standard for project editor configuration, jquery used this
Plugin 'kchmck/vim-coffee-script' " Syntax highighting for coffeescript
Plugin 'tpope/vim-abolish' " Convert variable to snake_case or camelCase
Plugin 'fatih/vim-go' " Syntax highlighter for go
Plugin 'PotatoesMaster/i3-vim-syntax' " Syntax highlighter for i3 config, add `# vim:filetype=i3` anywhere in your file in order to get it to work
Plugin 'dag/vim-fish' " Fish sugar for vim
Plugin 'scrooloose/nerdcommenter' " Comments on stereoids. I don't know how, but apparently this was uninstalled or not packed in the dotfiles.
Plugin 'juanpabloaj/vim-istanbul' " Include code coverage from istanbul in the files
Plugin 'heavenshell/vim-jsdoc' " Nice autocomplete for JSDoc
Plugin 'tpope/vim-git' " Nice syntax highlighting for git configs, diffs and editing patches
Plugin 'seyDoggy/vim-watchforchanges' " TODO Experiment, Should autoreload on
Plugin 'vim-scripts/mru.vim' " Save most recently used files to create open-recent script
Plugin 'myw/vim-polymer' " Polylint syntastic checker and includes HTM/CSS syntax for polymer elements
" Experiment with tern
"Plugin 'Valloric/YouCompleteMe'
"Plugin 'marijnh/tern_for_vim'
"let g:ycm_path_to_python_interpreter = '/usr/bin/python'
"set complete-=i
"Plugin 'reedes/vim-pencil' " Hopefully better text wrapping. Lets see if we
"can do it without. No, but it requires some (re-)configuration.
"
"Plugin 'marijnh/tern_for_vim' " suggestions as you type. Slower than
"christmas.
"Plugin 'jaxbot/github-issues.vim' " Acted annoying with bad networks. Blocked
"the entire git commit flow.
"Plugin 'msanders/snipmate.vim' " Didn't work for most items. Didn't want to
"fine tune. Auto complete snippets, like type: for<tab> and it will give you a for loop
"Plugin 'Facebook/vim-flow.git' " Static typing in javascript <- didn't work so smooth. Basically copied the flow output to the buffer when saving a file
"Plugin 'tpope/vim-unimpaired' " Tpope is a fucking hero, somebody please enlighten me what this thing does?
"Plugin 'skammer/vim-css-color' " #slow Gives colors in CSS a nice example
"Plugin 'teddywing/auditory.vim' "Sound effects! VERY ANNOYING!!!
"Plugin 'Valloric/YouCompleteMe'
"commented out because it was not compatible
"with my vim installation
"Plugin 'Raimondi/delimitMate' was very annoying, didn't allow me to delete
"the characters
"Plugin 'chrisbra/csv.vim' Didn't work so well, check it out again
"Plugin 'reedes/vim-wheel' " Make scrollwheel scroll vim. Didn't work on osx
"Plugin 'nathanaelkane/vim-indent-guides'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" Make F2 a button to toggle pastemode
set pastetoggle=<F2>
" Highlight the current line"
set cursorline
" Let the cursor line be toggled on and off by F3
map <F9> :set cursorline!<CR>
set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " a ruler on steroids
set ff=unix
set history=1000 " Store a ton of history (default is 20)
set nu " Line numbers on
set showmatch " show matching brackets/parenthesis
set scrolljump=5 " lines to scroll when cursor leaves screen
"set hlsearch " highlight search terms
set relativenumber " Make line numbers relative
set number " Show linenumbers
set equalalways " make splits equal size
" Color settings
colorscheme candy
set t_Co=256
let g:airline_theme = "kolor"
" for writing, use calmar-256-light
" Key (re)Mappings {
let mapleader = ','
" Easier moving in tabs and windows
map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_
map <C-L> <C-W>l<C-W>_
map <C-H> <C-W>h<C-W>_
" Shortcuts
" Change Working Directory to that of the current file
"cmap cwd lcd %:p:h
"cmap cd. lcd %:p:h
"lcd %:p:h
map <leader>ff :999winc ><CR>
" visual shifting (does not exit Visual mode)
vnoremap < <gv
vnoremap > >gv
"Open selected link
nmap gx <Plug>(openbrowser-smart-search)
vmap gx <Plug>(openbrowser-smart-search)
" fix my js with the leader+k command
map <Leader>k ;execute ":w !fixmyjs " . expand("%")<CR>:edit<CR>
" Map jj to ESC, #experimental - i hope to downcrease my hand movement to
" the esc key
" I mapped this to hh because Its right under my index finger in dvorak.
" DISABLED. Made the h key type slower.;w
"inoremap hh <ESC>
" jshint validation
nnoremap <silent><F5> :JSHint<CR>
inoremap <silent><F5> <C-O>:JSHint<CR>
vnoremap <silent><F5> :JSHint<CR>
" show next jshint error
nnoremap <silent><F6> :lnext<CR>
inoremap <silent><F6> <C-O>:lnext<CR>
vnoremap <silent><F6> :lnext<CR>
" show previous jshint error
nnoremap <silent><F7> :lprevious<CR>
inoremap <silent><F7> <C-O>:lprevious<CR>
vnoremap <silent><F7> :lprevious<CR>
" }
"
" Formatting {
set tw=79
set nowrap " wrap long lines
" uncommented to use default text editing settings
set smartindent
set tabstop=4
" The settings for indentaion
set shiftwidth=4
set expandtab
"set autoindent " indent at the same level of the previous line
"set shiftwidth=4 " use indents of 4 spaces
"set expandtab " tabs are spaces, not tabs
"set tabstop=4 " an indentation every four columns
"set softtabstop=4 " let backspace delete indent
" }
" Indent guides {
"let g:indent_guides_start_level = 2
"let g:indent_guides_guide_size = 1
"let g:indent_guides_enable_on_vim_startup = 1
"let g:indent_guides_auto_olors = 0
"autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=3
"autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=4
"" }
"" Fugitive {
"nnoremap <silent> <leader>gs :Gstatus<CR>
"nnoremap <silent> <leader>gd :Gdiff<CR>
"nnoremap <silent> <leader>gc :Gcommit<CR>
"nnoremap <silent> <leader>gb :Gblame<CR>
"nnoremap <silent> <leader>gl :Glog<CR>
"nnoremap <silent> <leader>gp :Git push<CR>
""}
if has('statusline')
set laststatus=2
" Broken down into easily includeable segments
set statusline=%<%f\ " Filename
set statusline+=%w%h%m%r " Options
if has('fugitive')
set statusline+=%{fugitive#statusline()} " Git Hotness
endif
set statusline+=\ [%{&ff}/%Y] " filetype
"set statusline+=\ [%{getcwd()}] " current dir
set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info
endif
" Highlight parantheses
set showmatch
" Markdown highlighting {
let g:vim_markdown_folding_disabled=1
"}
"" Spell checker settings
"augroup lexical
"autocmd!
"" Only spellcheck text files, checking on code will make everything slow
"autocmd FileType md,text,markdown,mkd call lexical#init()
"autocmd FileType textile call lexical#init()
"autocmd FileType text call lexical#init({ 'spell': 0 })
"" Define thesaurus dictionary
"let g:lexical#thesaurus = ['~/dev/thesaurus/mthesaur.txt',]
"" Lookup the word in thesaurus
"let g:lexical#thesaurus_key = '<leader>t'
"" Add more languages
"let g:lexical#spelllang = ['en_us', 'en_ca', 'nl']
"augroup END
"augroup Filetype markdown
"" set linebreak on
":set wrap " wrap long lines
"" Disable cursorline. When writing long texts on line this will be very annoying
":set nocursorline
"augroup END
" Highlight text longer than 79 characters to prevent long lines
"highlight OverLength ctermbg=red ctermfg=white guibg=#592929
"match OverLength /\%81v.\+/
" Rainbow parathesees highlighing
"au VimEnter * RainbowParenthesesToggle
" " au Syntax * RainbowParenthesesLoadRound
" au Syntax * RainbowParenthesesLoadSquare
" au Syntax * RainbowParenthesesLoadBraces
"====[ Make the 81st column stand out ]====================
highlight ColorColumn ctermbg=magenta
call matchadd('ColorColumn', '\%81v', 100)
"====[ Highlight the relative line numbers gray / yellow ]=
highlight LineNr ctermfg=238 ctermbg=0
highlight CursorLineNr ctermfg=gray ctermbg=0
"====[ Make tabs, trailing whitespace, and non-breaking spaces visible ]======
"exec "set listchars=trail:\uB7,nbsp:~"
"set list
"====[ Swap : and ; to make colon commands easier to type ]======
nnoremap ; :
nnoremap : ;
"====[ Shorthand to toggle a list to a sentence, or in reverse ]======
nmap <leader>l :call ListTrans_toggle_format()<CR>
vmap <leader>l :call ListTrans_toggle_format('visual')<CR>
"====[ Better digraph interactions ]======
inoremap <expr> <C-K> HUDG_GetDigraph()
"====[ math on visual regions ]======
" Mapped to the vmath plugin
vmap <expr> <leader>+ VMATH_YankAndAnalyse()
nmap <leader>+ vip++
"====[ make the gitgutter colors look nice ]======
highlight clear SignColumn
"====[ Drag block selection around with arrow keys ]======
vmap <expr> <LEFT> DVB_Drag('left')
vmap <expr> <RIGHT> DVB_Drag('right')
vmap <expr> <DOWN> DVB_Drag('down')
vmap <expr> <UP> DVB_Drag('up')
" Use D to duplicate a block
vmap <expr> D DVB_Duplicate()
"====[ Underline badly spelled words ]======
hi SpellBad term=reverse cterm=undercurl gui=undercurl guisp=NONE ctermbg=NONE
" Smooth note searching
command! -nargs=1 Ngrep grep "<args>" ~/PlainText/*.md
nnoremap <leader>[ :Ngrep
" FuzzyFinder {{{2
nnoremap '<Space> :FufBookmarkDir<cr>
nnoremap '. :FufFileWithCurrentBufferDir<cr>
nnoremap '' :b#<cr>
nnoremap '/ :FufFile /<cr>
nnoremap 'a :FufFile app/<cr>
nnoremap 'd :FufFile $HOME/Dropbox/<cr>
nnoremap 'f :FufFile<cr>
nnoremap 'h :FufFile $HOME/<cr>
nnoremap 'j :FufFile $HOME/.vim/<cr>
nnoremap 'k :FufBuffer<cr>
nnoremap 'l :FufTag<cr>
nnoremap 'n :FufFile $NOTES_DIR/<cr>
nnoremap 'p :e! ${PASSWORD_FILE}.gpg<cr>
nnoremap 'r :e! $HOME/.bashrc<cr><cr>
nnoremap 's :FufFile spec/<cr>
nnoremap 't :cd %:p:h<cr>:sh<cr>:cd -<cr>
nnoremap 'v :e! $MYVIMRC<cr><cr>
nnoremap 'w :FufFile $HOME/PlainText/<cr>
nnoremap 'b :FufFile $HOME/dev/riichard/_posts/<cr>
let g:fuf_file_exclude = '\v\~$|\.(DS_Store|o|exe|dll|bak|orig|swp)$|(^|[/\\])\.(hg|git|bzr)($|[/\\])'
let g:fuf_buffer_keyDelete = '<C-d>'
" Keep search matches in the middle of the screen
nnoremap n nzzzv
nnoremap N Nzzzv
" Save file when loosing focus in vim, there is never a moment I don't want to
" save a file. Plus, time machine and dropbox keep backups
au FocusLost * :wa
" Open a quickfix window with all search matches of last performed search.
nnoremap <silent> <leader>/ :execute 'vimgrep /'.@/.'/g %'<CR>:copen<CR>
" Highlight interesting words configuration. Whenever I'm on a word, I can
" highlight that particular word everywhere in the code
nnoremap <silent> <leader>i :call InterestingWords('n')<cr>
nnoremap <silent> <leader>I :call UncolorAllWords()<cr>
" Quickly edit configuration files
nnoremap <leader>ev <C-W>s<C-W>j<C-w>L:e ~/dev/dotfiles/vim/vimrc<cr>
nnoremap <leader>er <C-W>s<C-W>j<C-w>L:e ~/dev/dotfiles/VIMREADME.md<cr>
nnoremap <leader>el <C-W>s<C-W>j<C-w>L:e ~/dev/dotfiles/<cr>
nnoremap <leader>ef <C-W>s<C-W>j<C-w>L:e ~/dev/dotfiles/fish/config.fish<cr>
nnoremap <leader>ec <C-W>s<C-W>j<C-w>L:e ~/dev/dotfiles/chrome/vromerc<cr>
nnoremap <leader>em <C-W>s<C-W>j<C-w>L:e ~/dev/dotfiles/mutt/muttrc<cr>
nnoremap <leader>et <C-W>s<C-W>j<C-w>L:e ~/dev/dotfiles/tmux/config.conf<cr>
" Quick jumps with H and L to beginning or end of line
nnoremap H ^
nnoremap L $
" Open non text files with the system file handler
augroup nonvim
au!
au BufRead *.png,*.jpg sil exe "!open " . shellescape(expand("%:p")) | bd | let &ft=&ft
augroup end
" Configure JSDoc Plugin
let g:jsdoc_allow_input_prompt = 1 " Allow interactive input prompt
let g:jsdoc_input_description = 1 " Prompt for function description
nmap <silent> <leader>m :call JsDoc()<cr>
" Pretty Json
fu! Prettyjson()
:%! python -m json.tool
endfunction
" Check syntax with jscs
" Syntax validator
let g:syntastic_javascript_checkers=['jshint', 'eslint', 'jscs']
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_wq = 0
" Check on open=1 makes the startup really slow, so I set it to false
let g:syntastic_check_on_open = 0
noremap <silent> <Leader>W :call ToggleWrap()<CR>
function ToggleWrap()
if &wrap
echo "Wrap OFF"
setlocal nowrap
set virtualedit=all
silent! nunmap <buffer> <Up>
silent! nunmap <buffer> <Down>
silent! nunmap <buffer> <Home>
silent! nunmap <buffer> <End>
silent! iunmap <buffer> <Up>
silent! iunmap <buffer> <Down>
silent! iunmap <buffer> <Home>
silent! iunmap <buffer> <End>
else
echo "Wrap ON"
setlocal wrap linebreak nolist
set virtualedit=
setlocal display+=lastline
noremap <buffer> <silent> <Up> gk
noremap <buffer> <silent> <Down> gj
noremap <buffer> <silent> <Home> g<Home>
noremap <buffer> <silent> <End> g<End>
inoremap <buffer> <silent> <Up> <C-o>gk
inoremap <buffer> <silent> <Down> <C-o>gj
inoremap <buffer> <silent> <Home> <C-o>g<Home>
inoremap <buffer> <silent> <End> <C-o>g<End>
noremap <buffer> <silent> k gk
noremap <buffer> <silent> j gj
noremap <buffer> <silent> 0 g0
noremap <buffer> <silent> $ g$
endif
endfunction
function! PecoOpen()
for filename in split(system("git ls-files | peco"), "\n")
execute "e" filename
endfor
redraw!
endfunction
nnoremap <Leader>op :call PecoOpen()<CR>
" Removes trailing spaces
function! TrimWhiteSpace()
%s/\s\+$//e
endfunction
nnoremap <silent> <Leader>rts :call TrimWhiteSpace()<CR>
autocmd FileWritePre * :call TrimWhiteSpace()
autocmd FileAppendPre * :call TrimWhiteSpace()
autocmd FilterWritePre * :call TrimWhiteSpace()
autocmd BufWritePre * :call TrimWhiteSpace()
" Footnotes
" [1] I don't think much geeks will get this joke. But I'm referring to beyonce
" here: https://www.youtube.com/watch?v=IyuUWOnS9BY
" [2] http://nyan-mode.buildsomethingamazing.com/
"