Monday, December 26, 2011

Re: VIM-Crypt help

On 26/12/11 21:53, KasperH wrote:
> On 26 dec, 13:42, Tony Mechelynck<antoine.mechely...@gmail.com>
> wrote:
>> On 26/12/11 13:12, KasperH wrote:
>>> on a newly installed Fedora 14 system (running Amahi, headless),
>>> I have another issue. I did not notice it on the previously used Ubuntu
>>> and Fedora 14 systems. they do not exist anymore, so no reference.
>>
>>> considering the solution to my primairy issue, I installedvim-enhanced.
>>> for "vi -x" it works fine, however view(1) does not prompt for a
>>> password, and immediately shows the garbage
>>
>>> when I want to edit the crypted file, I use "vi", not "vim"
>>
>>> [root@hda ~]# ll /bin/vi
>>> -rwxr-xr-x 1 root root 787200 Sep 21 11:27 /bin/vi
>>> [root@hda ~]# ll /bin/view
>>> lrwxrwxrwx. 1 root root 2 Nov 11 21:55 /bin/view -> vi
>>> [root@hda ~]# ll /usr/bin/vim
>>> -rwxr-xr-x 1 root root 2105272 Sep 21 11:27 /usr/bin/vim
>>> [root@hda ~]# echo $PATH
>>> /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
>>> [root@hda ~]#
>>
>>> so when I "vi" a file, it usevim(1), although PATH hits /bin before
>>> /usr/bin
>>
>>> /bin/vi --version shows it is the Small version
>>> /usr/bin/vim--version shows it is the Huge version
>>
>>> I'm lost, my goal is to use view(1) in "Huge mode" and not corrupt the
>>> package structure
>>
>> To use thevimexecutable by default:
>>
>> cd /usr/bin
>> ln -svvimview
>> ln -svvimvimdiff
>>
>> etc., see :help ex
>>
>> (don't link gvim, gview, etc. unless yourvimis GUI-enabled of course).
>> This way, /usr/bin/view (->vimin the same directory) will be found
>> before /bin/view (-> vi in the same directory), so no need to remove the
>> other symlink.
>>
>> Best regards,
>> Tony.
>> --
>> "When you have to kill a man it costs nothing to be polite."
>> -- Winston Curchill, On formal declarations of war
>
>
>
> Thanks Tony for the prompt response, however..
> it did not work.

What you you mean, "it didn't work"?
- Do you mean you tried to make the link as I said (yes, destination
first, and then link name) and got an error
- Do you mean that you forgot to cd to /usr/bin before running the ln
command?
- Do you mean that you did set the links and "which" couldn't see them?
- Do you mean that you made the links in the wrong direction (with "ln
-s view vim" where "ls -sv vim view", with the spaces, and of course
after cd to the correct /usr/bindirectory, would have answered: `view'
-> `vim')?
- Do you mean that your non-root $PATH doesn't include /usr/bin ?

>
> I did the "ll's" (ll /bin/vi) as root, after a "which(1)", so in fact:
> [root@hda ~]# ll `which vi`
> -rwxr-xr-x 1 root root 787200 Sep 21 11:27 /bin/vi
> [root@hda ~]# ll `which vim`
> -rwxr-xr-x 1 root root 2105272 Sep 21 11:27 /usr/bin/vim
> [root@hda ~]# ll `which view`
> lrwxrwxrwx. 1 root root 2 Nov 11 21:55 /bin/view -> vi
> [root@hda ~]#
> now as regular user (kas):
> [kas@hda ~]$ ll `which vi`
> ls: cannot access alias: No such file or directory
> ls: cannot access vi='vim': No such file or directory
> -rwxr-xr-x 1 root root 2105272 Sep 21 11:27 /usr/bin/vim
> [kas@hda ~]$ ll `which vim`
> -rwxr-xr-x 1 root root 2105272 Sep 21 11:27 /usr/bin/vim
> [kas@hda ~]$ ll `which view`
> lrwxrwxrwx. 1 root root 2 Nov 11 21:55 /bin/view -> vi
> [kas@hda ~]$
>
> so it is the alias, that precedes the PATH and gives me /usr/bin/
> vim(1), when I type vi(1), but /bin/view when I type view(1)
> alias view='vim' now view opens the crypted file in expected way,
> but.. in RW mode
> alias view='/usr/bin/view' (the /usr/bin/vim linked) opens the crypted
> in expected way, and ReadOnly
>
> on another F14 Amahi system, that had not yet vim-enhanced installed:
>
> login as: kas
> password:
> [kas@localhost ~]$ ll `which vi`
> -rwxr-xr-x 1 root root 787200 Sep 21 11:27 /bin/vi
> [kas@localhost ~]$ ll `which view`
> lrwxrwxrwx. 1 root root 2 Dec 4 11:28 /bin/view -> vi
> [kas@localhost ~]$ ll `which vim`
> /usr/bin/which: no vim in (/usr/local/bin:/bin:/usr/bin:/usr/local/
> sbin:/usr/sbin:/sbin:/home/kas/bin)
> [kas@localhost ~]$ su -
> Password:
> [root@localhost ~]# yum install vim-enhanced
> <..>
> Running Transaction
> Installing : gpm-
> libs-1.20.6-11.fc14.x86_64 1/4
> Installing : 2:vim-
> filesystem-7.3.315-1.fc14.x86_64 2/4
> Installing : 2:vim-
> common-7.3.315-1.fc14.x86_64 3/4
> Installing : 2:vim-
> enhanced-7.3.315-1.fc14.x86_64 4/4
>
> Installed:
> vim-enhanced.x86_64 2:7.3.315-1.fc14
>
> Dependency Installed:
> gpm-libs.x86_64 0:1.20.6-11.fc14 vim-common.x86_64
> 2:7.3.315-1.fc14
> vim-filesystem.x86_64 2:7.3.315-1.fc14
>
> Complete!
> [root@localhost ~]# su - kas
> [kas@localhost ~]$ alias
> <..>
> alias vi='vim'
> <..>
> [kas@localhost ~]$ ll `which vim`
> -rwxr-xr-x 1 root root 2064504 Sep 21 11:27 /usr/bin/vim
> [kas@localhost ~]$ ll /usr/bin/vi*
> -rwxr-xr-x 1 root root 2064504 Sep 21 11:27 /usr/bin/vim
> lrwxrwxrwx 1 root root 3 Dec 26 21:33 /usr/bin/vimdiff -> vim
> -rwxr-xr-x 1 root root 2084 Sep 21 11:27 /usr/bin/vimtutor
> [kas@localhost ~]$
>
>
> so /usr/bin/view is not there (yet), and it is (offcourse) not alias-
> ed
>
> I've added the following to /etc/profile.d/vim.sh
>
> alias view>/dev/null 2>&1 || alias view=/usr/bin/view
>
>
> and
>
> [ `//usr/bin/id -u` -gt 200 ]&& alias view /usr/bin/vim for /etc/
> profile.d/vim.csh
>
>
> Cheers,
> Kasper
>

So now it works IIUC? I would have left these aliases out (finding them
in your shell startup files and deleting them if necessary) leaving the
job to the softlinks. But if it works, it works: if it ain't broke
(anymore), don' fix it.

Also, "which" doesn't know about shell builtins or aliases, but "type"
(a bash builtin, with optional -a switch for "all") does, e.g.:

linux:~ # which ll
which: no ll in
(/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/lib64/jvm/java-1.6.0-openjdk-1.6.0/jre/bin)
linux:~ # type ll
ll is aliased to `ls -l'
linux:~ # which -a kill
/bin/kill
linux:~ # type -a kill
kill is a shell builtin
kill is /bin/kill

Best regards,
Tony.
--
"Right now I'm having amnesia and /déja vu/ at the same time."
-- Steven Wright

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment