简体   繁体   中英

E488: Trailing characters: tags = tags; on Windows 7 running gVim

I am getting an error every time I run gVim that says:

Error detected while processing C:\Workspaces\workspace1\_vimrc:

line    4:

E488: Trailing characters: tags = tags;

If I move the line tags = tags; from my local _vimrc file to the global _vimrc file I get the same error. I also tried using an absolute path and get the same error. I am starting gVim from the command line in the C:\\Workspaces\\workspace1\\ directory. I have tried disabling all plugins in my _vimrc and doing a :PluginClean for Vundle.

The contents of my _vimrc file:

set nocompatible              " be iMproved, required
filetype off                  " required

set rtp+=~/vimfiles/bundle/Vundle.vim/
let path='~/vimfiles/bundle'
call vundle#begin(path)

" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'kien/ctrlp.vim'
Plugin 'scrooloose/nerdtree'
"Plugin 'scrooloose/syntastic'
Plugin 'bling/vim-airline'
"Plugin 'altercation/vim-colors-solarized'
Plugin 'xolox/vim-misc'
Plugin 'xolox/vim-session'
Plugin 'jnurmine/Zenburn'
Plugin 'majutsushi/tagbar'
Plugin 'brookhong/cscope.vim'

call vundle#end()            " required
filetype plugin indent on    " required


"Set Color Scheme and Font Options
syntax enable
set background=dark
colorscheme zenburn
set guifont=Consolas:h10:cANSI


"set secure          " disable unsafe commands in local .vimrc files
set exrc            " enable per-directory .vimrc files

set clipboard=unnamed

"set line no, buffer, search, highlight, autoindent and more.
set nu
set hidden
set ignorecase
set incsearch
set smartcase
set showmatch
set autoindent
set ruler
set vb
set viminfo+=n$VIM/_viminfo
set noerrorbells
set showcmd
set mouse=a
set history=1000
set undolevels=1000
set nowrap

set backspace=start,eol,indent
set guioptions-=m
set guioptions-=T
set guioptions-=r
set listchars=tab:>.,trail:.

set tabstop=4
set shiftwidth=4
set expandtab
set softtabstop=4

"Set working directory to the current file
"set autochdir

map <F2> :NERDTreeToggle<CR>
map <Leader>nt :NERDTree %:p:h<CR>
nnoremap <F8> :TagbarToggle<CR>

"Ctrl-P CONFIG 
"set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe  " Windows
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_extensions = ['tag', 'line']
"Fuzzy searching for tags 
nnoremap <leader>t :CtrlPTag<CR>

let g:session_autoload = 'yes'
let g:session_autosave = 'yes'

nnoremap <C-Right> :tabnext<CR>    
nnoremap <C-Left> :tabprevious<CR>
nnoremap <C-Up> :tabnew<CR>
nnoremap <C-Down> :tabclose<CR>

" Vertical Split
nnoremap ,v <C-w>v  
" Horizontal Split  
nnoremap ,h <C-w>s
" Next window    
nnoremap ,, <C-w>w

I have a feeling this is a matter of my _vimrc file being too unorganized and me being too careless copy-pasting things I do not fully understand in there, but I'm trying to get out of the beginner phase with the hands on approach and trying to find which plugins work for me.

Any info on what might be causing this error is greatly appreciated! Also, if there is anything else in my _vimrc file that is a bad idea please let me know!

The real rules are slightly less strict but, following is a simple way to set non-boolean options and let variables. Stick to this convention and you'll be good.

set option=value
let variable = value

Note the spacing around the equal sign.

The proper way to tell Vim where to look for tags files is thus:

set tags=value

About in your vimrc :

  • set nocompatible is useless, you can safely drop it

  • let path='~/vimfiles/bundle' is useless too, just pass the string to the function directly

  • prefer long forms, set visualbell , to short forms, set vb

  • you don't need to change 'tabstop'

  • here is a very optimal value for the 'tags' option:

     set tags=./tags;,tags; 

    that will look for tags files in the directory of the file associated with the current buffer and in the working directory, and up and up until it reaches / .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM