├── .git-crypt ├── .gitattributes └── keys │ └── default │ └── 0 │ └── F3F42E1F26FE5C63A19D3061FA5C94EDD085C989.gpg ├── .gitignore ├── LICENSE ├── README.md ├── elemental.nix └── home ├── default.nix ├── linux-only.nix ├── machine ├── boron │ ├── default.nix │ ├── restic │ │ ├── excludes │ │ │ ├── .gitattributes │ │ │ ├── full-home │ │ │ └── home │ │ └── includes │ │ │ ├── .gitattributes │ │ │ ├── home │ │ │ └── limited-home │ └── tool │ │ └── restic │ │ └── index.nix ├── default.nix ├── nixos-only.nix └── osmium │ ├── default.nix │ ├── restic │ ├── excludes │ │ ├── .gitattributes │ │ ├── full-home │ │ └── home │ └── includes │ │ ├── .gitattributes │ │ ├── home │ │ └── limited-home │ └── tool │ └── restic │ └── index.nix ├── program ├── admin │ ├── restic │ │ ├── back │ │ ├── default.nix │ │ ├── envs │ │ │ ├── .gitattributes │ │ │ ├── fast-drive │ │ │ │ ├── env.fish │ │ │ │ └── env.sh │ │ │ ├── gcs │ │ │ │ ├── env.fish │ │ │ │ ├── env.sh │ │ │ │ └── gcs-service-key.json │ │ │ └── slow-drive │ │ │ │ ├── env.fish │ │ │ │ └── env.sh │ │ └── fish-functions │ │ │ ├── restic-fd.fish │ │ │ ├── restic-gcs.fish │ │ │ └── restic-sd.fish │ └── topgrade │ │ ├── default.nix │ │ └── topgrade.toml ├── default.nix ├── dev │ └── git │ │ └── default.nix ├── editor │ └── neovim │ │ ├── coc.nix │ │ ├── configs │ │ ├── fixers.vimrc │ │ ├── flags.vimrc │ │ ├── general.vimrc │ │ ├── init.vim │ │ ├── init.vimrc │ │ ├── keys.vimrc │ │ ├── language-support │ │ │ └── ts.vimrc │ │ ├── lsp.vimrc │ │ ├── status-line.vimrc │ │ ├── themes.vimrc │ │ └── vista.vimrc │ │ └── default.nix ├── file-manager │ └── ranger │ │ ├── commands.py │ │ ├── commands_full.py │ │ ├── default.nix │ │ ├── rc.conf │ │ ├── rifle.conf │ │ └── scope.sh ├── networking │ ├── nmap │ │ ├── default.nix │ │ └── scripts │ │ │ └── vulners.nse │ └── ssh │ │ ├── .gitattributes │ │ └── default.nix ├── scripts │ ├── index.nix │ └── misc │ │ ├── .gitattributes │ │ ├── extract-back │ │ ├── gopass-password-only │ │ └── mk-back ├── shell │ ├── fish │ │ ├── default.nix │ │ ├── functions │ │ │ ├── .gitattributes │ │ │ ├── kp.fish │ │ │ └── start_ssh_agent.fish │ │ ├── fzf-colors.fish │ │ ├── prompt.fish │ │ └── sources.nix │ └── starship │ │ └── default.nix └── terminal │ ├── alacritty │ └── default.nix │ └── tmux │ ├── default.nix │ └── tmux.conf ├── role ├── darwin-laptop │ ├── de │ │ ├── hammerspoon │ │ │ ├── default.nix │ │ │ └── directory │ │ │ │ ├── init.lua │ │ │ │ └── keyboard │ │ │ │ ├── control-escape.lua │ │ │ │ ├── delete-words.lua │ │ │ │ ├── hyper-apps-defaults.lua │ │ │ │ ├── hyper.lua │ │ │ │ ├── init.lua │ │ │ │ ├── markdown.lua │ │ │ │ ├── microphone.lua │ │ │ │ ├── panes.lua │ │ │ │ ├── status-message.lua │ │ │ │ ├── super.lua │ │ │ │ ├── windows-bindings-defaults.lua │ │ │ │ └── windows.lua │ │ └── karabiner │ │ │ ├── default.nix │ │ │ └── karabiner.json │ ├── default.nix │ └── script │ │ └── set-wall ├── default.nix ├── nixos-only.nix └── workstation │ ├── .gitattributes │ ├── de │ ├── bspwm │ │ ├── bspwmrc │ │ └── default.nix │ ├── compton │ │ ├── compton.conf │ │ └── default.nix │ ├── dunst │ │ ├── default.nix │ │ └── dunstrc │ ├── polybar │ │ ├── config │ │ └── default.nix │ └── sxhkd │ │ ├── default.nix │ │ └── sxhkdrc │ ├── default.nix │ ├── location.nix │ └── script │ ├── dmenumount │ ├── dmenuumount │ ├── dprompt │ ├── flatpak-run │ ├── lock-screen │ ├── lock-screen-i3 │ └── set-wall ├── service ├── default.nix ├── dev │ └── lorri │ │ └── default.nix └── media │ └── mpd │ └── default.nix └── user ├── default.nix └── x └── default.nix /.git-crypt/.gitattributes: -------------------------------------------------------------------------------- 1 | # Do not edit this file. To specify the files to encrypt, create your own 2 | # .gitattributes file in the directory where your files are. 3 | * !filter !diff 4 | *.gpg binary 5 | -------------------------------------------------------------------------------- /.git-crypt/keys/default/0/F3F42E1F26FE5C63A19D3061FA5C94EDD085C989.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HugoReeves/elemental/e6bcae2c5f62ee10cad0ebe8aeed67d9beaa93b9/.git-crypt/keys/default/0/F3F42E1F26FE5C63A19D3061FA5C94EDD085C989.gpg -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | home.nix 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2021 Hugo Reeves 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Elemental 2 | 3 | **The component parts of a Nix/OS development system.** 4 | 5 | Elemental is my attempt to create a configurable development environment built atop [Nix](https://nixos.org) and [Home Manager](https://github.com/nix-community/home-manager). 6 | Elemental is currently setup for userspace configuration using Home Manager, I'm working on integrating my NixOS system configuration into the same repo using the same configuration techniques. 7 | 8 | Configuration in Elemental is dividided into three sections, **Machine Configuration**, **Role Configuration** and **User Configuration**. 9 | Custom derivations are stored under these three sections, the objective is to allow as much configuration to be shared where possible, whilst keeping configuration compartmentalised so that changing the machine, role or user is easily possible without rewritting configuration files. 10 | 11 | ### Machine 12 | 13 | The machine configuration is specific to the individual host system, generally speaking, for each non-homogenous device you manage with Elemental, you should have a separate machine configuration. 14 | Currently I maintain machine specific configurations for my NixOS workstation, a Intel Hades Canyon NUC, and my Darwin/MacOS laptop, a 2017 Macbook Pro running Big Sur. 15 | Configuration that should be considered 'machine specific' includes things like backup configuration that is depenedent on the systems disk layout, and custom networking software that is specific to the system's hardware. 16 | 17 | ### Role 18 | 19 | The majority of Elemental configuration fits into the role category. 20 | Currently I maintain two separate role configurations, one for a NixOS workstation and one for a Darwin laptop. 21 | Configuration that should be considered 'role' specific includes anything that touches GUI tools, the desktop environment, and shells or prompts. 22 | The idea here is that two separate machines could me made to use the same role configuration, if you wanted the same desktop environment and general configuration on both machines. 23 | 24 | In some situations, it makes sense to also consider the machine type within some of the Role configurations. 25 | An example where this may occur is if you need to reference a machine specific wifi network interface in a desktop status bar configuration. 26 | The component being configured here, the desktop status bar, is definitely a part of the role but it is also neccesary to reference the machine being targeted. 27 | Some situations like this are unavoidable. 28 | 29 | ### User 30 | 31 | User configuration primarily consists of installing the command line utilities the user should have access to, and configuring things like SSH, GPG and Git. 32 | I share the same user, 'x', across all my systems. 33 | By listing the commandline tools I need installed within the 'x' user configuration, I am able to keep the same tools installed on both my NixOS and MacOS machines. 34 | 35 | # Usage and Installation 36 | 37 | If you would like to adapt Elemental for your own purposes, I would encourage you to fork the repo and begin building your own machine, role and user configurations. 38 | 39 | Before installing Elemental, you must install [Home Manager](https://github.com/nix-community/home-manager), see [here for instructions](https://github.com/nix-community/home-manager#installation). 40 | 41 | Elemental should be installed to `~/.config/nixpkgs`. 42 | I generally like to have my Elemental repo appear at `~/elemental`, so I choose to symlink it into `~/.config/nixpkgs`. 43 | 44 | You will need to manually add a file called `home.nix` into the top level of your elemental repo. 45 | This file is where you will set the Machine, Role and User to be used in your configuration, it will be ignored by git by default. 46 | Within this file you should import `./elemental.nix` which defines elemental's configuration options. 47 | You should also import `./home/default.nix` which imports the individual machine, role and user configuration files. 48 | If deploying to a linux system, you should also import `./home/linux-only.nix` which imports configurations only available on Linux installations of Nix. 49 | 50 | ## MacOS Example 51 | 52 | The following `home.nix` configuration is for my NixOS desktop. 53 | 54 | ```nix 55 | { config, pkgs, lib,... }: 56 | 57 | { 58 | imports = [ 59 | ./elemental.nix 60 | 61 | ./home/default.nix 62 | 63 | # Import the linux only derivations 64 | ./home/linux-only.nix 65 | ]; 66 | 67 | # Let Home Manager install itself 68 | programs.home-manager.enable = true; 69 | # Allow unfree 70 | nixpkgs.config.allowUnfree = true; 71 | 72 | elemental.machine = "boron"; 73 | elemental.role = "workstation"; 74 | elemental.user = "x"; 75 | } 76 | ``` 77 | 78 | ## MacOS Example 79 | 80 | The following `home.nix` configuration is for my Macbook Pro running MacOS Big Sur. 81 | 82 | ```nix 83 | # ./elemental.nix 84 | { config, pkgs, lib,... }: 85 | 86 | { 87 | imports = [ 88 | ./elemental.nix 89 | 90 | ./home/default.nix 91 | ]; 92 | 93 | # Let Home Manager install itself 94 | programs.home-manager.enable = true; 95 | # Allow unfree 96 | nixpkgs.config.allowUnfree = true; 97 | 98 | elemental.machine = "osmium"; 99 | elemental.role = "darwin-laptop"; 100 | elemental.user = "x"; 101 | } 102 | ``` 103 | -------------------------------------------------------------------------------- /elemental.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | let 3 | cfg = config.elemental; 4 | in 5 | { 6 | 7 | options.elemental.machine = lib.mkOption { 8 | type = lib.types.str; 9 | default = ""; 10 | description = '' 11 | The hostname of the device. 12 | ''; 13 | example = "boron"; 14 | }; 15 | 16 | options.elemental.role = lib.mkOption { 17 | type = lib.types.str; 18 | default = ""; 19 | description = '' 20 | The device role, this determines the window manager and GUI tools to be installed. 21 | ''; 22 | example = "workstation"; 23 | }; 24 | 25 | options.elemental.user = lib.mkOption { 26 | type = lib.types.str; 27 | default = ""; 28 | description = '' 29 | The username of the primary user. 30 | ''; 31 | example = "x"; 32 | }; 33 | } 34 | -------------------------------------------------------------------------------- /home/default.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | 3 | { 4 | imports = [ 5 | ./machine/default.nix 6 | ./program/default.nix 7 | ./role/default.nix 8 | ./user/default.nix 9 | ]; 10 | 11 | # Let Home Manager install and manage itself. 12 | programs.home-manager.enable = true; 13 | manual.manpages.enable = false; 14 | } 15 | -------------------------------------------------------------------------------- /home/linux-only.nix: -------------------------------------------------------------------------------- 1 | { config, lib, stdenv, ... }: 2 | 3 | { 4 | imports = [ 5 | ./machine/nixos-only.nix 6 | ./role/nixos-only.nix 7 | ./service/default.nix 8 | ]; 9 | } 10 | -------------------------------------------------------------------------------- /home/machine/boron/default.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | with 3 | lib; 4 | let 5 | cfg = config.elemental.home.machine.boron; 6 | in 7 | { 8 | options.elemental.home.machine.boron = { 9 | enable = mkEnableOption "Enable the boron machine specific configuration"; 10 | }; 11 | 12 | config = mkIf (config.elemental.machine == "boron") { 13 | elemental.home.program.admin.restic.includeDir = ./restic/includes; 14 | elemental.home.program.admin.restic.excludeDir = ./restic/excludes; 15 | 16 | elemental.home.program.admin.restic = { 17 | enable = true; 18 | enableFishScripts = true; 19 | enableBackScript = true; 20 | }; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /home/machine/boron/restic/excludes/.gitattributes: -------------------------------------------------------------------------------- 1 | * filter=git-crypt diff=git-crypt 2 | .gitattributes !filter !diff 3 | -------------------------------------------------------------------------------- /home/machine/boron/restic/excludes/full-home: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HugoReeves/elemental/e6bcae2c5f62ee10cad0ebe8aeed67d9beaa93b9/home/machine/boron/restic/excludes/full-home -------------------------------------------------------------------------------- /home/machine/boron/restic/excludes/home: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HugoReeves/elemental/e6bcae2c5f62ee10cad0ebe8aeed67d9beaa93b9/home/machine/boron/restic/excludes/home -------------------------------------------------------------------------------- /home/machine/boron/restic/includes/.gitattributes: -------------------------------------------------------------------------------- 1 | * filter=git-crypt diff=git-crypt 2 | .gitattributes !filter !diff 3 | -------------------------------------------------------------------------------- /home/machine/boron/restic/includes/home: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HugoReeves/elemental/e6bcae2c5f62ee10cad0ebe8aeed67d9beaa93b9/home/machine/boron/restic/includes/home -------------------------------------------------------------------------------- /home/machine/boron/restic/includes/limited-home: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HugoReeves/elemental/e6bcae2c5f62ee10cad0ebe8aeed67d9beaa93b9/home/machine/boron/restic/includes/limited-home -------------------------------------------------------------------------------- /home/machine/boron/tool/restic/index.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | { } 3 | -------------------------------------------------------------------------------- /home/machine/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | imports = [ 3 | ./osmium/default.nix 4 | ]; 5 | } 6 | -------------------------------------------------------------------------------- /home/machine/nixos-only.nix: -------------------------------------------------------------------------------- 1 | { 2 | imports = [ 3 | ./boron/default.nix 4 | ]; 5 | } 6 | -------------------------------------------------------------------------------- /home/machine/osmium/default.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | with 3 | lib; 4 | { 5 | config = mkIf (config.elemental.machine == "osmium") { 6 | elemental.home.program.admin.restic = { 7 | enable = true; 8 | enableFishScripts = true; 9 | enableBackScript = true; 10 | 11 | includeDir = ./restic/includes; 12 | excludeDir = ./restic/excludes; 13 | }; 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /home/machine/osmium/restic/excludes/.gitattributes: -------------------------------------------------------------------------------- 1 | * filter=git-crypt diff=git-crypt 2 | .gitattributes !filter !diff 3 | -------------------------------------------------------------------------------- /home/machine/osmium/restic/excludes/full-home: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HugoReeves/elemental/e6bcae2c5f62ee10cad0ebe8aeed67d9beaa93b9/home/machine/osmium/restic/excludes/full-home -------------------------------------------------------------------------------- /home/machine/osmium/restic/excludes/home: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HugoReeves/elemental/e6bcae2c5f62ee10cad0ebe8aeed67d9beaa93b9/home/machine/osmium/restic/excludes/home -------------------------------------------------------------------------------- /home/machine/osmium/restic/includes/.gitattributes: -------------------------------------------------------------------------------- 1 | * filter=git-crypt diff=git-crypt 2 | .gitattributes !filter !diff 3 | -------------------------------------------------------------------------------- /home/machine/osmium/restic/includes/home: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HugoReeves/elemental/e6bcae2c5f62ee10cad0ebe8aeed67d9beaa93b9/home/machine/osmium/restic/includes/home -------------------------------------------------------------------------------- /home/machine/osmium/restic/includes/limited-home: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HugoReeves/elemental/e6bcae2c5f62ee10cad0ebe8aeed67d9beaa93b9/home/machine/osmium/restic/includes/limited-home -------------------------------------------------------------------------------- /home/machine/osmium/tool/restic/index.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | { 3 | elemental.home.program.admin.restic.includeDir = ./includes; 4 | elemental.home.program.admin.restic.excludeDir = ./excludes; 5 | } 6 | -------------------------------------------------------------------------------- /home/program/admin/restic/back: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Run a restic backup command using the correct repo and environment values 3 | set -e -o pipefail 4 | 5 | # Args to be passed to the resic invocation 6 | args=() 7 | 8 | # The repo is the first argument 9 | case $1 in 10 | gcs) 11 | source $HOME/.config/restic/envs/gcs/env.sh 12 | echo "Running command using GCS, repository: $RESTIC_REPOSITORY" 13 | 14 | # Add Args 15 | args+=( "--option" "gs.connections=$GS_CONNECTIONS" ) 16 | ;; 17 | 18 | slow-drive | sd) 19 | source $HOME/.config/restic/envs/slow-drive/env.sh 20 | echo "Running command using backup drive filesystem, repository: $RESTIC_REPOSITORY" 21 | ;; 22 | 23 | fast-drive | fd) 24 | source $HOME/.config/restic/envs/fast-drive/env.sh 25 | echo "Running command using backup drive filesystem, repository: $RESTIC_REPOSITORY" 26 | ;; 27 | 28 | airport | ap) 29 | source $HOME/.config/restic/envs/airport/env.sh 30 | echo "Running command using airport primary/hugo, repository: $RESTIC_REPOSITORY" 31 | ;; 32 | 33 | *) 34 | echo "The first argument is the repository to use for the backup, the options are..." 35 | echo "gcs: Google cloud storage repository." 36 | echo "pd | public-drive: Public hard drive mounted at a common mountpoint, see ~/.config/restic/envs/backup-drive/env.sh" 37 | echo "ap | airport: Apple airport timecapsule" 38 | exit 39 | ;; 40 | esac 41 | 42 | # The command to execute comes second 43 | case $2 in 44 | backup-limited-home | blh) 45 | echo "Backing up limited home." 46 | 47 | # Add Args 48 | args+=( 'backup' ) 49 | args+=( '--tag' 'limited-home' ) 50 | args+=( "--files-from" "$HOME/.config/restic/includes/limited-home" ) 51 | ;; 52 | 53 | backup-home | bh) 54 | echo "Backing up important user data home directories." 55 | 56 | # Add Args 57 | args+=( 'backup' ) 58 | args+=( '--tag' 'home' ) 59 | args+=( '--exclude-file' "$HOME/.config/restic/excludes/home" ) 60 | args+=( "--files-from" "$HOME/.config/restic/includes/home" ) 61 | ;; 62 | 63 | backup-full-home | bfh) 64 | echo "Backing up full home directory" 65 | echo "Excluding files using: $HOME/.config/restic/excludes/full-home" 66 | 67 | args+=( 'backup' ) 68 | args+=( '--tag' 'full-home' ) 69 | args+=( "$HOME" ) 70 | args+=( "--exclude-file" "$HOME/.config/restic/excludes/full-home") 71 | ;; 72 | 73 | forget | f) 74 | echo "Forgetting old snapshots" 75 | 76 | args+=( 77 | "forget" 78 | "--host" "$hostname" 79 | "--group-by" "host,tags" 80 | "--keep-last" "$KEEP_LAST" 81 | "--keep-hourly" "$RETENTION_HOURS" 82 | "--keep-daily" "$RETENTION_DAYS" 83 | "--keep-weekly" "$RETENTION_WEEKS" 84 | "--keep-monthly" "$RETENTION_MONTHS" 85 | "--keep-yearly" "$RETENTION_YEARS" 86 | ) 87 | ;; 88 | 89 | forget-prune | fp) 90 | echo "Forgetting and pruning old snapshots" 91 | 92 | args+=( 93 | "forget" 94 | "--prune" 95 | "--host" "$hostname" 96 | "--group-by" "host,tags" 97 | "--keep-last" "$KEEP_LAST" 98 | "--keep-hourly" "$RETENTION_HOURS" 99 | "--keep-daily" "$RETENTION_DAYS" 100 | "--keep-weekly" "$RETENTION_WEEKS" 101 | "--keep-monthly" "$RETENTION_MONTHS" 102 | "--keep-yearly" "$RETENTION_YEARS" 103 | ) 104 | ;; 105 | 106 | *) 107 | echo "The second argument is the operation to run, the options are..." 108 | echo "blh | backup-limited-home: Backup a small selection of home folders, mainly configuration files." 109 | echo "bfh | backup-full-home: Backup the entire home directory, exclude some large directories like ~/Library/" 110 | echo "bh | backup-home: Backup home files containing important user documents, this includes folders like ~/Desktop, ~/Documents and ~/drive" 111 | echo "f | forget: Forgets snapshots according to the retention policies" 112 | echo "fp | forget-prune: Like forget but also prunes unused data from the repository" 113 | exit 114 | ;; 115 | esac 116 | 117 | restic "${args[@]}" 118 | -------------------------------------------------------------------------------- /home/program/admin/restic/default.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | with 3 | lib; 4 | let 5 | cfg = config.elemental.home.program.admin.restic; 6 | in 7 | { 8 | options.elemental.home.program.admin.restic = { 9 | enable = mkEnableOption "Enable restic backup configuration"; 10 | 11 | includeDir = mkOption { 12 | type = types.path; 13 | default = null; 14 | description = "Include files to source into the appropriate directory"; 15 | }; 16 | 17 | excludeDir = mkOption { 18 | type = types.path; 19 | default = null; 20 | description = "Exclude files to source into the appropriate directory"; 21 | }; 22 | 23 | enableFishScripts = mkOption { 24 | type = types.bool; 25 | default = false; 26 | description = "Whether the fish scripts should be installed"; 27 | }; 28 | 29 | enableBackScript = mkOption { 30 | type = types.bool; 31 | default = false; 32 | description = "Whether the back script should be installed into scripts"; 33 | }; 34 | }; 35 | 36 | config = mkIf cfg.enable { 37 | home.packages = [ pkgs.restic ]; 38 | 39 | elemental.home.program.shell.fish.functionFiles = mkIf cfg.enableFishScripts { 40 | "restic-fd.fish" = ./fish-functions/restic-fd.fish; 41 | "restic-sd.fish" = ./fish-functions/restic-sd.fish; 42 | "restic-gcs.fish" = ./fish-functions/restic-gcs.fish; 43 | }; 44 | 45 | elemental.home.program.scripts.scriptFiles = mkIf cfg.enableBackScript { 46 | "back" = ./back; 47 | }; 48 | 49 | xdg.configFile = { 50 | "restic/envs".source = ./envs; 51 | "restic/includes" = mkIf (cfg.includeDir != null) { 52 | source = cfg.includeDir; 53 | }; 54 | "restic/excludes" = mkIf (cfg.excludeDir != null) { 55 | source = cfg.excludeDir; 56 | }; 57 | }; 58 | }; 59 | } 60 | -------------------------------------------------------------------------------- /home/program/admin/restic/envs/.gitattributes: -------------------------------------------------------------------------------- 1 | * filter=git-crypt diff=git-crypt 2 | .gitattributes !filter !diff 3 | -------------------------------------------------------------------------------- /home/program/admin/restic/envs/fast-drive/env.fish: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HugoReeves/elemental/e6bcae2c5f62ee10cad0ebe8aeed67d9beaa93b9/home/program/admin/restic/envs/fast-drive/env.fish -------------------------------------------------------------------------------- /home/program/admin/restic/envs/fast-drive/env.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HugoReeves/elemental/e6bcae2c5f62ee10cad0ebe8aeed67d9beaa93b9/home/program/admin/restic/envs/fast-drive/env.sh -------------------------------------------------------------------------------- /home/program/admin/restic/envs/gcs/env.fish: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HugoReeves/elemental/e6bcae2c5f62ee10cad0ebe8aeed67d9beaa93b9/home/program/admin/restic/envs/gcs/env.fish -------------------------------------------------------------------------------- /home/program/admin/restic/envs/gcs/env.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HugoReeves/elemental/e6bcae2c5f62ee10cad0ebe8aeed67d9beaa93b9/home/program/admin/restic/envs/gcs/env.sh -------------------------------------------------------------------------------- /home/program/admin/restic/envs/gcs/gcs-service-key.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HugoReeves/elemental/e6bcae2c5f62ee10cad0ebe8aeed67d9beaa93b9/home/program/admin/restic/envs/gcs/gcs-service-key.json -------------------------------------------------------------------------------- /home/program/admin/restic/envs/slow-drive/env.fish: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HugoReeves/elemental/e6bcae2c5f62ee10cad0ebe8aeed67d9beaa93b9/home/program/admin/restic/envs/slow-drive/env.fish -------------------------------------------------------------------------------- /home/program/admin/restic/envs/slow-drive/env.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HugoReeves/elemental/e6bcae2c5f62ee10cad0ebe8aeed67d9beaa93b9/home/program/admin/restic/envs/slow-drive/env.sh -------------------------------------------------------------------------------- /home/program/admin/restic/fish-functions/restic-fd.fish: -------------------------------------------------------------------------------- 1 | function restic-fd 2 | set repo "" 3 | if test -d "/Volumes/fast/restic" 4 | set repo /Volumes/fast/restic/ 5 | else if test -d "$HOME/mnts/fast/restic" 6 | set repo "$HOME/mnts/fast/restic" 7 | else 8 | echo "Drive not found at any logical mount point, exiting" 9 | return 1 10 | end 11 | 12 | set -lx RESTIC_REPOSITORY $repo 13 | set -lx RESTIC_PASSWORD_COMMAND "gopass-password-only backups/restic/fast-drive/password" 14 | 15 | set -lx KEEP_LAST 3 16 | set -lx RETENTION_HOURS 7 17 | set -lx RETENTION_DAYS 7 18 | set -lx RETENTION_WEEKS 7 19 | set -lx RETENTION_MONTHS 18 20 | set -lx RETENTION_YEARS 20 21 | 22 | restic \ 23 | $argv 24 | end 25 | -------------------------------------------------------------------------------- /home/program/admin/restic/fish-functions/restic-gcs.fish: -------------------------------------------------------------------------------- 1 | function restic-gcs 2 | set -lx GOOGLE_PROJECT_ID backups-hugoreeves-com 3 | set -lx GOOGLE_APPLICATION_CREDENTIALS $HOME/.config/restic/envs/gcs/gcs-service-key.json 4 | set -lx GS_CONNECTIONS 50 5 | 6 | set -lx RESTIC_REPOSITORY gs:personal.backups.hugoreeves.com:/ 7 | set -lx RESTIC_PASSWORD_COMMAND "gopass-password-only backups/restic/gcs/password" 8 | 9 | 10 | set -lx KEEP_LAST 3 11 | set -lx RETENTION_HOURS 7 12 | set -lx RETENTION_DAYS 7 13 | set -lx RETENTION_WEEKS 7 14 | set -lx RETENTION_MONTHS 18 15 | set -lx RETENTION_YEARS 20 16 | 17 | restic \ 18 | --option gs.connections=$GS_CONNECTIONS \ 19 | $argv 20 | end 21 | -------------------------------------------------------------------------------- /home/program/admin/restic/fish-functions/restic-sd.fish: -------------------------------------------------------------------------------- 1 | function restic-sd 2 | set repo "" 3 | if test -d "/Volumes/slow/restic" 4 | set repo /Volumes/slow/restic/ 5 | else if test -d "$HOME/mnts/slow/restic" 6 | set repo "$HOME/mnts/slow/restic" 7 | else 8 | echo "Drive not found at any logical mount point, exiting" 9 | return 1 10 | end 11 | 12 | set -lx RESTIC_REPOSITORY $repo 13 | set -lx RESTIC_PASSWORD_COMMAND "gopass-password-only backups/restic/slow-drive/password" 14 | 15 | set -lx KEEP_LAST 3 16 | set -lx RETENTION_HOURS 7 17 | set -lx RETENTION_DAYS 7 18 | set -lx RETENTION_WEEKS 7 19 | set -lx RETENTION_MONTHS 18 20 | set -lx RETENTION_YEARS 20 21 | 22 | restic \ 23 | $argv 24 | end 25 | -------------------------------------------------------------------------------- /home/program/admin/topgrade/default.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs, config, ... }: 2 | with 3 | lib; 4 | let 5 | cfg = config.elemental.home.program.admin.topgrade; 6 | in 7 | { 8 | options.elemental.home.program.admin.topgrade = { 9 | enable = mkEnableOption "Enable topgrade for convenient upgrades across package managers"; 10 | }; 11 | 12 | config = mkIf cfg.enable { 13 | home.packages = [ pkgs.topgrade ]; 14 | xdg.configFile."topgrade.toml".source = ./topgrade.toml; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /home/program/admin/topgrade/topgrade.toml: -------------------------------------------------------------------------------- 1 | # Additional git repositories to pull 2 | #git_repos = [ 3 | # "~/src/*/", 4 | # "~/.config/something" 5 | #] 6 | 7 | # Don't pull the predefined git repos 8 | # predefined_git_repos = false 9 | 10 | # Disable specific steps - same options as the command line flag 11 | disable = ["go", "rustup", "node", "tlmgr"] 12 | 13 | # Run specific steps - same options as the command line flag 14 | #only = ["system", "emacs"] 15 | 16 | # Do not ask to retry failed steps (default: false) 17 | #no_retry = true 18 | 19 | # Run inside tmux 20 | #run_in_tmux = true 21 | 22 | # List of remote machines with Topgrade installed on them 23 | #remote_topgrades = ["toothless", "pi", "parnas"] 24 | 25 | # Arguments to pass SSH when upgrading remote systems 26 | #ssh_arguments = "-o ConnectTimeout=2" 27 | 28 | # Arguments to pass Git when pulling Repositories 29 | #git_arguments = "--rebase --autostash" 30 | 31 | # Arguments to pass tmux when pulling Repositories 32 | #tmux_arguments = "-S /var/tmux.sock" 33 | 34 | # Arguments to pass yay when updating packages 35 | #yay_arguments = "--nodevel" 36 | 37 | # Manually select Windows updates 38 | # accept_all_windows_updates = false 39 | 40 | # Do not set the terminal title 41 | #set_title = false 42 | 43 | # Cleanup temporary or old files 44 | #cleanup = true 45 | 46 | #[composer] 47 | #self_update = true 48 | 49 | # Commands to run before anything 50 | #[pre_commands] 51 | #"Emacs Snapshot" = "rm -rf ~/.emacs.d/elpa.bak && cp -rl ~/.emacs.d/elpa ~/.emacs.d/elpa.bak" 52 | 53 | # Custom commands 54 | #[commands] 55 | #"Python Environment" = "~/dev/.env/bin/pip install -i https://pypi.python.org/simple -U --upgrade-strategy eager jupyter" 56 | 57 | -------------------------------------------------------------------------------- /home/program/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | imports = [ 3 | ./admin/restic/default.nix 4 | ./admin/topgrade/default.nix 5 | ./dev/git/default.nix 6 | ./editor/neovim/default.nix 7 | ./file-manager/ranger/default.nix 8 | ./networking/nmap/default.nix 9 | ./networking/ssh/default.nix 10 | ./scripts/index.nix 11 | ./shell/fish/default.nix 12 | ./shell/starship/default.nix 13 | ./terminal/alacritty/default.nix 14 | ./terminal/tmux/default.nix 15 | ]; 16 | } 17 | -------------------------------------------------------------------------------- /home/program/dev/git/default.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | with lib; 3 | let 4 | cfg = config.elemental.home.program.dev.git; 5 | in 6 | { 7 | options.elemental.home.program.dev.git = { 8 | enable = lib.mkEnableOption "Enable git"; 9 | 10 | userEmail = lib.mkOption { 11 | type = types.lines; 12 | description = "The git config email"; 13 | default = ""; 14 | }; 15 | 16 | userName = lib.mkOption { 17 | type = types.lines; 18 | description = "The git config name"; 19 | default = ""; 20 | }; 21 | 22 | gpgKey = lib.mkOption { 23 | type = types.lines; 24 | description = "The gpg-signing key"; 25 | default = ""; 26 | }; 27 | 28 | signByDefault = lib.mkOption { 29 | type = types.bool; 30 | description = "Whether to gpg sign by default"; 31 | default = false; 32 | }; 33 | }; 34 | 35 | config = lib.mkIf cfg.enable { 36 | programs.git = { 37 | enable = true; 38 | userEmail = cfg.userEmail; 39 | userName = cfg.userName; 40 | signing.key = cfg.gpgKey; 41 | signing.signByDefault = cfg.signByDefault; 42 | delta.enable = true; # Use Delta for diff viewing 43 | extraConfig = { 44 | # Force SSH 45 | url = { 46 | "git@github.com:" = { 47 | insteadOf = "https://github.com/"; 48 | }; 49 | }; 50 | # Pull behaviour 51 | pull.rebase = false; 52 | }; 53 | # Aliases 54 | aliases = { 55 | "s" = "status"; 56 | "co" = "checkout"; 57 | "br" = "branch"; 58 | # Commits, additions, and modifications 59 | "cm" = "commit -m"; 60 | "aa" = "add ."; 61 | "rh" = "reset --hard"; 62 | # Logging 63 | "lgo" = "log --oneline --graph"; 64 | "lo" = "log --oneline"; 65 | "ln" = "log -n"; # follow with a number to show n logs 66 | "lon" = "log --oneline -n"; # follow with a number to show n logs 67 | }; 68 | }; 69 | }; 70 | } 71 | -------------------------------------------------------------------------------- /home/program/editor/neovim/coc.nix: -------------------------------------------------------------------------------- 1 | { config }: 2 | { 3 | tsserver.enable = true; 4 | tslint.configFile = "tslint.json"; 5 | languageserver = { 6 | golang = { 7 | command = "go-langserver"; 8 | filetypes = [ "go" ]; 9 | initializationOptions = { 10 | gocodeCompletionEnabled = true; 11 | diagnosticsEnabled = true; 12 | lintTool = "golint"; 13 | }; 14 | }; 15 | }; 16 | python.pythonPath = "python3"; 17 | rust-analyzer.serverPath = "${config.home.homeDirectory}/.cargo/bin/ra_lsp_server"; 18 | } 19 | -------------------------------------------------------------------------------- /home/program/editor/neovim/configs/fixers.vimrc: -------------------------------------------------------------------------------- 1 | " Ale stuff 2 | " let g:ale_fixers = { 3 | " \ 'javascript': ['prettier', 'eslint'], 4 | " \ 'elixir': ['mix_format'] 5 | " \} 6 | " let g:ale_linters = { 7 | " \ 'javascript': ['eslint'], 8 | " \ 'javascript.jsx': ['eslint'] 9 | " \} 10 | 11 | " let g:ale_fix_on_save = 1 12 | " " Letting coc.vim do the completion instead of all 13 | " let g:ale_completion_enabled = 0 14 | " " use projects prettier and eslint settings 15 | " let g:ale_javascript_prettier_use_local_config = 1 16 | " let g:ale_javascript_eslint_use_local_config = 1 17 | " let g:ale_sign_error = '●' 18 | " let g:ale_sign_warning = "\uf49f" 19 | " let g:ale_virtualtext_cursor = 1 20 | 21 | " Test support 22 | " Neomake & vim-test 23 | " let g:test#javascript#jest#options = '--reporters jest-vim-reporter' 24 | " let g:neomake_open_list = 1 25 | " let test#strategy = "neomake" 26 | " let g:neomake_warning_sign = { 27 | " \ 'text': '◉' 28 | " \ } 29 | " let g:neomake_error_sign = { 30 | " \ 'text': '◉' 31 | " \ } 32 | 33 | " let g:dispatch_compilers = {'elixir': 'exunit'} 34 | 35 | 36 | " " Show message that tests have started 37 | " function! MyOnNeomakeJobStarted() abort 38 | " let g:TESTING_STATUS = 'running' 39 | " endfunction 40 | 41 | " " Show message when all tests are passing 42 | " function! MyOnNeomakeJobFinished() abort 43 | " let context = g:neomake_hook_context 44 | " if context.jobinfo.exit_code == 0 45 | " let g:TESTING_STATUS = 'passing' 46 | " endif 47 | " if context.jobinfo.exit_code == 1 48 | " let g:TESTING_STATUS = 'failing' 49 | " endif 50 | " endfunction 51 | 52 | " augroup my_neomake_hooks 53 | " au! 54 | " autocmd User NeomakeJobFinished call MyOnNeomakeJobFinished() 55 | " autocmd User NeomakeJobStarted call MyOnNeomakeJobStarted() 56 | " augroup END 57 | 58 | " """"""""""""""""""""" 59 | " " vim-test extensions 60 | " """"""""""""""""""""" 61 | " function! ElixirUmbrellaTransform(cmd) abort 62 | " if match(a:cmd, 'apps/') != -1 63 | " return substitute(a:cmd, 'mix test apps/\([^/]*/\)', 'cd apps/\1 \&\& mix test ', '') 64 | " else 65 | " return a:cmd 66 | " end 67 | " endfunction 68 | 69 | 70 | " let g:test#preserve_screen = 0 71 | " let g:test#custom_transformations = {'elixir_umbrella': function('ElixirUmbrellaTransform')} 72 | " let g:test#transformation = 'elixir_umbrella' 73 | -------------------------------------------------------------------------------- /home/program/editor/neovim/configs/flags.vimrc: -------------------------------------------------------------------------------- 1 | " The use case of the file is to catch a whole bunch of environment things so 2 | " that themes and things can be dynamic 3 | if executable('tmux') && filereadable(expand('~/.zshrc')) && $TMUX !=# '' 4 | let g:VIM_IN_TMUX = 1 5 | else 6 | let g:VIM_IN_TMUX = 0 7 | endif 8 | 9 | let g:VIM_LSP_CLIENT = 'coc' " coc ale 10 | let g:VIM_COMPLETION_FRAMEWORK = 'coc' " coc ale 11 | 12 | 13 | let g:TESTING_STATUS = 'passing' 14 | 15 | -------------------------------------------------------------------------------- /home/program/editor/neovim/configs/general.vimrc: -------------------------------------------------------------------------------- 1 | set nocompatible 2 | syntax enable 3 | 4 | set termguicolors 5 | 6 | " Limit escape key timeout 7 | set ttimeout 8 | set ttimeoutlen=100 9 | set timeoutlen=3000 10 | 11 | " Security and local execution 12 | set exrc 13 | set secure 14 | 15 | " Tab settings 16 | set tabstop=2 17 | set softtabstop=2 18 | set shiftwidth=2 19 | set expandtab 20 | 21 | set encoding=utf8 22 | set number 23 | set relativenumber 24 | set smartindent 25 | set autoindent 26 | set wrap 27 | set linebreak 28 | " set wildmenu 29 | " set lazyredraw 30 | set showmatch 31 | set noshowmode " lightline shows the status not vim 32 | set showtabline=2 33 | "set showcmd 34 | "}}} 35 | 36 | " Searching {{{ 37 | set incsearch 38 | set hlsearch 39 | set smartcase 40 | set ignorecase 41 | " }}} 42 | 43 | " Folding {{{ 44 | set foldenable 45 | set foldlevelstart=10 46 | set foldnestmax=10 47 | " }}} 48 | 49 | set nobackup 50 | set nowritebackup 51 | set noswapfile 52 | set hidden 53 | set history=100 54 | set path+=** 55 | set splitbelow 56 | set splitright 57 | 58 | set diffopt=vertical 59 | 60 | set completeopt=menu,menuone,preview,noselect,noinsert 61 | 62 | """ BEGIN Language Specific 63 | " 64 | " BEGIN Dart 65 | autocmd FileType dart setlocal shiftwidth=2 tabstop=2 66 | " END Dart 67 | " BEGIN Rust 68 | let g:rustfmt_autosave = 1 69 | " END Rust 70 | " BEGIN Ledger 71 | au BufNewFile,BufRead *.ldg,*.ledger setf ledger | comp ledger 72 | " END Ledger 73 | " 74 | """ END Language Specific 75 | -------------------------------------------------------------------------------- /home/program/editor/neovim/configs/init.vim: -------------------------------------------------------------------------------- 1 | " Environment and flags 2 | source $HOME/.config/nvim/flags.vimrc 3 | " Configure basic mappings 4 | source $HOME/.config/nvim/keys.vimrc 5 | " Install Plugins 6 | source $HOME/.config/nvim/init.vimrc 7 | " Language Server Protocol config 8 | source $HOME/.config/nvim/lsp.vimrc 9 | " Vista for LSP symbols 10 | source $HOME/.config/nvim/vista.vimrc 11 | " Basic set configuration, start here 12 | source $HOME/.config/nvim/general.vimrc 13 | " Configure status line 14 | source $HOME/.config/nvim/status-line.vimrc 15 | " Theme configuration 16 | source $HOME/.config/nvim/themes.vimrc 17 | -------------------------------------------------------------------------------- /home/program/editor/neovim/configs/init.vimrc: -------------------------------------------------------------------------------- 1 | call plug#begin('~/.config/nvim/plugged') 2 | " Utilities 3 | " 4 | " Awesome intellisense completion engine, relies on Language Servers 5 | Plug 'neoclide/coc.nvim', {'branch': 'release'} 6 | " Tree view for local directory 7 | Plug 'tpope/vim-vinegar' 8 | " Easily comment and uncomment lines 9 | Plug 'scrooloose/nerdcommenter' 10 | " Coc compatable LSP symbol finder and viewer 11 | Plug 'liuchengxu/vista.vim' 12 | " Fuzzy finder 13 | Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } 14 | Plug 'junegunn/fzf.vim' 15 | " Easily surround text objects with other characters 16 | Plug 'tpope/vim-surround' 17 | " Smooth scrolling 18 | Plug 'psliwka/vim-smoothie' 19 | " Vim Tables 20 | "Plug 'dhruvasagar/vim-table-mode' 21 | 22 | " Git Stuff 23 | " 24 | Plug 'tpope/vim-fugitive' 25 | Plug 'niklaas/lightline-gitdiff' 26 | Plug 'rhysd/git-messenger.vim' 27 | 28 | 29 | " Themeing 30 | " 31 | Plug 'ayu-theme/ayu-vim' 32 | " General text theme 33 | Plug 'challenger-deep-theme/vim', { 'name': 'challenger-deep' } 34 | Plug 'arcticicestudio/nord-vim' 35 | " Statusline 36 | Plug 'itchyny/lightline.vim' 37 | " Extras for lightline 38 | Plug 'sainnhe/lightline_foobar.vim' 39 | " Nerdfont icons and symbols for nerdtree and others 40 | Plug 'ryanoasis/vim-devicons' 41 | Plug 'junegunn/goyo.vim' 42 | 43 | " 44 | """ Language Specific Stuff 45 | " 46 | 47 | " Typescript 48 | Plug 'leafgarland/typescript-vim' 49 | 50 | " Vue 51 | Plug 'posva/vim-vue' 52 | 53 | " Go 54 | Plug 'fatih/vim-go' 55 | 56 | " Other Languages 57 | Plug 'LnL7/vim-nix' 58 | Plug 'cespare/vim-toml' 59 | Plug 'dag/vim-fish' 60 | Plug 'ledger/vim-ledger' 61 | Plug 'rust-lang/rust.vim' 62 | Plug 'hashivim/vim-terraform' 63 | Plug 'dart-lang/dart-vim-plugin' 64 | 65 | call plug#end() 66 | -------------------------------------------------------------------------------- /home/program/editor/neovim/configs/keys.vimrc: -------------------------------------------------------------------------------- 1 | let mapleader=" " 2 | let maplocalleader="-" 3 | 4 | " nnoremap ; : 5 | " nnoremap : ; 6 | nnoremap r :source $MYVIMRC 7 | nnoremap w :w 8 | nnoremap q :q 9 | nnoremap x :x 10 | 11 | " Quickly send output 12 | nnoremap > :! 13 | 14 | " Git mappings 15 | nnoremap gs :Gstatus 16 | nnoremap gc :Gcommit 17 | nnoremap gd :Gdiff 18 | nnoremap gb :Gblame 19 | 20 | " FZF mappings 21 | nnoremap f :GFiles 22 | nnoremap F :Files 23 | nnoremap b :Buffers 24 | nnoremap h :History 25 | nnoremap G :Rg 26 | "nnoremap t :BTags 27 | "nnoremap T :Tags 28 | 29 | map nh :noh 30 | 31 | " Copy/Paste from register 32 | " vnoremap cc "*y 33 | " map vv "*p 34 | 35 | -------------------------------------------------------------------------------- /home/program/editor/neovim/configs/language-support/ts.vimrc: -------------------------------------------------------------------------------- 1 | // 2 | -------------------------------------------------------------------------------- /home/program/editor/neovim/configs/lsp.vimrc: -------------------------------------------------------------------------------- 1 | nmap ld (coc-definition) 2 | nmap la (coc-references) 3 | nmap lr (coc-rename) 4 | noremap lh :call CocAction('doHover') 5 | noremap lo :CocList outline 6 | noremap lp :CocList diagnostics 7 | 8 | autocmd CursorHold * silent call CocActionAsync('highlight') 9 | 10 | -------------------------------------------------------------------------------- /home/program/editor/neovim/configs/status-line.vimrc: -------------------------------------------------------------------------------- 1 | function! TestingStatus() abort 2 | if g:TESTING_STATUS == 'passing' 3 | return "\ue342" 4 | elseif g:TESTING_STATUS == 'running' 5 | return "\uf499" 6 | elseif g:TESTING_STATUS == 'failing' 7 | return "\uf528" 8 | endif 9 | endfunction 10 | 11 | function! FileNameWithIcon() abort 12 | return winwidth(0) > 70 ? " " . WebDevIconsGetFileTypeSymbol() . ' ' . expand('%:t') : '' 13 | endfunction 14 | 15 | function! FileNameWithParent(f) abort 16 | if expand('%:t') ==# '' 17 | return expand('%:p:h:t') 18 | else 19 | return expand('%:p:h:t') . "/" . expand("%:t") 20 | endif 21 | endfunction 22 | 23 | function! Line_num() abort 24 | return string(line('.')) 25 | endfunction 26 | 27 | function! Active_tab_num(n) abort 28 | return " " . a:n . " \ue0bb" 29 | endfunction 30 | 31 | function! Inactive_tab_num(n) abort 32 | return " " . a:n . " \ue0bb " 33 | endfunction 34 | 35 | function! Line_percent() abort 36 | return string((100*line('.'))/line('$')) 37 | endfunction 38 | 39 | function! Col_num() abort 40 | return string(getcurpos()[2]) 41 | endfunction 42 | 43 | function! Git_branch() abort 44 | if fugitive#head() !=# '' 45 | return fugitive#head() . " " . "\ue702" 46 | else 47 | return "\uf468" 48 | endif 49 | endfunction 50 | 51 | function! StatusDiagnostic() abort 52 | let info = get(b:, 'coc_diagnostic_info', {}) 53 | 54 | if get(info, 'error', 0) 55 | return "\uf46f" 56 | endif 57 | 58 | if get(info, 'warning', 0) 59 | return info['warning'] . "\uf421" 60 | endif 61 | 62 | return "\uf42e" 63 | endfunction 64 | 65 | let g:lightline = {} 66 | let g:lightline.colorscheme = 'challenger_deep' 67 | let g:lightline.active = { 68 | \ 'left': [ ['mode', 'readonly'], ['filename_with_icon', 'modified' ] ], 69 | \ 'right': [ ['lineinfo'], ['testing_status', 'status_diagnostic'] ] 70 | \ } 71 | let g:lightline.separator = { 'left': "\ue0b8", 'right': "\ue0be " } 72 | let g:lightline.subseparator = { 'left': "\ue0b9", 'right': "\ue0b9" } 73 | let g:lightline.tabline_separator = { 'left': "\ue0bc", 'right': "\ue0ba " } 74 | let g:lightline.tabline_subseparator = { 'left': "\ue0bb", 'right': "\ue0bb" } 75 | let g:lightline#gitdiff#indicator_added = "\uf055 " 76 | let g:lightline#gitdiff#indicator_deleted = "\uf057 " 77 | let g:lightline#gitdiff#indicator_modified = "\uf056 " 78 | 79 | let g:lightline.tabline = { 80 | \ 'left': [ [ 'vim_logo', 'tabs' ] ], 81 | \ 'right': [ [ 'git_branch' ], [ 'gitdiff' ]] 82 | \ } 83 | let g:lightline.tab = { 84 | \ 'active': ['artify_activetabnum', 'filename_with_parent'], 85 | \ 'inactive': ['artify_inactivetabnum', 'filename'] 86 | \ } 87 | 88 | let g:lightline.tab_component = {} 89 | let g:lightline.tab_component_function = { 90 | \ 'artify_activetabnum': 'Active_tab_num', 91 | \ 'artify_inactivetabnum': 'Inactive_tab_num', 92 | \ 'artify_filename': 'lightline_tab_filename', 93 | \ 'filename': 'lightline#tab#filename', 94 | \ 'modified': 'lightline#tab#modified', 95 | \ 'readonly': 'lightline#tab#readonly', 96 | \ 'tabnum': 'lightline#tab#tabnum', 97 | \ 'filename_with_parent': 'FileNameWithParent' 98 | \ } 99 | 100 | let g:lightline.component = { 101 | \ 'filename_with_icon': '%{FileNameWithIcon()}', 102 | \ 'lineinfo': "%2{Line_percent()}\uf295 %3{Line_num()}:%-2{Col_num()}", 103 | \ 'vim_logo': "\ue7c5", 104 | \ 'git_branch': '%{Git_branch()}', 105 | \ 'filename_with_parent': '%t', 106 | \ 'status_diagnostic': '%{StatusDiagnostic()}', 107 | \ 'testing_status': '%{TestingStatus()}' 108 | \ } 109 | 110 | let g:lightline.component_expand = { 'gitdiff': 'lightline#gitdiff#get' } 111 | 112 | let g:lightline.component_function = { 113 | \ } 114 | 115 | -------------------------------------------------------------------------------- /home/program/editor/neovim/configs/themes.vimrc: -------------------------------------------------------------------------------- 1 | " Theme stuff 2 | colorscheme nord 3 | let g:lightline.colorscheme = 'nord' 4 | hi PMenu guibg=#100e23 5 | highlight clear ALEErrorSign 6 | highlight ALEWarningSign guifg=yellow 7 | highlight ALEVirtualTextWarning guifg=yellow 8 | hi Search guibg=#ffb378 guifg=black 9 | hi CtrlPMatch guibg=cyan guifg=black 10 | hi CtrlPMode1 guibg=cyan guifg=black 11 | hi Normal guibg=NONE ctermbg=NONE 12 | hi LineNr guibg=#1e1c31 ctermbg=NONE 13 | " Fix challengers horrible git diffs 14 | hi DiffAdd guibg=#62d196 guifg=black 15 | hi DiffDelete guibg=#ff5458 guifg=black 16 | hi DiffChange guibg=#ffb378 guifg=black 17 | hi DiffText guibg=#ffe9aa guifg=black 18 | 19 | " The Defaults 20 | let g:VIM_COLOR_SCHEME = 'nord' 21 | -------------------------------------------------------------------------------- /home/program/editor/neovim/configs/vista.vimrc: -------------------------------------------------------------------------------- 1 | let g:vista_default_executive = 'ctags' 2 | let g:vista_fzf_preview = ['right:50%'] 3 | 4 | let g:vista_executive_for = { 5 | \ 'go': 'coc', 6 | \ 'rust': 'coc', 7 | \ 'javascript': 'coc', 8 | \ 'typescript': 'coc', 9 | \ 'javascript.jsx': 'coc', 10 | \ 'python': 'coc', 11 | \ } 12 | 13 | " Ensure you have installed some decent font to show these pretty symbols, then you can enable icon for the kind. 14 | let g:vista#renderer#enable_icon = 1 15 | 16 | " The default icons can't be suitable for all the filetypes, you can extend it as you wish. 17 | let g:vista#renderer#icons = { 18 | \ "function": "\uf794", 19 | \ "variable": "\uf71b", 20 | \ } 21 | 22 | let g:vista_icon_indent = ["╰─▸ ", "├─▸ "] 23 | 24 | "if executable('typescript-language-server') 25 | "au User lsp_setup call lsp#register_server({ 26 | "\ 'name': 'typescript-language-server', 27 | "\ 'cmd': {server_info->[&shell, &shellcmdflag, 'typescript-language-server --stdio']}, 28 | "\ 'root_uri':{server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'tsconfig.json'))}, 29 | "\ 'whitelist': ['typescript', 'typescript.tsx'], 30 | "\ }) 31 | "endif 32 | -------------------------------------------------------------------------------- /home/program/editor/neovim/default.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | let 3 | cfg = config.elemental.home.program.editor.neovim; 4 | coc = import ./coc.nix; 5 | in 6 | { 7 | options.elemental.home.program.editor.neovim = { 8 | enable = lib.mkEnableOption "Enable the neovim editor"; 9 | }; 10 | 11 | config = lib.mkIf cfg.enable { 12 | 13 | programs.neovim = { 14 | enable = true; 15 | extraConfig = '' 16 | source $HOME/.config/nvim/init.vim 17 | ''; 18 | }; 19 | 20 | xdg.configFile."nvim/coc-settings.json".source = 21 | builtins.toFile "coc-settings.json" (builtins.toJSON (coc { 22 | config = config; 23 | #pkgs = pkgs; 24 | })); 25 | xdg.configFile."nvim/fixers.vimrc".source = ./configs/fixers.vimrc; 26 | xdg.configFile."nvim/flags.vimrc".source = ./configs/flags.vimrc; 27 | xdg.configFile."nvim/general.vimrc".source = ./configs/general.vimrc; 28 | xdg.configFile."nvim/init.vimrc".source = ./configs/init.vimrc; 29 | xdg.configFile."nvim/init.vim".source = ./configs/init.vim; 30 | xdg.configFile."nvim/keys.vimrc".source = ./configs/keys.vimrc; 31 | xdg.configFile."nvim/lsp.vimrc".source = ./configs/lsp.vimrc; 32 | xdg.configFile."nvim/status-line.vimrc".source = ./configs/status-line.vimrc; 33 | xdg.configFile."nvim/themes.vimrc".source = ./configs/themes.vimrc; 34 | xdg.configFile."nvim/vista.vimrc".source = ./configs/vista.vimrc; 35 | xdg.configFile."nvim/language-support".source = ./configs/language-support; 36 | }; 37 | } 38 | -------------------------------------------------------------------------------- /home/program/file-manager/ranger/commands.py: -------------------------------------------------------------------------------- 1 | # This is a sample commands.py. You can add your own commands here. 2 | # 3 | # Please refer to commands_full.py for all the default commands and a complete 4 | # documentation. Do NOT add them all here, or you may end up with defunct 5 | # commands when upgrading ranger. 6 | 7 | # A simple command for demonstration purposes follows. 8 | # ----------------------------------------------------------------------------- 9 | 10 | from __future__ import (absolute_import, division, print_function) 11 | 12 | # You can import any python module as needed. 13 | import os 14 | 15 | # You always need to import ranger.api.commands here to get the Command class: 16 | from ranger.api.commands import Command 17 | 18 | class fzf_select(Command): 19 | """ 20 | :fzf_select 21 | 22 | Find a file using fzf. 23 | 24 | With a prefix argument select only directories. 25 | 26 | See: https://github.com/junegunn/fzf 27 | """ 28 | def execute(self): 29 | import subprocess 30 | import os.path 31 | fzf = self.fm.execute_command("fzf +m", universal_newlines=True, stdout=subprocess.PIPE) 32 | stdout, stderr = fzf.communicate() 33 | if fzf.returncode == 0: 34 | fzf_file = os.path.abspath(stdout.rstrip('\n')) 35 | if os.path.isdir(fzf_file): 36 | self.fm.cd(fzf_file) 37 | else: 38 | self.fm.select_file(fzf_file) 39 | -------------------------------------------------------------------------------- /home/program/file-manager/ranger/default.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs, config, ... }: 2 | with 3 | lib; 4 | let 5 | cfg = config.elemental.home.program.filemanager.ranger; 6 | in 7 | { 8 | options.elemental.home.program.filemanager.ranger = { 9 | enable = mkEnableOption "Enable to ranger file manager"; 10 | }; 11 | 12 | config = mkIf cfg.enable { 13 | home.packages = [ pkgs.ranger ]; 14 | xdg.configFile."ranger/rc.conf".source = ./rc.conf; 15 | xdg.configFile."ranger/rifle.conf".source = ./rifle.conf; 16 | xdg.configFile."ranger/scope.sh".source = ./scope.sh; 17 | xdg.configFile."ranger/commands.py".source = ./commands.py; 18 | xdg.configFile."ranger/commands_full.py".source = ./commands_full.py; 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /home/program/file-manager/ranger/rc.conf: -------------------------------------------------------------------------------- 1 | ###SETTINGS### 2 | 3 | set column_ratios 1,3,4 4 | #set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$ 5 | set hidden_filter ^\.|\.(?:pyc|vrb|pyo|lof|bak|swp|aux|log|nav|out|snm|toc|bcf|run\.xml|synctex\.gz|blg|bbl)$|^lost\+found$|^__(py)?cache__$ 6 | set show_hidden false 7 | set confirm_on_delete multiple 8 | set preview_script ~/.config/ranger/scope.sh 9 | set use_preview_script true 10 | set automatically_count_files true 11 | set open_all_images true 12 | set vcs_aware false 13 | set vcs_backend_git enabled 14 | set vcs_backend_hg disabled 15 | set vcs_backend_bzr disabled 16 | set preview_images false 17 | set preview_images_method ueberzug 18 | set unicode_ellipsis false 19 | set show_hidden_bookmarks false 20 | set colorscheme default 21 | set preview_files true 22 | set preview_directories true 23 | set collapse_preview true 24 | set save_console_history false 25 | set status_bar_on_top false 26 | set draw_progress_bar_in_status_bar true 27 | set draw_borders true 28 | set dirname_in_tabs false 29 | set mouse_enabled true 30 | set display_size_in_main_column true 31 | set display_size_in_status_bar true 32 | set display_tags_in_all_columns true 33 | set update_title false 34 | set shorten_title 3 35 | set tilde_in_titlebar true 36 | set max_history_size 20 37 | set max_console_history_size 50 38 | set scroll_offset 8 39 | set flushinput true 40 | set padding_right true 41 | set autosave_bookmarks false 42 | set autoupdate_cumulative_size false 43 | set show_cursor false 44 | set sort natural 45 | set sort_reverse false 46 | set sort_case_insensitive true 47 | set sort_directories_first true 48 | set sort_unicode false 49 | set xterm_alt_key false 50 | set cd_bookmarks false 51 | set preview_max_size 0 52 | set show_selection_in_titlebar true 53 | set idle_delay 2000 54 | set metadata_deep_search false 55 | 56 | 57 | ###ALIASES### 58 | alias e edit 59 | alias q quit 60 | alias q! quitall 61 | alias qa quitall 62 | alias qall quitall 63 | alias setl setlocal 64 | 65 | alias filter scout -prt 66 | alias find scout -aeit 67 | alias mark scout -mr 68 | alias unmark scout -Mr 69 | alias search scout -rs 70 | alias search_inc scout -rts 71 | alias travel scout -aefiklst 72 | 73 | 74 | ###BASIC KEYS### 75 | 76 | #BASIC 77 | map Q quit! 78 | map q quit 79 | copymap q ZZ ZQ 80 | # map x set show_hidden! 81 | 82 | #map R reload_cwd 83 | map reset 84 | #map redraw_window 85 | map abort 86 | map change_mode normal 87 | 88 | map i display_file 89 | map ? help 90 | #map W display_log 91 | map w taskview_open 92 | map S shell $SHELL 93 | 94 | map : console 95 | map ; console 96 | map ! console shell%space 97 | map @ console -p6 shell %s 98 | map # console shell -p%space 99 | #map s console shell%space 100 | map r chain draw_possible_programs; console open_with%%space 101 | map f console find%space 102 | map cd console cd%space 103 | 104 | 105 | # Change the line mode 106 | #map Mf linemode filename 107 | #map Mi linemode fileinfo 108 | #map Mp linemode permissions 109 | #map Mt linemode metatitle 110 | 111 | #moc 112 | #map Mc shell mocp -c 113 | #map Ma shell mocp -a %s 114 | #map Ms shell mocp -p 115 | #map MS shell mocp -S 116 | #map Mp shell mocp -G 117 | #map Mn shell mocp -f 118 | #map Mb shell mocp -r 119 | #map MN shell mocp -s && mocp -c && mocp -a %s && mocp -p 120 | #map Mo shell mocp -j 0%% 121 | #map MK shell killall mocp 122 | 123 | 124 | 125 | # Tagging / Marking 126 | map at tag_toggle 127 | map ut tag_remove 128 | map " tag_toggle tag=%any 129 | map mark_files toggle=True 130 | map va mark_files all=True toggle=True 131 | map uv mark_files all=True val=False 132 | map vs toggle_visual_mode 133 | map uV toggle_visual_mode reverse=True 134 | 135 | 136 | 137 | # For the nostalgics: Midnight Commander bindings 138 | map help 139 | map display_file 140 | map edit 141 | map copy 142 | map console shell echo "require(rmarkdown); render_site()" | R --vanilla 143 | map cut 144 | map console mkdir%space 145 | map console delete 146 | map exit 147 | 148 | 149 | # In case you work on a keyboard with dvorak layout 150 | map move up=1 151 | map move down=1 152 | map move left=1 153 | map move right=1 154 | map move to=0 155 | map move to=-1 156 | map move down=1 pages=True 157 | map move up=1 pages=True 158 | map move right=1 159 | map console delete 160 | map console touch%space 161 | 162 | 163 | # VIM-like 164 | copymap k 165 | copymap j 166 | copymap h 167 | copymap l 168 | copymap gg 169 | copymap G 170 | copymap 171 | copymap 172 | 173 | map J move down=0.5 pages=True 174 | map K move up=0.5 pages=True 175 | copymap J 176 | copymap K 177 | 178 | 179 | # Jumping around 180 | map H history_go -1 181 | map L history_go 1 182 | map ] move_parent 1 183 | map [ move_parent -1 184 | map } traverse 185 | 186 | #DEFAULT MOVEMENT 187 | map ge cd /etc 188 | map gu cd /usr 189 | #map gl cd -r . 190 | map gL cd -r %f 191 | #map gv cd /var 192 | map gM cd /mnt 193 | map gr cd / 194 | map gR eval fm.cd(ranger.RANGERDIR) 195 | map g? cd /usr/share/doc/ranger 196 | 197 | # Tabs 198 | map tab_new ~ 199 | map tab_close 200 | map tab_move 1 201 | map tab_move -1 202 | map tab_move 1 203 | map tab_move -1 204 | #map gt tab_move 1 205 | #map gT tab_move -1 206 | map gn tab_new ~ 207 | #map gc tab_close 208 | map tt tab_close 209 | map to console touch%space 210 | map uq tab_restore 211 | map tab_open 1 212 | map tab_open 2 213 | map tab_open 3 214 | map tab_open 4 215 | map tab_open 5 216 | map tab_open 6 217 | map tab_open 7 218 | map tab_open 8 219 | map tab_open 9 220 | 221 | 222 | # External Programs 223 | map E edit 224 | map du shell -p du --max-depth=1 -h --apparent-size 225 | map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh 226 | map yp shell -f echo -n %%d/%%f | xsel -i; xsel -o | xsel -i -b 227 | map yd shell -f echo -n %%d | xsel -i; xsel -o | xsel -i -b 228 | map yn shell -f echo -n %%f | xsel -i; xsel -o | xsel -i -b 229 | 230 | 231 | # Filesystem Operations 232 | map = chmod 233 | map cw console rename%space 234 | map aa rename_append 235 | map A eval fm.open_console('rename ' + fm.thisfile.relative_path) 236 | map I eval fm.open_console('rename ' + fm.thisfile.relative_path, position=7) 237 | map pp paste 238 | map po paste overwrite=True 239 | map pP paste append=True 240 | map pO paste overwrite=True append=True 241 | map pl paste_symlink relative=False 242 | map pL paste_symlink relative=True 243 | map phl paste_hardlink 244 | map pht paste_hardlinked_subtree 245 | 246 | map dD console delete 247 | 248 | map dd cut 249 | map ud uncut 250 | map da cut mode=add 251 | map dr cut mode=remove 252 | 253 | map yy copy 254 | map uy uncut 255 | map ya copy mode=add 256 | map yr copy mode=remove 257 | 258 | 259 | # Temporary workarounds 260 | map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier) 261 | map dG eval fm.cut(dirarg=dict(to=-1), narg=quantifier) 262 | map dj eval fm.cut(dirarg=dict(down=1), narg=quantifier) 263 | map dk eval fm.cut(dirarg=dict(up=1), narg=quantifier) 264 | map ygg eval fm.copy(dirarg=dict(to=0), narg=quantifier) 265 | map yG eval fm.copy(dirarg=dict(to=-1), narg=quantifier) 266 | map yj eval fm.copy(dirarg=dict(down=1), narg=quantifier) 267 | map yk eval fm.copy(dirarg=dict(up=1), narg=quantifier) 268 | 269 | 270 | # Searching 271 | map / console search%space 272 | map n search_next 273 | map N search_next forward=False 274 | map ct search_next order=tag 275 | map cs search_next order=size 276 | map ci search_next order=mimetype 277 | map cc search_next order=ctime 278 | map cm search_next order=mtime 279 | map ca search_next order=atime 280 | 281 | 282 | # Sorting 283 | map or toggle_option sort_reverse 284 | map oz set sort=random 285 | map os chain set sort=size; set sort_reverse=False 286 | map ob chain set sort=basename; set sort_reverse=False 287 | map on chain set sort=natural; set sort_reverse=False 288 | map om chain set sort=mtime; set sort_reverse=False 289 | map oc chain set sort=ctime; set sort_reverse=False 290 | map oa chain set sort=atime; set sort_reverse=False 291 | map ot chain set sort=type; set sort_reverse=False 292 | map oe chain set sort=extension; set sort_reverse=False 293 | 294 | map oS chain set sort=size; set sort_reverse=True 295 | map oB chain set sort=basename; set sort_reverse=True 296 | map oN chain set sort=natural; set sort_reverse=True 297 | map oM chain set sort=mtime; set sort_reverse=True 298 | map oC chain set sort=ctime; set sort_reverse=True 299 | map oA chain set sort=atime; set sort_reverse=True 300 | map oT chain set sort=type; set sort_reverse=True 301 | map oE chain set sort=extension; set sort_reverse=True 302 | 303 | map dc get_cumulative_size 304 | 305 | 306 | # Settings 307 | map zc toggle_option collapse_preview 308 | map zd toggle_option sort_directories_first 309 | map zh toggle_option show_hidden 310 | map toggle_option show_hidden 311 | map zi toggle_option flushinput 312 | map zm toggle_option mouse_enabled 313 | map zp toggle_option preview_files 314 | map zP toggle_option preview_directories 315 | map zs toggle_option sort_case_insensitive 316 | map zu toggle_option autoupdate_cumulative_size 317 | map zv toggle_option use_preview_script 318 | map zf console filter%space 319 | 320 | 321 | # Bookmarks 322 | #map ` enter_bookmark %any 323 | #map ' enter_bookmark %any 324 | #map mm set_bookmark %any 325 | #map um unset_bookmark %any 326 | 327 | #map m draw_bookmarks 328 | #copymap m um ` ' 329 | 330 | 331 | # Generate all the chmod bindings with some python help: 332 | eval for arg in "rwxXst": cmd("map +u{0} shell -f chmod u+{0} %s".format(arg)) 333 | eval for arg in "rwxXst": cmd("map +g{0} shell -f chmod g+{0} %s".format(arg)) 334 | eval for arg in "rwxXst": cmd("map +o{0} shell -f chmod o+{0} %s".format(arg)) 335 | eval for arg in "rwxXst": cmd("map +a{0} shell -f chmod a+{0} %s".format(arg)) 336 | eval for arg in "rwxXst": cmd("map +{0} shell -f chmod u+{0} %s".format(arg)) 337 | 338 | eval for arg in "rwxXst": cmd("map -u{0} shell -f chmod u-{0} %s".format(arg)) 339 | eval for arg in "rwxXst": cmd("map -g{0} shell -f chmod g-{0} %s".format(arg)) 340 | eval for arg in "rwxXst": cmd("map -o{0} shell -f chmod o-{0} %s".format(arg)) 341 | eval for arg in "rwxXst": cmd("map -a{0} shell -f chmod a-{0} %s".format(arg)) 342 | eval for arg in "rwxXst": cmd("map -{0} shell -f chmod u-{0} %s".format(arg)) 343 | 344 | 345 | ###CONSOLE KEYS### 346 | # Basic 347 | cmap eval fm.ui.console.tab() 348 | cmap eval fm.ui.console.tab(-1) 349 | cmap eval fm.ui.console.close() 350 | cmap eval fm.ui.console.execute() 351 | #cmap redraw_window 352 | 353 | copycmap 354 | copycmap 355 | 356 | 357 | # Move around 358 | cmap eval fm.ui.console.history_move(-1) 359 | cmap eval fm.ui.console.history_move(1) 360 | cmap eval fm.ui.console.move(left=1) 361 | cmap eval fm.ui.console.move(right=1) 362 | cmap eval fm.ui.console.move(right=0, absolute=True) 363 | cmap eval fm.ui.console.move(right=-1, absolute=True) 364 | 365 | 366 | # Line Editing 367 | cmap eval fm.ui.console.delete(-1) 368 | cmap eval fm.ui.console.delete(0) 369 | cmap eval fm.ui.console.delete_word() 370 | cmap eval fm.ui.console.delete_word(backward=False) 371 | cmap eval fm.ui.console.delete_rest(1) 372 | cmap eval fm.ui.console.delete_rest(-1) 373 | cmap eval fm.ui.console.paste() 374 | 375 | # And of course the emacs way 376 | #copycmap 377 | #copycmap 378 | #copycmap 379 | #copycmap 380 | #copycmap 381 | #copycmap 382 | #copycmap 383 | #copycmap 384 | 385 | 386 | # Note: There are multiple ways to express backspaces. (code 263) 387 | # and (code 127). To be sure, use both. 388 | copycmap 389 | 390 | # This special expression allows typing in numerals: 391 | cmap false 392 | 393 | 394 | 395 | ###PAGER KEYS### 396 | # Movement 397 | pmap pager_move down=1 398 | pmap pager_move up=1 399 | pmap pager_move left=4 400 | pmap pager_move right=4 401 | pmap pager_move to=0 402 | pmap pager_move to=-1 403 | pmap pager_move down=1.0 pages=True 404 | pmap pager_move up=1.0 pages=True 405 | pmap pager_move down=0.5 pages=True 406 | pmap pager_move up=0.5 pages=True 407 | 408 | copypmap k 409 | copypmap j 410 | copypmap h 411 | copypmap l 412 | copypmap g 413 | copypmap G 414 | copypmap d 415 | copypmap u 416 | copypmap n f 417 | copypmap p b 418 | 419 | 420 | # Basic 421 | #pmap redraw_window 422 | pmap pager_close 423 | copypmap q Q i 424 | pmap E edit_file 425 | 426 | # =================================================================== 427 | # == Taskview Keybindings 428 | # =================================================================== 429 | 430 | # Movement 431 | tmap taskview_move up=1 432 | tmap taskview_move down=1 433 | tmap taskview_move to=0 434 | tmap taskview_move to=-1 435 | tmap taskview_move down=1.0 pages=True 436 | tmap taskview_move up=1.0 pages=True 437 | tmap taskview_move down=0.5 pages=True 438 | tmap taskview_move up=0.5 pages=True 439 | 440 | copytmap k 441 | copytmap j 442 | copytmap g 443 | copytmap G 444 | copytmap u 445 | copytmap n f 446 | copytmap p b 447 | 448 | # Changing priority and deleting tasks 449 | tmap J eval -q fm.ui.taskview.task_move(-1) 450 | tmap K eval -q fm.ui.taskview.task_move(0) 451 | tmap dd eval -q fm.ui.taskview.task_remove() 452 | tmap eval -q fm.ui.taskview.task_move(-1) 453 | tmap eval -q fm.ui.taskview.task_move(0) 454 | tmap eval -q fm.ui.taskview.task_remove() 455 | 456 | # Basic 457 | #tmap redraw_window 458 | tmap taskview_close 459 | copytmap q Q w 460 | 461 | 462 | map sp console shell bash speedvid.sh %f%space 463 | 464 | #General 465 | map V console shell vim%space 466 | map cA rename_append -ar %s 467 | map cW bulkrename %s 468 | map mkd console mkdir%space 469 | map sc console shell ln -sT%space 470 | map D console delete 471 | map X shell extract %f 472 | map Z shell tar -cvzf %f.tar.gz %f 473 | map fzf_select 474 | map fzf_locate 475 | 476 | #Document Manipulation 477 | map p1s shell lpr -o sides=one-sided %f 478 | map p2s shell lpr -o sides=two-sided-long-edge %f 479 | map MP shell pandoc %f -o %f.pdf 480 | map MX shell xelatex %f 481 | map ML shell latex %f 482 | map TC shell texclear 483 | map Txa console shell cp ~/Documents/LaTeX/article.tex%space 484 | map Txs console shell cp ~/Documents/LaTeX/beamer.tex%space 485 | map Txh console shell cp ~/Documents/LaTeX/handout.tex%space 486 | 487 | #Image commands 488 | map bg shell set-wall %F 489 | map C shell killall w3mimgdisplay && convert -rotate 90 %s %s 490 | map F shell killall w3mimgdisplay && convert -flop %s %s 491 | map bl shell killall w3mimgdisplay && convert %s -resize 1440x1080\> bl_%s 492 | map TR shell convert %s -transparent white %s 493 | 494 | #Music (mpd) shortcuts 495 | map MS shell mpd 496 | map MK shell killall mpd 497 | map Ma shell mpc add "%s" 498 | map Ms shell mpc play 499 | map Mp shell mpc toggle 500 | map Mn shell mpc next 501 | map Mb shell mpc prev 502 | map MN shell mpc stop && mpc clear && mpc add "%s" 503 | map Mo shell mpc seek 0% 504 | 505 | #Audio tagging (Requires eyeD3) 506 | map Ta eval fm.open_console('shell eyeD3 -a ' + fm.thisfile.relative_path, position=15) 507 | #Artist 508 | map TA eval fm.open_console('shell eyeD3 -A ' + fm.thisfile.relative_path, position=15) 509 | #Album 510 | map Tb eval fm.open_console('shell eyeD3 -b ' + fm.thisfile.relative_path, position=15) 511 | #Album artist 512 | map Tt eval fm.open_console('shell eyeD3 -t "" ' + fm.thisfile.relative_path, position=16) 513 | map Tn eval fm.open_console('shell eyeD3 -n "" ' + fm.thisfile.relative_path, position=16) 514 | 515 | #Downloading 516 | map ytv console shell youtube-dl -ic%space 517 | map yta console shell youtube-dl -xic%space 518 | -------------------------------------------------------------------------------- /home/program/file-manager/ranger/rifle.conf: -------------------------------------------------------------------------------- 1 | # vim: ft=cfg 2 | # 3 | # This is the configuration file of "rifle", ranger's file executor/opener. 4 | # Each line consists of conditions and a command. For each line the conditions 5 | # are checked and if they are met, the respective command is run. 6 | # 7 | # Syntax: 8 | # , , ... = command 9 | # 10 | # The command can contain these environment variables: 11 | # $1-$9 | The n-th selected file 12 | # $@ | All selected files 13 | # 14 | # If you use the special command "ask", rifle will ask you what program to run. 15 | # 16 | # Prefixing a condition with "!" will negate its result. 17 | # These conditions are currently supported: 18 | # match | The regexp matches $1 19 | # ext | The regexp matches the extension of $1 20 | # mime | The regexp matches the mime type of $1 21 | # name | The regexp matches the basename of $1 22 | # path | The regexp matches the absolute path of $1 23 | # has | The program is installed (i.e. located in $PATH) 24 | # env | The environment variable "variable" is non-empty 25 | # file | $1 is a file 26 | # directory | $1 is a directory 27 | # number | change the number of this command to n 28 | # terminal | stdin, stderr and stdout are connected to a terminal 29 | # X | $DISPLAY is not empty (i.e. Xorg runs) 30 | # 31 | # There are also pseudo-conditions which have a "side effect": 32 | # flag | Change how the program is run. See below. 33 | # label