Created
November 25, 2014 21:45
-
-
Save mrmrs/8c24852b40797cd7ea5b to your computer and use it in GitHub Desktop.
My simple setup for vim
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 | |
set rtp+=~/.vim/bundle/Vundle.vim | |
set runtimepath+=~/.vim/bundle/ultisnips | |
call vundle#begin() | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'sjl/gundo.vim' | |
Plugin 'tomtom/tlib_vim' " Dependency for snipmate-plus | |
Plugin 'MarcWeber/vim-addon-mw-utils' " Dependency for snipmate-plus | |
Plugin 'kien/ctrlp.vim' " Fuzzy file finder. | |
Plugin 'othree/html5.vim' | |
Plugin 'ag.vim' | |
Plugin 'SirVer/ultisnips' | |
Plugin 'honza/vim-snippets' | |
call vundle#end() | |
" VISUAL STUFF | |
set title " Sets the title at top of tab to be the filename if "titlestring" isn't defined | |
set laststatus=1 " Has to do with the status bar at the bottom. Check :help laststatus | |
set number " Line numbers on the left hand side | |
set visualbell " That bell is the worst sound. Shut it the fuck off. | |
syntax enable " Sets syntax highlighting on because what is this notepad | |
filetype plugin indent on " This gets vim to automatically load filetype specific options for plugins and indentation | |
" BASIC FUNCTIONALITY | |
set encoding=utf-8 " Duh | |
set history=512 " Default is 20, I'd rather set this to ∞ | |
set nofoldenable " Don't fold shit because it's the worst. | |
" Swap file stuff. | |
set noswapfile | |
set hidden | |
set undofile | |
set undodir=~/.vim/undodir | |
"" Formatting | |
set smartindent | |
set tabstop=2 | |
set shiftwidth=2 | |
set expandtab | |
autocmd BufWritePre * :%s/\s\+$//e " Remove trailing whitespace on save | |
" Fix indenting for css style things (sass, css) | |
au BufEnter *.css set nocindent | |
au BufLeave *.css set cindent | |
au BufEnter *.scss set nocindent | |
au BufLeave *.scss set cindent | |
au BufEnter *.sass set nocindent | |
au BufLeave *.sass set cindent | |
au BufEnter *.less set nocindent | |
au BufLeave *.less set cindent | |
autocmd BufNewFile,BufRead *.scss set ft=scss.css "Sets filetype of scss to be css. Helps with plugins. | |
autocmd BufNewFile,BufRead *.less set ft=less.css "Sets filetype of less to be css. Helps with plugins. | |
" omnicompletion in insert mode | |
imap <leader>m <c-x><c-o> | |
" maps ,, to esc in insert mode | |
imap <leader>, <esc> | |
" Enter newlines without entering insert mode | |
" http://vim.wikia.com/wiki/Insert_newline_without_entering_insert_mode | |
nnoremap <CR> o<Esc>k | |
" Tab Navigation | |
nnoremap th :tabfirst<CR> | |
nnoremap tj :tabnext<CR> | |
nnoremap tk :tabprev<CR> | |
nnoremap tl :tablast<CR> | |
nnoremap tn :tabnew<CR> | |
nnoremap <leader>m :bn<CR> | |
nnoremap <leader>n :bp<CR> | |
nnoremap <leader>p :set paste!<CR> | |
" Local list nav | |
nnoremap fj :execute "noautocmd vimgrep /" . expand("<cword>") . "/j **" <Bar> cnext<CR> | |
nnoremap cn :cn<CR> | |
nnoremap cp :cp<CR> | |
" Custom Plugin Mappings | |
nnoremap ff :CtrlP<CR> | |
nnoremap -- :GundoToggle<CR> | |
" Ignore node_modules in CtrlP | |
let g:ctrlp_custom_ignore = '\v[\/](\.(git|hg|svn)|node_modules)$' | |
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' | |
inoremap ;d :r !date -u <CR> | |
"set iskeyword+=- "Makes foo-bar considered one word | |
nnoremap <leader>v :e $MYVIMRC<cr> | |
nnoremap <leader>gx :Gbrowse<cr> | |
nnoremap <leader>g :Gstatus<cr> | |
nnoremap <leader>gc :Gcommit<cr> | |
nnoremap <leader>c :ccl<cr> | |
nnoremap <leader>o :copen<cr> | |
map <Esc><Esc> :w<CR> | |
set wildignore=node_modules/*,*.jpg,*.png,*.gif,*.woff,node_modules " See :help wildignore | |
autocmd FileType css set omnifunc=csscomplete#CompleteCSS " Gives css auto completion to files using filetype=css | |
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe. | |
let g:UltiSnipsExpandTrigger="<tab>" | |
let g:UltiSnipsJumpForwardTrigger="<c-b>" | |
let g:UltiSnipsJumpBackwardTrigger="<c-z>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment