MAINT: cleaning up vim config a bit (#2)

This commit is contained in:
Matthew Ryan Dillon 2019-08-20 06:39:13 -07:00 committed by GitHub
parent aa2b92a55a
commit e65f0f920d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 58 additions and 33 deletions

View file

@ -4,6 +4,7 @@
$ sudo zypper install \ $ sudo zypper install \
the_silver_searcher \ the_silver_searcher \
cmus \ cmus \
ctags \
docker \ docker \
gcc \ gcc \
git \ git \

90
vimrc
View file

@ -1,8 +1,3 @@
let g:ale_completion_enabled = 1
let g:ale_linters = {
\ 'python': ['flake8', 'pyls'],
\}
call plug#begin() call plug#begin()
" Color/theme integration " Color/theme integration
Plug 'danielwe/base16-vim' Plug 'danielwe/base16-vim'
@ -20,30 +15,10 @@ call plug#begin()
Plug 'ntpeters/vim-better-whitespace' Plug 'ntpeters/vim-better-whitespace'
" Mustache/handlebars support " Mustache/handlebars support
Plug 'mustache/vim-mustache-handlebars' Plug 'mustache/vim-mustache-handlebars'
" Insert-mode tab completion
Plug 'ervandew/supertab'
" elm-lang Support
Plug 'elmcast/elm-vim'
" ranger support
Plug 'francoiscabrol/ranger.vim'
" Delimited file querying
Plug 'mechatroner/rainbow_csv'
" fzf setup
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
" vue2
Plug 'posva/vim-vue'
" golang support
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
" elixir
Plug 'elixir-editors/vim-elixir'
" the silver searcher " the silver searcher
Plug 'mileszs/ack.vim' Plug 'mileszs/ack.vim'
" vimwiki " ctag generation
Plug 'vimwiki/vimwiki' Plug 'jsfaint/gen_tags.vim'
" typescript syntax highlighting
Plug 'leafgarland/typescript-vim'
" lsp
Plug 'w0rp/ale'
call plug#end() call plug#end()
set t_Co=256 set t_Co=256
@ -68,6 +43,7 @@ syntax on
" turn on line numbering " turn on line numbering
set number set number
set relativenumber
" make backspace behave as expected " make backspace behave as expected
set backspace=indent,eol,start set backspace=indent,eol,start
@ -112,9 +88,6 @@ set writebackup
" change the mapleader from \ to , " change the mapleader from \ to ,
let mapleader=" " let mapleader=" "
" fzf config
map <leader><Tab> :FZF<CR>
" PEP8 formatting " PEP8 formatting
au BufNewFile,BufRead *.py au BufNewFile,BufRead *.py
\ set tabstop=4 | \ set tabstop=4 |
@ -154,8 +127,59 @@ let g:flake8_warning_marker = 'WW'
" Inform ack.vim that we are actually using the_silver_searcher " Inform ack.vim that we are actually using the_silver_searcher
let g:ackprg = 'ag --vimgrep' let g:ackprg = 'ag --vimgrep'
" vimwiki config " relative numbers in normal mode, absolute in insert
let g:vimwiki_list = [{'path': '$HOME/Dropbox/vimwiki/'}] augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
augroup END
" netrw " netrw
let g:netrw_liststyle = 3 " tree view let g:netrw_banner = 0
let g:netrw_liststyle = 3
let g:netrw_altv = 1
let g:netrw_preview=1 " open previews vertically
let g:netrw_list_hide='\.git,\.idea,.*\.swp$,.*\.pyc$,__pycache__,\.DS_Store'
autocmd FileType netrw setlocal bufhidden=delete
" http://ivanbrennan.nyc/2014-01-16/rigging-vims-netrw
fun! VexOpen(dir)
let g:netrw_browse_split=4
let vex_width=25
execute "Vexplore " . a:dir
set number relativenumber
let t:vex_buf_nr = bufnr("%")
wincmd H
call VexSize(vex_width)
endf
fun! VexClose()
let cur_win_nr = winnr()
let target_nr = ( cur_win_nr == 1 ? winnr("#") : cur_win_nr )
1wincmd w
close
unlet t:vex_buf_nr
execute (target_nr - 1) . "wincmd w"
call NormalizeWidths()
endf
fun! VexSize(vex_width)
execute "vertical resize" . a:vex_width
set winfixwidth
call NormalizeWidths()
endf
fun! NormalizeWidths()
let eadir_pref = &eadirection
set eadirection=hor
set equalalways! equalalways!
let &eadirection = eadir_pref
endf
fun! VexToggle(dir)
if exists("t:vex_buf_nr")
call VexClose()
else
call VexOpen(a:dir)
endif
endf
noremap <Leader><Tab> :call VexToggle(getcwd())<CR>
noremap <Leader>` :call VexToggle("")<CR>
augroup NetrwGroup
autocmd! BufEnter * call NormalizeWidths()
augroup END