diff --git a/autoload/EasyMotion.vim b/autoload/EasyMotion.vim index 7059ef3..53e94a0 100644 --- a/autoload/EasyMotion.vim +++ b/autoload/EasyMotion.vim @@ -358,9 +358,10 @@ function! s:Prompt(message) " {{{ echo a:message . ': ' echohl None endfunction " }}} -function! s:Throw(message) +function! s:Throw(message) "{{{ throw 'EasyMotion: ' . a:message -endfunction +endfunction "}}} + " -- Save & Restore values --------------- function! s:SaveValue() "{{{ if ! s:current.is_search @@ -403,12 +404,14 @@ function! s:turn_on_hl_error() "{{{ unlet s:matchparen_hl endif endfunction "}}} + " -- Draw -------------------------------- function! s:SetLines(lines, key) " {{{ for [line_num, line] in a:lines keepjumps call setline(line_num, line[a:key]) endfor endfunction " }}} + " -- Get characters from user input ------ function! s:GetChar() " {{{ let char = getchar() @@ -578,34 +581,14 @@ function! s:should_use_smartsign(char) "{{{ return 0 endif endfunction "}}} -function! s:convert_t_regexp(re, direction) +function! s:convert_t_regexp(re, direction) "{{{ if a:direction == 0 "forward return '\_.\ze\('.a:re.'\)' elseif a:direction == 1 "backward return '\('.a:re.'\)\@<=\_.' endif -endfunction +endfunction "}}} -function! s:handleEmpty(input, visualmode) "{{{ - " if empty, reselect and return 1 - if empty(a:input) - if ! empty(a:visualmode) - silent exec 'normal! gv' - endif - let s:EasyMotion_is_cancelled = 1 " Cancel - return 1 - endif - return 0 -endfunction "}}} -function! s:load_smart_dict() "{{{ - if exists('g:EasyMotion_use_smartsign_us') - return g:EasyMotion#sticky_table#us - elseif exists('g:EasyMotion_use_smartsign_jp') - return g:EasyMotion#sticky_table#jp - else - return {} - endif -endfunction "}}} " -- Handle Visual Mode ------------------ function! s:GetVisualStartPosition(c_pos, v_start, v_end, search_direction) "{{{ let vmode = mode(1) @@ -652,6 +635,7 @@ function! s:GetVisualStartPosition(c_pos, v_start, v_end, search_direction) "{{{ "}}} endif endfunction "}}} + " -- Others ------------------------------ function! s:is_cmdwin() "{{{ return bufname('%') ==# '[Command Line]' @@ -661,6 +645,26 @@ function! s:should_use_wundo() "{{{ " unless undolist is not empty return ! s:is_cmdwin() && undotree().seq_last != 0 endfunction "}}} +function! s:handleEmpty(input, visualmode) "{{{ + " if empty, reselect and return 1 + if empty(a:input) + if ! empty(a:visualmode) + silent exec 'normal! gv' + endif + let s:EasyMotion_is_cancelled = 1 " Cancel + return 1 + endif + return 0 +endfunction "}}} +function! s:load_smart_dict() "{{{ + if exists('g:EasyMotion_use_smartsign_us') + return g:EasyMotion#sticky_table#us + elseif exists('g:EasyMotion_use_smartsign_jp') + return g:EasyMotion#sticky_table#jp + else + return {} + endif +endfunction "}}} function! EasyMotion#attach_active_autocmd() "{{{ " Reference: https://github.com/justinmk/vim-sneak augroup plugin-easymotion-active @@ -687,7 +691,6 @@ function! EasyMotion#activate(is_visual) "{{{ normal! gv endif endfunction "}}} -"}}} function! s:restore_cursor_state(visualmode) "{{{ " -- Restore original cursor position/selection if ! empty(a:visualmode)