mirror of
https://github.com/preservim/vim-pencil.git
synced 2025-11-13 04:13:46 -05:00
Use robust comparison operators
This commit is contained in:
@@ -248,7 +248,7 @@ fun! pencil#init(...) abort
|
|||||||
" flag to suspend autoformat for next Insert
|
" flag to suspend autoformat for next Insert
|
||||||
" optional user-defined mapping
|
" optional user-defined mapping
|
||||||
if exists('g:pencil#map#suspend_af') &&
|
if exists('g:pencil#map#suspend_af') &&
|
||||||
\ g:pencil#map#suspend_af != ''
|
\ g:pencil#map#suspend_af !=# ''
|
||||||
exe 'no <buffer> <silent> ' . g:pencil#map#suspend_af . ' :let b:pencil_suspend_af=1<CR>'
|
exe 'no <buffer> <silent> ' . g:pencil#map#suspend_af . ' :let b:pencil_suspend_af=1<CR>'
|
||||||
en
|
en
|
||||||
|
|
||||||
@@ -478,7 +478,7 @@ endf
|
|||||||
fun! s:doOne(item) abort
|
fun! s:doOne(item) abort
|
||||||
let l:matches = matchlist(a:item, '^\([a-z]\+\)=\([a-zA-Z0-9_\-.]\+\)$')
|
let l:matches = matchlist(a:item, '^\([a-z]\+\)=\([a-zA-Z0-9_\-.]\+\)$')
|
||||||
if len(l:matches) > 1
|
if len(l:matches) > 1
|
||||||
if l:matches[1] =~ 'textwidth\|tw'
|
if l:matches[1] =~# 'textwidth\|tw'
|
||||||
let l:tw = str2nr(l:matches[2])
|
let l:tw = str2nr(l:matches[2])
|
||||||
if l:tw > b:max_textwidth
|
if l:tw > b:max_textwidth
|
||||||
let b:max_textwidth = l:tw
|
let b:max_textwidth = l:tw
|
||||||
@@ -511,7 +511,7 @@ fun! s:doModelines() abort
|
|||||||
let l:lines={ }
|
let l:lines={ }
|
||||||
call map(filter(getline(1, &modelines) +
|
call map(filter(getline(1, &modelines) +
|
||||||
\ getline(line("$") - &modelines, "$"),
|
\ getline(line("$") - &modelines, "$"),
|
||||||
\ 'v:val =~ ":"'), 'extend(l:lines, { v:val : 0 } )')
|
\ 'v:val =~# ":"'), 'extend(l:lines, { v:val : 0 } )')
|
||||||
for l:line in keys(l:lines)
|
for l:line in keys(l:lines)
|
||||||
call s:doModeline(l:line)
|
call s:doModeline(l:line)
|
||||||
endfo
|
endfo
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ fun! PencilMode()
|
|||||||
if b:pencil_wrap_mode ==# s:WRAP_MODE_SOFT
|
if b:pencil_wrap_mode ==# s:WRAP_MODE_SOFT
|
||||||
return get(g:pencil#mode_indicators, 'soft', 'S')
|
return get(g:pencil#mode_indicators, 'soft', 'S')
|
||||||
elsei b:pencil_wrap_mode ==# s:WRAP_MODE_HARD
|
elsei b:pencil_wrap_mode ==# s:WRAP_MODE_HARD
|
||||||
if &fo =~ 'a'
|
if &fo =~# 'a'
|
||||||
return get(g:pencil#mode_indicators, 'auto', 'A')
|
return get(g:pencil#mode_indicators, 'auto', 'A')
|
||||||
el
|
el
|
||||||
return get(g:pencil#mode_indicators, 'hard', 'H')
|
return get(g:pencil#mode_indicators, 'hard', 'H')
|
||||||
|
|||||||
Reference in New Issue
Block a user