patching vim

76 views
Skip to first unread message

djp

unread,
Dec 25, 2012, 7:47:57 PM12/25/12
to vimorg...@googlegroups.com
I'm re-installing VimOrganizer on an "new" machine, and I want to get all the goodness, so I'm ready to patch vim.
2 questions;

how?

and

does this work for gvim at the same time?

many thanks,
djp

Herbert Sitz

unread,
Dec 26, 2012, 1:46:01 PM12/26/12
to vimorg...@googlegroups.com
Hi David -- The patch files need to be applied to the Vim source
code, then Vim has to be recompiled. You may not even have the Vim
source code on your system. Assuming you're on Linux, If you don't
have Vim source code on your machine you will want to either install
the Vim source package from your distribution's repositories or get it
directly from Vim's mercurial repository. Then it would be a good
idea to make sure you can do a standard build of Vim. See here for
more info on that:
http://vim.wikia.com/wiki/Building_Vim

You should make sure Vim is compiling with the 'HUGE' feature set
flag, which is mentioned in above link. Also, you would need to
compile twice, once to generate a gvim executable, and second time to
generate a regular (terminal) vim executable. Again, this is
described in the link above..

Once you have Vim source and can compile it you will want to apply a
patch file from /contrib directory of VimOrganizer files. To do this
you will run the 'patch' utility, which provides an automated way of
applying the changes in the patch file to your own Vim source files.
The 'patch' utility should already be on your machine. To apply the
patch you would copy the patch file to the directory where your Vim
source is (probably ends in '/src') and than issue this command from a
terminal in that directory:

patch -i [name of patch file]

This will generate some output that hopefully will include several
'succeeded' messages. If you see any 'FAILED' message then the patch
didn't fully work. You should back up the files in your /src
directory so you can restore if the patch fails. The patch's most
recent version (vim73_390_foldinghighlighting.patch) should work
against recent versions of Vim, though I'm not positive it works
against all the various subversions.

If the patch doesn't work you can look through it and apply the
changes by editing the source code manually. The patch file is
basically just a diff file showing how original Vim source code lines
were changed to add the fold highlighting. You could edit the files
directly to apply the changes, just ten or twelve lines in three
different files are all that need to be changed. If this sounds
daunting you can always send me the three source files and I'll send
you back patched versions. These three files are: (1) eval.c ; (2)
screen.c ; and (3) vim.h .

Hope that helps.

-- Herb

David J Patrick

unread,
Dec 26, 2012, 11:33:10 PM12/26/12
to vimorg...@googlegroups.com
On 26 December 2012 13:46, Herbert Sitz <hes...@gmail.com> wrote:
>  The patch files need to be applied to the Vim source
code, then Vim has to be recompiled.

pulled in the source via hg, check!

You should make sure Vim is compiling with the 'HUGE' feature set
flag,

 
which is mentioned in above link.  Also, you would need to
compile twice, once to generate a gvim executable, and second time to
generate a regular (terminal) vim executable.  Again, this is
described in the link above..

actually, I don't see the reference to compile twice..

Once you have Vim source and can compile it you will want to apply a
patch file from /contrib directory of VimOrganizer files.

patched following instructions: check!
 
 To do this
you will run the 'patch' utility, which provides an automated way of
applying the changes in the patch file to your own Vim source files.
The 'patch' utility should already be on your machine.  To apply the
patch you would copy the patch file to the directory where your Vim
source is (probably ends in '/src') and than issue this command from a
terminal in that directory:

      patch -i [name of patch file] 
If the patch doesn't work you can look through it and apply the
changes by editing the source code manually.

the patch SEEMED to work, that is, ran without error..

BUT after all that, and a
make distclean
.configure == huge and all that
make
sudo make install
and it all ran a metric crapload of stuff, without obvious errors,
folded lines still have the same (non) coloration !

now.. I DIDN'T run it a second time.. nor see the specific instruction in how to do so..
suggestions?
 
Hope that helps.

very helpful, but did not work ;-)
thank you,
djp

David J Patrick

unread,
Dec 26, 2012, 11:40:18 PM12/26/12
to vimorg...@googlegroups.com
but it DID work for gvim..

repeat the whole

make distclean
.configure = huge blabla
make
sudo make install

?

or just some of that?

Herbert Sitz

unread,
Dec 27, 2012, 12:45:59 AM12/27/12
to vimorg...@googlegroups.com
On Wed, Dec 26, 2012 at 8:33 PM, David J Patrick <dava...@gmail.com> wrote:
> On 26 December 2012 13:46, Herbert Sitz <hes...@gmail.com> wrote:
>> which is mentioned in above link. Also, you would need to
>> compile twice, once to generate a gvim executable, and second time to
>> generate a regular (terminal) vim executable. Again, this is
>> described in the link above..
>
>
> actually, I don't see the reference to compile twice..

