Skip to content

Instantly share code, notes, and snippets.

@gdestuynder
Created November 19, 2019 23:11
Show Gist options
  • Save gdestuynder/284310914a642fc8f0f31c5a8ea624e9 to your computer and use it in GitHub Desktop.
Save gdestuynder/284310914a642fc8f0f31c5a8ea624e9 to your computer and use it in GitHub Desktop.
" This file expects to have vim (yeh!), python-black, vim-jellybeans (it's a theme), exuberant-ctags, vim-plug installed (and to run PlugInstall the first time)
"General stuff
syntax on
set nocompatible
filetype off
set pastetoggle=<F2> "paste mode shortcut
set cursorline cursorcolumn "crosshair where cursor is
set nobackup nowritebackup noswapfile autoread "no cruft.
set ruler "always show ruler in statusline
"set number "line numbers for akrug
set textwidth=120 "deal with it.
set nofoldenable "folding kills bunnies.
"set mouse=a mousemodel=popup "don't mess with my right click paste.
"set clipboard=unnamedplus "gvim clipboard sync
setlocal spell spelllang=en_us "spellcheck
"nicer term title
let &titlestring = @%
set title
"Search & complete
set omnifunc=syntaxcomplete#Complete
set wildmenu
set wildmode=list:longest
set incsearch ignorecase smartcase hlsearch
"Colors
set t_Co=256
set colorcolumn=80 "hilight at 80 col
let &colorcolumn="80,".join(range(120,999),",") "hilight harder at 120 col
"colorscheme mustang
colorscheme jellybeans
" JSON syntax coloring
autocmd BufNewFile,BufRead *.har set ft=javascript
"Hilight trailing spaces
set list
set listchars=tab:\ \ ,trail:.
"let g:riv_fold_auto_update=0 "for the bunnies.
"set noexpandtab "tabs > spaces. :((
set softtabstop=2 shiftwidth=2 expandtab "that's me giving up
nmap <F8> :TagbarToggle<CR>
" match HTML tags (taken directly from $VIM/ftplugin/html.vim)
if exists("loaded_matchit")
let b:match_ignorecase=0
let b:match_skip = 's:Comment'
let b:match_words = '<:>,' .
\ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' .
\ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' .
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
endif
" Navigate with jkl; instead of hjkl
"noremap ; l
"noremap l k
"noremap k j
"noremap j h
" vim plug https://github.com/junegunn/vim-plug
call plug#begin('~/.vim/plugged')
Plug 'ambv/black'
Plug 'soramugi/auto-ctags.vim'
call plug#end()
let g:black_linelength=120
let g:black_skip_string_normalization=0
autocmd BufWritePre *.py execute ':Black'
" has to be after plugins
filetype plugin indent on
" has to be after everything else in order to have all variables available
if has("autocmd")
"Open file @ last position
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"Auto open taglist
"au FileType python,c,java TlistOpen
endif
" Additional functions
command! UnMinify call UnMinify()
function! UnMinify()
%s/{\ze[^\r\n]/{\r/g
%s/){/) {/g
%s/};\?\ze[^\r\n]/\0\r/g
%s/;\ze[^\r\n]/;\r/g
%s/[^\s]\zs[=&|]\+\ze[^\s]/ \0 /g
normal ggVG=
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment