Hi Chong, I appreciate you trying to explain how to use a mergetool and using vimdiff as that tool. but it was really hard to follow. I've never used vimdiff at all and the commands and keys used did not advance my knowledge. Thank you for your effort.
I understand where you're coming from. I put a lot of effort into learning vim, took me 3 months before I got comfortable with it. I really wanted to know what the fuss was all about. I love vim because it is so powerful, but not perfect. IDEs (like pycharm) has a lot of nice features, but I find that it doesn't give me as much power as vim. In this video, I assumed you know vim since this was really about vimdiff. I wanted to show how 3-way merges work. When I say 3-way merge, people think they're doing a three-way merge because they see 3 windows (your changes, remote changes, and a working file), but that's just a regular merge. In order to have a 3-way merge, you also need to have the common ancestor window so you can see the changes before your changes and the remote changes. You can try out something like Beyond Compare, which costs $60 which has a 3-way merge (I haven't tried it). What I like about doing diffs in vim, is that I can turn off diff for a particular window or I can add as many windows as I want and include them in the diff. And it's free. If you want to try out vim, you can just type "vimtutor" on the command line and it'll give you the basics on how to move around. My next step was to do ":help" and scroll down to "Getting started" and it has a user manual that goes through the basic features of vim. Once you're done with that you can install some plugins to really get some powe, like fugitive, which will make handling git so much more convenient. I made some videos on vim tips if you want to get a feel for how vim works
+arman1372 I am using "robbyrussell" theme in oh-my-zsh with powerline (github.com/carlcarl/powerline-zsh). You'd also want syntax highlighting on your shell with colorize and zsh-syntax-highlighting. It's also good to have colored-man-pages when you look up man pages.
Nice tutorial. Vim as a mergetool is pretty impossible without knowing how to enable and disable diff highlighting for various panes. The text color change was also new to me. While I was already able to use vimdiff for two files, now I'm willing to give it a whirl as my mergetool.
Hi Chong, If there are 4 files with conflict, and I resolved the first conflict, then how to jump to the next file having comflict. I just did diffu after first was resolved. Now what?
You save and quit out of vim. You can either :wq multiple times (or ZZ), or you can do it all in one go with :wqa. If git sees there are more files to resolve, then it will bring up another vimdiff session.
You can't do it with diffget, but you can just modify the merged text. If they don't conflict, you don't need to do anything because it would include both. If they do conflict, that means that there are some common changes, so you need to figure out how the end result should look like. Using vimdiff 3-way you can see what each change is trying to do. You can't blindly add both since it may change the logic.
You underestimate just how much the user doesn't know. The user isn't able to even navigate between the three different views and highlight/copy/paste the test, and has no idea what you're doing to do that.
I have some other videos that go over some basic stuff about vim. This video is pretty specific with what it's trying to do. It's pretty important because it has some capabilities that other merge conflict programs don't have (like seeing the ancestor version that both diffs). I figured that if anyone is trying to do a merge conflict is already familiar with the basics since it means they're working on a large project with out people.
Chong Kim Thank you for getting back quickly! I was just having difficulty navigating between the windows and then back again to the command line within the vim. I used :diffo l, and then i to edit the working screen. Then, I hit esc to return to the vim command line. I hope I'm explaining correctly. I'm new :^) Thank you so much for this video!
If you're having problems navigating, you might want to try vimtutor on the command line. It will guide you through the basic commands. Then when you have the basics, you can do :help inside vim, and scroll down until you see "USER MANUAL". Follow those links (looks like usr-01.txt) by doing Ctrl-]. I read one or two per day to learn something new every day. BTW, if you're in command-mode, you need to type i to get into insert mode.
to switch between the windows, you can (in normal mode, so press Esc if you aren't) press CTRL+W followed by either some movement (like h, j, k, l) or again CTRL+W
Wow, vimdiff, a GUI diff tool you still have to remember command line stuff for, and looks like DOS applications from 1990. For the hard core living 25 years in the past programmer.
the main think with vim that is a speed, but yeah it can be not easy to start with. well, about 90-s and current merge tool. Generally nothing changed. Problem is not in a tools, problem in person who writing code.
Thank you! You explained all the important points really well. Very useful, and still relevant tutorial even after 9 years.
Hi Chong, I appreciate you trying to explain how to use a mergetool and using vimdiff as that tool. but it was really hard to follow. I've never used vimdiff at all and the commands and keys used did not advance my knowledge. Thank you for your effort.
I understand where you're coming from. I put a lot of effort into learning vim, took me 3 months before I got comfortable with it. I really wanted to know what the fuss was all about. I love vim because it is so powerful, but not perfect. IDEs (like pycharm) has a lot of nice features, but I find that it doesn't give me as much power as vim.
In this video, I assumed you know vim since this was really about vimdiff. I wanted to show how 3-way merges work. When I say 3-way merge, people think they're doing a three-way merge because they see 3 windows (your changes, remote changes, and a working file), but that's just a regular merge. In order to have a 3-way merge, you also need to have the common ancestor window so you can see the changes before your changes and the remote changes. You can try out something like Beyond Compare, which costs $60 which has a 3-way merge (I haven't tried it). What I like about doing diffs in vim, is that I can turn off diff for a particular window or I can add as many windows as I want and include them in the diff. And it's free.
If you want to try out vim, you can just type "vimtutor" on the command line and it'll give you the basics on how to move around. My next step was to do ":help" and scroll down to "Getting started" and it has a user manual that goes through the basic features of vim. Once you're done with that you can install some plugins to really get some powe, like fugitive, which will make handling git so much more convenient. I made some videos on vim tips if you want to get a feel for how vim works
This is great! Would love to see it display the keystrokes tho!
You saved my afternoon! Thanks!
wonderfully explained Chong.. thanks!
thank you mate, very helpfull!!!
Are you using a specific oh my zsh theme? It looks fantastic
+arman1372 I am using "robbyrussell" theme in oh-my-zsh with powerline (github.com/carlcarl/powerline-zsh). You'd also want syntax highlighting on your shell with colorize and zsh-syntax-highlighting. It's also good to have colored-man-pages when you look up man pages.
thank-you very helpful content
Nice tutorial. Vim as a mergetool is pretty impossible without knowing how to enable and disable diff highlighting for various panes. The text color change was also new to me. While I was already able to use vimdiff for two files, now I'm willing to give it a whirl as my mergetool.
Hi Chong, If there are 4 files with conflict, and I resolved the first conflict, then how to jump to the next file having comflict. I just did diffu after first was resolved. Now what?
You save and quit out of vim. You can either :wq multiple times (or ZZ), or you can do it all in one go with :wqa. If git sees there are more files to resolve, then it will bring up another vimdiff session.
Ok thanks I will try that way.
When working with textfiles you sometimes need both changes from LOCAL and REMOTE.
Is it possible to get this done with diffget?
You can't do it with diffget, but you can just modify the merged text. If they don't conflict, you don't need to do anything because it would include both. If they do conflict, that means that there are some common changes, so you need to figure out how the end result should look like. Using vimdiff 3-way you can see what each change is trying to do. You can't blindly add both since it may change the logic.
@@ChongKim Thx!
good job
I'm not getting no working file.
You underestimate just how much the user doesn't know. The user isn't able to even navigate between the three different views and highlight/copy/paste the test, and has no idea what you're doing to do that.
I have some other videos that go over some basic stuff about vim. This video is pretty specific with what it's trying to do. It's pretty important because it has some capabilities that other merge conflict programs don't have (like seeing the ancestor version that both diffs). I figured that if anyone is trying to do a merge conflict is already familiar with the basics since it means they're working on a large project with out people.
Why can't I delete or write into the working window?
Could you give more info? You should be able to. It's probably unrelated to vimdiff.
Chong Kim Thank you for getting back quickly! I was just having difficulty navigating between the windows and then back again to the command line within the vim. I used :diffo l, and then i to edit the working screen. Then, I hit esc to return to the vim command line. I hope I'm explaining correctly. I'm new :^) Thank you so much for this video!
If you're having problems navigating, you might want to try vimtutor on the command line. It will guide you through the basic commands. Then when you have the basics, you can do :help inside vim, and scroll down until you see "USER MANUAL". Follow those links (looks like usr-01.txt) by doing Ctrl-]. I read one or two per day to learn something new every day.
BTW, if you're in command-mode, you need to type i to get into insert mode.
to switch between the windows, you can (in normal mode, so press Esc if you aren't) press CTRL+W followed by either some movement (like h, j, k, l) or again CTRL+W
????????????????????????????????
Wow, vimdiff, a GUI diff tool you still have to remember command line stuff for, and looks like DOS applications from 1990. For the hard core living 25 years in the past programmer.
the main think with vim that is a speed, but yeah it can be not easy to start with.
well, about 90-s and current merge tool. Generally nothing changed. Problem is not in a tools, problem in person who writing code.