Skip to content

Instantly share code, notes, and snippets.

@tbrisbout
Last active December 13, 2015 17:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbrisbout/8cede8c7fa2f0ae0d147 to your computer and use it in GitHub Desktop.
Save tbrisbout/8cede8c7fa2f0ae0d147 to your computer and use it in GitHub Desktop.
talk vimrc
" augroup reload_talk_vimrc
" autocmd!
" autocmd BufWritePost *.vimrc source ~/dev/talk.vimrc
" augroup END
" ================ General Config ================
set nocompatible
syntax enable
set encoding=utf-8
set hidden
set autoread
"" Whitespace
set nowrap " don't wrap lines
set tabstop=2 shiftwidth=2 " a tab is two spaces (or set this to 4)
set expandtab " use spaces, not tabs (optional)
set backspace=indent,eol,start " backspace through everything in insert mode
set list listchars=tab:»·,trail:·
"" Searching
set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
"" Status Bar
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set laststatus=2 " show status line all the time
set wildmenu
set wildmode=longest:list,list
set wildignore+=*/.git/*,*/node_modules/*,*/bower_components/*
set number " Display line number
set showmatch " Show matching brackets.
"" Avoid backup files
set nobackup
set noswapfile
set nowb
" ================= Plugins ====================
" Vundle setup
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
" My plugins
" File navigation
Plugin 'scrooloose/nerdtree'
Plugin 'kien/ctrlp.vim'
Plugin 'bling/vim-airline'
" Git
Plugin 'tpope/vim-fugitive'
Plugin 'airblade/vim-gitgutter'
" Misc utilities
Plugin 'tpope/vim-commentary'
Plugin 'editorconfig/editorconfig-vim'
Plugin 'majutsushi/tagbar'
" Styles
Plugin 'blueeyed/vim-colors-solarized'
Plugin 'flazz/vim-colorschemes'
Plugin 'ryanoasis/vim-webdevicons'
" Completion and snippets
Plugin 'sirver/ultisnips'
Plugin 'honza/vim-snippets'
Plugin 'Valloric/YouCompleteMe' " Post install step: cd ~/.vim/bundle/YouCompleteMe && ./install.py
Plugin 'marijnh/tern_for_vim' " Post install step: cd ~/.vim/bundle/tern_for_vim && npm install
" Language
Plugin 'wookiehangover/jshint.vim'
Plugin 'geekjuice/vim-mocha'
Plugin 'kchmck/vim-coffee-script'
Plugin 'cohama/lexima.vim'
Plugin 'alvan/vim-closetag'
Plugin 'jelera/vim-javascript-syntax'
Plugin 'moll/vim-node'
" End of Vundle conf
call vundle#end()
Filetype plugin indent on
" ========================= Style ====================================
set background=dark
set t_Co=16
colorscheme solarized
let g:airline_powerline_fonts=1
" Buffer Top bar
let g:airline#extensions#tabline#enabled = 1
" ========================== Shortcuts ================================
" Use the mouse
set mouse=a
" Use Space as the leader
let mapleader = " "
" Clipboard
vmap <Leader>y "+y
vmap <Leader>d "+d
nmap <Leader>p "+p
nmap <Leader>P "+P
vmap <Leader>p "+p
vmap <Leader>P "+P
" Escape
inoremap jj <Esc>
inoremap jk <Esc>:w<CR>
" Useful
nnoremap <Leader>o o<Esc>k
nnoremap <Leader>O O<Esc>j
nnoremap <Leader>w :w<CR>
" Insert comma / semicolon at end of line
nnoremap <Leader>, m`A,<Esc>``
nnoremap <Leader>; m`A;<Esc>``
" Comment
nmap <Leader>c gcc
vmap <Leader>c gc
" Clear search highlight
nmap <Leader><Leader> :noh<CR>
" NERDTree
silent! nmap <F2> :NERDTreeToggle<CR>
silent! map <F3> :NERDTreeFind<CR>
silent! nmap <F8> :TagBarToggle<CR>
" Buffers
" Move to the next buffer
nnoremap <leader>l :bnext<CR>
" Move to the previous buffer
nmap <leader>h :bprevious<CR>
" Delete current buffer
nmap <leader>bd :bd<CR>
" ========================== Search ==================
set grepprg=ag\ --nogroup\ --nocolor
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
" ========================= Misc ===================
" AutoCorrect typos in Insert Mode
iabbrev lenght length
iabbrev heigth height
iabbrev widht width
iabbrev fucntion function
iabbrev funciton function
augroup vimrc_autocmds
autocmd BufNewFile,BufRead *.md set filetype=markdown
" Some git commit convention
autocmd Filetype gitcommit highlight OverLength ctermbg=red guibg=#592929
autocmd Filetype gitcommit match OverLength /\%72v.*/
autocmd BufEnter * set completeopt-=preview
" Use node to run js files
autocmd FileType javascript nnoremap <Leader>r :!node "%:p"<CR>
autocmd FileType javascript set makeprg=node\ %
autocmd FileType ruby set makeprg=ruby \ %
augroup END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment