From 72da8f8fce9b60ad456fee951522a4602d2c4e88 Mon Sep 17 00:00:00 2001 From: Nate Fischer Date: Wed, 18 Nov 2015 01:50:44 -0800 Subject: [PATCH 01/11] Trim trailing whitespace at logging time --- autoload/vundle/installer.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index 472271a3..2ad085ac 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -527,8 +527,11 @@ func! s:log(str, ...) abort let fmt = '%Y-%m-%d %H:%M:%S' let lines = split(a:str, '\n', 1) let time = strftime(fmt) + let entry_prefix = '['. time .'] '. prefix for line in lines - call add(g:vundle#log, '['. time .'] '. prefix . line) + " Trim trailing whitespace + let entry = substitute(entry_prefix . line, '\m\s\+$', '', '') + call add(g:vundle#log, entry) endfor return a:str endf From 4ec18dcc542c207d249e5c190c76521a9d412640 Mon Sep 17 00:00:00 2001 From: Nate Fischer Date: Wed, 18 Nov 2015 01:50:44 -0800 Subject: [PATCH 02/11] Adding syntax highlighting for normal log files --- autoload/vundle/scripts.vim | 3 +- ftplugin/vundlechangelog.vim | 15 ++++++++++ ftplugin/vundlelog.vim | 3 +- syntax/vundlechangelog.vim | 36 ++++++++++++++++++++++ syntax/vundlelog.vim | 58 ++++++++++++++++++++---------------- 5 files changed, 86 insertions(+), 29 deletions(-) create mode 100644 ftplugin/vundlechangelog.vim create mode 100644 syntax/vundlechangelog.vim diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index f789762f..01421dfb 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -67,6 +67,7 @@ func! s:view_log() setl buftype=nofile setl noswapfile setl ro noma + setfiletype vundlelog wincmd P | wincmd H endf @@ -124,7 +125,7 @@ func! s:view_changelog() setl buftype=nofile setl noswapfile setl ro noma - setfiletype vundlelog + setfiletype vundlechangelog wincmd P | wincmd H endf diff --git a/ftplugin/vundlechangelog.vim b/ftplugin/vundlechangelog.vim new file mode 100644 index 00000000..0f338eb8 --- /dev/null +++ b/ftplugin/vundlechangelog.vim @@ -0,0 +1,15 @@ +" --------------------------------------------------------------------------- +" Standard ftplugin boilerplate; see ':help ftplugin'. +" --------------------------------------------------------------------------- +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + + +" --------------------------------------------------------------------------- +" Settings for the Vundle update log buffer. +" --------------------------------------------------------------------------- +setlocal textwidth=0 +setlocal nowrap +setlocal noswapfile diff --git a/ftplugin/vundlelog.vim b/ftplugin/vundlelog.vim index 0f338eb8..d7cd95ed 100644 --- a/ftplugin/vundlelog.vim +++ b/ftplugin/vundlelog.vim @@ -8,8 +8,7 @@ let b:did_ftplugin = 1 " --------------------------------------------------------------------------- -" Settings for the Vundle update log buffer. +" Settings for the Vundle log buffer. " --------------------------------------------------------------------------- setlocal textwidth=0 -setlocal nowrap setlocal noswapfile diff --git a/syntax/vundlechangelog.vim b/syntax/vundlechangelog.vim new file mode 100644 index 00000000..64e81e32 --- /dev/null +++ b/syntax/vundlechangelog.vim @@ -0,0 +1,36 @@ +" --------------------------------------------------------------------------- +" Syntax highlighting for the line which identifies the plugin. +" --------------------------------------------------------------------------- +syntax match VundlePluginName '\v(^Updated Plugin: )@<=.*$' +highlight link VundlePluginName Keyword + +" --------------------------------------------------------------------------- +" Syntax highlighting for the 'compare at' line of each plugin. +" --------------------------------------------------------------------------- +syntax region VundleCompareLine start='\v^Compare at: https:' end='\v\n' + \ contains=VundleCompareUrl +syntax match VundleCompareUrl '\vhttps:\S+' +highlight link VundleCompareLine Comment +highlight link VundleCompareUrl Underlined + +" --------------------------------------------------------------------------- +" Syntax highlighting for individual commits. +" --------------------------------------------------------------------------- +" The main commit line. +" Note that this regex is intimately related to the one for VundleCommitTree, +" and the two should be changed in sync. +syntax match VundleCommitLine '\v(^ [|*]( *[\\|/\*])* )@<=[^*|].*$' + \ contains=VundleCommitMerge,VundleCommitUser,VundleCommitTime +highlight link VundleCommitLine String +" Sub-regions inside the commit message. +syntax match VundleCommitMerge '\v Merge pull request #\d+.*' +syntax match VundleCommitUser '\v( )@<=\S+( \S+)*(, \d+ \w+ ago$)@=' +syntax match VundleCommitTime '\v(, )@<=\d+ \w+ ago$' +highlight link VundleCommitMerge Ignore +highlight link VundleCommitUser Identifier +highlight link VundleCommitTime Comment +" The git history DAG markers are outside of the main commit line region. +" Note that this regex is intimately related to the one for VundleCommitLine, +" and the two should be changed in sync. +syntax match VundleCommitTree '\v(^ )@<=[|*]( *[\\|/\*])*' +highlight link VundleCommitTree Label diff --git a/syntax/vundlelog.vim b/syntax/vundlelog.vim index 64e81e32..a7f4f410 100644 --- a/syntax/vundlelog.vim +++ b/syntax/vundlelog.vim @@ -1,36 +1,42 @@ " --------------------------------------------------------------------------- " Syntax highlighting for the line which identifies the plugin. " --------------------------------------------------------------------------- -syntax match VundlePluginName '\v(^Updated Plugin: )@<=.*$' +syntax match VundlePluginName '\v\C(Plugin )@<=\S+/\S+(\s|$)' highlight link VundlePluginName Keyword " --------------------------------------------------------------------------- -" Syntax highlighting for the 'compare at' line of each plugin. +" Syntax highlighting for diffs on each plugin " --------------------------------------------------------------------------- -syntax region VundleCompareLine start='\v^Compare at: https:' end='\v\n' - \ contains=VundleCompareUrl -syntax match VundleCompareUrl '\vhttps:\S+' -highlight link VundleCompareLine Comment -highlight link VundleCompareUrl Underlined +syntax match VundleGitAddition '\v(\|\s*\d+ )@<=\++' +highlight VundleGitAddition guifg=darkgreen guibg=NONE gui=bold + \ ctermfg=darkgreen ctermbg=NONE cterm=bold + +syntax match VundleGitDeletion '\v(\|\s*\d+ \+*)@<=-+' +highlight VundleGitDeletion guifg=red guibg=NONE gui=bold ctermfg=red + \ ctermbg=NONE cterm=bold " --------------------------------------------------------------------------- -" Syntax highlighting for individual commits. +" Syntax highlighting for log-specific features " --------------------------------------------------------------------------- -" The main commit line. -" Note that this regex is intimately related to the one for VundleCommitTree, -" and the two should be changed in sync. -syntax match VundleCommitLine '\v(^ [|*]( *[\\|/\*])* )@<=[^*|].*$' - \ contains=VundleCommitMerge,VundleCommitUser,VundleCommitTime -highlight link VundleCommitLine String -" Sub-regions inside the commit message. -syntax match VundleCommitMerge '\v Merge pull request #\d+.*' -syntax match VundleCommitUser '\v( )@<=\S+( \S+)*(, \d+ \w+ ago$)@=' -syntax match VundleCommitTime '\v(, )@<=\d+ \w+ ago$' -highlight link VundleCommitMerge Ignore -highlight link VundleCommitUser Identifier -highlight link VundleCommitTime Comment -" The git history DAG markers are outside of the main commit line region. -" Note that this regex is intimately related to the one for VundleCommitLine, -" and the two should be changed in sync. -syntax match VundleCommitTree '\v(^ )@<=[|*]( *[\\|/\*])*' -highlight link VundleCommitTree Label +syntax match VundleCaret '\V >' +highlight link VundleCaret Label + +" Make path to tags file stand out +syntax match VundleTagPath '\v\C(:helptags )@<=/\S+$' +highlight link VundleTagPath Comment + +" Make URL stand out +syntax match VundleCompareUrl '\v\Chttps:\S+' +highlight link VundleCompareUrl Underlined + +" Make errors (from git) stand out +syntax match VundleError '\v\C( \> )@<=fatal:.*$' +highlight link VundleError Error + +" Make git messages stand out +syntax match VundleGitMsg '\v\C( \> )@<=git:.*$' +highlight link VundleGitMsg Type + +" De-emphasize the time stamp +syntax match VundleTimeStamp '\m^\[\d\{4}-\d\{2}-\d\{2} \d\{2}:\d\{2}:\d\{2}]' +highlight link VundleTimeStamp String From 2b194760dd89562b75eb67c73ee84ed9a982e17c Mon Sep 17 00:00:00 2001 From: cameris Date: Sat, 2 Jan 2016 16:49:01 +0100 Subject: [PATCH 03/11] Added variables for git, curl & wget executables, making it easier to use Vundle with gVimPortable and PortableGit. --- autoload/vundle.vim | 10 ++++++++++ autoload/vundle/installer.vim | 20 +++++++++++--------- autoload/vundle/scripts.vim | 10 +++++----- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index 148ff3ef..f05d74b6 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -87,4 +87,14 @@ let vundle#lazy_load = 0 let vundle#log = [] let vundle#updated_bundles = [] +if !exists('g:vundle#git_executable') + let vundle#git_executable = 'git' +endf +if !exists('g:vundle#curl_executable') + let vundle#curl_executable = 'curl' +endf +if !exists('g:vundle#wget_executable') + let vundle#wget_executable = 'wget' +endf + " vim: set expandtab sts=2 ts=2 sw=2 tw=78 norl: diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index 472271a3..5ade369d 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -343,7 +343,8 @@ endf " return -- the URL for the origin remote (string) " --------------------------------------------------------------------------- func! s:get_current_origin_url(bundle) abort - let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && git config --get remote.origin.url' + let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && '. + g:vundle#git_executable.' config --get remote.origin.url' let cmd = vundle#installer#shellesc_cd(cmd) let out = s:strip(s:system(cmd)) return out @@ -357,7 +358,8 @@ endf " return -- A 15 character log sha for the current HEAD " --------------------------------------------------------------------------- func! s:get_current_sha(bundle) - let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && git rev-parse HEAD' + let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && '. + g:vundle#git_executable.' rev-parse HEAD' let cmd = vundle#installer#shellesc_cd(cmd) let out = s:system(cmd)[0:15] return out @@ -389,10 +391,10 @@ func! s:make_sync_command(bang, bundle) abort " Directory names match but the origin remotes are not the same let cmd_parts = [ \ 'cd '.vundle#installer#shellesc(a:bundle.path()) , - \ 'git remote set-url origin ' . vundle#installer#shellesc(a:bundle.uri), - \ 'git fetch', - \ 'git reset --hard origin/HEAD', - \ 'git submodule update --init --recursive', + \ g:vundle#git_executable.' remote set-url origin ' . vundle#installer#shellesc(a:bundle.uri), + \ g:vundle#git_executable.' fetch', + \ g:vundle#git_executable.' reset --hard origin/HEAD', + \ g:vundle#git_executable.' submodule update --init --recursive', \ ] let cmd = join(cmd_parts, ' && ') let cmd = vundle#installer#shellesc_cd(cmd) @@ -407,15 +409,15 @@ func! s:make_sync_command(bang, bundle) abort let cmd_parts = [ \ 'cd '.vundle#installer#shellesc(a:bundle.path()), - \ 'git pull', - \ 'git submodule update --init --recursive', + \ g:vundle#git_executable.' pull', + \ g:vundle#git_executable.' submodule update --init --recursive', \ ] let cmd = join(cmd_parts, ' && ') let cmd = vundle#installer#shellesc_cd(cmd) let initial_sha = s:get_current_sha(a:bundle) else - let cmd = 'git clone --recursive '.vundle#installer#shellesc(a:bundle.uri).' '.vundle#installer#shellesc(a:bundle.path()) + let cmd = g:vundle#git_executable.' clone --recursive '.vundle#installer#shellesc(a:bundle.uri).' '.vundle#installer#shellesc(a:bundle.path()) let initial_sha = '' endif return [cmd, initial_sha] diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index f789762f..e34b555a 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -84,7 +84,7 @@ func! s:create_changelog() abort let bundle = bundle_data[2] let cmd = 'cd '.vundle#installer#shellesc(bundle.path()). - \ ' && git log --pretty=format:"%s %an, %ar" --graph '. + \ ' && '.g:vundle#git_executable.' log --pretty=format:"%s %an, %ar" --graph '. \ initial_sha.'..'.updated_sha let cmd = vundle#installer#shellesc_cd(cmd) @@ -235,11 +235,11 @@ func! s:fetch_scripts(to) endif let l:vim_scripts_json = 'http://vim-scripts.org/api/scripts.json' - if executable("curl") - let cmd = 'curl --fail -s -o '.vundle#installer#shellesc(a:to).' '.l:vim_scripts_json - elseif executable("wget") + if executable(g:vundle#curl_executable) + let cmd = g:vundle#curl_executable.' --fail -s -o '.vundle#installer#shellesc(a:to).' '.l:vim_scripts_json + elseif executable(g:vundle#wget_executable) let temp = vundle#installer#shellesc(tempname()) - let cmd = 'wget -q -O '.temp.' '.l:vim_scripts_json. ' && mv -f '.temp.' '.vundle#installer#shellesc(a:to) + let cmd = g:vundle#wget_executable.' -q -O '.temp.' '.l:vim_scripts_json. ' && mv -f '.temp.' '.vundle#installer#shellesc(a:to) if (has('win32') || has('win64')) let cmd = substitute(cmd, 'mv -f ', 'move /Y ', '') " change force flag let cmd = vundle#installer#shellesc(cmd) From 651a47f80d7c141d33085f9c2f4d9fcf2c0fa157 Mon Sep 17 00:00:00 2001 From: cameris Date: Tue, 19 Jan 2016 00:19:18 +0100 Subject: [PATCH 04/11] Corrected endif typo --- autoload/vundle.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index f05d74b6..a1613668 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -89,12 +89,12 @@ let vundle#updated_bundles = [] if !exists('g:vundle#git_executable') let vundle#git_executable = 'git' -endf +endif if !exists('g:vundle#curl_executable') let vundle#curl_executable = 'curl' -endf +endif if !exists('g:vundle#wget_executable') let vundle#wget_executable = 'wget' -endf +endif " vim: set expandtab sts=2 ts=2 sw=2 tw=78 norl: From 87eb7c230eb0d4b01f069e105415b36b1981abf6 Mon Sep 17 00:00:00 2001 From: Guillaume Maudoux Date: Fri, 26 Feb 2016 22:47:16 +0100 Subject: [PATCH 05/11] Harden system calls to git --- autoload/vundle/installer.vim | 46 ++++++++++++++++++++++++++--------- autoload/vundle/scripts.vim | 7 ++---- 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index 472271a3..3befc9d1 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -343,8 +343,7 @@ endf " return -- the URL for the origin remote (string) " --------------------------------------------------------------------------- func! s:get_current_origin_url(bundle) abort - let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && git config --get remote.origin.url' - let cmd = vundle#installer#shellesc_cd(cmd) + let cmd = s:make_git_command(a:bundle, ['config', '--get', 'remote.origin.url']) let out = s:strip(s:system(cmd)) return out endf @@ -357,12 +356,37 @@ endf " return -- A 15 character log sha for the current HEAD " --------------------------------------------------------------------------- func! s:get_current_sha(bundle) - let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && git rev-parse HEAD' - let cmd = vundle#installer#shellesc_cd(cmd) + let cmd = s:make_sync_command(a:bundle, ['rev-parse', 'HEAD']) let out = s:system(cmd)[0:15] return out endf +" --------------------------------------------------------------------------- +" Build a safe (escaped) git command +" +" bundle -- A bundle object to get the path to the git dir +" args -- A list of arguments to the git executable +" return -- A string containing the escaped shell command +" --------------------------------------------------------------------------- +func! s:make_git_command(bundle, args) abort + let workdir = a:bundle.path() + let gitdir = workdir.'/.git/' + + let git = ['git', '--git-dir='.gitdir, '--work-tree='.workdir] + + return join(map(copy(git + args), 'vundle#installer#shellesc')) +endf + +" --------------------------------------------------------------------------- +" Build a safe (escaped) command from list of git args +" +" bundle -- A bundle object to get the path to the git dir +" argss -- A list of lists of arguments to successive git calls +" return -- A string containing the escaped shell command +" --------------------------------------------------------------------------- +func! s:make_git_commands(bundle, argss) abort + return join(map(a:argss, 's:make_git_command(s:bundle, {})'), ' && ') +endf " --------------------------------------------------------------------------- " Create the appropriate sync command to run according to the current state of @@ -388,14 +412,12 @@ func! s:make_sync_command(bang, bundle) abort call s:log('> Plugin ' . a:bundle.name . ' new URI: ' . a:bundle.uri) " Directory names match but the origin remotes are not the same let cmd_parts = [ - \ 'cd '.vundle#installer#shellesc(a:bundle.path()) , - \ 'git remote set-url origin ' . vundle#installer#shellesc(a:bundle.uri), - \ 'git fetch', - \ 'git reset --hard origin/HEAD', - \ 'git submodule update --init --recursive', - \ ] - let cmd = join(cmd_parts, ' && ') - let cmd = vundle#installer#shellesc_cd(cmd) + [ 'remote', 'set-url', 'origin', a:bundle.uri ], + [ 'fetch' ], + [ 'reset', '--hard', 'origin/HEAD' ], + [ 'submodule', 'update', '--init', '--recursive' ], + ] + let cmd = s:make_git_commands(a:bundle, cmd_parts) let initial_sha = '' return [cmd, initial_sha] endif diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index f789762f..1b04c290 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -83,11 +83,8 @@ func! s:create_changelog() abort let updated_sha = bundle_data[1] let bundle = bundle_data[2] - let cmd = 'cd '.vundle#installer#shellesc(bundle.path()). - \ ' && git log --pretty=format:"%s %an, %ar" --graph '. - \ initial_sha.'..'.updated_sha - - let cmd = vundle#installer#shellesc_cd(cmd) + let cmd = s:make_git_command(bundle, ['log', '--pretty=format:"%s %an, %ar"', + \ '--graph', initial_sha.'..'.updated_sha ]) let updates = system(cmd) From 462970020bdcd142e1e1cf6134fc0dd100e2ee5e Mon Sep 17 00:00:00 2001 From: Guillaume Maudoux Date: Fri, 26 Feb 2016 23:30:50 +0100 Subject: [PATCH 06/11] Fix syntax (and other) issues --- autoload/vundle/installer.vim | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index 3befc9d1..d35415f0 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -356,7 +356,7 @@ endf " return -- A 15 character log sha for the current HEAD " --------------------------------------------------------------------------- func! s:get_current_sha(bundle) - let cmd = s:make_sync_command(a:bundle, ['rev-parse', 'HEAD']) + let cmd = s:make_git_command(a:bundle, ['rev-parse', 'HEAD']) let out = s:system(cmd)[0:15] return out endf @@ -374,7 +374,7 @@ func! s:make_git_command(bundle, args) abort let git = ['git', '--git-dir='.gitdir, '--work-tree='.workdir] - return join(map(copy(git + args), 'vundle#installer#shellesc')) + return join(map(git + a:args, 'vundle#installer#shellesc(v:val)')) endf " --------------------------------------------------------------------------- @@ -385,7 +385,7 @@ endf " return -- A string containing the escaped shell command " --------------------------------------------------------------------------- func! s:make_git_commands(bundle, argss) abort - return join(map(a:argss, 's:make_git_command(s:bundle, {})'), ' && ') + return join(map(a:argss, 's:make_git_command(a:bundle, v:val)'), ' && ') endf " --------------------------------------------------------------------------- @@ -412,11 +412,11 @@ func! s:make_sync_command(bang, bundle) abort call s:log('> Plugin ' . a:bundle.name . ' new URI: ' . a:bundle.uri) " Directory names match but the origin remotes are not the same let cmd_parts = [ - [ 'remote', 'set-url', 'origin', a:bundle.uri ], - [ 'fetch' ], - [ 'reset', '--hard', 'origin/HEAD' ], - [ 'submodule', 'update', '--init', '--recursive' ], - ] + \ [ 'remote', 'set-url', 'origin', a:bundle.uri ], + \ [ 'fetch' ], + \ [ 'reset', '--hard', 'origin/HEAD' ], + \ [ 'submodule', 'update', '--init', '--recursive' ] + \] let cmd = s:make_git_commands(a:bundle, cmd_parts) let initial_sha = '' return [cmd, initial_sha] From 1f2c3315944d616add131bf07bb1371020f4a8b7 Mon Sep 17 00:00:00 2001 From: Guillaume Maudoux Date: Sat, 23 Apr 2016 13:29:30 +0200 Subject: [PATCH 07/11] fixup harden git --- autoload/vundle/installer.vim | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index ff2d2781..6c4517c0 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -428,16 +428,13 @@ func! s:make_sync_command(bang, bundle) abort endif let cmd_parts = [ - \ 'cd '.vundle#installer#shellesc(a:bundle.path()), - \ g:vundle#git_executable.' pull', - \ g:vundle#git_executable.' submodule update --init --recursive', - \ ] - let cmd = join(cmd_parts, ' && ') - let cmd = vundle#installer#shellesc_cd(cmd) - + \ [ 'pull'], + \ [ 'submodule', 'update', '--init', '--recursive'] + \] + let cmd = s:make_git_commands(a:bundle, cmd_parts) let initial_sha = s:get_current_sha(a:bundle) else - let cmd = g:vundle#git_executable.' clone --recursive '.vundle#installer#shellesc(a:bundle.uri).' '.vundle#installer#shellesc(a:bundle.path()) + let cmd = s:make_git_command(a:bundle, ['clone', '--recursive', a:bundle.uri, a:bundle.path()]) let initial_sha = '' endif return [cmd, initial_sha] From 633f352e533cb97d4d4f6b6f7dc3bf51bc656ed1 Mon Sep 17 00:00:00 2001 From: Nate Fischer Date: Wed, 18 Nov 2015 01:50:44 -0800 Subject: [PATCH 08/11] Trim trailing whitespace at logging time --- autoload/vundle/installer.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index 535a1293..6af5d26a 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -588,8 +588,11 @@ func! s:log(str, ...) abort let fmt = '%Y-%m-%d %H:%M:%S' let lines = split(a:str, '\n', 1) let time = strftime(fmt) + let entry_prefix = '['. time .'] '. prefix for line in lines - call add(g:vundle#log, '['. time .'] '. prefix . line) + " Trim trailing whitespace + let entry = substitute(entry_prefix . line, '\m\s\+$', '', '') + call add(g:vundle#log, entry) endfor return a:str endf From 68b17c4bfa4e8527f8b44c1ef1995a12e98ecb83 Mon Sep 17 00:00:00 2001 From: Nate Fischer Date: Wed, 18 Nov 2015 01:50:44 -0800 Subject: [PATCH 09/11] Adding syntax highlighting for normal log files --- autoload/vundle/scripts.vim | 3 +- ...7395f7b68406fac0255c023b68d6a9a1e5f5.patch | 34 +++++++++++ ftplugin/vundlechangelog.vim | 15 +++++ ftplugin/vundlelog.vim | 3 +- syntax/vundlechangelog.vim | 36 ++++++++++++ syntax/vundlelog.vim | 58 ++++++++++--------- 6 files changed, 120 insertions(+), 29 deletions(-) create mode 100644 d8057395f7b68406fac0255c023b68d6a9a1e5f5.patch create mode 100644 ftplugin/vundlechangelog.vim create mode 100644 syntax/vundlechangelog.vim diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index f789762f..01421dfb 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -67,6 +67,7 @@ func! s:view_log() setl buftype=nofile setl noswapfile setl ro noma + setfiletype vundlelog wincmd P | wincmd H endf @@ -124,7 +125,7 @@ func! s:view_changelog() setl buftype=nofile setl noswapfile setl ro noma - setfiletype vundlelog + setfiletype vundlechangelog wincmd P | wincmd H endf diff --git a/d8057395f7b68406fac0255c023b68d6a9a1e5f5.patch b/d8057395f7b68406fac0255c023b68d6a9a1e5f5.patch new file mode 100644 index 00000000..11aaa237 --- /dev/null +++ b/d8057395f7b68406fac0255c023b68d6a9a1e5f5.patch @@ -0,0 +1,34 @@ +From d8057395f7b68406fac0255c023b68d6a9a1e5f5 Mon Sep 17 00:00:00 2001 +From: Chip Hogg +Date: Sun, 6 Nov 2016 12:55:47 -0500 +Subject: [PATCH] Recognize underscores as commit tree characters + +Currently, any line in a commit tree representation with an underscore +will not be highlighted correctly. The solution is to add the +underscore to the list of commit tree characters. + +Fixes #766. +--- + syntax/vundlechangelog.vim | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/syntax/vundlechangelog.vim b/syntax/vundlechangelog.vim +index 64e81e32..fc68ea60 100644 +--- a/syntax/vundlechangelog.vim ++++ b/syntax/vundlechangelog.vim +@@ -19,7 +19,7 @@ highlight link VundleCompareUrl Underlined + " The main commit line. + " Note that this regex is intimately related to the one for VundleCommitTree, + " and the two should be changed in sync. +-syntax match VundleCommitLine '\v(^ [|*]( *[\\|/\*])* )@<=[^*|].*$' ++syntax match VundleCommitLine '\v(^ [|*]( *[\\|_/\*])* )@<=[^*|].*$' + \ contains=VundleCommitMerge,VundleCommitUser,VundleCommitTime + highlight link VundleCommitLine String + " Sub-regions inside the commit message. +@@ -32,5 +32,5 @@ highlight link VundleCommitTime Comment + " The git history DAG markers are outside of the main commit line region. + " Note that this regex is intimately related to the one for VundleCommitLine, + " and the two should be changed in sync. +-syntax match VundleCommitTree '\v(^ )@<=[|*]( *[\\|/\*])*' ++syntax match VundleCommitTree '\v(^ )@<=[|*]( *[\\|_/\*])*' + highlight link VundleCommitTree Label diff --git a/ftplugin/vundlechangelog.vim b/ftplugin/vundlechangelog.vim new file mode 100644 index 00000000..0f338eb8 --- /dev/null +++ b/ftplugin/vundlechangelog.vim @@ -0,0 +1,15 @@ +" --------------------------------------------------------------------------- +" Standard ftplugin boilerplate; see ':help ftplugin'. +" --------------------------------------------------------------------------- +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + + +" --------------------------------------------------------------------------- +" Settings for the Vundle update log buffer. +" --------------------------------------------------------------------------- +setlocal textwidth=0 +setlocal nowrap +setlocal noswapfile diff --git a/ftplugin/vundlelog.vim b/ftplugin/vundlelog.vim index 0f338eb8..d7cd95ed 100644 --- a/ftplugin/vundlelog.vim +++ b/ftplugin/vundlelog.vim @@ -8,8 +8,7 @@ let b:did_ftplugin = 1 " --------------------------------------------------------------------------- -" Settings for the Vundle update log buffer. +" Settings for the Vundle log buffer. " --------------------------------------------------------------------------- setlocal textwidth=0 -setlocal nowrap setlocal noswapfile diff --git a/syntax/vundlechangelog.vim b/syntax/vundlechangelog.vim new file mode 100644 index 00000000..fc68ea60 --- /dev/null +++ b/syntax/vundlechangelog.vim @@ -0,0 +1,36 @@ +" --------------------------------------------------------------------------- +" Syntax highlighting for the line which identifies the plugin. +" --------------------------------------------------------------------------- +syntax match VundlePluginName '\v(^Updated Plugin: )@<=.*$' +highlight link VundlePluginName Keyword + +" --------------------------------------------------------------------------- +" Syntax highlighting for the 'compare at' line of each plugin. +" --------------------------------------------------------------------------- +syntax region VundleCompareLine start='\v^Compare at: https:' end='\v\n' + \ contains=VundleCompareUrl +syntax match VundleCompareUrl '\vhttps:\S+' +highlight link VundleCompareLine Comment +highlight link VundleCompareUrl Underlined + +" --------------------------------------------------------------------------- +" Syntax highlighting for individual commits. +" --------------------------------------------------------------------------- +" The main commit line. +" Note that this regex is intimately related to the one for VundleCommitTree, +" and the two should be changed in sync. +syntax match VundleCommitLine '\v(^ [|*]( *[\\|_/\*])* )@<=[^*|].*$' + \ contains=VundleCommitMerge,VundleCommitUser,VundleCommitTime +highlight link VundleCommitLine String +" Sub-regions inside the commit message. +syntax match VundleCommitMerge '\v Merge pull request #\d+.*' +syntax match VundleCommitUser '\v( )@<=\S+( \S+)*(, \d+ \w+ ago$)@=' +syntax match VundleCommitTime '\v(, )@<=\d+ \w+ ago$' +highlight link VundleCommitMerge Ignore +highlight link VundleCommitUser Identifier +highlight link VundleCommitTime Comment +" The git history DAG markers are outside of the main commit line region. +" Note that this regex is intimately related to the one for VundleCommitLine, +" and the two should be changed in sync. +syntax match VundleCommitTree '\v(^ )@<=[|*]( *[\\|_/\*])*' +highlight link VundleCommitTree Label diff --git a/syntax/vundlelog.vim b/syntax/vundlelog.vim index fc68ea60..a7f4f410 100644 --- a/syntax/vundlelog.vim +++ b/syntax/vundlelog.vim @@ -1,36 +1,42 @@ " --------------------------------------------------------------------------- " Syntax highlighting for the line which identifies the plugin. " --------------------------------------------------------------------------- -syntax match VundlePluginName '\v(^Updated Plugin: )@<=.*$' +syntax match VundlePluginName '\v\C(Plugin )@<=\S+/\S+(\s|$)' highlight link VundlePluginName Keyword " --------------------------------------------------------------------------- -" Syntax highlighting for the 'compare at' line of each plugin. +" Syntax highlighting for diffs on each plugin " --------------------------------------------------------------------------- -syntax region VundleCompareLine start='\v^Compare at: https:' end='\v\n' - \ contains=VundleCompareUrl -syntax match VundleCompareUrl '\vhttps:\S+' -highlight link VundleCompareLine Comment -highlight link VundleCompareUrl Underlined +syntax match VundleGitAddition '\v(\|\s*\d+ )@<=\++' +highlight VundleGitAddition guifg=darkgreen guibg=NONE gui=bold + \ ctermfg=darkgreen ctermbg=NONE cterm=bold + +syntax match VundleGitDeletion '\v(\|\s*\d+ \+*)@<=-+' +highlight VundleGitDeletion guifg=red guibg=NONE gui=bold ctermfg=red + \ ctermbg=NONE cterm=bold " --------------------------------------------------------------------------- -" Syntax highlighting for individual commits. +" Syntax highlighting for log-specific features " --------------------------------------------------------------------------- -" The main commit line. -" Note that this regex is intimately related to the one for VundleCommitTree, -" and the two should be changed in sync. -syntax match VundleCommitLine '\v(^ [|*]( *[\\|_/\*])* )@<=[^*|].*$' - \ contains=VundleCommitMerge,VundleCommitUser,VundleCommitTime -highlight link VundleCommitLine String -" Sub-regions inside the commit message. -syntax match VundleCommitMerge '\v Merge pull request #\d+.*' -syntax match VundleCommitUser '\v( )@<=\S+( \S+)*(, \d+ \w+ ago$)@=' -syntax match VundleCommitTime '\v(, )@<=\d+ \w+ ago$' -highlight link VundleCommitMerge Ignore -highlight link VundleCommitUser Identifier -highlight link VundleCommitTime Comment -" The git history DAG markers are outside of the main commit line region. -" Note that this regex is intimately related to the one for VundleCommitLine, -" and the two should be changed in sync. -syntax match VundleCommitTree '\v(^ )@<=[|*]( *[\\|_/\*])*' -highlight link VundleCommitTree Label +syntax match VundleCaret '\V >' +highlight link VundleCaret Label + +" Make path to tags file stand out +syntax match VundleTagPath '\v\C(:helptags )@<=/\S+$' +highlight link VundleTagPath Comment + +" Make URL stand out +syntax match VundleCompareUrl '\v\Chttps:\S+' +highlight link VundleCompareUrl Underlined + +" Make errors (from git) stand out +syntax match VundleError '\v\C( \> )@<=fatal:.*$' +highlight link VundleError Error + +" Make git messages stand out +syntax match VundleGitMsg '\v\C( \> )@<=git:.*$' +highlight link VundleGitMsg Type + +" De-emphasize the time stamp +syntax match VundleTimeStamp '\m^\[\d\{4}-\d\{2}-\d\{2} \d\{2}:\d\{2}:\d\{2}]' +highlight link VundleTimeStamp String From 44bd0304592a88565cf81d273c784a80d13ebbf9 Mon Sep 17 00:00:00 2001 From: cameris Date: Sat, 2 Jan 2016 16:49:01 +0100 Subject: [PATCH 10/11] Added variables for git, curl & wget executables, making it easier to use Vundle with gVimPortable and PortableGit. --- autoload/vundle.vim | 10 ++++++++++ autoload/vundle/installer.vim | 24 +++++++++++++----------- autoload/vundle/scripts.vim | 10 +++++----- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index 148ff3ef..f05d74b6 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -87,4 +87,14 @@ let vundle#lazy_load = 0 let vundle#log = [] let vundle#updated_bundles = [] +if !exists('g:vundle#git_executable') + let vundle#git_executable = 'git' +endf +if !exists('g:vundle#curl_executable') + let vundle#curl_executable = 'curl' +endf +if !exists('g:vundle#wget_executable') + let vundle#wget_executable = 'wget' +endf + " vim: set expandtab sts=2 ts=2 sw=2 tw=78 norl: diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index 6af5d26a..001e161c 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -343,7 +343,8 @@ endf " return -- the URL for the origin remote (string) " --------------------------------------------------------------------------- func! s:get_current_origin_url(bundle) abort - let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && git config --get remote.origin.url' + let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && '. + g:vundle#git_executable.' config --get remote.origin.url' let cmd = vundle#installer#shellesc_cd(cmd) let out = s:strip(s:system(cmd)) return out @@ -357,7 +358,8 @@ endf " return -- A 15 character log sha for the current HEAD " --------------------------------------------------------------------------- func! s:get_current_sha(bundle) - let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && git rev-parse HEAD' + let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && '. + g:vundle#git_executable.' rev-parse HEAD' let cmd = vundle#installer#shellesc_cd(cmd) let out = s:system(cmd)[0:15] return out @@ -389,11 +391,11 @@ func! s:make_sync_command(bang, bundle) abort " Directory names match but the origin remotes are not the same let cmd_parts = [ \ 'cd '.vundle#installer#shellesc(a:bundle.path()) , - \ 'git remote set-url origin ' . vundle#installer#shellesc(a:bundle.uri), - \ 'git fetch', - \ 'git reset --hard origin/HEAD', - \ 'git submodule sync --recursive', - \ 'git submodule update --init --recursive', + \ g:vundle#git_executable.' remote set-url origin ' . vundle#installer#shellesc(a:bundle.uri), + \ g:vundle#git_executable.' fetch', + \ g:vundle#git_executable.' reset --hard origin/HEAD', + \ g:vundle#git_executable.' submodule sync --recursive', + \ g:vundle#git_executable.' submodule update --init --recursive', \ ] let cmd = join(cmd_parts, ' && ') let cmd = vundle#installer#shellesc_cd(cmd) @@ -408,16 +410,16 @@ func! s:make_sync_command(bang, bundle) abort let cmd_parts = [ \ 'cd '.vundle#installer#shellesc(a:bundle.path()), - \ 'git pull', - \ 'git submodule sync --recursive', - \ 'git submodule update --init --recursive', + \ g:vundle#git_executable.' pull', + \ g:vundle#git_executable.' submodule sync --recursive', + \ g:vundle#git_executable.' submodule update --init --recursive', \ ] let cmd = join(cmd_parts, ' && ') let cmd = vundle#installer#shellesc_cd(cmd) let initial_sha = s:get_current_sha(a:bundle) else - let cmd = 'git clone --depth 1 --recursive --shallow-submodules '.vundle#installer#shellesc(a:bundle.uri).' '.vundle#installer#shellesc(a:bundle.path()) + let cmd = g:vundle#git_executable.' clone --depth 1 --recursive --shallow-submodules '.vundle#installer#shellesc(a:bundle.uri).' '.vundle#installer#shellesc(a:bundle.path()) let initial_sha = '' endif return [cmd, initial_sha] diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index 01421dfb..680221b8 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -85,7 +85,7 @@ func! s:create_changelog() abort let bundle = bundle_data[2] let cmd = 'cd '.vundle#installer#shellesc(bundle.path()). - \ ' && git log --pretty=format:"%s %an, %ar" --graph '. + \ ' && '.g:vundle#git_executable.' log --pretty=format:"%s %an, %ar" --graph '. \ initial_sha.'..'.updated_sha let cmd = vundle#installer#shellesc_cd(cmd) @@ -236,11 +236,11 @@ func! s:fetch_scripts(to) endif let l:vim_scripts_json = 'http://vim-scripts.org/api/scripts.json' - if executable("curl") - let cmd = 'curl --fail -s -o '.vundle#installer#shellesc(a:to).' '.l:vim_scripts_json - elseif executable("wget") + if executable(g:vundle#curl_executable) + let cmd = g:vundle#curl_executable.' --fail -s -o '.vundle#installer#shellesc(a:to).' '.l:vim_scripts_json + elseif executable(g:vundle#wget_executable) let temp = vundle#installer#shellesc(tempname()) - let cmd = 'wget -q -O '.temp.' '.l:vim_scripts_json. ' && mv -f '.temp.' '.vundle#installer#shellesc(a:to) + let cmd = g:vundle#wget_executable.' -q -O '.temp.' '.l:vim_scripts_json. ' && mv -f '.temp.' '.vundle#installer#shellesc(a:to) if (has('win32') || has('win64')) let cmd = substitute(cmd, 'mv -f ', 'move /Y ', '') " change force flag let cmd = vundle#installer#shellesc(cmd) From 3823167b4c4d99e2c83073a5c77456738f0450d5 Mon Sep 17 00:00:00 2001 From: cameris Date: Tue, 19 Jan 2016 00:19:18 +0100 Subject: [PATCH 11/11] Corrected endif typo --- autoload/vundle.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index f05d74b6..a1613668 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -89,12 +89,12 @@ let vundle#updated_bundles = [] if !exists('g:vundle#git_executable') let vundle#git_executable = 'git' -endf +endif if !exists('g:vundle#curl_executable') let vundle#curl_executable = 'curl' -endf +endif if !exists('g:vundle#wget_executable') let vundle#wget_executable = 'wget' -endf +endif " vim: set expandtab sts=2 ts=2 sw=2 tw=78 norl: