From 0b6710b7cb29480208739784219a6d14f0f31d09 Mon Sep 17 00:00:00 2001 From: rhysd Date: Mon, 20 May 2024 19:02:40 +0900 Subject: [PATCH] fix comma is always prepended to `b:match_words` --- plugin/conflict_marker.vim | 13 +++++++------ test/test_matchit.vimspec | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/plugin/conflict_marker.vim b/plugin/conflict_marker.vim index 3fd922a..aa0b8b2 100644 --- a/plugin/conflict_marker.vim +++ b/plugin/conflict_marker.vim @@ -68,12 +68,13 @@ function! s:set_conflict_marker_to_match_words() return endif - let b:match_words = get(b:, 'match_words', '') - \ . printf(',%s:%s:%s:%s', - \ g:conflict_marker_begin, - \ g:conflict_marker_common_ancestors, - \ g:conflict_marker_separator, - \ g:conflict_marker_end) + let group = printf('%s:%s:%s:%s', + \ g:conflict_marker_begin, + \ g:conflict_marker_common_ancestors, + \ g:conflict_marker_separator, + \ g:conflict_marker_end) + + let b:match_words = exists('b:match_words') ? b:match_words . ',' . group : group let b:conflict_marker_match_words_loaded = 1 endfunction diff --git a/test/test_matchit.vimspec b/test/test_matchit.vimspec index ed73504..e62d085 100644 --- a/test/test_matchit.vimspec +++ b/test/test_matchit.vimspec @@ -35,7 +35,7 @@ Describe matchit It defines b:match_words Assert Exists('b:match_words') - Assert Equals(b:match_words, ',^<<<<<<<\+:^|||||||\+:^=======\+$:^>>>>>>>\+') + Assert Equals(b:match_words, '^<<<<<<<\+:^|||||||\+:^=======\+$:^>>>>>>>\+') End It can jump within a conflict marker