aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundle/prr-ui/autoload/prr_ui.vim29
-rw-r--r--bundle/prr-ui/plugin/prr_ui.vim4
2 files changed, 31 insertions, 2 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
diff --git a/bundle/prr-ui/plugin/prr_ui.vim b/bundle/prr-ui/plugin/prr_ui.vim
index 892a774..665f65b 100644
--- a/bundle/prr-ui/plugin/prr_ui.vim
+++ b/bundle/prr-ui/plugin/prr_ui.vim
@@ -3,6 +3,6 @@ if exists('g:loaded_prr_ui')
endif
let g:loaded_prr_ui = 1
-command! PrrStart execute 'vsplit ' . system('prr-start --print')
-command! PrrSubmit update | !prr-submit
+command! PrrStart call prr_ui#StartInteractive()
+command! PrrSubmit call prr_ui#Submit()
command! PrrComment call prr_ui#Comment()