From e65f0f920dda18ee46da8ee230345c86b5592427 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Tue, 20 Aug 2019 06:39:13 -0700 Subject: [PATCH] MAINT: cleaning up vim config a bit (#2) --- README.md | 1 + vimrc | 90 +++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 58 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index e98d9ca..e9603d1 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ $ sudo zypper install \ the_silver_searcher \ cmus \ + ctags \ docker \ gcc \ git \ diff --git a/vimrc b/vimrc index b873011..edfdc7c 100644 --- a/vimrc +++ b/vimrc @@ -1,8 +1,3 @@ -let g:ale_completion_enabled = 1 -let g:ale_linters = { -\ 'python': ['flake8', 'pyls'], -\} - call plug#begin() " Color/theme integration Plug 'danielwe/base16-vim' @@ -20,30 +15,10 @@ call plug#begin() Plug 'ntpeters/vim-better-whitespace' " Mustache/handlebars support 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 Plug 'mileszs/ack.vim' - " vimwiki - Plug 'vimwiki/vimwiki' - " typescript syntax highlighting - Plug 'leafgarland/typescript-vim' - " lsp - Plug 'w0rp/ale' + " ctag generation + Plug 'jsfaint/gen_tags.vim' call plug#end() set t_Co=256 @@ -68,6 +43,7 @@ syntax on " turn on line numbering set number +set relativenumber " make backspace behave as expected set backspace=indent,eol,start @@ -112,9 +88,6 @@ set writebackup " change the mapleader from \ to , let mapleader=" " -" fzf config -map :FZF - " PEP8 formatting au BufNewFile,BufRead *.py \ set tabstop=4 | @@ -154,8 +127,59 @@ let g:flake8_warning_marker = 'WW' " Inform ack.vim that we are actually using the_silver_searcher let g:ackprg = 'ag --vimgrep' -" vimwiki config -let g:vimwiki_list = [{'path': '$HOME/Dropbox/vimwiki/'}] +" relative numbers in normal mode, absolute in insert +augroup numbertoggle + autocmd! + autocmd BufEnter,FocusGained,InsertLeave * set relativenumber + autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber +augroup END " 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 :call VexToggle(getcwd()) +noremap ` :call VexToggle("") +augroup NetrwGroup + autocmd! BufEnter * call NormalizeWidths() +augroup END