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.


#9

I think whatever that was it’s fixed now. I installed Flake8 and Vim-flake8 (using Pathogen) and it works nicely.


#10

Hello @io_io.

Thanks for the link.
I will try that soon. I still use vim. But more and more moving over to pycharm.
Probably I still going to use every now and then.

Thanks for the heart at my pytest for ex49.


#11

Hi there, @ulfen69.
I am using Vim for everything now, very unlikely to change it. :smiley:
Do you know about the weekend seminars? Haven’t seen you there, this is why I am asking.


#12

Hi @io_io
Weekend seminars?
What am I missing?
Is it about vim or Python?


#13

@zedshaw usually does 2 seminars in weekends, on different topics. It can be Python, it can be JavaScript, Django, server security,etc.
He sends mails to announce the seminars and he also tweets about it.
The seminars are part of the LCLive : https://shop.learncodethehardway.org/live/
The last ones were free so anyone could join.
Maybe message him directly here on the forum and ask him how to join.
P.S. He did a long series on Vim too, there are vids you could download, don’t forget to ask him about them if interested.