Skip to content

Commit

Permalink
fix: Use correct l: and s: scope; Put s:no_trim outside of function
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoomen committed Sep 10, 2019
1 parent 866abd4 commit c9eb506
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions autoload/doge/helpers.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
let s:save_cpo = &cpoptions
set cpoptions&vim

let s:no_trim = (has('nvim') && !has('nvim-0.3.2')) ||
\ (!has('nvim') && (v:version < 800 || !has('patch8.0.1630')))

""
" @public
" @function doge#helpers#count({word} [, {lnum_start}, {lnum_end} ])
Expand Down Expand Up @@ -45,7 +48,6 @@ function! doge#helpers#keyseq(seq) abort
return l:keyseq
endfunction


""
" @public
" Generate a placeholder with optionally a context. Optionally, you can pass the
Expand All @@ -70,12 +72,8 @@ endfunction
" @public
" Helper for compatibility with vim versions without the trim() function.
function! doge#helpers#trim(string) abort
let s:no_trim = (has('nvim') && !has('nvim-0.3.2')) ||
\ (!has('nvim') && (v:version < 800 || !has('patch8.0.1630')))

let s:trim_pattern = '^[ \t\n\r\x0B\xA0]*\(.\{-}\)[ \t\n\r\x0B\xA0]*$'
return s:no_trim
\ ? substitute(a:string, s:trim_pattern, '\1', '')
\ ? substitute(a:string, '^[ \t\n\r\x0B\xA0]*\(.\{-}\)[ \t\n\r\x0B\xA0]*$', '\1', '')
\ : trim(a:string)
endfunction

Expand Down

0 comments on commit c9eb506

Please sign in to comment.