about summary refs log tree commit diff stats
path: root/examples/plugin_chmod_keybindings.py
blob: 63f42b0eb46d4fe9a8345019006b298d00c0ed35 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Compatible with ranger 1.6.0 through ranger 1.7.*
#
# This plugin serves as an example for adding key bindings through a plugin.
# It could replace the ten lines in the rc.conf that create the key bindings
# for the "chmod" command.

import ranger.api
old_hook_init = ranger.api.hook_init


def hook_init(fm):
    old_hook_init(fm)

    # Generate key bindings for the chmod command
    command = "map {0}{1}{2} shell -d chmod {1}{0}{2} %s"
    for mode in list('ugoa') + ['']:
        for perm in "rwxXst":
            fm.execute_console(command.format('-', mode, perm))
            fm.execute_console(command.format('+', mode, perm))

ranger.api.hook_init = hook_init
d_shows_usage_when_no_arg(void **state); void cmd_account_add_adds_account(void **state); void cmd_account_enable_shows_usage_when_no_arg(void **state); void cmd_account_enable_enables_account(void **state); void cmd_account_enable_shows_message_when_account_doesnt_exist(void **state); void cmd_account_disable_shows_usage_when_no_arg(void **state); void cmd_account_disable_disables_account(void **state); void cmd_account_disable_shows_message_when_account_doesnt_exist(void **state); void cmd_account_rename_shows_usage_when_no_args(void **state); void cmd_account_rename_shows_usage_when_one_arg(void **state); void cmd_account_rename_renames_account(void **state); void cmd_account_rename_shows_message_when_not_renamed(void **state); void cmd_account_set_shows_usage_when_no_args(void **state); void cmd_account_set_shows_usage_when_one_arg(void **state); void cmd_account_set_shows_usage_when_two_args(void **state); void cmd_account_set_shows_message_when_account_doesnt_exist(void **state); void cmd_account_set_jid_shows_message_for_malformed_jid(void **state); void cmd_account_set_jid_sets_barejid(void **state); void cmd_account_set_jid_sets_resource(void **state); void cmd_account_set_server_sets_server(void **state); void cmd_account_set_resource_sets_resource(void **state); void cmd_account_set_resource_sets_resource_with_online_message(void **state); void cmd_account_set_password_sets_password(void **state); void cmd_account_set_eval_password_sets_eval_password(void **state); void cmd_account_set_password_when_eval_password_set(void **state); void cmd_account_set_eval_password_when_password_set(void **state); void cmd_account_set_muc_sets_muc(void **state); void cmd_account_set_nick_sets_nick(void **state); void cmd_account_show_message_for_missing_otr_policy(void **state); void cmd_account_show_message_for_invalid_otr_policy(void **state); void cmd_account_set_otr_sets_otr(void **state); void cmd_account_set_status_shows_message_when_invalid_status(void **state); void cmd_account_set_status_sets_status_when_valid(void **state); void cmd_account_set_status_sets_status_when_last(void **state); void cmd_account_set_invalid_presence_string_priority_shows_message(void **state); void cmd_account_set_last_priority_shows_message(void **state); void cmd_account_set_online_priority_sets_preference(void **state); void cmd_account_set_chat_priority_sets_preference(void **state); void cmd_account_set_away_priority_sets_preference(void **state); void cmd_account_set_xa_priority_sets_preference(void **state); void cmd_account_set_dnd_priority_sets_preference(void **state); void cmd_account_set_priority_too_low_shows_message(void **state); void cmd_account_set_priority_too_high_shows_message(void **state); void cmd_account_set_priority_when_not_number_shows_message(void **state); void cmd_account_set_priority_when_empty_shows_message(void **state); void cmd_account_set_priority_updates_presence_when_account_connected_with_presence(void **state); void cmd_account_clear_shows_usage_when_no_args(void **state); void cmd_account_clear_shows_usage_when_one_arg(void **state); void cmd_account_clear_shows_message_when_account_doesnt_exist(void **state); void cmd_account_clear_shows_message_when_invalid_property(void **state);