Skip to content
Iury O. G. Figueiredo edited this page Aug 26, 2016 · 2 revisions

The vyrc file consists of a sequence of python statements whose purpose is loading plugins and configuring preferences. Some plugins receive arguments, these arguments modify their behavior in some aspects. An example of such a plugin is listed below:

# Shifting blocks of code.
import vyapp.plugins.shift
autoload(vyapp.plugins.shift, width=4, char=' ')

The statements above tell python to import the plugin vyapp.plugins.shift then pass it as argument to the autoload function. That function is responsible by adding the vyapp.plugins.shift module to the list of modules that should be loaded whenever an AreaVi instance is created.

The vyapp.plugins.shift module implements keycommands to shift selected text to the left/right.

The most important statements of the vyrc file are the following:

##############################################################################
# User plugin space.

import sys
from os.path import expanduser, join
sys.path.append(join(expanduser('~'), '.vy'))
##############################################################################
# Functions used to load the plugins.
from vyapp.plugins import autoload, autocall

##############################################################################

The first three statements tells python to add your ~/.vy folder to the list of places in which python should look for imports. The remaining ones just import the autoload function and autocall function to be used afterwards. The autocall function receives as first argument a python function instead of a python module. Such a function is useful to set up some aspects of appearence for some Tkinter widgets.

There are some kinds of imports which don't demand the autoload function. These are statements that import command modules/plugins. These modules define python functions that are exposed in the vyapp.plugins.ENV environment. This dict is used by vy as environment variable when python code is dropped.

Example from ~/.vy/vyrc:

# Command plugins.
# Post files quickly with codepad.
from vyapp.plugins import codepad
Clone this wiki locally