Mercurial > vim
view runtime/ftplugin/debcontrol.vim @ 11010:c004e17fa36b v8.0.0394
patch 8.0.0394: tabs are not aligned when scrolling horizontally
commit https://github.com/vim/vim/commit/abc39ab642791ae3d22a524516eeedb673a95d9d
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 1 18:04:05 2017 +0100
patch 8.0.0394: tabs are not aligned when scrolling horizontally
Problem: Tabs are not aligned when scrolling horizontally and a Tab doesn't
fit. (Axel Bender)
Solution: Handle a Tab as a not fitting character. (Christian Brabandt)
Also fix that ":redraw" does not scroll horizontally to show the
cursor. And fix the test that depended on the old behavior.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 01 Mar 2017 18:15:04 +0100 |
parents | b9e314fe473f |
children | 167a030448fa |
line wrap: on
line source
" Vim filetype plugin file (GUI menu and folding) " Language: Debian control files " Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> " Former Maintainer: Pierre Habouzit <madcoder@debian.org> " Last Change: 2008-03-08 " URL: http://hg.debian.org/hg/pkg-vim/vim/raw-file/tip/runtime/ftplugin/debcontrol.vim " Do these settings once per buffer if exists("b:did_ftplugin") finish endif let b:did_ftplugin=1 " {{{1 Local settings (do on every load) if exists("g:debcontrol_fold_enable") setlocal foldmethod=expr setlocal foldexpr=DebControlFold(v:lnum) setlocal foldtext=DebControlFoldText() endif setlocal textwidth=0 " Clean unloading let b:undo_ftplugin = "setlocal tw< foldmethod< foldexpr< foldtext<" " }}}1 " {{{1 folding function! s:getField(f, lnum) let line = getline(a:lnum) let fwdsteps = 0 while line !~ '^'.a:f.':' let fwdsteps += 1 let line = getline(a:lnum + fwdsteps) if line == '' return 'unknown' endif endwhile return substitute(line, '^'.a:f.': *', '', '') endfunction function! DebControlFoldText() if v:folddashes == '-' " debcontrol entry fold let type = substitute(getline(v:foldstart), ':.*', '', '') if type == 'Source' let ftext = substitute(foldtext(), ' *Source: *', ' ', '') return ftext . ' -- ' . s:getField('Maintainer', v:foldstart) . ' ' endif let arch = s:getField('Architecture', v:foldstart) let ftext = substitute(foldtext(), ' *Package: *', ' [' . arch . '] ', '') return ftext . ': ' . s:getField('Description', v:foldstart) . ' ' endif return foldtext() endfunction function! DebControlFold(l) " This is for not merging blank lines around folds to them if getline(a:l) =~ '^Source:' return '>1' endif if getline(a:l) =~ '^Package:' return '>1' endif return '=' endfunction " }}}1