Skip to content

Instantly share code, notes, and snippets.

@zikes
Created May 31, 2017
Embed
What would you like to do?
vim files
set nocompatible
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'editorconfig/editorconfig-vim'
Plugin 'scrooloose/nerdtree'
Plugin 'majutsushi/tagbar'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'altercation/vim-colors-solarized'
Plugin 'airblade/vim-gitgutter'
Plugin 'fatih/vim-go'
Plugin 'vim-scripts/Conque-GDB'
Plugin 'vimwiki/vimwiki'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on
syntax enable
" set t_Co=256
set noswapfile
set timeoutlen=100 ttimeoutlen=0
set visualbell
set t_vb=
set background=light
colorscheme monochrome
set title
set titlestring=%-25.55F\ %a%r%m
" use system clipboard on MacOS
set clipboard=unnamed
" show line numbers
set number
" set relativenumber
" case insensitive and smart case matching
set ignorecase
set smartcase
" incremental search with/without highlights
set incsearch
" set hlsearch
set nohlsearch
" auto indent and convert tabs to spaces
set expandtab
set smarttab
set autoindent
" use 2 spaces for tabs
set shiftwidth=2
set tabstop=2
set softtabstop=2
" use tabs for bash files
autocmd FileType sh setlocal noexpandtab
" keep 5 lines above and below and 5 characters to each side
set scrolloff=5
set sidescrolloff=5
" always show current position
set ruler
" set default encoding and file types
set encoding=utf-8
set ffs=unix,dos,mac
set fillchars=vert:\│
" get rid of line wrapping
set nowrap
" set textwidth=0
" set wrapmargin=0
" show commands
set showcmd
" show whitespace
set list
set listchars=tab:→\ ,trail:~,extends:>,precedes:<
set backspace=2
" delete trailing whitespace on save
func! DeleteTrailingWS()
exe "normal mz"
%s/\s\+$//ge
exe "normal `z"
endfunc
autocmd BufWrite *.htm,*.html,*.css,*.js,*.php :call DeleteTrailingWS()
set laststatus=2
let g:airline_powerline_fonts = 1
let g:airline_skip_empty_sections = 1
let g:airline_inactive_collapse = 0
let g:airline_theme='zenburn'
let g:airline_theme_patch_func = 'AirlineThemePatch'
function! AirlineInit()
call extend(g:airline_mode_map, {'__': ' '})
if exists(':TagbarToggle')
function! airline#extensions#tagbar#get_status(...)
let l:spc = g:airline_symbols.space
let builder = airline#builder#new({'active': a:1})
call builder.add_section('airline_a', l:spc.'Tagbar'.l:spc)
call builder.add_section('airline_b', l:spc.a:3.l:spc)
return builder.build()
endfunction
endif
endfunction
autocmd User AirlineAfterInit call AirlineInit()
function! AirlineThemePatch(palette)
if g:airline_theme == 'zenburn'
let l:N1 = airline#themes#get_highlight('StatusLine')
let l:N2 = airline#themes#get_highlight('Folded')
let l:N3 = airline#themes#get_highlight('Title')
let l:I1 = airline#themes#get_highlight2(['DbgCurrent', 'bg'], ['String', 'fg'], 'none')
let l:I2 = airline#themes#get_highlight2(['String', 'fg'], ['Folded', 'bg'])
let l:I3 = l:N3
let l:R1 = airline#themes#get_highlight2(['DbgCurrent', 'bg'], ['Error', 'bg'], 'bold')
let l:R2 = airline#themes#get_highlight2(['Comment', 'fg'], ['Folded', 'bg'])
let l:R3 = l:N3
let a:palette.normal = airline#themes#generate_color_map(l:N1, l:N2, l:N3)
let a:palette.insert = airline#themes#generate_color_map(l:I1, l:N2, l:N3)
let a:palette.inactive = airline#themes#generate_color_map(l:N1, l:N2, l:N3)
let a:palette.replace = airline#themes#generate_color_map(l:R1, l:N2, l:N3)
endif
endfunction
" NERDTree Settings
map <C-n> :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
let NERDTreeShowHidden=1
let &titleold=hostname()
let NERDTreeDirArrows=1
let NERDTreeMinimalUI=1
let NERDTreeIgnore=['\.o$', '\.pyc$', '\.php\~$', '^\.git$']
let NERDTreeWinSize = 20
let NERDTreeChDirMode = 2
let NerdTreeAutoCenter = 1
autocmd Filetype go call SetGoOptions()
function! SetGoOptions()
autocmd vimenter * NERDTree
autocmd vimenter * wincmd p
autocmd vimenter * TagbarOpen
set foldmethod=syntax
set foldnestmax=2
set foldcolumn=3
set foldlevel=2
endfunction
" PHP Indentation
autocmd FileType php setlocal shiftwidth=4 tabstop=4 softtabstop=4
" When in Insert mode, Shift+Tab will insert a literal tab character instead
" of the default indentation
imap <S-Tab> <C-V><Tab>
" When in Normal mode, F8 to toggle Tagbar
nmap <F8> :TagbarToggle<CR>
let g:tagbar_width = 30
let g:tagbar_compact = 1
" When in Normal mode, Space to toggle fold
nmap <Space> za
" 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_types = 1
" let g:go_highlight_operators = 1
" let g:go_highlight_build_constraints = 1
let g:go_fmt_command = "goimports"
autocmd FileType qf wincmd J
" syntastic
let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
" vimwiki
let g:vimwiki_folding = 'list'
let g:vimwiki_list = [{'path': '~/vimwiki/', 'auto_export': 1}]
" tmux/screen fixes
if $TERM =~ '^xterm-256color'
map <Esc>OH <Home>
map! <Esc>OH <Home>
map <Esc>OF <End>
map! <Esc>OF <End>
endif
" Show syntax highlighting groups for word under cursor
nmap <C-S-P> :call <SID>SynStack()<CR>
function! <SID>SynStack()
if !exists("*synstack")
return
endif
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val,"name")')
endfunc
" Disable paren matching
let loaded_matchparen = 1
hi clear
syntax reset
let g:colors_name = "monochrome"
let s:gui_gray_6="#4a4a4a"
let s:gui_gray_5="#707070"
let s:gui_gray_4="#969696"
let s:gui_gray_3="#c2c2c2"
let s:gui_gray_2="#e3e3e3"
let s:gui_gray_1="#f5f5f5"
let s:gui_red="#fff0f0"
let s:gui_green="#f0fff0"
let s:gui_black="#000000"
let s:gui_white="#ffffff"
let s:term_gray_6="238"
let s:term_gray_5="240"
let s:term_gray_4="242"
let s:term_gray_3="244"
let s:term_gray_2="246"
let s:term_gray_1="254"
let s:term_red="196"
let s:term_green="34"
let s:term_black="16"
let s:term_white="231"
let s:gui_none=" gui=NONE term=NONE cterm=NONE"
let s:guifg_none=" guifg=NONE ctermfg=NONE"
let s:guibg_none=" guibg=NONE ctermbg=NONE"
let s:gui_reverse=" gui=reverse term=reverse cterm=reverse"
let s:gui_undercurl=" gui=undercurl term=undercurl cterm=undercurl guisp=NONE"
let s:gui_standout=" gui=standout term=standout cterm=standout"
let s:guifg_gray_1=" guifg=".s:gui_gray_1." ctermfg=".s:term_gray_1
let s:guifg_gray_2=" guifg=".s:gui_gray_2." ctermfg=".s:term_gray_2
let s:guifg_gray_3=" guifg=".s:gui_gray_3." ctermfg=".s:term_gray_3
let s:guifg_gray_4=" guifg=".s:gui_gray_4." ctermfg=".s:term_gray_4
let s:guifg_gray_5=" guifg=".s:gui_gray_5." ctermfg=".s:term_gray_5
let s:guifg_gray_6=" guifg=".s:gui_gray_6." ctermfg=".s:term_gray_6
let s:guibg_gray_1=" guibg=".s:gui_gray_1." ctermbg=".s:term_gray_1
let s:guibg_gray_2=" guibg=".s:gui_gray_2." ctermbg=".s:term_gray_2
let s:guibg_gray_3=" guibg=".s:gui_gray_3." ctermbg=".s:term_gray_3
let s:guibg_gray_4=" guibg=".s:gui_gray_4." ctermbg=".s:term_gray_4
let s:guibg_gray_5=" guibg=".s:gui_gray_5." ctermbg=".s:term_gray_5
let s:guibg_gray_6=" guibg=".s:gui_gray_6." ctermbg=".s:term_gray_6
let s:guifg_red=" guifg=".s:gui_red." ctermfg=".s:term_red
let s:guibg_red=" guibg=".s:gui_red." ctermbg=".s:term_red
let s:guifg_green=" guifg=".s:gui_green." ctermfg=".s:term_green
let s:guibg_green=" guibg=".s:gui_green." ctermbg=".s:term_green
let s:guifg_white=" guifg=".s:gui_white." ctermfg=".s:term_white
let s:guibg_white=" guibg=".s:gui_white." ctermbg=".s:term_white
let s:guifg_black=" guifg=".s:gui_black." ctermfg=".s:term_black
let s:guibg_black=" guibg=".s:gui_black." ctermbg=".s:term_black
if &background == "light"
exe "hi! Boolean " .s:gui_none .s:guifg_gray_3 .s:guibg_none
exe "hi! ColorColumn " .s:gui_none .s:guifg_none .s:guibg_gray_1
exe "hi! Comment " .s:gui_none .s:guifg_gray_2 .s:guibg_none
exe "hi! Conceal " .s:gui_none .s:guifg_gray_3 .s:guibg_none
exe "hi! Conditional " .s:gui_none .s:guifg_gray_4 .s:guibg_none
exe "hi! Constant " .s:gui_none .s:guifg_gray_3 .s:guibg_none
exe "hi! Cursor " .s:gui_reverse .s:guifg_none .s:guibg_none
exe "hi! CursorColumn " .s:gui_none .s:guifg_none .s:guibg_gray_1
exe "hi! CursorLine " .s:gui_none .s:guifg_none .s:guibg_gray_1
exe "hi! CursorLineNr " .s:gui_none .s:guifg_gray_2 .s:guibg_none
exe "hi! DbgCurrent " .s:gui_none .s:guifg_black .s:guibg_white
exe "hi! DiffAdd " .s:gui_none .s:guifg_none .s:guibg_green
exe "hi! DiffChange " .s:gui_none .s:guifg_none .s:guibg_gray_1
exe "hi! DiffDelete " .s:gui_none .s:guifg_none .s:guibg_red
exe "hi! DiffText " .s:gui_none .s:guifg_none .s:guibg_gray_5
exe "hi! Directory " .s:gui_none .s:guifg_gray_4 .s:guibg_none
exe "hi! Error " .s:gui_none .s:guifg_white .s:guibg_red
exe "hi! ErrorMsg " .s:gui_none .s:guifg_white .s:guibg_red
exe "hi! FoldColumn " .s:gui_none .s:guifg_black .s:guibg_gray_1
exe "hi! Folded " .s:gui_none .s:guifg_black .s:guibg_gray_1
exe "hi! Function " .s:gui_none .s:guifg_black .s:guibg_none
exe "hi! Ignore " .s:gui_reverse .s:guifg_none .s:guibg_none
exe "hi! IncSearch " .s:gui_reverse .s:guifg_none .s:guibg_none
exe "hi! LineNr " .s:gui_none .s:guifg_gray_2 .s:guibg_none
exe "hi! MatchParen " .s:gui_none .s:guifg_none .s:guibg_gray_5
exe "hi! ModeMsg " .s:gui_none .s:guifg_gray_5 .s:guibg_none
exe "hi! MoreMsg " .s:gui_none .s:guifg_gray_5 .s:guibg_none
exe "hi! Normal " .s:gui_none .s:guifg_black .s:guibg_white
exe "hi! NonText ctermbg=bg ctermfg=bg guibg=bg guifg=bg"
exe "hi! Number " .s:gui_none .s:guifg_red .s:guibg_none
exe "hi! Pmenu " .s:gui_none .s:guifg_none .s:guibg_gray_1
exe "hi! PmenuSbar " .s:gui_none .s:guifg_none .s:guibg_gray_5
exe "hi! PmenuSel " .s:gui_none .s:guifg_none .s:guibg_gray_5
exe "hi! PmenuThumb " .s:gui_none .s:guifg_none .s:guibg_gray_3
exe "hi! Question " .s:gui_none .s:guifg_black .s:guibg_none
exe "hi! Search " .s:gui_reverse .s:guifg_none .s:guibg_none
exe "hi! SignColumn " .s:gui_none .s:guifg_gray_3 .s:guibg_none
exe "hi! Special " .s:gui_none .s:guifg_gray_3 .s:guibg_none
exe "hi! SpecialKey " .s:gui_none .s:guifg_gray_2 .s:guibg_none
exe "hi! SpellBad " .s:gui_undercurl .s:guifg_none .s:guibg_red
exe "hi! SpellCap " .s:gui_undercurl .s:guifg_none .s:guibg_none
exe "hi! SpellLocal " .s:gui_undercurl .s:guifg_none .s:guibg_green
exe "hi! SpellRare " .s:gui_undercurl .s:guifg_none .s:guibg_gray_5
exe "hi! Statement " .s:gui_none .s:guifg_gray_5 .s:guibg_none
exe "hi! StatusLine " .s:gui_none .s:guifg_white .s:guibg_gray_5
exe "hi! StatusLineNC " .s:gui_none .s:guifg_gray_2 .s:guibg_gray_5
exe "hi! StorageClass " .s:gui_none .s:guifg_gray_4 .s:guibg_none
exe "hi! String " .s:gui_none .s:guifg_green .s:guibg_none
exe "hi! TabLine " .s:gui_none .s:guifg_gray_2 .s:guibg_gray_5
exe "hi! TabLineFill " .s:gui_none .s:guifg_none .s:guibg_gray_5
exe "hi! TabLineSel " .s:gui_none .s:guifg_black .s:guibg_gray_5
exe "hi! Title " .s:gui_none .s:guifg_gray_3 .s:guibg_none
exe "hi! Todo " .s:gui_standout .s:guifg_none .s:guibg_none
exe "hi! Type " .s:gui_none .s:guifg_gray_4 .s:guibg_none
exe "hi! Underlined " .s:gui_none .s:guifg_none .s:guibg_none
exe "hi! VertSplit " .s:gui_none .s:guifg_black .s:guibg_none
exe "hi! Visual " .s:gui_none .s:guifg_none .s:guibg_gray_1
exe "hi! VisualNOS " .s:gui_none .s:guifg_none .s:guibg_none
exe "hi! WarningMsg " .s:gui_none .s:guifg_white .s:guibg_red
exe "hi! WildMenu " .s:gui_none .s:guifg_none .s:guibg_gray_3
exe "hi! lCursor " .s:gui_none .s:guifg_none .s:guibg_none
exe "hi! Identifier " .s:gui_none .s:guifg_black .s:guibg_none
exe "hi! PreProc " .s:gui_none .s:guifg_black .s:guibg_none
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment