MrCBofBCinTX
Technical User
I have a problem with vim-gtk causing an X crash when accidentally starting it outside a terminal. Long story but the window managers are at fault.
I have made a simple script to test for a terminal if vim command is used, if okay, then start renamed vim executable (vim-safe).
# cat /usr/local/bin/vim
#!/bin/sh
test -t 0 && /usr/local/bin/vim-safe $1 $2 $3 $4
Works great, however, vim determines what the actual command is, for example, vim or view or vdiff or gvim or gview or gdiff, etc.
But those commands come through a bunch of symlinks to vim.
There are no other executables.
$ ls /usr/local/bin/gv*
ls /usr/local/bin/gv*
lrwxr-xr-x 1 root wheel 3 Jul 14 16:09 /usr/local/bin/gview -> vim
lrwxr-xr-x 1 root wheel 23 Jul 15 10:13 /usr/local/bin/gvim -> /usr/local/bin/vim-safe
lrwxr-xr-x 1 root wheel 3 Jul 14 16:09 /usr/local/bin/gvimdiff -> vim
-rwxr-xr-x 1 root wheel 143 Jul 4 07:35 /usr/local/bin/gvimtutor
$ ls /usr/local/bin/vi*
lrwxr-xr-x 1 root wheel 3 Jul 14 16:08 /usr/local/bin/view -> vim
-rwxr-xr-x 1 root wheel 61 Jul 15 10:16 /usr/local/bin/vim
-rwxr-xr-x 1 root wheel 1851924 Jul 4 07:35 /usr/local/bin/vim-safe
lrwxr-xr-x 1 root wheel 3 Jul 14 16:08 /usr/local/bin/vimdiff -> vim
-rwxr-xr-x 1 root wheel 2084 Jul 4 07:35 /usr/local/bin/vimtutor
What I can't figure out is how to work it so that I can test vimdiff and view and vimtutor for terminal, since using the script erases that info
I have made a simple script to test for a terminal if vim command is used, if okay, then start renamed vim executable (vim-safe).
# cat /usr/local/bin/vim
#!/bin/sh
test -t 0 && /usr/local/bin/vim-safe $1 $2 $3 $4
Works great, however, vim determines what the actual command is, for example, vim or view or vdiff or gvim or gview or gdiff, etc.
But those commands come through a bunch of symlinks to vim.
There are no other executables.
$ ls /usr/local/bin/gv*
ls /usr/local/bin/gv*
lrwxr-xr-x 1 root wheel 3 Jul 14 16:09 /usr/local/bin/gview -> vim
lrwxr-xr-x 1 root wheel 23 Jul 15 10:13 /usr/local/bin/gvim -> /usr/local/bin/vim-safe
lrwxr-xr-x 1 root wheel 3 Jul 14 16:09 /usr/local/bin/gvimdiff -> vim
-rwxr-xr-x 1 root wheel 143 Jul 4 07:35 /usr/local/bin/gvimtutor
$ ls /usr/local/bin/vi*
lrwxr-xr-x 1 root wheel 3 Jul 14 16:08 /usr/local/bin/view -> vim
-rwxr-xr-x 1 root wheel 61 Jul 15 10:16 /usr/local/bin/vim
-rwxr-xr-x 1 root wheel 1851924 Jul 4 07:35 /usr/local/bin/vim-safe
lrwxr-xr-x 1 root wheel 3 Jul 14 16:08 /usr/local/bin/vimdiff -> vim
-rwxr-xr-x 1 root wheel 2084 Jul 4 07:35 /usr/local/bin/vimtutor
What I can't figure out is how to work it so that I can test vimdiff and view and vimtutor for terminal, since using the script erases that info