Before you start reading.
Before having answers, I thought vimdiff
was a binary program because I'm used to Debian's file
, which seems not to honor POSIX (but I didn't knew); but then I used macOS 10.14 file
, which seems to honor POSIX (without me knowing such).
The original post.
Read in this nice answer, you can see it for yourself, you can diff two documents without the need to use vimdiff
. Awesome!
That made me suppose vimdiff
should be some kind of scripted use of Vim.
I was surprised to read that:
$ uname -a
Darwin llc.local 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64
$ echo "I don't know what's the Darwin equivalent to \`lsb_release -a\`."
I don't know what's the Darwin equivalent to `lsb_release -a`.
$ which vimdiff
/usr/bin/vimdiff
$ file /usr/bin/vimdiff
/usr/bin/vimdiff: Mach-O 64-bit executable x86_64
$ hexdump -C /usr/bin/vimdiff | head
00000000 cf fa ed fe 07 00 00 01 03 00 00 80 02 00 00 00 |................|
00000010 12 00 00 00 20 07 00 00 85 00 20 00 00 00 00 00 |.... ..... .....|
00000020 19 00 00 00 48 00 00 00 5f 5f 50 41 47 45 5a 45 |....H...__PAGEZE|
00000030 52 4f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |RO..............|
00000040 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 |................|
00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000060 00 00 00 00 00 00 00 00 19 00 00 00 28 02 00 00 |............(...|
00000070 5f 5f 54 45 58 54 00 00 00 00 00 00 00 00 00 00 |__TEXT..........|
00000080 00 00 00 00 01 00 00 00 00 c0 19 00 00 00 00 00 |................|
00000090 00 00 00 00 00 00 00 00 00 c0 19 00 00 00 00 00 |................|
$ vimdiff --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 19 2019 19:08:44)
Included patches: 1-503, 505-680, 682-1283, 1365
Compiled by [email protected]
Normal version without GUI. Features included (+) or not (-):
+acl +file_in_path -mouse_sgr +tag_old_static
-arabic +find_in_path -mouse_sysmouse -tag_any_white
+autocmd +float -mouse_urxvt -tcl
-balloon_eval +folding +mouse_xterm -termguicolors
-browse -footer +multi_byte -terminal
+builtin_terms +fork() +multi_lang +terminfo
+byte_offset -gettext -mzscheme +termresponse
+channel -hangul_input +netbeans_intg +textobjects
+cindent +iconv +num64 +timers
-clientserver +insert_expand +packages +title
-clipboard +job +path_extra -toolbar
+cmdline_compl +jumplist -perl +user_commands
+cmdline_hist -keymap +persistent_undo +vertsplit
+cmdline_info +lambda +postscript +virtualedit
+comments -langmap +printer +visual
-conceal +libcall -profile +visualextra
+cryptv +linebreak +python/dyn +viminfo
+cscope +lispindent -python3 +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con -lua -rightleft +windows
+diff +menu +ruby/dyn +writebackup
+digraphs +mksession +scrollbind -X11
-dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent -xim
-emacs_tags -mouseshape +startuptime -xpm
+eval -mouse_dec +statusline -xsmp
+ex_extra -mouse_gpm -sun_workshop -xterm_clipboard
+extra_search -mouse_jsbterm +syntax -xterm_save
-farsi -mouse_netterm +tag_binary
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L/usr/local/lib -o vim -lm -lncurses -liconv -framework Cocoa
$ brew info vim
vim: stable 8.1.1850 (bottled), HEAD
Vi 'workalike' with many additional features
https://www.vim.org/
Conflicts with:
ex-vi (because vim and ex-vi both install bin/ex and bin/view)
macvim (because vim and macvim both install vi* binaries)
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/vim.rb
==> Dependencies
Required: gettext ✘, lua ✘, perl ✘, python ✔, ruby ✘
==> Options
--HEAD
Install HEAD version
==> Analytics
install: 69,509 (30 days), 203,502 (90 days), 819,729 (365 days)
install_on_request: 64,612 (30 days), 188,872 (90 days), 745,495 (365 days)
build_error: 0 (30 days)
$ brew info macvim
macvim: stable 8.1-157 (bottled), HEAD
GUI for vim, made for macOS
https://github.com/macvim-dev/macvim
Conflicts with:
vim (because vim and macvim both install vi* binaries)
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/macvim.rb
==> Dependencies
Required: cscope ✘, lua ✘, python ✔
==> Requirements
Build: xcode ✔
==> Options
--HEAD
Install HEAD version
==> Analytics
install: 7,845 (30 days), 30,394 (90 days), 137,548 (365 days)
install_on_request: 7,268 (30 days), 27,783 (90 days), 124,890 (365 days)
build_error: 0 (30 days)
$ brew info ex-vi
ex-vi: stable 050325 (bottled)
UTF8-friendly version of tradition vi
https://ex-vi.sourceforge.io/
Conflicts with:
vim (because ex-vi and vim both install bin/ex and bin/view)
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/ex-vi.rb
==> Analytics
install: 6 (30 days), 17 (90 days), 83 (365 days)
install_on_request: 6 (30 days), 17 (90 days), 83 (365 days)
build_error: 0 (30 days)
$ _
(EASY) Is
vimdiff
really supposed to be a binary program always?(HARD?) Is it really supposed to be a binary program in whatever provider I have been choosing (macOS default shipping, I guess)?
(BONUS) Does this look like a compromised
vimdiff
?
The X of my Y is, I want to write some Vim script, and I wanted to draw inspiration from the scripts I thought Vim would use to diff.