debian-dots

dotfiles (does the obvious)
git clone [email protected]:dracuxan/debian-dots.git
Log | Files | Refs | README | LICENSE

commit 546e0715eb4b98ee0fc349b0527bb179a5fccb39
Author: dracuxan <[email protected]>
Date:   Fri,  5 Jun 2026 16:50:09 +0530

batman

Diffstat:
ALICENSE | 28++++++++++++++++++++++++++++
AREADME.md | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aalacritty/alacritty.toml | 38++++++++++++++++++++++++++++++++++++++
Aconfig.ini | 27+++++++++++++++++++++++++++
Adunst/dunstrc | 32++++++++++++++++++++++++++++++++
Aeww/eww.scss | 7+++++++
Aeww/eww.yuck | 13+++++++++++++
Afastfetch/config.jsonc | 75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aflake.lock | 27+++++++++++++++++++++++++++
Aflake.nix | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ai3/config | 250+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ai3status/config | 40++++++++++++++++++++++++++++++++++++++++
Aiex/.iex.exs | 14++++++++++++++
Ainstall.sh | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anvim/init.lua | 4++++
Anvim/lazy-lock.json | 47+++++++++++++++++++++++++++++++++++++++++++++++
Anvim/lua/dracuxan/core/autoreload.lua | 21+++++++++++++++++++++
Anvim/lua/dracuxan/core/keymaps.lua | 99+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anvim/lua/dracuxan/core/options.lua | 80+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anvim/lua/dracuxan/plugins/cmp.lua | 90+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anvim/lua/dracuxan/plugins/langages.lua | 92+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anvim/lua/dracuxan/plugins/lazy.lua | 220+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anvim/lua/dracuxan/plugins/lsp.lua | 181+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anvim/lua/dracuxan/plugins/lualine.lua | 229+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anvim/lua/dracuxan/plugins/misic.lua | 46++++++++++++++++++++++++++++++++++++++++++++++
Anvim/lua/dracuxan/plugins/none-ls.lua | 31+++++++++++++++++++++++++++++++
Anvim/lua/dracuxan/plugins/scope.lua | 8++++++++
Anvim/lua/dracuxan/plugins/telescope.lua | 151++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anvim/lua/dracuxan/plugins/textobjects.lua | 66++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anvim/lua/dracuxan/plugins/toggleterm.lua | 142+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anvim/lua/dracuxan/plugins/treesitter.lua | 35+++++++++++++++++++++++++++++++++++
Anvim/lua/dracuxan/plugins/vesper.lua | 20++++++++++++++++++++
Apicom/picom.conf | 45+++++++++++++++++++++++++++++++++++++++++++++
Arofi/config.rasi | 91+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ascreenshots/alacritty.png | 0
Ascreenshots/blank.png | 0
Ascreenshots/new_rice.png | 0
Ascreenshots/nvim_plus_tmux.png | 0
Ascreenshots/rice-1.png | 0
Ascripts/caps_watch | 0
Ascripts/caps_watch.c | 43+++++++++++++++++++++++++++++++++++++++++++
Ascripts/cemu | 2++
Ascripts/obs | 2++
Ascripts/obsidian | 3+++
Ascripts/pcsx2 | 3+++
Ascripts/psp | 3+++
Ascripts/run | 209+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ascripts/set_wallpaper | 233+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ascripts/setup_monitors | 40++++++++++++++++++++++++++++++++++++++++
Ascripts/slack | 2++
Ascripts/start_tmux | 93+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ascripts/steam | 2++
Ascripts/volume_control | 19+++++++++++++++++++
Ascripts/zen | 4++++
Astarship/starship.toml | 42++++++++++++++++++++++++++++++++++++++++++
Atmux/.tmux.conf | 112+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Auninstall.sh | 48++++++++++++++++++++++++++++++++++++++++++++++++
Azsh/.zshrc | 146+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
58 files changed, 3432 insertions(+), 0 deletions(-)

