sponsor Vim development Vim logo Vim Book Ad

python_tools : A "gf" mapping for locally-imported symbols in Python, and a few other tools

 script karma  Rating 0/0, Downloaded by 3  Comments, bugs, improvements  Vim wiki

created by
Andrew Radev
 
script type
utility
 
description
This plugin automatically looks up imported symbols in a Python file and highlights them by underscoring them. You can then use the built-in gf mapping to follow the imported symbol to its definition. You can also use CTRL-W_f, CTRL-W_gf and other functions in the same family.

A few additional buffer-local commands are available to perform certain editing tasks. Check the built-in documentation for details, or the README in the code repository: https://codeberg.org/AndrewRadev/python_tools.vim.

Here's a demo video of the plugin (and its extension, flask_tools) in action: https://www.youtube.com/watch?v=nth9-NxhILk.
 
install details
The easiest way to install the plugin is with a plugin manager:

- vim-plug: https://github.com/junegunn/vim-plug
- vundle:   https://github.com/VundleVim/Vundle.vim
- minpac:   https://github.com/k-takata/minpac

If you use one, just follow the instructions in its documentation.

You can install the plugin yourself using Vim's "packages" functionality by cloning the project (or adding it as a submodule) under `~/.vim/pack/<any-name>/start/`. For example:

    mkdir -p ~/.vim/pack/andrewradev/start
    cd ~/.vim/pack/andrewradev/start
    git clone https://codeberg.org/andrewradev/python_tools.vim.git

    # to generate documentation tags:
    vim -u NONE -c "helptags python_tools.vim/doc" -c q

This should automatically load the plugin for you when Vim starts. Alternatively, you can add it to `~/.vim/pack/<any-name>/opt/` instead and load it in your .vimrc manually with:

    packadd python_tools
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
python_tools.zip 0.1.0 2026-01-27 9.0 Andrew Radev Initial upload
ip used for rating: 216.73.216.22

Questions about Vim should go to the maillist. Help Uganda.     Vim at Github