aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2023-12-07 22:24:36 +0100
committerTeddy Wing2023-12-07 22:40:23 +0100
commitfbc9060f8aa60132c3562ff01b79c48686122f51 (patch)
tree6d959b099fca0f886aa50d46f714055aca6de21b
parent96d7056b5cac4c510e44783c2af7b1f50fd3ea00 (diff)
downloaddotvim-fbc9060f8aa60132c3562ff01b79c48686122f51.tar.bz2
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.
-rw-r--r--bundle/prr-ui/autoload/prr_ui.vim10
1 files 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)