diff --git a/LICENSE b/LICENSE @@ -0,0 +1,28 @@ +BSD 3-Clause License + +Copyright (c) 2026, dracuxan + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md @@ -0,0 +1,58 @@ +[![wakatime](https://wakatime.com/badge/user/0d75cfc5-da70-41b7-b8c8-661ef9d8338b/project/9358976a-67c2-4357-8140-bd4a4c743b96.svg)](https://wakatime.com/badge/user/0d75cfc5-da70-41b7-b8c8-661ef9d8338b/project/9358976a-67c2-4357-8140-bd4a4c743b96) + +# Dotfiles + +Personal configuration for Neovim, i3, tmux, zsh, and other tools, managed with GNU stow (may or may not work for you). + +![preview](./screenshots/new_rice.png) + +## Installation + +> [!WARNING] +> These dotfiles are under **active development**. Existing configurations will be overwritten. + +### 1. Clone & Dependencies + +Install packages using Nix (recommended) or your system package manager. +**Requirements:** `stow`, `git`, `zsh`, `Neovim`, `tmux`, `i3`, `picom`. + +```bash +git clone https://github.com/dracuxan/debian-dots.git ~/dotfiles && cd ~/dotfiles +# Optional: Install tools via Nix +nix profile install .#default +``` + +### 2. Apply Configs + +```bash +./install.sh +``` + +### Uninstall + +```bash +./uninstall.sh +``` + +## Screenshots + +<div align="center"> + <img src="./screenshots/rice-1.png" alt="i3 WM" width="49%"/> + <img src="./screenshots/alacritty.png" alt="Fastfetch" width="49%"/> +</div> + +<div align="center"> + <img src="./screenshots/nvim_plus_tmux.png" alt="Neovim+Tmux" width="49%"/> + <img src="./screenshots/blank.png" alt="Clean Desktop" width="49%"/> +</div> + +## Scripts + +> [!WARNING] +> Scripts in `scripts/` are experimental. + +- `run.sh`: Universal runner for C, Go, Rust, Elixir, JS, and more. +- `start_tmux.sh`: Smart session manager (auto-attach/create) with logging. +- `set_wallpaper.sh`: Manages background images. +- `setup_monitors.sh`: Configures multi-monitor layouts. +- `steam`, `obs`, `zen`, etc.: Wrappers for Flatpak applications. diff --git a/alacritty/alacritty.toml b/alacritty/alacritty.toml @@ -0,0 +1,38 @@ +[font] +size = 10 + +[font.bold] +family = "JetBrainsMono Nerd Font" +style = "Bold" + +[font.italic] +family = "JetBrainsMono Nerd Font" +style = "Regular" + +[font.normal] +family = "JetBrainsMono Nerd Font" +style = "Regular" + +[font.offset] +x = 0 +y = 0 + +[scrolling] +history = 10000 +multiplier = 3 + +[selection] +save_to_clipboard = true + +[window.padding] +x = 10 +y = 10 + +[keyboard] +bindings = [ + # Alt + hjkl navigation + { key = "H", mods = "Alt", chars = "\u001b[D" }, # Left + { key = "J", mods = "Alt", chars = "\u001b[B" }, # Down + { key = "K", mods = "Alt", chars = "\u001b[A" }, # Up + { key = "L", mods = "Alt", chars = "\u001b[C" }, # Right +] diff --git a/config.ini b/config.ini @@ -0,0 +1,27 @@ +; Colorscheme +include-file = ${env:POLYBAR_COLLECTION}/colorscheme/gruvbox.ini + +; Theme +include-directory = ${env:POLYBAR_COLLECTION}/themes/murz + +[bar/main] +width = 100% +height = 30 + +bottom = true +fixed-center = true + +offset-x = 0 +offset-y = 0 + +background = ${colors.semi-trans} +foreground = ${colors.fg0} + +; Options: bspwm, i3 +wm-restack = bspwm + +; Font file +include-file = fonts.ini + +; Set enabled modules +include-file = ${env:POLYBAR_COLLECTION}/enabled-modules.ini diff --git a/dunst/dunstrc b/dunst/dunstrc @@ -0,0 +1,32 @@ +[global] +# Appearance +font = "JetBrainsMono Nerd Font 10" +transparency = 1 +frame_color = "#999ecf" +separator_color = "#999ecf" +monitor = 1 + +# Colors matching your i3 config +background = "#1D1E1C" +foreground = "#ffcfa8" +timeout = 5 + +[urgency_low] +background = "#1D1E1C" +foreground = "#cccccc" +timeout = 3 + +[urgency_normal] +background = "#1D1E1C" +foreground = "#ffcfa8" +timeout = 5 + +[urgency_critical] +background = "#1D1E1C" +foreground = "#ff5555" +frame_color = "#ff5555" +timeout = 0 + +[volume] +summary = "Volume" +skip_display = true diff --git a/eww/eww.scss b/eww/eww.scss @@ -0,0 +1,7 @@ +.activate-linux { + color: rgba(250, 250, 250, 0.5); + + &.background { + background: none; + } +} diff --git a/eww/eww.yuck b/eww/eww.yuck @@ -0,0 +1,13 @@ +(defwidget activate-linux [] + (box + :orientation "v" + :halign "start" + :valign "start" + (label :xalign 0 :markup "<span font_size=\"large\">Activate Debian</span>") + (label :xalign 0 :text "Go to Settings to activate Debian"))) + +(defwindow activate-linux + :monitor 1 + :stacking "bg" + :geometry (geometry :x "0px" :y "-50px" :width "250px" :anchor "bottom right") + (activate-linux)) diff --git a/fastfetch/config.jsonc b/fastfetch/config.jsonc @@ -0,0 +1,75 @@ +{ + "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json", + "logo": { + "type": "small", + "padding": { + "top": 2, + "left": 3, + }, + }, + "display": { + "separator": "", + "key": { + "width": 15, + }, + "color": { + "keys": "white", + "title": "red", + }, + }, + "modules": [ + { + "key": "╭───────────╮", + "type": "custom", + }, + { + "key": "│ │\u001b[11D{#36} user", + "type": "title", + }, + { + "key": "│ │\u001b[11D{#38}󰣇 os", + "type": "os", + "format": "{2}", + }, + { + "key": "│ │\u001b[11D{#31}󰅐 uptime", + "type": "uptime", + }, + { + "key": "│ │\u001b[11D{#32} term", + "type": "terminal", + "format": "{5}", + }, + { + "key": "│ │\u001b[11D{#33} shell", + "type": "shell", + }, + { + "key": "│ │\u001b[11D{#34}󰍛 cpu", + "type": "cpu", + "format": "{1}", + }, + { + "key": "│ │\u001b[11D{#37}󰍛 gpu", + "type": "gpu", + "format": "{2}", + }, + { + "key": "│ │\u001b[11D{#35} memory", + "type": "memory", + }, + { + "key": "│ │\u001b[11D{#39}󰓡 swap", + "type": "swap", + }, + { + "key": "│ │\u001b[11D{#36}󰩟 network", + "type": "localip", + "format": "{1} ({4})", + }, + { + "key": "╰───────────╯", + "type": "custom", + }, + ], +} diff --git a/flake.lock b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1767767207, + "narHash": "sha256-Mj3d3PfwltLmukFal5i3fFt27L6NiKXdBezC1EBuZs4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5912c1772a44e31bf1c63c0390b90501e5026886", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix @@ -0,0 +1,63 @@ +{ + description = "System-wide tools via Nix flakes"; + + inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; }; + + outputs = { self, nixpkgs }: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + }; + in { + packages.${system}.default = pkgs.buildEnv { + name = "system-tools"; + + paths = with pkgs; [ + # editors / shell + tmux + + # cli utils + ripgrep + fd + bat + eza + curl + wget + git + zoxide + stow + fastfetch + starship + fzf + fd + gh + gawk + acpi + lazygit + ffmpeg + opencode + cmus + tokei + rumno + + # dev tools + zig + gnumake + go_1_24 + nodejs_24 + bun + pnpm + python315 + uv + + # BEAM + inotify-tools + elixir-ls + xdg-utils + watchman + ]; + }; + }; +} diff --git a/i3/config b/i3/config @@ -0,0 +1,250 @@ +# Base +set $mod Mod4 +font pango:JetBrainsMono Nerd Font 11 + +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + +# Autostart +exec --no-startup-id xset r rate 200 30 +exec --no-startup-id dex --autostart --environment i3 +exec --no-startup-id blueman-applet +exec --no-startup-id xinput set-prop 15 "libinput Natural Scrolling Enabled" 1 +exec --no-startup-id xset -dpms +exec --no-startup-id xset s off +exec --no-startup-id dunst +exec --no-startup-id rumno daemon --foreground +exec --no-startup-id autorandr --change +exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork +exec --no-startup-id nm-applet +exec --no-startup-id /home/dracuxan/Source/eww/target/release/eww open activate-linux + +# Startup commands +exec --no-startup-id sleep 3 && /home/dracuxan/.local/bin/setup_monitors; /home/dracuxan/.local/bin/set_wallpaper +exec --no-startup-id caps_watch +exec --no-startup-id fusuma + +# Media + Brightness +# Volume control with PipeWire (wpctl) +bindsym XF86AudioRaiseVolume exec --no-startup-id volume_control up +bindsym XF86AudioLowerVolume exec --no-startup-id volume_control down +bindsym XF86AudioMute exec --no-startup-id volume_control mute + +# Brightness +bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl set +10% +bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl set 10%- + +# Launchers + Apps +# start a terminal +bindsym $mod+Return exec --no-startup-id alacritty + +# start dmenu (a program launcher) +bindsym $mod+d exec --no-startup-id rofi -show run -display-run '>' -m 0 +bindsym $mod+b exec --no-startup-id helium +bindsym $mod+x exec --no-startup-id zen x.com/xandrom_app + +# Custom keybinds +bindsym $mod+p exec sioyek + +# keybind for OBS +bindsym $mod+o exec obs + +# Screenshot +bindsym $mod+Shift+s exec flameshot gui + +# Window Focus + Movement +# change focus +bindsym $mod+h focus left +bindsym $mod+l focus right +bindsym $mod+k focus up +bindsym $mod+j focus down + +# alternatively, you can use the cursor keys: +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# move focused window +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right + +# alternatively, you can use the cursor keys: +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +# bindsym $mod+d focus child + +# kill focused window +bindsym $mod+q kill + +# toggle between last focused window +bindsym Mod1+Tab focus right +bindsym Mod1+Shift+Tab focus left + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# move window to center +bindsym $mod+c move position center + +# Layout + Containers +# split in horizontal orientation +bindsym $mod+semicolon split h + +# split in vertical orientation +bindsym $mod+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# change wallpaper +bindsym $mod+Shift+w exec --no-startup-id set_wallpaper --select + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# Workspaces +# Define names for default workspaces for which we configure key bindings later on. +# We use variables to avoid repeating the names in multiple places. +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws5 "5" +set $ws6 "6" + +# Bind workspaces to outputs +workspace 6 output eDP + +# switch to workspace +bindsym $mod+1 workspace number $ws1 +bindsym $mod+2 workspace number $ws2 +bindsym $mod+3 workspace number $ws3 +bindsym $mod+4 workspace number $ws4 +bindsym $mod+5 workspace number $ws5 +bindsym $mod+6 workspace number $ws6 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace number $ws1 +bindsym $mod+Shift+2 move container to workspace number $ws2 +bindsym $mod+Shift+3 move container to workspace number $ws3 +bindsym $mod+Shift+4 move container to workspace number $ws4 +bindsym $mod+Shift+5 move container to workspace number $ws5 +bindsym $mod+Shift+6 move container to workspace number $ws6 + +# switch to last used workspace +bindsym $mod+Tab workspace back_and_forth + +# change focus to next workspace +bindsym $mod+n workspace next +# bindsym $mod+Shift+n workspace previous + +# Session Control +# reload the configuration file +bindsym $mod+Shift+c reload +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart +# exit i3 (logs you out of your X session) +bindsym $mod+Shift+e exec "i3-msg exit" + +# Increase inner gaps +bindsym $mod+g gaps inner current plus 5 + +# Decrease inner gaps +bindsym $mod+Shift+g gaps inner current minus 5 + +# resize windows to a custom size +bindsym $mod+Shift+m resize set width 35 ppt +bindsym $mod+Shift+n resize set width 50 ppt + +# Modes +# resize window (you can also use the mouse for that) +mode "resize" { + bindsym h resize shrink width 10 px or 10 ppt + bindsym j resize grow height 10 px or 10 ppt + bindsym k resize shrink height 10 px or 10 ppt + bindsym l resize grow width 10 px or 10 ppt + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+r mode "default" +} + +bindsym $mod+r mode "resize" + +# Bar +bar { + i3bar_command i3bar -t + status_command i3status + modifier Mod5 + position top + strip_workspace_numbers yes + height 25 + font pango:JetBrainsMono Nerd Font 10 + tray_output none + + colors { + background #00000000 + statusline #ffcfa8 + separator #999ecf + + #<border> <background> <text> + focused_workspace $black #00000000 #ffffff + active_workspace #00000000 #00000000 #ffcfa8 + inactive_workspace #00000000 #00000000 #cccccc + urgent_workspace $black #00000000 #ff5555 + } +} + +# hide bar +bindsym $mod+m bar mode toggle + +# Appearance +# Colorscheme + +# Focused window (active) +client.focused #999ecf #999ecf #000000 #999ecf #999ecf + +# Unfocused windows +client.unfocused #1D1E1C #000000 #888888 #000000 #1D1E1C + +# mouse for focus +focus_follows_mouse no +mouse_warping none + +# No title bars, but keep thin highlight border +default_border pixel 1 +default_floating_border pixel 1 + +# Force all new windows into tabbed layout +workspace_layout tabbed + +# Gaps +# Set space between windows and screen edges +gaps outer 0 + +# Set space between windows +gaps inner 0 + +# Rules +assign [class="workfolio"] workspace 6 +for_window [class="gnuplot_qt"] floating enable +for_window [class="feh"] floating enable diff --git a/i3status/config b/i3status/config @@ -0,0 +1,40 @@ +general { + colors = true + interval = 5 + + color_good = "#99ffe4" + color_degraded = "#ffcfa8" + color_bad = "#ff8080" +} + +order += "wireless _first_" +order += "battery all" +order += "disk /" +order += "memory" +order += "tztime local" + +wireless _first_ { + format_up = "󰖩 %quality @ %essid " + format_down = "󰖪 down " +} + +battery all { + format = " %percentage %remaining" + format_down = "  " + last_full_capacity = true +} + +disk "/" { + format = " 󰋊 %avail " +} + +memory { + format = "  %used " + threshold_degraded = "1G" + format_degraded = " < %available" +} + +tztime local { + format = " 󰃭 %d-%m-%Y | %I:%M %p " +} + diff --git a/iex/.iex.exs b/iex/.iex.exs @@ -0,0 +1,14 @@ +IEx.configure( + # Main prompt + default_prompt: "λ > ", + + # Prompt when connected to a distributed node + alive_prompt: "λ (#{IO.ANSI.cyan()}%node#{IO.ANSI.reset()}) >" +) + +# Optional helper functions +defmodule Helpers do + def neo, do: IEx.Helpers.clear() +end + +import Helpers diff --git a/install.sh b/install.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +set -e # Exit on error + +echo "-----------------------------------------" +echo " DRACUXAN'S DOTFILES FOR DEBIAN " +echo "-----------------------------------------" + +echo "[+] Checking stow..." +if command -v stow >/dev/null 2>&1; then + echo "[+] exists" +else + echo "[-] stow does not exist! Please install manually" + exit 1 +fi + +echo "[+] Stowing dotfiles..." + +DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +echo "[+] Preparing ~/.config layout..." +for dir in fastfetch nvim alacritty i3 i3status picom rofi dunst eww; do + mkdir -p "$HOME/.config/$dir" +done + +echo "[+] Stowing configs into ~/.config/..." + +for dir in fastfetch nvim alacritty i3 i3status picom rofi dunst eww; do + stow --adopt -d "$DOTFILES_DIR" -t "$HOME/.config/$dir" "$dir" +done + +stow --adopt -d "$DOTFILES_DIR" -t "$HOME/.config" starship + +echo "[+] Stowing legacy dotfiles into ~/..." +for dir in zsh tmux iex; do + stow --adopt -d "$DOTFILES_DIR" -t "$HOME" "$dir" +done + +echo "[+] Building caps_watch..." +gcc -O2 -o "$DOTFILES_DIR/scripts/caps_watch" "$DOTFILES_DIR/scripts/caps_watch.c" -lX11 + +echo "[+] Stowing scripts into ~/.local/bin/..." +stow --adopt -d "$DOTFILES_DIR" -t "$HOME/.local/bin" scripts + +echo "[+] Checking wallpaper config..." + +if [[ ! -f "$HOME/.config/wallpaper.conf" ]]; then + mkdir -p "$HOME/.config" + echo "# Wallpaper Configuration" >"$HOME/.config/wallpaper.conf" + echo "WALLPAPER_PATH=~/Wallpapers/anime_skull.png" >>"$HOME/.config/wallpaper.conf" + echo "Created default wallpaper configuration" +fi + +echo "-----------------------------------------" +echo " SETUP COMPLETE. REBOOT NOW " +echo "-----------------------------------------" diff --git a/nvim/init.lua b/nvim/init.lua @@ -0,0 +1,4 @@ +require("dracuxan.core.options") +require("dracuxan.core.keymaps") +require("dracuxan.core.autoreload").setup() +require("dracuxan.plugins.lazy") diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json @@ -0,0 +1,47 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "LuaSnip": { "branch": "master", "commit": "642b0c595e11608b4c18219e93b88d7637af27bc" }, + "auto-session": { "branch": "main", "commit": "62437532b38495551410b3f377bcf4aaac574ebe" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, + "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "fidget.nvim": { "branch": "main", "commit": "7fa433a83118a70fe24c1ce88d5f0bd3453c0970" }, + "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, + "gitsigns.nvim": { "branch": "main", "commit": "0f00d07c2c3106ba6abd594ac1c17f211141b7b5" }, + "gopher.nvim": { "branch": "main", "commit": "27ba078f14dd39fcd5e8a57d7009cdd77450ebbb" }, + "indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "25f609e7fca78af7cede4f9fa3af8a94b1c4950b" }, + "mason-null-ls.nvim": { "branch": "main", "commit": "8e7806acaa87fae64f0bfde25bb4b87c18bd19b4" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "443f1ef8b5e6bf47045cb2217b6f748a223cf7dc" }, + "mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" }, + "mini.icons": { "branch": "main", "commit": "5b9076dae1bfbe47ba4a14bc8b967cde0ab5d77e" }, + "noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" }, + "none-ls-extras.nvim": { "branch": "main", "commit": "c6fa39ac52814182c05552cb5d3750cae23ff0f0" }, + "none-ls.nvim": { "branch": "main", "commit": "c9317c2a8629d4e39e7cf47be74cb67f3ab37cda" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" }, + "nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, + "nvim-dap": { "branch": "master", "commit": "4f5deb110d9ff8994d96c21df95e2271d11214f9" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" }, + "nvim-lspconfig": { "branch": "master", "commit": "8e2084bf5e40c79c1f42210a6ef96a0a4793a763" }, + "nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" }, + "nvim-treesitter": { "branch": "master", "commit": "cf12346a3414fa1b06af75c79faebe7f76df080a" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" }, + "nvim-ts-autotag": { "branch": "main", "commit": "8e1c0a389f20bf7f5b0dd0e00306c1247bda2595" }, + "nvim-web-devicons": { "branch": "master", "commit": "d7462543c9e366c0d196c7f67a945eaaf5d99414" }, + "ocaml.nvim": { "branch": "main", "commit": "d56d551f1b7efbb2ebd250b4701e0a38568cec04" }, + "oxocarbon.nvim": { "branch": "main", "commit": "a7ba74849a00546a311f8c146320b433900393e7" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "scope.nvim": { "branch": "main", "commit": "228aabdb1b9cc74f0c0ccec88e79873857236e49" }, + "snacks.nvim": { "branch": "main", "commit": "ad9ede6a9cddf16cedbd31b8932d6dcdee9b716e" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" }, + "telescope.nvim": { "branch": "master", "commit": "5255aa27c422de944791318024167ad5d40aad20" }, + "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, + "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, + "vesper.nvim": { "branch": "main", "commit": "1717b1ad657c94bec3fc2bdebb0c55452d9fe46d" }, + "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" } +} diff --git a/nvim/lua/dracuxan/core/autoreload.lua b/nvim/lua/dracuxan/core/autoreload.lua @@ -0,0 +1,21 @@ +local vim = vim +local M = {} + +function M.setup() + local autoreload_group = vim.api.nvim_create_augroup("AutoReload", { clear = true }) + + vim.api.nvim_create_autocmd({ + "FocusGained", + "CursorHold", + "CursorHoldI", + }, { + group = autoreload_group, + callback = function() + if vim.bo.modified == false then + vim.cmd("checktime") + end + end, + }) +end + +return M diff --git a/nvim/lua/dracuxan/core/keymaps.lua b/nvim/lua/dracuxan/core/keymaps.lua @@ -0,0 +1,99 @@ +local vim = vim +local vk = vim.keymap.set + +-- Leader +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +-- Defaults +local opts = { noremap = true, silent = true } + +-- Insert +vk("i", "jj", "<Esc>", opts) +vk("i", "<C-b>", "<C-o>^", opts) +vk("i", "<C-e>", "<C-o>$", opts) + +-- Normal/Visual +vk({ "n", "v" }, "<Space>", "<Nop>", { silent = true }) + +-- Save +vk("n", "<C-s>", "<cmd> w <CR>", opts) +vk("i", "<C-s>", "<Esc><cmd> w <CR>", opts) +vk("n", "<leader>s", "<cmd> noautocmd w <CR>", opts) +vk("n", "<leader>a", "<cmd> AutoSession search <CR>", opts) + +-- Edit +vk("n", "x", '"_x', opts) + +-- Resize +vk("n", "<Up>", ":resize -2<CR>", opts) +vk("n", "<Down>", ":resize +2<CR>", opts) +vk("n", "<Left>", ":vertical resize -2<CR>", opts) +vk("n", "<Right>", ":vertical resize +2<CR>", opts) + +-- Buffers +vk("n", "<Tab>", ":bnext<CR>", opts) +vk("n", "<S-Tab>", ":bprevious<CR>", opts) +vk("n", "<leader>x", ":bdelete!<CR>", opts) +vk("n", "<leader>x", function() + local bufnr = vim.api.nvim_get_current_buf() -- Get the current buffer number + local buffers = vim.fn.getbufinfo({ buflisted = 1 }) -- Get list of open buffers + + if #buffers > 1 then + vim.cmd("bnext") -- Switch to the next buffer + else + vim.cmd("enew") -- Open a new empty buffer if it's the last one + end + + vim.cmd("bdelete! " .. bufnr) -- Delete the previous buffer +end, opts) + +-- Windows +vk("n", "<C-k>", ":wincmd k<CR>", opts) +vk("n", "<C-j>", ":wincmd j<CR>", opts) +vk("n", "<C-h>", ":wincmd h<CR>", opts) +vk("n", "<C-l>", ":wincmd l<CR>", opts) + +-- Visual +vk("v", "<", "<gv", opts) +vk("v", ">", ">gv", opts) +vk("v", "p", '"_dP', opts) + +-- Diagnostics +vk("n", "<leader>d", vim.diagnostic.open_float, { desc = "Open floating diagnostic message" }) +vk("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostics list" }) + +-- Reload +local new_opts = { desc = "Reload current Lua file", noremap = true, silent = true } +vk("n", "<leader>rr", ":luafile %<CR>", new_opts) + +-- Lazy +vk("n", "<leader>l", "<cmd>Lazy<CR>", opts) + +-- Snacks +vk("n", "<M-\\>", function() + Snacks.explorer() +end, { desc = "Toggle Snacks Explorer" }) + +-- Quit +vk("n", "<C-q>", "<cmd> qa <CR>", opts) +vk("i", "<C-q>", "<cmd> qa <CR>", opts) +vk("n", "qq", "<cmd> q <CR>", opts) + +-- Telescope +vk( + "n", + "<leader>ft", + "<cmd> TodoTelescope <CR>", + { desc = "[F]ind [T]odos using telescope", noremap = true, silent = true } +) + +-- File reload +vk("n", "<leader>fr", ":checktime<CR>", { desc = "Check external file changes" }) +vk("n", "<leader>fr!", ":edit!<CR>", { desc = "Force reload file" }) + +-- Terminal +vk("t", "<C-h>", [[<C-\><C-N><C-w>h]]) +vk("t", "<C-j>", [[<C-\><C-N><C-w>j]]) +vk("t", "<C-k>", [[<C-\><C-N><C-w>k]]) +vk("t", "<C-l>", [[<C-\><C-N><C-w>l]]) diff --git a/nvim/lua/dracuxan/core/options.lua b/nvim/lua/dracuxan/core/options.lua @@ -0,0 +1,80 @@ +local vim = vim + +-- UI +vim.wo.number = true +vim.o.relativenumber = true +vim.o.numberwidth = 2 +vim.o.cursorline = false +vim.o.wrap = true +vim.o.linebreak = true +vim.o.breakindent = true +vim.wo.signcolumn = "yes" +vim.o.showmode = false +vim.opt.termguicolors = true +vim.o.showtabline = 2 +vim.o.pumheight = 10 +vim.o.conceallevel = 0 +vim.o.cmdheight = 1 +vim.opt.fillchars = { eob = " " } + +-- Behavior +vim.o.mouse = "" +vim.o.autoindent = true +vim.o.smartindent = true +vim.o.ignorecase = true +vim.o.smartcase = true +vim.o.hlsearch = false +vim.o.whichwrap = "bs<>[]hl" +vim.o.scrolloff = 0 +vim.o.sidescrolloff = 8 +vim.o.splitbelow = true +vim.o.splitright = true +vim.o.backspace = "indent,eol,start" + +-- Indentation +vim.o.shiftwidth = 2 +vim.o.tabstop = 2 +vim.o.softtabstop = 2 +vim.o.expandtab = true + +-- Files and undo +vim.o.swapfile = false +vim.o.backup = false +vim.o.writebackup = false +vim.o.undofile = true +vim.o.fileencoding = "utf-8" + +-- Completion and messaging +vim.o.completeopt = "menuone,noselect" +vim.opt.shortmess:append("c") +vim.opt.iskeyword:append("-") +vim.opt.formatoptions:remove({ "c", "r", "o" }) + +-- Timing +vim.o.updatetime = 250 +vim.o.timeoutlen = 300 +vim.o.updatetime = 1000 + +-- Clipboard +vim.o.clipboard = "unnamedplus" +vim.opt.clipboard = "unnamedplus" + +-- Folding +vim.wo.foldmethod = "expr" +vim.wo.foldexpr = "nvim_treesitter#foldexpr()" +vim.wo.foldlevel = 99 +vim.o.showtabline = 0 +vim.o.tabline = "" + +vim.api.nvim_create_autocmd("ColorScheme", { + callback = function() + local set_hl = vim.api.nvim_set_hl + set_hl(0, "TabLine", { bg = "none" }) + set_hl(0, "TabLineSel", { bg = "none", bold = true }) + set_hl(0, "TabLineFill", { bg = "none" }) + set_hl(0, "NormalFloat", { bg = "none" }) + set_hl(0, "FloatBorder", { bg = "none", fg = "none" }) + set_hl(0, "OilNormal", { bg = "none" }) + set_hl(0, "OilFloat", { bg = "none" }) + end, +}) diff --git a/nvim/lua/dracuxan/plugins/cmp.lua b/nvim/lua/dracuxan/plugins/cmp.lua @@ -0,0 +1,90 @@ +local cmp = require("cmp") +local luasnip = require("luasnip") + +luasnip.config.setup({}) + +local kind_icons = { + Text = "󰉿", + Method = "m", + Function = "󰊕", + Constructor = "", + Field = "", + Variable = "󰆧", + Class = "󰌗", + Interface = "", + Module = "", + Property = "", + Unit = "", + Value = "󰎠", + Enum = "", + Keyword = "󰌋", + Snippet = "", + Color = "󰏘", + File = "󰈙", + Reference = "", + Folder = "󰉋", + EnumMember = "", + Constant = "󰇽", + Struct = "", + Event = "", + Operator = "󰆕", + TypeParameter = "󰊄", +} + +cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + completion = { completeopt = "menu,menuone,noinsert" }, + mapping = cmp.mapping.preset.insert({ + ["<C-n>"] = cmp.mapping.select_next_item(), + ["<C-p>"] = cmp.mapping.select_prev_item(), + ["<C-b>"] = cmp.mapping.scroll_docs(-4), + ["<C-f>"] = cmp.mapping.scroll_docs(4), + ["<CR>"] = cmp.mapping.confirm({ select = true }), + ["<C-Space>"] = cmp.mapping.complete({}), + ["<Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + ["<S-Tab>"] = 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 = { + { + name = "lazydev", + group_index = 0, + }, + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "buffer" }, + { name = "path" }, + }, + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function(entry, vim_item) + vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) + vim_item.menu = ({ + nvim_lsp = "[LSP]", + luasnip = "[Snippet]", + buffer = "[Buffer]", + path = "[Path]", + })[entry.source.name] + return vim_item + end, + }, +}) diff --git a/nvim/lua/dracuxan/plugins/langages.lua b/nvim/lua/dracuxan/plugins/langages.lua @@ -0,0 +1,92 @@ +return { + { + "tarides/ocaml.nvim", + config = function() + require("ocaml").setup() + end, + }, + + { + "windwp/nvim-ts-autotag", + ft = { "javascript", "javascriptreact", "typescript", "typescriptreact" }, + config = function() + require("nvim-ts-autotag").setup({}) + end, + }, + + { + "mfussenegger/nvim-dap", + }, + + { + "theHamsta/nvim-dap-virtual-text", + lazy = false, + config = function(_, opts) + require("nvim-dap-virtual-text").setup(opts) + end, + }, + + { + "olexsmir/gopher.nvim", + ft = "go", + config = function(_, opts) + require("gopher").setup(opts) + end, + build = function() + vim.cmd([[silent! GoInstallDeps]]) + end, + }, + + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + main = "nvim-treesitter.configs", -- Sets main module to use for opts + config = function() + require("dracuxan.plugins.treesitter") -- Loads the Treesitter configuration + end, + }, + + { + "hrsh7th/nvim-cmp", + dependencies = { + { + "L3MON4D3/LuaSnip", + build = (function() + if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then + return + end + return "make install_jsregexp" + end)(), + dependencies = { + { + "rafamadriz/friendly-snippets", + config = function() + require("luasnip.loaders.from_lua").lazy_load({ + paths = "~/.config/nvim/lua/luasnip/snippets/", + }) + require("luasnip.loaders.from_vscode").lazy_load() + end, + }, + }, + }, + "saadparwaiz1/cmp_luasnip", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + }, + config = function() + require("dracuxan.plugins.cmp") + end, + }, + + { + "nvimtools/none-ls.nvim", + dependencies = { + "nvimtools/none-ls-extras.nvim", + "jayp0521/mason-null-ls.nvim", -- ensures dependencies are installed + }, + config = function() + require("dracuxan.plugins.none-ls") + end, + }, +} diff --git a/nvim/lua/dracuxan/plugins/lazy.lua b/nvim/lua/dracuxan/plugins/lazy.lua @@ -0,0 +1,220 @@ +-- Set up the Lazy plugin manager +local vim = vim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + error("Error cloning lazy.nvim:\n" .. out) + end +end +vim.opt.rtp:prepend(lazypath) + +local custom_plugins = { + require("dracuxan.plugins.telescope"), + require("dracuxan.plugins.misic"), + require("dracuxan.plugins.lsp"), + require("dracuxan.plugins.langages"), + require("dracuxan.plugins.textobjects"), + + { + "tiagovla/scope.nvim", + config = function() + require("scope").setup({}) + end, + }, + + { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + opts = { + explorer = { + enabled = true, + }, + picker = { + sources = { + explorer = { + layout = { + preset = "sidebar", + preview = false, + layout = { + position = "right", + width = 35, + }, + }, + }, + }, + }, + }, + }, + + { + "nyoom-engineering/oxocarbon.nvim", + }, + + { + "nvim-treesitter/nvim-treesitter", + branch = "master", + lazy = false, + build = ":TSUpdate", + }, + + { + "folke/noice.nvim", + config = function() + require("noice").setup({ + -- add any options here + lsp = { + documentation = { + opts = { + size = { + max_width = 80, + max_height = 20, + }, + }, + }, + }, + routes = { + { + filter = { + event = "msg_show", + any = { + { find = "%d+L, %d+B" }, + { find = "; after #%d+" }, + { find = "; before #%d+" }, + { find = "%d fewer lines" }, + { find = "%d more lines" }, + }, + }, + opts = { skip = true }, + }, + }, + presets = { + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = true, -- position the cmdline and popupmenu together + long_message_to_split = true, -- long messages will be sent to a split + lsp_doc_border = true, -- add a border to hover docs and signature help + }, + }) + end, + dependencies = { "MunifTanjim/nui.nvim" }, + }, + + { + "akinsho/toggleterm.nvim", + version = "*", + config = function() + require("dracuxan.plugins.toggleterm") + end, + lazy = false, + }, + + { + "datsfilipe/vesper.nvim", + version = false, + lazy = false, + priority = 1000, -- make sure to load this before all the other start plugins + config = function() + require("dracuxan.plugins.vesper") + end, + }, + + { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + config = function() + local hooks = require("ibl.hooks") + + hooks.register(hooks.type.HIGHLIGHT_SETUP, function() + -- normal indent lines (purple) + vim.api.nvim_set_hl(0, "IndentPurple", { fg = "#2f324f" }) + + -- active scope (when cursor inside function) + vim.api.nvim_set_hl(0, "ScopePeach", { fg = "#999ecf" }) + end) + + require("ibl").setup({ + indent = { + highlight = { "IndentPurple" }, + }, + scope = { + enabled = true, + highlight = { "ScopePeach" }, + show_start = true, + show_end = true, + }, + }) + end, + }, + + { + "rmagatti/auto-session", + config = function() + local height = math.floor(vim.o.lines * 0.45) + local width = 70 + + require("auto-session").setup({ + session_lens = { + picker_opts = { + height = height, + width = width, + layout_strategy = "center", + layout_config = { + anchor = "C", + }, + -- border = "rounded", + }, + }, + log_level = "error", + auto_session_suppress_dirs = { "~/", "~/Downloads" }, + }) + end, + }, + + { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + disabled_filetypes = { "alpha" }, + config = function() + require("dracuxan.plugins.lualine") + end, + }, + + { + "lewis6991/gitsigns.nvim", + opts = { + signs = { + add = { text = "+" }, + change = { text = "~" }, + delete = { text = "_" }, + topdelete = { text = "‾" }, + changedelete = { text = "~" }, + }, + signs_staged = { + add = { text = "+" }, + change = { text = "~" }, + delete = { text = "_" }, + topdelete = { text = "‾" }, + changedelete = { text = "~" }, + }, + }, + }, + + { + "numToStr/Comment.nvim", + opts = {}, + config = function() + local opts = { noremap = true, silent = true } + vim.keymap.set("n", "<C-c>", require("Comment.api").toggle.linewise.current, opts) + vim.keymap.set( + "v", + "<C-c>", + "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", + opts + ) + end, + }, +} + +require("lazy").setup(custom_plugins) diff --git a/nvim/lua/dracuxan/plugins/lsp.lua b/nvim/lua/dracuxan/plugins/lsp.lua @@ -0,0 +1,181 @@ +local vim = vim + +return { + "neovim/nvim-lspconfig", + dependencies = { + { "williamboman/mason.nvim", config = true }, -- NOTE: Must be loaded before dependants + "williamboman/mason-lspconfig.nvim", + "WhoIsSethDaniel/mason-tool-installer.nvim", + { "j-hui/fidget.nvim", opts = {} }, + + "hrsh7th/cmp-nvim-lsp", + }, + config = function() + local lspconfig = require("lspconfig") + local util = lspconfig.util + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }), + callback = function(event) + local map = function(keys, func, desc, mode) + mode = mode or "n" + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc }) + end + + local telescope = require("telescope.builtin") + -- Jump to the definition of the word under your cursor + map("gd", telescope.lsp_definitions, "[G]oto [D]efinition") + + -- Find references for the word under your cursor + map("gr", telescope.lsp_references, "[G]oto [R]eferences") + + -- Jump to the implementation of the word under your cursor + map("gI", telescope.lsp_implementations, "[G]oto [I]mplementation") + + -- Jump to the type of the word under your cursor + map("<leader>D", telescope.lsp_type_definitions, "Type [D]efinition") + + -- Fuzzy find all the symbols in your current document + map("<leader>ds", telescope.lsp_document_symbols, "[D]ocument [S]ymbols") + + -- Fuzzy find all the symbols in your current workspace + map("<leader>ws", telescope.lsp_dynamic_workspace_symbols, "[W]orkspace [S]ymbols") + -- Rename the variable under your cursor. + -- Most Language Servers support renaming across files, etc. + map("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame") + + -- Execute a code action, usually your cursor needs to be on top of an error + -- or a suggestion from your LSP for this to activate. + map("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction", { "n", "x" }) + + local client = vim.lsp.get_client_by_id(event.data.client_id) + if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then + local highlight_augroup = vim.api.nvim_create_augroup("kickstart-lsp-highlight", { clear = false }) + vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.document_highlight, + }) + + vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references, + }) + + vim.api.nvim_create_autocmd("LspDetach", { + group = vim.api.nvim_create_augroup("kickstart-lsp-detach", { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds({ group = "kickstart-lsp-highlight", buffer = event2.buf }) + end, + }) + end + + if client.supports_method("textDocument/formatting") then + local format_augroup = vim.api.nvim_create_augroup("lsp-format-" .. event.buf, { clear = true }) + + vim.api.nvim_create_autocmd("BufWritePre", { + group = format_augroup, + buffer = event.buf, + callback = function() + if vim.bo.filetype == "oil" then + return + end + vim.lsp.buf.format({ bufnr = event.buf }) + end, + }) + + vim.diagnostic.config({ + update_in_insert = false, -- Show errors while typing + virtual_text = true, -- Show inline errors + signs = true, -- Show signs in the gutter + underline = true, -- Underline errors + }) + end + + vim.api.nvim_create_autocmd("BufWritePre", { + pattern = "*.go", + callback = function() + if vim.bo.filetype == "oil" then + return + end + local params = vim.lsp.util.make_range_params(0, "utf-16") + params.context = { only = { "source.organizeImports" } } + local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params) + for cid, res in pairs(result or {}) do + for _, r in pairs(res.result or {}) do + if r.edit then + local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or "utf-16" + vim.lsp.util.apply_workspace_edit(r.edit, enc) + end + end + end + vim.lsp.buf.format({ async = false }) + end, + }) + end, + }) + + local servers = { + lua_ls = { + settings = { + Lua = { + completion = { + callSnippet = "Replace", + }, + runtime = { version = "LuaJIT" }, + diagnostics = { disable = { "missing-fields" }, globals = { "vim" } }, + format = { + enable = false, + }, + }, + }, + }, + html = {}, + cssls = {}, + gopls = {}, + rust_analyzer = {}, + nil_ls = {}, + bashls = {}, + pyright = {}, + zls = {}, + ts_ls = {}, + eslint = {}, + elixirls = { + cmd = { "elixir-ls" }, + settings = { + elixirLS = { + dialyzerEnabled = false, + fetchDeps = false, + }, + }, + }, + } + + require("mason").setup() + + local ensure_installed = vim.tbl_keys(servers or {}) + vim.list_extend(ensure_installed, { + "stylua", + "shfmt", + "checkmake", + "prettierd", + "nixfmt", + "black", + }) + require("mason-tool-installer").setup({ ensure_installed = ensure_installed }) + + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities = vim.tbl_deep_extend("force", capabilities, require("cmp_nvim_lsp").default_capabilities()) + + require("mason-lspconfig").setup({ + handlers = { + function(server_name) + local server = servers[server_name] or {} + server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {}) + require("lspconfig")[server_name].setup(server) + end, + }, + }) + end, +} diff --git a/nvim/lua/dracuxan/plugins/lualine.lua b/nvim/lua/dracuxan/plugins/lualine.lua @@ -0,0 +1,229 @@ +-- Eviline config for lualine +-- Author: shadmansaleh +-- Credit: glepnir +local lualine = require("lualine") + +-- Color table for highlights +-- stylua: ignore +local colors = { + bg = 'none', + fg = '#DCD7BA', + yellow = '#E6C384', + cyan = '#7AA89F', + darkblue = '#223249', + green = '#98BB6C', + orange = '#C0A36E', + violet = '#938AA9', + magenta = '#957FB8', + blue = '#7E9CD8', + red = '#C34043', +} + +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 = { + globalstatus = true, + disabled_filetypes = {}, + -- 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 = {}, + }, + inactive_sections = { + -- these are to remove the defaults + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + lualine_c = {}, + 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 }, + 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_right({ + -- Lsp server name . + function() + local bufnr = vim.api.nvim_get_current_buf() + local clients = vim.lsp.get_clients({ bufnr = bufnr }) + + if next(clients) == nil then + return "No LSP" + end + + local excluded_clients = { + ["GitHub Copilot"] = true, + -- ["null-ls"] = true, + } + + local client_names = {} + for _, client in pairs(clients) do + if not excluded_clients[client.name] then + table.insert(client_names, client.name) + end + end + return table.concat(client_names, ", ") + 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) diff --git a/nvim/lua/dracuxan/plugins/misic.lua b/nvim/lua/dracuxan/plugins/misic.lua @@ -0,0 +1,46 @@ +-- Standalone plugins with less than 10 lines of config go here +return { + { + -- Detect tabstop and shiftwidth automatically + "tpope/vim-sleuth", + }, + { + -- Autoclose parentheses, brackets, quotes, etc. + "windwp/nvim-autopairs", + event = "InsertEnter", + config = true, + opts = {}, + }, + { + -- Highlight todo, notes, etc in comments + "folke/todo-comments.nvim", + event = "VimEnter", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { signs = true }, + }, + { + -- High-performance color highlighter + "norcalli/nvim-colorizer.lua", + config = function() + require("colorizer").setup(nil, { + names = false, + }) + end, + }, + { + "alexghergh/nvim-tmux-navigation", + config = function() + require("nvim-tmux-navigation").setup({ + disable_when_zoomed = true, -- defaults to false + keybindings = { + left = "<C-h>", + down = "<C-j>", + up = "<C-k>", + right = "<C-l>", + last_active = "<C-\\>", + next = "<C-Space>", + }, + }) + end, + }, +} diff --git a/nvim/lua/dracuxan/plugins/none-ls.lua b/nvim/lua/dracuxan/plugins/none-ls.lua @@ -0,0 +1,31 @@ +local vim = vim +local null_ls = require("null-ls") +local formatting = null_ls.builtins.formatting -- to setup formatters + +local sources = { + formatting.prettierd, + formatting.shfmt.with({ args = { "-i", "4" } }), + formatting.terraform_fmt, + formatting.nixfmt, + formatting.black, +} + +local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) +null_ls.setup({ + sources = sources, + on_attach = function(client, bufnr) + if client.supports_method("textDocument/formatting") then + vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + if vim.bo.filetype == "oil" then + return + end + vim.lsp.buf.format({ async = false }) + end, + }) + end + end, +}) diff --git a/nvim/lua/dracuxan/plugins/scope.lua b/nvim/lua/dracuxan/plugins/scope.lua @@ -0,0 +1,8 @@ +-- init.lua +require("scope").setup({ + hooks = { + pre_tab_enter = function() + -- Your custom logic to run before entering a tab + end, + }, +}) diff --git a/nvim/lua/dracuxan/plugins/telescope.lua b/nvim/lua/dracuxan/plugins/telescope.lua @@ -0,0 +1,151 @@ +local vim = vim +local sizes = { + center_height = math.floor(vim.o.lines * 0.6), + center_width = math.floor(vim.o.columns * 0.6), +} + +local function pct(value, total) + return math.floor(total * value) +end + +local picker_layouts = { + find_files = { height = 0.4, width = 0.5, anchor = "SW" }, + current_buffer_fuzzy_find = { height = 0.4, width = 0.5, anchor = "SW" }, + buffers = { height = 0.45, width = 0.5, anchor = "SW" }, +} + +local function builtin(name, opts) + return function() + require("telescope.builtin")[name](opts) + end +end + +return { + "nvim-telescope/telescope.nvim", + lazy = false, + version = "*", + dependencies = { + "nvim-lua/plenary.nvim", + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + "echasnovski/mini.icons", + }, + opts = { + defaults = { + vimgrep_arguments = { + "rg", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--smart-case", + "--hidden", + "--glob", + "!.git/", + }, + layout_strategy = "center", + layout_config = { + height = sizes.center_height, + width = sizes.center_width, + prompt_position = "top", + anchor = "S", + }, + sorting_strategy = "ascending", + previewer = false, + border = true, + }, + pickers = { + find_files = { + previewer = false, + hidden = true, + }, + current_buffer_fuzzy_find = { previewer = false }, + buffers = { previewer = false }, + }, + }, + config = function(_, opts) + for picker, layout in pairs(picker_layouts) do + opts.pickers[picker] = vim.tbl_extend("force", opts.pickers[picker], { + layout_strategy = "vertical", + layout_config = { + height = pct(layout.height, vim.o.lines), + width = pct(layout.width, vim.o.columns), + prompt_position = "top", + anchor = layout.anchor, + }, + }) + end + + require("telescope").setup(opts) + require("telescope").load_extension("fzf") + require("telescope").load_extension("session-lens") + end, + + keys = { + { + "<leader><leader>", + builtin("find_files"), + desc = "Find Files in project directory", + }, + { + "<leader>fg", + builtin("live_grep"), + desc = "Find by grepping in project directory", + }, + { + "<leader>fc", + builtin("find_files", { cwd = vim.fn.stdpath("config") }), + desc = "Find in neovim configuration", + }, + { + "<leader>fh", + builtin("help_tags"), + desc = "[F]ind [H]elp", + }, + { + "<leader>fk", + builtin("keymaps"), + desc = "[F]ind [K]eymaps", + }, + { + "<leader>fB", + builtin("builtin"), + desc = "[F]ind [B]uiltin Telescope", + }, + { + "<leader>fw", + builtin("grep_string", { search = vim.fn.expand("<cword>") }), + desc = "[F]ind current [W]ord", + }, + { + "<leader>fW", + builtin("grep_string", { search = vim.fn.expand("<cWORD>") }), + desc = "[F]ind current [W]ORD", + }, + { + "<leader>fd", + builtin("diagnostics", { bufnr = 0 }), + desc = "[F]ind [D]iagnostics", + }, + { + "<leader>fr", + builtin("resume"), + desc = "[F]ind [R]esume", + }, + { + "<leader>fo", + builtin("oldfiles"), + desc = "[F]ind [O]ld Files", + }, + { + "<leader>b", + builtin("buffers"), + desc = "[,] Find existing buffers", + }, + { + "<leader>/", + builtin("current_buffer_fuzzy_find"), + desc = "[/] Live grep the current buffer", + }, + }, +} diff --git a/nvim/lua/dracuxan/plugins/textobjects.lua b/nvim/lua/dracuxan/plugins/textobjects.lua @@ -0,0 +1,66 @@ +return { + "nvim-treesitter/nvim-treesitter-textobjects", + dependencies = { "nvim-treesitter" }, + config = function() + require("nvim-treesitter.configs").setup({ + textobjects = { + move = { + enable = true, + set_jumps = true, + goto_next_start = { + ["[f"] = "@function.outer", + ["]["] = "@class.outer", + }, + goto_previous_start = { + ["]f"] = "@function.outer", + ["[["] = "@class.outer", + }, + goto_previous_end = { + ["[F"] = "@function.outer", + ["[]"] = "@class.outer", + }, + }, + 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 + ["af"] = "@function.outer", + ["if"] = "@function.inner", + -- You can optionally set descriptions to the mappings (used in the desc parameter of + -- nvim_buf_set_keymap) which plugins like which-key display + ["ic"] = { query = "@class.inner", desc = "Select inner part of a class region" }, + ["ac"] = { query = "@class.outer", desc = "Select outer part of a class region" }, + -- You can also use captures from other query groups like `locals.scm` + ["as"] = { query = "@local.scope", query_group = "locals", desc = "Select language scope" }, + }, + -- You can choose the select mode (default is charwise 'v') + -- + -- Can also be a function which gets passed a table with the keys + -- * query_string: eg '@function.inner' + -- * method: eg 'v' or 'o' + -- and should return the mode ('v', 'V', or '<c-v>') or a table + -- mapping query_strings to modes. + selection_modes = { + ["@parameter.outer"] = "v", -- charwise + ["@function.outer"] = "V", -- linewise + ["@class.outer"] = "<c-v>", -- blockwise + }, + -- If you set this to `true` (default is `false`) then any textobject is + -- extended to include preceding or succeeding whitespace. Succeeding + -- whitespace has priority in order to act similarly to eg the built-in + -- `ap`. + -- + -- Can also be a function which gets passed a table with the keys + -- * query_string: eg '@function.inner' + -- * selection_mode: eg 'v' + -- and should return true or false + include_surrounding_whitespace = true, + }, + }, + }) + end, +} diff --git a/nvim/lua/dracuxan/plugins/toggleterm.lua b/nvim/lua/dracuxan/plugins/toggleterm.lua @@ -0,0 +1,142 @@ +local vim = vim +local autoRun = "horizontal" +local default = "vertical" +local status_ok, toggleterm = pcall(require, "toggleterm") +if not status_ok then + return +end + +toggleterm.setup({ + size = function(term) + if term.direction == "horizontal" then + return 20 + else + return 60 + end + end, + open_mapping = [[<C-t>]], + hide_numbers = true, + shade_filetypes = {}, + shade_terminals = true, + shading_factor = 2, + start_in_insert = true, + insert_mappings = true, + persist_size = true, + direction = default, + close_on_exit = true, + shell = vim.o.shell, + float_opts = { + border = "curved", + winblend = 0, + highlights = { + border = "Normal", + background = "Normal", + }, + }, +}) + +function _G.set_terminal_keymaps() + local opts = { noremap = true } + vim.api.nvim_buf_set_keymap(0, "t", "<esc>", [[<C-\><C-n>]], opts) + vim.api.nvim_buf_set_keymap(0, "t", "jk", [[<C-\><C-n>]], opts) +end + +vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()") +local Terminal = require("toggleterm.terminal").Terminal + +-- Define toggle functions + +function _RUN_SCRIPT() + local buffname = vim.api.nvim_buf_get_name(0) + local filepath = vim.fn.fnamemodify(buffname, ":p") + local script_run = Terminal:new({ + cmd = "run " .. filepath, + hidden = true, + close_on_exit = false, + direction = autoRun, + persist_size = true, + }) + + script_run:toggle() +end + +function _RUN_TEST() + local buffname = vim.api.nvim_buf_get_name(0) + local filepath = vim.fn.fnamemodify(buffname, ":p") + local script_test = Terminal:new({ + cmd = "run " .. filepath .. " --test", + direction = autoRun, + persist_size = true, + hidden = true, + close_on_exit = false, + }) + script_test:toggle() +end + +function _RUN_REPL() + local buffname = vim.api.nvim_buf_get_name(0) + local filepath = vim.fn.fnamemodify(buffname, ":p") + local script_test = Terminal:new({ + cmd = "run " .. filepath .. " --repl", + direction = autoRun, + persist_size = true, + hidden = true, + close_on_exit = false, + }) + script_test:toggle() +end + +function _RUN_MIX() + local buffname = vim.api.nvim_buf_get_name(0) + local filepath = vim.fn.fnamemodify(buffname, ":p") + local script_test = Terminal:new({ + cmd = "run " .. filepath .. " --mix", + direction = autoRun, + persist_size = true, + hidden = true, + close_on_exit = false, + }) + script_test:toggle() +end + +function _RUN_BUILD() + local buffname = vim.api.nvim_buf_get_name(0) + local filepath = vim.fn.fnamemodify(buffname, ":p") + local script_build = Terminal:new({ + cmd = "run " .. filepath .. " --build", + hidden = true, + direction = autoRun, + persist_size = true, + close_on_exit = false, + }) + script_build:toggle() +end + +function _SEND_BIN() + local buffname = vim.api.nvim_buf_get_name(0) + local filepath = vim.fn.fnamemodify(buffname, ":p") + local sendToServer = "run " .. filepath .. " --build && scp ./bin/* Igris.local:/home/igris/exps" + local script_send = Terminal:new({ + cmd = sendToServer, + hidden = true, + direction = autoRun, + persist_size = true, + close_on_exit = false, + }) + script_send:toggle() +end + +function _LAZYGIT_TOGGLE() + local lazygit = Terminal:new({ cmd = "lazygit", hidden = true, direction = "float" }) + + lazygit:toggle() +end + +-- Set keymaps +vim.keymap.set("n", "<leader>mr", _RUN_SCRIPT, { noremap = true, silent = true, desc = "run script" }) +vim.keymap.set("n", "<leader>mt", _RUN_TEST, { noremap = true, silent = true, desc = "run test(s)" }) +vim.keymap.set("n", "<leader>mi", _RUN_REPL, { noremap = true, silent = true, desc = "run REPL" }) +vim.keymap.set("n", "<leader>mm", _RUN_MIX, { noremap = true, silent = true, desc = "run with MIX" }) +vim.keymap.set("n", "<leader>mb", _RUN_BUILD, { noremap = true, silent = true, desc = "build project" }) +vim.keymap.set("n", "<leader>ms", _SEND_BIN, { noremap = true, silent = true, desc = "send binaries to server" }) +vim.keymap.set("n", "<leader>ml", _LAZYGIT_TOGGLE, { noremap = true, silent = true, desc = "lazygit" }) diff --git a/nvim/lua/dracuxan/plugins/treesitter.lua b/nvim/lua/dracuxan/plugins/treesitter.lua @@ -0,0 +1,35 @@ +require("nvim-treesitter.configs").setup({ + ensure_installed = { + "lua", + "python", + "javascript", + "typescript", + "vimdoc", + "vim", + "regex", + "terraform", + "sql", + "dockerfile", + "toml", + "json", + "java", + "groovy", + "go", + "gitignore", + "graphql", + "yaml", + "make", + "cmake", + "markdown", + "markdown_inline", + "bash", + "tsx", + "css", + "html", + "rust", + "zig", + }, + -- Autoinstall languages that are not installed + auto_install = true, + highlight = { enable = true }, +}) diff --git a/nvim/lua/dracuxan/plugins/vesper.lua b/nvim/lua/dracuxan/plugins/vesper.lua @@ -0,0 +1,20 @@ +require("vesper").setup({ + transparent = true, -- Boolean: Sets the background to transparent + italics = { + comments = true, -- Boolean: Italicizes comments + keywords = true, -- Boolean: Italicizes keywords + functions = true, -- Boolean: Italicizes functions + strings = true, -- Boolean: Italicizes strings + variables = true, -- Boolean: Italicizes variables + }, + overrides = { + OilNormal = { bg = "NONE" }, + OilFloat = { bg = "NONE" }, + FloatBorder = { bg = "NONE", fg = "#5e81ac" }, + }, -- A dictionary of group names, can be a function returning a dictionary or a table. + palette_overrides = {}, +}) + +-- vim.cmd.colorscheme("vesper") +vim.opt.background = "dark" -- set this to dark or light +vim.cmd.colorscheme("vesper") diff --git a/picom/picom.conf b/picom/picom.conf @@ -0,0 +1,45 @@ +backend = "glx"; +vsync = true; +blur-method = "dual_kawase"; +blur-strength = 6; + +active-opacity = 1; +inactive-opacity = 0.85; + +blur-background-exclude = [ + "class_g = 'zen'", + #"class_g = 'Helium'", + "class_g = 'Brave-browser'", + "class_g = 'steam'", + "class_g = 'cs2'", + "class_g = 'obs'", + "class_g = 'Antigravity'", + "class_g = 'steam_app_1836450'", + "class_g = 'pcsx2-qt'", + "class_g = 'flameshot'", + "class_g = 'workfolio'", + "class_g = 'Slack'", + "class_g = 'Rumno'", + "class_g = 'Eww'", + "class_g = 'conky-semi'" +]; + +opacity-rule = [ + "100:class_g = 'zen'", + "100:class_g = 'sioyek'", + #"100:class_g = 'Helium'", + "100:class_g = 'Brave-browser'", + "100:class_g = 'Blueman-manager'", + "100:class_g = 'org.ppsspp.PPSSPP'", + "100:class_g = 'steam'", + "100:class_g = 'cs2'", + "100:class_g = 'obs'", + "100:class_g = 'Antigravity'", + "100:class_g = 'pcsx2-qt'", + "100:class_g = 'flameshot'", + "100:class_g = 'workfolio'", + "100:class_g = 'Slack'", + "100:class_g = 'Rumno'", + "100:class_g = 'steam_app_1836450'", + "100:class_g = 'steam_app_4368030'" +]; diff --git a/rofi/config.rasi b/rofi/config.rasi @@ -0,0 +1,91 @@ +* { + font: "JetBrainsMono Nerd Font 10"; + + /* palette */ + bg0: #ffcfa8; + bg2: #999ecf; + + fg0: #ffcfa8; + + background-color: transparent; + text-color: @fg0; + + margin: 0; + padding: 0; + spacing: 0; +} + +/* window */ +window { + background-color: transparent; + anchor: center; + location: center; + width: 360px; + border-radius: 0; + border-color: @bg2; +} + +/* input */ +inputbar { + font: inherit; + padding: 12px; + spacing: 12px; + children: [ prompt, entry ]; + background-color: transparent; +} + +prompt { + expand: false; + text-color: @fg0; +} + +prompt, +entry, +element-icon, +element-text { + vertical-align: 0.5; +} + +entry { + font: inherit; + text-color: @fg0; +} + +/* list */ +listview { + lines: 8; + fixed-height: false; + border: 0; + scrollbar: false; +} + +/* elements */ +element { + padding: 8px 16px; + spacing: 16px; + background-color: transparent; + text-color: @fg0; +} + +element selected normal, +element selected active { + background-color: @bg0; + text-color: @bg2; +} + +element normal normal, +element alternate normal, +element normal active, +element alternate active { + background-color: transparent; + text-color: @fg0; +} + +/* content */ +element-icon { + size: 1em; +} + +element-text { + text-color: inherit; +} diff --git a/screenshots/alacritty.png b/screenshots/alacritty.png Binary files differ. diff --git a/screenshots/blank.png b/screenshots/blank.png Binary files differ. diff --git a/screenshots/new_rice.png b/screenshots/new_rice.png Binary files differ. diff --git a/screenshots/nvim_plus_tmux.png b/screenshots/nvim_plus_tmux.png Binary files differ. diff --git a/screenshots/rice-1.png b/screenshots/rice-1.png Binary files differ. diff --git a/scripts/caps_watch b/scripts/caps_watch Binary files differ. diff --git a/scripts/caps_watch.c b/scripts/caps_watch.c @@ -0,0 +1,43 @@ +#include <stdio.h> +#include <stdlib.h> +#include <X11/Xlib.h> +#include <X11/XKBlib.h> + +int main(void) +{ + Display *dpy; + int xkbEventType, xkbError; + int major = XkbMajorVersion, minor = XkbMinorVersion; + + dpy = XkbOpenDisplay(NULL, &xkbEventType, NULL, &major, &minor, &xkbError); + if (!dpy) + return 1; + + XkbSelectEventDetails(dpy, XkbUseCoreKbd, XkbStateNotify, + XkbModifierLockMask, XkbModifierLockMask); + + int prev = -1; + + XEvent xev; + while (1) { + XNextEvent(dpy, &xev); + if (xev.type != xkbEventType) + continue; + + XkbEvent *xkbe = (XkbEvent *)&xev; + if (xkbe->any.xkb_type != XkbStateNotify) + continue; + + int on = (xkbe->state.locked_mods & LockMask) != 0; + if (on == prev) + continue; + prev = on; + + char cmd[256]; + snprintf(cmd, sizeof(cmd), + "dunstify 'Caps Lock: %s'", + on ? "ON" : "OFF"); + system(cmd); + } + return 0; +} diff --git a/scripts/cemu b/scripts/cemu @@ -0,0 +1,2 @@ +#!/bin/bash +flatpak run info.cemu.Cemu diff --git a/scripts/obs b/scripts/obs @@ -0,0 +1,2 @@ +#!/bin/bash +flatpak run com.obsproject.Studio diff --git a/scripts/obsidian b/scripts/obsidian @@ -0,0 +1,3 @@ +#!/bin/bash + +flatpak run md.obsidian.Obsidian diff --git a/scripts/pcsx2 b/scripts/pcsx2 @@ -0,0 +1,3 @@ +#!/bin/sh + +flatpak run net.pcsx2.PCSX2 diff --git a/scripts/psp b/scripts/psp @@ -0,0 +1,3 @@ +#!/bin/bash + +flatpak run org.ppsspp.PPSSPP diff --git a/scripts/run b/scripts/run @@ -0,0 +1,209 @@ +#!/bin/bash +FILE_PATH=$1 +shift # Remove the file path from the list of arguments +ARGS="$@" # Capture any additional arguments + +BUILD_ONLY=false +TEST_PROJECT=false +REPL=false +MIX=false +C_FLAGS="" + +for arg in "$@"; do + case $arg in + --build | -b) + BUILD_ONLY=true + shift + ;; + --test | -t) + TEST_PROJECT=true + shift + ;; + --repl | -r) + REPL=true + shift + ;; + --mix | -m) + MIX=true + shift + ;; + --cflags) + shift + C_FLAGS="$1" + shift + ;; + esac +done + +# Ensure a file path is provided +if [[ -z "$FILE_PATH" ]]; then + echo "Usage: $0 <source_file> [program arguments if any] [--build-only(optional)]" + exit 1 +fi + +if [[ -f "build.zig" ]]; then + IS_ZIG_PROJECT=true +else + IS_ZIG_PROJECT=false +fi + +EXT="${FILE_PATH##*.}" +FILE_NAME=$(basename "$FILE_PATH" ."$EXT") + +case "$EXT" in +c) + echo "Compiling ${FILE_NAME}.c..." + # Ensure 'bin' directory exists for compiled binaries + mkdir -p "bin" + gcc -Wall -Wextra -lm $C_FLAGS "$FILE_PATH" -o "bin/${FILE_NAME}" + if [[ $? -ne 0 ]]; then + echo "Compilation failed." + exit 1 + fi + if $BUILD_ONLY; then + echo "done" + exit 0 + fi + echo "" + echo "Running bin/${FILE_NAME}..." + echo "" + ./bin/${FILE_NAME} $ARGS + ;; +go) + if $TEST_PROJECT; then + echo "Running tests..." + echo "" + go test $FILE_PATH + else + echo "Compiling ${FILE_NAME}.go..." + echo "" + # Ensure 'bin' directory exists for compiled binaries + mkdir -p "bin" + go build -o "bin/${FILE_NAME}" "$FILE_PATH" + if [[ $? -ne 0 ]]; then + echo "Compilation failed." + exit 1 + fi + if $BUILD_ONLY; then + echo "Binary compiled at bin/${FILE_NAME}" + else + echo "Running bin/${FILE_NAME}..." + ./bin/${FILE_NAME} $ARGS + fi + fi + ;; +rs) + echo "Running ${FILE_NAME}.rs with rustc..." + echo "" + mkdir -p "target" + rustc "$FILE_PATH" -o ./target/$FILE_NAME + ./target/${FILE_NAME} $ARGS + ;; +exs | ex) + if $TEST_PROJECT; then + mix test + elif $MIX; then + echo "running script with mix..." + echo "" + mix run ${FILE_PATH} + elif $REPL; then + if [[ "$EXT" == "exs" ]] && [[ "$FILE_NAME" != "mix" ]]; then + echo "starting iex repl..." + echo "" + iex ${FILE_PATH} + else + echo "running app with iex..." + echo "" + iex -S mix + fi + else + if [[ "$EXT" == "exs" ]] && [[ "$FILE_NAME" != "mix" ]]; then + echo "Running ${FILE_NAME}.exs with elixir..." + echo "" + elixir "$FILE_PATH" $ARGS + else + if $BUILD_ONLY; then + echo "Compiling mix project..." + echo "" + mix escript.build + + else + echo "Running mix project..." + echo "" + mix run + fi + fi + + fi + ;; +zig) + if $IS_ZIG_PROJECT; then + # Project mode + if $TEST_PROJECT; then + echo "Running Zig project tests..." + echo "" + zig build test + + elif $BUILD_ONLY; then + echo "Building Zig project..." + echo "" + zig build + + else + echo "Running Zig project..." + echo "" + zig build run -- $ARGS + fi + + else + # Single file mode + if $TEST_PROJECT; then + echo "Running tests for ${FILE_NAME}.zig..." + echo "" + zig test "$FILE_PATH" + + elif $BUILD_ONLY; then + echo "Building ${FILE_NAME}.zig..." + echo "" + mkdir -p target + zig build-exe "$FILE_PATH" -o "target/${FILE_NAME}" + + else + echo "Running ${FILE_NAME}.zig..." + echo "" + zig run "$FILE_PATH" -- $ARGS + fi + fi + ;; +ts | js) + if [[ "$EXT" == "js" ]]; then + echo "Running ${FILE_NAME}.js..." + else + + echo "Running ${FILE_NAME}.ts..." + fi + echo "" + node $FILE_PATH + ;; +py) + echo "Running ${FILE_NAME}.py...." + echo "" + python3 $FILE_PATH + ;; +sh) + echo "Running ${FILE_NAME}.sh script...." + echo "" + bash $FILE_PATH + ;; +html) + echo "starting http server..." + echo "" + http-server --port 5173 + ;; +*) + echo "Unsupported file type: .$EXT" + exit 1 + ;; +esac + +exit 0 diff --git a/scripts/set_wallpaper b/scripts/set_wallpaper @@ -0,0 +1,233 @@ +#!/bin/bash + +# Wallpaper Management Script +# Usage: +# set_wallpaper.sh # Set wallpaper from config file +# set_wallpaper.sh filename.jpg # Set new wallpaper and update config +# set_wallpaper.sh --select # Select wallpaper using rofi + +set -e + +# Configuration +CONFIG_FILE="$HOME/.config/wallpaper.conf" +WALLPAPER_DIR="$HOME/Wallpapers" +DEFAULT_WALLPAPER="$WALLPAPER_DIR/gruvbox_spac.jpg" + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +# Logging functions +log_info() { + echo -e "${GREEN}[INFO]${NC} $1" +} + +log_warn() { + echo -e "${YELLOW}[WARN]${NC} $1" +} + +log_error() { + echo -e "${RED}[ERROR]${NC} $1" >&2 +} + +# Ensure wallpaper directory exists +ensure_wallpaper_dir() { + if [[ ! -d "$WALLPAPER_DIR" ]]; then + log_warn "Wallpaper directory $WALLPAPER_DIR not found, creating..." + mkdir -p "$WALLPAPER_DIR" + fi +} + +# Read current wallpaper from config +read_wallpaper_config() { + if [[ -f "$CONFIG_FILE" ]]; then + source "$CONFIG_FILE" + echo "${WALLPAPER_PATH:-$DEFAULT_WALLPAPER}" + else + log_warn "Config file not found, using default wallpaper" + echo "$DEFAULT_WALLPAPER" + fi +} + +# Write wallpaper to config +write_wallpaper_config() { + local wallpaper_path="$1" + local config_dir + config_dir="$(dirname "$CONFIG_FILE")" + + mkdir -p "$config_dir" + + echo "# Wallpaper Configuration" >"$CONFIG_FILE" + echo "# Format: WALLPAPER_PATH=~/Wallpapers/filename.jpg" >>"$CONFIG_FILE" + echo "# The wallpaper script will read this file and apply the specified wallpaper" >>"$CONFIG_FILE" + echo "" >>"$CONFIG_FILE" + echo "WALLPAPER_PATH=$wallpaper_path" >>"$CONFIG_FILE" + + log_info "Wallpaper config updated: $wallpaper_path" +} + +# Validate wallpaper file exists +validate_wallpaper() { + local wallpaper_path="$1" + + wallpaper_path="${wallpaper_path/#\~/$HOME}" + + if [[ ! -f "$wallpaper_path" ]]; then + log_error "Wallpaper file not found: $wallpaper_path" + return 1 + fi + + return 0 +} + +# Apply wallpaper using feh +apply_wallpaper() { + local wallpaper_path="$1" + + wallpaper_path="${wallpaper_path/#\~/$HOME}" + + if ! validate_wallpaper "$wallpaper_path"; then + return 1 + fi + + if feh --bg-fill "$wallpaper_path"; then + log_info "Wallpaper applied successfully: $(basename "$wallpaper_path")" + return 0 + else + log_error "Failed to apply wallpaper: $wallpaper_path" + return 1 + fi +} + +# Select wallpaper using rofi +select_wallpaper() { + ensure_wallpaper_dir + + local selected + + selected=$( + find "$WALLPAPER_DIR" -maxdepth 1 -type f \ + \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.webp" -o -iname "*.bmp" \) | + sed "s|$WALLPAPER_DIR/||" | + sort | + rofi -dmenu -m 0 -i -p ">" + ) + + [[ -z "$selected" ]] && exit 0 + + echo "$WALLPAPER_DIR/$selected" +} + +# Show usage +show_usage() { + echo "Wallpaper Management Script" + echo "" + echo "Usage:" + echo " $0 # Set wallpaper from config file" + echo " $0 filename.jpg # Set new wallpaper and update config" + echo " $0 --select # Select wallpaper using rofi" + echo " $0 --list # List available wallpapers" + echo " $0 --help # Show this help" + echo "" + echo "Examples:" + echo " $0 gruvbox_spac.jpg" + echo " $0 ~/Wallpapers/joyboy.png" + echo " $0 --select" +} + +# List available wallpapers +list_wallpapers() { + ensure_wallpaper_dir + + log_info "Available wallpapers in $WALLPAPER_DIR:" + + local wallpapers + wallpapers=("$WALLPAPER_DIR"/*.{jpg,jpeg,png,bmp,webp}) + + local found=false + + for wallpaper in "${wallpapers[@]}"; do + if [[ -f "$wallpaper" ]]; then + echo " $(basename "$wallpaper")" + found=true + fi + done + + if [[ "$found" == false ]]; then + log_warn "No wallpapers found in $WALLPAPER_DIR" + fi +} + +# Main function +main() { + local wallpaper_path + local action="from_config" + + case "${1:-}" in + --help | -h) + show_usage + exit 0 + ;; + + --select | -s) + action="select" + ;; + + --list | -l) + list_wallpapers + exit 0 + ;; + + "") + action="from_config" + ;; + + *) + wallpaper_path="$1" + + if [[ "$wallpaper_path" != *"/"* ]]; then + wallpaper_path="$WALLPAPER_DIR/$wallpaper_path" + fi + + wallpaper_path="${wallpaper_path/#$HOME/\~}" + action="specific" + ;; + esac + + case "$action" in + "from_config") + wallpaper_path=$(read_wallpaper_config) + log_info "Setting wallpaper from config: $(basename "$wallpaper_path")" + ;; + + "select") + wallpaper_path=$(select_wallpaper) + log_info "Selected wallpaper: $(basename "$wallpaper_path")" + ;; + + "specific") + log_info "Setting specific wallpaper: $(basename "$wallpaper_path")" + ;; + esac + + if validate_wallpaper "$wallpaper_path"; then + if apply_wallpaper "$wallpaper_path"; then + + if [[ "$action" != "from_config" ]]; then + write_wallpaper_config "$wallpaper_path" + fi + + log_info "Wallpaper set successfully!" + else + log_error "Failed to set wallpaper" + exit 1 + fi + else + log_error "Invalid wallpaper file: $wallpaper_path" + exit 1 + fi +} + +main "$@" diff --git a/scripts/setup_monitors b/scripts/setup_monitors @@ -0,0 +1,40 @@ +#!/bin/bash +set -e + +POSITION="above" # left | right | above | below +DRY_RUN=false + +EXTERNAL_OUTPUT="HDMI-1-0" +INTERNAL_OUTPUT="eDP" + +run() { + if $DRY_RUN; then + echo "[DRY-RUN] xrandr $*" + else + xrandr "$@" + fi +} + +# Enable both monitors +run --output "$INTERNAL_OUTPUT" --auto --primary +run --output "$EXTERNAL_OUTPUT" --mode 1920x1080 --rate 180.00 + +# Position external monitor +case "$POSITION" in +left) + run --output "$EXTERNAL_OUTPUT" --left-of "$INTERNAL_OUTPUT" + ;; +right) + run --output "$EXTERNAL_OUTPUT" --right-of "$INTERNAL_OUTPUT" + ;; +above) + run --output "$EXTERNAL_OUTPUT" --above "$INTERNAL_OUTPUT" + ;; +below) + run --output "$EXTERNAL_OUTPUT" --below "$INTERNAL_OUTPUT" + ;; +*) + echo "Invalid position" + exit 1 + ;; +esac diff --git a/scripts/slack b/scripts/slack @@ -0,0 +1,2 @@ +#!/bin/bash +flatpak run com.slack.Slack diff --git a/scripts/start_tmux b/scripts/start_tmux @@ -0,0 +1,93 @@ +#!/bin/bash + +# Parse command line arguments +force_new=false + +while [[ $# -gt 0 ]]; do + case $1 in + -n | --new) + force_new=true + shift + ;; + *) + echo "Unknown option: $1" >&2 + echo "Usage: $0 [-n|--new]" >&2 + exit 1 + ;; + esac +done + +logs() { + local action=$1 + local session_name=$2 + local log_dir="$HOME/.tmux_logs" + local log_file="$log_dir/tmux_session.log" + local time_stamp=$(date "+%Y-%m-%d %H:%M:%S") + + # Create log directory if it doesn't exist + mkdir -p "$log_dir" || { + echo "Error: Failed to create log directory '$log_dir'." >&2 + return 1 + } + + # Check if log file is writable + if ! touch "$log_file" 2>/dev/null; then + echo "Error: Log file '$log_file' is not writable." >&2 + return 1 + fi + + # Write log entry + echo "$action -> $session_name: $time_stamp" >>"$log_file" +} + +tm() { + # Check if tmux is installed + if ! command -v tmux >/dev/null 2>&1; then + echo "Error: tmux is not installed." >&2 + exit 1 + fi + + # Check for existing sessions + local existing_sessions + existing_sessions=$(tmux ls 2>/dev/null) + + # Decide whether to create new session or attach to existing + if [ "$force_new" = true ] || [ -z "$existing_sessions" ]; then + # Prompt for session name + if [ "$force_new" = true ] && [ -n "$existing_sessions" ]; then + echo -n "Enter a name for a new session: " + else + echo -n "No sessions found. Enter a name for a new session: " + fi + read -r name + # Validate input + if [ -z "$name" ]; then + echo "Error: Session name cannot be empty." >&2 + exit 1 + fi + # Log before creating session + logs "new" "$name" + # Create new session + tmux new-session -s "$name" || { + echo "Error: Failed to create session '$name'." >&2 + exit 1 + } + else + # Get the most recent session name + local session_name + session_name=$(tmux list-sessions -F '#S' | head -n 1) || { + echo "Error: Failed to retrieve session name." >&2 + exit 1 + } + # Log before attaching + logs "enter" "$session_name" + # Attach to the most recent session + tmux attach || { + echo "Error: Failed to attach to session '$session_name'." >&2 + exit 1 + } + fi +} + +# Call the tm function +tm diff --git a/scripts/steam b/scripts/steam @@ -0,0 +1,2 @@ +#!/bin/sh +flatpak run com.valvesoftware.Steam diff --git a/scripts/volume_control b/scripts/volume_control @@ -0,0 +1,19 @@ +#!/bin/bash +case "$1" in +up) + wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ + rumno notify -v $(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print int($2*100)}') + ;; +down) + wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- + rumno notify -v $(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print int($2*100)}') + ;; +mute) + wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle + if wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep -q MUTED; then + rumno notify -m + else + rumno notify -v $(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print int($2*100)}') + fi + ;; +esac diff --git a/scripts/zen b/scripts/zen @@ -0,0 +1,4 @@ +#!/bin/sh +WEBSITE="$@" + +flatpak run app.zen_browser.zen $WEBSITE diff --git a/starship/starship.toml b/starship/starship.toml @@ -0,0 +1,42 @@ +"$schema" = 'https://starship.rs/config-schema.json' + +format = """ +$username\ +$hostname\ +$directory\ +$git_branch\ +$git_state\ +$git_status\ +$cmd_duration\ +$line_break\ +$character""" + +[directory] +style = "fg:#a0a0a0" + +[character] +success_symbol = "[❯](bold #99ffe4)" +error_symbol = "[❯](red)" +vimcmd_symbol = "[❮](bold #ff8080)" + +[git_branch] +format = "[$branch]($style)" +style = "bright-black" + +[git_status] +format = "[[(*$conflicted$untracked$modified$staged$renamed$deleted)](218) ($ahead_behind$stashed)]($style)" +style = "cyan" +conflicted = "​" +untracked = "​" +modified = "​" +staged = "​" +renamed = "​" +deleted = "​" +stashed = "≡" + +[git_state] +format = '\([$state( $progress_current/$progress_total)]($style)\) ' +style = "bright-black" + +[cmd_duration] +format = "[$duration](fg:#6b6f82) " diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf @@ -0,0 +1,112 @@ +# PREFIX Key +unbind C-b +set -g prefix C-n + +bind r source-file ~/.tmux.conf\; display "config reloaded!" +set -g mouse on + +# Bind middle-click on a window in the status bar to close it +bind -n MouseDown2Status kill-window + +# # Window & Pane Index from 1 +set -g base-index 1 # Windows start from 1 +set -g pane-base-index 1 # Panes start from 1 +set-option -g renumber-windows on # Auto renumber windows after close +set-option -g default-shell /usr/bin/zsh + +# Smart pane switching with awareness of Vim splits. +# See: https://github.com/christoomey/vim-tmux-navigator + +# decide whether we're in a Vim process +is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ + | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" + +bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' +bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' +bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' +bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' + +tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' + +if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" +if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" + +bind-key -n 'C-Space' if-shell "$is_vim" 'send-keys C-Space' 'select-pane -t:.+' + +bind-key -T copy-mode-vi 'C-h' select-pane -L +bind-key -T copy-mode-vi 'C-j' select-pane -D +bind-key -T copy-mode-vi 'C-k' select-pane -U +bind-key -T copy-mode-vi 'C-l' select-pane -R +bind-key -T copy-mode-vi 'C-\' select-pane -l +bind-key -T copy-mode-vi 'C-Space' select-pane -t:.+ + +# Splits +bind v split-window -h -p 30 +bind w split-window -v -p 30 +bind q killp +bind - select-layout -E +bind-key Tab last-window +bind-key C command-prompt -p "New session name:" "new-session -s '%%' -c ~" + +# Plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @tpm_plugins ' + tmux-plugins/tpm \ + catppuccin/tmux \ + christoomey/vim-tmux-navigator \ +' +set -g @thm_bg default +set -g @thm_txt "#181818" +set -g @thm_fg "#d8d8d8" + +# Configure Catppuccin +set -g @catppuccin_flavor "macchiato" +set -g @catppuccin_status_background "none" +set -g @catppuccin_window_status_style "none" +set -g @catppuccin_pane_status_enabled "off" +set -g @catppuccin_pane_border_status "off" + +# status left look and feel +set -g status-left-length 100 +set -g status-left "" +set -ga status-left "#{?client_prefix,#{#[bg=#{@thm_peach},fg=#{@thm_txt},bold]  #S },#{#[bg=#{@thm_bg},fg=#{@thm_fg}]  #S }}" +set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_fg},none]│" +set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_fg}]  #{pane_current_command} " +set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_fg},none]#{?window_zoomed_flag,│,}" +set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_yellow}]#{?window_zoomed_flag,  zoom ,}" +set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_fg},none]│" + +# status right look and feel +set -g status-right-length 100 +set -g status-right "" +# set -ga status-right "#[fg=#{@thm_fg}] ♥ #(acpi -b | awk '{print $4}' | tr -d ',') |" +set -ga status-right "#[bg=#{@thm_bg},fg=#{@thm_fg}] 󰭦 %A %d-%m-%Y | 󰅐 %l:%M %p " + +# Configure Tmux +set -g status-position top +set -g status-style "bg=#{@thm_bg}" + +# pane border look and feel +setw -g pane-border-status top +setw -g pane-border-format "" +setw -g pane-active-border-style "bg=#{@thm_bg},fg=#{@thm_fg}" +setw -g pane-border-style "bg=#{@thm_bg},fg=#{@thm_fg}" +setw -g pane-border-lines single + +# window look and feel +set-option -wg automatic-rename on +set-option -g automatic-rename-format ' #{b:pane_current_path}' + +set -g window-status-format " #I#{?#{!=:#{window_name},Window},: #W,} " +set -g window-status-style "bg=#{@thm_bg},fg=#{@thm_fg}" +set -g window-status-last-style "bg=#{@thm_bg},fg=#{@thm_fg}" +set -g window-status-activity-style "bg=#{@thm_red},fg=#{@thm_bg}" +set -g window-status-bell-style "bg=#{@thm_red},fg=#{@thm_bg},bold" + +set -g window-status-current-format " #I#{?#{!=:#{window_name},Window},: #W,} " +set -g window-status-current-style "bg=#{@thm_fg},fg=#{@thm_txt},bold" + +# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) +run '~/.tmux/plugins/tpm/tpm' diff --git a/uninstall.sh b/uninstall.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +set -e + +echo "[+] Checking stow..." +if ! command -v stow >/dev/null 2>&1; then + echo "[-] stow is not installed. Cannot proceed." + exit 1 +fi + +DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +echo "[+] Unstowing configs from ~/.config/..." + +config_packages=( + "fastfetch:$HOME/.config/fastfetch" + "nvim:$HOME/.config/nvim" + "alacritty:$HOME/.config/alacritty" + "i3:$HOME/.config/i3" + "i3status:$HOME/.config/i3status" + "picom:$HOME/.config/picom" + "rofi:$HOME/.config/rofi" + "dunst:$HOME/.config/dunst" + "starship:$HOME/.config" +) + +for item in "${config_packages[@]}"; do + pkg="${item%%:*}" + target="${item##*:}" + stow -D -d "$DOTFILES_DIR" -t "$target" "$pkg" || true +done + +echo "[+] Unstowing legacy dotfiles from ~/..." + +home_packages=( + "zsh:$HOME" + "tmux:$HOME" + "iex:$HOME" + "scripts:$HOME/.local/bin" +) + +for item in "${home_packages[@]}"; do + pkg="${item%%:*}" + target="${item##*:}" + stow -D -d "$DOTFILES_DIR" -t "$target" "$pkg" || true +done + +echo "[+] Cleanup complete." diff --git a/zsh/.zshrc b/zsh/.zshrc @@ -0,0 +1,146 @@ +# Plugins +source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh +autoload -Uz +X compinit && compinit + +## case insensitive path-completion +zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' +zstyle ':completion:*' menu select + +# Exports and Alias +# History configurations +HISTFILE=~/.zsh_history +HISTSIZE=100000 +SAVEHIST=200000 + +# force zsh to show the complete history +alias history="history 0" + +# Some more ls aliases +alias ll='ls -la' +alias la='ls -A' +alias l='ls -CF' +alias ld='du -h -d 1' +alias nv='nvim' +alias neo='clear' +alias noe='neo' +alias cls='clear; fastfetch' +alias tr='tree -Ld 1' +alias trf='tree -I '.git' -I 'out' -L 2' +alias x='exit' +alias nvc='cd ~/dotfiles/nvim && nv' +alias cd='z' + +# Zig environment variables +export PATH="$PATH:$HOME/zig/bin" + +# Go via Nix +export GOPATH="$HOME/go" +export PATH="$PATH:$GOPATH/bin" + + +# Elixir env +export PATH="$HOME/.mix/escripts:$PATH" +# Elixir install (official installer) +# NVM Variables +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # Load NVM +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # Load NVM bash_completion (optional) +export PATH="$HOME/.npm-global/bin:$PATH" + +# Neovim Variables +export PATH="$PATH:/opt/nvim-linux-x86_64/bin" + +# Path for custom scripts +export PATH="$HOME/bin:$PATH" +export PATH="$HOME/.local/bin:$PATH" +alias tm='start_tmux' +alias arise='ssh Igris' + +export LC_ALL=C.UTF-8 + +# Git aliases +alias gitupd='git add .; git commit -m "upd"; git push' +alias gitnew='git add .; git commit -m "new"; git push' +alias gitadd='git add .; git commit -m "add"; git push' +alias gitfix='git add .; git commit -m "fix"; git push' +alias gitrebase='git pull --rebase' +alias gitbat='git add .; git commit -m "Batman"; git push' +alias ga="git add .;" +alias gc="git commit -m" +alias gp="git push" +alias gpall="git remote | xargs -L1 git push" + +# bun completions +[ -s "/home/dracuxan/.bun/_bun" ] && source "/home/dracuxan/.bun/_bun" + +# bun +export BUN_INSTALL="$HOME/.bun" +export PATH="$BUN_INSTALL/bin:$PATH" + +# cargo +export PATH="/home/dracuxan/.cargo/bin:$PATH" + +# Python alias +alias py='python3' + +# Nuclei alias +alias nuke='nuclei' +alias ff='firefox' + +# codex alias +alias cr='codex resume' + +# alacrity configurations +alias alacritty_conf='nv /mnt/c/Users/Nisarg/AppData/Roaming/alacritty/alacritty.toml' + +# Solana environment Variables +alias anchor="LD_LIBRARY_PATH=$HOME/glibc-2.39/local/lib:$LD_LIBRARY_PATH anchor" +PATH="/home/dracuxan/.local/share/solana/install/active_release/bin:$PATH" + +# Metasploit variables +export PATH="$PATH:/opt/metasploit-framework/bin" + +# nix alias +alias nix-system-add='sudo nix profile add --profile /nix/var/nix/profiles/system' +alias nix-system-upgrade='sudo nix profile upgrade --profile /nix/var/nix/profiles/system dotfiles' +alias nix-system-profile='sudo nix profile list --profile /nix/var/nix/profiles/system' + +# Nix system profile (required for Debian + Nix) +export PATH=/nix/var/nix/profiles/system/bin:$PATH + +# Startup Commands +[ -f ~/.chatgpt.env ] && source ~/.chatgpt.env +eval "$(starship init zsh)" + +if [[ -n "$IN_NIX_SHELL" ]]; then + PROMPT="(nix-shell) $PROMPT" +fi + +export POLYBAR_COLLECTION="/home/dracuxan/debian-dots/polybar" +export POLYBAR_BATTERY_ADP="ACAD" +export POLYBAR_BATTERY_BAT="BAT1" +export POLYBAR_WIRELESS="wlan0" +export POLYBAR_WIRED="enp3s0" +export POLYBAR_WEATHER_API="46276f91dcb44de4ac0134024262101" + +# opencode +export PATH=/home/dracuxan/.opencode/bin:$PATH +. /etc/profile.d/nix.sh +eval "$(zoxide init zsh)" +export PATH=$HOME/.npm-global/bin:$PATH + +export GPG_TTY=$(tty) + +export PATH="/home/dracuxan/.pixi/bin:$PATH" +. "$HOME/.asdf/asdf.sh" + +preexec() { LAST_CMD="$1" } +precmd() { + local exclude=("ls" "cd" "source" "clear" "x" "neo" "noe" "nv" "cls" "tm" "git" "lazygit" "vim" "cat") + local cmd_base="${LAST_CMD%% *}" + + if [[ -n "$LAST_CMD" ]] && [[ ! " ${exclude[@]} " =~ " ${cmd_base} " ]]; then + dunstify "command completed: $LAST_CMD" + fi + LAST_CMD="" +}