diff --git a/Splitkeyboard/split.vil b/Splitkeyboard/split.vil new file mode 100644 index 0000000..1a006a5 --- /dev/null +++ b/Splitkeyboard/split.vil @@ -0,0 +1 @@ +{"version": 1, "uid": 5010774632021243529, "layout": [[["KC_TAB", "KC_Q", "KC_W", "KC_E", "KC_R", "KC_T", "KC_PGUP"], ["KC_CAPSLOCK", "KC_A", "KC_S", "KC_D", "KC_F", "KC_G", "KC_PGDOWN"], ["KC_NO", "KC_Z", "KC_X", "KC_C", "KC_V", "KC_B", -1], [-1, -1, -1, "M4", "MO(1)", "KC_SPACE", -1], ["KC_LBRACKET", "KC_P", "KC_O", "KC_I", "KC_U", "KC_Y", "KC_BSPACE"], ["KC_QUOTE", "KC_SCOLON", "KC_L", "KC_K", "KC_J", "KC_H", "M5"], ["KC_MINUS", "KC_SLASH", "KC_DOT", "KC_COMMA", "KC_M", "KC_N", -1], [-1, -1, -1, "KC_BSPACE", "MO(2)", "KC_ENTER", -1]], [["KC_TAB", "KC_1", "KC_2", "KC_3", "KC_4", "KC_5", "KC_LCTRL"], ["KC_CAPSLOCK", "KC_NO", "TD(0)", "KC_NO", "M0", "M8", "KC_LALT"], ["M3", "KC_NONUS_BSLASH", "KC_NO", "KC_NO", "M1", "M2", -1], [-1, -1, -1, "M4", "MO(1)", "KC_SPACE", -1], ["KC_BSPACE", "KC_0", "KC_9", "KC_8", "KC_7", "KC_6", "KC_RCTRL"], ["KC_NONUS_HASH", "KC_NO", "KC_RIGHT", "KC_UP", "KC_DOWN", "KC_LEFT", "M6"], ["LSFT(KC_RBRACKET)", "KC_MINUS", "KC_EQUAL", "KC_NO", "KC_NO", "KC_NO", -1], [-1, -1, -1, "KC_TRNS", "MO(2)", "KC_ENTER", -1]], [["KC_TAB", "LSFT(KC_1)", "LSFT(KC_2)", "LSFT(KC_3)", "LSFT(KC_4)", "LSFT(KC_5)", "KC_LCTRL"], ["KC_CAPSLOCK", "KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_LALT"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO", -1], [-1, -1, -1, "M4", "MO(1)", "KC_SPACE", -1], ["KC_BSPACE", "LSFT(KC_0)", "LSFT(KC_9)", "LSFT(KC_8)", "LSFT(KC_7)", "LSFT(KC_6)", "KC_RCTRL"], ["KC_GRAVE", "KC_BSLASH", "KC_RBRACKET", "KC_LBRACKET", "KC_EQUAL", "KC_MINUS", "M7"], ["LSFT(KC_GRAVE)", "LSFT(KC_BSLASH)", "LSFT(KC_RBRACKET)", "LSFT(KC_LBRACKET)", "LSFT(KC_EQUAL)", "LSFT(KC_MINUS)", -1], [-1, -1, -1, "KC_TRNS", "MO(2)", "KC_ENTER", -1]], [["RGB_HUI", "RGB_MOD", "KC_NO", "KC_NO", "KC_NO", "KC_NO", "QK_BOOT"], ["KC_CAPSLOCK", "RGB_TOG", "RGB_SAI", "RGB_VAI", "KC_NO", "KC_NO", "QK_REBOOT"], ["RGB_HUD", "RGB_RMOD", "RGB_SAD", "RGB_VAD", "KC_NO", "KC_NO", -1], [-1, -1, -1, "M4", "KC_TRNS", "KC_SPACE", -1], ["KC_NO", "KC_KP_ASTERISK", "KC_KP_SLASH", "KC_KP_9", "KC_KP_8", "KC_KP_7", "KC_NUMLOCK"], ["KC_NO", "KC_KP_PLUS", "KC_KP_MINUS", "KC_KP_6", "KC_KP_5", "KC_KP_4", "M4"], ["KC_NO", "KC_KP_EQUAL", "KC_KP_COMMA", "KC_KP_3", "KC_KP_2", "KC_KP_1", -1], [-1, -1, -1, "KC_KP_DOT", "KC_KP_0", "KC_ENTER", -1]], [["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], [-1, -1, -1, "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], [-1, -1, -1, "KC_TRNS", "KC_TRNS", "KC_TRNS", -1]], [["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], [-1, -1, -1, "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", -1], [-1, -1, -1, "KC_TRNS", "KC_TRNS", "KC_TRNS", -1]]], "encoder_layout": [[["RGB_MOD", "RGB_RMOD"], ["RGB_HUI", "RGB_HUD"], ["RGB_VAI", "RGB_VAD"], ["RGB_SAI", "RGB_SAD"]], [["RGB_MOD", "RGB_RMOD"], ["RGB_HUI", "RGB_HUD"], ["RGB_VAI", "RGB_VAD"], ["RGB_SAI", "RGB_SAD"]], [["RGB_MOD", "RGB_RMOD"], ["RGB_HUI", "RGB_HUD"], ["RGB_VAI", "RGB_VAD"], ["RGB_SAI", "RGB_SAD"]], [["RGB_MOD", "RGB_RMOD"], ["RGB_HUI", "RGB_HUD"], ["RGB_VAI", "RGB_VAD"], ["RGB_SAI", "RGB_SAD"]], [["KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS"]], [["KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS"], ["KC_TRNS", "KC_TRNS"]]], "layout_options": 0, "macro": [[["down", "KC_LGUI"], ["delay", 10], ["down", "KC_LCTRL"], ["tap", "KC_4"], ["up", "KC_LCTRL"], ["delay", 10], ["up", "KC_LGUI"]], [["down", "KC_LGUI"], ["delay", 10], ["down", "KC_LCTRL"], ["tap", "KC_5"], ["up", "KC_LCTRL"], ["delay", 10], ["up", "KC_LGUI"]], [["down", "KC_LGUI"], ["delay", 10], ["down", "KC_LCTRL"], ["tap", "KC_6"], ["up", "KC_LCTRL"], ["delay", 10], ["up", "KC_LGUI"]], [["down", "KC_LGUI"], ["delay", 10], ["down", "KC_LCTRL"], ["tap", "KC_8"], ["up", "KC_LCTRL"], ["delay", 10], ["up", "KC_LGUI"]], [["down", "KC_LGUI"], ["delay", 10], ["down", "KC_LCTRL"], ["tap", "KC_0"], ["up", "KC_LCTRL"], ["delay", 10], ["up", "KC_LGUI"], ["delay", 20], ["tap", "DF(0)"]], [["down", "KC_LGUI"], ["delay", 10], ["down", "KC_LCTRL"], ["tap", "KC_1"], ["up", "KC_LCTRL"], ["delay", 10], ["up", "KC_LGUI"], ["delay", 10], ["tap", "DF(1)"]], [["down", "KC_LGUI"], ["delay", 10], ["down", "KC_LCTRL"], ["tap", "KC_2"], ["up", "KC_LCTRL"], ["delay", 10], ["up", "KC_LGUI"], ["delay", 20], ["tap", "DF(2)"]], [["down", "KC_LGUI"], ["delay", 10], ["down", "KC_LCTRL"], ["tap", "KC_3"], ["up", "KC_LCTRL"], ["delay", 10], ["up", "KC_LGUI"], ["delay", 20], ["tap", "DF(3)"]], [["down", "KC_LGUI"], ["delay", 10], ["down", "KC_LCTRL"], ["tap", "KC_7"], ["up", "KC_LCTRL"], ["delay", 10], ["up", "KC_LGUI"]], [], [], [], [], [], [], []], "vial_protocol": 6, "via_protocol": 9, "tap_dance": [["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", 200]], "combo": [["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"], ["KC_NO", "KC_NO", "KC_NO", "KC_NO", "KC_NO"]], "key_override": [{"trigger": "KC_NO", "replacement": "LSFT(KC_NO)", "layers": 65535, "trigger_mods": 64, "negative_mod_mask": 240, "suppressed_mods": 0, "options": 135}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}, {"trigger": "KC_NO", "replacement": "KC_NO", "layers": 65535, "trigger_mods": 0, "negative_mod_mask": 0, "suppressed_mods": 0, "options": 7}], "alt_repeat_key": [], "settings": {"1": 0, "2": 50, "3": 0, "4": 175, "5": 5, "6": 5000, "7": 200, "8": 0, "9": 10, "10": 20, "11": 8, "12": 10, "13": 30, "14": 10, "15": 80, "16": 8, "17": 40, "18": 0, "19": 80, "20": 7, "21": 0}} \ No newline at end of file diff --git a/backgrounds/.config/backgrounds/unviverse/blue_universe.jpg b/backgrounds/.config/backgrounds/unviverse/blue_universe.jpg new file mode 100644 index 0000000..4c675f8 Binary files /dev/null and b/backgrounds/.config/backgrounds/unviverse/blue_universe.jpg differ diff --git a/backgrounds/.config/backgrounds/unviverse/magenta.jpg b/backgrounds/.config/backgrounds/unviverse/magenta.jpg new file mode 100644 index 0000000..7e76e64 Binary files /dev/null and b/backgrounds/.config/backgrounds/unviverse/magenta.jpg differ diff --git a/backgrounds/.config/backgrounds/unviverse/universe.jpg b/backgrounds/.config/backgrounds/unviverse/universe.jpg new file mode 100644 index 0000000..ecaca0a Binary files /dev/null and b/backgrounds/.config/backgrounds/unviverse/universe.jpg differ diff --git a/ghostty/.config/ghostty/config b/ghostty/.config/ghostty/config new file mode 100644 index 0000000..4f38d13 --- /dev/null +++ b/ghostty/.config/ghostty/config @@ -0,0 +1,86 @@ +theme = catppuccin-mocha +# font-size = 12 +# background-blur-radius = 20 +# mouse-hide-while-typing = true +# window-decoration = true +# keybind = global:cmd+/=toggle_quick_terminal +# macos-option-as-alt = true +# background-opacity = 0.7 +# background-blur-radius = 20 + +# By default Reload config with shft + cmd + , + +# config-file = themes/rosepine +# background = #000000 +# background-opacity = 0.85 +# background-blur-radius = 20 + +# font-family = JetBrainsMonoNL Nerd Font +# font-size = 12 +cursor-style = block +cursor-style-blink = false +cursor-invert-fg-bg = true + +# macos-titlebar-style = hidden +macos-option-as-alt = true +# mouse-hide-while-typing = true + +#confirm-close-surface = false +#window-decoration = true +window-padding-x = 10 +window-padding-y = 10 +window-padding-balance = true + +auto-update = check +auto-update-channel = stable + +# extras +# shell-integration-features = no-cursor +copy-on-select = clipboard + +# Custom Keybinds & Config (super represents cmd key on mac) +# For Simple Keybinds +# keybind = super+r=reload_config +keybind = super+i=inspector:toggle +keybind = super+b>,=toggle_quick_terminal + +# Similar Tmux but with Ghostty +# (ctrl b for tmux -> cmb b for ghostty) +keybind = super+b>r=reload_config +keybind = super+b>x=close_surface +# this only works if you have `macos-titlebar-style = tabs or native or transparent` +# else it behaves like new window +keybind = super+b>c=new_tab +keybind = super+b>n=new_window + +# tab nav +#keybind = super+b>1=goto_tab:1 +#keybind = super+b>2=goto_tab:2 +#keybind = super+b>3=goto_tab:3 +#keybind = super+b>4=goto_tab:4 +#keybind = super+b>5=goto_tab:5 +#keybind = super+b>6=goto_tab:6 +#keybind = super+b>7=goto_tab:7 +#keybind = super+b>8=goto_tab:8 +#keybind = super+b>9=goto_tab:9 + +# splitting +#keybind = super+a>\=new_split:right +#keybind = super+a>-=new_split:down +#keybind = super+a>e=equalize_splits + +# split nav (setting this to control will not work if tmux already uses it) +#keybind = super+a>h=goto_split:left +#keybind = super+a>j=goto_split:bottom +#keybind = super+a>k=goto_split:top +#keybind = super+a>l=goto_split:right + +# typecraft +theme = catppuccin-mocha +# theme = GruvboxDark +font-family = CaskaydiaCove Nerd Font +font-size = 12 +background-opacity = 0.95 +gtk-titlebar = false +# custom-shader = /home/chris/bloom.glsl +#custom-shader = /home/chris/crt.glsl diff --git a/hypridle/.config/hypr/hypridle.conf b/hypridle/.config/hypr/hypridle.conf new file mode 100644 index 0000000..c52b3aa --- /dev/null +++ b/hypridle/.config/hypr/hypridle.conf @@ -0,0 +1,24 @@ +general { + lock_cmd = pidof hyprlock || hyprlock + before_sleep_cmd = loginctl lock-session + after_sleep_cmd = hyprctl dispatch dpms on +} + +# locks screen after 5min +listener { + timeout = 300 + on-timeout = loginctl lock-session +} + +# turn of screen after 10min +listener { + timeout = 600 + on-timeout = hyptrctl dispatch dpms off + on-resume = hyprctl dispatch dpms on +} + +# turns of pc after 60min of non use +listener { + timeout = 3600 + on-timeout = systemctl suspend +} diff --git a/hyprland/.config/hypr/hyprland.conf b/hyprland/.config/hypr/hyprland.conf new file mode 100644 index 0000000..13cdafb --- /dev/null +++ b/hyprland/.config/hypr/hyprland.conf @@ -0,0 +1,348 @@ + +# ####################################################################################### +# AUTOGENERATED HYPRLAND CONFIG. +# PLEASE USE THE CONFIG PROVIDED IN THE GIT REPO /examples/hyprland.conf AND EDIT IT, +# OR EDIT THIS ONE ACCORDING TO THE WIKI INSTRUCTIONS. +# ####################################################################################### + +# autogenerated = 1 # remove this line to remove the warning + +# This is an example Hyprland config file. +# Refer to the wiki for more information. +# https://wiki.hyprland.org/Configuring/ + +# Please note not all available settings / options are set here. +# For a full list, see the wiki + +# You can split this configuration into multiple files +# Create your files separately and then link them to this file like this: +# source = ~/.config/hypr/myColors.conf + +# Wallpaper +env = WALLPAPER, ~/.config/backgrounds/unviverse/magenta.jpg + +################ +### MONITORS ### +################ + +# See https://wiki.hyprland.org/Configuring/Monitors/ +monitor=,preferred,auto,1.5 + + +################### +### MY PROGRAMS ### +################### + +# See https://wiki.hyprland.org/Configuring/Keywords/ + +# Set programs that you use +$terminal = kitty +$fileManager = dolphin +$menu = wofi --show drun +$browser = librewolf +$mail = betterbird + +################# +### AUTOSTART ### +################# + +# Autostart necessary processes (like notifications daemons, status bars, etc.) +# Or execute your favorite apps at launch like this: + +# exec-once = $terminal +# exec-once = nm-applet & +# exec-once = waybar & hyprpaper & firefox +exec-once = waybar & hyprpaper & hypridle +#exec-once = /usr/lib/polkit-kde-authentication-agent-1 +exec-once = protonmail-bridge --no-window +exec-once = dbus-update-activation-environment --all +exec-once = gnome-keyring-daemon --start --components=secrets +exec-once = swaync +# add banana +#exec-once = hyprctl setcursor "Banana-Catppuccin-Mocha" 48 +#exec = gsettings set org.gnome.desktop.interface cursor-the "Banana-Catppuccin-Mocha" +#exec = gsettings set org.gnome.desktop.interface cursor-size 48 + +############################ +### ENVIRONMENT VARIABLES ### +############################# + +# See https://wiki.hyprland.org/Configuring/Environment-variables/ + +env = XCURSOR_SIZE,24 +env = HYPRCURSOR_SIZE,24 + + +##################### +### LOOK AND FEEL ### +##################### + +# Refer to https://wiki.hyprland.org/Configuring/Variables/ + +# https://wiki.hyprland.org/Configuring/Variables/#general +general { + gaps_in = 2 + gaps_out = 2 + + border_size = 1 + + # https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors + col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg + col.inactive_border = rgba(595959aa) + + # Set to true enable resizing windows by clicking and dragging on borders and gaps + resize_on_border = false + + # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on + allow_tearing = false + + layout = dwindle +} + +# https://wiki.hyprland.org/Configuring/Variables/#decoration +decoration { + rounding = 3 + + # Change transparency of focused and unfocused windows + active_opacity = 1.0 + inactive_opacity = 1.0 + + shadow { + enabled = true + range = 4 + render_power = 3 + color = rgba(1a1a1aee) + } + + # https://wiki.hyprland.org/Configuring/Variables/#blur + blur { + enabled = true + size = 3 + passes = 1 + + vibrancy = 0.1696 + } +} + +# https://wiki.hyprland.org/Configuring/Variables/#animations +animations { + enabled = yes, please :) + + # Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + + bezier = easeOutQuint,0.23,1,0.32,1 + bezier = easeInOutCubic,0.65,0.05,0.36,1 + bezier = linear,0,0,1,1 + bezier = almostLinear,0.5,0.5,0.75,1.0 + bezier = quick,0.15,0,0.1,1 + + animation = global, 1, 10, default + animation = border, 1, 5.39, easeOutQuint + animation = windows, 1, 4.79, easeOutQuint + animation = windowsIn, 1, 4.1, easeOutQuint, popin 87% + animation = windowsOut, 1, 1.49, linear, popin 87% + animation = fadeIn, 1, 1.73, almostLinear + animation = fadeOut, 1, 1.46, almostLinear + animation = fade, 1, 3.03, quick + animation = layers, 1, 3.81, easeOutQuint + animation = layersIn, 1, 4, easeOutQuint, fade + animation = layersOut, 1, 1.5, linear, fade + animation = fadeLayersIn, 1, 1.79, almostLinear + animation = fadeLayersOut, 1, 1.39, almostLinear + animation = workspaces, 1, 1.94, almostLinear, fade + animation = workspacesIn, 1, 1.21, almostLinear, fade + animation = workspacesOut, 1, 1.94, almostLinear, fade +} + +# Ref https://wiki.hyprland.org/Configuring/Workspace-Rules/ +# "Smart gaps" / "No gaps when only" +# uncomment all if you wish to use that. +# workspace = w[tv1], gapsout:0, gapsin:0 +# workspace = f[1], gapsout:0, gapsin:0 +# windowrulev2 = bordersize 0, floating:0, onworkspace:w[tv1] +# windowrulev2 = rounding 0, floating:0, onworkspace:w[tv1] +# windowrulev2 = bordersize 0, floating:0, onworkspace:f[1] +# windowrulev2 = rounding 0, floating:0, onworkspace:f[1] + +# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more +dwindle { + pseudotile = true # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = true # You probably want this +} + +# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more +master { + new_status = master +} + +# https://wiki.hyprland.org/Configuring/Variables/#misc +#misc { +# force_default_wallpaper = -1 # Set to 0 or 1 to disable the anime mascot wallpapers +# disable_hyprland_logo = false # If true disables the random hyprland logo / anime girl background. :( +#} + + +############# +### INPUT ### +############# + +# https://wiki.hyprland.org/Configuring/Variables/#input +input { + kb_layout = ch + kb_variant = de_mac + kb_model = apple + kb_options = + kb_rules = + + follow_mouse = 1 + + sensitivity = 0 # -1.0 - 1.0, 0 means no modification. + + touchpad { + natural_scroll = false + } +} + +# https://wiki.hyprland.org/Configuring/Variables/#gestures +#gestures { +# workspace_swipe = false +#} + +# Example per-device config +# See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more +device { + name = epic-mouse-v1 + sensitivity = -0.5 +} + + +################### +### KEYBINDINGS ### +################### + +# See https://wiki.hyprland.org/Configuring/Keywords/ +$mainMod = SUPER # Sets "Windows" key as main modifier + +# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more +bind = $mainMod, return, exec, $terminal +bind = $SUPER_SHIFT, c, killactive, +bind = $mainMod, !, exit, +bind = $mainMod, E, exec, $fileManager +bind = $mainMod, V, togglefloating, +bind = $mainMod, space, exec, $menu +bind = $mainMod, P, exec, [workspace 5 silent] bitwarden-desktop +bind = $mainMod, J, togglesplit, # dwindle +bind = $mainMod, M, exec, [workspace 3 silent] $mail +bind = $mainMod, I, exec, [workspace 4 silent] claude-desktop +bind = $mainMod, T, exec, [workspace 5 silent] tidal-hifi +bind = $mainMod, Z, exec, [workspace 2 silent] $browser +bind = $mainMod, O, exec, [workspace 6 silent] onlyoffice-desktopeditors +bind = $mainMod, B, exec, [workspace 5 silent] obsidian + +# Layer Indicator +bind = SUPER CTRL, 0, exec, ~/scripts/layer_notify.sh 0 +bind = SUPER CTRL, 1, exec, ~/scripts/layer_notify.sh 1 +bind = SUPER CTRL, 2, exec, ~/scripts/layer_notify.sh 2 +bind = SUPER CTRL, 3, exec, ~/scripts/layer_notify.sh 3 + +# Brightness controls +bind = SUPER CTRL, 4, exec, ~/scripts/br_up.sh +bind = SUPER CTRL, 5, exec, ~/scripts/br_down.sh + +# Blue light filter toggle +bind = SUPER CTRL, 6, exec, ~/scripts/br_blue.sh + +# Filter Reset +bind = SUPER CTRL, 7, exec, ~/scripts/br_reset.sh + +# Toggle Swaync Control center +bind = SUPER CTRL, 8, exec, swaync-client -t + +# hyprlock +bind = $SUPER_SHIFT, l, exec, hyprlock + +# hyprshot +bind = $mainMod ALT, 5, exec, hyprshot -m window +bind = $mainMod ALT, 4, exec, hyprshot -m region + +# Move focus with mainMod + arrow keys +bind = $mainMod, h, movefocus, l +bind = $mainMod, j, movefocus, d +bind = $mainMod, k, movefocus, u +bind = $mainMod, l, movefocus, r + +# Switch workspaces with mainMod + [0-9] +bind = $mainMod, 1, workspace, 1 +bind = $mainMod, 2, workspace, 2 +bind = $mainMod, 3, workspace, 3 +bind = $mainMod, 4, workspace, 4 +bind = $mainMod, 5, workspace, 5 +bind = $mainMod, 6, workspace, 6 +bind = $mainMod, 7, workspace, 7 +bind = $mainMod, 8, workspace, 8 +bind = $mainMod, 9, workspace, 9 +bind = $mainMod, 0, workspace, 10 + +# Move active window to a workspace with mainMod + SHIFT + [0-9] +bind = $mainMod SHIFT, 1, movetoworkspace, 1 +bind = $mainMod SHIFT, 2, movetoworkspace, 2 +bind = $mainMod SHIFT, 3, movetoworkspace, 3 +bind = $mainMod SHIFT, 4, movetoworkspace, 4 +bind = $mainMod SHIFT, 5, movetoworkspace, 5 +bind = $mainMod SHIFT, 6, movetoworkspace, 6 +bind = $mainMod SHIFT, 7, movetoworkspace, 7 +bind = $mainMod SHIFT, 8, movetoworkspace, 8 +bind = $mainMod SHIFT, 9, movetoworkspace, 9 +bind = $mainMod SHIFT, 0, movetoworkspace, 10 + +# Example special workspace (scratchpad) +bind = $mainMod, S, togglespecialworkspace, magic +bind = $mainMod SHIFT, S, movetoworkspace, special:magic + +# Scroll through existing workspaces with mainMod + scroll +bind = $mainMod, mouse_down, workspace, e+1 +bind = $mainMod, mouse_up, workspace, e-1 + +# Move/resize windows with mainMod + LMB/RMB and dragging +bindm = $mainMod, mouse:272, movewindow +bindm = $mainMod, mouse:273, resizewindow + +# Laptop multimedia keys for volume and LCD brightness +bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ +bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- +bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle +bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle +bindel = ,XF86MonBrightnessUp, exec, brightnessctl s 10%+ +bindel = ,XF86MonBrightnessDown, exec, brightnessctl s 10%- + +# Requires playerctl +bindl = , XF86AudioNext, exec, playerctl next +bindl = , XF86AudioPause, exec, playerctl play-pause +bindl = , XF86AudioPlay, exec, playerctl play-pause +bindl = , XF86AudioPrev, exec, playerctl previous + +# brightness adjustment +#bind = , code:232, exec, ~/.scripts/brightness.sh dec +#bind = , code:233, exec, ~/.scripts/brightness.sh inc + +############################## +### WINDOWS AND WORKSPACES ### +############################## + +# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more +# See https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules + +# Example windowrule v1 +# windowrule = float, ^(kitty)$ + +# Example windowrule v2 +# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ + +# Ignore maximize requests from apps. You'll probably like this. +windowrulev2 = suppressevent maximize, class:.* + +# Fix some dragging issues with XWayland +#windowrulev2 = nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0 +#decoration { +# screen_shader = ~/.config/hypr/shaders/bluelight.frag +#} diff --git a/hyprlock/.config/hypr/hyprlock.conf b/hyprlock/.config/hypr/hyprlock.conf new file mode 100644 index 0000000..3215643 --- /dev/null +++ b/hyprlock/.config/hypr/hyprlock.conf @@ -0,0 +1,79 @@ +source = $HOME/.config/hypr/mocha.conf + +$accent = $mauve +$accentAlpha = $mauveAlpha +$font = JetBrainsMono Nerd Font + +# GENERAL +general { + disable_loading_bar = true + hide_cursor = true +} + +# BACKGROUND +background { + monitor = + path = $WALLPAPER + blur_passes = 2 + color = $base +} + +# TIME +label { + monitor = + text = cmd[update:30000] echo "$(date +"%R")" + color = $text + font_size = 90 + font_family = $font + position = -30, 0 + halign = right + valign = top +} + +# DATE +label { + monitor = + text = cmd[update:43200000] echo "$(date +"%A, %d %B %Y")" + color = $text + font_size = 25 + font_family = $font + position = -30, -150 + halign = right + valign = top +} + +# USER AVATAR + +image { + monitor = + path = ~/.face + size = 100 + border_color = $accent + + position = 0, 75 + halign = center + valign = center +} + +# INPUT FIELD +input-field { + monitor = + size = 300, 60 + outline_thickness = 4 + dots_size = 0.2 + dots_spacing = 0.2 + dots_center = true + outer_color = $accent + inner_color = $surface0 + font_color = $text + fade_on_empty = false + placeholder_text = 󰌾 Logged in as $USER + hide_input = false + check_color = $accent + fail_color = $red + fail_text = $FAIL ($ATTEMPTS) + capslock_color = $yellow + position = 0, -35 + halign = center + valign = center +} diff --git a/hyprmocha/.config/hypr/mocha.conf b/hyprmocha/.config/hypr/mocha.conf new file mode 100644 index 0000000..8ccb56a --- /dev/null +++ b/hyprmocha/.config/hypr/mocha.conf @@ -0,0 +1,78 @@ + +$rosewater = rgb(f5e0dc) +$rosewaterAlpha = f5e0dc + +$flamingo = rgb(f2cdcd) +$flamingoAlpha = f2cdcd + +$pink = rgb(f5c2e7) +$pinkAlpha = f5c2e7 + +$mauve = rgb(cba6f7) +$mauveAlpha = cba6f7 + +$red = rgb(f38ba8) +$redAlpha = f38ba8 + +$maroon = rgb(eba0ac) +$maroonAlpha = eba0ac + +$peach = rgb(fab387) +$peachAlpha = fab387 + +$yellow = rgb(f9e2af) +$yellowAlpha = f9e2af + +$green = rgb(a6e3a1) +$greenAlpha = a6e3a1 + +$teal = rgb(94e2d5) +$tealAlpha = 94e2d5 + +$sky = rgb(89dceb) +$skyAlpha = 89dceb + +$sapphire = rgb(74c7ec) +$sapphireAlpha = 74c7ec + +$blue = rgb(89b4fa) +$blueAlpha = 89b4fa + +$lavender = rgb(b4befe) +$lavenderAlpha = b4befe + +$text = rgb(cdd6f4) +$textAlpha = cdd6f4 + +$subtext1 = rgb(bac2de) +$subtext1Alpha = bac2de + +$subtext0 = rgb(a6adc8) +$subtext0Alpha = a6adc8 + +$overlay2 = rgb(9399b2) +$overlay2Alpha = 9399b2 + +$overlay1 = rgb(7f849c) +$overlay1Alpha = 7f849c + +$overlay0 = rgb(6c7086) +$overlay0Alpha = 6c7086 + +$surface2 = rgb(585b70) +$surface2Alpha = 585b70 + +$surface1 = rgb(45475a) +$surface1Alpha = 45475a + +$surface0 = rgb(313244) +$surface0Alpha = 313244 + +$base = rgb(1e1e2e) +$baseAlpha = 1e1e2e + +$mantle = rgb(181825) +$mantleAlpha = 181825 + +$crust = rgb(11111b) +$crustAlpha = 11111b diff --git a/hyprpaper/.config/hypr/hyprpaper.conf b/hyprpaper/.config/hypr/hyprpaper.conf new file mode 100644 index 0000000..46e9853 --- /dev/null +++ b/hyprpaper/.config/hypr/hyprpaper.conf @@ -0,0 +1,2 @@ +preload = $WALLPAPER +wallpaper = , $WALLPAPER diff --git a/kanata/.config/kanata/config.kbd b/kanata/.config/kanata/config.kbd new file mode 100644 index 0000000..a6850ff --- /dev/null +++ b/kanata/.config/kanata/config.kbd @@ -0,0 +1,28 @@ +;; defsrc is still necessary +(defcfg + process-unmapped-keys yes +) + +(defsrc + caps a s d f j k l ; +) +(defvar + tap-time 250 + hold-time 250 +) + +(defalias + escctrl (tap-hold 250 250 esc lctrl) + a (multi f24 (tap-hold $tap-time $hold-time a lmet)) + s (multi f24 (tap-hold $tap-time $hold-time s lalt)) + d (multi f24 (tap-hold $tap-time $hold-time d lsft)) + f (multi f24 (tap-hold $tap-time $hold-time f lctl)) + j (multi f24 (tap-hold $tap-time $hold-time j rctl)) + k (multi f24 (tap-hold $tap-time $hold-time k rsft)) + l (multi f24 (tap-hold $tap-time $hold-time l ralt)) + ; (multi f24 (tap-hold $tap-time $hold-time ; rmet)) +) + +(deflayer base + @escctrl @a @s @d @f @j @k @l @; +) diff --git a/kanata/.config/systemd/user/kanata.service b/kanata/.config/systemd/user/kanata.service new file mode 100644 index 0000000..5d62194 --- /dev/null +++ b/kanata/.config/systemd/user/kanata.service @@ -0,0 +1,22 @@ +[Unit] +Description=Kanata keyboard remapper +Documentation=https://github.com/jtroo/kanata + +[Service] +Environment=PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:${HOME}/.local/bin +Environment=DISPLAY=:0 +# Uncomment the 4 lines beneath this to increase process priority +# of Kanata in case you encounter lagginess when resource constrained. +# WARNING: doing so will require the service to run as an elevated user such as root. +# Implementing least privilege access is an exercise left to the reader. +# +CPUSchedulingPolicy=rr +CPUSchedulingPriority=99 +IOSchedulingClass=realtime +Nice=-20 +Type=simple +ExecStart=/usr/bin/sh -c "exec $$(which kanata) --cfg $$HOME/.config/kanata/config.kbd" +Restart=no + +[Install] +WantedBy=default.target diff --git a/kitty/.config/kitty/current-theme.conf b/kitty/.config/kitty/current-theme.conf new file mode 100644 index 0000000..77800ed --- /dev/null +++ b/kitty/.config/kitty/current-theme.conf @@ -0,0 +1,80 @@ +# vim:ft=kitty + +## name: Catppuccin-Mocha +## author: Pocco81 (https://github.com/Pocco81) +## license: MIT +## upstream: https://github.com/catppuccin/kitty/blob/main/mocha.conf +## blurb: Soothing pastel theme for the high-spirited! + +window_padding_width 5 10 + +# The basic colors +foreground #CDD6F4 +background #1E1E2E +selection_foreground #1E1E2E +selection_background #F5E0DC + +# Cursor colors +cursor #F5E0DC +cursor_text_color #1E1E2E + +# URL underline color when hovering with mouse +url_color #F5E0DC + +# Kitty window border colors +active_border_color #B4BEFE +inactive_border_color #6C7086 +bell_border_color #F9E2AF + +# OS Window titlebar colors +wayland_titlebar_color system +macos_titlebar_color system + +# Tab bar colors +active_tab_foreground #11111B +active_tab_background #CBA6F7 +inactive_tab_foreground #CDD6F4 +inactive_tab_background #181825 +tab_bar_background #11111B + +# Colors for marks (marked text in the terminal) +mark1_foreground #1E1E2E +mark1_background #B4BEFE +mark2_foreground #1E1E2E +mark2_background #CBA6F7 +mark3_foreground #1E1E2E +mark3_background #74C7EC + +# The 16 terminal colors + +# black +color0 #45475A +color8 #585B70 + +# red +color1 #F38BA8 +color9 #F38BA8 + +# green +color2 #A6E3A1 +color10 #A6E3A1 + +# yellow +color3 #F9E2AF +color11 #F9E2AF + +# blue +color4 #89B4FA +color12 #89B4FA + +# magenta +color5 #F5C2E7 +color13 #F5C2E7 + +# cyan +color6 #94E2D5 +color14 #94E2D5 + +# white +color7 #BAC2DE +color15 #A6ADC8 diff --git a/kitty/.config/kitty/kitty.conf b/kitty/.config/kitty/kitty.conf new file mode 100644 index 0000000..217979e --- /dev/null +++ b/kitty/.config/kitty/kitty.conf @@ -0,0 +1,14 @@ +# BEGIN_KITTY_THEME +# Catppuccin-Mocha +include current-theme.conf +# END_KITTY_THEME +# + +font_family Inconsolata Nerd Font +bold_font auto +italic_font auto +bold_italic_font auto + +font_size 14 + +background_opacity 0.9 diff --git a/nushell/.config/nushell/config.nu b/nushell/.config/nushell/config.nu new file mode 100644 index 0000000..a83dac7 --- /dev/null +++ b/nushell/.config/nushell/config.nu @@ -0,0 +1,186 @@ +# config.nu +# +# Installed by: +# version = "0.103.0" +# +# This file is used to override default Nushell settings, define +# (or import) custom commands, or run any other startup tasks. +# See https://www.nushell.sh/book/configuration.html +# +# This file is loaded after env.nu and before login.nu +# +# You can open this file in your default editor using: +# config nu +# +# See `help config nu` for more options +# +# You can remove these comments if you want or leave +# them for future reference. + +# https://github.com/nushell/nu_scripts/tree/main/themes +let dark_theme = { + # color for nushell primitives + separator: white + leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off + header: green_bold + empty: blue + # Closures can be used to choose colors for specific values. + # The value (in this case, a bool) is piped into the closure. + # eg) {|| if $in { 'light_cyan' } else { 'light_gray' } } + bool: light_cyan + int: white + filesize: cyan + duration: white + date: purple + range: white + float: white + string: white + nothing: white + binary: white + cell-path: white + row_index: green_bold + record: white + list: white + block: white + hints: dark_gray + search_result: { bg: red fg: white } + shape_and: purple_bold + shape_binary: purple_bold + shape_block: blue_bold + shape_bool: light_cyan + shape_closure: green_bold + shape_custom: green + shape_datetime: cyan_bold + shape_directory: cyan + shape_external: cyan + shape_externalarg: green_bold + shape_external_resolved: light_yellow_bold + shape_filepath: cyan + shape_flag: blue_bold + shape_float: purple_bold + # shapes are used to change the cli syntax highlighting + shape_garbage: { fg: white bg: red attr: b} + shape_glob_interpolation: cyan_bold + shape_globpattern: cyan_bold + shape_int: purple_bold + shape_internalcall: cyan_bold + shape_keyword: cyan_bold + shape_list: cyan_bold + shape_literal: blue + shape_match_pattern: green + shape_matching_brackets: { attr: u } + shape_nothing: light_cyan + shape_operator: yellow + shape_or: purple_bold + shape_pipe: purple_bold + shape_range: yellow_bold + shape_record: cyan_bold + shape_redirection: purple_bold + shape_signature: green_bold + shape_string: green + shape_string_interpolation: cyan_bold + shape_table: blue_bold + shape_variable: purple + shape_vardecl: purple + shape_raw_string: light_purple +} + +let light_theme = { + # color for nushell primitives + separator: dark_gray + leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off + header: green_bold + empty: blue + # Closures can be used to choose colors for specific values. + # The value (in this case, a bool) is piped into the closure. + # eg) {|| if $in { 'dark_cyan' } else { 'dark_gray' } } + bool: dark_cyan + int: dark_gray + filesize: cyan_bold + duration: dark_gray + date: purple + range: dark_gray + float: dark_gray + string: dark_gray + nothing: dark_gray + binary: dark_gray + cell-path: dark_gray + row_index: green_bold + record: dark_gray + list: dark_gray + block: dark_gray + hints: dark_gray + search_result: { fg: white bg: red } + shape_and: purple_bold + shape_binary: purple_bold + shape_block: blue_bold + shape_bool: light_cyan + shape_closure: green_bold + shape_custom: green + shape_datetime: cyan_bold + shape_directory: cyan + shape_external: cyan + shape_externalarg: green_bold + shape_external_resolved: light_purple_bold + shape_filepath: cyan + shape_flag: blue_bold + shape_float: purple_bold + # shapes are used to change the cli syntax highlighting + shape_garbage: { fg: white bg: red attr: b} + shape_globpattern: cyan_bold + shape_int: purple_bold + shape_internalcall: cyan_bold + shape_keyword: cyan_bold + shape_list: cyan_bold + shape_literal: blue + shape_match_pattern: green + shape_matching_brackets: { attr: u } + shape_nothing: light_cyan + shape_operator: yellow + shape_or: purple_bold + shape_pipe: purple_bold + shape_range: yellow_bold + shape_record: cyan_bold + shape_redirection: purple_bold + shape_signature: green_bold + shape_string: green + shape_string_interpolation: cyan_bold + shape_table: blue_bold + shape_variable: purple + shape_vardecl: purple + shape_raw_string: light_purple +} + +# Example prompt with Nerd Font icons +def create_left_prompt [] { + let dir = ([ + (char -u "e0b1"), + ($env.PWD | str replace $nu.home-path "~") + ] | str join) + + let git_branch = (do -i { git rev-parse --abbrev-ref HEAD } | default "") + + $"(ansi green)($dir)(ansi reset) (ansi purple) ($git_branch)(ansi reset)" +} + +$env.PROMPT_COMMAND = { create_left_prompt } + +$env.GIT_DISCOVERY_ACROSS_FILESYSTEM = "1" # Allows Git to check parent dirs + +def --wrapped git [...args] { + ^git ...$args err> /dev/null +} + +## Alias +source ~/.alias.nu + +### autocompletion +## zoxide +#$env.ZOXIDE_HOOK = true + +#$env.config.completions.quick = true # Show completions immediately +#$env.config.completions.partial = true # Complete on partial matches +#$env.config.completions.case_sensitive = false + +#~/.config/nushell/config.nu +source ~/.cache/carapace/init.nu diff --git a/nushell/.config/nushell/env.nu b/nushell/.config/nushell/env.nu new file mode 100644 index 0000000..39b3915 --- /dev/null +++ b/nushell/.config/nushell/env.nu @@ -0,0 +1,29 @@ +# env.nu +# +# Installed by: +# version = "0.103.0" +# +# Previously, environment variables were typically configured in `env.nu`. +# In general, most configuration can and should be performed in `config.nu` +# or one of the autoload directories. +# +# This file is generated for backwards compatibility for now. +# It is loaded before config.nu and login.nu +# +# See https://www.nushell.sh/book/configuration.html +# +# Also see `help config env` for more options. +# +# You can remove these comments if you want or leave +# them for future reference. + +$env.GIT_DISCOVERY_ACROSS_FILESYSTEM = "1" # Allows Git to check parent dire + +# Add after the last line +# https://carapace-sh.github.io/carapace-bin/setup.html#nushell + +$env.FZF_DEFAULT_OPTS = "--ansi --preview-window 'right:60%' --preview 'bat --color=always --style=header,grid --line-range :300 {}'" + +mkdir ~/.cache/carapace +carapace _carapace nushell | save --force ~/.cache/carapace/init.nu + diff --git a/nushell/.config/nushell/history.txt b/nushell/.config/nushell/history.txt new file mode 100644 index 0000000..538e3d2 --- /dev/null +++ b/nushell/.config/nushell/history.txt @@ -0,0 +1,363 @@ +y +yazi +y +yazi +exit +y +yazi +tn +y +yazi +lt +ltree +ls +cld +exit +ffcbmp +y +exit +nu +exit +nu +ls +ltree +ripp +ripp 'radiohead' +ffcbmp +ffcmp +y +ltree +y +cl +exit +nu +exit +nu +y +$env.config.buffer_editor = +$env.config.buffer_editor = +$env.config.buffer_editor = neovim +$env.config.buffer_editor = nvim +$env.config.buffer_editor = "neovim" +config nu --doc | nu-highlight | less -R +vpnr +nmst +nmwi +vpnr +ys starship +starship +starship config +mkdir -p ~/.config/starship && touch ~/.config/starship/starship.toml +mkdir -p ~/.config/starship ; touch ~/.config/starship/starship.toml +mkdir ~/.config/starship ; touch ~/.config/starship/starship.toml +y +which starhip +starship --version +y +exit +$nu.config-path +ys nushell-bin-0.96.0 +ys nushell-bin-0.96 +exit +cd dotfiles +y +cd dotfiles +exit +cd dotfiles +cd +exit +cd dotfiles +starship config +y +which starhip +where starhip.conf +where starhip.toml +starship config +q +cd +cd podman +cd arr_stack/config/lidarr/ +cd arr_stack/ +cd .. +cd essentials_stack/data/movies/ +cd +cd programming/ +cd +cd podman/ +cd dot +cd +cd dotfiles/ +cd nvim/.config/nvim/lua/plugins/catppuccin.lua +cd nvim/.config/nvim/lua/plugins +exit +y +cd dotfiles/ +cd programming/ +cd +cd programming/ +sudo pacman -S ttf-nerd-fonts-symbols +exit +cd programming/ +starship config +cd +ys ttf-firecode-nerd +ys ttf-firacode +y +cd programming/ +y +cd programming/ +y +exit +cd programming/ +config reset +exit +cd programming/ +starship preset nerd-font-symbols -o ~/.config/starship.toml +starship config +exit +cd programming/ +exit +cd programming/ +exi +exit +cd programming/ +y +exit +cd programming/ +starship config +cd +cd dotfiles/nvim/.config/nvim/lua/plugins/ +cd +cd podman +cd arr_stack/ +cd config/radarr/ +cd config/ +cd config +cd .. +cd +cd dotfiles/ +cd ~/.config/lazygit/ +cd +cd Downloads/lebara.pdf +starship config +exit +cd dotfiles/ +exit +cd dotfiles/ +exit +cd dotfiles/ +exit +cd dotfiles/ +cd +cd dotfiles/ +exit +test +cd dotfiles +cd Downloads/lebara.pdf +cd Downloads +cd +cd Downloads/ +cd +cd programming/ +y +cd dotfiles +cd +cd programming/ +ys carapace-bin +y +which carapace +cd scripts +fzf +ys carapace-bin +starship config +rebo +reboot +cd programming/ +cd +y +yazi +exit +nu +exit +cd +ys protonmail +y +let carapace_completer = {|spans|<\n> carapace $spans.0 nushell ...$spans | from json<\n>} +let fish_completer = {|spans|<\n> fish --command $'complete "--do-complete=($spans | str join " ")"'<\n> | from tsv --flexible --noheaders --no-infer<\n> | rename value description<\n> | update value {<\n> if ($in | path exists) {$'"($in | str replace "\"" "\\\"" )"'} else {$in}<\n> }<\n>} +fzf +exit +ls | get name | str join "\n" | fzf +$env.config.completions.algorithm = "Fuzzy" +cd StreamripDownloads/ +cd +# I found the code below here: https://discord.com/channels/601130461678272522/615253963645911060/1209827461496569876<\n>$env.config.keybindings ++= [<\n> {<\n> name: fzf_files<\n> modifier: control<\n> keycode: char_t<\n> mode: [emacs, vi_normal, vi_insert]<\n> event: [<\n> {<\n> send: executehostcommand<\n> cmd: "<\n> let fzf_ctrl_t_command = \"fd --type=file | fzf --preview 'bat --color=always --style=full --line-range=:500 {}'\";<\n> let result = nu -c $fzf_ctrl_t_command;<\n> commandline edit --append $result;<\n> commandline set-cursor --end<\n> "<\n> }<\n> ]<\n> }<\n>] +let $config_path = $env.XDG_CONFIG_HOME? | default '~/.config' | path join broot select.toml<\n>mkdir ($config_path | path dirname) <\n><\n>{<\n> verbs: [<\n> [invocation, key, leave_broot, execution, apply_to];<\n> [ok, enter, true, ":print_path", file ],<\n> [ok, alt-enter, true, ":print_path", any ]<\n> ]<\n>} | save -f $config_path +exit +ls | get name | str join "\n" | fzf +ls +exit +nu +cld +y +cld +cd pod +exit +ls | get name | str join "\n" | fzf +ls Downloads/ +exit +ls podman/ +ls podman/arr_stack/ +lt podman/essentials_stack/ +ls podman/essentials_stack/ +ls podman/essentials_stack/data/tv/ +ls `podman/essentials_stack/data/tv/The Last of Us/` +exit +ls podman/essentials_stack/ +exit +ls Downloads/ +source ~/.config/nushell/config.nu +nvim ~/.config/nushell/config.nu +source ~/.config/nushell/config.nu +cld +exit +eit +exit +exir +exit +cd programming/ +cld +cd +cd podman/ +cl +cd +cl +$env.GIT_DISCOVERY_ACROSS_FILESYSTEM = "1" # Allows Git to check parent dirs +$env.GIT_DISCOVERY_ACROSS_FILESYSTEM = "1" +cl +cd +nvim ~/.config/nushell/config.nu +source ~/.config/nushell/config.nu +nvim ~/.config/nushell/config.nu +source ~/.config/nushell/config.nu +exit +nvim ~/.config/nushell/config.nu +git init +exit +source ~/.config/nushell/config.nu +exit +source ~/.config/nushell/config.nu +exit +source ~/.config/nushell/config.nu +do -i { git status } | ignore +exit +git status 2> /dev/null +exit +nvim ~/.config/nushell/config.nu +source ~/.config/nushell/config.nu +exit +ls Downloads/ +cl +clear +exit +source ~/.config/nushell/config.nu +ls +clear +nvim ~/.config/nushell/config.nu +source ~/.config/nushell/config.nu +nvim ~/.config/nushell/config.nu +source ~/.config/nushell/config.nu +nvim ~/.config/nushell/config.nu +source ~/.config/nushell/config.nu +exit +source ~/.config/nushell/config.nu +exir +exit +source ~/.config/nushell/config.nu +exit +nvim ~/.config/nushell/config.nu +source ~/.config/nushell/config.nu +carapace _carapace nushell +nvim ~/.config/nushell/env.nu +nvim ~/.config/nushell/config.nu +source ~/.config/nushell/config.nu +exit +nvim ~/.config/nushell/env.nu +exit +carapace --run nu +--packages nushell carapace --run nu +bash --packages nushell carapace --run nu +exit +cd dotfiles +nvim ~/.config/nushell/env.nu +source ~/.config/nushell/config.nu +source ~/.config/nushell/env.nu +exit +carapace paru +carapace --init +carapace --help +carapace --run +carapace --run --help +carapace --run -h +carapace --run paru +carapace -h +carapace chmod nushell +carapace -h +carapace --run nushell +carapace nushell +carpace -h +carapace -h +carapace _carapace nushell +cd podman/monitoring_stack/data/influxdb +cd podman/monitoring_stack/data/influxdb/ +carapace --makros +carapace --macro +cd dotfiles/ +git status -- +cd +nvim ~/.config/nushell/env.nu +bat ~/.config/nushell/env.nu +nvim ~/.config/nushell/env.nu +nvim ~/.config/nushell/config.nu +source ~/.config/nushell/env.nu +source ~/.config/nushell/config.nu +exit +cld +exit +ls programming/ +ls programming/Algo/ +lt podman/essentials_stack/ +ls Downloads/ +exit +ls Downloads/ +nvim ~/.config/nushell/config.nu +source ~/.config/nushell/config.nu +ls Downloads/ +exit +ls Downloads/ +lt podman/essentials_stack/ +exit +cld +source ~/.config/nushell/config.nu +exit +test +cld +exit +ys +cld +duaa +dfh +duf +cld +exit +ls ~/.config/hypr/ +ls ~/.config/hypr/hypridle.conf +bat ~/.config/hypr/hypridle.conf +cat ~/.config/hypr/hypridle.conf +exit +fzf +source ~/.config/nushell/env.nu +fzf +cld +exit +bat ~/.ssh/id_ed25519.pub +exit diff --git a/nvim/.config/nvim/.luarc.json b/nvim/.config/nvim/.luarc.json new file mode 100644 index 0000000..aad784f --- /dev/null +++ b/nvim/.config/nvim/.luarc.json @@ -0,0 +1,11 @@ +{ + "diagnostics.globals": [ + "vim", + " false", + " " + ], + "runtime.unicodeName": true, + "diagnostics.disable": [ + "undefined-doc-name" + ] +} \ No newline at end of file diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua new file mode 100644 index 0000000..238356a --- /dev/null +++ b/nvim/.config/nvim/init.lua @@ -0,0 +1,41 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +-- Only enable spell checking for specific filetypes +vim.api.nvim_create_autocmd("FileType", { + pattern = { "markdown", "text", "gitcommit", "tex" }, + callback = function() + vim.opt_local.spell = true + vim.opt_local.spelllang = "en_us,de" + end, +}) +require("vim-options") +require("lazy").setup("plugins") +require("lualine").setup({ + sections = { + lualine_x = { + { + require("noice").api.statusline.mode.get, + cond = require("noice").api.statusline.mode.has, + color = { fg = "#ff9e64" }, + }, + }, + }, +}) +require("lazy").setup({ + { + "tzachar/cmp-tabnine", + build = "./install.sh", + dependencies = "hrsh7th/nvim-cmp", + }, +}) diff --git a/nvim/.config/nvim/init.lua.bak b/nvim/.config/nvim/init.lua.bak new file mode 100644 index 0000000..0b45ed4 --- /dev/null +++ b/nvim/.config/nvim/init.lua.bak @@ -0,0 +1,35 @@ +vim.cmd("set expandtab") +vim.cmd("set tabstop=2") +vim.cmd("set softtabstop=2") +vim.cmd("set shiftwidth=2") +vim.g.mapleader = " " + +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("vim-options") +require("lazy").setup("plugins") + + + diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..4cff3bb --- /dev/null +++ b/nvim/.config/nvim/lazy-lock.json @@ -0,0 +1,54 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "LuaSnip": { "branch": "master", "commit": "fb525166ccc30296fb3457441eb979113de46b00" }, + "alpha-nvim": { "branch": "main", "commit": "3979b01cb05734331c7873049001d3f2bb8477f4" }, + "barbecue": { "branch": "main", "commit": "cd7e7da622d68136e13721865b4d919efd6325ed" }, + "catppuccin": { "branch": "main", "commit": "ce8d176faa4643e026e597ae3c31db59b63cef09" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, + "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, + "cmp-tabnine": { "branch": "main", "commit": "c0167cdc86c15e782c5461ee62aebee89231c2ed" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, + "flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "fzf-lua": { "branch": "main", "commit": "9d579feab4d3035627150e5e9b6e8fbf5e814ef6" }, + "gitsigns.nvim": { "branch": "main", "commit": "5813e4878748805f1518cee7abb50fd7205a3a48" }, + "grapple.nvim": { "branch": "main", "commit": "b41ddfc1c39f87f3d1799b99c2f0f1daa524c5f7" }, + "harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" }, + "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, + "luvit-meta": { "branch": "main", "commit": "0ea4ff636c5bb559ffa78108561d0976f4de9682" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "3b3571b4dadbcb464804466e9872e7246c316af7" }, + "mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "f3df514fff2bdd4318127c40470984137f87b62e" }, + "neogit": { "branch": "master", "commit": "d8bf9102692250193b855acd9025a826f1af2729" }, + "noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" }, + "none-ls.nvim": { "branch": "main", "commit": "5abf61927023ea83031753504adb19630ba80eef" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-autopairs": { "branch": "master", "commit": "c2a0dd0d931d0fb07665e1fedb1ea688da3b80b4" }, + "nvim-cmp": { "branch": "main", "commit": "d97d85e01339f01b842e6ec1502f639b080cb0fc" }, + "nvim-lspconfig": { "branch": "master", "commit": "c4f67bf85b01a57e3c130352c0a0e453ab8cd5b9" }, + "nvim-navic": { "branch": "master", "commit": "7d914a39a1ef8f4e22c2c4381abeef7c556f5a13" }, + "nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" }, + "nvim-spectre": { "branch": "master", "commit": "72f56f7585903cd7bf92c665351aa585e150af0f" }, + "nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, + "nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" }, + "obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "portal.nvim": { "branch": "main", "commit": "77d9d53fec945bfa407d5fd7120f1b4f117450ed" }, + "projections.nvim": { "branch": "main", "commit": "f18a8505f84f45a0fe024cafca5b969447f63cd5" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "master", "commit": "3d757e586ff0bfc85bdb7b46c9d3d932147a0cde" }, + "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }, + "vim-test": { "branch": "master", "commit": "1eeb12774a0f251571700ccf68da27789b2f0852" }, + "vimux": { "branch": "master", "commit": "614f0bb1fb598f97accdcea71d5f7b18d7d62436" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }, + "yazi.nvim": { "branch": "main", "commit": "275c195596c857955f4627a8b48b68144d79478f" } +} diff --git a/nvim/.config/nvim/lua/plugins.inactive/cmp.lua.bak b/nvim/.config/nvim/lua/plugins.inactive/cmp.lua.bak new file mode 100644 index 0000000..b423a4e --- /dev/null +++ b/nvim/.config/nvim/lua/plugins.inactive/cmp.lua.bak @@ -0,0 +1,9 @@ +return { + { + "hrsh7th/cmp-path", -- file and folders + "hrsh7th/cmp-buffer", -- words from the current buffer + "hrsh7th/cmp-nvim-lsp", -- LSP-based autocompletions + "hrsh7th/cmp-cmdline", -- Command-line autocompletions + "tzachar/cmp-tabnine"--, build = "./install.sh", + }, +} diff --git a/nvim/.config/nvim/lua/plugins.inactive/lsp-config.lua b/nvim/.config/nvim/lua/plugins.inactive/lsp-config.lua new file mode 100644 index 0000000..96d869a --- /dev/null +++ b/nvim/.config/nvim/lua/plugins.inactive/lsp-config.lua @@ -0,0 +1,60 @@ +return { + { + "williamboman/mason.nvim", + lazy = false, + config = function() + require("mason").setup() + end, + }, + { + "williamboman/mason-lspconfig.nvim", + lazy = false, + opts = { + auto_install = true, + }, + }, + { + "neovim/nvim-lspconfig", + lazy = false, + config = function() + local capabilities = require('cmp_nvim_lsp').default_capabilities() + + -- Define server configurations + local servers = { + ts_ls = {}, + solargraph = {}, + html = {}, + lua_ls = {}, + pyright = {}, + -- ltex = { + -- cmd_env = { + -- JAVA_TOOL_OPTIONS = "-Djdk.xml.totalEntitySizeLimit=0 -Djdk.xml.entityExpansionLimit=0" + -- }, + -- filetypes = { "markdown", "text", "tex", "gitcommit" }, + -- settings = { + -- ltex = { + -- language = "en-US", + -- additionalRules = { + -- enablePickyRules = true, + -- motherTongue = "de-DE", + -- }, + -- } + -- } + -- }, + } + + -- Setup each server with the new API + for server, config in pairs(servers) do + config.capabilities = capabilities + vim.lsp.config[server] = config + vim.lsp.enable(server) + end + + -- LSP keymaps + vim.keymap.set("n", "K", vim.lsp.buf.hover, {}) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, {}) + vim.keymap.set("n", "gr", vim.lsp.buf.references, {}) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, {}) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins.inactive/lsp-config.lua.bak b/nvim/.config/nvim/lua/plugins.inactive/lsp-config.lua.bak new file mode 100644 index 0000000..d434a8c --- /dev/null +++ b/nvim/.config/nvim/lua/plugins.inactive/lsp-config.lua.bak @@ -0,0 +1,46 @@ +return { + { + "williamboman/mason.nvim", + lazy = false, + config = function() + require("mason").setup() + end, + }, + { + "williamboman/mason-lspconfig.nvim", + lazy = false, + opts = { + auto_install = true, + }, + }, + { + "neovim/nvim-lspconfig", + lazy = false, + config = function() + local capabilities = require('cmp_nvim_lsp').default_capabilities() + + local lspconfig = require("lspconfig") + lspconfig.ts_ls.setup({ + capabilities = capabilities + }) + lspconfig.solargraph.setup({ + capabilities = capabilities + }) + lspconfig.html.setup({ + capabilities = capabilities + }) + lspconfig.lua_ls.setup({ + capabilities = capabilities + }) + lspconfig.pyright.setup({ + capabilities = capabilities + }) + + vim.keymap.set("n", "K", vim.lsp.buf.hover, {}) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, {}) + vim.keymap.set("n", "gr", vim.lsp.buf.references, {}) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, {}) + end, + }, +} + diff --git a/nvim/.config/nvim/lua/plugins.inactive/markdown-preview.lua b/nvim/.config/nvim/lua/plugins.inactive/markdown-preview.lua new file mode 100644 index 0000000..3fd1a0b --- /dev/null +++ b/nvim/.config/nvim/lua/plugins.inactive/markdown-preview.lua @@ -0,0 +1,84 @@ +return { + { + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + ft = { "markdown" }, + build = function() + vim.fn["mkdp#util#install"]() + end, + config = function() + -- Set to 1 to open preview in browser automatically when entering markdown buffer + vim.g.mkdp_auto_start = 0 + + -- Set to 1 to auto close preview when switching away from markdown buffer + vim.g.mkdp_auto_close = 1 + + -- Set to 1 to refresh on save only, 0 to refresh on every change + vim.g.mkdp_refresh_slow = 0 + + -- Specify browser to open preview page + -- Can be 'firefox', 'chrome', etc. or leave empty for default + vim.g.mkdp_browser = "" + + -- Set to 1 to echo preview page URL in command line + vim.g.mkdp_echo_preview_url = 0 + + -- Options for markdown rendering + -- mkit: markdown-it options for rendering + -- katex: KaTeX options for math typesetting + -- uml: markdown-it-plantuml options + vim.g.mkdp_preview_options = { + mkit = {}, + katex = {}, + uml = {}, + maid = {}, + disable_sync_scroll = 0, + sync_scroll_type = "middle", + hide_yaml_meta = 1, + sequence_diagrams = {}, + flowchart_diagrams = {}, + content_editable = false, + disable_filename = 0, + toc = {}, + } + + -- Use custom markdown style (absolute path or URL) + vim.g.mkdp_markdown_css = "" + + -- Use custom highlight style (absolute path or URL) + vim.g.mkdp_highlight_css = "" + + -- Custom port for preview server (empty = auto select) + vim.g.mkdp_port = "" + + -- Theme: 'dark' or 'light' + vim.g.mkdp_theme = "dark" + + -- Combine preview window (set to 1 to combine multiple markdown preview windows) + vim.g.mkdp_combine_preview = 0 + + -- Auto-start preview when entering markdown buffer + vim.g.mkdp_auto_start = 0 + end, + keys = { + { + "mp", + "MarkdownPreviewToggle", + desc = "Markdown Preview Toggle", + ft = "markdown", + }, + { + "ms", + "MarkdownPreview", + desc = "Markdown Preview Start", + ft = "markdown", + }, + { + "mS", + "MarkdownPreviewStop", + desc = "Markdown Preview Stop", + ft = "markdown", + }, + }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins.inactive/none-ls.lua.bak b/nvim/.config/nvim/lua/plugins.inactive/none-ls.lua.bak new file mode 100644 index 0000000..d28120e --- /dev/null +++ b/nvim/.config/nvim/lua/plugins.inactive/none-ls.lua.bak @@ -0,0 +1,21 @@ +return { + "nvimtools/none-ls.nvim", + config = function() + local null_ls = require("null-ls") + null_ls.setup({ + sources = { + null_ls.builtins.formatting.stylua, + null_ls.builtins.formatting.prettier, + -- null_ls.builtins.diagnostics.eslint_d, + null_ls.builtins.diagnostics.rubocop, + null_ls.builtins.formatting.rubocop, + null_ls.builtins.formatting.black, + null_ls.builtins.formatting.isort, + null_ls.builtins.diagnostics.pylint, + }, + }) + + vim.keymap.set("n", "gf", vim.lsp.buf.format, {}) + end, +} + diff --git a/nvim/.config/nvim/lua/plugins.inactive/oil.lua b/nvim/.config/nvim/lua/plugins.inactive/oil.lua new file mode 100644 index 0000000..4acbe58 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins.inactive/oil.lua @@ -0,0 +1,8 @@ +-- return { +-- "stevearc/oil.nvim", +-- config = function() +-- local oil = require("oil") +-- oil.setup() +-- vim.keymap.set("n", "-", oil.toggle_float, {}) +-- end, +--} diff --git a/nvim/.config/nvim/lua/plugins.inactive/swagger-preview.lua b/nvim/.config/nvim/lua/plugins.inactive/swagger-preview.lua new file mode 100644 index 0000000..513df78 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins.inactive/swagger-preview.lua @@ -0,0 +1,5 @@ +return { + "vinnymeller/swagger-preview.nvim", + build = "npm install -g swagger-ui-watcher", + config = true, +} diff --git a/nvim/.config/nvim/lua/plugins.inactive/telescope.lua.bak b/nvim/.config/nvim/lua/plugins.inactive/telescope.lua.bak new file mode 100644 index 0000000..ddb60ab --- /dev/null +++ b/nvim/.config/nvim/lua/plugins.inactive/telescope.lua.bak @@ -0,0 +1,26 @@ +return { + { + "nvim-telescope/telescope-ui-select.nvim", + }, + { + "nvim-telescope/telescope.nvim", + tag = "0.1.5", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + require("telescope").setup({ + extensions = { + ["ui-select"] = { + require("telescope.themes").get_dropdown({}), + }, + }, + }) + local builtin = require("telescope.builtin") + vim.keymap.set("n", "", builtin.find_files, {}) + vim.keymap.set("n", "fg", builtin.live_grep, {}) + vim.keymap.set("n", "", builtin.oldfiles, {}) + + require("telescope").load_extension("ui-select") + require("telescope").load_extension("noice") + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua new file mode 100644 index 0000000..a564707 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins.lua @@ -0,0 +1 @@ +return {} diff --git a/nvim/.config/nvim/lua/plugins/alpha.lua b/nvim/.config/nvim/lua/plugins/alpha.lua new file mode 100644 index 0000000..d6638ae --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/alpha.lua @@ -0,0 +1,31 @@ +return { + "goolord/alpha-nvim", + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + + config = function() + local alpha = require("alpha") + local dashboard = require("alpha.themes.startify") + + dashboard.section.header.val = { + [[ ]], + [[ ]], + [[ ]], + [[ ]], + [[  ]], + [[ ████ ██████ █████ ██ ]], + [[ ███████████ █████  ]], + [[ █████████ ███████████████████ ███ ███████████ ]], + [[ █████████ ███ █████████████ █████ ██████████████ ]], + [[ █████████ ██████████ █████████ █████ █████ ████ █████ ]], + [[ ███████████ ███ ███ █████████ █████ █████ ████ █████ ]], + [[ ██████ █████████████████████ ████ █████ █████ ████ ██████ ]], + [[ ]], + [[ ]], + [[ ]], + } + + alpha.setup(dashboard.opts) + end, +} diff --git a/nvim/.config/nvim/lua/plugins/autopairs.lua b/nvim/.config/nvim/lua/plugins/autopairs.lua new file mode 100644 index 0000000..4a214ed --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/autopairs.lua @@ -0,0 +1,96 @@ +return { + { + "windwp/nvim-autopairs", + event = "InsertEnter", + dependencies = { + "hrsh7th/nvim-cmp", + }, + config = function() + local autopairs = require("nvim-autopairs") + local cmp_autopairs = require("nvim-autopairs.completion.cmp") + local cmp = require("cmp") + + autopairs.setup({ + check_ts = true, -- Enable treesitter + ts_config = { + lua = { "string" }, -- Don't add pairs in lua string treesitter nodes + javascript = { "template_string" }, -- Don't add pairs in JS template strings + java = false, -- Don't check treesitter on java + }, + disable_filetype = { "TelescopePrompt", "vim" }, + disable_in_macro = true, -- Disable when recording or executing a macro + disable_in_visualblock = false, -- Disable when in visual block mode + disable_in_replace_mode = true, + ignored_next_char = [=[[%w%%%'%[%"%.%`%$]]=], + enable_moveright = true, + enable_afterquote = true, -- Add bracket pairs after quote + enable_check_bracket_line = true, -- Check bracket in same line + enable_bracket_in_quote = true, + enable_abbr = false, -- Trigger abbreviation + break_undo = true, -- Switch for basic rule break undo sequence + check_comma = true, + map_cr = true, + map_bs = true, -- Map the key + map_c_h = false, -- Map the key to delete a pair + map_c_w = false, -- Map to delete a pair if possible + }) + + -- Integration with nvim-cmp + cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) + + -- Treesitter rules + local ts_conds = require("nvim-autopairs.ts-conds") + + -- Press % => %% only while inside a comment or string + autopairs.add_rules({ + require("nvim-autopairs.rule")("%", "%", "lua") + :with_pair(ts_conds.is_ts_node({ "string", "comment" })), + require("nvim-autopairs.rule")("$", "$", "lua") + :with_pair(ts_conds.is_not_ts_node({ "function" })), + }) + + -- Add spaces between parentheses + local Rule = require("nvim-autopairs.rule") + local cond = require("nvim-autopairs.conds") + + autopairs.add_rules({ + Rule(" ", " ") + :with_pair(function(opts) + local pair = opts.line:sub(opts.col - 1, opts.col) + return vim.tbl_contains({ "()", "[]", "{}" }, pair) + end) + :with_move(cond.none()) + :with_cr(cond.none()) + :with_del(function(opts) + local col = vim.api.nvim_win_get_cursor(0)[2] + local context = opts.line:sub(col - 1, col + 2) + return vim.tbl_contains({ "( )", "[ ]", "{ }" }, context) + end), + Rule("", " )") + :with_pair(cond.none()) + :with_move(function(opts) + return opts.char == ")" + end) + :with_cr(cond.none()) + :with_del(cond.none()) + :use_key(")"), + Rule("", " }") + :with_pair(cond.none()) + :with_move(function(opts) + return opts.char == "}" + end) + :with_cr(cond.none()) + :with_del(cond.none()) + :use_key("}"), + Rule("", " ]") + :with_pair(cond.none()) + :with_move(function(opts) + return opts.char == "]" + end) + :with_cr(cond.none()) + :with_del(cond.none()) + :use_key("]"), + }) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/barbeque.lua b/nvim/.config/nvim/lua/plugins/barbeque.lua new file mode 100644 index 0000000..ec7e57e --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/barbeque.lua @@ -0,0 +1,99 @@ +return { + { + "utilyre/barbecue.nvim", + name = "barbecue", + version = "*", + dependencies = { + "SmiteshP/nvim-navic", + "nvim-tree/nvim-web-devicons", + }, + event = { "BufReadPost", "BufNewFile" }, + config = function() + require("barbecue").setup({ + -- Create autocmd to attach to LSP + attach_navic = true, + + -- Create user commands + create_autocmd = true, + + -- Whether to show/use file icons + show_modified = false, + + -- Whether to show file path + show_dirname = true, + + -- Whether to show basename + show_basename = true, + + -- Filetypes to exclude + exclude_filetypes = { "netrw", "toggleterm", "alpha", "NvimTree" }, + + -- Modifiers to apply to dirname + modifiers = { + dirname = ":~:.", + basename = "", + }, + + -- Whether to display path to file + show_navic = true, + + -- Custom section + custom_section = function() + return " " + end, + + -- Theme configuration + theme = "auto", -- 'auto', 'tokyonight', 'catppuccin', etc. + + -- Symbols for different node kinds + kinds = { + File = "", + Module = "", + Namespace = "", + Package = "", + Class = "", + Method = "", + Property = "", + Field = "", + Constructor = "", + Enum = "", + Interface = "", + Function = "", + Variable = "", + Constant = "", + String = "", + Number = "", + Boolean = "", + Array = "", + Object = "", + Key = "", + Null = "", + EnumMember = "", + Struct = "", + Event = "", + Operator = "", + TypeParameter = "", + }, + }) + end, + }, + { + "SmiteshP/nvim-navic", + dependencies = { + "neovim/nvim-lspconfig", + }, + opts = { + lsp = { + auto_attach = true, + preference = nil, + }, + highlight = true, + separator = " > ", + depth_limit = 0, + depth_limit_indicator = "..", + safe_output = true, + lazy_update_context = false, + click = false, + }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/catppuccin.lua b/nvim/.config/nvim/lua/plugins/catppuccin.lua new file mode 100644 index 0000000..988b00f --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/catppuccin.lua @@ -0,0 +1,11 @@ +return { + { + "catppuccin/nvim", + lazy = false, + name = "catppuccin", + priority = 1000, + config = function() + vim.cmd.colorscheme "catppuccin-mocha" + end + } +} diff --git a/nvim/.config/nvim/lua/plugins/cmp.lua b/nvim/.config/nvim/lua/plugins/cmp.lua new file mode 100644 index 0000000..5e54c38 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/cmp.lua @@ -0,0 +1,24 @@ +return { + { + "hrsh7th/cmp-nvim-lsp", + }, + { + "L3MON4D3/LuaSnip", + dependencies = { + "saadparwaiz1/cmp_luasnip", + "rafamadriz/friendly-snippets", + }, + }, + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-path", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-cmdline", + }, + }, + { + "tzachar/cmp-tabnine", + build = "./install.sh", + }, +} diff --git a/nvim/.config/nvim/lua/plugins/comment.lua b/nvim/.config/nvim/lua/plugins/comment.lua new file mode 100644 index 0000000..b25f4d0 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/comment.lua @@ -0,0 +1,56 @@ +return { + { + "numToStr/Comment.nvim", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "JoosepAlviste/nvim-ts-context-commentstring", + }, + config = function() + local comment = require("Comment") + local ts_context_commentstring = require("ts_context_commentstring.integrations.comment_nvim") + + comment.setup({ + -- Add a space between comment and the line + padding = true, + + -- Whether the cursor should stay at its position + sticky = true, + + -- Lines to be ignored while (un)comment + ignore = "^$", + + -- LHS of toggle mappings in NORMAL mode + toggler = { + line = "gcc", -- Line-comment toggle keymap + block = "gbc", -- Block-comment toggle keymap + }, + + -- LHS of operator-pending mappings in NORMAL and VISUAL mode + opleader = { + line = "gc", -- Line-comment keymap + block = "gb", -- Block-comment keymap + }, + + -- LHS of extra mappings + extra = { + above = "gcO", -- Add comment on the line above + below = "gco", -- Add comment on the line below + eol = "gcA", -- Add comment at the end of line + }, + + -- Enable keybindings + -- NOTE: If given `false` then the plugin won't create any mappings + mappings = { + basic = true, + extra = true, + }, + + -- Function to call before (un)comment + pre_hook = ts_context_commentstring.create_pre_hook(), + + -- Function to call after (un)comment + post_hook = nil, + }) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/completions.lua b/nvim/.config/nvim/lua/plugins/completions.lua new file mode 100644 index 0000000..0008aa7 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/completions.lua @@ -0,0 +1,45 @@ +return { + { + "hrsh7th/cmp-nvim-lsp", + }, + { + "L3MON4D3/LuaSnip", + -- follow latest release. + version = "v2.*", -- Replace by the latest released major (first number of latest release) + -- install jsregexp (optional!). + build = "make install_jsregexp" + }, + { + "hrsh7th/nvim-cmp", + config = function() + local cmp = require("cmp") + require("luasnip.loaders.from_vscode").lazy_load() + + cmp.setup({ + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, -- For luasnip users. + { name = "buffer" }, + { name = "path" }, + { name = "cmp_tabnine" }, -- ai powerde suggestions + }), + }) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/dressing.lua b/nvim/.config/nvim/lua/plugins/dressing.lua new file mode 100644 index 0000000..772d8cf --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/dressing.lua @@ -0,0 +1,44 @@ +return { + { + "stevearc/dressing.nvim", + event = "VeryLazy", + opts = { + input = { + enabled = true, + default_prompt = "Input:", + trim_prompt = true, + title_pos = "left", + start_in_insert = true, + border = "rounded", + relative = "cursor", + prefer_width = 40, + win_options = { + winblend = 0, + }, + mappings = { + n = { + [""] = "Close", + [""] = "Confirm", + }, + i = { + [""] = "Close", + [""] = "Confirm", + [""] = "HistoryPrev", + [""] = "HistoryNext", + }, + }, + }, + select = { + enabled = true, + backend = { "telescope", "builtin" }, + trim_prompt = true, + telescope = require("telescope.themes").get_dropdown({ + layout_config = { + width = 0.8, + height = 0.8, + }, + }), + }, + }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/flash-nvim.lua b/nvim/.config/nvim/lua/plugins/flash-nvim.lua new file mode 100644 index 0000000..7e7f638 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/flash-nvim.lua @@ -0,0 +1,50 @@ +return { + { + "folke/flash.nvim", + event = "VeryLazy", + ---@type Flash.Config + opts = {}, + keys = { + { + "w", + mode = { "n", "x", "o" }, + function() + require("flash").jump() + end, + desc = "Flash", + }, + { + "W", + mode = { "n", "x", "o" }, + function() + require("flash").treesitter() + end, + desc = "Flash Treesitter", + }, + { + "r", + mode = "o", + function() + require("flash").remote() + end, + desc = "Remote Flash", + }, + { + "R", + mode = { "o", "x" }, + function() + require("flash").treesitter_search() + end, + desc = "Treesitter Search", + }, + { + "", + mode = { "c" }, + function() + require("flash").toggle() + end, + desc = "Toggle Flash Search", + }, + }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/fzf.lua b/nvim/.config/nvim/lua/plugins/fzf.lua new file mode 100644 index 0000000..0dee574 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/fzf.lua @@ -0,0 +1,14 @@ +return { + { + "ibhagwan/fzf-lua", + -- optional for icon support + dependencies = { "nvim-tree/nvim-web-devicons" }, + -- or if using mini.icons/mini.nvim + -- dependencies = { "nvim-mini/mini.icons" }, + ---@module "fzf-lua" + ---@type fzf-lua.Config|{} + ---@diagnostics disable: missing-fields + opts = {}, + ---@diagnostics enable: missing-fields + }, +} diff --git a/nvim/.config/nvim/lua/plugins/git-signs.lua b/nvim/.config/nvim/lua/plugins/git-signs.lua new file mode 100644 index 0000000..7ac67c2 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/git-signs.lua @@ -0,0 +1,86 @@ +return { + { + "lewis6991/gitsigns.nvim", + event = { "BufReadPre", "BufNewFile" }, + config = function() + require("gitsigns").setup({ + signs = { + add = { text = "│" }, + change = { text = "│" }, + delete = { text = "_" }, + topdelete = { text = "‾" }, + changedelete = { text = "~" }, + untracked = { text = "┆" }, + }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = false, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + watch_gitdir = { + follow_files = true + }, + attach_to_untracked = true, + current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' + delay = 1000, + ignore_whitespace = false, + virt_text_priority = 100, + }, + current_line_blame_formatter = ", - ", + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, + max_file_length = 40000, + preview_config = { + border = "rounded", + style = "minimal", + relative = "cursor", + row = 0, + col = 1 + }, + on_attach = function(bufnr) + local gs = package.loaded.gitsigns + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map("n", "]c", function() + if vim.wo.diff then return "]c" end + vim.schedule(function() gs.next_hunk() end) + return "" + end, { expr = true, desc = "Next hunk" }) + + map("n", "[c", function() + if vim.wo.diff then return "[c" end + vim.schedule(function() gs.prev_hunk() end) + return "" + end, { expr = true, desc = "Previous hunk" }) + + -- Actions + map("n", "hs", gs.stage_hunk, { desc = "Stage hunk" }) + map("n", "hr", gs.reset_hunk, { desc = "Reset hunk" }) + map("v", "hs", function() gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) end, { desc = "Stage hunk" }) + map("v", "hr", function() gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) end, { desc = "Reset hunk" }) + map("n", "hS", gs.stage_buffer, { desc = "Stage buffer" }) + map("n", "hu", gs.undo_stage_hunk, { desc = "Undo stage hunk" }) + map("n", "hR", gs.reset_buffer, { desc = "Reset buffer" }) + map("n", "hp", gs.preview_hunk, { desc = "Preview hunk" }) + map("n", "hb", function() gs.blame_line({ full = true }) end, { desc = "Blame line" }) + map("n", "tb", gs.toggle_current_line_blame, { desc = "Toggle line blame" }) + map("n", "hd", gs.diffthis, { desc = "Diff this" }) + map("n", "hD", function() gs.diffthis("~") end, { desc = "Diff this ~" }) + map("n", "td", gs.toggle_deleted, { desc = "Toggle deleted" }) + + -- Text object + map({ "o", "x" }, "ih", ":Gitsigns select_hunk", { desc = "Select hunk" }) + end + }) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/harpoon.lua b/nvim/.config/nvim/lua/plugins/harpoon.lua new file mode 100644 index 0000000..4f98022 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/harpoon.lua @@ -0,0 +1,68 @@ +return { + { + "ThePrimeagen/harpoon", + branch = "harpoon2", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope.nvim", + }, + config = function() + local harpoon = require("harpoon") + + -- Setup harpoon + harpoon:setup({ + settings = { + save_on_toggle = true, + sync_on_ui_close = true, + key = function() + return vim.loop.cwd() + end, + }, + }) + + -- Basic keymaps + vim.keymap.set("n", "a", function() harpoon:list():add() end, + { desc = "Harpoon: Add file" }) + + vim.keymap.set("n", "", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end, + { desc = "Harpoon: Toggle menu" }) + + -- Navigate to files 1-4 + vim.keymap.set("n", "1", function() harpoon:list():select(1) end, + { desc = "Harpoon: Go to file 1" }) + vim.keymap.set("n", "2", function() harpoon:list():select(2) end, + { desc = "Harpoon: Go to file 2" }) + vim.keymap.set("n", "3", function() harpoon:list():select(3) end, + { desc = "Harpoon: Go to file 3" }) + vim.keymap.set("n", "4", function() harpoon:list():select(4) end, + { desc = "Harpoon: Go to file 4" }) + + -- Navigate to previous & next buffers + vim.keymap.set("n", "", function() harpoon:list():prev() end, + { desc = "Harpoon: Previous file" }) + vim.keymap.set("n", "", function() harpoon:list():next() end, + { desc = "Harpoon: Next file" }) + + -- Telescope integration + local conf = require("telescope.config").values + local function toggle_telescope(harpoon_files) + local file_paths = {} + for _, item in ipairs(harpoon_files.items) do + table.insert(file_paths, item.value) + end + + require("telescope.pickers").new({}, { + prompt_title = "Harpoon", + finder = require("telescope.finders").new_table({ + results = file_paths, + }), + previewer = conf.file_previewer({}), + sorter = conf.generic_sorter({}), + }):find() + end + + vim.keymap.set("n", "h", function() toggle_telescope(harpoon:list()) end, + { desc = "Open harpoon window with Telescope" }) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/indent-blankline.lua b/nvim/.config/nvim/lua/plugins/indent-blankline.lua new file mode 100644 index 0000000..1e6140d --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/indent-blankline.lua @@ -0,0 +1,18 @@ +return { + { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + config = function() + require("ibl").setup({ + indent = { + char = "│", + }, + scope = { + enabled = true, + show_start = true, + show_end = false, + }, + }) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/lazydev.lua b/nvim/.config/nvim/lua/plugins/lazydev.lua new file mode 100644 index 0000000..9b9ab4d --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/lazydev.lua @@ -0,0 +1,38 @@ +return { + { + "folke/lazydev.nvim", + ft = "lua", + dependencies = { + "Bilal2453/luvit-meta", + }, + opts = { + library = { + -- Load luvit types when the `vim.uv` word is found + { path = "luvit-meta/library", words = { "vim%.uv" } }, + -- Load LazyVim types when the `LazyVim` word is found + { path = "LazyVim", words = { "LazyVim" } }, + -- Add nvim-navic to library for completions + { path = "nvim-navic", words = { "navic" } }, + -- Add barbecue to library + { path = "barbecue.nvim", words = { "barbecue" } }, + }, + -- Enable type checking + enabled = function(root_dir) + return vim.g.lazydev_enabled == nil and true or vim.g.lazydev_enabled + end, + -- Disable integration with cmp + integrations = { + -- Enable lspconfig integration + lspconfig = true, + -- Enable cmp integration + cmp = true, + -- Enable coq integration + coq = false, + }, + }, + }, + { + "Bilal2453/luvit-meta", + lazy = true, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/lsp-config.lua b/nvim/.config/nvim/lua/plugins/lsp-config.lua new file mode 100644 index 0000000..6ea86da --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/lsp-config.lua @@ -0,0 +1,71 @@ +return { + { + "williamboman/mason.nvim", + lazy = false, + config = function() + require("mason").setup() + end, + }, + { + "williamboman/mason-lspconfig.nvim", + lazy = false, + opts = { + auto_install = true, + }, + }, + { + "neovim/nvim-lspconfig", + lazy = false, + dependencies = { + "SmiteshP/nvim-navic", -- Add this dependency + }, + config = function() + local capabilities = require('cmp_nvim_lsp').default_capabilities() + local navic = require("nvim-navic") + + -- Define server configurations + local servers = { + ts_ls = {}, + solargraph = {}, + html = {}, + lua_ls = { + settings = { + Lua = { + diagnostics = { + globals = { "vim" }, + }, + workspace = { + checkThirdParty = false, + }, + telemetry = { + enable = false, + }, + }, + }, + }, + pyright = {}, + } + + -- Setup each server with the new API + for server, config in pairs(servers) do + config.capabilities = capabilities + + -- Add navic on_attach for breadcrumbs + config.on_attach = function(client, bufnr) + if client.server_capabilities.documentSymbolProvider then + navic.attach(client, bufnr) + end + end + + vim.lsp.config[server] = config + vim.lsp.enable(server) + end + + -- LSP keymaps + vim.keymap.set("n", "K", vim.lsp.buf.hover, {}) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, {}) + vim.keymap.set("n", "gr", vim.lsp.buf.references, {}) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, {}) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/lualine.lua b/nvim/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..ad3617a --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,10 @@ +return { + "nvim-lualine/lualine.nvim", + config = function () + require('lualine').setup({ + options = { + theme = 'dracula' + } + }) + end +} diff --git a/nvim/.config/nvim/lua/plugins/neo-tree.lua b/nvim/.config/nvim/lua/plugins/neo-tree.lua new file mode 100644 index 0000000..3acf6dd --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/neo-tree.lua @@ -0,0 +1,13 @@ +return { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + "MunifTanjim/nui.nvim", + }, + config = function() + vim.keymap.set("n", "ee", ":Neotree filesystem reveal left", {}) + vim.keymap.set("n", "bf", ":Neotree buffers reveal float", {}) + end, +} diff --git a/nvim/.config/nvim/lua/plugins/neogit.lua b/nvim/.config/nvim/lua/plugins/neogit.lua new file mode 100644 index 0000000..b530202 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/neogit.lua @@ -0,0 +1,24 @@ +return { + { + "NeogitOrg/neogit", + dependencies = { + "nvim-lua/plenary.nvim", + "sindrets/diffview.nvim", + "nvim-telescope/telescope.nvim", + }, + opts = { + integrations = { + telescope = true, + diffview = true, + }, + kind = "tab", + }, + keys = { + { "gs", "Neogit", desc = "Neogit Status" }, + { "gc", "Neogit commit", desc = "Neogit Commit" }, + { "gp", "Neogit pull", desc = "Neogit Pull" }, + { "gP", "Neogit push", desc = "Neogit Push" }, + { "gb", "Neogit branch", desc = "Neogit Branch" }, + }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/noice.lua b/nvim/.config/nvim/lua/plugins/noice.lua new file mode 100644 index 0000000..ab7f611 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/noice.lua @@ -0,0 +1,17 @@ +return { -- lazy.nvim + { + "folke/noice.nvim", + event = "VeryLazy", + opts = { + -- add any options here + }, + dependencies = { + -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + "MunifTanjim/nui.nvim", + -- OPTIONAL: + -- `nvim-notify` is only needed, if you want to use the notification view. + -- If not available, we use `mini` as the fallback + "rcarriga/nvim-notify", + }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/none-ls.lua b/nvim/.config/nvim/lua/plugins/none-ls.lua new file mode 100644 index 0000000..77dfa25 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/none-ls.lua @@ -0,0 +1,23 @@ +return { + "nvimtools/none-ls.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + }, + event = { "BufReadPre", "BufNewFile" }, + config = function() + local null_ls = require("null-ls") + null_ls.setup({ + sources = { + null_ls.builtins.formatting.stylua, + null_ls.builtins.formatting.prettier, + -- null_ls.builtins.diagnostics.eslint_d, + null_ls.builtins.diagnostics.rubocop, + null_ls.builtins.formatting.rubocop, + null_ls.builtins.formatting.black, + null_ls.builtins.formatting.isort, + null_ls.builtins.diagnostics.pylint, + }, + }) + vim.keymap.set("n", "gf", vim.lsp.buf.format, {}) + end, +} diff --git a/nvim/.config/nvim/lua/plugins/nvim-spectre.lua b/nvim/.config/nvim/lua/plugins/nvim-spectre.lua new file mode 100644 index 0000000..8098071 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/nvim-spectre.lua @@ -0,0 +1,159 @@ +return { + { + "nvim-pack/nvim-spectre", + dependencies = { + "nvim-lua/plenary.nvim", + }, + config = function() + require("spectre").setup({ + -- Optional: customize colors + color_devicons = true, + open_cmd = "vnew", + live_update = false, -- auto execute search again when you write any file + line_sep_start = "┌-----------------------------------------", + result_padding = "¦ ", + line_sep = "└-----------------------------------------", + highlight = { + ui = "String", + search = "DiffChange", + replace = "DiffDelete", + }, + mapping = { + ["toggle_line"] = { + map = "dd", + cmd = "lua require('spectre').toggle_line()", + desc = "toggle item", + }, + ["enter_file"] = { + map = "", + cmd = "lua require('spectre.actions').select_entry()", + desc = "open file", + }, + ["send_to_qf"] = { + map = "q", + cmd = "lua require('spectre.actions').send_to_qf()", + desc = "send all items to quickfix", + }, + ["replace_cmd"] = { + map = "c", + cmd = "lua require('spectre.actions').replace_cmd()", + desc = "input replace command", + }, + ["show_option_menu"] = { + map = "o", + cmd = "lua require('spectre').show_options()", + desc = "show options", + }, + ["run_current_replace"] = { + map = "rc", + cmd = "lua require('spectre.actions').run_current_replace()", + desc = "replace current line", + }, + ["run_replace"] = { + map = "R", + cmd = "lua require('spectre.actions').run_replace()", + desc = "replace all", + }, + ["change_view_mode"] = { + map = "v", + cmd = "lua require('spectre').change_view()", + desc = "change result view mode", + }, + ["change_replace_sed"] = { + map = "trs", + cmd = "lua require('spectre').change_engine_replace('sed')", + desc = "use sed to replace", + }, + ["change_replace_oxi"] = { + map = "tro", + cmd = "lua require('spectre').change_engine_replace('oxi')", + desc = "use oxi to replace", + }, + ["toggle_live_update"] = { + map = "tu", + cmd = "lua require('spectre').toggle_live_update()", + desc = "update when vim writes to file", + }, + ["toggle_ignore_case"] = { + map = "ti", + cmd = "lua require('spectre').change_options('ignore-case')", + desc = "toggle ignore case", + }, + ["toggle_ignore_hidden"] = { + map = "th", + cmd = "lua require('spectre').change_options('hidden')", + desc = "toggle search hidden", + }, + ["resume_last_search"] = { + map = "l", + cmd = "lua require('spectre').resume_last_search()", + desc = "resume last search", + }, + }, + find_engine = { + ["rg"] = { + cmd = "rg", + args = { + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + }, + options = { + ["ignore-case"] = { + value = "--ignore-case", + icon = "[I]", + desc = "ignore case", + }, + ["hidden"] = { + value = "--hidden", + desc = "hidden file", + icon = "[H]", + }, + }, + }, + }, + replace_engine = { + ["sed"] = { + cmd = "sed", + args = nil, + options = { + ["ignore-case"] = { + value = "--ignore-case", + icon = "[I]", + desc = "ignore case", + }, + }, + }, + }, + default = { + find = { + cmd = "rg", + options = { "ignore-case" }, + }, + replace = { + cmd = "sed", + }, + }, + }) + + -- Global keymaps + vim.keymap.set("n", "S", 'lua require("spectre").toggle()', { + desc = "Toggle Spectre", + }) + + vim.keymap.set("n", "sw", 'lua require("spectre").open_visual({select_word=true})', { + desc = "Search current word", + }) + + vim.keymap.set("v", "sw", 'lua require("spectre").open_visual()', { + desc = "Search current word", + }) + + vim.keymap.set("n", "sp", 'lua require("spectre").open_file_search({select_word=true})', { + desc = "Search in current file", + }) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/nvim-tmux-navigation.lua b/nvim/.config/nvim/lua/plugins/nvim-tmux-navigation.lua new file mode 100644 index 0000000..867d0e8 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/nvim-tmux-navigation.lua @@ -0,0 +1,10 @@ +return { + "alexghergh/nvim-tmux-navigation", + config = function() + require('nvim-tmux-navigation').setup({}) + vim.keymap.set("n", "", "NvimTmuxNavigateLeft", {}) + vim.keymap.set("n", "", "NvimTmuxNavigateDown", {}) + vim.keymap.set("n", "", "NvimTmuxNavigateUp", {}) + vim.keymap.set("n", "", "NvimTmuxNavigateRight", {}) + end, +} diff --git a/nvim/.config/nvim/lua/plugins/nvim-web-devicons.lua b/nvim/.config/nvim/lua/plugins/nvim-web-devicons.lua new file mode 100644 index 0000000..2b5b575 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/nvim-web-devicons.lua @@ -0,0 +1,88 @@ +return { + { + "nvim-tree/nvim-web-devicons", + lazy = true, + config = function() + require("nvim-web-devicons").setup({ + -- Globally enable/disable all icons + override = { + -- Override specific file type icons + zsh = { + icon = "", + color = "#428850", + cterm_color = "65", + name = "Zsh" + }, + -- Add custom icons + ["Dockerfile"] = { + icon = "", + color = "#384d54", + name = "Dockerfile" + }, + [".env"] = { + icon = "", + color = "#faf743", + name = "Env" + }, + [".gitignore"] = { + icon = "", + color = "#f1502f", + name = "GitIgnore" + }, + }, + -- Override by file extension + override_by_extension = { + ["log"] = { + icon = "", + color = "#81e043", + name = "Log" + }, + ["rs"] = { + icon = "", + color = "#dea584", + name = "Rust" + }, + ["md"] = { + icon = "", + color = "#519aba", + name = "Markdown" + }, + }, + -- Override by filename + override_by_filename = { + ["makefile"] = { + icon = "", + color = "#6d8086", + name = "Makefile" + }, + ["dockerfile"] = { + icon = "", + color = "#384d54", + name = "Dockerfile" + }, + [".dockerignore"] = { + icon = "", + color = "#384d54", + name = "DockerIgnore" + }, + ["package.json"] = { + icon = "", + color = "#e8274b", + name = "PackageJson" + }, + ["package-lock.json"] = { + icon = "", + color = "#7a0d21", + name = "PackageLockJson" + }, + }, + -- Use colors by default + color_icons = true, + -- Globally enable default icons (if icon not found) + default = true, + -- Use strict mode (throw error if icon not found) + strict = false, + }) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/obsidian.lua b/nvim/.config/nvim/lua/plugins/obsidian.lua new file mode 100644 index 0000000..6a3537a --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/obsidian.lua @@ -0,0 +1,110 @@ +return { + { + "epwalsh/obsidian.nvim", + version = "*", + lazy = true, + ft = "markdown", + dependencies = { + "nvim-lua/plenary.nvim", + }, + opts = { + workspaces = { + { + name = "nvim", + path = "~/Documents/obsidian/vault", -- Change to your vault path + }, + -- { + -- name = "work", + -- path = "~/obsidian/work", -- Optional: add more vaults + -- }, + }, + + -- Daily notes + daily_notes = { + folder = "daily", + date_format = "%Y-%m-%d", + template = nil, + }, + + -- Templates + templates = { + folder = "templates", + date_format = "%Y-%m-%d", + time_format = "%H:%M", + }, + + -- Completion + completion = { + nvim_cmp = true, + min_chars = 2, + }, + + -- Use note title as filename + note_id_func = function(title) + if title ~= nil then + return title + else + return tostring(os.time()) + end + end, + + -- Disable UI features if you don't want them + ui = { + enable = true, -- Set to false to disable and suppress warning + }, + + -- Mappings (only active in markdown files) + mappings = { + -- Follow link under cursor + ["gf"] = { + action = function() + return require("obsidian").util.gf_passthrough() + end, + opts = { noremap = false, expr = true, buffer = true }, + }, + -- Toggle checkbox + ["ch"] = { + action = function() + return require("obsidian").util.toggle_checkbox() + end, + opts = { buffer = true }, + }, + -- Smart action (follow link or toggle checkbox) + [""] = { + action = function() + return require("obsidian").util.smart_action() + end, + opts = { buffer = true, expr = true }, + }, + }, + }, + + config = function(_, opts) + require("obsidian").setup(opts) + + -- Set conceallevel for markdown files (for UI features) + vim.api.nvim_create_autocmd("FileType", { + pattern = "markdown", + callback = function() + vim.opt_local.conceallevel = 2 + end, + }) + end, + + -- Global keymaps + keys = { + { "on", "ObsidianNew", desc = "New Obsidian note" }, + { "oo", "ObsidianQuickSwitch", desc = "Quick switch notes" }, + { "os", "ObsidianSearch", desc = "Search notes" }, + { "ot", "ObsidianToday", desc = "Today's note" }, + { "oy", "ObsidianYesterday", desc = "Yesterday's note" }, + { "ob", "ObsidianBacklinks", desc = "Show backlinks" }, + { "og", "ObsidianTags", desc = "Search tags" }, + { "ol", "ObsidianLink", mode = "v", desc = "Link selection" }, + { "oL", "ObsidianLinkNew", mode = "v", desc = "Link to new note" }, + { "of", "ObsidianFollowLink", desc = "Follow link" }, + { "oT", "ObsidianTemplate", desc = "Insert template" }, + { "op", "ObsidianOpen", desc = "Open in Obsidian app" }, + }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/portal.lua b/nvim/.config/nvim/lua/plugins/portal.lua new file mode 100644 index 0000000..6ed8469 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/portal.lua @@ -0,0 +1,72 @@ +return { + { + "cbochs/portal.nvim", + dependencies = { + "cbochs/grapple.nvim", -- Optional: for grapple integration + "ThePrimeagen/harpoon", -- Optional: for harpoon integration + }, + config = function() + -- Setup portal + require("portal").setup({ + labels = { "j", "k", "h", "l" }, + escape = { + [""] = true, + }, + }) + + -- Basic navigation keymaps + vim.keymap.set("n", "u", "Portal jumplist backward", { desc = "Portal: Jump backward" }) + + vim.keymap.set("n", "i", "Portal jumplist forward", { desc = "Portal: Jump forward" }) + + -- Changelist navigation + vim.keymap.set( + "n", + "po", + "Portal changelist backward", + { desc = "Portal: Jump backward (changelist)" } + ) + + vim.keymap.set( + "n", + "pi", + "Portal changelist forward", + { desc = "Portal: Jump forward (changelist)" } + ) + + -- Quickfix navigation + vim.keymap.set( + "n", + "qo", + "Portal quickfix backward", + { desc = "Portal: Jump backward (quickfix)" } + ) + + vim.keymap.set( + "n", + "qi", + "Portal quickfix forward", + { desc = "Portal: Jump forward (quickfix)" } + ) + + -- Optional: Harpoon integration + vim.keymap.set( + "n", + "ho", + "Portal harpoon backward", + { desc = "Portal: Jump backward (harpoon)" } + ) + + vim.keymap.set( + "n", + "hi", + "Portal harpoon forward", + { desc = "Portal: Jump forward (harpoon)" } + ) + end, + keys = { + { "u", desc = "Portal: Jump backward" }, + { "i", desc = "Portal: Jump forward" }, + }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/projections.lua b/nvim/.config/nvim/lua/plugins/projections.lua new file mode 100644 index 0000000..5153e24 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/projections.lua @@ -0,0 +1,38 @@ +return { + { + "gnikdroy/projections.nvim", + dependencies = { + "nvim-telescope/telescope.nvim", + }, + config = function() + require("projections").setup({ + workspaces = { + "~/projects", + "~/obsidian", + "~/.config", + }, + patterns = { ".git", "package.json", "Cargo.toml", "go.mod" }, + }) + + require("telescope").load_extension("projections") + + -- Auto-store session on VimExit + local Session = require("projections.session") + vim.api.nvim_create_autocmd({ "VimLeavePre" }, { + callback = function() Session.store(vim.loop.cwd()) end, + }) + + -- Auto-restore session + vim.api.nvim_create_autocmd({ "VimEnter" }, { + callback = function() + if vim.fn.argc() == 0 then + Session.restore(vim.loop.cwd()) + end + end, + }) + end, + keys = { + { "fp", "Telescope projections", desc = "Find Projects" }, + }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/telescope.lua b/nvim/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..5af98a1 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,28 @@ +return { + { + "nvim-telescope/telescope-ui-select.nvim", + }, + { + "nvim-telescope/telescope.nvim", + -- tag = "0.1.5", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + require("telescope").setup({ + extensions = { + ["ui-select"] = { + require("telescope.themes").get_dropdown({}), + }, + }, + }) + local builtin = require("telescope.builtin") + vim.keymap.set("n", "", builtin.find_files, {}) + vim.keymap.set("n", "fg", builtin.live_grep, {}) + vim.keymap.set("n", "", builtin.oldfiles, {}) + vim.keymap.set("n", "z=", function() + builtin.spell_suggest(require("telescope.themes").get_cursor({})) + end, {}) + require("telescope").load_extension("ui-select") + require("telescope").load_extension("noice") + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..d722213 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,14 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + local config = require("nvim-treesitter.configs") + config.setup({ + auto_install = true, + highlight = { enable = true }, + indent = { enable = true }, + }) + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/trouble.lua b/nvim/.config/nvim/lua/plugins/trouble.lua new file mode 100644 index 0000000..d6e434f --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/trouble.lua @@ -0,0 +1,39 @@ +return { +{ + "folke/trouble.nvim", + opts = {}, -- for default options, refer to the configuration section for custom setup. + cmd = "Trouble", + keys = { + { + "xx", + "Trouble diagnostics toggle", + desc = "Diagnostics (Trouble)", + }, + { + "xX", + "Trouble diagnostics toggle filter.buf=0", + desc = "Buffer Diagnostics (Trouble)", + }, + { + "cs", + "Trouble symbols toggle focus=false", + desc = "Symbols (Trouble)", + }, + { + "cl", + "Trouble lsp toggle focus=false win.position=right", + desc = "LSP Definitions / references / ... (Trouble)", + }, + { + "xL", + "Trouble loclist toggle", + desc = "Location List (Trouble)", + }, + { + "xQ", + "Trouble qflist toggle", + desc = "Quickfix List (Trouble)", + }, + }, +} +} diff --git a/nvim/.config/nvim/lua/plugins/vim-test.lua b/nvim/.config/nvim/lua/plugins/vim-test.lua new file mode 100644 index 0000000..500e95c --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/vim-test.lua @@ -0,0 +1,14 @@ +return { + "vim-test/vim-test", + dependencies = { + "preservim/vimux" + }, + config = function() + vim.keymap.set("n", "t", ":TestNearest", {}) + vim.keymap.set("n", "T", ":TestFile", {}) + vim.keymap.set("n", "a", ":TestSuite", {}) + vim.keymap.set("n", "l", ":TestLast", {}) + vim.keymap.set("n", "g", ":TestVisit", {}) + vim.cmd("let test#strategy = 'vimux'") + end, +} diff --git a/nvim/.config/nvim/lua/plugins/which-key.lua b/nvim/.config/nvim/lua/plugins/which-key.lua new file mode 100644 index 0000000..84dd848 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/which-key.lua @@ -0,0 +1,20 @@ +return { + { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Local Keymaps (which-key)", + }, + }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/yazi-nvim.lua b/nvim/.config/nvim/lua/plugins/yazi-nvim.lua new file mode 100644 index 0000000..998b9da --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/yazi-nvim.lua @@ -0,0 +1,35 @@ +return { + { + "mikavilpas/yazi.nvim", + event = "VeryLazy", + keys = { + -- 👇 in this section, choose your own keymappings! + { + "-", + "Yazi", + desc = "Open yazi at the current file", + }, + { + -- Open in the current working directory + "cw", + "Yazi cwd", + desc = "Open the file manager in nvim's working directory", + }, + { + -- NOTE: this requires a version of yazi that includes + -- https://github.com/sxyazi/yazi/pull/1305 from 2024-07-18 + "", + "Yazi toggle", + desc = "Resume the last yazi session", + }, + }, + ---@type YaziConfig + opts = { + -- if you want to open yazi instead of netrw, see below for more info + open_for_directories = false, + keymaps = { + show_help = "", + }, + }, + }, +} diff --git a/nvim/.config/nvim/lua/vim-options.lua b/nvim/.config/nvim/lua/vim-options.lua new file mode 100644 index 0000000..a94a27b --- /dev/null +++ b/nvim/.config/nvim/lua/vim-options.lua @@ -0,0 +1,18 @@ +vim.cmd("set expandtab") +vim.cmd("set tabstop=2") +vim.cmd("set softtabstop=2") +vim.cmd("set shiftwidth=2") +vim.g.mapleader = " " +vim.g.background = "light" + +vim.opt.swapfile = false + +-- Navigate vim panes better +vim.keymap.set('n', '', ':wincmd k') +vim.keymap.set('n', '', ':wincmd j') +vim.keymap.set('n', '', ':wincmd h') +vim.keymap.set('n', '', ':wincmd l') + +vim.keymap.set('n', 'h', ':nohlsearch') +vim.wo.number = true + diff --git a/ohmyposh/.config/ohmyposh/zen.toml b/ohmyposh/.config/ohmyposh/zen.toml new file mode 100644 index 0000000..bbe222a --- /dev/null +++ b/ohmyposh/.config/ohmyposh/zen.toml @@ -0,0 +1,80 @@ +console_title_template = '{{ .Shell }} in {{ .Folder }}' +version = 3 +final_space = true + +[secondary_prompt] + template = '❯❯ ' + foreground = 'magenta' + background = 'transparent' + +[transient_prompt] + template = '❯ ' + background = 'transparent' + foreground_templates = ['{{if gt .Code 0}}red{{end}}', '{{if eq .Code 0}}magenta{{end}}'] + +[[blocks]] + type = 'prompt' + alignment = 'left' + newline = true + + [[blocks.segments]] + template = '{{ .Path }}' + foreground = 'blue' + background = 'transparent' + type = 'path' + style = 'plain' + + [blocks.segments.properties] + cache_duration = 'none' + style = 'full' + + [[blocks.segments]] + template = ' {{ .HEAD }}{{ if or (.Working.Changed) (.Staging.Changed) }}*{{ end }} {{ if gt .Behind 0 }}⇣{{ end }}{{ if gt .Ahead 0 }}⇡{{ end }}' + foreground = 'yellow' + background = 'transparent' + type = 'git' + style = 'plain' + + [blocks.segments.properties] + branch_icon = '' + cache_duration = 'none' + commit_icon = '@' + fetch_status = true + +[[blocks]] + type = 'rprompt' + overflow = 'hidden' + + [[blocks.segments]] + template = '{{ .FormattedMs }}' + foreground = 'yellow' + background = 'transparent' + type = 'executiontime' + style = 'plain' + + [blocks.segments.properties] + cache_duration = 'none' + threshold = 5000 + + [[blocks.segments]] + type = "python" + style = "powerline" + powerline_symbol = "" + foreground = "cyan" + background = "transparent" + template = "  {{ .Full }} " + +[[blocks]] + type = 'prompt' + alignment = 'left' + newline = true + + [[blocks.segments]] + template = '❯' + background = 'transparent' + type = 'text' + style = 'plain' + foreground_templates = ['{{if gt .Code 0}}red{{end}}', '{{if eq .Code 0}}magenta{{end}}'] + + [blocks.segments.properties] + cache_duration = 'none' diff --git a/scripts/scripts/bluelight.sh b/scripts/scripts/bluelight.sh new file mode 100755 index 0000000..6341a3d --- /dev/null +++ b/scripts/scripts/bluelight.sh @@ -0,0 +1,87 @@ +#!/bin/bash + +SHADER_DIR="$HOME/.config/hypr/shaders" +SHADER_FILE="$SHADER_DIR/brightness.frag" + +# Ensure shader directory exists +mkdir -p "$SHADER_DIR" + +# Get screen brightness level +echo "Enter screen brightness level (0-10, where 10 = 100%):" +read -r LEVEL + +# Validate input +if ! [[ "$LEVEL" =~ ^[0-9]+$ ]] || [ "$LEVEL" -lt 0 ] || [ "$LEVEL" -gt 10 ]; then + echo "Invalid input. Please enter a number between 0 and 10." + exit 1 +fi + +# Convert to decimal (0-10 -> 0.0-1.0) +BRIGHTNESS=$(echo "scale=2; $LEVEL / 10" | bc) + +# Ask about keyboard backlight +echo "Adjust keyboard backlight? (y/n):" +read -r KBD_ADJUST + +if [[ "$KBD_ADJUST" == "y" || "$KBD_ADJUST" == "Y" ]]; then + echo "Enter keyboard backlight level (0-10, where 10 = 100%):" + read -r KBD_LEVEL + + # Validate keyboard input + if ! [[ "$KBD_LEVEL" =~ ^[0-9]+$ ]] || [ "$KBD_LEVEL" -lt 0 ] || [ "$KBD_LEVEL" -gt 10 ]; then + echo "Invalid input. Please enter a number between 0 and 10." + exit 1 + fi + + # Convert to percentage (0-10 -> 0-100) + KBD_PERCENT=$((KBD_LEVEL * 10)) + + # Set keyboard backlight + kbdlight set $KBD_PERCENT + echo "Keyboard backlight set to ${KBD_PERCENT}%" +fi + +# Ask about blue light filter +echo "Apply blue light filter? (y/n):" +read -r BLUELIGHT + +# Create shader based on choice +cat > "$SHADER_FILE" << EOF +#version 300 es + +precision mediump float; + +in vec2 v_texcoord; +out vec4 fragColor; +uniform sampler2D tex; + +void main() { + vec4 pixColor = texture(tex, v_texcoord); + +EOF + +if [[ "$BLUELIGHT" == "y" || "$BLUELIGHT" == "Y" ]]; then + cat >> "$SHADER_FILE" << EOF + // Reduce blue light + pixColor.r *= 1.0; + pixColor.g *= 0.85; + pixColor.b *= 0.65; + +EOF +fi + +cat >> "$SHADER_FILE" << EOF + // Adjust brightness + pixColor.rgb *= $BRIGHTNESS; + + fragColor = pixColor; +} +EOF + +# Apply shader +if [ -z "$HYPRLAND_INSTANCE_SIGNATURE" ]; then + export HYPRLAND_INSTANCE_SIGNATURE=$(ls -t /tmp/hypr/ 2>/dev/null | head -n1) +fi +/usr/bin/hyprctl keyword decoration:screen_shader "$SHADER_FILE" + +echo "Screen brightness set to ${LEVEL}0% $([ "$BLUELIGHT" == "y" ] || [ "$BLUELIGHT" == "Y" ] && echo "with blue light filter")" diff --git a/scripts/scripts/borg-backup.sh b/scripts/scripts/borg-backup.sh new file mode 100755 index 0000000..5f7f4d5 --- /dev/null +++ b/scripts/scripts/borg-backup.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +SOURCE_DIRS=("/home/liph/Documents" "/home/liph/Pictures" "/home/liph/Downloads") +REPO_DIR="/home/liph/borg-repo" +BORG_PASSPHRASE="1ChagearC" + +export BORG_PASSPHRASE + +for SOURCE_DIR in "${SOURCE_DIRS[@]}"; do + ARCHIVE_NAME="{hostname}-{user}-{now}" + + echo "Starting backup of ${SOURCE_DIR}..." + borg create --stats --progress \ + "${REPO_DIR}::${ARCHIVE_NAME}" \ + "${SOURCE_DIR}" + + if [ $? -eq 0 ]; then + echo "Backup of ${SOURCE_DIR} completed successfully!" + else + echo "Backup of ${SOURCE_DIR} failed!" + fi +done + +echo "Pruning old backups..." +borg prune --stats --progress \ + --keep-daily=7 \ + --keep-weekly=4 \ + --keep-monthly=6 \ + "${REPO_DIR}" + +echo "Backup and pruning completed!" + diff --git a/scripts/scripts/borg-mac.sh b/scripts/scripts/borg-mac.sh new file mode 100755 index 0000000..5175778 --- /dev/null +++ b/scripts/scripts/borg-mac.sh @@ -0,0 +1,95 @@ +#!/bin/sh + +# Setting this, so the repo does not need to be given on the commandline: +# export BORG_REPO=ssh://username@example.com:2022/~/backup/main +#export BORG_REPO=~/backup/ + +# See the section "Passphrase notes" for more infos. +#export BORG_PASSPHRASE='1ChagearC' + +export BORG_REPO="ssh://100.121.203.110:2222/./repo/borg-repo" +export BORG_PASSPHRASE="1ChagearC" # Encryption key +BACKUP_SOURCES=( + "/home/liph/Downloads/" + "/home/liph/dotfiles/" + "/home/liph/scripts" +) # What to back up +BACKUP_NAME="laptop-$(date +%Y-%m-%d)" # Dynamic backup name + +# some helpers and error handling: +info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; } +trap 'echo $( date ) Backup interrupted >&2; exit 2' INT TERM + +info "Starting backup" + +# Initialize Borg repo (if not exists) +borg init --encryption=repokey "$BORG_REPO" 2>/dev/null || true + +# Backup the most important directories into an archive named after +# the machine this script is currently running on: + +borg create \ + --verbose \ + --filter AME \ + --list \ + --stats \ + --show-rc \ + --progress \ + --compression lz4 \ + --exclude-caches \ + --exclude 'home/*/.cache/*' \ + --exclude 'var/tmp/*' \ + "$BORG_REPO::$BACKUP_NAME" \ + "${BACKUP_SOURCES[@]}" \ +# ::'{hostname}-{user}-{now}' \ +# /home/liph/Documents/ \ +# /home/liph/Pictures/ \ +# /home/liph/Downloads/ +# /etc \ +# /home \ +# /root \ +# /var +backup_exit=$? + +info "Pruning repository" + +# Use the `prune` subcommand to maintain 7 daily, 4 weekly and 6 monthly +# archives of THIS machine. The '{hostname}-*' matching is very important to +# limit prune's operation to this machine's archives and not apply to +# other machines' archives also: + +borg prune \ + --list \ + --glob-archives '{hostname}-*' \ + --show-rc \ + --keep-daily 7 \ + --keep-weekly 4 \ + --keep-monthly 6 + "$BORG_REPO" + +prune_exit=$? + +# actually free repo disk space by compacting segments + +info "Compacting repository" + +borg compact + +compact_exit=$? + +# use highest exit code as global exit code +global_exit=$(( backup_exit > prune_exit ? backup_exit : prune_exit )) +global_exit=$(( compact_exit > global_exit ? compact_exit : global_exit )) + +if [ ${global_exit} -eq 0 ]; then + info "Backup, Prune, and Compact finished successfully" +elif [ ${global_exit} -eq 1 ]; then + info "Backup, Prune, and/or Compact finished with warnings" +else + info "Backup, Prune, and/or Compact finished with errors" +fi + +exit ${global_exit} + +# Check backup integrity +borg check "$BORG_REPO" diff --git a/scripts/scripts/borg-server.sh b/scripts/scripts/borg-server.sh new file mode 100644 index 0000000..7b623ff --- /dev/null +++ b/scripts/scripts/borg-server.sh @@ -0,0 +1,95 @@ +#!/bin/sh + +# Setting this, so the repo does not need to be given on the commandline: +# export BORG_REPO=ssh://username@example.com:2022/~/backup/main +#export BORG_REPO=~/backup/ + +# See the section "Passphrase notes" for more infos. +#export BORG_PASSPHRASE='1ChagearC' + +export BORG_REPO="ssh://100.121.203.110:2222/./repo/borg-repo" +export BORG_PASSPHRASE="1ChagearC" # Encryption key +BACKUP_SOURCES=( + "/home/liph/Documents" + "/home/liph/Pictures" + "/home/liph/scripts" +) # What to back up +BACKUP_NAME="server-$(date +%Y-%m-%d)" # Dynamic backup name + +# some helpers and error handling: +info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; } +trap 'echo $( date ) Backup interrupted >&2; exit 2' INT TERM + +info "Starting backup" + +# Initialize Borg repo (if not exists) +borg init --encryption=repokey "$BORG_REPO" 2>/dev/null || true + +# Backup the most important directories into an archive named after +# the machine this script is currently running on: + +borg create \ + --verbose \ + --filter AME \ + --list \ + --stats \ + --show-rc \ + --progress \ + --compression lz4 \ + --exclude-caches \ + --exclude 'home/*/.cache/*' \ + --exclude 'var/tmp/*' \ + "$BORG_REPO::$BACKUP_NAME" \ + "${BACKUP_SOURCES[@]}" \ +# ::'{hostname}-{user}-{now}' \ +# /home/liph/Documents/ \ +# /home/liph/Pictures/ \ +# /home/liph/Downloads/ +# /etc \ +# /home \ +# /root \ +# /var +backup_exit=$? + +info "Pruning repository" + +# Use the `prune` subcommand to maintain 7 daily, 4 weekly and 6 monthly +# archives of THIS machine. The '{hostname}-*' matching is very important to +# limit prune's operation to this machine's archives and not apply to +# other machines' archives also: + +borg prune \ + --list \ + --glob-archives '{hostname}-*' \ + --show-rc \ + --keep-daily 7 \ + --keep-weekly 4 \ + --keep-monthly 6 + "$BORG_REPO" + +prune_exit=$? + +# actually free repo disk space by compacting segments + +info "Compacting repository" + +borg compact + +compact_exit=$? + +# use highest exit code as global exit code +global_exit=$(( backup_exit > prune_exit ? backup_exit : prune_exit )) +global_exit=$(( compact_exit > global_exit ? compact_exit : global_exit )) + +if [ ${global_exit} -eq 0 ]; then + info "Backup, Prune, and Compact finished successfully" +elif [ ${global_exit} -eq 1 ]; then + info "Backup, Prune, and/or Compact finished with warnings" +else + info "Backup, Prune, and/or Compact finished with errors" +fi + +exit ${global_exit} + +# Check backup integrity +borg check "$BORG_REPO" diff --git a/scripts/scripts/borg.sh b/scripts/scripts/borg.sh new file mode 100755 index 0000000..b6ea062 --- /dev/null +++ b/scripts/scripts/borg.sh @@ -0,0 +1,95 @@ +#!/bin/sh + +# Setting this, so the repo does not need to be given on the commandline: +# export BORG_REPO=ssh://username@example.com:2022/~/backup/main +#export BORG_REPO=~/backup/ + +# See the section "Passphrase notes" for more infos. +#export BORG_PASSPHRASE='1ChagearC' + +export BORG_REPO="ssh://100.121.203.110:2222/./repo/borg-repo" +export BORG_PASSPHRASE="1ChagearC" # Encryption key +BACKUP_SOURCES=( + "/home/liph/Documents" + "/home/liph/Pictures" + "/home/liph/scripts" +) # What to back up +BACKUP_NAME="laptop-$(date +%Y-%m-%d)" # Dynamic backup name + +# some helpers and error handling: +info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; } +trap 'echo $( date ) Backup interrupted >&2; exit 2' INT TERM + +info "Starting backup" + +# Initialize Borg repo (if not exists) +borg init --encryption=repokey "$BORG_REPO" 2>/dev/null || true + +# Backup the most important directories into an archive named after +# the machine this script is currently running on: + +borg create \ + --verbose \ + --filter AME \ + --list \ + --stats \ + --show-rc \ + --progress \ + --compression lz4 \ + --exclude-caches \ + --exclude 'home/*/.cache/*' \ + --exclude 'var/tmp/*' \ + "$BORG_REPO::$BACKUP_NAME" \ + "${BACKUP_SOURCES[@]}" \ +# ::'{hostname}-{user}-{now}' \ +# /home/liph/Documents/ \ +# /home/liph/Pictures/ \ +# /home/liph/Downloads/ +# /etc \ +# /home \ +# /root \ +# /var +backup_exit=$? + +info "Pruning repository" + +# Use the `prune` subcommand to maintain 7 daily, 4 weekly and 6 monthly +# archives of THIS machine. The '{hostname}-*' matching is very important to +# limit prune's operation to this machine's archives and not apply to +# other machines' archives also: + +borg prune \ + --list \ + --glob-archives '{hostname}-*' \ + --show-rc \ + --keep-daily 7 \ + --keep-weekly 4 \ + --keep-monthly 6 + "$BORG_REPO" + +prune_exit=$? + +# actually free repo disk space by compacting segments + +info "Compacting repository" + +borg compact + +compact_exit=$? + +# use highest exit code as global exit code +global_exit=$(( backup_exit > prune_exit ? backup_exit : prune_exit )) +global_exit=$(( compact_exit > global_exit ? compact_exit : global_exit )) + +if [ ${global_exit} -eq 0 ]; then + info "Backup, Prune, and Compact finished successfully" +elif [ ${global_exit} -eq 1 ]; then + info "Backup, Prune, and/or Compact finished with warnings" +else + info "Backup, Prune, and/or Compact finished with errors" +fi + +exit ${global_exit} + +# Check backup integrity +borg check "$BORG_REPO" diff --git a/scripts/scripts/br_blue.sh b/scripts/scripts/br_blue.sh new file mode 100755 index 0000000..4f42411 --- /dev/null +++ b/scripts/scripts/br_blue.sh @@ -0,0 +1,74 @@ +#!/bin/bash + +# Path to the brightness shader file +SHADER_DIR="$HOME/.config/hypr/shaders" +SHADER_FILE="$SHADER_DIR/brightness.frag" + +# Ensure shader directory exists +mkdir -p "$SHADER_DIR" + +# Check if shader file exists, if not create with default values +if [ ! -f "$SHADER_FILE" ]; then + CURRENT_BRIGHTNESS=1.0 + BLUELIGHT_ENABLED=false +else + # Get current brightness multiplier + CURRENT_BRIGHTNESS=$(grep -oP 'pixColor.rgb \*= \K[0-9.]+' "$SHADER_FILE" | tail -1) + + # Check current state by looking at the blue channel multiplier + if grep -q "pixColor.b \*= 0.6" "$SHADER_FILE"; then + BLUELIGHT_ENABLED=true + else + BLUELIGHT_ENABLED=false + fi +fi + +# Toggle the blue light filter state +if [ "$BLUELIGHT_ENABLED" = true ]; then + # Filter is ON, turn it OFF + NEW_STATE=false + echo "Blue light filter: OFF" +else + # Filter is OFF, turn it ON + NEW_STATE=true + echo "Blue light filter: ON" +fi + +# Recreate the shader file +cat > "$SHADER_FILE" << EOF +#version 300 es + +precision mediump float; + +in vec2 v_texcoord; +out vec4 fragColor; +uniform sampler2D tex; + +void main() { + vec4 pixColor = texture(tex, v_texcoord); + +EOF + +if [ "$NEW_STATE" = true ]; then + cat >> "$SHADER_FILE" << EOF + // Reduce blue light + pixColor.r *= 1.0; + pixColor.g *= 0.85; + pixColor.b *= 0.6; + +EOF +fi + +cat >> "$SHADER_FILE" << EOF + // Adjust brightness + pixColor.rgb *= $CURRENT_BRIGHTNESS; + + fragColor = pixColor; +} +EOF + +# Apply shader +if [ -z "$HYPRLAND_INSTANCE_SIGNATURE" ]; then + export HYPRLAND_INSTANCE_SIGNATURE=$(ls -t /tmp/hypr/ 2>/dev/null | head -n1) +fi +/usr/bin/hyprctl keyword decoration:screen_shader "$SHADER_FILE" diff --git a/scripts/scripts/br_down.sh b/scripts/scripts/br_down.sh new file mode 100755 index 0000000..19de79a --- /dev/null +++ b/scripts/scripts/br_down.sh @@ -0,0 +1,74 @@ +#!/bin/bash + +# Path to the brightness shader file +SHADER_DIR="$HOME/.config/hypr/shaders" +SHADER_FILE="$SHADER_DIR/brightness.frag" + +# Ensure shader directory exists +mkdir -p "$SHADER_DIR" + +# Check if shader file exists, if not create with default brightness +if [ ! -f "$SHADER_FILE" ]; then + CURRENT=1.0 +else + # Get current brightness multiplier + CURRENT=$(grep -oP 'pixColor.rgb \*= \K[0-9.]+' "$SHADER_FILE" | tail -1) +fi + +# Calculate new brightness (decrease by 10%) +NEW=$(echo "$CURRENT * 0.90" | bc -l) + +# Cap at 0.1 to prevent complete darkness +if (( $(echo "$NEW < 0.1" | bc -l) )); then + NEW=0.1 +fi + +# Format to 2 decimal places +NEW=$(printf "%.2f" "$NEW") + +# Check if blue light filter is currently enabled +BLUELIGHT_ENABLED=false +if [ -f "$SHADER_FILE" ] && grep -q "pixColor.b \*= 0.6" "$SHADER_FILE"; then + BLUELIGHT_ENABLED=true +fi + +# Recreate the shader file +cat > "$SHADER_FILE" << EOF +#version 300 es + +precision mediump float; + +in vec2 v_texcoord; +out vec4 fragColor; +uniform sampler2D tex; + +void main() { + vec4 pixColor = texture(tex, v_texcoord); + +EOF + +if [ "$BLUELIGHT_ENABLED" = true ]; then + cat >> "$SHADER_FILE" << EOF + // Reduce blue light + pixColor.r *= 1.0; + pixColor.g *= 0.85; + pixColor.b *= 0.6; + +EOF +fi + +cat >> "$SHADER_FILE" << EOF + // Adjust brightness + pixColor.rgb *= $NEW; + + fragColor = pixColor; +} +EOF + +# Apply shader +if [ -z "$HYPRLAND_INSTANCE_SIGNATURE" ]; then + export HYPRLAND_INSTANCE_SIGNATURE=$(ls -t /tmp/hypr/ 2>/dev/null | head -n1) +fi +/usr/bin/hyprctl keyword decoration:screen_shader "$SHADER_FILE" + +echo "Brightness decreased from $CURRENT to $NEW" diff --git a/scripts/scripts/br_reset.sh b/scripts/scripts/br_reset.sh new file mode 100755 index 0000000..f8c4d30 --- /dev/null +++ b/scripts/scripts/br_reset.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# Path to the brightness shader file +SHADER_DIR="$HOME/.config/hypr/shaders" +SHADER_FILE="$SHADER_DIR/brightness.frag" + +# Ensure shader directory exists +mkdir -p "$SHADER_DIR" + +# Create shader file with 100% brightness and no blue light filter +cat > "$SHADER_FILE" << EOF +#version 300 es + +precision mediump float; + +in vec2 v_texcoord; +out vec4 fragColor; +uniform sampler2D tex; + +void main() { + vec4 pixColor = texture(tex, v_texcoord); + + // Adjust brightness + pixColor.rgb *= 1.00; + + fragColor = pixColor; +} +EOF + +# Apply shader +if [ -z "$HYPRLAND_INSTANCE_SIGNATURE" ]; then + export HYPRLAND_INSTANCE_SIGNATURE=$(ls -t /tmp/hypr/ 2>/dev/null | head -n1) +fi +/usr/bin/hyprctl keyword decoration:screen_shader "$SHADER_FILE" + +echo "Screen reset: Brightness 100%, Blue light filter OFF" diff --git a/scripts/scripts/br_up.sh b/scripts/scripts/br_up.sh new file mode 100755 index 0000000..88f0800 --- /dev/null +++ b/scripts/scripts/br_up.sh @@ -0,0 +1,74 @@ +#!/bin/bash + +# Path to the brightness shader file +SHADER_DIR="$HOME/.config/hypr/shaders" +SHADER_FILE="$SHADER_DIR/brightness.frag" + +# Ensure shader directory exists +mkdir -p "$SHADER_DIR" + +# Check if shader file exists, if not create with default brightness +if [ ! -f "$SHADER_FILE" ]; then + CURRENT=1.0 +else + # Get current brightness multiplier + CURRENT=$(grep -oP 'pixColor.rgb \*= \K[0-9.]+' "$SHADER_FILE" | tail -1) +fi + +# Calculate new brightness (increase by 10%) +NEW=$(echo "$CURRENT * 1.10" | bc -l) + +# Cap at 2.0 to prevent excessive brightness +if (( $(echo "$NEW > 2.0" | bc -l) )); then + NEW=2.0 +fi + +# Format to 2 decimal places +NEW=$(printf "%.2f" "$NEW") + +# Check if blue light filter is currently enabled +BLUELIGHT_ENABLED=false +if [ -f "$SHADER_FILE" ] && grep -q "pixColor.b \*= 0.6" "$SHADER_FILE"; then + BLUELIGHT_ENABLED=true +fi + +# Recreate the shader file +cat > "$SHADER_FILE" << EOF +#version 300 es + +precision mediump float; + +in vec2 v_texcoord; +out vec4 fragColor; +uniform sampler2D tex; + +void main() { + vec4 pixColor = texture(tex, v_texcoord); + +EOF + +if [ "$BLUELIGHT_ENABLED" = true ]; then + cat >> "$SHADER_FILE" << EOF + // Reduce blue light + pixColor.r *= 1.0; + pixColor.g *= 0.85; + pixColor.b *= 0.6; + +EOF +fi + +cat >> "$SHADER_FILE" << EOF + // Adjust brightness + pixColor.rgb *= $NEW; + + fragColor = pixColor; +} +EOF + +# Apply shader +if [ -z "$HYPRLAND_INSTANCE_SIGNATURE" ]; then + export HYPRLAND_INSTANCE_SIGNATURE=$(ls -t /tmp/hypr/ 2>/dev/null | head -n1) +fi +/usr/bin/hyprctl keyword decoration:screen_shader "$SHADER_FILE" + +echo "Brightness increased from $CURRENT to $NEW" diff --git a/scripts/scripts/fzf-git.sh b/scripts/scripts/fzf-git.sh new file mode 100755 index 0000000..d360751 --- /dev/null +++ b/scripts/scripts/fzf-git.sh @@ -0,0 +1,310 @@ +# Fzf with Git in the shell +# You can find this whole script from Junegunn Github repo below +# https://github.com/junegunn/fzf-git.sh + +# Script is used in .zshrc + +# shellcheck disable=SC2039 +[[ $0 = - ]] && return + +__fzf_git_color() { + if [[ -n $NO_COLOR ]]; then + echo never + elif [[ $# -gt 0 ]] && [[ -n $FZF_GIT_PREVIEW_COLOR ]]; then + echo "$FZF_GIT_PREVIEW_COLOR" + else + echo "${FZF_GIT_COLOR:-always}" + fi +} + +__fzf_git_cat() { + if [[ -n $FZF_GIT_CAT ]]; then + echo "$FZF_GIT_CAT" + return + fi + + # Sometimes bat is installed as batcat + _fzf_git_bat_options="--style='${BAT_STYLE:-full}' --color=$(__fzf_git_color .) --pager=never" + if command -v batcat > /dev/null; then + echo "batcat $_fzf_git_bat_options" + elif command -v bat > /dev/null; then + echo "bat $_fzf_git_bat_options" + else + echo cat + fi +} + +if [[ $# -eq 1 ]]; then + branches() { + git branch "$@" --sort=-committerdate --sort=-HEAD --format=$'%(HEAD) %(color:yellow)%(refname:short) %(color:green)(%(committerdate:relative))\t%(color:blue)%(subject)%(color:reset)' --color=$(__fzf_git_color) | column -ts$'\t' + } + refs() { + git for-each-ref --sort=-creatordate --sort=-HEAD --color=$(__fzf_git_color) --format=$'%(refname) %(color:green)(%(creatordate:relative))\t%(color:blue)%(subject)%(color:reset)' | + eval "$1" | + sed 's#^refs/remotes/#\x1b[95mremote-branch\t\x1b[33m#; s#^refs/heads/#\x1b[92mbranch\t\x1b[33m#; s#^refs/tags/#\x1b[96mtag\t\x1b[33m#; s#refs/stash#\x1b[91mstash\t\x1b[33mrefs/stash#' | + column -ts$'\t' + } + hashes() { + git log --date=short --format="%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)" --graph --color=$(__fzf_git_color) "$@" + } + case "$1" in + branches) + echo $'CTRL-O (open in browser) ╱ ALT-A (show all branches)\n' + branches + ;; + all-branches) + echo $'CTRL-O (open in browser)\n' + branches -a + ;; + hashes) + echo $'CTRL-O (open in browser) ╱ CTRL-D (diff)\nCTRL-S (toggle sort) ╱ ALT-A (show all hashes)\n' + hashes + ;; + all-hashes) + echo $'CTRL-O (open in browser) ╱ CTRL-D (diff)\nCTRL-S (toggle sort)\n' + hashes --all + ;; + refs) + echo $'CTRL-O (open in browser) ╱ ALT-E (examine in editor) ╱ ALT-A (show all refs)\n' + refs 'grep -v ^refs/remotes' + ;; + all-refs) + echo $'CTRL-O (open in browser) ╱ ALT-E (examine in editor)\n' + refs 'cat' + ;; + nobeep) ;; + *) exit 1 ;; + esac +elif [[ $# -gt 1 ]]; then + set -e + + branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null) + if [[ $branch = HEAD ]]; then + branch=$(git describe --exact-match --tags 2> /dev/null || git rev-parse --short HEAD) + fi + + # Only supports GitHub for now + case "$1" in + commit) + hash=$(grep -o "[a-f0-9]\{7,\}" <<< "$2") + path=/commit/$hash + ;; + branch|remote-branch) + branch=$(sed 's/^[* ]*//' <<< "$2" | cut -d' ' -f1) + remote=$(git config branch."${branch}".remote || echo 'origin') + branch=${branch#$remote/} + path=/tree/$branch + ;; + remote) + remote=$2 + path=/tree/$branch + ;; + file) path=/blob/$branch/$(git rev-parse --show-prefix)$2 ;; + tag) path=/releases/tag/$2 ;; + *) exit 1 ;; + esac + + remote=${remote:-$(git config branch."${branch}".remote || echo 'origin')} + remote_url=$(git remote get-url "$remote" 2> /dev/null || echo "$remote") + + if [[ $remote_url =~ ^git@ ]]; then + url=${remote_url%.git} + url=${url#git@} + url=https://${url/://} + elif [[ $remote_url =~ ^http ]]; then + url=${remote_url%.git} + fi + + case "$(uname -s)" in + Darwin) open "$url$path" ;; + *) xdg-open "$url$path" ;; + esac + exit 0 +fi + +if [[ $- =~ i ]]; then +# ----------------------------------------------------------------------------- + +# Redefine this function to change the options +_fzf_git_fzf() { + fzf-tmux -p80%,60% -- \ + --layout=reverse --multi --height=50% --min-height=20 --border \ + --border-label-pos=2 \ + --color='header:italic:underline,label:blue' \ + --preview-window='right,50%,border-left' \ + --bind='ctrl-/:change-preview-window(down,50%,border-top|hidden|)' "$@" +} + +_fzf_git_check() { + git rev-parse HEAD > /dev/null 2>&1 && return + + [[ -n $TMUX ]] && tmux display-message "Not in a git repository" + return 1 +} + +__fzf_git=${BASH_SOURCE[0]:-${(%):-%x}} +__fzf_git=$(readlink -f "$__fzf_git" 2> /dev/null || /usr/bin/ruby --disable-gems -e 'puts File.expand_path(ARGV.first)' "$__fzf_git" 2> /dev/null) + +_fzf_git_files() { + _fzf_git_check || return + local root query + root=$(git rev-parse --show-toplevel) + [[ $root != "$PWD" ]] && query='!../ ' + + (git -c color.status=$(__fzf_git_color) status --short --no-branch + git ls-files "$root" | grep -vxFf <(git status -s | grep '^[^?]' | cut -c4-; echo :) | sed 's/^/ /') | + _fzf_git_fzf -m --ansi --nth 2..,.. \ + --border-label '📁 Files' \ + --header $'CTRL-O (open in browser) ╱ ALT-E (open in editor)\n\n' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git file {-1}" \ + --bind "alt-e:execute:${EDITOR:-vim} {-1} > /dev/tty" \ + --query "$query" \ + --preview "git diff --no-ext-diff --color=$(__fzf_git_color .) -- {-1} | sed 1,4d; $(__fzf_git_cat) {-1}" "$@" | + cut -c4- | sed 's/.* -> //' +} + +_fzf_git_branches() { + _fzf_git_check || return + bash "$__fzf_git" branches | + _fzf_git_fzf --ansi \ + --border-label '🌲 Branches' \ + --header-lines 2 \ + --tiebreak begin \ + --preview-window down,border-top,40% \ + --color hl:underline,hl+:underline \ + --no-hscroll \ + --bind 'ctrl-/:change-preview-window(down,70%|hidden|)' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git branch {}" \ + --bind "alt-a:change-border-label(🌳 All branches)+reload:bash \"$__fzf_git\" all-branches" \ + --preview "git log --oneline --graph --date=short --color=$(__fzf_git_color .) --pretty='format:%C(auto)%cd %h%d %s' \$(sed s/^..// <<< {} | cut -d' ' -f1) --" "$@" | + sed 's/^..//' | cut -d' ' -f1 +} + +_fzf_git_tags() { + _fzf_git_check || return + git tag --sort -version:refname | + _fzf_git_fzf --preview-window right,70% \ + --border-label '📛 Tags' \ + --header $'CTRL-O (open in browser)\n\n' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git tag {}" \ + --preview "git show --color=$(__fzf_git_color .) {}" "$@" +} + +_fzf_git_hashes() { + _fzf_git_check || return + bash "$__fzf_git" hashes | + _fzf_git_fzf --ansi --no-sort --bind 'ctrl-s:toggle-sort' \ + --border-label '🍡 Hashes' \ + --header-lines 3 \ + --bind "ctrl-o:execute-silent:bash $__fzf_git commit {}" \ + --bind "ctrl-d:execute:grep -o '[a-f0-9]\{7,\}' <<< {} | head -n 1 | xargs git diff --color=$(__fzf_git_color) > /dev/tty" \ + --bind "alt-a:change-border-label(🍇 All hashes)+reload:bash \"$__fzf_git\" all-hashes" \ + --color hl:underline,hl+:underline \ + --preview "grep -o '[a-f0-9]\{7,\}' <<< {} | head -n 1 | xargs git show --color=$(__fzf_git_color .)" "$@" | + awk 'match($0, /[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]*/) { print substr($0, RSTART, RLENGTH) }' +} + +_fzf_git_remotes() { + _fzf_git_check || return + git remote -v | awk '{print $1 "\t" $2}' | uniq | + _fzf_git_fzf --tac \ + --border-label '📡 Remotes' \ + --header $'CTRL-O (open in browser)\n\n' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git remote {1}" \ + --preview-window right,70% \ + --preview "git log --oneline --graph --date=short --color=$(__fzf_git_color .) --pretty='format:%C(auto)%cd %h%d %s' '{1}/$(git rev-parse --abbrev-ref HEAD)' --" "$@" | + cut -d$'\t' -f1 +} + +_fzf_git_stashes() { + _fzf_git_check || return + git stash list | _fzf_git_fzf \ + --border-label '🥡 Stashes' \ + --header $'CTRL-X (drop stash)\n\n' \ + --bind 'ctrl-x:reload(git stash drop -q {1}; git stash list)' \ + -d: --preview "git show --color=$(__fzf_git_color .) {1}" "$@" | + cut -d: -f1 +} + +_fzf_git_lreflogs() { + _fzf_git_check || return + git reflog --color=$(__fzf_git_color) --format="%C(blue)%gD %C(yellow)%h%C(auto)%d %gs" | _fzf_git_fzf --ansi \ + --border-label '📒 Reflogs' \ + --preview "git show --color=$(__fzf_git_color .) {1}" "$@" | + awk '{print $1}' +} + +_fzf_git_each_ref() { + _fzf_git_check || return + bash "$__fzf_git" refs | _fzf_git_fzf --ansi \ + --nth 2,2.. \ + --tiebreak begin \ + --border-label '☘️ Each ref' \ + --header-lines 2 \ + --preview-window down,border-top,40% \ + --color hl:underline,hl+:underline \ + --no-hscroll \ + --bind 'ctrl-/:change-preview-window(down,70%|hidden|)' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git {1} {2}" \ + --bind "alt-e:execute:${EDITOR:-vim} <(git show {2}) > /dev/tty" \ + --bind "alt-a:change-border-label(🍀 Every ref)+reload:bash \"$__fzf_git\" all-refs" \ + --preview "git log --oneline --graph --date=short --color=$(__fzf_git_color .) --pretty='format:%C(auto)%cd %h%d %s' {2} --" "$@" | + awk '{print $2}' +} + +_fzf_git_worktrees() { + _fzf_git_check || return + git worktree list | _fzf_git_fzf \ + --border-label '🌴 Worktrees' \ + --header $'CTRL-X (remove worktree)\n\n' \ + --bind 'ctrl-x:reload(git worktree remove {1} > /dev/null; git worktree list)' \ + --preview " + git -c color.status=$(__fzf_git_color .) -C {1} status --short --branch + echo + git log --oneline --graph --date=short --color=$(__fzf_git_color .) --pretty='format:%C(auto)%cd %h%d %s' {2} -- + " "$@" | + awk '{print $1}' +} + +if [[ -n "${BASH_VERSION:-}" ]]; then + __fzf_git_init() { + bind -m emacs-standard '"\er": redraw-current-line' + bind -m emacs-standard '"\C-z": vi-editing-mode' + bind -m vi-command '"\C-z": emacs-editing-mode' + bind -m vi-insert '"\C-z": emacs-editing-mode' + + local o c + for o in "$@"; do + c=${o:0:1} + bind -m emacs-standard '"\C-g\C-'$c'": " \C-u \C-a\C-k`_fzf_git_'$o'`\e\C-e\C-y\C-a\C-y\ey\C-h\C-e\er \C-h"' + bind -m vi-command '"\C-g\C-'$c'": "\C-z\C-g\C-'$c'\C-z"' + bind -m vi-insert '"\C-g\C-'$c'": "\C-z\C-g\C-'$c'\C-z"' + bind -m emacs-standard '"\C-g'$c'": " \C-u \C-a\C-k`_fzf_git_'$o'`\e\C-e\C-y\C-a\C-y\ey\C-h\C-e\er \C-h"' + bind -m vi-command '"\C-g'$c'": "\C-z\C-g'$c'\C-z"' + bind -m vi-insert '"\C-g'$c'": "\C-z\C-g'$c'\C-z"' + done + } +elif [[ -n "${ZSH_VERSION:-}" ]]; then + __fzf_git_join() { + local item + while read item; do + echo -n "${(q)item} " + done + } + + __fzf_git_init() { + local m o + for o in "$@"; do + eval "fzf-git-$o-widget() { local result=\$(_fzf_git_$o | __fzf_git_join); zle reset-prompt; LBUFFER+=\$result }" + eval "zle -N fzf-git-$o-widget" + for m in emacs vicmd viins; do + eval "bindkey -M $m '^g^${o[1]}' fzf-git-$o-widget" + eval "bindkey -M $m '^g${o[1]}' fzf-git-$o-widget" + done + done + } +fi +__fzf_git_init files branches tags remotes hashes stashes lreflogs each_ref worktrees + +# ----------------------------------------------------------------------------- +fi diff --git a/scripts/scripts/fzf_listoldfiles.sh b/scripts/scripts/fzf_listoldfiles.sh new file mode 100755 index 0000000..0b5ffed --- /dev/null +++ b/scripts/scripts/fzf_listoldfiles.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Script to list recent files and open nvim using fzf +# set to an alias nlof in .zshrc + +list_oldfiles() { + # Get the oldfiles list from Neovim + local oldfiles=($(nvim -u NONE --headless +'lua io.write(table.concat(vim.v.oldfiles, "\n") .. "\n")' +qa)) + # Filter invalid paths or files not found + local valid_files=() + for file in "${oldfiles[@]}"; do + if [[ -f "$file" ]]; then + valid_files+=("$file") + fi + done + # Use fzf to select from valid files + local files=($(printf "%s\n" "${valid_files[@]}" | \ + grep -v '\[.*' | \ + fzf --multi \ + --preview 'bat -n --color=always --line-range=:500 {} 2>/dev/null || echo "Error previewing file"' \ + --height=70% \ + --layout=default)) + + # Open selected files in Neovim + [[ ${#files[@]} -gt 0 ]] && nvim "${files[@]}" +} + +# Call the function +list_oldfiles "$@" diff --git a/scripts/scripts/hydroxide.sh b/scripts/scripts/hydroxide.sh new file mode 100755 index 0000000..9bac7d5 --- /dev/null +++ b/scripts/scripts/hydroxide.sh @@ -0,0 +1,7 @@ +hydroxide serve & + +kanata --cfg ~/.config/kanata/config.kbd & + +sudo mount -a & + +syncthing & diff --git a/scripts/scripts/kanata.sh b/scripts/scripts/kanata.sh new file mode 100755 index 0000000..a6dcd61 --- /dev/null +++ b/scripts/scripts/kanata.sh @@ -0,0 +1 @@ +kanata --cfg ~/.config/kanata/config.kbd & diff --git a/scripts/scripts/keyboard-layer.sh b/scripts/scripts/keyboard-layer.sh new file mode 100755 index 0000000..f6874ed --- /dev/null +++ b/scripts/scripts/keyboard-layer.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# ~/.config/hypr/scripts/keyboard-layer.sh + +# This checks which modifiers are active as a proxy for layers +# Adjust based on your actual layer keys + +while true; do + # You might need to adjust this based on your keyboard + # This is a simplified example + echo '{"text": "Layer ?", "class": "layer"}' + sleep 0.5 +done diff --git a/scripts/scripts/layer_notify.sh b/scripts/scripts/layer_notify.sh new file mode 100755 index 0000000..5f0a3c0 --- /dev/null +++ b/scripts/scripts/layer_notify.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +case $1 in + 0) notify-send -t 1500 "Layer 0" "Base/QWERTY" ;; + 1) notify-send -t 1500 "Layer 1" "Navigation/Numbers" ;; + 2) notify-send -t 1500 "Layer 2" "Symbols" ;; + 3) notify-send -t 1500 "Layer 3" "Function Keys" ;; + *) notify-send -t 1500 "Unknown Layer" ;; +esac diff --git a/scripts/scripts/protonport.sh b/scripts/scripts/protonport.sh new file mode 100755 index 0000000..7f0d864 --- /dev/null +++ b/scripts/scripts/protonport.sh @@ -0,0 +1,89 @@ +#!/bin/bash + +# Configuration variables - change this for your setup +gluetun_container_name="gluetun" +qbittorrent_container_name="qbittorrent" +gluetun_origin="http://100.120.152.94:8888" +qb_origin="http://100.120.152.94:8099" +#################################################################### + +# Arrays for URLs +declare -A gluetun_urls=( + ["pub_ip"]="$gluetun_origin/v1/publicip/ip" + ["portforwarded"]="$gluetun_origin/v1/openvpn/portforwarded" +) + +declare -A qbittorrent_urls=( + #used for getting and setting listen_port + ["prefs"]="$qb_origin/api/v2/app/preferences" + ["setPrefs"]="$qb_origin/api/v2/app/setPreferences" +) + + +# Function to check if a Docker container is running +is_container_running() { + local container_name="$1" + docker inspect -f '{{.State.Running}}' "$container_name" 2>/dev/null + # echo "Container $container_name status: $status" +} + +get_vpn_external_ip() { + local url="$1" + curl -s "$url" | -r .'public_ip' +} + +# Function to send a GET request and extract the port from the response +get_port_from_url() { + local url="$1" + local port_key + + # Try 'port' key first + port_key=$(curl -s "$url" | jq -r '.port') + + if [ "$port_key" == "null" ]; then + # If 'port' key is null, try 'listen_port' key + port_key=$(curl -s "$url" | jq -r '.listen_port') + fi + + echo "$port_key" +} + +# Function to send a POST request with JSON data +send_post_request() { + local url="$1" + local port="$2" + curl -s -X POST -d json={\"listen_port\":$port} "$url" +} + +# Outputs container names +echo "Gluetun container name: $gluetun_container_name - Gluetun Origin URL: $gluetun_origin" +echo "qBittorrent container name: $qbittorrent_container_name - qBittorrent Origin URL: $qb_origin" + +# Check if both containers are running +if [[ $(is_container_running "$gluetun_container_name") == $(is_container_running "$qbittorrent_container_name") ]]; then + echo "Both Gluetun and qBittorrent containers are running. Continuing." + + external_ip=$(get_vpn_external_ip "${gluetun_urls["pub_ip"]}") + if [ -z "$external_ip" ]; then + echo "External IP is empty. Exiting script due to potential VPN or internet connection issue." + exit 1 + else + echo "External IP is $external_ip therefore VPN is up" + fi + + gluetun_port=$(get_port_from_url "${gluetun_urls["portforwarded"]}") + qbittorrent_port=$(get_port_from_url "${qbittorrent_urls["prefs"]}") + + echo "Gluetun forwarded port is $gluetun_port" + echo "qBittorrent listen port is $qbittorrent_port" + if [ "$gluetun_port" -eq "$qbittorrent_port" ]; then + echo "qBittorrent listen port is already set to $qbittorrent_port. No need to change. Exiting script." + else + echo "Updating qBittorrent listen port to Gluetun forwarded port $gluetun_port." + send_post_request "${qbittorrent_urls["setPrefs"]}" "$gluetun_port" + qbittorrent_port=$(get_port_from_url "${qbittorrent_urls["prefs"]}") + echo "qBittorrent listen port updated to $qbittorrent_port. Exiting script." + fi +else + echo "Either Gluetun or qBittorrent container is not running. Exiting script." +fi diff --git a/scripts/scripts/tidal-mcp.sh b/scripts/scripts/tidal-mcp.sh new file mode 100755 index 0000000..e94a51d --- /dev/null +++ b/scripts/scripts/tidal-mcp.sh @@ -0,0 +1,11 @@ +cd ~/mcp/tidal-mcp/ + +uv venv --clear +source .venv/bin/activate + +uv pip install --editable . + +cd ~/mcp/tidal-mcp/tidal_api/ +uv pip install flask tidalapi + +nohup python app.py > tidal.log 2>&1 & diff --git a/scripts/scripts/tidal.log b/scripts/scripts/tidal.log new file mode 100644 index 0000000..9b7c006 --- /dev/null +++ b/scripts/scripts/tidal.log @@ -0,0 +1,2 @@ +nohup: ignoring input +/usr/bin/python: can't open file '/home/liph/dotfiles/scripts/scripts/app.py': [Errno 2] No such file or directory diff --git a/scripts/scripts/tmux-sessionizer.sh b/scripts/scripts/tmux-sessionizer.sh new file mode 100755 index 0000000..e89f2fb --- /dev/null +++ b/scripts/scripts/tmux-sessionizer.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +# Save this file as ~/scripts/tmux-sessionizer +# Make it executable with: chmod +x ~/.local/bin/tmux-sessionizer + +if [[ $# -eq 1 ]]; then + selected=$1 +else + selected=$(fd -H . ~/dotfiles ~/Desktop/main-cs ~/Desktop/main-cs/Projects ~/ ~/Desktop/work ~/Desktop/work/youtube -t d -d 1 | fzf) +fi + +if [[ -z $selected ]]; then + exit 0 +fi + +selected_name=$(basename "$selected" | tr . _) +tmux_running=$(pgrep tmux) + +if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then + tmux new-session -s $selected_name -c $selected + exit 0 +fi + +if ! tmux has-session -t=$selected_name 2> /dev/null; then + tmux new-session -ds $selected_name -c $selected +fi + +tmux switch-client -t $selected_name diff --git a/scripts/scripts/zoxide_openfiles_nvim.sh b/scripts/scripts/zoxide_openfiles_nvim.sh new file mode 100755 index 0000000..3d177ed --- /dev/null +++ b/scripts/scripts/zoxide_openfiles_nvim.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Script to find every single file and opens in neovim +# alias set as nzo in .zshrc +search_with_zoxdie() { + if [ -z "$1" ]; then + # use fd with fzf to select & open a file when no arg are provided + file="$(fd --type f -I -H -E .git -E .git-crypt -E .cache -E .backup | fzf --height=70% --preview='bat -n --color=always --line-range :500 {}')" + if [ -n "$file" ]; then + nvim "$file" + fi + else + # Handle when an arg is provided + lines=$(zoxide query -l | xargs -I {} fd --type f -I -H -E .git -E .git-crypt -E .cache -E .backup -E .vscode "$1" {} | fzf --no-sort) # Initial filter attempt with fzf + line_count="$(echo "$lines" | wc -l | xargs)" # Trim any leading spaces + + if [ -n "$lines" ] && [ "$line_count" -eq 1 ]; then + # looks for the exact ones and opens it + file="$lines" + nvim "$file" + elif [ -n "$lines" ]; then + # If multiple files are found, allow further selection using fzf and bat for preview + file=$(echo "$lines" | fzf --query="$1" --height=70% --preview='bat -n --color=always --line-range :500 {}') + if [ -n "$file" ]; then + nvim "$file" + fi + else + echo "No matches found." >&2 + fi + fi +} + +search_with_zoxdie "$@" diff --git a/starship/.config/starship.toml b/starship/.config/starship.toml new file mode 100644 index 0000000..96c7f3e --- /dev/null +++ b/starship/.config/starship.toml @@ -0,0 +1,158 @@ +format = """ +$directory\ +$fill\ +$git_status\ +$python\ +$cmd_duration\ +$line_break\ +$character\ +$line_break""" + +#$git_branch\ +#$git_status\ +#$python\ +#$lua\ +#$nodejs\ +#$golang\ +#$haskell\ +#$rust\ +#$ruby\ +#$package\ +#$aws\ +#$docker_context\ +#$jobs\ + +add_newline = true +command_timeout = 1000 +palette = "catppuccin_mocha" + +[directory] +style = 'sky' +format = '[$path ]($style)' +truncation_length = 3 +read_only = " 󰌾" +truncation_symbol = '…/' +truncate_to_repo = false + +#[directory.substitutions] +#'Documents' = '󰈙' +#'Downloads' = ' ' +#'Music' = ' ' +#'Pictures' = ' ' + +[fill] +symbol = ' ' + +## Symbols +[c] +symbol = " " + +[cmake] +symbol = " " + +[conda] +symbol = " " + +[docker_context] +symbol = ' ' +style = 'fg:#06969A' +format = '[$symbol]($style) $path' +detect_files = ['docker-compose.yml', 'docker-compose.yaml', 'Dockerfile'] +detect_extensions = ['Dockerfile'] + +[git_branch] +symbol = " " + +[git_commit] +tag_symbol = '  ' + +[golang] +symbol = " " + +[haskell] +symbol = " " + +[hostname] +ssh_symbol = " " + +[java] +symbol = " " + +[lua] +symbol = " " + +[memory_usage] +symbol = "󰍛 " + +[nix_shell] +symbol = " " + +[nodejs] +symbol = " " + +[os.symbols] +Alpine = " " +Android = " " +Arch = " " +Artix = " " +Debian = " " +EndeavourOS = " " +Fedora = " " +Kali = " " +Linux = " " +Macos = " " +NixOS = " " +openSUSE = " " +Pop = " " +Ubuntu = " " +Unknown = " " +Windows = "󰍲 " + +[package] +symbol = "󰏗 " + +[php] +symbol = " " + +[pijul_channel] +symbol = " " + +[python] +symbol = " " + +[rlang] +symbol = "󰟔 " + +[ruby] +symbol = " " + +[rust] +symbol = "󱘗 " + +[palettes.catppuccin_mocha] +rosewater = "#f5e0dc" +flamingo = "#f2cdcd" +pink = "#f5c2e7" +mauve = "#cba6f7" +red = "#f38ba8" +maroon = "#eba0ac" +peach = "#fab387" +yellow = "#f9e2af" +green = "#a6e3a1" +teal = "#94e2d5" +sky = "#89dceb" +sapphire = "#74c7ec" +blue = "#89b4fa" +lavender = "#b4befe" +text = "#cdd6f4" +subtext1 = "#bac2de" +subtext0 = "#a6adc8" +overlay2 = "#9399b2" +overlay1 = "#7f849c" +overlay0 = "#6c7086" +surface2 = "#585b70" +surface1 = "#45475a" +surface0 = "#313244" +base = "#1e1e2e" +mantle = "#181825" +crust = "#11111b" diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf new file mode 100644 index 0000000..b3e65a1 --- /dev/null +++ b/tmux/.tmux.conf @@ -0,0 +1,117 @@ +unbind r + +bind -n M-H previous-window +bind -n M-L next-window + +set -g prefix C-s +set -g mouse on + +# Start windows and panes at 1, not 0 +set -g base-index 1 +set -g pane-base-index 1 +set-window-option -g pane-base-index 1 +set-option -g renumber-windows on + +set -g allow-passthrough on + +bind-key h select-pane -L +bind-key j select-pane -D +bind-key k select-pane -U +bind-key l select-pane -R + +# Configure Catppuccin +set -g @catppuccin_flavor "macchiato" +set -g @catppuccin_status_background "none" +set -g @catppuccin_window_status_style "none" +set -g @catppuccin_pane_status_enabled "off" +set -g @catppuccin_pane_border_status "off" + +# Configure Online +set -g @online_icon "ok" +set -g @offline_icon "nok" + +# status left look and feel +set -g status-left-length 100 +set -g status-left "" +set -ga status-left "#{?client_prefix,#{#[bg=#{@thm_red},fg=#{@thm_bg},bold]  #S },#{#[bg=#{@thm_bg},fg=#{@thm_green}]  #S }}" +set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_overlay_0},none]│" +set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_maroon}]  #{pane_current_command} " +set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_overlay_0},none]│" +set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_blue}]  #{=/-32/...:#{s|$USER|~|:#{b:pane_current_path}}} " +set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_overlay_0},none]#{?window_zoomed_flag,│,}" +set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_yellow}]#{?window_zoomed_flag,  zoom ,}" + +# status right look and feel +set -g status-right-length 100 +set -g status-right "" +set -ga status-right "#{?#{e|>=:10,#{battery_percentage}},#{#[bg=#{@thm_red},fg=#{@thm_bg}]},#{#[bg=#{@thm_bg},fg=#{@thm_pink}]}} #{battery_icon} #{battery_percentage} " +set -ga status-right "#[bg=#{@thm_bg},fg=#{@thm_overlay_0}, none]│" + +# Configure Tmux +set -g status-position top +set -g status-style "bg=#{@thm_bg}" +set -g status-justify "absolute-centre" + +# continuum +set -g @continuum-restore 'on' + +# pane border look and feel +setw -g pane-border-status top +setw -g pane-border-format "" +setw -g pane-active-border-style "bg=#{@thm_bg},fg=#{@thm_overlay_0}" +setw -g pane-border-style "bg=#{@thm_bg},fg=#{@thm_surface_0}" +setw -g pane-border-lines single + +# window look and feel +set -wg automatic-rename on +set -g automatic-rename-format "Window" + +set -g window-status-format " #I#{?#{!=:#{window_name},Window},: #W,} " +set -g window-status-style "bg=#{@thm_bg},fg=#{@thm_rosewater}" +set -g window-status-last-style "bg=#{@thm_bg},fg=#{@thm_peach}" +set -g window-status-activity-style "bg=#{@thm_red},fg=#{@thm_bg}" +set -g window-status-bell-style "bg=#{@thm_red},fg=#{@thm_bg},bold" +set -gF window-status-separator "#[bg=#{@thm_bg},fg=#{@thm_overlay_0}]│" + +set -g window-status-current-format " #I#{?#{!=:#{window_name},Window},: #W,} " +set -g window-status-current-style "bg=#{@thm_peach},fg=#{@thm_bg},bold" + +# set vi-mode +set-window-option -g mode-keys vi +# key binds +bind-key -T copy-mode-vi v send-keys -X begin-selection +bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle +bind-key -T copy-mode-vi y send-keys -X copy-selections-and-cancel + +## tmux in yazy +set -g allow-passthrough on +set -ga update-environment TERM +set -ga update-environment TERM_PROGRAM + +# List of plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'tmux-plugins/tmux-battery' +set -g @plugin 'catppuccin/tmux' +set -g @plugin 'christoomey/vim-tmux-navigator' +set -g @plugin 'tmux-plugins/tmux-yank' +set -g @plugin 'sainnhe/tmux-fzf' +set -g @plugin 'alexwforsythe/tmux-which-key' +set -g @plugin 'tmux-plugins/tmux-resurrect' +set -g @plugin 'tmux-plugins/tmux-continuum' + +# Other examples: +# set -g @plugin 'github_username/plugin_name' +# set -g @plugin 'github_username/plugin_name#branch' +# set -g @plugin 'git@github.com:user/plugin' +# set -g @plugin 'git@bitbucket.com:user/plugin' + +# tmux-fzf config +# Default value in tmux < 3.2 +TMUX_FZF_OPTIONS="-m" + +# Default value in tmux >= 3.2 +TMUX_FZF_OPTIONS="-p -w 100% -h 50% -m" + +# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) +run '~/.tmux/plugins/tpm/tpm' diff --git a/waybar/.config/waybar/config.jsonc b/waybar/.config/waybar/config.jsonc new file mode 100644 index 0000000..634b52f --- /dev/null +++ b/waybar/.config/waybar/config.jsonc @@ -0,0 +1,137 @@ +// -*- mode: jsonc -*- +{ + "layer": "top", + "position": "top", + "height": 30, + "spacing": 0, + "modules-left": [ + "custom/logo", + "cpu", + "memory", + "bluetooth", + "mpris" + ], + "modules-center": [ + "hyprland/workspaces" + ], + "modules-right": [ + "tray", + "power-profiles-daemon", + "hyprland/language", + "pulseaudio", + "network", + "battery", + "clock", + "custom/power" + ], + "mpris": { + "format": "DEFAULT: {player_icon} {dynamic}", + "format-paused": "DEFAULT: {status_icon} {dynamic}", + "player-icons": { + "default": "▶", + "mpv": "🎵" + }, + "status-icons": { + "paused": "⏸" + } + // "ignored-players": ["firefox"] + }, + "tray": { + "icon-size": 14, + "spacing": 10 + }, + "clock": { + "format": "{:%I:%M:%S %p}", + "tooltip-format": "{:%Y %B}\n{calendar}", + "format-alt": "{:%Y-%m-%d}", + "interval": 1 + }, + "cpu": { + "format": " {usage}%", + "tooltip": false, + "interval": 1 + }, + "memory": { + "format": " {}%", + "interval": 1 + }, + "battery": { + "interval": 1, + "states": { + // "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{icon} {capacity}%", + "format-full": "{icon} {capacity}%", + "format-charging": "󰂄 {capacity}%", + "format-plugged": "󰂄 {capacity}%", + "format-icons": [ + "󰁺", + "󰁼", + "󰁾", + "󰂀", + "󰂂" + ] + }, + "power-profiles-daemon": { + "format": "{icon}", + "tooltip-format": "Power profile: {profile}\nDriver: {driver}", + "tooltip": true, + "format-icons": { + "default": "", + "performance": "", + "balanced": "", + "power-saver": "" + } + }, + "network": { + "format-wifi": " ", + "format-ethernet": "󰈀", + "format-disconnected": "󰤭", + "format-alt": "{bandwidthDownBytes}", + "interval": 1 + }, + "pulseaudio": { + "format": "{icon} {volume}%", + "format-muted": "󰝟", + "format-source": "{volume}% ", + "format-source-muted": "", + "format-icons": { + "headphone": " ", + "hands-free": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": [ + "󰕿", + "󰖀", + "󰕾" + ] + }, + "on-click": "pavucontrol" + }, + "custom/power": { + "format": "⏻", + "tooltip": false, + "on-click": "wlogout" + }, + "custom/logo": { + "format": "󰣇", + "on-click": "wofi --show drun" + }, + "bluetooth": { + "format": "󰂯", + "format-disabled": "󰂲", + "format-connected": "󰂱", + "on-click": "blueman-manager" + }, + "custom/keyboard-layer": { + "exec": "~/scripts/keyboard-layer.sh", + "return-type": "json", + "interval": "once", + "format": "🎹 {}" + } + +} diff --git a/waybar/.config/waybar/config.jsonc.test b/waybar/.config/waybar/config.jsonc.test new file mode 100644 index 0000000..92c461e --- /dev/null +++ b/waybar/.config/waybar/config.jsonc.test @@ -0,0 +1,115 @@ +{ + "layer": "bottom", + "position": "top", + "height": 40, + "spacing": 2, + "exclusive": true, + "gtk-layer-shell": true, + "passthrough": false, + "fixed-center": true, + "modules-left": ["hyprland/workspaces", "hyprland/window"], + "modules-center": ["mpris"], + "modules-right": [ + "cpu", + "memory", + "pulseaudio", + "clock", + "clock#simpleclock", + "tray", + "custom/notification", + "custom/power", + ], + "custom/spotify": { + "format": " {}", + "return-type": "json", + "on-click": "playerctl -p spotify play-pause", + "on-click-right": "spotifatius toggle-liked", + "on-click-middle": "playerctl -p spotify next", + "exec": "spotifatius monitor", + }, + "mpris": { + "player": "spotify", + "dynamic-order": ["artist", "title"], + "format": "{player_icon} {dynamic}", + "format-paused": "{status_icon} {dynamic}", + "status-icons": { + "paused": "", + }, + "player-icons": { + "default": "", + }, + }, + "hyprland/workspaces": { + "on-click": "activate", + "format": "{id}", + "all-outputs": true, + "disable-scroll": false, + "active-only": false, + }, + "hyprland/window": { + "format": "{title}", + }, + "tray": { + "show-passive-items": true, + "spacing": 10, + }, + "clock#simpleclock": { + "tooltip": false, + "format": " {:%H:%M}", + }, + "clock": { + "format": " {:L%a %d %b}", + "calendar": { + "format": { + "days": "{}", + "months": "{}", + "today": "{}", + "weekdays": "{}", + "weeks": "W{}", + }, + "mode": "month", + "mode-mon-col": 1, + "on-scroll": 1, + }, + "tooltip-format": "{calendar}", + }, + "cpu": { + "format": " {usage}%", + "tooltip": true, + "interval": 1, + }, + "memory": { + "format": " {used:0.1f}Gi", + }, + "pulseaudio": { + "format": "{icon} {volume}%", + "format-muted": " muted", + "format-icons": { + "headphone": "", + "default": [" ", " ", " "], + }, + "on-click": "pavucontrol", + }, + "custom/sep": { + "format": "|", + "tooltip": false, + }, + "custom/power": { + "tooltip": false, + "on-click": "wlogout -p layer-shell &", + "format": "⏻", + }, + "custom/notification": { + "escape": true, + "exec": "swaync-client -swb", + "exec-if": "which swaync-client", + "format": "{icon}", + "format-icons": { + "none": "󰅺", + "notification": "󰡟", + }, + "on-click": "sleep 0.1 && swaync-client -t -sw", + "return-type": "json", + "tooltip": false, + }, +} diff --git a/waybar/.config/waybar/config_1.jsonc b/waybar/.config/waybar/config_1.jsonc new file mode 100644 index 0000000..911c2c7 --- /dev/null +++ b/waybar/.config/waybar/config_1.jsonc @@ -0,0 +1,40 @@ +{ + "position": "top", + "modules-left": ["hyprland/workspaces"], + "modules-center": ["hyprland/window"], + "modules-right": ["network", "pulseaudio", "battery", "clock"], + "clock": { + "format": "{:%a %d %H:%M}", + "tooltip-format": "{:%Y %B}\n{calendar}" + }, + "battery": { + "states": { + "warning": 30, + "critical": 15 + }, + "format": "{icon} {capacity}%", + "format-warning": "{icon} {capacity}%", + "format-critical": "{icon} {capacity}%", + "format-charging": "{capacity}%", + "format-plugged": "{capacity}%", + "format-alt": "{icon} {time}", + "format-full": "{capacity}%", + "format-icons": ["", "", "", "", ""], + "tooltip-format": "{time}" + }, + "network": { + "format-wifi": "{essid}", + "format-ethernet": "󰤭 Disconnected", + "format-linked": "{ifname} (No IP) ", + "format-disconnected": "Disconnected", + "tooltip-format-wifi": "Signal Strenght: {signalStrength}%" + }, + "pulseaudio": { + "format": "{icon} {volume}%", + "format-muted": "", + "format-icons": { + "default": ["", "", " "] + }, + "on-click": "pavucontrol" + } +} diff --git a/waybar/.config/waybar/mocha.css b/waybar/.config/waybar/mocha.css new file mode 100644 index 0000000..0eb6a82 --- /dev/null +++ b/waybar/.config/waybar/mocha.css @@ -0,0 +1,26 @@ +@define-color rosewater #f5e0dc; +@define-color flamingo #f2cdcd; +@define-color pink #f5c2e7; +@define-color mauve #cba6f7; +@define-color red #f38ba8; +@define-color maroon #eba0ac; +@define-color peach #fab387; +@define-color yellow #f9e2af; +@define-color green #a6e3a1; +@define-color teal #94e2d5; +@define-color sky #89dceb; +@define-color sapphire #74c7ec; +@define-color blue #89b4fa; +@define-color lavender #b4befe; +@define-color text #cdd6f4; +@define-color subtext1 #bac2de; +@define-color subtext0 #a6adc8; +@define-color overlay2 #9399b2; +@define-color overlay1 #7f849c; +@define-color overlay0 #6c7086; +@define-color surface2 #585b70; +@define-color surface1 #45475a; +@define-color surface0 #313244; +@define-color base #1e1e2e; +@define-color mantle #181825; +@define-color crust #11111b; diff --git a/waybar/.config/waybar/style.css b/waybar/.config/waybar/style.css new file mode 100644 index 0000000..fab9dd5 --- /dev/null +++ b/waybar/.config/waybar/style.css @@ -0,0 +1,143 @@ +* { + font-family: "FiraCode Nerd Font"; + font-size: 13px; +} + +window#waybar { + background-color: rgba(43, 48, 59, 0.5); + background: radial-gradient(alpha(@theme_base_color, 0.4), @theme_base_color); + color: @theme_fg_color; + transition-property: background-color; + transition-duration: .5s; +} + +window#waybar.hidden { + opacity: 0.2; +} + +button { + border: none; + border-radius: 0; +} + +button:hover { + background: inherit; +} + +#workspaces { + padding: 5px; +} + +#workspaces button { + padding: 0 10px; + background-color: transparent; + color: @theme_fg_color; + border-radius: 10px; +} + +#workspaces button:hover, +#workspaces button.active { + background: @theme_selected_bg_color; +} + +#workspaces button.urgent { + background-color: #eb4d4b; +} + +#clock, +#battery, +#cpu, +#memory, +#disk, +#temperature, +#backlight, +#network, +#pulseaudio, +#wireplumber, +#custom-media, +#tray, +#mode, +#idle_inhibitor, +#scratchpad, +#power-profiles-daemon, +#mpd { + padding: 0 10px; + color: @theme_fg_color; +} + +#window, +#workspaces { + margin: 0 4px; +} + +/* If workspaces is the leftmost module, omit left margin */ +.modules-left>widget:first-child>#workspaces { + margin-left: 0; +} + +/* If workspaces is the rightmost module, omit right margin */ +.modules-right>widget:last-child>#workspaces { + margin-right: 0; +} + +#clock, +#battery, +#cpu, +#memory, +#backlight, +#network, +#pulseaudio, +#custom-media, +#tray, +#custom-power, +#bluetooth, +#power-profiles-daemon { + padding: 5px 15px; + color: @theme_text_color; + background-color: alpha(@theme_unfocused_bg_color, 0.4); + border-radius: 20px; + margin: 0 4px; +} + +#custom-power { + background-color: #ed333b; + border-radius: 20px 0 0 20px; + transition: all 250ms ease-in-out; +} + +#battery.charging { + color: #00ff1c; +} + +#clock { + border-radius: 20px; + margin: 0 5px; +} + +#pulseaudio.muted { + color: orange; +} + +#network.disconnected { + color: red; +} + +#tray { + border-radius: 20px; + margin: 0 5px; +} + +#custom-logo { + background-color: #1794d1; + padding: 0 17px; + border-radius: 0 20px 20px 0; +} + +#custom-power { + margin: 0; +} + +#bluetooth { + border-radius: 20px; + margin: 0 5px; +} diff --git a/waybar/.config/waybar/style.css.test b/waybar/.config/waybar/style.css.test new file mode 100644 index 0000000..5f337dd --- /dev/null +++ b/waybar/.config/waybar/style.css.test @@ -0,0 +1,116 @@ +* { + min-height: 0; + min-width: 0; + font-family: Lexend, "JetBrainsMono NFP"; + font-size: 16px; + font-weight: 600; +} + +window#waybar { + transition-property: background-color; + transition-duration: 0.5s; + /* background-color: #1e1e2e; */ + /* background-color: #181825; */ + background-color: #11111b; + /* background-color: rgba(24, 24, 37, 0.6); */ +} + +#workspaces button { + padding: 0.3rem 0.6rem; + margin: 0.4rem 0.25rem; + border-radius: 6px; + /* background-color: #181825; */ + background-color: #1e1e2e; + color: #cdd6f4; +} + +#workspaces button:hover { + color: #1e1e2e; + background-color: #cdd6f4; +} + +#workspaces button.active { + background-color: #1e1e2e; + color: #89b4fa; +} + +#workspaces button.urgent { + background-color: #1e1e2e; + color: #f38ba8; +} + +#clock, +#pulseaudio, +#custom-logo, +#custom-power, +#custom-spotify, +#custom-notification, +#cpu, +#tray, +#memory, +#window, +#mpris { + padding: 0.3rem 0.6rem; + margin: 0.4rem 0.25rem; + border-radius: 6px; + /* background-color: #181825; */ + background-color: #1e1e2e; +} + +#mpris.playing { + color: #a6e3a1; +} + +#mpris.paused { + color: #9399b2; +} + +#custom-sep { + padding: 0px; + color: #585b70; +} + +window#waybar.empty #window { + background-color: transparent; +} + +#cpu { + color: #94e2d5; +} + +#memory { + color: #cba6f7; +} + +#clock { + color: #74c7ec; +} + +#clock.simpleclock { + color: #89b4fa; +} + +#window { + color: #cdd6f4; +} + +#pulseaudio { + color: #b4befe; +} + +#pulseaudio.muted { + color: #a6adc8; +} + +#custom-logo { + color: #89b4fa; +} + +#custom-power { + color: #f38ba8; +} + +tooltip { + background-color: #181825; + border: 2px solid #89b4fa; +} diff --git a/wofi/.config/wofi/style.css b/wofi/.config/wofi/style.css new file mode 100644 index 0000000..a1d3662 --- /dev/null +++ b/wofi/.config/wofi/style.css @@ -0,0 +1,138 @@ +@define-color rosewater #f5e0dc; +@define-color rosewater-rgb rgb(245, 224, 220); +@define-color flamingo #f2cdcd; +@define-color flamingo-rgb rgb(242, 205, 205); +@define-color pink #f5c2e7; +@define-color pink-rgb rgb(245, 194, 231); +@define-color mauve #cba6f7; +@define-color mauve-rgb rgb(203, 166, 247); +@define-color red #f38ba8; +@define-color red-rgb rgb(243, 139, 168); +@define-color maroon #eba0ac; +@define-color maroon-rgb rgb(235, 160, 172); +@define-color peach #fab387; +@define-color peach-rgb rgb(250, 179, 135); +@define-color yellow #f9e2af; +@define-color yellow-rgb rgb(249, 226, 175); +@define-color green #a6e3a1; +@define-color green-rgb rgb(166, 227, 161); +@define-color teal #94e2d5; +@define-color teal-rgb rgb(148, 226, 213); +@define-color sky #89dceb; +@define-color sky-rgb rgb(137, 220, 235); +@define-color sapphire #74c7ec; +@define-color sapphire-rgb rgb(116, 199, 236); +@define-color blue #89b4fa; +@define-color blue-rgb rgb(137, 180, 250); +@define-color lavender #b4befe; +@define-color lavender-rgb rgb(180, 190, 254); +@define-color text #cdd6f4; +@define-color text-rgb rgb(205, 214, 244); +@define-color subtext1 #bac2de; +@define-color subtext1-rgb rgb(186, 194, 222); +@define-color subtext0 #a6adc8; +@define-color subtext0-rgb rgb(166, 173, 200); +@define-color overlay2 #9399b2; +@define-color overlay2-rgb rgb(147, 153, 178); +@define-color overlay1 #7f849c; +@define-color overlay1-rgb rgb(127, 132, 156); +@define-color overlay0 #6c7086; +@define-color overlay0-rgb rgb(108, 112, 134); +@define-color surface2 #585b70; +@define-color surface2-rgb rgb(88, 91, 112); +@define-color surface1 #45475a; +@define-color surface1-rgb rgb(69, 71, 90); +@define-color surface0 #313244; +@define-color surface0-rgb rgb(49, 50, 68); +@define-color base #1e1e2e; +@define-color base-rgb rgb(30, 30, 46); +@define-color mantle #181825; +@define-color mantle-rgb rgb(24, 24, 37); +@define-color crust #11111b; +@define-color crust-rgb rgb(17, 17, 27); + +* { + font-family: 'CaskaydiaCove Nerd Font', monospace; + font-size: 18px; +} + +/* Window */ +window { + margin: 0px; + padding: 10px; + border: 2px solid @lavender; + border-radius: 8px; + background-color: @base; +} + +/* Inner Box */ +#inner-box { + margin: 5px; + padding: 10px; + border: none; + background-color: @base; +} + +/* Outer Box */ +#outer-box { + margin: 5px; + padding: 10px; + border: none; + background-color: @base; +} + +/* Scroll */ +#scroll { + margin: 0px; + padding: 10px; + border: none; + background-color: @base; +} + +/* Input */ +#input { + margin: 5px 20px; + padding: 10px; + border: none; + border-radius: 0.1em; + color: @text; + background-color: @base; +} + +#input image { + border: none; + color: @red; +} + +#input * { + outline: 4px solid @red!important; +} + +/* Text */ +#text { + margin: 5px; + border: none; + color: @text; +} + +#entry { + background-color: @base; +} + +#entry arrow { + border: none; + color: @lavender; +} + +/* Selected Entry */ +#entry:selected { + border: 0.11em solid @lavender; +} + +#entry:selected #text { + color: @mauve; +} + +#entry:drop(active) { + background-color: @lavender!important; +} diff --git a/yazi/.config/yazi/bookmark b/yazi/.config/yazi/bookmark new file mode 100644 index 0000000..f373967 --- /dev/null +++ b/yazi/.config/yazi/bookmark @@ -0,0 +1,17 @@ +tank /mnt/tank/ t +ssd2 /mnt/ssd2/ 7 +ssd1 /mnt/ssd1/ 6 +plugins /home/liph/.config/nvim/lua/plugins/ p +nvim /home/liph/.config/nvim/ n +hypr /home/liph/.config/hypr/ h +healing /mnt/tank/audio/healing/ H +hdd5 /mnt/hdd5/ 5 +hdd4 /mnt/hdd4/ 4 +hdd3 /mnt/hdd3/ 3 +hdd2 /mnt/hdd2/ 2 +hdd1 /mnt/hdd1/ 1 +flash1 /mnt/flash1/ 8 +Downloads /home/liph/Downloads/ D +dotfiles /home/liph/dotfiles/ d +Desktop /home/liph/Desktop/ d +.config /home/liph/.config/ c diff --git a/yazi/.config/yazi/flavors/catppuccin-mocha.yazi/LICENSE b/yazi/.config/yazi/flavors/catppuccin-mocha.yazi/LICENSE new file mode 100644 index 0000000..fb5b1d6 --- /dev/null +++ b/yazi/.config/yazi/flavors/catppuccin-mocha.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 yazi-rs + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. diff --git a/yazi/.config/yazi/flavors/catppuccin-mocha.yazi/LICENSE-tmtheme b/yazi/.config/yazi/flavors/catppuccin-mocha.yazi/LICENSE-tmtheme new file mode 100644 index 0000000..44b4479 --- /dev/null +++ b/yazi/.config/yazi/flavors/catppuccin-mocha.yazi/LICENSE-tmtheme @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Himanshu + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. diff --git a/yazi/.config/yazi/flavors/catppuccin-mocha.yazi/README.md b/yazi/.config/yazi/flavors/catppuccin-mocha.yazi/README.md new file mode 100644 index 0000000..a9cff17 --- /dev/null +++ b/yazi/.config/yazi/flavors/catppuccin-mocha.yazi/README.md @@ -0,0 +1,38 @@ +
+ Yazi logo +
+ +

+ Catppuccin Mocha Flavor for Yazi +

+ +## 👀 Preview + + + +## 🎨 Installation + +```sh +ya pack -a yazi-rs/flavors:catppuccin-mocha +``` + +## ⚙️ Usage + +Set the content of your `theme.toml` to enable it as your _dark_ flavor: + +```toml +[flavor] +use = "catppuccin-mocha" +# For upcoming Yazi 0.4 (nightly version): +dark = "catppuccin-mocha" +``` + +Make sure your `theme.toml` doesn't contain anything other than `[flavor]`, unless you want to override certain styles of this flavor. + +See the [Yazi flavor documentation](https://yazi-rs.github.io/docs/flavors/overview) for more details. + +## 📜 License + +The flavor is MIT-licensed, and the included tmTheme is also MIT-licensed. + +Check the [LICENSE](LICENSE) and [LICENSE-tmtheme](LICENSE-tmtheme) file for more details. diff --git a/yazi/.config/yazi/flavors/catppuccin-mocha.yazi/flavor.toml b/yazi/.config/yazi/flavors/catppuccin-mocha.yazi/flavor.toml new file mode 100644 index 0000000..f86711f --- /dev/null +++ b/yazi/.config/yazi/flavors/catppuccin-mocha.yazi/flavor.toml @@ -0,0 +1,173 @@ +# vim:fileencoding=utf-8:foldmethod=marker + +# : Manager {{{ + +[manager] +cwd = { fg = "#94e2d5" } + +# Hovered +hovered = { reversed = true } +preview_hovered = { underline = true } + +# Find +find_keyword = { fg = "#f9e2af", bold = true, italic = true, underline = true } +find_position = { fg = "#f5c2e7", bg = "reset", bold = true, italic = true } + +# Marker +marker_copied = { fg = "#a6e3a1", bg = "#a6e3a1" } +marker_cut = { fg = "#f38ba8", bg = "#f38ba8" } +marker_marked = { fg = "#94e2d5", bg = "#94e2d5" } +marker_selected = { fg = "#f9e2af", bg = "#f9e2af" } + +# Tab +tab_active = { reversed = true } +tab_inactive = {} +tab_width = 1 + +# Count +count_copied = { fg = "#1e1e2e", bg = "#a6e3a1" } +count_cut = { fg = "#1e1e2e", bg = "#f38ba8" } +count_selected = { fg = "#1e1e2e", bg = "#f9e2af" } + +# Border +border_symbol = "│" +border_style = { fg = "#7f849c" } + +# : }}} + + +# : Mode {{{ + +[mode] + +normal_main = { fg = "#1e1e2e", bg = "#89b4fa", bold = true } +normal_alt = { fg = "#89b4fa", bg = "#313244" } + +# Select mode +select_main = { fg = "#1e1e2e", bg = "#a6e3a1", bold = true } +select_alt = { fg = "#a6e3a1", bg = "#313244" } + +# Unset mode +unset_main = { fg = "#1e1e2e", bg = "#f2cdcd", bold = true } +unset_alt = { fg = "#f2cdcd", bg = "#313244" } + +# : }}} + + +# : Status bar {{{ + +[status] +separator_open = "" +separator_close = "" + +# Progress +progress_label = { fg = "#ffffff", bold = true } +progress_normal = { fg = "#89b4fa", bg = "#45475a" } +progress_error = { fg = "#f38ba8", bg = "#45475a" } + +# Permissions +perm_sep = { fg = "#7f849c" } +perm_type = { fg = "#89b4fa" } +perm_read = { fg = "#f9e2af" } +perm_write = { fg = "#f38ba8" } +perm_exec = { fg = "#a6e3a1" } + +# : }}} + + +# : Pick {{{ + +[pick] +border = { fg = "#89b4fa" } +active = { fg = "#f5c2e7", bold = true } +inactive = {} + +# : }}} + + +# : Input {{{ + +[input] +border = { fg = "#89b4fa" } +title = {} +value = {} +selected = { reversed = true } + +# : }}} + + +# : Completion {{{ + +[completion] +border = { fg = "#89b4fa" } + +# : }}} + + +# : Tasks {{{ + +[tasks] +border = { fg = "#89b4fa" } +title = {} +hovered = { fg = "#f5c2e7", underline = true } + +# : }}} + + +# : Which {{{ + +[which] +mask = { bg = "#313244" } +cand = { fg = "#94e2d5" } +rest = { fg = "#9399b2" } +desc = { fg = "#f5c2e7" } +separator = "  " +separator_style = { fg = "#585b70" } + +# : }}} + + +# : Help {{{ + +[help] +on = { fg = "#94e2d5" } +run = { fg = "#f5c2e7" } +hovered = { reversed = true, bold = true } +footer = { fg = "#313244", bg = "#cdd6f4" } + +# : }}} + + +# : Notify {{{ + +[notify] +title_info = { fg = "#a6e3a1" } +title_warn = { fg = "#f9e2af" } +title_error = { fg = "#f38ba8" } + +# : }}} + + +# : File-specific styles {{{ + +[filetype] + +rules = [ + # Images + { mime = "image/*", fg = "#94e2d5" }, + + # Media + { mime = "{audio,video}/*", fg = "#f9e2af" }, + + # Archives + { mime = "application/{zip,rar,7z*,tar,gzip,xz,zstd,bzip*,lzma,compress,archive,cpio,arj,xar,ms-cab*}", fg = "#f5c2e7" }, + + # Documents + { mime = "application/{pdf,doc,rtf}", fg = "#a6e3a1" }, + + # Fallback + { name = "*", fg = "#cdd6f4" }, + { name = "*/", fg = "#89b4fa" } +] + +# : }}} diff --git a/yazi/.config/yazi/flavors/catppuccin-mocha.yazi/preview.png b/yazi/.config/yazi/flavors/catppuccin-mocha.yazi/preview.png new file mode 100644 index 0000000..a684ec8 Binary files /dev/null and b/yazi/.config/yazi/flavors/catppuccin-mocha.yazi/preview.png differ diff --git a/yazi/.config/yazi/flavors/catppuccin-mocha.yazi/tmtheme.xml b/yazi/.config/yazi/flavors/catppuccin-mocha.yazi/tmtheme.xml new file mode 100644 index 0000000..364617b --- /dev/null +++ b/yazi/.config/yazi/flavors/catppuccin-mocha.yazi/tmtheme.xml @@ -0,0 +1,2021 @@ + + + + + name + Catppuccin Mocha + semanticClass + theme.dark.catppuccin-mocha + uuid + 627ce890-fabb-4d39-9819-7be71f4bdca7 + author + Catppuccin Org + colorSpaceName + sRGB + settings + + + settings + + background + #1e1e2e + foreground + #cdd6f4 + caret + #f5e0dc + lineHighlight + #cdd6f412 + misspelling + #f38ba8 + accent + #cba6f7 + selection + #9399b240 + activeGuide + #45475a + findHighlight + #3e5767 + gutterForeground + #7f849c + + + + name + Basic text & variable names (incl. leading punctuation) + scope + text, source, variable.other.readwrite, punctuation.definition.variable + settings + + foreground + #cdd6f4 + + + + name + Parentheses, Brackets, Braces + scope + punctuation + settings + + foreground + #9399b2 + fontStyle + + + + + name + Comments + scope + comment, punctuation.definition.comment + settings + + foreground + #6c7086 + fontStyle + italic + + + + scope + string, punctuation.definition.string + settings + + foreground + #a6e3a1 + + + + scope + constant.character.escape + settings + + foreground + #f5c2e7 + + + + name + Booleans, constants, numbers + scope + constant.numeric, variable.other.constant, entity.name.constant, constant.language.boolean, constant.language.false, constant.language.true, keyword.other.unit.user-defined, keyword.other.unit.suffix.floating-point + settings + + foreground + #fab387 + + + + scope + keyword, keyword.operator.word, keyword.operator.new, variable.language.super, support.type.primitive, storage.type, storage.modifier, punctuation.definition.keyword + settings + + foreground + #cba6f7 + fontStyle + + + + + scope + entity.name.tag.documentation + settings + + foreground + #cba6f7 + + + + name + Punctuation + scope + keyword.operator, punctuation.accessor, punctuation.definition.generic, meta.function.closure punctuation.section.parameters, punctuation.definition.tag, punctuation.separator.key-value + settings + + foreground + #94e2d5 + + + + scope + entity.name.function, meta.function-call.method, support.function, support.function.misc, variable.function + settings + + foreground + #89b4fa + fontStyle + italic + + + + name + Classes + scope + entity.name.class, entity.other.inherited-class, support.class, meta.function-call.constructor, entity.name.struct + settings + + foreground + #f9e2af + fontStyle + italic + + + + name + Enum + scope + entity.name.enum + settings + + foreground + #f9e2af + fontStyle + italic + + + + name + Enum member + scope + meta.enum variable.other.readwrite, variable.other.enummember + settings + + foreground + #94e2d5 + + + + name + Object properties + scope + meta.property.object + settings + + foreground + #94e2d5 + + + + name + Types + scope + meta.type, meta.type-alias, support.type, entity.name.type + settings + + foreground + #f9e2af + fontStyle + italic + + + + name + Decorators + scope + meta.annotation variable.function, meta.annotation variable.annotation.function, meta.annotation punctuation.definition.annotation, meta.decorator, punctuation.decorator + settings + + foreground + #fab387 + + + + scope + variable.parameter, meta.function.parameters + settings + + foreground + #eba0ac + fontStyle + italic + + + + name + Built-ins + scope + constant.language, support.function.builtin + settings + + foreground + #f38ba8 + + + + scope + entity.other.attribute-name.documentation + settings + + foreground + #f38ba8 + + + + name + Preprocessor directives + scope + keyword.control.directive, punctuation.definition.directive + settings + + foreground + #f9e2af + + + + name + Type parameters + scope + punctuation.definition.typeparameters + settings + + foreground + #89dceb + + + + name + Namespaces + scope + entity.name.namespace + settings + + foreground + #f9e2af + + + + name + Property names (left hand assignments in json/yaml/css) + scope + support.type.property-name.css + settings + + foreground + #89b4fa + fontStyle + + + + + name + This/Self keyword + scope + variable.language.this, variable.language.this punctuation.definition.variable + settings + + foreground + #f38ba8 + + + + name + Object properties + scope + variable.object.property + settings + + foreground + #cdd6f4 + + + + name + String template interpolation + scope + string.template variable, string variable + settings + + foreground + #cdd6f4 + + + + name + `new` as bold + scope + keyword.operator.new + settings + + fontStyle + bold + + + + name + C++ extern keyword + scope + storage.modifier.specifier.extern.cpp + settings + + foreground + #cba6f7 + + + + name + C++ scope resolution + scope + entity.name.scope-resolution.template.call.cpp, entity.name.scope-resolution.parameter.cpp, entity.name.scope-resolution.cpp, entity.name.scope-resolution.function.definition.cpp + settings + + foreground + #f9e2af + + + + name + C++ doc keywords + scope + storage.type.class.doxygen + settings + + fontStyle + + + + + name + C++ operators + scope + storage.modifier.reference.cpp + settings + + foreground + #94e2d5 + + + + name + C# Interpolated Strings + scope + meta.interpolation.cs + settings + + foreground + #cdd6f4 + + + + name + C# xml-style docs + scope + comment.block.documentation.cs + settings + + foreground + #cdd6f4 + + + + name + Classes, reflecting the className color in JSX + scope + source.css entity.other.attribute-name.class.css, entity.other.attribute-name.parent-selector.css punctuation.definition.entity.css + settings + + foreground + #f9e2af + + + + name + Operators + scope + punctuation.separator.operator.css + settings + + foreground + #94e2d5 + + + + name + Pseudo classes + scope + source.css entity.other.attribute-name.pseudo-class + settings + + foreground + #94e2d5 + + + + scope + source.css constant.other.unicode-range + settings + + foreground + #fab387 + + + + scope + source.css variable.parameter.url + settings + + foreground + #a6e3a1 + fontStyle + + + + + name + CSS vendored property names + scope + support.type.vendored.property-name + settings + + foreground + #89dceb + + + + name + Less/SCSS right-hand variables (@/$-prefixed) + scope + source.css meta.property-value variable, source.css meta.property-value variable.other.less, source.css meta.property-value variable.other.less punctuation.definition.variable.less, meta.definition.variable.scss + settings + + foreground + #eba0ac + + + + name + CSS variables (--prefixed) + scope + source.css meta.property-list variable, meta.property-list variable.other.less, meta.property-list variable.other.less punctuation.definition.variable.less + settings + + foreground + #89b4fa + + + + name + CSS Percentage values, styled the same as numbers + scope + keyword.other.unit.percentage.css + settings + + foreground + #fab387 + + + + name + CSS Attribute selectors, styled the same as strings + scope + source.css meta.attribute-selector + settings + + foreground + #a6e3a1 + + + + name + JSON/YAML keys, other left-hand assignments + scope + keyword.other.definition.ini, punctuation.support.type.property-name.json, support.type.property-name.json, punctuation.support.type.property-name.toml, support.type.property-name.toml, entity.name.tag.yaml, punctuation.support.type.property-name.yaml, support.type.property-name.yaml + settings + + foreground + #89b4fa + fontStyle + + + + + name + JSON/YAML constants + scope + constant.language.json, constant.language.yaml + settings + + foreground + #fab387 + + + + name + YAML anchors + scope + entity.name.type.anchor.yaml, variable.other.alias.yaml + settings + + foreground + #f9e2af + fontStyle + + + + + name + TOML tables / ini groups + scope + support.type.property-name.table, entity.name.section.group-title.ini + settings + + foreground + #f9e2af + + + + name + TOML dates + scope + constant.other.time.datetime.offset.toml + settings + + foreground + #f5c2e7 + + + + name + YAML anchor puctuation + scope + punctuation.definition.anchor.yaml, punctuation.definition.alias.yaml + settings + + foreground + #f5c2e7 + + + + name + YAML triple dashes + scope + entity.other.document.begin.yaml + settings + + foreground + #f5c2e7 + + + + name + Markup Diff + scope + markup.changed.diff + settings + + foreground + #fab387 + + + + name + Diff + scope + meta.diff.header.from-file, meta.diff.header.to-file, punctuation.definition.from-file.diff, punctuation.definition.to-file.diff + settings + + foreground + #89b4fa + + + + name + Diff Inserted + scope + markup.inserted.diff + settings + + foreground + #a6e3a1 + + + + name + Diff Deleted + scope + markup.deleted.diff + settings + + foreground + #f38ba8 + + + + name + dotenv left-hand side assignments + scope + variable.other.env + settings + + foreground + #89b4fa + + + + name + dotenv reference to existing env variable + scope + string.quoted variable.other.env + settings + + foreground + #cdd6f4 + + + + name + GDScript functions + scope + support.function.builtin.gdscript + settings + + foreground + #89b4fa + + + + name + GDScript constants + scope + constant.language.gdscript + settings + + foreground + #fab387 + + + + name + Comment keywords + scope + comment meta.annotation.go + settings + + foreground + #eba0ac + + + + name + go:embed, go:build, etc. + scope + comment meta.annotation.parameters.go + settings + + foreground + #fab387 + + + + name + Go constants (nil, true, false) + scope + constant.language.go + settings + + foreground + #fab387 + + + + name + GraphQL variables + scope + variable.graphql + settings + + foreground + #cdd6f4 + + + + name + GraphQL aliases + scope + string.unquoted.alias.graphql + settings + + foreground + #f2cdcd + + + + name + GraphQL enum members + scope + constant.character.enum.graphql + settings + + foreground + #94e2d5 + + + + name + GraphQL field in types + scope + meta.objectvalues.graphql constant.object.key.graphql string.unquoted.graphql + settings + + foreground + #f2cdcd + + + + name + HTML/XML DOCTYPE as keyword + scope + keyword.other.doctype, meta.tag.sgml.doctype punctuation.definition.tag, meta.tag.metadata.doctype entity.name.tag, meta.tag.metadata.doctype punctuation.definition.tag + settings + + foreground + #cba6f7 + + + + name + HTML/XML-like <tags/> + scope + entity.name.tag + settings + + foreground + #89b4fa + fontStyle + + + + + name + Special characters like &amp; + scope + text.html constant.character.entity, text.html constant.character.entity punctuation, constant.character.entity.xml, constant.character.entity.xml punctuation, constant.character.entity.js.jsx, constant.charactger.entity.js.jsx punctuation, constant.character.entity.tsx, constant.character.entity.tsx punctuation + settings + + foreground + #f38ba8 + + + + name + HTML/XML tag attribute values + scope + entity.other.attribute-name + settings + + foreground + #f9e2af + + + + name + Components + scope + support.class.component, support.class.component.jsx, support.class.component.tsx, support.class.component.vue + settings + + foreground + #f5c2e7 + fontStyle + + + + + name + Annotations + scope + punctuation.definition.annotation, storage.type.annotation + settings + + foreground + #fab387 + + + + name + Java enums + scope + constant.other.enum.java + settings + + foreground + #94e2d5 + + + + name + Java imports + scope + storage.modifier.import.java + settings + + foreground + #cdd6f4 + + + + name + Javadoc + scope + comment.block.javadoc.java keyword.other.documentation.javadoc.java + settings + + fontStyle + + + + + name + Exported Variable + scope + meta.export variable.other.readwrite.js + settings + + foreground + #eba0ac + + + + name + JS/TS constants & properties + scope + variable.other.constant.js, variable.other.constant.ts, variable.other.property.js, variable.other.property.ts + settings + + foreground + #cdd6f4 + + + + name + JSDoc; these are mainly params, so styled as such + scope + variable.other.jsdoc, comment.block.documentation variable.other + settings + + foreground + #eba0ac + fontStyle + + + + + name + JSDoc keywords + scope + storage.type.class.jsdoc + settings + + fontStyle + + + + + scope + support.type.object.console.js + settings + + foreground + #cdd6f4 + + + + name + Node constants as keywords (module, etc.) + scope + support.constant.node, support.type.object.module.js + settings + + foreground + #cba6f7 + + + + name + implements as keyword + scope + storage.modifier.implements + settings + + foreground + #cba6f7 + + + + name + Builtin types + scope + constant.language.null.js, constant.language.null.ts, constant.language.undefined.js, constant.language.undefined.ts, support.type.builtin.ts + settings + + foreground + #cba6f7 + + + + scope + variable.parameter.generic + settings + + foreground + #f9e2af + + + + name + Arrow functions + scope + keyword.declaration.function.arrow.js, storage.type.function.arrow.ts + settings + + foreground + #94e2d5 + + + + name + Decorator punctuations (decorators inherit from blue functions, instead of styleguide peach) + scope + punctuation.decorator.ts + settings + + foreground + #89b4fa + fontStyle + italic + + + + name + Extra JS/TS keywords + scope + keyword.operator.expression.in.js, keyword.operator.expression.in.ts, keyword.operator.expression.infer.ts, keyword.operator.expression.instanceof.js, keyword.operator.expression.instanceof.ts, keyword.operator.expression.is, keyword.operator.expression.keyof.ts, keyword.operator.expression.of.js, keyword.operator.expression.of.ts, keyword.operator.expression.typeof.ts + settings + + foreground + #cba6f7 + + + + name + Julia macros + scope + support.function.macro.julia + settings + + foreground + #94e2d5 + fontStyle + italic + + + + name + Julia language constants (true, false) + scope + constant.language.julia + settings + + foreground + #fab387 + + + + name + Julia other constants (these seem to be arguments inside arrays) + scope + constant.other.symbol.julia + settings + + foreground + #eba0ac + + + + name + LaTeX preamble + scope + text.tex keyword.control.preamble + settings + + foreground + #94e2d5 + + + + name + LaTeX be functions + scope + text.tex support.function.be + settings + + foreground + #89dceb + + + + name + LaTeX math + scope + constant.other.general.math.tex + settings + + foreground + #f2cdcd + + + + name + Lua docstring keywords + scope + comment.line.double-dash.documentation.lua storage.type.annotation.lua + settings + + foreground + #cba6f7 + fontStyle + + + + + name + Lua docstring variables + scope + comment.line.double-dash.documentation.lua entity.name.variable.lua, comment.line.double-dash.documentation.lua variable.lua + settings + + foreground + #cdd6f4 + + + + scope + heading.1.markdown punctuation.definition.heading.markdown, heading.1.markdown, markup.heading.atx.1.mdx, markup.heading.atx.1.mdx punctuation.definition.heading.mdx, markup.heading.setext.1.markdown, markup.heading.heading-0.asciidoc + settings + + foreground + #f38ba8 + + + + scope + heading.2.markdown punctuation.definition.heading.markdown, heading.2.markdown, markup.heading.atx.2.mdx, markup.heading.atx.2.mdx punctuation.definition.heading.mdx, markup.heading.setext.2.markdown, markup.heading.heading-1.asciidoc + settings + + foreground + #fab387 + + + + scope + heading.3.markdown punctuation.definition.heading.markdown, heading.3.markdown, markup.heading.atx.3.mdx, markup.heading.atx.3.mdx punctuation.definition.heading.mdx, markup.heading.heading-2.asciidoc + settings + + foreground + #f9e2af + + + + scope + heading.4.markdown punctuation.definition.heading.markdown, heading.4.markdown, markup.heading.atx.4.mdx, markup.heading.atx.4.mdx punctuation.definition.heading.mdx, markup.heading.heading-3.asciidoc + settings + + foreground + #a6e3a1 + + + + scope + heading.5.markdown punctuation.definition.heading.markdown, heading.5.markdown, markup.heading.atx.5.mdx, markup.heading.atx.5.mdx punctuation.definition.heading.mdx, markup.heading.heading-4.asciidoc + settings + + foreground + #89b4fa + + + + scope + heading.6.markdown punctuation.definition.heading.markdown, heading.6.markdown, markup.heading.atx.6.mdx, markup.heading.atx.6.mdx punctuation.definition.heading.mdx, markup.heading.heading-5.asciidoc + settings + + foreground + #cba6f7 + + + + scope + markup.bold + settings + + foreground + #f38ba8 + fontStyle + bold + + + + scope + markup.italic + settings + + foreground + #f38ba8 + fontStyle + italic + + + + scope + markup.strikethrough + settings + + foreground + #a6adc8 + fontStyle + strikethrough + + + + name + Markdown auto links + scope + punctuation.definition.link, markup.underline.link + settings + + foreground + #89b4fa + + + + name + Markdown links + scope + text.html.markdown punctuation.definition.link.title, string.other.link.title.markdown, markup.link, punctuation.definition.constant.markdown, constant.other.reference.link.markdown, markup.substitution.attribute-reference + settings + + foreground + #b4befe + + + + name + Markdown code spans + scope + punctuation.definition.raw.markdown, markup.inline.raw.string.markdown, markup.raw.block.markdown + settings + + foreground + #a6e3a1 + + + + name + Markdown triple backtick language identifier + scope + fenced_code.block.language + settings + + foreground + #89dceb + + + + name + Markdown triple backticks + scope + markup.fenced_code.block punctuation.definition, markup.raw support.asciidoc + settings + + foreground + #9399b2 + + + + name + Markdown quotes + scope + markup.quote, punctuation.definition.quote.begin + settings + + foreground + #f5c2e7 + + + + name + Markdown separators + scope + meta.separator.markdown + settings + + foreground + #94e2d5 + + + + name + Markdown list bullets + scope + punctuation.definition.list.begin.markdown, markup.list.bullet + settings + + foreground + #94e2d5 + + + + name + Nix attribute names + scope + entity.other.attribute-name.multipart.nix, entity.other.attribute-name.single.nix + settings + + foreground + #89b4fa + + + + name + Nix parameter names + scope + variable.parameter.name.nix + settings + + foreground + #cdd6f4 + fontStyle + + + + + name + Nix interpolated parameter names + scope + meta.embedded variable.parameter.name.nix + settings + + foreground + #b4befe + fontStyle + + + + + name + Nix paths + scope + string.unquoted.path.nix + settings + + foreground + #f5c2e7 + fontStyle + + + + + name + PHP Attributes + scope + support.attribute.builtin, meta.attribute.php + settings + + foreground + #f9e2af + + + + name + PHP Parameters (needed for the leading dollar sign) + scope + meta.function.parameters.php punctuation.definition.variable.php + settings + + foreground + #eba0ac + + + + name + PHP Constants (null, __FILE__, etc.) + scope + constant.language.php + settings + + foreground + #cba6f7 + + + + name + PHP functions + scope + text.html.php support.function + settings + + foreground + #89dceb + + + + name + PHPdoc keywords + scope + keyword.other.phpdoc.php + settings + + fontStyle + + + + + name + Python argument functions reset to text, otherwise they inherit blue from function-call + scope + support.variable.magic.python, meta.function-call.arguments.python + settings + + foreground + #cdd6f4 + + + + name + Python double underscore functions + scope + support.function.magic.python + settings + + foreground + #89dceb + fontStyle + italic + + + + name + Python `self` keyword + scope + variable.parameter.function.language.special.self.python, variable.language.special.self.python + settings + + foreground + #f38ba8 + fontStyle + italic + + + + name + python keyword flow/logical (for ... in) + scope + keyword.control.flow.python, keyword.operator.logical.python + settings + + foreground + #cba6f7 + + + + name + python storage type + scope + storage.type.function.python + settings + + foreground + #cba6f7 + + + + name + python function support + scope + support.token.decorator.python, meta.function.decorator.identifier.python + settings + + foreground + #89dceb + + + + name + python function calls + scope + meta.function-call.python + settings + + foreground + #89b4fa + + + + name + python function decorators + scope + entity.name.function.decorator.python, punctuation.definition.decorator.python + settings + + foreground + #fab387 + fontStyle + italic + + + + name + python placeholder reset to normal string + scope + constant.character.format.placeholder.other.python + settings + + foreground + #f5c2e7 + + + + name + Python exception & builtins such as exit() + scope + support.type.exception.python, support.function.builtin.python + settings + + foreground + #fab387 + + + + name + entity.name.type + scope + support.type.python + settings + + foreground + #fab387 + + + + name + python constants (True/False) + scope + constant.language.python + settings + + foreground + #cba6f7 + + + + name + Arguments accessed later in the function body + scope + meta.indexed-name.python, meta.item-access.python + settings + + foreground + #eba0ac + fontStyle + italic + + + + name + Python f-strings/binary/unicode storage types + scope + storage.type.string.python + settings + + foreground + #a6e3a1 + fontStyle + italic + + + + name + Python type hints + scope + meta.function.parameters.python + settings + + fontStyle + + + + + name + Regex string begin/end in JS/TS + scope + string.regexp punctuation.definition.string.begin, string.regexp punctuation.definition.string.end + settings + + foreground + #f5c2e7 + + + + name + Regex anchors (^, $) + scope + keyword.control.anchor.regexp + settings + + foreground + #cba6f7 + + + + name + Regex regular string match + scope + string.regexp.ts + settings + + foreground + #cdd6f4 + + + + name + Regex group parenthesis & backreference (\1, \2, \3, ...) + scope + punctuation.definition.group.regexp, keyword.other.back-reference.regexp + settings + + foreground + #a6e3a1 + + + + name + Regex character class [] + scope + punctuation.definition.character-class.regexp + settings + + foreground + #f9e2af + + + + name + Regex character classes (\d, \w, \s) + scope + constant.other.character-class.regexp + settings + + foreground + #f5c2e7 + + + + name + Regex range + scope + constant.other.character-class.range.regexp + settings + + foreground + #f5e0dc + + + + name + Regex quantifier + scope + keyword.operator.quantifier.regexp + settings + + foreground + #94e2d5 + + + + name + Regex constant/numeric + scope + constant.character.numeric.regexp + settings + + foreground + #fab387 + + + + name + Regex lookaheads, negative lookaheads, lookbehinds, negative lookbehinds + scope + punctuation.definition.group.no-capture.regexp, meta.assertion.look-ahead.regexp, meta.assertion.negative-look-ahead.regexp + settings + + foreground + #89b4fa + + + + name + Rust attribute + scope + meta.annotation.rust, meta.annotation.rust punctuation, meta.attribute.rust, punctuation.definition.attribute.rust + settings + + foreground + #f9e2af + fontStyle + italic + + + + name + Rust attribute strings + scope + meta.attribute.rust string.quoted.double.rust, meta.attribute.rust string.quoted.single.char.rust + settings + + fontStyle + + + + + name + Rust keyword + scope + entity.name.function.macro.rules.rust, storage.type.module.rust, storage.modifier.rust, storage.type.struct.rust, storage.type.enum.rust, storage.type.trait.rust, storage.type.union.rust, storage.type.impl.rust, storage.type.rust, storage.type.function.rust, storage.type.type.rust + settings + + foreground + #cba6f7 + fontStyle + + + + + name + Rust u/i32, u/i64, etc. + scope + entity.name.type.numeric.rust + settings + + foreground + #cba6f7 + fontStyle + + + + + name + Rust generic + scope + meta.generic.rust + settings + + foreground + #fab387 + + + + name + Rust impl + scope + entity.name.impl.rust + settings + + foreground + #f9e2af + fontStyle + italic + + + + name + Rust module + scope + entity.name.module.rust + settings + + foreground + #fab387 + + + + name + Rust trait + scope + entity.name.trait.rust + settings + + foreground + #f9e2af + fontStyle + italic + + + + name + Rust struct + scope + storage.type.source.rust + settings + + foreground + #f9e2af + + + + name + Rust union + scope + entity.name.union.rust + settings + + foreground + #f9e2af + + + + name + Rust enum member + scope + meta.enum.rust storage.type.source.rust + settings + + foreground + #94e2d5 + + + + name + Rust macro + scope + support.macro.rust, meta.macro.rust support.function.rust, entity.name.function.macro.rust + settings + + foreground + #89b4fa + fontStyle + italic + + + + name + Rust lifetime + scope + storage.modifier.lifetime.rust, entity.name.type.lifetime + settings + + foreground + #89b4fa + fontStyle + italic + + + + name + Rust string formatting + scope + string.quoted.double.rust constant.other.placeholder.rust + settings + + foreground + #f5c2e7 + + + + name + Rust return type generic + scope + meta.function.return-type.rust meta.generic.rust storage.type.rust + settings + + foreground + #cdd6f4 + + + + name + Rust functions + scope + meta.function.call.rust + settings + + foreground + #89b4fa + + + + name + Rust angle brackets + scope + punctuation.brackets.angle.rust + settings + + foreground + #89dceb + + + + name + Rust constants + scope + constant.other.caps.rust + settings + + foreground + #fab387 + + + + name + Rust function parameters + scope + meta.function.definition.rust variable.other.rust + settings + + foreground + #eba0ac + + + + name + Rust closure variables + scope + meta.function.call.rust variable.other.rust + settings + + foreground + #cdd6f4 + + + + name + Rust self + scope + variable.language.self.rust + settings + + foreground + #f38ba8 + + + + name + Rust metavariable names + scope + variable.other.metavariable.name.rust, meta.macro.metavariable.rust keyword.operator.macro.dollar.rust + settings + + foreground + #f5c2e7 + + + + name + Shell shebang + scope + comment.line.shebang, comment.line.shebang punctuation.definition.comment, comment.line.shebang, punctuation.definition.comment.shebang.shell, meta.shebang.shell + settings + + foreground + #f5c2e7 + fontStyle + italic + + + + name + Shell shebang command + scope + comment.line.shebang constant.language + settings + + foreground + #94e2d5 + fontStyle + italic + + + + name + Shell interpolated command + scope + meta.function-call.arguments.shell punctuation.definition.variable.shell, meta.function-call.arguments.shell punctuation.section.interpolation, meta.function-call.arguments.shell punctuation.definition.variable.shell, meta.function-call.arguments.shell punctuation.section.interpolation + settings + + foreground + #f38ba8 + + + + name + Shell interpolated command variable + scope + meta.string meta.interpolation.parameter.shell variable.other.readwrite + settings + + foreground + #fab387 + fontStyle + italic + + + + scope + source.shell punctuation.section.interpolation, punctuation.definition.evaluation.backticks.shell + settings + + foreground + #94e2d5 + + + + name + Shell EOF + scope + entity.name.tag.heredoc.shell + settings + + foreground + #cba6f7 + + + + name + Shell quoted variable + scope + string.quoted.double.shell variable.other.normal.shell + settings + + foreground + #cdd6f4 + + + + scope + markup.heading.synopsis.man, markup.heading.title.man, markup.heading.other.man, markup.heading.env.man + settings + + foreground + #cba6f7 + + + + scope + markup.heading.commands.man + settings + + foreground + #89b4fa + + + + scope + markup.heading.env.man + settings + + foreground + #f5c2e7 + + + + + \ No newline at end of file diff --git a/yazi/.config/yazi/init.lua b/yazi/.config/yazi/init.lua new file mode 100644 index 0000000..fefd0d1 --- /dev/null +++ b/yazi/.config/yazi/init.lua @@ -0,0 +1,87 @@ +require("yaziline"):setup({ + color = "#98c379", -- main theme color + default_files_color = "darkgray", -- color of the file counter when it's inactive + selected_files_color = "white", + yanked_files_color = "green", + cut_files_color = "red", + + separator_style = "angly", -- "angly" | "curvy" | "liney" | "empty" + separator_open = "", + separator_close = "", + separator_open_thin = "", + separator_close_thin = "", + separator_head = "", + separator_tail = "", + + select_symbol = "", + yank_symbol = "󰆐", + + filename_max_length = 24, -- truncate when filename > 24 + filename_truncate_length = 6, -- leave 6 chars on both sides + filename_truncate_separator = "..." -- the separator of the truncated filename +}) + +local path_sep = package.config:sub(1, 1) +local home_path = ya.target_family() == "windows" and os.getenv("USERPROFILE") or os.getenv("HOME") +if ya.target_family() == "windows" then + table.insert(bookmarks, { + tag = "Scoop Local", + + path = (os.getenv("SCOOP") or home_path .. "\\scoop") .. "\\", + key = "p" + }) + table.insert(bookmarks, { + tag = "Scoop Global", + path = (os.getenv("SCOOP_GLOBAL") or "C:\\ProgramData\\scoop") .. "\\", + key = "P" + }) + table.insert(bookmarks, { + tag = "Desktop", + path = home_path .. path_sep .. "Desktop" .. path_sep, + key = "d" + }) +end + +-- You can configure your bookmarks by lua language +local bookmarks = {} + +local path_sep = package.config:sub(1, 1) +local home_path = ya.target_family() == "windows" and os.getenv("USERPROFILE") or os.getenv("HOME") +if ya.target_family() == "windows" then + table.insert(bookmarks, { + tag = "Scoop Local", + + path = (os.getenv("SCOOP") or home_path .. "\\scoop") .. "\\", + key = "p" + }) + table.insert(bookmarks, { + tag = "Scoop Global", + path = (os.getenv("SCOOP_GLOBAL") or "C:\\ProgramData\\scoop") .. "\\", + key = "P" + }) +end + +table.insert(bookmarks, { + tag = "Desktop", + path = home_path .. path_sep .. "Desktop" .. path_sep, + key = "d" +}) +require("git"):setup() +require("yamb"):setup { + -- Optional, the path ending with path seperator represents folder. + bookmarks = bookmarks, + -- Optional, recieve notification everytime you jump. + jump_notify = true, + -- Optional, the cli of fzf. + cli = "fzf", + -- Optional, a string used for randomly generating keys, where the preceding characters have higher priority. + keys = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + -- Optional, the path of bookmarks + path = (ya.target_family() == "windows" and os.getenv("APPDATA") .. "\\yazi\\config\\bookmark") or + (os.getenv("HOME") .. "/.config/yazi/bookmark"), +} + +-- require("fg"):setup({ +-- default_action = "menu", -- nvim, jump +-- }) + diff --git a/yazi/.config/yazi/keymap.toml b/yazi/.config/yazi/keymap.toml new file mode 100644 index 0000000..fd243b0 --- /dev/null +++ b/yazi/.config/yazi/keymap.toml @@ -0,0 +1,385 @@ +# A TOML linter such as https://taplo.tamasfe.dev/ can use this schema to validate your config. +# If you encounter any issues, please make an issue at https://github.com/yazi-rs/schemas. +"$schema" = "https://yazi-rs.github.io/schemas/keymap.json" + +[mgr] +keymap = [ + { on = "", run = "escape", desc = "Exit visual mode, clear selected, or cancel search" }, + { on = "", run = "escape", desc = "Exit visual mode, clear selected, or cancel search" }, + { on = "q", run = "quit", desc = "Quit the process" }, + { on = "Q", run = "quit --no-cwd-file", desc = "Quit the process without outputting cwd-file" }, + { on = "", run = "close", desc = "Close the current tab, or quit if it's last" }, + { on = "", run = "suspend", desc = "Suspend the process" }, + + # Hopping + { on = "k", run = "arrow -1", desc = "Move cursor up" }, + { on = "j", run = "arrow 1", desc = "Move cursor down" }, + + { on = "", run = "arrow -1", desc = "Move cursor up" }, + { on = "", run = "arrow 1", desc = "Move cursor down" }, + + { on = "", run = "arrow -50%", desc = "Move cursor up half page" }, + { on = "", run = "arrow 50%", desc = "Move cursor down half page" }, + { on = "", run = "arrow -100%", desc = "Move cursor up one page" }, + { on = "", run = "arrow 100%", desc = "Move cursor down one page" }, + + { on = "", run = "arrow -50%", desc = "Move cursor up half page" }, + { on = "", run = "arrow 50%", desc = "Move cursor down half page" }, + { on = "", run = "arrow -100%", desc = "Move cursor up one page" }, + { on = "", run = "arrow 100%", desc = "Move cursor down one page" }, + + { on = [ "g", "g" ], run = "arrow top", desc = "Move cursor to the top" }, +{ on = "G", run = "arrow bot", desc = "Move cursor to the bottom" }, + + # Navigation + { on = "h", run = "leave", desc = "Go back to the parent directory" }, + { on = "l", run = "enter", desc = "Enter the child directory" }, + + { on = "", run = "leave", desc = "Go back to the parent directory" }, + { on = "", run = "enter", desc = "Enter the child directory" }, + + { on = "H", run = "back", desc = "Go back to the previous directory" }, + { on = "L", run = "forward", desc = "Go forward to the next directory" }, + + # Toggle + { on = "", run = [ "toggle", "arrow 1" ], desc = "Toggle the current selection state" }, + { on = "", run = "toggle_all --state=on", desc = "Select all files" }, + { on = "", run = "toggle_all", desc = "Invert selection of all files" }, + + # Visual mode + { on = "v", run = "visual_mode", desc = "Enter visual mode (selection mode)" }, + { on = "V", run = "visual_mode --unset", desc = "Enter visual mode (unset mode)" }, + + # Seeking + { on = "K", run = "seek -5", desc = "Seek up 5 units in the preview" }, + { on = "J", run = "seek 5", desc = "Seek down 5 units in the preview" }, + + # Spotting + { on = "", run = "spot", desc = "Spot hovered file" }, + + # Operation + { on = "o", run = "open", desc = "Open selected files" }, + { on = "O", run = "open --interactive", desc = "Open selected files interactively" }, + { on = "", run = "open", desc = "Open selected files" }, + { on = "", run = "open --interactive", desc = "Open selected files interactively" }, + { on = "y", run = "yank", desc = "Yank selected files (copy)" }, + { on = "x", run = "yank --cut", desc = "Yank selected files (cut)" }, + { on = "p", run = "paste", desc = "Paste yanked files" }, + { on = "P", run = "paste --force", desc = "Paste yanked files (overwrite if the destination exists)" }, + { on = "-", run = "link", desc = "Symlink the absolute path of yanked files" }, + { on = "_", run = "link --relative", desc = "Symlink the relative path of yanked files" }, + { on = "", run = "hardlink", desc = "Hardlink yanked files" }, + { on = "Y", run = "unyank", desc = "Cancel the yank status" }, + { on = "X", run = "unyank", desc = "Cancel the yank status" }, + { on = "d", run = "remove", desc = "Trash selected files" }, + { on = "D", run = "remove --permanently", desc = "Permanently delete selected files" }, + { on = "a", run = "create", desc = "Create a file (ends with / for directories)" }, + { on = "r", run = "rename --cursor=before_ext", desc = "Rename selected file(s)" }, + { on = ";", run = "shell --interactive", desc = "Run a shell command" }, + { on = ":", run = "shell --block --interactive", desc = "Run a shell command (block until finishes)" }, + { on = ".", run = "hidden toggle", desc = "Toggle the visibility of hidden files" }, + { on = "s", run = "search --via=fd", desc = "Search files by name via fd" }, + { on = "S", run = "search --via=rg", desc = "Search files by content via ripgrep" }, + { on = "", run = "escape --search", desc = "Cancel the ongoing search" }, + { on = "z", run = "plugin zoxide", desc = "Jump to a directory via zoxide" }, + { on = "Z", run = "plugin fzf", desc = "Jump to a file/directory via fzf" }, + + # Linemode + { on = [ "m", "s" ], run = "linemode size", desc = "Linemode: size" }, + { on = [ "m", "p" ], run = "linemode permissions", desc = "Linemode: permissions" }, + { on = [ "m", "b" ], run = "linemode btime", desc = "Linemode: btime" }, + { on = [ "m", "m" ], run = "linemode mtime", desc = "Linemode: mtime" }, + { on = [ "m", "o" ], run = "linemode owner", desc = "Linemode: owner" }, + { on = [ "m", "n" ], run = "linemode none", desc = "Linemode: none" }, + + # Copy + { on = [ "c", "c" ], run = "copy path", desc = "Copy the file path" }, + { on = [ "c", "d" ], run = "copy dirname", desc = "Copy the directory path" }, + { on = [ "c", "f" ], run = "copy filename", desc = "Copy the filename" }, + { on = [ "c", "n" ], run = "copy name_without_ext", desc = "Copy the filename without extension" }, + + # Filter + { on = "f", run = "filter --smart", desc = "Filter files" }, + + # Find + { on = "/", run = "find --smart", desc = "Find next file" }, + { on = "?", run = "find --previous --smart", desc = "Find previous file" }, + { on = "n", run = "find_arrow", desc = "Goto the next found" }, + { on = "N", run = "find_arrow --previous", desc = "Goto the previous found" }, + + # Sorting + { on = [ ",", "m" ], run = [ "sort mtime --reverse=no", "linemode mtime" ], desc = "Sort by modified time" }, + { on = [ ",", "M" ], run = [ "sort mtime --reverse", "linemode mtime" ], desc = "Sort by modified time (reverse)" }, + { on = [ ",", "b" ], run = [ "sort btime --reverse=no", "linemode btime" ], desc = "Sort by birth time" }, + { on = [ ",", "B" ], run = [ "sort btime --reverse", "linemode btime" ], desc = "Sort by birth time (reverse)" }, + { on = [ ",", "e" ], run = "sort extension --reverse=no", desc = "Sort by extension" }, + { on = [ ",", "E" ], run = "sort extension --reverse", desc = "Sort by extension (reverse)" }, + { on = [ ",", "a" ], run = "sort alphabetical --reverse=no", desc = "Sort alphabetically" }, + { on = [ ",", "A" ], run = "sort alphabetical --reverse", desc = "Sort alphabetically (reverse)" }, + { on = [ ",", "n" ], run = "sort natural --reverse=no", desc = "Sort naturally" }, + { on = [ ",", "N" ], run = "sort natural --reverse", desc = "Sort naturally (reverse)" }, + { on = [ ",", "s" ], run = [ "sort size --reverse=no", "linemode size" ], desc = "Sort by size" }, + { on = [ ",", "S" ], run = [ "sort size --reverse", "linemode size" ], desc = "Sort by size (reverse)" }, + { on = [ ",", "r" ], run = "sort random --reverse=no", desc = "Sort randomly" }, + + # Tabs + { on = "t", run = "tab_create --current", desc = "Create a new tab with CWD" }, + + { on = "1", run = "tab_switch 0", desc = "Switch to the first tab" }, + { on = "2", run = "tab_switch 1", desc = "Switch to the second tab" }, + { on = "3", run = "tab_switch 2", desc = "Switch to the third tab" }, + { on = "4", run = "tab_switch 3", desc = "Switch to the fourth tab" }, + { on = "5", run = "tab_switch 4", desc = "Switch to the fifth tab" }, + { on = "6", run = "tab_switch 5", desc = "Switch to the sixth tab" }, + { on = "7", run = "tab_switch 6", desc = "Switch to the seventh tab" }, + { on = "8", run = "tab_switch 7", desc = "Switch to the eighth tab" }, + { on = "9", run = "tab_switch 8", desc = "Switch to the ninth tab" }, + + { on = "[", run = "tab_switch -1 --relative", desc = "Switch to the previous tab" }, + { on = "]", run = "tab_switch 1 --relative", desc = "Switch to the next tab" }, + + { on = "{", run = "tab_swap -1", desc = "Swap current tab with previous tab" }, + { on = "}", run = "tab_swap 1", desc = "Swap current tab with next tab" }, + + # Tasks + { on = "w", run = "tasks_show", desc = "Show task manager" }, + + # Help + { on = "~", run = "help", desc = "Open help" }, + { on = "", run = "help", desc = "Open help" }, +] + # eza keymaps https://github.com/ahkohd/eza-preview.yazi +prepend_keymap = [ + { on = [ "" ], run = "plugin eza-preview", desc = "Toggle tree/list dir preview" }, + { on = [ "" ], run = "plugin eza-preview '--dec-level'", desc = "Decrement tree level" }, + { on = [ "" ], run = "plugin eza-preview '--toggle-follow-symlinks'", desc = "Toggle tree follow symlinks" }, +# ouch https://github.com/ndtoan96/ouch.yazi + { on = ["C"], run = "plugin ouch 'zip'", desc = "Compress with ouch" }, +# https://github.com/iynaix/time-travel.yazi + { on = ["W", "h"], run = "plugin time-travel 'prev'", desc = "Go to previous snapshot"}, + { on = ["W", "l"], run = "plugin time-travel 'next'", desc = "Go to next snapshot"}, + { on = ["W", "e"], run = "plugin time-travel 'exit'", desc = "Exit browsing snapshots"}, + # https://github.com/Lil-Dank/lazygit.yazi + { on = [ "g", "i" ], run = "plugin lazygit", desc = "run lazygit"}, + # mount + { on = "M", run = "plugin mount" }, +# yamb.yazi https://github.com/h-hg/yamb.yazi + { on = [ "u", "a" ], run = "plugin yamb 'save'", desc = "Add bookmark"}, + { on = [ "u", "g" ], run = "plugin yamb 'jump_by_key'", desc = "Jump bookmark by key"}, + { on = [ "u", "G" ], run = "plugin yamb 'jump_by_fzf'", desc = "Jump bookmark by fzf"}, + { on = [ "u", "d" ], run = "plugin yamb 'delete_by_key'", desc = "Delete bookmark by key"}, + { on = [ "u", "D" ], run = "plugin yamb 'delete_by_fzf'", desc = "Delete bookmark by fzf"}, + { on = [ "u", "A" ], run = "plugin yamb 'delete_all'", desc = "Delete all bookmarks"}, + { on = [ "u", "r" ], run = "plugin yamb 'rename_by_key'", desc = "Rename bookmark by key"}, + { on = [ "u", "R" ], run = "plugin yamb 'rename_by_fzf'", desc = "Rename bookmark by fzf"}, + # chmode https://github.com/yazi-rs/plugins/tree/main/chmod.yazi + { on = [ "c", "m" ], run = "plugin chmod", desc = "Chmod on selected files" }, + # https://gitee.com/DreamMaoMao/fg.yazi + { on = [ "f","g" ], run = "plugin fg", desc = "find file by content (fuzzy match)" }, + { on = [ "f","G" ], run = "plugin fg 'rg'", desc = "find file by content (ripgrepmatch)" }, + { on = [ "f","f" ], run = "plugin fg 'fzf'", desc = "find file by filename" }, + # toggle view + { on = [ "i", "a" ], run = "plugin toggle-view 'parent'", desc = "Toggle parent" }, + { on = [ "i", "s" ], run = "plugin toggle-view 'current'", desc = "Toggle current" }, + { on = [ "i", "d"], run = "plugin toggle-view 'preview'", desc = "Toggle preview" }, +] + + +[tasks] + +keymap = [ + { on = "", run = "close", desc = "Close task manager" }, + { on = "", run = "close", desc = "Close task manager" }, + { on = "", run = "close", desc = "Close task manager" }, + { on = "w", run = "close", desc = "Close task manager" }, + + { on = "k", run = "arrow -1", desc = "Move cursor up" }, + { on = "j", run = "arrow 1", desc = "Move cursor down" }, + + { on = "", run = "arrow -1", desc = "Move cursor up" }, + { on = "", run = "arrow 1", desc = "Move cursor down" }, + + { on = "", run = "inspect", desc = "Inspect the task" }, + { on = "x", run = "cancel", desc = "Cancel the task" }, + + # Help + { on = "~", run = "help", desc = "Open help" }, + { on = "", run = "help", desc = "Open help" }, +] + +[spot] + +keymap = [ + { on = "", run = "close", desc = "Close the spot" }, + { on = "", run = "close", desc = "Close the spot" }, + { on = "", run = "close", desc = "Close the spot" }, + { on = "", run = "close", desc = "Close the spot" }, + + { on = "k", run = "arrow -1", desc = "Move cursor up" }, + { on = "j", run = "arrow 1", desc = "Move cursor down" }, + { on = "h", run = "swipe -1", desc = "Swipe to the next file" }, + { on = "l", run = "swipe 1", desc = "Swipe to the previous file" }, + + { on = "", run = "arrow -1", desc = "Move cursor up" }, + { on = "", run = "arrow 1", desc = "Move cursor down" }, + { on = "", run = "swipe -1", desc = "Swipe to the next file" }, + { on = "", run = "swipe 1", desc = "Swipe to the previous file" }, + + # Copy + { on = [ "c", "c" ], run = "copy cell", desc = "Copy selected cell" }, + + # Help + { on = "~", run = "help", desc = "Open help" }, + { on = "", run = "help", desc = "Open help" }, +] + +[pick] + +keymap = [ + { on = "", run = "close", desc = "Cancel pick" }, + { on = "", run = "close", desc = "Cancel pick" }, + { on = "", run = "close", desc = "Cancel pick" }, + { on = "", run = "close --submit", desc = "Submit the pick" }, + + { on = "k", run = "arrow -1", desc = "Move cursor up" }, + { on = "j", run = "arrow 1", desc = "Move cursor down" }, + + { on = "", run = "arrow -1", desc = "Move cursor up" }, + { on = "", run = "arrow 1", desc = "Move cursor down" }, + + # Help + { on = "~", run = "help", desc = "Open help" }, + { on = "", run = "help", desc = "Open help" }, +] + +[input] + +keymap = [ + { on = "", run = "close", desc = "Cancel input" }, + { on = "", run = "close --submit", desc = "Submit input" }, + { on = "", run = "escape", desc = "Go back the normal mode, or cancel input" }, + { on = "", run = "escape", desc = "Go back the normal mode, or cancel input" }, + + # Mode + { on = "i", run = "insert", desc = "Enter insert mode" }, + { on = "a", run = "insert --append", desc = "Enter append mode" }, + { on = "I", run = [ "move -999", "insert" ], desc = "Move to the BOL, and enter insert mode" }, + { on = "A", run = [ "move 999", "insert --append" ], desc = "Move to the EOL, and enter append mode" }, + { on = "v", run = "visual", desc = "Enter visual mode" }, + { on = "V", run = [ "move -999", "visual", "move 999" ], desc = "Enter visual mode and select all" }, + + # Character-wise movement + { on = "h", run = "move -1", desc = "Move back a character" }, + { on = "l", run = "move 1", desc = "Move forward a character" }, + { on = "", run = "move -1", desc = "Move back a character" }, + { on = "", run = "move 1", desc = "Move forward a character" }, + { on = "", run = "move -1", desc = "Move back a character" }, + { on = "", run = "move 1", desc = "Move forward a character" }, + + # Word-wise movement + { on = "b", run = "backward", desc = "Move back to the start of the current or previous word" }, + { on = "w", run = "forward", desc = "Move forward to the start of the next word" }, + { on = "e", run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" }, + { on = "", run = "backward", desc = "Move back to the start of the current or previous word" }, + { on = "", run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" }, + + # Line-wise movement + { on = "0", run = "move -999", desc = "Move to the BOL" }, + { on = "$", run = "move 999", desc = "Move to the EOL" }, + { on = "", run = "move -999", desc = "Move to the BOL" }, + { on = "", run = "move 999", desc = "Move to the EOL" }, + { on = "", run = "move -999", desc = "Move to the BOL" }, + { on = "", run = "move 999", desc = "Move to the EOL" }, + + # Delete + { on = "", run = "backspace", desc = "Delete the character before the cursor" }, + { on = "", run = "backspace --under", desc = "Delete the character under the cursor" }, + { on = "", run = "backspace", desc = "Delete the character before the cursor" }, + { on = "", run = "backspace --under", desc = "Delete the character under the cursor" }, + + # Kill + { on = "", run = "kill bol", desc = "Kill backwards to the BOL" }, + { on = "", run = "kill eol", desc = "Kill forwards to the EOL" }, + { on = "", run = "kill backward", desc = "Kill backwards to the start of the current word" }, + { on = "", run = "kill forward", desc = "Kill forwards to the end of the current word" }, + + # Cut/Yank/Paste + { on = "d", run = "delete --cut", desc = "Cut the selected characters" }, + { on = "D", run = [ "delete --cut", "move 999" ], desc = "Cut until the EOL" }, + { on = "c", run = "delete --cut --insert", desc = "Cut the selected characters, and enter insert mode" }, + { on = "C", run = [ "delete --cut --insert", "move 999" ], desc = "Cut until the EOL, and enter insert mode" }, + { on = "x", run = [ "delete --cut", "move 1 --in-operating" ], desc = "Cut the current character" }, + { on = "y", run = "yank", desc = "Copy the selected characters" }, + { on = "p", run = "paste", desc = "Paste the copied characters after the cursor" }, + { on = "P", run = "paste --before", desc = "Paste the copied characters before the cursor" }, + + # Undo/Redo + { on = "u", run = "undo", desc = "Undo the last operation" }, + { on = "", run = "redo", desc = "Redo the last operation" }, + + # Help + { on = "~", run = "help", desc = "Open help" }, + { on = "", run = "help", desc = "Open help" }, +] + +[confirm] + +keymap = [ + { on = "", run = "close", desc = "Cancel the confirm" }, + { on = "", run = "close", desc = "Cancel the confirm" }, + { on = "", run = "close", desc = "Cancel the confirm" }, + { on = "", run = "close --submit", desc = "Submit the confirm" }, + + { on = "n", run = "close", desc = "Cancel the confirm" }, + { on = "y", run = "close --submit", desc = "Submit the confirm" }, + + { on = "k", run = "arrow -1", desc = "Move cursor up" }, + { on = "j", run = "arrow 1", desc = "Move cursor down" }, + + { on = "", run = "arrow -1", desc = "Move cursor up" }, + { on = "", run = "arrow 1", desc = "Move cursor down" }, + + # Help + { on = "~", run = "help", desc = "Open help" }, + { on = "", run = "help", desc = "Open help" }, +] + +[completion] + +keymap = [ + { on = "", run = "close", desc = "Cancel completion" }, + { on = "", run = "close --submit", desc = "Submit the completion" }, + { on = "", run = [ "close --submit", "close_input --submit" ], desc = "Submit the completion and input" }, + + { on = "", run = "arrow -1", desc = "Move cursor up" }, + { on = "", run = "arrow 1", desc = "Move cursor down" }, + + { on = "", run = "arrow -1", desc = "Move cursor up" }, + { on = "", run = "arrow 1", desc = "Move cursor down" }, + + { on = "", run = "arrow -1", desc = "Move cursor up" }, + { on = "", run = "arrow 1", desc = "Move cursor down" }, + + # Help + { on = "~", run = "help", desc = "Open help" }, + { on = "", run = "help", desc = "Open help" }, +] + +[help] + +keymap = [ + { on = "", run = "escape", desc = "Clear the filter, or hide the help" }, + { on = "", run = "escape", desc = "Clear the filter, or hide the help" }, + { on = "", run = "close", desc = "Hide the help" }, + + # Navigation + { on = "k", run = "arrow -1", desc = "Move cursor up" }, + { on = "j", run = "arrow 1", desc = "Move cursor down" }, + + { on = "", run = "arrow -1", desc = "Move cursor up" }, + { on = "", run = "arrow 1", desc = "Move cursor down" }, + + # Filtering + { on = "f", run = "filter", desc = "Apply a filter for the help items" }, +] diff --git a/yazi/.config/yazi/package.toml b/yazi/.config/yazi/package.toml new file mode 100644 index 0000000..aeece26 --- /dev/null +++ b/yazi/.config/yazi/package.toml @@ -0,0 +1,54 @@ +[[plugin.deps]] +use = "ahkohd/eza-preview" +rev = "5ef05bc" +hash = "72355a6c8b7c8de6ed4dda0f98f86fee" + +[[plugin.deps]] +use = "iynaix/time-travel" +rev = "85baafd" +hash = "653fca8253e8cc431e7b1ceacc53ccfc" + +[[plugin.deps]] +use = "AnirudhG07/rich-preview" +rev = "6752254" +hash = "c9a3d0731e7d7340e2c6d6126b1f3aa3" + +[[plugin.deps]] +use = "yazi-rs/plugins:chmod" +rev = "02d18be" +hash = "4c7e8fd0266eedee7b619d966bd2d025" + +[[plugin.deps]] +use = "Sonico98/exifaudio" +rev = "d794614" +hash = "a8e15d3c21c02a5af41d46ed04778a02" + +[[plugin.deps]] +use = "dawsers/toggle-view" +rev = "9ae57f9" +hash = "9d291f6cecb1f1f5542fc18177d5c107" + +[[plugin.deps]] +use = "llanosrocas/yaziline" +rev = "1342efe" +hash = "a84a339953a568fee1d8beb63e6dca73" + +[[plugin.deps]] +use = "h-hg/yamb" +rev = "22af003" +hash = "7cc42012a7c2099f80064d228feb8d44" + +[[plugin.deps]] +use = "Lil-Dank/lazygit" +rev = "7a08a09" +hash = "a1fa2b3e1826c3a34804ea8c548e9f80" + +[[plugin.deps]] +use = "yazi-rs/plugins:mount" +rev = "5eea960" +hash = "b3f1d6ec3721d4061aad5f69cddb0cf9" + +[[flavor.deps]] +use = "yazi-rs/flavors:catppuccin-mocha" +rev = "fc8eeaa" +hash = "407710c2af9621a8351453e637d6c870" diff --git a/yazi/.config/yazi/plugins/PPDATAyaziconfigpluginsfg.yazi b/yazi/.config/yazi/plugins/PPDATAyaziconfigpluginsfg.yazi new file mode 160000 index 0000000..c201a3e --- /dev/null +++ b/yazi/.config/yazi/plugins/PPDATAyaziconfigpluginsfg.yazi @@ -0,0 +1 @@ +Subproject commit c201a3e1c0cda921c06019127886f16faef4b17e diff --git a/yazi/.config/yazi/plugins/chmod.yazi/LICENSE b/yazi/.config/yazi/plugins/chmod.yazi/LICENSE new file mode 100644 index 0000000..fb5b1d6 --- /dev/null +++ b/yazi/.config/yazi/plugins/chmod.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 yazi-rs + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. diff --git a/yazi/.config/yazi/plugins/chmod.yazi/README.md b/yazi/.config/yazi/plugins/chmod.yazi/README.md new file mode 100644 index 0000000..e8a6614 --- /dev/null +++ b/yazi/.config/yazi/plugins/chmod.yazi/README.md @@ -0,0 +1,28 @@ +# chmod.yazi + +Execute `chmod` on the selected files to change their mode. This plugin is only available on Unix platforms since it relies on [`chmod(2)`](https://man7.org/linux/man-pages/man2/chmod.2.html). + +https://github.com/yazi-rs/plugins/assets/17523360/7aa3abc2-d057-498c-8473-a6282c59c464 + +## Installation + +```sh +ya pack -a yazi-rs/plugins:chmod +``` + +## Usage + +Add this to your `~/.config/yazi/keymap.toml`: + +```toml +[[manager.prepend_keymap]] +on = [ "c", "m" ] +run = "plugin chmod" +desc = "Chmod on selected files" +``` + +Make sure the c => m key is not used elsewhere. + +## License + +This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file. diff --git a/yazi/.config/yazi/plugins/chmod.yazi/main.lua b/yazi/.config/yazi/plugins/chmod.yazi/main.lua new file mode 100644 index 0000000..c2687b0 --- /dev/null +++ b/yazi/.config/yazi/plugins/chmod.yazi/main.lua @@ -0,0 +1,39 @@ +local selected_or_hovered = ya.sync(function() + local tab, paths = cx.active, {} + for _, u in pairs(tab.selected) do + paths[#paths + 1] = tostring(u) + end + if #paths == 0 and tab.current.hovered then + paths[1] = tostring(tab.current.hovered.url) + end + return paths +end) + +return { + entry = function() + ya.manager_emit("escape", { visual = true }) + + local urls = selected_or_hovered() + if #urls == 0 then + return ya.notify { title = "Chmod", content = "No file selected", level = "warn", timeout = 5 } + end + + local value, event = ya.input { + title = "Chmod:", + position = { "top-center", y = 3, w = 40 }, + } + if event ~= 1 then + return + end + + local status, err = Command("chmod"):arg(value):arg(urls):spawn():wait() + if not status or not status.success then + ya.notify { + title = "Chmod", + content = string.format("Chmod on selected files failed, error: %s", status and status.code or err), + level = "error", + timeout = 5, + } + end + end, +} diff --git a/yazi/.config/yazi/plugins/exifaudio.yazi/LICENSE b/yazi/.config/yazi/plugins/exifaudio.yazi/LICENSE new file mode 100644 index 0000000..78aae84 --- /dev/null +++ b/yazi/.config/yazi/plugins/exifaudio.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Sonico98 + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. diff --git a/yazi/.config/yazi/plugins/exifaudio.yazi/README.md b/yazi/.config/yazi/plugins/exifaudio.yazi/README.md new file mode 100644 index 0000000..e646d0c --- /dev/null +++ b/yazi/.config/yazi/plugins/exifaudio.yazi/README.md @@ -0,0 +1,38 @@ +# exifaudio.yazi + +Preview audio metadata and cover on [Yazi](https://github.com/sxyazi/yazi). + +![image](https://github.com/Sonico98/exifaudio.yazi/assets/61394886/53c1492c-9f05-4c80-a4e7-94fb36f35ca9) + +## Installation + +```sh +# Automatically with yazi 0.3.0 +ya pack -a "Sonico98/exifaudio" + +# Or manually under: +# Linux/macOS +git clone https://github.com/Sonico98/exifaudio.yazi.git ~/.config/yazi/plugins/exifaudio.yazi + +# Windows +git clone https://github.com/Sonico98/exifaudio.yazi.git %AppData%\yazi\config\plugins\exifaudio.yazi +``` + +## Usage + +Add the following to your `yazi.toml`: + +```toml +[plugin] +prepend_previewers = [ + { mime = "audio/*", run = "exifaudio"} +] +``` + +Make sure you have [exiftool](https://exiftool.org/) installed and in your `PATH`. + +Optional: if you have [mediainfo](https://mediaarea.net/en/MediaInfo) installed and in your `PATH`, it will be used instead for more accurate metadata. Exiftool is still required to display the cover. + +## Thanks + +Thanks to [sxyazi](https://github.com/sxyazi) for the PDF previewer code, on which this previewer is based on. diff --git a/yazi/.config/yazi/plugins/exifaudio.yazi/main.lua b/yazi/.config/yazi/plugins/exifaudio.yazi/main.lua new file mode 100644 index 0000000..3aacdd0 --- /dev/null +++ b/yazi/.config/yazi/plugins/exifaudio.yazi/main.lua @@ -0,0 +1,231 @@ +local M = {} + +function GetPath(str) + local sep = '/' + if ya.target_family() == "windows" then + sep = '\\' + end + return str:match("(.*"..sep..")") +end + +function Exiftool(...) + local child = Command("exiftool") + :arg({ + "-q", "-q", "-S", "-Title", "-SortName", + "-TitleSort", "-TitleSortOrder", "-Artist", + "-SortArtist", "-ArtistSort", "-PerformerSortOrder", + "-Album", "-SortAlbum", "-AlbumSort", "-AlbumSortOrder", + "-AlbumArtist", "-SortAlbumArtist", "-AlbumArtistSort", + "-AlbumArtistSortOrder", "-Genre", "-TrackNumber", + "-Year", "-Duration", "-SampleRate", + "-AudioSampleRate", "-AudioBitrate", "-AvgBitrate", + "-Channels", "-AudioChannels", tostring(...), + }) + :stdout(Command.PIPED) + :stderr(Command.NULL) + :spawn() + return child +end + +function Mediainfo(...) + local file, cache_dir = ... + local template = cache_dir.."mediainfo.txt" + local child = Command("mediainfo") + :arg({ + "--Output=file://"..template, tostring(file) + }) + :stdout(Command.PIPED) + :stderr(Command.NULL) + :spawn() + return child +end + +function M:peek(job) + local cache = ya.file_cache(job) + if not cache then + return + end + + -- Get cache dir to find the mediainfo template file + local cache_dir = GetPath(tostring(cache)) + + -- Try mediainfo, otherwise use exiftool + local status, child = pcall(Mediainfo, job.file.url, cache_dir) + if not status or child == nil then + status, child = pcall(Exiftool, job.file.url) + if not status or child == nil then + local error = ui.Line { ui.Span("Make sure exiftool is installed and in your PATH") } + -- TODO)) Remove legacy method when v0.4 gets released + local function display_error_legacy() + local p = ui.Paragraph(job.area, { error }):wrap(ui.Paragraph.WRAP) + ya.preview_widgets(job, { p }) + end + local function display_error() + local p = ui.Text(error):area(job.area):wrap(ui.Text.WRAP) + ya.preview_widgets(job, { p }) + end + if pcall(display_error) then else pcall(display_error_legacy) end + return + end + end + + local limit = job.area.h + local i, metadata = 0, {} + repeat + local next, event = child:read_line() + if event == 1 then + return self:fallback_to_builtin() + elseif event ~= 0 then + break + end + + i = i + 1 + if i > job.skip then + local m_title, m_tag = Prettify(next) + if m_title ~= "" and m_tag ~= "" then + local ti = ui.Span(m_title):bold() + local ta = ui.Span(m_tag) + table.insert(metadata, ui.Line{ti, ta}) + table.insert(metadata, ui.Line{}) + end + end + until i >= job.skip + limit + + -- TODO)) Remove legacy method when v0.4 gets released + local function display_metadata_legacy() + local p = ui.Paragraph(job.area, metadata):wrap(ui.Paragraph.WRAP) + ya.preview_widgets(job, { p }) + end + local function display_metadata() + local p = ui.Text(metadata):area(job.area):wrap(ui.Text.WRAP) + ya.preview_widgets(job, { p }) + end + if pcall(display_metadata) then else pcall(display_metadata_legacy) end + + local cover_width = job.area.w / 2 - 5 + local cover_height = (job.area.h / 4) + 3 + + local bottom_right = ui.Rect { + x = job.area.right - cover_width, + y = job.area.bottom - cover_height, + w = cover_width, + h = cover_height, + } + + if self:preload(job) == 1 then + ya.image_show(cache, bottom_right) + end +end + +function Prettify(metadata) + local substitutions = { + Sortname = "Sort Title:", + SortName = "Sort Title:", + TitleSort = "Sort Title:", + TitleSortOrder = "Sort Title:", + ArtistSort = "Sort Artist:", + SortArtist = "Sort Artist:", + Artist = "Artist:", + ARTIST = "Artist:", + PerformerSortOrder = "Sort Artist:", + SortAlbumArtist = "Sort Album Artist:", + AlbumArtistSortOrder = "Sort Album Artist:", + AlbumArtistSort = "Sort Album Artist:", + AlbumSortOrder = "Sort Album:", + AlbumSort = "Sort Album:", + SortAlbum = "Sort Album:", + Album = "Album:", + ALBUM = "Album:", + AlbumArtist = "Album Artist:", + Genre = "Genre:", + GENRE = "Genre:", + TrackNumber = "Track Number:", + Year = "Year:", + Duration = "Duration:", + AudioBitrate = "Bitrate:", + AvgBitrate = "Average Bitrate:", + AudioSampleRate = "Sample Rate:", + SampleRate = "Sample Rate:", + AudioChannels = "Channels:" + } + + for k, v in pairs(substitutions) do + metadata = metadata:gsub(tostring(k)..":", v, 1) + end + + -- Separate the tag title from the tag data + local t={} + for str in string.gmatch(metadata , "([^"..":".."]+)") do + if str ~= "\n" then + table.insert(t, str) + else + table.insert(t, nil) + end + end + + -- Add back semicolon to title, rejoin tag data if it happened to contain a semicolon + local title, tag_data = "", "" + if t[1] ~= nil then + title, tag_data = t[1]..":", table.concat(t, ":", 2) + end + return title, tag_data + +end + +function M:seek(job) + local h = cx.active.current.hovered + if h and h.url == job.file.url then + ya.manager_emit("peek", { + tostring(math.max(0, cx.active.preview.skip + job.units)), + only_if = tostring(job.file.url), + }) + end +end + +function M:preload(job) + local cache = ya.file_cache(job) + if not cache or fs.cha(cache) then + return 1 + end + + local mediainfo_template = 'General;"\ +$if(%Track%,Title: %Track%,)\ +$if(%Track/Sort%,Sort Title: %Track/Sort%,)\ +$if(%Title/Sort%,Sort Title: %Title/Sort%,)\ +$if(%TITLESORT%,Sort Title: %TITLESORT%,)\ +$if(%Performer%,Artist: %Performer%,)\ +$if(%Performer/Sort%,Sort Artist: %Performer/Sort%,)\ +$if(%ARTISTSORT%,Sort Artist: %ARTISTSORT%,)\ +$if(%Album%,Album: %Album%,)\ +$if(%Album/Sort%,Sort Album: %Album/Sort%)\ +$if(%ALBUMSORT%,Sort Album: %ALBUMSORT%)\ +$if(%Album/Performer%,Album Artist: %Album/Performer%)\ +$if(%Album/Performer/Sort%,Sort Album Artist: %Album/Performer/Sort%)\ +$if(%Genre%,Genre: %Genre%)\ +$if(%Track/Position%,Track Number: %Track/Position%)\ +$if(%Recorded_Date%,Year: %Recorded_Date%)\ +$if(%Duration/String%,Duration: %Duration/String%)\ +$if(%BitRate/String%,Bitrate: %BitRate/String%)\ +"\ +Audio;"Sample Rate: %SamplingRate%\ +Channels: %Channel(s)%"\ +' + + -- Write the mediainfo template file into yazi's cache dir + local cache_dir = GetPath(tostring(cache)) + fs.write(Url(cache_dir.."mediainfo.txt"), mediainfo_template) + + local output = Command("exiftool") + :arg({ "-b", "-CoverArt", "-Picture", tostring(job.file.url) }) + :stdout(Command.PIPED) + :stderr(Command.PIPED) + :output() + + if not output then + return 0 + end + + return fs.write(cache, output.stdout) and 1 or 2 +end + +return M diff --git a/yazi/.config/yazi/plugins/eza-preview.yazi/LICENSE b/yazi/.config/yazi/plugins/eza-preview.yazi/LICENSE new file mode 100644 index 0000000..14b7911 --- /dev/null +++ b/yazi/.config/yazi/plugins/eza-preview.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 sharklasers996 + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. diff --git a/yazi/.config/yazi/plugins/eza-preview.yazi/README.md b/yazi/.config/yazi/plugins/eza-preview.yazi/README.md new file mode 100644 index 0000000..0694dbe --- /dev/null +++ b/yazi/.config/yazi/plugins/eza-preview.yazi/README.md @@ -0,0 +1,63 @@ +# eza-preview.yazi + +[Yazi](https://github.com/sxyazi/yazi) plugin to preview directories using [eza](https://github.com/eza-community/eza), can be switched between list and tree modes. + +List mode: +![list.png](list.png) + +Tree mode: +![tree.png](tree.png) + +## Requirements + +- [yazi (0.4+) or nightly](https://github.com/sxyazi/yazi) +- [eza (0.20+)](https://github.com/eza-community/eza) + +## Installation + +### Linux/MacOS + +```sh +ya pack -a ahkohd/eza-preview +``` + +## Usage + +Add `eza-preview` to previewers in `yazi.toml`: + +```toml +[[plugin.prepend_previewers]] +name = "*/" +run = "eza-preview" +``` + +Set key binding to switch between list and tree modes in `keymap.toml`: + +```toml +[manager] +prepend_keymap = [ + { on = [ "E" ], run = "plugin eza-preview", desc = "Toggle tree/list dir preview" }, + { on = [ "-" ], run = "plugin eza-preview --args='--inc-level'", desc = "Increment tree level" }, + { on = [ "_" ], run = "plugin eza-preview --args='--dec-level'", desc = "Decrement tree level" }, + { on = [ "$" ], run = "plugin eza-preview --args='--toggle-follow-symlinks'", desc = "Toggle tree follow symlinks" }, +] +``` + +List mode is the default, if you want to have tree mode instead when starting yazi - update `init.lua` with: + +```lua +require("eza-preview"):setup({ + -- Determines the directory depth level to tree preview (default: 3) + level = 3, + + -- Whether to follow symlinks when previewing directories (default: false) + follow_symlinks = false + + -- Whether to show target file info instead of symlink info (default: false) + dereference = false +}) + +-- Or use default settings with empty table +require("eza-preview"):setup({}) + +``` diff --git a/yazi/.config/yazi/plugins/eza-preview.yazi/main.lua b/yazi/.config/yazi/plugins/eza-preview.yazi/main.lua new file mode 100644 index 0000000..e87963e --- /dev/null +++ b/yazi/.config/yazi/plugins/eza-preview.yazi/main.lua @@ -0,0 +1,157 @@ +local M = {} + +local function fail(s, ...) + ya.notify({ title = "Eza Preview", content = string.format(s, ...), timeout = 5, level = "error" }) +end + +local toggle_view_mode = ya.sync(function(state, _) + if state.tree == nil then + state.tree = false + end + + state.tree = not state.tree +end) + +local is_tree_view_mode = ya.sync(function(state, _) + return state.tree +end) + +local set_opts = ya.sync(function(state, opts) + if state.opts == nil then + state.opts = { level = 3, follow_symlinks = false, dereference = false } + end + + for key, value in pairs(opts or {}) do + state.opts[key] = value + end +end) + +local get_opts = ya.sync(function(state) + return state.opts +end) + +local inc_level = ya.sync(function(state) + state.opts.level = state.opts.level + 1 +end) + +local dec_level = ya.sync(function(state) + if state.opts.level > 1 then + state.opts.level = state.opts.level - 1 + end +end) + +local toggle_follow_symlinks = ya.sync(function(state) + state.opts.follow_symlinks = not state.opts.follow_symlinks +end) + +function M:setup(opts) + set_opts(opts) + + toggle_view_mode() +end + +function M:entry(job) + local arg = job.arg + + if arg["inc_level"] ~= nil then + inc_level() + elseif arg["dec_level"] ~= nil then + dec_level() + elseif arg["toggle_follow_symlinks"] ~= nil then + toggle_follow_symlinks() + else + set_opts() + toggle_view_mode() + end + + ya.manager_emit("seek", { 0 }) +end + +function M:peek(job) + local opts = get_opts() + + local arg = { + "--all", + "--color=always", + "--icons=always", + "--group-directories-first", + "--no-quotes", + tostring(job.file.url), + } + + if is_tree_view_mode() then + table.insert(arg, "--tree") + table.insert(arg, string.format("--level=%d", opts.level)) + end + + if opts then + if opts.follow_symlinks then + table.insert(arg, "--follow-symlinks") + end + + if opts.dereference then + table.insert(arg, "--dereference") + end + end + + local child = Command("eza"):arg(arg):stdout(Command.PIPED):stderr(Command.PIPED):spawn() + + local limit = job.area.h + local lines = "" + local num_lines = 1 + local num_skip = 0 + local empty_output = false + + repeat + local line, event = child:read_line() + if event == 1 then + fail(tostring(event)) + elseif event ~= 0 then + break + end + + if num_skip >= job.skip then + lines = lines .. line + num_lines = num_lines + 1 + else + num_skip = num_skip + 1 + end + until num_lines >= limit + + if num_lines == 1 and not is_tree_view_mode() then + empty_output = true + elseif num_lines == 2 and is_tree_view_mode() then + empty_output = true + end + + child:start_kill() + if job.skip > 0 and num_lines < limit then + ya.manager_emit("peek", { + tostring(math.max(0, job.skip - (limit - num_lines))), + only_if = tostring(job.file.url), + upper_bound = "", + }) + elseif empty_output then + ya.preview_widgets(job, { + ui.Text({ ui.Line("No items") }):area(job.area):align(ui.Text.CENTER), + }) + else + ya.preview_widgets(job, { ui.Text.parse(lines):area(job.area) }) + end +end + +function M:seek(job) + local h = cx.active.current.hovered + + if h and h.url == job.file.url then + local step = math.floor(job.units * job.area.h / 10) + + ya.manager_emit("peek", { + math.max(0, cx.active.preview.skip + step), + only_if = tostring(job.file.url), + force = true, + }) + end +end + +return M diff --git a/yazi/.config/yazi/plugins/fg.yazi b/yazi/.config/yazi/plugins/fg.yazi new file mode 160000 index 0000000..c201a3e --- /dev/null +++ b/yazi/.config/yazi/plugins/fg.yazi @@ -0,0 +1 @@ +Subproject commit c201a3e1c0cda921c06019127886f16faef4b17e diff --git a/yazi/.config/yazi/plugins/git.yazi/LICENSE b/yazi/.config/yazi/plugins/git.yazi/LICENSE new file mode 120000 index 0000000..ea5b606 --- /dev/null +++ b/yazi/.config/yazi/plugins/git.yazi/LICENSE @@ -0,0 +1 @@ +../LICENSE \ No newline at end of file diff --git a/yazi/.config/yazi/plugins/git.yazi/README.md b/yazi/.config/yazi/plugins/git.yazi/README.md new file mode 100644 index 0000000..96a87a8 --- /dev/null +++ b/yazi/.config/yazi/plugins/git.yazi/README.md @@ -0,0 +1,78 @@ +# git.yazi + +Show the status of Git file changes as linemode in the file list. + +https://github.com/user-attachments/assets/34976be9-a871-4ffe-9d5a-c4cdd0bf4576 + +## Installation + +```sh +ya pkg add yazi-rs/plugins:git +``` + +## Setup + +Add the following to your `~/.config/yazi/init.lua`: + +```lua +require("git"):setup() +``` + +And register it as fetchers in your `~/.config/yazi/yazi.toml`: + +```toml +[[plugin.prepend_fetchers]] +id = "git" +name = "*" +run = "git" + +[[plugin.prepend_fetchers]] +id = "git" +name = "*/" +run = "git" +``` + +## Advanced + +> [!NOTE] +> The following configuration must be put before `require("git"):setup()` + +You can customize the [Style](https://yazi-rs.github.io/docs/plugins/layout#style) of the status sign with: + +- `th.git.modified` +- `th.git.added` +- `th.git.untracked` +- `th.git.ignored` +- `th.git.deleted` +- `th.git.updated` + +For example: + +```lua +-- ~/.config/yazi/init.lua +th.git = th.git or {} +th.git.modified = ui.Style():fg("blue") +th.git.deleted = ui.Style():fg("red"):bold() +``` + +You can also customize the text of the status sign with: + +- `th.git.modified_sign` +- `th.git.added_sign` +- `th.git.untracked_sign` +- `th.git.ignored_sign` +- `th.git.deleted_sign` +- `th.git.updated_sign` + +For example: + +```lua +-- ~/.config/yazi/init.lua +th.git = th.git or {} +th.git.modified_sign = "M" +th.git.deleted_sign = "D" +``` + +## License + +This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file. diff --git a/yazi/.config/yazi/plugins/git.yazi/main.lua b/yazi/.config/yazi/plugins/git.yazi/main.lua new file mode 100644 index 0000000..66ef3bb --- /dev/null +++ b/yazi/.config/yazi/plugins/git.yazi/main.lua @@ -0,0 +1,261 @@ +--- @since 25.5.31 + +local WINDOWS = ya.target_family() == "windows" + +-- The code of supported git status, +-- also used to determine which status to show for directories when they contain different statuses +-- see `bubble_up` +---@enum CODES +local CODES = { + excluded = 100, -- ignored directory + ignored = 6, -- ignored file + untracked = 5, + modified = 4, + added = 3, + deleted = 2, + updated = 1, + unknown = 0, +} + +local PATTERNS = { + { "!$", CODES.ignored }, + { "?$", CODES.untracked }, + { "[MT]", CODES.modified }, + { "[AC]", CODES.added }, + { "D", CODES.deleted }, + { "U", CODES.updated }, + { "[AD][AD]", CODES.updated }, +} + +---@param line string +---@return CODES, string +local function match(line) + local signs = line:sub(1, 2) + for _, p in ipairs(PATTERNS) do + local path, pattern, code = nil, p[1], p[2] + if signs:find(pattern) then + path = line:sub(4, 4) == '"' and line:sub(5, -2) or line:sub(4) + path = WINDOWS and path:gsub("/", "\\") or path + end + if not path then + elseif path:find("[/\\]$") then + -- Mark the ignored directory as `excluded`, so we can process it further within `propagate_down` + return code == CODES.ignored and CODES.excluded or code, path:sub(1, -2) + else + return code, path + end + ---@diagnostic disable-next-line: missing-return + end +end + +---@param cwd Url +---@return string? +local function root(cwd) + local is_worktree = function(url) + local file, head = io.open(tostring(url)), nil + if file then + head = file:read(8) + file:close() + end + return head == "gitdir: " + end + + repeat + local next = cwd:join(".git") + local cha = fs.cha(next) + if cha and (cha.is_dir or is_worktree(next)) then + return tostring(cwd) + end + cwd = cwd.parent + until not cwd +end + +---@param changed Changes +---@return Changes +local function bubble_up(changed) + local new, empty = {}, Url("") + for path, code in pairs(changed) do + if code ~= CODES.ignored then + local url = Url(path).parent + while url and url ~= empty do + local s = tostring(url) + new[s] = (new[s] or CODES.unknown) > code and new[s] or code + url = url.parent + end + end + end + return new +end + +---@param excluded string[] +---@param cwd Url +---@param repo Url +---@return Changes +local function propagate_down(excluded, cwd, repo) + local new, rel = {}, cwd:strip_prefix(repo) + for _, path in ipairs(excluded) do + if rel:starts_with(path) then + -- If `cwd` is a subdirectory of an excluded directory, also mark it as `excluded` + new[tostring(cwd)] = CODES.excluded + elseif cwd == repo:join(path).parent then + -- If `path` is a direct subdirectory of `cwd`, mark it as `ignored` + new[path] = CODES.ignored + else + -- Skipping, we only care about `cwd` itself and its direct subdirectories for maximum performance + end + end + return new +end + +---@param cwd string +---@param repo string +---@param changed Changes +local add = ya.sync(function(st, cwd, repo, changed) + ---@cast st State + + st.dirs[cwd] = repo + st.repos[repo] = st.repos[repo] or {} + for path, code in pairs(changed) do + if code == CODES.unknown then + st.repos[repo][path] = nil + elseif code == CODES.excluded then + -- Mark the directory with a special value `excluded` so that it can be distinguished during UI rendering + st.dirs[path] = CODES.excluded + else + st.repos[repo][path] = code + end + end + -- TODO: remove this + if ui.render then + ui.render() + else + ya.render() + end +end) + +---@param cwd string +local remove = ya.sync(function(st, cwd) + ---@cast st State + + local repo = st.dirs[cwd] + if not repo then + return + end + + -- TODO: remove this + if ui.render then + ui.render() + else + ya.render() + end + st.dirs[cwd] = nil + if not st.repos[repo] then + return + end + + for _, r in pairs(st.dirs) do + if r == repo then + return + end + end + st.repos[repo] = nil +end) + +---@param st State +---@param opts Options +local function setup(st, opts) + st.dirs = {} + st.repos = {} + + opts = opts or {} + opts.order = opts.order or 1500 + + local t = th.git or {} + local styles = { + [CODES.ignored] = t.ignored and ui.Style(t.ignored) or ui.Style():fg("darkgray"), + [CODES.untracked] = t.untracked and ui.Style(t.untracked) or ui.Style():fg("magenta"), + [CODES.modified] = t.modified and ui.Style(t.modified) or ui.Style():fg("yellow"), + [CODES.added] = t.added and ui.Style(t.added) or ui.Style():fg("green"), + [CODES.deleted] = t.deleted and ui.Style(t.deleted) or ui.Style():fg("red"), + [CODES.updated] = t.updated and ui.Style(t.updated) or ui.Style():fg("yellow"), + } + local signs = { + [CODES.ignored] = t.ignored_sign or "", + [CODES.untracked] = t.untracked_sign or "?", + [CODES.modified] = t.modified_sign or "", + [CODES.added] = t.added_sign or "", + [CODES.deleted] = t.deleted_sign or "", + [CODES.updated] = t.updated_sign or "", + } + + Linemode:children_add(function(self) + local url = self._file.url + local repo = st.dirs[tostring(url.base or url.parent)] + local code + if repo then + code = repo == CODES.excluded and CODES.ignored or st.repos[repo][tostring(url):sub(#repo + 2)] + end + + if not code or signs[code] == "" then + return "" + elseif self._file.is_hovered then + return ui.Line { " ", signs[code] } + else + return ui.Line { " ", ui.Span(signs[code]):style(styles[code]) } + end + end, opts.order) +end + +---@type UnstableFetcher +local function fetch(_, job) + local cwd = job.files[1].url.base or job.files[1].url.parent + local repo = root(cwd) + if not repo then + remove(tostring(cwd)) + return true + end + + local paths = {} + for _, file in ipairs(job.files) do + paths[#paths + 1] = tostring(file.url) + end + + -- stylua: ignore + local output, err = Command("git") + :cwd(tostring(cwd)) + :arg({ "--no-optional-locks", "-c", "core.quotePath=", "status", "--porcelain", "-unormal", "--no-renames", "--ignored=matching" }) + :arg(paths) + :stdout(Command.PIPED) + :output() + if not output then + return true, Err("Cannot spawn `git` command, error: %s", err) + end + + local changed, excluded = {}, {} + for line in output.stdout:gmatch("[^\r\n]+") do + local code, path = match(line) + if code == CODES.excluded then + excluded[#excluded + 1] = path + else + changed[path] = code + end + end + + if job.files[1].cha.is_dir then + ya.dict_merge(changed, bubble_up(changed)) + end + ya.dict_merge(changed, propagate_down(excluded, cwd, Url(repo))) + + -- Reset the status of any files that don't appear in the output of `git status` to `unknown`, + -- so that cleaning up outdated statuses from `st.repos` + for _, path in ipairs(paths) do + local s = path:sub(#repo + 2) + changed[s] = changed[s] or CODES.unknown + end + + add(tostring(cwd), repo, changed) + + return false +end + +return { setup = setup, fetch = fetch } diff --git a/yazi/.config/yazi/plugins/git.yazi/types.lua b/yazi/.config/yazi/plugins/git.yazi/types.lua new file mode 100644 index 0000000..9936849 --- /dev/null +++ b/yazi/.config/yazi/plugins/git.yazi/types.lua @@ -0,0 +1,12 @@ +---@class State +---@field dirs table Mapping between a directory and its corresponding repository +---@field repos table Mapping between a repository and the status of each of its files + +---@class Options +---@field order number The order in which the status is displayed +---@field renamed boolean Whether to include renamed files in the status (or treat them as modified) + +-- TODO: move this to `types.yazi` once it's get stable +---@alias UnstableFetcher fun(self: unknown, job: { files: File[] }): boolean, Error? + +---@alias Changes table diff --git a/yazi/.config/yazi/plugins/lazygit.yazi/LICENSE b/yazi/.config/yazi/plugins/lazygit.yazi/LICENSE new file mode 100644 index 0000000..ae1f60d --- /dev/null +++ b/yazi/.config/yazi/plugins/lazygit.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Darius + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. diff --git a/yazi/.config/yazi/plugins/lazygit.yazi/README.md b/yazi/.config/yazi/plugins/lazygit.yazi/README.md new file mode 100644 index 0000000..e96c9c6 --- /dev/null +++ b/yazi/.config/yazi/plugins/lazygit.yazi/README.md @@ -0,0 +1,29 @@ +# lazygit.yazi +Plugin for [Yazi](https://github.com/sxyazi/yazi) to manage git repos with [lazygit](https://github.com/jesseduffield/lazygit) +## Dependencies +Make sure [lazygit](https://github.com/jesseduffield/lazygit) is installed and in your `PATH`. +## Installation + +### Using `ya pack` +``` +ya pack -a Lil-Dank/lazygit +``` + +### Manual +**Linux/macOS** +``` +git clone https://github.com/Lil-Dank/lazygit.yazi.git ~/.config/yazi/plugins/lazygit.yazi +``` +**Windows** +``` +git clone https://github.com/Lil-Dank/lazygit.yazi.git %AppData%\yazi\config\plugins\lazygit.yazi +``` +## Configuration +add this to your **keymap.toml** file +```toml +[[manager.prepend_keymap]] +on = [ "g", "i" ] +run = "plugin lazygit" +desc = "run lazygit" +``` +you can customize the keybinding however you like. Please refer to the [keymap.toml](https://yazi-rs.github.io/docs/configuration/keymap) documentation diff --git a/yazi/.config/yazi/plugins/lazygit.yazi/main.lua b/yazi/.config/yazi/plugins/lazygit.yazi/main.lua new file mode 100644 index 0000000..32d7f18 --- /dev/null +++ b/yazi/.config/yazi/plugins/lazygit.yazi/main.lua @@ -0,0 +1,31 @@ +return { + entry = function() + local output = Command("git"):arg("status"):stderr(Command.PIPED):output() + if output.stderr ~= "" then + ya.notify({ + title = "lazygit", + content = "Not in a git directory\nError: " .. output.stderr, + level = "warn", + timeout = 5, + }) + else + permit = ya.hide() + local output, err_code = Command("lazygit"):stderr(Command.PIPED):output() + if err_code ~= nil then + ya.notify({ + title = "Failed to run lazygit command", + content = "Status: " .. err_code, + level = "error", + timeout = 5, + }) + elseif not output.status.success then + ya.notify({ + title = "lazygit in" .. cwd .. "failed, exit code " .. output.status.code, + content = output.stderr, + level = "error", + timeout = 5, + }) + end + end + end, +} diff --git a/yazi/.config/yazi/plugins/mount.yazi/LICENSE b/yazi/.config/yazi/plugins/mount.yazi/LICENSE new file mode 100644 index 0000000..fb5b1d6 --- /dev/null +++ b/yazi/.config/yazi/plugins/mount.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 yazi-rs + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. diff --git a/yazi/.config/yazi/plugins/mount.yazi/README.md b/yazi/.config/yazi/plugins/mount.yazi/README.md new file mode 100644 index 0000000..ff7f110 --- /dev/null +++ b/yazi/.config/yazi/plugins/mount.yazi/README.md @@ -0,0 +1,48 @@ +# mount.yazi + +A mount manager for Yazi, providing disk mount, unmount, and eject functionality. + +Supported platforms: + +- Linux with [`udisksctl`](https://github.com/storaged-project/udisks) and [`lsblk`](https://github.com/util-linux/util-linux) +- macOS with `diskutil` + +https://github.com/user-attachments/assets/c6f780ab-458b-420f-85cf-2fc45fcfe3a2 + +## Installation + +```sh +ya pkg add yazi-rs/plugins:mount +``` + +## Usage + +Add this to your `~/.config/yazi/keymap.toml`: + +```toml +[[mgr.prepend_keymap]] +on = "M" +run = "plugin mount" +``` + +Available keybindings: + +| Key binding | Alternate key | Action | +| ------------ | ------------- | --------------------- | +| q | - | Quit the plugin | +| k | | Move up | +| j | | Move down | +| l | | Enter the mount point | +| m | - | Mount the partition | +| u | - | Unmount the partition | +| e | - | Eject the disk | + +## TODO + +- Custom keybindings +- Windows support (I don't have an Windows machine for testing, PRs welcome!) +- Support mount, unmount, and eject the entire disk + +## License + +This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file. diff --git a/yazi/.config/yazi/plugins/mount.yazi/main.lua b/yazi/.config/yazi/plugins/mount.yazi/main.lua new file mode 100644 index 0000000..32dc15e --- /dev/null +++ b/yazi/.config/yazi/plugins/mount.yazi/main.lua @@ -0,0 +1,285 @@ +--- @since 25.5.31 + +local toggle_ui = ya.sync(function(self) + if self.children then + Modal:children_remove(self.children) + self.children = nil + else + self.children = Modal:children_add(self, 10) + end + ya.render() +end) + +local subscribe = ya.sync(function(self) + ps.unsub("mount") + ps.sub("mount", function() ya.emit("plugin", { self._id, "refresh" }) end) +end) + +local update_partitions = ya.sync(function(self, partitions) + self.partitions = partitions + self.cursor = math.max(0, math.min(self.cursor or 0, #self.partitions - 1)) + ya.render() +end) + +local active_partition = ya.sync(function(self) return self.partitions[self.cursor + 1] end) + +local update_cursor = ya.sync(function(self, cursor) + if #self.partitions == 0 then + self.cursor = 0 + else + self.cursor = ya.clamp(0, self.cursor + cursor, #self.partitions - 1) + end + ya.render() +end) + +local M = { + keys = { + { on = "q", run = "quit" }, + + { on = "k", run = "up" }, + { on = "j", run = "down" }, + { on = "l", run = { "enter", "quit" } }, + + { on = "", run = "up" }, + { on = "", run = "down" }, + { on = "", run = { "enter", "quit" } }, + + { on = "m", run = "mount" }, + { on = "u", run = "unmount" }, + { on = "e", run = "eject" }, + }, +} + +function M:new(area) + self:layout(area) + return self +end + +function M:layout(area) + local chunks = ui.Layout() + :constraints({ + ui.Constraint.Percentage(10), + ui.Constraint.Percentage(80), + ui.Constraint.Percentage(10), + }) + :split(area) + + local chunks = ui.Layout() + :direction(ui.Layout.HORIZONTAL) + :constraints({ + ui.Constraint.Percentage(10), + ui.Constraint.Percentage(80), + ui.Constraint.Percentage(10), + }) + :split(chunks[2]) + + self._area = chunks[2] +end + +function M:entry(job) + if job.args[1] == "refresh" then + return update_partitions(self.obtain()) + end + + toggle_ui() + update_partitions(self.obtain()) + subscribe() + + local tx1, rx1 = ya.chan("mpsc") + local tx2, rx2 = ya.chan("mpsc") + function producer() + while true do + local cand = self.keys[ya.which { cands = self.keys, silent = true }] or { run = {} } + for _, r in ipairs(type(cand.run) == "table" and cand.run or { cand.run }) do + tx1:send(r) + if r == "quit" then + toggle_ui() + return + end + end + end + end + + function consumer1() + repeat + local run = rx1:recv() + if run == "quit" then + tx2:send(run) + break + elseif run == "up" then + update_cursor(-1) + elseif run == "down" then + update_cursor(1) + elseif run == "enter" then + local active = active_partition() + if active and active.dist then + ya.emit("cd", { active.dist }) + end + else + tx2:send(run) + end + until not run + end + + function consumer2() + repeat + local run = rx2:recv() + if run == "quit" then + break + elseif run == "mount" then + self.operate("mount") + elseif run == "unmount" then + self.operate("unmount") + elseif run == "eject" then + self.operate("eject") + end + until not run + end + + ya.join(producer, consumer1, consumer2) +end + +function M:reflow() return { self } end + +function M:redraw() + local rows = {} + for _, p in ipairs(self.partitions or {}) do + if not p.sub then + rows[#rows + 1] = ui.Row { p.main } + elseif p.sub == "" then + rows[#rows + 1] = ui.Row { p.main, p.label or "", p.dist or "", p.fstype or "" } + else + rows[#rows + 1] = ui.Row { " " .. p.sub, p.label or "", p.dist or "", p.fstype or "" } + end + end + + return { + ui.Clear(self._area), + ui.Border(ui.Edge.ALL) + :area(self._area) + :type(ui.Border.ROUNDED) + :style(ui.Style():fg("blue")) + :title(ui.Line("Mount"):align(ui.Align.CENTER)), + ui.Table(rows) + :area(self._area:pad(ui.Pad(1, 2, 1, 2))) + :header(ui.Row({ "Src", "Label", "Dist", "FSType" }):style(ui.Style():bold())) + :row(self.cursor) + :row_style(ui.Style():fg("blue"):underline()) + :widths { + ui.Constraint.Length(20), + ui.Constraint.Length(20), + ui.Constraint.Percentage(70), + ui.Constraint.Length(10), + }, + } +end + +function M.obtain() + local tbl = {} + local last + for _, p in ipairs(fs.partitions()) do + local main, sub = M.split(p.src) + if main and last ~= main then + if p.src == main then + last, p.main, p.sub, tbl[#tbl + 1] = p.src, p.src, "", p + else + last, tbl[#tbl + 1] = main, { src = main, main = main, sub = "" } + end + end + if sub then + if tbl[#tbl].sub == "" and tbl[#tbl].main == main then + tbl[#tbl].sub = nil + end + p.main, p.sub, tbl[#tbl + 1] = main, sub, p + end + end + table.sort(M.fillin(tbl), function(a, b) + if a.main == b.main then + return (a.sub or "") < (b.sub or "") + else + return a.main > b.main + end + end) + return tbl +end + +function M.split(src) + local pats = { + { "^/dev/sd[a-z]", "%d+$" }, -- /dev/sda1 + { "^/dev/nvme%d+n%d+", "p%d+$" }, -- /dev/nvme0n1p1 + { "^/dev/mmcblk%d+", "p%d+$" }, -- /dev/mmcblk0p1 + { "^/dev/disk%d+", ".+$" }, -- /dev/disk1s1 + } + for _, p in ipairs(pats) do + local main = src:match(p[1]) + if main then + return main, src:sub(#main + 1):match(p[2]) + end + end +end + +function M.fillin(tbl) + if ya.target_os() ~= "linux" then + return tbl + end + + local sources, indices = {}, {} + for i, p in ipairs(tbl) do + if p.sub and not p.fstype then + sources[#sources + 1], indices[p.src] = p.src, i + end + end + if #sources == 0 then + return tbl + end + + local output, err = Command("lsblk"):arg({ "-p", "-o", "name,fstype", "-J" }):arg(sources):output() + if err then + ya.dbg("Failed to fetch filesystem types for unmounted partitions: " .. err) + return tbl + end + + local t = ya.json_decode(output and output.stdout or "") + for _, p in ipairs(t and t.blockdevices or {}) do + tbl[indices[p.name]].fstype = p.fstype + end + return tbl +end + +function M.operate(type) + local active = active_partition() + if not active then + return + elseif not active.sub then + return -- TODO: mount/unmount main disk + end + + local output, err + if ya.target_os() == "macos" then + output, err = Command("diskutil"):arg({ type, active.src }):output() + end + if ya.target_os() == "linux" then + if type == "eject" then + Command("udisksctl"):arg({ "unmount", "-b", active.src }):status() + output, err = Command("udisksctl"):arg({ "power-off", "-b", active.src }):output() + else + output, err = Command("udisksctl"):arg({ type, "-b", active.src }):output() + end + end + + if not output then + M.fail("Failed to %s `%s`: %s", type, active.src, err) + elseif not output.status.success then + M.fail("Failed to %s `%s`: %s", type, active.src, output.stderr) + end +end + +function M.fail(...) ya.notify { title = "Mount", content = string.format(...), timeout = 10, level = "error" } end + +function M:click() end + +function M:scroll() end + +function M:touch() end + +return M diff --git a/yazi/.config/yazi/plugins/nbpreview.yazi/LICENSE b/yazi/.config/yazi/plugins/nbpreview.yazi/LICENSE new file mode 100644 index 0000000..ea3f779 --- /dev/null +++ b/yazi/.config/yazi/plugins/nbpreview.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Anirudh Gupta + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. diff --git a/yazi/.config/yazi/plugins/nbpreview.yazi/README.md b/yazi/.config/yazi/plugins/nbpreview.yazi/README.md new file mode 100644 index 0000000..30782f7 --- /dev/null +++ b/yazi/.config/yazi/plugins/nbpreview.yazi/README.md @@ -0,0 +1,79 @@ +# nbpreview.yazi + +View your Jupyter notebooks beautifully in the preview in Yazi. + +## Requirements + +- [Yazi](https://github.com/sxyazi/yazi) version >=0.4 +- [nbpreview](https://github.com/paw-lu/nbpreview) + +## Previews + +image + +## Installation + +```bash +ya pack -a AnirudhG07/nbpreview + +## For linux and MacOS +git clone https://github.com/AnirudhG07/nbpreview.yazi.git ~/.config/yazi/plugins/nbpreview.yazi + +## For Windows +git clone https://github.com/AnirudhG07/nbpreview.yazi.git %AppData%\yazi\config\plugins\nbpreview.yazi +``` + +## Usage + +After installing the plugin, add this to your `yazi.toml` file inside the plugin's section previously present. + +```toml +[plugin] +prepend_previewers = [ + { name = "*.ipynb", run = "nbpreview" }, +] +``` + +## Configurations + +You can configure your preview by editing the `init.lua` file present in the plugin directory. +image + +All the configurations provided using `nbpreview --help`. +By default we have give you some of the flags which you can change according to your needs in the `init.lua` file. + +Please DONOT change the below options(unless you know what you are doing) - + +- `--nerd-font` - Yazi uses nerd-font. +- \*`--decorated` - This enables the decorations you see in the preview. +- `--no-paging` - To avoid errors. + +The `OPTIONAL CHANGES` flags are by default(recommended) given. You can add more or change as you wish. + +## CUSTOMIZATION + +You can Color customize your previews from the Color schemes and themes provided by `nbpreview`. These are - + +```bash +# COLOR SCHEMES +--color-system, --cs [standard|256|truecolor|windows|none|auto] + The type of color system to use. [env var: NBPREVIEW_COLOR_SYSTEM] + +# THEMES + -t, --theme [abap|algol|algol_nu|arduino|autumn|bw|borland|coffee|colorful|default| + dracula|emacs|friendly_grayscale|friendly|fruity|github-dark|gruvbox-dark| + gruvbox-light|igor|inkpot|lightbulb|lilypond|lovelace|manni|material|monokai| + murphy|native|nord-darker|nord|one-dark|paraiso-dark|paraiso-light|pastie| + perldoc|rainbow_dash|rrt|sas|solarized-dark|solarized-light|staroffice|stata-dark| + stata-light|tango|trac|vim|vs|xcode|zenburn|light|dark|ansi_light|ansi_dark] +``` + +You can change the default give color scheme and theme to any you like. + +> [!Note] +> +> The loading of `ipynb` might appear slow. This is due to the lag created by the command itself and not because of the plugin or yazi + +## Explore Yazi + +Yazi is an amazing, blazing fast terminal file manager, with a variety of plugins, flavors and themes. Check them out at [awesome-yazi](https://github.com/AnirudhG07/awesome-yazi) and the official [yazi webpage](https://yazi-rs.github.io/). diff --git a/yazi/.config/yazi/plugins/nbpreview.yazi/main.lua b/yazi/.config/yazi/plugins/nbpreview.yazi/main.lua new file mode 100644 index 0000000..8bed14d --- /dev/null +++ b/yazi/.config/yazi/plugins/nbpreview.yazi/main.lua @@ -0,0 +1,58 @@ +local M = {} + +function M:peek(job) + local child = Command("nbpreview") + :arg({ + -- DO NOT CHANGE -- + "--no-paging", + "--nerd-font", + "--decorated", + + -- OPTIONAL CHANGES -- + "--no-files", + "--unicode", + "--color", + "--images", + + -- SPECIAL CUSTOMIZATIONS -- + "--color-system=standard", + "--theme=ansi_dark", + tostring(job.file.url), + }) + :stdout(Command.PIPED) + :stderr(Command.PIPED) + :spawn() + if not child then + return require("code"):peek(job) + end + + local limit = job.area.h + local i, lines = 0, "" + repeat + local next, event = child:read_line() + if event == 1 then + return require("code"):peek(job) + elseif event ~= 0 then + break + end + + i = i + 1 + if i > job.skip then + lines = lines .. next + end + until i >= job.skip + limit + + child:start_kill() + if job.skip > 0 and i < job.skip + limit then + ya.manager_emit("peek", { math.max(0, i - limit), only_if = job.file.url, upper_bound = true }) + else + lines = lines:gsub("\t", string.rep(" ", PREVIEW.tab_size)) + ya.preview_widgets(job, { ui.Text.parse(lines):area(job.area) }) + end +end + +function M:seek(job) + require("code"):seek(job) +end + +return M diff --git a/yazi/.config/yazi/plugins/rich-preview.yazi/LICENSE b/yazi/.config/yazi/plugins/rich-preview.yazi/LICENSE new file mode 100644 index 0000000..ea3f779 --- /dev/null +++ b/yazi/.config/yazi/plugins/rich-preview.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Anirudh Gupta + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. diff --git a/yazi/.config/yazi/plugins/rich-preview.yazi/README.md b/yazi/.config/yazi/plugins/rich-preview.yazi/README.md new file mode 100644 index 0000000..3c5dcfd --- /dev/null +++ b/yazi/.config/yazi/plugins/rich-preview.yazi/README.md @@ -0,0 +1,75 @@ +# rich-preview.yazi + +Preview file types using `rich` command in Yazi. This plugin allows preview for various filetypes including - + +- Markdown +- Jupyter notebook +- JSON +- CSV +- RestructuredText + +## Previews/Screenshots + +[rich-preview1.webm](https://github.com/user-attachments/assets/580e36a8-249f-48a8-95fc-8c3d60e6a7d7) + +## Requirements + +- [Yazi](https://github.com/sxyazi/yazi) v0.4 or higher. +- [rich-cli](https://github.com/Textualize/rich) v13.7.1 or higher. + +## Installation + +To install this plugin, simply run- + +```bash +ya pack -a AnirudhG07/rich-preview +## For linux and MacOS +git clone https://github.com/AnirudhG07/rich-preview.yazi.git ~/.config/yazi/plugins/rich-preview.yazi + +## For Windows +git clone https://github.com/AnirudhG07/rich-preview.yazi.git %AppData%\yazi\config\plugins\rich-preview.yazi +``` + +## Usages + +The `rich` commands automatically detects if the file is markdown, csv, json, etc. files and accordingly the preview is viewed. + +Add the below to your `yazi.toml` file to allow the respective file to previewed using `rich`. + +```toml +[plugin] + +prepend_previewers = [ + { name = "*.csv", run = "rich-preview"}, # for csv files + { name = "*.md", run = "rich-preview" }, # for markdown (.md) files + { name = "*.rst", run = "rich-preview"}, # for restructured text (.rst) files + { name = "*.ipynb", run = "rich-preview"}, # for jupyter notebooks (.ipynb) + { name = "*.json", run = "rich-preview"}, # for json (.json) files +# { name = "*.lang_type", run = "rich-preview"} # for particular language files eg. .py, .go., .lua, etc. +] +``` + +## Configurations + +If you would like to use `rich` with more configurations, you can go to `init.lua` and edit the arguments in the code with your preferences. You can view the options using `rich --help`. + +```lua +-- init.lua +"-j", +"--left", +"--line-numbers", +"--force-terminal", +"--panel=rounded", +"--guides", +"--max-width" -- to area of preview +``` + +You can add more, remove and choose themes as you wish. You can set styles or Themes(as mentioned in `rich --help`) by `--theme=your_theme` and similarly for style. + +## Notes + +Currently the colors maynot be uniformly present, along with weird lines here and there. This is due to `"--force-terminal"` option. You can disable it if you find it annoying. Work is in progress to possibly fix the issue. + +# Explore Yazi + +Yazi is an amazing, blazing fast terminal file manager, with a variety of plugins, flavors and themes. Check them out at [awesome-yazi](https://github.com/AnirudhG07/awesome-yazi) and the official [yazi webpage](https://yazi-rs.github.io/). diff --git a/yazi/.config/yazi/plugins/rich-preview.yazi/main.lua b/yazi/.config/yazi/plugins/rich-preview.yazi/main.lua new file mode 100644 index 0000000..20700fa --- /dev/null +++ b/yazi/.config/yazi/plugins/rich-preview.yazi/main.lua @@ -0,0 +1,53 @@ +local M = {} + +function M:peek(job) + local child = Command("rich") + :arg({ + "-j", + "--left", + "--line-numbers", + "--force-terminal", + "--panel=rounded", + "--guides", + "--max-width", + tostring(job.area.w), + tostring(job.file.url), + }) + :stdout(Command.PIPED) + :stderr(Command.PIPED) + :spawn() + + if not child then + return require("code"):peek(job) + end + + local limit = job.area.h + local i, lines = 0, "" + repeat + local next, event = child:read_line() + if event == 1 then + return require("code"):peek(job) + elseif event ~= 0 then + break + end + + i = i + 1 + if i > job.skip then + lines = lines .. next + end + until i >= job.skip + limit + + child:start_kill() + if job.skip > 0 and i < job.skip + limit then + ya.manager_emit("peek", { math.max(0, i - limit), only_if = job.file.url, upper_bound = true }) + else + lines = lines:gsub("\t", string.rep(" ", PREVIEW.tab_size)) + ya.preview_widgets(job, { ui.Text.parse(lines):area(job.area) }) + end +end + +function M:seek(job) + require("code"):seek(job) +end + +return M diff --git a/yazi/.config/yazi/plugins/time-travel.yazi/LICENSE b/yazi/.config/yazi/plugins/time-travel.yazi/LICENSE new file mode 100644 index 0000000..84d96d4 --- /dev/null +++ b/yazi/.config/yazi/plugins/time-travel.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Xianyi Lin + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. \ No newline at end of file diff --git a/yazi/.config/yazi/plugins/time-travel.yazi/README.md b/yazi/.config/yazi/plugins/time-travel.yazi/README.md new file mode 100644 index 0000000..7476b88 --- /dev/null +++ b/yazi/.config/yazi/plugins/time-travel.yazi/README.md @@ -0,0 +1,35 @@ +# time-travel.yazi + +A Yazi plugin for browsing backwards and forwards in time via BTRFS / ZFS snapshots. + +https://github.com/user-attachments/assets/6d2fc9e7-f86e-4444-aab6-4e11e51e8b34 + +## Installation + +```sh +ya pack -a iynaix/time-travel +``` + +## Usage + +Add keymaps similar to the following to your `~/.config/yazi/keymap.toml`: + +```toml +[[manager.prepend_keymap]] +on = ["z", "h"] +run = "plugin time-travel --args=prev" +desc = "Go to previous snapshot" + +[[manager.prepend_keymap]] +on = ["z", "l"] +run = "plugin time-travel --args=next" +desc = "Go to next snapshot" + +[[manager.prepend_keymap]] +on = ["z", "e"] +run = "plugin time-travel --args=exit" +desc = "Exit browsing snapshots" +``` +#### Note for BTRFS + +`sudo` is required to run btrfs commands such as `btrfs subvolume list`, the plugin will drop into a terminal to prompt for the password. \ No newline at end of file diff --git a/yazi/.config/yazi/plugins/time-travel.yazi/main.lua b/yazi/.config/yazi/plugins/time-travel.yazi/main.lua new file mode 100644 index 0000000..f67b569 --- /dev/null +++ b/yazi/.config/yazi/plugins/time-travel.yazi/main.lua @@ -0,0 +1,386 @@ +---@param msg string +local notify_warn = function(msg) + ya.notify { title = "ZFS", content = msg, level = "warn", timeout = 5 } +end + +---@param msg string +local notify_error = function(msg) + ya.notify { title = "ZFS", content = msg, level = "error", timeout = 5 } +end + +---@param arr table +---@param predicate fun(value: any): boolean +---@return number|nil # index if found, nil if not found +local find_index = function(arr, predicate) + for i, value in ipairs(arr) do + if predicate(value) then + return i + end + end + return nil +end + +--- Verify if `sudo` is already authenticated +--- @return boolean +local function sudo_already() + local status = Command("sudo"):arg({ "--validate", "--non-interactive" }):status() + assert(status, "Failed to run `sudo --validate --non-interactive`") + return status.success +end + +--- Run a program with `sudo` privilege +--- @param program string +--- @param arg table +--- @return Output|nil output +--- @return integer|nil err +--- nil: no error +--- 1: sudo failed +local function run_with_sudo(program, arg) + local cmd = Command("sudo"):arg({ program, table.unpack(arg) }):stdout(Command.PIPED):stderr(Command.PIPED) + if sudo_already() then + return cmd:output() + end + + local permit = ya.hide() + print(string.format("Sudo password required to run: `%s %s`", program, table.concat(arg, " "))) + local output = cmd:output() + permit:drop() + + if output.status.success or sudo_already() then + return output + end + return nil, 1 +end + + +---@return string +local get_cwd = ya.sync(function() + return tostring(cx.active.current.cwd) +end) + +---@param s string +---@return string +local trim = function(s) + return s:match("^%s*(.-)%s*$") +end + +---@param cwd string +---@return string|nil +local get_filesystem_type = function(cwd) + local stat, _ = Command("stat"):arg({ "-f", "-c", "%T", cwd }):output() + if not stat.status.success then + return nil + end + return trim(stat.stdout) +end + +---@param cwd string +---@return string|nil +local zfs_dataset = function(cwd) + local df, _ = Command("df"):arg({ "--output=source", cwd }):output() + local dataset = nil + for line in df.stdout:gmatch("[^\r\n]+") do + -- dataset is last line in output + dataset = line + end + return dataset +end + +---@param dataset string +---@return string|nil +local zfs_mountpoint = function(dataset) + local zfs, _ = Command("zfs"):arg({ "get", "-H", "-o", "value", "mountpoint", dataset }):output() + + -- not a dataset! + if not zfs.status.success then + return nil + end + + -- legacy mountpoint, search for actual mountpoint using df + if zfs.stdout == "legacy\n" then + local df, _ = Command("df"):output() + if not df.status.success then + return nil + end + + for line in df.stdout:gmatch("[^\r\n]+") do + -- match start of line + if string.sub(line, 1, #dataset) == dataset then + local mountpoint = nil + for field in line:gmatch("%S+") do + -- mountpoint is last field in df output + mountpoint = field + end + return mountpoint + end + end + else + return zfs.stdout:gsub("\n$", "") + end + + -- shouldn't be here + return nil +end + +-- returns the path relative to the mountpoint / snapshot +---@param cwd string +---@param mountpoint string +local zfs_relative = function(cwd, mountpoint) + -- relative path to get mountpoint + local relative = (cwd:sub(0, #mountpoint) == mountpoint) and cwd:sub(#mountpoint + 1) or cwd + + -- is a snapshot dir, strip everything after "/snapshot" + if cwd:find(".zfs/snapshot") ~= nil then + local snapshot_pos = cwd:find("/snapshot") + + -- everything after the "/snapshot/" + local after = cwd:sub(snapshot_pos + #"/snapshot" + 1) + local first_slash = after:find("/") + -- root of snapshot? + if first_slash == nil then + return "/" + else + return after:sub(first_slash) + end + end + + return relative +end + +---@class Snapshot +---@field name string +---@field path string + +---@param dataset string +---@param mountpoint string +---@param relative string +---@return Snapshot[] +local zfs_snapshots = function(dataset, mountpoint, relative) + -- -S is for reverse order + local zfs_snapshots, _ = Command("zfs"):arg({ "list", "-H", "-t", "snapshot", "-o", "name", "-S", "creation", + dataset }) + :output() + + if not zfs_snapshots.status.success then + return {} + end + + ---@type Snapshot[] + local snapshots = {} + for snapshot in zfs_snapshots.stdout:gmatch("[^\r\n]+") do + -- in the format dataset@snapshot + local sep = snapshot:find("@") + local id = snapshot:sub(sep + 1) + + table.insert(snapshots, { + id = id, + path = mountpoint .. "/.zfs/snapshot/" .. id .. relative, + }) + end + return snapshots +end + +---@param cwd string +---@return string|nil +local function btrfs_mountpoint(cwd) + local cmd, _ = Command("findmnt"):arg({ "-no", "TARGET", "-T", cwd }):output() + if not cmd.status.success then + return nil + end + return trim(cmd.stdout) +end + +---Returns the current uuid and the parent uuid +---@param cwd string +---@return string|nil, string|nil +local function btrfs_uuids(cwd) + local cmd, _ = run_with_sudo("btrfs", { "subvolume", "show", cwd }) + if not cmd then + return nil + end + + local parent_uuid = nil + local uuid = nil + for line in cmd.stdout:gmatch("[^\r\n]+") do + local parent_uuid_re = line:match("^%s*Parent UUID:%s*(%S+)") + if parent_uuid_re then + parent_uuid = trim(parent_uuid_re) + end + + local uuid_re = line:match("^%s*UUID:%s*(%S+)") + if uuid_re then + uuid = trim(uuid_re) + end + end + return parent_uuid, uuid +end + +---@param mountpoint string +---@param current_uuid string +---@param current_parent_uuid string|nil +---@return { snapshots: Snapshot[], latest_path: string, current_snapshot_id: string } +local function btrfs_snapshots(mountpoint, current_uuid, current_parent_uuid) + local snapshots_cmd, _ = run_with_sudo("btrfs", { "subvolume", "list", "-q", "-u", mountpoint }) + if not snapshots_cmd then + return {} + end + + local snapshots = {} + local latest_path = "" + local current_snapshot_id = "" + + for line in snapshots_cmd.stdout:gmatch("[^\r\n]+") do + local pattern = "ID (%d+) gen %d+ top level %d+ parent_uuid ([%w-]+)%s+uuid ([%w-]+) path (%S+)" + -- Extract the fields + local subvol_id, parent_uuid, uuid, name = line:match(pattern) + parent_uuid = trim(parent_uuid) + + local path = mountpoint .. "/" .. name + local is_parent = false + + if current_parent_uuid == "-" then + if parent_uuid == "-" and uuid == current_uuid then + is_parent = true + end + else + if uuid == current_parent_uuid then + is_parent = true + end + end + + if is_parent then + latest_path = path + end + + if uuid == current_uuid and not is_parent then + current_snapshot_id = name + end + + if not is_parent then + table.insert(snapshots, { + id = name, + subvol_id = subvol_id, -- used only for sorting + path = path, + }) + end + end + + -- Sort snapshots by time descending + table.sort(snapshots, function(a, b) + return a.subvol_id > b.subvol_id + end) + + return { snapshots = snapshots, latest_path = latest_path, current_snapshot_id = current_snapshot_id } +end + +return { + entry = function(_, job) + local action = job.arg[1] + local cwd = get_cwd() + + if action ~= "exit" and action ~= "prev" and action ~= "next" then + return notify_error("Invalid action: " .. action) + end + + local fs_type = get_filesystem_type(cwd) + if fs_type ~= "zfs" and fs_type ~= "btrfs" then + return notify_error("Current directory is not on a BTRFS / ZFS filesystem.") + end + + local current_snapshot_id = "" + local latest_path = "" + local snapshots = {} + + if fs_type == "zfs" then + local dataset = zfs_dataset(cwd) + if dataset == nil then + return notify_error("Current directory is not within a ZFS dataset.") + end + + if cwd:find(".zfs/snapshot") ~= nil then + -- in the format dataset@snapshot + local sep = dataset:find("@") + current_snapshot_id = dataset:sub(sep + 1) + dataset = dataset:sub(1, sep - 1) + end + + local mountpoint = zfs_mountpoint(dataset) + if mountpoint == nil then + return notify_error("Current directory is not within a ZFS dataset.") + end + + -- NOTE: relative already has leading "/" + local relative = zfs_relative(cwd, mountpoint) + + latest_path = mountpoint .. relative + snapshots = zfs_snapshots(dataset, mountpoint, relative) + elseif fs_type == "btrfs" then + local mountpoint = btrfs_mountpoint(cwd) + local parent_uuid, uuid = btrfs_uuids(cwd) + + if mountpoint == nil or uuid == nil then + return notify_error("Current directory is not within a BTRFS subvolume.") + end + + local ret = btrfs_snapshots(mountpoint, uuid, parent_uuid) + snapshots = ret.snapshots + latest_path = ret.latest_path + current_snapshot_id = ret.current_snapshot_id + end + + if action == "exit" then + ya.manager_emit("cd", { latest_path }) + return + end + + if #snapshots == 0 then + return notify_warn("No snapshots found.") + end + + ---@param start_idx integer + ---@param end_idx integer + ---@param step integer + local find_and_goto_snapshot = function(start_idx, end_idx, step) + if start_idx == 0 then + -- going from newest snapshot to current state + return ya.manager_emit("cd", { latest_path }) + elseif start_idx < 0 then + return notify_warn("No earlier snapshots found.") + elseif start_idx > #snapshots then + return notify_warn("No earlier snapshots found.") + end + + for i = start_idx, end_idx, step do + local snapshot_dir = snapshots[i].path + if io.open(snapshot_dir, "r") then + return ya.manager_emit("cd", { snapshot_dir }) + end + end + + local direction = action == "prev" and "earlier" or "later" + return notify_warn("No " .. direction .. " snapshots found.") + end + + -- NOTE: latest snapshot is first in list + if current_snapshot_id == "" then + if action == "prev" then + -- go to latest snapshot + return find_and_goto_snapshot(1, #snapshots, 1) + elseif action == "next" then + return notify_warn("No later snapshots found.") + end + end + + -- has current snapshot + local idx = find_index(snapshots, function(snapshot) return snapshot.id == current_snapshot_id end) + if idx == nil then + return notify_error("Snapshot not found.") + end + + if action == "prev" then + find_and_goto_snapshot(idx + 1, #snapshots, 1) + elseif action == "next" then + find_and_goto_snapshot(idx - 1, 1, -1) + end + end, +} diff --git a/yazi/.config/yazi/plugins/toggle-view.yazi/LICENSE b/yazi/.config/yazi/plugins/toggle-view.yazi/LICENSE new file mode 100644 index 0000000..c85eb72 --- /dev/null +++ b/yazi/.config/yazi/plugins/toggle-view.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 dawsers + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. diff --git a/yazi/.config/yazi/plugins/toggle-view.yazi/README.md b/yazi/.config/yazi/plugins/toggle-view.yazi/README.md new file mode 100644 index 0000000..73d4d53 --- /dev/null +++ b/yazi/.config/yazi/plugins/toggle-view.yazi/README.md @@ -0,0 +1,32 @@ +# toggle-view.yazi + +Toggle the different views: parent, current and preview. + +## Requirements + +- [Yazi](https://github.com/sxyazi/yazi/) v0.4 or later. + +## Installation + +```sh +ya pack -a dawsers/toggle-view +``` + +## Usage + +Add this to your `~/.config/yazi/keymap.toml`: + +``` toml +[manager] +prepend_keymap = [ + { on = "", run = "plugin toggle-view --args=parent", desc = "Toggle parent" }, + { on = "", run = "plugin toggle-view --args=current", desc = "Toggle current" }, + { on = "", run = "plugin toggle-view --args=preview", desc = "Toggle preview" }, +] +``` + +Now each key will toggle on/off one of the three panels: `Ctrl+1` for +*parent*, `Ctrl+2` for *current* and `Ctrl+3` for *preview*. + +You can set your own key bindings. + diff --git a/yazi/.config/yazi/plugins/toggle-view.yazi/main.lua b/yazi/.config/yazi/plugins/toggle-view.yazi/main.lua new file mode 100644 index 0000000..c8a4a08 --- /dev/null +++ b/yazi/.config/yazi/plugins/toggle-view.yazi/main.lua @@ -0,0 +1,63 @@ +--- @sync entry +-- Toggle different views on/off: parent, current, preview +local function entry(st, job) + local arg = job.arg or job + local action = arg[1] + if not action then + return + end + + if st.view == nil then + st.old_parent = MANAGER.ratio.parent + st.old_current = MANAGER.ratio.current + st.old_preview = MANAGER.ratio.preview + + -- Get current tab ratios + local all_old = st.old_parent + st.old_current + st.old_preview + local area = ui.Rect { x= 0, y = 0, w = all_old, h = 10 } + local tab = Tab:new(area, cx.active) + st.parent = tab._chunks[1].w + st.current = tab._chunks[2].w + st.preview = tab._chunks[3].w + st.layout = Tab.layout + st.view = true -- initialized + end + + if action == "parent" then + if st.parent > 0 then + st.parent = 0 + else + st.parent = st.old_parent + end + elseif action == "current" then + if st.current > 0 then + st.current = 0 + else + st.current = st.old_current + end + elseif action == "preview" then + if st.preview > 0 then + st.preview = 0 + else + st.preview = st.old_preview + end + else + return + end + Tab.layout = function(self) + local all = st.parent + st.current + st.preview + self._chunks = ui.Layout() + :direction(ui.Layout.HORIZONTAL) + :constraints({ + ui.Constraint.Ratio(st.parent, all), + ui.Constraint.Ratio(st.current, all), + ui.Constraint.Ratio(st.preview, all), + }) + :split(self._area) + end + ya.app_emit("resize", {}) +end + +local function enabled(st) return st.view ~= nil end + +return { entry = entry, enabled = enabled } diff --git a/yazi/.config/yazi/plugins/yamb.yazi/LICENSE b/yazi/.config/yazi/plugins/yamb.yazi/LICENSE new file mode 100644 index 0000000..12f8c8b --- /dev/null +++ b/yazi/.config/yazi/plugins/yamb.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Hunter Hwang + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. diff --git a/yazi/.config/yazi/plugins/yamb.yazi/README.md b/yazi/.config/yazi/plugins/yamb.yazi/README.md new file mode 100644 index 0000000..5f322de --- /dev/null +++ b/yazi/.config/yazi/plugins/yamb.yazi/README.md @@ -0,0 +1,112 @@ +# Yet another bookmarks + +A [Yazi](https://github.com/sxyazi/yazi) plugin for bookmark management, supporting the following features + +- Persistent bookmarks. No bookmarks are lost after you close yazi. +- Quickly jump, delete, and rename a bookmark by keymap. +- Support fuzzy search through [fzf](https://github.com/junegunn/fzf). +- Configure your bookmarks using Lua language. + +## Installation + +> [!NOTE] +> Yazi >= 0.25. + +```sh +# Linux/macOS +git clone https://github.com/h-hg/yamb.yazi.git ~/.config/yazi/plugins/yamb.yazi + +# Windows +git clone https://github.com/h-hg/yamb.yazi.git $env:APPDATA\yazi\config\plugins\yamb.yazi + +# if you are using Yazi version >= 3.0 +ya pack -a h-hg/yamb +``` + +## Usage + +Add this to your `init.lua` + +```lua +-- You can configure your bookmarks by lua language +local bookmarks = {} + +local path_sep = package.config:sub(1, 1) +local home_path = ya.target_family() == "windows" and os.getenv("USERPROFILE") or os.getenv("HOME") +if ya.target_family() == "windows" then + table.insert(bookmarks, { + tag = "Scoop Local", + + path = (os.getenv("SCOOP") or home_path .. "\\scoop") .. "\\", + key = "p" + }) + table.insert(bookmarks, { + tag = "Scoop Global", + path = (os.getenv("SCOOP_GLOBAL") or "C:\\ProgramData\\scoop") .. "\\", + key = "P" + }) +end +table.insert(bookmarks, { + tag = "Desktop", + path = home_path .. path_sep .. "Desktop" .. path_sep, + key = "d" +}) + +require("yamb"):setup { + -- Optional, the path ending with path seperator represents folder. + bookmarks = bookmarks, + -- Optional, recieve notification everytime you jump. + jump_notify = true, + -- Optional, the cli of fzf. + cli = "fzf", + -- Optional, a string used for randomly generating keys, where the preceding characters have higher priority. + keys = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + -- Optional, the path of bookmarks + path = (ya.target_family() == "windows" and os.getenv("APPDATA") .. "\\yazi\\config\\bookmark") or + (os.getenv("HOME") .. "/.config/yazi/bookmark"), +} +``` + +Add this to your `keymap.toml`: + +```toml +[[manager.prepend_keymap]] +on = [ "u", "a" ] +run = "plugin yamb save" +desc = "Add bookmark" + +[[manager.prepend_keymap]] +on = [ "u", "g" ] +run = "plugin yamb jump_by_key" +desc = "Jump bookmark by key" + +[[manager.prepend_keymap]] +on = [ "u", "G" ] +run = "plugin yamb jump_by_fzf" +desc = "Jump bookmark by fzf" + +[[manager.prepend_keymap]] +on = [ "u", "d" ] +run = "plugin yamb delete_by_key" +desc = "Delete bookmark by key" + +[[manager.prepend_keymap]] +on = [ "u", "D" ] +run = "plugin yamb delete_by_fzf" +desc = "Delete bookmark by fzf" + +[[manager.prepend_keymap]] +on = [ "u", "A" ] +run = "plugin yamb delete_all" +desc = "Delete all bookmarks" + +[[manager.prepend_keymap]] +on = [ "u", "r" ] +run = "plugin yamb rename_by_key" +desc = "Rename bookmark by key" + +[[manager.prepend_keymap]] +on = [ "u", "R" ] +run = "plugin yamb rename_by_fzf" +desc = "Rename bookmark by fzf" +``` diff --git a/yazi/.config/yazi/plugins/yamb.yazi/main.lua b/yazi/.config/yazi/plugins/yamb.yazi/main.lua new file mode 100644 index 0000000..383b492 --- /dev/null +++ b/yazi/.config/yazi/plugins/yamb.yazi/main.lua @@ -0,0 +1,355 @@ +local path_sep = package.config:sub(1, 1) + +local get_hovered_path = ya.sync(function(state) + local h = cx.active.current.hovered + if h then + local path = tostring(h.url) + if h.cha.is_dir then + return path .. path_sep + end + return path + else + return '' + end +end) + +local get_state_attr = ya.sync(function(state, attr) + return state[attr] +end) + +local set_state_attr = ya.sync(function(state, attr, value) + state[attr] = value +end) + +local set_bookmarks = ya.sync(function(state, path, value) + state.bookmarks[path] = value +end) + +local sort_bookmarks = function(bookmarks, key1, key2, reverse) + reverse = reverse or false + table.sort(bookmarks, function(x, y) + if x[key1] == nil and y[key1] == nil then + return x[key2] < y[key2] + elseif x[key1] == nil then + return false + elseif y[key1] == nil then + return true + else + return x[key1] < y[key1] + end + end) + if reverse then + local n = #bookmarks + for i = 1, math.floor(n / 2) do + bookmarks[i], bookmarks[n - i + 1] = bookmarks[n - i + 1], bookmarks[i] + end + end + return bookmarks +end + +local save_to_file = function(mb_path, bookmarks) + local file = io.open(mb_path, "w") + if file == nil then + return + end + local array = {} + for _, item in pairs(bookmarks) do + table.insert(array, item) + end + sort_bookmarks(array, "tag", "key", true) + for _, item in ipairs(array) do + file:write(string.format("%s\t%s\t%s\n", item.tag, item.path, item.key)) + end + file:close() +end + +local fzf_find = function(cli, mb_path) + local permit = ya.hide() + local cmd = string.format("%s < \"%s\"", cli, mb_path) + local handle = io.popen(cmd, "r") + local result = "" + if handle then + -- strip + result = string.gsub(handle:read("*all") or "", "^%s*(.-)%s*$", "%1") + handle:close() + end + permit:drop() + local tag, path, key = string.match(result or "", "(.-)\t(.-)\t(.*)") + return path +end + +local which_find = function(bookmarks) + local cands = {} + for path, item in pairs(bookmarks) do + if #item.tag ~= 0 then + table.insert(cands, { desc = item.tag, on = item.key, path = item.path }) + end + end + sort_bookmarks(cands, "on", "desc", false) + if #cands == 0 then + ya.notify { + title = "Bookmarks", + content = "Empty bookmarks", + timeout = 2, + level = "info", + } + return nil + end + local idx = ya.which { cands = cands } + if idx == nil then + return nil + end + return cands[idx].path +end + +local action_jump = function(bookmarks, path, jump_notify) + if path == nil then + return + end + local tag = bookmarks[path].tag + if string.sub(path, -1) == path_sep then + ya.manager_emit("cd", { path }) + else + ya.manager_emit("reveal", { path }) + end + if jump_notify then + ya.notify { + title = "Bookmarks", + content = 'Jump to "' .. tag .. '"', + timeout = 2, + level = "info", + } + end +end + +local generate_key = function(bookmarks) + local keys = get_state_attr("keys") + local key2rank = get_state_attr("key2rank") + local mb = {} + for _, item in pairs(bookmarks) do + if #item.key == 1 then + table.insert(mb, item.key) + end + end + if #mb == 0 then + return keys[1] + end + table.sort(mb, function(a, b) + return key2rank[a] < key2rank[b] + end) + local idx = 1 + for _, key in ipairs(keys) do + if idx > #mb or key2rank[key] < key2rank[mb[idx]] then + return key + end + idx = idx + 1 + end + return nil +end + +local action_save = function(mb_path, bookmarks, path) + if path == nil or #path == 0 then + return + end + + local path_obj = bookmarks[path] + -- check tag + local tag = path_obj and path_obj.tag or path:match(".*[\\/]([^\\/]+)[\\/]?$") + while true do + local value, event = ya.input({ + title = "Tag (alias name)", + value = tag, + position = { "top-center", y = 3, w = 40 }, + }) + if event ~= 1 then + return + end + tag = value or '' + if #tag == 0 then + ya.notify { + title = "Bookmarks", + content = "Empty tag", + timeout = 2, + level = "info", + } + else + -- check the tag + local tag_obj = nil + for _, item in pairs(bookmarks) do + if item.tag == tag then + tag_obj = item + break + end + end + if tag_obj == nil or tag_obj.path == path then + break + end + ya.notify { + title = "Bookmarks", + content = "Duplicated tag", + timeout = 2, + level = "info", + } + end + end + -- check key + local key = path_obj and path_obj.key or generate_key(bookmarks) + while true do + local value, event = ya.input({ + title = "Key (1 character, optional)", + value = key, + position = { "top-center", y = 3, w = 40 }, + }) + if event ~= 1 then + return + end + key = value or "" + if key == "" then + key = "" + break + elseif #key == 1 then + -- check the key + local key_obj = nil + for _, item in pairs(bookmarks) do + if item.key == key then + key_obj = item + break + end + end + if key_obj == nil or key_obj.path == path then + break + else + ya.notify { + title = "Bookmarks", + content = "Duplicated key", + timeout = 2, + level = "info", + } + end + else + ya.notify { + title = "Bookmarks", + content = "The length of key shoule be 1", + timeout = 2, + level = "info", + } + end + end + -- save + set_bookmarks(path, { tag = tag, path = path, key = key }) + bookmarks = get_state_attr("bookmarks") + save_to_file(mb_path, bookmarks) + ya.notify { + title = "Bookmarks", + content = '"' .. tag .. '" saved"', + timeout = 2, + level = "info", + } +end + +local action_delete = function(mb_path, bookmarks, path) + if path == nil then + return + end + local tag = bookmarks[path].tag + set_bookmarks(path, nil) + bookmarks = get_state_attr("bookmarks") + save_to_file(mb_path, bookmarks) + ya.notify { + title = "Bookmarks", + content = '"' .. tag .. '" deleted', + timeout = 2, + level = "info", + } +end + +local action_delete_all = function(mb_path) + local value, event = ya.input({ + title = "Delete all bookmarks? (y/n)", + position = { "top-center", y = 3, w = 40 }, + }) + if event ~= 1 then + return + end + if string.lower(value) == "y" then + set_state_attr("bookmarks", {}) + save_to_file(mb_path, {}) + ya.notify { + title = "Bookmarks", + content = "All bookmarks deleted", + timeout = 2, + level = "info", + } + else + ya.notify { + title = "Bookmarks", + content = "Cancel delete", + timeout = 2, + level = "info", + } + end +end + +return { + setup = function(state, options) + state.path = options.path or + (ya.target_family() == "windows" and os.getenv("APPDATA") .. "\\yazi\\config\\bookmark") or + (os.getenv("HOME") .. "/.config/yazi/bookmark") + state.cli = options.cli or "fzf" + state.jump_notify = options.jump_notify and true + -- init the keys + local keys = options.keys or "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + state.keys = {} + state.key2rank = {} + for i = 1, #keys do + local char = keys:sub(i, i) + table.insert(state.keys, char) + state.key2rank[char] = i + end + + -- init the bookmarks + local bookmarks = {} + for _, item in pairs(options.bookmarks or {}) do + bookmarks[item.path] = { tag = item.tag, path = item.path, key = item.key } + end + -- load the config + local file = io.open(state.path, "r") + if file ~= nil then + for line in file:lines() do + local tag, path, key = string.match(line, "(.-)\t(.-)\t(.*)") + if tag and path then + key = key or "" + bookmarks[path] = { tag = tag, path = path, key = key } + end + end + file:close() + end + -- create bookmarks file to enable fzf + save_to_file(state.path, bookmarks) + state.bookmarks = bookmarks + end, + entry = function(self, jobs) + local action = jobs.args[1] + if not action then + return + end + local mb_path, cli, bookmarks, jump_notify = get_state_attr("path"), get_state_attr("cli"), get_state_attr("bookmarks"), get_state_attr("jump_notify") + if action == "save" then + action_save(mb_path, bookmarks, get_hovered_path()) + elseif action == "delete_by_key" then + action_delete(mb_path, bookmarks, which_find(bookmarks)) + elseif action == "delete_by_fzf" then + action_delete(mb_path, bookmarks, fzf_find(cli, mb_path)) + elseif action == "delete_all" then + action_delete_all(mb_path) + elseif action == "jump_by_key" then + action_jump(bookmarks, which_find(bookmarks), jump_notify) + elseif action == "jump_by_fzf" then + action_jump(bookmarks, fzf_find(cli, mb_path), jump_notify) + elseif action == "rename_by_key" then + action_save(mb_path, bookmarks, which_find(bookmarks)) + elseif action == "rename_by_fzf" then + action_save(mb_path, bookmarks, fzf_find(cli, mb_path)) + end + end, +} diff --git a/yazi/.config/yazi/plugins/yaziline.yazi/LICENSE b/yazi/.config/yazi/plugins/yaziline.yazi/LICENSE new file mode 100644 index 0000000..82a69f6 --- /dev/null +++ b/yazi/.config/yazi/plugins/yaziline.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 llanosrocas + +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: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. diff --git a/yazi/.config/yazi/plugins/yaziline.yazi/README.md b/yazi/.config/yazi/plugins/yaziline.yazi/README.md new file mode 100644 index 0000000..fedd392 --- /dev/null +++ b/yazi/.config/yazi/plugins/yaziline.yazi/README.md @@ -0,0 +1,154 @@ +# yaziline.yazi + +Simple lualine-like status line for yazi. + +Read more about features and configuration [here](#features). + +> ⚠️ **Note**: +> If you experience any issues after updating, please refer to the latest release notes. This repository is continuously synced with the upstream Yazi source code, which is actively maintained and frequently updated. + +![preview](https://github.com/llanosrocas/yaziline.yazi/blob/master/.github/images/preview.png) + +## Requirements + +- yazi version >= [25.4.8](https://github.com/sxyazi/yazi/releases/tag/v25.4.8) +- Font with symbol support. For example [Nerd Fonts](https://www.nerdfonts.com/). + +## Installation + +```sh +ya pack -a llanosrocas/yaziline +``` + +Or manually copy `init.lua` to the `~/.config/yazi/plugins/yaziline.yazi/init.lua` + +## Usage + +Add this to your `~/.config/yazi/init.lua`: + +```lua +require("yaziline"):setup() +``` + +Optionally, configure line: + +```lua +require("yaziline"):setup({ + color = "#98c379", -- main theme color + default_files_color = "darkgray", -- color of the file counter when it's inactive + selected_files_color = "white", + yanked_files_color = "green", + cut_files_color = "red", + + separator_style = "angly", -- "angly" | "curvy" | "liney" | "empty" + separator_open = "", + separator_close = "", + separator_open_thin = "", + separator_close_thin = "", + separator_head = "", + separator_tail = "", + + select_symbol = "", + yank_symbol = "󰆐", + + filename_max_length = 24, -- truncate when filename > 24 + filename_truncate_length = 6, -- leave 6 chars on both sides + filename_truncate_separator = "..." -- the separator of the truncated filename +}) +``` + +## Features + +### Preconfigured separators + +Choose your style: + +- `angly` + ![angly](https://github.com/llanosrocas/yaziline.yazi/blob/master/.github/images/angly.png) +- `curvy` + ![curvy](https://github.com/llanosrocas/yaziline.yazi/blob/master/.github/images/curvy.png) +- `liney` + ![liney](https://github.com/llanosrocas/yaziline.yazi/blob/master/.github/images/liney.png) +- `empty` + ![empty](https://github.com/llanosrocas/yaziline.yazi/blob/master/.github/images/empty.png) + +### Separator customization + +You can provide your own symbols for separators combined with preconfigured separators. For example: + +```lua +require("yaziline"):setup({ + -- Optinal config + separator_style = "angly", -- preconfigured style + separator_open = "", -- instead of  + separator_close = "", -- instead of  + separator_open_thin = "", -- change to anything + separator_close_thin = "", -- change to anything + separator_head = "", -- to match the style + separator_tail = "" -- to match the style +}) +``` + +![empty](https://github.com/llanosrocas/yaziline.yazi/blob/master/.github/images/separator-combination.png) + +_You can find more symbols [here](https://www.nerdfonts.com/cheat-sheet)_ + +### File actions icons + +You can provide your own symbols for `select` and `yank`. For example: + +```lua +require("yaziline"):setup({ + -- Optinal config + select_symbol = "", -- "S" by default + yank_symbol = "󰆐" -- "Y" by default +}) +``` + +![empty](https://github.com/llanosrocas/yaziline.yazi/blob/master/.github/images/file-actions.png) + +_You can find more symbols [here](https://www.nerdfonts.com/cheat-sheet)_ + +### Colors and font weight + +By default yaziline uses color values from your `theme.toml` (or flavor) but you can set custom colors in the `init.lua`: + +```lua +require("yaziline"):setup({ + color = "#98c379", + default_files_color = "darkgray", + selected_files_color = "white", + yanked_files_color = "green", + cut_files_color = "red", +}) +``` + +For example, here is how my line looks like: + +![preview-2](https://github.com/llanosrocas/yaziline.yazi/blob/master/.github/images/preview-2.png) + +### Selected and Yanked Counter + +Displays the number of selected ('S') and yanked ('Y') files on the left. If files are cut, the yank counter changes color, since its `yank --cut` under the hood. + +### Truncated filename + +Displays the truncated filename on the left, which is useful for smaller windows or long filenames. By default, it's 24 characters with trimming to 12 (6 + 6). Adjust in the `setup`. + +```lua +require("yaziline"):setup({ + filename_max_length = 24, -- truncate when filename > 24 + filename_truncate_length = 6, -- leave 6 chars on both sides + filename_truncate_separator = "..." -- the separator of the truncated filename +}) +``` + +### ISO Date for 'Modified' + +On the right, you'll find the date and time the file was modified, formatted in an [ISO](https://en.wikipedia.org/wiki/ISO_8601)-like string for universal date representation. Adjust in the `Status:date` function. + +## Credits + +- [yazi source code](https://github.com/sxyazi/yazi) +- [yatline.yazi](https://github.com/imsi32/yatline.yazi/tree/main) +- [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) diff --git a/yazi/.config/yazi/plugins/yaziline.yazi/main.lua b/yazi/.config/yazi/plugins/yaziline.yazi/main.lua new file mode 100644 index 0000000..2f7daac --- /dev/null +++ b/yazi/.config/yazi/plugins/yaziline.yazi/main.lua @@ -0,0 +1,199 @@ +local function setup(_, options) + options = options or {} + + local default_separators = { + angly = { "", "", "", "" }, + curvy = { "", "", "", "" }, + liney = { "", "", "|", "|" }, + empty = { "", "", "", "" }, + } + local separators = default_separators[options.separator_style or "angly"] + + local config = { + separator_styles = { + separator_open = options.separator_open or separators[1], + separator_close = options.separator_close or separators[2], + separator_open_thin = options.separator_open_thin or separators[3], + separator_close_thin = options.separator_close_thin or separators[4], + separator_head = options.separator_head or "", + separator_tail = options.separator_tail or "", + }, + select_symbol = options.select_symbol or "S", + yank_symbol = options.yank_symbol or "Y", + + filename_max_length = options.filename_max_length or 24, + filename_truncate_length = options.filename_truncate_length or 6, + filename_truncate_separator = options.filename_truncate_separator or "...", + + color = options.color or nil, + default_files_color = options.default_files_color + or th.which.separator_style.fg + or "darkgray", + selected_files_color = options.selected_files_color + or th.mgr.count_selected.bg + or "white", + yanked_files_color = options.selected_files_color + or th.mgr.count_copied.bg + or "green", + cut_files_color = options.cut_files_color + or th.mgr.count_cut.bg + or "red", + } + + local current_separator_style = config.separator_styles + + function Header:count() + return ui.Line({}) + end + + function Status:mode() + local mode = tostring(self._tab.mode):upper() + + local style = self:style() + return ui.Line({ + ui.Span(current_separator_style.separator_head) + :fg(config.color or style.main.bg), + ui.Span(" " .. mode .. " ") + :fg(th.which.mask.bg) + :bg(config.color or style.main.bg), + }) + end + + function Status:size() + local h = self._current.hovered + local size = h and ya.readable_size(h:size() or h.cha.len) + + local style = self:style() + return ui.Span(current_separator_style.separator_close .. " " .. size .. " ") + :fg(config.color or style.main.bg) + :bg(th.which.separator_style.fg) + end + + function Status:utf8_sub(str, start_char, end_char) + local start_byte = utf8.offset(str, start_char) + local end_byte = end_char and (utf8.offset(str, end_char + 1) - 1) or #str + + if not start_byte or not end_byte then + return "" + end + + return string.sub(str, start_byte, end_byte) + end + + function Status:truncate_name(filename, max_length) + local base_name, extension = filename:match("^(.+)(%.[^%.]+)$") + base_name = base_name or filename + extension = extension or "" + + if utf8.len(base_name) > max_length then + base_name = self:utf8_sub(base_name, 1, config.filename_truncate_length) + .. config.filename_truncate_separator + .. self:utf8_sub(base_name, -config.filename_truncate_length) + end + + return base_name .. extension + end + + function Status:name() + local h = self._current.hovered + if not h then + return "" + end + + local truncated_name = self:truncate_name(h.name, config.filename_max_length) + + local style = self:style() + return ui.Line { + ui.Span(current_separator_style.separator_close .. " ") + :fg(th.which.separator_style.fg), + ui.Span(truncated_name) + :fg(config.color or style.main.bg), + } + end + + function Status:files() + local files_yanked = #cx.yanked + local files_selected = #cx.active.selected + local files_cut = cx.yanked.is_cut + + local selected_fg = files_selected > 0 + and config.selected_files_color + or config.default_files_color + local yanked_fg = files_yanked > 0 + and + (files_cut + and config.cut_files_color + or config.yanked_files_color + ) + or config.default_files_color + + local yanked_text = files_yanked > 0 + and config.yank_symbol .. " " .. files_yanked + or config.yank_symbol .. " 0" + + return ui.Line({ + ui.Span(" " .. current_separator_style.separator_close_thin .. " ") + :fg(th.which.separator_style.fg), + ui.Span(config.select_symbol .. " " .. files_selected .. " ") + :fg(selected_fg), + ui.Span(yanked_text .. " ") + :fg(yanked_fg), + }) + end + + function Status:modified() + local hovered = cx.active.current.hovered + local cha = hovered.cha + local time = (cha.mtime or 0) // 1 + + return ui.Span(os.date("%Y-%m-%d %H:%M", time) .. " " .. current_separator_style.separator_open_thin .. " ") + :fg(th.which.separator_style.fg) + end + + function Status:percent() + local percent = 0 + local cursor = self._tab.current.cursor + local length = #self._tab.current.files + if cursor ~= 0 and length ~= 0 then + percent = math.floor((cursor + 1) * 100 / length) + end + + if percent == 0 then + percent = " Top " + elseif percent == 100 then + percent = " Bot " + else + percent = string.format(" %2d%% ", percent) + end + + local style = self:style() + return ui.Line({ + ui.Span(" " .. current_separator_style.separator_open) + :fg(th.which.separator_style.fg), + ui.Span(percent) + :fg(config.color or style.main.bg) + :bg(th.which.separator_style.fg), + ui.Span(current_separator_style.separator_open) + :fg(config.color or style.main.bg) + :bg(th.which.separator_style.fg), + }) + end + + function Status:position() + local cursor = self._tab.current.cursor + local length = #self._tab.current.files + + local style = self:style() + return ui.Line({ + ui.Span(string.format(" %2d/%-2d ", math.min(cursor + 1, length), length)) + :fg(th.which.mask.bg) + :bg(config.color or style.main.bg), + ui.Span(current_separator_style.separator_tail):fg(config.color or style.main.bg), + }) + end + + Status:children_add(Status.files, 4000, Status.LEFT) + Status:children_add(Status.modified, 0, Status.RIGHT) +end + +return { setup = setup } \ No newline at end of file diff --git a/yazi/.config/yazi/theme.toml b/yazi/.config/yazi/theme.toml new file mode 100644 index 0000000..48eb1cf --- /dev/null +++ b/yazi/.config/yazi/theme.toml @@ -0,0 +1,4 @@ +[flavor] +dark = "catppuccin-mocha" +light = "catppuccin-mocha" + diff --git a/yazi/.config/yazi/yazi.toml b/yazi/.config/yazi/yazi.toml new file mode 100644 index 0000000..9df43a5 --- /dev/null +++ b/yazi/.config/yazi/yazi.toml @@ -0,0 +1,250 @@ +## https://www.youtube.com/watch?v=iKb3cHDD9hw# A TOML linter such as https://taplo.tamasfe.dev/ can use this schema to validate your config. +# If you encounter any issues, please make an issue at https://github.com/yazi-rs/schemas. +"$schema" = "https://yazi-rs.github.io/schemas/yazi.json" + +[mgr] +ratio = [ 2, 3, 5 ] +sort_by = "alphabetical" +sort_sensitive = false +sort_reverse = false +sort_dir_first = true +sort_translit = false +linemode = "none" +show_hidden = true +show_symlink = true +scrolloff = 5 +mouse_events = [ "click", "scroll" ] +title_format = "Yazi: {cwd}" + +[preview] +wrap = "no" +tab_size = 2 +max_width = 2400 +max_height = 2000 +cache_dir = "" +image_delay = 30 +image_filter = "triangle" +image_quality = 75 +sixel_fraction = 15 +ueberzug_scale = 1 +ueberzug_offset = [ 0, 0, 0, 0 ] + +[opener] +edit = [ + { run = 'nvim $0', block = true, desc = "nvim", for = "unix" }, + { run = 'code %*', orphan = true, desc = "code", for = "windows" }, + { run = 'code -w %*', block = true, desc = "code (block)", for = "windows" }, +] +open = [ + { run = 'xdg-open "$1"', desc = "Open", for = "linux" }, + { run = 'open "$@"', desc = "Open", for = "macos" }, + { run = 'start "" "%1"', orphan = true, desc = "Open", for = "windows" }, +] +reveal = [ + { run = 'xdg-open "$(dirname "$1")"', desc = "Reveal", for = "linux" }, + { run = 'open -R "$1"', desc = "Reveal", for = "macos" }, + { run = 'explorer /select,"%1"', orphan = true, desc = "Reveal", for = "windows" }, + { run = '''exiftool "$1"; echo "Press enter to exit"; read _''', block = true, desc = "Show EXIF", for = "unix" }, +] +extract = [ + { run = 'ouch d -y "%*"', desc = "Extract here with ouch", for = "windows" }, + { run = 'ouch d -y "$@"', desc = "Extract here with ouch", for = "unix" }, + # { run = 'ya pub extract --list "$@"', desc = "Extract here", for = "unix" }, + #{ run = 'ya pub extract --list %*', desc = "Extract here", for = "windows" }, +] +play = [ + { run = 'mpv --force-window "$@"', orphan = true, for = "unix" }, + { run = 'mpv --force-window %*', orphan = true, for = "windows" }, + { run = '''mediainfo "$1"; echo "Press enter to exit"; read _''', block = true, desc = "Show media info", for = "unix" }, +] + +[open] +rules = [ + # Folder + { name = "*/", use = [ "edit", "open", "reveal" ] }, + # Text + { mime = "text/*", use = [ "edit", "reveal" ] }, + # Image + { mime = "image/*", use = [ "open", "reveal" ] }, + # Media + # { mime = "{audio,video}/*", use = [ "play", "reveal" ] }, + # Archive + { mime = "application/{zip,rar,7z*,tar,gzip,xz,zstd,bzip*,lzma,compress,archive,cpio,arj,xar,ms-cab*}", use = [ "extract", "reveal" ] }, + # JSON + { mime = "application/{json,ndjson}", use = [ "edit", "reveal" ] }, + { mime = "*/javascript", use = [ "edit", "reveal" ] }, + # Empty file + { mime = "inode/empty", use = [ "edit", "reveal" ] }, + # Fallback + { name = "*", use = [ "open", "reveal" ] }, +] + +[tasks] +micro_workers = 10 +macro_workers = 10 +bizarre_retry = 3 +image_alloc = 536870912 # 512MB +image_bound = [ 0, 0 ] +suppress_preload = true + +[plugin] + +#fetchers = [ +# # Mimetype +# { id = "mime", name = "*", run = "mime", if = "!mime", prio = "high" }, +# ] +prepend_fetchers = [ + { id = "git", name = "*", run = "git" }, + { id = "git", name = "*/", run = "git" }, + { id = "mime", mime = "*", run = "mime", prio = "low" }, +] +spotters = [ +{ name = "*/", run = "folder" }, + # Code + { mime = "text/*", run = "code" }, + { mime = "*/{xml,javascript,wine-extension-ini}", run = "code" }, + # Image + { mime = "image/{avif,hei?,jxl,svg+xml}", run = "magick" }, + { mime = "image/*", run = "image" }, + # Video + #{ mime = "video/*", run = "video" }, + # Fallback + { name = "*", run = "file" }, +] +preloaders = [ + # Image + { mime = "image/{avif,hei?,jxl,svg+xml}", run = "magick" }, + { mime = "image/*", run = "image" }, + # Video + #{ mime = "video/*", run = "video" }, + # PDF + { mime = "application/pdf", run = "pdf" }, + # Font + { mime = "font/*", run = "font" }, + { mime = "application/ms-opentype", run = "font" }, +] +previewers = [ + { name = "*/", run = "folder", sync = true }, + # Code + { mime = "text/*", run = "code" }, + { mime = "*/{xml,javascript,wine-extension-ini}", run = "code" }, + # JSON + { mime = "application/{json,ndjson}", run = "json" }, + # Image + { mime = "image/{avif,hei?,jxl,svg+xml}", run = "magick" }, + { mime = "image/*", run = "image" }, + # # Video + #{ mime = "video/*", run = "video" }, + # PDF + { mime = "application/pdf", run = "pdf" }, + # Archive + { mime = "application/{zip,rar,7z*,tar,gzip,xz,zstd,bzip*,lzma,compress,archive,cpio,arj,xar,ms-cab*}", run = "archive" }, + { mime = "application/{debian*-package,redhat-package-manager,rpm,android.package-archive}", run = "archive" }, + { name = "*.{AppImage,appimage}", run = "archive" }, + # Virtual Disk / Disk Image + { mime = "application/{iso9660-image,qemu-disk,ms-wim,apple-diskimage}", run = "archive" }, + { mime = "application/virtualbox-{vhd,vhdx}", run = "archive" }, + { name = "*.{img,fat,ext,ext2,ext3,ext4,squashfs,ntfs,hfs,hfsx}", run = "archive" }, + # Font + { mime = "font/*", run = "font" }, + { mime = "application/ms-opentype", run = "font" }, + # Empty file + { mime = "inode/empty", run = "empty" }, + # Fallback + { name = "*", run = "file" }, +] +# eza-preview +prepend_previewers = [ + { name = "*/", run = "eza-preview"}, +# jupyter preview + { name = "*.ipynb", run = "nbpreview" }, +# mediainfo + # { mime = "{image,audio,video}/*", run = "mediainfo-nightly"}, + # { mime = "application/subrip", run = "mediainfo-nightly"}, +# Archive previewer https://github.com/ndtoan96/ouch.yazi + { mime = "application/*zip", run = "ouch" }, + { mime = "application/x-tar", run = "ouch" }, + { mime = "application/x-bzip2", run = "ouch" }, + { mime = "application/x-7z-compressed", run = "ouch" }, + { mime = "application/x-rar", run = "ouch" }, + { mime = "application/x-xz", run = "ouch" }, + # rich preview https://github.com/AnirudhG07/rich-preview.yazi + { name = "*.csv", run = "rich-preview"}, # for csv files + { name = "*.md", run = "rich-preview" }, # for markdown (.md) files + { name = "*.rst", run = "rich-preview"}, # for restructured text (.rst) files + { name = "*.ipynb", run = "rich-preview"}, # for jupyter notebooks (.ipynb) + { name = "*.json", run = "rich-preview"}, # for json (.json) files + { name = "*.lang_type", run = "rich-preview"}, # for particular language files eg. .py, .go., .lua, etc. +] + +[input] +cursor_blink = false + +# cd +cd_title = "Change directory:" +cd_origin = "top-center" +cd_offset = [ 0, 2, 50, 3 ] + +# create +create_title = [ "Create:", "Create (dir):" ] +create_origin = "top-center" +create_offset = [ 0, 2, 50, 3 ] + +# rename +rename_title = "Rename:" +rename_origin = "hovered" +rename_offset = [ 0, 1, 50, 3 ] + +# filter +filter_title = "Filter:" +filter_origin = "top-center" +filter_offset = [ 0, 2, 50, 3 ] + +# find +find_title = [ "Find next:", "Find previous:" ] +find_origin = "top-center" +find_offset = [ 0, 2, 50, 3 ] + +# search +search_title = "Search via {n}:" +search_origin = "top-center" +search_offset = [ 0, 2, 50, 3 ] + +# shell +shell_title = [ "Shell:", "Shell (block):" ] +shell_origin = "top-center" +shell_offset = [ 0, 2, 50, 3 ] + +[confirm] +# trash +trash_title = "Trash {n} selected file{s}?" +trash_origin = "center" +trash_offset = [ 0, 0, 70, 20 ] + +# delete +delete_title = "Permanently delete {n} selected file{s}?" +delete_origin = "center" +delete_offset = [ 0, 0, 70, 20 ] + +# overwrite +overwrite_title = "Overwrite file?" +overwrite_content = "Will overwrite the following file:" +overwrite_origin = "center" +overwrite_offset = [ 0, 0, 50, 15 ] + +# quit +quit_title = "Quit?" +quit_content = "The following task is still running, are you sure you want to quit?" +quit_origin = "center" +quit_offset = [ 0, 0, 50, 15 ] + +[pick] +open_title = "Open with:" +open_origin = "hovered" +open_offset = [ 0, 1, 50, 7 ] + +[which] +sort_by = "none" +sort_sensitive = false +sort_reverse = false +sort_translit = false diff --git a/zshrc/.aliases.zsh b/zshrc/.aliases.zsh new file mode 100644 index 0000000..684f305 --- /dev/null +++ b/zshrc/.aliases.zsh @@ -0,0 +1,167 @@ +alias cl='clear' +alias cld='clear && cd' +alias neo='neofetch' +alias f='fuck' + +# put everything on nvim +alias nano='nvim' +alias vim='nvim' +alias n='nvim' + +alias soz='source ~/.zshrc' +alias rmm='sudo rm -R' +alias mc='musikcube' +alias mat='tldr' +alias kbu='kbdlight up 50' +alias kbd='kbdlight down 50' + +alias tg='~/scripts/bluelight.sh' + +# 8 commandlinetools zoxide_openfiles_nvim +alias nzo="~/scripts/zoxide_openfiles_nvim.sh" +alias rebo='sudo grub-mkconfig -o /boot/grub/grub.cfg; reboot' +alias shut='sudo grub-mkconfig -o /boot/grub/grub.cfg; shutdown now' +alias grubb='sudo grub-mkconfig -o /boot/grub/grub.cfg' + +# called from ~/scrtipts/ +alias nlof="~/scripts/fzf_listoldfiles.sh" +# alias fman="compgen -c | fzf | xargs man" + +# tmux +alias ta='tmux attach' +alias tn='tmux new' +alias tns='~/scripts/tmux-sessionizer.sh' + +# eza +alias lt='eza --tree --level=1 --long --icons --git' +alias ltt='eza --tree --level=2 --long --icons --git' +alias lttt='eza --tree --level=3 --long --icons --git' +alias ltre='eza --tree --level=1 --icons --git' +alias ltree='eza --tree --level=2 --icons --git' +alias ltreee='eza --tree --level=3 --icons --git' +alias ls='eza --color=always --long --git --no-time --icons=always --no-user --no-permissions' + +# mirrorlist +alias mbak='sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak' +alias mlist='sudo reflector --verbose --latest 10 --age 1 --download-timeout 20 --protocol https --sort rate --save /etc/pacman.d/mirrorlist' + +# git commands +# alias gad='git add' +# alias gaf='git add *' +# alias gco='git commit -m' +# alias gp='git push' +# alias gcc='git clone' +alias lgit='lazygit' + +# proton vpn +alias vpnn='sudo protonvpn c' +alias vpnr='sudo protonvpn reconnect' # reconnect after sleep +alias vpn='sudo protonvpn c -f' # connect to fastest server +alias vpnd='sudo protonvpn d' # diconnect current session +alias vpnp='sudo protonvpn c --p2p' # connect to fastest p2p server +alias vpns='protonvpn status' # check status + +# NetworkManager +alias nmwi='nmcli device wifi list' # show you all possible wifi networks +alias nmst='nmcli device status' # shows you the current connection +alias nmco='nmcli device wifi connect' # add '$SSID' and '$PASSWORD' +alias nmsh='nmcli con show' # shows all valid connnections +alias nmup='nmcli con up' # add the name of the connection in '' +alias nmdo='nmcli con down' # add the nome of the connection in '' + +# open with password +alias tshift='sudo -E timeshift-launcher' +alias part='sudo -E gparted' + +# mtp mount (android etc) +alias mtpd='mtp-detect' +alias mtpm='jmtpfs ~/android_device' +alias mtpu='fusermount -u ~/android_device' + +# mount not android +alias lsb='lsblk' +alias lsd='sudo mkdir /mount/' +alias lsm='sudo mount /dev/' +alias lsu='sudo umount /mount/' + +# streamrip +alias ripp='rip search tidal album' + +# paru +alias ys='$AUR_HELPER -S' # install package +alias yr='$AUR_HELPER -Rn' # remove package +alias yy='$AUR_HELPER -Ss' # paru search for package +alias yay='$AUR_HELPER' +alias yi='$AUR_HELPER -Si' # aur info +alias which-aur="echo 'Currently using: $AUR_HELPER'" + +# trash-cli +alias te='trash-empty' +alias tr='trash-restore' + +# pyenv +alias pyl='pyenv local' # set this for folder in spec python version +alias pyg='pyenv global' # changes the global python version +alias pyve='pyenv virtualenvs' # shows all possible vitualenvironments +alias pyd='pyenv virtualenv-delete' +alias pyn='pyenv virtualenv' # makes a new env $VSERION $NAME +alias pyv='pyenv versions' +alias pyil='pyenv install -l' +alias pyi='pyenv install' + +# aria2 and yt-dlp +alias aryt="yt-dlp --external-downloader aria2c --external-downloader-args '-x 8 -j2'" # add URL in '' +alias aria='aria2c -x 8' # add URL in '' for 8 segmented download +alias yd='yt-dlp' # copy link from videodownload helper and add the URL in '' + +# ffmpeg +alias ffcmp='ffmpeg -i video.mp4 -q:a 0 -map a audio.mp3' # convert on mp4 into mp3 +alias ffcbmp='for file in *.mp4; do + ffmpeg -i "$file" -q:a 0 -map a "${file%.mp4}.mp3" +done' # batch rename all mp4 into mp3 add -af "volume=1.5" to increase audio volume by 1.5 +alias photodetect='gphoto2 --auto-detect' +alias photoget='gphoto2 --get-all-files' + +# borg backup +alias boinit='borg init --encryption repokey' # add folder like /folder/ initiates the backupfunction +alias bolist='borg list' # /backup/ creates a list of al the backups which are contained in this folder +alias boc='borg create --stats --progress --compression lz4' # /backup::backup1 dotfiles creates the backup. The ::backup1 will be name of the backup +# create placeholder sudo borg create --stats --compression lz4 ::{user}-{now} file or folder +alias bomo='borg mount /home/liph/backup /tmp/borg' # which repo to mount and where to mount it. make sure the folder already exists +alias boumo='borg umount /tmp/borg' # unmount the mount folder + +# systemctl +alias sysen='sudo systemctl enable' +alias sysst='sudo systemctl start' + +# podmand +alias pops='podman ps' +alias pos='podman start' +alias post='podman stop' +alias poc='podman-compose up -d' +alias pocp='podman-compose pull' +alias pocf='podman-compose up -d --force-recreate' +alias porm='podman rm' +alias pormf='podman rm -f' +alias pormi='podman rmi' + +# disk space +alias dfh='df -h' # shows a list of all mounted drives +alias duh='du -sh' #calculates folder space +alias duf='duf' # analyzes diskspace +alias duaa='dua i' # opens dua in interactive mode +alias rns='sudo pacman -Rns $(pacman -Qdtq)' # remove orphaned packages +alias rsc='sudo pacman -Sc' # remove cached packeged +alias rmc='rm -rf ~/.cache/*' # clear user cache + +# ip addr +alias ipa='sudo ip addr add ' +alias ipl='sudo ip link set ' +alias ipf='sudo ip addr flush ' + +# wireguard vpn +alias wgu='sudo wg-quick up' # start the connection you like to establish (f.E open) +alias wgd='sudo wg-quick down' # end the connection you like to end (f.E open) +alias wgc='sudo wg showconf' # show the config for a connection (f.E open) +alias wgs='sudo wg show' # show informations about the connection + diff --git a/zshrc/.export.zsh b/zshrc/.export.zsh new file mode 100644 index 0000000..196cefe --- /dev/null +++ b/zshrc/.export.zsh @@ -0,0 +1,37 @@ +# FZF +export FZF_CTRL_T_OPTS="--preview 'bat -n --color=always --line-range :500 {}'" +export FZF_ALT_C_OPTS="--preview 'eza --tree --color=always {} | head -200'" +export FZF_DEFAULT_OPTS="--height 50% --layout=default --border --color=hl:#2dd4bf" +export FZF_TMUX_OPTS=" -p90%,70% " + +# FD +export FZF_DEFAULT_COMMAND="fd --hidden --strip-cwd-prefix --exclude .git" +export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" +export FZF_ALT_C_COMMAND="fd --type=d --hidden --strip-cwd-prefix --exclude .g-t" +export FZF_DEFAULT_OPTS='--bind tab:accept' + +# temuxifier +export PATH="$HOME/.tmuxifier/bin:$PATH" + +# yazi setup +export EDITOR="nvim" + +# pyenv +export PYENV_ROOT="$HOME/.pyenv/" + +# fuse +export BORG_FUSE_IMPL=llfuse +export BORG_FUSE_IMPL=pyfuse3 + +# borg podman +export BORG_PASSPHRASE="1ChagearC" + +# manpager +export MANPAGER='nvim +Man!' + +export XDG_CURRENT_DESKTOP=Hyprland +export XDG_SESSION_TYPE=wayland +export QT_QPA_PLATFORM=wayland +export SDL_VIDEODRIVER=wayland +export CLUTTER_BACKEND=wayland +export MOZ_ENABLE_WAYLAND=1 diff --git a/zshrc/.plugins.zsh b/zshrc/.plugins.zsh new file mode 100644 index 0000000..3ac2607 --- /dev/null +++ b/zshrc/.plugins.zsh @@ -0,0 +1,17 @@ +# Add in Powerline10k +#zinit ice depth=1; zinit light romkatv/powerlevel10k + +# Add in plugins +zinit light zsh-users/zsh-syntax-highlighting +zinit light zsh-users/zsh-completions +zinit light zsh-users/zsh-autosuggestions +zinit light Aloxaf/fzf-tab + +# Add in snippets from "OhMyZsh“ +zinit snippet OMZP::git +zinit snippet OMZP::sudo +zinit snippet OMZP::archlinux +zinit snippet OMZP::aws +zinit snippet OMZP::kubectl +zinit snippet OMZP::kubectx +zinit snippet OMZP::command-not-found diff --git a/zshrc/.zshrc b/zshrc/.zshrc new file mode 100644 index 0000000..853f312 --- /dev/null +++ b/zshrc/.zshrc @@ -0,0 +1,120 @@ + + +# set the directory we want to store zinit and plugins +ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.locale/share}/zinit/zinit.git" + +# Download Zinit +if [ ! -d "$ZINIT_HOME" ]; then + mkdir -p "$(dirname $ZINIT_HOME)" + git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" +fi + +# Source zsh, alias +source "${ZINIT_HOME}/zinit.zsh" +source ~/.aliases.zsh +source ~/.plugins.zsh +source ~/.export.zsh +# https://github.com/jungunn/fzf-git.sh +source ~/scripts/fzf-git.sh +# you should unse +source /usr/share/zsh/plugins/zsh-you-should-use/you-should-use.plugin.zsh +# Set up fzf key bindings and fuzzy completion +source <(fzf --zsh) +## hydroxide +#source ~/scripts/hydroxide.sh + +# env aur helper +if command -v paru &> /dev/null; then + export AUR_HELPER="paru" +elif command -v yay &> /dev/null; then + export AUR_HELPER="yay" +else + export AUR_HELPER="pacman" # Fallback to pacman +fi +#export AUR_HELPER="paru" + +# Load completions +autoload -U compinit && compinit + +## zinit cdreplay -q +eval "$(oh-my-posh init zsh --config $HOME/.config/ohmyposh/zen.toml)" + +#eval "$(ssh-agent -s)" +#if ! pgrep -u "$USER" ssh-agent > /dev/null; then +# ssh-agent > ~/.ssh-agent.env +#fi +#if [[ -z "$SSH_AUTH_SOCK" ]]; then +# source ~/.ssh-agent.env > /dev/null +#fi + +# pyenv +[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" + +# Bindkey +bindkey -e +bindkey '^p' history-search-backward +bindkey '^n' history-search-forward + +# History +HISTSIZE=5000 +HISTFILE=~/.zsh_history +SAVEHIST=$HISTSIZE +HISTDUP=erase +setopt appendhistory +setopt sharehistory +setopt hist_ignore_space +setopt hist_ignore_all_dups +setopt hist_save_no_dups +setopt hist_ignore_dups +setopt hist_find_no_dups + +# Completion styling +zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' +zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" +zstyle ':completion:*' menu no +zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath' + +# Shell integration +eval "$(fzf --zsh)" +eval "$(zoxide init --cmd cd zsh)" +eval "$(thefuck --alias)" +eval "$(navi widget zsh)" +# pyenv https://github.com/pyenv/pyenv-virtualenv +eval "$(pyenv init --path)" +eval "$(pyenv init -)" +# eval "$(pyenv virtualenv-init -)" +# starship +# eval "$(starship init zsh)" + +_fzf_comprun() { + local command=$1 + shift + + case "$command" in + cd) fzf --preview 'eza --tree --color=always {} | head -200' "$@" ;; + export|unset) fzf --preview "eval 'echo \$' {}" "$@" ;; + ssh) fzf --preview 'dig {}' "$@" ;; + *) fzf --preview "--preview 'bat -n --color=always --line-range :10 {}'" "$@" ;; + esac +} + +function y() { + local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd + yazi "$@" --cwd-file="$tmp" + if cwd="$(command cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then + builtin cd -- "$cwd" + fi + rm -f -- "$tmp" +} + +# Load a few important annexes, without Turbo +# (this is currently required for annexes) +zinit light-mode for \ + zdharma-continuum/zinit-annex-as-monitor \ + zdharma-continuum/zinit-annex-bin-gem-node \ + zdharma-continuum/zinit-annex-patch-dl \ + zdharma-continuum/zinit-annex-rust + +### End of Zinit's installer chunk + +# . "$HOME/.local/bin/env"