I have a problem with my vim config...
This error occurs when opening python (.py) files:
Error detected while processing BufRead Auto commands for "*.py": E20: Mark not set
When opening for example html (.html) or ruby (.rb) files, the error does not occur.
Here is my vim config. The plugins are all installed.
""" VUNDLE """ set nocompatible filetype off set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() Plugin 'VundleVim/Vundle.vim' " plugins Plugin 'valloric/youcompleteme' Plugin 'scrooloose/nerdtree' Plugin 'jistr/vim-nerdtree-tabs' Plugin 'shawncplus/phpcomplete.vim' Plugin 'quramy/tsuquyomi' "Plugin 'Shougo/vimproc.vim' Plugin 'leafgarland/typescript-vim' call vundle#end() filetype plugin indent on """ CONFIG """ set history=200 "command history set so=7 "add 7 lines when moving up/down set hlsearch "highlight search results set showmatch "highlight matching brackets set ruler set relativenumber syntax enable set encoding=utf8 set ffs=unix,dos,mac "unix as standard file type set expandtab set smarttab set shiftwidth=4 set tabstop=4 set ai "Auto indent set si "Smart indent set nowrap "Wrap lines set laststatus=2 " whitespace set list set listchars=tab:>-,trail:~,extends:>,precedes:< set nobackup set nowb set noswapfile " NERDTree map <C-n> :NERDTreeToggle<CR> "autocmd vimenter * NERDTree " NERDTreeTabs let NERDTreeShowHidden=1 let g:nerdtree_tabs_open_on_console_startup=1 map <Leader>n <plug>NERDTreeTabsToggle<CR> au FileType php setl ofu=phpcomplete#CompletePHP au FileType ruby,eruby setl ofu=rubycomplete#Complete au FileType html,xhtml setl ofu=htmlcomplete#CompleteTags au FileType css setl ofu=csscomplete#CompleteCSS au FileType python setl ofu=pythoncomplete#Complete au BufNewFile,BufRead *.py, *.php, *.rb, *.html, *.js, *.ts, *.md \ set tabstop=4 | \ set softtabstop=4 | \ set shiftwidth=4 | \ set textwidth=79 | \ set expandtab | \ set autoindent | \ set fileformat=unix au BufNewFile,BufRead *.css, *.scss, *.json \ set tabstop=2 | \ set softtabstop=2 | \ set shiftwidth=2 | \ set textwidth=79 | \ set expandtab | \ set autoindent | \ set fileformat=unix let g:ycm_python_binary_path = 'python' if !exists("g:ycm_semantic_triggers") let g:ycm_semantic_triggers = {} endif " TypeScript plugin tsuquyomi let g:ycm_semantic_triggers['typescript'] = ['.'] let g:tsuquyomi_import_curly_spacing = 0 let g:tsuquyomi_single_quote_import = 1 map <C-i> :TsuImport<CR> hi Pmenu ctermbg=green
I did change the line with "BufNewFile" into different ways (1 set
command, multiple set
commands, with pipes, without pipes, with backslashes, without backslashes, etc.) but nothing helped.
Does anyone know what exactly the problem is?
It's hard to notice (I had to look twice), but the problem is the spaces between the patterns in the :autocmd
definition:
The syntax is
:au[tocmd] [group] {event} {pat} [nested] {cmd}
:help {pat}
shows that there must not be whitespace between individual patterns.
:au BufNewFile,BufRead *.py, *.php, *.rb, *.html, *.js, *.ts, *.md echomsg 'test' :au BufRead *.py --- Auto-Commands --- filetypedetect BufRead *.py setf python BufRead *.py *.php, *.rb, *.html, *.js, *.ts, *.md echomsg 'test'
As you can see, Vim only recognizes the first pattern, and takes all following as (Ex) commands!
The :*
command executes the contents of a register (probably rubbish), and that causes the E20
error you've seen (probably because there's the '
character in the register).
Drop the whitespace. As I've already commented, you can also skip repeating the :set
commands for each option.
:au BufNewFile,BufRead *.py,*.php,*.rb,*.html,*.js,*.ts,*.md ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With