0

If I run vim normally, I get mouse support (via set mouse=a). However, if I run vim as view, it appears to not load my .vimrc correctly.

[c34n11 colors] vim elflord.vim      # runs correctly
[c34n11 colors] view elflord.vim     # gives error, no mouse
Error detected while processing /gpfs/loomis/home.grace/fas/manohar/emb99/.vimrc:
    line    2:
E538: No mouse support: mouse=a
Press ENTER or type command to continue
[c34n11 colors] which view
/usr/bin/view
[c34n11 colors] file /usr/bin/view   # view just points to vim
/usr/bin/view: symbolic link to `vi'
[c34n11 colors] which vi
alias vi='vim'
        /usr/bin/vim

How can I debug this?

1 Answer 1

1

Your /bin/vi is a lightweight version of Vim, which likely doesn't support a lot of things like colorschemes, syntax highlighting, etc. Obviously /usr/bin/vim is the full version that does.

The fact that you have aliased vi to vim doesn't affect symbolic links.

The way I solve this is to set an alias in ~/.bashrc:

alias view="vim -R"

Also, there's a trick you can do in your ~/.vimrc to prevent the stripped down version of Vim from giving you errors when it sources. Just put an if 1 before the commands that only work in the full version of Vim, such as before your set mouse=a command. For example:

set showcmd
set hlsearch
set ignorecase

if 1
set mouse=1
syntax on
filetype indent plugin on
endif
5
  • Does vim run in compatibility mode when run as vi?
    – baum
    Dec 15, 2018 at 20:53
  • 1
    @baum It's more that many distributions install a /bin/vi that is compiled without most of the extended features of Vim. It's not that it's running in compatibility mode, it's that it's literally incapable of more.
    – Heptite
    Dec 15, 2018 at 20:54
  • But on my system, which vi gave alias vi='vim'...
    – baum
    Dec 15, 2018 at 20:55
  • 1
    Yes, but that does not and can not affect symlinks. view is pointed to vi via symlink, so it's going to invoke vi, bypassing the alias. This is why I suggested adding another alias.
    – Heptite
    Dec 15, 2018 at 20:57
  • Oh, gotcha. Totally misread that.
    – baum
    Dec 15, 2018 at 20:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .