.vimrc:第 4 行:意外标记“(”附近的语法错误[重复]

2024-03-24

我正在尝试配置 Vim。但是当我尝试获取来源时.vimrc编辑文件后出现以下错误:

$ 源 ~/.vimrc -bash: let g:plug_shallow = 0 : 未找到命令 -bash: /Users/stevenaguilar/.vimrc: 第 4 行:意外标记附近出现语法错误(' -bash: /Users/stevenaguilar/.vimrc: line 4:调用plug#begin()'

我不明白这个错误来自哪里。它会在线抛出错误call plug#begin()这是关闭的。这是完整的.vimrc

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:plug_shallow = 0 " disable shallow cloning

call plug#begin()

Plug 'airblade/vim-gitgutter'                 " shows a git diff in the gutter
Plug 'altercation/vim-colors-solarized'       " precision colorscheme
Plug 'godlygeek/tabular'                      " text filtering and alignment
Plug 'janko-m/vim-test'                       " test runner
Plug 'phallstrom/vim-sailfish'
Plug 'scrooloose/nerdtree'                    " tree explorer
Plug 'sjl/gundo.vim'                          " graph your vim undo tree
Plug 'tpope/vim-commentary'                   " comment stuff out
Plug 'tpope/vim-endwise'                      " wisely add 'end' in ruby, endfunction/endif/more in vim script, etc
Plug 'tpope/vim-fugitive'                     " git wrapper
Plug 'tpope/vim-rails', { 'for': ['ruby'] }   " ruby on rails power tools
Plug 'vim-ruby/vim-ruby', { 'for': ['ruby'] } " vim/ruby configuration
Plug 'tpope/vim-projectionist'                " project configuration (file jumping)
Plug 'kana/vim-textobj-user'                  " create your own text objects
Plug 'nelstrom/vim-textobj-rubyblock'         " custom text object for selecting ruby blocks
Plug 'tpope/vim-surround'                     " quoting/parenthesizing made simple
Plug 'chriskempson/base16-vim'                " color schemes, https://chriskempson.github.io/base16/
Plug 'w0rp/ale'                               " asynchronous lint engine
Plug 'editorconfig/editorconfig-vim'          " editorConfig plugin
Plug 'vim-airline/vim-airline'                " status/tabline
Plug 'vim-airline/vim-airline-themes'         " status/tabline themes
Plug 'pangloss/vim-javascript'                " Javascript syntax
Plug 'mxw/vim-jsx'                            " react jsx syntax
Plug 'posva/vim-vue', { 'for': ['vue'] }      " Vue.js syntax
Plug '/usr/local/opt/fzf' | Plug 'junegunn/fzf.vim' " A command-line fuzzy finder written in Go
Plug 'kien/rainbow_parentheses.vim', { 'for': ['clojure'] } " Better Rainbow Parentheses
Plug 'guns/vim-clojure-static', { 'for': ['clojure'] } " Meikel Brandmeyer's excellent Clojure runtime files
Plug 'tpope/vim-unimpaired'                   " pairs of handy bracket mappings
Plug 'tpope/vim-abolish'                      " easily search for, substitute, and abbreviate multiple variants of a word
Plug 'mechatroner/rainbow_csv'                " highlighting columns in csv/tsv files
Plug 'slim-template/vim-slim' " slim syntax highlighting for vim

call plug#end()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

set t_Co=256

set nocompatible      " We're running Vim, not Vi!
set synmaxcol=500     " don't try to highlight long lines
compiler ruby         " Enable compiler support for ruby

filetype plugin on

set background=dark
colorscheme base16-oceanicnext

set backspace=2
set expandtab
set tabstop=2 shiftwidth=2 softtabstop=2
set autoindent
set nowrap
set nrformats=

set backupdir=$HOME/.vimbackup,.
set directory=$HOME/.vimswap,.

au FocusLost * :wa

set ignorecase
set smartcase
set scrolloff=2
set ttyfast
set hidden
set wildmenu
set wildmode=list:longest
nnoremap <leader>nt :NERDTreeToggle<enter>

source $VIMRUNTIME/macros/matchit.vim

" fzf
nnoremap <silent> <C-p> :Files<CR>
nnoremap <silent> <Leader>b :Buffers<CR>

" https://github.com/tpope/vim-commentary/commit/4dcfc318e0b02fdbb0c2d9ff77cf3562b46eea25
xmap \\  <Plug>Commentary
nmap \\  <Plug>Commentary

set updatetime=250

nmap <silent> <leader>s :TestNearest<CR>
nmap <silent> <leader>t :TestFile<CR>
nmap <silent> <leader>T :TestSuite<CR>

set mouse=a
vnoremap <Leader>c "*y
noremap <Leader>v "*p

set nofixeol

set formatoptions+=j " Delete comment character when joining commented lines

au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") |
    \ exe "normal g'\"" | endif

let g:omni_sql_no_default_maps = 1 " disable SQL autocompletion entirely

" To ensure that EditorConfig plugin works well with Tim Pope's fugitive
let g:EditorConfig_exclude_patterns = ['fugitive://.*']

" ALE - Asynchronous Lint Engine
let g:ale_lint_on_enter = 0        " no checks on open
let g:ale_lint_on_save = 1         " check on save
let g:ale_lint_on_text_changed = 1 " check on text change
let g:ale_lint_delay = 300         " millisecond delay before checking

" Airline
let g:airline_theme = 'base16'                  " theme
set laststatus=2                                " always show airline
set noshowmode                                  " hide default mode indicator
let g:airline_powerline_fonts = 1               " use powerline font
let g:airline#extensions#wordcount#enabled = 0  " disable word counting
let g:airline#extensions#whitespace#enabled = 0 " disable detection of whitespace errors

if filereadable($HOME."/.vimrc_local")
  source $HOME/.vimrc_local
endif

let g:jsx_ext_required = 0 " JSX syntax in .js files

" open file splits in vsplit by default
:nnoremap <C-W>f :vertical wincmd f<CR>

" https://github.com/posva/vim-vue#how-can-i-use-existing-configurationplugins-in-vue-files
" autocmd BufRead,BufNewFile *.vue setlocal filetype=vue.html.javascript.css

au FileType clojure exe "RainbowParenthesesLoadRound" | RainbowParenthesesActivate

" open NERDTree automatically when vim starts up on opening a directory
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif

" https://github.com/slim-template/vim-slim/issues/38#issuecomment-23760100
autocmd BufNewFile,BufRead *.slim setlocal filetype=slim

看来您是从 bash 获取 .vimrc 的。这不是 bash 脚本。相反,您应该从 Vim 内部获取它:

:source ~/.vimrc
:source $MYVIMRC

或者只是重新启动 Vim。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

.vimrc:第 4 行:意外标记“(”附近的语法错误[重复] 的相关文章

  • vim 中的切换功能

    基本上我想做的是 map e call ToggleEssayMode
  • 在vim中禁用omnicomplete或ftplugin或其他东西

    我正在尝试禁用 sql 中的 自动 全向 任意 完成 这对我来说是个问题 因为我用过
  • 更改背景颜色

    好吧 我对 vim 还很陌生 我不知道如何更改背景颜色 我正在编辑 vimrc 文件来设置这些颜色 但找不到任何背景颜色 我正在使用一个配色方案 我只需要知道如何覆盖它或者要查找什么 以便我可以在我的 color theme vim 文件中
  • 关闭文件而不退出 VIM 应用程序?

    我用 e and w用于编辑和写入文件的命令 我不确定是否有 close 命令可以在不离开Vim的情况下关闭当前文件 I know that the q command can be used to close a file but if
  • 可以使 ctag 遵循 #include 指令吗?

    我正在尝试在我的 Makefile 中创建一个目标来自动创建tags使用 ctags 文件 我有一个源文件列表 cpp 文件 但我没有所有头文件的列表 我使用g MM创建标头依赖项列表 我本以为 ctags 会遵循任何 include生成标
  • 如何跳转到 vim 中不同选项卡内的标记?

    我使用 MacVim 通常会打开许多 选项卡 我希望能够在任何打开的文件中放置标记并在它们之间跳转 mK and K当标记位于同一个选项卡中时效果很好 但我必须使用gt找到选项卡 然后K找到标记 一定有更好的方法吗 这是一个快速而肮脏的技巧
  • vim可以实时监控文件的变化吗

    我的问题与此类似如何实时监控文本文件 https stackoverflow com questions 18632 how to monitor a text file in realtime但我想在vim中做 我知道我可以读取打开的文件
  • 使用新文件名保存文件:附加到现有文件名

    有没有一种简单的方法 在 VIM 中 使用当前名称加上附加短语保存当前打开的文件 即 来自 home affert type vim data folder file1 txt 然后将文件另存为 data folder file1 txt
  • 选项卡视觉选择

    In many GUIs when I select a section of text and then hit the Tab or Shift Tab button the selected section will indent i
  • Vim:如何交换两个字符?

    有没有快速更改的命令 Cnotrol to Control While in normal mode with your cursor on top of the first character to swap you can type x
  • Vim NerdCommenter:在 vimrc 中添加新文件类型

    有没有办法在 vimrc 中为 NerdCommenter 定义新的文件类型注释 它已经可以工作了 但是如果我可以将其直接放入 vimrc 中 备份配置会更容易 Thanks NERDCommenter 能够解析commentstring选
  • 有没有办法在 Vim 中映射 Ctrl 句点和 Ctrl 逗号?

    我似乎找不到绘制地图的方法
  • 插件 (vim-latex) 在启动时导致 gVim 崩溃

    我正在尝试使用在 Windows XP 上使用 gVim 但是一旦我打开 tex 文件 或者一旦我set ft tex gVim 崩溃且没有可见的错误消息 控制台 vim 中不会发生崩溃 我已经按照设置说明进行了操作 据我所知 并且我尝试禁
  • 在 vim 中,+register 和 +register 与 .命令?

    我很难理解这个问题的解决方案维姆高尔夫挑战赛 http vimgolf com challenges 5192f96ad8df110002000002 最好的建议解决方案是 cw
  • VIM:在窗口顶部显示自定义参考栏

    我想设置一个 vim 环境来使用基本的 HTML 编辑 由其他人 为此 我想设置一个快速参考栏 显示在窗口顶部 例如
  • 在 Vim 中的缩进线上按“Home”

    我有一个坏习惯 就是使用 home 键返回到行首 当我最近开始使用 vim 时 我注意到当我在缩进的行上按 home 键时 它会让我回到该行的开头 在 Notepad 我曾经使用的编辑器 中 它会让我返回到该行代码的开头 就在缩进之后 有没
  • 带有 Viper 和 Vimpulse 的 Emacs 缺少哪些 Vim 功能?

    Emacs 的一些重要功能在 Vim 中是缺失的 例如 comint 模式 并且没有脚本 插件可以替代它们 与 Emacs 相比 Vim 也有一些优点 例如模式编辑和通常更好的默认快捷键 然而 Viper 模式让我两者兼而有之 Vimpul
  • 运行 tmux 时映射箭头键

    这些键映射在 tmux 中停止工作 在我的 vimrc 我有 nmap
  • 如果文件类型 == tex

    如果文件是乳胶文件 我想在 vimrc 中运行命令 我想我的语法有问题 但它不起作用 有什么线索吗 if filetype tex set spell endif 您可以使用自动命令来实现您想要的 autocmd BufNewFile Bu
  • git 提交消息的 vim 语法高亮显示 - 自定义 commentchar

    如上所述在这个答案中 https stackoverflow com a 14931661 835945 从 Git 1 8 2 开始你可以使用core commentchar配置值将提交消息注释更改为默认值以外的其他内容 哈希标记或哈希符

随机推荐