From dbcdace7be8d63e82206d7fd52dee2c1c860ffd1 Mon Sep 17 00:00:00 2001 From: Amir Date: Tue, 28 Jan 2020 23:07:36 -0300 Subject: [PATCH] Updated plugins --- sources_non_forked/bufexplorer/README.md | 14 +- .../bufexplorer/plugin/bufexplorer.vim | 8 +- sources_non_forked/gist-vim/README.md | 3 + sources_non_forked/gist-vim/autoload/gist.vim | 4 +- sources_non_forked/lightline-ale/README.md | 14 +- .../lightline-ale/autoload/lightline/ale.vim | 14 +- sources_non_forked/lightline.vim/LICENSE | 2 +- sources_non_forked/lightline.vim/README.md | 2 +- .../lightline.vim/autoload/lightline.vim | 4 +- .../lightline.vim/doc/lightline.txt | 24 +- sources_non_forked/nerdtree/CHANGELOG.md | 5 + .../nerdtree/autoload/nerdtree.vim | 7 +- .../nerdtree/autoload/nerdtree/ui_glue.vim | 7 +- sources_non_forked/nerdtree/doc/NERDTree.txt | 5 +- .../nerdtree/lib/nerdtree/creator.vim | 30 +- .../nerdtree/nerdtree_plugin/fs_menu.vim | 9 +- sources_non_forked/nginx.vim/README.md | 25 +- .../rust.vim/autoload/cargo.vim | 4 + .../rust.vim/autoload/rustfmt.vim | 22 +- sources_non_forked/rust.vim/plugin/cargo.vim | 1 + .../vim-fugitive/autoload/fugitive.vim | 899 ++++++++---------- .../vim-fugitive/doc/fugitive.txt | 89 +- .../vim-fugitive/plugin/fugitive.vim | 46 +- sources_non_forked/vim-gitgutter/README.mkd | 14 + .../vim-gitgutter/autoload/gitgutter/diff.vim | 2 +- .../vim-gitgutter/doc/gitgutter.txt | 18 + .../vim-javascript/syntax/javascript.vim | 2 +- .../vim-ruby/ftdetect/ruby_extra.vim | 3 + sources_non_forked/vim-ruby/syntax/ruby.vim | 4 +- .../vim-snippets/UltiSnips/tex.snippets | 21 + .../vim-snippets/snippets/elixir.snippets | 2 + .../vim-snippets/snippets/sh.snippets | 4 +- 32 files changed, 644 insertions(+), 664 deletions(-) diff --git a/sources_non_forked/bufexplorer/README.md b/sources_non_forked/bufexplorer/README.md index a5eab5bc..5ee9346e 100644 --- a/sources_non_forked/bufexplorer/README.md +++ b/sources_non_forked/bufexplorer/README.md @@ -5,10 +5,10 @@ BufExplorer Plugin for Vim With bufexplorer, you can quickly and easily switch between buffers by using the one of the default public interfaces: - 'be' (normal open) or - 'bt' (toggle open / close) or - 'bs' (force horizontal split open) or - 'bv' (force vertical split open) + '\be' (normal open) or + '\bt' (toggle open / close) or + '\bs' (force horizontal split open) or + '\bv' (force vertical split open) Once the bufexplorer window is open you can use the normal movement keys (hjkl) to move around and then use or to select the buffer you would like to open. If you would like to have the selected buffer opened in a new tab, simply press either or 't'. Please note that when opening a buffer in a tab, that if the buffer is already in another tab, bufexplorer can switch to that tab automatically for you if you would like. More about that in the supplied VIM help. @@ -28,8 +28,8 @@ This plugin can also be found at http://www.vim.org/scripts/script.php?script_id ## Installation ### Manually -1. If you do not want to use on the the bundle handlers, you can take the zip - file from vim.org and unzip it and copy the plugin to your vimfiles\plugin +1. If you do not want to use one of the the bundle handlers, you can take the + zip file from vim.org and unzip it and copy the plugin to your vimfiles\plugin directory and the txt file to your vimfiles\doc directory. If you do that, make sure you generate the help by executing @@ -65,7 +65,7 @@ This plugin can also be found at http://www.vim.org/scripts/script.php?script_id git clone https://github.com/jlanzarotta/bufexplorer.git ~/.vim/bundle/bufexplorer.vim ## License -Copyright (c) 2001-2019, Jeff Lanzarotta +Copyright (c) 2001-2020, Jeff Lanzarotta All rights reserved. diff --git a/sources_non_forked/bufexplorer/plugin/bufexplorer.vim b/sources_non_forked/bufexplorer/plugin/bufexplorer.vim index aa19a36f..6a7ef4f0 100644 --- a/sources_non_forked/bufexplorer/plugin/bufexplorer.vim +++ b/sources_non_forked/bufexplorer/plugin/bufexplorer.vim @@ -919,7 +919,7 @@ function! s:SelectBuffer(...) endif " Switch to the selected buffer. - execute "keepalt silent b!" _bufNbr + execute "keepjumps keepalt silent b!" _bufNbr endif " Make the buffer 'listed' again. @@ -957,12 +957,6 @@ function! s:RemoveBuffer(mode) let mode = a:mode - " Do not allow this buffer to be deleted if it is the last one. - if len(s:MRUList) == 1 - call s:Error("Sorry, you are not allowed to delete the last buffer") - return - endif - " These commands are to temporarily suspend the activity of winmanager. if exists("b:displayMode") && b:displayMode == "winmanager" call WinManagerSuspendAUs() diff --git a/sources_non_forked/gist-vim/README.md b/sources_non_forked/gist-vim/README.md index 95e3e234..e91463f1 100644 --- a/sources_non_forked/gist-vim/README.md +++ b/sources_non_forked/gist-vim/README.md @@ -266,6 +266,9 @@ Then gist-vim will ask for your password in order to create an access token. If you have two-factor authentication enabled, gist-vim will also prompt you to enter the two-factor key you receive. +NOTE: +If you want you can set it directly to `g:github_user` and `g:gist_token`. + Whichever type of authentication you use, your GitHub password will not be stored, only a OAuth access token produced specifically for gist-vim. The token is stored in `~/.gist-vim`. If you stop using the plugin, you can diff --git a/sources_non_forked/gist-vim/autoload/gist.vim b/sources_non_forked/gist-vim/autoload/gist.vim index 50d88427..afe797e7 100644 --- a/sources_non_forked/gist-vim/autoload/gist.vim +++ b/sources_non_forked/gist-vim/autoload/gist.vim @@ -961,7 +961,9 @@ function! s:GistGetAuthHeader() abort return printf('basic %s', webapi#base64#b64encode(g:github_user.':'.password)) endif let auth = '' - if filereadable(s:gist_token_file) + if !empty(get(g:, 'gist_token', $GITHUB_TOKEN)) + let auth = 'token ' . get(g:, 'gist_token', $GITHUB_TOKEN) + elseif filereadable(s:gist_token_file) let str = join(readfile(s:gist_token_file), '') if type(str) == 1 let auth = str diff --git a/sources_non_forked/lightline-ale/README.md b/sources_non_forked/lightline-ale/README.md index a2e345b0..ebfbc7e6 100644 --- a/sources_non_forked/lightline-ale/README.md +++ b/sources_non_forked/lightline-ale/README.md @@ -30,6 +30,7 @@ let g:lightline = {} let g:lightline.component_expand = { \ 'linter_checking': 'lightline#ale#checking', + \ 'linter_infos': 'lightline#ale#infos', \ 'linter_warnings': 'lightline#ale#warnings', \ 'linter_errors': 'lightline#ale#errors', \ 'linter_ok': 'lightline#ale#ok', @@ -40,17 +41,18 @@ let g:lightline.component_expand = { ```viml let g:lightline.component_type = { - \ 'linter_checking': 'left', + \ 'linter_checking': 'right', + \ 'linter_infos': 'right', \ 'linter_warnings': 'warning', \ 'linter_errors': 'error', - \ 'linter_ok': 'left', + \ 'linter_ok': 'right', \ } ``` 3. Add the components to the lightline, for example to the right side: ```viml -let g:lightline.active = { 'right': [[ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_ok' ]] } +let g:lightline.active = { 'right': [[ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_ok' ]] } ``` ## Configuration @@ -59,6 +61,10 @@ let g:lightline.active = { 'right': [[ 'linter_checking', 'linter_errors', 'lint The indicator to use when ALE is in progress. Default is `Linting...`. +##### `g:lightline#ale#indicator_infos` + +The indicator to use when there are infos. Default is `I:`. + ##### `g:lightline#ale#indicator_warnings` The indicator to use when there are warnings. Default is `W:`. @@ -78,6 +84,7 @@ If you would like to replace the default indicators with symbols like on the scr The following icons from the Font Awesome font are used in the screenshot: * Checking: [f110](https://fontawesome.com/icons/spinner) +* Infos: [f129](https://fontawesome.com/icons/info) * Warnings: [f071](https://fontawesome.com/icons/exclamation-triangle) * Errors: [f05e](https://fontawesome.com/icons/ban) * OK: [f00c](https://fontawesome.com/icons/check) (although I prefer to disable this component) @@ -93,6 +100,7 @@ Here's the configuration snippet used in the screenshot: ```viml let g:lightline#ale#indicator_checking = "\uf110" +let g:lightline#ale#indicator_infos = "\uf129" let g:lightline#ale#indicator_warnings = "\uf071" let g:lightline#ale#indicator_errors = "\uf05e" let g:lightline#ale#indicator_ok = "\uf00c" diff --git a/sources_non_forked/lightline-ale/autoload/lightline/ale.vim b/sources_non_forked/lightline-ale/autoload/lightline/ale.vim index 06aa90c1..0b34f7bc 100644 --- a/sources_non_forked/lightline-ale/autoload/lightline/ale.vim +++ b/sources_non_forked/lightline-ale/autoload/lightline/ale.vim @@ -1,3 +1,4 @@ +let s:indicator_infos = get(g:, 'lightline#ale#indicator_infos', 'I: ') let s:indicator_warnings = get(g:, 'lightline#ale#indicator_warnings', 'W: ') let s:indicator_errors = get(g:, 'lightline#ale#indicator_errors', 'E: ') let s:indicator_ok = get(g:, 'lightline#ale#indicator_ok', 'OK') @@ -7,14 +8,21 @@ let s:indicator_checking = get(g:, 'lightline#ale#indicator_checking', 'Linting. """""""""""""""""""""" " Lightline components +function! lightline#ale#infos() abort + if !lightline#ale#linted() + return '' + endif + let l:counts = ale#statusline#Count(bufnr('')) + return l:counts.info == 0 ? '' : printf(s:indicator_infos . '%d', l:counts.info) +endfunction + function! lightline#ale#warnings() abort if !lightline#ale#linted() return '' endif let l:counts = ale#statusline#Count(bufnr('')) - let l:all_errors = l:counts.error + l:counts.style_error - let l:all_non_errors = l:counts.total - l:all_errors - return l:all_non_errors == 0 ? '' : printf(s:indicator_warnings . '%d', all_non_errors) + let l:all_warnings = l:counts.warning + l:counts.style_warning + return l:all_warnings == 0 ? '' : printf(s:indicator_warnings . '%d', all_warnings) endfunction function! lightline#ale#errors() abort diff --git a/sources_non_forked/lightline.vim/LICENSE b/sources_non_forked/lightline.vim/LICENSE index 56144fc6..ee9e0c80 100644 --- a/sources_non_forked/lightline.vim/LICENSE +++ b/sources_non_forked/lightline.vim/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2013-2019 itchyny +Copyright (c) 2013-2020 itchyny Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sources_non_forked/lightline.vim/README.md b/sources_non_forked/lightline.vim/README.md index f4061bd5..bb116378 100644 --- a/sources_non_forked/lightline.vim/README.md +++ b/sources_non_forked/lightline.vim/README.md @@ -246,7 +246,7 @@ let g:lightline = { \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ] \ }, \ 'component_function': { - \ 'gitbranch': 'fugitive#head' + \ 'gitbranch': 'FugitiveHead' \ }, \ } ``` diff --git a/sources_non_forked/lightline.vim/autoload/lightline.vim b/sources_non_forked/lightline.vim/autoload/lightline.vim index 127622c0..07800f42 100644 --- a/sources_non_forked/lightline.vim/autoload/lightline.vim +++ b/sources_non_forked/lightline.vim/autoload/lightline.vim @@ -2,7 +2,7 @@ " Filename: autoload/lightline.vim " Author: itchyny " License: MIT License -" Last Change: 2019/08/20 14:00:00. +" Last Change: 2020/01/27 19:41:58. " ============================================================================= let s:save_cpo = &cpo @@ -432,7 +432,7 @@ function! s:line(tabline, inactive) abort let _ .= i < l + len(lt) - len(l_) && ll[i] < l || ll[i] != ll[i + 1] ? p.left : len(lt[i]) ? s.left : '' endfor let _ .= '%#LightlineMiddle_' . mode . '#%=' - for i in reverse(range(len(rt))) + for i in range(len(rt) - 1, 0, -1) let _ .= '%#LightlineRight_' . mode . '_' . rl[i] . '_' . rl[i + 1] . '#' let _ .= i < r + len(rt) - len(r_) && rl[i] < r || rl[i] != rl[i + 1] ? p.right : len(rt[i]) ? s.right : '' let _ .= '%#LightlineRight_' . mode . '_' . rl[i] . '#' diff --git a/sources_non_forked/lightline.vim/doc/lightline.txt b/sources_non_forked/lightline.vim/doc/lightline.txt index 5bb51eee..c94b63d0 100644 --- a/sources_non_forked/lightline.vim/doc/lightline.txt +++ b/sources_non_forked/lightline.vim/doc/lightline.txt @@ -4,7 +4,7 @@ Version: 0.1 Author: itchyny (https://github.com/itchyny) License: MIT License Repository: https://github.com/itchyny/lightline.vim -Last Change: 2019/12/27 18:23:29. +Last Change: 2020/01/28 18:40:21. CONTENTS *lightline-contents* @@ -148,7 +148,7 @@ OPTIONS *lightline-option* \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ] \ }, \ 'component_function': { - \ 'gitbranch': 'fugitive#head' + \ 'gitbranch': 'FugitiveHead' \ }, \ } < @@ -316,8 +316,8 @@ nice. return &readonly ? '' : '' endfunction function! LightlineFugitive() - if exists('*fugitive#head') - let branch = fugitive#head() + if exists('*FugitiveHead') + let branch = FugitiveHead() return branch !=# '' ? ''.branch : '' endif return '' @@ -341,8 +341,8 @@ look nice. return &readonly ? '⭤' : '' endfunction function! LightlineFugitive() - if exists('*fugitive#head') - let branch = fugitive#head() + if exists('*FugitiveHead') + let branch = FugitiveHead() return branch !=# '' ? '⭠ '.branch : '' endif return '' @@ -742,8 +742,8 @@ A nice example for non-patched font users. \ (LightlineModified() !=# '' ? ' ' . LightlineModified() : '') endfunction function! LightlineFugitive() - if &ft !~? 'vimfiler' && exists('*fugitive#head') - return fugitive#head() + if &ft !~? 'vimfiler' && exists('*FugitiveHead') + return FugitiveHead() endif return '' endfunction @@ -777,8 +777,8 @@ A nice example for |vim-powerline| font users: \ (LightlineModified() !=# '' ? ' ' . LightlineModified() : '') endfunction function! LightlineFugitive() - if &ft !~? 'vimfiler' && exists('*fugitive#head') - let branch = fugitive#head() + if &ft !~? 'vimfiler' && exists('*FugitiveHead') + let branch = FugitiveHead() return branch !=# '' ? '⭠ '.branch : '' endif return '' @@ -836,9 +836,9 @@ For users who uses lots of plugins: function! LightlineFugitive() try - if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*fugitive#head') + if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*FugitiveHead') let mark = '' " edit here for cool mark - let branch = fugitive#head() + let branch = FugitiveHead() return branch !=# '' ? mark.branch : '' endif catch diff --git a/sources_non_forked/nerdtree/CHANGELOG.md b/sources_non_forked/nerdtree/CHANGELOG.md index c8989ef3..e163c6c9 100644 --- a/sources_non_forked/nerdtree/CHANGELOG.md +++ b/sources_non_forked/nerdtree/CHANGELOG.md @@ -7,7 +7,12 @@ in an unordered list. The format is: - **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR) --> +#### 6.5 +- **.0**: `NERDTreeToggle ` always sets NERDTree root. (PhilRunninger) [#1083](https://github.com/preservim/nerdtree/pull/1083) #### 6.4 +- **.6**: NERDTreeFind shows expected message if file doesn't exist e.g. with vim-startify (andys8). [#1081](https://github.com/preservim/nerdtree/pull/1081) +- **.5**: Ensure events are (or aren't) being ignored correctly. (PhilRunninger) [#1080](https://github.com/preservim/nerdtree/pull/1080) +- **.4**: Prevent overwriting existing files/dirs on node move. (PhilRunninger) [#1079](https://github.com/preservim/nerdtree/pull/1079) - **.3**: Fix regex that finds keyword for minimal menu. (PhilRunninger) [#1075](https://github.com/preservim/nerdtree/pull/1075) - **.2**: Lint vimscript, fix errors and warnings, add CI job to review PRs (Caleb Maclennan) [#1071](https://github.com/preservim/nerdtree/pull/1071) - **.1**: Ensure backward compatibility. v:t_func is not available before Vim 8.0 (Phil Runninger) diff --git a/sources_non_forked/nerdtree/autoload/nerdtree.vim b/sources_non_forked/nerdtree/autoload/nerdtree.vim index 5c9af895..156b2602 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree.vim @@ -169,8 +169,11 @@ function! nerdtree#exec(cmd, ignoreAll) abort if a:ignoreAll set eventignore=all endif - exec a:cmd - let &eventignore = old_ei + try + exec a:cmd + finally + let &eventignore = old_ei + endtry endfunction " FUNCTION: nerdtree#has_opt(options, name) {{{2 diff --git a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim index 400e52dc..57af126b 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim @@ -284,15 +284,16 @@ endfunction " FUNCTION: s:findAndRevealPath(pathStr) {{{1 function! s:findAndRevealPath(pathStr) abort let l:pathStr = !empty(a:pathStr) ? a:pathStr : expand('%:p') - if !filereadable(l:pathStr) - let l:pathStr = fnamemodify(l:pathStr, ':h') - endif if empty(l:pathStr) call nerdtree#echoWarning('no file for the current buffer') return endif + if !filereadable(l:pathStr) + let l:pathStr = fnamemodify(l:pathStr, ':h') + endif + try let l:pathStr = g:NERDTreePath.Resolve(l:pathStr) let l:pathObj = g:NERDTreePath.New(l:pathStr) diff --git a/sources_non_forked/nerdtree/doc/NERDTree.txt b/sources_non_forked/nerdtree/doc/NERDTree.txt index 857e6823..e2dd56a3 100644 --- a/sources_non_forked/nerdtree/doc/NERDTree.txt +++ b/sources_non_forked/nerdtree/doc/NERDTree.txt @@ -122,8 +122,9 @@ The following features and functionality are provided by the NERDTree: :NERDTreeToggle [ | ] *:NERDTreeToggle* If a NERDTree already exists for this tab, it is reopened and rendered - again. If no NERDTree exists for this tab then this command acts the - same as the |:NERDTree| command. + again. If or is given, the root of NERDTree + is set to that path. If no NERDTree exists for this tab then this command + acts the same as the |:NERDTree| command. :NERDTreeToggleVCS [ | ] *:NERDTreeToggleVCS* Like |:NERDTreeToggle|, but searches up the directory tree to find the top of diff --git a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim index 39e3f554..e2b3fa0a 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim @@ -333,14 +333,17 @@ function! s:Creator._tabpagevar(tabnr, var) let old_ei = &eventignore set eventignore=all - exec 'tabnext ' . a:tabnr - let v = -1 - if exists('t:' . a:var) - exec 'let v = t:' . a:var - endif - exec 'tabnext ' . currentTab + try + exec 'tabnext ' . a:tabnr + let v = -1 + if exists('t:' . a:var) + exec 'let v = t:' . a:var + endif + exec 'tabnext ' . currentTab - let &eventignore = old_ei + finally + let &eventignore = old_ei + endtry return v endfunction @@ -352,17 +355,20 @@ function! s:Creator.ToggleTabTree(dir) endfunction " FUNCTION: s:Creator.toggleTabTree(dir) {{{1 -" Toggles the NERD tree. I.e the NERD tree is open, it is closed, if it is -" closed it is restored or initialized (if it doesnt exist) +" Toggles the NERD tree. I.e if the NERD tree is open, it is closed. If it is +" closed, it is restored or initialized. If dir is not empty, it will be set +" as the new root. " " Args: -" dir: the full path for the root node (is only used if the NERD tree is being -" initialized. +" dir: the full path for the root node (is used if the NERD tree is being +" initialized, or to change the root to a new dir.) function! s:Creator.toggleTabTree(dir) if g:NERDTree.ExistsForTab() if !g:NERDTree.IsOpen() call self._createTreeWin() - if !&hidden + if !empty(a:dir) + call self.createTabTree(a:dir) + elseif !&hidden call b:NERDTree.render() endif call b:NERDTree.ui.restoreScreenState() diff --git a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim index 3ecfa816..281116fd 100644 --- a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim +++ b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim @@ -141,12 +141,12 @@ function! s:renameBuffer(bufNum, newNodeName, isDirectory) let editStr = g:NERDTreePath.New(a:newNodeName).str({'format': 'Edit'}) endif " 1. ensure that a new buffer is loaded - call nerdtree#exec('badd ' . quotedFileName, 1) + call nerdtree#exec('badd ' . quotedFileName, 0) " 2. ensure that all windows which display the just deleted filename " display a buffer for a new filename. let s:originalTabNumber = tabpagenr() let s:originalWindowNumber = winnr() - call nerdtree#exec('tabdo windo if winbufnr(0) ==# ' . a:bufNum . " | exec ':e! " . editStr . "' | endif", 1) + call nerdtree#exec('tabdo windo if winbufnr(0) ==# ' . a:bufNum . " | exec ':e! " . editStr . "' | endif", 0) call nerdtree#exec('tabnext ' . s:originalTabNumber, 1) call nerdtree#exec(s:originalWindowNumber . 'wincmd w', 1) " 3. We don't need a previous buffer anymore @@ -196,6 +196,11 @@ function! NERDTreeMoveNode() let curNode = g:NERDTreeFileNode.GetSelected() let prompt = s:inputPrompt('move') let newNodePath = input(prompt, curNode.path.str(), 'file') + while filereadable(newNodePath) + call nerdtree#echoWarning('This destination already exists. Try again.') + let newNodePath = input(prompt, curNode.path.str(), 'file') + endwhile + if newNodePath ==# '' call nerdtree#echo('Node Renaming Aborted.') diff --git a/sources_non_forked/nginx.vim/README.md b/sources_non_forked/nginx.vim/README.md index 58eceefa..669159ad 100644 --- a/sources_non_forked/nginx.vim/README.md +++ b/sources_non_forked/nginx.vim/README.md @@ -51,22 +51,27 @@ For help with secure cipher selection, visit [Mozillas SSL Configuration Generat ## Installation -### Pathogen +Install using any vim plugin manager. If you're not familiar with any, go with Plug ([``vim-plug``](https://github.com/junegunn/vim-plug)). +Then install this plugin using the your vim's plugin manager as follows: -```bash -git clone https://github.com/chr4/nginx.vim ~/.vim/bundle/nginx.vim +### Plug +``` +Plug 'chr4/nginx.vim' ``` -### Other (Plug, Dein.vim, Vundle) -```vim -" Plug -Plug 'chr4/nginx.vim' - -" Dein.vim +### Dein.vim +``` call dein#add('chr4/nginx.vim') +``` -" Vundle +### Vundle +``` Plugin 'chr4/nginx.vim' ``` +### Pathogen +``` +git clone https://github.com/chr4/nginx.vim ~/.vim/bundle/nginx.vim +``` + Optionally, if you like [Jinja](http://jinja.pocoo.org/) template syntax highlighting, install `lepture/vim-jinja`, too. diff --git a/sources_non_forked/rust.vim/autoload/cargo.vim b/sources_non_forked/rust.vim/autoload/cargo.vim index 01ab2ccc..b84f62a8 100644 --- a/sources_non_forked/rust.vim/autoload/cargo.vim +++ b/sources_non_forked/rust.vim/autoload/cargo.vim @@ -65,6 +65,10 @@ function! cargo#build(args) call cargo#cmd("build " . a:args) endfunction +function! cargo#check(args) + call cargo#cmd("check " . a:args) +endfunction + function! cargo#clean(args) call cargo#cmd("clean " . a:args) endfunction diff --git a/sources_non_forked/rust.vim/autoload/rustfmt.vim b/sources_non_forked/rust.vim/autoload/rustfmt.vim index 7fd9b43c..4a5f86cc 100644 --- a/sources_non_forked/rust.vim/autoload/rustfmt.vim +++ b/sources_non_forked/rust.vim/autoload/rustfmt.vim @@ -60,18 +60,19 @@ function! s:RustfmtWriteMode() endif endfunction -function! s:RustfmtConfig() +function! s:RustfmtConfigOptions() let l:rustfmt_toml = findfile('rustfmt.toml', expand('%:p:h') . ';') if l:rustfmt_toml !=# '' - return '--config-path '.l:rustfmt_toml + return '--config-path '.fnamemodify(l:rustfmt_toml, ":p") endif let l:_rustfmt_toml = findfile('.rustfmt.toml', expand('%:p:h') . ';') if l:_rustfmt_toml !=# '' - return '--config-path '.l:_rustfmt_toml + return '--config-path '.fnamemodify(l:_rustfmt_toml, ":p") endif - return '' + " Default to edition 2018 in case no rustfmt.toml was found. + return '--edition 2018' endfunction function! s:RustfmtCommandRange(filename, line1, line2) @@ -82,7 +83,7 @@ function! s:RustfmtCommandRange(filename, line1, line2) let l:arg = {"file": shellescape(a:filename), "range": [a:line1, a:line2]} let l:write_mode = s:RustfmtWriteMode() - let l:rustfmt_config = s:RustfmtConfig() + let l:rustfmt_config = s:RustfmtConfigOptions() " FIXME: When --file-lines gets to be stable, add version range checking " accordingly. @@ -96,14 +97,9 @@ function! s:RustfmtCommandRange(filename, line1, line2) endfunction function! s:RustfmtCommand() - if g:rustfmt_emit_files - let l:write_mode = "--emit=stdout" - else - let l:write_mode = "--write-mode=display" - endif - " rustfmt will pick on the right config on its own due to the - " current directory change. - return g:rustfmt_command . " ". l:write_mode . " " . g:rustfmt_options + let write_mode = g:rustfmt_emit_files ? '--emit=stdout' : '--write-mode=display' + let config = s:RustfmtConfigOptions() + return join([g:rustfmt_command, write_mode, config, g:rustfmt_options]) endfunction function! s:DeleteLines(start, end) abort diff --git a/sources_non_forked/rust.vim/plugin/cargo.vim b/sources_non_forked/rust.vim/plugin/cargo.vim index 5cd413cc..efc38768 100644 --- a/sources_non_forked/rust.vim/plugin/cargo.vim +++ b/sources_non_forked/rust.vim/plugin/cargo.vim @@ -7,6 +7,7 @@ set cpoptions&vim command! -nargs=+ Cargo call cargo#cmd() command! -nargs=* Cbuild call cargo#build() +command! -nargs=* Ccheck call cargo#check() command! -nargs=* Cclean call cargo#clean() command! -nargs=* Cdoc call cargo#doc() command! -nargs=+ Cnew call cargo#new() diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index fbd90e17..2823ec13 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -42,7 +42,7 @@ function! s:Uniq(list) abort endfunction function! s:winshell() abort - return has('win32') && &shellcmdflag =~# '^/\|^-Command$' + return has('win32') && &shellcmdflag !~# '^-' endfunction function! s:shellesc(arg) abort @@ -138,6 +138,19 @@ function! s:executable(binary) abort return s:executables[a:binary] endfunction +if !exists('s:temp_scripts') + let s:temp_scripts = {} +endif +function! s:TempScript(...) abort + let body = join(a:000, "\n") + if !has_key(s:temp_scripts, body) + let temp = tempname() . '.sh' + call writefile(['#!/bin/sh'] + a:000, temp) + let s:temp_scripts[body] = temp + endif + return FugitiveGitPath(s:temp_scripts[body]) +endfunction + function! s:DoAutocmd(cmd) abort if v:version >= 704 || (v:version == 703 && has('patch442')) return 'doautocmd ' . a:cmd @@ -244,6 +257,25 @@ function! s:QuickfixStream(nr, event, title, cmd, first, callback, ...) abort endif endfunction +let s:common_efm = '' + \ . '%+Egit:%.%#,' + \ . '%+Eusage:%.%#,' + \ . '%+Eerror:%.%#,' + \ . '%+Efatal:%.%#,' + \ . '%-G%.%#%\e[K%.%#,' + \ . '%-G%.%#%\r%.%\+' + +function! fugitive#Cwindow() abort + if &buftype == 'quickfix' + cwindow + else + botright cwindow + if &buftype == 'quickfix' + wincmd p + endif + endif +endfunction + " Section: Git function! s:UserCommandList(...) abort @@ -414,17 +446,24 @@ function! fugitive#PrepareDirEnvArgv(...) abort return [dir, env, cmd] endfunction +function! s:BuildEnvPrefix(env) abort + let pre = '' + let env = items(a:env) + if empty(env) + return '' + elseif &shellcmdflag =~# '-Command' + return join(map(env, '"$Env:" . v:val[0] . " = ''" . substitute(v:val[1], "''", "''''", "g") . "''; "'), '') + elseif s:winshell() + return join(map(env, '"set " . substitute(join(v:val, "="), "[&|<>^]", "^^^&", "g") . "& "'), '') + else + return 'env ' . s:shellesc(map(env, 'join(v:val, "=")')) . ' ' + endif +endfunction + function! s:BuildShell(dir, env, args) abort let cmd = copy(a:args) let tree = s:Tree(a:dir) - let pre = '' - for [var, val] in items(a:env) - if s:winshell() - let pre .= 'set ' . var . '=' . s:shellesc(val) . '& ' - else - let pre = (len(pre) ? pre : 'env ') . var . '=' . s:shellesc(val) . ' ' - endif - endfor + let pre = s:BuildEnvPrefix(a:env) if empty(tree) || index(cmd, '--') == len(cmd) - 1 call insert(cmd, '--git-dir=' . FugitiveGitPath(a:dir)) elseif fugitive#GitVersion(1, 8, 5) @@ -1260,17 +1299,16 @@ function! fugitive#setfperm(url, perm) abort endfunction function! s:TempCmd(out, cmd) abort - let prefix = '' try let cmd = (type(a:cmd) == type([]) ? fugitive#Prepare(a:cmd) : a:cmd) let redir = ' > ' . a:out - if s:winshell() + if (s:winshell() || &shellcmdflag ==# '-Command') && !has('nvim') let cmd_escape_char = &shellxquote == '(' ? '^' : '^^^' - return s:SystemError('cmd /c "' . prefix . s:gsub(cmd, '[<>]', cmd_escape_char . '&') . redir . '"') + return s:SystemError('cmd /c "' . s:gsub(cmd, '[<>%]', cmd_escape_char . '&') . redir . '"') elseif &shell =~# 'fish' - return s:SystemError(' begin;' . prefix . cmd . redir . ';end ') + return s:SystemError(' begin;' . cmd . redir . ';end ') else - return s:SystemError(' (' . prefix . cmd . redir . ') ') + return s:SystemError(' (' . cmd . redir . ') ') endif endtry endfunction @@ -1555,28 +1593,16 @@ function! s:ReplaceCmd(cmd) abort if exec_error call s:throw((len(err) ? err : filereadable(temp) ? join(readfile(temp), ' ') : 'unknown error running ' . a:cmd)) endif - let temp = s:Resolve(temp) - let fn = expand('%:p') - silent exe 'keepalt file '.temp - let modelines = &modelines - try - set modelines=0 - silent keepjumps noautocmd edit! - finally - let &modelines = modelines - try - silent exe 'keepalt file '.s:fnameescape(fn) - catch /^Vim\%((\a\+)\)\=:E302:/ - endtry - call delete(temp) - if s:cpath(fnamemodify(bufname('$'), ':p'), temp) - silent! execute 'bwipeout '.bufnr('$') - endif - endtry + silent exe 'lockmarks keepalt 0read ++edit' s:fnameescape(temp) + silent keepjumps $delete _ + call delete(temp) + if s:cpath(fnamemodify(bufname('$'), ':p'), temp) + silent! execute bufnr('$') . 'bwipeout' + endif endfunction function! s:QueryLog(refspec) abort - let lines = s:LinesError(['log', '-n', '256', '--format=%h%x09%s', a:refspec, '--'])[0] + let lines = s:LinesError(['log', '-n', '256', '--pretty=format:%h%x09%s', a:refspec, '--'])[0] call map(lines, 'split(v:val, "\t")') call map(lines, '{"type": "Log", "commit": v:val[0], "subject": v:val[-1]}') return lines @@ -1626,12 +1652,28 @@ function! s:AddSection(label, lines, ...) abort call append(line('$'), ['', a:label . (len(note) ? ': ' . note : ' (' . len(a:lines) . ')')] + s:Format(a:lines)) endfunction +let s:rebase_abbrevs = { + \ 'p': 'pick', + \ 'r': 'reword', + \ 'e': 'edit', + \ 's': 'squash', + \ 'f': 'fixup', + \ 'x': 'exec', + \ 'd': 'drop', + \ 'l': 'label', + \ 't': 'reset', + \ 'm': 'merge', + \ 'b': 'break', + \ } + function! fugitive#BufReadStatus() abort let amatch = s:Slash(expand('%:p')) let b:fugitive_type = 'index' unlet! b:fugitive_reltime try silent doautocmd BufReadPre + let config = fugitive#Config() + let cmd = [fnamemodify(amatch, ':h')] setlocal noro ma nomodeline buftype=nowrite if s:cpath(fnamemodify($GIT_INDEX_FILE !=# '' ? $GIT_INDEX_FILE : fugitive#Find('.git/index'), ':p')) !=# s:cpath(amatch) @@ -1746,15 +1788,13 @@ function! fugitive#BufReadStatus() abort let b:fugitive_files['Unstaged'][dict.filename] = dict endfor - let config = fugitive#Config() - let pull_type = 'Pull' if len(pull) let rebase = fugitive#Config('branch.' . branch . '.rebase', config) if empty(rebase) let rebase = fugitive#Config('pull.rebase', config) endif - if rebase =~# '^\%(true\|yes\|on\|1\|interactive\)$' + if rebase =~# '^\%(true\|yes\|on\|1\|interactive\|merges\|preserve\)$' let pull_type = 'Rebase' elseif rebase =~# '^\%(false\|no|off\|0\|\)$' let pull_type = 'Merge' @@ -1765,20 +1805,22 @@ function! fugitive#BufReadStatus() abort if empty(push_remote) let push_remote = fugitive#Config('remote.pushDefault', config) endif - let push = len(push_remote) && len(branch) ? push_remote . '/' . branch : '' - if empty(push) - let push = pull + let fetch_remote = fugitive#Config('branch.' . branch . '.remote', config) + if empty(fetch_remote) + let fetch_remote = 'origin' + endif + if empty(push_remote) + let push_remote = fetch_remote endif - if len(pull) && get(props, 'branch.ab') !~# ' -0$' - let unpulled = s:QueryLog(head . '..' . pull) - else - let unpulled = [] + let push_default = fugitive#Config('push.default') + if empty(push_default) + let push_default = fugitive#GitVersion(2) ? 'simple' : 'matching' endif - if len(push) && !(push ==# pull && get(props, 'branch.ab') =~# '^+0 ') - let unpushed = s:QueryLog(push . '..' . head) + if push_default ==# 'upstream' + let push = pull else - let unpushed = [] + let push = len(branch) ? (push_remote ==# '.' ? '' : push_remote . '/') . branch : '' endif if isdirectory(fugitive#Find('.git/rebase-merge/')) @@ -1844,8 +1886,19 @@ function! fugitive#BufReadStatus() abort let unstaged_end = len(unstaged) ? line('$') : 0 call s:AddSection('Staged', staged) let staged_end = len(staged) ? line('$') : 0 - call s:AddSection('Unpushed to ' . push, unpushed) - call s:AddSection('Unpulled from ' . pull, unpulled) + + if len(pull) && get(props, 'branch.ab') !~# ' -0$' + call s:AddSection('Unpulled from ' . pull, s:QueryLog(head . '..' . pull)) + endif + if len(push) && push !=# pull + call s:AddSection('Unpulled from ' . push, s:QueryLog(head . '..' . push)) + endif + if len(pull) && push !=# pull + call s:AddSection('Unpushed to ' . pull, s:QueryLog(pull . '..' . head)) + endif + if len(push) && !(push ==# pull && get(props, 'branch.ab') =~# '^+0 ') + call s:AddSection('Unpushed to ' . push, s:QueryLog(push . '..' . head)) + endif setlocal nomodified readonly noswapfile silent doautocmd BufReadPost @@ -1916,7 +1969,7 @@ function! fugitive#BufReadStatus() abort endfor let b:fugitive_reltime = reltime() - return '' + return 'silent ' . s:DoAutocmd('User FugitiveIndex') catch /^fugitive:/ return 'echoerr ' . string(v:exception) endtry @@ -2019,7 +2072,7 @@ function! fugitive#BufReadCmd(...) abort setlocal endofline try - silent doautocmd BufReadPre + silent exe s:DoAutocmd('BufReadPre') if b:fugitive_type ==# 'tree' let b:fugitive_display_format = b:fugitive_display_format % 2 if b:fugitive_display_format @@ -2043,6 +2096,7 @@ function! fugitive#BufReadCmd(...) abort call s:ReplaceCmd([dir, 'cat-file', b:fugitive_type, rev]) else call s:ReplaceCmd([dir, 'show', '--no-color', '-m', '--first-parent', '--pretty=format:tree%x20%T%nparent%x20%P%nauthor%x20%an%x20<%ae>%x20%ad%ncommitter%x20%cn%x20<%ce>%x20%cd%nencoding%x20%e%n%n%s%n%n%b', rev]) + keepjumps 1 keepjumps call search('^parent ') if getline('.') ==# 'parent ' silent keepjumps delete_ @@ -2079,8 +2133,16 @@ function! fugitive#BufReadCmd(...) abort endtry setlocal modifiable + + let browsex = maparg('NetrwBrowseX', 'n') + let remote_check = '\Cnetrw#CheckIfRemote(\%(netrw#GX()\)\=)' + if browsex =~# remote_check + exe 'nnoremap NetrwBrowseX' substitute(browsex, remote_check, '0', 'g') + endif + return 'silent ' . s:DoAutocmd('BufReadPost') . - \ (modifiable ? '' : '|setl nomodifiable') + \ (modifiable ? '' : '|setl nomodifiable') . '|silent ' . + \ s:DoAutocmd('User Fugitive' . substitute(b:fugitive_type, '^\l', '\u&', '')) catch /^fugitive:/ return 'echoerr ' . string(v:exception) endtry @@ -2119,9 +2181,7 @@ function! s:TempReadPre(file) abort setlocal nomodeline setlocal bufhidden=delete nobuflisted setlocal buftype=nowrite - if has_key(dict, 'modifiable') - let &l:modifiable = dict.modifiable - endif + setlocal nomodifiable if len(dict.dir) let b:git_dir = dict.dir call extend(b:, {'fugitive_type': 'temp'}, 'keep') @@ -2154,6 +2214,124 @@ augroup END " Section: :Git +function! s:RunJobs() abort + return exists('*job_start') || exists('*jobstart') +endfunction + +function! s:RunReceive(state, job, data, ...) abort + call add(a:state.log, a:data) + let data = type(a:data) == type([]) ? join(a:data, "\n") : a:data + if has_key(a:state, 'buffer') + let data = remove(a:state, 'buffer') . data + endif + let escape = "\033]51;[^\007]*" + let a:state.buffer = matchstr(data, escape . "$\\|[\r\n]\\+$") + if len(a:state.buffer) + let data = strpart(data, 0, len(data) - len(a:state.buffer)) + endif + let cmd = matchstr(data, escape . "\007")[5:-2] + let data = substitute(data, escape . "\007", '', 'g') + echon substitute(data, "\r\\ze\n", '', 'g') + if cmd =~# '^fugitive:' + let a:state.request = strpart(cmd, 9) + endif +endfunction + +function! s:RunSend(job, str) abort + try + if type(a:job) == type(0) + call chansend(a:job, a:str) + else + call ch_sendraw(a:job, a:str) + endif + return len(a:str) + catch /^Vim\%((\a\+)\)\=:E90[06]:/ + return 0 + endtry +endfunction + +if !exists('s:edit_jobs') + let s:edit_jobs = {} +endif +function! s:RunWait(state, job) abort + let finished = 0 + try + while get(a:state, 'request', '') !=# 'edit' && (type(a:job) == type(0) ? jobwait([a:job], 1)[0] == -1 : ch_status(a:job) !=# 'closed') + if !exists('*jobwait') + sleep 1m + endif + let peek = getchar(1) + if peek != 0 && !(has('win32') && peek == 128) + let c = getchar() + let c = type(c) == type(0) ? nr2char(c) : c + call s:RunSend(a:job, c) + if !a:state.pty + echon c + endif + endif + endwhile + sleep 1m + echo + if get(a:state, 'request', '') == 'edit' + call remove(a:state, 'request') + let file = readfile(a:state.temp . '.edit')[0] + exe substitute(a:state.mods, '\', '-tab', 'g') 'keepalt split' s:fnameescape(file) + set bufhidden=wipe + let s:edit_jobs[bufnr('')] = [a:state, a:job] + endif + let finished = 1 + finally + if !finished + try + if a:state.pty + call s:RunSend(a:job, "\") + elseif type(a:job) == type(0) + call jobstop(a:job) + else + call job_stop(a:job) + endif + catch /.*/ + endtry + endif + endtry + call fugitive#ReloadStatus(a:state.dir, 1) + return '' +endfunction + +if !exists('s:resume_queue') + let s:resume_queue = [] +endif +function! fugitive#Resume() abort + while len(s:resume_queue) + let [state, job] = remove(s:resume_queue, 0) + call s:RunWait(state, job) + endwhile +endfunction + +function! s:RunBufDelete(bufnr) abort + if has_key(s:edit_jobs, a:bufnr) | + if filereadable(s:edit_jobs[a:bufnr][0].temp . '.edit') + call delete(s:edit_jobs[a:bufnr][0].temp . '.edit') + endif + call add(s:resume_queue, remove(s:edit_jobs, a:bufnr)) + call feedkeys(":redraw!|call fugitive#Resume()|silent checktime\r", 'n') + endif +endfunction + +augroup fugitive_job + autocmd! + autocmd BufDelete * call s:RunBufDelete(expand('')) + autocmd VimLeave * + \ for s:jobbuf in keys(s:edit_jobs) | + \ call writefile([], remove(s:edit_jobs, s:jobbuf)[0].temp . '.exit') | + \ endfor +augroup END + +let s:disable_colors = [] +for s:colortype in ['advice', 'branch', 'diff', 'grep', 'interactive', 'pager', 'push', 'remote', 'showBranch', 'status', 'transport', 'ui'] + call extend(s:disable_colors, ['-c', 'color.' . s:colortype . '=false']) +endfor +unlet s:colortype function! fugitive#Command(line1, line2, range, bang, mods, arg) abort let dir = s:Dir() let [args, after] = s:SplitExpandChain(a:arg, s:Tree(dir)) @@ -2171,22 +2349,27 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort if exists('*s:' . name . 'Subcommand') && get(args, 1, '') !=# '--help' try exe s:DirCheck(dir) - let result = s:{name}Subcommand(a:line1, a:line2, a:range, a:bang, a:mods, args[1:-1]) - if type(result) == type('') - return 'exe ' . string(result) . after + let opts = s:{name}Subcommand(a:line1, a:line2, a:range, a:bang, a:mods, args[1:-1]) + if type(opts) == type('') + return 'exe ' . string(opts) . after endif catch /^fugitive:/ return 'echoerr ' . string(v:exception) endtry + else + let opts = {} endif - if a:bang || args[0] =~# '^-P$\|^--no-pager$\|diff\%(tool\)\@!\|log\|^show$' || + let args = get(opts, 'args', args) + if a:bang || args[0] =~# '^-p$\|^--paginate$\|diff\%(tool\)\@!\|log\|^show$' || \ (args[0] ==# 'stash' && get(args, 1, '') ==# 'show') || \ (args[0] ==# 'help' || get(args, 1, '') ==# '--help') && !s:HasOpt(args, '--web') + if args[0] =~# '^-p$\|^--paginate$' + call remove(args, 0) + endif return s:OpenExec((a:line2 > 0 ? a:line2 : '') . (a:line2 ? 'split' : 'edit'), a:mods, args, dir) . after endif if s:HasOpt(args, ['add', 'checkout', 'commit', 'stage', 'stash', 'reset'], '-p', '--patch') || - \ s:HasOpt(args, ['add', 'clean', 'stage'], '-i', '--interactive') || - \ index(['--paginate', '-p'], args[0]) >= 0 + \ s:HasOpt(args, ['add', 'clean', 'stage'], '-i', '--interactive') let mods = substitute(s:Mods(a:mods), '\', '-tab', 'g') let assign = len(dir) ? '|let b:git_dir = ' . string(dir) : '' if has('nvim') @@ -2197,16 +2380,81 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort return 'exe ' . string(mods . 'terminal ' . (a:line2 ? '' : '++curwin ') . join(map(s:UserCommandList(dir) + args, 's:fnameescape(v:val)'))) . assign . after endif endif - if has('gui_running') && !has('win32') - call insert(args, '--no-pager') + let env = get(opts, 'env', {}) + if s:RunJobs() + let state = {'dir': dir, 'mods': s:Mods(a:mods), 'temp': tempname(), 'log': []} + let state.pty = get(g:, 'fugitive_pty', has('unix') && (has('patch-8.0.0744') || has('nvim'))) + if !state.pty + let args = s:AskPassArgs(dir) + args + endif + let env.FUGITIVE_TEMP = state.temp + let editor = 'sh ' . s:TempScript( + \ '[ -f "$FUGITIVE_TEMP.exit" ] && exit 1', + \ 'echo "$1" > "$FUGITIVE_TEMP.edit"', + \ 'printf "\033]51;fugitive:edit\007"', + \ 'while [ -f "$FUGITIVE_TEMP.edit" -a ! -f "$FUGITIVE_TEMP.exit" ]; do sleep 0.05 2>/dev/null || sleep 1; done', + \ 'exit 0') + call extend(env, { + \ 'NO_COLOR': '1', + \ 'GIT_EDITOR': editor, + \ 'GIT_SEQUENCE_EDITOR': editor, + \ 'GIT_MERGE_AUTOEDIT': '1', + \ 'GIT_PAGER': 'cat', + \ 'PAGER': 'cat'}, 'keep') + let args = ['-c', 'advice.waitingForEditor=false'] + s:disable_colors + args + let argv = s:UserCommandList(dir) + args + if !has('patch-8.0.0902') || has('nvim') + let envlist = map(items(env), 'join(v:val, "=")') + if s:executable('env') + let argv = ['env'] + envlist + argv + elseif has('win32') + let argv = ['cmd.exe', '/c', + \ join(map(envlist, { _, v -> 'set ' . substitute(v, '[&|<>^]', '^^^&', 'g') }) + + \ [s:shellesc(argv)], '& ')] + else + return 'echoerr ' . string('fugitive: "env" command missing') + endif + let env = {} + endif + let state.cmd = argv + let g:_fugitive_last_job = state + if &autowrite || &autowriteall | silent! wall | endif + if exists('*job_start') + let jobopts = { + \ 'mode': 'raw', + \ 'callback': function('s:RunReceive', [state]), + \ } + if state.pty + let jobopts.pty = 1 + endif + if len(env) + let jobopts.env = env + endif + let job = job_start(argv, jobopts) + else + let job = jobstart(argv, { + \ 'pty': state.pty, + \ 'env': env, + \ 'TERM': 'dumb', + \ 'on_stdout': function('s:RunReceive', [state]), + \ 'on_stderr': function('s:RunReceive', [state]), + \ }) + endif + let state.job = job + call s:RunWait(state, job) + return 'silent checktime' . after + else + if has('gui_running') && !has('win32') + call insert(args, '--no-pager') + endif + if has('nvim') + let env.GIT_TERMINAL_PROMPT = '0' + endif + let pre = s:BuildEnvPrefix(env) + return 'exe ' . string('noautocmd !' . escape(pre . s:UserCommand(dir, args), '!#%')) . + \ '|call fugitive#ReloadStatus(' . string(dir) . ', 1)' . + \ after endif - let pre = '' - if has('nvim') && executable('env') - let pre .= 'env GIT_TERMINAL_PROMPT=0 ' - endif - return 'exe ' . string('noautocmd !' . escape(pre . s:UserCommand(dir, args), '!#%')) . - \ '|call fugitive#ReloadStatus(' . string(dir) . ', 1)' . - \ after endfunction let s:exec_paths = {} @@ -3206,7 +3454,7 @@ function! s:DoStageUnpushedHeading(heading) abort let remote = '.' endif let branch = matchstr(a:heading, 'to \%([^/]\+/\)\=\zs\S\+') - call feedkeys(':Gpush ' . remote . ' ' . 'HEAD:' . branch) + call feedkeys(':Git push ' . remote . ' ' . 'HEAD:' . 'refs/heads/' . branch) endfunction function! s:DoToggleUnpushedHeading(heading) abort @@ -3219,7 +3467,7 @@ function! s:DoStageUnpushed(record) abort let remote = '.' endif let branch = matchstr(a:record.heading, 'to \%([^/]\+/\)\=\zs\S\+') - call feedkeys(':Gpush ' . remote . ' ' . a:record.commit . ':' . branch) + call feedkeys(':Git push ' . remote . ' ' . a:record.commit . ':' . 'refs/heads/' . branch) endfunction function! s:DoToggleUnpushed(record) abort @@ -3227,7 +3475,7 @@ function! s:DoToggleUnpushed(record) abort endfunction function! s:DoUnstageUnpulledHeading(heading) abort - call feedkeys(':Grebase') + call feedkeys(':Git rebase') endfunction function! s:DoToggleUnpulledHeading(heading) abort @@ -3235,7 +3483,7 @@ function! s:DoToggleUnpulledHeading(heading) abort endfunction function! s:DoUnstageUnpulled(record) abort - call feedkeys(':Grebase ' . a:record.commit) + call feedkeys(':Git rebase ' . a:record.commit) endfunction function! s:DoToggleUnpulled(record) abort @@ -3243,7 +3491,7 @@ function! s:DoToggleUnpulled(record) abort endfunction function! s:DoUnstageUnpushed(record) abort - call feedkeys(':Grebase --autosquash ' . a:record.commit . '^') + call feedkeys(':Git rebase --autosquash ' . a:record.commit . '^') endfunction function! s:DoToggleStagedHeading(...) abort @@ -3370,109 +3618,28 @@ function! s:CommitInteractive(line1, line2, range, bang, mods, args, patch) abor endif endfunction -function! s:CommitSubcommand(line1, line2, range, bang, mods, args, ...) abort - let mods = substitute(s:Mods(a:mods), '\C\', '-tab', 'g') - let dir = a:0 ? a:1 : s:Dir() - let tree = s:Tree(dir) - let msgfile = fugitive#Find('.git/COMMIT_EDITMSG', dir) - let outfile = tempname() - try - if s:winshell() - let command = 'set GIT_EDITOR=false& ' +function! s:CommitSubcommand(line1, line2, range, bang, mods, args) abort + let argv = copy(a:args) + let i = 0 + while get(argv, i, '--') !=# '--' + if argv[i] =~# '^-[apzsneiovq].' + call insert(argv, argv[i][0:1]) + let argv[i+1] = '-' . argv[i+1][2:-1] else - let command = 'env GIT_EDITOR=false ' + let i += 1 endif - let argv = a:args - let i = 0 - while get(argv, i, '--') !=# '--' - if argv[i] =~# '^-[apzsneiovq].' - call insert(argv, argv[i][0:1]) - let argv[i+1] = '-' . argv[i+1][2:-1] - else - let i += 1 - endif - endwhile - let command .= s:UserCommand(dir, ['commit'] + argv) - if (&autowrite || &autowriteall) && !a:0 - silent! wall - endif - if s:HasOpt(argv, '-i', '--interactive') - return s:CommitInteractive(a:line1, a:line2, a:range, a:bang, a:mods, argv, 0) - elseif s:HasOpt(argv, '-p', '--patch') - return s:CommitInteractive(a:line1, a:line2, a:range, a:bang, a:mods, argv, 1) - else - let [error_string, exec_error] = s:TempCmd(outfile, command) - let errors = split(error_string, "\n") - endif - if !has('gui_running') - redraw! - endif - if !exec_error - echo join(errors, "\n") - if filereadable(outfile) - echo join(readfile(outfile), "\n") - endif - call fugitive#ReloadStatus(dir, 1) - return '' - else - let error = get(errors,-2,get(errors,-1,'!')) - if error =~# 'false''\=\.$' - let i = 0 - while get(argv, i, '--') !=# '--' - if argv[i] =~# '^\%(-[eips]\|-[CcFm].\+\|--edit\|--interactive\|--patch\|--signoff\|--reedit-message=.*\|--reuse-message=.*\|--file=.*\|--message=.*\)$' - call remove(argv, i) - elseif argv[i] =~# '^\%(-[CcFm]\|--reedit-message\|--reuse-message\|--file\|--message\)$' - call remove(argv, i, i + 1) - else - if argv[i] =~# '^--cleanup\>' - let cleanup = 1 - endif - let i += 1 - endif - endwhile - call insert(argv, '--no-signoff', i) - call insert(argv, '--no-interactive', i) - call insert(argv, '--no-edit', i) - if !exists('cleanup') - call insert(argv, '--cleanup=strip') - endif - call extend(argv, ['-F', msgfile], 'keep') - if (bufname('%') == '' && line('$') == 1 && getline(1) == '' && !&modified) || a:line2 == 0 - execute mods . 'keepalt edit' s:fnameescape(msgfile) - elseif s:HasOpt(argv, '-v') || mods =~# '\' - execute mods . 'keepalt -tabedit' s:fnameescape(msgfile) - else - execute mods . 'keepalt split' s:fnameescape(msgfile) - endif - let b:fugitive_commit_arguments = argv - setlocal bufhidden=wipe filetype=gitcommit - return '1' - elseif empty(errors) - let out = readfile(outfile) - echo get(out, -1, '') =~# 'stash\|\d' ? get(out, -2, '') : get(out, -1, '') - return '' - else - echo join(errors, "\n") - return '' - endif - endif - catch /^fugitive:/ - return 'echoerr ' . string(v:exception) - finally - call delete(outfile) - endtry + endwhile + if s:HasOpt(argv, '-i', '--interactive') + return s:CommitInteractive(a:line1, a:line2, a:range, a:bang, a:mods, argv, 0) + elseif s:HasOpt(argv, '-p', '--patch') + return s:CommitInteractive(a:line1, a:line2, a:range, a:bang, a:mods, argv, 1) + else + return {} + endif endfunction function! s:RevertSubcommand(line1, line2, range, bang, mods, args) abort - let dir = s:Dir() - let no_commit = s:HasOpt(a:args, '-n', '--no-commit', '--no-edit', '--abort', '--continue', '--quit') - let cmd = s:UserCommand(dir, ['revert'] + (no_commit ? [] : ['-n']) + a:args) - let [out, exec_error] = s:SystemError(cmd) - call fugitive#ReloadStatus(dir, 1) - if no_commit || exec_error - return 'echo ' . string(substitute(out, "\n$", '', '')) - endif - return s:CommitSubcommand(a:line1, a:line2, a:range, a:bang, a:mods, [], dir) + return {'args': ['revert', '--edit'] + a:args} endfunction function! fugitive#CommitComplete(A, L, P) abort @@ -3496,20 +3663,6 @@ function! fugitive#RevertComplete(A, L, P) abort return s:CompleteSub('revert', a:A, a:L, a:P, function('s:CompleteRevision')) endfunction -function! s:FinishCommit() abort - let buf = +expand('') - let args = getbufvar(buf, 'fugitive_commit_arguments') - if !empty(args) - call setbufvar(buf, 'fugitive_commit_arguments', []) - if getbufvar(buf, 'fugitive_commit_rebase') - call setbufvar(buf, 'fugitive_commit_rebase', 0) - let s:rebase_continue = [s:Dir(buf), 0] - endif - return s:CommitSubcommand(-1, -1, 0, 0, '', args, s:Dir(buf)) - endif - return '' -endfunction - " Section: :Gmerge, :Grebase, :Gpull function! fugitive#MergeComplete(A, L, P) abort @@ -3524,278 +3677,24 @@ function! fugitive#PullComplete(A, L, P) abort return s:CompleteSub('pull', a:A, a:L, a:P, function('s:CompleteRemote')) endfunction -function! s:RebaseSequenceAborter() abort - if !exists('s:rebase_sequence_aborter') - let temp = tempname() . '.sh' - call writefile( - \ ['#!/bin/sh', - \ 'echo exec false | cat - "$1" > "$1.fugitive"', - \ 'mv "$1.fugitive" "$1"'], - \ temp) - let s:rebase_sequence_aborter = temp - endif - return s:rebase_sequence_aborter -endfunction - -function! fugitive#Cwindow() abort - if &buftype == 'quickfix' - cwindow - else - botright cwindow - if &buftype == 'quickfix' - wincmd p - endif - endif -endfunction - -let s:common_efm = '' - \ . '%+Egit:%.%#,' - \ . '%+Eusage:%.%#,' - \ . '%+Eerror:%.%#,' - \ . '%+Efatal:%.%#,' - \ . '%-G%.%#%\e[K%.%#,' - \ . '%-G%.%#%\r%.%\+' - -let s:rebase_abbrevs = { - \ 'p': 'pick', - \ 'r': 'reword', - \ 'e': 'edit', - \ 's': 'squash', - \ 'f': 'fixup', - \ 'x': 'exec', - \ 'd': 'drop', - \ 'l': 'label', - \ 't': 'reset', - \ 'm': 'merge', - \ 'b': 'break', - \ } - -function! s:RebaseEdit(cmd, dir) abort - let rebase_todo = s:fnameescape(fugitive#Find('.git/rebase-merge/git-rebase-todo', a:dir)) - - if filereadable(rebase_todo) - let new = readfile(rebase_todo) - let sha_length = 0 - let shas = {} - - for i in range(len(new)) - if new[i] =~# '^\l\+\s\+[0-9a-f]\{5,\}\>' - let sha = matchstr(new[i], '\C\<[a-f0-9]\{5,\}\>') - if !sha_length - let sha_length = len(s:TreeChomp(a:dir, 'rev-parse', '--short', sha)) - endif - let shortened_sha = strpart(sha, 0, sha_length) - let shas[shortened_sha] = sha - let new[i] = substitute(new[i], sha, shortened_sha, '') - endif - endfor - call writefile(new, rebase_todo) - endif - return a:cmd . ' +setlocal\ bufhidden=wipe\|' . escape('let b:fugitive_rebase_shas = ' . string(shas), ' ') . ' ' . rebase_todo -endfunction - -function! s:MergeRebase(cmd, bang, mods, args, ...) abort - let dir = a:0 ? a:1 : s:Dir() - let args = a:args - let mods = s:Mods(a:mods) - if a:cmd =~# '^rebase' && s:HasOpt(args, '-i', '--interactive') - let cmd = fugitive#Prepare(dir, '-c', 'sequence.editor=sh ' . s:RebaseSequenceAborter(), 'rebase') . ' ' . s:shellesc(args) - let out = system(cmd)[0:-2] - for file in ['end', 'msgnum'] - let file = fugitive#Find('.git/rebase-merge/' . file, dir) - if !filereadable(file) - return 'echoerr ' . string("fugitive: " . out) - endif - call writefile([readfile(file)[0] - 1], file) - endfor - call writefile([], fugitive#Find('.git/rebase-merge/done', dir)) - if a:bang - return 'exe' - endif - return s:RebaseEdit(mods . 'split', dir) - elseif a:cmd =~# '^rebase' && s:HasOpt(args, '--edit-todo') && filereadable(fugitive#Find('.git/rebase-merge/git-rebase-todo', dir)) - return s:RebaseEdit(mods . 'split', dir) - elseif a:cmd =~# '^rebase' && s:HasOpt(args, '--continue') && !a:0 - let rdir = fugitive#Find('.git/rebase-merge', dir) - let exec_error = s:ChompError([dir, 'diff-index', '--cached', '--quiet', 'HEAD', '--'])[1] - if exec_error && isdirectory(rdir) - if getfsize(rdir . '/amend') <= 0 - return 'exe ' . string(mods . 'Gcommit -n -F ' . s:fnameescape(rdir .'/message') . ' -e') . '|let b:fugitive_commit_rebase = 1' - elseif readfile(rdir . '/amend')[0] ==# fugitive#Head(-1, dir) - return 'exe ' . string(mods . 'Gcommit --amend -n -F ' . s:fnameescape(rdir . '/message') . ' -e') . '|let b:fugitive_commit_rebase = 1' - endif - endif - endif - let had_merge_msg = filereadable(fugitive#Find('.git/MERGE_MSG', dir)) - let argv = [] - if a:cmd ==# 'pull' - let argv += s:AskPassArgs(dir) + ['pull', '--progress'] - else - call add(argv, a:cmd) - endif - if !s:HasOpt(args, '--no-edit', '--abort', '-m') && a:cmd !=# 'rebase' - call add(argv, '--edit') - endif - if a:cmd ==# 'rebase' && s:HasOpt(args, '--autosquash') && !s:HasOpt(args, '--interactive', '-i') - call add(argv, '--interactive') - endif - call extend(argv, args) - - let [mp, efm] = [&l:mp, &l:efm] - try - let cdback = s:Cd(s:Tree(dir)) - let &l:errorformat = '' - \ . '%-Gerror:%.%#false''.,' - \ . '%-G%.%# ''git commit'' %.%#,' - \ . '%+Emerge:%.%#,' - \ . s:common_efm . ',' - \ . '%+ECannot %.%#: You have unstaged changes.,' - \ . '%+ECannot %.%#: Your index contains uncommitted changes.,' - \ . '%+EThere is no tracking information for the current branch.,' - \ . '%+EYou are not currently on a branch. Please specify which,' - \ . '%+I %#git rebase --continue,' - \ . 'CONFLICT (%m): %f deleted in %.%#,' - \ . 'CONFLICT (%m): Merge conflict in %f,' - \ . 'CONFLICT (%m): Rename \"%f\"->%.%#,' - \ . 'CONFLICT (%m): Rename %.%#->%f %.%#,' - \ . 'CONFLICT (%m): There is a directory with name %f in %.%#,' - \ . '%+ECONFLICT %.%#,' - \ . '%+EKONFLIKT %.%#,' - \ . '%+ECONFLIT %.%#,' - \ . "%+EXUNG \u0110\u1ed8T %.%#," - \ . "%+E\u51b2\u7a81 %.%#," - \ . 'U%\t%f' - if a:cmd =~# '^merge' && empty(args) && - \ (had_merge_msg || isdirectory(fugitive#Find('.git/rebase-apply', dir)) || - \ !empty(s:TreeChomp(dir, 'diff-files', '--diff-filter=U'))) - let cmd = g:fugitive_git_executable.' diff-files --name-status --diff-filter=U' - else - let cmd = s:UserCommand(dir, argv) - endif - if !empty($GIT_SEQUENCE_EDITOR) || has('win32') - let old_sequence_editor = $GIT_SEQUENCE_EDITOR - let $GIT_SEQUENCE_EDITOR = 'true' - else - let cmd = 'env GIT_SEQUENCE_EDITOR=true ' . cmd - endif - if !empty($GIT_EDITOR) || has('win32') - let old_editor = $GIT_EDITOR - let $GIT_EDITOR = 'false' - else - let cmd = 'env GIT_EDITOR=false ' . substitute(cmd, '^env ', '', '') - endif - if !has('patch-8.1.0334') && has('terminal') && &autowrite - let autowrite_was_set = 1 - set noautowrite - silent! wall - endif - let &l:makeprg = cmd - silent noautocmd make! - catch /^Vim\%((\a\+)\)\=:E211/ - let err = v:exception - finally - if exists('autowrite_was_set') - set autowrite - endif - redraw! - let [&l:mp, &l:efm] = [mp, efm] - if exists('old_editor') - let $GIT_EDITOR = old_editor - endif - if exists('old_sequence_editor') - let $GIT_SEQUENCE_EDITOR = old_sequence_editor - endif - execute cdback - endtry - call fugitive#ReloadStatus(dir, 1) - if empty(filter(getqflist(),'v:val.valid && v:val.type !=# "I"')) - if a:cmd =~# '^rebase' && - \ filereadable(fugitive#Find('.git/rebase-merge/done', dir)) && - \ get(readfile(fugitive#Find('.git/rebase-merge/done', dir)), -1, '') =~# '^[^bep]' - cclose - let amend = filereadable(fugitive#Find('.git/rebase-merge/amend', dir)) ? '--amend ' : '' - return 'exe ' . string(mods . 'Gcommit ' . amend . '-n -F ' . s:fnameescape(fugitive#Find('.git/rebase-merge/message', dir)) . ' -e') . '|let b:fugitive_commit_rebase = 1' - elseif !had_merge_msg && filereadable(fugitive#Find('.git/MERGE_MSG', dir)) - cclose - return mods . 'Gcommit --no-status -n -t '.s:fnameescape(fugitive#Find('.git/MERGE_MSG', dir)) - endif - endif - let qflist = getqflist() - let found = 0 - for e in qflist - if !empty(e.bufnr) - let found = 1 - let e.pattern = '^<<<<<<<' - endif - endfor - call fugitive#Cwindow() - if found - call setqflist(qflist, 'r') - if !a:bang - call s:BlurStatus() - return 'cfirst' - endif - endif - return exists('err') ? 'echoerr '.string(err) : 'exe' -endfunction - -function! s:RebaseClean(file) abort - if !filereadable(a:file) - return '' - endif - let old = readfile(a:file) - let new = copy(old) - for i in range(len(new)) - let new[i] = substitute(new[i], '^\l\>', '\=get(s:rebase_abbrevs,submatch(0),submatch(0))', '') - - let sha = matchstr(new[i], '\C\<[a-f0-9]\{5,\}\>') - let rebase_shas = getbufvar(a:file, 'fugitive_rebase_shas') - if len(sha) && type(rebase_shas) == type({}) && has_key(rebase_shas, sha) - let new[i] = substitute(new[i], '\C\<' . sha . '\>', rebase_shas[sha], '') - endif - endfor - if new !=# old - call writefile(new, a:file) - endif - return '' -endfunction - function! s:MergeSubcommand(line1, line2, range, bang, mods, args) abort - return s:MergeRebase('merge', a:bang, a:mods, a:args) + let dir = s:Dir() + if empty(a:args) && ( + \ filereadable(fugitive#Find('.git/MERGE_MSG', dir)) || + \ isdirectory(fugitive#Find('.git/rebase-apply', dir)) || + \ !empty(s:TreeChomp(dir, 'diff-files', '--diff-filter=U'))) + return 'echohl WarningMsg|echo ":Git merge for loading conflicts is deprecated in favor of :Git mergetool"|echohl NONE|silent Git' . (a:bang ? '!' : '') . ' mergetool' + endif + return {} endfunction function! s:RebaseSubcommand(line1, line2, range, bang, mods, args) abort - return s:MergeRebase('rebase', a:bang, a:mods, a:args) + if s:HasOpt(a:args, '--autosquash') && !s:HasOpt(a:args, '-i', '--interactive') + return {'env': {'GIT_SEQUENCE_EDITOR': 'true'}, 'args': ['rebase', '--interactive'] + a:args} + endif + return {} endfunction -function! s:PullSubcommand(line1, line2, range, bang, mods, args) abort - return s:MergeRebase('pull', a:bang, a:mods, a:args) -endfunction - -function! s:RebaseContinue(arg, ...) abort - let [dir, edit_todo] = a:arg - exe s:MergeRebase('rebase', 0, '', [edit_todo && getfsize(fugitive#Find('.git/rebase-merge/git-rebase-todo', dir)) <= 0 ? '--abort' : '--continue'], dir) -endfunction - -augroup fugitive_merge - autocmd! - autocmd VimLeavePre,BufDelete git-rebase-todo - \ if getbufvar(+expand(''), '&bufhidden') ==# 'wipe' | - \ call s:RebaseClean(expand('')) | - \ if getfsize(FugitiveFind('.git/rebase-merge/done', +expand(''))) == 0 | - \ let s:rebase_continue = [FugitiveGitDir(+expand('')), 1] | - \ endif | - \ endif - autocmd BufEnter * nested - \ if exists('s:rebase_continue') | - \ if has('timers') | - \ call timer_start(0, function('s:RebaseContinue', [remove(s:, 'rebase_continue')])) | - \ else | - \ call s:RebaseContinue(remove(s:, 'rebase_continue')) | - \ endif | - \ endif -augroup END - " Section: :Git difftool, :Git mergetool function! s:ToolItems(state, from, to, offsets, text, ...) abort @@ -3852,6 +3751,9 @@ function! s:ToolParse(state, line) abort let offsets = split(matchstr(a:line, '^@\+ \zs[-+0-9, ]\+\ze @'), ' ') return s:ToolItems(a:state, a:state.from, a:state.to, offsets, matchstr(a:line, ' @@\+ \zs.*')) endif + elseif a:line =~# '^\* Unmerged path .' + let file = a:line[16:-1] + return s:ToolItems(a:state, file, file, [], '') elseif a:line =~# '^[A-Z]\d*\t.\|^:.*\t.' " --raw, --name-status let [status; files] = split(a:line, "\t") @@ -3890,7 +3792,7 @@ function! s:ToolStream(dir, line1, line2, range, bang, mods, args, state, title) endif let arg = argv[i] if arg =~# '^-t$\|^--tool=\|^--tool-help$\|^--help$' - return -1 + return {} elseif arg =~# '^-y$\|^--no-prompt$' let prompt = 0 call remove(argv, i) @@ -4084,12 +3986,7 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, args) abort call add(cmd, '--column') endif let tree = s:Tree(dir) - if type(a:args) == type([]) - let [args, after] = [a:args, ''] - else - let [args, after] = s:SplitExpandChain(a:args, tree) - endif - let prefix = FugitiveVimPath(s:HasOpt(args, '--cached') || empty(tree) ? 'fugitive://' . dir . '//0/' : tree . '/') + let args = a:args let name_only = s:HasOpt(args, '-l', '--files-with-matches', '--name-only', '-L', '--files-without-match') let title = [listnr < 0 ? ':Ggrep' : ':Glgrep'] + args if listnr > 0 @@ -4102,6 +3999,9 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, args) abort let tempfile = tempname() let event = listnr < 0 ? 'grep-fugitive' : 'lgrep-fugitive' silent exe s:DoAutocmd('QuickFixCmdPre ' . event) + let prefix = FugitiveVimPath(s:HasOpt(args, '--cached') || empty(tree) ? + \ 'fugitive://' . dir . '//0/' : + \ s:cpath(getcwd(), tree) ? '' : tree . '/') exe '!' . escape(s:UserCommand(dir, cmd + args), '%#!') \ printf(&shellpipe . (&shellpipe =~# '%s' ? '' : ' %s'), s:shellesc(tempfile)) let list = map(readfile(tempfile), 's:GrepParseLine(prefix, name_only, dir, v:val)') @@ -4111,9 +4011,9 @@ function! s:GrepSubcommand(line1, line2, range, bang, mods, args) abort redraw endif if !a:bang && !empty(list) - return (listnr < 0 ? 'c' : 'l').'first' . after + return (listnr < 0 ? 'c' : 'l').'first' else - return after[1:-1] + return '' endif endfunction @@ -4408,13 +4308,7 @@ function! s:OpenExec(cmd, mods, args, ...) abort let dir = a:0 ? s:Dir(a:1) : s:Dir() let temp = tempname() let columns = get(g:, 'fugitive_columns', 80) - if columns <= 0 - let env = '' - elseif s:winshell() - let env = 'set COLUMNS=' . columns . '& ' - else - let env = 'env COLUMNS=' . columns . ' ' - endif + let env = s:BuildEnvPrefix({'COLUMNS': columns}) silent! execute '!' . escape(env . s:UserCommand(dir, ['--no-pager'] + a:args), '!#%') . \ (&shell =~# 'csh' ? ' >& ' . temp : ' > ' . temp . ' 2>&1') redraw! @@ -4425,7 +4319,7 @@ function! s:OpenExec(cmd, mods, args, ...) abort else let filetype = 'git' endif - let s:temp_files[s:cpath(temp)] = { 'dir': dir, 'filetype': filetype, 'modifiable': first =~# '^diff ' } + let s:temp_files[s:cpath(temp)] = { 'dir': dir, 'filetype': filetype } if a:cmd ==# 'edit' call s:BlurStatus() endif @@ -4512,26 +4406,8 @@ function! fugitive#WriteCommand(line1, line2, range, bang, mods, arg, args) abor return 'wq' elseif get(b:, 'fugitive_type', '') ==# 'index' return 'Gcommit' - elseif &buftype ==# 'nowrite' && getline(4) =~# '^+++ ' - let filename = getline(4)[6:-1] - setlocal buftype= - silent write - setlocal buftype=nowrite - if matchstr(getline(2),'index [[:xdigit:]]\+\.\.\zs[[:xdigit:]]\{7\}') ==# fugitive#RevParse(':0:'.filename)[0:6] - let [message, exec_error] = s:ChompError(['apply', '--cached', '--reverse', '--', expand('%:p')]) - else - let [message, exec_error] = s:ChompError(['apply', '--cached', '--', expand('%:p')]) - endif - if exec_error - echohl ErrorMsg - echo message - echohl NONE - return '' - elseif a:bang - return 'bdelete' - else - return 'Gedit '.fnameescape(filename) - endif + elseif &buftype ==# 'nowrite' && getline(4) =~# '^[+-]\{3\} ' + return 'echoerr ' . string('fugitive: :Gwrite from :Git diff has been removed in favor of :Git add --edit') endif let mytab = tabpagenr() let mybufnr = bufnr('') @@ -4667,11 +4543,6 @@ function! fugitive#WqCommand(...) abort endif endfunction -augroup fugitive_commit - autocmd! - autocmd VimLeavePre,BufDelete COMMIT_EDITMSG execute substitute(s:FinishCommit(), '\C^echoerr \(''[^'']*''\)*', 'redraw|echohl ErrorMsg|echo \1|echohl NONE', '') -augroup END - " Section: :Gpush, :Gfetch function! fugitive#PushComplete(A, L, P) abort @@ -5258,7 +5129,7 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, args) abort endfor return '' endif - let temp_state = {'dir': s:Dir(), 'filetype': (raw ? '' : 'fugitiveblame'), 'blame_flags': flags, 'blame_file': file, 'modifiable': 0} + let temp_state = {'dir': s:Dir(), 'filetype': (raw ? '' : 'fugitiveblame'), 'blame_flags': flags, 'blame_file': file} if s:HasOpt(flags, '--reverse') let temp_state.blame_reverse_end = matchstr(get(commits, 0, ''), '\.\.\zs.*') endif @@ -5911,14 +5782,14 @@ function! fugitive#MapJumps(...) abort nnoremap c :Git commit nnoremap c :Git commit - nnoremap cv :Git commit -v - nnoremap cv :Git commit -v + nnoremap cv :tab Git commit -v + nnoremap cv :tab Git commit -v nnoremap ca :Gcommit --amend nnoremap cc :Gcommit nnoremap ce :Gcommit --amend --no-edit nnoremap cw :Gcommit --amend --only - nnoremap cva :Gcommit -v --amend - nnoremap cvc :Gcommit -v + nnoremap cva :tab Gcommit -v --amend + nnoremap cvc :tab Gcommit -v nnoremap cRa :Gcommit --reset-author --amend nnoremap cRe :Gcommit --reset-author --amend --no-edit nnoremap cRw :Gcommit --reset-author --amend --only @@ -5937,6 +5808,7 @@ function! fugitive#MapJumps(...) abort nnoremap cm :Git merge nnoremap cm :Git merge + nnoremap cmt :Git mergetool nnoremap cm? :help fugitive_cm nnoremap cz :Git stash @@ -6302,43 +6174,22 @@ function! fugitive#foldtext() abort return fugitive#Foldtext() endfunction -augroup fugitive_folding - autocmd! - autocmd User Fugitive - \ if &filetype =~# '^git\%(commit\)\=$' && &foldtext ==# 'foldtext()' | - \ set foldtext=fugitive#Foldtext() | - \ endif -augroup END - " Section: Initialization function! fugitive#Init() abort - if exists('#User#FugitiveBoot') - exe s:DoAutocmd('User FugitiveBoot') - endif - let dir = s:Dir() - if &tags !~# '\.git' && @% !~# '\.git' && !exists('s:tags_warning') - let actualdir = fugitive#Find('.git/', dir) - if filereadable(actualdir . 'tags') - let s:tags_warning = 1 - echohl WarningMsg - echo "Fugitive .git/tags support removed in favor of `:set tags^=./.git/tags;`" - echohl NONE - endif - endif - exe s:DoAutocmd('User Fugitive') + throw 'Third party code is using fugitive#Init() which has been removed. Contact the author if you have a reason to still use it' endfunction function! fugitive#is_git_dir(path) abort - return FugitiveIsGitDir(a:path) + throw 'Third party code is using fugitive#is_git_dir() which has been removed. Change it to FugitiveIsGitDir()' endfunction function! fugitive#extract_git_dir(path) abort - return FugitiveExtractGitDir(a:path) + throw 'Third party code is using fugitive#extract_git_dir() which has been removed. Change it to FugitiveExtractGitDir()' endfunction function! fugitive#detect(path) abort - return FugitiveDetect(a:path) + throw 'Third party code is using fugitive#detect() which has been removed. Contact the author if you have a reason to still use it' endfunction " Section: End diff --git a/sources_non_forked/vim-fugitive/doc/fugitive.txt b/sources_non_forked/vim-fugitive/doc/fugitive.txt index e4d04aeb..efb4425a 100644 --- a/sources_non_forked/vim-fugitive/doc/fugitive.txt +++ b/sources_non_forked/vim-fugitive/doc/fugitive.txt @@ -16,14 +16,18 @@ These commands are local to the buffers in which they work (generally, buffers that are part of Git repositories). *:Git* *fugitive-:G* -:Git {args} Run an arbitrary git command. Similar to :!git [args] -:G {args} but chdir to the repository tree first. For some - subcommands, a Fugitive command is called instead. +:Git {args} Run an arbitrary git command and display any output. +:G {args} On UNIX this uses a pty and on other platforms it uses + a pipe, which will cause some behavior differences + such as the absence of progress bars. Any file the + command edits (for example, a commit message) will be + loaded into a split window. Closing that window will + resume running the command. A few Git subcommands + have different behavior; these are documented below. - *:Git!* -:Git! {args} Like |:Git|, but capture the output into a temp file, -:Git --no-pager {args} and |:split| that temp file. Use :0Git to -:Git -P {args} |:edit| the temp file instead. A temp file is always +:Git! {args} Run an arbitrary git command, capture output to a temp +:Git --paginate {args} file, and |:split| that temp file. Use :0Git to +:Git -p {args} |:edit| the temp file instead. A temp file is always used for diff and log commands. *:Gstatus* @@ -31,44 +35,6 @@ that are part of Git repositories). :G Press g? or see |fugitive-maps| for usage. :Gstatus - *:Git-commit* *:Gcommit* -:Git commit [args] A wrapper around git-commit. Unless the arguments -:Gcommit [args] given would skip the invocation of an editor (e.g., - -m), a split window will be used to obtain a commit - message, or a new tab if -v is given. Write and close - the window (:wq) to finish the commit. To cancel, use - an empty message. - - *:Git-revert* *:Grevert* -:Git revert [args] A wrapper around git-revert. Similar to |:Gcommit|. -:Grevert [args] - - *:Git-merge* *:Gmerge* -:Git merge [args] Calls git-merge and loads errors and conflicted files -:Gmerge [args] into the |quickfix| list. Opens a |:Gcommit| style - split window for the commit message if the merge - succeeds. If called during a merge conflict, the - conflicted files from the current index are loaded - into the |quickfix| list. - - *:Git-pull* *:Gpull* -:Git pull [args] Like |:Gmerge|, but for git-pull. -:Gpull [args] - - *:Git-rebase* *:Grebase* -:Git rebase [args] Like |:Gmerge|, but for git-rebase. Interactive -:Grebase [args] rebase is experimentally supported. - - *:Git-push* *:Gpush* -:Git push [args] Invoke git-push, load the results into the |quickfix| -:Gpush [args] list, and invoke |:cwindow| to reveal any errors. - |:Dispatch| is used if available for asynchronous - invocation. - - *:Git-fetch* *:Gfetch* -:Git fetch [args] Like |:Gpush|, but for git-fetch. -:Gfetch [args] - *:Git-blame* *:Gblame* :Git blame [flags] Run git-blame [flags] on the current file and open the :Gblame [flags] results in a scroll-bound vertical split. The @@ -111,12 +77,39 @@ that are part of Git repositories). change unless [!] is given. :Git difftool -y [args] Invoke `git diff [args]`, open each changed file in a - new tab, and invoke `:Gdiffsplit` against the + new tab, and invoke `:Gdiffsplit!` against the appropriate commit. *:Git-mergetool* :Git mergetool [args] Like |:Git-difftool|, but target merge conflicts. + *:Git-push* *:Gpush* +:Git push [args] Invoke git-push, load the results into the |quickfix| +:Gpush [args] list, and invoke |:cwindow| to reveal any errors. + |:Dispatch| is used if available for asynchronous + invocation. + + *:Git-fetch* *:Gfetch* +:Git fetch [args] Like |:Gpush|, but for git-fetch. +:Gfetch [args] + + *:Git-merge* *:Gmerge* +:Gmerge [args] Deprecated alias for |:Git| merge. Use |:Git-mergetool| + to get the old behavior of loading merge conflicts + into the quickfix list. + + *:Git-pull* *:Gpull* +:Gpull [args] Deprecated alias for |:Git| pull. + + *:Git-rebase* *:Grebase* +:Grebase [args] Deprecated alias for |:Git| rebase. + + *:Git-commit* *:Gcommit* +:Gcommit [args] Deprecated alias for |:Git| commit. + + *:Git-revert* *:Grevert* +:Grevert [args] Deprecated alias for |:Git| revert. + *:Gclog* *:Glog* :Gclog[!] [args] Use git-log [args] to load the commit history into the :Glog[!] [args] |quickfix| list. Jumps to the first commit unless [!] @@ -208,7 +201,7 @@ that are part of Git repositories). focus on the current window. During a merge conflict, this is a three-way diff against the "ours" and "theirs" ancestors. Additional d2o and d3o maps are - provided to to obtain the hunk from the "ours" or + provided to obtain the hunk from the "ours" or "theirs" ancestor, respectively. :Gdiffsplit! {object} Like |:Gdiffsplit|, but retain focus on the current @@ -315,7 +308,7 @@ P under the cursor. On untracked files, this instead *fugitive_d* Diff maps ~ *fugitive_dp* -dp Invoke |:Git!| diff on the file under the cursor. +dp Invoke |:Git| diff on the file under the cursor. Deprecated in favor of inline diffs. *fugitive_dd* diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index e98f437d..a1e66fb6 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -1,6 +1,6 @@ " fugitive.vim - A Git wrapper so awesome, it should be illegal " Maintainer: Tim Pope -" Version: 3.1 +" Version: 3.2 " GetLatestVimScripts: 2975 1 :AutoInstall: fugitive.vim if exists('g:loaded_fugitive') @@ -66,8 +66,8 @@ function! FugitivePath(...) abort endfunction " FugitiveParse() takes a fugitive:// URL and returns a 2 element list -" containing the Git dir and an object name ("commit:file"). It's effectively -" then inverse of FugitiveFind(). +" containing an object name ("commit:file") and the Git dir. It's effectively +" the inverse of FugitiveFind(). function! FugitiveParse(...) abort let path = s:Slash(a:0 ? a:1 : @%) if path !~# '^fugitive:' @@ -103,6 +103,24 @@ function! FugitiveConfig(...) abort endif endfunction +" Retrieve a Git configuration value. An optional second argument provides +" the Git dir as with FugitiveFind(). Pass a blank string to limit to the +" global config. +function! FugitiveConfigGet(name, ...) abort + return call('FugitiveConfig', [a:name] + a:000) +endfunction + +" Like FugitiveConfigGet(), but return a list of all values. +function! FugitiveConfigGetAll(name, ...) abort + if a:0 && type(a:1) ==# type({}) + let config = a:1 + else + let config = fugitive#Config(FugitiveGitDir(a:0 ? a:1 : -1)) + endif + let name = substitute(a:name, '^[^.]\+\|[^.]\+$', '\L&', 'g') + return copy(get(config, name, [])) +endfunction + function! FugitiveRemoteUrl(...) abort return fugitive#RemoteUrl(a:0 ? a:1 : '', FugitiveGitDir(a:0 > 1 ? a:2 : -1)) endfunction @@ -261,9 +279,23 @@ function! FugitiveDetect(path) abort let b:git_dir = dir endif endif - if exists('b:git_dir') - return fugitive#Init() + if !exists('b:git_dir') || !exists('#User#Fugitive') + return '' endif + if v:version >= 704 || (v:version == 703 && has('patch442')) + doautocmd User Fugitive + elseif &modelines > 0 + let modelines = &modelines + try + set modelines=0 + doautocmd User Fugitive + finally + let &modelines = modelines + endtry + else + doautocmd User Fugitive + endif + return '' endfunction function! FugitiveVimPath(path) abort @@ -339,6 +371,10 @@ augroup fugitive \ if len(FugitiveGitDir()) | \ call fugitive#MapCfile('fugitive#MessageCfile()') | \ endif + autocmd FileType git,gitcommit + \ if len(FugitiveGitDir()) && &foldtext ==# 'foldtext()' | + \ setlocal foldtext=fugitive#Foldtext() | + \ endif autocmd FileType fugitive \ if len(FugitiveGitDir()) | \ call fugitive#MapCfile('fugitive#StatusCfile()') | diff --git a/sources_non_forked/vim-gitgutter/README.mkd b/sources_non_forked/vim-gitgutter/README.mkd index 4f8495c8..0c21f3c1 100644 --- a/sources_non_forked/vim-gitgutter/README.mkd +++ b/sources_non_forked/vim-gitgutter/README.mkd @@ -234,6 +234,20 @@ gitgutter#fold#foldtext(): +-- 45 lines (*): abcdef You can use `gitgutter#fold#is_changed()` in your own `foldtext` expression to find out whether the folded lines have been changed. +### Status line + +Call the `GitGutterGetHunkSummary()` function from your status line to get a list of counts of added, modified, and removed lines in the current buffer. For example: + +```viml +" Your vimrc +function! GitStatus() + let [a,m,r] = GitGutterGetHunkSummary() + return printf('+%d ~%d -%d', a, m, r) +endfunction +set statusline+=%{GitStatus()} +``` + + ### Customisation You can customise: diff --git a/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim b/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim index 498fe9e9..be8a685f 100644 --- a/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim +++ b/sources_non_forked/vim-gitgutter/autoload/gitgutter/diff.vim @@ -4,7 +4,7 @@ let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@' " True for git v1.7.2+. function! s:git_supports_command_line_config_override() abort - call system(g:gitgutter_git_executable.' '.g:gitgutter_git_args.' -c foo.bar=baz --version') + call gitgutter#utility#system(g:gitgutter_git_executable.' '.g:gitgutter_git_args.' -c foo.bar=baz --version') return !v:shell_error endfunction diff --git a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt index f3c09b87..1f52989f 100644 --- a/sources_non_forked/vim-gitgutter/doc/gitgutter.txt +++ b/sources_non_forked/vim-gitgutter/doc/gitgutter.txt @@ -17,6 +17,7 @@ CONTENTS *gitgutter* Commands ..................... |gitgutter-commands| Mappings ..................... |gitgutter-mappings| Autocommand .................. |gitgutter-autocommand| + Status line .................. |gitgutter-statusline| Options ...................... |gitgutter-options| Highlights ................... |gitgutter-highlights| FAQ .......................... |gitgutter-faq| @@ -244,6 +245,23 @@ trailing empty lines. < +=============================================================================== +STATUS LINE *gitgutter-statusline* + + +Call the `GitGutterGetHunkSummary()` function from your status line to get a +list of counts of added, modified, and removed lines in the current buffer. +For example: +> + " Your vimrc + function! GitStatus() + let [a,m,r] = GitGutterGetHunkSummary() + return printf('+%d ~%d -%d', a, m, r) + endfunction + set statusline+=%{GitStatus()} +< + + =============================================================================== OPTIONS *gitgutter-options* diff --git a/sources_non_forked/vim-javascript/syntax/javascript.vim b/sources_non_forked/vim-javascript/syntax/javascript.vim index c8daec93..4d1a7e50 100644 --- a/sources_non_forked/vim-javascript/syntax/javascript.vim +++ b/sources_non_forked/vim-javascript/syntax/javascript.vim @@ -199,7 +199,7 @@ syntax match jsDestructuringNoise contained /[,[\]]/ syntax region jsDestructuringPropertyComputed contained matchgroup=jsDestructuringBraces start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsDestructuringValue,jsDestructuringValueAssignment,jsDestructuringNoise extend fold " Comments -syntax keyword jsCommentTodo contained TODO FIXME XXX TBD +syntax keyword jsCommentTodo contained TODO FIXME XXX TBD NOTE syntax region jsComment start=+//+ end=/$/ contains=jsCommentTodo,@Spell extend keepend syntax region jsComment start=+/\*+ end=+\*/+ contains=jsCommentTodo,@Spell fold extend keepend syntax region jsEnvComment start=/\%^#!/ end=/$/ display diff --git a/sources_non_forked/vim-ruby/ftdetect/ruby_extra.vim b/sources_non_forked/vim-ruby/ftdetect/ruby_extra.vim index 8a02d736..68e1567a 100644 --- a/sources_non_forked/vim-ruby/ftdetect/ruby_extra.vim +++ b/sources_non_forked/vim-ruby/ftdetect/ruby_extra.vim @@ -57,6 +57,9 @@ au BufNewFile,BufRead [rR]outefile call s:setf('ruby') " SimpleCov au BufNewFile,BufRead .simplecov call s:setf('ruby') +" Sorbet RBI files +au BufNewFile,BufRead *.rbi call s:setf('ruby') + " Thor au BufNewFile,BufRead [tT]horfile,*.thor call s:setf('ruby') diff --git a/sources_non_forked/vim-ruby/syntax/ruby.vim b/sources_non_forked/vim-ruby/syntax/ruby.vim index 6dbaf9a8..563885ed 100644 --- a/sources_non_forked/vim-ruby/syntax/ruby.vim +++ b/sources_non_forked/vim-ruby/syntax/ruby.vim @@ -91,7 +91,7 @@ if exists("ruby_operators") || exists("ruby_pseudo_operators") syn match rubyBooleanOperator "\%(\w\|[^\x00-\x7F]\)\@1\@!\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|||=\||=\|%=\|+=\|>>=\|<<=\|\^=" - syn match rubyAssignmentOperator "=>\@!" containedin=rubyBlockParameterList " TODO: this is inelegant + syn match rubyAssignmentOperator "=>\@!" contained containedin=rubyBlockParameterList " TODO: this is inelegant syn match rubyEqualityOperator "===\|==\|!=\|!\~\|=\~" syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\%(\w\|[^\x00-\x7F]\)[?!]\=\|[]})]\)\@2<=\[" end="]" contains=ALLBUT,@rubyNotTop @@ -192,7 +192,7 @@ SynFold ':' syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"': syn match rubyCapitalizedMethod "\%(\%(^\|[^.]\)\.\s*\)\@\%(\s*(\)\@=" -syn region rubyParentheses start="(" end=")" contains=ALLBUT,@rubyNotTop containedin=rubyBlockParameterList +syn region rubyParentheses start="(" end=")" contains=ALLBUT,@rubyNotTop contained containedin=rubyBlockParameterList syn region rubyBlockParameterList start="\%(\%(\\|{\)\_s*\)\@32<=|" end="|" contains=ALLBUT,@rubyNotTop,@rubyProperOperator if exists('ruby_global_variable_error') diff --git a/sources_non_forked/vim-snippets/UltiSnips/tex.snippets b/sources_non_forked/vim-snippets/UltiSnips/tex.snippets index 355d9e46..b5be4b74 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/tex.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/tex.snippets @@ -220,4 +220,25 @@ ${2:${VISUAL:code}} $0 endsnippet + +snippet gln "New glossary item" b +\newglossaryentry{${1:identifier}} +{ + name={${2:name}}, + first={${3:first occurrence}}, + sort={${4:sort value}}, + description={${0:description}}, +} +endsnippet +snippet glnl "New long glossary item" b +\longnewglossaryentry{${1:identifier}} +{ + name={${2:name}}, + first={${3:first occurrence}}, + sort={${4:sort value}}, +} +{ + ${0:description} +} +endsnippet # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/snippets/elixir.snippets b/sources_non_forked/vim-snippets/snippets/elixir.snippets index 64b63f6e..468575d0 100644 --- a/sources_non_forked/vim-snippets/snippets/elixir.snippets +++ b/sources_non_forked/vim-snippets/snippets/elixir.snippets @@ -188,6 +188,8 @@ snippet try try .. rescue .. end snippet pry require IEx; IEx.pry ${0} +snippet ppry + |> (fn x -> require IEx; IEx.pry; x end).()${0} snippet qu quote do ${1} diff --git a/sources_non_forked/vim-snippets/snippets/sh.snippets b/sources_non_forked/vim-snippets/snippets/sh.snippets index 35afa301..2ce67ec4 100644 --- a/sources_non_forked/vim-snippets/snippets/sh.snippets +++ b/sources_non_forked/vim-snippets/snippets/sh.snippets @@ -4,10 +4,10 @@ snippet #! snippet s#! #!/usr/bin/env sh - set -euo pipefail + set -eu snippet safe - set -euo pipefail + set -eu snippet bash #!/usr/bin/env bash