我是 nvim 编辑器的新手。我需要帮助设置我的 ~/.vimrc 文件。我看过一些教程并遵循它们。并想出了这个:
> vim ~/.vimrc
Run Code Online (Sandbox Code Playgroud)
已将其添加到我的 vimrc 中。
syntax on
set noerrorbells
set tabstop=4 softtabstop=4
set shiftwidth=4
set expandtab
set smartindent
set nu
Run Code Online (Sandbox Code Playgroud)
然后获取文件
:source %
Run Code Online (Sandbox Code Playgroud)
更改会立即应用。但是当我退出文件并再次打开它时,更改就会消失。如果我再次获取它,它就会起作用。有什么办法可以让这些改变永久存在吗?
[注意]:当我退出文件时,我使用了:x
更新:
当我尝试~/.config/nvim/init.vim使用 vim 打开时。我收到这个错误。
E325: ATTENTION
Found a swap file by the name "~/.local/share/nvim/swap//%home%manoj%.config%nvi
m%init.vim.swp"
owned by: manoj dated: Wed Mar 31 16:01:46 2021
file name: ~manoj/.config/nvim/init.vim
modified: YES
user name: manoj host name: manoj
process ID: 15099
While opening file "/home/manoj/.config/nvim/init.vim"
CANNOT BE FOUND
(1) Another program may be editing the same file. If this is the case,
be careful not to end up with two different instances of the same
file when making changes. Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r /home/manoj/.config/nvim/init
.vim"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file "/home/manoj/.local/share/nvim
/swap//%home%manoj%.config%nvim%init.vim.swp"
to avoid this message.
Swap file "~/.local/share/nvim/swap//%home%manoj%.config%nvim%init.vim.swp" alre
ady exists!
Run Code Online (Sandbox Code Playgroud)