spf13-vim
spf13-vim copied to clipboard
there is always undefined variable error "E121: Undefined variable: g:spf13_bundle_groups" after installation
Hi, OS: MacOS 14.3.1 (23D60) Vim: VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Dec 20 2023 18:57:50)
I installed the spf13 like below:
(base) ➜ ~ curl https://j.mp/spf13-vim3 -L -o - | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 142 100 142 0 0 146 0 --:--:-- --:--:-- --:--:-- 146
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
100 5230 100 5230 0 0 27 0 0:03:13 0:03:08 0:00:05 1429
Trying to update spf13-vim
From https://github.com/spf13/spf13-vim
* branch 3.0 -> FETCH_HEAD
Already up to date.
[✔] Successfully updated spf13-vim
[✔] Setting up vim symlinks.
Trying to update vundle
Cloning into '/Users/username/.vim/bundle/vundle'...
remote: Enumerating objects: 3160, done.
remote: Counting objects: 100% (15/15), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 3160 (delta 3), reused 8 (delta 0), pack-reused 3145
Receiving objects: 100% (3160/3160), 944.82 KiB | 245.00 KiB/s, done.
Resolving deltas: 100% (1111/1111), done.
[✔] Successfully cloned vundle.
Vim: Warning: Input is not from a terminal
[✔] Now updating/installing plugins using Vundle
after installation, I tried to open the .vimrc like below:
(base) ➜ ~ vim .vimrc
Error detected while processing /Users/username/.vimrc:
line 178:
E121: Undefined variable: g:spf13_bundle_groups
E116: Invalid arguments for function count(g:spf13_bundle_groups, 'go')
line 201:
E121: Undefined variable: g:spf13_bundle_groups
E116: Invalid arguments for function count(g:spf13_bundle_groups, 'writing')
line 212:
E121: Undefined variable: g:spf13_bundle_groups
E116: Invalid arguments for function count(g:spf13_bundle_groups, 'writing')
line 373:
E117: Unknown function: WINDOWS
line 429:
E121: Undefined variable: g:spf13_bundle_groups
E116: Invalid arguments for function count(g:spf13_bundle_groups, 'youcompleteme')
line 471:
E121: Undefined variable: g:spf13_bundle_groups
E116: Invalid arguments for function count(g:spf13_bundle_groups, 'neocomplete')
line 701:
E121: Undefined variable: g:spf13_bundle_groups
E116: Invalid arguments for function count(g:spf13_bundle_groups, 'neocomplcache') || count(g:spf13_bundle_groups, 'neocomplete')
Press ENTER or type command to continue
I tried to reinstalled for another 2 times, but it still had those errors, how can I fix them?
您好!您的邮件已收到,我将会尽快地进行处理,谢谢来信!
I figured out the problem. I found that the .vimrc file lost the following code snippet
" Environment {
" Identify platform {
silent function! OSX()
return has('macunix')
endfunction
silent function! LINUX()
return has('unix') && !has('macunix') && !has('win32unix')
endfunction
silent function! WINDOWS()
return (has('win32') || has('win64'))
endfunction
" }
" Basics {
set nocompatible " Must be first line
if !WINDOWS()
set shell=/bin/sh
endif
" }
" Windows Compatible {
" On Windows, also use '.vim' instead of 'vimfiles'; this makes synchronization
" across (heterogeneous) systems easier.
if WINDOWS()
set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
endif
" }
" Arrow Key Fix {
" https://github.com/spf13/spf13-vim/issues/780
if &term[:4] == "xterm" || &term[:5] == 'screen' || &term[:3] == 'rxvt'
inoremap <silent> <C-[>OC <RIGHT>
endif
" }
" }
" Use before config if available {
if filereadable(expand("~/.vimrc.before"))
source ~/.vimrc.before
endif
" }
" Use bundles config {
if filereadable(expand("~/.vimrc.bundles"))
source ~/.vimrc.bundles
endif
" }
After I added the snippet manually, the vim worked well. Although this bug still need to be fixed, but it will no bother me any more.