Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Using vimdiff to merge config changes from dispatch-conf
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
ecatmur
Advocate
Advocate


Joined: 20 Oct 2003
Posts: 3595
Location: Edinburgh

PostPosted: Thu Nov 17, 2005 10:46 pm    Post subject: Using vimdiff to merge config changes from dispatch-conf Reply with quote

dispatch-conf is a great way to manage configuration files, but the default merging program, sdiff, leaves a lot to be desired. Wouldn't it be better to use your favourite editor to merge differences?

Simply place this line:
Code:
merge="vimdiff -c 'saveas %s' -c next -c 'setlocal nomodifiable readonly' -c prev %s %s"

(or
Code:
merge="gvimdiff -f -c 'saveas %s' -c next -c 'setlocal nomodifiable readonly' -c prev %s %s"
to use gvim) in /etc/dispatch-conf.conf, and you will be able to see all the proposed changes and also make changes to the new configuration file.

Note: the left pane will hold the original config file saved as the merge output, so make changes in the left pane and save that pane. To help you remember the right hand pane (containing the new config file) will be marked unmodifiable and read-only.

Use ":wqa" to write and exit.
_________________
No more cruft
dep: Revdeps that work
Using command-line ACCEPT_KEYWORDS?
Back to top
View user's profile Send private message
scooper
n00b
n00b


Joined: 13 Dec 2004
Posts: 32

PostPosted: Fri Nov 18, 2005 5:21 pm    Post subject: Reply with quote

Thanks for the great tip! I assume the diff= line could be replaced with a similar vimdiff command? I'm not familiar with the vimdiff command line options. How would they differ from the ones you used for merge?

Thanks again.
Steve
Back to top
View user's profile Send private message
ecatmur
Advocate
Advocate


Joined: 20 Oct 2003
Posts: 3595
Location: Edinburgh

PostPosted: Fri Nov 18, 2005 5:26 pm    Post subject: Reply with quote

I guess you could use "vimdiff -c 'set nomodifiable readonly' %s %s" (or "gvimdiff -f -c 'set nomodifiable readonly' %s %s")

Personally I use colordiff: "colordiff -Nu %s %s".
_________________
No more cruft
dep: Revdeps that work
Using command-line ACCEPT_KEYWORDS?
Back to top
View user's profile Send private message
gi1242
Tux's lil' helper
Tux's lil' helper


Joined: 29 Jul 2004
Posts: 146

PostPosted: Mon Feb 12, 2007 1:24 am    Post subject: Reply with quote

I've been using this vimdiff trick for a while. Unfortunately after a recent portage update (2.1.2-r9), it doesn't work any more! For some reason I think dispatch-conf doesn't quote it's arguments properly. Namely '-c setreadonly' is seen as two words, not one quoted word.

This causes lots of trouble. Anyone know a work around?

Thanks,

GI
Back to top
View user's profile Send private message
gi1242
Tux's lil' helper
Tux's lil' helper


Joined: 29 Jul 2004
Posts: 146

PostPosted: Wed Feb 14, 2007 7:45 pm    Post subject: Reply with quote

Well it looks like all I had to do was switch to double quotes, and backslash single quote arguments.

GI
Back to top
View user's profile Send private message
mrsteven
Veteran
Veteran


Joined: 04 Jul 2003
Posts: 1938

PostPosted: Thu Feb 15, 2007 12:24 pm    Post subject: Reply with quote

:?: I don't understand... Please post your correct line...
_________________
Unix philosophy: "Do one thing and do it well."
systemd: "Do everything and do it wrong."
Back to top
View user's profile Send private message
gi1242
Tux's lil' helper
Tux's lil' helper


Joined: 29 Jul 2004
Posts: 146

PostPosted: Thu Feb 15, 2007 7:18 pm    Post subject: Reply with quote

mrsteven wrote:
:?: I don't understand... Please post your correct line...

Code:
merge="vimdiff -c \'saveas %s\' -c next -c \'setlocal nomodifiable readonly\' -c prev %s %s"
Back to top
View user's profile Send private message
mrsteven
Veteran
Veteran


Joined: 04 Jul 2003
Posts: 1938

PostPosted: Fri Feb 16, 2007 11:09 am    Post subject: Reply with quote

Ah, thank you very much! :)
_________________
Unix philosophy: "Do one thing and do it well."
systemd: "Do everything and do it wrong."
Back to top
View user's profile Send private message
lkraav
Tux's lil' helper
Tux's lil' helper


Joined: 13 Oct 2004
Posts: 129
Location: Estonia

PostPosted: Sat Apr 23, 2011 10:14 pm    Post subject: Reply with quote

is anyone noticing that vimdiff drops out of diff mode when you give :next command to it? i'm running 7.3.50.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum