How to check if two lines are identical in vim?

I know that I can select rows and use something like

:w ! sort | uniq -c 

Is there a better solution?

+8
vim line
source share
1 answer

With vimscript, this is easy to do:

 if getline(line_number_1) ==# getline(line_number_2) echo 'hello' endif 

where * line_number_1 * and * line_number_2 * are integers. You can calculate the current line number using line('.') .

See :help getline() and help line() . More complete documentation help eval.txt .

+9
source share

All Articles