From fba5997012f8a9de522bbdf7404ad4f9095fca6e Mon Sep 17 00:00:00 2001 From: Kevin O'Neal Date: Sat, 15 Jul 2023 16:39:48 -0500 Subject: [PATCH 1/2] resolve #8 add CloseMarkdownDrawer --- autoload/ui.vim | 10 ++++++++++ ftplugin/markdown.vim | 1 + 2 files changed, 11 insertions(+) diff --git a/autoload/ui.vim b/autoload/ui.vim index 8778860..3096263 100644 --- a/autoload/ui.vim +++ b/autoload/ui.vim @@ -3,6 +3,16 @@ let s:outline = [] let s:file = '' let s:fileLength = 0 +function! ui#CloseMarkdownDrawer() abort + if !ReuseWindow() + " close existing terminal buffer with the same name + let ex_term_buf_no = bufnr(s:drawerName) + if ex_term_buf_no > -1 + execute 'bwipeout! ' . ex_term_buf_no + endif + endif +endfunction + function! ui#OpenMarkdownDrawer() abort let s:file = expand('%:p') let s:fileLength = line('$') diff --git a/ftplugin/markdown.vim b/ftplugin/markdown.vim index 57f1682..be79257 100644 --- a/ftplugin/markdown.vim +++ b/ftplugin/markdown.vim @@ -34,4 +34,5 @@ if !exists('g:markdrawer_to_delete_color') endif command! MarkDrawer :call ui#OpenMarkdownDrawer() +command! MarkDrawerClose :call ui#OpenMarkdownClose() command! -nargs=1 MarkDrawerLevelSet :call ui#MarkDrawerLevelSet() From dd9b6b2b0a6731e727d223cf1c9d028594aac581 Mon Sep 17 00:00:00 2001 From: Kevin O'Neal Date: Fri, 6 Sep 2024 09:37:06 -0500 Subject: [PATCH 2/2] fix --- autoload/ui.vim | 8 +------- ftplugin/markdown.vim | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/autoload/ui.vim b/autoload/ui.vim index 3096263..3848acc 100644 --- a/autoload/ui.vim +++ b/autoload/ui.vim @@ -4,13 +4,7 @@ let s:file = '' let s:fileLength = 0 function! ui#CloseMarkdownDrawer() abort - if !ReuseWindow() - " close existing terminal buffer with the same name - let ex_term_buf_no = bufnr(s:drawerName) - if ex_term_buf_no > -1 - execute 'bwipeout! ' . ex_term_buf_no - endif - endif + execute ':bdelete! ' . bufnr(s:drawerName) endfunction function! ui#OpenMarkdownDrawer() abort diff --git a/ftplugin/markdown.vim b/ftplugin/markdown.vim index be79257..4fdbfc6 100644 --- a/ftplugin/markdown.vim +++ b/ftplugin/markdown.vim @@ -34,5 +34,5 @@ if !exists('g:markdrawer_to_delete_color') endif command! MarkDrawer :call ui#OpenMarkdownDrawer() -command! MarkDrawerClose :call ui#OpenMarkdownClose() +command! MarkDrawerClose :call ui#CloseMarkdownClose() command! -nargs=1 MarkDrawerLevelSet :call ui#MarkDrawerLevelSet()