aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Frederick <noah@noahfrederick.com>2016-02-16 17:58:21 -0500
committerNoah Frederick <noah@noahfrederick.com>2016-03-05 09:12:54 -0500
commit42e710eacb996cb054ffba020133c1132d47889a (patch)
tree6553e3a892e98e644d838dcc9afceeb088718e65
parent9fb9d2929fb9913105efaad8af6b3ecfbeaf52dc (diff)
downloadrneovim-42e710eacb996cb054ffba020133c1132d47889a.tar.gz
rneovim-42e710eacb996cb054ffba020133c1132d47889a.tar.bz2
rneovim-42e710eacb996cb054ffba020133c1132d47889a.zip
man.vim: clean up regex/string comparisons
- Explicitly specify case sensitivity when comparing strings - Clean up unnecessarily complex `if` statements
-rw-r--r--runtime/autoload/man.vim13
1 files changed, 4 insertions, 9 deletions
diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim
index f702c39826..f0e9af01a2 100644
--- a/runtime/autoload/man.vim
+++ b/runtime/autoload/man.vim
@@ -51,7 +51,7 @@ function man#get_page(...) abort
if winnr() > 1
exe "norm! " . thiswin . "\<C-W>w"
while 1
- if &filetype == 'man'
+ if &filetype ==# 'man'
break
endif
wincmd w
@@ -75,10 +75,10 @@ function man#get_page(...) abort
endif
silent exec 'r!/usr/bin/man '.s:cmd(sect, page).' | col -b'
" Remove blank lines from top and bottom.
- while getline(1) =~ '^\s*$'
+ while getline(1) =~# '^\s*$'
silent keepjumps norm! gg"_dd
endwhile
- while getline('$') =~ '^\s*$'
+ while getline('$') =~# '^\s*$'
silent keepjumps norm! G"_dd
endwhile
setlocal nomodified
@@ -133,10 +133,5 @@ endfunction
function s:find_page(sect, page) abort
let where = system('/usr/bin/man '.s:man_find_arg.' '.s:cmd(a:sect, a:page))
- if where !~ "^/"
- if matchstr(where, " [^ ]*$") !~ "^ /"
- return 0
- endif
- endif
- return 1
+ return (where =~# '^ */')
endfunction