當我嘗試使用vim
打開文件進行編輯時,我收到以下消息並檢測到錯誤消息。使用Vim編輯器時檢測到錯誤消息
Jashs-MacBook-Pro:hello jashjacob$ vim hello.rb
--- Auto-Commands ---
filetypedetect BufRead
*if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat | runtime! scripts.vim | endif
*if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat && (getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#'^I|| getline(4) =~ '^#' || getline(5) =~ '^#') | setf conf | endif
Error detected while processing /usr/share/vim/vimrc:
line 18:
E116: Invalid arguments for function line("'"") > 0 && line ("'"") <= line("$") |
E15: Invalid expression: line("'"") > 0 && line ("'"") <= line("$") |
Press ENTER or type command to continue
我的vim編輯器文件被損壞/修改了嗎?如何解決處理/usr/share/vim/vimrc
時檢測到的錯誤?
/usr/share/vim/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
set ai " auto indenting
set history=100 " keep 100 lines of history
set ruler " show the cursor position
syntax on " syntax highlighting
set hlsearch " highlight the last searched term
filetype plugin on " use the file type plugins
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
if ! exists("g:leave_my_cursor_position_alone") |
if line("'"") > 0 && line ("'"") <= line("$") |
exe "normal g'"" |
endif |
endif
" Don't write backup file if vim is being called by "crontab -e"
au BufWrite /private/tmp/crontab.* set nowritebackup
" Don't write backup file if vim is being called by "chpass"
au BufWrite /private/etc/pw.* set nowritebackup
什麼在您的vimrc?特別是,第18行是什麼,也許是前面的行呢? – 2014-11-04 03:59:21
@JonKiparsky我已經添加了我的vimrc配置文件內容。在第18行 - 'if line(「'」「)> 0 && line(」'「」)<= line(「$」)|' – 2014-11-04 04:03:20