Skip to content

Instantly share code, notes, and snippets.

@tebeka
Created September 6, 2018 05:27
Show Gist options
  • Save tebeka/424b8d66510c06ba0b3d727136a6bac0 to your computer and use it in GitHub Desktop.
Save tebeka/424b8d66510c06ba0b3d727136a6bac0 to your computer and use it in GitHub Desktop.
vimrc
call plug#begin('~/.vim/plugged')
Plug 'SirVer/ultisnips'
Plug 'artur-shaik/vim-javacomplete2'
Plug 'fatih/vim-go'
Plug 'flazz/vim-colorschemes'
Plug 'honza/vim-snippets'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'scrooloose/nerdtree'
Plug 'tmhedberg/matchit'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'vim-scripts/a.vim'
Plug 'w0rp/ale'
" Python
Plug 'davidhalter/jedi-vim'
" Misc Syntax
Plug 'cespare/vim-toml'
Plug 'chr4/nginx.vim'
Plug 'dcharbon/vim-flatbuffers'
Plug 'ekalinin/Dockerfile.vim'
Plug 'leafgarland/typescript-vim'
Plug 'peter-edge/vim-capnp'
Plug 'rust-lang/rust.vim'
Plug 'solarnz/thrift.vim'
Plug 'vim-scripts/SWIG-syntax'
Plug 'zimbatm/haproxy.vim'
" Elixir
Plug 'elixir-editors/vim-elixir'
Plug 'slashmili/alchemist.vim'
call plug#end()
" Search & Display
set ignorecase
set incsearch
set nohls
set number
set showmatch
set smartcase
" Enable vim: ... directives
set modeline
" Tab stuff
set tabstop=8
set softtabstop=4
set shiftwidth=4
" Use system clipboard
set clipboard=unnamedplus
" Make no noise
set visualbell t_vb=
set noerrorbells
" Save before make
set autowrite
" Vertical diff
set diffopt=filler,vertical
" airline
set laststatus=2
let g:airline_powerline_fonts = 1
" GUI Stuff
if has("gui_running")
" No toolbar or menu
set guioptions=aAce
colorscheme koehler
set guifont=Inconsolata\ Medium\ 20
endif
" Spelling
au BufNewFile,BufRead ChangeLog,*.txt,*.rst,*.markdown,*.md,*.yaml,*.yml setl spell
" Text width
au BufNewFile,BufRead *.markdown,*.md setl tw=80
" Docker
au BufNewFile,BufRead Dockerfile* se ft=dockerfile
" Go
" let g:go_fmt_command = "goimports"
au BufNewFile,BufRead *.go setl noet
au BufNewFile,BufRead *.go setl ts=4
au BufNewFile,BufRead *.go setl tw=0
let g:go_auto_sameids = 1
let g:go_auto_type_info = 1
au FileType go nmap <leader>gt :GoDeclsDir<cr>
" .i are SWIG
au BufNewFile,BufRead *.i set ft=swig
" influxdb config are TOML
au BufNewFile,BufRead influxdb.conf set ft=toml
" .envrc
au BufNewFile,BufRead .envrc set ft=zsh
" HTML
au BufNewFile,BufRead *.html setl ts=2
au BufNewFile,BufRead *.html setl sw=2
au BufNewFile,BufRead *.html setl tw=0
" HTML + jinja
au FileType htmljinja setl ts=2
au FileType htmljinja setl sw=2
au FileType htmljinja setl tw=0
func! ASCII_Clean()
silent %! iconv -c -t ASCII
endfunc
comm! AC call ASCII_Clean()
" Space for page up/down
noremap <SPACE> <C-F>
" Explorer to show full info
let g:explDetailedList=1
" Use hidden (allow buffer switch when modified)
au BufNewFile,BufRead * set hidden
" Abbriviations
abb _3me_ Miki Tebeka <[email protected]>
abb _cr_ # Copyright 353Solutions, All rights reserved
abb _date_ <C-R>=strftime("%Y-%m-%d")<CR>
abb _gme_ Miki Tebeka <[email protected]>
abb _py_ #!/usr/bin/env python
abb _sh_ #!/bin/bash
" Python stuff
let python_highlight_all=1
au FileType python syntax sync fromstart
au FileType python setl textwidth=79
au FileType python setl ts=4
let g:jedi#goto_command = "<C-]>"
" Sort Python imports
func! Isort()
w
silent !isort -q %
e
endfunc
comm! Isort call Isort()
" Run black Python formatter
func! Black()
w
silent !black -S -l 79 %
e
endfunc
comm! Black call Black()
" XML indent is two spaces
au FileType xml setl shiftwidth=2
" SQL indent is two spaces
au FileType sql setl shiftwidth=2
" Make file executable
func! MakeExecutable()
w
!chmod +x %
e
endfunc
comm! MX silent call MakeExecutable()
" egg, wheel are just zip files (but can be directories as well)
au BufReadCmd *.egg,*.whl if !isdirectory(expand("<amatch>")) |
\ call zip#Browse(expand("<amatch>")) | endif
let NERDTreeIgnore = ['\.py[co]$', '__pycache__']
comm! NT NERDTreeToggle
let g:NERDTreeWinSize = 18
comm! Gr ! go run %
comm! Pr ! python %
comm! Pr2 ! python2 %
abb _ys_ **Youngstar:**
abb _gb_ **Graybeard:**
" ultisnips
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" java
autocmd FileType java setlocal omnifunc=javacomplete#Complete
au BufNewFile,BufRead *.java set ts=4
" c++
autocmd FileType cpp setlocal et
autocmd FileType cpp setlocal sw=4
autocmd FileType cpp setlocal ts=4
autocmd FileType c setlocal et
autocmd FileType c setlocal sw=4
autocmd FileType c setlocal ts=4
" asm
au BufNewFile,BufRead *.ASM set ft=tasm
au BufNewFile,BufRead *.ASM set ts=2
au BufNewFile,BufRead *.ASM set sw=2
" Ignore
let g:ctrlp_custom_ignore = {
\ 'dir': '\.venv$\|\.vendor$',
\ }
" Ale
let g:ale_sign_error = '✗'
let g:ale_sign_warning = '❗'
let g:ale_linters = {
\ 'python': ['flake8'],
\}
" Airline
let g:airline#extensions#ale#enabled = 1
let g:airline#extensions#branch#enabled = 1
let g:airline#extensions#ctrlp#enabled = 1
let g:airline_theme = 'minimalist'
noremap <C-P> :FZF<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment