128 lines
3.2 KiB
Nix
128 lines
3.2 KiB
Nix
{pkgs, ...}: {
|
|
# Enable Ranger
|
|
programs.ranger = {
|
|
enable = true;
|
|
settings = {
|
|
preview_images = true;
|
|
preview_images_method = "sixel";
|
|
dirname_in_tabs = true;
|
|
cd_tab_fuzzy = true;
|
|
autosave_bookmarks = false;
|
|
show_hidden = true;
|
|
wrap_scroll = true;
|
|
column_ratios = "2,2,4";
|
|
hidden_filter = ''^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$'';
|
|
};
|
|
rifle = [
|
|
# Text editing
|
|
{
|
|
condition = ''ext xml|json|jsonc|m3u|m3u8|csv|tex|py|pl|rb|js|sh|php|md|nix'';
|
|
command = ''vim -- "$@"'';
|
|
}
|
|
|
|
# Media
|
|
{
|
|
condition = ''mime ^image, has imv, X, flag f'';
|
|
command = ''imv -- "$@"'';
|
|
}
|
|
{
|
|
condition = ''mime ^video, terminal, has mpv'';
|
|
command = ''mpv -- "$@"'';
|
|
}
|
|
{
|
|
condition = ''mime ^video, terminal, has mpv'';
|
|
command = ''mpv --video-rotate=270 -- "$@"'';
|
|
}
|
|
{
|
|
condition = ''mime ^audio|ogg$, terminal, has mpv'';
|
|
command = ''mpv --no-audio-display -- "$@"'';
|
|
}
|
|
{
|
|
condition = ''mime ^audio|ogg$, terminal, has mpv'';
|
|
command = ''mpv --shuffle --no-audio-display -- "$@"'';
|
|
}
|
|
{
|
|
condition = ''ext x?html?|pdf, has librewolf, X, flag f'';
|
|
command = ''librewolf -- "$@"'';
|
|
}
|
|
{
|
|
condition = ''ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f'';
|
|
command = ''libreoffice "$@"'';
|
|
}
|
|
|
|
# Scripts
|
|
{
|
|
condition = ''sh'';
|
|
command = ''sh -- "$1"'';
|
|
}
|
|
{
|
|
condition = ''py'';
|
|
command = ''python -- "$1"'';
|
|
}
|
|
{
|
|
condition = ''pl'';
|
|
command = ''perl -- "$1"'';
|
|
}
|
|
{
|
|
condition = ''js'';
|
|
command = ''node -- "$1"'';
|
|
}
|
|
{
|
|
condition = ''php'';
|
|
command = ''php -- "$1"'';
|
|
}
|
|
|
|
# Misc
|
|
{
|
|
condition = ''ext exe|msi'';
|
|
command = ''wine "$1"'';
|
|
}
|
|
{
|
|
condition = ''ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz|iso|jar|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip|zst, has 7z'';
|
|
command = ''7z x -- "$@"'';
|
|
}
|
|
{
|
|
condition = ''label open, has xdg-open'';
|
|
command = ''xdg-open -- "$@"'';
|
|
}
|
|
];
|
|
plugins = [
|
|
{
|
|
name = "devicons2";
|
|
src = builtins.fetchGit {
|
|
url = "https://github.com/cdump/ranger-devicons2";
|
|
rev = "9606009aa01743768b0f27de0a841f7d8fe196c5";
|
|
};
|
|
}
|
|
];
|
|
extraConfig = ''
|
|
default_linemode devicons2
|
|
'';
|
|
};
|
|
|
|
# Ranger's bookmarks
|
|
home.file = let
|
|
rangerBookmarks = ''
|
|
# Local files
|
|
h:/home/jimbo/
|
|
k:/home/jimbo/Downloads
|
|
v:/home/jimbo/Videos
|
|
c:/home/jimbo/.config
|
|
L:/home/jimbo/.local
|
|
D:/mnt
|
|
n:/etc/nixos
|
|
|
|
# Remote files
|
|
a:/home/jimbo/JimboNFS
|
|
K:/home/jimbo/JimboNFS/Downloads
|
|
p:/home/jimbo/JimboNFS/Photos
|
|
P:/home/jimbo/JimboNFS/Projects
|
|
V:/home/jimbo/JimboNFS/Videos/Random
|
|
m:/home/jimbo/JimboNFS/Music
|
|
s:/home/jimbo/JimboNFS/School
|
|
'';
|
|
in {
|
|
".local/share/ranger/bookmarks".text = rangerBookmarks;
|
|
};
|
|
}
|