mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
nix!: refactored homeModules
This commit is contained in:
parent
1c48edddf4
commit
e9f8ccd2b3
50 changed files with 14 additions and 41 deletions
19
nix/homeModules/common/atuin/default.nix
Normal file
19
nix/homeModules/common/atuin/default.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
programs.atuin = {
|
||||
enable = true;
|
||||
flags = [ "--disable-up-arrow" ];
|
||||
settings = {
|
||||
history_filter = [
|
||||
# privacy
|
||||
"^echo"
|
||||
".*PASSWORD=.*"
|
||||
".*TOKEN=.*"
|
||||
|
||||
# idiot protection
|
||||
".*rm -rf.*"
|
||||
];
|
||||
style = "full";
|
||||
show_preview = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
212
nix/homeModules/common/btop/btop/btop.conf
Normal file
212
nix/homeModules/common/btop/btop/btop.conf
Normal file
|
|
@ -0,0 +1,212 @@
|
|||
#? Config file for btop v. 1.2.13
|
||||
|
||||
#* Name of a btop++/bpytop/bashtop formatted ".theme" file, "Default" and "TTY" for builtin themes.
|
||||
#* Themes should be placed in "../share/btop/themes" relative to binary or "$HOME/.config/btop/themes"
|
||||
color_theme = "onedark.theme"
|
||||
|
||||
#* If the theme set background should be shown, set to False if you want terminal background transparency.
|
||||
theme_background = True
|
||||
|
||||
#* Sets if 24-bit truecolor should be used, will convert 24-bit colors to 256 color (6x6x6 color cube) if false.
|
||||
truecolor = True
|
||||
|
||||
#* Set to true to force tty mode regardless if a real tty has been detected or not.
|
||||
#* Will force 16-color mode and TTY theme, set all graph symbols to "tty" and swap out other non tty friendly symbols.
|
||||
force_tty = False
|
||||
|
||||
#* Define presets for the layout of the boxes. Preset 0 is always all boxes shown with default settings. Max 9 presets.
|
||||
#* Format: "box_name:P:G,box_name:P:G" P=(0 or 1) for alternate positions, G=graph symbol to use for box.
|
||||
#* Use whitespace " " as separator between different presets.
|
||||
#* Example: "cpu:0:default,mem:0:tty,proc:1:default cpu:0:braille,proc:0:tty"
|
||||
presets = "cpu:1:default,proc:0:default cpu:0:default,mem:0:default,net:0:default cpu:0:block,net:0:tty"
|
||||
|
||||
#* Set to True to enable "h,j,k,l,g,G" keys for directional control in lists.
|
||||
#* Conflicting keys for h:"help" and k:"kill" is accessible while holding shift.
|
||||
vim_keys = True
|
||||
|
||||
#* Rounded corners on boxes, is ignored if TTY mode is ON.
|
||||
rounded_corners = False
|
||||
|
||||
#* Default symbols to use for graph creation, "braille", "block" or "tty".
|
||||
#* "braille" offers the highest resolution but might not be included in all fonts.
|
||||
#* "block" has half the resolution of braille but uses more common characters.
|
||||
#* "tty" uses only 3 different symbols but will work with most fonts and should work in a real TTY.
|
||||
#* Note that "tty" only has half the horizontal resolution of the other two, so will show a shorter historical view.
|
||||
graph_symbol = "braille"
|
||||
|
||||
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
|
||||
graph_symbol_cpu = "default"
|
||||
|
||||
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
|
||||
graph_symbol_mem = "default"
|
||||
|
||||
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
|
||||
graph_symbol_net = "default"
|
||||
|
||||
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
|
||||
graph_symbol_proc = "default"
|
||||
|
||||
#* Manually set which boxes to show. Available values are "cpu mem net proc", separate values with whitespace.
|
||||
shown_boxes = "mem net cpu"
|
||||
|
||||
#* Update time in milliseconds, recommended 2000 ms or above for better sample times for graphs.
|
||||
update_ms = 2000
|
||||
|
||||
#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct",
|
||||
#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly.
|
||||
proc_sorting = "memory"
|
||||
|
||||
#* Reverse sorting order, True or False.
|
||||
proc_reversed = False
|
||||
|
||||
#* Show processes as a tree.
|
||||
proc_tree = False
|
||||
|
||||
#* Use the cpu graph colors in the process list.
|
||||
proc_colors = True
|
||||
|
||||
#* Use a darkening gradient in the process list.
|
||||
proc_gradient = True
|
||||
|
||||
#* If process cpu usage should be of the core it's running on or usage of the total available cpu power.
|
||||
proc_per_core = False
|
||||
|
||||
#* Show process memory as bytes instead of percent.
|
||||
proc_mem_bytes = True
|
||||
|
||||
#* Show cpu graph for each process.
|
||||
proc_cpu_graphs = True
|
||||
|
||||
#* Use /proc/[pid]/smaps for memory information in the process info box (very slow but more accurate)
|
||||
proc_info_smaps = False
|
||||
|
||||
#* Show proc box on left side of screen instead of right.
|
||||
proc_left = False
|
||||
|
||||
#* (Linux) Filter processes tied to the Linux kernel(similar behavior to htop).
|
||||
proc_filter_kernel = False
|
||||
|
||||
#* Sets the CPU stat shown in upper half of the CPU graph, "total" is always available.
|
||||
#* Select from a list of detected attributes from the options menu.
|
||||
cpu_graph_upper = "total"
|
||||
|
||||
#* Sets the CPU stat shown in lower half of the CPU graph, "total" is always available.
|
||||
#* Select from a list of detected attributes from the options menu.
|
||||
cpu_graph_lower = "total"
|
||||
|
||||
#* Toggles if the lower CPU graph should be inverted.
|
||||
cpu_invert_lower = True
|
||||
|
||||
#* Set to True to completely disable the lower CPU graph.
|
||||
cpu_single_graph = False
|
||||
|
||||
#* Show cpu box at bottom of screen instead of top.
|
||||
cpu_bottom = False
|
||||
|
||||
#* Shows the system uptime in the CPU box.
|
||||
show_uptime = True
|
||||
|
||||
#* Show cpu temperature.
|
||||
check_temp = True
|
||||
|
||||
#* Which sensor to use for cpu temperature, use options menu to select from list of available sensors.
|
||||
cpu_sensor = "Auto"
|
||||
|
||||
#* Show temperatures for cpu cores also if check_temp is True and sensors has been found.
|
||||
show_coretemp = True
|
||||
|
||||
#* Set a custom mapping between core and coretemp, can be needed on certain cpus to get correct temperature for correct core.
|
||||
#* Use lm-sensors or similar to see which cores are reporting temperatures on your machine.
|
||||
#* Format "x:y" x=core with wrong temp, y=core with correct temp, use space as separator between multiple entries.
|
||||
#* Example: "4:0 5:1 6:3"
|
||||
cpu_core_map = ""
|
||||
|
||||
#* Which temperature scale to use, available values: "celsius", "fahrenheit", "kelvin" and "rankine".
|
||||
temp_scale = "celsius"
|
||||
|
||||
#* Use base 10 for bits/bytes sizes, KB = 1000 instead of KiB = 1024.
|
||||
base_10_sizes = False
|
||||
|
||||
#* Show CPU frequency.
|
||||
show_cpu_freq = True
|
||||
|
||||
#* Draw a clock at top of screen, formatting according to strftime, empty string to disable.
|
||||
#* Special formatting: /host = hostname | /user = username | /uptime = system uptime
|
||||
clock_format = "%X"
|
||||
|
||||
#* Update main ui in background when menus are showing, set this to false if the menus is flickering too much for comfort.
|
||||
background_update = True
|
||||
|
||||
#* Custom cpu model name, empty string to disable.
|
||||
custom_cpu_name = ""
|
||||
|
||||
#* Optional filter for shown disks, should be full path of a mountpoint, separate multiple values with whitespace " ".
|
||||
#* Begin line with "exclude=" to change to exclude filter, otherwise defaults to "most include" filter. Example: disks_filter="exclude=/boot /home/user".
|
||||
disks_filter = ""
|
||||
|
||||
#* Show graphs instead of meters for memory values.
|
||||
mem_graphs = True
|
||||
|
||||
#* Show mem box below net box instead of above.
|
||||
mem_below_net = False
|
||||
|
||||
#* Count ZFS ARC in cached and available memory.
|
||||
zfs_arc_cached = True
|
||||
|
||||
#* If swap memory should be shown in memory box.
|
||||
show_swap = True
|
||||
|
||||
#* Show swap as a disk, ignores show_swap value above, inserts itself after first disk.
|
||||
swap_disk = True
|
||||
|
||||
#* If mem box should be split to also show disks info.
|
||||
show_disks = True
|
||||
|
||||
#* Filter out non physical disks. Set this to False to include network disks, RAM disks and similar.
|
||||
only_physical = True
|
||||
|
||||
#* Read disks list from /etc/fstab. This also disables only_physical.
|
||||
use_fstab = True
|
||||
|
||||
#* Setting this to True will hide all datasets, and only show ZFS pools. (IO stats will be calculated per-pool)
|
||||
zfs_hide_datasets = False
|
||||
|
||||
#* Set to true to show available disk space for privileged users.
|
||||
disk_free_priv = False
|
||||
|
||||
#* Toggles if io activity % (disk busy time) should be shown in regular disk usage view.
|
||||
show_io_stat = True
|
||||
|
||||
#* Toggles io mode for disks, showing big graphs for disk read/write speeds.
|
||||
io_mode = False
|
||||
|
||||
#* Set to True to show combined read/write io graphs in io mode.
|
||||
io_graph_combined = False
|
||||
|
||||
#* Set the top speed for the io graphs in MiB/s (100 by default), use format "mountpoint:speed" separate disks with whitespace " ".
|
||||
#* Example: "/mnt/media:100 /:20 /boot:1".
|
||||
io_graph_speeds = ""
|
||||
|
||||
#* Set fixed values for network graphs in Mebibits. Is only used if net_auto is also set to False.
|
||||
net_download = 100
|
||||
|
||||
net_upload = 100
|
||||
|
||||
#* Use network graphs auto rescaling mode, ignores any values set above and rescales down to 10 Kibibytes at the lowest.
|
||||
net_auto = True
|
||||
|
||||
#* Sync the auto scaling for download and upload to whichever currently has the highest scale.
|
||||
net_sync = True
|
||||
|
||||
#* Starts with the Network Interface specified here.
|
||||
net_iface = ""
|
||||
|
||||
#* Show battery stats in top right if battery is present.
|
||||
show_battery = True
|
||||
|
||||
#* Which battery to use if multiple are present. "Auto" for auto detection.
|
||||
selected_battery = "Auto"
|
||||
|
||||
#* Set loglevel for "~/.config/btop/btop.log" levels are: "ERROR" "WARNING" "INFO" "DEBUG".
|
||||
#* The level set includes all lower levels, i.e. "DEBUG" will show all logging info.
|
||||
log_level = "WARNING"
|
||||
81
nix/homeModules/common/btop/btop/themes/onedark.theme
Normal file
81
nix/homeModules/common/btop/btop/themes/onedark.theme
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
# Theme: OneDark
|
||||
# By: Vitor Melo
|
||||
|
||||
# Main bg
|
||||
theme[main_bg]="#282c34"
|
||||
|
||||
# Main text color
|
||||
theme[main_fg]="#abb2bf"
|
||||
|
||||
# Title color for boxes
|
||||
theme[title]="#abb2bf"
|
||||
|
||||
# Higlight color for keyboard shortcuts
|
||||
theme[hi_fg]="#61afef"
|
||||
|
||||
# Background color of selected item in processes box
|
||||
theme[selected_bg]="#2c313c"
|
||||
|
||||
# Foreground color of selected item in processes box
|
||||
theme[selected_fg]="#abb2bf"
|
||||
|
||||
# Color of inactive/disabled text
|
||||
theme[inactive_fg]="#5c6370"
|
||||
|
||||
# Misc colors for processes box including mini cpu graphs, details memory graph and details status text
|
||||
theme[proc_misc]="#61afef"
|
||||
|
||||
# Cpu box outline color
|
||||
theme[cpu_box]="#5c6370"
|
||||
|
||||
# Memory/disks box outline color
|
||||
theme[mem_box]="#5c6370"
|
||||
|
||||
# Net up/down box outline color
|
||||
theme[net_box]="#5c6370"
|
||||
|
||||
# Processes box outline color
|
||||
theme[proc_box]="#5c6370"
|
||||
|
||||
# Box divider line and small boxes line color
|
||||
theme[div_line]="#5c6370"
|
||||
|
||||
# Temperature graph colors
|
||||
theme[temp_start]="#98c379"
|
||||
theme[temp_mid]="#e5c07b"
|
||||
theme[temp_end]="#e06c75"
|
||||
|
||||
# CPU graph colors
|
||||
theme[cpu_start]="#98c379"
|
||||
theme[cpu_mid]="#e5c07b"
|
||||
theme[cpu_end]="#e06c75"
|
||||
|
||||
# Mem/Disk free meter
|
||||
theme[free_start]="#98c379"
|
||||
theme[free_mid]="#e5c07b"
|
||||
theme[free_end]="#e06c75"
|
||||
|
||||
# Mem/Disk cached meter
|
||||
theme[cached_start]="#98c379"
|
||||
theme[cached_mid]="#e5c07b"
|
||||
theme[cached_end]="#e06c75"
|
||||
|
||||
# Mem/Disk available meter
|
||||
theme[available_start]="#98c379"
|
||||
theme[available_mid]="#e5c07b"
|
||||
theme[available_end]="#e06c75"
|
||||
|
||||
# Mem/Disk used meter
|
||||
theme[used_start]="#98c379"
|
||||
theme[used_mid]="#e5c07b"
|
||||
theme[used_end]="#e06c75"
|
||||
|
||||
# Download graph colors
|
||||
theme[download_start]="#98c379"
|
||||
theme[download_mid]="#e5c07b"
|
||||
theme[download_end]="#e06c75"
|
||||
|
||||
# Upload graph colors
|
||||
theme[upload_start]="#98c379"
|
||||
theme[upload_mid]="#e5c07b"
|
||||
theme[upload_end]="#e06c75"
|
||||
5
nix/homeModules/common/btop/default.nix
Normal file
5
nix/homeModules/common/btop/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
programs.btop.enable = true;
|
||||
xdg.configFile.btop.source = lib.mkIf config.programs.btop.enable ./btop;
|
||||
}
|
||||
59
nix/homeModules/common/cmus/default.nix
Normal file
59
nix/homeModules/common/cmus/default.nix
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options.programs.cmus.enable = lib.mkEnableOption "cmus";
|
||||
|
||||
config = lib.mkIf config.programs.cmus.enable {
|
||||
home.packages = [ pkgs.cmus ];
|
||||
xdg.configFile."cmus/rc".text = lib.mkMerge [
|
||||
(builtins.readFile ./rc)
|
||||
|
||||
(lib.mkIf pkgs.stdenv.isLinux (
|
||||
let
|
||||
# dispatch to multiple callbacks
|
||||
callback = pkgs.writeShellApplication {
|
||||
name = "cmus-callback-script";
|
||||
runtimeInputs = [
|
||||
pkgs.cmusfm
|
||||
pkgs.libnotify
|
||||
];
|
||||
text = ''
|
||||
argv=("$@")
|
||||
declare -A map
|
||||
while [ $# -gt 0 ]; do
|
||||
map["$1"]="$2"
|
||||
shift
|
||||
shift
|
||||
done
|
||||
|
||||
notify-send "''${map[title]}" "''${map[artist]} / ''${map[album]}"
|
||||
cmusfm "''${argv[@]}"
|
||||
'';
|
||||
};
|
||||
in
|
||||
''
|
||||
set status_display_program=${lib.getExe callback}
|
||||
''
|
||||
))
|
||||
|
||||
(lib.mkIf pkgs.stdenv.isDarwin ''
|
||||
set status_display_program=${lib.getExe pkgs.cmusfm}
|
||||
'')
|
||||
|
||||
(lib.mkIf pkgs.stdenv.isLinux ''
|
||||
set output_plugin=alsa
|
||||
'')
|
||||
|
||||
# When switching over bluetooth, toggle the output device to coreaudio
|
||||
# and back to ao would fix the no sound issue.
|
||||
(lib.mkIf pkgs.stdenv.isDarwin ''
|
||||
# distortion fix https://github.com/cmus/cmus/issues/1130#issuecomment-1003324193
|
||||
set output_plugin=ao
|
||||
'')
|
||||
];
|
||||
};
|
||||
}
|
||||
94
nix/homeModules/common/cmus/rc
Normal file
94
nix/homeModules/common/cmus/rc
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
colorscheme spotify
|
||||
|
||||
set aaa_mode=album
|
||||
set confirm_run=true
|
||||
set continue=true
|
||||
set continue_album=true
|
||||
set follow=true
|
||||
|
||||
bind -f browser - browser-up
|
||||
bind -f browser i toggle show_hidden
|
||||
bind -f browser space win-activate
|
||||
bind -f browser u win-update
|
||||
bind -f common ! push shell
|
||||
bind -f common / search-start
|
||||
bind -f common 1 view tree
|
||||
bind -f common 2 view sorted
|
||||
bind -f common 3 view playlist
|
||||
bind -f common 4 view queue
|
||||
bind -f common 5 view browser
|
||||
bind -f common 6 view filters
|
||||
bind -f common 7 view settings
|
||||
bind -f common < seek -1m
|
||||
bind -f common = vol +10%
|
||||
bind -f common > seek +1m
|
||||
bind -f common ? search-b-start
|
||||
bind -f common B player-prev-album
|
||||
bind -f common C toggle continue
|
||||
bind -f common D win-remove
|
||||
bind -f common F push filter
|
||||
bind -f common G win-bottom
|
||||
bind -f common K echo {}
|
||||
bind -f common L push live-filter
|
||||
bind -f common M toggle play_library
|
||||
bind -f common N search-prev
|
||||
bind -f common P win-mv-before
|
||||
bind -f common Q win-add-Q
|
||||
bind -f common U win-update-cache
|
||||
bind -f common W player-next-album
|
||||
bind -f common [ vol +1% +0
|
||||
bind -f common ] vol +0 +1%
|
||||
bind -f common ^B win-page-up
|
||||
bind -f common ^C echo Type :quit<enter> to exit cmus.
|
||||
bind -f common ^D win-half-page-down
|
||||
bind -f common ^E win-scroll-down
|
||||
bind -f common ^F win-page-down
|
||||
bind -f common ^L refresh
|
||||
bind -f common ^R toggle repeat_current
|
||||
bind -f common ^U win-half-page-up
|
||||
bind -f common ^Y win-scroll-up
|
||||
bind -f common a win-add-l
|
||||
bind -f common b player-prev
|
||||
bind -f common c player-pause
|
||||
bind -f common delete win-remove
|
||||
bind -f common down win-down
|
||||
bind -f common end win-bottom
|
||||
bind -f common enter win-activate
|
||||
bind -f common f toggle follow
|
||||
bind -f common g win-top
|
||||
bind -f common h seek -5
|
||||
bind -f common home win-top
|
||||
bind -f common i win-sel-cur
|
||||
bind -f common j win-down
|
||||
bind -f common k win-up
|
||||
bind -f common l seek +5
|
||||
bind -f common left seek -5
|
||||
bind -f common m toggle aaa_mode
|
||||
bind -f common mlb_click_bar player-pause
|
||||
bind -f common mlb_click_selected win-activate
|
||||
bind -f common mouse_scroll_down win-down
|
||||
bind -f common mouse_scroll_down_bar seek -5
|
||||
bind -f common mouse_scroll_down_title right-view
|
||||
bind -f common mouse_scroll_up win-up
|
||||
bind -f common mouse_scroll_up_bar seek +5
|
||||
bind -f common mouse_scroll_up_title left-view
|
||||
bind -f common n search-next
|
||||
bind -f common o toggle play_sorted
|
||||
bind -f common p win-mv-after
|
||||
bind -f common page_down win-page-down
|
||||
bind -f common page_up win-page-up
|
||||
bind -f common q win-add-q
|
||||
bind -f common r toggle repeat
|
||||
bind -f common right seek +5
|
||||
bind -f common s toggle shuffle
|
||||
bind -f common space win-toggle
|
||||
bind -f common t toggle show_remaining_time
|
||||
bind -f common tab win-next
|
||||
bind -f common u update-cache
|
||||
bind -f common up win-up
|
||||
bind -f common v player-stop
|
||||
bind -f common w player-next
|
||||
bind -f common x player-play
|
||||
bind -f common y win-add-p
|
||||
bind -f common { vol -1% -0
|
||||
bind -f common } vol -0 -1%
|
||||
13
nix/homeModules/common/direnv/default.nix
Normal file
13
nix/homeModules/common/direnv/default.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
config = builtins.fromTOML ''
|
||||
[whitelist]
|
||||
prefix = [ "${config.home.homeDirectory}/.dotfiles" ]
|
||||
[global]
|
||||
strict_env = true
|
||||
'';
|
||||
};
|
||||
}
|
||||
80
nix/homeModules/common/fish/aliasesAbbrs.nix
Normal file
80
nix/homeModules/common/fish/aliasesAbbrs.nix
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
pkgs,
|
||||
hostname,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
programs.fish = {
|
||||
shellAbbrs = lib.mkMerge [
|
||||
{
|
||||
## Docker
|
||||
dc = "docker compose";
|
||||
|
||||
## Git
|
||||
gaa = "git add (git rev-parse --show-toplevel)";
|
||||
"ga." = "git add .";
|
||||
gp = "git pull";
|
||||
gP = "git push";
|
||||
clone = "clone_to_repos";
|
||||
|
||||
## Editor
|
||||
ts = "tmux_sessionizer";
|
||||
v = "nvim";
|
||||
|
||||
":q" = "exit";
|
||||
|
||||
nhist = "sudo nix profile history --profile /nix/var/nix/profiles/system";
|
||||
hhist = "nix profile history --profile ~/.local/state/nix/profiles/home-manager";
|
||||
|
||||
nwipe = "sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 7d";
|
||||
hwipe = "nix profile wipe-history --profile ~/.local/state/nix/profiles/home-manager --older-than 7d";
|
||||
}
|
||||
|
||||
# TODO: move this out
|
||||
(lib.mkIf pkgs.stdenv.isLinux {
|
||||
ss = "sudo systemctl";
|
||||
se = "SUDO_EDITOR=(which nvim) sudoedit";
|
||||
ns = "sudo nixos-rebuild switch -L --flake ~/.dotfiles#${hostname}";
|
||||
hs = "home-manager switch -L --flake ~/.dotfiles#${hostname}";
|
||||
})
|
||||
|
||||
(lib.mkIf pkgs.stdenv.isDarwin {
|
||||
ns = "darwin-rebuild switch -L --flake ~/.dotfiles#${hostname} --option sandbox false";
|
||||
ndd = "nix develop -L --option sandbox false -c true"; # run the develop once without sandbox when needed
|
||||
})
|
||||
];
|
||||
|
||||
shellAliases = lib.mkMerge [
|
||||
{
|
||||
rm = "rm -I"; # idiot protection
|
||||
tree = "tree -Cph";
|
||||
restow = "cd ~/.dotfiles/ && stow -D . && stow -S . && prevd";
|
||||
nix-shell = "nix-shell --run fish";
|
||||
",," = "nix shell -c";
|
||||
}
|
||||
|
||||
(lib.mkIf pkgs.stdenv.isLinux {
|
||||
# idiot protection
|
||||
chmod = "chmod --preserve-root";
|
||||
chown = "chown --preserve-root";
|
||||
})
|
||||
|
||||
(lib.mkIf pkgs.stdenv.isDarwin (
|
||||
let
|
||||
cmds = builtins.concatStringsSep ";";
|
||||
in
|
||||
{
|
||||
reset_launchpad = cmds [
|
||||
"defaults write com.apple.dock ResetLaunchPad -bool true"
|
||||
"killall Dock"
|
||||
];
|
||||
add_spacer_tile = cmds [
|
||||
"defaults write com.apple.dock persistent-apps -array-add '{tile-type=\"small-spacer-tile\";}"
|
||||
"killall Dock"
|
||||
];
|
||||
}
|
||||
))
|
||||
];
|
||||
};
|
||||
}
|
||||
11
nix/homeModules/common/fish/conf.d/bind.fish
Normal file
11
nix/homeModules/common/fish/conf.d/bind.fish
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
for mode in default insert
|
||||
bind --mode $mode \cg tmux_home
|
||||
bind --mode $mode \cf tmux_sessionizer
|
||||
end
|
||||
|
||||
# vi cursor style
|
||||
fish_vi_key_bindings
|
||||
set fish_cursor_default block
|
||||
set fish_cursor_insert line
|
||||
set fish_cursor_replace_one underscore
|
||||
set fish_cursor_visual block
|
||||
100
nix/homeModules/common/fish/conf.d/colorscheme.fish
Normal file
100
nix/homeModules/common/fish/conf.d/colorscheme.fish
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
# Learn more: https://fishshell.com/docs/current/interactive.html
|
||||
|
||||
begin
|
||||
# scope this in a bolck to not leak variables everywhere
|
||||
|
||||
set -l black 000000
|
||||
set -l grey a0a1a7
|
||||
set -l cyan 0184bc
|
||||
set -l blue 4078f2
|
||||
set -l purple a626a4
|
||||
set -l green 50a14f
|
||||
set -l orange e45649
|
||||
set -l red ca1243
|
||||
set -l brown 986801
|
||||
set -l gold c18401
|
||||
set -l accent 645199
|
||||
set -l visual d0d0d0
|
||||
|
||||
###########
|
||||
# General #
|
||||
###########
|
||||
# default color
|
||||
set fish_color_normal $black
|
||||
# commands like echo
|
||||
set fish_color_command $blue
|
||||
# keywords like if - this falls back on the command color if unset
|
||||
set fish_color_keyword $purple
|
||||
# quoted text like "abc"
|
||||
set fish_color_quote $green
|
||||
# IO redirections like >/dev/null
|
||||
set fish_color_redirection $gold
|
||||
# process separators like ; and &
|
||||
set fish_color_end $black --bold
|
||||
# syntax errors
|
||||
set fish_color_error $black
|
||||
# ordinary command parameters
|
||||
set fish_color_param $red
|
||||
# parameters that are filenames (if the file exists)
|
||||
set fish_color_valid_path --italics
|
||||
# options starting with “-”, up to the first “--” parameter
|
||||
set fish_color_option $cyan
|
||||
# comments like ‘# important’
|
||||
set fish_color_comment $grey
|
||||
# selected text in vi visual mode
|
||||
set fish_color_selection --background=$visual
|
||||
# parameter expansion operators like * and ~
|
||||
set fish_color_operator $orange
|
||||
# character escapes like \n and \x70
|
||||
set fish_color_escape $purple
|
||||
# autosuggestions (the proposed rest of a command)
|
||||
set fish_color_autosuggestion $grey
|
||||
# The current working directory in the default prompt
|
||||
set fish_color_cwd $black
|
||||
# The current working directory in the default prompt for the root user
|
||||
set fish_color_cwd_root $red
|
||||
# The username in the default prompt
|
||||
set fish_color_user $grey
|
||||
# The hostname in the default prompt
|
||||
set fish_color_host $black
|
||||
# the hostname in the default prompt for remote sessions (like ssh)
|
||||
set fish_color_host_remote $red
|
||||
# the last command’s nonzero exit code in the default prompt
|
||||
set fish_color_status $red
|
||||
# the ‘^C’ indicator on a canceled command
|
||||
set fish_color_cancel $accent --reverse
|
||||
# history search matches and selected pager items (background only)
|
||||
set fish_color_search_match --background $visual
|
||||
|
||||
#########
|
||||
# Pager #
|
||||
#########
|
||||
# the progress bar at the bottom left corner
|
||||
set fish_pager_color_progress --reverse $cyan
|
||||
# the background color of a line
|
||||
set fish_pager_color_background $black
|
||||
# the prefix string, i.e. the string that is to be completed
|
||||
set fish_pager_color_prefix $black
|
||||
# the completion itself, i.e. the proposed rest of the string
|
||||
set fish_pager_color_completion $grey
|
||||
# the completion description
|
||||
set fish_pager_color_description $grey
|
||||
# background of the selected completion
|
||||
set fish_pager_color_selected_background $black
|
||||
# prefix of the selected completion
|
||||
set fish_pager_color_selected_prefix
|
||||
# suffix of the selected completion
|
||||
set fish_pager_color_selected_completion $red
|
||||
# description of the selected completion
|
||||
set fish_pager_color_selected_description $gold
|
||||
|
||||
# ## Alternating colors
|
||||
# # background of every second unselected completion
|
||||
# set fish_pager_color_secondary_background --background=$tinted_bg
|
||||
# # prefix of every second unselected completion
|
||||
# set fish_pager_color_secondary_prefix
|
||||
# # suffix of every second unselected completion
|
||||
# set fish_pager_color_secondary_completion
|
||||
# # description of every second unselected completion
|
||||
# set fish_pager_color_secondary_description
|
||||
end
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
# fzf preview theme (use delta instead of bat)
|
||||
set -x fzf_preview_file_cmd 'delta'
|
||||
# fd uses LS_COLORS
|
||||
set -x LS_COLORS (vivid -m 24-bit generate one-light)
|
||||
# fzf-fish search hidden files
|
||||
set -x fzf_fd_opts --hidden --exclude=.git
|
||||
14
nix/homeModules/common/fish/conf.d/locale.fish
Normal file
14
nix/homeModules/common/fish/conf.d/locale.fish
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# zh_TW
|
||||
# set -x LANG zh_TW.UTF-8
|
||||
# set -x LANGUAGE zh_TW
|
||||
# set -x LC_ALL zh_TW.UTF-8
|
||||
|
||||
# fr_FR
|
||||
# set -x LANG fr_FR.UTF-8
|
||||
# set -x LANGUAGE fr_FR
|
||||
# set -x LC_ALL fr_FR.UTF-8
|
||||
|
||||
# en_US
|
||||
set -x LANG en_US.UTF-8
|
||||
set -x LANGUAGE en_US
|
||||
set -x LC_ALL en_US.UTF-8
|
||||
4
nix/homeModules/common/fish/conf.d/shellInit.fish
Normal file
4
nix/homeModules/common/fish/conf.d/shellInit.fish
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# repo paths
|
||||
set REPOS_PATH ~/repos
|
||||
set UNIV_REPOS_PATH ~/univ-repos
|
||||
set PLAYGROUND_PATH ~/playground
|
||||
105
nix/homeModules/common/fish/default.nix
Normal file
105
nix/homeModules/common/fish/default.nix
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [ ./aliasesAbbrs.nix ];
|
||||
|
||||
options.programs.fish.sourcePaths = lib.mkOption {
|
||||
type = with lib.types; nonEmptyListOf str;
|
||||
description = ''
|
||||
Paths to be sourced idempotently at the start of a login-shell.
|
||||
'';
|
||||
};
|
||||
|
||||
config.xdg.configFile."fish/functions".source = lib.mkIf config.programs.fish.enable ./functions;
|
||||
config.programs.fish =
|
||||
let
|
||||
readConfig = n: builtins.readFile ./conf.d/${n}.fish;
|
||||
readConfigs = ns: builtins.concatStringsSep "\n" (map readConfig ns);
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
|
||||
# We need to handle path idempotently, because fish in home-manager is
|
||||
# unable to depend on nixos/nix-darwin configurations to figure out the profile.d/nix.sh
|
||||
# to source.
|
||||
#
|
||||
# The hack is to make terminal emulators run fish as a login shell
|
||||
# whenever fish should handle the path.
|
||||
# tmux should NOT call fish as a login shell, because it would inherit the
|
||||
# environment variables from its parent shell, which is a login shell.
|
||||
loginShellInit = ''
|
||||
begin
|
||||
set ps ${builtins.concatStringsSep " " config.programs.fish.sourcePaths}
|
||||
|
||||
set -e fish_user_paths
|
||||
for p in $ps
|
||||
test -d $p && set --append fish_user_paths $p
|
||||
end
|
||||
end
|
||||
'';
|
||||
|
||||
sourcePaths =
|
||||
[
|
||||
# Make sure wrapper comes first
|
||||
# https://discourse.nixos.org/t/sudo-run-current-system-sw-bin-sudo-must-be-owned-by-uid-0-and-have-the-setuid-bit-set-and-cannot-chdir-var-cron-bailing-out-var-cron-permission-denied/20463/2
|
||||
"/run/wrappers/bin"
|
||||
|
||||
# Make sure nixcpp with the specified version in the flake come first
|
||||
"${config.nix.package}/bin"
|
||||
|
||||
"${config.home.homeDirectory}/.nix-profile/bin"
|
||||
"/nix/profile/bin"
|
||||
"${config.home.homeDirectory}/.local/state/nix/profile/bin"
|
||||
|
||||
"/etc/profiles/per-user/${config.home.username}/bin"
|
||||
|
||||
"/nix/var/nix/profiles/default/bin"
|
||||
"/run/current-system/sw/bin"
|
||||
]
|
||||
# Add brew, but as fallback
|
||||
++ (lib.lists.optional pkgs.stdenv.isDarwin "/opt/homebrew/bin");
|
||||
|
||||
shellInit = readConfig "shellInit";
|
||||
|
||||
interactiveShellInit = readConfigs [
|
||||
"interactiveShellInit"
|
||||
"bind"
|
||||
"colorscheme"
|
||||
"locale"
|
||||
];
|
||||
|
||||
plugins = [
|
||||
{
|
||||
name = "fzf-fish";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "PatrickF1";
|
||||
repo = "fzf.fish";
|
||||
rev = "v10.3";
|
||||
hash = "sha256-T8KYLA/r/gOKvAivKRoeqIwE2pINlxFQtZJHpOy9GMM=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "colored-man-pages";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "PatrickF1";
|
||||
repo = "colored_man_pages.fish";
|
||||
rev = "f885c2507128b70d6c41b043070a8f399988bc7a";
|
||||
sha256 = "sha256-ii9gdBPlC1/P1N9xJzqomrkyDqIdTg+iCg0mwNVq2EU=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "sponge";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "meaningful-ooo";
|
||||
repo = "sponge";
|
||||
sha256 = "sha256-MdcZUDRtNJdiyo2l9o5ma7nAX84xEJbGFhAVhK+Zm1w=";
|
||||
rev = "1.1.0";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
15
nix/homeModules/common/fish/functions/,.fish
Normal file
15
nix/homeModules/common/fish/functions/,.fish
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
function ,
|
||||
set ps
|
||||
set os
|
||||
for p in $argv
|
||||
if not string match -q -- "--*" $p
|
||||
set -a ps "nixpkgs#$p"
|
||||
else
|
||||
set -a os "$p"
|
||||
end
|
||||
end
|
||||
|
||||
set cmd "SHELL=(which fish) IN_NIX_SHELL=\"impure\" nix shell $os $ps"
|
||||
echo "Executing `$cmd`..."
|
||||
eval $cmd
|
||||
end
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
function __tmux_attach_or_switch \
|
||||
--description "Attach (not in tmux) or switch (in tmux) to a session"
|
||||
### Arguments:
|
||||
set session_name $argv[1]
|
||||
|
||||
if [ -z "$TMUX" ]
|
||||
tmux attach-session -t $session_name
|
||||
else
|
||||
tmux switch-client -t $session_name
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
function __tmux_maybe_create \
|
||||
--description "Create a tmux session with sensible defaults if it doesn't exist yet"
|
||||
### Arguments:
|
||||
set session_name $argv[1]
|
||||
set session_dir $argv[2]
|
||||
|
||||
if pgrep tmux 2>&1 >/dev/null; or ! tmux has -t=$session_name 2>/dev/null
|
||||
tmux \
|
||||
new-session -ds $session_name -c $session_dir \; \
|
||||
send-keys -t $session_name $EDITOR ENTER \; \
|
||||
new-window -t $session_name -c $session_dir \; \
|
||||
select-window -t $session_name:1
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
function __tmux_register_session \
|
||||
--description "Register the session, if it's not set yet"
|
||||
### Effects:
|
||||
set last /tmp/TMUX_LAST
|
||||
|
||||
set this (tmux display-message -p '#S')
|
||||
if [ ! -f "$last" ]; or [ (cat "$last") != "$this" ]
|
||||
echo "$this" >"$last"
|
||||
end
|
||||
|
||||
end
|
||||
13
nix/homeModules/common/fish/functions/clone_to_repos.fish
Normal file
13
nix/homeModules/common/fish/functions/clone_to_repos.fish
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
function clone_to_repos
|
||||
|
||||
if not count $argv >/dev/null
|
||||
echo "Git url needed"
|
||||
end
|
||||
|
||||
set name_repo (echo $argv | sed -E 's/.*[:\\/]([^\\/]+)\\/([^\\/]+?)(:?\\.git)$/\1 \2/')
|
||||
set name (echo $name_repo | cut -d ' ' -f1)
|
||||
set repo (echo $name_repo | cut -d ' ' -f2)
|
||||
mkdir -p $REPOS_PATH/$name
|
||||
git clone $argv $REPOS_PATH/$name/$repo
|
||||
|
||||
end
|
||||
12
nix/homeModules/common/fish/functions/fish_greeting.fish
Normal file
12
nix/homeModules/common/fish/functions/fish_greeting.fish
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
function fish_greeting
|
||||
|
||||
set_color --italics
|
||||
switch $FISH_GREETING
|
||||
case toh
|
||||
cat ~/.quotes/toh/* | shuf -n 1
|
||||
case fleabag
|
||||
cat ~/.quotes/fleabag/* | shuf -n 1
|
||||
case "*"
|
||||
end
|
||||
|
||||
end
|
||||
29
nix/homeModules/common/fish/functions/fzf_pass.fish
Normal file
29
nix/homeModules/common/fish/functions/fzf_pass.fish
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
function fzf_pass
|
||||
|
||||
set selected \
|
||||
(begin
|
||||
fd -tf . $PASSWORD_STORE_DIR | sed "s|^$PASSWORD_STORE_DIR/\(.*\)\.gpg\$|\1|"
|
||||
end | fzf)
|
||||
|
||||
if [ -z "$selected" ]
|
||||
echo Nothing selected
|
||||
echo exiting...
|
||||
end
|
||||
|
||||
set mode \
|
||||
(begin
|
||||
echo "password"
|
||||
echo "otp"
|
||||
echo "all"
|
||||
end | fzf)
|
||||
|
||||
switch "$mode"
|
||||
case all
|
||||
pass "$selected" | nvim +"setlocal buftype=nofile bufhidden=hide noswapfile"
|
||||
case password
|
||||
pass "$selected" -c
|
||||
case otp
|
||||
pass otp "$selected" -c
|
||||
end
|
||||
|
||||
end
|
||||
5
nix/homeModules/common/fish/functions/snakecase.fish
Normal file
5
nix/homeModules/common/fish/functions/snakecase.fish
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
function snakecase
|
||||
|
||||
echo $argv | sed -E 's/[^A-Za-z0-9_\n]+/_/g' | sed -E 's/__+/_/g' | tr '[:upper:]' '[:lower:]'
|
||||
|
||||
end
|
||||
19
nix/homeModules/common/fish/functions/tmux_home.fish
Normal file
19
nix/homeModules/common/fish/functions/tmux_home.fish
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
function tmux_home \
|
||||
--description "Take me back to ~"
|
||||
|
||||
set session_name home
|
||||
|
||||
if pgrep tmux 2>&1 >/dev/null
|
||||
__tmux_register_session
|
||||
end
|
||||
|
||||
if pgrep tmux 2>&1 >/dev/null; or ! tmux has -t=$session_name 2>/dev/null
|
||||
tmux \
|
||||
new-session -ds home \; \
|
||||
new-window -t home \; \
|
||||
select-window -t "home":1
|
||||
end
|
||||
|
||||
__tmux_attach_or_switch $session_name
|
||||
|
||||
end
|
||||
16
nix/homeModules/common/fish/functions/tmux_last.fish
Normal file
16
nix/homeModules/common/fish/functions/tmux_last.fish
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
function tmux_last \
|
||||
--description "Toggle the last tmux session"
|
||||
|
||||
set tmux_last /tmp/TMUX_LAST
|
||||
if [ ! -f $tmux_last ]
|
||||
echo "Last session is not yet set"
|
||||
return 1
|
||||
end
|
||||
|
||||
set session_name (cat $tmux_last)
|
||||
|
||||
__tmux_register_session
|
||||
__tmux_maybe_create $session_name /tmp
|
||||
__tmux_attach_or_switch $session_name
|
||||
|
||||
end
|
||||
48
nix/homeModules/common/fish/functions/tmux_sessionizer.fish
Normal file
48
nix/homeModules/common/fish/functions/tmux_sessionizer.fish
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
function tmux_sessionizer \
|
||||
--description "Manage tmux sessions in specific folders with fzf"
|
||||
|
||||
set selected \
|
||||
(begin
|
||||
fd . $REPOS_PATH $UNIV_REPOS_PATH --exact-depth 2 --type d
|
||||
fd . $PLAYGROUND_PATH --exact-depth 1 --type d
|
||||
# Special mode to create a playground
|
||||
echo "play"
|
||||
echo "dotfiles"
|
||||
end 2> /dev/null | sed -e "s|^$HOME|~|" | fzf)
|
||||
|
||||
set selected (echo $selected | sed -e "s|^~|$HOME|")
|
||||
|
||||
if [ -z "$selected" ]
|
||||
commandline --function repaint
|
||||
return 0
|
||||
end
|
||||
|
||||
# derive session name based on selected path
|
||||
# dots are meaningful in tmux, remove them
|
||||
set session_name (echo $selected | tr . _)
|
||||
|
||||
# fixup special cases, override derived session_name if necessary
|
||||
# this should be id for non-special cases
|
||||
switch $selected
|
||||
case play
|
||||
read -P "Give it a name: " name
|
||||
if [ -z "$name" ]
|
||||
return 0
|
||||
end
|
||||
set name (snakecase "$name")
|
||||
|
||||
set selected ~/playground/$name
|
||||
set session_name (echo $selected | tr . _)
|
||||
mkdir -p $selected
|
||||
|
||||
case dotfiles
|
||||
set selected ~/.dotfiles
|
||||
set session_name dotfiles
|
||||
end
|
||||
|
||||
# effects
|
||||
__tmux_register_session $session_name
|
||||
__tmux_maybe_create $session_name $selected
|
||||
__tmux_attach_or_switch $session_name
|
||||
|
||||
end
|
||||
10
nix/homeModules/common/fish/functions/update_dotfiles.fish
Normal file
10
nix/homeModules/common/fish/functions/update_dotfiles.fish
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
function update_dotfiles
|
||||
|
||||
cd ~/.dotfiles/
|
||||
git reset --hard
|
||||
git pull --set-upstream origin main
|
||||
git submodule update --init
|
||||
prevd
|
||||
restow
|
||||
|
||||
end
|
||||
16
nix/homeModules/common/fzf/default.nix
Normal file
16
nix/homeModules/common/fzf/default.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
defaultOptions = [
|
||||
"--cycle"
|
||||
"--border=none"
|
||||
"--preview-window=wrap"
|
||||
"--color=fg:#000000,bg:#eeeeee,hl:#ca1243"
|
||||
"--color=fg+:#000000,bg+:#d0d0d0,hl+:#ca1243"
|
||||
"--color=info:#0184bc,prompt:#645199,pointer:#645199"
|
||||
"--color=marker:#0184bc,spinner:#645199,header:#645199"
|
||||
"--color=gutter:#eeeeee"
|
||||
];
|
||||
};
|
||||
}
|
||||
73
nix/homeModules/common/git/default.nix
Normal file
73
nix/homeModules/common/git/default.nix
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
{ lib, ... }:
|
||||
{
|
||||
# git plugins
|
||||
programs.git = {
|
||||
lfs.enable = true;
|
||||
delta = {
|
||||
enable = true;
|
||||
options.syntax-theme = "OneHalfLight";
|
||||
};
|
||||
};
|
||||
|
||||
# git itself
|
||||
programs.git = {
|
||||
enable = true;
|
||||
extraConfig = {
|
||||
init.defaultBranch = "mistress"; # haha gay haha
|
||||
push.autoSetupRemote = true;
|
||||
pull.ff = "only";
|
||||
rerere.enabled = true;
|
||||
safe.directory = "/etc/docker/compose";
|
||||
};
|
||||
ignores = [
|
||||
# sanity
|
||||
".env"
|
||||
|
||||
# vim
|
||||
"*~"
|
||||
"*.swp"
|
||||
|
||||
# darwin
|
||||
".DS_Store"
|
||||
|
||||
# nix
|
||||
".direnv/"
|
||||
"**/result"
|
||||
|
||||
# pre-commit
|
||||
".pre-commit-config.yaml"
|
||||
|
||||
# dotfiles
|
||||
".config/nvim/spell/"
|
||||
".local/bin/"
|
||||
|
||||
# deploy-rs
|
||||
".deploy-gc/"
|
||||
];
|
||||
};
|
||||
|
||||
# identity
|
||||
programs.git = {
|
||||
userEmail = "leana.jiang+git@icloud.com";
|
||||
userName = "Léana 江";
|
||||
signing = {
|
||||
key = "0x4E887A4CA9714ADA";
|
||||
signByDefault = lib.mkDefault false;
|
||||
};
|
||||
};
|
||||
|
||||
programs.git.includes = [
|
||||
# university identity
|
||||
{
|
||||
condition = "gitdir:~/univ-repos/";
|
||||
contents = {
|
||||
init.defaultBranch = "main";
|
||||
user = {
|
||||
name = "Léana CHIANG";
|
||||
email = "leana.chiang@etudiant.univ-rennes1.fr";
|
||||
signingKey = "0x32035DB97E777EEB";
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
12
nix/homeModules/common/gpg/default.nix
Normal file
12
nix/homeModules/common/gpg/default.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{ pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
programs.gpg.enable = true;
|
||||
|
||||
services.gpg-agent = {
|
||||
enable = lib.mkIf pkgs.stdenv.isLinux true;
|
||||
enableFishIntegration = true;
|
||||
defaultCacheTtl = 1209600;
|
||||
pinentryPackage = pkgs.pinentry-tty;
|
||||
};
|
||||
}
|
||||
45
nix/homeModules/common/kitty/default.nix
Normal file
45
nix/homeModules/common/kitty/default.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
programs.kitty = lib.mkIf config.programs.kitty.enable {
|
||||
font = {
|
||||
name = "AltiosevkaNFM";
|
||||
size = 14;
|
||||
};
|
||||
settings = {
|
||||
foreground = "#000000";
|
||||
background = "#ffffff";
|
||||
confirm_os_window_close = 0;
|
||||
text_composition_strategy = "1.7 0";
|
||||
shell = ''${pkgs.fish}/bin/fish --command="tmux_home" --login'';
|
||||
};
|
||||
extraConfig = ''
|
||||
background #f8f8f8
|
||||
foreground #2a2b33
|
||||
cursor #bbbbbb
|
||||
selection_background #ececec
|
||||
color0 #000000
|
||||
color8 #000000
|
||||
color1 #ca1243
|
||||
color9 #ca1243
|
||||
color2 #50a14f
|
||||
color10 #50a14f
|
||||
color3 #e5bf6d
|
||||
color11 #e5bf6d
|
||||
color4 #4078f2
|
||||
color12 #4078f2
|
||||
color5 #950095
|
||||
color13 #a00095
|
||||
color6 #0184bc
|
||||
color14 #0184bc
|
||||
color7 #bbbbbb
|
||||
color15 #ffffff
|
||||
selection_foreground #f8f8f8
|
||||
'';
|
||||
shellIntegration.enableFishIntegration = true;
|
||||
};
|
||||
}
|
||||
63
nix/homeModules/common/neovim/default.nix
Normal file
63
nix/homeModules/common/neovim/default.nix
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
options.programs.neovim.extraLangServers = {
|
||||
enable = lib.mkEnableOption "miscellaneous language servers";
|
||||
};
|
||||
|
||||
config = {
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
package = pkgs.neovim-pin.neovim-unwrapped;
|
||||
defaultEditor = true;
|
||||
extraPackages = lib.mkMerge [
|
||||
|
||||
# might be useful for servers
|
||||
[
|
||||
# shell
|
||||
pkgs.nodePackages.bash-language-server
|
||||
pkgs.shellcheck
|
||||
pkgs.shfmt
|
||||
]
|
||||
|
||||
(lib.mkIf config.programs.neovim.extraLangServers.enable [
|
||||
# lua
|
||||
pkgs.lua-language-server
|
||||
pkgs.stylua
|
||||
|
||||
pkgs.nil # nix
|
||||
pkgs.yaml-language-server # yaml
|
||||
|
||||
pkgs.nodePackages.pyright # python
|
||||
|
||||
pkgs.marksman # markdown
|
||||
pkgs.taplo # toml
|
||||
pkgs.lemminx # xml
|
||||
# pkgs.texlab # latex
|
||||
])
|
||||
|
||||
];
|
||||
};
|
||||
|
||||
xdg.configFile =
|
||||
let
|
||||
fr_utf-8_spl = builtins.fetchurl {
|
||||
url = "http://ftp.vim.org/vim/runtime/spell/fr.utf-8.spl";
|
||||
sha256 = "abfb9702b98d887c175ace58f1ab39733dc08d03b674d914f56344ef86e63b61";
|
||||
};
|
||||
fr_utf-8_sug = builtins.fetchurl {
|
||||
url = "http://ftp.vim.org/vim/runtime/spell/fr.utf-8.sug";
|
||||
sha256 = "0294bc32b42c90bbb286a89e23ca3773b7ef50eff1ab523b1513d6a25c6b3f58";
|
||||
};
|
||||
in
|
||||
lib.mkIf config.programs.neovim.enable {
|
||||
"nvim/spell/fr.utf-8.spl".source = fr_utf-8_spl;
|
||||
"nvim/spell/fr.utf-8.sug".source = fr_utf-8_sug;
|
||||
};
|
||||
};
|
||||
}
|
||||
76
nix/homeModules/common/packages/default.nix
Normal file
76
nix/homeModules/common/packages/default.nix
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (pkgs) myPkgs;
|
||||
in
|
||||
|
||||
{
|
||||
options.extraPackages = {
|
||||
utilities.enable = lib.mkEnableOption "utility packages";
|
||||
workflow.enable = lib.mkEnableOption "worflow packages";
|
||||
};
|
||||
|
||||
config = {
|
||||
programs.home-manager.enable = true;
|
||||
home = {
|
||||
username = lib.mkDefault "leana";
|
||||
homeDirectory = lib.mkMerge [
|
||||
(lib.mkIf pkgs.stdenv.isLinux (lib.mkDefault "/home/leana"))
|
||||
(lib.mkIf pkgs.stdenv.isDarwin (lib.mkDefault "/Users/leana"))
|
||||
];
|
||||
};
|
||||
|
||||
programs.ripgrep.enable = true;
|
||||
home.packages = lib.mkMerge [
|
||||
[
|
||||
# shell and script dependencies
|
||||
pkgs.figlet
|
||||
pkgs.gnused
|
||||
pkgs.stow
|
||||
pkgs.fd
|
||||
pkgs.vivid
|
||||
|
||||
# nix
|
||||
pkgs.nixfmt-rfc-style
|
||||
|
||||
# utils
|
||||
pkgs.tree
|
||||
pkgs.tldr
|
||||
pkgs.parallel
|
||||
pkgs.findutils # xargs and more
|
||||
pkgs.du-dust
|
||||
]
|
||||
|
||||
(lib.mkIf pkgs.stdenv.isDarwin [
|
||||
# coreutils for darwin
|
||||
pkgs.uutils-coreutils-noprefix
|
||||
])
|
||||
|
||||
(lib.mkIf config.extraPackages.utilities.enable [
|
||||
pkgs.rsync
|
||||
pkgs.jq
|
||||
pkgs.hyperfine
|
||||
pkgs.watchexec
|
||||
pkgs.onefetch
|
||||
pkgs.ghostscript
|
||||
myPkgs.tokei
|
||||
pkgs.gnumake
|
||||
pkgs.just
|
||||
pkgs.nurl
|
||||
pkgs.tea
|
||||
pkgs.agenix
|
||||
pkgs.nvd
|
||||
])
|
||||
|
||||
(lib.mkIf config.extraPackages.workflow.enable [
|
||||
pkgs.act
|
||||
pkgs.forgejo-actions-runner
|
||||
])
|
||||
];
|
||||
};
|
||||
}
|
||||
29
nix/homeModules/common/password-store/default.nix
Normal file
29
nix/homeModules/common/password-store/default.nix
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
pass_enabled = config.programs.password-store.enable;
|
||||
|
||||
pass_cfg = {
|
||||
package = pkgs.pass.withExtensions (exts: [
|
||||
exts.pass-otp
|
||||
exts.pass-import
|
||||
]);
|
||||
settings = {
|
||||
PASSWORD_STORE_DIR = "${config.home.homeDirectory}/repos/leana/vault";
|
||||
};
|
||||
};
|
||||
extra_programs = [
|
||||
pkgs.pwgen
|
||||
pkgs.diceware
|
||||
];
|
||||
in
|
||||
|
||||
{
|
||||
home.packages = lib.mkIf pass_enabled extra_programs;
|
||||
programs.password-store = lib.mkIf pass_enabled pass_cfg;
|
||||
}
|
||||
7
nix/homeModules/common/starship/default.nix
Normal file
7
nix/homeModules/common/starship/default.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
settings = fromTOML (builtins.readFile ./starship.toml);
|
||||
};
|
||||
}
|
||||
90
nix/homeModules/common/starship/starship.toml
Normal file
90
nix/homeModules/common/starship/starship.toml
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
"$schema" = 'https://starship.rs/config-schema.json'
|
||||
|
||||
format = '''
|
||||
$status$hostname$directory$python$username$nix_shell
|
||||
$character
|
||||
'''
|
||||
right_format = '$cmd_duration$git_state$git_branch$git_commit$git_status'
|
||||
|
||||
palette = 'curry'
|
||||
|
||||
[palettes.curry]
|
||||
accent = '#645199' # Haskell purple
|
||||
accent_trans = '#efebfc'
|
||||
black = '#383A42'
|
||||
grey = '#a0a1a7'
|
||||
cyan = '#0184bc'
|
||||
blue = '#4078f2'
|
||||
purple = '#a626a4'
|
||||
green = '#50a14f'
|
||||
orange = '#e45649'
|
||||
red = '#ca1243'
|
||||
brown = '#986801'
|
||||
gold = '#c18401'
|
||||
tinted_bg = '#eeeeee'
|
||||
|
||||
[hostname]
|
||||
ssh_only = true
|
||||
style = 'bold orange'
|
||||
format = '[$hostname]($style):'
|
||||
|
||||
[username]
|
||||
style_root = 'bold orange'
|
||||
style_user = 'grey'
|
||||
format = '( [\($user\)]($style))'
|
||||
|
||||
[character]
|
||||
success_symbol = '[\$](black)' # Insert
|
||||
error_symbol = '[\$](black)' # Insert
|
||||
vimcmd_symbol = '[N](grey)' # Normal
|
||||
vimcmd_replace_symbol = '[R](grey)' # Replace
|
||||
vimcmd_replace_one_symbol = '[R](grey)' # Replace
|
||||
vimcmd_visual_symbol = '[V](grey)' # Visual
|
||||
|
||||
[directory]
|
||||
truncation_length = 4
|
||||
truncate_to_repo = false
|
||||
style = 'fg:black bg:accent_trans'
|
||||
format = '[$path]($style)( [$read_only]($read_only_style))'
|
||||
read_only = ''
|
||||
read_only_style = 'red'
|
||||
truncation_symbol = '…/'
|
||||
|
||||
[status]
|
||||
format = '([\[$status\]](bold red) )'
|
||||
disabled = false
|
||||
|
||||
[python]
|
||||
style = 'grey'
|
||||
format = '( [\($virtualenv\)]($style))'
|
||||
|
||||
[cmd_duration]
|
||||
min_time = 5_000
|
||||
show_milliseconds = true
|
||||
style = 'brown'
|
||||
format = '([$duration]($style) )'
|
||||
|
||||
[git_state]
|
||||
style = 'bold red'
|
||||
format = '\([$state( $progress_current/$progress_total)]($style)\) '
|
||||
|
||||
[git_branch]
|
||||
symbol = ''
|
||||
style = 'grey'
|
||||
format = '[$symbol$branch(:$remote_branch)]($style)'
|
||||
|
||||
[git_commit]
|
||||
style = 'accent'
|
||||
format = '[\(](grey)[$hash$tag]($style)[\)](grey)'
|
||||
|
||||
[git_status]
|
||||
ahead = '⇡$count'
|
||||
behind = '⇣$count'
|
||||
diverged = '⇕⇡$ahead_count⇣$behind_count'
|
||||
style = 'bold accent'
|
||||
format = '([\[](grey)[$all_status$ahead_behind]($style)[\]](grey))'
|
||||
|
||||
[nix_shell]
|
||||
# https://github.com/starship/starship/blob/073e16b4926009565c06897aabda7f807c63c5a0/src/modules/nix_shell.rs#L66-L70
|
||||
# apparently `$name` and `$unknown_msg` are mutually exclusive
|
||||
format = '[ \($state( $name)\)]($style) '
|
||||
12
nix/homeModules/common/tmux/default.nix
Normal file
12
nix/homeModules/common/tmux/default.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
extraConfig =
|
||||
''
|
||||
set -g default-command "${pkgs.fish}/bin/fish" # Use fish
|
||||
set -g default-shell "${pkgs.fish}/bin/fish"
|
||||
''
|
||||
+ builtins.readFile ./tmux.conf;
|
||||
};
|
||||
}
|
||||
127
nix/homeModules/common/tmux/tmux.conf
Normal file
127
nix/homeModules/common/tmux/tmux.conf
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
###########
|
||||
# Options #
|
||||
###########
|
||||
|
||||
set -s escape-time 0 # escape delay
|
||||
set -g mouse on # mouse control
|
||||
set -g focus-events on # focus-events for vim
|
||||
set -g default-terminal "tmux-256color" # enable italics
|
||||
set -g base-index 1 # start counting pane number from 1
|
||||
set -g renumber-windows on # auto reorder window number
|
||||
set -g mode-keys vi # global vi mode
|
||||
set -g history-limit 10000 # I want more history
|
||||
|
||||
# Display style
|
||||
set -g @FG "#000000"
|
||||
set -g @BG "#fafafa"
|
||||
set -g @GREY "#a0a1a7"
|
||||
set -g @VISUAL "#dedede"
|
||||
set -g @ACCENT "#645199"
|
||||
set -g @RED "#ca1243"
|
||||
|
||||
set -g message-style "fg=#{@FG},bold,bg=#{@VISUAL}"
|
||||
|
||||
# status bar
|
||||
set -g status-position top
|
||||
set -g status-justify left
|
||||
set -g status-style "fg=#{@FG},bg=#{@VISUAL}"
|
||||
set -g status-left ""
|
||||
set -g status-right-style "fg=#{@FG}"
|
||||
set -g status-right "#(basename #S)@#(uname -n) "
|
||||
set -g status-right-length "70"
|
||||
set -g window-status-activity-style "fg=#{@FG},bold,blink"
|
||||
set -g window-status-bell-style "fg=#{@FG},bold,blink"
|
||||
|
||||
# window name
|
||||
set -g window-status-style "fg=#{@GREY},bg=#{@VISUAL}"
|
||||
set -g window-status-format " #{pane_current_command}"
|
||||
set -g window-status-current-style "fg=#{@FG},bold,bg=#{@VISUAL}"
|
||||
set -g window-status-current-format " #{pane_current_command}"
|
||||
|
||||
# pane border (separator)
|
||||
set -g pane-border-style "fg=#{@VISUAL}"
|
||||
set -g pane-active-border-style "fg=#{@ACCENT}"
|
||||
|
||||
############
|
||||
# Bindings #
|
||||
############
|
||||
# remap prefix
|
||||
bind C-a send-prefix
|
||||
set -g prefix C-a
|
||||
unbind C-b
|
||||
|
||||
# easy config reload (that bypasses nix too)
|
||||
bind r source-file ~/.dotfiles/nix/homeModules/tmux/tmux.conf \; display-message "tmux.conf reloaded."
|
||||
|
||||
# organic jumping
|
||||
bind -n C-h select-window -t 1
|
||||
bind -n C-t select-window -t 2
|
||||
bind -n C-n select-window -t 3
|
||||
bind -n C-s select-window -t 4
|
||||
bind -T copy-mode-vi C-h select-window -t 1
|
||||
bind -T copy-mode-vi C-t select-window -t 2
|
||||
bind -T copy-mode-vi C-n select-window -t 3
|
||||
bind -T copy-mode-vi C-s select-window -t 4
|
||||
|
||||
# stop the clock madness
|
||||
unbind t
|
||||
|
||||
# vim-sytle pane jumping
|
||||
bind h select-pane -L
|
||||
bind l select-pane -R
|
||||
bind j select-pane -D
|
||||
bind k select-pane -U
|
||||
|
||||
# unbind built-in select-pane jumping
|
||||
unbind Left
|
||||
unbind Right
|
||||
unbind Down
|
||||
unbind Up
|
||||
|
||||
# improve window swapping
|
||||
bind [ swap-window -d -t -1
|
||||
bind ] swap-window -d -t +1
|
||||
|
||||
# Prime says the find window is for chumps. Don't use the find window
|
||||
bind -n C-f run-shell "tmux neww fish -c tmux_sessionizer"
|
||||
bind -n C-g run-shell "fish -c tmux_home"
|
||||
bind s run-shell "fish -c tmux_last"
|
||||
|
||||
# fast kill
|
||||
bind C-k confirm-before kill-session
|
||||
|
||||
# pane movement
|
||||
bind < command-prompt -p "join pane from:" "join-pane -s '%%'"
|
||||
bind > command-prompt -p "send pane to:" "join-pane -t '%%'"
|
||||
bind b command-prompt -p "break pane to " "break-pane -t '%%'"
|
||||
|
||||
# Disable toggle
|
||||
# credit https://github.com/samoshkin/tmux-config/blob/master/tmux/tmux.conf
|
||||
bind -T root F12 \
|
||||
set prefix None \;\
|
||||
set key-table off \;\
|
||||
set window-status-current-style "fg=#{@GREY},bold,bg=#{@VISUAL}" \;\
|
||||
refresh-client -S
|
||||
|
||||
bind -T off F12 \
|
||||
set -u prefix \;\
|
||||
set -u key-table \;\
|
||||
set -u status \;\
|
||||
set window-status-current-style "fg=#{@FG},bold,bg=#{@VISUAL}" \;\
|
||||
refresh-client -S
|
||||
|
||||
# Better copy
|
||||
bind v copy-mode
|
||||
bind -T copy-mode-vi v send-keys -X begin-selection
|
||||
if-shell "uname | grep -q Darwin" {
|
||||
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'pbcopy'
|
||||
bind-key -T copy-mode-vi Enter send -X copy-pipe-and-cancel 'pbcopy'
|
||||
} {
|
||||
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
|
||||
bind-key -T copy-mode-vi Enter send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
|
||||
}
|
||||
|
||||
# if-shell "[ -n \"#{@SSH_CLIENT}\"]" {
|
||||
# bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'ssh leana@10.0.0.10 pbcopy'
|
||||
# bind-key -T copy-mode-vi 'Y' send -X copy-pipe-and-cancel 'ssh leana@10.66.66.10 pbcopy'
|
||||
# }
|
||||
37
nix/homeModules/common/user-nixconf/default.nix
Normal file
37
nix/homeModules/common/user-nixconf/default.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{ pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
|
||||
nix = {
|
||||
package = lib.mkForce pkgs.nixVersions.nix_2_23;
|
||||
|
||||
settings = {
|
||||
allow-import-from-derivation = "true";
|
||||
extra-substituters = [
|
||||
"https://nix-community.cachix.org"
|
||||
"https://leana8959.cachix.org"
|
||||
];
|
||||
extra-trusted-substituters = [
|
||||
"https://nix-community.cachix.org"
|
||||
"https://leana8959.cachix.org"
|
||||
];
|
||||
extra-trusted-public-keys = [
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
"leana8959.cachix.org-1:CxQSAp8lcgMv8Me459of0jdXRW2tcyeYRKTiiUq8z0M="
|
||||
];
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
};
|
||||
|
||||
registry.flakies = {
|
||||
from.id = "flakies";
|
||||
from.type = "indirect";
|
||||
to.type = "git";
|
||||
to.url = "https://git.earth2077.fr/leana/flakies";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
33
nix/homeModules/common/vim/default.nix
Normal file
33
nix/homeModules/common/vim/default.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.vim = {
|
||||
enable = true;
|
||||
extraConfig = builtins.readFile ./vimrc;
|
||||
plugins =
|
||||
let
|
||||
vpkgs = pkgs.vimPlugins;
|
||||
|
||||
paramount = pkgs.vimUtils.buildVimPlugin {
|
||||
name = "paramount";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "owickstrom";
|
||||
repo = "vim-colors-paramount";
|
||||
rev = "a5601d36fb6932e8d1a6f8b37b179a99b1456798";
|
||||
hash = "sha256-j9nMjKYK7bqrGHprYp0ddLEWs1CNMudxXD13sOROVmY=";
|
||||
};
|
||||
};
|
||||
in
|
||||
[
|
||||
vpkgs.vim-sleuth
|
||||
vpkgs.vim-surround
|
||||
vpkgs.vim-fugitive
|
||||
vpkgs.vim-commentary
|
||||
vpkgs.undotree
|
||||
vpkgs.tabular
|
||||
vpkgs.vim-wakatime
|
||||
vpkgs.vim-caddyfile
|
||||
paramount
|
||||
];
|
||||
};
|
||||
}
|
||||
105
nix/homeModules/common/vim/vimrc
Normal file
105
nix/homeModules/common/vim/vimrc
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
set belloff=all
|
||||
|
||||
set hlsearch
|
||||
set incsearch
|
||||
|
||||
set number
|
||||
set relativenumber
|
||||
set cursorline
|
||||
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set noexpandtab
|
||||
|
||||
set nowrap
|
||||
set linebreak
|
||||
set breakindent
|
||||
|
||||
set noswapfile
|
||||
set nobackup
|
||||
set undofile
|
||||
|
||||
set termguicolors
|
||||
syntax on
|
||||
|
||||
set ignorecase
|
||||
set smartcase
|
||||
set autoindent
|
||||
set smartindent
|
||||
|
||||
set scrolloff=3
|
||||
|
||||
set colorcolumn=80
|
||||
|
||||
"""""""""""
|
||||
" Keymaps "
|
||||
"""""""""""
|
||||
let mapleader = " "
|
||||
|
||||
vnoremap J :m '>+1<CR>gv=gv
|
||||
vnoremap K :m '<-2<CR>gv=gv
|
||||
|
||||
" Centered motions
|
||||
nnoremap <C-d> <C-d>zz
|
||||
nnoremap <C-u> <C-u>zz
|
||||
nnoremap n nzzzv
|
||||
nnoremap N Nzzzv
|
||||
nnoremap J mzJ`z
|
||||
|
||||
" Better clipboard
|
||||
nnoremap <Leader>d "_d
|
||||
nnoremap <Leader>c "_dc
|
||||
nnoremap <Leader>p "_dP
|
||||
nnoremap <Leader>y "+y
|
||||
|
||||
xnoremap <Leader>d "_d
|
||||
xnoremap <Leader>c "_dc
|
||||
xnoremap <Leader>p "_dP
|
||||
xnoremap <Leader>y "+y
|
||||
|
||||
vnoremap <Leader>d "_d
|
||||
vnoremap <Leader>c "_dc
|
||||
vnoremap <Leader>p "_dP
|
||||
vnoremap <Leader>y "+y
|
||||
|
||||
" Linewrap jk
|
||||
nnoremap j gj
|
||||
nnoremap k gk
|
||||
nnoremap <Down> g<Down>
|
||||
nnoremap <Up> g<Up>
|
||||
|
||||
nnoremap <Leader>pv :Explore<CR> " Project View
|
||||
nnoremap <Leader>nf :enew<CR> " New File
|
||||
nnoremap <Leader>so :so %<CR> " Source buffer
|
||||
cnoremap #capl \(.\{-}\) " helpers in regex
|
||||
cnoremap #capm \(.*\)
|
||||
|
||||
nnoremap <Leader>+x :!chmod +x %<CR> " Permission
|
||||
nnoremap <Leader>-x :!chmod -x %<CR>
|
||||
|
||||
nnoremap <Leader>w :setlocal invwrap<CR> " linewrap
|
||||
nnoremap Q <nop>
|
||||
|
||||
"""""""""""""""""""
|
||||
" Plugin mappings "
|
||||
"""""""""""""""""""
|
||||
|
||||
" Fugitive
|
||||
nmap <leader><space> :Git<CR>5<Down>
|
||||
autocmd FileType fugitive nmap <buffer> <leader><space> :q<CR>
|
||||
nmap <leader>gb :Git blame<CR>
|
||||
autocmd FileType fugitiveblame nmap <buffer> <leader>gb :q<CR>
|
||||
|
||||
" Undotree
|
||||
nmap <leader>u :UndotreeToggle<CR>:UndotreeFocus<CR>
|
||||
autocmd FileType undotree nmap <buffer> <leader>u :q<CR>
|
||||
|
||||
" Tabular
|
||||
nmap <leader>ta Tabularize /=<CR>
|
||||
nmap <leader>tc Tabularize /:<CR>
|
||||
nmap <leader>tC Tabularize trailing_c_comments<CR>
|
||||
|
||||
"""""""""""""""
|
||||
" Colorscheme "
|
||||
"""""""""""""""
|
||||
colorscheme paramount
|
||||
Loading…
Add table
Add a link
Reference in a new issue