¿Cuál es la diferencia entre .exrc y .vimrc?


13

Sé por experiencia que el archivo ~ / .exrc se puede usar para configurar vim. También sé que el archivo ~ / .vimrc se puede usar para el mismo propósito.

Sin embargo, si uso .exrc para configurar vim, esto genera problemas en los sistemas donde viestá instalado en lugar de hacerlo vim. A saber, vimadmite funciones adicionales que vino lo hacen; y cuando intentas usarlos vi, se viqueja.

Mis preguntas son:

  1. ¿Cuál es la diferencia entre .exrc y .vimrc?
  2. Si ambos están presentes, ¿se usan ambos ?
  3. ¿Es una mala práctica usar el archivo .exrc para configurar vim?

Respuestas:


14
  1. .exrc es el archivo de configuración para vi, mientras que .vimrc es el archivo de configuración paravim

  2. No. Vim usará el archivo .vimrc si está presente; de ​​lo contrario, el archivo .exrc si está presente.

  3. Sí, a menos que solo ingrese comandos compatibles con vi

De la ayuda de Vim en exrc:

 c. Four places are searched for initializations.  The first that exists
is used, the others are ignored.  The $MYVIMRC environment variable is
set to the file that was first found, unless $MYVIMRC was already set
and when using VIMINIT.
-  The environment variable VIMINIT (see also |compatible-default|) (*)
   The value of $VIMINIT is used as an Ex command line.
-  The user vimrc file(s):
        "$HOME/.vimrc"     (for Unix and OS/2) (*)
        "$HOME/.vim/vimrc"     (for Unix and OS/2) (*)
        "s:.vimrc"         (for Amiga) (*)
        "home:.vimrc"      (for Amiga) (*)
        "home:vimfiles:vimrc"  (for Amiga) (*)
        "$VIM/.vimrc"      (for OS/2 and Amiga) (*)
        "$HOME/_vimrc"     (for MS-DOS and Win32) (*)
        "$HOME/vimfiles/vimrc" (for MS-DOS and Win32) (*)
        "$VIM/_vimrc"      (for MS-DOS and Win32) (*)
    Note: For Unix, OS/2 and Amiga, when ".vimrc" does not exist,
    "_vimrc" is also tried, in case an MS-DOS compatible file
    system is used.  For MS-DOS and Win32 ".vimrc" is checked
    after "_vimrc", in case long file names are used.
    Note: For MS-DOS and Win32, "$HOME" is checked first.  If no
    "_vimrc" or ".vimrc" is found there, "$VIM" is tried.
    See |$VIM| for when $VIM is not set.
-  The environment variable EXINIT.
   The value of $EXINIT is used as an Ex command line.
-  The user exrc file(s).  Same as for the user vimrc file, but with
   "vimrc" replaced by "exrc".  But only one of ".exrc" and "_exrc" is
   used, depending on the system.  And without the (*)!
Al usar nuestro sitio, usted reconoce que ha leído y comprende nuestra Política de Cookies y Política de Privacidad.
Licensed under cc by-sa 3.0 with attribution required.