Reputation: 149963
I know I can select the lines and use something like
:w ! sort | uniq -c
Is there a better solution?
Upvotes: 8
Views: 566
Reputation: 79205
With vimscript it is easy to do that:
if getline(line_number_1) ==# getline(line_number_2)
echo 'hello'
endif
where *line_number_1* and *line_number_2* are integers. You can compute the current line number with line('.')
.
See :help getline()
and help line()
. Broader documentation is help eval.txt
.
Upvotes: 9