diff --git a/.config/alacritty/.gitignore b/.config/alacritty/.gitignore new file mode 100644 index 0000000..9847ade --- /dev/null +++ b/.config/alacritty/.gitignore @@ -0,0 +1 @@ +**/current-theme.toml diff --git a/.config/alacritty/alacritty.toml b/.config/alacritty/alacritty.toml new file mode 100644 index 0000000..66eebdc --- /dev/null +++ b/.config/alacritty/alacritty.toml @@ -0,0 +1,107 @@ +import = [ "~/.config/alacritty/current-theme.toml" ] + +[env] +TERM = "xterm-256color" + +[font] +size = 17.0 +offset.x = 0 +offset.y = 0 + +[font.normal] +family = "JetBrainsMono NF" + +[[keyboard.bindings]] +action = "CreateNewWindow" +key = "N" +mods = "Command" + +[[keyboard.bindings]] +action = "SearchForward" +key = "F" +mods = "Command" + +[[keyboard.bindings]] +chars = "alacritty -e 'btop' & \r" +key = "P" +mods = "Command" + +[[keyboard.bindings]] +chars = "search_history \r" +key = "Slash" +mode = "AppCursor" +mods = "Command" + +[[keyboard.bindings]] +chars = "\u001Bb" +key = "Left" +mods = "Alt" + +[[keyboard.bindings]] +chars = "\u001Bf" +key = "Right" +mods = "Alt" +[[keyboard.bindings]] +key = "T" +mods = "Command" +chars = "\u0013\u0003" + +[[keyboard.bindings]] +action = "ResetFontSize" +key = "Key0" +mods = "Command" + +[[keyboard.bindings]] +action = "IncreaseFontSize" +key = "Equals" +mods = "Command" + +[[keyboard.bindings]] +action = "DecreaseFontSize" +key = "Minus" +mods = "Command" + +[[keyboard.bindings]] +key = "T" +mods = "Command" +command = { program = "/opt/homebrew/bin/tmux", args = ["new-window"] } + +[[keyboard.bindings]] +key = "[" +mods = "Command" +command = { program = "/opt/homebrew/bin/tmux", args = ["previous-window"] } + +[[keyboard.bindings]] +key = "]" +mods = "Command" +command = { program = "/opt/homebrew/bin/tmux", args = ["next-window"] } + +[[keyboard.bindings]] +key = "d" +mods = "Command" +command = { program = "/opt/homebrew/bin/tmux", args = ["split", "-h"] } + +[[keyboard.bindings]] +key = "e" +mods = "Command" +command = { program = "/opt/homebrew/bin/tmux", args = ["split", "-v"] } + +[[keyboard.bindings]] +key = "W" +mods = "Command" +command = { program = "/opt/homebrew/bin/tmux", args = ["kill-pane"] } + +[shell] +args = ["-l", "-c", "session_name=$(tmux ls | grep -v \"(attached)\" | head -n 1 | cut -d: -f1); [ -n \"$session_name\" ] && tmux attach -t \"$session_name\" || tmux new-session"] +program = "/opt/homebrew/bin/zsh" + +[window] +decorations = "buttonless" +decorations_theme_variant = "None" +dynamic_padding = false +dynamic_title = true +opacity = 1 + +[window.padding] +x = 10 +y = 10 diff --git a/.config/alacritty/current-theme.example.toml b/.config/alacritty/current-theme.example.toml new file mode 100644 index 0000000..2b7f569 --- /dev/null +++ b/.config/alacritty/current-theme.example.toml @@ -0,0 +1 @@ +import = [ "/Users/dani/.config/alacritty/themes/solarized_light.toml" ] diff --git a/.config/alacritty/current-theme.toml b/.config/alacritty/current-theme.toml new file mode 100644 index 0000000..33b75f9 --- /dev/null +++ b/.config/alacritty/current-theme.toml @@ -0,0 +1 @@ +import = [ "~/.config/alacritty/themes/tokyonight.toml" ] diff --git a/.config/alacritty/themes/solarized_light.toml b/.config/alacritty/themes/solarized_light.toml new file mode 100644 index 0000000..3f7eb25 --- /dev/null +++ b/.config/alacritty/themes/solarized_light.toml @@ -0,0 +1,28 @@ +# Colors (Solarized Light) + +# Default colors +[colors.primary] +background = '#fdf6e3' +foreground = '#586e75' + +# Normal colors +[colors.normal] +black = '#073642' +red = '#dc322f' +green = '#859900' +yellow = '#b58900' +blue = '#268bd2' +magenta = '#d33682' +cyan = '#2aa198' +white = '#eee8d5' + +# Bright colors +[colors.bright] +black = '#002b36' +red = '#cb4b16' +green = '#586e75' +yellow = '#657b83' +blue = '#839496' +magenta = '#6c71c4' +cyan = '#93a1a1' +white = '#fdf6e3' diff --git a/.config/alacritty/themes/tokyonight.toml b/.config/alacritty/themes/tokyonight.toml new file mode 100644 index 0000000..0642a90 --- /dev/null +++ b/.config/alacritty/themes/tokyonight.toml @@ -0,0 +1,29 @@ +# Colors (Tokyo Night) +# Source https//github.com/zatchheems/tokyo-night-alacritty-theme + +# Default colors +[colors.primary] +background = '#1a1b26' +foreground = '#a9b1d6' + +# Normal colors +[colors.normal] +black = '#32344a' +red = '#f7768e' +green = '#9ece6a' +yellow = '#e0af68' +blue = '#7aa2f7' +magenta = '#ad8ee6' +cyan = '#449dab' +white = '#787c99' + +# Bright colors +[colors.bright] +black = '#444b6a' +red = '#ff7a93' +green = '#b9f27c' +yellow = '#ff9e64' +blue = '#7da6ff' +magenta = '#bb9af7' +cyan = '#0db9d7' +white = '#acb0d0' diff --git a/.config/bat/bat b/.config/bat/bat new file mode 120000 index 0000000..65fcef6 --- /dev/null +++ b/.config/bat/bat @@ -0,0 +1 @@ +/Users/dani/.config/bat \ No newline at end of file diff --git a/.config/bat/config b/.config/bat/config new file mode 100644 index 0000000..a5f01fc --- /dev/null +++ b/.config/bat/config @@ -0,0 +1,12 @@ +# Bat configuration file +# Syntax highlighting theme +--theme="TwoDark" + +# Style components to display +--style="numbers,changes,header" + +# Always show decorations +--decorations=never + +# Use less as pager with useful options +--pager="less -RF" diff --git a/.config/btop/btop.conf b/.config/btop/btop.conf new file mode 100644 index 0000000..c8f4358 --- /dev/null +++ b/.config/btop/btop.conf @@ -0,0 +1,218 @@ +#? Config file for btop v. 1.4.0 + +#* Name of a btop++/bpytop/bashtop formatted ".theme" file, "Default" and "TTY" for builtin themes. +#* Themes should be placed in "../share/btop/themes" relative to binary or "$HOME/.config/btop/themes" +color_theme = "/opt/homebrew/Cellar/btop/1.4.0/share/btop/themes/flat-remix-light.theme" + +#* If the theme set background should be shown, set to False if you want terminal background transparency. +theme_background = False + +#* Sets if 24-bit truecolor should be used, will convert 24-bit colors to 256 color (6x6x6 color cube) if false. +truecolor = True + +#* Set to true to force tty mode regardless if a real tty has been detected or not. +#* Will force 16-color mode and TTY theme, set all graph symbols to "tty" and swap out other non tty friendly symbols. +force_tty = False + +#* Define presets for the layout of the boxes. Preset 0 is always all boxes shown with default settings. Max 9 presets. +#* Format: "box_name:P:G,box_name:P:G" P=(0 or 1) for alternate positions, G=graph symbol to use for box. +#* Use whitespace " " as separator between different presets. +#* Example: "cpu:0:default,mem:0:tty,proc:1:default cpu:0:braille,proc:0:tty" +presets = "cpu:1:default,proc:0:default cpu:0:default,mem:0:default,net:0:default cpu:0:block,net:0:tty" + +#* Set to True to enable "h,j,k,l,g,G" keys for directional control in lists. +#* Conflicting keys for h:"help" and k:"kill" is accessible while holding shift. +vim_keys = True + +#* Rounded corners on boxes, is ignored if TTY mode is ON. +rounded_corners = True + +#* Default symbols to use for graph creation, "braille", "block" or "tty". +#* "braille" offers the highest resolution but might not be included in all fonts. +#* "block" has half the resolution of braille but uses more common characters. +#* "tty" uses only 3 different symbols but will work with most fonts and should work in a real TTY. +#* Note that "tty" only has half the horizontal resolution of the other two, so will show a shorter historical view. +graph_symbol = "braille" + +# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty". +graph_symbol_cpu = "default" + +# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty". +graph_symbol_mem = "default" + +# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty". +graph_symbol_net = "default" + +# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty". +graph_symbol_proc = "default" + +#* Manually set which boxes to show. Available values are "cpu mem net proc" and "gpu0" through "gpu5", separate values with whitespace. +shown_boxes = "proc" + +#* Update time in milliseconds, recommended 2000 ms or above for better sample times for graphs. +update_ms = 29000 + +#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct", +#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly. +proc_sorting = "name" + +#* Reverse sorting order, True or False. +proc_reversed = False + +#* Show processes as a tree. +proc_tree = False + +#* Use the cpu graph colors in the process list. +proc_colors = True + +#* Use a darkening gradient in the process list. +proc_gradient = True + +#* If process cpu usage should be of the core it's running on or usage of the total available cpu power. +proc_per_core = True + +#* Show process memory as bytes instead of percent. +proc_mem_bytes = True + +#* Show cpu graph for each process. +proc_cpu_graphs = True + +#* Use /proc/[pid]/smaps for memory information in the process info box (very slow but more accurate) +proc_info_smaps = False + +#* Show proc box on left side of screen instead of right. +proc_left = False + +#* (Linux) Filter processes tied to the Linux kernel(similar behavior to htop). +proc_filter_kernel = False + +#* In tree-view, always accumulate child process resources in the parent process. +proc_aggregate = False + +#* Sets the CPU stat shown in upper half of the CPU graph, "total" is always available. +#* Select from a list of detected attributes from the options menu. +cpu_graph_upper = "Auto" + +#* Sets the CPU stat shown in lower half of the CPU graph, "total" is always available. +#* Select from a list of detected attributes from the options menu. +cpu_graph_lower = "Auto" + +#* Toggles if the lower CPU graph should be inverted. +cpu_invert_lower = True + +#* Set to True to completely disable the lower CPU graph. +cpu_single_graph = False + +#* Show cpu box at bottom of screen instead of top. +cpu_bottom = False + +#* Shows the system uptime in the CPU box. +show_uptime = True + +#* Show cpu temperature. +check_temp = True + +#* Which sensor to use for cpu temperature, use options menu to select from list of available sensors. +cpu_sensor = "Auto" + +#* Show temperatures for cpu cores also if check_temp is True and sensors has been found. +show_coretemp = True + +#* Set a custom mapping between core and coretemp, can be needed on certain cpus to get correct temperature for correct core. +#* Use lm-sensors or similar to see which cores are reporting temperatures on your machine. +#* Format "x:y" x=core with wrong temp, y=core with correct temp, use space as separator between multiple entries. +#* Example: "4:0 5:1 6:3" +cpu_core_map = "" + +#* Which temperature scale to use, available values: "celsius", "fahrenheit", "kelvin" and "rankine". +temp_scale = "celsius" + +#* Use base 10 for bits/bytes sizes, KB = 1000 instead of KiB = 1024. +base_10_sizes = True + +#* Show CPU frequency. +show_cpu_freq = True + +#* Draw a clock at top of screen, formatting according to strftime, empty string to disable. +#* Special formatting: /host = hostname | /user = username | /uptime = system uptime +clock_format = "%X" + +#* Update main ui in background when menus are showing, set this to false if the menus is flickering too much for comfort. +background_update = True + +#* Custom cpu model name, empty string to disable. +custom_cpu_name = "" + +#* Optional filter for shown disks, should be full path of a mountpoint, separate multiple values with whitespace " ". +#* Begin line with "exclude=" to change to exclude filter, otherwise defaults to "most include" filter. Example: disks_filter="exclude=/boot /home/user". +disks_filter = "" + +#* Show graphs instead of meters for memory values. +mem_graphs = True + +#* Show mem box below net box instead of above. +mem_below_net = False + +#* Count ZFS ARC in cached and available memory. +zfs_arc_cached = True + +#* If swap memory should be shown in memory box. +show_swap = True + +#* Show swap as a disk, ignores show_swap value above, inserts itself after first disk. +swap_disk = True + +#* If mem box should be split to also show disks info. +show_disks = False + +#* Filter out non physical disks. Set this to False to include network disks, RAM disks and similar. +only_physical = True + +#* Read disks list from /etc/fstab. This also disables only_physical. +use_fstab = True + +#* Setting this to True will hide all datasets, and only show ZFS pools. (IO stats will be calculated per-pool) +zfs_hide_datasets = False + +#* Set to true to show available disk space for privileged users. +disk_free_priv = False + +#* Toggles if io activity % (disk busy time) should be shown in regular disk usage view. +show_io_stat = True + +#* Toggles io mode for disks, showing big graphs for disk read/write speeds. +io_mode = False + +#* Set to True to show combined read/write io graphs in io mode. +io_graph_combined = False + +#* Set the top speed for the io graphs in MiB/s (100 by default), use format "mountpoint:speed" separate disks with whitespace " ". +#* Example: "/mnt/media:100 /:20 /boot:1". +io_graph_speeds = "" + +#* Set fixed values for network graphs in Mebibits. Is only used if net_auto is also set to False. +net_download = 100 + +net_upload = 100 + +#* Use network graphs auto rescaling mode, ignores any values set above and rescales down to 10 Kibibytes at the lowest. +net_auto = False + +#* Sync the auto scaling for download and upload to whichever currently has the highest scale. +net_sync = False + +#* Starts with the Network Interface specified here. +net_iface = "" + +#* Show battery stats in top right if battery is present. +show_battery = True + +#* Which battery to use if multiple are present. "Auto" for auto detection. +selected_battery = "Auto" + +#* Show power stats of battery next to charge indicator. +show_battery_watts = True + +#* Set loglevel for "~/.config/btop/btop.log" levels are: "ERROR" "WARNING" "INFO" "DEBUG". +#* The level set includes all lower levels, i.e. "DEBUG" will show all logging info. +log_level = "WARNING" diff --git a/.config/ghostty/config b/.config/ghostty/config new file mode 100644 index 0000000..b125bca --- /dev/null +++ b/.config/ghostty/config @@ -0,0 +1,92 @@ +font-family = Jetbrains Mono NF +font-family-bold = Jetbrains Mono NF +font-family-italic = Jetbrains Mono NF +font-family-bold-italic = Jetbrains Mono NF +font-size = 16 +background = #000000 +command = zsh -c "/opt/homebrew/bin/zellij" +keybind = super+enter=toggle_fullscreen +keybind = super+alt+shift+j=write_screen_file:open +keybind = super+2=goto_tab:2 +keybind = super+digit_6=goto_tab:6 +keybind = super+k=clear_screen +keybind = super+page_down=scroll_page_down +keybind = super+4=goto_tab:4 +keybind = super+shift+z=redo +keybind = super+shift+v=paste_from_selection +keybind = shift+page_down=adjust_selection:page_down +keybind = super+7=goto_tab:7 +keybind = shift+arrow_down=adjust_selection:down +keybind = super+5=goto_tab:5 +keybind = super+3=goto_tab:3 +keybind = super+a=select_all +keybind = super+arrow_left=text:\x01 +keybind = shift+page_up=adjust_selection:page_up +keybind = super+0=reset_font_size +keybind = super+digit_2=goto_tab:2 +keybind = super+shift+bracket_left=previous_tab +keybind = super+shift+,=reload_config +keybind = super+,=open_config +keybind = super+ctrl+shift+j=write_screen_file:copy +keybind = paste=paste_from_clipboard +keybind = super+alt+arrow_up=goto_split:up +keybind = super+ctrl+arrow_right=resize_split:right,10 +keybind = alt+arrow_left=esc:b +keybind = shift+enter=text:\x1b\r +keybind = super+equal=increase_font_size:1 +keybind = ctrl+tab=next_tab +keybind = super+digit_4=goto_tab:4 +keybind = super+q=quit +keybind = super+shift+arrow_up=jump_to_prompt:-1 +keybind = super+ctrl+equal=equalize_splits +keybind = super+digit_7=goto_tab:7 +keybind = super+ctrl+f=toggle_fullscreen +keybind = super+backspace=text:\x15 +keybind = super+6=goto_tab:6 +keybind = super+page_up=scroll_page_up +keybind = super+1=goto_tab:1 +keybind = super+alt+w=close_tab:this +keybind = super+end=scroll_to_bottom +keybind = super+-=decrease_font_size:1 +keybind = super+arrow_up=jump_to_prompt:-1 +keybind = super+shift+t=undo +keybind = super+z=undo +keybind = super+digit_8=goto_tab:8 +keybind = super+9=last_tab +keybind = shift+arrow_up=adjust_selection:up +keybind = super+home=scroll_to_top +keybind = super+digit_1=goto_tab:1 +keybind = super+shift+w=close_window +keybind = super+alt+shift+w=close_all_windows +keybind = super+ctrl+arrow_down=resize_split:down,10 +keybind = shift+end=adjust_selection:end +keybind = super+v=paste_from_clipboard +keybind = shift+arrow_right=adjust_selection:right +keybind = super+ctrl+arrow_left=resize_split:left,10 +keybind = super+shift+enter=toggle_split_zoom +keybind = super+arrow_right=text:\x05 +keybind = super++=increase_font_size:1 +keybind = super+shift+p=toggle_command_palette +keybind = super+8=goto_tab:8 +keybind = shift+arrow_left=adjust_selection:left +keybind = super+shift+arrow_down=jump_to_prompt:1 +keybind = super+alt+arrow_down=goto_split:down +keybind = copy=copy_to_clipboard +keybind = super+shift+j=write_screen_file:paste +keybind = super+shift+bracket_right=next_tab +keybind = super+arrow_down=jump_to_prompt:1 +keybind = ctrl+shift+tab=previous_tab +keybind = alt+arrow_right=esc:f +keybind = super+n=new_window +keybind = shift+home=adjust_selection:home +keybind = super+alt+i=inspector:toggle +keybind = super+digit_5=goto_tab:5 +keybind = super+digit_3=goto_tab:3 +keybind = super+ctrl+arrow_up=resize_split:up,10 +window-padding-x = 10 +window-padding-y = 10 +click-repeat-interval = 200 +macos-titlebar-style = hidden +macos-option-as-alt = true +bold-color = bright +auto-update-channel = stable diff --git a/.config/hyfetch/hyfetch.json b/.config/hyfetch/hyfetch.json new file mode 100644 index 0000000..ea3b7b2 --- /dev/null +++ b/.config/hyfetch/hyfetch.json @@ -0,0 +1,16 @@ +{ + "preset": "nonbinary", + "mode": "rgb", + "light_dark": "dark", + "lightness": 0.5, + "color_align": { + "mode": "horizontal", + "custom_colors": [], + "fore_back": null + }, + "backend": "neofetch", + "args": null, + "distro": null, + "pride_month_shown": [], + "pride_month_disable": false +} diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf new file mode 100644 index 0000000..883d7c3 --- /dev/null +++ b/.config/hypr/hyprland.conf @@ -0,0 +1,274 @@ + +# ####################################################################################### +# AUTOGENERATED HYPR CONFIG. +# PLEASE USE THE CONFIG PROVIDED IN THE GIT REPO /examples/hypr.conf AND EDIT IT, +# OR EDIT THIS ONE ACCORDING TO THE WIKI INSTRUCTIONS. +# ####################################################################################### + + +# This is an example Hyprland config file. +# Refer to the wiki for more information. +# https://wiki.hyprland.org/Configuring/Configuring-Hyprland/ + +# 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 + + +################ +### MONITORS ### +################ + +# See https://wiki.hyprland.org/Configuring/Monitors/ +monitor=,preferred,auto,auto + + +################### +### MY PROGRAMS ### +################### + +# See https://wiki.hyprland.org/Configuring/Keywords/ + +# Set programs that you use +$terminal = alacritty +$browser = firefox +$fileManager = dolphin +$menu = wofi --show drun + + +################# +### 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 + + +############################# +### 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 = 5 + gaps_out = 20 + + border_size = 2 + + # 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 = 10 + + # Change transparency of focused and unfocused windows + active_opacity = 1.0 + inactive_opacity = 1.0 + + drop_shadow = true + shadow_range = 4 + shadow_render_power = 3 + col.shadow = 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 = true + + # Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + + bezier = myBezier, 0.05, 0.9, 0.1, 1.05 + + animation = windows, 0, 1, myBezier + animation = windowsOut, 0, 1, default, popin 80% + animation = border, 0, 10, default + animation = borderangle, 0, 8, default + animation = fade, 0, 7, default + animation = workspaces, 0, 0, default +} + +# 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 = us + kb_variant = + kb_model = + kb_options = caps:swapescape + kb_rules = + follow_mouse = 1 + + sensitivity = 0 # -1.0 - 1.0, 0 means no modification. + + touchpad { + natural_scroll = false + } + + repeat_delay = 200 + repeat_rate = 60 +} + +# 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 +} + + +#################### +### KEYBINDINGSS ### +#################### + +# 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, Q, exec, $terminal +bind = $mainMod, F, exec, $browser +bind = $mainMod, C, killactive, +bind = $mainMod, M, exit, +bind = $mainMod, E, exec, $fileManager +bind = $mainMod, V, togglefloating, +bind = $mainMod, R, exec, $menu +bind = $mainMod, Z, fullscreen +bind = $mainMod, P, pseudo, # dwindle +# bind = $mainMod, J, togglesplit, # dwindle + +bind = $mainMod, t, togglegroup + +# Move focus with mainMod + hjkl +bind = $mainMod, H, movefocus, l +bind = $mainMod, L, movefocus, r +bind = $mainMod, K, movefocus, u +bind = $mainMod, J, movefocus, d + +# Swap windows with mainMod + hjkl +bind = $mainMod SHIFT, H, swapwindow, l +bind = $mainMod SHIFT, L, swapwindow, r +bind = $mainMod SHIFT, K, swapwindow, u +bind = $mainMod SHIFT, J, swapwindow, d + +# Switch workspaces with mainMod + [0-9] +bind = $mainMod, 1, workspace, 1 +bind = $mainMod, 2, workspace, 2 +$browser = firefox +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 + +# Activate app switcher +bind = $mainMod, R, exec, bemenu-run + +# Media keys +bindel = , XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ +bindel = , XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- +bindl = , XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle + +############################## +### 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)$ + +windowrulev2 = suppressevent maximize, class:.* # You'll probably like this. diff --git a/.config/kitty/Solarized_Light.conf b/.config/kitty/Solarized_Light.conf new file mode 100644 index 0000000..36e101b --- /dev/null +++ b/.config/kitty/Solarized_Light.conf @@ -0,0 +1,21 @@ +background #fdf6e3 +foreground #52676f +cursor #52676f +selection_background #e9e2cb +color0 #e4e4e4 +color8 #ffffd7 +color1 #d70000 +color9 #d75f00 +color2 #5f8700 +color10 #585858 +color3 #af8700 +color11 #626262 +color4 #0087ff +color12 #808080 +color5 #af005f +color13 #5f5faf +color6 #00afaf +color14 #8a8a8a +color7 #262626 +color15 #1c1c1c +selection_foreground #fcf4dc diff --git a/.config/kitty/kitty.bak.conf b/.config/kitty/kitty.bak.conf new file mode 100644 index 0000000..2e38b8f --- /dev/null +++ b/.config/kitty/kitty.bak.conf @@ -0,0 +1,2507 @@ +# vim:fileencoding=utf-8:foldmethod=marker + +#: Fonts {{{ + +#: kitty has very powerful font management. You can configure +#: individual font faces and even specify special fonts for particular +#: characters. + +font_family jetbrains mono +bold_font auto +italic_font auto +bold_italic_font auto + +#: You can specify different fonts for the bold/italic/bold-italic +#: variants. To get a full list of supported fonts use the `kitty +#: +list-fonts` command. By default they are derived automatically, by +#: the OSes font system. When bold_font or bold_italic_font is set to +#: auto on macOS, the priority of bold fonts is semi-bold, bold, +#: heavy. Setting them manually is useful for font families that have +#: many weight variants like Book, Medium, Thick, etc. For example:: + +#: font_family Operator Mono Book +#: bold_font Operator Mono Medium +#: italic_font Operator Mono Book Italic +#: bold_italic_font Operator Mono Medium Italic + +font_size 23.0 + +#: Font size (in pts). + +# force_ltr no + +#: kitty does not support BIDI (bidirectional text), however, for RTL +#: scripts, words are automatically displayed in RTL. That is to say, +#: in an RTL script, the words "HELLO WORLD" display in kitty as +#: "WORLD HELLO", and if you try to select a substring of an RTL- +#: shaped string, you will get the character that would be there had +#: the string been LTR. For example, assuming the Hebrew word ירושלים, +#: selecting the character that on the screen appears to be ם actually +#: writes into the selection buffer the character י. kitty's default +#: behavior is useful in conjunction with a filter to reverse the word +#: order, however, if you wish to manipulate RTL glyphs, it can be +#: very challenging to work with, so this option is provided to turn +#: it off. Furthermore, this option can be used with the command line +#: program GNU FriBidi +#: to get BIDI support, because it will force kitty to always treat +#: the text as LTR, which FriBidi expects for terminals. + +# symbol_map + +#: E.g. symbol_map U+E0A0-U+E0A3,U+E0C0-U+E0C7 PowerlineSymbols + +#: Map the specified Unicode codepoints to a particular font. Useful +#: if you need special rendering for some symbols, such as for +#: Powerline. Avoids the need for patched fonts. Each Unicode code +#: point is specified in the form `U+`. You +#: can specify multiple code points, separated by commas and ranges +#: separated by hyphens. This option can be specified multiple times. +#: The syntax is:: + +#: symbol_map codepoints Font Family Name + +# narrow_symbols + +#: E.g. narrow_symbols U+E0A0-U+E0A3,U+E0C0-U+E0C7 1 + +#: Usually, for Private Use Unicode characters and some symbol/dingbat +#: characters, if the character is followed by one or more spaces, +#: kitty will use those extra cells to render the character larger, if +#: the character in the font has a wide aspect ratio. Using this +#: option you can force kitty to restrict the specified code points to +#: render in the specified number of cells (defaulting to one cell). +#: This option can be specified multiple times. The syntax is:: + +#: narrow_symbols codepoints [optionally the number of cells] + +# disable_ligatures never + +#: Choose how you want to handle multi-character ligatures. The +#: default is to always render them. You can tell kitty to not render +#: them when the cursor is over them by using cursor to make editing +#: easier, or have kitty never render them at all by using always, if +#: you don't like them. The ligature strategy can be set per-window +#: either using the kitty remote control facility or by defining +#: shortcuts for it in kitty.conf, for example:: + +#: map alt+1 disable_ligatures_in active always +#: map alt+2 disable_ligatures_in all never +#: map alt+3 disable_ligatures_in tab cursor + +#: Note that this refers to programming ligatures, typically +#: implemented using the calt OpenType feature. For disabling general +#: ligatures, use the font_features option. + +# font_features + +#: E.g. font_features none + +#: Choose exactly which OpenType features to enable or disable. This +#: is useful as some fonts might have features worthwhile in a +#: terminal. For example, Fira Code includes a discretionary feature, +#: zero, which in that font changes the appearance of the zero (0), to +#: make it more easily distinguishable from Ø. Fira Code also includes +#: other discretionary features known as Stylistic Sets which have the +#: tags ss01 through ss20. + +#: For the exact syntax to use for individual features, see the +#: HarfBuzz documentation . + +#: Note that this code is indexed by PostScript name, and not the font +#: family. This allows you to define very precise feature settings; +#: e.g. you can disable a feature in the italic font but not in the +#: regular font. + +#: On Linux, font features are first read from the FontConfig database +#: and then this option is applied, so they can be configured in a +#: single, central place. + +#: To get the PostScript name for a font, use `kitty +list-fonts +#: --psnames`: + +#: .. code-block:: sh + +#: $ kitty +list-fonts --psnames | grep Fira +#: Fira Code +#: Fira Code Bold (FiraCode-Bold) +#: Fira Code Light (FiraCode-Light) +#: Fira Code Medium (FiraCode-Medium) +#: Fira Code Regular (FiraCode-Regular) +#: Fira Code Retina (FiraCode-Retina) + +#: The part in brackets is the PostScript name. + +#: Enable alternate zero and oldstyle numerals:: + +#: font_features FiraCode-Retina +zero +onum + +#: Enable only alternate zero in the bold font:: + +#: font_features FiraCode-Bold +zero + +#: Disable the normal ligatures, but keep the calt feature which (in +#: this font) breaks up monotony:: + +#: font_features TT2020StyleB-Regular -liga +calt + +#: In conjunction with force_ltr, you may want to disable Arabic +#: shaping entirely, and only look at their isolated forms if they +#: show up in a document. You can do this with e.g.:: + +#: font_features UnifontMedium +isol -medi -fina -init + +# modify_font + +#: Modify font characteristics such as the position or thickness of +#: the underline and strikethrough. The modifications can have the +#: suffix px for pixels or % for percentage of original value. No +#: suffix means use pts. For example:: + +#: modify_font underline_position -2 +#: modify_font underline_thickness 150% +#: modify_font strikethrough_position 2px + +#: Additionally, you can modify the size of the cell in which each +#: font glyph is rendered and the baseline at which the glyph is +#: placed in the cell. For example:: + +#: modify_font cell_width 80% +#: modify_font cell_height -2px +#: modify_font baseline 3 + +#: Note that modifying the baseline will automatically adjust the +#: underline and strikethrough positions by the same amount. +#: Increasing the baseline raises glyphs inside the cell and +#: decreasing it lowers them. Decreasing the cell size might cause +#: rendering artifacts, so use with care. + +# box_drawing_scale 0.001, 1, 1.5, 2 + +#: The sizes of the lines used for the box drawing Unicode characters. +#: These values are in pts. They will be scaled by the monitor DPI to +#: arrive at a pixel value. There must be four values corresponding to +#: thin, normal, thick, and very thick lines. + +# undercurl_style thin-sparse + +#: The style with which undercurls are rendered. This option takes the +#: form (thin|thick)-(sparse|dense). Thin and thick control the +#: thickness of the undercurl. Sparse and dense control how often the +#: curl oscillates. With sparse the curl will peak once per character, +#: with dense twice. + +# text_composition_strategy platform + +#: Control how kitty composites text glyphs onto the background color. +#: The default value of platform tries for text rendering as close to +#: "native" for the platform kitty is running on as possible. + +#: A value of legacy uses the old (pre kitty 0.28) strategy for how +#: glyphs are composited. This will make dark text on light +#: backgrounds look thicker and light text on dark backgrounds +#: thinner. It might also make some text appear like the strokes are +#: uneven. + +#: You can fine tune the actual contrast curve used for glyph +#: composition by specifying up to two space-separated numbers for +#: this setting. + +#: The first number is the gamma adjustment, which controls the +#: thickness of dark text on light backgrounds. Increasing the value +#: will make text appear thicker. The default value for this is 1.0 on +#: Linux and 1.7 on macOS. Valid values are 0.01 and above. The result +#: is scaled based on the luminance difference between the background +#: and the foreground. Dark text on light backgrounds receives the +#: full impact of the curve while light text on dark backgrounds is +#: affected very little. + +#: The second number is an additional multiplicative contrast. It is +#: percentage ranging from 0 to 100. The default value is 0 on Linux +#: and 30 on macOS. + +#: If you wish to achieve similar looking thickness in light and dark +#: themes, a good way to experiment is start by setting the value to +#: 1.0 0 and use a dark theme. Then adjust the second parameter until +#: it looks good. Then switch to a light theme and adjust the first +#: parameter until the perceived thickness matches the dark theme. + +# text_fg_override_threshold 0 + +#: The minimum accepted difference in luminance between the foreground +#: and background color, below which kitty will override the +#: foreground color. It is percentage ranging from 0 to 100. If the +#: difference in luminance of the foreground and background is below +#: this threshold, the foreground color will be set to white if the +#: background is dark or black if the background is light. The default +#: value is 0, which means no overriding is performed. Useful when +#: working with applications that use colors that do not contrast well +#: with your preferred color scheme. + +#: WARNING: Some programs use characters (such as block characters) +#: for graphics display and may expect to be able to set the +#: foreground and background to the same color (or similar colors). +#: If you see unexpected stripes, dots, lines, incorrect color, no +#: color where you expect color, or any kind of graphic display +#: problem try setting text_fg_override_threshold to 0 to see if this +#: is the cause of the problem. + +#: }}} + +#: Cursor customization {{{ + +# cursor #cccccc + +#: Default cursor color. If set to the special value none the cursor +#: will be rendered with a "reverse video" effect. It's color will be +#: the color of the text in the cell it is over and the text will be +#: rendered with the background color of the cell. Note that if the +#: program running in the terminal sets a cursor color, this takes +#: precedence. Also, the cursor colors are modified if the cell +#: background and foreground colors have very low contrast. Note that +#: some themes set this value, so if you want to override it, place +#: your value after the lines where the theme file is included. + +# cursor_text_color #111111 + +#: The color of text under the cursor. If you want it rendered with +#: the background color of the cell underneath instead, use the +#: special keyword: `background`. Note that if cursor is set to none +#: then this option is ignored. Note that some themes set this value, +#: so if you want to override it, place your value after the lines +#: where the theme file is included. + +# cursor_shape block + +#: The cursor shape can be one of block, beam, underline. Note that +#: when reloading the config this will be changed only if the cursor +#: shape has not been set by the program running in the terminal. This +#: sets the default cursor shape, applications running in the terminal +#: can override it. In particular, shell integration +#: in kitty sets +#: the cursor shape to beam at shell prompts. You can avoid this by +#: setting shell_integration to no-cursor. + +# cursor_beam_thickness 1.5 + +#: The thickness of the beam cursor (in pts). + +# cursor_underline_thickness 2.0 + +#: The thickness of the underline cursor (in pts). + +# cursor_blink_interval -1 + +#: The interval to blink the cursor (in seconds). Set to zero to +#: disable blinking. Negative values mean use system default. Note +#: that the minimum interval will be limited to repaint_delay. + +# cursor_stop_blinking_after 15.0 + +#: Stop blinking cursor after the specified number of seconds of +#: keyboard inactivity. Set to zero to never stop blinking. + +#: }}} + +#: Scrollback {{{ + +# scrollback_lines 2000 + +#: Number of lines of history to keep in memory for scrolling back. +#: Memory is allocated on demand. Negative numbers are (effectively) +#: infinite scrollback. Note that using very large scrollback is not +#: recommended as it can slow down performance of the terminal and +#: also use large amounts of RAM. Instead, consider using +#: scrollback_pager_history_size. Note that on config reload if this +#: is changed it will only affect newly created windows, not existing +#: ones. + +# scrollback_indicator_opacity 1.0 + +#: The opacity of the scrollback indicator which is a small colored +#: rectangle that moves along the right hand side of the window as you +#: scroll, indicating what fraction you have scrolled. The default is +#: one which means fully opaque, aka visible. Set to a value between +#: zero and one to make the indicator less visible. + +# scrollback_pager less --chop-long-lines --RAW-CONTROL-CHARS +INPUT_LINE_NUMBER + +#: Program with which to view scrollback in a new window. The +#: scrollback buffer is passed as STDIN to this program. If you change +#: it, make sure the program you use can handle ANSI escape sequences +#: for colors and text formatting. INPUT_LINE_NUMBER in the command +#: line above will be replaced by an integer representing which line +#: should be at the top of the screen. Similarly CURSOR_LINE and +#: CURSOR_COLUMN will be replaced by the current cursor position or +#: set to 0 if there is no cursor, for example, when showing the last +#: command output. + +# scrollback_pager_history_size 0 + +#: Separate scrollback history size (in MB), used only for browsing +#: the scrollback buffer with pager. This separate buffer is not +#: available for interactive scrolling but will be piped to the pager +#: program when viewing scrollback buffer in a separate window. The +#: current implementation stores the data in UTF-8, so approximately +#: 10000 lines per megabyte at 100 chars per line, for pure ASCII, +#: unformatted text. A value of zero or less disables this feature. +#: The maximum allowed size is 4GB. Note that on config reload if this +#: is changed it will only affect newly created windows, not existing +#: ones. + +# scrollback_fill_enlarged_window no + +#: Fill new space with lines from the scrollback buffer after +#: enlarging a window. + +# wheel_scroll_multiplier 5.0 + +#: Multiplier for the number of lines scrolled by the mouse wheel. +#: Note that this is only used for low precision scrolling devices, +#: not for high precision scrolling devices on platforms such as macOS +#: and Wayland. Use negative numbers to change scroll direction. See +#: also wheel_scroll_min_lines. + +# wheel_scroll_min_lines 1 + +#: The minimum number of lines scrolled by the mouse wheel. The scroll +#: multiplier wheel_scroll_multiplier only takes effect after it +#: reaches this number. Note that this is only used for low precision +#: scrolling devices like wheel mice that scroll by very small amounts +#: when using the wheel. With a negative number, the minimum number of +#: lines will always be added. + +# touch_scroll_multiplier 1.0 + +#: Multiplier for the number of lines scrolled by a touchpad. Note +#: that this is only used for high precision scrolling devices on +#: platforms such as macOS and Wayland. Use negative numbers to change +#: scroll direction. + +#: }}} + +#: Mouse {{{ + +# mouse_hide_wait 3.0 + +#: Hide mouse cursor after the specified number of seconds of the +#: mouse not being used. Set to zero to disable mouse cursor hiding. +#: Set to a negative value to hide the mouse cursor immediately when +#: typing text. Disabled by default on macOS as getting it to work +#: robustly with the ever-changing sea of bugs that is Cocoa is too +#: much effort. + +# url_color #0087bd +# url_style curly + +#: The color and style for highlighting URLs on mouse-over. url_style +#: can be one of: none, straight, double, curly, dotted, dashed. + +# open_url_with default + +#: The program to open clicked URLs. The special value default will +#: first look for any URL handlers defined via the open_actions +#: facility and if non +#: are found, it will use the Operating System's default URL handler +#: (open on macOS and xdg-open on Linux). + +# url_prefixes file ftp ftps gemini git gopher http https irc ircs kitty mailto news sftp ssh + +#: The set of URL prefixes to look for when detecting a URL under the +#: mouse cursor. + +# detect_urls yes + +#: Detect URLs under the mouse. Detected URLs are highlighted with an +#: underline and the mouse cursor becomes a hand over them. Even if +#: this option is disabled, URLs are still clickable. See also the +#: underline_hyperlinks option to control how hyperlinks (as opposed +#: to plain text URLs) are displayed. + +# url_excluded_characters + +#: Additional characters to be disallowed from URLs, when detecting +#: URLs under the mouse cursor. By default, all characters that are +#: legal in URLs are allowed. Additionally, newlines are allowed (but +#: stripped). This is to accommodate programs such as mutt that add +#: hard line breaks even for continued lines. \n can be added to this +#: option to disable this behavior. Special characters can be +#: specified using backslash escapes, to specify a backslash use a +#: double backslash. + +# show_hyperlink_targets no + +#: When the mouse hovers over a terminal hyperlink, show the actual +#: URL that will be activated when the hyperlink is clicked. + +# underline_hyperlinks hover + +#: Control how hyperlinks are underlined. They can either be +#: underlined on mouse hover, always (i.e. permanently underlined) or +#: never which means that kitty will not apply any underline styling +#: to hyperlinks. Uses the url_style and url_color settings for the +#: underline style. Note that reloading the config and changing this +#: value to/from always will only affect text subsequently received by +#: kitty. + +# copy_on_select no + +#: Copy to clipboard or a private buffer on select. With this set to +#: clipboard, selecting text with the mouse will cause the text to be +#: copied to clipboard. Useful on platforms such as macOS that do not +#: have the concept of primary selection. You can instead specify a +#: name such as a1 to copy to a private kitty buffer. Map a shortcut +#: with the paste_from_buffer action to paste from this private +#: buffer. For example:: + +#: copy_on_select a1 +#: map shift+cmd+v paste_from_buffer a1 + +#: Note that copying to the clipboard is a security risk, as all +#: programs, including websites open in your browser can read the +#: contents of the system clipboard. + +# paste_actions quote-urls-at-prompt,confirm + +#: A comma separated list of actions to take when pasting text into +#: the terminal. The supported paste actions are: + +#: quote-urls-at-prompt: +#: If the text being pasted is a URL and the cursor is at a shell prompt, +#: automatically quote the URL (needs shell_integration). +#: replace-dangerous-control-codes +#: Replace dangerous control codes from pasted text, without confirmation. +#: replace-newline +#: Replace the newline character from pasted text, without confirmation. +#: confirm: +#: Confirm the paste if the text to be pasted contains any terminal control codes +#: as this can be dangerous, leading to code execution if the shell/program running +#: in the terminal does not properly handle these. +#: confirm-if-large +#: Confirm the paste if it is very large (larger than 16KB) as pasting +#: large amounts of text into shells can be very slow. +#: filter: +#: Run the filter_paste() function from the file paste-actions.py in +#: the kitty config directory on the pasted text. The text returned by the +#: function will be actually pasted. +#: no-op: +#: Has no effect. + +# strip_trailing_spaces never + +#: Remove spaces at the end of lines when copying to clipboard. A +#: value of smart will do it when using normal selections, but not +#: rectangle selections. A value of always will always do it. + +# select_by_word_characters @-./_~?&=%+# + +#: Characters considered part of a word when double clicking. In +#: addition to these characters any character that is marked as an +#: alphanumeric character in the Unicode database will be matched. + +# select_by_word_characters_forward + +#: Characters considered part of a word when extending the selection +#: forward on double clicking. In addition to these characters any +#: character that is marked as an alphanumeric character in the +#: Unicode database will be matched. + +#: If empty (default) select_by_word_characters will be used for both +#: directions. + +# click_interval -1.0 + +#: The interval between successive clicks to detect double/triple +#: clicks (in seconds). Negative numbers will use the system default +#: instead, if available, or fallback to 0.5. + +# focus_follows_mouse no + +#: Set the active window to the window under the mouse when moving the +#: mouse around. On macOS, this will also cause the OS Window under +#: the mouse to be focused automatically when the mouse enters it. + +# pointer_shape_when_grabbed arrow + +#: The shape of the mouse pointer when the program running in the +#: terminal grabs the mouse. + +# default_pointer_shape beam + +#: The default shape of the mouse pointer. + +# pointer_shape_when_dragging beam + +#: The default shape of the mouse pointer when dragging across text. + +#: Mouse actions {{{ + +#: Mouse buttons can be mapped to perform arbitrary actions. The +#: syntax is: + +#: .. code-block:: none + +#: mouse_map button-name event-type modes action + +#: Where button-name is one of left, middle, right, b1 ... b8 with +#: added keyboard modifiers. For example: ctrl+shift+left refers to +#: holding the Ctrl+Shift keys while clicking with the left mouse +#: button. The value b1 ... b8 can be used to refer to up to eight +#: buttons on a mouse. + +#: event-type is one of press, release, doublepress, triplepress, +#: click, doubleclick. modes indicates whether the action is performed +#: when the mouse is grabbed by the program running in the terminal, +#: or not. The values are grabbed or ungrabbed or a comma separated +#: combination of them. grabbed refers to when the program running in +#: the terminal has requested mouse events. Note that the click and +#: double click events have a delay of click_interval to disambiguate +#: from double and triple presses. + +#: You can run kitty with the kitty --debug-input command line option +#: to see mouse events. See the builtin actions below to get a sense +#: of what is possible. + +#: If you want to unmap a button, map it to nothing. For example, to +#: disable opening of URLs with a plain click:: + +#: mouse_map left click ungrabbed + +#: See all the mappable actions including mouse actions here +#: . + +#: .. note:: +#: Once a selection is started, releasing the button that started it will +#: automatically end it and no release event will be dispatched. + +# clear_all_mouse_actions no + +#: Remove all mouse action definitions up to this point. Useful, for +#: instance, to remove the default mouse actions. + +#: Click the link under the mouse or move the cursor + +# mouse_map left click ungrabbed mouse_handle_click selection link prompt + +#:: First check for a selection and if one exists do nothing. Then +#:: check for a link under the mouse cursor and if one exists, click +#:: it. Finally check if the click happened at the current shell +#:: prompt and if so, move the cursor to the click location. Note +#:: that this requires shell integration +#:: to work. + +#: Click the link under the mouse or move the cursor even when grabbed + +# mouse_map shift+left click grabbed,ungrabbed mouse_handle_click selection link prompt + +#:: Same as above, except that the action is performed even when the +#:: mouse is grabbed by the program running in the terminal. + +#: Click the link under the mouse cursor + +# mouse_map ctrl+shift+left release grabbed,ungrabbed mouse_handle_click link + +#:: Variant with Ctrl+Shift is present because the simple click based +#:: version has an unavoidable delay of click_interval, to +#:: disambiguate clicks from double clicks. + +#: Discard press event for link click + +# mouse_map ctrl+shift+left press grabbed discard_event + +#:: Prevent this press event from being sent to the program that has +#:: grabbed the mouse, as the corresponding release event is used to +#:: open a URL. + +#: Paste from the primary selection + +# mouse_map middle release ungrabbed paste_from_selection + +#: Start selecting text + +# mouse_map left press ungrabbed mouse_selection normal + +#: Start selecting text in a rectangle + +# mouse_map ctrl+alt+left press ungrabbed mouse_selection rectangle + +#: Select a word + +# mouse_map left doublepress ungrabbed mouse_selection word + +#: Select a line + +# mouse_map left triplepress ungrabbed mouse_selection line + +#: Select line from point + +# mouse_map ctrl+alt+left triplepress ungrabbed mouse_selection line_from_point + +#:: Select from the clicked point to the end of the line. If you +#:: would like to select the word at the point and then extend to the +#:: rest of the line, change `line_from_point` to +#:: `word_and_line_from_point`. + +#: Extend the current selection + +# mouse_map right press ungrabbed mouse_selection extend + +#:: If you want only the end of the selection to be moved instead of +#:: the nearest boundary, use move-end instead of extend. + +#: Paste from the primary selection even when grabbed + +# mouse_map shift+middle release ungrabbed,grabbed paste_selection +# mouse_map shift+middle press grabbed discard_event + +#: Start selecting text even when grabbed + +# mouse_map shift+left press ungrabbed,grabbed mouse_selection normal + +#: Start selecting text in a rectangle even when grabbed + +# mouse_map ctrl+shift+alt+left press ungrabbed,grabbed mouse_selection rectangle + +#: Select a word even when grabbed + +# mouse_map shift+left doublepress ungrabbed,grabbed mouse_selection word + +#: Select a line even when grabbed + +# mouse_map shift+left triplepress ungrabbed,grabbed mouse_selection line + +#: Select line from point even when grabbed + +# mouse_map ctrl+shift+alt+left triplepress ungrabbed,grabbed mouse_selection line_from_point + +#:: Select from the clicked point to the end of the line even when +#:: grabbed. If you would like to select the word at the point and +#:: then extend to the rest of the line, change `line_from_point` to +#:: `word_and_line_from_point`. + +#: Extend the current selection even when grabbed + +# mouse_map shift+right press ungrabbed,grabbed mouse_selection extend + +#: Show clicked command output in pager + +# mouse_map ctrl+shift+right press ungrabbed mouse_show_command_output + +#:: Requires shell integration +#:: to work. + +#: }}} + +#: }}} + +#: Performance tuning {{{ + +# repaint_delay 10 + +#: Delay between screen updates (in milliseconds). Decreasing it, +#: increases frames-per-second (FPS) at the cost of more CPU usage. +#: The default value yields ~100 FPS which is more than sufficient for +#: most uses. Note that to actually achieve 100 FPS, you have to +#: either set sync_to_monitor to no or use a monitor with a high +#: refresh rate. Also, to minimize latency when there is pending input +#: to be processed, this option is ignored. + +# input_delay 3 + +#: Delay before input from the program running in the terminal is +#: processed (in milliseconds). Note that decreasing it will increase +#: responsiveness, but also increase CPU usage and might cause flicker +#: in full screen programs that redraw the entire screen on each loop, +#: because kitty is so fast that partial screen updates will be drawn. +#: This setting is ignored when the input buffer is almost full. + +# sync_to_monitor yes + +#: Sync screen updates to the refresh rate of the monitor. This +#: prevents screen tearing +#: when scrolling. +#: However, it limits the rendering speed to the refresh rate of your +#: monitor. With a very high speed mouse/high keyboard repeat rate, +#: you may notice some slight input latency. If so, set this to no. + +#: }}} + +#: Terminal bell {{{ + +# enable_audio_bell yes + +#: The audio bell. Useful to disable it in environments that require +#: silence. + +# visual_bell_duration 0.0 + +#: The visual bell duration (in seconds). Flash the screen when a bell +#: occurs for the specified number of seconds. Set to zero to disable. + +# visual_bell_color none + +#: The color used by visual bell. Set to none will fall back to +#: selection background color. If you feel that the visual bell is too +#: bright, you can set it to a darker color. + +# window_alert_on_bell yes + +#: Request window attention on bell. Makes the dock icon bounce on +#: macOS or the taskbar flash on Linux. + +# bell_on_tab "🔔 " + +#: Some text or a Unicode symbol to show on the tab if a window in the +#: tab that does not have focus has a bell. If you want to use leading +#: or trailing spaces, surround the text with quotes. See +#: tab_title_template for how this is rendered. + +#: For backwards compatibility, values of yes, y and true are +#: converted to the default bell symbol and no, n, false and none are +#: converted to the empty string. + +# command_on_bell none + +#: Program to run when a bell occurs. The environment variable +#: KITTY_CHILD_CMDLINE can be used to get the program running in the +#: window in which the bell occurred. + +# bell_path none + +#: Path to a sound file to play as the bell sound. If set to none, the +#: system default bell sound is used. Must be in a format supported by +#: the operating systems sound API, such as WAV or OGA on Linux +#: (libcanberra) or AIFF, MP3 or WAV on macOS (NSSound). + +# linux_bell_theme __custom + +#: The XDG Sound Theme kitty will use to play the bell sound. Defaults +#: to the custom theme name used by GNOME and Budgie, falling back to +#: the default freedesktop theme if it does not exist. This option may +#: be removed if Linux ever provides desktop-agnostic support for +#: setting system sound themes. + +#: }}} + +#: Window layout {{{ + +# remember_window_size yes +# initial_window_width 640 +# initial_window_height 400 + +#: If enabled, the OS Window size will be remembered so that new +#: instances of kitty will have the same size as the previous +#: instance. If disabled, the OS Window will initially have size +#: configured by initial_window_width/height, in pixels. You can use a +#: suffix of "c" on the width/height values to have them interpreted +#: as number of cells instead of pixels. + +# enabled_layouts * + +#: The enabled window layouts. A comma separated list of layout names. +#: The special value all means all layouts. The first listed layout +#: will be used as the startup layout. Default configuration is all +#: layouts in alphabetical order. For a list of available layouts, see +#: the layouts . + +# window_resize_step_cells 2 +# window_resize_step_lines 2 + +#: The step size (in units of cell width/cell height) to use when +#: resizing kitty windows in a layout with the shortcut +#: start_resizing_window. The cells value is used for horizontal +#: resizing, and the lines value is used for vertical resizing. + +# window_border_width 0.5pt + +#: The width of window borders. Can be either in pixels (px) or pts +#: (pt). Values in pts will be rounded to the nearest number of pixels +#: based on screen resolution. If not specified, the unit is assumed +#: to be pts. Note that borders are displayed only when more than one +#: window is visible. They are meant to separate multiple windows. + +# draw_minimal_borders yes + +#: Draw only the minimum borders needed. This means that only the +#: borders that separate the window from a neighbor are drawn. Note +#: that setting a non-zero window_margin_width overrides this and +#: causes all borders to be drawn. + +# window_margin_width 0 + +#: The window margin (in pts) (blank area outside the border). A +#: single value sets all four sides. Two values set the vertical and +#: horizontal sides. Three values set top, horizontal and bottom. Four +#: values set top, right, bottom and left. + +# single_window_margin_width -1 + +#: The window margin to use when only a single window is visible (in +#: pts). Negative values will cause the value of window_margin_width +#: to be used instead. A single value sets all four sides. Two values +#: set the vertical and horizontal sides. Three values set top, +#: horizontal and bottom. Four values set top, right, bottom and left. + +window_padding_width 10 + +#: The window padding (in pts) (blank area between the text and the +#: window border). A single value sets all four sides. Two values set +#: the vertical and horizontal sides. Three values set top, horizontal +#: and bottom. Four values set top, right, bottom and left. + +# single_window_padding_width -1 + +#: The window padding to use when only a single window is visible (in +#: pts). Negative values will cause the value of window_padding_width +#: to be used instead. A single value sets all four sides. Two values +#: set the vertical and horizontal sides. Three values set top, +#: horizontal and bottom. Four values set top, right, bottom and left. + +# placement_strategy center + +#: When the window size is not an exact multiple of the cell size, the +#: cell area of the terminal window will have some extra padding on +#: the sides. You can control how that padding is distributed with +#: this option. Using a value of center means the cell area will be +#: placed centrally. A value of top-left means the padding will be +#: only at the bottom and right edges. + +active_border_color #FF0000 + +#: The color for the border of the active window. Set this to none to +#: not draw borders around the active window. + +# inactive_border_color #cccccc + +#: The color for the border of inactive windows. + +# bell_border_color #ff5a00 + +#: The color for the border of inactive windows in which a bell has +#: occurred. + +# inactive_text_alpha 1.0 + +#: Fade the text in inactive windows by the specified amount (a number +#: between zero and one, with zero being fully faded). + +# hide_window_decorations false + +#: Hide the window decorations (title-bar and window borders) with +#: yes. On macOS, titlebar-only and titlebar-and-corners can be used +#: to only hide the titlebar and the rounded corners. Whether this +#: works and exactly what effect it has depends on the window +#: manager/operating system. Note that the effects of changing this +#: option when reloading config are undefined. When using titlebar- +#: only, it is useful to also set window_margin_width and +#: placement_strategy to prevent the rounded corners from clipping +#: text. Or use titlebar-and-corners. + +# window_logo_path none + +#: Path to a logo image. Must be in PNG format. Relative paths are +#: interpreted relative to the kitty config directory. The logo is +#: displayed in a corner of every kitty window. The position is +#: controlled by window_logo_position. Individual windows can be +#: configured to have different logos either using the launch action +#: or the remote control facility. + +# window_logo_position bottom-right + +#: Where to position the window logo in the window. The value can be +#: one of: top-left, top, top-right, left, center, right, bottom-left, +#: bottom, bottom-right. + +# window_logo_alpha 0.5 + +#: The amount the logo should be faded into the background. With zero +#: being fully faded and one being fully opaque. + +# resize_debounce_time 0.1 0.5 + +#: The time to wait (in seconds) before asking the program running in +#: kitty to resize and redraw the screen during a live resize of the +#: OS window, when no new resize events have been received, i.e. when +#: resizing is either paused or finished. On platforms such as macOS, +#: where the operating system sends events corresponding to the start +#: and end of a live resize, the second number is used for redraw- +#: after-pause since kitty can distinguish between a pause and end of +#: resizing. On such systems the first number is ignored and redraw is +#: immediate after end of resize. On other systems only the first +#: number is used so that kitty is "ready" quickly after the end of +#: resizing, while not also continuously redrawing, to save energy. + +# resize_in_steps no + +#: Resize the OS window in steps as large as the cells, instead of +#: with the usual pixel accuracy. Combined with initial_window_width +#: and initial_window_height in number of cells, this option can be +#: used to keep the margins as small as possible when resizing the OS +#: window. Note that this does not currently work on Wayland. + +# visual_window_select_characters 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ + +#: The list of characters for visual window selection. For example, +#: for selecting a window to focus on with focus_visible_window. The +#: value should be a series of unique numbers or alphabets, case +#: insensitive, from the set 0-9A-Z\-=[];',./\\`. Specify your +#: preference as a string of characters. + +# confirm_os_window_close -1 + +#: Ask for confirmation when closing an OS window or a tab with at +#: least this number of kitty windows in it by window manager (e.g. +#: clicking the window close button or pressing the operating system +#: shortcut to close windows) or by the close_tab action. A value of +#: zero disables confirmation. This confirmation also applies to +#: requests to quit the entire application (all OS windows, via the +#: quit action). Negative values are converted to positive ones, +#: however, with shell_integration enabled, using negative values +#: means windows sitting at a shell prompt are not counted, only +#: windows where some command is currently running. Note that if you +#: want confirmation when closing individual windows, you can map the +#: close_window_with_confirmation action. + +#: }}} + +#: Tab bar {{{ + +# tab_bar_edge bottom + +#: The edge to show the tab bar on, top or bottom. + +# tab_bar_margin_width 0.0 + +#: The margin to the left and right of the tab bar (in pts). + +# tab_bar_margin_height 0.0 0.0 + +#: The margin above and below the tab bar (in pts). The first number +#: is the margin between the edge of the OS Window and the tab bar. +#: The second number is the margin between the tab bar and the +#: contents of the current tab. + +# tab_bar_style fade + +#: The tab bar style, can be one of: + +#: fade +#: Each tab's edges fade into the background color. (See also tab_fade) +#: slant +#: Tabs look like the tabs in a physical file. +#: separator +#: Tabs are separated by a configurable separator. (See also +#: tab_separator) +#: powerline +#: Tabs are shown as a continuous line with "fancy" separators. +#: (See also tab_powerline_style) +#: custom +#: A user-supplied Python function called draw_tab is loaded from the file +#: tab_bar.py in the kitty config directory. For examples of how to +#: write such a function, see the functions named draw_tab_with_* in +#: kitty's source code: kitty/tab_bar.py. See also +#: this discussion +#: for examples from kitty users. +#: hidden +#: The tab bar is hidden. If you use this, you might want to create +#: a mapping for the select_tab action which presents you with a list of +#: tabs and allows for easy switching to a tab. + +# tab_bar_align left + +#: The horizontal alignment of the tab bar, can be one of: left, +#: center, right. + +# tab_bar_min_tabs 2 + +#: The minimum number of tabs that must exist before the tab bar is +#: shown. + +# tab_switch_strategy previous + +#: The algorithm to use when switching to a tab when the current tab +#: is closed. The default of previous will switch to the last used +#: tab. A value of left will switch to the tab to the left of the +#: closed tab. A value of right will switch to the tab to the right of +#: the closed tab. A value of last will switch to the right-most tab. + +# tab_fade 0.25 0.5 0.75 1 + +#: Control how each tab fades into the background when using fade for +#: the tab_bar_style. Each number is an alpha (between zero and one) +#: that controls how much the corresponding cell fades into the +#: background, with zero being no fade and one being full fade. You +#: can change the number of cells used by adding/removing entries to +#: this list. + +# tab_separator " ┇" + +#: The separator between tabs in the tab bar when using separator as +#: the tab_bar_style. + +# tab_powerline_style angled + +#: The powerline separator style between tabs in the tab bar when +#: using powerline as the tab_bar_style, can be one of: angled, +#: slanted, round. + +# tab_activity_symbol none + +#: Some text or a Unicode symbol to show on the tab if a window in the +#: tab that does not have focus has some activity. If you want to use +#: leading or trailing spaces, surround the text with quotes. See +#: tab_title_template for how this is rendered. + +# tab_title_max_length 0 + +#: The maximum number of cells that can be used to render the text in +#: a tab. A value of zero means that no limit is applied. + +# tab_title_template "{fmt.fg.red}{bell_symbol}{activity_symbol}{fmt.fg.tab}{title}" + +#: A template to render the tab title. The default just renders the +#: title with optional symbols for bell and activity. If you wish to +#: include the tab-index as well, use something like: {index}:{title}. +#: Useful if you have shortcuts mapped for goto_tab N. If you prefer +#: to see the index as a superscript, use {sup.index}. All data +#: available is: + +#: title +#: The current tab title. +#: index +#: The tab index usable with goto_tab N goto_tab shortcuts. +#: layout_name +#: The current layout name. +#: num_windows +#: The number of windows in the tab. +#: num_window_groups +#: The number of window groups (a window group is a window and all of its overlay windows) in the tab. +#: tab.active_wd +#: The working directory of the currently active window in the tab +#: (expensive, requires syscall). Use active_oldest_wd to get +#: the directory of the oldest foreground process rather than the newest. +#: tab.active_exe +#: The name of the executable running in the foreground of the currently +#: active window in the tab (expensive, requires syscall). Use +#: active_oldest_exe for the oldest foreground process. +#: max_title_length +#: The maximum title length available. +#: keyboard_mode +#: The name of the current keyboard mode or the empty string if no keyboard mode is active. + +#: Note that formatting is done by Python's string formatting +#: machinery, so you can use, for instance, {layout_name[:2].upper()} +#: to show only the first two letters of the layout name, upper-cased. +#: If you want to style the text, you can use styling directives, for +#: example: +#: `{fmt.fg.red}red{fmt.fg.tab}normal{fmt.bg._00FF00}greenbg{fmt.bg.tab}`. +#: Similarly, for bold and italic: +#: `{fmt.bold}bold{fmt.nobold}normal{fmt.italic}italic{fmt.noitalic}`. +#: Note that for backward compatibility, if {bell_symbol} or +#: {activity_symbol} are not present in the template, they are +#: prepended to it. + +# active_tab_title_template none + +#: Template to use for active tabs. If not specified falls back to +#: tab_title_template. + +# active_tab_foreground #000 +# active_tab_background #eee +# active_tab_font_style bold-italic +# inactive_tab_foreground #444 +# inactive_tab_background #999 +# inactive_tab_font_style normal + +#: Tab bar colors and styles. + +# tab_bar_background none + +#: Background color for the tab bar. Defaults to using the terminal +#: background color. + +# tab_bar_margin_color none + +#: Color for the tab bar margin area. Defaults to using the terminal +#: background color for margins above and below the tab bar. For side +#: margins the default color is chosen to match the background color +#: of the neighboring tab. + +#: }}} + +#: Color scheme {{{ + +# foreground #dddddd +# background #000000 + +#: The foreground and background colors. + +# background_opacity 1.0 + +#: The opacity of the background. A number between zero and one, where +#: one is opaque and zero is fully transparent. This will only work if +#: supported by the OS (for instance, when using a compositor under +#: X11). Note that it only sets the background color's opacity in +#: cells that have the same background color as the default terminal +#: background, so that things like the status bar in vim, powerline +#: prompts, etc. still look good. But it means that if you use a color +#: theme with a background color in your editor, it will not be +#: rendered as transparent. Instead you should change the default +#: background color in your kitty config and not use a background +#: color in the editor color scheme. Or use the escape codes to set +#: the terminals default colors in a shell script to launch your +#: editor. Be aware that using a value less than 1.0 is a (possibly +#: significant) performance hit. When using a low value for this +#: setting, it is desirable that you set the background color to a +#: color the matches the general color of the desktop background, for +#: best text rendering. If you want to dynamically change +#: transparency of windows, set dynamic_background_opacity to yes +#: (this is off by default as it has a performance cost). Changing +#: this option when reloading the config will only work if +#: dynamic_background_opacity was enabled in the original config. + +# background_blur 0 + +#: Set to a positive value to enable background blur (blurring of the +#: visuals behind a transparent window) on platforms that support it. +#: Only takes effect when background_opacity is less than one. On +#: macOS, this will also control the blur radius (amount of blurring). +#: Setting it to too high a value will cause severe performance issues +#: and/or rendering artifacts. Usually, values up to 64 work well. +#: Note that this might cause performance issues, depending on how the +#: platform implements it, so use with care. Currently supported on +#: macOS and KDE. + +# background_image none + +#: Path to a background image. Must be in PNG format. + +# background_image_layout tiled + +#: Whether to tile, scale or clamp the background image. The value can +#: be one of tiled, mirror-tiled, scaled, clamped, centered or +#: cscaled. The scaled and cscaled values scale the image to the +#: window size, with cscaled preserving the image aspect ratio. + +# background_image_linear no + +#: When background image is scaled, whether linear interpolation +#: should be used. + +# dynamic_background_opacity no + +#: Allow changing of the background_opacity dynamically, using either +#: keyboard shortcuts (increase_background_opacity and +#: decrease_background_opacity) or the remote control facility. +#: Changing this option by reloading the config is not supported. + +# background_tint 0.0 + +#: How much to tint the background image by the background color. This +#: option makes it easier to read the text. Tinting is done using the +#: current background color for each window. This option applies only +#: if background_opacity is set and transparent windows are supported +#: or background_image is set. + +# background_tint_gaps 1.0 + +#: How much to tint the background image at the window gaps by the +#: background color, after applying background_tint. Since this is +#: multiplicative with background_tint, it can be used to lighten the +#: tint over the window gaps for a *separated* look. + +# dim_opacity 0.4 + +#: How much to dim text that has the DIM/FAINT attribute set. One +#: means no dimming and zero means fully dimmed (i.e. invisible). + +# selection_foreground #000000 +# selection_background #fffacd + +#: The foreground and background colors for text selected with the +#: mouse. Setting both of these to none will cause a "reverse video" +#: effect for selections, where the selection will be the cell text +#: color and the text will become the cell background color. Setting +#: only selection_foreground to none will cause the foreground color +#: to be used unchanged. Note that these colors can be overridden by +#: the program running in the terminal. + +#: The color table {{{ + +#: The 256 terminal colors. There are 8 basic colors, each color has a +#: dull and bright version, for the first 16 colors. You can set the +#: remaining 240 colors as color16 to color255. + +# color0 #000000 +# color8 #767676 + +#: black + +# color1 #cc0403 +# color9 #f2201f + +#: red + +# color2 #19cb00 +# color10 #23fd00 + +#: green + +# color3 #cecb00 +# color11 #fffd00 + +#: yellow + +# color4 #0d73cc +# color12 #1a8fff + +#: blue + +# color5 #cb1ed1 +# color13 #fd28ff + +#: magenta + +# color6 #0dcdcd +# color14 #14ffff + +#: cyan + +# color7 #dddddd +# color15 #ffffff + +#: white + +# mark1_foreground black + +#: Color for marks of type 1 + +# mark1_background #98d3cb + +#: Color for marks of type 1 (light steel blue) + +# mark2_foreground black + +#: Color for marks of type 2 + +# mark2_background #f2dcd3 + +#: Color for marks of type 1 (beige) + +# mark3_foreground black + +#: Color for marks of type 3 + +# mark3_background #f274bc + +#: Color for marks of type 3 (violet) + +#: }}} + +#: }}} + +#: Advanced {{{ + +# shell . + +#: The shell program to execute. The default value of . means to use +#: whatever shell is set as the default shell for the current user. +#: Note that on macOS if you change this, you might need to add +#: --login and --interactive to ensure that the shell starts in +#: interactive mode and reads its startup rc files. Environment +#: variables are expanded in this setting. + +# editor . + +#: The terminal based text editor (such as vim or nano) to use when +#: editing the kitty config file or similar tasks. + +#: The default value of . means to use the environment variables +#: VISUAL and EDITOR in that order. If these variables aren't set, +#: kitty will run your shell ($SHELL -l -i -c env) to see if your +#: shell startup rc files set VISUAL or EDITOR. If that doesn't work, +#: kitty will cycle through various known editors (vim, emacs, etc.) +#: and take the first one that exists on your system. + +# close_on_child_death no + +#: Close the window when the child process (shell) exits. With the +#: default value no, the terminal will remain open when the child +#: exits as long as there are still processes outputting to the +#: terminal (for example disowned or backgrounded processes). When +#: enabled with yes, the window will close as soon as the child +#: process exits. Note that setting it to yes means that any +#: background processes still using the terminal can fail silently +#: because their stdout/stderr/stdin no longer work. + +# remote_control_password + +#: Allow other programs to control kitty using passwords. This option +#: can be specified multiple times to add multiple passwords. If no +#: passwords are present kitty will ask the user for permission if a +#: program tries to use remote control with a password. A password can +#: also *optionally* be associated with a set of allowed remote +#: control actions. For example:: + +#: remote_control_password "my passphrase" get-colors set-colors focus-window focus-tab + +#: Only the specified actions will be allowed when using this +#: password. Glob patterns can be used too, for example:: + +#: remote_control_password "my passphrase" set-tab-* resize-* + +#: To get a list of available actions, run:: + +#: kitten @ --help + +#: A set of actions to be allowed when no password is sent can be +#: specified by using an empty password. For example:: + +#: remote_control_password "" *-colors + +#: Finally, the path to a python module can be specified that provides +#: a function is_cmd_allowed that is used to check every remote +#: control command. For example:: + +#: remote_control_password "my passphrase" my_rc_command_checker.py + +#: Relative paths are resolved from the kitty configuration directory. +#: See rc_custom_auth for details. + +# allow_remote_control no + +#: Allow other programs to control kitty. If you turn this on, other +#: programs can control all aspects of kitty, including sending text +#: to kitty windows, opening new windows, closing windows, reading the +#: content of windows, etc. Note that this even works over SSH +#: connections. The default setting of no prevents any form of remote +#: control. The meaning of the various values are: + +#: password +#: Remote control requests received over both the TTY device and the socket +#: are confirmed based on passwords, see remote_control_password. + +#: socket-only +#: Remote control requests received over a socket are accepted +#: unconditionally. Requests received over the TTY are denied. +#: See listen_on. + +#: socket +#: Remote control requests received over a socket are accepted +#: unconditionally. Requests received over the TTY are confirmed based on +#: password. + +#: no +#: Remote control is completely disabled. + +#: yes +#: Remote control requests are always accepted. + +# listen_on none + +#: Listen to the specified socket for remote control connections. Note +#: that this will apply to all kitty instances. It can be overridden +#: by the kitty --listen-on command line option. For UNIX sockets, +#: such as unix:${TEMP}/mykitty or unix:@mykitty (on Linux). +#: Environment variables are expanded and relative paths are resolved +#: with respect to the temporary directory. If {kitty_pid} is present, +#: then it is replaced by the PID of the kitty process, otherwise the +#: PID of the kitty process is appended to the value, with a hyphen. +#: For TCP sockets such as tcp:localhost:0 a random port is always +#: used even if a non-zero port number is specified. See the help for +#: kitty --listen-on for more details. Note that this will be ignored +#: unless allow_remote_control is set to either: yes, socket or +#: socket-only. Changing this option by reloading the config is not +#: supported. + +# env + +#: Specify the environment variables to be set in all child processes. +#: Using the name with an equal sign (e.g. env VAR=) will set it to +#: the empty string. Specifying only the name (e.g. env VAR) will +#: remove the variable from the child process' environment. Note that +#: environment variables are expanded recursively, for example:: + +#: env VAR1=a +#: env VAR2=${HOME}/${VAR1}/b + +#: The value of VAR2 will be /a/b. + +# watcher + +#: Path to python file which will be loaded for watchers +#: . Can be +#: specified more than once to load multiple watchers. The watchers +#: will be added to every kitty window. Relative paths are resolved +#: relative to the kitty config directory. Note that reloading the +#: config will only affect windows created after the reload. + +# exe_search_path + +#: Control where kitty finds the programs to run. The default search +#: order is: First search the system wide PATH, then ~/.local/bin and +#: ~/bin. If still not found, the PATH defined in the login shell +#: after sourcing all its startup files is tried. Finally, if present, +#: the PATH specified by the env option is tried. + +#: This option allows you to prepend, append, or remove paths from +#: this search order. It can be specified multiple times for multiple +#: paths. A simple path will be prepended to the search order. A path +#: that starts with the + sign will be append to the search order, +#: after ~/bin above. A path that starts with the - sign will be +#: removed from the entire search order. For example:: + +#: exe_search_path /some/prepended/path +#: exe_search_path +/some/appended/path +#: exe_search_path -/some/excluded/path + +# update_check_interval 24 + +#: The interval to periodically check if an update to kitty is +#: available (in hours). If an update is found, a system notification +#: is displayed informing you of the available update. The default is +#: to check every 24 hours, set to zero to disable. Update checking is +#: only done by the official binary builds. Distro packages or source +#: builds do not do update checking. Changing this option by reloading +#: the config is not supported. + +# startup_session none + +#: Path to a session file to use for all kitty instances. Can be +#: overridden by using the kitty --session =none command line option +#: for individual instances. See sessions +#: in the kitty +#: documentation for details. Note that relative paths are interpreted +#: with respect to the kitty config directory. Environment variables +#: in the path are expanded. Changing this option by reloading the +#: config is not supported. Note that if kitty is invoked with command +#: line arguments specifying a command to run, this option is ignored. + +# clipboard_control write-clipboard write-primary read-clipboard-ask read-primary-ask + +#: Allow programs running in kitty to read and write from the +#: clipboard. You can control exactly which actions are allowed. The +#: possible actions are: write-clipboard, read-clipboard, write- +#: primary, read-primary, read-clipboard-ask, read-primary-ask. The +#: default is to allow writing to the clipboard and primary selection +#: and to ask for permission when a program tries to read from the +#: clipboard. Note that disabling the read confirmation is a security +#: risk as it means that any program, even the ones running on a +#: remote server via SSH can read your clipboard. See also +#: clipboard_max_size. + +# clipboard_max_size 512 + +#: The maximum size (in MB) of data from programs running in kitty +#: that will be stored for writing to the system clipboard. A value of +#: zero means no size limit is applied. See also clipboard_control. + +# file_transfer_confirmation_bypass + +#: The password that can be supplied to the file transfer kitten +#: to skip the +#: transfer confirmation prompt. This should only be used when +#: initiating transfers from trusted computers, over trusted networks +#: or encrypted transports, as it allows any programs running on the +#: remote machine to read/write to the local filesystem, without +#: permission. + +# allow_hyperlinks yes + +#: Process hyperlink escape sequences (OSC 8). If disabled OSC 8 +#: escape sequences are ignored. Otherwise they become clickable +#: links, that you can click with the mouse or by using the hints +#: kitten . The +#: special value of ask means that kitty will ask before opening the +#: link when clicked. + +# shell_integration enabled + +#: Enable shell integration on supported shells. This enables features +#: such as jumping to previous prompts, browsing the output of the +#: previous command in a pager, etc. on supported shells. Set to +#: disabled to turn off shell integration, completely. It is also +#: possible to disable individual features, set to a space separated +#: list of these values: no-rc, no-cursor, no-title, no-cwd, no- +#: prompt-mark, no-complete, no-sudo. See Shell integration +#: for details. + +# allow_cloning ask + +#: Control whether programs running in the terminal can request new +#: windows to be created. The canonical example is clone-in-kitty +#: . +#: By default, kitty will ask for permission for each clone request. +#: Allowing cloning unconditionally gives programs running in the +#: terminal (including over SSH) permission to execute arbitrary code, +#: as the user who is running the terminal, on the computer that the +#: terminal is running on. + +# clone_source_strategies venv,conda,env_var,path + +#: Control what shell code is sourced when running clone-in-kitty in +#: the newly cloned window. The supported strategies are: + +#: venv +#: Source the file $VIRTUAL_ENV/bin/activate. This is used by the +#: Python stdlib venv module and allows cloning venvs automatically. +#: conda +#: Run conda activate $CONDA_DEFAULT_ENV. This supports the virtual +#: environments created by conda. +#: env_var +#: Execute the contents of the environment variable +#: KITTY_CLONE_SOURCE_CODE with eval. +#: path +#: Source the file pointed to by the environment variable +#: KITTY_CLONE_SOURCE_PATH. + +#: This option must be a comma separated list of the above values. +#: Only the first valid match, in the order specified, is sourced. + +# notify_on_cmd_finish never + +#: Show a desktop notification when a long-running command finishes +#: (needs shell_integration). The possible values are: + +#: never +#: Never send a notification. + +#: unfocused +#: Only send a notification when the window does not have keyboard focus. + +#: invisible +#: Only send a notification when the window both is unfocused and not visible +#: to the user, for example, because it is in an inactive tab or its OS window +#: is not currently active. + +#: always +#: Always send a notification, regardless of window state. + +#: There are two optional arguments: + +#: First, the minimum duration for what is considered a long running +#: command. The default is 5 seconds. Specify a second argument to set +#: the duration. For example: invisible 15. Do not set the value too +#: small, otherwise a command that launches a new OS Window and exits +#: will spam a notification. + +#: Second, the action to perform. The default is notify. The possible +#: values are: + +#: notify +#: Send a desktop notification. + +#: bell +#: Ring the terminal bell. + +#: command +#: Run a custom command. All subsequent arguments are the cmdline to run. + +#: Some more examples:: + +#: # Send a notification when a command takes more than 5 seconds in an unfocused window +#: notify_on_cmd_finish unfocused +#: # Send a notification when a command takes more than 10 seconds in a invisible window +#: notify_on_cmd_finish invisible 10.0 +#: # Ring a bell when a command takes more than 10 seconds in a invisible window +#: notify_on_cmd_finish invisible 10.0 bell +#: # Run 'notify-send' when a command takes more than 10 seconds in a invisible window +#: notify_on_cmd_finish invisible 10.0 command notify-send job finished + +# term xterm-kitty + +#: The value of the TERM environment variable to set. Changing this +#: can break many terminal programs, only change it if you know what +#: you are doing, not because you read some advice on "Stack Overflow" +#: to change it. The TERM variable is used by various programs to get +#: information about the capabilities and behavior of the terminal. If +#: you change it, depending on what programs you run, and how +#: different the terminal you are changing it to is, various things +#: from key-presses, to colors, to various advanced features may not +#: work. Changing this option by reloading the config will only affect +#: newly created windows. + +# terminfo_type path + +#: The value of the TERMINFO environment variable to set. This +#: variable is used by programs running in the terminal to search for +#: terminfo databases. The default value of path causes kitty to set +#: it to a filesystem location containing the kitty terminfo database. +#: A value of direct means put the entire database into the env var +#: directly. This can be useful when connecting to containers, for +#: example. But, note that not all software supports this. A value of +#: none means do not touch the variable. + +# forward_stdio no + +#: Forward STDOUT and STDERR of the kitty process to child processes +#: as file descriptors 3 and 4. This is useful for debugging as it +#: allows child processes to print to kitty's STDOUT directly. For +#: example, echo hello world >&3 in a shell will print to the parent +#: kitty's STDOUT. When enabled, this also sets the +#: KITTY_STDIO_FORWARDED=3 environment variable so child processes +#: know about the forwarding. + +# menu_map + +#: Specify entries for various menus in kitty. Currently only the +#: global menubar on macOS is supported. For example:: + +#: menu_map global "Actions::Launch something special" launch --hold --type=os-window sh -c "echo hello world" + +#: This will create a menu entry named "Launch something special" in +#: an "Actions" menu in the macOS global menubar. Sub-menus can be +#: created by adding more levels separated by the :: characters. + +#: }}} + +#: OS specific tweaks {{{ + +# wayland_titlebar_color system + +#: The color of the kitty window's titlebar on Wayland systems with +#: client side window decorations such as GNOME. A value of system +#: means to use the default system colors, a value of background means +#: to use the background color of the currently active kitty window +#: and finally you can use an arbitrary color, such as #12af59 or red. + +# macos_titlebar_color system + +#: The color of the kitty window's titlebar on macOS. A value of +#: system means to use the default system color, light or dark can +#: also be used to set it explicitly. A value of background means to +#: use the background color of the currently active window and finally +#: you can use an arbitrary color, such as #12af59 or red. WARNING: +#: This option works by using a hack when arbitrary color (or +#: background) is configured, as there is no proper Cocoa API for it. +#: It sets the background color of the entire window and makes the +#: titlebar transparent. As such it is incompatible with +#: background_opacity. If you want to use both, you are probably +#: better off just hiding the titlebar with hide_window_decorations. + +# macos_option_as_alt no + +#: Use the Option key as an Alt key on macOS. With this set to no, +#: kitty will use the macOS native Option+Key to enter Unicode +#: character behavior. This will break any Alt+Key keyboard shortcuts +#: in your terminal programs, but you can use the macOS Unicode input +#: technique. You can use the values: left, right or both to use only +#: the left, right or both Option keys as Alt, instead. Note that +#: kitty itself always treats Option the same as Alt. This means you +#: cannot use this option to configure different kitty shortcuts for +#: Option+Key vs. Alt+Key. Also, any kitty shortcuts using +#: Option/Alt+Key will take priority, so that any such key presses +#: will not be passed to terminal programs running inside kitty. +#: Changing this option by reloading the config is not supported. + +# macos_hide_from_tasks no + +#: Hide the kitty window from running tasks on macOS (⌘+Tab and the +#: Dock). Changing this option by reloading the config is not +#: supported. + +# macos_quit_when_last_window_closed no + +#: Have kitty quit when all the top-level windows are closed on macOS. +#: By default, kitty will stay running, even with no open windows, as +#: is the expected behavior on macOS. + +# macos_window_resizable yes + +#: Disable this if you want kitty top-level OS windows to not be +#: resizable on macOS. + +# macos_thicken_font 0 + +#: Draw an extra border around the font with the given width, to +#: increase legibility at small font sizes on macOS. For example, a +#: value of 0.75 will result in rendering that looks similar to sub- +#: pixel antialiasing at common font sizes. Note that in modern kitty, +#: this option is obsolete (although still supported). Consider using +#: text_composition_strategy instead. + +# macos_traditional_fullscreen no + +#: Use the macOS traditional full-screen transition, that is faster, +#: but less pretty. + +# macos_show_window_title_in all + +#: Control where the window title is displayed on macOS. A value of +#: window will show the title of the currently active window at the +#: top of the macOS window. A value of menubar will show the title of +#: the currently active window in the macOS global menu bar, making +#: use of otherwise wasted space. A value of all will show the title +#: in both places, and none hides the title. See +#: macos_menubar_title_max_length for how to control the length of the +#: title in the menu bar. + +# macos_menubar_title_max_length 0 + +#: The maximum number of characters from the window title to show in +#: the macOS global menu bar. Values less than one means that there is +#: no maximum limit. + +# macos_custom_beam_cursor no + +#: Use a custom mouse cursor for macOS that is easier to see on both +#: light and dark backgrounds. Nowadays, the default macOS cursor +#: already comes with a white border. WARNING: this might make your +#: mouse cursor invisible on dual GPU machines. Changing this option +#: by reloading the config is not supported. + +# macos_colorspace srgb + +#: The colorspace in which to interpret terminal colors. The default +#: of srgb will cause colors to match those seen in web browsers. The +#: value of default will use whatever the native colorspace of the +#: display is. The value of displayp3 will use Apple's special +#: snowflake display P3 color space, which will result in over +#: saturated (brighter) colors with some color shift. Reloading +#: configuration will change this value only for newly created OS +#: windows. + +# linux_display_server auto + +#: Choose between Wayland and X11 backends. By default, an appropriate +#: backend based on the system state is chosen automatically. Set it +#: to x11 or wayland to force the choice. Changing this option by +#: reloading the config is not supported. + +# wayland_enable_ime yes + +#: Enable Input Method Extension on Wayland. This is typically used +#: for inputting text in East Asian languages. However, its +#: implementation in Wayland is often buggy and introduces latency +#: into the input loop, so disable this if you know you dont need it. +#: Changing this option by reloading the config is not supported, it +#: will not have any effect. + +#: }}} + +#: Keyboard shortcuts {{{ + +#: Keys are identified simply by their lowercase Unicode characters. +#: For example: a for the A key, [ for the left square bracket key, +#: etc. For functional keys, such as Enter or Escape, the names are +#: present at Functional key definitions +#: . +#: For modifier keys, the names are ctrl (control, ⌃), shift (⇧), alt +#: (opt, option, ⌥), super (cmd, command, ⌘). + +#: Simple shortcut mapping is done with the map directive. For full +#: details on advanced mapping including modal and per application +#: maps, see mapping . Some +#: quick examples to illustrate common tasks:: + +#: # unmap a keyboard shortcut, passing it to the program running in kitty +#: map kitty_mod+space +#: # completely ignore a keyboard event +#: map ctrl+alt+f1 discard_event +#: # combine multiple actions +#: map kitty_mod+e combine : new_window : next_layout +#: # multi-key shortcuts +#: map ctrl+x>ctrl+y>z action + +#: The full list of actions that can be mapped to key presses is +#: available here . + +# kitty_mod ctrl+shift + +#: Special modifier key alias for default shortcuts. You can change +#: the value of this option to alter all default shortcuts that use +#: kitty_mod. + +# clear_all_shortcuts no + +#: Remove all shortcut definitions up to this point. Useful, for +#: instance, to remove the default shortcuts. + +# action_alias + +#: E.g. action_alias launch_tab launch --type=tab --cwd=current + +#: Define action aliases to avoid repeating the same options in +#: multiple mappings. Aliases can be defined for any action and will +#: be expanded recursively. For example, the above alias allows you to +#: create mappings to launch a new tab in the current working +#: directory without duplication:: + +#: map f1 launch_tab vim +#: map f2 launch_tab emacs + +#: Similarly, to alias kitten invocation:: + +#: action_alias hints kitten hints --hints-offset=0 + +# kitten_alias + +#: E.g. kitten_alias hints hints --hints-offset=0 + +#: Like action_alias above, but specifically for kittens. Generally, +#: prefer to use action_alias. This option is a legacy version, +#: present for backwards compatibility. It causes all invocations of +#: the aliased kitten to be substituted. So the example above will +#: cause all invocations of the hints kitten to have the --hints- +#: offset=0 option applied. + +#: Clipboard {{{ + +#: Copy to clipboard + +# map kitty_mod+c copy_to_clipboard +# map cmd+c copy_to_clipboard + +#:: There is also a copy_or_interrupt action that can be optionally +#:: mapped to Ctrl+C. It will copy only if there is a selection and +#:: send an interrupt otherwise. Similarly, +#:: copy_and_clear_or_interrupt will copy and clear the selection or +#:: send an interrupt if there is no selection. + +#: Paste from clipboard + +# map kitty_mod+v paste_from_clipboard +# map cmd+v paste_from_clipboard + +#: Paste from selection + +# map kitty_mod+s paste_from_selection +# map shift+insert paste_from_selection + +#: Pass selection to program + +# map kitty_mod+o pass_selection_to_program + +#:: You can also pass the contents of the current selection to any +#:: program with pass_selection_to_program. By default, the system's +#:: open program is used, but you can specify your own, the selection +#:: will be passed as a command line argument to the program. For +#:: example:: + +#:: map kitty_mod+o pass_selection_to_program firefox + +#:: You can pass the current selection to a terminal program running +#:: in a new kitty window, by using the @selection placeholder:: + +#:: map kitty_mod+y new_window less @selection + +#: }}} + +#: Scrolling {{{ + +#: Scroll line up + +# map kitty_mod+up scroll_line_up +# map kitty_mod+k scroll_line_up +# map opt+cmd+page_up scroll_line_up +# map cmd+up scroll_line_up + +#: Scroll line down + +# map kitty_mod+down scroll_line_down +# map kitty_mod+j scroll_line_down +# map opt+cmd+page_down scroll_line_down +# map cmd+down scroll_line_down + +#: Scroll page up + +# map kitty_mod+page_up scroll_page_up +# map cmd+page_up scroll_page_up + +#: Scroll page down + +# map kitty_mod+page_down scroll_page_down +# map cmd+page_down scroll_page_down + +#: Scroll to top + +# map kitty_mod+home scroll_home +# map cmd+home scroll_home + +#: Scroll to bottom + +# map kitty_mod+end scroll_end +# map cmd+end scroll_end + +#: Scroll to previous shell prompt + +# map kitty_mod+z scroll_to_prompt -1 + +#:: Use a parameter of 0 for scroll_to_prompt to scroll to the last +#:: jumped to or the last clicked position. Requires shell +#:: integration +#:: to work. + +#: Scroll to next shell prompt + +# map kitty_mod+x scroll_to_prompt 1 + +#: Browse scrollback buffer in pager + +# map kitty_mod+h show_scrollback + +#:: You can pipe the contents of the current screen and history +#:: buffer as STDIN to an arbitrary program using launch --stdin- +#:: source. For example, the following opens the scrollback buffer in +#:: less in an overlay window:: + +#:: map f1 launch --stdin-source=@screen_scrollback --stdin-add-formatting --type=overlay less +G -R + +#:: For more details on piping screen and buffer contents to external +#:: programs, see launch . + +#: Browse output of the last shell command in pager + +# map kitty_mod+g show_last_command_output + +#:: You can also define additional shortcuts to get the command +#:: output. For example, to get the first command output on screen:: + +#:: map f1 show_first_command_output_on_screen + +#:: To get the command output that was last accessed by a keyboard +#:: action or mouse action:: + +#:: map f1 show_last_visited_command_output + +#:: You can pipe the output of the last command run in the shell +#:: using the launch action. For example, the following opens the +#:: output in less in an overlay window:: + +#:: map f1 launch --stdin-source=@last_cmd_output --stdin-add-formatting --type=overlay less +G -R + +#:: To get the output of the first command on the screen, use +#:: @first_cmd_output_on_screen. To get the output of the last jumped +#:: to command, use @last_visited_cmd_output. + +#:: Requires shell integration +#:: to work. + +#: }}} + +#: Window management {{{ + +#: New window + +# map kitty_mod+enter new_window +# map cmd+enter new_window + +#:: You can open a new kitty window running an arbitrary program, for +#:: example:: + +#:: map kitty_mod+y launch mutt + +#:: You can open a new window with the current working directory set +#:: to the working directory of the current window using:: + +#:: map ctrl+alt+enter launch --cwd=current + +#:: You can open a new window that is allowed to control kitty via +#:: the kitty remote control facility with launch --allow-remote- +#:: control. Any programs running in that window will be allowed to +#:: control kitty. For example:: + +#:: map ctrl+enter launch --allow-remote-control some_program + +#:: You can open a new window next to the currently active window or +#:: as the first window, with:: + +#:: map ctrl+n launch --location=neighbor +#:: map ctrl+f launch --location=first + +#:: For more details, see launch +#:: . + +#: New OS window + +# map kitty_mod+n new_os_window +# map cmd+n new_os_window + +#:: Works like new_window above, except that it opens a top-level OS +#:: window. In particular you can use new_os_window_with_cwd to open +#:: a window with the current working directory. + +#: Close window + +# map kitty_mod+w close_window +# map shift+cmd+d close_window + +#: Next window + +# map kitty_mod+] next_window + +#: Previous window + +# map kitty_mod+[ previous_window + +#: Move window forward + +# map kitty_mod+f move_window_forward + +#: Move window backward + +# map kitty_mod+b move_window_backward + +#: Move window to top + +# map kitty_mod+` move_window_to_top + +#: Start resizing window + +# map kitty_mod+r start_resizing_window +# map cmd+r start_resizing_window + +#: First window + +# map kitty_mod+1 first_window +# map cmd+1 first_window + +#: Second window + +# map kitty_mod+2 second_window +# map cmd+2 second_window + +#: Third window + +# map kitty_mod+3 third_window +# map cmd+3 third_window + +#: Fourth window + +# map kitty_mod+4 fourth_window +# map cmd+4 fourth_window + +#: Fifth window + +# map kitty_mod+5 fifth_window +# map cmd+5 fifth_window + +#: Sixth window + +# map kitty_mod+6 sixth_window +# map cmd+6 sixth_window + +#: Seventh window + +# map kitty_mod+7 seventh_window +# map cmd+7 seventh_window + +#: Eighth window + +# map kitty_mod+8 eighth_window +# map cmd+8 eighth_window + +#: Ninth window + +# map kitty_mod+9 ninth_window +# map cmd+9 ninth_window + +#: Tenth window + +# map kitty_mod+0 tenth_window + +#: Visually select and focus window + +# map kitty_mod+f7 focus_visible_window + +#:: Display overlay numbers and alphabets on the window, and switch +#:: the focus to the window when you press the key. When there are +#:: only two windows, the focus will be switched directly without +#:: displaying the overlay. You can change the overlay characters and +#:: their order with option visual_window_select_characters. + +#: Visually swap window with another + +# map kitty_mod+f8 swap_with_window + +#:: Works like focus_visible_window above, but swaps the window. + +#: }}} + +#: Tab management {{{ + +#: Next tab + +# map kitty_mod+right next_tab +# map shift+cmd+] next_tab +# map ctrl+tab next_tab + +#: Previous tab + +# map kitty_mod+left previous_tab +# map shift+cmd+[ previous_tab +# map ctrl+shift+tab previous_tab + +#: New tab + +# map kitty_mod+t new_tab +# map cmd+t new_tab + +#: Close tab + +# map kitty_mod+q close_tab +# map cmd+w close_tab + +#: Close OS window + +# map shift+cmd+w close_os_window + +#: Move tab forward + +# map kitty_mod+. move_tab_forward + +#: Move tab backward + +# map kitty_mod+, move_tab_backward + +#: Set tab title + +# map kitty_mod+alt+t set_tab_title +# map shift+cmd+i set_tab_title + + +#: You can also create shortcuts to go to specific tabs, with 1 being +#: the first tab, 2 the second tab and -1 being the previously active +#: tab, and any number larger than the last tab being the last tab:: + +#: map ctrl+alt+1 goto_tab 1 +#: map ctrl+alt+2 goto_tab 2 + +#: Just as with new_window above, you can also pass the name of +#: arbitrary commands to run when using new_tab and new_tab_with_cwd. +#: Finally, if you want the new tab to open next to the current tab +#: rather than at the end of the tabs list, use:: + +#: map ctrl+t new_tab !neighbor [optional cmd to run] +#: }}} + +#: Layout management {{{ + +#: Next layout + +# map kitty_mod+l next_layout + + +#: You can also create shortcuts to switch to specific layouts:: + +#: map ctrl+alt+t goto_layout tall +#: map ctrl+alt+s goto_layout stack + +#: Similarly, to switch back to the previous layout:: + +#: map ctrl+alt+p last_used_layout + +#: There is also a toggle_layout action that switches to the named +#: layout or back to the previous layout if in the named layout. +#: Useful to temporarily "zoom" the active window by switching to the +#: stack layout:: + +#: map ctrl+alt+z toggle_layout stack +#: }}} + +#: Font sizes {{{ + +#: You can change the font size for all top-level kitty OS windows at +#: a time or only the current one. + +#: Increase font size + +# map kitty_mod+equal change_font_size all +2.0 +# map kitty_mod+plus change_font_size all +2.0 +# map kitty_mod+kp_add change_font_size all +2.0 +# map cmd+plus change_font_size all +2.0 +# map cmd+equal change_font_size all +2.0 +# map shift+cmd+equal change_font_size all +2.0 + +#: Decrease font size + +# map kitty_mod+minus change_font_size all -2.0 +# map kitty_mod+kp_subtract change_font_size all -2.0 +# map cmd+minus change_font_size all -2.0 +# map shift+cmd+minus change_font_size all -2.0 + +#: Reset font size + +# map kitty_mod+backspace change_font_size all 0 +# map cmd+0 change_font_size all 0 + + +#: To setup shortcuts for specific font sizes:: + +#: map kitty_mod+f6 change_font_size all 10.0 + +#: To setup shortcuts to change only the current OS window's font +#: size:: + +#: map kitty_mod+f6 change_font_size current 10.0 +#: }}} + +#: Select and act on visible text {{{ + +#: Use the hints kitten to select text and either pass it to an +#: external program or insert it into the terminal or copy it to the +#: clipboard. + +#: Open URL + +# map kitty_mod+e open_url_with_hints + +#:: Open a currently visible URL using the keyboard. The program used +#:: to open the URL is specified in open_url_with. + +#: Insert selected path + +# map kitty_mod+p>f kitten hints --type path --program - + +#:: Select a path/filename and insert it into the terminal. Useful, +#:: for instance to run git commands on a filename output from a +#:: previous git command. + +#: Open selected path + +# map kitty_mod+p>shift+f kitten hints --type path + +#:: Select a path/filename and open it with the default open program. + +#: Insert selected line + +# map kitty_mod+p>l kitten hints --type line --program - + +#:: Select a line of text and insert it into the terminal. Useful for +#:: the output of things like: `ls -1`. + +#: Insert selected word + +# map kitty_mod+p>w kitten hints --type word --program - + +#:: Select words and insert into terminal. + +#: Insert selected hash + +# map kitty_mod+p>h kitten hints --type hash --program - + +#:: Select something that looks like a hash and insert it into the +#:: terminal. Useful with git, which uses SHA1 hashes to identify +#:: commits. + +#: Open the selected file at the selected line + +# map kitty_mod+p>n kitten hints --type linenum + +#:: Select something that looks like filename:linenum and open it in +#:: your default editor at the specified line number. + +#: Open the selected hyperlink + +# map kitty_mod+p>y kitten hints --type hyperlink + +#:: Select a hyperlink (i.e. a URL that has been marked as such by +#:: the terminal program, for example, by `ls --hyperlink=auto`). + + +#: The hints kitten has many more modes of operation that you can map +#: to different shortcuts. For a full description see hints kitten +#: . +#: }}} + +#: Miscellaneous {{{ + +#: Show documentation + +# map kitty_mod+f1 show_kitty_doc overview + +#: Toggle fullscreen + +# map kitty_mod+f11 toggle_fullscreen +# map ctrl+cmd+f toggle_fullscreen + +#: Toggle maximized + +# map kitty_mod+f10 toggle_maximized + +#: Toggle macOS secure keyboard entry + +# map opt+cmd+s toggle_macos_secure_keyboard_entry + +#: Unicode input + +# map kitty_mod+u kitten unicode_input +# map ctrl+cmd+space kitten unicode_input + +#: Edit config file + +# map kitty_mod+f2 edit_config_file +# map cmd+, edit_config_file + +#: Open the kitty command shell + +# map kitty_mod+escape kitty_shell window + +#:: Open the kitty shell in a new window / tab / overlay / os_window +#:: to control kitty using commands. + +#: Increase background opacity + +# map kitty_mod+a>m set_background_opacity +0.1 + +#: Decrease background opacity + +# map kitty_mod+a>l set_background_opacity -0.1 + +#: Make background fully opaque + +# map kitty_mod+a>1 set_background_opacity 1 + +#: Reset background opacity + +# map kitty_mod+a>d set_background_opacity default + +#: Reset the terminal + +# map kitty_mod+delete clear_terminal reset active +# map opt+cmd+r clear_terminal reset active + +#:: You can create shortcuts to clear/reset the terminal. For +#:: example:: + +#:: # Reset the terminal +#:: map f1 clear_terminal reset active +#:: # Clear the terminal screen by erasing all contents +#:: map f1 clear_terminal clear active +#:: # Clear the terminal scrollback by erasing it +#:: map f1 clear_terminal scrollback active +#:: # Scroll the contents of the screen into the scrollback +#:: map f1 clear_terminal scroll active +#:: # Clear everything up to the line with the cursor or the start of the current prompt (needs shell integration) +#:: map f1 clear_terminal to_cursor active +#:: # Same as above except cleared lines are moved into scrollback +#:: map f1 clear_terminal to_cursor_scroll active + +#:: If you want to operate on all kitty windows instead of just the +#:: current one, use all instead of active. + +#:: Some useful functions that can be defined in the shell rc files +#:: to perform various kinds of clearing of the current window: + +#:: .. code-block:: sh + +#:: clear-only-screen() { +#:: printf "\e[H\e[2J" +#:: } + +#:: clear-screen-and-scrollback() { +#:: printf "\e[H\e[3J" +#:: } + +#:: clear-screen-saving-contents-in-scrollback() { +#:: printf "\e[H\e[22J" +#:: } + +#:: For instance, using these escape codes, it is possible to remap +#:: Ctrl+L to both scroll the current screen contents into the +#:: scrollback buffer and clear the screen, instead of just clearing +#:: the screen. For ZSH, in ~/.zshrc, add: + +#:: .. code-block:: zsh + +#:: ctrl_l() { +#:: builtin print -rn -- $'\r\e[0J\e[H\e[22J' >"$TTY" +#:: builtin zle .reset-prompt +#:: builtin zle -R +#:: } +#:: zle -N ctrl_l +#:: bindkey '^l' ctrl_l + +#:: Alternatively, you can just add map ctrl+l clear_terminal +#:: to_cursor_scroll active to kitty.conf which works with no changes +#:: to the shell rc files, but only clears up to the prompt, it does +#:: not clear anytext at the prompt itself. + +#: Clear up to cursor line + +# map cmd+k clear_terminal to_cursor active + +#: Reload kitty.conf + +# map kitty_mod+f5 load_config_file +# map ctrl+cmd+, load_config_file + +#:: Reload kitty.conf, applying any changes since the last time it +#:: was loaded. Note that a handful of options cannot be dynamically +#:: changed and require a full restart of kitty. Particularly, when +#:: changing shortcuts for actions located on the macOS global menu +#:: bar, a full restart is needed. You can also map a keybinding to +#:: load a different config file, for example:: + +#:: map f5 load_config /path/to/alternative/kitty.conf + +#:: Note that all options from the original kitty.conf are discarded, +#:: in other words the new configuration *replace* the old ones. + +#: Debug kitty configuration + +# map kitty_mod+f6 debug_config +# map opt+cmd+, debug_config + +#:: Show details about exactly what configuration kitty is running +#:: with and its host environment. Useful for debugging issues. + +#: Send arbitrary text on key presses + +#:: E.g. map ctrl+shift+alt+h send_text all Hello World + +#:: You can tell kitty to send arbitrary (UTF-8) encoded text to the +#:: client program when pressing specified shortcut keys. For +#:: example:: + +#:: map ctrl+alt+a send_text all Special text + +#:: This will send "Special text" when you press the Ctrl+Alt+A key +#:: combination. The text to be sent decodes ANSI C escapes +#:: so you can use escapes like \e to send control +#:: codes or \u21fb to send Unicode characters (or you can just input +#:: the Unicode characters directly as UTF-8 text). You can use +#:: `kitten show_key` to get the key escape codes you want to +#:: emulate. + +#:: The first argument to send_text is the keyboard modes in which to +#:: activate the shortcut. The possible values are normal, +#:: application, kitty or a comma separated combination of them. The +#:: modes normal and application refer to the DECCKM cursor key mode +#:: for terminals, and kitty refers to the kitty extended keyboard +#:: protocol. The special value all means all of them. + +#:: Some more examples:: + +#:: # Output a word and move the cursor to the start of the line (like typing and pressing Home) +#:: map ctrl+alt+a send_text normal Word\e[H +#:: map ctrl+alt+a send_text application Word\eOH +#:: # Run a command at a shell prompt (like typing the command and pressing Enter) +#:: map ctrl+alt+a send_text normal,application some command with arguments\r + +#: Open kitty Website + +# map shift+cmd+/ open_url https://sw.kovidgoyal.net/kitty/ + +#: Hide macOS kitty application + +# map cmd+h hide_macos_app + +#: Hide macOS other applications + +# map opt+cmd+h hide_macos_other_apps + +#: Minimize macOS window + +# map cmd+m minimize_macos_window + +#: Quit kitty + +# map cmd+q quit + +#: }}} + +#: }}} diff --git a/.config/kitty/kitty.conf b/.config/kitty/kitty.conf new file mode 100644 index 0000000..d143822 --- /dev/null +++ b/.config/kitty/kitty.conf @@ -0,0 +1,19 @@ +# vim:fileencoding=utf-8:foldmethod=marker + +include ./Solarized_Light.conf +macos_hide_titlebar true +hide_window_decorations titlebar-only +confirm_os_window_close 0 + +font_family SauceCodePro NF +bold_font auto +italic_font auto +bold_italic_font auto + +font_size 23.0 +# -> foo bar >= ==> === == /> + +window_padding_width 10 + +tab_bar_edge top +tab_bar_style fade diff --git a/.config/nvim/.gitignore b/.config/nvim/.gitignore new file mode 100644 index 0000000..cc5457a --- /dev/null +++ b/.config/nvim/.gitignore @@ -0,0 +1,8 @@ +tt.* +.tests +doc/tags +debug +.repro +foo.* +*.log +data diff --git a/.config/nvim/.luarc.json b/.config/nvim/.luarc.json new file mode 100644 index 0000000..1e1765c --- /dev/null +++ b/.config/nvim/.luarc.json @@ -0,0 +1,5 @@ +{ + "diagnostics.globals": [ + "vim" + ] +} \ No newline at end of file diff --git a/.config/nvim/.neoconf.json b/.config/nvim/.neoconf.json new file mode 100644 index 0000000..7c48087 --- /dev/null +++ b/.config/nvim/.neoconf.json @@ -0,0 +1,15 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + } +} diff --git a/.config/nvim/.prettierrc b/.config/nvim/.prettierrc new file mode 100644 index 0000000..8973894 --- /dev/null +++ b/.config/nvim/.prettierrc @@ -0,0 +1,4 @@ +{ + "useTabs": false, + "tabWidth": 2 +} diff --git a/.config/nvim/.tool-versions b/.config/nvim/.tool-versions new file mode 100644 index 0000000..07557c4 --- /dev/null +++ b/.config/nvim/.tool-versions @@ -0,0 +1,2 @@ +ruby 3.4.1 +nodejs 20.11.0 diff --git a/.config/nvim/README.md b/.config/nvim/README.md index 10c9b62..cf0bfe9 100644 --- a/.config/nvim/README.md +++ b/.config/nvim/README.md @@ -1,4 +1,74 @@ -# Dotfiles +# Nvim Config -You are currently on the main branch which doesn't contain any of my dotfiles in order not to affect my GitHub contributions counter. -If you want to visit my real dotfiles, just visit this branch: [dotfiles](https://github.com/CuddlyBunion341/dotfiles/tree/main) +This is my own nvim config. It is strongly opinionated and tailored to my own needs. + +## Philosophy + +This configuration is a no-nonsense, bare-knuckle beast that prioritizes raw performance and simplicity above all else. It doesn't have time for fancy status lines like `lualine` or bloated file explorers like `Neotree`. No sir, there are no animations or other frivolous distractions that could bog down the editor. + +Yes, there are plugins like `gitsigns` that might add a bit of overhead, but nothing that would significantly impact performance. And there's absolutely no room for fancy markdown rendering or over-engineered find and replace tools. It's all about keeping it simple and efficient. + +Additionally, the key mappings are kept short and simple. Instead of convoluted mappings like `cff`, the aim is to limit mappings to one or two keys. This is part of the commitment to efficiency and speed. + +The goal here is pure, unadulterated SPEED. Every plugin and setting has been chosen and tweaked with this in mind. If it doesn't make the editing experience faster and more efficient, it doesn't make the cut. + +## Overview + +I have been using Neovim as my primary editor for a while now and I have been customizing it to my own needs, adding and removing plugins, and tweaking settings to make it more efficient and productive. +The entry point for the configuration is `init.lua`, which loads the rest of the configuration. The configuration is split into some files under the `lua` directory. Lazy plugins can also be found there. + +### Repository Files + +Here are some of the key files in the repository: + +- `./lua/util.lua`: Contains utility functions used across the configuration. +- `./lua/theme.lua`: Contains theme settings and customizations. +- `./lua/settings.lua`: Contains general settings for Neovim. + +### Plugins + +I am using the lazyvim plugin manager to manage plugins. +[Lazyvim](https://github.com/folke/lazy.nvim) is a plugin manager that loads plugins lazily, only when they are needed. + + +#### File Exploring +- **bufexplorer**: Buffer explorer / picker. +- **Oil**: A text buffer based file explorer. + +#### Autocompletion +- **nvim-cmp**: Autocompletion framework. +- **LuaSnip**: Snippet engine. +- **cmp-buffer**: Buffer source for nvim-cmp. +- **cmp-cmdline**: Cmdline source for nvim-cmp. +- **cmp-nvim-lsp**: LSP source for nvim-cmp. +- **cmp-path**: Filepath source for nvim-cmp. +- **cmp_luasnip**: LuaSnip source for nvim-cmp. +- **friendly-snippets**: Preconfigured snippets for nvim-cmp. + +#### Navigation +- **vim-tmux-navigator**: Seamless navigation between tmux panes and vim splits. +- **vim-visual-multi**: Multiple cursors plugin. +- **nvim-surround**: Surroundings operations (add, change, delete). +- **nvim-treesitter-textobjects**: Advanced textobjects based on treesitter. +- **nvim-treesitter-endwise**: Endwise motion based on treesitter. + +#### FZF (Fuzzy Finder) +- **telescope.nvim**: Highly extendable fuzzy finder over lists. + +#### Git +- **gitsigns.nvim**: Git signs (add, change, delete) in the sign column. +- **lazygit.nvim**: Terminal UI for git commands. +- **diffview.nvim**: Side-by-side diff viewer for git in Neovim. + +#### Other +- **copilot.vim**: AI pair programming assistant. +- **neotest-rspec**: RSpec test runner. +- **nvim-lspconfig**: Quickstart configurations for the Nvim LSP client. +- **nvim-treesitter**: Parser generator tool and an incremental parsing library. +- **nvim-spectre**: Search and replace tool. +- **auto-session**: Automatic session save and restore. +- **autoclose.nvim**: Auto close pairs of brackets and quotes. +- **markdown.nvim**: Markdown support. +- **plantuml-previewer.vim**: PlantUML previewer. +- **solarized.nvim**: Solarized color scheme. +- **tokyodark.nvim**: Tokyo Night color scheme. diff --git a/.config/nvim/bin/check b/.config/nvim/bin/check new file mode 100755 index 0000000..206b4c0 --- /dev/null +++ b/.config/nvim/bin/check @@ -0,0 +1,4 @@ +#!/bin/bash + +stylua --check . +nvim --headless -c "checkhealth" -c "qa" diff --git a/.config/nvim/bin/lint b/.config/nvim/bin/lint new file mode 100755 index 0000000..4f5d306 --- /dev/null +++ b/.config/nvim/bin/lint @@ -0,0 +1,3 @@ +#!/bin/bash + +stylua . diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..4943379 --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,26 @@ +require("settings") +require("util") + +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", + lazypath, + }) +end + +vim.opt.rtp:prepend(lazypath) + +local plugins = { + { import = "plugins" }, +} + +local opts = { defaults = { lazy = true }, change_detection = { notify = false } } + +require("theme-flag") +require("lazy").setup(plugins, opts) +require("theme") diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..5dc977c --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,80 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "CopilotChat.nvim": { "branch": "canary", "commit": "451d365928a994cda3505a84905303f790e28df8" }, + "LuaSnip": { "branch": "master", "commit": "21f74f7ba8c49f95f9d7c8293b147c2901dd2d3a" }, + "auto-session": { "branch": "main", "commit": "5a269bb5bec50b8b60564aa00f6454d9e82fbe8d" }, + "boole.nvim": { "branch": "main", "commit": "7b4a3dae28e3b2497747aa840439e9493cabdc49" }, + "bufexplorer": { "branch": "master", "commit": "b96d275811b92e86ee52be3112e1de735ba08fb9" }, + "cellular-automaton.nvim": { "branch": "main", "commit": "1606e9d5d04ff254023c3f3c62842d065708d6d3" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" }, + "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, + "cmp-treesitter": { "branch": "master", "commit": "958fcfa0d8ce46d215e19cc3992c542f576c4123" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "copilot.lua": { "branch": "master", "commit": "8aebaa3a102125fedf08c98773a0a8def92fff37" }, + "csvview.nvim": { "branch": "main", "commit": "bbab4c2f808fd8e11ec8dfdd128251aadba566a1" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "endpoint.nvim": { "branch": "master", "commit": "33108d5f96690b585bfcc1e3a6093d689835a74b" }, + "flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "fzf-lua": { "branch": "main", "commit": "d39620ba79d3685bae28e76b9a9a8dbc1cf2cd34" }, + "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" }, + "gitsigns.nvim": { "branch": "main", "commit": "f780609807eca1f783a36a8a31c30a48fbe150c5" }, + "gradle.nvim": { "branch": "main", "commit": "81c39ac1b1782061421bdc9295a4213894495a6d" }, + "grug-far.nvim": { "branch": "main", "commit": "176ba4c42924f4d84ee7d19c9f0081c538f84a88" }, + "gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" }, + "harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" }, + "jsonpath.nvim": { "branch": "main", "commit": "0ea5bd5441189a0496630a14e7433bdc1b943cf2" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lsp-zero.nvim": { "branch": "v4.x", "commit": "d388e2b71834c826e61a3eba48caec53d7602510" }, + "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, + "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "7f9a39fcd2ac6e979001f857727d606888f5909c" }, + "mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" }, + "maximize.nvim": { "branch": "master", "commit": "d688b66344b03ee6e5a32a0a40af85d174490af8" }, + "mini.cursorword": { "branch": "main", "commit": "84c82f8040a75445f1f39a0d36f4d0d0fe0bee92" }, + "mini.icons": { "branch": "main", "commit": "f9a177c11daa7829389b7b6eaaec8b8a5c47052d" }, + "neogit": { "branch": "master", "commit": "df08cb97f126c546a5ec265bafab2d78cc7399fa" }, + "neotest": { "branch": "master", "commit": "2cf3544fb55cdd428a9a1b7154aea9c9823426e8" }, + "neotest-java": { "branch": "main", "commit": "0f31785a9cffa98c71eaeb80bf9f55d0d80fcb4d" }, + "neotest-minitest": { "branch": "main", "commit": "4d1c19f80be0efff7656dea76a589c02bf418b68" }, + "neotest-mocha": { "branch": "main", "commit": "342664d54d2177cd0b21742ddf8c447ff278df46" }, + "neotest-rspec": { "branch": "main", "commit": "e7dc67c1167a9e593c804a6be6808ba9a5920d43" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-asciidoc-preview": { "branch": "main", "commit": "b2bd92c9f39c2203c0a91085705aeac5fb7d2903" }, + "nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" }, + "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, + "nvim-jdtls": { "branch": "master", "commit": "c23f200fee469a415c77265ca55b496feb646992" }, + "nvim-lspconfig": { "branch": "master", "commit": "d9879110d0422a566fa01d732556f4d5515e1738" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-surround": { "branch": "main", "commit": "a868c256c861044beb9794b4dd126480dcdfbdad" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-treesitter-endwise": { "branch": "master", "commit": "a61a9de7965324d4019fb1637b66bfacdcb01f51" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "71385f191ec06ffc60e80e6b0c9a9d5daed4824c" }, + "nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" }, + "nvim-web-devicons": { "branch": "master", "commit": "6e51ca170563330e063720449c21f43e27ca0bc1" }, + "oil.nvim": { "branch": "feat/scratch-preview", "commit": "15a17fdff4866394bdf1f7bf081b818ec3de44f5" }, + "open-browser.vim": { "branch": "master", "commit": "7d4c1d8198e889d513a030b5a83faa07606bac27" }, + "plantuml-previewer.vim": { "branch": "master", "commit": "368a1f331c1ff29f6a3ee76facfca39a7f374b13" }, + "plantuml-syntax": { "branch": "master", "commit": "9d4900aa16674bf5bb8296a72b975317d573b547" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "refactoring.nvim": { "branch": "master", "commit": "74b608dfee827c2372250519d433cc21cb083407" }, + "snacks.nvim": { "branch": "main", "commit": "da230e3ca8146da4b73752daaf0a1d07d343c12d" }, + "solarized.nvim": { "branch": "main", "commit": "c0dfe1cbfabd93b546baf5f1408f5df7e02e2050" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "text-case.nvim": { "branch": "main", "commit": "e898cfd46fa6cde0e83abb624a16e67d2ffc6457" }, + "tokyonight-vim": { "branch": "master", "commit": "4e82e0f0452a6ce8f387828ec71013015515035a" }, + "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, + "undotree": { "branch": "main", "commit": "68fb733769fed365cca72d7c97c5cc2fd3d31055" }, + "vim-case-convert": { "branch": "master", "commit": "0a75eb4cf77976c1cdecaa6155c752b1f0c693d8" }, + "vim-fetch": { "branch": "master", "commit": "db3fd95eb0cf7e7e9effa1338b286db33e4a36c1" }, + "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }, + "vim-polar": { "branch": "master", "commit": "dc7723d0a8ee8b00a3d15ef19c6720403654c23b" }, + "vim-rails": { "branch": "master", "commit": "b0a5c76f86ea214ade36ab0b811e730c3f0add67" }, + "vim-tmux-navigator": { "branch": "master", "commit": "c45243dc1f32ac6bcf6068e5300f3b2b237e576a" }, + "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }, + "yaml.nvim": { "branch": "main", "commit": "c6c7bac834c3f48e1afdb78a7a1d23996a2f89d9" } +} diff --git a/.config/nvim/lua/.gitignore b/.config/nvim/lua/.gitignore new file mode 100644 index 0000000..d4b4a91 --- /dev/null +++ b/.config/nvim/lua/.gitignore @@ -0,0 +1,2 @@ +# ignore theme because it changes frequently and is managed via change_theme scirpt +theme-flag.lua diff --git a/.config/nvim/lua/plugins/autopairs.lua b/.config/nvim/lua/plugins/autopairs.lua new file mode 100644 index 0000000..b83282d --- /dev/null +++ b/.config/nvim/lua/plugins/autopairs.lua @@ -0,0 +1,5 @@ +return { + "windwp/nvim-autopairs", + event = "InsertEnter", + config = true, +} diff --git a/.config/nvim/lua/plugins/autosession.lua b/.config/nvim/lua/plugins/autosession.lua new file mode 100644 index 0000000..a7dc9b6 --- /dev/null +++ b/.config/nvim/lua/plugins/autosession.lua @@ -0,0 +1,11 @@ +return { + "rmagatti/auto-session", + lazy = false, + dependencies = { + "nvim-telescope/telescope.nvim", + }, + opts = {}, + keys = { + { "", "SessionDelete", desc = "Delete session" }, + }, +} diff --git a/.config/nvim/lua/plugins/boole.lua b/.config/nvim/lua/plugins/boole.lua new file mode 100644 index 0000000..919e18e --- /dev/null +++ b/.config/nvim/lua/plugins/boole.lua @@ -0,0 +1,21 @@ +return { + "nat-418/boole.nvim", + event = { "BufReadPre", "BufNewFile" }, + config = function() + require("boole").setup({ + mappings = { + increment = "", + decrement = "", + }, + additions = { + { "Foo", "Bar", "Baz", "Qux", "Quux" }, + { "light", "dark" }, + { "if", "unless" }, + { "true", "false" }, + { "&&", "||" }, + { "private", "public", "protected" }, + { "const", "let" }, + }, + }) + end, +} diff --git a/.config/nvim/lua/plugins/bufexplorer.lua b/.config/nvim/lua/plugins/bufexplorer.lua new file mode 100644 index 0000000..fe14cfa --- /dev/null +++ b/.config/nvim/lua/plugins/bufexplorer.lua @@ -0,0 +1,4 @@ +return { + "jlanzarotta/bufexplorer", + lazy = false, +} diff --git a/.config/nvim/lua/plugins/cellular_automaton.lua b/.config/nvim/lua/plugins/cellular_automaton.lua new file mode 100644 index 0000000..cf86bc2 --- /dev/null +++ b/.config/nvim/lua/plugins/cellular_automaton.lua @@ -0,0 +1,4 @@ +return { + "Eandrju/cellular-automaton.nvim", + lazy = false, +} diff --git a/.config/nvim/lua/plugins/codecompanion.lua b/.config/nvim/lua/plugins/codecompanion.lua new file mode 100644 index 0000000..2c99bc8 --- /dev/null +++ b/.config/nvim/lua/plugins/codecompanion.lua @@ -0,0 +1,9 @@ +return { + -- "olimorris/codecompanion.nvim", + -- lazy = false, + -- opts = {}, + -- dependencies = { + -- "nvim-lua/plenary.nvim", + -- "nvim-treesitter/nvim-treesitter", + -- }, +} diff --git a/.config/nvim/lua/plugins/codeium.lua b/.config/nvim/lua/plugins/codeium.lua new file mode 100644 index 0000000..4b37ae5 --- /dev/null +++ b/.config/nvim/lua/plugins/codeium.lua @@ -0,0 +1,3 @@ +return {} +-- return { "Exafunction/codeium.vim", lazy = false } +-- sall :Codeium Auth after installation to get Token ID diff --git a/.config/nvim/lua/plugins/colorscheme.lua b/.config/nvim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..677dfeb --- /dev/null +++ b/.config/nvim/lua/plugins/colorscheme.lua @@ -0,0 +1,20 @@ +return { + { + "ghifarit53/tokyonight-vim", + lazy = false, + priority = 1000, + }, + { + "maxmx03/solarized.nvim", + lazy = false, + priority = 1000, + }, + { + "habamax/vim-polar", + lazy = false, + priority = 1000, + }, + { "ellisonleao/gruvbox.nvim", priority = 1000, config = { + transparent_mode = true, + } }, +} diff --git a/.config/nvim/lua/plugins/comment.lua b/.config/nvim/lua/plugins/comment.lua new file mode 100644 index 0000000..2254763 --- /dev/null +++ b/.config/nvim/lua/plugins/comment.lua @@ -0,0 +1,7 @@ +return { + "numToStr/Comment.nvim", + opts = {}, + keys = { + { "gcc", "CommentToggle", desc = "Comment" }, + }, +} diff --git a/.config/nvim/lua/plugins/copilot.lua b/.config/nvim/lua/plugins/copilot.lua new file mode 100644 index 0000000..14e55eb --- /dev/null +++ b/.config/nvim/lua/plugins/copilot.lua @@ -0,0 +1,7 @@ +return { + -- "github/copilot.vim", + -- event = "BufRead", + -- commands = { + -- "Copilot" + -- } +} diff --git a/.config/nvim/lua/plugins/copilotchat.lua b/.config/nvim/lua/plugins/copilotchat.lua new file mode 100644 index 0000000..1d42900 --- /dev/null +++ b/.config/nvim/lua/plugins/copilotchat.lua @@ -0,0 +1,98 @@ +return {} +-- return { +-- "CopilotC-Nvim/CopilotChat.nvim", +-- dependencies = { +-- { "zbirenbaum/copilot.lua" }, +-- { "nvim-lua/plenary.nvim" }, +-- }, +-- commands = { +-- "CopilotChat", +-- "CopilotChatOpen", +-- "CopilotChatClose", +-- "CopilotChatToggle", +-- "CopilotChatStop", +-- "CopilotChatReset", +-- "CopilotChatSave", +-- "CopilotChatLoad", +-- "CopilotChatDebugInfo", +-- "CopilotChatModels", +-- "CopilotChatExplain", +-- "CopilotChatReview", +-- "CopilotChatFix", +-- "CopilotChatOptimize", +-- "CopilotChatDocs", +-- "CopilotChatTests", +-- "CopilotChatFixDiagnostic", +-- "CopilotChatCommit", +-- "CopilotChatCommitStaged", +-- }, +-- opts = { +-- temperature = 0.3, +-- auto_insert_mode = true, +-- system_prompt = "You are a AI (femboy) assistant for developers. Make sure that you reply the same way a cute femboy would do. UwU. Don't forget that you are an expert in the field and attempt to repond in a concise way.", +-- mappings = { +-- reset = { +-- normal = "", +-- insert = "", +-- }, +-- complete = { +-- detail = "Use @ or / for options.", +-- insert = "", +-- }, +-- submit_prompt = { +-- normal = "", +-- insert = "", +-- }, +-- accept_diff = { +-- normal = "", +-- insert = "", +-- }, +-- yank_diff = { +-- normal = "gy", +-- }, +-- show_diff = { +-- normal = "gd", +-- }, +-- show_system_prompt = { +-- normal = "gp", +-- }, +-- show_user_selection = { +-- normal = "gs", +-- }, +-- }, +-- }, +-- keys = { +-- { +-- "p", +-- "CopilotChat", +-- desc = "CopilotChat - Quick chat", +-- }, +-- { +-- "ccq", +-- function() +-- local input = vim.fn.input("Quick Chat: ") +-- if input ~= "" then +-- require("CopilotChat").ask(input, { selection = require("CopilotChat.select").buffer }) +-- end +-- end, +-- desc = "CopilotChat - Quick chat", +-- }, +-- { +-- "cch", +-- function() +-- local actions = require("CopilotChat.actions") +-- require("CopilotChat.integrations.telescope").pick(actions.help_actions()) +-- end, +-- desc = "CopilotChat - Help actions", +-- }, +-- -- Show prompts actions with telescope +-- { +-- "ccp", +-- function() +-- local actions = require("CopilotChat.actions") +-- require("CopilotChat.integrations.telescope").pick(actions.prompt_actions()) +-- end, +-- desc = "CopilotChat - Prompt actions", +-- }, +-- }, +-- } diff --git a/.config/nvim/lua/plugins/csvview.lua b/.config/nvim/lua/plugins/csvview.lua new file mode 100644 index 0000000..51f1bbe --- /dev/null +++ b/.config/nvim/lua/plugins/csvview.lua @@ -0,0 +1,22 @@ +return { + "hat0uma/csvview.nvim", + ---@module "csvview" + ---@type CsvView.Options + opts = { + parser = { comments = { "#", "//" } }, + keymaps = { + -- Text objects for selecting fields + textobject_field_inner = { "if", mode = { "o", "x" } }, + textobject_field_outer = { "af", mode = { "o", "x" } }, + -- Excel-like navigation: + -- Use and to move horizontally between fields. + -- Use and to move vertically between rows and place the cursor at the end of the field. + -- Note: In terminals, you may need to enable CSI-u mode to use and . + jump_next_field_end = { "", mode = { "n", "v" } }, + jump_prev_field_end = { "", mode = { "n", "v" } }, + jump_next_row = { "", mode = { "n", "v" } }, + jump_prev_row = { "", mode = { "n", "v" } }, + }, + }, + cmd = { "CsvViewEnable", "CsvViewDisable", "CsvViewToggle" }, +} diff --git a/.config/nvim/lua/plugins/diffview.lua b/.config/nvim/lua/plugins/diffview.lua new file mode 100644 index 0000000..8bf3783 --- /dev/null +++ b/.config/nvim/lua/plugins/diffview.lua @@ -0,0 +1,9 @@ +return { + "sindrets/diffview.nvim", + cmd = { + "DiffviewOpen", + }, + keys = { + { "do", "DiffviewOpen", desc = "Open diffview" }, + }, +} diff --git a/.config/nvim/lua/plugins/endpoint.lua b/.config/nvim/lua/plugins/endpoint.lua new file mode 100644 index 0000000..be02f46 --- /dev/null +++ b/.config/nvim/lua/plugins/endpoint.lua @@ -0,0 +1,85 @@ +return { + "zerochae/endpoint.nvim", + dependencies = { "nvim-telescope/telescope.nvim" }, + cmd = { + "Endpoint", + }, + config = function() + require("endpoint").setup({ + -- Framework configuration + framework = "auto", -- "auto", "spring", "nestjs", "django", "rails", "express" + + -- Optional: Path-based framework overrides + framework_paths = { + ["/path/to/spring/project"] = "spring", + ["/path/to/nestjs/project"] = "nestjs", + }, + + -- Cache configuration + cache_mode = "persistent", -- Cache mode: "session" or "persistent" + debug = false, -- Enable debug logging + + ui = { + show_icons = true, -- Show method icons + show_method = true, -- Show method text (GET, POST, etc.) + use_nerd_font = false, -- Use nerd font glyphs instead of emojis + + -- Customize icons (requires show_icons = true) + method_icons = { + emoji = { + GET = "📥", + POST = "📤", + PUT = "✏️", + DELETE = "🗑️", + PATCH = "🔧", + }, + nerd_font = { + GET = "", -- download icon + POST = "", -- upload icon + PUT = "", -- edit icon + DELETE = "", -- trash icon + PATCH = "", -- wrench icon + }, + }, + + -- Customize colors + method_colors = { + GET = "DiagnosticOk", -- Green + POST = "DiagnosticInfo", -- Blue + PUT = "DiagnosticWarn", -- Yellow + DELETE = "DiagnosticError", -- Red + PATCH = "DiagnosticHint", -- Purple + }, + + -- Cache status UI customization + cache_status_icons = { + emoji = { + title = "🚀", + success = "✅", + error = "❌", + tree = "🌳", + directory = "📁", + file = "📄", + }, + nerd_font = { + title = "", + success = "", + error = "", + tree = "", + directory = "", + file = "", + }, + }, + + -- Cache status syntax highlighting + cache_status_highlight = { + title = "Special", + success = "DiagnosticOk", + error = "DiagnosticError", + key = "Keyword", + tree_method = "Function", + }, + }, + }) + end, +} diff --git a/.config/nvim/lua/plugins/flash.lua b/.config/nvim/lua/plugins/flash.lua new file mode 100644 index 0000000..4e7ab2a --- /dev/null +++ b/.config/nvim/lua/plugins/flash.lua @@ -0,0 +1,14 @@ +return { + "folke/flash.nvim", + event = "VeryLazy", + keys = { + { + "s", + mode = { "n", "x", "o" }, + function() + require("flash").jump() + end, + desc = "Flash", + }, + }, +} diff --git a/.config/nvim/lua/plugins/gitlinker.lua b/.config/nvim/lua/plugins/gitlinker.lua new file mode 100644 index 0000000..6e8cb3c --- /dev/null +++ b/.config/nvim/lua/plugins/gitlinker.lua @@ -0,0 +1,33 @@ +return { + "ruifm/gitlinker.nvim", + lazy = false, + config = function() + require("gitlinker").setup({ + opts = { + remote = nil, -- force the use of a specific remote + -- adds current line nr in the url for normal mode + add_current_line_on_normal_mode = true, + -- callback for what to do with the url + action_callback = require("gitlinker.actions").copy_to_clipboard, + -- print the url after performing the action + print_url = true, + }, + callbacks = { + ["github.com"] = require("gitlinker.hosts").get_github_type_url, + ["gitlab.com"] = require("gitlinker.hosts").get_gitlab_type_url, + ["gitlab.nine.ch"] = require("gitlinker.hosts").get_gitlab_type_url, + ["try.gitea.io"] = require("gitlinker.hosts").get_gitea_type_url, + ["codeberg.org"] = require("gitlinker.hosts").get_gitea_type_url, + ["bitbucket.org"] = require("gitlinker.hosts").get_bitbucket_type_url, + ["try.gogs.io"] = require("gitlinker.hosts").get_gogs_type_url, + ["git.sr.ht"] = require("gitlinker.hosts").get_srht_type_url, + ["git.launchpad.net"] = require("gitlinker.hosts").get_launchpad_type_url, + ["repo.or.cz"] = require("gitlinker.hosts").get_repoorcz_type_url, + ["git.kernel.org"] = require("gitlinker.hosts").get_cgit_type_url, + ["git.savannah.gnu.org"] = require("gitlinker.hosts").get_cgit_type_url, + }, + -- default mapping to call url generation with action_callback + mappings = "oy", + }) + end, +} diff --git a/.config/nvim/lua/plugins/gitsigns.lua b/.config/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..5fb77dd --- /dev/null +++ b/.config/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,87 @@ +return { + "lewis6991/gitsigns.nvim", + lazy = false, + config = function() + require("gitsigns").setup({ + numhl = true, + attach_to_untracked = true, + update_debounce = 5, + on_attach = function(bufnr) + local gitsigns = require("gitsigns") + end, + }) + end, + keys = { + -- Navigation + { + "]c", + function() + if vim.wo.diff then + vim.cmd("normal! ]c") + else + require("gitsigns").next_hunk() + end + end, + mode = "n", + desc = "Next Git hunk", + }, + { + "[c", + function() + if vim.wo.diff then + vim.cmd("normal! [c") + else + require("gitsigns").prev_hunk() + end + end, + mode = "n", + desc = "Previous Git hunk", + }, + + -- Actions + { "hs", ":Gitsigns stage_hunk", mode = "n", desc = "Stage Hunk" }, + { "hr", ":Gitsigns reset_hunk", mode = "n", desc = "Reset Hunk" }, + { + "hs", + function() + require("gitsigns").stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end, + mode = "v", + desc = "Stage Hunk", + }, + { + "hr", + function() + require("gitsigns").reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end, + mode = "v", + desc = "Reset Hunk", + }, + { "hS", ":Gitsigns stage_buffer", mode = "n", desc = "Stage Buffer" }, + { "hu", ":Gitsigns undo_stage_hunk", mode = "n", desc = "Undo Stage Hunk" }, + { "hR", ":Gitsigns reset_buffer", mode = "n", desc = "Reset Buffer" }, + { "hp", ":Gitsigns preview_hunk", mode = "n", desc = "Preview Hunk" }, + { + "hb", + function() + require("gitsigns").blame_line({ full = true }) + end, + mode = "n", + desc = "Blame Line", + }, + { "tb", ":Gitsigns toggle_current_line_blame", mode = "n", desc = "Toggle Blame" }, + { "hd", ":Gitsigns diffthis", mode = "n", desc = "Diff This" }, + { + "hD", + function() + require("gitsigns").diffthis("~") + end, + mode = "n", + desc = "Diff This ~", + }, + { "td", ":Gitsigns toggle_deleted", mode = "n", desc = "Toggle Deleted" }, + + -- Text object + { "ih", ":Gitsigns select_hunk", mode = { "o", "x" }, desc = "Select Hunk" }, + }, +} diff --git a/.config/nvim/lua/plugins/gradlew.lua b/.config/nvim/lua/plugins/gradlew.lua new file mode 100644 index 0000000..0f6f041 --- /dev/null +++ b/.config/nvim/lua/plugins/gradlew.lua @@ -0,0 +1,16 @@ +return { + "oclay1st/gradle.nvim", + cmd = { "Gradle", "GradleExec", "GradleInit" }, + dependencies = { + "nvim-lua/plenary.nvim", + "MunifTanjim/nui.nvim", + }, + opts = {}, -- options, see default configuration + keys = { { "G", "Gradle", desc = "Gradle" } }, + ft = { "java" }, + config = function() + require("gradle").setup({ + gradle_executable = "./gradlew", -- Example: gradle, ./gradlew or a path to Gradle executable + }) + end, +} diff --git a/.config/nvim/lua/plugins/grug.lua b/.config/nvim/lua/plugins/grug.lua new file mode 100644 index 0000000..52f68a4 --- /dev/null +++ b/.config/nvim/lua/plugins/grug.lua @@ -0,0 +1,29 @@ +return { + "MagicDuck/grug-far.nvim", + config = function() + require("grug-far").setup({}) + end, + keys = { + { + "", + function() + require("grug-far").open() + end, + desc = "Find and replace", + }, + { + "sp", + function() + require("grug-far").open() + end, + desc = "Find and replace", + }, + { + "sw", + function() + require("grug-far").open({ prefills = { search = vim.fn.expand("") } }) + end, + desc = "Find and replace word under cursor", + }, + }, +} diff --git a/.config/nvim/lua/plugins/harpoon.lua b/.config/nvim/lua/plugins/harpoon.lua new file mode 100644 index 0000000..05a3b47 --- /dev/null +++ b/.config/nvim/lua/plugins/harpoon.lua @@ -0,0 +1,52 @@ +return { + "ThePrimeagen/harpoon", + lazy = false, + branch = "harpoon2", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + local harpoon = require("harpoon") + + harpoon:setup() + + vim.keymap.set("n", "a", function() + harpoon:list():add() + end, { noremap = true, silent = true, desc = "Add file to Harpoon" }) + vim.keymap.set("n", "e", function() + harpoon:list():remove() + end, { noremap = true, silent = true, desc = "Remove file from Harpoon" }) + -- vim.keymap.set("n", "", function() harpoon.ui:toggle_quick_menu() end, { noremap = true, silent = true }) + vim.keymap.set("n", "1", function() + harpoon:list():select(1) + end, { noremap = true, silent = true, desc = "Select Harpoon file 1" }) + vim.keymap.set("n", "2", function() + harpoon:list():select(2) + end, { noremap = true, silent = true, desc = "Select Harpoon file 2" }) + vim.keymap.set("n", "3", function() + harpoon:list():select(3) + end, { noremap = true, silent = true, desc = "Select Harpoon file 3" }) + vim.keymap.set("n", "4", function() + harpoon:list():select(4) + end, { noremap = true, silent = true, desc = "Select Harpoon file 4" }) + vim.keymap.set("n", "5", function() + harpoon:list():select(5) + end, { noremap = true, silent = true, desc = "Select Harpoon file 5" }) + vim.keymap.set("n", "6", function() + harpoon:list():select(6) + end, { noremap = true, silent = true, desc = "Select Harpoon file 6" }) + vim.keymap.set("n", "7", function() + harpoon:list():select(7) + end, { noremap = true, silent = true, desc = "Select Harpoon file 7" }) + vim.keymap.set("n", "8", function() + harpoon:list():select(8) + end, { noremap = true, silent = true, desc = "Select Harpoon file 8" }) + vim.keymap.set("n", "9", function() + harpoon:list():select(9) + end, { noremap = true, silent = true, desc = "Select Harpoon file 9" }) + vim.keymap.set("n", "", function() + harpoon:list():next() + end, { desc = "Next Harpoon file" }) + vim.keymap.set("n", "", function() + harpoon:list():prev() + end, { desc = "Previous Harpoon file" }) + end, +} diff --git a/.config/nvim/lua/plugins/jsonpath.lua b/.config/nvim/lua/plugins/jsonpath.lua new file mode 100644 index 0000000..45bc16a --- /dev/null +++ b/.config/nvim/lua/plugins/jsonpath.lua @@ -0,0 +1,5 @@ +return { + "phelipetls/jsonpath.nvim", + cmd = "JsonPathCopy", + opts = { show_on_winbar = true, reg = "+" }, +} diff --git a/.config/nvim/lua/plugins/jupynium.lua b/.config/nvim/lua/plugins/jupynium.lua new file mode 100644 index 0000000..62b94af --- /dev/null +++ b/.config/nvim/lua/plugins/jupynium.lua @@ -0,0 +1,13 @@ +return {} + +-- return { +-- "kiyoon/jupynium.nvim", +-- lazy = false, +-- build = "pip3 install --user .", +-- deps = { +-- "rcarriga/nvim-notify", -- optional +-- "stevearc/dressing.nvim", -- optional, UI for :JupyniumKernelSelect +-- } +-- -- build = "uv pip install . --python=$HOME/.virtualenvs/jupynium/bin/python", +-- -- build = "conda run --no-capture-output -n jupynium pip install .", +-- } diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..9c7fe0c --- /dev/null +++ b/.config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,302 @@ +return { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + lazy = false, + config = function() + -- Eviline config for lualine + -- Author: shadmansaleh + -- Credit: glepnir + local lualine = require("lualine") + + -- Color table for highlights + -- stylua: ignore + -- dark + -- local colors = { + -- bg = '#202328', + -- fg = '#bbc2cf', + -- yellow = '#ECBE7B', + -- cyan = '#008080', + -- darkblue = '#081633', + -- green = '#98be65', + -- orange = '#FF8800', + -- violet = '#a9a1e1', + -- magenta = '#c678dd', + -- blue = '#51afef', + -- red = '#ec5f67', + -- } + -- + -- if vim.o.background == "light" then + -- colors = { + -- bg = '#FFFFFF', -- Light background + -- fg = '#2E2E2E', -- Darker foreground for contrast + -- yellow = '#7F6D3A', -- Softer yellow + -- cyan = '#009B9F', -- Softer cyan + -- darkblue = '#2C3E50', -- Softer dark blue + -- green = '#5C9E3E', -- Softer green + -- orange = '#E76E27', -- Softer orange + -- violet = '#8E9DCC', -- Softer violet + -- magenta = '#D25D91', -- Softer magenta + -- blue = '#6BB6E8', -- Softer blue + -- red = '#E53A35', -- Softer red + -- } + -- end + + local colors = { + black = '#282828', + white = '#ebdbb2', + red = '#fb4934', + green = '#b8bb26', + blue = '#83a598', + yellow = '#fe8019', + gray = '#a89984', + darkgray = '#3c3836', + lightgray = '#504945', + inactivegray = '#7c6f64', + } + + local conditions = { + buffer_not_empty = function() + return vim.fn.empty(vim.fn.expand("%:t")) ~= 1 + end, + hide_in_width = function() + return vim.fn.winwidth(0) > 80 + end, + check_git_workspace = function() + local filepath = vim.fn.expand("%:p:h") + local gitdir = vim.fn.finddir(".git", filepath .. ";") + return gitdir and #gitdir > 0 and #gitdir < #filepath + end, + } + + -- Config + local config = { + options = { + -- Disable sections and component separators + component_separators = "", + section_separators = "", + theme = { + -- We are going to use lualine_c an lualine_x as left and + -- right section. Both are highlighted by c theme . So we + -- are just setting default looks o statusline + normal = { c = { fg = colors.fg, bg = colors.bg } }, + inactive = { c = { fg = colors.fg, bg = colors.bg } }, + }, + }, + sections = { + -- these are to remove the defaults + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + -- These will be filled later + lualine_c = {}, + -- lualine_x = { require("yaml_nvim").get_yaml_key }, + lualine_x = {}, + }, + inactive_sections = { + -- these are to remove the defaults + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + lualine_c = {}, + -- lualine_x = { require("yaml_nvim").get_yaml_key }, + lualine_x = {}, + }, + } + + -- Inserts a component in lualine_c at left section + local function ins_left(component) + table.insert(config.sections.lualine_c, component) + end + + -- Inserts a component in lualine_x at right section + local function ins_right(component) + table.insert(config.sections.lualine_x, component) + end + + ins_left({ + function() + return "▊" + end, + color = { fg = colors.blue }, -- Sets highlighting of component + padding = { left = 0, right = 1 }, -- We don't need space before this + }) + + ins_left({ + -- mode component + function() + return "󰊠" + end, + color = function() + -- auto change color according to neovims mode + local mode_color = { + n = colors.red, + i = colors.green, + v = colors.blue, + [""] = colors.blue, + V = colors.blue, + c = colors.magenta, + no = colors.red, + s = colors.orange, + S = colors.orange, + [""] = colors.orange, + ic = colors.yellow, + R = colors.violet, + Rv = colors.violet, + cv = colors.red, + ce = colors.red, + r = colors.cyan, + rm = colors.cyan, + ["r?"] = colors.cyan, + ["!"] = colors.red, + t = colors.red, + } + return { fg = mode_color[vim.fn.mode()] } + end, + padding = { right = 1 }, + }) + + ins_left({ + -- filesize component + "filesize", + cond = conditions.buffer_not_empty, + }) + + ins_left({ + "filename", + cond = conditions.buffer_not_empty, + color = { fg = colors.magenta, gui = "bold" }, + }) + + ins_left({ "location" }) + + ins_left({ "progress", color = { fg = colors.fg, gui = "bold" } }) + + ins_left({ + "diagnostics", + sources = { "nvim_diagnostic" }, + symbols = { error = " ", warn = " ", info = " " }, + diagnostics_color = { + error = { fg = colors.red }, + warn = { fg = colors.yellow }, + info = { fg = colors.cyan }, + }, + }) + + -- Insert mid section. You can make any number of sections in neovim :) + -- for lualine it's any number greater then 2 + ins_left({ + function() + return "%=" + end, + }) + + ins_left({ + -- Lsp server name . + function() + local msg = "No Active Lsp" + local buf_ft = vim.api.nvim_get_option_value("filetype", { buf = 0 }) + local clients = vim.lsp.get_clients() + if next(clients) == nil then + return msg + end + for _, client in ipairs(clients) do + local filetypes = client.config.filetypes + if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then + return client.name + end + end + return msg + end, + icon = " LSP:", + color = { fg = "#ffffff", gui = "bold" }, + }) + + -- Add components to right sections + ins_right({ + "o:encoding", -- option component same as &encoding in viml + fmt = string.upper, -- I'm not sure why it's upper case either ;) + cond = conditions.hide_in_width, + color = { fg = colors.green, gui = "bold" }, + }) + + ins_right({ + "fileformat", + fmt = string.upper, + icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh + color = { fg = colors.green, gui = "bold" }, + }) + + ins_right({ + "branch", + icon = "", + color = { fg = colors.violet, gui = "bold" }, + }) + + ins_right({ + "diff", + -- Is it me or the symbol for modified us really weird + symbols = { added = " ", modified = "󰝤 ", removed = " " }, + diff_color = { + added = { fg = colors.green }, + modified = { fg = colors.orange }, + removed = { fg = colors.red }, + }, + cond = conditions.hide_in_width, + }) + + ins_right({ + function() + return "▊" + end, + color = { fg = colors.blue }, + padding = { left = 1 }, + }) + + -- Now don't forget to initialize lualine + lualine.setup(config) + + -- require("lualine").setup({ + -- options = { + -- icons_enabled = true, + -- -- theme = 'ayu_light', + -- component_separators = { left = "", right = "" }, + -- section_separators = { left = "", right = "" }, + -- disabled_filetypes = { + -- statusline = {}, + -- winbar = {}, + -- }, + -- ignore_focus = {}, + -- always_divide_middle = true, + -- always_show_tabline = true, + -- globalstatus = false, + -- refresh = { + -- statusline = 100, + -- tabline = 100, + -- winbar = 100, + -- }, + -- }, + -- sections = { + -- lualine_a = { "mode" }, + -- lualine_b = { "branch", "diff", "diagnostics" }, + -- lualine_c = { "filename" }, + -- lualine_x = { "fileformat", "filetype" }, + -- lualine_y = { "progress" }, + -- lualine_z = { "location" }, + -- }, + -- inactive_sections = { + -- lualine_a = {}, + -- lualine_b = {}, + -- lualine_c = { "filename" }, + -- lualine_x = { "location" }, + -- lualine_y = {}, + -- lualine_z = {}, + -- }, + -- tabline = {}, + -- winbar = {}, + -- inactive_winbar = {}, + -- extensions = {}, + -- }) + end, +} diff --git a/.config/nvim/lua/plugins/markdown.lua b/.config/nvim/lua/plugins/markdown.lua new file mode 100644 index 0000000..9b105d8 --- /dev/null +++ b/.config/nvim/lua/plugins/markdown.lua @@ -0,0 +1,27 @@ +return { + { + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + build = "cd app && yarn install", + init = function() + vim.g.mkdp_filetypes = { "markdown" } + end, + ft = { "markdown" }, + }, + + -- "tadmccorkle/markdown.nvim", + -- ft = "markdown", -- or 'event = "VeryLazy"' + -- opts = { + -- -- configuration here or empty for defaults + -- }, + -- { + -- "MeanderingProgrammer/render-markdown.nvim", + -- dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.nvim" }, -- if you use the mini.nvim suite + -- -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins + -- -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons + -- ---@module 'render-markdown' + -- ---@type render.md.UserConfig + -- opts = {}, + -- ft = "markdown", + -- }, +} diff --git a/.config/nvim/lua/plugins/maximize.lua b/.config/nvim/lua/plugins/maximize.lua new file mode 100644 index 0000000..30183df --- /dev/null +++ b/.config/nvim/lua/plugins/maximize.lua @@ -0,0 +1,10 @@ +return { + "declancm/maximize.nvim", + config = true, + cmd = { + "Maximize", + }, + keys = { + { "z", "Maximize", desc = "Maximize" }, + }, +} diff --git a/.config/nvim/lua/plugins/mini-cursorword.lua b/.config/nvim/lua/plugins/mini-cursorword.lua new file mode 100644 index 0000000..8c598ec --- /dev/null +++ b/.config/nvim/lua/plugins/mini-cursorword.lua @@ -0,0 +1,10 @@ +return { + "echasnovski/mini.cursorword", + version = false, + lazy = false, + config = function() + require("mini.cursorword").setup({ + delay = 10, + }) + end, +} diff --git a/.config/nvim/lua/plugins/neogit.lua b/.config/nvim/lua/plugins/neogit.lua new file mode 100644 index 0000000..843d8f8 --- /dev/null +++ b/.config/nvim/lua/plugins/neogit.lua @@ -0,0 +1,16 @@ +return { + "NeogitOrg/neogit", + dependencies = { + "nvim-lua/plenary.nvim", + "sindrets/diffview.nvim", + "nvim-telescope/telescope.nvim", + }, + keys = { + { "g", "Neogit", desc = "Neogit" }, + }, + config = function() + require("neogit").setup({ + graph_style = "unicode", + }) + end, +} diff --git a/.config/nvim/lua/plugins/neotest.lua b/.config/nvim/lua/plugins/neotest.lua new file mode 100644 index 0000000..3694f31 --- /dev/null +++ b/.config/nvim/lua/plugins/neotest.lua @@ -0,0 +1,61 @@ +return { + "nvim-neotest/neotest", + event = "VeryLazy", + dependencies = { + "nvim-neotest/nvim-nio", + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + "olimorris/neotest-rspec", + "zidhuss/neotest-minitest", + "rcasia/neotest-java", + "mfussenegger/nvim-jdtls", + "adrigzr/neotest-mocha", + }, + config = function() + require("neotest").setup({ + adapters = { + require("neotest-minitest"), + require("neotest-mocha")({ + command = "bunx mocha --", + command_args = function(context) + -- The context contains: + -- results_path: The file that json results are written to + -- test_name_pattern: The generated pattern for the test + -- path: The path to the test file + -- + -- It should return a string array of arguments + -- + -- Not specifying 'command_args' will use the defaults below + local relative_path = vim.fn.fnamemodify(context.path, ":.") + return { + "--full-trace", + "--reporter=json", + "--reporter-options=output=" .. context.results_path, + "--grep=" .. context.test_name_pattern, + relative_path, + } + end, + env = { CI = true }, + cwd = function() + return vim.fn.getcwd() + end, + }), + require("neotest-rspec")({ + rspec_cmd = function() + return { "mise", "exec", "--", "bundle", "exec", "rspec" } + end, + }), + require("neotest-java")({ + ignore_wrapper = true, + }), + }, + }) + end, + keys = { + { "tt", "Neotest run file", desc = "Test file" }, + { "tr", "Neotest run", desc = "Run closest test" }, + { "to", "Neotest output", desc = "Test output" }, + { "tO", "Neotest output-panel", desc = "Test output panel" }, + { "ts", "Neotest stop", desc = "Stop test" }, + }, +} diff --git a/.config/nvim/lua/plugins/nvim-asciidoc-preview.lua b/.config/nvim/lua/plugins/nvim-asciidoc-preview.lua new file mode 100644 index 0000000..52e843f --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-asciidoc-preview.lua @@ -0,0 +1,8 @@ +return { + "tigion/nvim-asciidoc-preview", + ft = { "asciidoc" }, + build = "cd server && npm install --omit=dev", + opts = { + -- Add user configuration here + }, +} diff --git a/.config/nvim/lua/plugins/nvim-cmp.lua b/.config/nvim/lua/plugins/nvim-cmp.lua new file mode 100644 index 0000000..170ce71 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-cmp.lua @@ -0,0 +1,97 @@ +return { + "hrsh7th/nvim-cmp", + lazy = false, + dependencies = { + "hrsh7th/nvim-cmp", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "ray-x/cmp-treesitter", + "neovim/nvim-lspconfig", + "saadparwaiz1/cmp_luasnip", + "rafamadriz/friendly-snippets", + "L3MON4D3/LuaSnip", + }, + config = function() + local cmp = require("cmp") + require("luasnip.loaders.from_vscode").lazy_load() + + local luasnip = require("luasnip") + + cmp.setup({ + snippet = { + -- expand = function(args) + -- require('luasnip').lsp_expand(args.body) + -- end, + }, + 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 }), + -- https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings#luasnip + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + if luasnip.expandable() then + luasnip.expand() + else + cmp.confirm({ + select = true, + }) + end + else + fallback() + end + end), + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.locally_jumpable(1) then + luasnip.jump(1) + else + fallback() + end + end, { "i", "s" }), + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + -- { name = 'treesitter' }, + { name = "luasnip" }, + }, { + { name = "buffer" }, + { name = "path" }, + }), + }) + + cmp.setup.cmdline({ "/", "?" }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" }, + }, + }) + + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), + matching = { disallow_symbol_nonprefix_matching = false }, + }) + end, +} diff --git a/.config/nvim/lua/plugins/nvim-lspconfig.lua b/.config/nvim/lua/plugins/nvim-lspconfig.lua new file mode 100644 index 0000000..1e694d5 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-lspconfig.lua @@ -0,0 +1,77 @@ +return { + "neovim/nvim-lspconfig", + lazy = false, + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "VonHeikemen/lsp-zero.nvim", + { + "williamboman/mason.nvim", + config = function() + require("mason").setup() + end, + }, + { + "williamboman/mason-lspconfig.nvim", + dependencies = { "williamboman/mason.nvim" }, + }, + }, + keys = { + { "li", "LspInfo", desc = "Lsp info" }, + { "ll", "LspLog", desc = "Lsp log" }, + }, + config = function() + -- Setup mason-lspconfig with v2.0 API + require("mason-lspconfig").setup({ + ensure_installed = { "lua_ls", "rust_analyzer" }, + automatic_enable = true, -- This automatically enables installed servers + }) + + -- Setup LSP capabilities for autocompletion + local lspconfig = require("lspconfig") + local lspconfig_defaults = lspconfig.util.default_config + lspconfig_defaults.capabilities = + vim.tbl_deep_extend("force", lspconfig_defaults.capabilities, require("cmp_nvim_lsp").default_capabilities()) + + -- Configure ruby-lsp using the new vim.lsp.config API + vim.lsp.config("ruby-lsp", { + init_options = { + addonSettings = { + ["Ruby LSP Rails"] = { + enablePendingMigrationsPrompt = false, + }, + }, + settings = { + formatter = { + enabled = true, + }, + }, + }, + }) + + -- herb? + vim.lsp.config("herb_ls", { + cmd = { "herb-language-server", "--stdio" }, + filetypes = { "erb" }, + }) + + -- LSP keymaps and autocmds + vim.api.nvim_create_autocmd("LspAttach", { + desc = "LSP actions", + callback = function(event) + local opts = { buffer = event.buf } + vim.keymap.set("n", "K", vim.lsp.buf.hover, { desc = "Show hover information" }) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" }) + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { desc = "Go to declaration" }) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { desc = "Go to implementation" }) + vim.keymap.set("n", "go", vim.lsp.buf.type_definition, { desc = "Go to type definition" }) + vim.keymap.set("n", "gr", vim.lsp.buf.references, { desc = "Show references" }) + vim.keymap.set("n", "gs", vim.lsp.buf.signature_help, { desc = "Show signature help" }) + vim.keymap.set("n", "cn", vim.lsp.buf.rename, { desc = "Rename symbol" }) + vim.keymap.set({ "n", "x" }, "F", function() + vim.lsp.buf.format({ async = true }) -- TODO: add desc + end, opts) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, opts) + end, + }) + end, +} diff --git a/.config/nvim/lua/plugins/nvim-surround.lua b/.config/nvim/lua/plugins/nvim-surround.lua new file mode 100644 index 0000000..e859c19 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-surround.lua @@ -0,0 +1,8 @@ +return { + "kylechui/nvim-surround", + version = "*", + event = "VeryLazy", + config = function() + require("nvim-surround").setup() + end, +} diff --git a/.config/nvim/lua/plugins/nvim-treesitter-endwise.lua b/.config/nvim/lua/plugins/nvim-treesitter-endwise.lua new file mode 100644 index 0000000..00de681 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-treesitter-endwise.lua @@ -0,0 +1,11 @@ +return { + "RRethy/nvim-treesitter-endwise", + event = { "BufReadPre", "BufNewFile" }, + config = function() + require("nvim-treesitter.configs").setup({ + endwise = { + enable = true, + }, + }) + end, +} diff --git a/.config/nvim/lua/plugins/nvim-treesitter-textobjects.lua b/.config/nvim/lua/plugins/nvim-treesitter-textobjects.lua new file mode 100644 index 0000000..8aad996 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-treesitter-textobjects.lua @@ -0,0 +1,74 @@ +-- https://www.josean.com/posts/nvim-treesitter-and-textobjects +return { + "nvim-treesitter/nvim-treesitter-textobjects", + lazy = true, + config = function() + require("nvim-treesitter.configs").setup({ + textobjects = { + select = { + enable = true, + + -- Automatically jump forward to textobj, similar to targets.vim + lookahead = true, + + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ["a="] = { query = "@assignment.outer", desc = "Select outer part of an assignment" }, + ["i="] = { query = "@assignment.inner", desc = "Select inner part of an assignment" }, + ["l="] = { query = "@assignment.lhs", desc = "Select left hand side of an assignment" }, + ["r="] = { query = "@assignment.rhs", desc = "Select right hand side of an assignment" }, + + -- works for javascript/typescript files (custom captures I created in after/queries/ecma/textobjects.scm) + ["a:"] = { query = "@property.outer", desc = "Select outer part of an object property" }, + ["i:"] = { query = "@property.inner", desc = "Select inner part of an object property" }, + ["l:"] = { query = "@property.lhs", desc = "Select left part of an object property" }, + ["r:"] = { query = "@property.rhs", desc = "Select right part of an object property" }, + + ["aa"] = { query = "@parameter.outer", desc = "Select outer part of a parameter/argument" }, + ["ia"] = { query = "@parameter.inner", desc = "Select inner part of a parameter/argument" }, + + ["ai"] = { query = "@conditional.outer", desc = "Select outer part of a conditional" }, + ["ii"] = { query = "@conditional.inner", desc = "Select inner part of a conditional" }, + + ["al"] = { query = "@loop.outer", desc = "Select outer part of a loop" }, + ["il"] = { query = "@loop.inner", desc = "Select inner part of a loop" }, + + ["af"] = { query = "@call.outer", desc = "Select outer part of a function call" }, + ["if"] = { query = "@call.inner", desc = "Select inner part of a function call" }, + + ["am"] = { + query = "@function.outer", + desc = "Select outer part of a method/function definition", + }, + ["im"] = { + query = "@function.inner", + desc = "Select inner part of a method/function definition", + }, + + ["ab"] = { query = "@block.outer", desc = "Select outer part of a block definition" }, + ["ib"] = { query = "@block.inner", desc = "Select inner part of a block definition" }, + + ["ac"] = { query = "@class.outer", desc = "Select outer part of a class" }, + ["ic"] = { query = "@class.inner", desc = "Select inner part of a class" }, + + ["a/"] = { query = "@comment.outer", desc = "Select outer part of a comment" }, + ["i/"] = { query = "@comment.inner", desc = "Select inner part of a comment" }, + }, + }, + swap = { + enable = true, + swap_next = { + ["na"] = "@parameter.inner", -- swap parameters/argument with next + ["n:"] = "@property.outer", -- swap object property with next + ["nm"] = "@function.outer", -- swap function with next + }, + swap_previous = { + ["Pa"] = "@parameter.inner", -- swap parameters/argument with prev + ["P:"] = "@property.outer", -- swap object property with prev + ["Pm"] = "@function.outer", -- swap function with previous + }, + }, + }, + }) + end, +} diff --git a/.config/nvim/lua/plugins/nvim-treesitter.lua b/.config/nvim/lua/plugins/nvim-treesitter.lua new file mode 100644 index 0000000..0c99b7b --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-treesitter.lua @@ -0,0 +1,36 @@ +return { + "nvim-treesitter/nvim-treesitter", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + -- "nvim-treesitter/nvim-treesitter-context", + "nvim-treesitter/nvim-treesitter-textobjects", + }, + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { + "lua", + "yaml", + "vim", + "vimdoc", + "query", + "markdown", + "markdown_inline", + "ruby", + "javascript", + "rust", + "html", + "embedded_template", + }, + incremental_selection = { + enable = true, + keymaps = { + node_incremental = "tab", + node_decremental = "", + }, + }, + highlight = { + enable = true, + }, + }) + end, +} diff --git a/.config/nvim/lua/plugins/nvim-ts-autotag.lua b/.config/nvim/lua/plugins/nvim-ts-autotag.lua new file mode 100644 index 0000000..cfe911d --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-ts-autotag.lua @@ -0,0 +1,23 @@ +return { + "windwp/nvim-ts-autotag", + lazy = false, + -- event = { "BufReadPre", "BufNewFile" }, + config = function() + require("nvim-ts-autotag").setup({ + opts = { + -- Defaults + enable_close = true, -- Auto close tags + enable_rename = true, -- Auto rename pairs of tags + enable_close_on_slash = false, -- Auto close on trailing "] = "actions.select", + [""] = { + "actions.select", + opts = { vertical = true }, + desc = "Open the entry in a vertical split", + }, + [""] = { + "actions.select", + opts = { horizontal = true }, + desc = "Open the entry in a horizontal split", + }, + [""] = { "actions.select", opts = { tab = true }, desc = "Open the entry in new tab" }, + [""] = "actions.preview", + ["-"] = "actions.parent", + ["_"] = "actions.open_cwd", + ["`"] = "actions.cd", + ["gs"] = "actions.change_sort", + [""] = { + "actions.open_cmdline", + opts = { + modify = ":! open", + }, + desc = "Open file", + }, + ["K"] = "actions.preview_scroll_up", + ["J"] = "actions.preview_scroll_down", + }, + use_default_keymaps = false, + view_options = { + show_hidden = true, + }, + lsp_file_methods = { + enabled = false, + }, + }) + end, + keys = { + { mode = "n", "-", "Oil" }, + }, +} diff --git a/.config/nvim/lua/plugins/plantuml.lua b/.config/nvim/lua/plugins/plantuml.lua new file mode 100644 index 0000000..dfb4e9b --- /dev/null +++ b/.config/nvim/lua/plugins/plantuml.lua @@ -0,0 +1,8 @@ +return { + "weirongxu/plantuml-previewer.vim", + dependencies = { "tyru/open-browser.vim", "aklt/plantuml-syntax" }, + lazy = false, + config = function() + vim.g.plantuml_previewer_plantuml_jar_path = "/opt/homebrew/bin/plantuml" + end, +} diff --git a/.config/nvim/lua/plugins/refactoring.lua b/.config/nvim/lua/plugins/refactoring.lua new file mode 100644 index 0000000..7c3e917 --- /dev/null +++ b/.config/nvim/lua/plugins/refactoring.lua @@ -0,0 +1,11 @@ +return { + "ThePrimeagen/refactoring.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + }, + lazy = false, + config = function() + require("refactoring").setup() + end, +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..3a8fff6 --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,113 @@ +return { + "nvim-telescope/telescope.nvim", + tag = "0.1.8", + dependencies = { "nvim-lua/plenary.nvim", "nvim-telescope/telescope-ui-select.nvim" }, + config = function() + require("telescope").setup({ + extensions = { + ["ui-select"] = { + require("telescope.themes").get_dropdown({}), + }, + }, + previewers = { + qflist = { + updatetime = 25, + layout_config = { + width = 0.75, + height = 0.75, + }, + }, + }, + defaults = { + file_ignore_patterns = { ".git/" }, -- Ignore the .git directory + mappings = { + n = { + [""] = require("telescope.actions").send_selected_to_qflist + require("telescope.actions").open_qflist, + }, + }, + }, + }) + + require("telescope").load_extension("ui-select") + local harpoon = require("harpoon") + harpoon:setup({}) + + -- basic telescope configuration + 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, + }), + layout_strategy = "center", + previewer = conf.file_previewer({}), + sorter = conf.generic_sorter({}), + }) + :find() + end + + vim.keymap.set("n", "", function() + toggle_telescope(harpoon:list()) + end, { desc = "Open harpoon window" }) + end, + keys = { + { "", 'Telescope find_files path_display={"smart"}', desc = "Find files" }, + { "", "Telescope buffers", desc = "Find buffer" }, + { "C", "Telescope commands", desc = "Find commands" }, + { "", "Telescope lsp_document_symbols", desc = "Find symbols" }, + { "f", "Telescope find_files hidden=true", desc = "Find files" }, + -- { "e", "Telescope find_files hidden=false", desc = "Find all files" }, + { "w", "Telescope live_grep", desc = "Find substring" }, + { + "r", + function() + local current_word = vim.fn.expand("") + require("telescope.builtin").grep_string({ search = current_word }) + end, + }, + { "cc", "Telescope git_commits", desc = "Find git commits" }, + { + "ac", + "Telescope find_files prompt_title=Controllers cwd=app/controllers/ hidden=true", + desc = "Find Rails controllers", + }, + { + "as", + "Telescope find_files prompt_title=Services cwd=app/services/ hidden=true", + desc = "Find Rails services", + }, + { + "ah", + "Telescope find_files prompt_title=Helpers cwd=app/helpers/ hidden=true", + desc = "Find Rails helpers", + }, + { + "am", + "Telescope find_files prompt_title=Models cwd=app/models/ hidden=true", + desc = "Find Rails models", + }, + { + "at", + "Telescope find_files prompt_title=Specs cwd=spec/ hidden=true", + desc = "Find Rails specs", + }, + { + "af", + "Telescope find_files prompt_title=Specs cwd=spec/factories hidden=true", + desc = "Find Rails factories", + }, + { + "av", + "Telescope find_files prompt_title=Views cwd=app/views hidden=true", + desc = "Find Rails views", + }, + { "l", "Telescope lsp_document_symbols", desc = "Find symbols" }, + }, +} diff --git a/.config/nvim/lua/plugins/text-case.lua b/.config/nvim/lua/plugins/text-case.lua new file mode 100644 index 0000000..9512abc --- /dev/null +++ b/.config/nvim/lua/plugins/text-case.lua @@ -0,0 +1,19 @@ +return { + "johmsalas/text-case.nvim", + dependencies = { "nvim-telescope/telescope.nvim" }, + config = function() + require("textcase").setup({}) + require("telescope").load_extension("textcase") + end, + keys = { + { "co", "TextCaseOpenTelescope", mode = { "n", "x" }, desc = "Open TextCase Telescope" }, + }, + cmd = { + "Subs", + "TextCaseOpenTelescope", + "TextCaseOpenTelescopeQuickChange", + "TextCaseOpenTelescopeLSPChange", + "TextCaseStartReplacingCommand", + }, + lazy = false, +} diff --git a/.config/nvim/lua/plugins/trouble.lua b/.config/nvim/lua/plugins/trouble.lua new file mode 100644 index 0000000..3741f30 --- /dev/null +++ b/.config/nvim/lua/plugins/trouble.lua @@ -0,0 +1,37 @@ +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/.config/nvim/lua/plugins/undotree.lua b/.config/nvim/lua/plugins/undotree.lua new file mode 100644 index 0000000..fb491a7 --- /dev/null +++ b/.config/nvim/lua/plugins/undotree.lua @@ -0,0 +1,30 @@ +return { + "jiaoshijie/undotree", + dependencies = "nvim-lua/plenary.nvim", + keys = { -- load the plugin only when using it's keybinding: + { "u", "lua require('undotree').toggle()", desc = "Undotree" }, + }, + config = function() + local undotree = require("undotree") + + undotree.setup({ + float_diff = true, -- using float window previews diff, set this `true` will disable layout option + layout = "left_bottom", -- "left_bottom", "left_left_bottom" + position = "left", -- "right", "bottom" + ignore_filetype = { "undotree", "undotreeDiff", "qf", "TelescopePrompt", "spectre_panel", "tsplayground" }, + window = { + winblend = 30, + }, + keymaps = { + ["j"] = "move_next", + ["k"] = "move_prev", + ["gj"] = "move2parent", + ["J"] = "move_change_next", + ["K"] = "move_change_prev", + [""] = "action_enter", + ["p"] = "enter_diffbuf", + ["q"] = "quit", + }, + }) + end, +} diff --git a/.config/nvim/lua/plugins/vim-case-convert.lua b/.config/nvim/lua/plugins/vim-case-convert.lua new file mode 100644 index 0000000..5335a6c --- /dev/null +++ b/.config/nvim/lua/plugins/vim-case-convert.lua @@ -0,0 +1,4 @@ +return { + "chiedo/vim-case-convert", + lazy = false, +} diff --git a/.config/nvim/lua/plugins/vim-fetch.lua b/.config/nvim/lua/plugins/vim-fetch.lua new file mode 100644 index 0000000..64e76e5 --- /dev/null +++ b/.config/nvim/lua/plugins/vim-fetch.lua @@ -0,0 +1,4 @@ +return { + "wsdjeg/vim-fetch", + lazy = false, +} diff --git a/.config/nvim/lua/plugins/vim-fugitive.lua b/.config/nvim/lua/plugins/vim-fugitive.lua new file mode 100644 index 0000000..c38fbcf --- /dev/null +++ b/.config/nvim/lua/plugins/vim-fugitive.lua @@ -0,0 +1,13 @@ +return { + "tpope/vim-fugitive", + config = function() + require("vim-fugitive").setup() + end, + commands = { + { "G", "Git" }, + { "Gblame", "Git blame" }, + { "Gdiff", "Git diff" }, + { "Glog", "Git log" }, + { "Gstatus", "Git status" }, + }, +} diff --git a/.config/nvim/lua/plugins/vim-rails.lua b/.config/nvim/lua/plugins/vim-rails.lua new file mode 100644 index 0000000..1586b7a --- /dev/null +++ b/.config/nvim/lua/plugins/vim-rails.lua @@ -0,0 +1,5 @@ +return { + "tpope/vim-rails", + lazy = false, + ft = { "ruby" }, +} diff --git a/.config/nvim/lua/plugins/vim-tmux-navigator.lua b/.config/nvim/lua/plugins/vim-tmux-navigator.lua new file mode 100644 index 0000000..11c99cd --- /dev/null +++ b/.config/nvim/lua/plugins/vim-tmux-navigator.lua @@ -0,0 +1,18 @@ +return { + "christoomey/vim-tmux-navigator", + cmd = { + "TmuxNavigateLeft", + "TmuxNavigateDown", + "TmuxNavigateUp", + "TmuxNavigateRight", + "TmuxNavigatePrevious", + "TmuxNavigatorProcessList", + }, + keys = { + { "", "TmuxNavigateLeft" }, + { "", "TmuxNavigateDown" }, + { "", "TmuxNavigateUp" }, + { "", "TmuxNavigateRight" }, + { "", "TmuxNavigatePrevious" }, + }, +} diff --git a/.config/nvim/lua/plugins/visual-multi.lua b/.config/nvim/lua/plugins/visual-multi.lua new file mode 100644 index 0000000..01d1d04 --- /dev/null +++ b/.config/nvim/lua/plugins/visual-multi.lua @@ -0,0 +1,4 @@ +return { + "mg979/vim-visual-multi", + lazy = false, +} diff --git a/.config/nvim/lua/plugins/whichkey.lua b/.config/nvim/lua/plugins/whichkey.lua new file mode 100644 index 0000000..f8feb59 --- /dev/null +++ b/.config/nvim/lua/plugins/whichkey.lua @@ -0,0 +1,19 @@ +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 + delay = 0, + }, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Local Keymaps (which-key)", + }, + }, +} diff --git a/.config/nvim/lua/plugins/yaml.lua b/.config/nvim/lua/plugins/yaml.lua new file mode 100644 index 0000000..68c982c --- /dev/null +++ b/.config/nvim/lua/plugins/yaml.lua @@ -0,0 +1,10 @@ +return { + "cuducos/yaml.nvim", + ft = { "yaml" }, -- optional + dependencies = { + "nvim-treesitter/nvim-treesitter", + "folke/snacks.nvim", -- optional + "nvim-telescope/telescope.nvim", -- optional + "ibhagwan/fzf-lua", -- optional + }, +} diff --git a/.config/nvim/lua/plugins/zj-navigator.lua b/.config/nvim/lua/plugins/zj-navigator.lua new file mode 100644 index 0000000..6ddf0ad --- /dev/null +++ b/.config/nvim/lua/plugins/zj-navigator.lua @@ -0,0 +1,12 @@ +return { + -- 'dynamotn/Navigator.nvim', + -- lazy = false, + -- config = function() + -- require('Navigator').setup() + -- vim.keymap.set({'n', 't'}, '', 'NavigatorLeft') + -- vim.keymap.set({'n', 't'}, '', 'NavigatorRight') + -- vim.keymap.set({'n', 't'}, '', 'NavigatorUp') + -- vim.keymap.set({'n', 't'}, '', 'NavigatorDown') + -- vim.keymap.set({'n', 't'}, '', 'NavigatorPrevious') + -- end +} diff --git a/.config/nvim/lua/plugins/zj-vim-zellij-navigator.lua b/.config/nvim/lua/plugins/zj-vim-zellij-navigator.lua new file mode 100644 index 0000000..d3c2ad2 --- /dev/null +++ b/.config/nvim/lua/plugins/zj-vim-zellij-navigator.lua @@ -0,0 +1,7 @@ +return { + -- "hiasr/vim-zellij-navigator.nvim", + -- lazy = false, + -- config = function() + -- require('vim-zellij-navigator').setup() + -- end +} diff --git a/.config/nvim/lua/plugins/zj-zellij-nav.lua b/.config/nvim/lua/plugins/zj-zellij-nav.lua new file mode 100644 index 0000000..2cd919f --- /dev/null +++ b/.config/nvim/lua/plugins/zj-zellij-nav.lua @@ -0,0 +1,12 @@ +return { + -- "swaits/zellij-nav.nvim", + -- lazy = true, + -- event = "VeryLazy", + -- keys = { + -- { "", "ZellijNavigateLeftTab", { silent = true, desc = "navigate left or tab" } }, + -- { "", "ZellijNavigateDown", { silent = true, desc = "navigate down" } }, + -- { "", "ZellijNavigateUp", { silent = true, desc = "navigate up" } }, + -- { "", "ZellijNavigateRightTab", { silent = true, desc = "navigate right or tab" } }, + -- }, + -- opts = {}, +} diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua new file mode 100644 index 0000000..2ddf614 --- /dev/null +++ b/.config/nvim/lua/settings.lua @@ -0,0 +1,115 @@ +vim.opt.swapfile = false +vim.g.mapleader = " " +vim.g.maplocalleader = "," +vim.opt.cursorline = true +vim.opt.cursorcolumn = true +vim.opt.termguicolors = true +vim.wo.number = true +vim.wo.relativenumber = true +vim.opt.expandtab = true +vim.opt.tabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.scrolloff = 10 +vim.opt.autowrite = true +vim.opt.autowriteall = true +vim.opt.list = false -- whitespace +vim.o.clipboard = "unnamedplus" +vim.o.timeoutlen = 200 +-- vim.opt.cmdheight = 0 + +-- keyap to toggle line numbers (set nonumber and set norelativenumber) +-- vim.keymap.set("n", "", ":set invnumber:set invrelativenumber") + +vim.keymap.set("n", "n", "nzz") +vim.keymap.set("n", "N", "Nzz") +vim.keymap.set("n", "/", "noh") + +-- tabs +-- vim.keymap.set("n", "", ":tabnew", { noremap = true }) +-- vim.keymap.set("n", "", ":tabnext", { noremap = true }) +-- vim.keymap.set("n", "", ":tabprevious", { noremap = true }) + +-- terminal +vim.keymap.set("n", "", ":vert terminal", { noremap = true }) +vim.keymap.set("t", "", "", { noremap = true }) + +-- move +vim.api.nvim_set_keymap("x", "", ":move '>+gv=gv", { noremap = true, silent = true, desc = "Move line down" }) +vim.api.nvim_set_keymap("n", "", ":move -2==", { noremap = true, silent = true, desc = "Move line up" }) +vim.api.nvim_set_keymap("n", "", ":move +==", { noremap = true, silent = true, desc = "Move line down" }) +vim.api.nvim_set_keymap("x", "", ":move -2gv=gv", { noremap = true, silent = true, desc = "Move line up" }) + +-- saving / quitting + +vim.keymap.set("n", "Q", ":quit", { desc = "Quit" }) +vim.keymap.set("n", "Q", ":q!", { desc = "Quit without saving" }) +vim.keymap.set("n", "W", ":wq", { desc = "Save and quit" }) +vim.keymap.set("n", "q", ":quitall", { desc = "Quit all" }) +vim.keymap.set("n", "s", ":w", { desc = "Save" }) + +-- formatting + +vim.keymap.set("n", "g=", "ggVG=", { desc = "Fix indentation in file" }) +vim.keymap.set("n", "zt", "%s/\t/ /g", { desc = "Replace tabs with spaces" }) +vim.keymap.set("n", "vag", "ggVG", { desc = "Visual select file contents" }) +vim.keymap.set("n", "dag", "ggVGd", { desc = "Delete file contents" }) +vim.keymap.set("n", "yag", "ggVGy", { desc = "Format paragraph" }) +vim.keymap.set("n", "cag", "ggVGc", { desc = "Format paragraph" }) +vim.keymap.set("n", "gJ", "Jx") + +-- macro + +vim.api.nvim_set_keymap("n", "", "qq", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", "", "q", { noremap = true, silent = true }) +vim.api.nvim_set_keymap("n", "", "@q", { noremap = true, silent = true }) + +-- suppression + +vim.opt.shortmess:append("A") -- https://stackoverflow.com/questions/1098159/vim-stop-existing-swap-file-warnings + +-- commands + +vim.keymap.set("n", "L", ":Lazy") +vim.keymap.set("n", "cp", "cp :let @+=expand('%:p')") +vim.keymap.set("n", "cm", ":cnext") +vim.keymap.set("n", "cl", ":cprev") + +vim.api.nvim_create_user_command("Kms", 'execute "SessionDelete" | quit', {}) + +-- splits + +vim.opt.splitright = true +vim.opt.splitbelow = true +vim.keymap.set("n", "", ":wincmd k", { silent = true }) +vim.keymap.set("n", "", ":wincmd j", { silent = true }) +vim.keymap.set("n", "", ":wincmd h", { silent = true }) +vim.keymap.set("n", "", ":wincmd l", { silent = true }) +vim.keymap.set("n", "", ":wincmd =", { silent = true }) +vim.keymap.set("n", "v", ":wincmd v", { silent = true }) +vim.keymap.set("n", "V", ":wincmd s", { noremap = true, silent = true }) +vim.keymap.set("n", "o", function() + -- get the current line content + local line = vim.api.nvim_get_current_line() + + -- extract the string (either single-quoted or double-quoted) + local str = line:match("'(.-)'") or line:match('"(.-)"') + + if str then + -- Construct the GitHub URL + local url = "https://github.com/" .. str + + -- use the open shell command to open the URL + os.execute("open " .. url) + else + print("No valid string found on the current line.") + end +end) + +-- vim.keymap.set('n', '', ':let @+ = "rspec " . substitute(expand("%:p"), getcwd() . "/", "", "") . ":" . line(".")') +vim.keymap.set("n", "", ':let @+ = "rspec " . substitute(expand("%:p"), getcwd() . "/", "", "")') +vim.keymap.set("n", "", ':let @+ = "rubocop " . substitute(expand("%:p"), getcwd() . "/", "", "")') + +vim.keymap.set("n", "", ':let @+ = substitute(expand("%:p"), getcwd() . "/", "", "")') +-- vim.keymap.set('n', '', ':let @+ = expand("%:p")') + +vim.api.nvim_create_user_command("Trim", ":%s/\\s\\+$//e", {}) diff --git a/.config/nvim/lua/theme.lua b/.config/nvim/lua/theme.lua new file mode 100644 index 0000000..2b007a2 --- /dev/null +++ b/.config/nvim/lua/theme.lua @@ -0,0 +1,14 @@ +if vim.o.background == "dark" then + vim.g.tokyonight_style = "night" + vim.g.tokyonight_transparent_background = 1 + vim.g.tokyonight_enable_italic = 1 + vim.cmd("colorscheme gruvbox") + -- vim.cmd("colorscheme vim") + vim.cmd("set bg=dark") +else + vim.o.background = "light" + -- vim.cmd("colorscheme solarized") + -- vim.cmd("colorscheme wildcharm") + vim.cmd("colorscheme polar") + vim.cmd("set bg=light") +end diff --git a/.config/nvim/lua/util.lua b/.config/nvim/lua/util.lua new file mode 100644 index 0000000..f98b06a --- /dev/null +++ b/.config/nvim/lua/util.lua @@ -0,0 +1,56 @@ +local function get_current_line() + return vim.api.nvim_get_current_line() +end + +local function extract_attribute_name(line) + return line:match("%s*(%w+)%s*;") +end + +vim.api.nvim_create_autocmd("TextYankPost", { + group = vim.api.nvim_create_augroup("highlight_yank", {}), + desc = "Hightlight selection on yank", + pattern = "*", + callback = function() + vim.highlight.on_yank({ higroup = "IncSearch", timeout = 100 }) + end, +}) + +local numbertoggle_group = vim.api.nvim_create_augroup("numbertoggle", { clear = true }) + +vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" }, { + group = numbertoggle_group, + pattern = "*", + callback = function() + if vim.wo.number and vim.fn.mode() ~= "i" then + vim.wo.relativenumber = true + end + end, +}) + +vim.api.nvim_create_autocmd({ "BufLeave", "FocusLost", "InsertEnter", "WinLeave" }, { + group = numbertoggle_group, + pattern = "*", + callback = function() + if vim.wo.number then + vim.wo.relativenumber = false + end + end, +}) + +function toggle_terminal() + local term_bufnr = nil + for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do + if vim.api.nvim_buf_get_option(bufnr, "buftype") == "terminal" then + term_bufnr = bufnr + break + end + end + + if term_bufnr then + vim.api.nvim_buf_delete(term_bufnr, { force = true }) + else + vim.cmd("vsplit | terminal") + end +end + +vim.keymap.set("n", "", toggle_terminal, { noremap = true, silent = true }) diff --git a/.config/nvim/stylua.toml b/.config/nvim/stylua.toml new file mode 100644 index 0000000..6090f42 --- /dev/null +++ b/.config/nvim/stylua.toml @@ -0,0 +1,6 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "Always" diff --git a/.config/nvim/vscode.lua b/.config/nvim/vscode.lua new file mode 100644 index 0000000..b40ec9c --- /dev/null +++ b/.config/nvim/vscode.lua @@ -0,0 +1,80 @@ +-- Options +vim.o.clipboard = "unnamedplus" +vim.g.mapleader = " " +vim.g.maplocalleader = "," + +-- Plugins + +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", + lazypath, + }) +end + +vim.opt.rtp:prepend(lazypath) + +local plugins = { + { + { + "tpope/vim-rails", + lazy = false, + ft = { "ruby" }, + }, + }, +} + +local opts = { defaults = { lazy = true }, change_detection = { notify = false } } + +require("lazy").setup(plugins, opts) + +-- Other +-- Borrowed from: https://github.com/milanglacier/nvim/blob/f54b7356dc97cbf9b07a77d5db1ad199c2ff3f2e/lua/conf/vscode.lua#L29 + +local M = {} + +local augroup = vim.api.nvim_create_augroup +local keymap = vim.api.nvim_set_keymap + +M.my_vscode = augroup("MyVSCode", {}) + +vim.filetype.add({ + pattern = { + [".*%.ipynb.*"] = "python", + }, +}) +local function notify(cmd) + return string.format("call VSCodeNotify('%s')", cmd) +end + +local function v_notify(cmd) + return string.format("call VSCodeNotifyVisual('%s', 1)", cmd) +end + +keymap("n", "xr", notify("references-view.findReferences"), { silent = true }) -- language references +keymap("n", "xd", notify("workbench.actions.view.problems"), { silent = true }) -- language diagnostics +keymap("n", "gr", notify("editor.action.goToReferences"), { silent = true }) +keymap("n", "rn", notify("editor.action.rename"), { silent = true }) +keymap("n", "fm", notify("editor.action.formatDocument"), { silent = true }) +keymap("n", "ca", notify("editor.action.refactor"), { silent = true }) -- language code actions + +keymap("n", "rg", notify("workbench.action.findInFiles"), { silent = true }) -- use ripgrep to search files +keymap("n", "ts", notify("workbench.action.toggleSidebarVisibility"), { silent = true }) +keymap("n", "th", notify("workbench.action.toggleAuxiliaryBar"), { silent = true }) -- toggle docview (help page) +keymap("n", "tp", notify("workbench.action.togglePanel"), { silent = true }) +keymap("n", "fc", notify("workbench.action.showCommands"), { silent = true }) -- find commands +keymap("n", "ff", notify("workbench.action.quickOpen"), { silent = true }) -- find files +keymap("n", "tw", notify("workbench.action.terminal.toggleTerminal"), { silent = true }) -- terminal window + +keymap("v", "fm", v_notify("editor.action.formatSelection"), { silent = true }) +keymap("v", "ca", v_notify("editor.action.refactor"), { silent = true }) +keymap("v", "fc", v_notify("workbench.action.showCommands"), { silent = true }) + +keymap("n", "r", notify("command.railsFastNavigation"), { silent = false }) + +return M diff --git a/.config/zellij/config.kdl b/.config/zellij/config.kdl new file mode 100644 index 0000000..6313e23 --- /dev/null +++ b/.config/zellij/config.kdl @@ -0,0 +1,517 @@ +// +// THIS FILE WAS AUTOGENERATED BY ZELLIJ, THE PREVIOUS FILE AT THIS LOCATION WAS COPIED TO: /Users/dani/.config/zellij/config.kdl.bak.2 +// + +pane_frames false +keybinds clear-defaults=true { + normal { + bind "Super [" { GoToPreviousTab; } + bind "Super ]" { GoToNextTab; } + bind "Super w" { CloseFocus; } + bind "Super n" { NewTab; } + bind "Super t" { NewTab; } + bind "Super z" { ToggleFocusFullscreen; } + bind "Super d" { NewPane "right"; } + bind "Super D" { NewPane "down"; } + bind "Super k" { Clear; } + } + locked { + bind "Alt g" { SwitchToMode "normal"; } + } + pane { + bind "left" { MoveFocus "left"; } + bind "down" { MoveFocus "down"; } + bind "up" { MoveFocus "up"; } + bind "right" { MoveFocus "right"; } + bind "c" { SwitchToMode "renamepane"; PaneNameInput 0; } + bind "d" { NewPane "down"; SwitchToMode "normal"; } + bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "normal"; } + bind "f" { ToggleFocusFullscreen; SwitchToMode "normal"; } + bind "h" { MoveFocus "left"; } + bind "i" { TogglePanePinned; SwitchToMode "normal"; } + bind "j" { MoveFocus "down"; } + bind "k" { MoveFocus "up"; } + bind "l" { MoveFocus "right"; } + bind "n" { NewPane; SwitchToMode "normal"; } + bind "p" { SwitchFocus; } + bind "Alt p" { SwitchToMode "normal"; } + bind "r" { NewPane "right"; SwitchToMode "normal"; } + bind "w" { ToggleFloatingPanes; SwitchToMode "normal"; } + bind "z" { TogglePaneFrames; SwitchToMode "normal"; } + } + tab { + bind "left" { GoToPreviousTab; } + bind "down" { GoToNextTab; } + bind "up" { GoToPreviousTab; } + bind "right" { GoToNextTab; } + bind "1" { GoToTab 1; SwitchToMode "normal"; } + bind "2" { GoToTab 2; SwitchToMode "normal"; } + bind "3" { GoToTab 3; SwitchToMode "normal"; } + bind "4" { GoToTab 4; SwitchToMode "normal"; } + bind "5" { GoToTab 5; SwitchToMode "normal"; } + bind "6" { GoToTab 6; SwitchToMode "normal"; } + bind "7" { GoToTab 7; SwitchToMode "normal"; } + bind "8" { GoToTab 8; SwitchToMode "normal"; } + bind "9" { GoToTab 9; SwitchToMode "normal"; } + bind "[" { BreakPaneLeft; SwitchToMode "normal"; } + bind "]" { BreakPaneRight; SwitchToMode "normal"; } + bind "b" { BreakPane; SwitchToMode "normal"; } + bind "h" { GoToPreviousTab; } + bind "j" { GoToNextTab; } + bind "k" { GoToPreviousTab; } + bind "l" { GoToNextTab; } + bind "n" { NewTab; SwitchToMode "normal"; } + bind "r" { SwitchToMode "renametab"; TabNameInput 0; } + bind "s" { ToggleActiveSyncTab; SwitchToMode "normal"; } + bind "Alt t" { SwitchToMode "normal"; } + bind "x" { CloseTab; SwitchToMode "normal"; } + bind "tab" { ToggleTab; } + } + resize { + bind "left" { Resize "Increase left"; } + bind "down" { Resize "Increase down"; } + bind "up" { Resize "Increase up"; } + bind "right" { Resize "Increase right"; } + bind "+" { Resize "Increase"; } + bind "-" { Resize "Decrease"; } + bind "=" { Resize "Increase"; } + bind "H" { Resize "Decrease left"; } + bind "J" { Resize "Decrease down"; } + bind "K" { Resize "Decrease up"; } + bind "L" { Resize "Decrease right"; } + bind "h" { Resize "Increase left"; } + bind "j" { Resize "Increase down"; } + bind "k" { Resize "Increase up"; } + bind "l" { Resize "Increase right"; } + bind "Alt n" { SwitchToMode "normal"; } + } + move { + bind "left" { MovePane "left"; } + bind "down" { MovePane "down"; } + bind "up" { MovePane "up"; } + bind "right" { MovePane "right"; } + bind "h" { MovePane "left"; } + bind "Alt h" { SwitchToMode "normal"; } + bind "j" { MovePane "down"; } + bind "k" { MovePane "up"; } + bind "l" { MovePane "right"; } + bind "n" { MovePane; } + bind "p" { MovePaneBackwards; } + bind "tab" { MovePane; } + } + scroll { + bind "Alt left" { MoveFocusOrTab "left"; SwitchToMode "normal"; } + bind "Alt down" { MoveFocus "down"; SwitchToMode "normal"; } + bind "Alt up" { MoveFocus "up"; SwitchToMode "normal"; } + bind "Alt right" { MoveFocusOrTab "right"; SwitchToMode "normal"; } + bind "e" { EditScrollback; SwitchToMode "normal"; } + bind "Alt j" { MoveFocus "down"; SwitchToMode "normal"; } + bind "Alt k" { MoveFocus "up"; SwitchToMode "normal"; } + bind "Alt l" { MoveFocusOrTab "right"; SwitchToMode "normal"; } + bind "s" { SwitchToMode "entersearch"; SearchInput 0; } + bind "Alt s" { SwitchToMode "normal"; } + } + search { + bind "c" { SearchToggleOption "CaseSensitivity"; } + bind "n" { Search "down"; } + bind "o" { SearchToggleOption "WholeWord"; } + bind "p" { Search "up"; } + bind "Ctrl s" { SwitchToMode "normal"; } + bind "w" { SearchToggleOption "Wrap"; } + } + session { + bind "a" { + LaunchOrFocusPlugin "zellij:about" { + floating true + move_to_focused_tab true + } + SwitchToMode "normal" + } + bind "c" { + LaunchOrFocusPlugin "configuration" { + floating true + move_to_focused_tab true + } + SwitchToMode "normal" + } + bind "Alt o" { SwitchToMode "normal"; } + bind "p" { + LaunchOrFocusPlugin "plugin-manager" { + floating true + move_to_focused_tab true + } + SwitchToMode "normal" + } + bind "w" { + LaunchOrFocusPlugin "session-manager" { + floating true + move_to_focused_tab true + } + SwitchToMode "normal" + } + } + shared_among "normal" "locked" { + bind "Alt Shift left" { MoveFocusOrTab "left"; } + bind "Alt Shift down" { MoveFocus "down"; } + bind "Alt Shift up" { MoveFocus "up"; } + bind "Alt Shift right" { MoveFocusOrTab "right"; } + bind "Alt Shift +" { Resize "Increase"; } + bind "Alt Shift -" { Resize "Decrease"; } + bind "Alt Shift =" { Resize "Increase"; } + bind "Alt Shift [" { PreviousSwapLayout; } + bind "Alt Shift ]" { NextSwapLayout; } + bind "Alt Shift f" { ToggleFloatingPanes; } + bind "Alt Shift h" { MoveFocusOrTab "left"; } + bind "Alt Shift i" { MoveTab "left"; } + bind "Alt Shift j" { MoveFocus "down"; } + bind "Alt Shift k" { MoveFocus "up"; } + bind "Alt Shift l" { MoveFocusOrTab "right"; } + bind "Alt Shift n" { NewPane; } + bind "Alt Shift o" { MoveTab "right"; } + } + shared_except "locked" "entersearch" "renametab" "renamepane" "move" "prompt" "tmux" { + bind "Alt h" { SwitchToMode "move"; } + } + shared_except "locked" "entersearch" "renametab" "renamepane" "prompt" "tmux" { + bind "Alt g" { SwitchToMode "locked"; } + bind "Alt q" { Quit; } + } + shared_except "locked" "entersearch" "renametab" "renamepane" "session" "prompt" "tmux" { + bind "Alt o" { SwitchToMode "session"; } + } + shared_except "locked" "scroll" "search" "tmux" { + bind "Ctrl b" { SwitchToMode "tmux"; } + } + shared_except "locked" "scroll" "entersearch" "renametab" "renamepane" "prompt" "tmux" { + bind "Alt s" { SwitchToMode "scroll"; } + } + shared_except "locked" "tab" "entersearch" "renametab" "renamepane" "prompt" "tmux" { + bind "Alt t" { SwitchToMode "tab"; } + } + shared_except "locked" "pane" "entersearch" "renametab" "renamepane" "prompt" "tmux" { + bind "Alt p" { SwitchToMode "pane"; } + } + shared_except "locked" "resize" "entersearch" "renametab" "renamepane" "prompt" "tmux" { + bind "Alt n" { SwitchToMode "resize"; } + } + shared_except "normal" "locked" { + bind "Alt +" { Resize "Increase"; } + bind "Alt -" { Resize "Decrease"; } + bind "Alt =" { Resize "Increase"; } + bind "Alt [" { PreviousSwapLayout; } + bind "Alt ]" { NextSwapLayout; } + bind "Alt f" { ToggleFloatingPanes; } + bind "Alt i" { MoveTab "left"; } + } + shared_except "normal" "locked" "entersearch" { + bind "enter" { SwitchToMode "normal"; } + } + shared_except "normal" "locked" "entersearch" "renametab" "renamepane" { + bind "esc" { SwitchToMode "normal"; } + } + shared_except "normal" "locked" "scroll" { + bind "Alt left" { MoveFocusOrTab "left"; } + bind "Alt down" { MoveFocus "down"; } + bind "Alt up" { MoveFocus "up"; } + bind "Alt right" { MoveFocusOrTab "right"; } + bind "Alt j" { MoveFocus "down"; } + bind "Alt k" { MoveFocus "up"; } + bind "Alt l" { MoveFocusOrTab "right"; } + } + shared_among "pane" "tmux" { + bind "x" { CloseFocus; SwitchToMode "normal"; } + } + shared_among "scroll" "search" { + bind "PageDown" { PageScrollDown; } + bind "PageUp" { PageScrollUp; } + bind "left" { PageScrollUp; } + bind "down" { ScrollDown; } + bind "up" { ScrollUp; } + bind "right" { PageScrollDown; } + bind "Ctrl b" { PageScrollUp; } + bind "Ctrl c" { ScrollToBottom; SwitchToMode "normal"; } + bind "d" { HalfPageScrollDown; } + bind "Ctrl f" { PageScrollDown; } + bind "h" { PageScrollUp; } + bind "j" { ScrollDown; } + bind "k" { ScrollUp; } + bind "l" { PageScrollDown; } + bind "u" { HalfPageScrollUp; } + } + entersearch { + bind "Ctrl c" { SwitchToMode "scroll"; } + bind "esc" { SwitchToMode "scroll"; } + bind "enter" { SwitchToMode "search"; } + } + shared_among "entersearch" "renametab" "renamepane" "prompt" "tmux" { + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl h" { SwitchToMode "move"; } + bind "Alt h" { MoveFocusOrTab "left"; } + bind "Ctrl n" { SwitchToMode "resize"; } + bind "Alt n" { NewPane; } + bind "Ctrl o" { SwitchToMode "session"; } + bind "Alt o" { MoveTab "right"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Ctrl q" { Quit; } + bind "Ctrl s" { SwitchToMode "scroll"; } + bind "Ctrl t" { SwitchToMode "tab"; } + } + renametab { + bind "esc" { UndoRenameTab; SwitchToMode "tab"; } + } + shared_among "renametab" "renamepane" { + bind "Ctrl c" { SwitchToMode "normal"; } + } + renamepane { + bind "esc" { UndoRenamePane; SwitchToMode "pane"; } + } + shared_among "session" "tmux" { + bind "d" { Detach; } + } + tmux { + bind "left" { MoveFocus "left"; SwitchToMode "normal"; } + bind "down" { MoveFocus "down"; SwitchToMode "normal"; } + bind "up" { MoveFocus "up"; SwitchToMode "normal"; } + bind "right" { MoveFocus "right"; SwitchToMode "normal"; } + bind "space" { NextSwapLayout; } + bind "\"" { NewPane "down"; SwitchToMode "normal"; } + bind "%" { NewPane "right"; SwitchToMode "normal"; } + bind "," { SwitchToMode "renametab"; } + bind "[" { SwitchToMode "scroll"; } + bind "Ctrl b" { Write 2; SwitchToMode "normal"; } + bind "c" { NewTab; SwitchToMode "normal"; } + bind "h" { MoveFocus "left"; SwitchToMode "normal"; } + bind "j" { MoveFocus "down"; SwitchToMode "normal"; } + bind "k" { MoveFocus "up"; SwitchToMode "normal"; } + bind "l" { MoveFocus "right"; SwitchToMode "normal"; } + bind "n" { GoToNextTab; SwitchToMode "normal"; } + bind "o" { FocusNextPane; } + bind "p" { GoToPreviousTab; SwitchToMode "normal"; } + bind "z" { ToggleFocusFullscreen; SwitchToMode "normal"; } + } +} + +// Plugin aliases - can be used to change the implementation of Zellij +// changing these requires a restart to take effect +plugins { + about location="zellij:about" + compact-bar location="zellij:compact-bar" + configuration location="zellij:configuration" + filepicker location="zellij:strider" { + cwd "/" + } + plugin-manager location="zellij:plugin-manager" + session-manager location="zellij:session-manager" + status-bar location="zellij:status-bar" + strider location="zellij:strider" + tab-bar location="zellij:tab-bar" + welcome-screen location="zellij:session-manager" { + welcome_screen true + } +} + +// Plugins to load in the background when a new session starts +// eg. "file:/path/to/my-plugin.wasm" +// eg. "https://example.com/my-plugin.wasm" +load_plugins { + "https://github.com/dj95/zjstatus/releases/download/latest/zjstatus.wasm" +} + +// Use a simplified UI without special fonts (arrow glyphs) +// Options: +// - true +// - false (Default) +// +simplified_ui true + +// Choose the theme that is specified in the themes section. +// Default: default +// +// theme "tokyo-night-dark" +theme "gruvbox-dark" +// theme "ayu-light" +// theme "iceberg-light" + +// Choose the base input mode of zellij. +// Default: normal +// +// default_mode "normal" + +// Choose the path to the default shell that zellij will use for opening new panes +// Default: $SHELL +// +// default_shell "fish" + +// Choose the path to override cwd that zellij will use for opening new panes +// +// default_cwd "/tmp" + +// The name of the default layout to load on startup +// Default: "default" +// +default_layout "compact" + +// The folder in which Zellij will look for layouts +// (Requires restart) +// +// layout_dir "/tmp" + +// The folder in which Zellij will look for themes +// (Requires restart) +// +// theme_dir "/tmp" + +// Toggle enabling the mouse mode. +// On certain configurations, or terminals this could +// potentially interfere with copying text. +// Options: +// - true (default) +// - false +// +// mouse_mode false + +// Toggle having pane frames around the panes +// Options: +// - true (default, enabled) +// - false +// + +// When attaching to an existing session with other users, +// should the session be mirrored (true) +// or should each user have their own cursor (false) +// (Requires restart) +// Default: false +// +// mirror_session true + +// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP +// eg. when terminal window with an active zellij session is closed +// (Requires restart) +// Options: +// - detach (Default) +// - quit +// +// on_force_close "quit" + +// Configure the scroll back buffer size +// This is the number of lines zellij stores for each pane in the scroll back +// buffer. Excess number of lines are discarded in a FIFO fashion. +// (Requires restart) +// Valid values: positive integers +// Default value: 10000 +// +// scroll_buffer_size 10000 + +// Provide a command to execute when copying text. The text will be piped to +// the stdin of the program to perform the copy. This can be used with +// terminal emulators which do not support the OSC 52 ANSI control sequence +// that will be used by default if this option is not set. +// Examples: +// +// copy_command "xclip -selection clipboard" // x11 +// copy_command "wl-copy" // wayland +// copy_command "pbcopy" // osx +// +// copy_command "pbcopy" + +// Choose the destination for copied text +// Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard. +// Does not apply when using copy_command. +// Options: +// - system (default) +// - primary +// +// copy_clipboard "primary" + +// Enable automatic copying (and clearing) of selection when releasing mouse +// Default: true +// +// copy_on_select true + +// Path to the default editor to use to edit pane scrollbuffer +// Default: $EDITOR or $VISUAL +// scrollback_editor "/usr/bin/vim" + +// A fixed name to always give the Zellij session. +// Consider also setting `attach_to_session true,` +// otherwise this will error if such a session exists. +// Default: +// +// session_name "My singleton session" + +// When `session_name` is provided, attaches to that session +// if it is already running or creates it otherwise. +// Default: false +// +// attach_to_session true + +// Toggle between having Zellij lay out panes according to a predefined set of layouts whenever possible +// Options: +// - true (default) +// - false +// +// auto_layout false + +// Whether sessions should be serialized to the cache folder (including their tabs/panes, cwds and running commands) so that they can later be resurrected +// Options: +// - true (default) +// - false +// +// session_serialization false + +// Whether pane viewports are serialized along with the session, default is false +// Options: +// - true +// - false (default) +// +// serialize_pane_viewport false + +// Scrollback lines to serialize along with the pane viewport when serializing sessions, 0 +// defaults to the scrollback size. If this number is higher than the scrollback size, it will +// also default to the scrollback size. This does nothing if `serialize_pane_viewport` is not true. +// +// scrollback_lines_to_serialize 10000 + +// Enable or disable the rendering of styled and colored underlines (undercurl). +// May need to be disabled for certain unsupported terminals +// (Requires restart) +// Default: true +// +// styled_underlines false + +// How often in seconds sessions are serialized +// +// serialization_interval 10000 + +// Enable or disable writing of session metadata to disk (if disabled, other sessions might not know +// metadata info on this session) +// (Requires restart) +// Default: false +// +// disable_session_metadata false + +// Enable or disable support for the enhanced Kitty Keyboard Protocol (the host terminal must also support it) +// (Requires restart) +// Default: true (if the host terminal supports it) +// +// support_kitty_keyboard_protocol false + +// Whether to stack panes when resizing beyond a certain size +// Default: true +// +// stacked_resize false + +show_startup_tips false +show_release_notes false +// keybinds { +// bind "Super c" { Copy; } +// bind "Super [" { GoToPreviousTab; } +// bind "Super ]" { GoToNextTab; } +// bind "Super w" { CloseFocus; } +// bind "Super n" { NewTab; } +// bind "Super t" { NewTab; } +// bind "Super d" { NewPane "right"; } +// bind "Super D" { NewPane "down"; } +// bind "Super k" { Clear; } +// } + diff --git a/.config/zellij/layouts/rails.kdl b/.config/zellij/layouts/rails.kdl new file mode 100644 index 0000000..2712fca --- /dev/null +++ b/.config/zellij/layouts/rails.kdl @@ -0,0 +1,28 @@ +layout { + default_tab_template { + children + pane size=1 borderless=true { + plugin location="compact-bar" + } + } + tab name="Editor" { + pane command="/opt/homebrew/bin/nvim" + } + tab name="run" focus=true { + pane split_direction="vertical" { + pane command="tail" { + args "-f" "./log/development.log" + } + pane command="/Users/dani/.local/bin/mise" { + args "exec" "-c" "bundle exec rails console" + } + } + pane + } + tab name="srv" { + pane command="/Users/dani/.local/bin/mise" { + args "exec" "-c" "bundle exec rails server" + } + } +} + diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..71e9f7f --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,50 @@ +name: Neovim Checks + +on: + push: + branches: [ main ] + #paths: + # - '.config/nvim/**' + pull_request: + branches: [ main ] + # paths: + # - '.config/nvim/**' + workflow_dispatch: + +jobs: + nvim-checks: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Neovim + uses: rhysd/action-setup-vim@v1 + with: + neovim: true + version: stable + + - uses: asdf-vm/actions/setup@v3 + + - name: Install asdf plugins + run: | + asdf plugin add nodejs || true + asdf plugin add ruby || true + + - name: Install versions from .tool-versions + working-directory: .config/nvim + run: asdf install + + - name: Install StyLua + run: cargo install stylua + + - name: Run fast checks (linting) + working-directory: .config/nvim + run: ./bin/lint + + - name: Sync Lazy + run: nvim --headless "+Lazy sync" +qall + + - name: Run health checks + working-directory: .config/nvim + run: ./bin/check diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..e6fd4dd --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,69 @@ +name: Format Check + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + format-check: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: 'stable' + + - name: Install formatters + run: | + # Install StyLua for Lua formatting + cargo install stylua + + # Install shfmt for shell formatting + go install mvdan.cc/sh/v3/cmd/shfmt@latest + + # Install prettier for TypeScript/JavaScript + npm install -g prettier + + # Add Go bin to PATH + echo "$HOME/go/bin" >> $GITHUB_PATH + + - name: Create directories for fastcheck scripts + run: | + mkdir -p bin + mkdir -p neovim + mkdir -p scripts + + - name: Run bin/fastcheck + run: ./bin/fastcheck + + - name: Run neovim/fastcheck + run: ./neovim/fastcheck + + - name: Run scripts/fastcheck + run: ./scripts/fastcheck + + - name: Check if files were modified + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Files were modified by formatting. Please run the fastcheck scripts locally and commit the changes." + git diff + exit 1 + else + echo "All files are properly formatted!" + fi \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ef89d67 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +**/node_modules/** +**/.DS_Store/** +**/.ignore/** +**/*.log + diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 0000000..098c21a --- /dev/null +++ b/.tmux.conf @@ -0,0 +1,80 @@ +unbind C-b +set -g prefix C-s +bind a send-prefix + +# bind r source-file ~/.tmux.conf \; display-message "Config reloaded..." + +bind - split-window -v -c "#{pane_current_path}" +unbind '"' +unbind % +bind | split-window -h -c "#{pane_current_path}" +bind c new-window -c "#{pane_current_path}" + +bind g + +setw -g mode-keys vi +bind-key h select-pane -L +bind-key j select-pane -D +bind-key k select-pane -U +bind-key l select-pane -R +# set -g window-size latest +# setw -g aggressive-resize on + +bind r source-file ~/.tmux.conf; + +# set-hook -g after-kill-pane 'select-layout -E' +# set-hook -g pane-exited 'select-layout -E' +# set-hook -g window-pane-changed 'select-layout -E' +# set-hook -g client-resized 'select-layout -E' + +set -g mouse on +set -g default-terminal "screen-256color" +set -ag terminal-overrides ",xterm-256color:RGB" +set-option -g status-position top +set-option -g status on +set-option -g renumber-windows on +set -g pane-border-lines "single" +set -s escape-time 1 +set -g base-index 0 +set -g pane-active-border-style "bg=default,fg=colour233" +set -g pane-border-style "bg=default,fg=colour235" + +# Some hacks for OSX Alacritty audio bell +set -g monitor-bell on +set -g bell-action other +set-hook -g alert-bell 'run-shell "afplay /System/Library/Sounds/Funk.aiff"' + +set -g focus-events on +#set-hook -g pane-focus-out 'select-pane -P bg=colour235,fg=colour10' +#set-hook -g pane-focus-in 'select-pane -P bg=default,fg=default' + +# set-hook -g pane-focus-out 'select-pane -P bg=colour233,fg=colour10' +# set-hook -g pane-focus-out 'select-pane -P bg=colour233,fg=default' +# set-hook -g pane-focus-in 'select-pane -P bg=default,fg=default' + +# List of plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'tmux-plugins/tmux-prefix-highlight' +set -g @plugin 'jimeh/tmuxifier' +set -g @plugin 'christoomey/vim-tmux-navigator' +# set -g @plugin 'arcticicestudio/nord-tmux' + +run-shell "~/my-status-bar.tmux" +# set -g @plugin 'erikw/tmux-powerline' + +# Not working :/ +# set -g @plugin 'b0o/tmux-autoreload' +# set -g @tmux-autoreload-entrypoints '~/.tmux.conf' + +# Powertab +# set -g @plugin 'jabirali/tmux-powertab' +# set -g @powertab-powerline 'on' +# set -g @powertab-pathname on +# set -g @powertab-foreground '#1d1d1d' + +# Power +# set -g @plugin 'wfxr/tmux-power' +# set -g @tmux_power_theme '#1000001' + +run '~/.tmux/plugins/tpm/tpm' diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..03d5f01 --- /dev/null +++ b/.tool-versions @@ -0,0 +1,2 @@ +ruby 3.2.3 +nodejs 20.11.0 diff --git a/.zshrc b/.zshrc index c7aa615..cbb0633 100644 --- a/.zshrc +++ b/.zshrc @@ -1,195 +1,183 @@ -source ~/.import-secrets.sh - - -if [ "$TERM_PROGRAM" = "WarpTerminal" ] && [ "$TERMINAL_EMULATOR" != "JetBrains-JediTerm" ]; then - printf '\eP$f{"hook": "SourcedRcFileForWarp", "value": { "shell": "zsh"}}\x9c' -else - [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh - - source /opt/homebrew/share/antigen/antigen.zsh - antigen apply - - if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then - source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" - fi -fi - -# BEGIN mood-nvim https://github.com/otavioschwanck/mood-nvim/wiki/Manual-Installation#manual-installation -if [ -n "$NVIM_LISTEN_ADDRESS" ]; then - alias nvim=nvr -cc split --remote-wait +'set bufhidden=wipe' -fi - -if [ -n "$NVIM_LISTEN_ADDRESS" ]; then - export VISUAL="nvr -cc split --remote-wait +'set bufhidden=wipe'" - export EDITOR="nvr -cc split --remote-wait +'set bufhidden=wipe'" -else - export VISUAL="nvim" - export EDITOR="nvim" -fi -# END mood-nvim - -export PATH="$HOME/.jenv/bin:$PATH" -export PATH="~/renuo/personal/rails-generator/bin:$PATH" -export PATH="~/.asdf/shims/:$PATH" -export BUN_INSTALL="$HOME/.bun" -export PATH="$BUN_INSTALL/bin:$PATH" -export PATH=~/dev/flutter/bin:$PATH -export PATH="/Users/dani/.gem/ruby/3.2.0/bin:$PATH" -export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES # fix libcurl error -source $HOMEBREW_PREFIX/share/zsh-autocomplete/zsh-autocomplete.plugin.zsh -source "$(brew --prefix)/share/google-cloud-sdk/path.zsh.inc" -source "$(brew --prefix)/share/google-cloud-sdk/completion.zsh.inc" - -[ -s "/Users/dani/.bun/_bun" ] && source "/Users/dani/.bun/_bun" -source /opt/homebrew/opt/autojump/etc/autojump.sh -source "$HOME/.cargo/env" -source /opt/homebrew/opt/asdf/libexec/asdf.sh - -eval $(thefuck --alias) -eval "$(jenv init -)" -eval "$(fzf --zsh)" - -alias ls="eza" -alias l="ls -lah" -alias go="~/scripts/js/open-repo-in-browser.ts" -alias gtable="~/scripts/js/git-smart-log.ts" -alias gitcopy='~/scripts/copy_remote_to_clipboard.sh' -alias cscript='~/scripts/create_executable_script.sh' -alias timelog='bun ~/scripts/js/my-ticketing-query/index.ts' -alias crails='~/renuo/personal/rails-generator/bin/crails' -alias openticket='~/scripts/js/open-ticket-in-browser.ts' -alias ot='~/scripts/js/open-ticket-in-browser.ts' -alias prt='~/scripts/js/get-pr-template.ts' -alias cpt='~/scripts/js/copy-ticket-number.ts' -alias '..'='cd ..' -alias '...'='cd ../../' - -function rr() { rustc "$@.rs" && ./"$@"} # [r]ust [r]un - -alias zshrc='nvim ~/.zshrc' # Idea from Chris -alias g="grep" # [g]rep -alias bra="bundle exec rubocop -A" # [b]undle exec [r]ubocop -[A] -alias spec="be rspec" -alias f="fork ." -alias rsf='be rspec spec/$(cd spec/ && fzf)' # [r][s]pec [f]uzzy find -alias nvcon="cd ~/.config/nvim && nvim init.lua" - -alias glog_="git log --pretty=format:'%D %n %C(yellow)%h %C(reset)%ad %C(reset)%s' --date=format:'%d-%m-%Y %H:%M'" -alias glog="glog_ | grep -v -e '^\s*$' --color=always | less --use-color" -alias glag="glog_ --all --since='00:00' --until='NOW' | grep -v -e '^\s*$' --color=always" -alias gb="if ( git branch | grep '* develop' ); then; git checkout -b ; else; echo 'You can only start a new feature from the development branch' ;fi;" -alias gs="git status" -alias gp="git push" -alias gpp="git pull && git push" -alias gpl="git pull" # [g]it [p]u[l]l -alias gc="git commit" # [g]it [c]ommit -alias ga="git add" -alias gac="git add . && git commit" # [g]it [a]dd and [c]ommit -# alias gpsup="git push –-set-upstream origin $(git_current_branch)" -alias lg="lazygit" -alias gcl="git clone" -alias gss="git stash" -alias cl="clear" -# IDEA: gsf TICKET NAME => git checkout -b feature/TICKET-NAME + check if user on develop -# IDEA: grd => git pull origin develop && fork . => rebase - -alias python="python3" -alias o="open" -alias q="exit" -alias be="bundle exec" -alias qlf='qlmanage -p "$@"' -alias mine='rubymine .' -alias m='rubymine .' -alias bc="bin/check" -alias br="bin/run" -alias bd="bin/dev" -alias yd="yarn dev" -alias yt="yarn test" -alias brc="be rspec --format doc" # [b]undle [e]xec run [c]hecks -alias nvimc="cd ~/.config/nvim && nvim ." -alias gcf="git checkout -b feature/" -alias rr="rails routes | grep" -alias c="code" -alias bat="bat --style plain " -alias cat="bat" -alias gdu="git diff @{upstream}" -alias spf="~/bin/spf" - -alias gch="git checkout" - -alias gcf="git checkout -b feature/" - -reimport_abbr() { - rm -rf $ABBR_TMPDIR - rm $ABBR_USER_ABBREVIATIONS_FILE - abbr import-aliases +export ZSH="$HOME/.oh-my-zsh" + +set -o vi + + # https://github.com/ohmyzsh/ohmyzsh/wiki/Themes + ZSH_THEME="robbyrussell" + + plugins=( + bundler + fzf + git + brew + bun + you-should-use + zsh-vi-mode + fast-syntax-highlighting + rust + zsh-autocomplete + ) + + source $HOME/.import-secrets.sh + source $ZSH/oh-my-zsh.sh + source $HOME/.cargo/env + source "$HOME/.cargo/env" + + [[ -f local_zsh ]] && source local_zsh + + # unalias sd + + DISABLE_AUTO_TITLE="true" + + export LANG=en_US.UTF-8 + export EDITOR=nvim + export THOR_MERGE="nvim -d $2 $1" + export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES + + [ -f /opt/homebrew/etc/profile.d/autojump.sh ] && . /opt/homebrew/etc/profile.d/autojump.sh + + export BUN_INSTALL="$HOME/.bun" + export PATH="$BUN_INSTALL/bin:$PATH" + export PATH="$HOME/bin:$PATH" + export PATH="/opt/homebrew/opt/mysql@8.4/bin:$PATH" + export PATH="/Applications/Sublime Text.app/Contents/SharedSupport/bin:$PATH" + export PATH=$HOME/development/flutter/bin:$PATH + export PATH=$HOME/cmdline-tools/bin:$PATH + # export LDFLAGS="-L/opt/homebrew/opt/mysql@8.4/lib" + # export CPPFLAGS="-I/opt/homebrew/opt/mysql@8.4/include" + export PKG_CONFIG_PATH="/opt/homebrew/opt/mysql@8.4/lib/pkgconfig" + + # mysql stuff +export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib" +export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include" +export LIBRARY_PATH=$LIBRARY_PATH:$(brew --prefix zstd)/lib/ + + alias l='ls -1A' + alias v="nvim" + alias go='~/scripts/open-repo-in-browser.ts' + + alias myip="ipconfig getifaddr en0" + alias pubip="curl ifconfig.me" + alias gg="lazygit" + alias bra="bundle exec rubocop -A" + alias bsf="bundle exec standardrb --fix" + alias ctags="`brew --prefix`/bin/ctags" + alias o="open" + # alias c="cursor" + alias c="code" + alias grr='gradle run' + + # config + alias cnvim="cd ~/.config/nvim && $EDITOR init.lua" + alias vimrc="$EDITOR ~/.vimrc" + alias zshrc="$EDITOR ~/.zshrc" + alias bashrc="$EDITOR ~/.bashrc" + alias ohmyzsh="$EDITOR ~/.oh-my-zsh" + alias clg="$EDITOR ~/Library/Application\ Support/lazygit/config.yml" + alias cgit="$EDITOR ~/.gitconfig" + alias zj="zellij" + alias zjc="v ~/.config/zellij/config.kdl" + alias zjlc="v ~/.config/zellij/layouts/my_layout.kdl" + alias gac="git add . && git commit --verbose" + alias prc="v /Users/dani/prompts/README.md" + alias fr='find . | rg ' + alias ff='hyfetch -C ~/.config/hyfetch/hyfetch.json' + alias cvu='~/scripts/simplecov_parser.rb -u' + alias vo='v $(fzf)' + + # Created by `pipx` on 2024-12-12 09:25:29 + export PATH="$PATH:/Users/dani/.local/bin" + + set_terminal_title() { + git_branch=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') + repo_name=$(basename "$(git rev-parse --show-toplevel 2> /dev/null)") + echo -ne "\e]1;${repo_name} - ${git_branch}\a" + } + export PROMPT_COMMAND="$PROMPT_COMMAND; set_terminal_title" + precmd() { set_terminal_title } + + + alias y='yazi' + + alias jr='javac -d bin src/**/*.java; java -cp bin ch.zhaw.prog1.farm.Farm' + alias gs='git status --porcelain=v1' + alias gsm='git status --porcelain | awk '\''{ print $2 }'\''' + jsf() { + find . -name "*.java" | fzf --preview 'echo {}' | xargs java + } + + alias fg='ls -1 | rg' + alias bc='bin/check' + alias br='bin/run' + alias bcu='bin/check_unit_tests' + alias bd='bin/dev' + alias rails_tree="tree -I 'storage|log|tmp|node_modules|.git|public/system|public/uploads' -L 5 | bat" + alias rails_tree_minimal=" tree -I 'db|bin|assets|config|views|storage|log|tmp|node_modules|public|.git|public/system|public/uploads' -L 5 | bat" + + export SSH_AUTH_SOCK=~/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock + +# The next line updates PATH for the Google Cloud SDK. +if [ -f '/Users/dani/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/dani/google-cloud-sdk/path.zsh.inc'; fi + +# The next line enables shell command completion for gcloud. +if [ -f '/Users/dani/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/dani/google-cloud-sdk/completion.zsh.inc'; fi + +# Zellij + +zellij_tab_name_update() { + if [[ -n $ZELLIJ ]]; then + local current_dir=$PWD + if [[ $current_dir == $HOME ]]; then + current_dir="~" + else + current_dir=${current_dir##*/} + fi + command nohup zellij action rename-tab $current_dir >/dev/null 2>&1 + fi } -backup_directory() { - if [ -z "$1" ]; then - echo "Please provide a directory to backup" - return - fi +zellij_tab_name_update +chpwd_functions+=(zellij_tab_name_update) - directory_name_with_timestamp_suffix=$1-$(date +%Y-%m-%d:%H:%M:%S) - cp -r "$1" "$directory_name_with_timestamp_suffix" - printf "Backup created at $directory_name_with_timestamp_suffix" -} +eval "$(~/.local/bin/mise activate zsh)" -compinit -C +## [Completion] +## Completion scripts setup. Remove the following line to uninstall +[[ -f /Users/dani/.dart-cli-completion/zsh-config.zsh ]] && . /Users/dani/.dart-cli-completion/zsh-config.zsh || true +## [/Completion] -# BEGIN zsh-sticky-prompt -ZLE_STICKY_PROMPT_LEFT="" -ZLE_STICKY_PROMPT_RIGHT="" +export PATH="/opt/homebrew/opt/mysql-client@8.4/bin:$PATH" +export PATH="$HOME/.local/bin:$PATH" -sticky-prompt-zle-line-init() { - LBUFFER="$ZLE_STICKY_PROMPT_LEFT" - RBUFFER="$ZLE_STICKY_PROMPT_RIGHT" - zle _zle-line-init -} +alias parallel='/opt/homebrew/Cellar/parallel/20250722/bin/parallel' -sticky-prompt-set() { - if [[ -z "$BUFFER" ]]; then - if [[ -z "$ZLE_STICKY_PROMPT_LEFT" ]]; then - zle -M "No sticky prompt set." - else - ZLE_STICKY_PROMPT_LEFT="" - ZLE_STICKY_PROMPT_RIGHT="" - zle -M "Removed sticky prompt." - fi - return - fi - - local ZLE_STICKY_PROMPT_PREV_LEFT="$ZLE_STICKY_PROMPT_LEFT" - local ZLE_STICKY_PROMPT_PREV_RIGHT="$ZLE_STICKY_PROMPT_RIGHT" - ZLE_STICKY_PROMPT_LEFT="$LBUFFER" - ZLE_STICKY_PROMPT_RIGHT="$RBUFFER" - - if { [[ -n "$ZLE_STICKY_PROMPT_LEFT" ]] && [[ "$ZLE_STICKY_PROMPT_PREV_LEFT" != "$ZLE_STICKY_PROMPT_LEFT" ]]; } || - { [[ -n "$ZLE_STICKY_PROMPT_RIGHT" ]] && [[ "$ZLE_STICKY_PROMPT_PREV_RIGHT" != "$ZLE_STICKY_PROMPT_RIGHT" ]]; }; then - zle -M "Sticky prompt $ZLE_STICKY_PROMPT_LEFT|$ZLE_STICKY_PROMPT_RIGHT" - else - ZLE_STICKY_PROMPT_LEFT="" - ZLE_STICKY_PROMPT_RIGHT="" - BUFFER="" - zle -M "Removed sticky prompt." - fi -} +# deploio completion +fpath=(~/.local/share/zsh/site-functions $fpath) +autoload -Uz compinit && compinit +autoload -U _deploio 2>/dev/null +compdef _deploio deploio depl 2>/dev/null -sticky-prompt-accept-line() { - if [[ -z "$BUFFER" ]] && [[ -n "$ZLE_STICKY_PROMPT_LEFT" ]]; then - ZLE_STICKY_PROMPT_LEFT="" - ZLE_STICKY_PROMPT_RIGHT="" - zle -M "Removed sticky prompt." - fi - zle .accept-line -} +fpath=(~/.config/zsh/completions $fpath) +autoload -U compinit && compinit -functions[_zle-line-init]="${functions[zle-line-init]}" -zle -N _zle-line-init -zle -N zle-line-init sticky-prompt-zle-line-init -zle -N sticky-prompt-set -zle -N accept-line sticky-prompt-accept-line -bindkey '^S' sticky-prompt-set +nvimfuzzysearch() { + local sel + sel=$( + fzf --ansi --disabled \ + --prompt='rg> ' \ + --header='Type to search. Enter opens in nvim' \ + --bind "change:reload:rg --line-number --no-heading --color=always --smart-case --hidden -g '!.git' {q} || true" \ + --delimiter=':' \ + --preview 'bat --style=plain --color=always {1} --highlight-line {2}' \ + --preview-window='up:60%' + ) || return + + [ -n "$sel" ] || return + nvim "+$(cut -d: -f2 <<<"$sel")" "$(cut -d: -f1 <<<"$sel")" +} +alias vf='nvimfuzzysearch' +alias docker-compose='docker compose' +fpath+=/Users/dani/.zfunc -# END zsh-sticky-prompt +# Load Angular CLI autocompletion. +source <(ng completion script) diff --git a/Brewfile b/Brewfile new file mode 100644 index 0000000..95c61b7 --- /dev/null +++ b/Brewfile @@ -0,0 +1,38 @@ +# Core tools +brew "git" +brew "neovim" +brew "curl" +brew "wget" + +# Language version managers +brew "mise" + +# Development tools +brew "ruby-build" # Needed for mise to install Ruby +brew "openssl@3" # Dependency for ruby-build +brew "libyaml" # Dependency for ruby-build +brew "libffi" # Dependency for ruby-build + +# Search and file tools (commonly used with nvim) +brew "ripgrep" # rg - fast grep alternative +brew "fd" # fd - fast find alternative +brew "fzf" # fuzzy finder +brew "bat" # cat with syntax highlighting +brew "tree" # directory tree viewer + +# Git tools +brew "lazygit" # Git TUI + +# Terminal multiplexer +brew "tmux" # Terminal multiplexer +brew "zellij" # Modern terminal workspace + +# LSP and formatters that might be needed +brew "lua-language-server" +brew "stylua" # Lua formatter + +# Additional utilities +brew "jq" # JSON processor +brew "yq" # YAML processor +brew "htop" # Process viewer +brew "watch" # Execute command repeatedly \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..da48d9e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,92 @@ +# Use Ubuntu as base image +FROM ubuntu:22.04 + +# Set environment variables +ENV DEBIAN_FRONTEND=noninteractive +ENV HOMEBREW_NO_ANALYTICS=1 +ENV HOMEBREW_NO_INSECURE_REDIRECT=1 +ENV HOMEBREW_CASK_OPTS="--require-sha" + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + build-essential \ + curl \ + file \ + git \ + procps \ + sudo \ + wget \ + ca-certificates \ + locales \ + zsh \ + && rm -rf /var/lib/apt/lists/* + +# Generate locale +RUN locale-gen en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US:en +ENV LC_ALL=en_US.UTF-8 + +# Create a non-root user with zsh as default shell +RUN useradd -m -s /usr/bin/zsh developer && \ + echo 'developer ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + +# Switch to the developer user +USER developer +WORKDIR /home/developer + +# Install Homebrew +RUN /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + +# Add Homebrew to PATH +ENV PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:${PATH}" + +# Copy Brewfile and install dependencies +COPY --chown=developer:developer Brewfile /home/developer/ +RUN brew bundle install --file=/home/developer/Brewfile + +# Copy dotfiles +COPY --chown=developer:developer . /home/developer/.dotfiles + +# Create symlinks for neovim config +RUN mkdir -p /home/developer/.config && \ + ln -sf /home/developer/.dotfiles/.config/nvim /home/developer/.config/nvim + +# Copy tool-versions for mise +RUN ln -sf /home/developer/.dotfiles/.tool-versions /home/developer/.tool-versions + +# Install oh-my-zsh +RUN sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended + +# Install zsh plugins +RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions && \ + git clone https://github.com/MichaelAquilina/zsh-you-should-use.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/you-should-use && \ + git clone https://github.com/jeffreytse/zsh-vi-mode ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-vi-mode && \ + git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting && \ + git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autocomplete + +# Set up zsh configuration +RUN ln -sf /home/developer/.dotfiles/.zshrc /home/developer/.zshrc + +# Create dummy files/directories for macOS-specific paths to avoid errors +RUN sudo mkdir -p /opt/homebrew/etc/profile.d && \ + sudo touch /opt/homebrew/etc/profile.d/autojump.sh && \ + sudo mkdir -p /Users/dani/.dart-cli-completion && \ + sudo touch /Users/dani/.dart-cli-completion/zsh-config.zsh && \ + touch /home/developer/.import-secrets.sh && \ + echo "# Docker placeholder" > /home/developer/.import-secrets.sh + +# Install languages using mise +RUN /bin/zsh -c "eval \"\$(mise activate zsh)\" && mise install" + +# Initialize neovim and install plugins +RUN nvim --headless "+Lazy! sync" +qa + +# Note: Treesitter parsers will be installed on first use +# You can manually install them with: :TSInstall + +# Set the working directory to dotfiles +WORKDIR /home/developer/.dotfiles + +# Default command +CMD ["/usr/bin/zsh"] \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..527697e --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2024 Daniel Bengl + +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/README.md b/README.md index 10c9b62..4d2b100 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,29 @@ -# Dotfiles +# dotfiles -You are currently on the main branch which doesn't contain any of my dotfiles in order not to affect my GitHub contributions counter. -If you want to visit my real dotfiles, just visit this branch: [dotfiles](https://github.com/CuddlyBunion341/dotfiles/tree/main) +This is a collection of my dotfiles for my personal development setup. +Other than the dotfiles, I also have a few scripts that I use to automate some tasks. + +## Docker Setup + +Run the complete development environment in a container: + +```bash +docker compose up -d +docker compose exec dotfiles zsh +``` + +## Configuration + +* [Alacritty](./.config/alacritty/alacritty.toml) +* [Nvim](./.config/nvim/) +* [Lazygit](./lazygit/config.yml) +* [Tmux](./.tmux.conf) +* [Zsh profile](./.zshrc) +* [Utility Scripts](./scripts/) +* [NixOS Configuration](./nixos/configuration.nix) +* [NixOS Hardware Configuration](./nixos/hardware-configuration.nix) +* [Hyprland Configuration](./.config/hypr/hyprland.conf) + +## License + +The source files in this repository is licensed under the MIT license. See [LICENSE](./LICENSE) for more information. \ No newline at end of file diff --git a/bin/fastcheck b/bin/fastcheck new file mode 100755 index 0000000..9f49b1b --- /dev/null +++ b/bin/fastcheck @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +set -euo pipefail + +echo "🔍 Running format checks for shell files..." + +# Find and format shell scripts +find . -type f \( -name "*.sh" -o -name "*.bash" -o -name "*.zsh" \) -not -path "./.git/*" -not -path "./node_modules/*" | while read -r file; do + echo "Formatting: $file" + + # Use shfmt for shell script formatting + if command -v shfmt >/dev/null 2>&1; then + shfmt -i 2 -ci -w "$file" + else + echo "Warning: shfmt not found, skipping shell formatting" + fi +done + +# Format .zshrc specifically (skip if it has syntax issues) +if [[ -f ".zshrc" ]]; then + echo "Checking .zshrc..." + if command -v shfmt >/dev/null 2>&1; then + if shfmt -d .zshrc >/dev/null 2>&1; then + shfmt -i 2 -ci -w .zshrc + echo "Formatted .zshrc" + else + echo "Warning: .zshrc has syntax issues, skipping formatting" + fi + fi +fi + +echo "✅ Shell file formatting complete!" + +# Run other fastcheck scripts +echo "" +echo "🔄 Running neovim/fastcheck..." +./neovim/fastcheck + +echo "" +echo "🔄 Running scripts/fastcheck..." +./scripts/fastcheck + +echo "" +echo "🎉 All fastcheck scripts completed!" diff --git a/change_theme.sh b/change_theme.sh new file mode 100755 index 0000000..bb9902a --- /dev/null +++ b/change_theme.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +if [[ "$OSTYPE" == "darwin"* ]]; then + SED_COMMAND='sed -i ""' +else + SED_COMMAND='sed -i' +fi + +replace() { + $SED_COMMAND "s|$1|$2|g" "$3" +} + +ALACRITTY_LIGHT_THEME="solarized_light" +ALACRITTY_DARK_THEME="tokyonight" +ALACRITTY_CONFIG_FILE="$HOME/.config/alacritty/current-theme.toml" + +if [ ! -f "$ALACRITTY_CONFIG_FILE" ]; then + echo "File not found: $ALACRITTY_CONFIG_FILE" + exit 1 +fi + +NVIM_THEME_FILE="$HOME/.config/nvim/lua/theme.lua" +NVIM_LIGHT_THEME='solarized' +NVIM_DARK_THEME='tokyodark' + +if [ ! -f "$NVIM_THEME_FILE" ]; then + echo "File not found: $NVIM_THEME_FILE" + exit 1 +fi + +NVIM_SERVERS=$(nvr --serverlist) + +if grep -q "$ALACRITTY_LIGHT_THEME" "$ALACRITTY_CONFIG_FILE"; then + # switch to dark theme + replace "$ALACRITTY_LIGHT_THEME" "$ALACRITTY_DARK_THEME" "$ALACRITTY_CONFIG_FILE" + replace "local USE_DARKMODE = false" "local USE_DARKMODE = true" "$NVIM_THEME_FILE" + for server in $NVIM_SERVERS; do + nvr --servername $server --remote-send ":colorscheme $NVIM_DARK_THEME:set background=dark" + done + echo "Changed to dark theme" +else + # switch to light theme + replace "$ALACRITTY_DARK_THEME" "$ALACRITTY_LIGHT_THEME" "$ALACRITTY_CONFIG_FILE" + replace "local USE_DARKMODE = true" "local USE_DARKMODE = false" "$NVIM_THEME_FILE" + for server in $NVIM_SERVERS; do + nvr --servername $server --remote-send ":colorscheme $NVIM_LIGHT_THEME:set background=light" + done + echo "Changed to light theme" +fi diff --git a/create_linux_symlinx.sh b/create_linux_symlinx.sh new file mode 100644 index 0000000..39ab6e7 --- /dev/null +++ b/create_linux_symlinx.sh @@ -0,0 +1 @@ +#/bin/zsh diff --git a/create_symlinks.sh b/create_symlinks.sh new file mode 100755 index 0000000..9f89f6d --- /dev/null +++ b/create_symlinks.sh @@ -0,0 +1,26 @@ +#!/bin/zsh + +function create_symlink() { + if [[ ! -e $1 ]]; then + echo "Source file $1 does not exist" + elif [[ ! -e $2 ]]; then + ln -s $1 $2 + echo "Created symlink $2 -> $1" + elif [[ -L $2 && ! -e $2 ]]; then + echo "Symlink $2 is broken" + else + echo "Symlink $2 already exists" + fi +} + +create_symlink ~/dotfiles/.zshrc ~/.zshrc +create_symlink ~/dotfiles/.config/nvim ~/.config/nvim +create_symlink ~/dotfiles/.config/alacritty ~/.config/alacritty +create_symlink ~/dotfiles/.tmux.conf ~/.tmux.conf +create_symlink ~/dotfiles/my-status-bar.tmux ~/my-status-bar.tmux +create_symlink ~/dotfiles/.gitignore ~/.gitignore +create_symlink ~/dotfiles/scripts ~/scripts +create_symlink ~/dotfiles/.config/ghostty ~/.config/ghostty +create_symlink ~/dotfiles/.config/btop ~/.config/btop +create_symlink ~/dotfiles/.config/hyfetch ~/.config/hyfetch +create_symlink ~/dotfiles/.config/bat ~/.config/bat diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ae44758 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: '3.8' +services: + dotfiles: + build: . + image: dotfiles-zsh + container_name: dotfiles-dev + volumes: + - .:/workspace + - nvim_data:/home/developer/.local/share/nvim + - mise_data:/home/developer/.local/share/mise + - zsh_data:/home/developer/.oh-my-zsh + working_dir: /workspace + stdin_open: true + tty: true + command: /usr/bin/zsh + +volumes: + nvim_data: + mise_data: + zsh_data: diff --git a/lazygit/.gitignore b/lazygit/.gitignore new file mode 100644 index 0000000..ace2661 --- /dev/null +++ b/lazygit/.gitignore @@ -0,0 +1 @@ +state.yml diff --git a/lazygit/config.yml b/lazygit/config.yml new file mode 100644 index 0000000..bebd563 --- /dev/null +++ b/lazygit/config.yml @@ -0,0 +1,39 @@ +customCommands: + - key: "F" + command: "git fetch --prune" + context: "localBranches" + stream: true + +os: + editPreset: "nvim" + +git: + paging: + colorArg: always + pager: delta --dark --paging=never + # pager: diff-so-fancy + +theme: + activeBorderColor: + #- "#8caaee" + #- bold + - "#FF0000" + inactiveBorderColor: + - "#a5adce" + optionsTextColor: + - "#8caaee" + selectedLineBgColor: + - "#414559" + cherryPickedCommitBgColor: + - "#51576d" + cherryPickedCommitFgColor: + - "#8caaee" + unstagedChangesColor: + - "#e78284" + defaultFgColor: + - "#c6d0f5" + searchingActiveBorderColor: + - "#e5c890" + +authorColors: + "*": "#babbf1" diff --git a/my-status-bar.tmux b/my-status-bar.tmux new file mode 100755 index 0000000..c10f0b4 --- /dev/null +++ b/my-status-bar.tmux @@ -0,0 +1,61 @@ +!/usr/bin/env bash +#=============================================================================== +# Author: CuddlyBunion341 +# Created: 2024-04-13 22:25 +#=============================================================================== + +tmux_get() { + local value="$(tmux show -gqv "$1")" + [ -n "$value" ] && echo "$value" || echo "$2" +} + +tmux_set() { + tmux set-option -gq "$1" "$2" +} + +#color1="#fcf6e5" +color1="black" +# color1="#fdf6e3" +# color1="#000000" +color2="white" +color3="white" +color4="white" + +secondary="#[fg=$color2,bg=$color1]" +tertiary="#[fg=black,bg=$color1]" +primary="#[fg=$color1,bg=$color2]" +background="#[fg=$color2,bg=$color1]" + +title="#W:#I" +# tmux_set status-fg "$colork" +# tmux_set status-bg "$color1" +tmux_set status-bg "$color1" +tmux_set status-fg "$color4" +# tmux_set window-status-current-format "#[underscore]$title" +# tmux_set window-status-format "$title" +# tmux_set window-status-separator " | " + +tmux_set window-status-format "#[bg=$color1] $title " +tmux_set window-status-current-format "#[bg=$color4,fg=$color1] $title " +tmux_set window-status-separator " " + +# tmux_set window-status-current-format "#[bg=$color1,fg=$color2]#[bg=$color2,fg=$color3] $title #[bg=$color1,fg=$color2]" +# tmux_set window-status-separator "" +# tmux_set window-status-format "#[bg=$color1,fg=$color3]#[bg=$color3,fg=$color2] $title #[bg=$color1,fg=$color3]" + +#    +cmd="#[fg=black]#{pane_current_command}" +path="#(echo #{pane_current_path} | sed 's#$HOME#~#g')" +ruby_version=$(ruby -v | awk '{print $2}') +ruby="#[fg=red] $ruby_version" + +# tmux_set status-left " #H [#S] " +tmux_set status-left "#[bg=green,fg=black][#S]#[bg=default] " +# tmux_set status-right "#{prefix_highlight} $cmd $path $ruby" +tmux_set status-right "#{prefix_highlight} $cmd $path" +# Window status style +# tmux_set window-status-style "fg=$tertiary,bg=$primary,none" +# tmux_set window-status-last-style "fg=$tertiary,bg=$primary,bold" +# tmux_set window-status-activity-style "fg=$tertiary,bg=$primary,bold" +tmux_set status-right-length 200 +tmux_set status-left-length 200 diff --git a/neovim/fastcheck b/neovim/fastcheck new file mode 100755 index 0000000..6f0d03f --- /dev/null +++ b/neovim/fastcheck @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -euo pipefail + +echo "🔍 Running format checks for Neovim Lua files..." + +# Find and format Lua files in .config/nvim +find .config/nvim -type f -name "*.lua" | while read -r file; do + echo "Formatting: $file" + + # Use stylua for Lua formatting + if command -v stylua >/dev/null 2>&1; then + stylua --config-path .config/nvim/stylua.toml "$file" 2>/dev/null || stylua "$file" + else + echo "Warning: stylua not found, skipping Lua formatting" + fi +done + +echo "✅ Neovim Lua file formatting complete!" \ No newline at end of file diff --git a/nixos/configuration.nix b/nixos/configuration.nix new file mode 100644 index 0000000..471d176 --- /dev/null +++ b/nixos/configuration.nix @@ -0,0 +1,161 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ./hardware-configuration.nix + ]; + + nixpkgs.config.allowUnfree = true; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + +# console.font = "Lat2-Terminus16"; + + networking = { + hostName = "nixos"; + networkmanager = { + enable = true; + }; + wireless = { + enable = false; + networks = {}; + }; + }; + + # networking.hostName = "nixos"; + # + # networking.networkmanager.enable = true; + # networking.wireless.enable = false; + # networking.useDHCP = true; + + time.timeZone = "Europe/Zurich"; + + i18n.defaultLocale = "en_US.UTF-8"; + + services.xserver.xkb = { + layout = "us"; + variant = ""; + }; + + users.users.dani = { + isNormalUser = true; + description = "Dani"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; []; + }; + + fonts.packages = with pkgs; [ + hack-font + hackgen-nf-font + terminus-nerdfont + ]; + +# $ nix search wget + environment.systemPackages = with pkgs; [ + krusader + bemenu + nnn + + lz4 + + ruby_3_1 + bundix + gnumake + gcc + + nodejs_22 + + fbterm + eza + superfile + + bun + + vim + neovim + neovim-remote + mc + alacritty + lazygit + fzf + gh + tmux + lynx + hyprland + lynx + fastfetch + git + zsh + btop + htop + wget + ripgrep + + firefox + kdePackages.dolphin + discord + + hyprland + + lua-language-server + rust-analyzer + bundix + cargo + ]; + + programs.zsh.enable = true; + programs.hyprland.enable = true; + + programs.firefox = { + enable = true; + languagePacks = [ "de" "en-US" ]; + + policies = { + DisableTelemetry = true; + DisableFirefoxStudies = true; + EnableTrackingProtection = { + Value= true; + Locked = true; + Cryptomining = true; + Fingerprinting = true; + }; + DisablePocket = true; + DisableFirefoxAccounts = true; + DisableAccounts = true; + DisableFirefoxScreenshots = true; + OverrideFirstRunPage = ""; + OverridePostUpdatePage = ""; + DontCheckDefaultBrowser = true; + DisplayBookmarksToolbar = "newtab"; + DisplayMenuBar = "default-off"; + SearchBar = "unified"; + + /* ---- EXTENSIONS ---- */ + ExtensionSettings = { + "uBlock0@raymondhill.net" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; + installation_mode = "force_installed"; + }; + "jid1-MnnxcxisBPnSXQ@jetpack" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/privacy-badger17/latest.xpi"; + installation_mode = "force_installed"; + }; + "{d634138d-c276-4fc8-924b-40a0ea21d284}" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/1password-x-password-manager/latest.xpi"; + installation_mode = "force_installed"; + }; + "addon@darkreader.org" = { + install_url = "https://addons.mozilla.org/darkreader/downloads/latest/1password-x-password-manager/latest.xpi"; + installation_mode = "force_installed"; + }; + }; + + Preferences = { + extensions.activeThemeId = "4ae94ae4-df44-487a-bb8d-cdf0cb324144"; + }; + }; + }; + + system.stateVersion = "24.05"; +} diff --git a/nixos/hardware-configuration.nix b/nixos/hardware-configuration.nix new file mode 100644 index 0000000..f459541 --- /dev/null +++ b/nixos/hardware-configuration.nix @@ -0,0 +1,49 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/fd27be81-9590-4514-82d7-3312e66a2dce"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/4021-E963"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + # networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp5s0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp6s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + sound.enable = true; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; +} diff --git a/scripts/branch-checkout.ts b/scripts/branch-checkout.ts new file mode 100755 index 0000000..deee886 --- /dev/null +++ b/scripts/branch-checkout.ts @@ -0,0 +1,38 @@ +#!/usr/bin/env node + +import { execSync } from "child_process"; + +// copilot prompt: +// this script gets a branch name from the command line +// it fuzzy searches for a branch containing the substring with grep +// it checks out the branch, if it exists and then exitts + +const branchName = process.argv[2]; + +if (!branchName) { + // get branches + console.log("Please provide a branch name"); + const branches = execSync("git branch").toString().split("\n"); + console.log(branches); + process.exit(1); +} + +const branches = execSync(`git branch | grep ${branchName}`) + .toString() + .split("\n") + .filter((b) => b.length > 0); + +if (branches.length === 0) { + console.log(`No branch found containing ${branchName}`); + process.exit(1); +} + +if (branches.length > 1) { + console.log(`Found ${branches.length} branches containing ${branchName}`); + console.log(branches); +} else { + const branch = branches[0].trim(); + console.log(`Found branch ${branch}`); + console.log(`Checking out ${branch}`); + execSync(`git checkout ${branch}`); +} diff --git a/scripts/bun.lockb b/scripts/bun.lockb new file mode 100755 index 0000000..53e2708 Binary files /dev/null and b/scripts/bun.lockb differ diff --git a/scripts/clone_praktikum.sh b/scripts/clone_praktikum.sh new file mode 100755 index 0000000..dd2ce34 --- /dev/null +++ b/scripts/clone_praktikum.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +ORG_NAME="prog1-kurs" +GH_USER="bengldan" +GH_HOST="github.zhaw.ch" + +for cmd in gh jq fzf; do + if ! command -v $cmd &>/dev/null; then + echo "Error: $cmd is not installed." >&2 + exit 1 + fi +done + +list_repos() { + GH_HOST=$GH_HOST gh repo list $ORG_NAME --json name | jq -r '.[].name' | fzf +} + +fork_and_clone_repo() { + local repo_name=$1 + GH_HOST=$GH_HOST gh repo fork "$ORG_NAME/$repo_name" --clone +} + +REPO_LIST=$(list_repos) +if [ -n "$REPO_LIST" ]; then + fork_and_clone_repo "$REPO_LIST" +else + echo "No repository selected." +fi diff --git a/scripts/copy-ticket-number.ts b/scripts/copy-ticket-number.ts new file mode 100755 index 0000000..cc3fd17 --- /dev/null +++ b/scripts/copy-ticket-number.ts @@ -0,0 +1,31 @@ +#!/usr/bin/env bun + +import { execSync } from "child_process"; + +const pipe = + (...fns: Array<(arg: T) => T>) => + (value: T) => + fns.reduce((acc, fn) => fn(acc), value); + +try { + execSync("git status"); +} catch (e) { + console.log("Not a git repository"); + process.exit(1); +} + +const branchPattern = /feature\/(\d+)/; + +const openGitInBrowser = pipe( + () => execSync('git branch --list | grep "*"'), + (branch) => branchPattern.exec(branch.toString()), + (matches) => { + if (!matches?.[1]) throw new Error("Current branch invalid"); + return matches[1]; + }, + (ticketNumber) => `echo ${ticketNumber} | pbcopy`, + (command: string) => execSync(command), + () => execSync('echo "The PR template has been copied to your clipboard\!"'), +); + +openGitInBrowser(""); diff --git a/scripts/copy_remote_to_clipboard.sh b/scripts/copy_remote_to_clipboard.sh new file mode 100755 index 0000000..4ada773 --- /dev/null +++ b/scripts/copy_remote_to_clipboard.sh @@ -0,0 +1,7 @@ +#!/bin/zsh + +# Get the git remote origin URL +remote_url=$(git remote -v | awk '/origin.*fetch/ { print $2 }') + +# Copy the remote URL to the clipboard +echo "$remote_url" | pbcopy diff --git a/scripts/create_executable_script.sh b/scripts/create_executable_script.sh new file mode 100755 index 0000000..e3bfcd3 --- /dev/null +++ b/scripts/create_executable_script.sh @@ -0,0 +1,35 @@ +#!/bin/zsh +# Author: ChatGPT 3.5 Turbo + +# Check if both the directory and script name are provided as arguments +if [ $# -lt 2 ]; then + echo "Usage: create_executable_script.sh directory_name script_name" + exit 1 +fi + +# Extract directory name and script name from input arguments +directory_name="$1" +script_name="$2" + +# Create the directory if it doesn't exist +if [ ! -d "$directory_name" ]; then + mkdir -p "$directory_name" +fi + +# Change to the specified directory +cd "$directory_name" || exit + +# Check if the script name already exists +if [ -f "$script_name" ]; then + echo "A script with the name $script_name already exists in the directory $directory_name." + exit 1 +fi + +# Create the new script file +touch "$script_name" + +# Make the script executable +chmod +x "$script_name" + +# Open the script file in a text editor for further editing +nvim "$script_name" diff --git a/scripts/fastcheck b/scripts/fastcheck new file mode 100755 index 0000000..8fc313c --- /dev/null +++ b/scripts/fastcheck @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +set -euo pipefail + +echo "🔍 Running format checks for scripts directory..." + +# Find and format shell scripts in scripts/ +find scripts -type f \( -name "*.sh" -o -name "*.bash" \) | while read -r file; do + echo "Formatting: $file" + + # Use shfmt for shell script formatting + if command -v shfmt >/dev/null 2>&1; then + shfmt -i 2 -ci -w "$file" + else + echo "Warning: shfmt not found, skipping shell formatting" + fi +done + +# Check TypeScript files for basic formatting (if prettier is available) +if command -v prettier >/dev/null 2>&1; then + find scripts -type f -name "*.ts" -not -path "*/node_modules/*" | while read -r file; do + echo "Formatting TypeScript: $file" + prettier --write "$file" + done +else + echo "Note: prettier not found, skipping TypeScript formatting" +fi + +# Check Ruby files for basic formatting (use standardrb for autofix) +if command -v standardrb >/dev/null 2>&1; then + find scripts -type f -name "*.rb" | while read -r file; do + echo "Formatting Ruby: $file" + standardrb --fix "$file" || echo "Warning: standardrb failed on $file" + done +else + echo "Note: standardrb not found, skipping Ruby formatting" +fi + +echo "✅ Scripts directory formatting complete!" \ No newline at end of file diff --git a/scripts/format_url.sh b/scripts/format_url.sh new file mode 100755 index 0000000..770c7c4 --- /dev/null +++ b/scripts/format_url.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# Get the URL of the current page from the clipboard +URL=$(pbpaste) + +# Provide debug output of the captured URL +echo "Formatting: '$URL'" + +# Initialize the FORMAT variable +FORMAT="" + +# Extract necessary parts based on the URL structure +if [[ $URL =~ https?://[^/]+\.atlassian\.net/browse/([^ ]+) ]]; then + TICKET="${BASH_REMATCH[1]}" + FORMAT="$TICKET" +elif [[ $URL =~ https?://[^/]+\.bitbucket\.org/[^/]+/pull-requests/([0-9]+) ]]; then + PR_NUMBER="${BASH_REMATCH[1]}" + FORMAT="#$PR_NUMBER" +elif [[ $URL =~ https?://[^/]+\.bitbucket\.org/[^/]+/commits/([0-9a-f]+) ]]; then + COMMIT_HASH="${BASH_REMATCH[1]}" + FORMAT="${COMMIT_HASH:0:7}" +else + echo "Unsupported URL structure." + exit 1 +fi + +# Copy the formatted string to the clipboard +echo -n "$FORMAT" | pbcopy + +# Optional: Feedback on successful copy +echo "Copied to clipboard: $FORMAT" diff --git a/scripts/get-pr-template.ts b/scripts/get-pr-template.ts new file mode 100755 index 0000000..772e02b --- /dev/null +++ b/scripts/get-pr-template.ts @@ -0,0 +1,35 @@ +#!/usr/bin/env bun + +import { execSync } from "child_process"; + +const pipe = + (...fns: Array<(arg: T) => T>) => + (value: T) => + fns.reduce((acc, fn) => fn(acc), value); + +try { + execSync("git status"); +} catch (e) { + console.log("Not a git repository"); + process.exit(1); +} + +const redmineBaseUrl = "https://redmine.renuo.ch/issues/"; +const branchPattern = /feature\/(\d+)/; + +const copyTicket = pipe( + () => execSync('git branch --list | grep "*"'), + (branch) => branchPattern.exec(branch.toString()), + (matches) => { + if (!matches?.[1]) throw new Error("Current branch invalid"); + return matches[1]; + }, + (ticketNumber) => { + return `TICKET-${ticketNumber}`; + }, + (prTemplate) => `echo ${JSON.stringify(prTemplate)} | pbcopy`, + (command) => execSync(command), + () => execSync('echo "The PR template has been copied to your clipboard\!"'), +); + +copyTicket(""); diff --git a/scripts/git-smart-log.ts b/scripts/git-smart-log.ts new file mode 100755 index 0000000..4ea7db6 --- /dev/null +++ b/scripts/git-smart-log.ts @@ -0,0 +1,82 @@ +#!/usr/bin/env bun + +import { execSync } from "child_process"; +import { printTable } from "console-table-printer"; +import simpleGit from "simple-git"; + +const params = process.argv.slice(2); +let filterDate = new Date(); + +if (params[0] === "--help" || params[0] === "-h") { + console.log(` + Usage: git-smart-log [date] + + date: Date in format dd.mm.yyyy + `); + process.exit(0); +} + +if (params.length) { + const [day, month, year] = params[0].split(".").map(Number); + + filterDate = new Date( + year ?? new Date().getFullYear(), + month ? month - 1 : new Date().getMonth(), + day ?? new Date().getDate(), + ); + if (isNaN(filterDate.getTime())) { + throw new Error("Invalid date"); + } +} + +const cwd = process.cwd(); +const { all } = await simpleGit().cwd(cwd).log(["--all"]); + +const filteredCommits = all.filter((commit) => { + const date = new Date(commit.date); + return date.toDateString() === filterDate.toDateString(); +}); + +const commits = filteredCommits.map((commit) => { + const branch = execSync(`git branch --contains ${commit.hash}`, { cwd }) + .toString() + .split("\n")[0] + .trim() + .replace("* ", "") + .replace(/^\s+/, ""); + + return { + ...commit, + branch, + }; +}); + +const sortedCommits = commits.sort((a, b) => { + const dateA = new Date(a.date); + const dateB = new Date(b.date); + return dateA.getTime() - dateB.getTime(); +}); + +const textElipsis = (str: string, maxLength: number) => { + if (str.length < maxLength) return str; + + return str.substring(0, maxLength) + "..."; +}; + +const formatedCommits = sortedCommits.map((commit) => { + const formatedDate = new Date(commit.date).toLocaleTimeString(); + + return { + branch: textElipsis(commit.branch, 40), + author: textElipsis(commit.author_name, 10), + hash: commit.hash.slice(0, 7), + date: formatedDate, + message: textElipsis(commit.message, 80), + }; +}); + +console.log( + `${formatedCommits.length} commits found for ${filterDate.toDateString()}`, +); + +printTable(formatedCommits); diff --git a/scripts/index.ts b/scripts/index.ts new file mode 100755 index 0000000..6933ff8 --- /dev/null +++ b/scripts/index.ts @@ -0,0 +1,78 @@ +#!/usr/bin/env bun + +import { parse } from "csv-parse"; +import { createReadStream } from "fs"; +import chalk from "chalk"; + +const { log } = console; + +const filename = process.argv[2]; +const pretendDayEnd = process.argv[3] === "y"; + +const columns = ["Project", "Date", "Hours", "Issue"]; +const indicies: Record<(typeof columns)[number], number> = {}; + +const dateDict: Record = {}; // use a dict to aggregate hours by date + +log(chalk.blue(`Reading ${filename}`)); + +let index = 0; +createReadStream(filename) + .pipe(parse({ delimiter: "," })) + .on("data", (row) => { + // get the indicies of the columns we care about + if (index++ === 0) { + columns.forEach((column) => { + indicies[column] = row.indexOf(column); + }); + return; + } + + // get the values of the columns we care about + const values = columns.map((column) => row[indicies[column]]); + const [project, date, hours, issue] = values; + + dateDict[date] = (dateDict[date] || 0) + Number(hours); + }) + .on("end", () => { + log(chalk.green("Done!")); + + const dateList: [string, number][] = Object.entries(dateDict); + + let totalHours = 0; + dateList.forEach(([date, hours], index) => { + if (index === 0 && hours < 8.4 && pretendDayEnd) { + totalHours += 8.4; + log(chalk.magenta(`${date}: ${format(hours)}, counted as 8.4`)); + } else { + totalHours += hours; + + if (isHourSussy(hours)) { + log(chalk.red(`⚠️ ${date}: ${format(hours)}`)); + } else { + log(chalk.gray(`${date}: ${format(hours)}`)); + } + } + }); + + log(`\nTotal hours: ${format(totalHours)}`); + log(`Expected hours: ${format(8.4 * dateList.length)}`); + log( + `\nOvertime in this period: ${format(totalHours - 8.4 * dateList.length)}`, + ); + + log(`Average hours: ${format(totalHours / dateList.length)}`); + log(`Total days: ${dateList.length}`); + }); + +// helpers +function isHourSussy(hours: number) { + const workDay = 8.4; + const deviation = 1.0; + + return hours > workDay + deviation || hours < workDay - deviation; +} + +function format(num: number) { + return num.toFixed(1); +} diff --git a/scripts/lynx-google.sh b/scripts/lynx-google.sh new file mode 100644 index 0000000..91418d5 --- /dev/null +++ b/scripts/lynx-google.sh @@ -0,0 +1 @@ +url="https://www.google.com/search?q=" diff --git a/scripts/open-repo-in-browser.ts b/scripts/open-repo-in-browser.ts new file mode 100755 index 0000000..456b16f --- /dev/null +++ b/scripts/open-repo-in-browser.ts @@ -0,0 +1,27 @@ +#!/usr/bin/env bun + +import { execSync } from "child_process"; + +const pipe = + (...fns: Array<(arg: T) => T>) => + (value: T) => + fns.reduce((acc, fn) => fn(acc), value); + +try { + execSync("git status"); +} catch (e) { + console.log("Not a git repository"); + process.exit(1); +} + +const branch = execSync("git rev-parse --abbrev-ref HEAD").toString(); + +const openGitInBrowser = pipe( + () => execSync("git remote get-url origin").toString().trim(), + (output) => output.split("@")[1].replace(":", "/"), + (path) => `https://${path.replace(".git", "")}`, + (url) => `open ${url}/tree/${branch}`, + (command) => execSync(command).toString(), +); + +openGitInBrowser(""); diff --git a/scripts/open-ticket-in-browser.ts b/scripts/open-ticket-in-browser.ts new file mode 100755 index 0000000..13b5fc8 --- /dev/null +++ b/scripts/open-ticket-in-browser.ts @@ -0,0 +1,31 @@ +#!/usr/bin/env bun + +import { exec, execSync } from "child_process"; + +const pipe = + (...fns: Array<(arg: T) => T>) => + (value: T) => + fns.reduce((acc, fn) => fn(acc), value); + +try { + execSync("git status"); +} catch (e) { + console.log("Not a git repository"); + process.exit(1); +} + +const redmineBaseUrl = "https://redmine.renuo.ch/issues/"; +const branchPattern = /feature\/(\d+)/; + +const openGitInBrowser = pipe( + () => execSync('git branch --list | grep "*"'), + (branch) => branchPattern.exec(branch), + (matches) => { + if (!matches?.[1]) throw new Error("Current branch invalid"); + return matches[1]; + }, + (ticketNumber) => `open ${redmineBaseUrl}${ticketNumber}`, + (command) => execSync(command), +); + +openGitInBrowser(""); diff --git a/scripts/package.json b/scripts/package.json new file mode 100644 index 0000000..93ab2d3 --- /dev/null +++ b/scripts/package.json @@ -0,0 +1,9 @@ +{ + "dependencies": { + "@types/node": "^20.6.3", + "chalk": "^5.3.0", + "console-table-printer": "^2.11.2", + "csv-parse": "^5.5.5", + "simple-git": "^3.20.0" + } +} diff --git a/scripts/pretty-pulls.ts b/scripts/pretty-pulls.ts new file mode 100755 index 0000000..c2e839c --- /dev/null +++ b/scripts/pretty-pulls.ts @@ -0,0 +1,103 @@ +#!/usr/bin/env bun + +/* +Example usage: + +curl -L \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $(echo $GITHUB_REST_TOKEN)" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/renuo/khw2/pulls\?state=all | ./pretty-pulls.ts > file.html && open file.html +*/ + +let data = ""; + +process.stdin.resume(); +process.stdin.setEncoding("utf8"); + +process.stdin.on("data", (chunk) => { + data += chunk; +}); + +type PullRequest = { + html_url: string; + number: number; + title: string; + merged_at: string | null; + user: { login: string }; +}; + +const prs: { + username: string; + url: string; + number: number; + title: string; + mergedAt: string | null; +}[] = []; + +process.stdin.on("end", () => { + try { + const pulls = JSON.parse(data) as PullRequest[]; + pulls.forEach((pull) => { + const { title, number, html_url, user, merged_at } = pull; + prs.push({ + title, + number, + url: html_url, + username: user.login, + mergedAt: merged_at, + }); + }); + + console.log(` + + + + + + + + + + + + + + + + + + +${prs + .map((pr) => { + return ` + + + + + +`; + }) + .join("")} +
${pr.title}${pr.title}#${pr.number}${pr.username}${pr.mergedAt}#${pr.number}
+ + + +`); + } catch (e) { + console.error(e); + } +}); diff --git a/scripts/simplecov_parser.rb b/scripts/simplecov_parser.rb new file mode 100755 index 0000000..ea1139e --- /dev/null +++ b/scripts/simplecov_parser.rb @@ -0,0 +1,377 @@ +#!/usr/bin/env ruby + +# SimpleCov Coverage Parser +# ========================= +# +# Command-line tool to parse SimpleCov HTML coverage reports into text format. +# +# Features: +# - Parse SimpleCov HTML files into structured text output +# - Display overall coverage statistics with file counts and percentages +# - Group analysis by Rails conventions (Controllers, Models, Helpers, etc.) +# - File-level details with line and branch coverage metrics +# - Identify uncovered and partially covered lines with specific line numbers +# - Branch coverage analysis when available +# - Focused mode to show only files with coverage issues +# - Smart file discovery with common path fallbacks +# +# Requirements: +# - Ruby (any recent version) +# - nokogiri gem: gem install nokogiri +# +# Usage Examples: +# ./simplecov_parser.rb # Parse ./coverage/index.html +# ./simplecov_parser.rb coverage/index.html # Parse specific file +# ./simplecov_parser.rb -u # Show only uncovered files +# ./simplecov_parser.rb -d reports/coverage # Use different directory +# ./simplecov_parser.rb -f custom_coverage.html # Use different HTML file +# +# Use cases: +# - CI/CD pipelines to identify testing gaps +# - Code reviews focusing on coverage issues +# - Development workflow to track testing progress +# - Converting HTML reports for text-based tools and contexts + +require 'nokogiri' +require 'optparse' + +class SimpleCovParser + def initialize(html_file) + @html_file = html_file + @doc = nil + @options = {} + end + + def parse(options = {}) + @options = options + + File.open(@html_file, 'r') do |file| + @doc = Nokogiri::HTML(file) + end + + if @options[:uncovered_only] + puts 'SimpleCov Coverage Report - Uncovered Issues Only' + puts '=' * 55 + parse_uncovered_only + else + puts 'SimpleCov Coverage Report' + puts '=' * 50 + parse_summary + parse_groups + end + rescue StandardError => e + puts "Error parsing coverage file: #{e.message}" + exit 1 + end + + private + + def parse_summary + timestamp = @doc.css('.timestamp abbr').first&.attribute('title')&.value + puts "Generated: #{timestamp}" if timestamp + + all_files_section = @doc.css('#AllFiles').first + return unless all_files_section + + coverage_percent = all_files_section.css('.covered_percent .green').first&.text&.strip + hits_per_line = all_files_section.css('.covered_strength .green').first&.text&.strip + total_files = all_files_section.css('div').find do |div| + div.text.match(/\d+ files in total/) + end&.text&.match(/(\d+)/)&.[](1) + + line_summary = all_files_section.css('.t-line-summary').first + if line_summary + relevant_lines = line_summary.css('b').first&.text + covered_lines = line_summary.css('.green b').first&.text + missed_lines = line_summary.css('.red b').first&.text + end + + branch_summary = all_files_section.css('.t-branch-summary').first + if branch_summary + total_branches = branch_summary.css('b').first&.text + covered_branches = branch_summary.css('.green b').first&.text + missed_branches = branch_summary.css('.red b').first&.text + end + + puts "\nOverall Coverage:" + puts " Files: #{total_files}" + puts " Line Coverage: #{coverage_percent} (#{covered_lines}/#{relevant_lines} lines)" + if branch_summary + puts " Branch Coverage: #{if branch_summary + calculate_branch_percentage(covered_branches, + total_branches) + else + 'N/A' + end} (#{covered_branches}/#{total_branches} branches)" + end + puts " Average Hits/Line: #{hits_per_line}" + puts + end + + def parse_groups + group_sections = @doc.css('.file_list_container').select do |section| + group_name = section.css('.group_name').first&.text + group_name && group_name != 'All Files' + end + + group_sections.each do |section| + parse_group(section) + end + end + + def parse_group(section) + group_name = section.css('.group_name').first&.text + + # In uncovered-only mode, check if group has any issues before showing + if @options[:uncovered_only] + files = section.css('.file_list tbody .t-file') + has_issues = files.any? do |file_row| + missed_lines = file_row.css('.cell--number')[4]&.text&.strip + missed_branches = file_row.css('.cell--number')[9]&.text&.strip + missed_lines.to_i > 0 || missed_branches.to_i > 0 + end + return unless has_issues + end + + puts "Group: #{group_name}" + puts '-' * (group_name.length + 7) + + unless @options[:uncovered_only] + coverage_percent = section.css('.covered_percent .green').first&.text&.strip + hits_per_line = section.css('.covered_strength .green').first&.text&.strip + + line_summary = section.css('.t-line-summary').first + if line_summary + relevant_lines = line_summary.css('b').first&.text + covered_lines = line_summary.css('.green b').first&.text + missed_lines = line_summary.css('.red b').first&.text + end + + branch_summary = section.css('.t-branch-summary').first + if branch_summary + total_branches = branch_summary.css('b').first&.text + covered_branches = branch_summary.css('.green b').first&.text + missed_branches = branch_summary.css('.red b').first&.text + end + + puts " Summary: #{coverage_percent} line coverage, #{hits_per_line} hits/line" + puts " Lines: #{covered_lines}/#{relevant_lines} covered" + puts " Branches: #{covered_branches}/#{total_branches} covered" if branch_summary + puts + end + + files = section.css('.file_list tbody .t-file') + files.each do |file_row| + parse_file_summary(file_row) + end + + puts + end + + def parse_file_summary(file_row) + file_link = file_row.css('.t-file__name a').first + file_path = file_link&.attribute('title')&.value + file_id = file_link&.attribute('href')&.value&.gsub('#', '') + + coverage_percent = file_row.css('.t-file__coverage').first&.text&.strip + line_count = file_row.css('.cell--number')[1]&.text&.strip + relevant_lines = file_row.css('.cell--number')[2]&.text&.strip + covered_lines = file_row.css('.cell--number')[3]&.text&.strip + missed_lines = file_row.css('.cell--number')[4]&.text&.strip + avg_hits = file_row.css('.cell--number')[5]&.text&.strip + + branch_coverage = file_row.css('.t-file__branch-coverage').first&.text&.strip + total_branches = file_row.css('.cell--number')[7]&.text&.strip + covered_branches = file_row.css('.cell--number')[8]&.text&.strip + missed_branches = file_row.css('.cell--number')[9]&.text&.strip + + # Skip files with perfect coverage in uncovered-only mode + if @options[:uncovered_only] + has_uncovered_lines = missed_lines.to_i > 0 + has_uncovered_branches = missed_branches.to_i > 0 + return unless has_uncovered_lines || has_uncovered_branches + end + + puts " #{file_path}" + puts " Line Coverage: #{coverage_percent} (#{covered_lines}/#{relevant_lines})" + puts " Branch Coverage: #{branch_coverage} (#{covered_branches}/#{total_branches})" if total_branches.to_i > 0 + puts " Average Hits: #{avg_hits}" + + return unless file_id + + parse_file_details(file_id, file_path) + end + + def parse_file_details(file_id, _file_path) + source_table = @doc.css("##{file_id}").first + return unless source_table + + lines = source_table.css('li') + uncovered_lines = [] + partial_lines = [] + + lines.each do |line| + line_number = line.attribute('data-linenumber')&.value + line_class = line.attribute('class')&.value + + next unless line_number + + case line_class + when 'missed' + uncovered_lines << line_number + when 'partial' + partial_lines << line_number + end + end + + return unless !uncovered_lines.empty? || !partial_lines.empty? + + puts ' Issues:' + puts " Uncovered lines: #{uncovered_lines.join(', ')}" unless uncovered_lines.empty? + puts " Partially covered lines: #{partial_lines.join(', ')}" unless partial_lines.empty? + end + + def parse_uncovered_only + timestamp = @doc.css('.timestamp abbr').first&.attribute('title')&.value + puts "Generated: #{timestamp}" if timestamp + + all_files_section = @doc.css('#AllFiles').first + if all_files_section + line_summary = all_files_section.css('.t-line-summary').first + branch_summary = all_files_section.css('.t-branch-summary').first + + missed_lines = line_summary&.css('.red b')&.first&.text || '0' + missed_branches = branch_summary&.css('.red b')&.first&.text || '0' + + total_issues = missed_lines.to_i + missed_branches.to_i + + if total_issues == 0 + puts "\nPerfect coverage! No uncovered lines or branches found." + return + else + puts "\nFound #{missed_lines} uncovered lines and #{missed_branches} uncovered branches:" + puts + end + end + + parse_groups + end + + def calculate_branch_percentage(covered, total) + return '0.0%' if total.to_i == 0 + + percentage = (covered.to_f / total.to_f * 100).round(1) + "#{percentage}%" + end +end + +def show_help + puts <<~HELP + SimpleCov Coverage Parser + + USAGE: + #{$0} [OPTIONS] [COVERAGE_FILE] + + DESCRIPTION: + Parses SimpleCov HTML coverage files into digestible text format. + Includes file paths, line coverage, branch coverage, groups, and detailed line information. + + OPTIONS: + -d, --directory DIR Coverage directory (default: ./coverage) + -f, --file FILE Coverage HTML file (default: index.html) + -u, --uncovered-only Show only files with uncovered lines/branches + -h, --help Show this help message + -v, --verbose Show verbose output (currently same as default) + + EXAMPLES: + #{$0} # Parse ./coverage/index.html + #{$0} coverage/index.html # Parse specific file + #{$0} -d reports/coverage # Use different coverage directory + #{$0} -u # Show only uncovered files + #{$0} -f custom.html # Use different HTML file + + REQUIREMENTS: + - Ruby (any recent version) + - nokogiri gem (gem install nokogiri) + HELP +end + +def find_coverage_file(directory, filename) + path = File.join(directory, filename) + return path if File.exist?(path) + + # Try some common variations + variations = [ + File.join(directory, 'index.html'), + File.join('.', 'coverage', 'index.html'), + File.join('.', 'coverage_reports', 'index.html') + ] + + variations.find { |variation| File.exist?(variation) } +end + +# Main execution +options = { verbose: false, uncovered_only: false } +coverage_dir = 'coverage' +coverage_file = 'index.html' +target_file = nil + +OptionParser.new do |opts| + opts.banner = "Usage: #{$0} [options] coverage_file.html" + + opts.on('-d', '--directory DIR', 'Coverage directory') do |dir| + coverage_dir = dir + end + + opts.on('-f', '--file FILE', 'Coverage HTML file') do |file| + coverage_file = file + end + + opts.on('-v', '--verbose', 'Show verbose output') do + options[:verbose] = true + end + + opts.on('-u', '--uncovered-only', 'Show only files with uncovered lines/branches') do + options[:uncovered_only] = true + end + + opts.on('-h', '--help', 'Show this help message') do + show_help + exit + end +end.parse! + +# Determine the coverage file to parse +if ARGV.length > 0 + target_file = ARGV[0] + unless File.exist?(target_file) + puts "Error: File '#{target_file}' not found" + exit 1 + end +else + target_file = find_coverage_file(coverage_dir, coverage_file) + unless target_file + puts 'Error: Coverage file not found' + puts 'Tried looking for:' + puts " #{File.join(coverage_dir, coverage_file)}" + puts ' ./coverage/index.html' + puts ' ./coverage_reports/index.html' + puts + puts 'Make sure you have run your test suite with SimpleCov enabled.' + exit 1 + end +end + +# Check dependencies +begin + require 'nokogiri' +rescue LoadError + puts 'Error: nokogiri gem not found. Please install it with: gem install nokogiri' + exit 1 +end + +puts "Parsing coverage file: #{target_file}" +puts + +parser = SimpleCovParser.new(target_file) +parser.parse(options) diff --git a/scripts/startup-communications.sh b/scripts/startup-communications.sh new file mode 100755 index 0000000..07ad50c --- /dev/null +++ b/scripts/startup-communications.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Required parameters: +# @raycast.schemaVersion 1 +# @raycast.title Startup communications +# @raycast.mode compact + +# Optional parameters: +# @raycast.icon 🤖 + +# Documentation: +# @raycast.author Dani + +open -a "Slack" +open -a "Spark Mail" diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json new file mode 100644 index 0000000..1449bc3 --- /dev/null +++ b/scripts/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "lib": ["ESNext"], + "module": "esnext", + "target": "esnext", + "moduleResolution": "bundler", + "moduleDetection": "force", + "allowImportingTsExtensions": true, + "noEmit": true, + "composite": true, + "strict": true, + "downlevelIteration": true, + "skipLibCheck": true, + "jsx": "preserve", + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "allowJs": true, + "types": [ + "bun-types" // add Bun global + ] + } +} diff --git a/scripts/zip_split.sh b/scripts/zip_split.sh new file mode 100755 index 0000000..a054520 --- /dev/null +++ b/scripts/zip_split.sh @@ -0,0 +1,108 @@ +#!/bin/bash + +set -euo pipefail + +# --- Config --- +DEFAULT_MAX_SIZE_MB=500 +ZIP_PREFIX="archive_part" +OUTPUT_DIR="zipped_parts" + +# --- Help --- +print_help() { + cat < [max_size_mb] + +Splits files from a directory into zip archives, each under a max size. +Useful for platforms like Discord with upload size limits. + +Arguments: + directory Path to directory containing files to archive + max_size_mb Maximum size per zip file in MB (default: $DEFAULT_MAX_SIZE_MB) + +Options: + -h, --help Show this help message + +Example: + $(basename "$0") ./my_folder 500 +EOF +} + +# --- Platform-aware file size function --- +file_size() { + if [[ "$(uname)" == "Darwin" ]]; then + stat -f%z "$1" # macOS + else + stat --printf="%s" "$1" # Linux + fi +} + +# --- Parse args --- +if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then + print_help + exit 0 +fi + +if [[ $# -lt 1 ]]; then + echo "❌ Error: Missing directory argument." + print_help + exit 1 +fi + +SOURCE_DIR="$1" +MAX_SIZE_MB="${2:-$DEFAULT_MAX_SIZE_MB}" + +# Validate that MAX_SIZE_MB is a number +if ! [[ "$MAX_SIZE_MB" =~ ^[0-9]+$ ]]; then + echo "❌ Error: max_size_mb must be a number." + print_help + exit 1 +fi + +MAX_SIZE_BYTES=$((MAX_SIZE_MB * 1024 * 1024)) + +if [[ ! -d "$SOURCE_DIR" ]]; then + echo "❌ Error: Directory '$SOURCE_DIR' does not exist." + exit 1 +fi + +mkdir -p "$OUTPUT_DIR" + +# --- Main --- +CURRENT_BATCH=() +CURRENT_SIZE=0 +PART_INDEX=1 + +echo "📂 Scanning files in: $SOURCE_DIR" +echo "📦 Max size per archive: $MAX_SIZE_MB MB" +echo "📁 Output directory: $OUTPUT_DIR" + +shopt -s nullglob +for FILE in "$SOURCE_DIR"/*; do + [[ -f "$FILE" ]] || continue + SIZE=$(file_size "$FILE") + + if ((SIZE > MAX_SIZE_BYTES)); then + echo "⚠️ Skipping large file: $(basename "$FILE") (${SIZE} bytes)" + continue + fi + + if ((CURRENT_SIZE + SIZE > MAX_SIZE_BYTES && CURRENT_SIZE > 0)); then + ZIP_NAME="$OUTPUT_DIR/${ZIP_PREFIX}${PART_INDEX}.zip" + echo "📦 Creating $ZIP_NAME..." + zip -j -q "$ZIP_NAME" "${CURRENT_BATCH[@]}" + ((PART_INDEX++)) + CURRENT_BATCH=() + CURRENT_SIZE=0 + fi + + CURRENT_BATCH+=("$FILE") + CURRENT_SIZE=$((CURRENT_SIZE + SIZE)) +done + +if ((${#CURRENT_BATCH[@]} > 0)); then + ZIP_NAME="$OUTPUT_DIR/${ZIP_PREFIX}${PART_INDEX}.zip" + echo "📦 Creating $ZIP_NAME..." + zip -j -q "$ZIP_NAME" "${CURRENT_BATCH[@]}" +fi + +echo "✅ Done! Created zip files in '$OUTPUT_DIR'."