Update of /cvsroot/vim-latex/vimfiles/ftplugin/tex
In directory sc8-pr-cvs1:/tmp/cvs-serv19146
Modified Files:
smartspace.vim
Log Message:
. b:tw was initialized only when &tw > 0. Remove this restriction. Also
change it so that when &tw was initially zero, then do not do anything at
all.
TODO: there is still a "bug" where smartspace inserts items into the
history list whenever it has to break lines.
Index: smartspace.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/tex/smartspace.vim,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** smartspace.vim 22 Dec 2002 03:01:10 -0000 1.2
--- smartspace.vim 22 Dec 2002 03:15:44 -0000 1.3
***************
*** 3,7 ****
" Author: Carl Muller
" Created: Fri Dec 06 12:00 AM 2002 PST
! " Last Change: Mon Dec 09 12:00 PM 2002 PST
"
" Description:
--- 3,7 ----
" Author: Carl Muller
" Created: Fri Dec 06 12:00 AM 2002 PST
! " Last Change: Sat Dec 21 07:00 PM 2002 PST
"
" Description:
***************
*** 26,32 ****
" However, normal mode actions which rely on 'tw' such as gqap will be
" broken because of the faulty 'tw' setting.
! if &l:tw > 0
! let b:tw = &l:tw
! endif
setlocal tw=0
--- 26,30 ----
" However, normal mode actions which rely on 'tw' such as gqap will be
" broken because of the faulty 'tw' setting.
! let b:tw = &l:tw
setlocal tw=0
***************
*** 40,90 ****
" TexFormatLine: format line retaining $$'s on the same line.
function! s:TexFill(width) " {{{
! if col(".") > a:width
! exe "normal! a##\<Esc>"
! call <SID>TexFormatLine(a:width)
! exe "normal! ?##\<CR>2s\<Esc>"
! endif
endfunction
" }}}
function! s:TexFormatLine(width) " {{{
! let first = strpart(getline(line(".")),0,1)
! normal! $
! let length = col(".")
! let go = 1
! while length > a:width+2 && go
! let between = 0
! let string = strpart(getline(line(".")),0,a:width)
! " Count the dollar signs
! let number_of_dollars = 0
! let evendollars = 1
! let counter = 0
! while counter <= a:width-1
! if string[counter] == '$' && string[counter-1] != '\' " Skip \$.
! let evendollars = 1 - evendollars
! let number_of_dollars = number_of_dollars + 1
! endif
! let counter = counter + 1
! endwhile
! " Get ready to split the line.
! exe "normal! " . (a:width + 1) . "|"
! if evendollars
! " Then you are not between dollars.
! exe "normal! ?\\$\\| \<CR>W"
! else
! " Then you are between dollars.
! normal! F$
! if col(".") == 1 || strpart(getline(line(".")),col(".")-1,1) != "$"
! let go = 0
! endif
! endif
! if first == '$' && number_of_dollars == 1
! let go = 0
! else
! exe "normal! i\<CR>\<Esc>$"
! let first = strpart(getline(line(".")),0,1)
! endif
let length = col(".")
! endwhile
endfunction
--- 38,88 ----
" TexFormatLine: format line retaining $$'s on the same line.
function! s:TexFill(width) " {{{
! if a:width != 0 && col(".") > a:width
! exe "normal! a##\<Esc>"
! call <SID>TexFormatLine(a:width)
! exe "normal! ?##\<CR>2s\<Esc>"
! endif
endfunction
" }}}
function! s:TexFormatLine(width) " {{{
! let first = strpart(getline(line(".")),0,1)
! normal! $
let length = col(".")
! let go = 1
! while length > a:width+2 && go
! let between = 0
! let string = strpart(getline(line(".")),0,a:width)
! " Count the dollar signs
! let number_of_dollars = 0
! let evendollars = 1
! let counter = 0
! while counter <= a:width-1
! if string[counter] == '$' && string[counter-1] != '\' " Skip \$.
! let evendollars = 1 - evendollars
! let number_of_dollars = number_of_dollars + 1
! endif
! let counter = counter + 1
! endwhile
! " Get ready to split the line.
! exe "normal! " . (a:width + 1) . "|"
! if evendollars
! " Then you are not between dollars.
! exe "normal! ?\\$\\| \<CR>W"
! else
! " Then you are between dollars.
! normal! F$
! if col(".") == 1 || strpart(getline(line(".")),col(".")-1,1) != "$"
! let go = 0
! endif
! endif
! if first == '$' && number_of_dollars == 1
! let go = 0
! else
! exe "normal! i\<CR>\<Esc>$"
! let first = strpart(getline(line(".")),0,1)
! endif
! let length = col(".")
! endwhile
endfunction
|