In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to access / view Python help when using Vim, the article is very detailed, has a certain reference value, interested friends must read it!
I am a new Vim editor user. I use it to write Python code. Is there a way to view Python documents in vim without having to access the Internet? Suppose my cursor is under the print keyword in Python, and then press F1, I want to see the help of the keyword print. How do I display python help () in vim? How do I call pydoc3/pydoc for help without leaving vim?
The pydoc or pydoc3 command can display a text document based on the name of a Python keyword, topic, function, module, or package, or a reference to a class or function by a module within a module or package. You can call pydoc from Vim. Let's take a look at how to use pydoc to access Python documents in the Vim editor.
Use pydoc to access python help
The syntax is:
Pydoc keywordpydoc3 keywordpydoc lenpydoc print
Edit your ~ / .vimrc
$vim ~ / .vimrc
Add the following configuration for pydoc3 (python v3.x documentation). Create a mapping of the H key in normal mode:
Nnoremap H: execute "! pydoc3". Expand ("")
Save and close the file. Open the Vim editor:
$vim file.py
Write some code:
#! / usr/bin/python3x=5y=10z=x+yprint (z) print ("Hello world")
Place the cursor below the Python keyword print, then press Shift, and then press H. You will see the following output:
Press H to view help for the Python keyword print
How to view python help when using Vim
Jedi-vim is a Vim plug-in that binds the auto-completion library Jed. It can do a lot of things, including displaying keyword help when you press Shift followed by K (that is, press uppercase K).
How to install jedi-vim on Linux or Unix-like systems
Install jedi-vim using pathogen, vim-plug, or Vundle. I am using vim-plug. Add the following line to ~ / .vimrc:
Plug 'davidhalter/jedi-vim'
Save and close the file. Start Vim and enter:
PlugInstall
On Arch Linux, you can also use the pacman command to install jedi-vim from vim-jedi in the official repository:
$sudo pacman-S vim-jedi
It can also install vim-python-jedi using apt-get command/apt-get command on Debian (such as 8) and Ubuntu (such as 14.04):
$sudo apt install vim-python-jedi
On Fedora Linux, it can install vim-jedi with dnf:
$sudo dnf install vim-jedi
Jedi is initialized automatically by default. So you don't need further configuration. To view Documentation/Pydoc, press K. It will pop up the help window:
The above is all the contents of the article "how to access / View Python help when using Vim". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.