I read some articles about Vimscripting with python. I felt very interested. So I tried to figure out how to do vimscripting with python. But when I tried to import vim, it showed that the module vim wasn't installed. So I searched on the web, but still haven't find the module to install. I also tried pip to search automatically, still failed. Does anyone know where to find the module vim?
I am using fedora 17, and I have installed vim 7.3 and python 2.7.
Thanks in advance.
Here is the error message:
>>> import vim
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named vim
Python's ImportError ( ModuleNotFoundError ) indicates that you tried to import a module that Python doesn't find. It can usually be eliminated by adding a file named __init__.py to the directory and then adding this directory to $PYTHONPATH .
+python3 - Vim has built-in support for Python 3. +python - Vim has built-in support for Python 2. +python3/dyn - Vim has dynamic support for Python 3.
In Python, you use the import keyword to make code in one module available in another. Imports in Python are important for structuring your code effectively. Using imports properly will make you more productive, allowing you to reuse code while keeping your projects maintainable.
It doesn't seem like you need to import it, just make sure your vim is compiled with python support. Check this using vim --version | grep +python. Further, it seems that the vim module is imported automatically when in vim, rendering your import line unnecessary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With