vimwiki

Personal wiki for vim
git clone https://github.com/vimwiki/vimwiki.git
Log | Files | Refs | README | LICENSE

commit 394efe43122b838341495772433c15b7b94fb097
parent ea13b0e84829f141a93930bcf43fcf8f23bc59b4
Author: Michael F. Schönitzer <michael@schoenitzer.de>
Date:   Tue, 12 Jun 2018 20:55:56 +0200

Add a command that shows the version or commit 

Ref #512
Diffstat:
Mplugin/vimwiki.vim | 24++++++++++++++++++++++++
1 file changed, 24 insertions(+), 0 deletions(-)

diff --git a/plugin/vimwiki.vim b/plugin/vimwiki.vim @@ -9,6 +9,11 @@ if exists("g:loaded_vimwiki") || &cp endif let g:loaded_vimwiki = 1 +" Set to version number for release, otherwise -1 for dev-branch +let s:plugin_vers = -1 + +" Get the directory the script is installed in +let s:plugin_dir = expand('<sfile>:p:h:h') let s:old_cpo = &cpo set cpo&vim @@ -188,6 +193,23 @@ function! s:set_windowlocal_options() endfunction +function! s:get_version() + if s:plugin_vers != -1 + echo "Stable version: " . s:plugin_vers + else + let a:plugin_rev = system("git --git-dir " . s:plugin_dir . "/.git rev-parse --short HEAD") + let a:plugin_branch = system("git --git-dir " . s:plugin_dir . "/.git rev-parse --abbrev-ref HEAD") + let a:plugin_date = system("git --git-dir " . s:plugin_dir . "/.git show -s --format=%ci") + if v:shell_error == 0 + echo "Branch: " . a:plugin_branch + echo "Revision: " . a:plugin_rev + echo "Date: " . a:plugin_date + else + echo "Unknown version" + endif + endif +endfunction + " Initialization of Vimwiki starts here. Make sure everything below does not @@ -281,6 +303,8 @@ command! -count=1 VimwikiMakeTomorrowDiaryNote command! VimwikiDiaryGenerateLinks \ call vimwiki#diary#generate_diary_section() +command! VimwikiShowVersion call s:get_version() + let s:map_prefix = vimwiki#vars#get_global('map_prefix')