From f639c0a342602aae9ec5cb881d8301c6f001e6c8 Mon Sep 17 00:00:00 2001 From: Fredrik Arnerup Date: Mon, 17 Sep 2018 12:20:17 +0200 Subject: [PATCH 1/6] Clean URLs that don't have slashes Will fix normalization of links like [[local:./foo.txt]] Also, allow schemes to end with a number, so that e.g. [[wiki1:foo]] will normalize as expected. --- autoload/vimwiki/base.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 0f399ea..3a81b57 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -1861,7 +1861,8 @@ endfunction function! s:clean_url(url) " remove protocol and tld - let url = substitute(a:url, '^\a\+://', '', '') + let url = substitute(a:url, '^\a\+\d*:', '', '') + let url = substitute(url, '^//', '', '') let url = substitute(url, '^\([^/]\+\).\a\{2,4}/', '\1/', '') let url = split(url, '/\|=\|-\|&\|?\|\.') let url = filter(url, 'v:val !=# ""') From d7d94e21600930d9d81bc0dd4c583324ea9f5fd8 Mon Sep 17 00:00:00 2001 From: Steven Stallion Date: Thu, 12 Jul 2018 10:58:12 -0500 Subject: [PATCH 2/6] Initial commit --- autoload/vimwiki/diary.vim | 5 +++++ autoload/vimwiki/vars.vim | 1 + doc/vimwiki.txt | 11 +++++++++++ 3 files changed, 17 insertions(+) diff --git a/autoload/vimwiki/diary.vim b/autoload/vimwiki/diary.vim index 164211d..37f6d5c 100644 --- a/autoload/vimwiki/diary.vim +++ b/autoload/vimwiki/diary.vim @@ -231,6 +231,11 @@ function! vimwiki#diary#goto_diary_index(wnum) endif call vimwiki#base#edit_file('e', s:diary_index(idx), '') + + if vimwiki#vars#get_wikilocal('auto_diary_index') + call vimwiki#diary#generate_diary_section() + write! " save changes + endif endfunction diff --git a/autoload/vimwiki/vars.vim b/autoload/vimwiki/vars.vim index 7b8e507..2e7d036 100644 --- a/autoload/vimwiki/vars.vim +++ b/autoload/vimwiki/vars.vim @@ -181,6 +181,7 @@ endfunction function! s:populate_wikilocal_options() let default_values = { + \ 'auto_diary_index': 0, \ 'auto_export': 0, \ 'auto_tags': 0, \ 'auto_toc': 0, diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index 90b5b12..629ba9c 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -2295,6 +2295,17 @@ current wiki page is saved: > let g:vimwiki_list = [{'path': '~/my_site/', 'auto_tags': 1}] +*vimwiki-option-auto_diary_index* +------------------------------------------------------------------------------ +Key Default value Values~ +auto_diary_index 0 0, 1 + +Description~ +Set this option to 1 to automatically update the diary index when opened. +See |:VimwikiDiaryGenerateLinks|: > + let g:vimwiki_list = [{'path': '~/my_site/', 'auto_diary_index': 1}] + + ------------------------------------------------------------------------------ 12.4 Global Options *vimwiki-global-options* From e6d0678b545b32ab932f58448024a4c9af7690a9 Mon Sep 17 00:00:00 2001 From: EinfachToll Date: Tue, 9 Oct 2018 21:54:02 +0200 Subject: [PATCH 3/6] Add CONTRIBUTING.md --- CONTRIBUTING.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ doc/vimwiki.txt | 9 +-------- 2 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..bffe109 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,46 @@ +# Filing a bug + +Before filing a bug or starting to write a patch, check the latest development version from +https://github.com/vimwiki/vimwiki/tree/dev to see if your problem is already fixed. + +Issues can be filed at https://github.com/vimwiki/vimwiki/issues/ . + +# Creating a pull request +If you want to provide a pull request on GitHub, please start from the `dev` branch, not from the +`master` branch. (Caution, GitHub shows `master` as the default branch from which to start a PR.) + + +# More info for (aspiring) core developers +## Git branching model +- there are two branches with eternal lifetime: + - `dev`: This is where the main development happens. Tasks which are done in one or only a few + commits go here directly. Always try to keep this branch in a working state, that is, if the + task you work on requires multiple commits, make sure intermediate commits don't make Vimwiki + unusable (or at least push these commits at one go). + - `master`: This branches is for released states only. Whenever a reasonable set of changes has + piled up in the `dev` branch, a [release is done](#Preparing a release). After a release, + `dev` has been merged into `master` and `master` got exactly one additional commit in which + the version number in `plugin/vimwiki.vim` is updated. Apart from these commits and the merge + commit from `dev`, nothing happens on `master`. Never should `master` merge into `dev`. When + the users ask, we should recommend this branch for them to use. +- Larger changes which require multiple commits are done in feature branches. They are based on + `dev` and merge into `dev` when the work is done. + +## Preparing a release + +1. `git checkout dev` +2. Update the changelog in the doc, nicely grouped, with a new version number and release date. +3. Update the list of contributors. +4. Update the version number at the top of the doc file. +5. If necessary, update the Readme and the home page. +6. `git checkout master && git merge dev` +7. Update the version number at the top of plugin/vimwiki.vim. +8. Set a tag with the version number in Git: `git tag vX.Y` +9. `git push --tags` +10. In GitHub, go to _Releases_ -> _Draft a new release_ -> choose the tag, convert the changelog from the + doc to markdown and post it there. Make plans to build an automatic converter and immediately + forget this plan. +11. Tell the world. + + +%% vim:tw=99 diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index 629ba9c..fcea9eb 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -2910,14 +2910,7 @@ Your help in making Vimwiki better is really appreciated! Any help, whether it is a spelling correction or a code snippet to patch -- everything is welcomed. -Before filing a bug or starting to write a patch, check the latest development -version from https://github.com/vimwiki/vimwiki/tree/dev to see if your -problem is already fixed. - -Issues can be filed at https://github.com/vimwiki/vimwiki/issues/. - -If you want to provide a pull request on GitHub, please start from the dev -branch, not from the master branch. +See CONTRIBUTING.md for info about how to file bugs etc. ============================================================================== 15. Development *vimwiki-development* From 76f51f1dba3ff3bc5aafcf3538567eb8a11d7f40 Mon Sep 17 00:00:00 2001 From: EinfachToll Date: Mon, 15 Oct 2018 07:36:41 +0200 Subject: [PATCH 4/6] Nicer error message when linking to not registered wiki --- autoload/vimwiki/base.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 3a81b57..12b5ea8 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -174,6 +174,7 @@ function! vimwiki#base#resolve_link(link_text, ...) if link_infos.scheme =~# '\mwiki\d\+' let link_infos.index = eval(matchstr(link_infos.scheme, '\D\+\zs\d\+\ze')) if link_infos.index < 0 || link_infos.index >= vimwiki#vars#number_of_wikis() + let link_infos.index = -1 let link_infos.filename = '' return link_infos endif @@ -268,7 +269,11 @@ function! vimwiki#base#open_link(cmd, link, ...) endif if link_infos.filename == '' - echomsg 'Vimwiki Error: Unable to resolve link!' + if link_infos.index == -1 + echomsg 'Vimwiki Error: No registered wiki ''' . link_infos.scheme . '''.' + else + echomsg 'Vimwiki Error: Unable to resolve link!' + endif return endif From bd88ea968baf4ce779d05f029acb63418a103e51 Mon Sep 17 00:00:00 2001 From: EinfachToll Date: Tue, 16 Oct 2018 22:25:33 +0200 Subject: [PATCH 5/6] Better error handling when opening a file of which a swapfile exists Ref #569 --- autoload/vimwiki/base.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 12b5ea8..cf93366 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -736,6 +736,9 @@ function! vimwiki#base#edit_file(command, filename, anchor, ...) echomsg 'Vimwiki: The current file is modified. Hint: Take a look at' \ ''':h g:vimwiki_autowriteall'' to see how to save automatically.' return + catch /E325:/ + echom 'Vimwiki: Vim couldn''t open the file, probably because a swapfile already exists. See :h E325.' + return endtry endif From 7668985b43bb1d31933532e1a4f5e66329034c29 Mon Sep 17 00:00:00 2001 From: Benjamin Brandtner <37274870+BenjaminBrandtner@users.noreply.github.com> Date: Mon, 22 Oct 2018 20:23:07 +0200 Subject: [PATCH 6/6] Fixed system file handlers for windows Fixes #560 Opening external files containing spaces should now work on cmd and powershell. --- autoload/vimwiki/base.vim | 40 ++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index cf93366..6167060 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -220,22 +220,32 @@ endfunction function! vimwiki#base#system_open_link(url) " handlers function! s:win32_handler(url) - "http://vim.wikia.com/wiki/Opening_current_Vim_file_in_your_Windows_browser - "disable 'shellslash', otherwise the url will be enclosed in single quotes, - "which is problematic - "see https://github.com/vimwiki/vimwiki/issues/54#issuecomment-48011289 - if exists('+shellslash') - let old_ssl = &shellslash - set noshellslash - let url = shellescape(a:url, 1) - let &shellslash = old_ssl + "Disable shellslash for cmd and command.com, but enable for all other shells + "See Issue #560 + if (&shell =~? "cmd") || (&shell =~? "command.com") + + if exists('+shellslash') + let old_ssl = &shellslash + set noshellslash + let url = shellescape(a:url, 1) + let &shellslash = old_ssl + else + let url = shellescape(a:url, 1) + endif + execute 'silent ! start "Title" /B ' . url + else - let url = shellescape(a:url, 1) - endif - if &l:shell ==? "powershell" - execute 'silent ! start ' . a:url - else - execute 'silent ! start "Title" /B ' . a:url + + if exists('+shellslash') + let old_ssl = &shellslash + set shellslash + let url = shellescape(a:url, 1) + let &shellslash = old_ssl + else + let url = shellescape(a:url, 1) + endif + execute 'silent ! start ' . url + endif endfunction function! s:macunix_handler(url)