diff options
| author | 2025-06-09 13:43:45 +0300 | |
|---|---|---|
| committer | 2025-06-09 13:55:38 +0300 | |
| commit | 97af93b2a8ebc89364852e3f63e9fd8cfedaeedf (patch) | |
| tree | 27e2added74ee6c0ff91c9e7927491c661a8bb36 /config | |
| parent | 04.06.2025 (diff) | |
| download | dotfiles-97af93b2a8ebc89364852e3f63e9fd8cfedaeedf.tar.gz dotfiles-97af93b2a8ebc89364852e3f63e9fd8cfedaeedf.tar.bz2 dotfiles-97af93b2a8ebc89364852e3f63e9fd8cfedaeedf.tar.xz dotfiles-97af93b2a8ebc89364852e3f63e9fd8cfedaeedf.zip | |
Перевёл dotfiles на stow
Diffstat (limited to 'config')
59 files changed, 2837 insertions, 0 deletions
diff --git a/config/hypr/custom/rules.conf b/config/hypr/custom/rules.conf new file mode 100644 index 0000000..68a4aac --- /dev/null +++ b/config/hypr/custom/rules.conf @@ -0,0 +1,104 @@ +# ######## Window rules ######## + +# Uncomment to apply global transparency to all windows: +windowrulev2 = opacity 0.95 override 0.95 override, class:.* + +# Disable blur for XWayland windows (or context menus with shadow would look weird) +windowrulev2 = noblur, xwayland:1 + +# Floating +windowrulev2 = float, class:^(blueberry\.py)$ +windowrulev2 = float, class:^(steam)$ +windowrulev2 = float, class:^(guifetch)$ # FlafyDev/guifetch +windowrulev2 = float, class:^(pavucontrol)$ +windowrulev2 = size 45%, class:^(pavucontrol)$ +windowrulev2 = center, class:^(pavucontrol)$ +windowrulev2 = float, class:^(org.pulseaudio.pavucontrol)$ +windowrulev2 = size 45%, class:^(org.pulseaudio.pavucontrol)$ +windowrulev2 = center, class:^(org.pulseaudio.pavucontrol)$ +windowrulev2 = float, class:^(nm-connection-editor)$ +windowrulev2 = size 45%, class:^(nm-connection-editor)$ +windowrulev2 = center, class:^(nm-connection-editor)$ + +# Tiling +windowrulev2 = tile, class:^dev\.warp\.Warp$ + +# Picture-in-Picture +windowrulev2 = float, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ +windowrulev2 = keepaspectratio, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ +windowrulev2 = move 73% 72%, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ +windowrulev2 = size 25%, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ +windowrulev2 = float, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ +windowrulev2 = pin, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ + +# Dialog windows – float+center these windows. +windowrulev2 = center, title:^(Open File)(.*)$ +windowrulev2 = center, title:^(Select a File)(.*)$ +windowrulev2 = center, title:^(Choose wallpaper)(.*)$ +windowrulev2 = center, title:^(Open Folder)(.*)$ +windowrulev2 = center, title:^(Save As)(.*)$ +windowrulev2 = center, title:^(Library)(.*)$ +windowrulev2 = center, title:^(File Upload)(.*)$ +windowrulev2 = float, title:^(Open File)(.*)$ +windowrulev2 = float, title:^(Select a File)(.*)$ +windowrulev2 = float, title:^(Choose wallpaper)(.*)$ +windowrulev2 = float, title:^(Open Folder)(.*)$ +windowrulev2 = float, title:^(Save As)(.*)$ +windowrulev2 = float, title:^(Library)(.*)$ +windowrulev2 = float, title:^(File Upload)(.*)$ + + +# --- Tearing --- +windowrulev2 = immediate, title:.*\.exe +windowrulev2 = immediate, class:^(steam_app) + +# No shadow for tiled windows (matches windows that are not floating). +windowrulev2 = noshadow, floating:0 + +# ######## Workspace rules ######## +workspace = special:special, gapsout:30 + +# ######## Layer rules ######## +layerrule = xray 1, .* +# layerrule = noanim, .* +layerrule = noanim, walker +layerrule = noanim, selection +layerrule = noanim, overview +layerrule = noanim, anyrun +layerrule = noanim, indicator.* +layerrule = noanim, osk +layerrule = noanim, hyprpicker + +layerrule = noanim, noanim +layerrule = blur, gtk-layer-shell +layerrule = ignorezero, gtk-layer-shell +layerrule = blur, launcher +layerrule = ignorealpha 0.5, launcher +layerrule = blur, notifications +layerrule = ignorealpha 0.69, notifications +layerrule = blur, logout_dialog # wlogout + +# ags +layerrule = animation slide left, sideleft.* +layerrule = animation slide right, sideright.* +layerrule = blur, session[0-9]* +layerrule = blur, bar[0-9]* +layerrule = ignorealpha 0.6, bar[0-9]* +layerrule = blur, barcorner.* +layerrule = ignorealpha 0.6, barcorner.* +layerrule = blur, dock[0-9]* +layerrule = ignorealpha 0.6, dock[0-9]* +layerrule = blur, indicator.* +layerrule = ignorealpha 0.6, indicator.* +layerrule = blur, overview[0-9]* +layerrule = ignorealpha 0.6, overview[0-9]* +layerrule = blur, cheatsheet[0-9]* +layerrule = ignorealpha 0.6, cheatsheet[0-9]* +layerrule = blur, sideright[0-9]* +layerrule = ignorealpha 0.6, sideright[0-9]* +layerrule = blur, sideleft[0-9]* +layerrule = ignorealpha 0.6, sideleft[0-9]* +layerrule = blur, indicator.* +layerrule = ignorealpha 0.6, indicator.* +layerrule = blur, osk[0-9]* +layerrule = ignorealpha 0.6, osk[0-9]* diff --git a/config/hypr/hypridle.conf b/config/hypr/hypridle.conf new file mode 100644 index 0000000..8809a22 --- /dev/null +++ b/config/hypr/hypridle.conf @@ -0,0 +1,33 @@ +$suspend_cmd = pidof steam || systemctl suspend || loginctl suspend + +# General_settings +general { + before_sleep_cmd = hyprlock # command before sleep + ignore_dbus_inhibit = false # (used by e.g. firefox or steam) +} + +# Screen_brightness +listener { + timeout = 300 + on-timeout = brightnessctl s 20% + on-resume = brightnessctl s 100% +} + +# Screen_lock +listener { + timeout = 600 + on-timeout = hyprlock +} + +# Screen_off +listener { + timeout = 780 + on-timeout = hyprctl dispatch dpms off + on-resume = hyprctl dispatch dpms on +} + +# Suspend +listener { + timeout = 1200 + on-timeout = $suspend_cmd +} diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf new file mode 100644 index 0000000..c5ae504 --- /dev/null +++ b/config/hypr/hyprland.conf @@ -0,0 +1,264 @@ + +# ####################################################################################### +# AUTOGENERATED HYPR CONFIG. +# PLEASE USE THE CONFIG PROVIDED IN THE GIT REPO /examples/hypr.conf AND EDIT IT, +# OR EDIT THIS ONE ACCORDING TO THE WIKI INSTRUCTIONS. +# ####################################################################################### + + +# This is an example Hyprland config file. +# Refer to the wiki for more information. +# https://wiki.hyprland.org/Configuring/Configuring-Hyprland/ + +# Please note not all available settings / options are set here. +# For a full list, see the wiki + +# You can split this configuration into multiple files +# Create your files separately and then link them to this file like this: +# source = ~/.config/hypr/myColors.conf + + +################ +### MONITORS ### +################ + +# See https://wiki.hyprland.org/Configuring/Monitors/ +monitor=,preferred,auto,auto +monitor=DP-7,1920x1080,auto,auto + +################### +### MY PROGRAMS ### +################### + +# See https://wiki.hyprland.org/Configuring/Keywords/ + +# Set programs that you use +$terminal = kitty +$fileManager = dolphin +$menu = wofi --show drun + + +################# +### AUTOSTART ### +################# + +# Autostart necessary processes (like notifications daemons, status bars, etc.) +# Or execute your favorite apps at launch like this: + +exec-once = $terminal +exec-once = nm-applet & +exec-once = waybar & hyprpaper & firefox + + +############################# +### ENVIRONMENT VARIABLES ### +############################# + +# See https://wiki.hyprland.org/Configuring/Environment-variables/ + +env = XCURSOR_SIZE,24 +env = HYPRCURSOR_SIZE,24 + + +##################### +### LOOK AND FEEL ### +##################### + +# Refer to https://wiki.hyprland.org/Configuring/Variables/ + +# https://wiki.hyprland.org/Configuring/Variables/#general +general { + gaps_in = 4 + gaps_out = 8 + + border_size = 2 + + # https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors + col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg + col.inactive_border = rgba(595959aa) + + # Set to true enable resizing windows by clicking and dragging on borders and gaps + resize_on_border = false + + # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on + allow_tearing = false + + layout = dwindle +} + +# https://wiki.hyprland.org/Configuring/Variables/#decoration +decoration { + rounding = 10 + + # Change transparency of focused and unfocused windows + active_opacity = 1.0 + inactive_opacity = 1.0 + + drop_shadow = true + shadow_range = 4 + shadow_render_power = 3 + col.shadow = rgba(1a1a1aee) + + # https://wiki.hyprland.org/Configuring/Variables/#blur + blur { + enabled = true + size = 3 + passes = 1 + + vibrancy = 0.1696 + } +} + +# https://wiki.hyprland.org/Configuring/Variables/#animations +animations { + enabled = true + + # Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + + bezier = myBezier, 0.05, 0.9, 0.1, 1.05 + + animation = windows, 1, 7, myBezier + animation = windowsOut, 1, 7, default, popin 80% + animation = border, 1, 10, default + animation = borderangle, 1, 8, default + animation = fade, 1, 7, default + animation = workspaces, 1, 6, default +} + +# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more +dwindle { + pseudotile = true # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = true # You probably want this +} + +# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more +master { + new_status = master +} + +# https://wiki.hyprland.org/Configuring/Variables/#misc +misc { + force_default_wallpaper = -1 # Set to 0 or 1 to disable the anime mascot wallpapers + disable_hyprland_logo = false # If true disables the random hyprland logo / anime girl background. :( +} + + +############# +### INPUT ### +############# + +# https://wiki.hyprland.org/Configuring/Variables/#input +input { + kb_layout = us,ru + kb_variant = + kb_model = + kb_options = grp:caps_toggle,misc:typo,lv3:ralt_switch + kb_rules = + + follow_mouse = 1 + + sensitivity = 0 # -1.0 - 1.0, 0 means no modification. + + touchpad { + natural_scroll = true + } +} + +# https://wiki.hyprland.org/Configuring/Variables/#gestures +gestures { + workspace_swipe = true +} + +# Example per-device config +# See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more +device { + name = epic-mouse-v1 + sensitivity = -0.5 +} + + + +#################### +### KEYBINDINGSS ### +#################### + +# See https://wiki.hyprland.org/Configuring/Keywords/ +$mainMod = SUPER # Sets "Windows" key as main modifier +$shiftMod = SUPER_SHIFT +# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more +bind = $mainMod, Q, exec, $terminal +bind = $mainMod, C, killactive, +bind = $mainMod, M, exit, +bind = $mainMod, E, exec, $fileManager +bind = $mainMod, L, exec, hyprlock +bind = $mainMod, V, togglefloating, +bind = $mainMod, R, exec, $menu +bind = $mainMod, P, pseudo, # dwindle +bind = $mainMod, J, togglesplit, # dwindle + +# Move focus with mainMod + arrow keys +bind = $mainMod, left, movefocus, l +bind = $mainMod, right, movefocus, r +bind = $mainMod, up, movefocus, u +bind = $mainMod, down, movefocus, d + +# Switch workspaces with mainMod + [0-9] +bind = $mainMod, 1, workspace, 1 +bind = $mainMod, 2, workspace, 2 +bind = $mainMod, 3, workspace, 3 +bind = $mainMod, 4, workspace, 4 +bind = $mainMod, 5, workspace, 5 +bind = $mainMod, 6, workspace, 6 +bind = $mainMod, 7, workspace, 7 +bind = $mainMod, 8, workspace, 8 +bind = $mainMod, 9, workspace, 9 +bind = $mainMod, 0, workspace, 10 + +# Move active window to a workspace with mainMod + SHIFT + [0-9] +bind = $mainMod SHIFT, 1, movetoworkspace, 1 +bind = $mainMod SHIFT, 2, movetoworkspace, 2 +bind = $mainMod SHIFT, 3, movetoworkspace, 3 +bind = $mainMod SHIFT, 4, movetoworkspace, 4 +bind = $mainMod SHIFT, 5, movetoworkspace, 5 +bind = $mainMod SHIFT, 6, movetoworkspace, 6 +bind = $mainMod SHIFT, 7, movetoworkspace, 7 +bind = $mainMod SHIFT, 8, movetoworkspace, 8 +bind = $mainMod SHIFT, 9, movetoworkspace, 9 +bind = $mainMod SHIFT, 0, movetoworkspace, 10 + +# Example special workspace (scratchpad) +bind = $mainMod, S, togglespecialworkspace, magic +bind = $mainMod SHIFT, S, movetoworkspace, special:magic + +# Scroll through existing workspaces with mainMod + scroll +bind = $mainMod, mouse_down, workspace, e+1 +bind = $mainMod, mouse_up, workspace, e-1 + +# Move/resize windows with mainMod + LMB/RMB and dragging +bindm = $mainMod, mouse:272, movewindow +bindm = $mainMod, mouse:273, resizewindow + + +# Screenshot a window +bind = $mainMod, PRINT, exec, hyprshot -m window +# Screenshot a monitor +bind = , PRINT, exec, hyprshot -m output +# Screenshot a region +bind = $shiftMod, PRINT, exec, hyprshot -m region + +############################## +### WINDOWS AND WORKSPACES ### +############################## + +source = ~/.config/hypr/custom/rules.conf + +# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more +# See https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules + +# Example windowrule v1 +# windowrule = float, ^(kitty)$ + +# Example windowrule v2 +# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ +windowrulev2 = suppressevent maximize, class:.* # You'll probably like this. + diff --git a/config/hypr/hyprlock.conf b/config/hypr/hyprlock.conf new file mode 100644 index 0000000..94920bf --- /dev/null +++ b/config/hypr/hyprlock.conf @@ -0,0 +1,74 @@ +background { + monitor = + path = $HOME/.config/hypr/lock.png # only *.png supported for now + color = rgba(25, 20, 20, 1.0) + blur_passes = 4 # 0 disables blurring + blur_size = 2 + noise = 0.0117 + contrast = 0.8916 + brightness = 0.8172 + vibrancy = 0.1696 + vibrancy_darkness = 0.0 +} + +input-field { + monitor = + size = 400, 50 + outline_thickness = 1 + dots_size = 0.4 # Scale of input-field height, 0.2 - 0.8 + dots_spacing = 0.15 # Scale of dots' absolute size, 0.0 - 1.0 + dots_center = true + outer_color = rgb(000000) + inner_color = rgb(200, 200, 200) + font_color = rgb(10, 10, 10) + fade_on_empty = true + placeholder_text = <i>Пароль</i> # Text rendered in the input box when it's empty. + hide_input = false + position = 0, -50 + halign = center + valign = center +} + +label { + monitor = + text = cmd[update:1000] echo "<span foreground='##ffffff'>$(date +"%H:%M")</span>" + color = rgba(200, 200, 200, 1.0) + font_size = 60 + font_family = Noto Sans + position = 0, 150 + halign = center + valign = center +} + +label { + monitor = + text = cmd[update:1000] echo "<span foreground='##ffffff'>$(date +"%A, %d %B %Y")</span>" + color = rgba(200, 200, 200, 1.0) + font_size = 18 + font_family = Noto Sans + position = 0, 100 + halign = center + valign = center +} + +label { + monitor = + text = cmd[update:5000] ${XDG_CONFIG_HOME:-$HOME/.config}/hypr/hyprlock/status.sh + color = rgba(200, 200, 200, 1.0) + font_size = 18 + font_family = Noto Sans + position = 0, 50 + halign = center + valign = center +} + +label { + monitor = + text = <span foreground='##ffffff'>$USER</span> + color = rgba(200, 200, 200, 1.0) + font_size = 60 + font_family = Noto Sans + position = 0, 320 + halign = center + valign = center +} diff --git a/config/hypr/hyprlock/status.sh b/config/hypr/hyprlock/status.sh new file mode 100755 index 0000000..ea2607e --- /dev/null +++ b/config/hypr/hyprlock/status.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +############ Variables ############ +enable_battery=false +battery_charging=false + +####### Check availability ######## +for battery in /sys/class/power_supply/*BAT*; do + if [[ -f "$battery/uevent" ]]; then + enable_battery=true + if [[ $(cat /sys/class/power_supply/*/status | head -1) == "Charging" ]]; then + battery_charging=true + fi + break + fi +done + +############# Output ############# +if [[ $enable_battery == true ]]; then + if [[ $battery_charging == true ]]; then + echo -n " заряжается" + fi + echo -n "$(cat /sys/class/power_supply/*/capacity | head -1)"% + if [[ $battery_charging == false ]]; then + echo -n " осталось" + fi +fi + +echo '' diff --git a/config/hypr/hyprpaper.conf b/config/hypr/hyprpaper.conf new file mode 100644 index 0000000..4d21b18 --- /dev/null +++ b/config/hypr/hyprpaper.conf @@ -0,0 +1,3 @@ +preload = ~/.config/hypr/wp.jpg +wallpaper = , ~/.config/hypr/wp.jpg +splash = true diff --git a/config/hypr/lock.png b/config/hypr/lock.png Binary files differnew file mode 100644 index 0000000..5a85e8e --- /dev/null +++ b/config/hypr/lock.png diff --git a/config/hypr/wp.jpg b/config/hypr/wp.jpg Binary files differnew file mode 100644 index 0000000..2047b40 --- /dev/null +++ b/config/hypr/wp.jpg diff --git a/config/kitty/kitty.conf b/config/kitty/kitty.conf new file mode 100644 index 0000000..4ef1dc9 --- /dev/null +++ b/config/kitty/kitty.conf @@ -0,0 +1,18 @@ +font_size 10.0 +background_opacity 1 +background #0e0e20 +cursor_shape beam +window_margin_width 4 +confirm_os_window_close 0 + +# Zoom +map ctrl+plus change_font_size all +1 +map ctrl+equal change_font_size all +1 +map ctrl+kp_add change_font_size all +1 + +map ctrl+minus change_font_size all -1 +map ctrl+underscore change_font_size all -1 +map ctrl+kp_subtract change_font_size all -1 + +map ctrl+0 change_font_size all 0 +map ctrl+kp_0 change_font_size all 0 diff --git a/config/mako/config b/config/mako/config new file mode 100644 index 0000000..022c8ef --- /dev/null +++ b/config/mako/config @@ -0,0 +1,28 @@ +sort=-time +layer=overlay +background-color=#2e3440 +width=300 +height=110 +border-size=2 +border-color=#33ccff +border-radius=10 +icons=0 +max-icon-size=64 +default-timeout=5000 +ignore-timeout=1 +font=monospace 10 + +[urgency=low] +border-color=#595959 + +[urgency=normal] +border-color=#33ccff + +[urgency=high] +border-color=#00ff99 +default-timeout=0 + +[category=mpd] +default-timeout=2000 +group-by=category + diff --git a/config/nvim/.editorconfig b/config/nvim/.editorconfig new file mode 100644 index 0000000..2e6feec --- /dev/null +++ b/config/nvim/.editorconfig @@ -0,0 +1,7 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +indent_style = tab + diff --git a/config/nvim/.gitignore b/config/nvim/.gitignore new file mode 100644 index 0000000..67dcbc2 --- /dev/null +++ b/config/nvim/.gitignore @@ -0,0 +1 @@ +codecompanion.lua diff --git a/config/nvim/Session.vim b/config/nvim/Session.vim new file mode 100644 index 0000000..510124f --- /dev/null +++ b/config/nvim/Session.vim @@ -0,0 +1,54 @@ +let SessionLoad = 1 +let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1 +let v:this_session=expand("<sfile>:p") +silent only +silent tabonly +cd ~/projects/dotfiles/nvim +if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == '' + let s:wipebuf = bufnr('%') +endif +let s:shortmess_save = &shortmess +if &shortmess =~ 'A' + set shortmess=aoOA +else + set shortmess=aoO +endif +badd +6 init.lua +badd +25 lua/plugins/theme.lua +badd +1 lua/plugins/tree.lua +argglobal +%argdel +edit lua/plugins/tree.lua +argglobal +balt lua/plugins/theme.lua +setlocal fdm=expr +setlocal fde=nvim_treesitter#foldexpr() +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=6 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +let s:l = 1 - ((0 * winheight(0) + 22) / 44) +if s:l < 1 | let s:l = 1 | endif +keepjumps exe s:l +normal! zt +keepjumps 1 +normal! 0 +tabnext 1 +if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal' + silent exe 'bwipe ' . s:wipebuf +endif +unlet! s:wipebuf +set winheight=1 winwidth=20 +let &shortmess = s:shortmess_save +let s:sx = expand("<sfile>:p:r")."x.vim" +if filereadable(s:sx) + exe "source " . fnameescape(s:sx) +endif +let &g:so = s:so_save | let &g:siso = s:siso_save +set hlsearch +nohlsearch +doautoall SessionLoadPost +unlet SessionLoad +" vim: set ft=vim : diff --git a/config/nvim/colors/neonxp.lua b/config/nvim/colors/neonxp.lua new file mode 100644 index 0000000..1d7ab9f --- /dev/null +++ b/config/nvim/colors/neonxp.lua @@ -0,0 +1,142 @@ +local function SetHl(group, mod, fg, bg) + + local fmt="highlight %s gui=%s cterm=%s guifg=%s ctermfg=%s guibg=%s ctermbg=%s" + vim.cmd(fmt:format(group, mod[1], mod[2], fg[1], fg[2], bg[1], bg[2])) +end +local colors = require("theme.colors") +local mods = require("theme.modifiers") + +vim.cmd([[hi normal guibg=NONE ctermbg=NONE]]) + +-- VIM - INTERFACE +------------------ +SetHl("StatusLine", mods["bold"], colors["none"], colors["black_l"]) +SetHl("StatusLineNC", mods["none"], colors["none"], colors["black_l"]) +SetHl("TabLineSel", mods["bold"], colors["none"], colors["black_l"]) +SetHl("WinSeparator", mods["none"], colors["gray"], colors["none"]) +SetHl("Pmenu", mods["none"], colors["none"], colors["black_l"]) +SetHl("PmenuSel", mods["bold"], colors["none"], colors["black_l"]) +SetHl("PmenuThumb", mods["none"], colors["none"], colors["gray_dd"]) +SetHl("FloatBorder", mods["none"], colors["gray"], colors["none"]) + +-- VIM - GENERAL TEXT +--------------------- +SetHl("Visual", mods["bold"], colors["none"], colors["black_l"]) +SetHl("Normal", mods["none"], colors["white"], colors["none"]) +SetHl("NormalFloat", mods["none"], colors["white"], colors["none"]) +SetHl("NonText", mods["none"], colors["gray"], colors["none"]) +SetHl("SpecialKey", mods["none"], colors["gray"], colors["none"]) +SetHl("Conceal", mods["none"], colors["gray"], colors["none"]) +SetHl("Folded", mods["none"], colors["none"], colors["none"]) +SetHl("MatchParen", mods["bold"], colors["yellow_l"], colors["black_l"]) +SetHl("Search", mods["bold"], colors["yellow_l"], colors["black_l"]) +SetHl("CurSearch", mods["bold"], colors["chartreuse_l"], colors["black_l"]) +SetHl("CursorLine", mods["bold"], colors["none"], colors["black_ll"]) +SetHl("CursorColumn", mods["bold"], colors["none"], colors["black_l"]) +SetHl("ColorColumn", mods["bold"], colors["none"], colors["black_ll"]) + +-- VIM - INFO TEXT +------------------ +SetHl("LineNr", mods["italic"], colors["gray"], colors["none"]) +SetHl("SignColumn", mods["bold"], colors["gray"], colors["none"]) +SetHl("DiagnosticError", mods["none"], colors["red_l"], colors["none"]) +SetHl("DiagnosticWarn", mods["none"], colors["orange_l"], colors["none"]) +SetHl("DiagnosticOK", mods["none"], colors["green_l"], colors["none"]) +SetHl("DiagnosticInfo", mods["none"], colors["royal_l"], colors["none"]) +SetHl("DiffAdd", mods["none"], colors["green_l"], colors["black_l"]) +SetHl("DiffChange", mods["none"], colors["orange_l"], colors["black_l"]) +SetHl("DiffDelete", mods["none"], colors["red_l"], colors["black_l"]) +SetHl("DiffText", mods["none"], colors["royal_l"], colors["black_l"]) +SetHl("QuickFixLine", mods["none"], colors["royal_l"], colors["none"]) + +-- VIM - MESSAGE TEXT +--------------------- +SetHl("ErrorMsg", mods["none"], colors["red_l"], colors["none"]) +SetHl("WarningMsg", mods["none"], colors["orange_l"], colors["none"]) +SetHl("Title", mods["bold"], colors["white"], colors["none"]) +SetHl("ModeMsg", mods["none"], colors["turquoise_l"], colors["none"]) +SetHl("MoreMsg", mods["none"], colors["turquoise_l"], colors["none"]) +SetHl("Question", mods["none"], colors["royal_l"], colors["none"]) + +-- VIM - FILE SYSTEM +-------------------- +SetHl("Directory", mods["none"], colors["royal_l"], colors["none"]) +SetHl("netrwClassify", mods["none"], colors["royal_d"], colors["none"]) +SetHl("netrwExe", mods["none"], colors["turquoise_l"], colors["none"]) + +-- CODE - VIM GENERAL +--------------------- +SetHl("PreProc", mods["none"], colors["purple_l"], colors["none"]) +SetHl("PreCondit", mods["none"], colors["purple_l"], colors["none"]) +SetHl("Statement", mods["none"], colors["cyan_l"], colors["none"]) +SetHl("Type", mods["none"], colors["green_l"], colors["none"]) +SetHl("Identifier", mods["none"], colors["royal_l"], colors["none"]) +SetHl("Function", mods["none"], colors["turquoise_l"], colors["none"]) +SetHl("Delimiter", mods["none"], colors["gray_ll"], colors["none"]) +SetHl("Operator", mods["none"], colors["white"], colors["none"]) +SetHl("Constant", mods["none"], colors["white"], colors["none"]) +SetHl("Special", mods["none"], colors["white_dd"], colors["none"]) +SetHl("String", mods["italic"], colors["white"], colors["none"]) +SetHl("Comment", mods["italic"], colors["gray"], colors["none"]) +SetHl("SpecialComment", mods["italic"], colors["turquoise_l"], colors["none"]) +SetHl("Todo", mods["italic"], colors["turquoise_l"], colors["none"]) +SetHl("Debug", mods["italic"], colors["gray"], colors["none"]) +SetHl("Error", mods["none"], colors["red_l"], colors["none"]) +SetHl("Added", mods["none"], colors["green_l"], colors["none"]) +SetHl("Changed", mods["none"], colors["orange_l"], colors["none"]) +SetHl("Removed", mods["none"], colors["red_l"], colors["none"]) + +-- CODE - TREESITTER GENERAL +---------------------------- +SetHl("@variable", mods["none"], colors["royal_l"], colors["none"]) +SetHl("@constant", mods["none"], colors["royal_l"], colors["none"]) +SetHl("@function.builtin", mods["none"], colors["turquoise_l"], colors["none"]) +SetHl("@variable.builtin", mods["none"], colors["purple_l"], colors["none"]) +SetHl("@constant.builtin", mods["none"], colors["purple_l"], colors["none"]) + +-- CODE - TREESITTER BASH +------------------------- +SetHl("@variable.parameter.bash", mods["none"], colors["turquoise_d"], colors["none"]) +SetHl("@punctuation.special.bash", mods["none"], colors["royal_d"], colors["none"]) +SetHl("@character.special.bash", mods["none"], colors["purple_l"], colors["none"]) + +-- ADDON - LAZY +--------------- +SetHl("LazyH1", mods["bold"], colors["purple_l"], colors["none"]) +SetHl("LazyH2", mods["bold"], colors["turquoise_l"], colors["none"]) +SetHl("LazyComment", mods["none"], colors["turquoise_d"], colors["none"]) +SetHl("LazyButton", mods["none"], colors["white"], colors["none"]) +SetHl("LazyButtonActive", mods["none"], colors["turquoise_l"], colors["none"]) +SetHl("LazySpecial", mods["bold"], colors["turquoise_l"], colors["none"]) + +-- ADDON - LSPCMP +----------------- +SetHl("CmpItemKind", mods["italic"], colors["gray_l"], colors["none"]) +SetHl("CmpItemKindKeyword", mods["italic"], colors["cyan_l"], colors["none"]) +SetHl("CmpItemKindClass", mods["italic"], colors["yellow_l"], colors["none"]) +SetHl("CmpItemKindStruct", mods["italic"], colors["green_l"], colors["none"]) +SetHl("CmpItemKindEnum", mods["italic"], colors["salmon_l"], colors["none"]) +SetHl("CmpItemKindInterface", mods["italic"], colors["blue_l"], colors["none"]) +SetHl("CmpItemKindField", mods["italic"], colors["green_l"], colors["none"]) +SetHl("CmpItemKindUnit", mods["italic"], colors["salmon_l"], colors["none"]) +SetHl("CmpItemKindFile", mods["italic"], colors["turquoise_l"], colors["none"]) +SetHl("CmpItemKindFunction", mods["italic"], colors["turquoise_l"], colors["none"]) +SetHl("CmpItemKindMethod", mods["italic"], colors["turquoise_l"], colors["none"]) +SetHl("CmpItemKindModule", mods["italic"], colors["turquoise_l"], colors["none"]) +SetHl("CmpItemKindConstructor", mods["italic"], colors["turquoise_l"], colors["none"]) +SetHl("CmpItemKindOperator", mods["italic"], colors["turquoise_l"], colors["none"]) +SetHl("CmpItemKindFolder", mods["italic"], colors["royal_l"], colors["none"]) +SetHl("CmpItemKindConstant", mods["italic"], colors["royal_l"], colors["none"]) +SetHl("CmpItemKindVariable", mods["italic"], colors["royal_l"], colors["none"]) +SetHl("CmpItemKindReference", mods["italic"], colors["royal_l"], colors["none"]) +SetHl("CmpItemKindParameter", mods["italic"], colors["royal_l"], colors["none"]) +SetHl("CmpItemKindEnumMember", mods["italic"], colors["royal_l"], colors["none"]) +SetHl("CmpItemKindSnippet", mods["italic"], colors["purple_l"], colors["none"]) + +-- ADDON - TELESCOPE +-------------------- +SetHl("TelescopeTitle", mods["bold"], colors["white"], colors["none"]) +SetHl("TelescopeBorder", mods["none"], colors["gray"], colors["none"]) +SetHl("TelescopePromptPrefix", mods["none"], colors["purple_l"], colors["none"]) + + diff --git a/config/nvim/init.lua b/config/nvim/init.lua new file mode 100644 index 0000000..f6fd4ab --- /dev/null +++ b/config/nvim/init.lua @@ -0,0 +1,38 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "--branch=stable", + lazyrepo, + lazypath, + }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) +vim.g.mapleader = " " +vim.g.maplocalleader = " " +vim.g.colorcolumn = 120 +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 +vim.cmd("filetype plugin indent on") + +require("options") +require("plugins") +require("keymaps") +require("commands") +require("autocommands") +require("lsp") +require("syntax") +-- require("dap") +vim.cmd [[colorscheme nightfly]] diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json new file mode 100644 index 0000000..6b58a8b --- /dev/null +++ b/config/nvim/lazy-lock.json @@ -0,0 +1,35 @@ +{ + "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, + "auto-save.nvim": { "branch": "main", "commit": "37c82fd548e3f5ffc2d9d020a65dac1044584f44" }, + "blink.cmp": { "branch": "main", "commit": "022521a8910a5543b0251b21c9e1a1e989745796" }, + "codecompanion.nvim": { "branch": "main", "commit": "9edf22cb71711cd7fab7671a25ed5424011a379d" }, + "conform.nvim": { "branch": "master", "commit": "0e93e0d12d2f7ebdea9e3e444dfaff0050cefbe6" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "go.nvim": { "branch": "master", "commit": "a3455f48cff718a86275115523dcc735535a13aa" }, + "goerr-nvim": { "branch": "main", "commit": "d30ba1cab652e78dbf6a644eb4823be57e9af203" }, + "goimpl.nvim": { "branch": "main", "commit": "2548d42c4db0645dea14f27e67c4b19b7030f1cf" }, + "guihua.lua": { "branch": "master", "commit": "87bea7b98429405caf2a0ce4d029b027bb017c70" }, + "headlines.nvim": { "branch": "master", "commit": "bf17c96a836ea27c0a7a2650ba385a7783ed322e" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lsp_signature.nvim": { "branch": "master", "commit": "a4e3c15dfdce8783c074539b1835edae75fa63d5" }, + "lspsaga.nvim": { "branch": "main", "commit": "920b1253e1a26732e53fac78412f6da7f674671d" }, + "lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" }, + "nightfly": { "branch": "master", "commit": "8c55003e89f321a48a8cd4bb426dd3e7c58f0646" }, + "nvim-dap": { "branch": "master", "commit": "ea82027c3447dc1a022be9a9884de276c05cd33a" }, + "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, + "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, + "nvim-lspconfig": { "branch": "master", "commit": "036885e8e5456d3907626b634693234f628afef6" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-tree.lua": { "branch": "master", "commit": "1c733e8c1957dc67f47580fe9c458a13b5612d5b" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-treesitter-context": { "branch": "master", "commit": "464a443b5a6657f39772b20baa95d02ffe97b268" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "0f051e9813a36481f48ca1f833897210dbcfffde" }, + "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, + "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, + "smartcolumn.nvim": { "branch": "main", "commit": "92f3773af80d674f1eb61e112dca79e2fa449fd1" }, + "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, + "todotxt.nvim": { "branch": "main", "commit": "225ac77fea10a9ad9a48d0247a8d3c23f33cb2ba" } +} diff --git a/config/nvim/lua/autocommands.lua b/config/nvim/lua/autocommands.lua new file mode 100644 index 0000000..802d9e9 --- /dev/null +++ b/config/nvim/lua/autocommands.lua @@ -0,0 +1,163 @@ +local function async_cmd(cmd) + local job_id = vim.fn.jobstart(cmd, { + on_stdout = function(_, data) + for _, line in pairs(data or {}) do + print(line) + end + end, + on_stderr = function(_, data) + for _, line in pairs(data or {}) do + print(line) + end + end, + on_exit = function(_, code) + if code ~= 0 then + vim.notify( + string.format("Команда завершилась с ошибкой (%d)", code), + vim.log.levels.ERROR + ) + else + vim.notify("OK", vim.log.levels.INFO) + end + end, + }) + + return job_id +end + +vim.api.nvim_create_autocmd({ "BufWritePre" }, { + pattern = "*.go", + callback = function() + local params = vim.lsp.util.make_range_params(nil, vim.lsp.util._get_offset_encoding()) + params.context = { only = { "source.organizeImports" } } + local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 3000) + for _, res in pairs(result or {}) do + for _, r in pairs(res.result or {}) do + if r.edit then + vim.lsp.util.apply_workspace_edit(r.edit, vim.lsp.util._get_offset_encoding()) + else + vim.lsp.buf.execute_command(r.command) + end + end + end + end, +}) + +vim.api.nvim_create_autocmd({ "BufWritePre" }, { + pattern = "*.go", + callback = function() + vim.lsp.buf.format(nil, 3000) + end, +}) + +local TrimWhiteSpaceGrp = vim.api.nvim_create_augroup("TrimWhiteSpaceGrp", {}) +vim.api.nvim_create_autocmd("BufWritePre", { + group = TrimWhiteSpaceGrp, + pattern = "*", + command = "%s/\\s\\+$//e", +}) + +local YankHighlightGrp = vim.api.nvim_create_augroup("YankHighlightGrp", {}) +vim.api.nvim_create_autocmd("TextYankPost", { + group = YankHighlightGrp, + pattern = "*", + callback = function() + vim.highlight.on_yank({ + higroup = "IncSearch", + timeout = 40, + }) + end, +}) + +vim.api.nvim_create_autocmd("BufEnter", { + callback = function() + if vim.bo.filetype == "NvimTree" or vim.fn.expand("%") == "" then + return + end + vim.schedule(function() + vim.cmd("nohlsearch") + local treeapi = require("nvim-tree.api") + treeapi.tree.find_file({ + update_root = false, + focus = false, + }) + end) + end, +}) + +vim.api.nvim_create_autocmd({ "BufEnter", "BufAdd", "BufNew", "BufNewFile", "BufWinEnter" }, { + group = vim.api.nvim_create_augroup("TS_FOLD_WORKAROUND", {}), + callback = function() + -- vim.cmd([[normal zR]]) + end, +}) +vim.api.nvim_create_autocmd("FileType", { + pattern = "*", + callback = function(args) + local buf = args.buf + local ft = vim.bo[buf].filetype + + if ft and ft ~= "" then + local has_parser, _ = pcall(vim.treesitter.language.get_lang, ft) + if has_parser then + pcall(vim.treesitter.start, buf, ft) + end + end + end, +}) +vim.api.nvim_create_autocmd("User", { + pattern = "TSUpdate", + callback = function() + vim.cmd([[TSEnable highlight]]) + end, +}) +vim.api.nvim_create_autocmd({ "BufWritePost" }, { + pattern = "*.templ", + callback = function() + local cmd = "templ generate" + async_cmd(cmd) + end, +}) + +vim.api.nvim_create_autocmd({ "VimEnter" }, { + callback = function(data) + local directory = vim.fn.isdirectory(data.file) == 1 + if not directory then + return + end + vim.cmd.cd(data.file) + require("nvim-tree.api").tree.open() + end, +}) +vim.api.nvim_create_autocmd("FileType", { + pattern = "go", + callback = function() + vim.opt_local.expandtab = false + vim.opt_local.tabstop = 4 + vim.opt_local.shiftwidth = 4 + vim.opt_local.autoindent = true + vim.opt_local.smartindent = true + vim.opt_local.cindent = false + end, +}) +vim.filetype.add({ + extension = { + hjson = "hjson", + }, +}) +vim.api.nvim_create_autocmd("VimResized", { + pattern = "*", + callback = function() + vim.opt.scrolloff = vim.fn.floor(vim.fn.winheight(0) / 2) + end, +}) + +vim.api.nvim_create_autocmd("InsertEnter", { + pattern = "*", + command = "set norelativenumber", +}) + +vim.api.nvim_create_autocmd("InsertLeave", { + pattern = "*", + command = "set relativenumber", +}) diff --git a/config/nvim/lua/commands.lua b/config/nvim/lua/commands.lua new file mode 100644 index 0000000..8a987b0 --- /dev/null +++ b/config/nvim/lua/commands.lua @@ -0,0 +1,6 @@ +vim.api.nvim_create_user_command("Lower", function() + vim.cmd([[normal! guaw]]) +end, { force = true }) +vim.api.nvim_create_user_command("Upper", function() + vim.cmd([[normal! gUaw]]) +end, { force = true }) diff --git a/config/nvim/lua/keymaps.lua b/config/nvim/lua/keymaps.lua new file mode 100644 index 0000000..76919a8 --- /dev/null +++ b/config/nvim/lua/keymaps.lua @@ -0,0 +1,77 @@ +local map = vim.api.nvim_set_keymap +local kmap = vim.keymap.set +-- Базовые настройки навигации -- +map("n", "<Space>", "<Nop>", { noremap = true, silent = true }) + +-- Навигация в начало/конец строки +map("n", "<Home>", "^", { noremap = true, silent = true }) +map("n", "<End>", "$", { noremap = true, silent = true }) +map("v", "<Home>", "^", { noremap = true, silent = true }) +map("v", "<End>", "$", { noremap = true, silent = true }) +map("i", "<Home>", "<C-o>^", { noremap = true, silent = true }) +map("i", "<End>", "<C-o>$", { noremap = true, silent = true }) + +-- Фикс для визуального режима +map("v", "i", "<S-i>", { noremap = true, silent = true }) +map("v", "a", "<S-a>", { noremap = true, silent = true }) +map("v", "J", ":m '>+1<CR>gv=gv", { noremap = true, silent = true }) +map("v", "K", ":m '<-2<CR>gv=gv", { noremap = true, silent = true }) +map("v", "<", "<gv", { noremap = true, silent = true }) +map("v", ">", ">gv", { noremap = true, silent = true }) + +-- {{{ Управление буферами -- +kmap("n", "<leader>bn", "<cmd>bnext<CR>", { noremap = true, silent = true, desc = "Next buffer" }) +kmap("n", "<leader>bp", "<cmd>bprevious<CR>", { noremap = true, silent = true, desc = "Previous buffer" }) +kmap("n", "<leader>bd", "<cmd>bdelete<CR>", { noremap = true, silent = true, desc = "Delete buffer" }) +kmap("n", "<C-s>", "<cmd>wa<CR>", { noremap = true, silent = true, desc = "Save all files" }) +kmap("n", "<leader>q", "<cmd>q<CR>", { noremap = true, silent = true, desc = "Exit" }) +kmap("n", "<leader>vs", "<cmd>vsplit<CR>", { noremap = true, silent = true, desc = "Vertical split" }) +-- }}} + +-- {{{ Управление вкладками -- +kmap("n", "<A-Right>", ":tabnext<CR>", { noremap = true, silent = true, desc = "Next tab" }) +kmap("n", "<A-Left>", ":tabprevious<CR>", { noremap = true, silent = true, desc = "Previous tab" }) +kmap("n", "<A-t>", ":tabnew<CR>", { noremap = true, silent = true, desc = "New tab" }) +kmap("n", "<A-w>", ":tabclose<CR>", { noremap = true, silent = true, desc = "Close tab" }) + +-- Быстрый переход по вкладкам -- +for i = 1, 9 do + kmap("n", "<A-" .. i .. ">", ":tabn " .. i .. "<CR>", { noremap = true, silent = true, desc = "Go to tab " .. i }) +end + +-- }}} + +-- {{{ LSP функции +kmap("n", "d[", vim.diagnostic.goto_prev, { noremap = true, silent = true, desc = "Previous diagnostic" }) +kmap("n", "d]", vim.diagnostic.goto_next, { noremap = true, silent = true, desc = "Next diagnostic" }) + +kmap("n", "gD", vim.lsp.buf.declaration, { noremap = true, silent = true, desc = "Go to declaration" }) +kmap("n", "gd", vim.lsp.buf.definition, { noremap = true, silent = true, desc = "Go to definition" }) +kmap("n", "K", vim.lsp.buf.hover, { noremap = true, silent = true, desc = "Show documentation" }) + +kmap("n", "<C-k>", vim.lsp.buf.signature_help, { noremap = true, silent = true, desc = "Signature help" }) + +kmap( + "n", + "<leader>wa", + vim.lsp.buf.add_workspace_folder, + { noremap = true, silent = true, desc = "Add workspace folder" } +) + +kmap( + "n", + "<leader>wr", + vim.lsp.buf.remove_workspace_folder, + { noremap = true, silent = true, desc = "Remove workspace folder" } +) + +kmap("n", "<leader>wl", function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) +end, { noremap = true, silent = true, desc = "List workspace folders" }) + +--kmap("n", "<A-CR>", vim.lsp.buf.code_action, { noremap = true, silent = true, desc = "Code actions" }) +kmap("n", "<A-CR>", "<cmd>Lspsaga code_action<cr>", { noremap = true, silent = true, desc = "Code actions" }) + +kmap("n", "<F2>", vim.lsp.buf.rename, { noremap = true, silent = true, desc = "Rename symbol" }) + +-- }}} diff --git a/config/nvim/lua/lsp.lua b/config/nvim/lua/lsp.lua new file mode 100644 index 0000000..f12ecae --- /dev/null +++ b/config/nvim/lua/lsp.lua @@ -0,0 +1,31 @@ +-- инициализация LSP для различных ЯП +local lspconfig = require("lspconfig") +local util = require("lspconfig/util") + +local function config(_config) + return vim.tbl_deep_extend("force", { + -- capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()), + }, _config or {}) +end +-- иницализация gopls LSP для Go +-- https://github.com/golang/tools/blob/master/gopls/doc/vim.md#neovim-install +lspconfig.gopls.setup(config({ + cmd = { "gopls", "serve" }, + filetypes = { "go", "go.mod" }, + root_dir = util.root_pattern("go.work", "go.mod", ".git"), + settings = { + gopls = { + analyses = { + unusedparams = true, + }, + staticcheck = true, + gofumpt = true, + }, + }, +})) + +lspconfig.templ.setup(config({ + cmd = { "templ", "lsp" }, + filetypes = { "templ" }, + root_markers = { "go.work", "go.mod", ".git" }, +})) diff --git a/config/nvim/lua/myplugins/resize.lua b/config/nvim/lua/myplugins/resize.lua new file mode 100644 index 0000000..8af6c3b --- /dev/null +++ b/config/nvim/lua/myplugins/resize.lua @@ -0,0 +1,97 @@ +local M = {} + +M.setup = function(opts) end + +M.isRightMost = function() + local curWin = vim.fn.winnr() + vim.cmd([[wincmd l]]) + local rightWin = vim.fn.winnr() + if curWin == rightWin then + return true + else + vim.cmd([[wincmd h]]) + return false + end +end + +M.isLeftMost = function() + local curWin = vim.fn.winnr() + vim.cmd([[wincmd h]]) + local leftWin = vim.fn.winnr() + if curWin == leftWin then + return true + else + vim.cmd([[wincmd l]]) + return false + end +end + +M.isBottomMost = function() + local curWin = vim.fn.winnr() + vim.cmd([[wincmd j]]) + local bottomWin = vim.fn.winnr() + if curWin == bottomWin then + return true + else + vim.cmd([[wincmd k]]) + return false + end +end + +M.isTopMost = function() + local curWin = vim.fn.winnr() + vim.cmd([[wincmd k]]) + local topWin = vim.fn.winnr() + if curWin == topWin then + return true + else + vim.cmd([[wincmd j]]) + return false + end +end + +M.ResizeLeft = function() + if M.isRightMost() then + if not M.isLeftMost() then + vim.cmd([[wincmd 5 >]]) + end + else + vim.cmd([[wincmd 5 <]]) + end +end + +M.ResizeRight = function() + if M.isRightMost() then + if not M.isLeftMost() then + vim.cmd([[wincmd 5 <]]) + end + else + vim.cmd([[wincmd 5 >]]) + end +end + +M.ResizeUp = function() + if M.isBottomMost() then + if not M.isTopMost() then + vim.cmd([[wincmd 5 +]]) + else + vim.cmd([[wincmd 5 -]]) + end + else + vim.cmd([[wincmd 5 -]]) + end +end + +M.ResizeDown = function() + if M.isBottomMost() then + if not M.isTopMost() then + vim.cmd([[wincmd 5 -]]) + else + vim.cmd([[wincmd 5 +]]) + end + else + vim.cmd([[wincmd 5 +]]) + end +end + +return M diff --git a/config/nvim/lua/options.lua b/config/nvim/lua/options.lua new file mode 100644 index 0000000..8d55306 --- /dev/null +++ b/config/nvim/lua/options.lua @@ -0,0 +1,68 @@ +local options = { + backup = false, + clipboard = "unnamedplus", + cmdheight = 2, + completeopt = { "menuone", "noselect" }, + conceallevel = 0, + fileencoding = "utf-8", + hidden = true, + hlsearch = true, + ignorecase = true, + mouse = "", + pumheight = 10, + showmode = false, + showtabline = 2, + smartcase = true, + smartindent = true, + splitbelow = true, + splitright = true, + swapfile = false, + termguicolors = true, + undofile = true, + updatetime = 300, + writebackup = false, + shiftwidth = 4, + tabstop = 4, + cursorline = true, + number = true, + relativenumber = true, + numberwidth = 4, + signcolumn = "yes", + wrap = true, + scrolloff = 8, + sidescrolloff = 8, + syntax = "on", + foldmethod = "expr", + foldexpr = "v:lua.vim.treesitter.foldexpr()", + -- foldexpr = "nvim_treesitter#foldexpr()" + foldnestmax = 10, + foldlevel = 9, + -- foldlevelstart = 99, + scrolloff = 999, + so = vim.fn.floor(vim.fn.winheight(0) / 2), + guicursor = "n-v-c:block,i-ci-ve:hor10,r-cr:hor20,o:hor50,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,sm:block-blinkwait175-blinkoff150-blinkon175", + langmap = "ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯЖ;ABCDEFGHIJKLMNOPQRSTUVWXYZ:,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz", + spelllang = "en,ru_yo", + spell = true, +} +vim.opt.formatoptions:append({ r = true, o = true }) +vim.opt.shortmess:append("c") + +for k, v in pairs(options) do + vim.opt[k] = v +end +vim.wo.foldmethod = "expr" +vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()" +vim.cmd("set whichwrap+=<,>,[,],h,l") +vim.filetype.add({ + extension = { + templ = "templ", + }, + pattern = { + [".*/todo.txt"] = "todotxt", + }, +}) + +vim.g.nightflyCursorColor = true +vim.g.nightflyVirtualTextColor = true +vim.g.nightflyTransparent = true diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua new file mode 100644 index 0000000..0e9701d --- /dev/null +++ b/config/nvim/lua/plugins.lua @@ -0,0 +1,45 @@ +require("lazy").setup({ + { "bluz71/vim-nightfly-colors", name = "nightfly", lazy = false, priority = 1000 }, + { "nvim-lua/plenary.nvim" }, + { + "ray-x/guihua.lua", + build = "cd lua/fzy && make", + }, + { "neovim/nvim-lspconfig" }, + { "Snyssfx/goerr-nvim" }, + require("plugins.todo"), + require("plugins.codecompanion"), + require("plugins.resize"), + require("plugins.blankline"), + require("plugins.headlines"), + require("plugins.lsp_saga"), + require("plugins.lsp_signature"), + require("plugins.autosave"), + require("plugins.cmp"), + require("plugins.treesitter"), + require("plugins.tree"), + require("plugins.conform"), + require("plugins.dapui"), + require("plugins.dap"), + require("plugins.dap_go"), + require("plugins.go"), + require("plugins.goimpl"), + require("plugins.lualine"), + require("plugins.telescope"), + require("plugins.columns"), +}, { + performance = { + rtp = { + disabled_plugins = { + "gzip", + "matchit", + "matchparen", + "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/config/nvim/lua/plugins/autosave.lua b/config/nvim/lua/plugins/autosave.lua new file mode 100644 index 0000000..069afbf --- /dev/null +++ b/config/nvim/lua/plugins/autosave.lua @@ -0,0 +1,69 @@ +return { + "okuuva/auto-save.nvim", + enabled = true, + cmd = "ASToggle", -- optional for lazy loading on command + event = { "InsertLeave", "TextChanged" }, -- optional for lazy loading on trigger events + opts = { + enabled = true, -- start auto-save when the plugin is loaded (i.e. when your package manager loads it) + trigger_events = { -- See :h events + -- -- vim events that trigger an immediate save + -- -- I'm disabling this, as it's autosaving when I leave the buffer and + -- -- that's autoformatting stuff if on insert mode and following a tutorial + -- -- Re-enabling this to only save if NOT in insert mode in the condition below + -- immediate_save = { nil }, + immediate_save = { "BufLeave", "FocusLost", "QuitPre", "VimSuspend" }, -- vim events that trigger an immediate save + -- vim events that trigger a deferred save (saves after `debounce_delay`) + defer_save = { + "InsertLeave", + "TextChanged", + { "User", pattern = "VisualLeave" }, + { "User", pattern = "FlashJumpEnd" }, + { "User", pattern = "SnacksInputLeave" }, + { "User", pattern = "SnacksPickerInputLeave" }, + }, + cancel_deferred_save = { + "InsertEnter", + { "User", pattern = "VisualEnter" }, + { "User", pattern = "FlashJumpStart" }, + { "User", pattern = "SnacksInputEnter" }, + { "User", pattern = "SnacksPickerInputEnter" }, + }, + }, + -- function that takes the buffer handle and determines whether to save the current buffer or not + -- return true: if buffer is ok to be saved + -- return false: if it's not ok to be saved + -- if set to `nil` then no specific condition is applied + condition = function(buf) + -- Do not save when I'm in insert mode + -- Do NOT ADD VISUAL MODE HERE or the cancel_deferred_save wont' work + -- If I STAY in insert mode and switch to another app, like YouTube to + -- take notes, the BufLeave or FocusLost immediate_save will be ignored + -- and the save will not be triggered + local mode = vim.fn.mode() + if mode == "i" then + return false + end + + -- Disable auto-save for the harpoon plugin, otherwise it just opens and closes + -- https://github.com/ThePrimeagen/harpoon/issues/434 + -- + -- don't save for `sql` file types + -- I do this so when working with dadbod the file is not saved every time + -- I make a change, and a SQL query executed + -- Run `:set filetype?` on a dadbod query to make sure of the filetype + local filetype = vim.bo[buf].filetype + if filetype == "harpoon" or filetype == "mysql" then + return false + end + + return true + end, + write_all_buffers = true, -- write all buffers when the current one meets `condition` + noautocmd = false, + lockmarks = false, -- lock marks when saving, see `:h lockmarks` for more details + -- delay after which a pending save is executed (default 1000) + debounce_delay = 2000, + -- log debug messages to 'auto-save.log' file in neovim cache directory, set to `true` to enable + debug = false, + }, +} diff --git a/config/nvim/lua/plugins/blankline.lua b/config/nvim/lua/plugins/blankline.lua new file mode 100644 index 0000000..b74d9e6 --- /dev/null +++ b/config/nvim/lua/plugins/blankline.lua @@ -0,0 +1,7 @@ +return { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + --@module "ibl" + --@type ibl.config + config = true, +} diff --git a/config/nvim/lua/plugins/cmp.lua b/config/nvim/lua/plugins/cmp.lua new file mode 100644 index 0000000..718d8cb --- /dev/null +++ b/config/nvim/lua/plugins/cmp.lua @@ -0,0 +1,55 @@ +local source_mapping = { + buffer = "[Buffer]", + nvim_lsp = "[LSP]", + nvim_lua = "[Lua]", + luasnip = "[Snip]", + path = "[Path]", +} +return { + "saghen/blink.cmp", + lazy = false, + version = "1.*", + dependencies = { + { + "L3MON4D3/LuaSnip", + version = "v2.*", + build = "make install_jsregexp", + dependencies = { "rafamadriz/friendly-snippets" }, + config = function() + require("luasnip.loaders.from_vscode").lazy_load() + require("luasnip.loaders.from_vscode").lazy_load("./snippets") + end, + }, + }, + opts = { + keymap = { + preset = "enter", + }, + completion = { + list = { + selection = { + preselect = false, + auto_insert = false, + }, + }, + ghost_text = { + enabled = true, + }, + }, + cmdline = { + keymap = { + preset = "inherit", + ['<Tab>'] = { 'show', 'accept' }, + }, + completion = { + menu = { auto_show = false }, + ghost_text = { enabled = true }, + }, + sources = { "cmdline" }, + }, + snippets = { preset = "luasnip" }, + sources = { + default = { "lsp", "path", "snippets", "buffer", "codecompanion" }, + }, + }, +} diff --git a/config/nvim/lua/plugins/columns.lua b/config/nvim/lua/plugins/columns.lua new file mode 100644 index 0000000..40806e2 --- /dev/null +++ b/config/nvim/lua/plugins/columns.lua @@ -0,0 +1,10 @@ +return { + "m4xshen/smartcolumn.nvim", + opts = { + colorcolumn = "80", + disabled_filetypes = { "help", "text" }, + custom_colorcolumn = {}, + scope = "file", + editorconfig = true, + }, +} diff --git a/config/nvim/lua/plugins/conform.lua b/config/nvim/lua/plugins/conform.lua new file mode 100644 index 0000000..3204d2d --- /dev/null +++ b/config/nvim/lua/plugins/conform.lua @@ -0,0 +1,35 @@ +return { + "stevearc/conform.nvim", + opts = { + formatters_by_ft = { + javascript = { "prettier" }, + typescript = { "prettier" }, + javascriptreact = { "prettier" }, + typescriptreact = { "prettier" }, + css = { "prettier" }, + html = { "prettier" }, + json = { "prettier" }, + yaml = { "prettier" }, + markdown = { "prettier" }, + graphql = { "prettier" }, + lua = { "stylua" }, + python = { "isort", "black" }, + go = { "gofmt" }, + templ = { "templ" }, + }, + format_on_save = { + lsp_fallback = true, + async = false, + timeout_ms = 500, + }, + }, + keys = { + { + "<leader>mp", + function() + require("conform").format({ lsp_fallback = true, async = false, timeout_ms = 500 }) + end, + desc = "Format file or range (in visual mode)", + }, + }, +} diff --git a/config/nvim/lua/plugins/dap.lua b/config/nvim/lua/plugins/dap.lua new file mode 100644 index 0000000..ab44a1e --- /dev/null +++ b/config/nvim/lua/plugins/dap.lua @@ -0,0 +1,3 @@ +return { + "mfussenegger/nvim-dap", +} diff --git a/config/nvim/lua/plugins/dap_go.lua b/config/nvim/lua/plugins/dap_go.lua new file mode 100644 index 0000000..705fab7 --- /dev/null +++ b/config/nvim/lua/plugins/dap_go.lua @@ -0,0 +1,159 @@ +local default_config = { + delve = { + path = "dlv", + initialize_timeout_sec = 20, + port = "${port}", + args = {}, + build_flags = "", + -- Automatically handle the issue on delve Windows versions < 1.24.0 + -- where delve needs to be run in attched mode or it will fail (actually crashes). + detached = vim.fn.has("win32") == 0, + output_mode = "remote", + cwd = nil, + }, + tests = { + verbose = false, + }, +} + +local function setup_go_configuration(dap, configs) + local common_debug_configs = { + { + type = "go", + name = "Debug", + request = "launch", + program = "${workspaceFolder}", + args = {}, + buildFlags = configs.delve.build_flags, + outputMode = configs.delve.output_mode, + }, + } + + if dap.configurations.go == nil then + dap.configurations.go = {} + end + + for _, config in ipairs(common_debug_configs) do + table.insert(dap.configurations.go, config) + end + + if configs == nil or configs.dap_configurations == nil then + return + end + + for _, config in ipairs(configs.dap_configurations) do + if config.type == "go" then + table.insert(dap.configurations.go, config) + end + end +end + +return { + "leoluz/nvim-dap-go", + dependencies = { "mfussenegger/nvim-dap" }, + opts = true, + config = function() + local dap, dapui = require("dap"), require("dapui") + + dap.adapters.go = { + type = "server", + port = "${port}", + executable = { + command = "dlv", + args = { "dap", "-l", "127.0.0.1:${port}" }, + }, + } + + setup_go_configuration(dap, default_config) + + dap.defaults.fallback.terminal_win_cmd = "enew | set filetype=dap-terminal" + dap.listeners.before.attach.dapui_config = function() + dapui.open() + end + dap.listeners.before.launch.dapui_config = function() + dapui.open() + end + dap.listeners.before.event_terminated.dapui_config = function() + dapui.close() + end + dap.listeners.before.event_exited.dapui_config = function() + dapui.close() + end + + vim.api.nvim_set_hl(0, "DapBreakpoint", { ctermbg = 0, fg = "#993939", bg = "#31353f" }) + vim.api.nvim_set_hl(0, "DapLogPoint", { ctermbg = 0, fg = "#61afef", bg = "#31353f" }) + vim.api.nvim_set_hl(0, "DapStopped", { ctermbg = 0, fg = "#98c379", bg = "#31353f" }) + + vim.fn.sign_define( + "DapBreakpoint", + { text = "!", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" } + ) + vim.fn.sign_define( + "DapBreakpointCondition", + { text = "?", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" } + ) + vim.fn.sign_define( + "DapBreakpointRejected", + { text = "RJ", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" } + ) + vim.fn.sign_define( + "DapLogPoint", + { text = "i", texthl = "DapLogPoint", linehl = "DapLogPoint", numhl = "DapLogPoint" } + ) + vim.fn.sign_define( + "DapStopped", + { text = "→", texthl = "DapStopped", linehl = "DapStopped", numhl = "DapStopped" } + ) + end, + keys = { + { + "<F5>", + function() + require("dap").continue() + end, + silent = true, + }, + { + "<F17>", -- S-F5 + function() + require("dap").restart() + end, + silent = true, + }, + { + "<F29>", -- C-F5 + function() + require("dap").terminate() + end, + silent = true, + }, + { + "<F8>", + function() + require("dap").step_over() + end, + silent = true, + }, + { + "<F7>", + function() + require("dap").step_into() + end, + silent = true, + }, + { + "<F19>", -- S-F7 + function() + require("dap").step_out() + end, + silent = true, + }, + { + "<A-b>", + function() + require("dap").toggle_breakpoint() + end, + silent = true, + }, + }, +} diff --git a/config/nvim/lua/plugins/dapui.lua b/config/nvim/lua/plugins/dapui.lua new file mode 100644 index 0000000..5d35e1e --- /dev/null +++ b/config/nvim/lua/plugins/dapui.lua @@ -0,0 +1,73 @@ +return { + "rcarriga/nvim-dap-ui", + dependencies = { + "mfussenegger/nvim-dap", + "nvim-neotest/nvim-nio", + }, + keys = { + { + "<F6>", + function() + require("dapui").toggle() + end, + silent = true, + }, + { + "<Leader>dh", + function() + require("dap.ui.widgets").hover() + end, + silent = true, + }, + { + "<Leader>dp", + function() + require("dap.ui.widgets").preview() + end, + silent = true, + }, + { + "<F9>", + function() + local widgets = require("dap.ui.widgets") + widgets.centered_float(widgets.scopes) + end, + silent = true, + }, + }, + opts = { + icons = { + expanded = "[-]", + collapsed = "[+]", + }, + mappings = { + open = "o", + remove = "d", + edit = "e", + repl = "r", + toggle = "t", + }, + expand_lines = vim.fn.has("nvim-0.7"), + layouts = { + { + elements = { + "repl", + }, + size = 0.3, + position = "bottom", + }, + }, + floating = { + max_height = nil, + max_width = nil, + border = "single", + mappings = { + close = { "q", "<Esc>" }, + }, + }, + windows = { indent = 1 }, + render = { + max_type_length = nil, + }, + }, +} diff --git a/config/nvim/lua/plugins/go.lua b/config/nvim/lua/plugins/go.lua new file mode 100644 index 0000000..1078297 --- /dev/null +++ b/config/nvim/lua/plugins/go.lua @@ -0,0 +1,12 @@ +return { + "ray-x/go.nvim", + dependencies = { + "ray-x/guihua.lua", + "neovim/nvim-lspconfig", + "nvim-treesitter/nvim-treesitter", + }, + config = true, + event = { "CmdlineEnter" }, + ft = { "go", "gomod" }, + build = ':lua require("go.install").update_all_sync()', +} diff --git a/config/nvim/lua/plugins/goimpl.lua b/config/nvim/lua/plugins/goimpl.lua new file mode 100644 index 0000000..0b906fa --- /dev/null +++ b/config/nvim/lua/plugins/goimpl.lua @@ -0,0 +1,21 @@ +return { + "edolphin-ydf/goimpl.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-lua/popup.nvim", + "nvim-telescope/telescope.nvim", + "nvim-treesitter/nvim-treesitter", + }, + config = function() + require("telescope").load_extension("goimpl") + end, + keys = { + { + "<leader>im", + function() + require("telescope").extensions.goimpl.goimpl({}) + end, + desc = "Generate stub for interface on a type for golang", + }, + }, +} diff --git a/config/nvim/lua/plugins/headlines.lua b/config/nvim/lua/plugins/headlines.lua new file mode 100644 index 0000000..5d92245 --- /dev/null +++ b/config/nvim/lua/plugins/headlines.lua @@ -0,0 +1,5 @@ +return { + "lukas-reineke/headlines.nvim", + dependencies = "nvim-treesitter/nvim-treesitter", + config = true, + } diff --git a/config/nvim/lua/plugins/lsp_saga.lua b/config/nvim/lua/plugins/lsp_saga.lua new file mode 100644 index 0000000..ab8177f --- /dev/null +++ b/config/nvim/lua/plugins/lsp_saga.lua @@ -0,0 +1,8 @@ +return { + "nvimdev/lspsaga.nvim", + opts = { + lightbulb = { + enable = false, + }, + }, +} diff --git a/config/nvim/lua/plugins/lsp_signature.lua b/config/nvim/lua/plugins/lsp_signature.lua new file mode 100644 index 0000000..b9add0b --- /dev/null +++ b/config/nvim/lua/plugins/lsp_signature.lua @@ -0,0 +1,15 @@ +return { + "ray-x/lsp_signature.nvim", + event = "VeryLazy", + opts = { + doc_lines = 1, + max_height = 3, + hint_prefix = "", + hint_prefix = { + above = "↙ ", + current = "← ", + below = "↖ ", + }, + floating_window = true, + }, +} diff --git a/config/nvim/lua/plugins/lualine.lua b/config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..920e729 --- /dev/null +++ b/config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,44 @@ +local colors = require("theme.colors") +return { + "nvim-lualine/lualine.nvim", + opts = { + options = { + icons_enabled = true, + theme = "nightfly", + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + }, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch", "diff", "diagnostics" }, + lualine_c = { "filename" }, + lualine_x = { "filetype" }, + lualine_y = { "progress", "location" }, + lualine_z = { "lsp_status", "os.date('%H:%M')" }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { "filename" }, + lualine_x = { "location" }, + lualine_y = {}, + lualine_z = {}, + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {}, + }, +} diff --git a/config/nvim/lua/plugins/resize.lua b/config/nvim/lua/plugins/resize.lua new file mode 100644 index 0000000..7e22517 --- /dev/null +++ b/config/nvim/lua/plugins/resize.lua @@ -0,0 +1,34 @@ +return { + name = "resize", + dir = "~/.config/nvim/lua/myplugins", + keys = { + { + "<C-A-Left>", + function() + require("myplugins.resize").ResizeLeft() + end, + silent = true, + }, + { + "<C-A-Right>", + function() + require("myplugins.resize").ResizeRight() + end, + silent = true, + }, + { + "<C-A-Up>", + function() + require("myplugins.resize").ResizeUp() + end, + silent = true, + }, + { + "<C-A-Down>", + function() + require("myplugins.resize").ResizeDown() + end, + silent = true, + }, + }, +} diff --git a/config/nvim/lua/plugins/telescope.lua b/config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..aabcd9c --- /dev/null +++ b/config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,50 @@ +return { + "nvim-telescope/telescope.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + }, + config = function() + local actions = require("telescope.actions") + require("telescope").setup({ + extensions = { + project = { + sync_with_nvim_tree = true, + }, + }, + pickers = { + buffers = { + initial_mode = "normal", + }, + }, + defaults = { + file_ignore_patterns = { "vendor", "node_modules" }, + mappings = { + i = { + ["<F4>"] = actions.close, + }, + n = { + ["<F4>"] = actions.close, + }, + }, + }, + }) + end, + keys = { + { "<leader>ff", "<cmd>Telescope find_files<CR>", noremap = true, silent = true, desc = "Find files" }, + { "<leader>fg", "<cmd>Telescope live_grep<CR>", noremap = true, silent = true, desc = "Live grep" }, + { + "<leader>fb", + "<cmd>Telescope current_buffer_fuzzy_fund<CR>", + noremap = true, + silent = true, + desc = "Find current file", + }, + { "<F4>", "<cmd>Telescope buffers<CR>", noremap = true, silent = true, desc = "Find buffers" }, + { "<leader>gc", "<cmd>Telescope git_commits<CR>", noremap = true, silent = true }, + { "<leader>gs", "<cmd>Telescope git_status<CR>", noremap = true, silent = true }, + { "<leader>ch", "<cmd>Telescope commands_history<CR>", noremap = true, silent = true }, + { "<leader>e", "<cmd>Telescope diagnostics<CR>", noremap = true, silent = true }, + { "gi", "<cmd>Telescope lsp_implementations<CR>", noremap = true, silent = true }, + { "gr", "<cmd>Telescope lsp_references<CR>", noremap = true, silent = true }, + }, +} diff --git a/config/nvim/lua/plugins/todo.lua b/config/nvim/lua/plugins/todo.lua new file mode 100644 index 0000000..ee672ab --- /dev/null +++ b/config/nvim/lua/plugins/todo.lua @@ -0,0 +1,69 @@ +return { + "phrmendes/todotxt.nvim", + cmd = { "TodoTxt", "DoneTxt" }, + opts = { + todotxt = "/home/neonxp/Документы/todo.txt", + donetxt = "/home/neonxp/Документы/done.txt", + }, + -- suggested keybindings + keys = { + { + "<leader>tp", + function() require("todotxt").cycle_priority() end, + desc = "todo.txt: cycle priority", + ft = "todotxt", + }, + { + "<cr>", + function() require("todotxt").toggle_todo_state() end, + desc = "todo.txt: toggle task state", + ft = "todotxt", + }, + { + "<leader>tn", + function() require("todotxt").capture_todo() end, + desc = "New entry", + }, + { + "<leader>tt", + function() require("todotxt").toggle_todotxt() end, + desc = "Open", + }, + { + "<leader>tr", + function() require("todotxt").move_done_tasks() end, + desc = "Move to done.txt", + ft = "todotxt", + }, + { + "<leader>tss", + function() require("todotxt").sort_tasks() end, + desc = "Sort", + ft = "todotxt", + }, + { + "<leader>tsd", + function() require("todotxt").sort_tasks_by_due_date() end, + desc = "Sort by due:date", + ft = "todotxt", + }, + { + "<leader>tsP", + function() require("todotxt").sort_tasks_by_priority() end, + desc = "Sort by (priority)", + ft = "todotxt", + }, + { + "<leader>tsc", + function() require("todotxt").sort_tasks_by_context() end, + desc = "Sort by @context", + ft = "todotxt", + }, + { + "<leader>tsp", + function() require("todotxt").sort_tasks_by_project() end, + desc = "Sort by +project", + ft = "todotxt", + }, + }, +} diff --git a/config/nvim/lua/plugins/tree.lua b/config/nvim/lua/plugins/tree.lua new file mode 100644 index 0000000..3bf9eed --- /dev/null +++ b/config/nvim/lua/plugins/tree.lua @@ -0,0 +1,54 @@ +local WIDTH_RATIO = 0.25 + +return { + "nvim-tree/nvim-tree.lua", + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + opts = { + disable_netrw = true, + hijack_netrw = true, + sort = { + sorter = "case_sensitive", + }, + view = { + width = function() + return math.floor(vim.opt.columns:get() * WIDTH_RATIO) + end, + adaptive_size = true, + centralize_selection = true, + }, + git = { + enable = true, + }, + renderer = { + group_empty = true, + highlight_git = true, + icons = { + show = { + git = true, + }, + }, + }, + filters = { + dotfiles = false, + }, + update_focused_file = { + enable = true, + }, + }, + keys = { + { + "<C-c>", + function() + local api = require("nvim-tree.api") + local global_cwd = vim.fn.getcwd(-1, -1) + api.tree.change_root(global_cwd) + end, + noremap = true, + silent = true, + desc = "Change tree root to CWD", + }, + { "<F3>", ":NvimTreeToggle<CR>", noremap = true, silent = true, desc = "Toggle file tree" }, + }, +} diff --git a/config/nvim/lua/plugins/treesitter.lua b/config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..59e9294 --- /dev/null +++ b/config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,53 @@ +return { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + opts = { + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + ensure_installed = "all", + ignore_install = { "gdhsader", "phpdoc", "org" }, + indent = { enable = true }, + auto_install = true, + sync_install = true, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "<C-space>", + node_incremental = "<C-space>", + scope_incremental = false, + node_decremental = "<bs>", + }, + }, + textobjects = { + select = { enable = true, lookahead = true }, + move = { + enable = true, + goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer", ["]a"] = "@parameter.inner" }, + goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer", ["]A"] = "@parameter.inner" }, + goto_previous_start = { + ["[f"] = "@function.outer", + ["[c"] = "@class.outer", + ["[a"] = "@parameter.inner", + }, + goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer", ["[A"] = "@parameter.inner" }, + }, + }, + }, + build = function() + require("nvim-treesitter.install").update({ with_sync = true })() + end, + dependencies = { + { "nvim-treesitter/nvim-treesitter-textobjects" }, + { + "nvim-treesitter/nvim-treesitter-context", + opts = { + enable = true, + mode = "topline", + line_numbers = true, + }, + }, + { "windwp/nvim-ts-autotag" }, + }, +} diff --git a/config/nvim/lua/syntax/hjson.lua b/config/nvim/lua/syntax/hjson.lua new file mode 100644 index 0000000..a2e01ed --- /dev/null +++ b/config/nvim/lua/syntax/hjson.lua @@ -0,0 +1,61 @@ +-- ~/.config/nvim/after/syntax/hjson.lua +-- Или путь плагина: ~/.config/nvim/plugin/hjson.lua + +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = "*.hjson", + callback = function() + vim.b.current_syntax = "hjson" + + -- Очистка предыдущих правил + vim.cmd("syntax clear") + + -- Комментарии (высший приоритет) + vim.cmd([[ syntax match hjsonLineComment "\/\/.*" ]]) + vim.cmd([[ syntax match hjsonLineComment "#.*" ]]) + vim.cmd([[ syntax region hjsonComment start="/\*" end="\*/" ]]) + + -- Строки + vim.cmd([[ syntax region hjsonString matchgroup=hjsonQuote start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=hjsonEscape ]]) + vim.cmd([[ syntax region hjsonString matchgroup=hjsonQuote start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=hjsonEscape ]]) + vim.cmd([[ syntax region hjsonMLString matchgroup=hjsonQuote start=/'''/ end=/'''/ ]]) + + -- Числа + vim.cmd([[ syntax match hjsonNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>" ]]) + + -- Булевы значения и null + vim.cmd([[ syntax keyword hjsonBoolean true false ]]) + vim.cmd([[ syntax keyword hjsonNull null ]]) + + -- Ключи объектов + vim.cmd([[ syntax match hjsonKey "[^][{}:,\"'\s]\+" contained ]]) + vim.cmd([[ syntax match hjsonKeyUnquoted "[^][{}:,\"'\s]\+:"he=e-1 contains=hjsonKey,hjsonNoise ]]) + + -- Пунктуация + vim.cmd([[ syntax match hjsonNoise "[{}\[\],:]" ]]) + + -- Escape-последовательности + vim.cmd([[ syntax match hjsonEscape "\\[\\\"'/bfnrt]" contained ]]) + vim.cmd([[ syntax match hjsonEscape "\\u\x\{4}" contained ]]) + + -- Строки без кавычек (низший приоритет) + vim.cmd([[ syntax match hjsonStringUQ "[^][{}:,\"'\s]\+" contains=@NoSpell ]]) + + -- Сворачивание структур + vim.cmd([[ syntax region hjsonObject matchgroup=hjsonBraces start="{" end="}" transparent fold ]]) + vim.cmd([[ syntax region hjsonArray matchgroup=hjsonBraces start="\[" end="\]" transparent fold ]]) + + -- Подсветка + vim.cmd([[ highlight default link hjsonComment Comment ]]) + vim.cmd([[ highlight default link hjsonLineComment Comment ]]) + vim.cmd([[ highlight default link hjsonString String ]]) + vim.cmd([[ highlight default link hjsonMLString String ]]) + vim.cmd([[ highlight default link hjsonStringUQ String ]]) + vim.cmd([[ highlight default link hjsonEscape SpecialChar ]]) + vim.cmd([[ highlight default link hjsonNumber Number ]]) + vim.cmd([[ highlight default link hjsonBoolean Boolean ]]) + vim.cmd([[ highlight default link hjsonNull Constant ]]) + vim.cmd([[ highlight default link hjsonKey Label ]]) + vim.cmd([[ highlight default link hjsonNoise Delimiter ]]) + vim.cmd([[ highlight default link hjsonBraces Delimiter ]]) + end +}) diff --git a/config/nvim/lua/syntax/init.lua b/config/nvim/lua/syntax/init.lua new file mode 100644 index 0000000..d9f4dcb --- /dev/null +++ b/config/nvim/lua/syntax/init.lua @@ -0,0 +1 @@ +require("syntax.hjson") diff --git a/config/nvim/lua/theme/asset/hsv-to-rgb.lua b/config/nvim/lua/theme/asset/hsv-to-rgb.lua new file mode 100644 index 0000000..5a63f98 --- /dev/null +++ b/config/nvim/lua/theme/asset/hsv-to-rgb.lua @@ -0,0 +1,29 @@ +local function HsvToRgb(h, s, v) + + s = s / 100.0 + v = v / 100.0 + h = h / 60.0 + + local i = math.floor(h) % 6 + local f = h - math.floor(h) + local p = v * (1.0 - s) + local q = v * (1.0 - f * s) + local t = v * (1.0 - (1.0 - f) * s) + + local r, g, b = 0, 0, 0 + + if i == 0 then r, g, b = v, t, p + elseif i == 1 then r, g, b = q, v, p + elseif i == 2 then r, g, b = p, v, t + elseif i == 3 then r, g, b = p, q, v + elseif i == 4 then r, g, b = t, p, v + else r, g, b = v, p, q + end + + r = math.floor(r * 255 + 0.5) + g = math.floor(g * 255 + 0.5) + b = math.floor(b * 255 + 0.5) + + return string.format("#%02x%02x%02x", r, g, b) +end +return HsvToRgb diff --git a/config/nvim/lua/theme/colors.lua b/config/nvim/lua/theme/colors.lua new file mode 100644 index 0000000..6197328 --- /dev/null +++ b/config/nvim/lua/theme/colors.lua @@ -0,0 +1,68 @@ +local HsvToRgb = require("theme.asset.hsv-to-rgb") +local colors = { + + black = {HsvToRgb(0, 0, 0), 0},--0 Black + black_l = {HsvToRgb(0, 0, 10), 0}, + black_ll = {HsvToRgb(0, 0, 20), 0}, + + gray_dd = {HsvToRgb(0, 0, 30), 8},--8 DarkGray + gray_d = {HsvToRgb(0, 0, 40), 8}, + gray = {HsvToRgb(0, 0, 50), 7},--7 Gray + gray_l = {HsvToRgb(0, 0, 60), 7}, + gray_ll = {HsvToRgb(0, 0, 70), 7}, + + white_dd = {HsvToRgb(0, 0, 80), 15},--15 White + white_d = {HsvToRgb(0, 0, 90), 15}, + white = {HsvToRgb(0, 0, 100), 15}, + + red_d = {HsvToRgb(0, 100, 75), 12},--12 Red + red = {HsvToRgb(0, 100, 100), 12}, + red_l = {HsvToRgb(0, 75, 100), 12}, + + orange_d = {HsvToRgb(30, 100, 75), 4},--4 DarkRed + orange = {HsvToRgb(30, 100, 100), 4}, + orange_l = {HsvToRgb(30, 75, 100), 4}, + + yellow_d = {HsvToRgb(60, 100, 75), 14},--14 Yellow + yellow = {HsvToRgb(60, 100, 100), 14}, + yellow_l = {HsvToRgb(60, 75, 100), 14}, + + chartreuse_d = {HsvToRgb(90, 100, 75), 6},--6 DarkYellow + chartreuse = {HsvToRgb(90, 100, 100), 6}, + chartreuse_l = {HsvToRgb(90, 75, 100), 6}, + + green_d = {HsvToRgb(120, 100, 75), 10},--10 Green + green = {HsvToRgb(120, 100, 100), 10}, + green_l = {HsvToRgb(120, 75, 100), 10}, + + turquoise_d = {HsvToRgb(150, 100, 75), 2},--2 DarkGreen + turquoise = {HsvToRgb(150, 100, 100), 2}, + turquoise_l = {HsvToRgb(150, 75, 100), 2}, + + cyan_d = {HsvToRgb(180, 100, 75), 11},--11 Cyan + cyan = {HsvToRgb(180, 100, 100), 11}, + cyan_l = {HsvToRgb(180, 75, 100), 11}, + + royal_d = {HsvToRgb(210, 100, 75), 3},--3 DarkCyan + royal = {HsvToRgb(210, 100, 100), 3}, + royal_l = {HsvToRgb(210, 75, 100), 3}, + + blue_d = {HsvToRgb(240, 100, 75), 9},--9 Blue + blue = {HsvToRgb(240, 100, 100), 9}, + blue_l = {HsvToRgb(240, 75, 100), 9}, + + purple_d = {HsvToRgb(270, 100, 75), 1},--1 DarkBlue + purple = {HsvToRgb(270, 100, 100), 1}, + purple_l = {HsvToRgb(270, 75, 100), 1}, + + pink_d = {HsvToRgb(300, 100, 75), 13},--13 Magenta + pink = {HsvToRgb(300, 100, 100), 13}, + pink_l = {HsvToRgb(300, 75, 100), 13}, + + salmon_d = {HsvToRgb(330, 100, 75), 5},--5 DarkMagenta + salmon = {HsvToRgb(330, 100, 100), 5}, + salmon_l = {HsvToRgb(330, 75, 100), 5}, + + none = {"NONE", "NONE"} +} +return colors diff --git a/config/nvim/lua/theme/modifiers.lua b/config/nvim/lua/theme/modifiers.lua new file mode 100644 index 0000000..5f5b853 --- /dev/null +++ b/config/nvim/lua/theme/modifiers.lua @@ -0,0 +1,16 @@ +local mods = { + + bold = {"bold", "bold"}, + italic = {"italic", "italic"}, + underline = {"underline", "underline"}, + underdouble = {"underdouble", "underdouble"}, + underdoted = {"underdoted", "underdoted"}, + underdashed = {"underdashed", "underdashed"}, + undercurl = {"undercurl", "undercurl"}, + reverse = {"reverse", "reverse"}, + standout = {"standout", "standout"}, + altfont = {"altfont", "altfont"}, + strikethrough = {"strikethrough", "strikethrough"}, + none = {"NONE", "NONE"} +} +return mods diff --git a/config/nvim/snippets/go.json b/config/nvim/snippets/go.json new file mode 100644 index 0000000..353f79a --- /dev/null +++ b/config/nvim/snippets/go.json @@ -0,0 +1,28 @@ +{ + "package line": { + "body": ["package ${TM_DIRECTORY/.+\\/(.+)$/${1:/downcase}/}", "", "$0"], + "description": "package header", + "prefix": "pkg" + }, + "structure constructor": { + "body": [ + "// New$1 returns new $1.", + "func New${1:type}(${2}) *$1 {", + "\t$3", + "\treturn &$1{$4}", + "}" + ], + "description": "constructor for structure type", + "prefix": "construct" + }, + "if err := ...; err != nil": { + "prefix": "iferrr", + "body": "if err := ${1}; err != nil {\n\t${2:return ${3:nil, }${4:err}}\n}", + "description": "Snippet for if err := ...; err != nil" + }, + "if err != nil": { + "prefix": "iferr", + "body": "if err != nil {\n\t${1:return ${2:nil, }${3:err}}\n}", + "description": "Snippet for if err != nil" + } +} diff --git a/config/nvim/snippets/package.json b/config/nvim/snippets/package.json new file mode 100644 index 0000000..7c7e94a --- /dev/null +++ b/config/nvim/snippets/package.json @@ -0,0 +1,11 @@ +{ + "name": "gotools", + "contributes": { + "snippets": [ + { + "language": "go", + "path": "./go.json" + } + ] + } +} diff --git a/config/nvim/spell/en.utf-8.add b/config/nvim/spell/en.utf-8.add new file mode 100644 index 0000000..98afcae --- /dev/null +++ b/config/nvim/spell/en.utf-8.add @@ -0,0 +1,2 @@ +блог +блога diff --git a/config/nvim/spell/en.utf-8.add.spl b/config/nvim/spell/en.utf-8.add.spl Binary files differnew file mode 100644 index 0000000..1fe94cc --- /dev/null +++ b/config/nvim/spell/en.utf-8.add.spl diff --git a/config/nvim/spell/ru.cp1251.spl b/config/nvim/spell/ru.cp1251.spl Binary files differnew file mode 100644 index 0000000..5720ab0 --- /dev/null +++ b/config/nvim/spell/ru.cp1251.spl diff --git a/config/nvim/spell/ru.cp1251.sug b/config/nvim/spell/ru.cp1251.sug Binary files differnew file mode 100644 index 0000000..60f8823 --- /dev/null +++ b/config/nvim/spell/ru.cp1251.sug diff --git a/config/nvim/spell/ru.koi8-r.spl b/config/nvim/spell/ru.koi8-r.spl Binary files differnew file mode 100644 index 0000000..e503020 --- /dev/null +++ b/config/nvim/spell/ru.koi8-r.spl diff --git a/config/nvim/spell/ru.koi8-r.sug b/config/nvim/spell/ru.koi8-r.sug Binary files differnew file mode 100644 index 0000000..bdb7abe --- /dev/null +++ b/config/nvim/spell/ru.koi8-r.sug diff --git a/config/nvim/spell/ru.utf-8.spl b/config/nvim/spell/ru.utf-8.spl Binary files differnew file mode 100644 index 0000000..96e7592 --- /dev/null +++ b/config/nvim/spell/ru.utf-8.spl diff --git a/config/nvim/spell/ru.utf-8.sug b/config/nvim/spell/ru.utf-8.sug Binary files differnew file mode 100644 index 0000000..ba5a361 --- /dev/null +++ b/config/nvim/spell/ru.utf-8.sug diff --git a/config/waybar/config.jsonc b/config/waybar/config.jsonc new file mode 100644 index 0000000..66e648d --- /dev/null +++ b/config/waybar/config.jsonc @@ -0,0 +1,203 @@ +// -*- mode: jsonc -*- +{ + // "layer": "top", // Waybar at top layer + // "position": "bottom", // Waybar position (top|bottom|left|right) + "height": 20, // Waybar height (to be removed for auto height) + // "width": 1280, // Waybar width + "spacing": 0, // Gaps between modules (4px) + // Choose the order of the modules + "modules-left": [ + "hyprland/workspaces", + "custom/media" + ], + "modules-center": [ + "hyprland/window" + ], + "modules-right": [ + "mpd", + "idle_inhibitor", + "pulseaudio", + "network", + "power-profiles-daemon", + "cpu", + "memory", + // "temperature", + // "backlight", + "keyboard-state", + "hyprland/language", + "battery", + "battery#bat2", + "clock", + "tray" + ], + // Modules configuration + // "sway/workspaces": { + // "disable-scroll": true, + // "all-outputs": true, + // "warp-on-scroll": false, + // "format": "{name}: {icon}", + // "format-icons": { + // "1": "", + // "2": "", + // "3": "", + // "4": "", + // "5": "", + // "urgent": "", + // "focused": "", + // "default": "" + // } + // }, + "keyboard-state": { + "numlock": true, + "capslock": true, + "format": "{name} {icon}", + "format-icons": { + "locked": "", + "unlocked": "" + } + }, + "hyprland/workspaces": { + "format": "{name}", + "on-click": "activate", + "on-scroll-up": "hyprctl dispatch workspace e+1", + "on-scroll-down": "hyprctl dispatch workspace e-1" + }, + "hyprland/window": { + "separate-outputs": true + }, + "hyprland/language": { + "format": "{short}" + }, + "mpd": { + "format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ {volume}% ", + "format-disconnected": "Disconnected ", + "format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ", + "unknown-tag": "N/A", + "interval": 5, + "consume-icons": { + "on": " " + }, + "random-icons": { + "off": "<span color=\"#f53c3c\"> </span> ", + "on": " " + }, + "repeat-icons": { + "on": " " + }, + "single-icons": { + "on": " 1 " + }, + "state-icons": { + "paused": "", + "playing": "" + }, + "tooltip-format": "MPD (connected)", + "tooltip-format-disconnected": "MPD (disconnected)", + "on-click": "mpc toggle" + }, + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + } + }, + "tray": { + // "icon-size": 21, + "spacing": 10 + }, + "clock": { + // "timezone": "America/New_York", + "tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>", + "format-alt": "{:%Y-%m-%d}" + }, + "cpu": { + "format": "{usage}%", + "tooltip": false + }, + "memory": { + "format": " / {}%" + }, + "temperature": { + // "thermal-zone": 2, + // "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input", + "critical-threshold": 80, + // "format-critical": "{temperatureC}°C {icon}", + "format": "{temperatureC}°C {icon}", + "format-icons": ["", "", ""] + }, + "backlight": { + // "device": "acpi_video1", + "format": "{percent}% {icon}", + "format-icons": ["", "", "", "", "", "", "", "", ""] + }, + "battery": { + "states": { + // "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{capacity}% {icon}", + "format-full": "{capacity}% {icon}", + "format-charging": "{capacity}% ", + "format-plugged": "{capacity}% ", + "format-alt": "{time} {icon}", + // "format-good": "", // An empty format will hide the module + // "format-full": "", + "format-icons": ["", "", "", "", ""] + }, + "battery#bat2": { + "bat": "BAT2" + }, + "power-profiles-daemon": { + "format": "{icon}", + "tooltip-format": "Power profile: {profile}\nDriver: {driver}", + "tooltip": true, + "format-icons": { + "default": "", + "performance": "", + "balanced": "", + "power-saver": "" + } + }, + "network": { + // "interface": "wlp2*", // (Optional) To force the use of this interface + "format-wifi": "{essid} ({signalStrength}%) ", + "format-ethernet": "{ipaddr}/{cidr} ", + "tooltip-format": "{ifname} via {gwaddr} ", + "format-linked": "{ifname} (No IP) ", + "format-disconnected": "Disconnected ⚠", + "format-alt": "{ifname}: {ipaddr}/{cidr}" + }, + "pulseaudio": { + // "scroll-step": 1, // %, can be a float + "format": "{volume}% {icon} {format_source}", + "format-bluetooth": "{volume}% {icon} {format_source}", + "format-bluetooth-muted": " {icon} {format_source}", + "format-muted": " {format_source}", + "format-source": "{volume}% ", + "format-source-muted": "", + "format-icons": { + "headphone": " ", + "hands-free": " ", + "headset": " ", + "phone": " ", + "portable": " ", + "car": " ", + "default": [" ", " ", " "] + }, + "on-click": "pavucontrol" + }, + "custom/media": { + "format": "{icon} {}", + "return-type": "json", + "max-length": 40, + "format-icons": { + "spotify": "", + "default": "🎜" + }, + "escape": true, + "exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder + // "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name + } +} diff --git a/config/waybar/style.css b/config/waybar/style.css new file mode 100644 index 0000000..b13d2dc --- /dev/null +++ b/config/waybar/style.css @@ -0,0 +1,325 @@ +* { + /* `otf-font-awesome` is required to be installed for icons */ + font-family: FontAwesome, Roboto, Helvetica, Arial, sans-serif; + font-size: 13px; +} + +window#waybar { + background-color: rgba(43, 48, 59, 0.5); + border-bottom: 2px solid rgba(51, 204, 256, 238); + color: #ffffff; + transition-property: background-color; + transition-duration: .5s; +} + +window#waybar.hidden { + opacity: 0.2; +} + +/* +window#waybar.empty { + background-color: transparent; +} +window#waybar.solo { + background-color: #FFFFFF; +} +*/ + +window#waybar.termite { + background-color: #3F3F3F; +} + +window#waybar.chromium { + background-color: #000000; + border: none; +} + +button { + /* Use box-shadow instead of border so the text isn't offset */ + box-shadow: inset 0 -3px transparent; + /* Avoid rounded borders under each button name */ + border: none; + border-radius: 0; +} + +/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ +button:hover { + background: inherit; + box-shadow: inset 0 -3px #ffffff; +} + +/* you can set a style on hover for any module like this */ +#pulseaudio:hover { + background-color: #a37800; +} + +#workspaces button { + padding: 0 5px; + background-color: transparent; + color: #ffffff; +} + +#workspaces button:hover { + background: rgba(0, 0, 0, 0.2); +} + +#workspaces button.focused { + background-color: #64727D; + box-shadow: inset 0 -3px #ffffff; +} + +#workspaces button.urgent { + background-color: #eb4d4b; +} + +#mode { + background-color: #64727D; + box-shadow: inset 0 -3px #ffffff; +} + +#clock, +#battery, +#disk, +#temperature, +#backlight, +#network, +#pulseaudio, +#wireplumber, +#custom-media, +#tray, +#mode, +#idle_inhibitor, +#scratchpad, +#power-profiles-daemon, +#mpd { + padding: 0 10px; + color: #ffffff; +} + +#window, +#workspaces { + margin: 0 4px; +} + +/* If workspaces is the leftmost module, omit left margin */ +.modules-left > widget:first-child > #workspaces { + margin-left: 0; +} + +/* If workspaces is the rightmost module, omit right margin */ +.modules-right > widget:last-child > #workspaces { + margin-right: 0; +} + +#clock { + /*background-color: #64727D;*/ +} + +#battery { + /*background-color: #ffffff;*/ + /*color: #000000;*/ +} + +#battery.charging, #battery.plugged { + color: #ffffff; + /*background-color: #26A65B;*/ +} + +@keyframes blink { + to { + background-color: #ffffff; + color: #000000; + } +} + +/* Using steps() instead of linear as a timing function to limit cpu usage */ +#battery.critical:not(.charging) { + background-color: #f53c3c; + color: #ffffff; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: steps(12); + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#power-profiles-daemon { + padding-right: 15px; +} + +#power-profiles-daemon.performance { + /*background-color: #f53c3c;*/ + color: #ffffff; +} + +#power-profiles-daemon.balanced { + /*background-color: #2980b9;*/ + color: #ffffff; +} + +#power-profiles-daemon.power-saver { + /*background-color: #2ecc71;*/ + /*color: #000000;*/ +} + +label:focus { + background-color: #000000; +} + +#cpu { + /*background-color: #2ecc71;*/ + /*color: #000000;*/ +} + +#memory { + /*background-color: #9b59b6;*/ +} + +#disk { + /*background-color: #964B00;*/ +} + +#backlight { + /*background-color: #90b1b1;*/ +} + +#network { + /*background-color: #2980b9;*/ +} + +#network.disconnected { + /*background-color: #f53c3c;*/ +} + +#pulseaudio { + /*background-color: #f1c40f;*/ + /*color: #000000;*/ +} + +#pulseaudio.muted { + /*background-color: #90b1b1;*/ + /*color: #2a5c45;*/ +} + +#wireplumber { + /*background-color: #fff0f5;*/ + /*color: #000000;*/ +} + +#wireplumber.muted { + /*background-color: #f53c3c;*/ +} + +#custom-media { + /*background-color: #66cc99;*/ + /*color: #2a5c45;*/ + min-width: 100px; +} + +#custom-media.custom-spotify { + /*background-color: #66cc99;*/ +} + +#custom-media.custom-vlc { + /*background-color: #ffa000;*/ +} + +#temperature { + /*background-color: #f0932b;*/ +} + +#temperature.critical { + background-color: #eb4d4b; +} + +#tray { + /*background-color: #2980b9;*/ +} + +#tray > .passive { + -gtk-icon-effect: dim; +} + +#tray > .needs-attention { + -gtk-icon-effect: highlight; + background-color: #eb4d4b; +} + +#idle_inhibitor { + /*background-color: #2d3436;*/ +} + +#idle_inhibitor.activated { + /*background-color: #ecf0f1;*/ + color: #cfcfcf; +} + +#mpd { + /*background-color: #66cc99;*/ + /*color: #2a5c45;*/ +} + +#mpd.disconnected { + /*background-color: #f53c3c;*/ +} + +#mpd.stopped { + /*background-color: #90b1b1;*/ +} + +#mpd.paused { + /*background-color: #51a37a;*/ +} + +#language { + /*background: #00b093;*/ + /*color: #740864;*/ + /*padding: 0 5px;*/ + margin: 0 5px; + min-width: 16px; +} + +#keyboard-state { + background: #97e1ad; + color: #000000; + padding: 0 0px; + margin: 0 5px; + min-width: 16px; +} + +#keyboard-state > label { + padding: 0 5px; +} + +#keyboard-state > label.locked { + background: rgba(0, 0, 0, 0.2); +} + +#scratchpad { + background: rgba(0, 0, 0, 0.2); +} + +#scratchpad.empty { + background-color: transparent; +} + +#privacy { + padding: 0; +} + +#privacy-item { + padding: 0 5px; + color: white; +} + +#privacy-item.screenshare { + background-color: #cf5700; +} + +#privacy-item.audio-in { + background-color: #1ca000; +} + +#privacy-item.audio-out { + background-color: #0069d4; +} |
