Friday, December 19. 2008
Dear lazyweb.
You may remember some years ago I wrote about switching from emacs to vim. The change has been relatively painless, and I'm now an almost 100% fully fledged happy vim user.
However, there is still one thing I sometimes go back to emacs for, and that is its diff-resolution mode.
Here's an example workflow (using emacs): - Try and apply a large patch that generates lots of conflicts. I end up with a bunch of .rej files.
- For each .rej file, I open it in emacs, and can edit, invert, and selectively attempt to apply hunks, as well as jump to where the hunk should apply.
- I work through each hunk until all are somehow resolved, and move to the next file.
So. I understand there's this utility called vimdiff. As far as I can see, it gives you a split window of two files and lets you see (and I presume, act upon) the diff between them.
But can it somehow be coerced into taking a reject file and letting me muck with each hunk selectively until it applies?
I'm in the process of looking at other utilities as well, but I keep going back to emacs (and immediately typing jjjjjjjj when I start it). This is less than ideal, because obviously I am aiming to converge all of my editing of everything into one editor with one set of keybindings. Thus, using vim to not just write code, but also compose email, produce documents, presentations, and hopefully, resolve conflicts.
Please, lazyweb, help me find a way!
Edit: a better description than I can write
Tuesday, April 1. 2008
I tried a couple vim scripts to do bindings to abook and mutt aliases and in general I ended up pretty ragey, until Martyn hacked up something that now works perfectly for me.
First, I apt-get installed lbdb, then vim-addon-manager.
And then vim-addons install lbdbq
And then I configured it to use m_inmail m_abook and m_ldap:
cat ~/.lbdb/lbdbrc
METHODS="m_inmail m_abook m_ldap"
and then configured the ldap plugin to go talk to the Catalyst ldap server.
Then, using Martyn's vim-fu, I did:
in my ~/.muttrc:
set editor="vim -c 'set nohlsearch noshowmatch modelines=0 tw=75 et noai' --cmd 'let mutt_mode=1'"
and this in my ~/.vimrc:
http://paste.dollyfish.net.nz/b3bfc2.
voila! now I have email address tab completion in vim.
Wednesday, June 27. 2007
The one last feature that I'm finding I need emacs for is its amazing fantastic diff mode.
I spend lots of time resolving conflicts from tricky merges and emacs will open foo.php.rej files for me and not only do syntax highlighting (which is currently all I've managed to get vim to do for .rej files), but let me examine each hunk and why it's failing to apply (against foo.php if it exists, else ask for a target file), and change it until it does apply, then delete the hunk and move on to the next one.
So far, I've managed to get vim to open .rej files in diff mode and draw pretty syntax highlighting for me.
I can see that there's something called vimdiff and I've had a quick look through the help for it, but it all seems to be related to having two files, and running it like vimdiff file1.php file1.php. The problem with that is I don't have file2.php, I just have file1.php and file1.php.rej.
I see there's also something called diffpatch, but that seems to want to be in file1.php and apply all of file1.php.rej's hunks to it, and then open vimdiff between file1.php and file1.php.new... which I don't think I want.
The main problem here is that I want to be looking at the perspective of the conflicts and trying to resolve each one and apply it.
There must be a way! Go lazyweb, tell me what it is.
Monday, March 5. 2007
Last night I dreamt that I was inside Richard Stallman's brain. Being inside his brain was exactly like being inside a Community Hall, but in the pitch darkness.
I was stumbling about in this hall in the darkness, and came across one other person. It was someone I work with, who has been helping me with questions related to my trying out vim. Somehow we got into an argument about using vim vs using emacs.
There's so many different ways to think about that. It's rather alarming what happens in my subconscious sometimes.
Thursday, February 1. 2007
I'm compromising.
I got my first job doing web type programming stuff a little over 5 years ago. I was working in a tiny company, working closely with one other programmer. On my first day he helped me install Debian (I had previously tinkered with other distributions but never used Linux exclusively as my desktop machine), gave me a heads up about what software I wanted installed. One of those was emacs.
Up until then I was mostly editor-agnostic. I had had a fleeting introduction to vi (about the first half of the tutorial), certainly not enough to get a good idea about its strength. In (dark distant forgotton) windows land I probably used something like Homesite.
But since I was going to be working with this guy, especially since we were going to be doing peer programming together, I thought it made sense if we used the same editor. So I started using emacs.
Over the years, I've developed a fond affection for emacs. I had a brief love (hate) affair with eclipse when I was doing a lot of Java at another job, but emacs is always the one I go back to. I retained enough vi knowledge to be able to edit config files on the server with only a minimal amount of swearing and beeping. Certainly nothing even approaching efficiency.
But yesterday, I decided to start using vim. Just as a trial period to see if I like it. I'm not definitely switching, I just feel like I should know both before I can honestly keep saying 'emacs FTW!' with such religious fervour.
So far, I'm very slow. I have people at Catalyst who I can bug with questions. I should really be keeping a score sheet, actually. There are things I've found that are much easier in vim, and things I've found that are harder. The ones I've found harder about I've whinged about, until I've been provided a macro to do it for me (example: :e brings up prompt relative to where you started vim, emacs by default relative to current buffer, I now have ,e which is relative to current buffer).
The next thing to do is write a colorscheme. None of the default vim ones make me happy (I like very bland colors, greys and blues), and always ended up writing my own emacs ones.
The real test will come when I have a nasty merge to do. Using the emacs diff mode has saved my life on many a nasty occasion.
|