Fix: #891 Table Pressing <Enter> autosets tw<-0
Issue: Pressing <Enter> in insert mode in table breaks line wrapping #891
This commit is contained in:
parent
19bfe93ef3
commit
dfc5344d0c
@ -15,9 +15,6 @@ endif
|
||||
let g:loaded_vimwiki_tbl_auto = 1
|
||||
|
||||
|
||||
let s:textwidth = &textwidth
|
||||
|
||||
|
||||
function! s:rxSep() abort
|
||||
return vimwiki#vars#get_syntaxlocal('rxTableSep')
|
||||
endfunction
|
||||
@ -679,6 +676,9 @@ function! vimwiki#tbl#format(lnum, ...) abort
|
||||
return
|
||||
endif
|
||||
|
||||
" Backup textwidth
|
||||
let textwidth = &textwidth
|
||||
|
||||
let depth = a:0 == 1 ? a:1 : 0
|
||||
|
||||
if a:0 == 2
|
||||
@ -704,7 +704,8 @@ function! vimwiki#tbl#format(lnum, ...) abort
|
||||
endif
|
||||
endfor
|
||||
|
||||
let &textwidth = s:textwidth
|
||||
" Restore user textwidth
|
||||
let &textwidth = textwidth
|
||||
endfunction
|
||||
|
||||
|
||||
@ -753,20 +754,6 @@ function! vimwiki#tbl#align_or_cmd(cmd, ...) abort
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimwiki#tbl#reset_tw(lnum) abort
|
||||
if !vimwiki#u#ft_is_vw()
|
||||
return
|
||||
endif
|
||||
let line = getline(a:lnum)
|
||||
if !s:is_table(line)
|
||||
return
|
||||
endif
|
||||
|
||||
let s:textwidth = &textwidth
|
||||
let &textwidth = 0
|
||||
endfunction
|
||||
|
||||
|
||||
" TODO: move_column_left and move_column_right are good candidates to be refactored.
|
||||
function! vimwiki#tbl#move_column_left() abort
|
||||
|
||||
|
@ -331,7 +331,6 @@ augroup vimwiki
|
||||
" autowrap tables.
|
||||
if vimwiki#vars#get_global('table_auto_fmt')
|
||||
exe 'autocmd InsertLeave '.pat.' call vimwiki#tbl#format(line("."), 2)'
|
||||
exe 'autocmd InsertEnter '.pat.' call vimwiki#tbl#reset_tw(line("."))'
|
||||
endif
|
||||
if vimwiki#vars#get_global('folding') =~? ':quick$'
|
||||
" from http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text
|
||||
|
Loading…
Reference in New Issue
Block a user