I'm trying to install the following feature in vim:
https://github.com/luochen1990/rainbow
I did exactly what the manual installation says. I copied the file rainbow.vim to ~/.vim/plugin and added the sentence:
let g:rainbow_active = 1
to .vimrc file. However, when I try to source the .vimrc file, I get an error:
syntax: command not found
bash: let: g:rainbow_conf: syntax error in expression (error token is ":rainbow_conf")
Do you have an idea how to solve this problem?
BTW, I didn't install Vundle. That's why I used the manual installation.
Related
I use vim8. When I use vim, whether I open or save a file, there will be errors. To save a file, I must use: w!, Open the file must be q to close the error.
Error detected while processing function <SNR>66_MRU_Select_File_Cmd[21]..<SNR>66_MRU_Window_Edit_File[67]..BufRead Autocommands for "*"..function <SNR>25_Detect[17]..<SNR>25_BufInit[1]..<SNR>25_autoload[2]..script /root/.vim/bundle/vim-rails/autoload/rails.vim[169]..function <SNR>87_add_methods[2]..<SNR>87_function:
I tried to reinstall vim, but it didn't work
sudo apt remove vim
sudo apt install vim
Also try to modify the .vimrc file and copy the .vimrc file of vim that is normally used on other servers, but it doesn't work
I also tried to add the content shown in the answer here to the top of the file, but it still failed https://github.com/powerline/powerline/issues/1925
if has('python3')
silent! python3 1
endif
and i tried the solution here, but it still failed Error detected while processing function vundle#installer#new
set shell=/bin/bash
Then I tried the solution here, but it still didn't work https://github.com/vim/vim/issues/3117
mv ~/.vimrc ~/.vimrc_back
mv ~/.vim ~/.vim_back
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
cp ~/.vim/bundle/Vundle.vim/test/minirc.vim ~/.vimrc
What should I do so that vim can be used normally and no error will be reported
When a script is sourced by Vim it is given a number, which can be used to make sense of a stack trace like yours (edited for legibility):
Error detected while processing function <SNR>66_MRU_Select_File_Cmd[21]
..<SNR>66_MRU_Window_Edit_File[67]
..BufRead Autocommands for "*"
..function <SNR>25_Detect[17]
..<SNR>25_BufInit[1]
..<SNR>25_autoload[2]
..script /root/.vim/bundle/vim-rails/autoload/rails.vim[169]
..function <SNR>87_add_methods[2]
..<SNR>87_function:
Before reinstalling Vim, a more constructive approach would be to figure out whether the problem occurs in Vim's own runtime files or in yours. You can use :help :scriptnames to put a filename to those numbers, so to speak.
Without even seeing the output of that command, it doesn't take much effort to find out that at least some of your problems come from your runtime files:
" one plugin
<SNR>66_MRU_Select_File_Cmd[21]
<SNR>66_MRU_Window_Edit_File[67]
" another plugin
..script /root/.vim/bundle/vim-rails/autoload/rails.vim[169]
..function <SNR>87_add_methods[2]
..<SNR>87_function:
Which means that you should look for the actual cause, not throw the towel and reinstall Vim or try random answers to random unrelated questions.
One good starting point would be line 21 of function MRU_Select_File_Cmd() in script number 66, which should be a call to MRU_Window_Edit_File() in your outdated version. The stack trace then points to line 67 of that function, and so on.
Hypotheses:
badly installed plugins,
incompatible Vim version,
incompatible plugins,
options incompatible with your plugins,
etc.
Good luck.
I'm brand new to Vim and just trying to get setup with vim-airline. I'm using Pathogen to install and have followed the instructions provided. vim-airline is successfully cloned in ~/.vim/bundle/vim-airline.
When I try to add the required let g:airline_powerline_fonts = 1 instruction to my ~/.vimrc file I get the following error from the console when trying to source it:
bad math expression: ':' without '?'
I'm running vim 8.0.134 on macOS Sierra with zsh and oh-my-zsh.
Any ideas why this error is being thrown and how I can get around it?
It looks like you tried to run $ source ~/.vimrc in the shell?
I think you want to reload your vimrc file from within vim:
:source ~/.vimrc
Maybe you confused this with running $ source ~/.zshrc from the shell.
I am trying to incorporate cscope settings with vim to get an IDE like functionality.
I am using the popular cscope_maps.vim file http://cscope.sourceforge.net/cscope_maps.vim
in order to get these settings.I copied these settings to my vimrc file and and tried to source it.
This is the result I get for the same.
syntax error near unexpected token `'cscope''
Does this mean my Vim(version 7.0) doesnt support cscope ??
How do I resolve this.
I also observe that my ctags settings works perfectly
Thanks
Satwik
That error comes from your shell, not Vim. Compare:
$ if has("cscope")
-bash: syntax error near unexpected token `"cscope"'
with
:cscope
E492: Not an editor command: cscope
You need to source the plugin inside Vim!
So I git cloned the repository to ~/.vim/bundle and had pathogen installed. I can be sure pathogen works fine since my other plugins in bundle are all working fine. After googling for a while, it seems that syntastic should work out of box for c code. I also checked that I have all the executables specified in syntastic/syntax_checkers/c/.
Here is a part of my .vimrc file:
" syntastic
let g:syntastic_auto_loc_list=1
let g:syntastic_disabled_filetypes=['html']
let g:syntastic_enable_signs=1
When I open a *.c file and do :SyntasticCheck, nothing happens. There is no errors complaining command not found, so syntastic is loaded. However, even if the *.c file that's currently opened contains errors syntax error, syntastic is not showing anything.
It is the first time I use syntastic so I don't really know the correct way to invoke it.
I also tried :SyntasticCheck [c] and I get the following error message:
Error detected while processing function <SNR>_22_UpdateErrors..<SNR>22_CacheErrors:
line 16:
E121: Undefined variable: checkers
E15: Invalid expression: checkers
Can someone tell me what I did wrong and how to invoke syntastic?
Thanks!
Try adding this to your vimrc:
let g:syntastic_check_on_open=1
let g:syntastic_enable_signs=1
(This is lifted straight from my vimrc, which has some other Syntastic settings if you'd like.)
I don't really understand the reason, but when I re-installed the YouCompleteMe plugin for vim with ./install.sh --clang-completer. Syntastic works like charm.
Installing clang and/or ctags packages fixed this for me
I did two things and then Syntastic started to behave as expected with JS files and ESlint. Can't tell which one did the trick:
1- In the project's directory ran eslint --init.
2- Started vim opening the file without the -S flag.
Before it failed silently, no errors and no diagnostics. This is how ESlint behaves when there is no configuration file.
This question has been asked, in one form or another, a dozen times here, and it blows my mind how not a single one actually addresses how to configure syntastic or jslint such that it actually does what it is supposed to do (its README file is completely useless)
see here
Can anyone provide some step by step instructions, or a link to such instructions. I tried to install jslint and spidermonkey, and I got nowhere.
I managed to get the syntax check to work (thanks to romainl). A few things I learned along the way that may help anyone with a similar problem
To build Javascript Lint look for the README file nested in jsl-x.x.x/src/README.html
The build instructions are gmake -f Makefile.ref but gmake is the same thing as make so issue the command sudo ln -s /usr/bin/make /usr/bin/gmake
jsl will now be found in jsl-0.3.0/src/Linux_All_DBG.OBJ/jsl. To make it generally accessible do something like: ln -s /whatever/jsl-0.3.0/src/Linux_All_DBG.OBJ /home/ForestGump/bin/jsl. More information here
To check that jsl actually works find a test file ( here) then issue the command jsl -process test.js. It should list all the errors.
To customize your command line, add this to your vimrc file set statusline=%{SyntasticStatuslineFlag()}
What did you do? What works and what doesn't? Do you get error messages?
Here is what I did:
Downloaded the jsl sources from the JavaScript Lint site.
Built jsl and moved it somewhere in my $PATH.
Checked if it worked by running it against a random .js file
Downloaded and installed Syntastic as a Pathogen bundle.
Typed :helptags /path/to/syntastic/doc because for some reason Pathogen's automatic help tags generation doesn't work for me.
Read Syntastic's documentation: :help syntastic.
Steps 1 to 5 didn't take more than 3 or 4 minutes, maybe less.
Step 6 is obligatory, whatever new tool you try. RTFM.
I didn't have to configure anything beside these 3 lines in my .vimrc (and I believe the third is redundant):
let g:syntastic_auto_loc_list=1
let g:syntastic_disabled_filetypes=['html']
let g:syntastic_enable_signs=1
and customizing my statusline a bit with:
%{SyntasticStatuslineFlag()}
EDIT
Here is my statusline:
set statusline=%<\ %n:%f\ %m%r%y%{SyntasticStatuslineFlag()}%=line:\ %l\ of\ %L,\ col:\ %c%V,\ win:\ %{WindowNumber()}\
Don't copy it verbatim or you'll get some errors due to the function call at the end. There is a paragraph about that in syntastic's help.
END EDIT
After all that, 10 or 12 minutes if you count reading the documentation, I have a very helpful location list and signs poping up each time I save a .js file with syntax errors.
Setup vundle according to its README.
Put this into your .vimrc:
Bundle 'scrooloose/syntastic'
Then enter this command in vim:
:BundleInstall
That's it.
EDIT: Vundle has changed its syntax since I originally wrote this. Nowadays, you use
Plugin 'scrooloose/syntastic'
and then enter
:PluginInstall