Use \s, not \W, for whitespace checking.
parent
0bb7284511
commit
01dd3f9f41
|
@ -69,13 +69,13 @@ function! s:SmartJoinLine()
|
||||||
endif
|
endif
|
||||||
" If the character at textwidth is a whitespace character, we should simply
|
" If the character at textwidth is a whitespace character, we should simply
|
||||||
" place a line break at textwidth.
|
" place a line break at textwidth.
|
||||||
if match(l:line[&textwidth - 1], '\W\+') != -1
|
if match(l:line[&textwidth - 1], '\s\+') != -1
|
||||||
exe "normal! r\<CR>"
|
exe "normal! r\<CR>"
|
||||||
return 1
|
return 1
|
||||||
" If the character following textwidth is a whitespace character, we simply
|
" If the character following textwidth is a whitespace character, we simply
|
||||||
" create a line break at this point. Note that :join will already clear out
|
" create a line break at this point. Note that :join will already clear out
|
||||||
" any trailing whitespace between the two lines.
|
" any trailing whitespace between the two lines.
|
||||||
elseif match(l:line[&textwidth], '\W\+') != -1
|
elseif match(l:line[&textwidth], '\s\+') != -1
|
||||||
exe "normal! lr\<CR>"
|
exe "normal! lr\<CR>"
|
||||||
return 1
|
return 1
|
||||||
" The last possibility includes whether or not the current word runs through
|
" The last possibility includes whether or not the current word runs through
|
||||||
|
@ -85,7 +85,7 @@ function! s:SmartJoinLine()
|
||||||
" In this case, we first check if we are at the beginning of the word
|
" In this case, we first check if we are at the beginning of the word
|
||||||
" already (by verifying whether or not there exists a whitespace character
|
" already (by verifying whether or not there exists a whitespace character
|
||||||
" at the position left of the textwidth).
|
" at the position left of the textwidth).
|
||||||
if match(l:line[&textwidth - 2], '\W\+') == -1
|
if match(l:line[&textwidth - 2], '\s\+') == -1
|
||||||
exe "normal! B"
|
exe "normal! B"
|
||||||
endif
|
endif
|
||||||
" Check if WORD goes past textwidth and break at this point if it does.
|
" Check if WORD goes past textwidth and break at this point if it does.
|
||||||
|
|
Loading…
Reference in New Issue