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.
Related
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.
Ok so I'm setting up MacVim on my new macbook with Yosemite, using a homebrew installation.
To start off with I have no ~/.vimrc or ~/.gvimrc files setup at all.
Also I'm already familiar with links on stackoverflow which have explained that the .gvimrc file settings are usually applied after the .vimrc settings
When I execute the following command directly in MacVim my color scheme is applied fine
:colorscheme twilight
However, when I add the following line to a newly created ~/.gvimrc file the colour scheme does not load when I restart MacVim
colorscheme twilight
Keep in mind that I have nothing else apart from this line in my .gvimrc file and I have not setup a .vimrc file. If I execute the following command in MacVim
:scriptnames
I get the following output (not all lines included for clarity):
1: /usr/local/Cellar/macvim/7.4-73_1/MacVim.app/Contents/Resources/vim/vimrc
...
14: /usr/local/Cellar/macvim/7.4-73_1/MacVim.app/Contents/Resources/vim/gvimrc
...
20: ~/.gvimrc
You will noticed that MacVim thinks it has loaded the .gvimrc file. Anyone got any ideas why the color scheme won't load?
Ok so it looks like I've figured out what the problem is. The gvimrc and vimrc files were setup fine in the end, the problem is to do with what command you're supposed to execute to run MacVim
I came across the following link:
https://code.google.com/p/macvim/issues/detail?id=138
It was post #6 which made me realise that I was possibly running MacVim in the wrong way. I'm figuring that initially I probably mistakenly ran the MacVim binary directly which according to that post is the incorrect way to do it. Of course because I was running MacVim from spotlight it was repeatedly rerunning the incorrect command.
Anyway, I ran the command Vim -g from the command line instead and it worked fine.
I would best be described as a dabbler at this point in linux/vim. I'm trying to get started with go. Trying to install the vim-go plugin and i'm having issues. Following the following post.
I added the following to the end of my ~/.bashrc file:
export GOPATH=~/gocode
export PATH=$PATH:$GOPATH/bin
and created the following directory ~/gocode
So i created my ~/.vim/bundle & ~/.vim/autoload directories. I downloaded pathogen.vim to the autoload directory. I cloned the github repository for vim-go into the bundle directory which created a vim-go directory.
I created my ~/.vimrc file and added the following:
call pathogen#infect()
syntax enable
filetype plugin on
set number
let g:go_disable_autoinstall = 0
I executed the following from the vim console (which worked after installing Hg):
:GoInstallBinaries
FYI, i don't use vundle and to be honest don't even know what it is :).
So far the plugin doesn't seem to be working. When i type :help vim-go i get the following error: E149: Sorry, no help for vim-go
What am i do
Using the manual install method (copying vim-go/ to ~/.vim) I was able to get it working but only once I had the following ~/.vimrc file, and of course the Go binaries installed as per the instructions.
set nocompatible
set shell=/bin/sh
syntax on
filetype plugin on
let g:go_disable_autoinstall = 0
This was done on an Ubuntu 14.04 desktop with no other vim plugins or prior ~/.vim directory or ~/.vimrc. Frankly the official install instructions and many of the tutorials out there assume to much to be useful on a fresh install of Ubuntu.
However "help vim-go" was still not working for me. Tried the following command from within the ~/.vim directory and got that working: Vim helptag generation
solution put that in you .vimrc :
set nocompatible
execute pathogen#infect()
syntax on
filetype on
filetype plugin on
filetype plugin indent on
go in your .zshrc ou .bashrc and put :
export GOPATH="$HOME/gocode/"
export PATH=$PATH:~/gocode/bin
and in terminal do :
source .zshrc
or
source .bashrc
and now go to
cd ~/.vim/bundle
and do if youuse pathogen :
git clone https://github.com/fatih/vim-go.git
in vim do :
:GoInstallBinaries
test one of this commands :
:GoFmt
:GoLint
I'm trying to use the CoqIDE for vim plugin I found on this page.
I put the coq_IDE.vim file in ~/.vim/ftplugin folder. My current .vimrc file is:
set showcmd
set number
imap hl <Esc>
filetype plugin on
But when I start vim CoqIDE doesn't load automatically (I see no change whatsoever compared to normal vim, so I don't think it did). And when I try to load it manually by the command :source coq_IDE.vim, I get the following error message:
E484: Can't open file coq_IDE.vim
What could be the source of this error?
Here are some additional information that might be relevant:
1) I am running Ubuntu 14.04.
2) I checked that :version in vim shows +perl.
2) I am running vim from terminal, not gvim.
3) I tried removing and reinstalling different versions of vim (vim, vim-gtk, vim-gnome)
4) The CoqIDE installation guide says that coqtop.opt should be accessible via the PATH variable. Since I'm not even sure what this means, this might be the problem here, but that seems unlikely. From what I understand vim is getting errors when trying to read coq_IDE.vim, so it's not even getting to the part where it's looking for coqtop.opt.
5) I have CoqIDE installed from Ubuntu Software Center.
6) With :echo &runtimepath I get: ~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after
The instructions are bad.
Put the file in ~/.vim/plugin not ~/.vim/ftplugin
The file layout should look exactly like the file layout found in this mirror for the plugin. https://github.com/vim-scripts/CoqIDE. (Maybe take a look at pathogen or vundle,).
The reason the :source coq_IDE.vim fails is vim is looking for the file coq_IDE.vim in the current directory and it isn't there. Use the full path to file if you are going to source it manually. (You shouldn't need to though.)
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.