Sorry, I must have been thinking of something else. Basically, you
need to compile once to make gvim (with --enable-gui option set in
your configure command before your make) and then build a different
time for regular terminal vim (this time I think you want
'--enable-gui=no' in your configure command). If you only want one
or the other you only need to do one build.

> BUT after all that, and a
> make distclean
> .configure == huge and all that
> make
> sudo make install
> and it all ran a metric crapload of stuff, without obvious errors,
> folded lines still have the same (non) coloration !
>
> now.. I DIDN'T run it a second time.. nor see the specific instruction in
> how to do so..
> suggestions?
>

It sounds like you did a successful build of gvim. Not sure why
colors would not be showing up. To test whether you're running a
patched vim you can issue the command:

:echo v:foldhighlight

If you get an error then your vim is unpatched. If it prints a number
in command line (probably 0) then you're running a patched version.

I'm guessing that your running an unpatched version. Not sure why
that would be, I don't know Linux well, build I'm guessing that the
'make install' command could be installing a new instance of Vim
(i.e., copying the files) into a different directory than the Vim you
already had installed. That would mean your'e running you're still
running your old Vim, even though the patched version exists somewhere
on your machine.

One way to check things is to look in the source directory. There
should be a subdirectory (or possibly sibling directory) where the
build process leaves a vim or gvim executable (or maybe it's just left
in /src directory, not sure). 'Make install' then copies that to
wherever installation directory is supposed to be. Running vim or
gvim directly from that src subdirectory won't work perfectly, but you
could at least open the executable there from command line (e.g., be
in that directory and issue command './gvim') to check if that
executable passes the ':echo v:foldhighlight' test. If it does it
means the problem occurs somewhere after the patched Vim is compiled
and has to do with how files are getting "'installed".

- Herb

David J Patrick

unread,
Dec 27, 2012, 1:34:14 AM12/27/12
to vimorg...@googlegroups.com
gvim foldhighlight = 48

console vim, =
E121: Undefined variable: v:foldhighlight
E15: Invalid expression: v:foldhighlight

maybe I've compiled a fine gvim, and now have to compile another non-GUI?
from the same patched source?

Herbert Sitz

unread,
Dec 27, 2012, 1:52:52 AM12/27/12
to vimorg...@googlegroups.com
On Wed, Dec 26, 2012 at 10:34 PM, David J Patrick <dava...@gmail.com> wrote:
> gvim foldhighlight = 48
>
> console vim, =
> E121: Undefined variable: v:foldhighlight
> E15: Invalid expression: v:foldhighlight
>
> maybe I've compiled a fine gvim, and now have to compile another non-GUI?
> from the same patched source?
>

That's what it sounds like to me. But I'm not sure why the fold
highlighting would not be working for org files in gvim. Is that
where you were checking it?

David J Patrick

unread,
Dec 27, 2012, 3:20:49 AM12/27/12
to vimorg...@googlegroups.com
yes, working in gvim!

and .config --enable-gui=no
make
sudo make install

shouldn't trample my new gvim?

Herbert Sitz

unread,
Dec 27, 2012, 12:40:32 PM12/27/12
to vimorg...@googlegroups.com
I'm virtually certain that answer is NO, won't trample.

The result of the 'make' command is that the executable is compiled.
So all that happens after you set --enable-gui=no and do make is that
the new patched console vim executable is created.

'make install' copies that new executable and all of the supporting
"runtime" files to the install directory. I think it would either (1)
leave existing gvim executable in place, or (2) overwrite it with the
patched gvim executable that's already in /src subdir, so either way
your'e fine. But you can also avoid whole 'make install' command if
you want by (1) looking for the patched console vim executable in /src
subdir after the 'make' command, then (2) manally copy just that
patched 'vim' executable to vim install directory (so it overwrites
existing unpatched vim there, no need for 'make install' of all
supporting files again because that was already done first time with
gvim).

-- Herb

djp

unread,
Dec 31, 2012, 3:58:01 PM12/31/12
to vimorg...@googlegroups.com, hes...@gmail.com
On Thursday, 27 December 2012 12:40:32 UTC-5, hsitz wrote:
The result of the 'make' command is that the executable is compiled.
So all that happens after you set --enable-gui=no and do make is that
the new patched console vim executable is created.

Turns out that after the vim compile, a new executable WAS left in the /src/ directory.

because all of the /etc/alternatives pointed to vim.gnome, it wasn't finding the new one.

After copying that new vim to /usr/local/bin, and adjusting the symlinks, all is well!

I had to convince vim to use 256 colors, but that's about it, all patched up!
Thanks copiously for you assistance Herb!
Reply all
Reply to author
Forward
0 new messages