From e9d8c396089c56d39ae374f29d3a6f45b63420fc Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Mon, 30 Sep 2013 12:03:06 +0200 Subject: [PATCH] Update coffee, html and latex --- compiler/coffee.vim | 4 ++-- ftplugin/latex-box/motion.vim | 39 +++++++++++++++++++---------------- indent/html.vim | 18 ++++++++++++++++ 3 files changed, 41 insertions(+), 20 deletions(-) diff --git a/compiler/coffee.vim b/compiler/coffee.vim index f521ca9..a70fa64 100644 --- a/compiler/coffee.vim +++ b/compiler/coffee.vim @@ -27,8 +27,8 @@ function! s:GetMakePrg() \ ' -c' . \ ' ' . b:coffee_litcoffee . \ ' ' . g:coffee_make_options . - \ ' ' . fnameescape(expand('%')) . - \ ' $*' + \ ' $*' . + \ ' ' . fnameescape(expand('%')) endfunction " Set `makeprg` and return 1 if coffee is still the compiler, else return 0. diff --git a/ftplugin/latex-box/motion.vim b/ftplugin/latex-box/motion.vim index fea4e5f..7248175 100644 --- a/ftplugin/latex-box/motion.vim +++ b/ftplugin/latex-box/motion.vim @@ -312,7 +312,7 @@ function! s:ReadTOC(auxfile, texfile, ...) if included != '' " append the input TOX to `toc` and `fileindices` let newaux = prefix . '/' . included - let newtex = fnamemodify(fnamemodify(newaux, ':t:r') . '.tex', ':p') + let newtex = fnamemodify(newaux, ':r') . '.tex' call s:ReadTOC(newaux, newtex, toc, fileindices) continue endif @@ -441,23 +441,26 @@ function! s:FindClosestSection(toc, fileindices) endif let imax = len(a:fileindices[file]) - let imin = 0 - while imin < imax - 1 - let i = (imax + imin) / 2 - let tocindex = a:fileindices[file][i] - let entry = a:toc[tocindex] - let titlestr = entry['text'] - let titlestr = escape(titlestr, '\') - let titlestr = substitute(titlestr, ' ', '\\_\\s\\+', 'g') - let [lnum, cnum] = searchpos('\\' . entry['level'] . '\_\s*{' . titlestr . '}', 'nW') - if lnum - let imax = i - else - let imin = i - endif - endwhile - - return a:fileindices[file][imin] + if imax > 0 + let imin = 0 + while imin < imax - 1 + let i = (imax + imin) / 2 + let tocindex = a:fileindices[file][i] + let entry = a:toc[tocindex] + let titlestr = entry['text'] + let titlestr = escape(titlestr, '\') + let titlestr = substitute(titlestr, ' ', '\\_\\s\\+', 'g') + let [lnum, cnum] = searchpos('\\' . entry['level'] . '\_\s*{' . titlestr . '}', 'nW') + if lnum + let imax = i + else + let imin = i + endif + endwhile + return a:fileindices[file][imin] + else + return 0 + endif endfunction let s:ConvBackPats = map([ diff --git a/indent/html.vim b/indent/html.vim index a4cd0c4..6c30555 100644 --- a/indent/html.vim +++ b/indent/html.vim @@ -331,6 +331,24 @@ fun! HtmlIndentGet(lnum) let ind = ind - 1 endif + if getline(a:lnum) =~ '' + let block_start = search('^'.repeat(' ', ind * &sw).'\S' , 'bnW') + let prev_tag = search('', 'bW', block_start) + let prev_closetag = search('', 'W', a:lnum) + if prev_tag && !prev_closetag + let ind = ind - 1 + endif + endif + + if getline(a:lnum) =~ '' + let block_start = search('^'.repeat(' ', ind * &sw).'\S' , 'bnW') + let prev_tag = search('', 'bW', block_start) + let prev_closetag = search('', 'W', a:lnum) + if prev_tag && !prev_closetag + let ind = ind - 1 + endif + endif + if restore_ic == 0 setlocal noic endif