Reputation: 471
I'm comparing a couple files for differences using vimdiff
. In this case, one file has 11 lines of comments describing the file whereas the other has no comment lines. I was surprised that vimdiff
(rather, the underlying 'diff' ) did not accurately assign which lines to compare, so every line is different. In this case, line 12 from the first file should be compared to line 1 from the second.
Question: Is there a way to adjust which lines vimdiff
(or the underlying diff
) compares (e.g., shift down by 12), without modifying the files?
Really appreciate your help.
Here are initial lines from the files:
File 1 (includes comments)
# This table shows the intersection of dark by MAPQ regions by a gene annotation gff3, showing where dark by MAPQ regions fall within gene body
# chrom : Chromosome of dark by MAPQ region
# region_start : start position of dark by MAPQ region within gene-body element
# region_end : end position of dark by MAPQ region within gene-body element
# gene_body_id : ID of gene body element that contains this dark by MAPQ region
# region_type : genebody element type (e.g. exon, intron, UTR, etc.)
# biotype : GENCODE biotype of gene that contains this dark by MAPQ reigon
# gene_body_chrom : Chromosome of the genebody element
# gene_body_start : start position of the genebody element
# gene_body_end : end position of the genebody element
#chrom start end gene_body_id region_type biotype gene_body_chrom gene_body_start gene_body_end
1 11869 12227 DDX11L1_1 exon transcribed_unprocessed_pseudogene 1 11869 12227
1 12228 12611 DDX11L1_intron_1 intron transcribed_unprocessed_pseudogene 1 12228 12611
1 12612 12721 DDX11L1_2 exon transcribed_unprocessed_pseudogene 1 12612 12721
1 12722 12751 DDX11L1_intron_2 intron transcribed_unprocessed_pseudogene 1 12722 12973
1 12861 12973 DDX11L1_intron_2 intron transcribed_unprocessed_pseudogene 1 12722 12973
1 13191 13219 DDX11L1_intron_3 intron transcribed_unprocessed_pseudogene 1 13053 13219
File 2 (does not include comments)
chr1 11869 12227 DDX11L1_1 exon transcribed_unprocessed_pseudogene chr1 11869 12227
chr1 12228 12611 DDX11L1_intron_1 intron transcribed_unprocessed_pseudogene chr1 12228 12611
chr1 12612 12721 DDX11L1_2 exon transcribed_unprocessed_pseudogene chr1 12612 12721
chr1 12722 12752 DDX11L1_intron_2 intron transcribed_unprocessed_pseudogene chr1 12722 12973
chr1 12861 12973 DDX11L1_intron_2 intron transcribed_unprocessed_pseudogene chr1 12722 12973
chr1 13191 13219 DDX11L1_intron_3 intron transcribed_unprocessed_pseudogene chr1 13053 13219
Upvotes: 1
Views: 1235
Reputation: 439
I also have the same problem so I developed https://github.com/rickhowe/spotdiff.vim. You have to specify the line range but can partially compare any line between 2 files or even in a single file. You can also select visual area and text object to compare.
Upvotes: 1
Reputation: 471
I came up with a solution for this situation using tail
but would appreciate solutions where I can modify it directly in vimdiff
.
# Skip the first 12 lines from file_1
vimdiff <(tail -n +12 file_1) file_2
Upvotes: 0