Stylistic changes to pass vint tests.
Two non-stylistic errors were also fixed: 1. Removed duplicate function with invalid argument usage 2. Added missing quotes to a function call argument
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
" Description: Utility functions
|
||||
" Home: https://github.com/vimwiki/vimwiki/
|
||||
|
||||
function! vimwiki#u#trim(string, ...)
|
||||
function! vimwiki#u#trim(string, ...) abort
|
||||
let chars = ''
|
||||
if a:0 > 0
|
||||
let chars = a:1
|
||||
@ -15,58 +15,58 @@ endfunction
|
||||
|
||||
|
||||
" Builtin cursor doesn't work right with unicode characters.
|
||||
function! vimwiki#u#cursor(lnum, cnum)
|
||||
function! vimwiki#u#cursor(lnum, cnum) abort
|
||||
exe a:lnum
|
||||
exe 'normal! 0'.a:cnum.'|'
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#u#is_windows()
|
||||
return has("win32") || has("win64") || has("win95") || has("win16")
|
||||
function! vimwiki#u#is_windows() abort
|
||||
return has('win32') || has('win64') || has('win95') || has('win16')
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#u#is_macos()
|
||||
if has("mac") || has("macunix") || has("gui_mac")
|
||||
function! vimwiki#u#is_macos() abort
|
||||
if has('mac') || has('macunix') || has('gui_mac')
|
||||
return 1
|
||||
endif
|
||||
" that still doesn't mean we are not on Mac OS
|
||||
let os = substitute(system('uname'), '\n', '', '')
|
||||
return os == 'Darwin' || os == 'Mac'
|
||||
return os ==? 'Darwin' || os ==? 'Mac'
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#u#count_first_sym(line)
|
||||
function! vimwiki#u#count_first_sym(line) abort
|
||||
let first_sym = matchstr(a:line, '\S')
|
||||
return len(matchstr(a:line, first_sym.'\+'))
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#u#escape(string)
|
||||
function! vimwiki#u#escape(string) abort
|
||||
return escape(a:string, '~.*[]\^$')
|
||||
endfunction
|
||||
|
||||
|
||||
" Load concrete Wiki syntax: sets regexes and templates for headers and links
|
||||
function vimwiki#u#reload_regexes()
|
||||
function! vimwiki#u#reload_regexes() abort
|
||||
execute 'runtime! syntax/vimwiki_'.vimwiki#vars#get_wikilocal('syntax').'.vim'
|
||||
endfunction
|
||||
|
||||
|
||||
" Load syntax-specific functionality
|
||||
function vimwiki#u#reload_regexes_custom()
|
||||
function! vimwiki#u#reload_regexes_custom() abort
|
||||
execute 'runtime! syntax/vimwiki_'.vimwiki#vars#get_wikilocal('syntax').'_custom.vim'
|
||||
endfunction
|
||||
|
||||
|
||||
" Backward compatible version of the built-in function shiftwidth()
|
||||
if exists('*shiftwidth')
|
||||
func vimwiki#u#sw()
|
||||
function! vimwiki#u#sw() abort
|
||||
return shiftwidth()
|
||||
endfunc
|
||||
else
|
||||
func vimwiki#u#sw()
|
||||
return &sw
|
||||
function! vimwiki#u#sw() abort
|
||||
return &shiftwidth
|
||||
endfunc
|
||||
endif
|
||||
|
||||
@ -77,7 +77,7 @@ endif
|
||||
" if a:1==1 then the hasmapto(<Plug>) check is skipped.
|
||||
" this can be used to map different keys to the same <Plug> definition
|
||||
" if a:1==2 then the mapping is not <buffer> specific i.e. it is global
|
||||
function vimwiki#u#map_key(mode, key, plug, ...)
|
||||
function! vimwiki#u#map_key(mode, key, plug, ...) abort
|
||||
if a:0 && a:1 == 2
|
||||
" global mappings
|
||||
if !hasmapto(a:plug) && maparg(a:key, a:mode) ==# ''
|
||||
@ -95,7 +95,7 @@ function vimwiki#u#map_key(mode, key, plug, ...)
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#u#is_codeblock(lnum)
|
||||
function! vimwiki#u#is_codeblock(lnum) abort
|
||||
let syn_g = synIDattr(synID(a:lnum,1,1),'name')
|
||||
if syn_g =~# 'textSnip.*'
|
||||
\ || syn_g =~# 'VimwikiPre.*'
|
||||
|
Reference in New Issue
Block a user