aboutsummaryrefslogtreecommitdiff
path: root/vim/.vimrc
diff options
context:
space:
mode:
authorxero <x@xero.nu>2015-06-14 05:48:03 -0400
committerxero <x@xero.nu>2015-06-14 05:48:03 -0400
commit7eb2501d60f9a642c7c7fc3d68f5a42d50ea2ecd (patch)
tree5e33e44f4d7dfd941fe8575f88f95f15d44d741e /vim/.vimrc
parentfb2ea5b0e06ad95aa6bbdf0cc752a2958b53848e (diff)
downloaddotfiles_ascii-7eb2501d60f9a642c7c7fc3d68f5a42d50ea2ecd.tar.xz
dotfiles_ascii-7eb2501d60f9a642c7c7fc3d68f5a42d50ea2ecd.zip
vim reorganization
Diffstat (limited to 'vim/.vimrc')
-rw-r--r--vim/.vimrc264
1 files changed, 166 insertions, 98 deletions
diff --git a/vim/.vimrc b/vim/.vimrc
index d272d43..742969d 100644
--- a/vim/.vimrc
+++ b/vim/.vimrc
@@ -26,9 +26,10 @@ set undofile
set undodir=~/.vim/undo
set noswapfile
-" file name tab completion
+" lazy file name tab completion
set wildmode=longest,list,full
set wildmenu
+set wildignorecase
" case insensitive search
set ignorecase
@@ -37,59 +38,38 @@ set smartcase
" the /g flag on :s substitutions by default
set gdefault
-" show matching brackets/parenthesis
-set showmatch
-
" make backspace behave in a sane manner
set backspace=indent,eol,start
-" disable startup message
-set shortmess+=I
-
-" syntax highlighting and colors
-syntax on
-colorscheme sourcerer
-filetype plugin indent on
-
-" stop unnecessary rendering
-set lazyredraw
-
-" show line numbers
-set number
-
-" no line wrapping
-set nowrap
-
-" highlight column
-set cursorcolumn
-
" searching
set hlsearch
set incsearch
-" no folding
-set foldlevel=99
-set foldminlines=99
-
-" wrap long lines
-set nowrap
-
" use indents of 4 spaces
-set shiftwidth=4
+set shiftwidth=2
" tabs are spaces, not tabs
set expandtab
" an indentation every four columns
-set tabstop=4
+set tabstop=2
" let backspace delete indent
-set softtabstop=4
+set softtabstop=2
" remove trailing whitespaces and ^M chars
autocmd FileType c,cpp,java,php,js,python,twig,xml,yml autocmd BufWritePre <buffer> :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))
-" make ; work like : for commands. lazy shifting
+" let mapleader=","
+vnoremap <silent> <leader>y :w !xsel -i -b<CR>
+nnoremap <silent> <leader>y V:w !xsel -i -b<CR>
+nnoremap <silent> <leader>p :silent :r !xsel -o -b<CR>
+
+" ┏━╸┏━┓┏┳┓┏┳┓┏━┓┏┓╻╺┳┓┏━┓
+" ┃ ┃ ┃┃┃┃┃┃┃┣━┫┃┗┫ ┃┃┗━┓
+" ┗━╸┗━┛╹ ╹╹ ╹╹ ╹╹ ╹╺┻┛┗━┛
+
+" make ; work like : for commands (lazy shifting)
nnoremap ; :
" json pretty print
@@ -101,78 +81,166 @@ command Nows :%s/\s\+$//
" remove blank lines
command Nobl :g/^\s*$/d
-" enable file type detection and do language-dependent indenting
-if has("autocmd")
- filetype on
- filetype indent on
- filetype plugin on
-endif
+" toggle spellcheck
+command Spell :setlocal spell! spell?
-" let mapleader=","
-vnoremap <silent> <leader>y :w !xsel -i -b<CR>
-nnoremap <silent> <leader>y V:w !xsel -i -b<CR>
-nnoremap <silent> <leader>p :silent :r !xsel -o -b<CR>
+" ╻┏┓╻╺┳╸┏━╸┏━┓┏━╸┏━┓┏━╸┏━╸
+" ┃┃┗┫ ┃ ┣╸ ┣┳┛┣╸ ┣━┫┃ ┣╸
+" ╹╹ ╹ ╹ ┗━╸╹┗╸╹ ╹ ╹┗━╸┗━╸
-" remap code completion to ^space
-"inoremap <Nul> <C-x><C-o>
-" inoremap <Nul> <C-n>
-inoremap <C-Space> <C-x><C-o>
-inoremap <C-@> <C-Space>
+" show matching brackets/parenthesis
+set showmatch
+
+" disable startup message
+set shortmess+=I
+
+" syntax highlighting and colors
+syntax on
+colorscheme sourcerer
+filetype off
+
+" stop unnecessary rendering
+set lazyredraw
+
+" show line numbers
+set number
+
+" no line wrapping
+set nowrap
+
+" no folding
+set foldlevel=99
+set foldminlines=99
+
+" don't wrap long lines
+set nowrap
+
+" highlight column
+set cursorcolumn
+
+" ┏━┓╻ ╻ ╻┏━╸╻┏┓╻ ┏━┓╺┳╸╻ ╻┏━╸┏━╸
+" ┣━┛┃ ┃ ┃┃╺┓┃┃┗┫ ┗━┓ ┃ ┃ ┃┣╸ ┣╸
+" ╹ ┗━╸┗━┛┗━┛╹╹ ╹ ┗━┛ ╹ ┗━┛╹ ╹
+" i struggle with the decision to use plugins or a more vanilla vim. but right now i'm feeling sytanx completion, linting, and visual git diffs. don't judge me.
+" to install from the shell run:
+"& git clone https://github.com/gmarik/Vundle.vim.git ~/dotfiles/vim/.vim/bundle/Vundle.vim && vim +BundleInstall +qall && PYTHON=/usr/bin/python2 ~/dotfiles/vim/.vim/bundle/YouCompleteMe/install.sh --clang-completer
+
+set rtp+=~/.vim/bundle/Vundle.vim
+call vundle#begin()
+Plugin 'gmarik/Vundle.vim'
+Plugin 'Valloric/YouCompleteMe'
+Plugin 'scrooloose/syntastic'
+Plugin 'airblade/vim-gitgutter'
+Plugin 'isa/vim-matchit'
+Plugin 'shawncplus/phpcomplete.vim'
+Plugin 'mustache/vim-mustache-handlebars'
+Plugin 'itchyny/lightline.vim'
+Plugin 'tpope/vim-fugitive'
+call vundle#end()
+filetype plugin indent on
+" syntatic http://git.io/syntastic.vim
+" linters: (from aur) nodejs-jshint, nodejs-jsonlint, csslint, checkbashisms
+let g:syntastic_always_populate_loc_list = 1
+let g:syntastic_auto_loc_list = 1
+let g:syntastic_check_on_open = 1
+let g:syntastic_check_on_wq = 0
+highlight SyntasticErrorSign ctermfg=red ctermbg=237
+highlight SyntasticWarningSign ctermfg=yellow ctermbg=237
+highlight SyntasticStyleErrorSign ctermfg=red ctermbg=237
+highlight SyntasticStyleWarningSign ctermfg=yellow ctermbg=237
+
+" git-gutter http://git.io/vimgitgutter
+let g:gitgutter_realtime = 1
+let g:gitgutter_eager = 1
+let g:gitgutter_diff_args = '-w'
+let g:gitgutter_sign_added = '+'
+let g:gitgutter_sign_modified = '~'
+let g:gitgutter_sign_removed = '-'
+let g:gitgutter_sign_removed_first_line = '^'
+let g:gitgutter_sign_modified_removed = ':'
+let g:gitgutter_max_signs = 1500
+highlight clear SignColumn
+highlight GitGutterAdd ctermfg=green ctermbg=237
+highlight GitGutterChange ctermfg=yellow ctermbg=237
+highlight GitGutterDelete ctermfg=red ctermbg=237
+highlight GitGutterChangeDelete ctermfg=red ctermbg=237
+
+" vim mustache http://git.io/vim-stash
+let g:mustache_abbreviations = 1
+
+" ┏━┓╺┳╸┏━┓╺┳╸╻ ╻┏━┓╻ ╻┏┓╻┏━╸
+" ┗━┓ ┃ ┣━┫ ┃ ┃ ┃┗━┓┃ ┃┃┗┫┣╸
+" ┗━┛ ╹ ╹ ╹ ╹ ┗━┛┗━┛┗━╸╹╹ ╹┗━╸
+" lightline http://git.io/lightline
" █▓▒░ wizard status line
set laststatus=2
+let g:lightline = {
+ \ 'colorscheme': 'sourcerer',
+ \ 'active': {
+ \ 'left': [ [ 'filename' ],
+ \ [ 'readonly', 'fugitive' ] ],
+ \ 'right': [ [ 'percent', 'lineinfo' ],
+ \ [ 'fileencoding', 'filetype' ],
+ \ [ 'fileformat', 'syntastic' ] ]
+ \ },
+ \ 'component_function': {
+ \ 'modified': 'WizMod',
+ \ 'readonly': 'WizRO',
+ \ 'fugitive': 'WizGit',
+ \ 'filename': 'WizName',
+ \ 'filetype': 'WizType',
+ \ 'fileformat' : 'WizFormat',
+ \ 'fileencoding': 'WizEncoding',
+ \ 'mode': 'WizMode',
+ \ },
+ \ 'component_expand': {
+ \ 'syntastic': 'SyntasticStatuslineFlag',
+ \ },
+ \ 'component_type': {
+ \ 'syntastic': 'error',
+ \ },
+ \ 'separator': { 'left': '▓▒░', 'right': '░▒▓' },
+ \ 'subseparator': { 'left': '▒', 'right': '░' }
+ \ }
+
+function! WizMod()
+ return &ft =~ 'help\|vimfiler' ? '' : &modified ? '»' : &modifiable ? '' : ''
+endfunction
-hi BgColor guibg=#3A3A3A guifg=#ffffff ctermbg=237 ctermfg=255
-hi ModColor guibg=#3A3A3A guifg=#afaf00 ctermbg=237 ctermfg=142
-hi StatColor guibg=#3a3a3a guifg=#ffffff ctermbg=237 ctermfg=255
-hi GitColor guibg=#4e4e4e guifg=#ffffff ctermbg=239 ctermfg=255
-hi VoidColor guibg=#222222 guifg=#4e4e4e ctermbg=NONE ctermfg=239
-hi TypeColor guibg=#D78700 guifg=#262626 ctermbg=66 ctermfg=235
-hi PosColor guibg=#8787AF guifg=#262626 ctermbg=103 ctermfg=235
-
-function! WizardStatus(mode)
- let statusline="%#BgColor#"
- if &modified == 1
- let statusline.="%#ModColor# »» "
- else
- let statusline.=" "
- endif
- if &readonly != ''
- hi StatColor guifg=#af0000 ctermfg=124
- endif
- let statusline.="%#StatColor#%F "
- "let branch = system("git branch 2> /dev/null | sed -e '/^[^*]/d'")
- "let branch = system("git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* //'")
- "if branch != ''
- " let statusline .= '%#VoidColor#▓%#GitColor# ' . substitute(branch, '\n', '', 'g') . ' %#VoidColor#▓▒░ '
- "else
- let statusline .= '%#VoidColor#▒░ '
- "endif
- let statusline .= "%=%h%w\ %#TypeColor#▓"
- if &filetype != ''
- let statusline .="▒ %Y "
- endif
- let statusline .="▒ %{&encoding}:%{&fileformat} %#PosColor#▒ %p%% ░ %l/%L\.\%c\ ▒"
- return statusline
+function! WizRO()
+ return &ft !~? 'help\|vimfiler' && &readonly ? 'x' : ''
endfunction
-au WinEnter * setlocal statusline=%!WizardStatus('Enter')
-au WinLeave * setlocal statusline=%!WizardStatus('Leave')
-set statusline=%!WizardStatus('Enter')
-
-function! Colorize(mode)
- if a:mode == 'i'
- hi StatColor guibg=#D78700 guifg=#222222 ctermbg=110 ctermfg=235
- elseif a:mode == 'r'
- hi StatColor guibg=#D78700 guifg=#222222 ctermbg=172 ctermfg=235
- elseif a:mode == 'v'
- hi StatColor guibg=#D78700 guifg=#222222 ctermbg=172 ctermfg=235
- else
- hi StatColor guibg=#af0000 guifg=#222222 ctermbg=124 ctermfg=235
+function! WizGit()
+ if &ft !~? 'help\|vimfiler' && exists("*fugitive#head")
+ return fugitive#head()
endif
+ return ''
endfunction
-au InsertEnter * call Colorize(v:insertmode)
-au InsertLeave * hi StatColor guibg=#3a3a3a guifg=#ffffff ctermbg=237 ctermfg=255
+function! WizName()
+ return ('' != WizMod() ? WizMod() . ' ' : '') .
+ \ ('' != expand('%:t') ? expand('%:t') : '[none]')
+endfunction
- "execute pathogen#infect()
+function! WizType()
+ return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : '') : ''
+endfunction
+
+function! WizFormat()
+ return ''
+endfunction
+
+function! WizEncoding()
+ return winwidth(0) > 70 ? (strlen(&fenc) ? &enc : &enc) : ''
+endfunction
+
+augroup AutoSyntastic
+ autocmd!
+ autocmd BufWritePost *.c,*.cpp call s:syntastic()
+augroup END
+function! s:syntastic()
+ SyntasticCheck
+ call lightline#update()
+endfunction