From 545f8ab328fc6a8cfc91860b293b1d7069e369a2 Mon Sep 17 00:00:00 2001 From: Johannes Knopp Date: Sun, 22 Feb 2026 17:06:22 +0100 Subject: [PATCH] fix nvim config --- roles/hyprland/files/hypr/hyprland.conf | 14 +- roles/hyprland/files/hypr/monitors.conf | 5 +- .../files/hypr/scripts/close-monokai-popup.sh | 30 ++++ roles/nvim/files/lazy-lock.json | 3 +- roles/nvim/files/lua/config/plugins/cmp.lua | 1 + .../nvim/files/lua/config/plugins/lazygit.lua | 2 +- .../lua/config/plugins/lsp/lspconfig.lua | 138 ++++++------------ .../files/lua/config/plugins/lsp/mason.lua | 14 +- .../{todo-comments.lua => todo-comments.lua#} | 0 roles/zsh/files/dev_env.zsh | 8 - 10 files changed, 95 insertions(+), 120 deletions(-) create mode 100755 roles/hyprland/files/hypr/scripts/close-monokai-popup.sh rename roles/nvim/files/lua/config/plugins/{todo-comments.lua => todo-comments.lua#} (100%) delete mode 100644 roles/zsh/files/dev_env.zsh diff --git a/roles/hyprland/files/hypr/hyprland.conf b/roles/hyprland/files/hypr/hyprland.conf index 081b6ca..bfaa647 100644 --- a/roles/hyprland/files/hypr/hyprland.conf +++ b/roles/hyprland/files/hypr/hyprland.conf @@ -15,7 +15,7 @@ source = ./workspaces.conf $terminal = ghostty $fileManager = thunar -$menu = wofi --show drun +$menu = env XDG_CURRENT_DESKTOP=Hyprland wofi --show drun ################# ### AUTOSTART ### @@ -24,12 +24,13 @@ $menu = wofi --show drun # Autostart necessary processes (like notifications daemons, status bars, etc.) # Or execute your favorite apps at launch like this: # exec-once = waybar -exec-once = /usr/lib//hhyprpolkitagent/hyprpolkitagent +exec-once = /usr/lib/hyprpolkitagent/hyprpolkitagent exec-once = hyprpanel exec-once = dunst exec-once = firefox exec-once = hyprpaper exec-once = [workspace 9 silent] deezer-desktop +exec-once = scripts/close-monokai-popup.sh # gnome keyring secret service exec-once = dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE @@ -262,6 +263,12 @@ bind = $mainMod SHIFT, right, movewindow, r bind = $mainMod SHIFT, up, movewindow, u bind = $mainMod SHIFT, down, movewindow, d +# Resize +binde = $mainMod ALT, left, resizeactive, -20 0 +binde = $mainMod ALT, right, resizeactive, 20 0 +binde = $mainMod ALT, up, resizeactive, 0 -20 +binde = $mainMod ALT, down, resizeactive, 0 20 + # Example special workspace (scratchpad) bind = $mainMod, S, togglespecialworkspace, magic bind = $mainMod SHIFT, S, movetoworkspace, special:magic @@ -342,11 +349,10 @@ windowrule { windowrule { name = jetbrains-tab-drag match:class = ^(jetbrains-.*|android-studio)$ - match:title = ^(\s*)$ + match:title = ^(\s*|Delete|Replace All)$ no_initial_focus = 1 stay_focused = 1 float = 1 center = 1 } - diff --git a/roles/hyprland/files/hypr/monitors.conf b/roles/hyprland/files/hypr/monitors.conf index eb09808..88e0b20 100644 --- a/roles/hyprland/files/hypr/monitors.conf +++ b/roles/hyprland/files/hypr/monitors.conf @@ -1,8 +1,7 @@ -# Generated by nwg-displays on 2025-12-26 at 06:40:37. Do not edit manually. +# Generated by nwg-displays on 2026-02-09 at 00:39:06. Do not edit manually. monitor=DP-1,2560x1440@165.0,6626x876,1.0 monitor=DP-2,2560x1440@165.0,4066x876,1.0 +monitor=HDMI-A-1,disable monitor=HDMI-A-2,1920x1080@60.0,9186x396,1.0 monitor=HDMI-A-2,transform,3 -monitor=HDMI-A-1,3840x2160@60.0,226x156,1.0 -monitor=HDMI-A-1,disable diff --git a/roles/hyprland/files/hypr/scripts/close-monokai-popup.sh b/roles/hyprland/files/hypr/scripts/close-monokai-popup.sh new file mode 100755 index 0000000..287206b --- /dev/null +++ b/roles/hyprland/files/hypr/scripts/close-monokai-popup.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +SOCKET="/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" + +handle_line() { + local line="$1" + + # Split into EVENT and DATA (EVENT>>DATA) + local event="${line%%>>*}" + local data="${line#*>>}" + + case "$event" in + openwindow) + # Data format: + # WINDOWADDRESS,WORKSPACENAME,WINDOWCLASS,WINDOWTITLE + local addr ws class title + + IFS=, read -r addr ws class title <<< "$data" + + if [[ "$class" == "jetbrains-webstorm" && "$title" == "Monokai Pro Trial" ]]; then + # closewindow expects address with 0x prefix + hyprctl dispatch closewindow "address:0x$addr" + fi + ;; + esac +} + +socat -U - "UNIX-CONNECT:$SOCKET" | while read -r line; do + handle_line "$line" +done diff --git a/roles/nvim/files/lazy-lock.json b/roles/nvim/files/lazy-lock.json index 34bc1d3..3f343e5 100644 --- a/roles/nvim/files/lazy-lock.json +++ b/roles/nvim/files/lazy-lock.json @@ -12,6 +12,7 @@ "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "flutter-tools.nvim": { "branch": "main", "commit": "293dfc78162ab185bca5f81bb32155dcf45114bf" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" }, "lazygit.nvim": { "branch": "main", "commit": "a04ad0dbc725134edbee3a5eea29290976695357" }, "lspkind.nvim": { "branch": "master", "commit": "3ddd1b4edefa425fda5a9f95a4f25578727c0bb3" }, "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, @@ -19,7 +20,6 @@ "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, "mason.nvim": { "branch": "main", "commit": "4da89f3ab04783da990f9bd40aaa36c22e59375b" }, "monokai-nightasty.nvim": { "branch": "main", "commit": "8be5e1c6e1d59873505e81b161e923264dfa5c1a" }, - "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, "none-ls-extras.nvim": { "branch": "main", "commit": "03955d165621300965a6d685c8f399ec7efd5785" }, "none-ls.nvim": { "branch": "main", "commit": "0b457958cb958c16850b5a1fb38bbcd982909181" }, "nvim-autopairs": { "branch": "master", "commit": "c2a0dd0d931d0fb07665e1fedb1ea688da3b80b4" }, @@ -34,7 +34,6 @@ "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" }, "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, "vim-floaterm": { "branch": "master", "commit": "a11b930f55324e9b05e2ef16511fe713f1b456a7" }, "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } } diff --git a/roles/nvim/files/lua/config/plugins/cmp.lua b/roles/nvim/files/lua/config/plugins/cmp.lua index 3f006bc..0b43492 100644 --- a/roles/nvim/files/lua/config/plugins/cmp.lua +++ b/roles/nvim/files/lua/config/plugins/cmp.lua @@ -39,6 +39,7 @@ return { [''] = cmp.mapping.confirm({ select = true }), }), sources = cmp.config.sources({ + { name = 'lazydev', group_index = 0 }, { name = 'nvim_lsp' }, { name = 'luasnip' }, { name = 'buffer' }, diff --git a/roles/nvim/files/lua/config/plugins/lazygit.lua b/roles/nvim/files/lua/config/plugins/lazygit.lua index 20aa8b0..bf3b556 100644 --- a/roles/nvim/files/lua/config/plugins/lazygit.lua +++ b/roles/nvim/files/lua/config/plugins/lazygit.lua @@ -8,7 +8,7 @@ return { 'LazyGitFilter', 'LazyGitFilterCurrentFile', }, - depedencies = { + dependencies = { 'nvim-lua/plenary.nvim', }, } diff --git a/roles/nvim/files/lua/config/plugins/lsp/lspconfig.lua b/roles/nvim/files/lua/config/plugins/lsp/lspconfig.lua index f04bc14..23a49ab 100644 --- a/roles/nvim/files/lua/config/plugins/lsp/lspconfig.lua +++ b/roles/nvim/files/lua/config/plugins/lsp/lspconfig.lua @@ -5,11 +5,17 @@ return { 'williamboman/mason.nvim', 'hrsh7th/cmp-nvim-lsp', { 'antosha417/nvim-lsp-file-operations', config = true }, - { 'folke/neodev.nvim', opts = {} }, + { + 'folke/lazydev.nvim', + ft = 'lua', + opts = { + library = { + { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, + }, + }, + }, }, config = function() - local lspconfig = vim.lsp - local mason_lspconfig = require('mason-lspconfig') local cmp_nvim_lsp = require('cmp_nvim_lsp') local keymap = vim.keymap local wk = require('which-key') @@ -37,98 +43,40 @@ return { end, }) + -- Apply default capabilities to all servers local capabilities = cmp_nvim_lsp.default_capabilities() - mason_lspconfig.setup_handlers({ - -- default handler for installed servers - function(server_name) - lspconfig.enable(server_name, { - capabilities = capabilities, - }) - end, - -- TODO add lsp configs - ['lua_ls'] = function() - lspconfig.enable('lua_ls', { - capabilities = capabilities, - settings = { - Lua = { - diagnostics = { - globals = { 'vim' }, - }, - completion = { - callSnippet = 'Replace' - }, - } - } - }) - end, - ['emmet_ls'] = function() - -- capabilities.textDocument.completion.completionItem.snippetSupport = true - lspconfig.enable('emmet_ls', { - capabilities = capabilities, - filetypes = { - 'html', - 'css', - 'sass', - 'scss', - 'less', - 'javascript', - 'javascriptreact', - 'typescript', - 'typescriptreact', - 'svelte', - 'vue', - } - }) - end, - ['ts_ls'] = function() - lspconfig.enable('ts_ls', { - capabilities = capabilities, - cmd = { "typescript-language-server", "--stdio" }, - init_options = { - hostInfo = "neovim", - -- preferences = { - -- includePackagesJsonAutoImports = "on", - -- } - } - }) - end, - ['hyprls'] = function () - lspconfig.hyprls.setup({ - capabilities = capabilities, - cmd = { "hyprls" }, - root_dir = function(fname) - return vim.fn.getcwd() - end, - }) - end, - -- ['pyright'] = function() - -- lspconfig['pyright'].setup({ - -- -- cmd = { "pyright-langserver", "--stdio" }, - -- -- filetypes = { "python" }, - -- -- root_dir = function(filename) - -- -- return util.root_pattern(unpack(root_files))(filename) or util.path.dirname(filename) - -- -- end, - -- -- settings = { - -- -- python = { - -- -- analysis = { - -- -- autoSearchPaths = true, - -- -- diagnosticMode = "workspace", - -- -- useLibraryCodeForTypes = true - -- -- } - -- -- } - -- -- } - -- capabilities = capabilities, - -- settings = { - -- python = { - -- analysis = { - -- useLibraryCodeForTypes = true, - -- typeCheckingMode = "basic", - -- -- configPath = vim.fn.expand('./pyrightconfig.json') - -- } - -- } - -- }, - -- }) - -- end, + vim.lsp.config('*', { capabilities = capabilities }) + + -- lua_ls: suppress vim global warnings, improve completion + vim.lsp.config('lua_ls', { + settings = { + Lua = { + diagnostics = { + globals = { 'vim' }, + }, + completion = { + callSnippet = 'Replace', + }, + }, + }, }) - end + + -- ts_ls: explicit host info + vim.lsp.config('ts_ls', { + cmd = { 'typescript-language-server', '--stdio' }, + init_options = { + hostInfo = 'neovim', + }, + }) + + -- hyprls: not managed by mason, enable manually + vim.lsp.config('hyprls', { + cmd = { 'hyprls' }, + filetypes = { 'hyprlang' }, + root_dir = function(fname) + return vim.fn.getcwd() + end, + }) + vim.lsp.enable('hyprls') + end, } diff --git a/roles/nvim/files/lua/config/plugins/lsp/mason.lua b/roles/nvim/files/lua/config/plugins/lsp/mason.lua index 7696e7e..1de62a2 100644 --- a/roles/nvim/files/lua/config/plugins/lsp/mason.lua +++ b/roles/nvim/files/lua/config/plugins/lsp/mason.lua @@ -1,6 +1,6 @@ return { - { 'williamboman/mason.nvim', commit = '4da89f3' }, - { 'williamboman/mason-lspconfig.nvim', commit = '1a31f82' }, + { 'williamboman/mason.nvim' }, + { 'williamboman/mason-lspconfig.nvim' }, { 'WhoIsSethDaniel/mason-tool-installer.nvim' }, config = function() local mason = require('mason') @@ -10,14 +10,14 @@ return { mason.setup({ ui = { icons = { - package_installed = "✓", - package_pending = "➜", - package_uninstalled = "✗", + package_installed = '✓', + package_pending = '➜', + package_uninstalled = '✗', }, }, pip = { upgrade_pip = true, - } + }, }) mason_lspconfig.setup({ @@ -39,7 +39,7 @@ return { -- 'black', -- 'pylint', -- 'eslint_d', - } + }, }) end, } diff --git a/roles/nvim/files/lua/config/plugins/todo-comments.lua b/roles/nvim/files/lua/config/plugins/todo-comments.lua# similarity index 100% rename from roles/nvim/files/lua/config/plugins/todo-comments.lua rename to roles/nvim/files/lua/config/plugins/todo-comments.lua# diff --git a/roles/zsh/files/dev_env.zsh b/roles/zsh/files/dev_env.zsh deleted file mode 100644 index 8228131..0000000 --- a/roles/zsh/files/dev_env.zsh +++ /dev/null @@ -1,8 +0,0 @@ -# export DJANGO_SETTINGS_MODULE=config.settings.dev -export DATABASE_HOST=127.0.0.1 -export DATABASE_NAME=cerenim -export DATABASE_USER=brainhero -export DATABASE_PORT=5432 -export DATABASE_DJANGO_SCHEMA=django -export SECRET_KEY=abasdjkasd -export DATABASE_PASSWORD=abcdefghijk