码迷,mamicode.com
首页 > 系统相关 > 详细

Error detected while processing /root/.vimrc:

时间:2015-11-30 13:13:53      阅读:861      评论:0      收藏:0      [点我收藏+]

标签:

       1、问题描述

       在屏蔽.vimrc:中的注释行之后:  

$ vi ../../../.vimrc
# set cursorline 
# set cursorcolumn
# "hi CursorLine cterm=NONE ctermbg=257
# "hi CursorColumn cterm=NONE ctermbg=257

    编辑当前文件内容时,总是会出现如下错误:

$ vi in.thermalStress 
Error detected while processing /home/pandx/.vimrc:
line    1:
E488: Trailing characters: # set cursorline
line    2:
E488: Trailing characters: # set cursorcolumn
line    3:
E749: empty buffer
line    4:
E749: empty buffer
Press ENTER or type command to continue

  

        2、解决方案

        该问题在于.vimrc:中的注释符号不是通常的“#”,而是一个单独的“ 双引号(")” 。重新修改.vimrc:内容如下:

$ vi ../../../.vimrc
 " set cursorline 
 " set cursorcolumn
 " "hi CursorLine cterm=NONE ctermbg=257
 " "hi CursorColumn cterm=NONE ctermbg=257

    回到当前目录编辑文件内容,“Error detected while processing /root/.vimrc:”这一错误不再出现。

        

        3、延伸阅读

        在vim-common-7.2.411-1.8.el6.x86_64有个关于vimrc的示例“/usr/share/vim/vim72/macros/urm/examples”:

$ rpm -qa | grep vim
vim-common-7.2.411-1.8.el6.x86_64
vim-enhanced-7.2.411-1.8.el6.x86_64
vim-minimal-7.2.411-1.8.el6.x86_64
$ rpm -ql vim-common | grep example
/usr/share/vim/vim72/gvimrc_example.vim
/usr/share/vim/vim72/macros/urm/examples
/usr/share/vim/vim72/vimrc_example.vim

  下面是示例中的内容:

$ cat /usr/share/vim/vim72/vimrc_example.vim
" An example for a vimrc file.
"
" Maintainer:	Bram Moolenaar <Bram@vim.org>
" Last change:	2008 Jul 02
"
" To use it, copy it to
"     for Unix and OS/2:  ~/.vimrc
"	      for Amiga:  s:.vimrc
"  for MS-DOS and Win32:  $VIM\_vimrc
"	    for OpenVMS:  sys$login:.vimrc

" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
  finish
endif

" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible

" allow backspacing over everything in insert mode
set backspace=indent,eol,start

if has("vms")
  set nobackup		" do not keep a backup file, use versions instead
else
  set backup		" keep a backup file
endif
set history=50		" keep 50 lines of command line history
set ruler		" show the cursor position all the time
set showcmd		" display incomplete commands
set incsearch		" do incremental searching

" For Win32 GUI: remove ‘t‘ flag from ‘guioptions‘: no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")

" Don‘t use Ex mode, use Q for formatting
map Q gq

" CTRL-U in insert mode deletes a lot.  Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>

" In many terminal emulators the mouse works just fine, thus enable it.
if has(‘mouse‘)
  set mouse=a
endif

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
endif

" Only do this part when compiled with support for autocommands.
if has("autocmd")

  " Enable file type detection.
  " Use the default filetype settings, so that mail gets ‘tw‘ set to 72,
  " ‘cindent‘ is on in C files, etc.
  " Also load indent files, to automatically do language-dependent indenting.
  filetype plugin indent on

  " Put these in an autocmd group, so that we can delete them easily.
  augroup vimrcEx
  au!

  " For all text files set ‘textwidth‘ to 78 characters.
  autocmd FileType text setlocal textwidth=78

  " When editing a file, always jump to the last known cursor position.
  " Don‘t do it when the position is invalid or when inside an event handler
  " (happens when dropping a file on gvim).
  " Also don‘t do it when the mark is in the first line, that is the default
  " position when opening a file.
  autocmd BufReadPost *
    \ if line("‘\"") > 1 && line("‘\"") <= line("$") |
    \   exe "normal! g`\"" |
    \ endif

  augroup END

else

  set autoindent		" always set autoindenting on

endif " has("autocmd")

" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
  command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
		  \ | wincmd p | diffthis
endif

  可以清楚看到双引号就是其注释符号。

      进一步可以参见ChinaUnix上面的专家“肥同小可”的原创:RPM深入应用

 

Error detected while processing /root/.vimrc:

标签:

原文地址:http://www.cnblogs.com/panscience/p/5006805.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!