From c2efee6a8ea3bfa2100bd4eed6eaa3c6503913ed Mon Sep 17 00:00:00 2001 From: Brian Buller Date: Tue, 24 Apr 2018 07:53:09 -0500 Subject: [PATCH] Cleaning some things up --- .gitmodules | 12 -- .vim/bundle/go-explorer | 2 +- .vim/bundle/tagbar | 2 +- .vim/bundle/vim-dirdiff | 2 +- .vim/bundle/vim-go | 2 +- .vim/bundle/vim-plugin-AnsiEsc | 2 +- .vim/bundle/vim-rest-console | 2 +- .vim/bundle/vim-tmux-navigator | 2 +- .vim/bundle/vim-vinegar | 1 - .vim/bundle/vim-vinegar/CONTRIBUTING.markdown | 1 + .vim/bundle/vim-vinegar/README.markdown | 50 +++++++ .vim/bundle/vim-vinegar/plugin/vinegar.vim | 126 ++++++++++++++++++ .vim/bundle/vimux | 2 +- .vim/bundle/webapi-vim | 2 +- .vim/ftplugin/go.vim | 12 ++ home/.vimrc | 25 ++-- 16 files changed, 207 insertions(+), 38 deletions(-) delete mode 160000 .vim/bundle/vim-vinegar create mode 100644 .vim/bundle/vim-vinegar/CONTRIBUTING.markdown create mode 100644 .vim/bundle/vim-vinegar/README.markdown create mode 100644 .vim/bundle/vim-vinegar/plugin/vinegar.vim diff --git a/.gitmodules b/.gitmodules index 28c49b6..52161a4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,30 +13,18 @@ [submodule ".vim/bundle/vim-dirdiff"] path = .vim/bundle/vim-dirdiff url = https://github.com/will133/vim-dirdiff.git -[submodule ".vim/bundle/vim-vinegar"] - path = .vim/bundle/vim-vinegar - url = git://github.com/tpope/vim-vinegar.git [submodule ".vim/bundle/vim-rest-console"] path = .vim/bundle/vim-rest-console url = https://github.com/diepm/vim-rest-console.git [submodule ".vim/bundle/tagbar"] path = .vim/bundle/tagbar url = https://github.com/majutsushi/tagbar -[submodule ".vim/bundle/taskwiki"] - path = .vim/bundle/taskwiki - url = https://github.com/tbabej/taskwiki [submodule ".vim/bundle/vim-plugin-AnsiEsc"] path = .vim/bundle/vim-plugin-AnsiEsc url = https://github.com/powerman/vim-plugin-AnsiEsc -[submodule ".vim/bundle/vim-taskwarrior"] - path = .vim/bundle/vim-taskwarrior - url = https://github.com/farseer90718/vim-taskwarrior [submodule ".vim/bundle/go-explorer"] path = .vim/bundle/go-explorer url = https://github.com/garyburd/go-explorer.git -[submodule ".vim/bundle/--force"] - path = .vim/bundle/--force - url = https://github.com/tbabej/taskwiki [submodule ".vim/bundle/gist-vim"] path = .vim/bundle/gist-vim url = https://github.com/mattn/gist-vim.git diff --git a/.vim/bundle/go-explorer b/.vim/bundle/go-explorer index 6a82202..cbf2b4f 160000 --- a/.vim/bundle/go-explorer +++ b/.vim/bundle/go-explorer @@ -1 +1 @@ -Subproject commit 6a82202d18e3b4a4a06b6c22769ee9511335e6ae +Subproject commit cbf2b4ff6714f0c76f8a08d772cc97c8748efc15 diff --git a/.vim/bundle/tagbar b/.vim/bundle/tagbar index 53e9cb0..387bbad 160000 --- a/.vim/bundle/tagbar +++ b/.vim/bundle/tagbar @@ -1 +1 @@ -Subproject commit 53e9cb030e143b6286ed06255fef018265edd311 +Subproject commit 387bbadda98e1376ff3871aa461b1f0abd4ece70 diff --git a/.vim/bundle/vim-dirdiff b/.vim/bundle/vim-dirdiff index db1fe77..b5a3d59 160000 --- a/.vim/bundle/vim-dirdiff +++ b/.vim/bundle/vim-dirdiff @@ -1 +1 @@ -Subproject commit db1fe77dcefa7a5b1089c8a84d1b401a4bd780bc +Subproject commit b5a3d59bfbeb5cef7dbadbe69c455b470988b58c diff --git a/.vim/bundle/vim-go b/.vim/bundle/vim-go index 3eb57ac..7491209 160000 --- a/.vim/bundle/vim-go +++ b/.vim/bundle/vim-go @@ -1 +1 @@ -Subproject commit 3eb57ac3a8e02a3d6e2bfba981144c6e1af3545b +Subproject commit 7491209072ed4aa746e6fe7894f976ecd251801e diff --git a/.vim/bundle/vim-plugin-AnsiEsc b/.vim/bundle/vim-plugin-AnsiEsc index f2df795..2b9393c 160000 --- a/.vim/bundle/vim-plugin-AnsiEsc +++ b/.vim/bundle/vim-plugin-AnsiEsc @@ -1 +1 @@ -Subproject commit f2df795e886809dc08a554ed2d0802c620460de3 +Subproject commit 2b9393c921488a3f2592cfb77f52acd3eca793b1 diff --git a/.vim/bundle/vim-rest-console b/.vim/bundle/vim-rest-console index 28e4608..11f1acf 160000 --- a/.vim/bundle/vim-rest-console +++ b/.vim/bundle/vim-rest-console @@ -1 +1 @@ -Subproject commit 28e46087dc0a80005080cc6b91c6ed221e7c79c3 +Subproject commit 11f1acf4d1bb2fc269e81b3916057cf9b6456ba7 diff --git a/.vim/bundle/vim-tmux-navigator b/.vim/bundle/vim-tmux-navigator index 2fc1ed4..d724094 160000 --- a/.vim/bundle/vim-tmux-navigator +++ b/.vim/bundle/vim-tmux-navigator @@ -1 +1 @@ -Subproject commit 2fc1ed42ab580ab47c506ab0bef09f1dbb9ff04d +Subproject commit d724094e7128acd7375cc758008f1e1688130877 diff --git a/.vim/bundle/vim-vinegar b/.vim/bundle/vim-vinegar deleted file mode 160000 index bd7f7b7..0000000 --- a/.vim/bundle/vim-vinegar +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bd7f7b7929260072864462c04dde3b9f4c5e0d23 diff --git a/.vim/bundle/vim-vinegar/CONTRIBUTING.markdown b/.vim/bundle/vim-vinegar/CONTRIBUTING.markdown new file mode 100644 index 0000000..b3f0095 --- /dev/null +++ b/.vim/bundle/vim-vinegar/CONTRIBUTING.markdown @@ -0,0 +1 @@ +See the [contribution guidelines for pathogen.vim](https://github.com/tpope/vim-pathogen/blob/master/CONTRIBUTING.markdown). diff --git a/.vim/bundle/vim-vinegar/README.markdown b/.vim/bundle/vim-vinegar/README.markdown new file mode 100644 index 0000000..9684d16 --- /dev/null +++ b/.vim/bundle/vim-vinegar/README.markdown @@ -0,0 +1,50 @@ +# vinegar.vim + +> Split windows and the project drawer go together like oil and vinegar. I +> don't mean to say that you can combine them to create a delicious salad +> dressing. I mean that they don't mix well! +> - Drew Neil + +You know what netrw is, right? The built in directory browser? Well, +vinegar.vim enhances netrw, partially in an attempt to mitigate the need for +more disruptive ["project drawer"][Oil and vinegar] style plugins. + +[Oil and vinegar]: http://vimcasts.org/blog/2013/01/oil-and-vinegar-split-windows-and-project-drawer/ + +Some of the behaviors added by vinegar.vim would make excellent upstream +additions. Many, the author would probably reject. Others are a bit too wild +to even consider. + +* Press `-` in any buffer to hop up to the directory listing and seek to the + file you just came from. Keep bouncing to go up, up, up. Having rapid + directory access available changes everything. +* All that annoying crap at the top is turned off, leaving you with nothing + but a list of files. This is surprisingly disorienting, but ultimately + very liberating. Press `I` to toggle until you adapt. +* The oddly C-biased default sort order is replaced with a sensible application + of `'suffixes'`. +* File hiding: files are not listed that match with one of the patterns in + `'wildignore'`. + If you put `let g:netrw_list_hide = '\(^\|\s\s\)\zs\.\S\+'` + in your vimrc, vinegar will initialize with dot files hidden. + Press `gh` to toggle dot file hiding. +* Press `.` on a file to pre-populate it at the end of a `:` command line. + This is great, for example, to quickly initiate a `:grep` of the file or + directory under the cursor. There's also `!`, which starts the line off + with a bang. Type `!chmod +x` and get `:!chmod +x path/to/file`. +* Press `y.` to yank an absolute path for the file under the cursor. +* Press `~` to go home. + +## Installation + +If you don't have a preferred installation method, I recommend +installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and +then simply copy and paste: + + cd ~/.vim/bundle + git clone git://github.com/tpope/vim-vinegar.git + +## License + +Copyright © Tim Pope. Distributed under the same terms as Vim itself. +See `:help license`. diff --git a/.vim/bundle/vim-vinegar/plugin/vinegar.vim b/.vim/bundle/vim-vinegar/plugin/vinegar.vim new file mode 100644 index 0000000..001c8b5 --- /dev/null +++ b/.vim/bundle/vim-vinegar/plugin/vinegar.vim @@ -0,0 +1,126 @@ +" vinegar.vim - combine with netrw to create a delicious salad dressing +" Maintainer: Tim Pope + +if exists("g:loaded_vinegar") || v:version < 700 || &cp + finish +endif +let g:loaded_vinegar = 1 + +function! s:fnameescape(file) abort + if exists('*fnameescape') + return fnameescape(a:file) + else + return escape(a:file," \t\n*?[{`$\\%#'\"|!<") + endif +endfunction + +let s:dotfiles = '\(^\|\s\s\)\zs\.\S\+' + +let g:netrw_sort_sequence = '[\/]$,*,\%(' . join(map(split(&suffixes, ','), 'escape(v:val, ".*$~")'), '\|') . '\)[*@]\=$' +let s:escape = 'substitute(escape(v:val, ".$~"), "*", ".*", "g")' +let g:netrw_list_hide = + \ join(map(split(&wildignore, ','), '"^".' . s:escape . '. "/\\=$"'), ',') . ',^\.\.\=/\=$' . + \ (get(g:, 'netrw_list_hide', '')[-strlen(s:dotfiles)-1:-1] ==# s:dotfiles ? ','.s:dotfiles : '') +if !exists("g:netrw_banner") + let g:netrw_banner = 0 +endif +let s:netrw_up = '' + +nnoremap VinegarUp :call opendir('edit') +if empty(maparg('-', 'n')) + nmap - VinegarUp +endif + +nnoremap VinegarTabUp :call opendir('tabedit') +nnoremap VinegarSplitUp :call opendir('split') +nnoremap VinegarVerticalSplitUp :call opendir('vsplit') + +function! s:opendir(cmd) abort + let df = ','.s:dotfiles + if expand('%:t')[0] ==# '.' && g:netrw_list_hide[-strlen(df):-1] ==# df + let g:netrw_list_hide = g:netrw_list_hide[0 : -strlen(df)-1] + endif + if &filetype ==# 'netrw' + let currdir = fnamemodify(b:netrw_curdir, ':t') + execute s:netrw_up + call s:seek(currdir) + elseif expand('%') =~# '^$\|^term:[\/][\/]' + execute a:cmd '.' + else + execute a:cmd '%:h' + call s:seek(expand('#:t')) + endif +endfunction + +function! s:seek(file) abort + if get(b:, 'netrw_liststyle') == 2 + let pattern = '\%(^\|\s\+\)\zs'.escape(a:file, '.*[]~\').'[/*|@=]\=\%($\|\s\+\)' + else + let pattern = '^\%(| \)*'.escape(a:file, '.*[]~\').'[/*|@=]\=\%($\|\t\)' + endif + call search(pattern, 'wc') + return pattern +endfunction + +augroup vinegar + autocmd! + autocmd FileType netrw call s:setup_vinegar() +augroup END + +function! s:slash() abort + return !exists("+shellslash") || &shellslash ? '/' : '\' +endfunction + +function! s:absolutes(first, ...) abort + let files = getline(a:first, a:0 ? a:1 : a:first) + call filter(files, 'v:val !~# "^\" "') + call map(files, 'b:netrw_curdir . s:slash() . substitute(v:val, "[/*|@=]\\=\\%(\\t.*\\)\\=$", "", "")') + return files +endfunction + +function! s:relatives(first, ...) abort + let files = s:absolutes(a:first, a:0 ? a:1 : a:first) + call filter(files, 'v:val !~# "^\" "') + for i in range(len(files)) + let relative = fnamemodify(files[i], ':.') + if relative !=# files[i] + let files[i] = '.' . s:slash() . relative + endif + endfor + return files +endfunction + +function! s:escaped(first, last) abort + let files = s:relatives(a:first, a:last) + return join(map(files, 'fnameescape(v:val)'), ' ') +endfunction + +function! s:setup_vinegar() abort + if empty(s:netrw_up) + " save netrw mapping + if strpart(g:loaded_netrw, 1, strlen(g:loaded_netrw)) < 162 + let s:netrw_up = substitute(maparg('-', 'n'), '\c^:\%(\)\=', '', '') + else + let s:netrw_up = substitute(maparg('NetrwBrowseUpDir', 'n'), '\c^:\%(\)\=', '', '') + endif + " saved string is like this: + " :exe "norm! 0"|call netrw#LocalBrowseCheck(172_NetrwBrowseChgDir(1,'../')) + " remove at the end (otherwise raises "E488: Trailing characters") + let s:netrw_up = strpart(s:netrw_up, 0, strlen(s:netrw_up)-4) + endif + nmap - VinegarUp + cnoremap get(relatives('.'),0,"\022\006") + if empty(maparg('', 'c')) + cmap + endif + nnoremap ~ :edit ~/ + nnoremap . : =escaped(line('.'), line('.') - 1 + v:count1) + xnoremap . : =escaped(line("'<"), line("'>")) + if empty(mapcheck('y.', 'n')) + nnoremap y. :call setreg(v:register, join(absolutes(line('.'), line('.') - 1 + v:count1), "\n")."\n") + endif + nmap ! .! + xmap ! .! + exe 'syn match netrwSuffixes =\%(\S\+ \)*\S\+\%('.join(map(split(&suffixes, ','), s:escape), '\|') . '\)[*@]\=\S\@!=' + hi def link netrwSuffixes SpecialKey +endfunction diff --git a/.vim/bundle/vimux b/.vim/bundle/vimux index 2285cef..37f4119 160000 --- a/.vim/bundle/vimux +++ b/.vim/bundle/vimux @@ -1 +1 @@ -Subproject commit 2285cefee9dfb2139ebc8299d11a6c8c0f21309e +Subproject commit 37f41195e6369ac602a08ec61364906600b771f1 diff --git a/.vim/bundle/webapi-vim b/.vim/bundle/webapi-vim index e3fa93f..2522503 160000 --- a/.vim/bundle/webapi-vim +++ b/.vim/bundle/webapi-vim @@ -1 +1 @@ -Subproject commit e3fa93f29a3a0754204002775e140d8a9acfd7fd +Subproject commit 252250381a9509257bfb06b9f95441e41e3e23b5 diff --git a/.vim/ftplugin/go.vim b/.vim/ftplugin/go.vim index e69de29..e6b3991 100644 --- a/.vim/ftplugin/go.vim +++ b/.vim/ftplugin/go.vim @@ -0,0 +1,12 @@ +" Convenient mappings for all Go things +au FileType go nmap r :GoRun! +au FileType go nmap e (go-rename) +au FileType go nmap s (go-implements) +au FileType go nmap t :GoTest! +au FileType go nmap c (go-coverage) +au FileType go nmap v (go-vet) +au FileType go nmap gd (go-doc) +au FileType go nmap d :GoDef +au FileType go nmap D :GoDescribe +" Use `goimports` instead of `gofmt` +let g:go_fmt_command = "goimports" diff --git a/home/.vimrc b/home/.vimrc index 4252297..b41ffb3 100644 --- a/home/.vimrc +++ b/home/.vimrc @@ -8,7 +8,7 @@ execute pathogen#infect() " General Settings {{ scriptencoding utf-8 - set foldmethod=manual + set foldmethod=syntax set ai " Disable Ex Mode @@ -160,19 +160,7 @@ execute pathogen#infect() " }} " Go {{ - " Convenient mappings for all Go things - au FileType go nmap r :GoRun! - au FileType go nmap e (go-rename) - au FileType go nmap s (go-implements) - au FileType go nmap t :GoTest! - au FileType go nmap c (go-coverage) - au FileType go nmap v (go-vet) - au FileType go nmap gd (go-doc) - au FileType go nmap d :GoDef - au FileType go nmap D :GoDescribe - " Use `goimports` instead of `gofmt` - let g:go_fmt_command = "goimports" " }} " Java {{ @@ -189,9 +177,13 @@ execute pathogen#infect() " Misc Things {{ " Vimwiki {{ - let g:vimwiki_list = [ - \{'path': '~/Dropbox/Documents/vimwiki', 'path_html': '~/Dropbox/Documents/vimwiki_html/', 'auto_export':'1'}, - \] + let g:vimwiki_list = [{ + \'path': '~/Dropbox/Documents/vimwiki', + \'path_html': '~/Dropbox/Documents/vimwiki_html/', + \'template_path': '~/Dropbox/Documents/vimwiki/templates', + \'template_default': 'default', + \'template_ext': '.html', + \'auto_export':'1'}] nnoremap wb :Vimwiki2HTMLBrowse let g:vimwiki_auto_checkbox = 1 function! VimwikiLinkHandler(link) @@ -212,6 +204,7 @@ execute pathogen#infect() endfunction nmap VimwikiDiaryPrevDay nmap VimwikiDiaryNextDay + let g:vimwiki_folding='expr' " }} " Gist {{