On 29/11/08 00:00, Chris Jones wrote:
>
> Hello vim users:
>
> I currently use a script by Gary Johnson:
> http://vim.sourceforge.net/scripts/script.php?script_id=610
> (based on Alexey Marinichev's ctags.vim script)
>
> to set my status line to include the current C++ function that I'm in on
> the status line. I use this because of really long functions (yes I'm a
> bad progammer), but sometimes just small windows.
>
> I would like something similar for when I'm viewing a .diff file.
> These can get very lengthy and similar to the functions I would like to
> know what specific diff Index: file I'm looking at displayed in the the
> status line.
>
> Does someone have a script or simple solution to what I need?
>
> Much appreciated.
>
> Cheers,
>     Chris

Write a function which returns the name of the current file (if any) 
when viewing a patch. There is not always an "Index:" line, see e.g. 
Bram's patches at ftp://ftp.vim.org/pub/vim/patches/7.2/ with filenames 
7.2.001 to (at the moment) 7.2.055

Then insert in your custom 'statusline' an expression part, for instance

        %{(&ft\ ==\ 'diff')?IndexName():''}

which inserts the return value of the function when 'filetype' is set to 
"diff", the empty string otherwise. (Remember that, as has been done 
above, spaces, double quotes, vertical bars and literal backslashes must 
be backslash-escaped in the argument of a ":set" command.)


Best regards,
Tony.
-- 
Beneath this stone a virgin lies,
For her life held no terrors.
A virgin born, a virgin died:
No hits, no runs, no errors.

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

Reply via email to