Skip to content

Instantly share code, notes, and snippets.

@therealfakemoot
Created January 9, 2020 01:20
Show Gist options
  • Save therealfakemoot/b8fbeac5f36fe109f0290676114f41f2 to your computer and use it in GitHub Desktop.
Save therealfakemoot/b8fbeac5f36fe109f0290676114f41f2 to your computer and use it in GitHub Desktop.
" ~/.vimrc
set t_BE= "Disable bracketed paste
""" Vim-Plug ====================================
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged') " Minimalist Vim Plugin Manager
""" Settings ====================================
set nocompatible " be iMproved, required
set nobackup
set noswapfile
set termencoding=utf-8 " UTF8 as default encoding
set encoding=utf-8 " ...
" When using vimdiff, enable wordwrap.
autocmd FilterWritePre * if &diff | setlocal wrap< | endif
Plug 'tpope/vim-sensible' " Sensible Defaults
""" Input =======================================
let mapleader = ','
" nnoremap <C-h> <C-w>h
" nnoremap <C-j> <C-w>j
" nnoremap <C-k> <C-w>k
" nnoremap <C-l> <C-w>l
" Fold Mappings
" set foldmethod=syntax
" set foldnestmax=10
" set nofoldenable
" set foldlevel=0
inoremap <leader>z <C-O>za
nnoremap <leader>z za
onoremap <leader>z <C-C>za
vnoremap <leader>z zf
" Use <leader>/ to clear search highlight
nmap <silent> <leader>/ :nohlsearch<CR>
""" Display =====================================
set scrolloff=20
set pastetoggle=<F2>
set listchars=tab:\|.,trail:.,extends:#,nbsp:.
Plug 'universal-ctags/ctags' " ctags implementation
Plug 'majutsushi/tagbar' " Displays tags in a window
nmap <F8> :TagbarToggle<CR>
""" Utilities ===================================
Plug 'spolu/dwm.vim' " Tiled Window Management
Plug 'Shougo/vimfiler.vim' " Powerful file explorer
Plug 'tpope/vim-eunuch' " Helpers for UNIX
Plug 'tpope/vim-dispatch' " Async Build/Test
Plug 'benmills/vimux' " tmux Integration
Plug 'mileszs/ack.vim' " Enhanced Grepping within Vim
if executable('ag')
let g:ackprg = 'ag --vimgrep --smart-case'
cnoreabbrev ag Ack
cnoreabbrev aG Ack
cnoreabbrev Ag Ack
cnoreabbrev AG Ack
endif
Plug 'ctrlpvim/ctrlp.vim' " Fuzzy file/buffer/mru/tag/etc finder
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll|pyc|pyo)$',
\ 'link': 'some_bad_symbolic_links',
\ }
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']
""" Languages ===================================
" Set shiftwidth to 2 for html
au BufNewFile,BufRead *.html set shiftwidth=2
" Auto creates tags for Go source files.
au BufWritePost *.go silent! !ctags -R &
Plug 'fatih/vim-go' " Go development plugin for Vim
let $GOPATH = "/home/moot/.local/go"
let g:go_def_mode='gopls'
let g:go_info_mode='gopls'
let g:go_fmt_command = "gofmt"
let g:go_auto_type_info = 1
let g:go_auto_sameids = 0
let g:go_doc_keywordprg_enabled = 1
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_types = 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_highlight_extra_types = 1
Plug 'sheerun/vim-polyglot' " Language Support
let g:polyglot_disabled = ['go']
" JSX Config
Plug 'mxw/vim-jsx'
" ALE
Plug 'w0rp/ale'
" Linter configuration
let g:ale_linters = {'javascript': ['eslint'], 'go': ['gometalinter']}
" Fixer configuration
let g:ale_fixers = {'go': ['gofmt']}
let g:ale_lint_on_enter = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 1
let g:ale_set_loclist = 0
let g:ale_set_quickfix = 1
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
nmap <silent> <C-j> <Plug>(ale_next_wrap)
let g:airline#extensions#ale#enabled = 1
let g:ale_sign_column_always = 1
let g:ale_sign_error = '>>'
let g:ale_sign_warning = '--'
let g:ale_list_window_size = 7
""" Editor ======================================
set list " Show whitespace
set ruler " Show line/cursor position
set number " Show line numbers
set wrap linebreak nolist
autocmd BufWritePre * %s/\s\+$//e " Delete trailing whitespace on save
set listchars=tab:»\ ,extends:›,precedes:‹,nbsp:·,trail:·
set list
Plug 'tpope/vim-sleuth' " Heuristically set buffer options
Plug 'nathanaelkane/vim-indent-guides' " Visaully display indent level
Plug 'junegunn/vim-easy-align' " Easier text alignment
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
Plug 'ervandew/supertab' " Vim insert mode completions with Tab
let g:SuperTabDefaultCompletionType = "context"
Plug 'nsf/gocode', { 'rtp': 'vim', 'do': '~/.vim/plugged/gocode/vim/symlink.sh' }
Plug 'tpope/vim-surround' " Quoting/Parenthesizing made simple
Plug 'junegunn/limelight.vim' " Hyperfocus-writing in Vim
""" Status Line
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
""" Theme =======================================
Plug 'mtglsk/mushroom'
set background=dark
colorscheme mushroom
""" Version Control System ======================
Plug 'airblade/vim-gitgutter' " Show git diff in the gutter
nmap <Leader>ha <Plug>GitGutterStageHunk
nmap <Leader>hr <Plug>GitGutterUndoHunk
Plug 'tpope/vim-fugitive' " Git wrapper
Plug 'tpope/vim-git' " Git integration
Plug 'mattn/gist-vim' " Gist upload (GitHub)
"
" Something in here seems to be setting shiftwidth to 3
" which makes for dumb looking Python code.
set softtabstop=4
set shiftwidth=4
set expandtab
call plug#end()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment