以我有限的 shell 经验,我不知道如何解决这个错误。
提前致谢。
以下是异常(exception)情况:
[user@pc-name ~]$ source .vimrc
-bash: Configuration file for vim
set modelines=0 : command not found
-bash: Normally we use vim-extensions. If you want true vi-
compatibility
: command not found
-bash: .vimrc: line 45: unexpected EOF while looking for matching `"'
-bash: .vimrc: line 48: syntax error: unexpected end of file
这是我的 .vimrc
:
[user@pc-name ~]$ cat .vimrc
" Configuration file for vim
set modelines=0 " CVE-2007-2438
" Normally we use vim-extensions. If you want true vi-compatibility
" remove change the following statements
set nocompatible " Use Vim defaults instead of 100% vi
compatibility
set backspace=2 " more powerful backspacing
" Don't write backup file if vim is being called by "crontab -e"
au BufWrite /private/tmp/crontab.* set nowritebackup nobackup
" Don't write backup file if vim is being called by "chpass"
au BufWrite /private/etc/pw.* set nowritebackup nobackup
syntax enable
set background=dark
colorscheme solarized
filetype on " 检测文件的类型
set number " 显示行号
set cursorline " 用浅色高亮当前行
"autocmd InsertLeave * se nocul
"autocmd InsertEnter * se cul
set tabstop=4 " Tab键的宽度
set softtabstop=4
set shiftwidth=4 " 统一缩进为4
set autoindent " vim使用自动对齐,也就是把当前行的对齐格式应用到下一行(自动缩进)
set cindent " (cindent是特别针对 C语言语法自动缩进)
set smartindent " 依据上面的对齐格式,智能的选择对齐方式,对于类似C语言编写上有用
set scrolloff=3 " 光标移动到buffer的顶部和底部时保持3行距离
set incsearch " 输入搜索内容时就显示搜索结果
set hlsearch " 搜索时高亮显示被找到的文本
set foldmethod=indent " 设置缩进折叠
set foldlevel=99 " 设置折叠层数
nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR>
" 用空格键来开关折叠
" 自动跳转到上次退出的位置
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
最佳答案
发生错误是因为.vimrc
文件是由vim
文本编辑器读取的,而不是您的bash
shell。 source .vimrc
没有意义,因为 bash
不理解(也不打算理解)该文件。
关于linux - .vimrc 中的语法错误 : unexpected end of file and etc. 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52943792/