Do not modify foldmethod if the value is expr

It seems calculation of `expr` slows down to complete jump
If &foldmethod == 'expr', maybe there are no need to modify values temporarily
This commit is contained in:
haya14busa 2014-03-17 22:12:49 +09:00
parent 7d930dd734
commit 5302eecff5
2 changed files with 11 additions and 7 deletions

View File

@ -3,7 +3,7 @@
" Author: Kim Silkebækken <kim.silkebaekken+vim@gmail.com>
" haya14busa <hayabusa1419@gmail.com>
" Source: https://github.com/Lokaltog/vim-easymotion
" Last Change: 03 Mar 2014.
" Last Change: 17 Mar 2014.
"=============================================================================
" Saving 'cpoptions' {{{
scriptencoding utf-8
@ -349,7 +349,9 @@ function! s:SaveValue() "{{{
call EasyMotion#helper#VarReset('&readonly', 0)
call EasyMotion#helper#VarReset('&spell', 0)
call EasyMotion#helper#VarReset('&virtualedit', '')
call EasyMotion#helper#VarReset('&foldmethod', 'manual')
if &foldmethod !=# 'expr'
call EasyMotion#helper#VarReset('&foldmethod', 'manual')
endif
endfunction "}}}
function! s:RestoreValue() "{{{
call EasyMotion#helper#VarReset('&scrolloff')
@ -358,7 +360,9 @@ function! s:RestoreValue() "{{{
call EasyMotion#helper#VarReset('&readonly')
call EasyMotion#helper#VarReset('&spell')
call EasyMotion#helper#VarReset('&virtualedit')
call EasyMotion#helper#VarReset('&foldmethod')
if &foldmethod !=# 'expr'
call EasyMotion#helper#VarReset('&foldmethod')
endif
endfunction "}}}
function! s:turn_off_hl_error() "{{{
let s:error_hl = EasyMotion#highlight#capture('Error')

View File

@ -1,7 +1,7 @@
"=============================================================================
" FILE: autoload/EasyMotion/helper.vim
" AUTHOR: haya14busa
" Last Change: 22 Feb 2014.
" Last Change: 17 Mar 2014.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@ -105,8 +105,8 @@ function! EasyMotion#helper#VarReset(var, ...) "{{{
if a:0 == 0 && has_key(s:var_reset, a:var)
" Reset var to original value
" setbufbar( or bufname): '' or '%' can be used for the current buffer
call setbufvar("", a:var, s:var_reset[a:var])
" setbufvar( or bufname): '' or '%' can be used for the current buffer
call setbufvar('%', a:var, s:var_reset[a:var])
elseif a:0 == 1
" Save original value and set new var value
@ -116,7 +116,7 @@ function! EasyMotion#helper#VarReset(var, ...) "{{{
let s:var_reset[a:var] = getbufvar("", a:var)
" Set new var value
call setbufvar("", a:var, new_value)
call setbufvar('%', a:var, new_value)
endif
endfunction "}}}