aboutsummaryrefslogtreecommitdiffstats
path: root/bundle
diff options
context:
space:
mode:
authorTeddy Wing2023-12-06 00:03:57 +0100
committerTeddy Wing2023-12-06 00:51:47 +0100
commit086d3d3649a34db36180769efb210f6945770f83 (patch)
tree644d7eadb5cfef0f2e9197f4a15677c4000a5660 /bundle
parent0a2e1a11da108edb13d057feb4ccdfdf20a9fe80 (diff)
downloaddotvim-086d3d3649a34db36180769efb210f6945770f83.tar.bz2
prr-ui: Implement `PrrComment`
The idea is to open the Prr file at the line corresponding to the current line in the real source file. This makes it easy to comment on a line while looking at the source, rather than the diff.
Diffstat (limited to 'bundle')
-rw-r--r--bundle/prr-ui/autoload/prr_ui.vim10
1 files changed, 10 insertions, 0 deletions
diff --git a/bundle/prr-ui/autoload/prr_ui.vim b/bundle/prr-ui/autoload/prr_ui.vim
index 8e35a50..341df3c 100644
--- a/bundle/prr-ui/autoload/prr_ui.vim
+++ b/bundle/prr-ui/autoload/prr_ui.vim
@@ -864,4 +864,14 @@ endfunction
" Comment on the current line.
function! prr_ui#Comment()
+ let current_line = getline('.')
+
+ " Open the existing Prr review file in a new split.
+ sbuffer prr
+
+ call search(current_line)
+
+ " Put the cursor in place to add a comment on the line.
+ call append('.', ['', '', ''])
+ call cursor(line('.') + 2, 0)
endfunction