diff options
author | Teddy Wing | 2023-12-08 22:04:58 +0100 |
---|---|---|
committer | Teddy Wing | 2023-12-09 00:20:40 +0100 |
commit | 7c18c103fb5ab16abcd834e7a60bbd55ecc44e09 (patch) | |
tree | efb33a53616de60b55b2364e2134222fb5bec702 /bundle/prr-ui/autoload | |
parent | dd6f787ea345e47f2aecb49e07439e688867dc85 (diff) | |
download | dotvim-7c18c103fb5ab16abcd834e7a60bbd55ecc44e09.tar.bz2 |
prr-ui: Automatically `PrrStart` on `PrrComment`
If the Prr session hasn't been started yet, do so automatically when
running `PrrComment`. This lets me comment directly on a line without
having to worry about starting the Prr review beforehand.
Now that I see the code and my earlier TODO, I think I could probably
have made it work without the `s:active` flag. Will have to try removing
it and testing whether that works.
Diffstat (limited to 'bundle/prr-ui/autoload')
-rw-r--r-- | bundle/prr-ui/autoload/prr_ui.vim | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/bundle/prr-ui/autoload/prr_ui.vim b/bundle/prr-ui/autoload/prr_ui.vim index 1d3246a..03d39f5 100644 --- a/bundle/prr-ui/autoload/prr_ui.vim +++ b/bundle/prr-ui/autoload/prr_ui.vim @@ -862,8 +862,37 @@ function! prr_ui#RandomEmoji() endfunction +let s:prr_path = '' +let s:active = 0 + +function! prr_ui#Start() + let s:prr_path = system('prr-start --print') + let s:active = 1 + + return s:prr_path +endfunction + +function! prr_ui#StartInteractive() + let prr_path = prr_ui#Start() + execute 'vsplit ' . prr_path +endfunction + +function! prr_ui#Submit() + update + + !prr-submit + + let s:active = 0 +endfunction + + " Comment on the current line. function! prr_ui#Comment() + if !s:active + let prr_path = prr_ui#Start() + execute 'argadd ' . prr_path + endif + let current_line = getline('.') try |