StarWing wrote:
> omg, i just move this function from vimrc to indent file, so i didn't
> observe this function contain a stupid &ft judgement....
> 
> now it's correct.
> 
> " Vim indent file
> " Language:   plain text
> " Maintainer: StarWing
> " Last Change:        2008-11-10 09:40:18
> 
> " Only Load this indent file when no other was loaded.
> if exists("b:did_indent")
>     finish
> endif
> let b:did_indent = 1
> 
> " indent for plain text
> setlocal indentexpr=GetTextIndent()
> 
> " A small indent function for plain text {{{1
> "
> func! GetTextIndent()
>     let cline = line('.')

This should have v:lnum not '.'. It will only work sometimes otherwise,
e.g. not with the = command, I don't think.

Ben.



>     let nline = prevnonblank(cline - 1)
>     if getline(cline - 1) =~ '^\s*$'
>         if getline(nline - 1) =~ '^\s*$'
>             return indent(nline)
>         else
>             return indent(nline) + &sw
>         endif
>     else
>         if getline(nline - 1) =~ '^\s*$'
>             return indent(nline) - &sw
>         else
>             return indent(nline)
>         endif
>     endif
> endfunc
> " }}}
> 
> " vim: ft=vim:fdm=marker:co=84:ts=4:sw=4:sta:et:nu
> 
> 
> > 
> 

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to