[Vim-latex-cvs] vimfiles/ftplugin/tex smartspace.vim,1.5,1.6
Brought to you by:
srinathava,
tmaas
From: <sri...@us...> - 2003-01-06 00:17:55
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/tex In directory sc8-pr-cvs1:/tmp/cvs-serv31219 Modified Files: smartspace.vim Log Message: - removing the time stamp string. It is causing problems in merging from branches etc. - Bug: Pressing a <space> before the second $ of a line like: $aaaaa........$ caused spurious newlines to be inserted after the current line. Cause: Carl knows. Solution: [Cut/paste from Carl Mueller's email about this] I do have an answer for the problem of typing the space before the "$" in $aaaaaaaaaaaaaaaaaaaaa...$. But it does involve making TexFormatLine dependent on 2 new variables, current_line and current_column, which record the line (as a string) and the column number. With that change, it's easy to modify the "if" statement at the end of the function. I also have to modify the function TexFill, to define and pass on the new variables. Index: smartspace.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/tex/smartspace.vim,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** smartspace.vim 5 Jan 2003 04:50:46 -0000 1.5 --- smartspace.vim 6 Jan 2003 00:17:53 -0000 1.6 *************** *** 3,7 **** " Author: Carl Muller " Created: Fri Dec 06 12:00 AM 2002 PST - " Last Change: Sat Jan 04 12:00 AM 2003 PST " " Description: --- 3,6 ---- *************** *** 39,54 **** 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) " {{{ " get the first non-blank character. let first = matchstr(getline('.'), '\S') normal! $ ! let length = col(".") let go = 1 while length > a:width+2 && go --- 38,57 ---- function! s:TexFill(width) " {{{ if a:width != 0 && col(".") > a:width + " For future use, record the current line and the number of the current column + let current_line = getline(".") + let current_column = col(".") exe "normal! a##\<Esc>" ! call <SID>TexFormatLine(a:width,current_line,current_column) ! " Remove ## from the search history. ! exe "normal! ?##\<CR>2s\<Esc>".s:RemoveLastHistoryItem endif endfunction " }}} ! function! s:TexFormatLine(width, current_line, current_column) " {{{ " get the first non-blank character. let first = matchstr(getline('.'), '\S') normal! $ ! let length = col('.') let go = 1 while length > a:width+2 && go *************** *** 67,71 **** endwhile " Get ready to split the line. ! exe "normal! " . (a:width + 1) . "|" if evendollars " Then you are not between dollars. --- 70,74 ---- endwhile " Get ready to split the line. ! exe 'normal! ' . (a:width + 1) . '|' if evendollars " Then you are not between dollars. *************** *** 87,94 **** let length = col(".") endwhile ! if go == 0 && match(getline("."), '.*\$.*\$.*') != -1 ! exe "normal $F$wi\<CR>\<Esc>" endif endfunction " }}} --- 90,103 ---- let length = col(".") endwhile ! if go == 0 && strpart(a:current_line, 0, a:current_column) =~ '.*\$.*\$.*' ! exe "normal! ^f$a\<CR>\<Esc>" ! call <SID>TexFormatLine(a:width, a:current_line, a:current_column) endif endfunction + + " }}} + " s:RemoveLastHistoryItem: removes last search item from search history {{{ + " Description: Execute this string to clean up the search history. + let s:RemoveLastHistoryItem = ':call histdel("/", -1)|let @/=histget("/", -1)' " }}} |