You are not logged in.
Pages: 1
I've tried various distributions before now trying arch, and in all other cases there has always been some way to make vim the binary for commands like vi and view. In arch however ex remains the "norm" after installing vim.
$ ls -l /usr/bin/ | grep "\b\(vi\|vim\|ex\)\b"
lrwxrwxrwx 1 root root 2 6 sep 21.34 edit -> ex
-rwxr-xr-t 1 root root 236184 6 sep 21.34 ex
lrwxrwxrwx 1 root root 3 28 sep 17.51 rview -> vim
lrwxrwxrwx 1 root root 3 28 sep 17.51 rvim -> vim
lrwxrwxrwx 1 root root 2 6 sep 21.34 vedit -> ex
lrwxrwxrwx 1 root root 2 6 sep 21.34 vi -> ex
lrwxrwxrwx 1 root root 2 6 sep 21.34 view -> ex
-rwxr-xr-x 1 root root 2372176 28 sep 17.51 vim
lrwxrwxrwx 1 root root 3 28 sep 17.51 vimdiff -> vimWhat is the correct way to give ex the foot?
Last edited by azzid (2015-11-03 19:50:16)
Offline
I always just use a shell alias vi=vim
edit: of course, I usually just type e which is an alias for emacsclient ![]()
Last edited by ewaller (2015-11-03 19:59:36)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
Alternatively to what ewaller suggested you could put some symbolic links into /usr/local/bin, e.g.:
# ln -s /usr/bin/vim /usr/local/bin/viIt is also possible to replace the symbolic links in /usr/bin, however this requires adding the respective files to the NoExtract variable in /etc/pacman.conf .
Offline
Ugh. Just set the correct environment variables:
export EDITOR="vim"
export VISUAL="$EDITOR"
export SUDO_EDITOR="$EDITOR"
export FCEDIT="$EDITOR"Offline
you could put some symbolic links into /usr/local/bin,
.... just ensure that /usr/local/bin is in your PATH before /usr/bin
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
Ugh. Just set the correct environment variables:
Yeah, but muscle memory from my HP-UX days means I always type "vi ..." not "vim ..."
I do use vim from the command line when I want to edit something quick and simple.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
respiranto wrote:you could put some symbolic links into /usr/local/bin,
.... just ensure that /usr/local/bin is in your PATH before /usr/bin
... or $HOME/.local/bin ![]()
Otherwise, what jasonwryan said: well-written Unix applications allow you to configure their behaviour through environment variables.
Offline
Ugh. Just set the correct environment variables:
export EDITOR="vim" export VISUAL="$EDITOR" export SUDO_EDITOR="$EDITOR" export FCEDIT="$EDITOR"
That remembers me of an issue I have with /etc/environment where I store such variables.
For some reason it is not sourced when `su' is run.
Is there a way to enable this except for sourcing it from the .bashrc?
Offline
jasonwryan wrote:Ugh. Just set the correct environment variables:
export EDITOR="vim" export VISUAL="$EDITOR" export SUDO_EDITOR="$EDITOR" export FCEDIT="$EDITOR"That remembers me of an issue I have with /etc/environment where I store such variables.
For some reason it is not sourced when `su' is run.
Is there a way to enable this except for sourcing it from the .bashrc?
Thread hijacking, but as it is vaguely related...
See `man su`
For backward compatibility, su defaults to not change the current directory and to only set the environment variables HOME and
SHELL (plus USER and LOGNAME if the target user is not root)....
-m, -p, --preserve-environment
Preserve the entire environment, i.e. it does not set HOME, SHELL, USER nor LOGNAME. This option is ignored if the option
--login is specified.
Offline
Thread hijacking, but as it is vaguely related...
Sorry, I didn't found it worth opening a new thread.
If this is seen as further hijacking, any moderator may feel free to remove this post.
See `man su`
su(1) wrote:-m, -p, --preserve-environment
[...] This option is ignored if the option --login is specified.
Which is the option I use in most cases (--login, i.e. `su -'). So I assume, I will do best by actually sourcing /etc/environment from (bash).bashrc .
Offline
yeah, I was surprised when I first used Arch that vi wasn't symlinked to vim too. In any case, what I do is uninstall vi via pacman -R vi and then symlink:
ln -sv /usr/bin/{vim,vi}Offline
Ugh. Just set the correct environment variables:
export EDITOR="vim" export VISUAL="$EDITOR" export SUDO_EDITOR="$EDITOR" export FCEDIT="$EDITOR"
I think setting the 2nd two is redundant if the first two are set?
Offline
jasonwryan wrote:Ugh. Just set the correct environment variables:
export EDITOR="vim" export VISUAL="$EDITOR" export SUDO_EDITOR="$EDITOR" export FCEDIT="$EDITOR"I think setting the 2nd two is redundant if the first two are set?
No: there are some use cases, eg.,
The value in the FCEDIT
variable shall be used as a default when −e is not specified. If FCEDIT is null or unset, ed shall be used as the editor.
Offline
@jasonwryan, that is different to what the bash man page says.
Offline
@jasonwryan, that is different to what the bash man page says.
Indeed it is. Thanks!
Offline
Ugh. Just set the correct environment variables:
export EDITOR="vim" export VISUAL="$EDITOR" export SUDO_EDITOR="$EDITOR" export FCEDIT="$EDITOR"
Added it to .bashrc:
$ grep export .bashrc
export EDITOR="vim"
export VISUAL="$EDITOR"
export SUDO_EDITOR="$EDITOR"
export FCEDIT="$EDITOR"visudo and view (the examples I've tried) still start ex.
Adding links to /usr/local/bin does not work as I expect either:
$ ls -l /usr/local/bin/view
lrwxrwxrwx 1 root root 12 4 nov 20.27 /usr/local/bin/view -> /usr/bin/vim
$ which view
/usr/local/bin/viewLooks ok, but when i run view i still end up in ex, verified by issuing :ve which gave:
Version 4.0 (gritter) 12/25/06The same command in vim fills the screen with info about the installation.
The vi symlink in /usr/local/bin works however.
Last edited by azzid (2015-11-04 19:41:47)
Offline
You add it to your .profile or .bash_profile or whatever shell initialisation file you use. This also depends on how you login (which you haven't shared).
Offline
You add it to your .profile or .bash_profile or whatever shell initialisation file you use. This also depends on how you login (which you haven't shared).
All .bash_profile does is source .bashrc:
$ cat .bash_profile
#
# ~/.bash_profile
#
[[ -f ~/.bashrc ]] && . ~/.bashrc
$ cat .bashrc
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '
export EDITOR="vim"
export VISUAL="$EDITOR"
export SUDO_EDITOR="$EDITOR"
export FCEDIT="$EDITOR"I use GDM which I guess is also what displays the login dialog I use when I login. I enter the shell by starting Terminal from the gnome launcher. Don't think my login process is that special. ;-)
EDIT: moving the exports to .bash_profile and/or (i did both) restarting the terminal i find that view is now launching vim as expected. visudo still refuses.
Last edited by azzid (2015-11-04 19:55:58)
Offline
Adding links to /usr/local/bin does not work as I expect either:
$ ls -l /usr/local/bin/view lrwxrwxrwx 1 root root 12 4 nov 20.27 /usr/local/bin/view -> /usr/bin/vim $ which view /usr/local/bin/viewLooks ok, but when i run view i still end up in ex, verified by issuing :ve which gave:
Version 4.0 (gritter) 12/25/06The same command in vim fills the screen with info about the installation.
The vi symlink in /usr/local/bin works however.
This is because vim acts differently depending on the name it's called as (argv[0]).
You are still using vim, but it is started in ex read-only (view) mode (equivalent to `vim -e -R').
See also vim(1).
vi however has no such special meaning to vim, so vim works just as usual.
Last edited by respiranto (2015-11-04 20:32:32)
Offline
I use GDM which I guess is also what displays the login dialog I use when I login. I enter the shell by starting Terminal from the gnome launcher. Don't think my login process is that special. ;-)
GDM "helpfully" adopts its own way of setting the environment...
Offline
Pages: 1