.vimrc:第4行:意外令牌'('附近的语法错误

时间:2018-09-19 20:24:00

标签: vim

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

  

$ source〜/ .vimrc   -bash:让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

2 个答案:

答案 0 :(得分:4)

似乎您是从bash采购.vimrc。这不是bash脚本。相反,您应该从Vim内部获取它:

for d in data:
    for key in d.keys():
        print(d[key])

或者只是重新启动Vim。

答案 1 :(得分:2)

似乎您正像从 downloadImage(downloadLink) { this.orderService.getImage(downloadLink).subscribe( (res) => { const a = document.createElement('a'); a.href = URL.createObjectURL(res); a.download = 'comprobante'; document.body.appendChild(a); a.click(); }); 一样尝试从bash获取.vimrc,但这是vim特定的设置文件。如果vim运行在您的.bashrc中,并且它在您路径中的正确位置(这似乎是基于错误消息),它将自然而然地找到它。

如果您已经在vim中,并且已经对.vimrc进行了一些更改,或者希望加载另一个,可以通过进入命令模式并调用source

从vim中获取它。
.vimrc