vim中的语法高亮根本不起作用

前端之家收集整理的这篇文章主要介绍了vim中的语法高亮根本不起作用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我一直忙于在 thisthis代码的帮助下将vim配置为IDE,但我似乎无法使语法高亮显示工作.

在我的〜/ .vimrc中,我有以下两个设置文件类型插件缩进和语法,应该突出显示语法,但每当我打开一个文件(例如Javascript)它不起作用.

当我打开文件并执行:语法列表时,我得到以下响应:没有为此缓冲区定义语法项

我(快速)在互联网上搜索并参考我提到的设置(并且被正确定义).

我错过了什么?

在我的整个.vimrc内容之下

set nocompatible

"""" Config Vundle plugin manager """""
filetype off

set rtp=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'VundleVim/Vundle.vim'

"""" Plugins """"
Plugin 'altercation/vim-colors-solarized'
Plugin 'tomasr/molokai'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'vim-syntastic/syntastic'
Plugin 'xolox/vim-misc'
Plugin 'xolox/vim-easytags'
Plugin 'majutsushi/tagbar'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'vim-scripts/a.vim'
Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-fugitive'
Plugin 'Raimondi/delimitMate'
Plugin 'jez/vim-superman'
Plugin 'christoomey/vim-tmux-navigator'
Plugin 'jez/vim-c0'
Plugin 'jez/vim-ispc'
Plugin 'kchmck/vim-coffee-script'
Plugin 'godlygeek/tabular'
Plugin 'HTML-AutoCloseTag'
Plugin 'ekalinin/Dockerfile.vim'
Plugin 'cakebaker/scss-Syntax.vim'
Plugin 'tpope/vim-surround'
Plugin 'ntpeters/vim-better-whitespace'
Plugin 'edkolev/tmuxline.vim'

"""" OSX stupid backspace fix """"
set backspace=indent,eol,start

call vundle#end()
filetype plugin indent on
Syntax on

"""" General settings """"
set backspace=indent,start
set ruler
set number
set showcmd
set incsearch
set hlsearch

"""" Set tabs """"
set tabstop=2
set shiftwidth=2
set smarttab
set expandtab

"""" Enable mouse support """"
set mouse=a

"""" Enable highlighting of the current line """"
set cursorline

"""" Support symbols in the title bar """"
hi clear SignColumn

"""" Colorscheme (Solarized) """"
set background=dark
colorscheme solarized

" Always show statusbar
set laststatus=2

"""" Enable Menlo font """"
let g:airline_powerline_fonts = 1

" Show PASTE if in paste mode
let g:airline_detect_paste=1

" Show airline for tabs too
let g:airline#extensions#tabline#enabled = 1

" Use the solarized theme for the Airline status bar
let g:airline_theme='solarized'

"""" Nerdtree config """"
" Open/close NERDTree Tabs with \t
nmap <silent> <leader>t :NERDTreeTabsToggle<CR>
" To have NERDTree always open on startup
let g:nerdtree_tabs_open_on_console_startup = 1

"""" Scrooloose/syntastic settings """"
let g:syntastic_error_symbol = '✘'
let g:syntastic_warning_symbol = "▲"
augroup mySyntastic
  au!
  au FileType tex let b:syntastic_mode = "passive"
augroup END

"""" Easytags settings """
set tags=./tags;,~/.vimtags
" Sensible defaults
let g:easytags_events = ['BufReadPost','BufWritePost']
let g:easytags_async = 1
let g:easytags_dynamic_files = 2
let g:easytags_resolve_links = 1
let g:easytags_suppress_ctags_warning = 1

"""" Tagbar settings """"
" Open/close tagbar with \b
nmap <silent> <leader>b :TagbarToggle<CR>
" Open tagbar automatically whenever possible
autocmd BufEnter * nested :call tagbar#autoopen(0)

"""" Vimgutter settings """
" In vim-airline,only display "hunks" if the diff is non-zero
let g:airline#extensions#hunks#non_zero_only = 1

"""" delimitMate settings """
let delimitMate_expand_cr = 1
augroup mydelimitMate
  au!
  au FileType markdown let b:delimitMate_nesting_quotes = ["`"]
  au FileType tex let b:delimitMate_quotes = ""
  au FileType tex let b:delimitMate_matchpairs = "(:),[:],{:},`:'"
  au FileType python let b:delimitMate_nesting_quotes = ['"',"'"]
augroup END

"""" Superman config """"
noremap K :SuperMan <cword><CR>

编辑:

低于vim –version的响应

VIM - Vi IMproved 8.0 (2016 Sep 12,compiled Nov 29 2017 18:37:46)
Included patches: 1-503,505-680,682-1283
Compiled by root@apple.com
Normal version without GUI.  Features included (+) or not (-):
+acl             +file_in_path    -mouse_sgr       +tag_old_static
-arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           -mouse_urxvt     -tcl
-balloon_eval    +folding         +mouse_xterm     -termguicolors
-browse          -footer          +multi_byte      -terminal
+builtin_terms   +fork()          +multi_lang      +terminfo
+byte_offset     -gettext         -mzscheme        +termresponse
+channel         -hangul_input    +netbeans_intg   +textobjects
+cindent         +iconv           +num64           +timers
-clientserver    +insert_expand   +packages        +title
-clipboard       +job             +path_extra      -toolbar
+cmdline_compl   +jumplist        -perl            +user_commands
+cmdline_hist    -keymap          +persistent_undo +vertsplit
+cmdline_info    +lambda          +postscript      +virtualedit
+comments        -langmap         +printer         +visual
-conceal         +libcall         -profile         +visualextra
+cryptv          +linebreak       +python/dyn      +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      -lua             -rightleft       +windows
+diff            +menu            +ruby/dyn        +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
-emacs_tags      -mouseshape      +startuptime     -xpm
+eval            -mouse_dec       +statusline      -xsmp
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_clipboard
+extra_search    -mouse_jsbterm   +Syntax          -xterm_save
-farsi           -mouse_netterm   +tag_binary
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L/usr/local/lib -o vim        -lm -lncurses  -liconv -framework Cocoa

编辑2

我现在注意到,当我尝试重新加载我的.vimrc文件时,我收到以下错误

Error detected while processing /usr/share/vim/vim80/Syntax/Syntax.vim:
line   42:
E216: No such group or event: filetypedetect BufRead

其中points我在direction中更改了我的runtimepath值,但我没有在任何地方定义.我已经尝试将它添加到我的.vimrc中,但重新加载后仍然会出现相同的错误.

我把它放在文档的顶部(在设置不兼容之后,所以也许位置可能是问题,但如果是这样,我应该把它放在哪里呢?

Damnit,我在第6行错过了一个角色

set set rtp =〜/ .vim / bundle / Vundle.vim应该已经设置了rtp =〜/ .vim / bundle / Vundle.vim.现在它有效!

原文链接:https://www.f2er.com/bash/384763.html

猜你在找的Bash相关文章