I am using Android Studio 2.2.3 & Mercurial Distributed SCM (version 4.0.1), running on MacOS Sierra 10.12.3.
I am using Hg command base client. hg diff shows:
Here is my ~/.hgrc
[extensions]
purge=
color =
pager =
[pager]
pager = LESS='FRSXQ' less
quiet = True
attend = outgoing,incoming,diff,status,log,qdiff,blame,annotate,pdiff,glog
Any config I should add to avoid showing ^M in diff? In Android Studio or Mercurial config? Thanks.
The answer depends a bit on what you want:
a) Is it only that you do not want to see whitspace / eol character changes so that you can better review a diff? Then use the appropriate flag to the diff command: hg diff -b shows the diff while ignoreing whitespace changes including EOL.
b) If you generally have that problem and want to have some repository-side aid in messing with the EOL characters: make use of the EOL extension. However, the much more advisable approach is to use properly configured editors and maybe repository hook which rejects files with the wrong EOL characters.
Use the EOL extension. Read carefully https://www.mercurial-scm.org/wiki/EolExtension before blindly enabling it.
Related
I have installed xiki as per the instructions in https://github.com/trogdoro/xiki. I have read that Xiki provides partial support for Vi. I want to know how to setup Vim with Xiki. Can you point me in the right direction?
In searching for the answer to this, I encountered this question. I have now found it on my own:
The vim folder got moved. Here is the folder for vim in the Xiki github:
https://github.com/trogdoro/xiki/tree/master/misc/vim
here is the status report:
https://github.com/trogdoro/xiki/blob/master/misc/vim/vim_status.notes
and here is how it says to enable Xiki in Vim:
- 1) Add this line, and then restart vim
~/.vimrc
| let $XIKI_DIR = "[xiki dir]"
| source [xiki dir]/etc/vim/xiki.vim
- 2) Type "ip" on a blank line and double-click on it
Having no experience with xiki, I just googled this: https://github.com/trogdoro/xiki/tree/master/etc/vim. And here is some status report: https://github.com/trogdoro/xiki/blob/master/etc/vim/vim_status.notes. Hope that helps!
From the help page section encoding-values:
Supported 'encoding' values are: *encoding-values*
1 latin1 8-bit characters (ISO 8859-1, also used for cp1252)
1 iso-8859-n ISO_8859 variant (n = 2 to 15)
[...]
Somehow, it seems that ISO-8859-16 / latin10 was left out? I fail to read files with that encoding correctly. Am I overlooking anything? If not, can I somehow add support for this character encoding to vim through a plugin or so?
On Windows, my version of Vim is compiled with +iconv/dyn. According to the Vim documentation:
On MS-Windows Vim can be compiled with the +iconv/dyn feature. This
means Vim will search for the "iconv.dll" and "libiconv.dll"
libraries. When neither of them can be found Vim will still work but
some conversions won't be possible.
The most recent version from the DLL from here http://sourceforge.net/projects/gettext/files/libiconv-win32/ seems to do job for me. Without it I could not convert most iso-8859 encodings other than iso-8859-1. Having iconv.dll installed I can load the files easily with:
:e ++enc=iso-8859-16 file.txt
If Vim cannot handle it, you can convert to (for example) UTF-8) with the iconv tool:
$ iconv --from-code ISO-8859-16 --to-code UTF-8 -o outputfile inputfile
I want to use GVim as a merge tool for TFS 2010.
I can't figure out the Arguments for GVim.
Specifically the argument %4, when I use it I get an empty buffer for it. if I don't use it I get an error message that I must use it.
This may not be exactly to your liking, but here's how I use GVim for a merge tool.
I set it up to do a two-way merge: it has the 'source' on the left (where I'm merging from), and the merge file on the right (starts off as what my destination branch has for information).
I set it up like this:
command: C:\Program Files (x86)\Vim\vim73\gvim.exe
argument: -c "vert diffsplit %1 " %4 -c "wincmd l|0read %2 |diff"
What this does is as follows:
Reads in the 'source' file on the left, and splits the window (-c "vert diffsplit %1")
Opens up on the right side the merge result (%4)
Runs a quick script which:
Moves over the right window (wincmd l)
Reads in my existing changes in the branch (0read %2)
Re-runs the diff algorithm (diff)
This lets me "diff" my work against the incoming merge, and saving the right hand side will resolve the merge.
Your screenshot suggests you are using Vim 7.3 . According to Vim site:
http://vim.wikia.com/wiki/Running_diff
At some point, the MyDiff function provided by the "Vim without Cream"
installer has been modified. As of Vim 7.3.138 it is still broken.
However, You can try the following verbose-mode parameters
command : gvim
argument: -V -od %1 %2
diff -w command is used to create a side by side comparison diff file (instead of parallel)
i then view them using vi via ssh terminal
the changes are indicated by either "<" or "|" or ">"
Since the file i am viewing is a source code, navigating to changes alone
using above symbols is difficult since they are also in C source code.
How can i change these default symbols to desired ones ?
Kindly help. Thanks.
Instead of viewing the output of diff -w in vim, you can use vim's built-in diff:
vim -d file1 file2
This opens vim in a vertical split with both files open, and diff markings in the code. This is what it looks like:
And it works in a terminal too:
You can find a short tutorial here
According to my version of diff (2.8.1 from the GNU diffutils by the FSF) -w is used to change the width of the output; The -y parameter outputs side by side comparison. In combination, the two show no further effect than the -y parameter used alone, which means you may have an alias in your terminal profile or in the global terminal profile that aliases diff to diff -y.
I say all this because all options to change the symbols ("<", "|", and ">") conflict with the -y option. If you can live without side-by-side, you have the option of two other included output styles or defining your own. The two output styles are -c (context) and -u (unified). (For more information on what they do see the diff Wikipedia page. For more information on the options see the diff man page.)
A more in depth fix would be to use the following options:
diff --old-group-format="(deleted)---" \
--new-group-format="(added)---" \
--changed-group-format="(updated)---" \
--unchanged-group-format="(nodiff)---" \
old_file.c new_file.c
Now the old file's lines that are not present in the new file are represented by (deleted)---
The new file's lines that are not present in the old file are represented by (added)---
Lines that have been changed are represented by (updated)---
Lines common to both files are represented by (nodiff)---
Since you seem to do this often enough, you have the option of making it an alias in your terminal profile or writing a small shell script to handle it. For more options, see the manual's section on options and specifically see the section on line group formats for information on what you can put between the quotes in the format definitions.
Of course, if you must have side-by-side, try Nathan Fellman's idea above. Otherwise, there's the option of using a dedicated GUI tool for it such as Kompare.
I've set up my ~/.hgrc as per https://www.mercurial-scm.org/wiki/MergingWithVim to use vimdiff.
[ui]
merge = vimdiff
[merge-tools]
vimdiff.executable = vim
vimdiff.args = -d $base $local $output $other +close +close
However, when I try to run the actual merge, it just fails out not very helpfully with the following:
bash-3.2$ hg --debug merge
searching for copies back to rev 7
resolving manifests
overwrite None partial False
ancestor 88aaf3a2e10f local 311bb03b96cd+ remote 29bec6ac5dd3
junk: versions differ -> m
preserving junk for resolve of junk
updating: junk 1/1 files (100.00%)
picked tool 'vimdiff' for junk (binary False symlink False)
abort: Operation not supported: /Accounts/rainest/mtest/junk.orig
Any idea why it's doing this?
I've figured it out.
It turns out there's a very specific bug in Python2.6's shutil library that occurs if you're working with NFS mounts on a BSD-like system. More information, and the fix, can be found at http://bugs.python.org/issue7512.
Depending on how you installed it Mercurial usually comes with vimdiff pre-configured for merging. On my machine that's in /etc/mercurial/hgrc.d/mergetools.rc but I imagine it's different in your OSX box.
You might want to check to see if it doesn't already use vimdiff for merging if you remove all of that from your .hgrc.
You can use the command hg showconfig --debug to see all the per-user, per-repo, and system-wide configuration items that are in effect. If you see vimdiff in there after the lines you've added are removed then you might be good to go.