gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 08:02:40 25 4
gpt4 key购买 nike

我刚刚在 this 的帮助下忙于将 vim 配置为看起来像一个 IDE和 this源,但我似乎无法让语法突出显示工作。

在我的 ~/.vimrc我有以下两个设置 filetype plugin indent onsyntax on这应该突出显示语法,但是每当我打开一个文件(例如 Javascript)时,它都不起作用。

当我打开文件并执行 :syntax list我得到以下回复:No syntax items defined for this buffer
我在互联网上(快速)搜索引用了我提到的设置(并且定义正确)。

我错过了什么?

低于我的整体.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,eol,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值(value),但我没有在任何地方定义。我试过将它添加到我的 .vimrc ,但我重新加载后仍然出现相同的错误。

我已经把它放在文档的顶部(就在 set nocompatible 之后,所以也许位置可能是问题所在,但如果是这样,我应该把它放在哪里?

最佳答案

该死,我错过了一个 +第 6 行中的字符

套装set rtp=~/.vim/bundle/Vundle.vim应该是set rtp+=~/.vim/bundle/Vundle.vim .现在它起作用了!

关于vim - vim 中的语法高亮根本不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49708824/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com