From 7cfc3eee2291cec5286e554c29100486a47ee27f Mon Sep 17 00:00:00 2001 From: Brennen Bearnes Date: Sun, 22 May 2022 21:55:45 -0600 Subject: [PATCH] diary: use :drop for :VimwikiMakeDiaryNote I find this is one of the more common reasons I wind up with way too many copies of the same file open. This adds 2 new magic numbers to vimwiki#diary#make_note()'s second parameter: 4 for `tab drop` and 5 for `drop`. It also checks to make sure :drop exists in the current build. --- autoload/vimwiki/diary.vim | 7 +++++++ plugin/vimwiki.vim | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/autoload/vimwiki/diary.vim b/autoload/vimwiki/diary.vim index d3c5d74..9ab42d7 100644 --- a/autoload/vimwiki/diary.vim +++ b/autoload/vimwiki/diary.vim @@ -307,6 +307,13 @@ function! vimwiki#diary#make_note(wnum, ...) abort let cmd = 'split' elseif a:1 == 3 let cmd = 'vsplit' + elseif a:1 == 4 + let cmd = 'tab drop' + elseif a:1 == 5 + let cmd = 'drop' + if exists(':drop') + let cmd = 'drop' + endif endif endif if a:0>1 diff --git a/plugin/vimwiki.vim b/plugin/vimwiki.vim index c7728e6..2c9e39d 100644 --- a/plugin/vimwiki.vim +++ b/plugin/vimwiki.vim @@ -362,7 +362,7 @@ command! -count=0 VimwikiDiaryIndex \ call vimwiki#diary#goto_diary_index() command! -count=0 VimwikiMakeDiaryNote - \ call vimwiki#diary#make_note() + \ call vimwiki#diary#make_note(, 5) command! -count=0 VimwikiTabMakeDiaryNote \ call vimwiki#diary#make_note(, 1) @@ -397,7 +397,7 @@ nnoremap