Hot answers tagged

3

You mention in the comments, that the file Python.h is located in the directory $LOCAL_INSTALL/include/python3.8. This directory is not in the search path for include files. So it has to be added manually. export CFLAGS="-I$LOCAL_INSTALL/include/python3.8" ./configure ... The configure script adds the compiler flags from the environment variable ...


2

What I would do is the following: ESC :w to write (save) the file. Then :e number12.py. That will open a new buffer in the current window, if the file doesn't exist.


2

What program is called when K is pressed is set by keywordprg. By default, this is set to man (the linux manual). Changing it to pydoc so as to get Python documentation will do the trick, but then you don't the manual being checked anymore - which is an issue if, for example, you're working with C code, as C's library code has documentation in the man system ...


2

It seems that when you copied the snippet you forgot to add the indentation spaces in the python snippet conditional code as shown in the error message: Executed snippet code: 1 2 if t[2] and t[2][0] not in [',', '.', '?', '-', ' ']: 3 snip.rv = ' ' 4 else: 5 snip.rv = '' 6 Try to change it to: snippet im "create an inline ...


1

In my case I had to run this command: pip3 install --user jedi


1

You must escape spaces in directory names using a backslash. Also note that "autoload" subdirectory is not a proper place to put your python files.


1

Here are the commands I use to create a python 3.6.0 pyenv on a Mac using homebrew. Please note that I use neovim but the process to create a pyenv will not be much different for vim. Install readline and xz along with pyenv and pyenv-virtualenv brew install pyenv pyenv-virtualenv readline xz Install python 3.6.0 CFLAGS="-I$(brew --prefix openssl)/...


1

You can compile Vim from source to configure which interpreter it should use. The full instructions can be found on the YouCompleteMe wiki. It turns out the method described in the original post is correct: configuring the installation with the following options should have Vim link against Python 3.7 ./configure \ --enable-python3interp=yes \ ...


1

Here's a pure vimscript function that builds up the command by searching for functions (def) and classes (class). You may need to adjust the filename modifiers or the command; parameters or global vars could be used for that if one wanted to build a plugin. " ~/.vim/autoload/python.vim function python#runTest() abort const l:file = expand('%:p') if ...


1

I have managed to automate this feature using vimscript-python. Add this function to your ~/.vimrc: function! RunCurrentPythonTest() python3 << EOF import re import vim # https://vimhelp.org/if_pyth.txt.html cursor = vim.current.window.cursor test_filename = vim.eval("expand('%p')") test_name = None class_name = None for line_no in range(...


1

Check :version of your gvim. It should have +python3/dyn there for the python3 support. Both python3 and gvim should be 64 bit. (Windows binaries from vim.org are 32bit) Then try adding to your vimrc: set pythonthreedll=python38.dll set pythonthreehome=C:/Users/nikhi/AppData/Local/Programs/Python/Python38/


1

Specifying the python version in the script like #!/usr/bin/python3 (instead of just #!/usr/bin/python) solves the problem.


Only top voted, non community-wiki answers of a minimum length are eligible