Skip to content

Instantly share code, notes, and snippets.

@jayeheffernan
Created April 18, 2016 04:38
Show Gist options
  • Save jayeheffernan/377898e05c560610bb279ca97c77a000 to your computer and use it in GitHub Desktop.
Save jayeheffernan/377898e05c560610bb279ca97c77a000 to your computer and use it in GitHub Desktop.
Vim Config
" Clear autocommands to avoid running twice
autocmd!
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugins
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'maxbrunsfeld/vim-yankstack'
Plugin 'kien/ctrlp.vim'
Plugin 'mihaifm/bufstop'
Plugin 'godlygeek/tabular'
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-surround'
Plugin 'kien/rainbow_parentheses.vim'
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
Plugin 'scrooloose/syntastic'
Plugin 'ervandew/supertab'
Plugin 'nanotech/jellybeans.vim'
Plugin 'easymotion/vim-easymotion'
Plugin 'jelera/vim-javascript-syntax'
Plugin 'pangloss/vim-javascript'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'Raimondi/delimitMate'
Plugin 'scrooloose/nerdcommenter'
call vundle#end()
"For plugin manager
filetype plugin indent on
"For snipmate plugin
syntax on
"For CtrlP plugin
let g:ctrlp_show_hidden = 1
let g:ctrlp_working_path_mode = '~'
let delimitMate_expand_space = 1
let delimitMate_expand_cr = 1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Mappings
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let mapleader=","
"Easy exit insert mode
inoremap <C-e> <Esc>
"Move right in insert mode
inoremap <C-l> C
"Start new line
inoremap <C-j> <C-o>o
nnoremap > >>
nnoremap < <<
"For yankstack plugin
let g:yankstack_map_keys = 0
call yankstack#setup()
nmap <leader>p <Plug>yankstack_substitute_older_paste
nmap <leader>P <Plug>yankstack_substitute_newer_paste
nnoremap <Space> :
vnoremap <Space> :
nnoremap : ,
nnoremap <leader>w :w<return>
nnoremap <Leader>n :tabnew<return>
"Switch to alternate buffer
nnoremap <leader>a :buffer #<return>
"Toggle spell-check
nnoremap <leader>s :set spell!<CR>
"Toggle highlighting of search results
nnoremap <leader>h :set hlsearch!<CR>
"EasyMotion
let g:EasyMotion_do_mapping = 0 " Disable default mappings
nmap <leader>m <Plug>(easymotion-jumptoanywhere)
nmap <leader>k <Plug>(easymotion-bd-jk)
let g:EasyMotion_keys = 'bgjvkz.x,cmq;wyfupldhaorisetn'
"Buffer selector, ordered by last accessed
nnoremap <leader>b :BufstopFast<return>
"Undo all changes since last write
nnoremap <leader>u :earlier 1f<return>
"Reflow paragraph
nnoremap <Leader>f gqip
"Easier escape from insert mode by bashing j/f keys
" inoremap jf <Esc>
" inoremap fj <Esc>
"Toggle rainow parens plugin
nnoremap <leader>r :RainbowParenthesesToggle<CR>
"Easy window switching
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Easy insert ; for javascript
nnoremap ; mqA;q
" let g:UltiSnipsExpandTrigger="<tab>"
" let g:UltiSnipsJumpForwardTrigger="<tab>"
" let g:UltiSnipsJumpBackwardTrigger="<s-tab>""
let g:UltiSnipsExpandTrigger="<c-n>"
let g:UltiSnipsJumpForwardTrigger="<c-n>"
let g:UltiSnipsJumpBackwardTrigger="<c-p>"
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Options
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Show line number in margin
set number
set tabstop=2
"Backspacing an expanded tab deletes space of tab, not just a single space
set softtabstop=2
set expandtab
set shiftwidth=2
set textwidth=80
" Search for string while typing i.e. before hitting enter
set incsearch
set nohlsearch
"Ignore case for searches unless one or more characters in search string are
"uppercase
set ignorecase
set smartcase
set complete-=k complete+=k
set dictionary=/usr/share/dict/cracklib-small
"Automatically open all folds upon reading buffer
autocmd BufRead * normal zR
"Language for spell-check
set spelllang=en_au
set nospell
"Use vertical splits for diff mode (and show filler lines for when lines are
"added/removed in one buffer, as in default)
set diffopt=filler,vertical
colorscheme desert
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
" Required for transparent background:
highlight Normal ctermbg=NONE
set autoindent
set foldmethod=manual
set ruler
" So we don't have to save before changing buffers:
set hidden
" How many spelling-suggestions to offer
set sps=best,6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment