Skip to content

Instantly share code, notes, and snippets.

@apokalyptik apokalyptik/.vimrc
Last active Oct 5, 2017

Embed
What would you like to do?
My .vimrc file
" Instructions:
" 1. Download this .vimrc file:
" curl https://gist.githubusercontent.com/apokalyptik/fdf050e2dd004b756d2e1a0b6f2d399a/raw/.vimrc > .vimrc
" 2. Install vundle:
" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
" 3. Run vim
" 4. Install Plugins:
" :PluginInstall
" 5. Exit vim
set nocompatible " be improved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'kien/ctrlp.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-vinegar'
Plugin 'Shougo/neocomplete.vim'
Plugin 'scrooloose/syntastic'
Plugin 'fatih/vim-go'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-vividchalk'
Plugin 'moll/vim-bbye'
Plugin 'maksimr/vim-jsbeautify'
Plugin 'editorconfig/editorconfig-vim'
Plugin 'pangloss/vim-javascript'
Plugin 'mxw/vim-jsx'
call vundle#end() " required
filetype plugin indent on " required
" mxw/vim-jsx
let g:jsx_ext_required = 0
" js-beautify
"autocmd BufWrite *.js :call JsBeautify()
autocmd BufWrite *.json :call JsonBeautify()
autocmd BufWrite *.jsx :call JsxBeautify()
autocmd BufWrite *.htm* :call HtmlBeautify()
autocmd BufWrite *.css :call CSSBeautify()
" neocomplete settings
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_auto_select = 0
let g:neocomplete#enable_refresh_always = 1
let g:neocomplete#enable_multibyte_completion = 1
" airlilne
let g:airline#extensions#tabline#enabled = 1
set laststatus=2
set noshowmode
" vim-go settings
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_fields = 1
let g:go_highlight_structs = 1
let g:go_highlight_interfaces = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
let g:go_fmt_fail_silently = 1
let g:go_fmt_command = "/home/wpcom/go/bin/goimports"
let g:go_list_type = "quickfix"
" syntastic settings
let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 1
" gitgutter"
set signcolumn=yes
let g:gitgutter_realtime = 1
let g:gitgutter_eager = 1
" bbye
" map \q to :Bdelete
:nnoremap <Leader>q :Bdelete<CR>
" Other settings
""""""""""""""""
" Explorer
let g:netrw_liststyle=3 " be more like nerdtree
map <C-n> :Explore<CR>
set wildignore+=.git/
set wildignore+=.svn/
set wildignore+=*.swp
" Make backspace delete things that I didn't type this session. kthxbye
set backspace=indent,eol,start
" Make tab-completion for :something<tab> not suck
set wildmode=longest:full,list:full
set wildmenu
set ignorecase
set infercase
" Allow the use of the mouse in all modes except visual mode.
set ttymouse=xterm2
set mouse=ni
" Speed up tty rendering
set ttyfast
set lazyredraw
" Allows multiple changed file editing without complaining. Because: vim.
set hidden
" A bunch of crap because indentation sucks
set tabstop=8 " - tabs are at proper location
set expandtab " - don't use actual tab character (ctrl-v)
set shiftwidth=8 " - indenting is 4 spaces
set autoindent " - turns it on
set smartindent " - does the right thing (mostly) in programs
set cinoptions=l1
set cindent " - stricter rules for C programs
" When in visual mode and indenting or out-denting reselect the block
vnoremap < <gv
vnoremap > >gv
" When searching highlight all matches
set hlsearch
" Spell checking in comments and strings
set spell spelllang=en_us
" Disable spell checking for the quickfix window for readabilities sake
augroup quickfix
autocmd!
autocmd FileType qf setlocal nospell
augroup END
" Syntax checking
syntax on
syntax enable
" Colors :)
colorscheme vividchalk
" Make sure that working directory is always the same as the file you are
" editing
set autochdir
" Keep undo history across sessions by storing it in a file
let vimDir = '$HOME/.vim'
let &runtimepath.=','.vimDir
if has('persistent_undo')
let myUndoDir = expand(vimDir . '/undodir')
call system('mkdir ' . vimDir)
call system('mkdir ' . myUndoDir)
let &undodir = myUndoDir
set undofile
endif
" A function to reset spelling error colors (vividchalk is ugly here)
function! s:reset_spelling_colors()
" Make spelling work better in comments with vividchalk :)
if exists('g:colors_name') && strlen(g:colors_name)
highlight SpellBad ctermbg=DarkMagenta ctermfg=Black
endif
endfunction
" Run code at certain breakpoints
augroup ex_last
" Run code on startup after everything is initialized
if exists('##VimEnter')
" Execute after vim initializes
autocmd VimEnter * call <SID>reset_spelling_colors()
endif
" Run code on switching color schemes
if exists('##ColorScheme')
autocmd VimEnter * call <SID>reset_spelling_colors()
endif
augroup end
autocmd BufRead,BufNewFile *.php set autoindent noexpandtab tabstop=4 shiftwidth=4
set exrc
set secure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.