diff --git a/.dotter/aleidk-work-laptop.toml b/.dotter/aleidk-work-laptop.toml index b1fe098..66baeae 100644 --- a/.dotter/aleidk-work-laptop.toml +++ b/.dotter/aleidk-work-laptop.toml @@ -3,31 +3,6 @@ packages = ["default"] [files] "configs/hypr/work-laptop/hyprland.conf" = "~/.config/hypr/include/work-laptop.conf" - - -[files."configs/niri/config.kdl"] -target = "~/.config/niri/config.kdl" -type = "template" -append = """ -window-rule { - match app-id="brave-work" - open-on-workspace "1" - open-focused true - - default-column-width { - proportion 0.5 - } -} -window-rule { - match app-id="brave-personal" - open-on-workspace "2" - open-focused false - - default-column-width { - proportion 0.5 - } -} - -""" +"configs/niri/work-laptop/local.kdl" = "~/.config/niri/include/local.kdl" [variables] diff --git a/.dotter/global.toml b/.dotter/global.toml index 36b6ef0..ff29554 100644 --- a/.dotter/global.toml +++ b/.dotter/global.toml @@ -39,4 +39,4 @@ depends = ["niri"] [default.variables] [niri.files] -"configs/niri" = "~/.config/niri" +"configs/niri/base" = "~/.config/niri" diff --git a/.justfile b/.justfile new file mode 100644 index 0000000..af46a10 --- /dev/null +++ b/.justfile @@ -0,0 +1,49 @@ +packages_file := quote(justfile_directory() / "bootstrap/pkgs_arch.txt") + +bootstrap: setup_pacman setup_paru install_packages + + +install_packages: update_packages + paru -S --needed --noconfirm - < {{ packages_file }} + +update_packages: + paru -Syu --noconfirm + +clean_orphans: + -sudo pacman -Qdtq | sudo pacman -Rns - + @echo "\n\n{{ BLUE }}The following files are not owned by any package anymore:{{ NORMAL }}" + +# setup sudo: +# sudo loop +# show asterisk on password + +setup_pacman: + # add automatic updates + sudo sed -i \ + -e 's/#\?ParallelDownloads = [0-9]\+/ParallelDownloads = {{ num_cpus() }}/' \ + -e 's/#\?Color\+/Color/' \ + -e 's/#\?ILoveCandy\+/ILoveCandy/' \ + -e 's/#\?VerbosePkgLists\+/VerbosePkgLists/' \ + /etc/pacman.conf + +setup_paru: + #!/usr/bin/env bash + set -euxo pipefail + + if ! command -v paru &> /dev/null ; then + tmp=$(mktemp -d) + sudo pacman -S --needed base-devel + git clone https://aur.archlinux.org/paru.git "$tmp" + cd "$tmp" + makepkg -si + cd - + rm -rf "$tmp" + fi + + sudo sed -i \ + -e 's/#\?BottomUp\+/BottomUp/' \ + -e 's/#\?SudoLoop\+/SudoLoop/' \ + -e 's/#\?CombinedUpgrade\+/CombinedUpgrade/' \ + -e 's/#\?CleanAfter\+/CleanAfter/' \ + -e 's/#\?NewsOnUpgrade\+/NewsOnUpgrade/' \ + /etc/paru.conf diff --git a/.stylua.toml b/.stylua.toml index f0f7a59..c38f62a 100644 --- a/.stylua.toml +++ b/.stylua.toml @@ -1,7 +1,7 @@ syntax = "All" column_width = 120 line_endings = "Unix" -indent_type = "indent_type" +indent_type = "Spaces" indent_width = 2 quote_style = "AutoPreferDouble" call_parentheses = "Always" diff --git a/bootstrap/pkgs_arch.txt b/bootstrap/pkgs_arch.txt new file mode 100644 index 0000000..705fde1 --- /dev/null +++ b/bootstrap/pkgs_arch.txt @@ -0,0 +1,72 @@ +age +atuin +brave-bin +bun-bin +catppuccin-cursors-macchiato +catppuccin-gtk-theme-macchiato +catppuccin-sddm-theme-macchiato +celluloid +deno +dotter-rs-bin +dunst +eza +fish +flatpak +fzf +git +gitleaks +gnome-disk-utility +just +kitty +kvantum +kvantum-theme-catppuccin-git +lazygit +limine +limine-mkinitcpio-hook +limine-snapper-sync +lostfiles +lxappearance +ly +nautilus +nautilus-admin-gtk4 +nautilus-image-converter +nautilus-open-any-terminal +neovim +noto-fonts +noto-fonts-cjk +noto-fonts-emoji +paccache-hook +plymouth-theme-catppuccin-macchiato-git +podman +pre-commit +pwvucontrol +qt5-wayland +qt6-wayland +rofi +rofi-rbw +rofimoji +rsync +sops +swappy +tailscale +tealdeer +trash-cli +ttf-dejavu +ttf-fira-code +ttf-fira-mono +ttf-fira-sans +ttf-firacode-nerd +ttf-jetbrains-mono-nerd +ttf-ms-win11-auto +ttf-nerd-fonts-symbols-mono +ttf-nunito +ttf-opensans +ttf-roboto +ttf-roboto-mono-nerd +udiskie +vim +wget +yazi +zed +zip +zoxide diff --git a/configs/fish/config.fish b/configs/fish/config.fish index cbde320..9f5e5f6 100644 --- a/configs/fish/config.fish +++ b/configs/fish/config.fish @@ -2,7 +2,5 @@ if status is-interactive # Commands to run in interactive sessions can go here zoxide init --cmd cd fish | source atuin init fish | source - - mise activate fish | source end diff --git a/configs/fish/functions/envsource.fish b/configs/fish/functions/envsource.fish new file mode 100644 index 0000000..af570e4 --- /dev/null +++ b/configs/fish/functions/envsource.fish @@ -0,0 +1,7 @@ +function envsource + for line in (cat $argv | grep -v '^#') + set item (string split -m 1 '=' $line) + set -gx $item[1] $item[2] + echo "Exported key $item[1]" + end +end diff --git a/configs/ghostty/config b/configs/ghostty/config index 4d1ff59..fa8602d 100644 --- a/configs/ghostty/config +++ b/configs/ghostty/config @@ -1,7 +1,10 @@ -theme = catppuccin-macchiato +theme = Catppuccin Macchiato +font-family = JetBrainsMono Nerd Font # Common +keybind = global:ctrl+shift+x=toggle_quick_terminal + keybind = ctrl+space>o=write_selection_file:open keybind = ctrl+space>shift+o=write_selection_file:paste diff --git a/configs/hypr/base/hypridle.conf b/configs/hypr/base/hypridle.conf index a4b4f88..d96ac12 100644 --- a/configs/hypr/base/hypridle.conf +++ b/configs/hypr/base/hypridle.conf @@ -1,7 +1,7 @@ general { - lock_cmd = pidof hyprlock || hyprlock # avoid starting multiple hyprlock instances. - before_sleep_cmd = loginctl lock-session # lock before suspend. - after_sleep_cmd = hyprctl dispatch dpms on # to avoid having to press a key twice to turn on the display. + lock_cmd = pidof hyprlock || hyprlock # avoid starting multiple hyprlock instances. + before_sleep_cmd = loginctl lock-session # lock before suspend. + after_sleep_cmd = niri msg action power-on-monitors # to avoid having to press a key twice to turn on the display. } listener { @@ -23,9 +23,9 @@ listener { } listener { - timeout = 330 # 5.5min - on-timeout = hyprctl dispatch dpms off # screen off when timeout has passed - on-resume = hyprctl dispatch dpms on && brightnessctl -r # screen on when activity is detected after timeout has fired. + timeout = 330 # 5.5min + on-timeout = niri msg action power-off-monitors # screen off when timeout has passed + on-resume = niri msg action power-on-monitors && brightnessctl -r # screen on when activity is detected after timeout has fired. } listener { diff --git a/configs/kitty/quick-access-terminal.conf b/configs/kitty/quick-access-terminal.conf new file mode 100644 index 0000000..3d3949b --- /dev/null +++ b/configs/kitty/quick-access-terminal.conf @@ -0,0 +1,120 @@ +lines 30 + +#: The number of lines shown in the panel. Ignored for background, +#: centered, and vertical panels. If it has the suffix px then it sets +#: the height of the panel in pixels instead of lines. + +columns 200 + +#: The number of columns shown in the panel. Ignored for background, +#: centered, and horizontal panels. If it has the suffix px then it +#: sets the width of the panel in pixels instead of columns. + +edge top + +#: Which edge of the screen to place the panel on. Note that some +#: window managers (such as i3) do not support placing docked windows +#: on the left and right edges. The value background means make the +#: panel the "desktop wallpaper". Note that when using sway if you set +#: a background in your sway config it will cover the background drawn +#: using this kitten. Additionally, there are three more values: +#: center, center-sized and none. The value center anchors the panel +#: to all sides and covers the entire display (on macOS the part of +#: the display not covered by titlebar and dock). The panel can be +#: shrunk and placed using the margin parameters. The value none +#: anchors the panel to the top left corner and should be placed using +#: the margin parameters. Its size is set by lines and columns. The +#: value center-sized is just like none except that the panel is +#: centered instead of in the top left corner and the margins have no +#: effect. + +background_opacity 1 + +#: The background opacity of the window. This works the same as the +#: kitty option of the same name, it is present here as it has a +#: different default value for the quick access terminal. + +# hide_on_focus_loss no + +#: Hide the window when it loses keyboard focus automatically. Using +#: this option will force focus_policy to on-demand. + +# grab_keyboard no + +#: Grab the keyboard. This means global shortcuts defined in the OS +#: will be passed to kitty instead. Useful if you want to create an OS +#: modal window. How well this works depends on the OS/window +#: manager/desktop environment. On Wayland it works only if the +#: compositor implements the inhibit-keyboard-shortcuts protocol +#: . On macOS Apple doesn't allow applications to grab the +#: keyboard without special permissions, so it doesn't work. + +margin_left 50 + +#: Set the left margin for the panel, in pixels. Has no effect for +#: right edge panels. Only works on macOS and Wayland compositors that +#: supports the wlr layer shell protocol. + +margin_right 50 + +#: Set the right margin for the panel, in pixels. Has no effect for +#: left edge panels. Only works on macOS and Wayland compositors that +#: supports the wlr layer shell protocol. + +margin_top 10 + +#: Set the top margin for the panel, in pixels. Has no effect for +#: bottom edge panels. Only works on macOS and Wayland compositors +#: that supports the wlr layer shell protocol. + +# margin_bottom 0 + +#: Set the bottom margin for the panel, in pixels. Has no effect for +#: top edge panels. Only works on macOS and Wayland compositors that +#: supports the wlr layer shell protocol. + +# kitty_conf + +#: Path to config file to use for kitty when drawing the window. Can +#: be specified multiple times. By default, the normal kitty.conf is +#: used. Relative paths are resolved with respect to the kitty config +#: directory. + +kitty_override window_padding_width=0 8 + +#: Override individual kitty configuration options, can be specified +#: multiple times. Syntax: kitty_override name=value. For example: +#: kitty_override font_size=20. + +app_id kitty-quick-access + +#: On Wayland set the namespace of the layer shell surface. On X11 set +#: the WM_CLASS assigned to the quick access window. (Linux only) + +# output_name + +#: The panel can only be displayed on a single monitor (output) at a +#: time. This allows you to specify which output is used, by name. If +#: not specified the compositor will choose an output automatically, +#: typically the last output the user interacted with or the primary +#: monitor. Run kitten panel --output-name list to get a list of +#: available outputs. Use listjson for a json encoded output. Note +#: that on Wayland the output can only be set at panel creation time, +#: it cannot be changed after creation, nor is there anyway to display +#: a single panel on all outputs. Please complain to the Wayland +#: developers about this. + +# start_as_hidden no + +#: Whether to start the quick access terminal hidden. Useful if you +#: are starting it as part of system startup. + +# focus_policy exclusive + +#: On a Wayland compositor that supports the wlr layer shell protocol, +#: specify the focus policy for keyboard interactivity with the panel. +#: Please refer to the wlr layer shell protocol documentation for more +#: details. Note that different Wayland compositors behave very +#: differently with exclusive, your mileage may vary. On macOS, +#: exclusive and on-demand are currently the same. diff --git a/configs/lazygit/config.yml b/configs/lazygit/config.yml index d596e42..2d38e28 100644 --- a/configs/lazygit/config.yml +++ b/configs/lazygit/config.yml @@ -155,18 +155,18 @@ gui: # Config relating to git git: # See https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Pagers.md - paging: - # Value of the --color arg in the git diff command. Some pagers want this to be set to 'always' and some want it set to 'never' - colorArg: always - # e.g. - # diff-so-fancy - # delta --dark --paging=never - # ydiff -p cat -s --wrap --width={{columnWidth}} - pager: "" - # If true, Lazygit will use whatever pager is specified in `$GIT_PAGER`, `$PAGER`, or your *git config*. If the pager ends with something like ` | less` we will strip that part out, because less doesn't play nice with our rendering approach. If the custom pager uses less under the hood, that will also break rendering (hence the `--paging=never` flag for the `delta` pager). - useConfig: true - # e.g. 'difft --color=always' - externalDiffCommand: "" + pagers: + - # Value of the --color arg in the git diff command. Some pagers want this to be set to 'always' and some want it set to 'never' + colorArg: always + # e.g. + # diff-so-fancy + # delta --dark --paging=never + # ydiff -p cat -s --wrap --width={{columnWidth}} + pager: "" + # If true, Lazygit will use whatever pager is specified in `$GIT_PAGER`, `$PAGER`, or your *git config*. If the pager ends with something like ` | less` we will strip that part out, because less doesn't play nice with our rendering approach. If the custom pager uses less under the hood, that will also break rendering (hence the `--paging=never` flag for the `delta` pager). + useConfig: true + # e.g. 'difft --color=always' + externalDiffCommand: "" # Config relating to committing commit: # If true, pass '--signoff' flag when committing @@ -406,7 +406,7 @@ keybinding: viewResetOptions: D fetch: f toggleTreeView: '`' - openMergeTool: M + openMergeOptions: M openStatusFilter: copyFileInfoToClipboard: "y" branches: diff --git a/configs/niri/config.kdl b/configs/niri/base/config.kdl similarity index 93% rename from configs/niri/config.kdl rename to configs/niri/base/config.kdl index 9581911..4f340da 100644 --- a/configs/niri/config.kdl +++ b/configs/niri/base/config.kdl @@ -1,10 +1,11 @@ +include "include/local.kdl" // ╭─────────────────────────────────────────────────────────╮ // │ Windows Rules │ // ╰─────────────────────────────────────────────────────────╯ window-rule { // This regular expression is intentionally made as specific as possible, // since this is the default config, and we want no false positives. - // You can get away with just app-id="wezterm" if you want. + // You can get away with just app-id="wezterm" f you want. match app-id="^org\\.wezfurlong\\.wezterm$" default-column-width { @@ -16,6 +17,11 @@ window-rule { match app-id="^brave-.*-Default$" // Extensions popup open-floating true } +// Full width window +window-rule { + match app-id="beekeeper-studio" + open-maximized true +} window-rule { match app-id="^org\\.keepassxc\\.KeePassXC$" match app-id="^org\\.gnome\\.World\\.Secrets$" @@ -27,7 +33,7 @@ window-rule { match app-id="brave-browser" match at-startup=true default-column-width { - proportion 0.75 + proportion 0.5 } } window-rule { @@ -38,9 +44,20 @@ window-rule { geometry-corner-radius 4 clip-to-geometry true } +layer-rule { + match namespace="kitty-quick-access" + geometry-corner-radius 12 + shadow { + on + spread 10 + softness 20 + offset x=-10 y=10 + } +} // ╭─────────────────────────────────────────────────────────╮ // │ Auto Start Apps │ // ╰─────────────────────────────────────────────────────────╯ +spawn-at-startup "./fix_float.py" spawn-at-startup "/usr/lib/pam_kwallet_init" spawn-at-startup "udieskie" spawn-at-startup "brave" @@ -83,14 +100,20 @@ binds { Mod+Return hotkey-overlay-title="Open a Terminal: kitty" { spawn "kitty" } + Mod+Shift+Return hotkey-overlay-title="Open Quick Terminal" { + spawn "kitten" "quick_access_terminal" + } + Mod+Shift+E hotkey-overlay-title="Open Code Editor" { + spawn-sh "kitten quick_access_terminal --instance-group editor-choice fish -c \"zeditor (zoxide query -i)\"" + } Mod+D hotkey-overlay-title="Run an Application: Rofi" { spawn "rofi" "-show" "drun" "-run-command" "uwsm app -- {cmd}" } XF86AudioRaiseVolume allow-when-locked=true { - spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+" + spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.025+" } XF86AudioLowerVolume allow-when-locked=true { - spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1-" + spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.025-" } XF86AudioMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" @@ -129,10 +152,10 @@ binds { focus-window-or-workspace-up } Mod+Right { - focus-column-right + focus-column-or-monitor-right } Mod+H { - focus-column-left + focus-column-or-monitor-left } Mod+J { focus-window-or-workspace-down @@ -141,7 +164,7 @@ binds { focus-window-or-workspace-up } Mod+L { - focus-column-right + focus-column-or-monitor-right } Mod+Shift+Left { move-column-left @@ -381,10 +404,6 @@ binds { Mod+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit } - // The quit action will show a confirmation dialog to avoid accidental exits. - Mod+Shift+E { - quit - } Ctrl+Alt+Delete { quit } @@ -405,16 +424,10 @@ environment { TERMINAL "/usr/bin/kitty" } // ── Display Options ───────────────────────────────────────────────── -output "eDP-1" { - off -} output "HDMI-A-1" { scale 1 mode "3440x1440" } -output "DP-1" { - variable-refresh-rate on-demand=true -} // ── Input Options ─────────────────────────────────────────────────── input { keyboard { diff --git a/configs/niri/base/include/.gitkeep b/configs/niri/base/include/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/configs/niri/fix_float.py b/configs/niri/fix_float.py new file mode 100644 index 0000000..7090668 --- /dev/null +++ b/configs/niri/fix_float.py @@ -0,0 +1,124 @@ +#!/usr/bin/python3 +""" +Like open-float, but dynamically. Floats a window when it matches the rules. + +Some windows don't have the right title and app-id when they open, and only set +them afterward. This script is like open-float for those windows. + +Usage: fill in the RULES array below, then run the script. +""" + +import json +import os +import re +from dataclasses import dataclass, field +from socket import AF_UNIX, SHUT_WR, socket + + +@dataclass(kw_only=True) +class Match: + title: str | None = None + app_id: str | None = None + + def matches(self, window): + if self.title is None and self.app_id is None: + return False + + matched = True + + if self.title is not None: + matched &= re.search(self.title, window["title"]) is not None + if self.app_id is not None: + matched &= re.search(self.app_id, window["app_id"]) is not None + + return matched + + +@dataclass +class Rule: + match: list[Match] = field(default_factory=list) + exclude: list[Match] = field(default_factory=list) + + def matches(self, window): + if len(self.match) > 0 and not any(m.matches(window) for m in self.match): + return False + if any(m.matches(window) for m in self.exclude): + return False + + return True + + +# Write your rules here. One Rule() = one window-rule {}. +RULES = [ + # window-rule {} with one match. + Rule([Match(title="Bitwarden", app_id="^brave-.*-Default$")]), + # window-rule {} with one match and one exclude. + # Rule( + # [Match(title="rs")], + # exclude=[Match(app_id="Alacritty")], + # ), + # window-rule {} with two matches. + # Rule( + # [ + # Match(app_id="^foot$"), + # Match(app_id="^mpv$"), + # ] + # ), +] + + +if len(RULES) == 0: + print("fill in the RULES list, then run the script") + exit() + + +niri_socket = socket(AF_UNIX) +niri_socket.connect(os.environ["NIRI_SOCKET"]) +file = niri_socket.makefile("rw") + +_ = file.write('"EventStream"') +file.flush() +niri_socket.shutdown(SHUT_WR) + +windows = {} + + +def send(request): + with socket(AF_UNIX) as niri_socket: + niri_socket.connect(os.environ["NIRI_SOCKET"]) + file = niri_socket.makefile("rw") + _ = file.write(json.dumps(request)) + file.flush() + + +def float(id: int): + send({"Action": {"MoveWindowToFloating": {"id": id}}}) + send({"Action": {"SetWindowWidth": {"id": id, "change": {"SetProportion": 20}}}}) + send({"Action": {"SetWindowHeight": {"id": id, "change": {"SetProportion": 50}}}}) + + +def update_matched(win): + win["matched"] = False + if existing := windows.get(win["id"]): + win["matched"] = existing["matched"] + + matched_before = win["matched"] + win["matched"] = any(r.matches(win) for r in RULES) + if win["matched"] and not matched_before: + print(f"floating title={win['title']}, app_id={win['app_id']}") + float(win["id"]) + + +for line in file: + event = json.loads(line) + + if changed := event.get("WindowsChanged"): + for win in changed["windows"]: + update_matched(win) + windows = {win["id"]: win for win in changed["windows"]} + elif changed := event.get("WindowOpenedOrChanged"): + win = changed["window"] + update_matched(win) + windows[win["id"]] = win + elif changed := event.get("WindowClosed"): + del windows[changed["id"]] diff --git a/configs/niri/work-laptop/local.kdl b/configs/niri/work-laptop/local.kdl new file mode 100644 index 0000000..0e93f89 --- /dev/null +++ b/configs/niri/work-laptop/local.kdl @@ -0,0 +1,32 @@ +window-rule { + match app-id="brave-work" + open-on-workspace "1" + open-focused true + default-column-width { + proportion 0.5 + } +} +window-rule { + match app-id="brave-personal" + open-on-workspace "2" + open-focused false + default-column-width { + proportion 0.5 + } +} +output "HDMI-A-1" { + scale 1 + mode "3440x1440" + focus-at-startup + position x=1920 y=0 +} +output "eDP-1" { + mode "1920x1080@60.000" + position x=0 y=720 + layout { + default-column-width { + proportion 1.0 + } + } +} + diff --git a/configs/nvim/init.lua b/configs/nvim/init.lua index ea65040..b926841 100644 --- a/configs/nvim/init.lua +++ b/configs/nvim/init.lua @@ -16,6 +16,7 @@ end vim.opt.rtp:prepend(lazypath) require("aleidk.options") +require("aleidk.commands") require("aleidk.autocmds") require("aleidk.keymaps") diff --git a/configs/nvim/lazy-lock.json b/configs/nvim/lazy-lock.json index 35fbf0e..f7066e1 100644 --- a/configs/nvim/lazy-lock.json +++ b/configs/nvim/lazy-lock.json @@ -11,7 +11,8 @@ "hardtime.nvim": { "branch": "main", "commit": "3541ad24faff78274669eceaf130502eb7f1261a" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "f59bd14a852ca43db38e3662395354cb2a9b13e0" }, - "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "b1d9a914b02ba5660f1e272a03314b31d4576fe2" }, + "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, "mini.nvim": { "branch": "main", "commit": "94cae4660a8b2d95dbbd56e1fbc6fcfa2716d152" }, "neogen": { "branch": "main", "commit": "dc50715c009f89b8111197fd2f282f6042daa7ea" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, @@ -19,7 +20,7 @@ "nvim-dap-view": { "branch": "main", "commit": "390dae6bf67f3342ebb481159932ef0fe54822ba" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" }, "nvim-lint": { "branch": "master", "commit": "6b46370d02cd001509a765591a3ffc481b538794" }, - "nvim-lspconfig": { "branch": "master", "commit": "f47cd681d7cb6048876a2e908b6d8ba1e530d152" }, + "nvim-lspconfig": { "branch": "master", "commit": "c8503e63c6afab3ed34b49865a4a4edbb1ebf4a8" }, "nvim-treesitter": { "branch": "main", "commit": "802195d8f1980db25a7a39a55f9a25df21756c73" }, "nvim-treesitter-context": { "branch": "master", "commit": "66a9b5fa9e806918b5fe3dba00c6cce7e230abd2" }, "nvim-treesitter-textobjects": { "branch": "main", "commit": "1b2d85d3de6114c4bcea89ffb2cd1ce9e3a19931" }, diff --git a/configs/nvim/lua/aleidk/commands.lua b/configs/nvim/lua/aleidk/commands.lua new file mode 100644 index 0000000..8fd969b --- /dev/null +++ b/configs/nvim/lua/aleidk/commands.lua @@ -0,0 +1,11 @@ +vim.api.nvim_create_user_command("SopsDecrypt", function(args) + vim.cmd([[! sops decrypt -i %]]) +end, { + desc = "Decrypt current file with sops", +}) + +vim.api.nvim_create_user_command("SopsEncrypt", function(args) + vim.cmd([[! sops encrypt -i %]]) +end, { + desc = "Decrypt current file with sops", +}) diff --git a/configs/nvim/lua/aleidk/options.lua b/configs/nvim/lua/aleidk/options.lua index da04eeb..cf76fb6 100644 --- a/configs/nvim/lua/aleidk/options.lua +++ b/configs/nvim/lua/aleidk/options.lua @@ -10,54 +10,54 @@ vim.o.diffopt = "vertical,closeoff,filler" local opt = vim.opt vim.schedule(function() - vim.opt.clipboard = 'unnamedplus' + vim.opt.clipboard = "unnamedplus" end) -- opt.shortmess:append({ W = true, I = true, c = true }) -- INFO: this control the format of some messages -- vim.o.exrc = true -- vim.opt.list = true -- Sets how neovim will display certain whitespace characters in the editor. -- vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } -opt.autowrite = true -- Enable auto write -opt.breakindent = true -- Every wrapped line will continue visually indented +opt.autowrite = true -- Enable auto write +opt.breakindent = true -- Every wrapped line will continue visually indented opt.completeopt = "menu,menuone,noselect" -opt.conceallevel = 2 -- Hide * markup for bold and italic -opt.confirm = true -- Confirm to save changes before exiting modified buffer -opt.cursorline = true -- Enable highlighting of the current line -opt.expandtab = true -- Use spaces instead of tabs +opt.conceallevel = 2 -- Hide * markup for bold and italic +opt.confirm = true -- Confirm to save changes before exiting modified buffer +opt.cursorline = true -- Enable highlighting of the current line +opt.expandtab = true -- Use spaces instead of tabs opt.formatoptions = "jcroqlnt" -- tcqj opt.grepformat = "%f:%l:%c:%m" opt.grepprg = "rg --vimgrep" -opt.ignorecase = true -- Ignore case -opt.inccommand = 'split' -- Preview substitutions live, as you type! -opt.mouse = "a" -- Enable mouse mode -opt.nrformats = 'blank,bin,hex' -opt.number = true -- Print line number -opt.pumblend = 10 -- Popup blend -opt.pumheight = 10 -- Maximum number of entries in a popup +opt.ignorecase = true -- Ignore case +opt.inccommand = "split" -- Preview substitutions live, as you type! +opt.mouse = "a" -- Enable mouse mode +opt.nrformats = "blank,bin,hex" +opt.number = true -- Print line number +opt.pumblend = 10 -- Popup blend +opt.pumheight = 10 -- Maximum number of entries in a popup -- opt.relativenumber = true -- Relative line numbers -opt.scrolloff = 15 -- Lines of context -opt.sidescrolloff = 25 -- Columns of context +opt.scrolloff = 15 -- Lines of context +opt.sidescrolloff = 25 -- Columns of context opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" } -opt.shiftround = true -- Round indent -opt.shiftwidth = 2 -- Size of an indent -opt.showmode = false -- Don't show mode since we have a statusline -opt.sidescrolloff = 8 -- Columns of context -opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time -opt.smartcase = true -- Don't ignore case with capitals -opt.smartindent = true -- Insert indents automatically +opt.shiftround = true -- Round indent +opt.shiftwidth = 2 -- Size of an indent +opt.showmode = false -- Don't show mode since we have a statusline +opt.sidescrolloff = 8 -- Columns of context +opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time +opt.smartcase = true -- Don't ignore case with capitals +opt.smartindent = true -- Insert indents automatically opt.spelllang = { "en" } -opt.splitbelow = true -- Put new windows below current -opt.splitright = true -- Put new windows right of current -opt.tabstop = 2 -- Number of spaces tabs count for +opt.splitbelow = true -- Put new windows below current +opt.splitright = true -- Put new windows right of current +opt.tabstop = 2 -- Number of spaces tabs count for opt.termguicolors = true -- True color support opt.undofile = true opt.undolevels = 10000 -opt.updatetime = 200 -- Save swap file and trigger CursorHold +opt.updatetime = 200 -- Save swap file and trigger CursorHold opt.wildmode = "longest,list:full" -- Command-line completion mode -opt.winminwidth = 5 -- Minimum window width -opt.wrap = false -- Disable line wrap -vim.o.completeopt = 'noselect,menu,menuone,noinsert,popup' -vim.o.winborder = 'rounded' +opt.winminwidth = 5 -- Minimum window width +opt.wrap = false -- Disable line wrap +vim.o.completeopt = "noselect,menu,menuone,noinsert,popup" +vim.o.winborder = "rounded" vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions" @@ -130,18 +130,20 @@ vim.filetype.add({ mdx = "mdx", log = "log", conf = "conf", - env = "dotenv", + -- env = "dotenv", }, -- Detect and apply filetypes based on the entire filename filename = { - [".env"] = "dotenv", + -- [".env"] = "dotenv", ["env"] = "dotenv", ["tsconfig.json"] = "jsonc", }, -- Detect and apply filetypes based on certain patterns of the filenames pattern = { -- INFO: Match filenames like - ".env.example", ".env.local" and so on - ["%.env%.[%w_.-]+"] = "dotenv", + -- ["%.env%.[%w_.-]+"] = "dotenv", + ["compose.*%.ya?ml"] = "yaml.docker-compose", + ["docker-compose.*%.ya?ml"] = "yaml.docker-compose", [".*%.blade%.php"] = "blade", [".*%.hurl.*"] = "hurl", [".*/hypr/.*%.conf"] = "hyprlang", @@ -155,27 +157,16 @@ vim.filetype.add({ vim.lsp.config("rust-analyzer", { tools = { code_actions = { - ui_select_fallback = true - } - } + ui_select_fallback = true, + }, + }, }) -vim.lsp.enable({ - "bashls", - "biome", - "fish_lsp", - "gleam", - "gopls", - "hyprls", - "intelephense", - "jsonls", - "kotlin_lsp", - "lua_ls", - "nushell", - "pyright", - "ruff", - -- "rust_analyzer", -- managed by rustacean.nvim -}) +vim.g.markdown_fenced_languages = { + "ts=typescript", +} + +vim.lsp.enable("denols") vim.lsp.inlay_hint.enable(true) diff --git a/configs/nvim/lua/aleidk/plugins/init.lua b/configs/nvim/lua/aleidk/plugins/init.lua index 948f2b3..245f048 100644 --- a/configs/nvim/lua/aleidk/plugins/init.lua +++ b/configs/nvim/lua/aleidk/plugins/init.lua @@ -1,10 +1,13 @@ return { - 'neovim/nvim-lspconfig', - 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically { - "mason-org/mason.nvim", - opts = {} + "mason-org/mason-lspconfig.nvim", + opts = {}, + dependencies = { + { "mason-org/mason.nvim", opts = {} }, + "neovim/nvim-lspconfig", + }, }, + 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically { "ckolkey/ts-node-action", dependencies = { "nvim-treesitter" }, diff --git a/configs/nvim/lua/aleidk/plugins/language-support.lua b/configs/nvim/lua/aleidk/plugins/language-support.lua index c47309b..bee76db 100644 --- a/configs/nvim/lua/aleidk/plugins/language-support.lua +++ b/configs/nvim/lua/aleidk/plugins/language-support.lua @@ -1,24 +1,25 @@ return { - { - 'mrcjkb/rustaceanvim', - version = '^6', -- Recommended - lazy = false, -- This plugin is already lazy - }, - { - -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins - -- used for completion, annotations and signatures of Neovim apis - 'folke/lazydev.nvim', - ft = 'lua', - opts = { - library = { - -- Load luvit types when the `vim.uv` word is found - { path = "${3rd}/luv/library", words = { "vim%.uv" } } - }, - }, - }, - { - "pmizio/typescript-tools.nvim", - dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" }, - opts = {}, - } + { + "mrcjkb/rustaceanvim", + version = "^6", -- Recommended + lazy = false, -- This plugin is already lazy + }, + { + -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins + -- used for completion, annotations and signatures of Neovim apis + "folke/lazydev.nvim", + ft = "lua", + opts = { + library = { + -- Load luvit types when the `vim.uv` word is found + { path = "${3rd}/luv/library", words = { "vim%.uv" } }, + }, + }, + }, + { + "pmizio/typescript-tools.nvim", + enabled = false, + dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" }, + opts = {}, + }, } diff --git a/configs/nvim/lua/aleidk/plugins/training.lua b/configs/nvim/lua/aleidk/plugins/training.lua index 6eb3bfc..47012a6 100644 --- a/configs/nvim/lua/aleidk/plugins/training.lua +++ b/configs/nvim/lua/aleidk/plugins/training.lua @@ -1,14 +1,15 @@ return { - { - "m4xshen/hardtime.nvim", - lazy = false, - dependencies = { "MunifTanjim/nui.nvim" }, - keys = { - { "uH", "Hardtime toggle", desc = "Toggle hardtime" } - }, - opts = { - max_count = 10, - disable_mouse = false, - }, - }, + { + "m4xshen/hardtime.nvim", + lazy = false, + dependencies = { "MunifTanjim/nui.nvim" }, + keys = { + { "uH", "Hardtime toggle", desc = "Toggle hardtime" }, + }, + opts = { + max_count = 10, + disable_mouse = false, + restriction_mode = "hint", + }, + }, }