about summary refs log tree commit diff stats
path: root/ranger/api/__init__.py
blob: 3c7818b850143e43e9998a461ff63933d0ff8b2a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# This file is part of ranger, the console file manager.
# License: GNU GPL version 3, see the file "AUTHORS" for details.

"""Files in this module contain helper functions used in configuration files."""

import ranger  # NOQA

from ranger.core.linemode import LinemodeBase  # NOQA


# Hooks for use in plugins:
def hook_init(fm):  # pylint: disable=unused-argument
    """A hook that is called when ranger starts up.

    Parameters:
      fm = the file manager instance
    Return Value:
      ignored

    This hook is executed after fm is initialized but before fm.ui is
    initialized.  You can safely print to stdout and have access to fm to add
    keybindings and such.
    """


def hook_ready(fm):  # pylint: disable=unused-argument
    """A hook that is called after the ranger UI is initialized.

    Parameters:
      fm = the file manager instance
    Return Value:
      ignored

    This hook is executed after the user interface is initialized.  You should
    NOT print anything to stdout anymore from here on.  Use fm.notify instead.
    """


def register_linemode(linemode_class):
    """Add a custom linemode class.  See ranger.core.linemode"""
    from ranger.container.fsobject import FileSystemObject
    FileSystemObject.linemode_dict[linemode_class.name] = linemode_class()
    return linemode_class