Vim syntax checking


#1

Hello.

I have installed a plugin for vim that helps me point out when I type errors in the code.

But I have notice the plugin (I guess it is one of them below) does not like the last ( " ) in:

var = 'something'
print(f"when I print {var} correct I still got error ' )
#---the plugin does not like this quote--------------^
# it doesn't matter if I use single or double qoute  

" VIM syntax checking
Plugin ‘vim-syntastic/syntastic’
or
"PEP8 checking.
Plugin ‘nvie/vim-flake8’

Python doesn’t mind. The code runs perfectly.
Do I need to update, upgrade the plugin?
Or is another plugin better?


#2

Hmmmmmmm, I think that means the plugin is looking for Python 2 but you are using Python 3. Or, the plugin is using Python 3.5 but you are using python 3.6 or 3.7. Which plugin is it?


#3

I am using python 3.6
Using “vim --version” gives: VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 10 2018 21:31:58)"
Here is my .vimrc:

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

"Autocomplete
Bundle 'Valloric/YouCompleteMe'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.

" VIM syntax checking
Plugin 'vim-syntastic/syntastic'

"PEP8 checking.
Plugin 'nvie/vim-flake8'

" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted on GitHub
"" Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
"" Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
"" Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'}

"split navigations
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

I installed the plugin 3-4 months ago.
Unfortunately I do not remember which tutorial I used.
Perhaps this problem was there from the beginning. I just noticed this one recently.
Not a big problem though. But I have developed a need for fixing problem when learning python. :slight_smile:


#4

I had the same problem and it seemed to be linked to the plugins looking for Python 2 as Zed suggests. There were a few post for it in Stack Overflow iirc but I believe I had installed Flake8 via Brew to system Python (2).

Uninstall and use pip3 to reinstall Flake8 and you should be ok.


#5

Hello.

I have unistalled flake8 from vim.
So far so good.

But install with pip install does not give me this functionality vim? Or does it?
I am taking the risk to reveal my ignorance here :roll_eyes:
:grin:

I tried it though, following this tutorial http://flake8.pycqa.org/en/latest/user/invocation.html.
But when invoking it started up 4 processes that used up almost all memory. And the CPU fan was running at full speed.

Is there any alternatives to this plugin for vim?
Otherwise perhaps the old one is good enough?


#6

Uhhhhhhhhhhh I’d say don’t use flake then. Wow, that’s a lot of juice to just check code. You should only need to have python installed, and no flake or anything. I’ll have to double check but that’s all I install.


#7

Hello.

Thanks for answering.
I think I leave this now. It was just convenient to have something in vim that showed me error.
But not necessary at all.
I’ll find them sooner or later anyway.


#8

Alright, maybe I’ll take a look at how it’s being done in my videos and show you.