Skip to content

Conversation

@Faddeev-Popov
Copy link

Description

This pull request adds support for the Vifm console file manager in the shell prompt segment of Powerlevel10k. It mirrors the integration approach used in PR #2572 for the Yazi file manager, providing a similar functionality for Vifm.

Background

Vifm currently does not have a built-in shell session level indicator. However, it can be implemented externally in various ways. The following implementation, adapted from Vifm Wiki - Shell Session Indication, works well with the commits included in this PR:

# ~/.zshrc

# Additional zshrc configuration ...

ZSH_PARENT="$(</proc/$PPID/comm)"

update_vifm_level() {
    if [[ $ZSH_PARENT == "vifm" ]]; then
        if [[ $1 == "enter" ]]; then
            VIFM_LEVEL=$((VIFM_LEVEL + 1))
        elif [[ $1 == "exit" ]]; then
            VIFM_LEVEL=$((VIFM_LEVEL > 0 ? VIFM_LEVEL - 1 : 0))
        fi
        export VIFM_LEVEL
    fi
}

# Increment `VIFM_LEVEL` if `ZSH_PARENT` is `vifm`
update_vifm_level "enter"

zshexit() {
    # Additional `zshexit` commands ...

    # Decrement `VIFM_LEVEL` if `ZSH_PARENT` was `vifm`
    update_vifm_level "exit"
}

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant