.vimrc settings are not loaded under "screen"?

gnu-screen, ssh, vim

Solution

In vim, you can type `:scriptnames` to view all loaded scripts. The `vimrc` will show at the top if loaded.

Type `:version` to view how vim locate the `.vimrc` file, for example:

   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"

`vim` will load user vimrc file: `$HOME/.vimrc`. `HOME` is your bash env var, type `echo $HOME` in the terminal to view the value.

You can type `:echo $MYVIMRC` to view which vimrc was used at last.

Ultimately, you can type this command to start vim:

vim -V file.txt

It will print a lot of debug message. You can check what vim did, including sourcing vimrc.

Problem

When I ssh to one of my servers and do "ls", the folders are highlighted blue. If I open a file typing "vi filename" all my .vimrc settings are loaded. As soon, however, as I run "screen", all the folders are green, when I open to edit a file using vi, none of my .vimrc settting work unless I use "vim filename". Why does this happen and how can I fix it?

Original source