Move some should_use_ function to helper
This commit is contained in:
parent
fb419c288d
commit
2f9147321b
@ -1,7 +1,7 @@
|
|||||||
" EasyMotion - Vim motions on speed!
|
" EasyMotion - Vim motions on speed!
|
||||||
"
|
"
|
||||||
" Author: haya14busa <hayabusa1419@gmail.com>
|
" Author: haya14busa <hayabusa1419@gmail.com>
|
||||||
" Last Change: 25 Jan 2014.
|
" Last Change: 26 Jan 2014.
|
||||||
" Source: https://github.com/haya14busa/vim-easymotion
|
" Source: https://github.com/haya14busa/vim-easymotion
|
||||||
"
|
"
|
||||||
" Original Author: Kim Silkebækken <kim.silkebaekken+vim@gmail.com>
|
" Original Author: Kim Silkebækken <kim.silkebaekken+vim@gmail.com>
|
||||||
@ -603,7 +603,7 @@ function! s:convertRegep(input) "{{{
|
|||||||
let re = s:convertSmartsign(re, a:input)
|
let re = s:convertSmartsign(re, a:input)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let case_flag = s:should_use_smartcase(a:input) ? '\c' : '\C'
|
let case_flag = EasyMotion#helper#should_use_smartcase(a:input) ? '\c' : '\C'
|
||||||
let re = case_flag . re
|
let re = case_flag . re
|
||||||
return re
|
return re
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
@ -662,7 +662,7 @@ function! s:should_use_migemo(char) "{{{
|
|||||||
|
|
||||||
" Skip folded line and check if text include multibyte haracters
|
" Skip folded line and check if text include multibyte haracters
|
||||||
for line in range(first_line, end_line)
|
for line in range(first_line, end_line)
|
||||||
if s:is_folded(line)
|
if EasyMotion#helper#is_folded(line)
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -756,13 +756,6 @@ function! s:GetVisualStartPosition(c_pos, v_start, v_end, search_direction) "{{{
|
|||||||
endif
|
endif
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
" -- Others ------------------------------
|
" -- Others ------------------------------
|
||||||
function! s:is_folded(line) "{{{
|
|
||||||
" Return false if g:EasyMotion_skipfoldedline == 1
|
|
||||||
" and line is start of folded lines
|
|
||||||
return foldclosed(a:line) != -1 &&
|
|
||||||
\ (g:EasyMotion_skipfoldedline == 1 ||
|
|
||||||
\ a:line != foldclosed(a:line))
|
|
||||||
endfunction "}}}
|
|
||||||
function! s:is_cmdwin() "{{{
|
function! s:is_cmdwin() "{{{
|
||||||
return bufname('%') ==# '[Command Line]'
|
return bufname('%') ==# '[Command Line]'
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
@ -1337,7 +1330,7 @@ function! s:EasyMotion(regexp, direction, visualmode, is_inclusive, ...) " {{{
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Skip folded lines {{{
|
" Skip folded lines {{{
|
||||||
if s:is_folded(pos[0])
|
if EasyMotion#helper#is_folded(pos[0])
|
||||||
if search_direction ==# 'b'
|
if search_direction ==# 'b'
|
||||||
keepjumps call cursor(foldclosed(pos[0]-1), 0)
|
keepjumps call cursor(foldclosed(pos[0]-1), 0)
|
||||||
else
|
else
|
||||||
@ -1379,7 +1372,7 @@ function! s:EasyMotion(regexp, direction, visualmode, is_inclusive, ...) " {{{
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Skip folded lines {{{
|
" Skip folded lines {{{
|
||||||
if s:is_folded(pos[0])
|
if EasyMotion#helper#is_folded(pos[0])
|
||||||
" Always forward
|
" Always forward
|
||||||
keepjumps call cursor(foldclosedend(pos[0]+1), 0)
|
keepjumps call cursor(foldclosedend(pos[0]+1), 0)
|
||||||
continue
|
continue
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
" FILE: autoload/EasyMotion/command_line.vim
|
" FILE: autoload/EasyMotion/command_line.vim
|
||||||
" AUTHOR: haya14busa
|
" AUTHOR: haya14busa
|
||||||
" Reference: https://github.com/osyo-manga/vim-over
|
" Reference: https://github.com/osyo-manga/vim-over
|
||||||
" Last Change: 24 Jan 2014.
|
" Last Change: 26 Jan 2014.
|
||||||
" License: MIT license {{{
|
" License: MIT license {{{
|
||||||
" Permission is hereby granted, free of charge, to any person obtaining
|
" Permission is hereby granted, free of charge, to any person obtaining
|
||||||
" a copy of this software and associated documentation files (the
|
" a copy of this software and associated documentation files (the
|
||||||
@ -70,14 +70,6 @@ endfunction "}}}
|
|||||||
function! s:after_input() "{{{
|
function! s:after_input() "{{{
|
||||||
call EasyMotion#highlight#delete_highlight()
|
call EasyMotion#highlight#delete_highlight()
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
function! s:should_use_smartcase(input) "{{{
|
|
||||||
" TODO:
|
|
||||||
if g:EasyMotion_smartcase == 0
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
" return 1 if input didn't match upporcase letter
|
|
||||||
return match(a:input, '\u') == -1
|
|
||||||
endfunction "}}}
|
|
||||||
function! s:offscreen_search(re) "{{{
|
function! s:offscreen_search(re) "{{{
|
||||||
" First: search within visible screen range
|
" First: search within visible screen range
|
||||||
call s:adjust_screen()
|
call s:adjust_screen()
|
||||||
@ -221,7 +213,7 @@ function! EasyMotion#command_line#GetInput(num_strokes, prev, direction) "{{{
|
|||||||
" Incremental routine {{{
|
" Incremental routine {{{
|
||||||
if a:num_strokes == -1
|
if a:num_strokes == -1
|
||||||
let re = input
|
let re = input
|
||||||
let case_flag = s:should_use_smartcase(input) ? '\c' : '\C'
|
let case_flag = EasyMotion#helper#should_use_smartcase(re) ? '\c' : '\C'
|
||||||
let re .= case_flag
|
let re .= case_flag
|
||||||
if g:EasyMotion_inc_highlight "{{{
|
if g:EasyMotion_inc_highlight "{{{
|
||||||
call EasyMotion#highlight#delete_highlight('EasyMotionIncSearch')
|
call EasyMotion#highlight#delete_highlight('EasyMotionIncSearch')
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"=============================================================================
|
"=============================================================================
|
||||||
" FILE: autoload/EasyMotion/helper.vim
|
" FILE: autoload/EasyMotion/helper.vim
|
||||||
" AUTHOR: haya14busa
|
" AUTHOR: haya14busa
|
||||||
" Last Change: 17 Jan 2014.
|
" Last Change: 25 Jan 2014.
|
||||||
" License: MIT license {{{
|
" License: MIT license {{{
|
||||||
" Permission is hereby granted, free of charge, to any person obtaining
|
" Permission is hereby granted, free of charge, to any person obtaining
|
||||||
" a copy of this software and associated documentation files (the
|
" a copy of this software and associated documentation files (the
|
||||||
@ -55,6 +55,21 @@ function! EasyMotion#helper#is_greater_coords(coords1, coords2) "{{{
|
|||||||
endif
|
endif
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
|
function! EasyMotion#helper#is_folded(line) "{{{
|
||||||
|
" Return false if g:EasyMotion_skipfoldedline == 1
|
||||||
|
" and line is start of folded lines
|
||||||
|
return foldclosed(a:line) != -1 &&
|
||||||
|
\ (g:EasyMotion_skipfoldedline == 1 ||
|
||||||
|
\ a:line != foldclosed(a:line))
|
||||||
|
endfunction "}}}
|
||||||
|
function! EasyMotion#helper#should_use_smartcase(input) "{{{
|
||||||
|
if g:EasyMotion_smartcase == 0
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
" return 1 if input didn't match uppercase letter
|
||||||
|
return match(a:input, '\u') == -1
|
||||||
|
endfunction "}}}
|
||||||
|
|
||||||
" Migemo {{{
|
" Migemo {{{
|
||||||
function! EasyMotion#helper#load_migemo_dict() "{{{
|
function! EasyMotion#helper#load_migemo_dict() "{{{
|
||||||
let enc = &l:encoding
|
let enc = &l:encoding
|
||||||
|
Loading…
x
Reference in New Issue
Block a user