From fbc9060f8aa60132c3562ff01b79c48686122f51 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 7 Dec 2023 22:24:36 +0100 Subject: prr-ui: Comment: Exit early when Prr buffer doesn't exist If `PrrStart` hasn't been run yet, we should error and stop execution so we don't insert newlines and start insert mode in the current buffer. Eventually, we should set it up so `PrrStart` is called automatically from `PrrComment` if it hasn't been already. --- bundle/prr-ui/autoload/prr_ui.vim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bundle/prr-ui/autoload/prr_ui.vim b/bundle/prr-ui/autoload/prr_ui.vim index f3a6ea7..1d3246a 100644 --- a/bundle/prr-ui/autoload/prr_ui.vim +++ b/bundle/prr-ui/autoload/prr_ui.vim @@ -866,8 +866,14 @@ endfunction function! prr_ui#Comment() let current_line = getline('.') - " Open the existing Prr review file in a new split. - sbuffer prr + try + " Open the existing Prr review file in a new split. + sbuffer prr + catch + " TODO: Run prr-start. + echoerr 'PrrComment: No Prr buffer available' + return + endtry call search(current_line) -- cgit v1.2.3