Flatten indent
This commit is contained in:
parent
9812233fac
commit
4eeae613bc
@ -3,18 +3,19 @@
|
|||||||
" Author: Kim Silkebækken <kim.silkebaekken+vim@gmail.com>
|
" Author: Kim Silkebækken <kim.silkebaekken+vim@gmail.com>
|
||||||
" Source repository: https://github.com/Lokaltog/vim-easymotion
|
" Source repository: https://github.com/Lokaltog/vim-easymotion
|
||||||
|
|
||||||
" Saving 'cpoptions' {{{
|
" == Saving 'cpoptions' {{{
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
" }}}
|
" }}}
|
||||||
" Reset {{{
|
" == Reset {{{
|
||||||
function! EasyMotion#reset()
|
function! EasyMotion#reset()
|
||||||
" Reset Migemo Dictionary
|
" Reset Migemo Dictionary
|
||||||
let s:migemo_dicts = {}
|
let s:migemo_dicts = {}
|
||||||
return ""
|
return ""
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
" Motion functions {{{
|
|
||||||
" == Find Motion =========================
|
" == Motion functions {{{
|
||||||
|
" -- Find Motion -------------------------
|
||||||
function! EasyMotion#F(visualmode, direction) " {{{
|
function! EasyMotion#F(visualmode, direction) " {{{
|
||||||
let char = s:GetSearchChar(a:visualmode)
|
let char = s:GetSearchChar(a:visualmode)
|
||||||
|
|
||||||
@ -56,7 +57,7 @@ endfunction "}}}
|
|||||||
|
|
||||||
call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '', mode(1))
|
call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '', mode(1))
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
" == Word Motion =========================
|
" -- Word Motion -------------------------
|
||||||
function! EasyMotion#WB(visualmode, direction) " {{{
|
function! EasyMotion#WB(visualmode, direction) " {{{
|
||||||
call s:EasyMotion('\(\<.\|^$\)', a:direction, a:visualmode ? visualmode() : '', '')
|
call s:EasyMotion('\(\<.\|^$\)', a:direction, a:visualmode ? visualmode() : '', '')
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
@ -69,7 +70,7 @@ endfunction "}}}
|
|||||||
function! EasyMotion#EW(visualmode, direction) " {{{
|
function! EasyMotion#EW(visualmode, direction) " {{{
|
||||||
call s:EasyMotion('\(\S\(\s\|$\)\|^$\)', a:direction, a:visualmode ? visualmode() : '', mode(1))
|
call s:EasyMotion('\(\S\(\s\|$\)\|^$\)', a:direction, a:visualmode ? visualmode() : '', mode(1))
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
" == JK Motion ===========================
|
" -- JK Motion ---------------------------
|
||||||
function! EasyMotion#JK(visualmode, direction) " {{{
|
function! EasyMotion#JK(visualmode, direction) " {{{
|
||||||
if g:EasyMotion_startofline
|
if g:EasyMotion_startofline
|
||||||
call s:EasyMotion('^\(\w\|\s*\zs\|$\)', a:direction, a:visualmode ? visualmode() : '', '')
|
call s:EasyMotion('^\(\w\|\s*\zs\|$\)', a:direction, a:visualmode ? visualmode() : '', '')
|
||||||
@ -78,11 +79,11 @@ endfunction "}}}
|
|||||||
call s:EasyMotion('^.\{,' . prev_column . '}\zs\(.\|$\)', a:direction, a:visualmode ? visualmode() : '', '')
|
call s:EasyMotion('^.\{,' . prev_column . '}\zs\(.\|$\)', a:direction, a:visualmode ? visualmode() : '', '')
|
||||||
endif
|
endif
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
" == Search Motion =======================
|
" -- Search Motion -----------------------
|
||||||
function! EasyMotion#Search(visualmode, direction) " {{{
|
function! EasyMotion#Search(visualmode, direction) " {{{
|
||||||
call s:EasyMotion(@/, a:direction, a:visualmode ? visualmode() : '', '')
|
call s:EasyMotion(@/, a:direction, a:visualmode ? visualmode() : '', '')
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
" == JumpToAnywhere Motion ===============
|
" -- JumpToAnywhere Motion ---------------
|
||||||
function! EasyMotion#JumpToAnywhere(visualmode, direction) " {{{
|
function! EasyMotion#JumpToAnywhere(visualmode, direction) " {{{
|
||||||
if !exists('g:EasyMotion_re_anywhere')
|
if !exists('g:EasyMotion_re_anywhere')
|
||||||
" Anywhere regular expression: {{{
|
" Anywhere regular expression: {{{
|
||||||
@ -103,7 +104,7 @@ endfunction "}}}
|
|||||||
"
|
"
|
||||||
call s:EasyMotion( g:EasyMotion_re_anywhere, a:direction, a:visualmode ? visualmode() : '', '')
|
call s:EasyMotion( g:EasyMotion_re_anywhere, a:direction, a:visualmode ? visualmode() : '', '')
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
" == Line Motion =========================
|
" -- Line Motion -------------------------
|
||||||
function! EasyMotion#SL(visualmode, direction) " {{{
|
function! EasyMotion#SL(visualmode, direction) " {{{
|
||||||
let char = s:GetSearchChar(a:visualmode)
|
let char = s:GetSearchChar(a:visualmode)
|
||||||
|
|
||||||
@ -150,7 +151,7 @@ endfunction "}}}
|
|||||||
let re = s:re_line_flag . line('.') . s:re_line_after
|
let re = s:re_line_flag . line('.') . s:re_line_after
|
||||||
call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '', '')
|
call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '', '')
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
" == Special Motion ======================
|
" -- Special Motion ----------------------
|
||||||
function! EasyMotion#SelectLines() "{{{
|
function! EasyMotion#SelectLines() "{{{
|
||||||
let orig_pos = [line('.'), col('.')]
|
let orig_pos = [line('.'), col('.')]
|
||||||
|
|
||||||
@ -262,7 +263,7 @@ endfunction "}}}
|
|||||||
keepjumps call cursor(orig_pos[0], orig_pos[1])
|
keepjumps call cursor(orig_pos[0], orig_pos[1])
|
||||||
endif
|
endif
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
" == User Motion =========================
|
" -- User Motion -------------------------
|
||||||
function! EasyMotion#User(pattern, visualmode, direction) " {{{
|
function! EasyMotion#User(pattern, visualmode, direction) " {{{
|
||||||
let re = escape(a:pattern, '|')
|
let re = escape(a:pattern, '|')
|
||||||
call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '', mode(1))
|
call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '', mode(1))
|
||||||
@ -274,8 +275,8 @@ endfunction "}}}
|
|||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
" Helper functions {{{
|
" == Helper functions {{{
|
||||||
" Message {{{
|
" -- Message -----------------------------
|
||||||
function! s:Message(message) " {{{
|
function! s:Message(message) " {{{
|
||||||
echo 'EasyMotion: ' . a:message
|
echo 'EasyMotion: ' . a:message
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
@ -284,9 +285,7 @@ endfunction "}}}
|
|||||||
echo a:message . ': '
|
echo a:message . ': '
|
||||||
echohl None
|
echohl None
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
"}}}
|
" -- Save & Restore values ---------------
|
||||||
|
|
||||||
" Save & Restore values {{{
|
|
||||||
function! s:VarReset(var, ...) " {{{
|
function! s:VarReset(var, ...) " {{{
|
||||||
if ! exists('s:var_reset')
|
if ! exists('s:var_reset')
|
||||||
let s:var_reset = {}
|
let s:var_reset = {}
|
||||||
@ -326,9 +325,7 @@ endfunction "}}}
|
|||||||
call s:VarReset('&virtualedit')
|
call s:VarReset('&virtualedit')
|
||||||
call s:VarReset('&foldmethod')
|
call s:VarReset('&foldmethod')
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
"}}}
|
" -- Draw --------------------------------
|
||||||
|
|
||||||
" Draw {{{
|
|
||||||
function! s:SetLines(lines, key) " {{{
|
function! s:SetLines(lines, key) " {{{
|
||||||
if ! filereadable(s:undo_file)
|
if ! filereadable(s:undo_file)
|
||||||
" Try to join changes with previous undo block once
|
" Try to join changes with previous undo block once
|
||||||
@ -338,9 +335,7 @@ endfunction "}}}
|
|||||||
call setline(line_num, line[a:key])
|
call setline(line_num, line[a:key])
|
||||||
endfor
|
endfor
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
"}}}
|
" -- Get characters from user input ------
|
||||||
|
|
||||||
" Get characters from user input {{{
|
|
||||||
function! s:GetChar() " {{{
|
function! s:GetChar() " {{{
|
||||||
let char = getchar()
|
let char = getchar()
|
||||||
|
|
||||||
@ -395,9 +390,7 @@ endfunction "}}}
|
|||||||
|
|
||||||
return char
|
return char
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
"}}}
|
" -- Find Motion Helper ------------------
|
||||||
|
|
||||||
"Find Motion Helper {{{
|
|
||||||
function! s:findMotion(char) "{{{
|
function! s:findMotion(char) "{{{
|
||||||
" Find Motion: S,F,T
|
" Find Motion: S,F,T
|
||||||
let re = escape(a:char, '.$^~\')
|
let re = escape(a:char, '.$^~\')
|
||||||
@ -474,8 +467,7 @@ endfunction "}}}
|
|||||||
throw "Error: ".enc." is not supported. Migemo is made disabled."
|
throw "Error: ".enc." is not supported. Migemo is made disabled."
|
||||||
endif
|
endif
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
"}}}
|
" -- Others ------------------------------
|
||||||
|
|
||||||
" Handle Visual Mode {{{
|
" Handle Visual Mode {{{
|
||||||
function! s:GetVisualStartPosition(c_pos, v_start, v_end, direction) "{{{
|
function! s:GetVisualStartPosition(c_pos, v_start, v_end, direction) "{{{
|
||||||
let vmode = mode(1)
|
let vmode = mode(1)
|
||||||
@ -514,7 +506,6 @@ endfunction "}}}
|
|||||||
"}}}
|
"}}}
|
||||||
return v_pos
|
return v_pos
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! s:is_folded(line) "{{{
|
function! s:is_folded(line) "{{{
|
||||||
" Return false if g:EasyMotion_skipfoldedline == 1
|
" Return false if g:EasyMotion_skipfoldedline == 1
|
||||||
" and line is start of folded lines
|
" and line is start of folded lines
|
||||||
@ -522,19 +513,16 @@ endfunction "}}}
|
|||||||
\ (g:EasyMotion_skipfoldedline == 1 ||
|
\ (g:EasyMotion_skipfoldedline == 1 ||
|
||||||
\ a:line != foldclosed(a:line))
|
\ a:line != foldclosed(a:line))
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
|
" == Grouping algorithms {{{
|
||||||
" }}}
|
|
||||||
" Grouping algorithms {{{
|
|
||||||
let s:grouping_algorithms = {
|
let s:grouping_algorithms = {
|
||||||
\ 1: 'SCTree'
|
\ 1: 'SCTree'
|
||||||
\ , 2: 'Original'
|
\ , 2: 'Original'
|
||||||
\ }
|
\ }
|
||||||
" Single-key/closest target priority tree {{{
|
" -- Single-key/closest target priority tree {{{
|
||||||
" This algorithm tries to assign one-key jumps to all the targets closest to the cursor.
|
" This algorithm tries to assign one-key jumps to all the targets closest to the cursor.
|
||||||
" It works recursively and will work correctly with as few keys as two.
|
" It works recursively and will work correctly with as few keys as two.
|
||||||
function! s:GroupingAlgorithmSCTree(targets, keys)
|
function! s:GroupingAlgorithmSCTree(targets, keys) "{{{
|
||||||
" Prepare variables for working
|
" Prepare variables for working
|
||||||
let targets_len = len(a:targets)
|
let targets_len = len(a:targets)
|
||||||
let keys_len = len(a:keys)
|
let keys_len = len(a:keys)
|
||||||
@ -620,9 +608,9 @@ endfunction "}}}
|
|||||||
|
|
||||||
" Finally!
|
" Finally!
|
||||||
return groups
|
return groups
|
||||||
endfunction
|
endfunction "}}}
|
||||||
" }}}
|
" }}}
|
||||||
" Original {{{
|
" -- Original ---------------------------- {{{
|
||||||
function! s:GroupingAlgorithmOriginal(targets, keys)
|
function! s:GroupingAlgorithmOriginal(targets, keys)
|
||||||
" Split targets into groups (1 level)
|
" Split targets into groups (1 level)
|
||||||
let targets_len = len(a:targets)
|
let targets_len = len(a:targets)
|
||||||
@ -654,7 +642,8 @@ endfunction "}}}
|
|||||||
return groups
|
return groups
|
||||||
endfunction
|
endfunction
|
||||||
" }}}
|
" }}}
|
||||||
" Coord/key dictionary creation {{{
|
|
||||||
|
" -- Coord/key dictionary creation ------- {{{
|
||||||
function! s:CreateCoordKeyDict(groups, ...)
|
function! s:CreateCoordKeyDict(groups, ...)
|
||||||
" Dict structure:
|
" Dict structure:
|
||||||
" 1,2 : a
|
" 1,2 : a
|
||||||
@ -695,10 +684,9 @@ endfunction "}}}
|
|||||||
endfunction
|
endfunction
|
||||||
" }}}
|
" }}}
|
||||||
" }}}
|
" }}}
|
||||||
" Core functions {{{
|
" == Core functions {{{
|
||||||
function! s:PromptUser(groups, allows_repeat, fixed_column) "{{{
|
function! s:PromptUser(groups, allows_repeat, fixed_column) "{{{
|
||||||
|
" -- If only one possible match, jump directly to it {{{
|
||||||
" If only one possible match, jump directly to it {{{
|
|
||||||
let group_values = values(a:groups)
|
let group_values = values(a:groups)
|
||||||
|
|
||||||
if len(group_values) == 1
|
if len(group_values) == 1
|
||||||
@ -707,7 +695,7 @@ endfunction "}}}
|
|||||||
return group_values[0]
|
return group_values[0]
|
||||||
endif
|
endif
|
||||||
" }}}
|
" }}}
|
||||||
" Prepare marker lines {{{
|
" -- Prepare marker lines ---------------- {{{
|
||||||
let lines = {}
|
let lines = {}
|
||||||
let hl_coords = []
|
let hl_coords = []
|
||||||
let hl2_first_coords = [] " Highlight for two characters
|
let hl2_first_coords = [] " Highlight for two characters
|
||||||
@ -776,7 +764,6 @@ endfunction "}}}
|
|||||||
else
|
else
|
||||||
if strlen(lines[line_num]['marker']) > 0
|
if strlen(lines[line_num]['marker']) > 0
|
||||||
" Substitute marker character if line length > 0
|
" Substitute marker character if line length > 0
|
||||||
|
|
||||||
let c = 0
|
let c = 0
|
||||||
while c < target_key_len && c < 2
|
while c < target_key_len && c < 2
|
||||||
if strlen(lines[line_num]['marker']) >= col_num + c
|
if strlen(lines[line_num]['marker']) >= col_num + c
|
||||||
@ -823,7 +810,7 @@ endfunction "}}}
|
|||||||
|
|
||||||
let lines_items = items(lines)
|
let lines_items = items(lines)
|
||||||
" }}}
|
" }}}
|
||||||
" Highlight targets {{{
|
" -- Highlight targets ------------------- {{{
|
||||||
if len(hl_coords) > 0
|
if len(hl_coords) > 0
|
||||||
let target_hl_id = matchadd(g:EasyMotion_hl_group_target, join(hl_coords, '\|'), 1)
|
let target_hl_id = matchadd(g:EasyMotion_hl_group_target, join(hl_coords, '\|'), 1)
|
||||||
endif
|
endif
|
||||||
@ -833,20 +820,17 @@ endfunction "}}}
|
|||||||
if len(hl2_first_coords) > 0
|
if len(hl2_first_coords) > 0
|
||||||
let target_hl2_first_id = matchadd(g:EasyMotion_hl2_first_group_target, join(hl2_first_coords, '\|'), 1)
|
let target_hl2_first_id = matchadd(g:EasyMotion_hl2_first_group_target, join(hl2_first_coords, '\|'), 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
|
" -- Put labels on targets & Get User Input & Restore all {{{
|
||||||
" Save undo tree {{{
|
" Save undo tree {{{
|
||||||
let s:undo_file = tempname()
|
let s:undo_file = tempname()
|
||||||
execute "wundo" s:undo_file
|
execute "wundo" s:undo_file
|
||||||
"}}}
|
"}}}
|
||||||
try
|
try
|
||||||
|
|
||||||
" Set lines with markers
|
" Set lines with markers
|
||||||
call s:SetLines(lines_items, 'marker')
|
call s:SetLines(lines_items, 'marker')
|
||||||
|
|
||||||
redraw
|
redraw
|
||||||
|
|
||||||
" Get target character {{{
|
" Get target character {{{
|
||||||
call s:Prompt('Target key')
|
call s:Prompt('Target key')
|
||||||
|
|
||||||
@ -881,17 +865,18 @@ endfunction "}}}
|
|||||||
endif "}}}
|
endif "}}}
|
||||||
|
|
||||||
redraw
|
redraw
|
||||||
endtry
|
endtry "}}}
|
||||||
|
|
||||||
" Check if we have an input char {{{
|
" -- Check if we have an input char ------ {{{
|
||||||
if empty(char)
|
if empty(char)
|
||||||
throw 'Cancelled'
|
throw 'Cancelled'
|
||||||
endif
|
endif
|
||||||
" }}}
|
" }}}
|
||||||
" Check if the input char is valid {{{
|
" -- Repeat EasyMotion ------------------- {{{
|
||||||
if a:allows_repeat && char == '.'
|
if a:allows_repeat && char == '.'
|
||||||
return g:EasyMotion_old_target
|
return g:EasyMotion_old_target
|
||||||
else
|
endif "}}}
|
||||||
|
" -- Check if the input char is valid ---- {{{
|
||||||
if ! has_key(a:groups, char)
|
if ! has_key(a:groups, char)
|
||||||
throw 'Invalid target'
|
throw 'Invalid target'
|
||||||
endif
|
endif
|
||||||
@ -906,9 +891,7 @@ endfunction "}}}
|
|||||||
" Prompt for new target character
|
" Prompt for new target character
|
||||||
return s:PromptUser(target, a:allows_repeat, a:fixed_column)
|
return s:PromptUser(target, a:allows_repeat, a:fixed_column)
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! s:EasyMotion(regexp, direction, visualmode, mode, ...) " {{{
|
function! s:EasyMotion(regexp, direction, visualmode, mode, ...) " {{{
|
||||||
" For SelectLines(), to highlight previous selected line
|
" For SelectLines(), to highlight previous selected line
|
||||||
let hlcurrent = a:0 >= 1 ? a:1 : 0
|
let hlcurrent = a:0 >= 1 ? a:1 : 0
|
||||||
@ -925,11 +908,11 @@ endfunction "}}}
|
|||||||
let targets = []
|
let targets = []
|
||||||
|
|
||||||
try
|
try
|
||||||
" Reset properties {{{
|
" -- Reset properties -------------------- {{{
|
||||||
" Save original value and set new value
|
" Save original value and set new value
|
||||||
call s:SaveValue()
|
call s:SaveValue()
|
||||||
" }}}
|
" }}}
|
||||||
" Find motion targets {{{
|
" -- Find motion targets ----------------- {{{
|
||||||
" Setup searchpos args {{{
|
" Setup searchpos args {{{
|
||||||
let search_direction = (a:direction >= 1 ? 'b' : '')
|
let search_direction = (a:direction >= 1 ? 'b' : '')
|
||||||
let search_stopline = line(a:direction >= 1 ? 'w0' : 'w$')
|
let search_stopline = line(a:direction >= 1 ? 'w0' : 'w$')
|
||||||
@ -945,6 +928,7 @@ endfunction "}}}
|
|||||||
let v_end = [line("'>"),col("'>")] " visual_end_position
|
let v_end = [line("'>"),col("'>")] " visual_end_position
|
||||||
|
|
||||||
let v_original_pos = s:GetVisualStartPosition(c_pos, v_start, v_end, a:direction)
|
let v_original_pos = s:GetVisualStartPosition(c_pos, v_start, v_end, a:direction)
|
||||||
|
"}}}
|
||||||
|
|
||||||
" Reselect visual text {{{
|
" Reselect visual text {{{
|
||||||
keepjumps call cursor(v_original_pos)
|
keepjumps call cursor(v_original_pos)
|
||||||
@ -979,7 +963,7 @@ endfunction "}}}
|
|||||||
endwhile
|
endwhile
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" Handle direction == 2"{{{
|
" Handle bidirection "{{{
|
||||||
" Reconstruct match dict
|
" Reconstruct match dict
|
||||||
if a:direction == 2
|
if a:direction == 2
|
||||||
if ! empty(a:visualmode)
|
if ! empty(a:visualmode)
|
||||||
@ -1033,7 +1017,7 @@ endfunction "}}}
|
|||||||
let GroupingFn = function('s:GroupingAlgorithm' . s:grouping_algorithms[g:EasyMotion_grouping])
|
let GroupingFn = function('s:GroupingAlgorithm' . s:grouping_algorithms[g:EasyMotion_grouping])
|
||||||
let groups = GroupingFn(targets, split(g:EasyMotion_keys, '\zs'))
|
let groups = GroupingFn(targets, split(g:EasyMotion_keys, '\zs'))
|
||||||
|
|
||||||
" Shade inactive source {{{
|
" -- Shade inactive source --------------- {{{
|
||||||
if g:EasyMotion_do_shade
|
if g:EasyMotion_do_shade
|
||||||
let shade_hl_pos = '\%' . orig_pos[0] . 'l\%'. orig_pos[1] .'c'
|
let shade_hl_pos = '\%' . orig_pos[0] . 'l\%'. orig_pos[1] .'c'
|
||||||
|
|
||||||
@ -1059,19 +1043,19 @@ endfunction "}}}
|
|||||||
endif
|
endif
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
" Prompt user for target group/character"{{{
|
" -- Prompt user for target group/character {{{
|
||||||
let coords = s:PromptUser(groups, allows_repeat, fixed_column)
|
let coords = s:PromptUser(groups, allows_repeat, fixed_column)
|
||||||
let g:EasyMotion_old_target = coords
|
let g:EasyMotion_old_target = coords
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
" Update selection {{{
|
" -- Update selection -------------------- {{{
|
||||||
if ! empty(a:visualmode)
|
if ! empty(a:visualmode)
|
||||||
keepjumps call cursor(orig_pos[0], orig_pos[1])
|
keepjumps call cursor(orig_pos[0], orig_pos[1])
|
||||||
|
|
||||||
exec 'normal! ' . a:visualmode
|
exec 'normal! ' . a:visualmode
|
||||||
endif
|
endif
|
||||||
" }}}
|
" }}}
|
||||||
" Handle operator-pending mode {{{
|
" -- Handle operator-pending mode -------- {{{
|
||||||
if a:mode == 'no'
|
if a:mode == 'no'
|
||||||
" This mode requires that we eat one more
|
" This mode requires that we eat one more
|
||||||
" character to the right if we're using
|
" character to the right if we're using
|
||||||
@ -1083,7 +1067,7 @@ endfunction "}}}
|
|||||||
endif
|
endif
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
" Update cursor position"{{{
|
" -- Update cursor position -------------- {{{
|
||||||
call cursor(orig_pos[0], orig_pos[1])
|
call cursor(orig_pos[0], orig_pos[1])
|
||||||
let mark_save = getpos("'e")
|
let mark_save = getpos("'e")
|
||||||
call setpos("'e", [bufnr('%'), coords[0], coords[1], 0])
|
call setpos("'e", [bufnr('%'), coords[0], coords[1], 0])
|
||||||
@ -1099,7 +1083,7 @@ endfunction "}}}
|
|||||||
" Show exception message
|
" Show exception message
|
||||||
call s:Message(v:exception)
|
call s:Message(v:exception)
|
||||||
|
|
||||||
" Restore original cursor position/selection {{{
|
" -- Restore original cursor position/selection {{{
|
||||||
if ! empty(a:visualmode)
|
if ! empty(a:visualmode)
|
||||||
silent exec 'normal! gv'
|
silent exec 'normal! gv'
|
||||||
keepjumps call cursor(c_pos[0], c_pos[1])
|
keepjumps call cursor(c_pos[0], c_pos[1])
|
||||||
@ -1109,10 +1093,10 @@ endfunction "}}}
|
|||||||
" }}}
|
" }}}
|
||||||
let s:EasyMotion_cancelled = 1
|
let s:EasyMotion_cancelled = 1
|
||||||
finally
|
finally
|
||||||
" Restore properties {{{
|
" -- Restore properties ------------------ {{{
|
||||||
call s:RestoreValue()
|
call s:RestoreValue()
|
||||||
" }}}
|
" }}}
|
||||||
" Remove shading {{{
|
" -- Remove shading ---------------------- {{{
|
||||||
if g:EasyMotion_do_shade && exists('shade_hl_id') && (!fixed_column)
|
if g:EasyMotion_do_shade && exists('shade_hl_id') && (!fixed_column)
|
||||||
call matchdelete(shade_hl_id)
|
call matchdelete(shade_hl_id)
|
||||||
endif
|
endif
|
||||||
@ -1123,10 +1107,11 @@ endfunction "}}}
|
|||||||
endtry
|
endtry
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
"}}}
|
"}}}
|
||||||
" Call Reset {{{
|
|
||||||
|
" == Call Reset {{{
|
||||||
call EasyMotion#reset()
|
call EasyMotion#reset()
|
||||||
"}}}
|
"}}}
|
||||||
" Restore 'cpoptions' {{{
|
" == Restore 'cpoptions' {{{
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
" }}}
|
" }}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user