P4 annotates a specific line from vim

I am trying to create a vim command in my .vimrc that (possibly) will use p4 annotate to get the corresponding change list and its data for the current line that I am editing.

I tried to write something myself, but my skills in creating bash / vim scripts are not so great, and I could not find a way to get a list of changes in the current line.

What should such a vim command look like?

+5
source share
1 answer

This should work:
command! Annotate execute '!p4 annotate -cq "%" | sed "' . line(".") . 'q;d" | cut -f1 -d: | xargs p4 describe -s | sed -e ''/Affected files/,$d'''


I wrote something similar in this script that I am currently using.
This is a version of the p4 annotation that takes a file and a string as arguments and pretty prints them (and change lists with a description).

Note that the script depends on other scripts in the repo .

Btw, repo readme contains an example of the corresponding vim command.

+3
source

Source: https://habr.com/ru/post/1200064/


All Articles