Skip to content

Instantly share code, notes, and snippets.

@islandjoe
Last active December 15, 2016 21:20
Show Gist options
  • Save islandjoe/656bad15c8a48e21c601c6256d5a8098 to your computer and use it in GitHub Desktop.
Save islandjoe/656bad15c8a48e21c601c6256d5a8098 to your computer and use it in GitHub Desktop.
My .vimrc starter
syntax on
set tabstop=2
set shiftwidth=2
" Incremental Search
set incsearch
" Search Highlighting
set hlsearch
" Mapping
let mapleader = "\<Space>"
nnoremap <leader>rv :source $MYVIMRC<CR>
:nmap WW :w<CR>
:imap WW <esc>WW<CR>
" autocomplete parenthesis, brackets and braces
inoremap ( ()<Left>
inoremap [ []<Left>
inoremap { {}<Left>
" autocomplete quotes
inoremap ' '<Esc>:call QuoteInsertionWrapper("'")<CR>a
inoremap " "<Esc>:call QuoteInsertionWrapper('"')<CR>a
inoremap ` `<Esc>:call QuoteInsertionWrapper('`')<CR>a
function! QuoteInsertionWrapper(quote)
let col = col('.')
if getline('.')[col-2] !~ '\k' && getline('.')[col] !~ '\k'
normal ax
exe "normal r".a:quote."h"
end
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment