From ce776061227c8a10df26e1369d1ed50f074a7302 Mon Sep 17 00:00:00 2001 From: haya14busa Date: Thu, 20 Feb 2014 04:04:09 +0900 Subject: [PATCH] Perform refactoring of marker substitution section --- autoload/EasyMotion.vim | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/autoload/EasyMotion.vim b/autoload/EasyMotion.vim index 95bb8b1..dabb37e 100644 --- a/autoload/EasyMotion.vim +++ b/autoload/EasyMotion.vim @@ -914,20 +914,16 @@ function! s:PromptUser(groups) "{{{ for i in range(marker_limit) if strlen(lines[line_num]['marker']) >= col_num + col_add " Substitute marker character if line length > 0 - if i == 0 - let lines[line_num]['marker'] = substitute( - \ lines[line_num]['marker'], - \ '\%' . (col_num + col_add) . 'c.', - \ marker_chars_first - \ . repeat(' ', target_char_disp_len - 1), - \ '') - else - let lines[line_num]['marker'] = substitute( - \ lines[line_num]['marker'], - \ '\%' . (col_num + col_add) . 'c.', - \ matchstr(marker_chars, '^.\zs.'), - \ '') - endif + let substitute_expr = i == 0 + \ ? marker_chars_first . + \ repeat(' ', target_char_disp_len - 1) + \ : matchstr(marker_chars, '^.\zs.') + + let lines[line_num]['marker'] = substitute( + \ lines[line_num]['marker'], + \ '\%' . (col_num + col_add) . 'c.', + \ substitute_expr, + \ '') else " EOL let lines[line_num]['marker'] .= split(marker_chars, '\zs')[i]