sponsor Vim development Vim logo Vim Book Ad

flask_tools : A "gf" mapping and other tools for Flask apps

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

created by
Andrew Radev
 
script type
utility
 
description
This plugin overrides the built-in |gf| mapping (and others in the same
family, like |CTRL-W_f|, and |CTRL-W_gf|) to follow Jinja2 imports and
certain other references to files within a Flask project. Imported macros
within templates are underscored to indicate they can be followed.

The implementation depends on python_tools.vim
(https://codeberg.org/AndrewRadev/python_tools.vim) which provides the basic
|gf| family of mappings for python files, while flask_tools augments it and
adds a few more things. Please make sure to have the dependent plugin
installed to use this one.

For more details, check out the built-in documentation or the README in the code repository: https://codeberg.org/AndrewRadev/flask_tools.vim

Here's a demo video of both plugins 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/flask_tools.vim.git

    # to generate documentation tags:
    vim -u NONE -c "helptags flask_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 flask_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
flask_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