2017-09-30 24 views
0

如果我编辑我的.vimrc文件添加新的设置,然后退出我的bash会话并打开一个新的设置,所有设置都消失了。该.vimrc文件始终恢复到有这些内容:.vimrc设置在Windows 10上的bash会话之间没有保存

syntax on 
set shiftwidth=4 tabstop=4 expandtab 

我是先输入庆典,并使用cd ~在去我家目录编辑.vimrc文件。当我在那里时,我输入vi .vimrc。要保存我的新设置,我需要:w!然后:q!退出。

每次重新进入bash时,新设置都会被上面粘贴的块覆盖。

编辑

这里是我的.profile内容:

# ~/.profile: executed by the command interpreter for login shells. 
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login 
# exists. 
# see /usr/share/doc/bash/examples/startup-files for examples. 
# the files are located in the bash-doc package. 

# the default umask is set in /etc/profile; for setting the umask 
# for ssh logins, install and configure the libpam-umask package. 
#umask 022 

# if running bash 
if [ -n "$BASH_VERSION" ]; then 
    # include .bashrc if it exists 
    if [ -f "$HOME/.bashrc" ]; then 
    . "$HOME/.bashrc" 
    fi 
fi 

# set PATH so it includes user's private bin if it exists 
if [ -d "$HOME/bin" ] ; then 
    PATH="$HOME/bin:$PATH" 
fi 
+0

执行'ls -l .vimrc'来查看时间戳记是否表明文件在编辑后被覆盖,可能是在登录时。我怀疑你的.profile(或.bash_profile等)可能正在初始化.vimrc文件以及重新登录时覆盖的原因。 – codeforester

+0

是的,它在登录时被覆盖,如通过检查您建议的时间戳所证明的。我不确定覆盖发生在哪里。 – monker

回答

0

我发现这个问题,通过codeforester指出。我的.bashrc中有一行在启动时覆盖了我的.vimrc