Using VimDiff for file comparison and merge

How to use:

1. From terminal –

$vimdiff file1 file2

2. From Vim –
Open vim and use the following commands if you already have windows with other buffers open in the current tab.

:tabe file1
:vert diffsplit file2

Otherwise:

:e file1
:vert diffsplit file2

– If you have two or three windows open in your current tab and they display the buffers that you want to diff, you might want to turn on diff mode for each window:

:windo diffthis

or, synonym:

windo set diff

– vimdiff will correctly highlight differences inside a line (whole line pink, differing characters red).

– If you load up two files in splits (:vs or :sp), you can do :diffthis on each window and achieve a diff of files that were already loaded in buffers

– turning off:
:diffoff can be used to turn off the diff mode.
issuing :diffoff! which will turn off diff mode for all windows in the current tab page

Keyboard Shortcuts:
do – Get changes from other window into the current window.
dp – Put the changes from current window into the other window.
]c – Jump to the next change.
[c – Jump to the previous change.
Ctrl W + Ctrl W – Switch to the other split window.

Tips on file comparison:

– Sometimes the difference can be a special character – :set list in Vim will show whitespace. End of lines show as ‘$’ and carriage returns usually show as ‘^M’.

– Counting number of characters in a file from bash –

wc -c filename

Useful resources:
1. vimdiff – the cool way to diff for vim users
2. Vim documentation: diff
3. Diffuse -graphical tool for merging and comparing text files

Advertisements

Installing teamviewer on 64-bit Ubuntu 13.10, 14.04 and 16.04

Edited: 10/12/16 Installation instructions for 16.04 added

Edited: 12/5/15 Installation instructions for 14.04 added

64-bit Ubuntu 16.04:

As first, remove the actually broken Teamviewer installation in a terminal () by:

apt-get purge teamviewer

If this does not want to work you can as well do this with dpkg:

dpkg -r --force teamviewer

After that make sure you delete any leftovers from your user directory, i.e. ~/.local/share/teamviewer11, ~/.config/temaviewer and /etc/teamviewer:

rm -r ~/.local/share/teamviewer11
rm -r ~/.config/teamviewer
sudo rm -r /etc/teamviewer

Now that this is out of the way, you do an update and an upgrade:

sudo apt-get update
sudo apt-get dist-upgrade

Then install the following packages:

sudo apt-get install libjpeg62:i386 libxinerama1:i386 libxrandr2:i386 libxtst6:i386 ca-certificates

Now download the Teamviewer package from their website (download-link) and install it:

cd ~/Downloads
sudo dpkg -i teamviewer_11.0.57095_i386.deb

After that it should run start normaly. If you not see teamviewer yet in the dash search check /usr/share/applications directory if the shortcut teamviewer-teamviewer11.desktop exists. If not create one by

sudoedit teamviewer-teamviewer11.desktop

And pasting (ctrl+shift+v) the following in:

[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=TeamViewer 11
Comment=TeamViewer Remote Control Application
Exec=/opt/teamviewer/tv_bin/script/teamviewer
Icon=/opt/teamviewer/tv_bin/desktop/teamviewer.png
Type=Application
Categories=Network;
#Categories=Network;RemoteAccess;

It should show up in dash at least after a reboot. Meanwhile you can firstly start your new installed Teamviewer vie the terminal by:

teamviewer &
disown

Now you can lock it at least already onto your launcher if you wish to do so.

64-bit Ubuntu 14.04 Multiarch:

  1. According to TeamViewer’s web site: “On newer 64-bit DEB-systems with Multiarch-support (Debian 7) teamviewer_linux_x64.deb cannot be installed because the package ia32-libs is not available anymore on these systems. In this case you can use ‘teamviewer_10.0.41499_i386.deb‘ instead.”
  2.  Before installing the app, we need to apply the following commands to avoid “wrong architecture i386” error:
    1. sudo dpkg --add-architecture i386
    2. sudo apt-get update
  3. Now from terminal we ca run teamviewer by applying the ‘teamviewer’ command.

64-bit Ubuntu 13.10:

While trying to install Teamviewer 9 on 64-bit Ubuntu 13.10, you’ll get a dependencies error such as this:

Unpacking teamviewer (from teamviewer_linux_x64.deb) ...
dpkg: dependency problems prevent configuration of teamviewer:
 teamviewer depends on lib32asound2; however:
  Package lib32asound2 is not installed.
 teamviewer depends on lib32z1; however:
  Package lib32z1 is not installed.
 teamviewer depends on ia32-libs; however:
  Package ia32-libs is not installed.

dpkg: error processing teamviewer (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 teamviewer

The problem is that the teamviewer_linux_x64.deb has dependencies problems. It isn’t recommended for distributions using multiarch (Ubuntu 12.04 and later). For said distributions the teamviewer_linux.deb package should be used.

This is noted in the help page of Teamviewer:

Notes to Multiarch:

On newer 64-bit DEB-systems with Multiarch-support (Debian 7)
teamviewer_linux_x64.deb cannot be installed because the package
ia32-libs is not available anymore on these systems.
In this case you can use teamviewer_linux.deb instead.

So, here’s how to install it:

1. Download it

wget http://www.teamviewer.com/download/teamviewer_linux.deb

2. Install gdebi (GDebi can install local .deb packages with automatic dependency resolution (it automatically downloads and installs the required packages).):

sudo apt-get install gdebi

3. In the same directory you download the .deb file just run:

sudo gdebi teamviewer_linux.deb