diff --git a/modules/profiles/webis.nix b/modules/profiles/webis.nix index 6a506a2..a11cc71 100644 --- a/modules/profiles/webis.nix +++ b/modules/profiles/webis.nix @@ -4,16 +4,23 @@ , ... }: -with lib; let cfg = config.my.profiles.webis; + inherit (lib) mkEnableOption mkIf; in { options.my.profiles.webis.enable = mkEnableOption "webis profile"; config = mkIf cfg.enable { - my.programs.ssh.includeSecrets = [ ../../secrets/webis-ssh.age ]; + my.programs = { + ssh.includeSecrets = [ ../../secrets/webis-ssh.age ]; + jetbrains = { + pycharm.enable = true; + pycharm.package = pkgs.jetbrains.pycharm-professional; + }; + }; + age.secrets.webis = { file = ../../secrets/webis.age; name = "webis.ovpn"; @@ -25,9 +32,6 @@ in updateResolvConf = true; }; }; - environment.systemPackages = with pkgs; [ - jetbrains.pycharm-professional - ]; programs.dconf.enable = true; }; } diff --git a/modules/programs/foot.nix b/modules/programs/foot.nix index 3174b88..029dec4 100644 --- a/modules/programs/foot.nix +++ b/modules/programs/foot.nix @@ -12,8 +12,6 @@ in config = mkIf cfg.enable { home-manager.users.moritz = { - # HACK: to make foot server work - systemd.user.services.foot.Service.Environment = lib.mkForce "PATH=/run/current-system/sw/bin/"; programs.foot = { enable = true; settings = { diff --git a/modules/programs/hyprland/_config.nix b/modules/programs/hyprland/_config.nix index 651a896..c2182cd 100644 --- a/modules/programs/hyprland/_config.nix +++ b/modules/programs/hyprland/_config.nix @@ -133,7 +133,7 @@ in windowrulev2 = rounding 0, xwayland:1, floating:1 windowrulev2 = center, class:^(.*jetbrains.*)$, title:^(Confirm Exit|Open Project|win424|win201|splash)$ windowrulev2 = size 640 400, class:^(.*jetbrains.*)$, title:^(splash)$ - ${mkRules ["opaque" "noshadow" "noblur" "noanim" "move cursor 5 5"] ["class:^(.*jetbrains-.*)$"]} + windowrulev2 = nofocus, class:^jetbrains-(?!toolbox), floating:1, title:^win\d+$ # See https://wiki.hyprland.org/Configuring/Keywords/ for more $mainMod = SUPER diff --git a/modules/programs/jetbrains/default.nix b/modules/programs/jetbrains/default.nix new file mode 100644 index 0000000..78034e7 --- /dev/null +++ b/modules/programs/jetbrains/default.nix @@ -0,0 +1,38 @@ +{ config, lib, pkgs, ... }: + +let + inherit (lib) any filterAttrs mapAttrsToList mkEnableOption mkIf mkOption; + + cfg = config.my.programs.jetbrains; + isEnabled = _: value: value.enable; + anyEnabled = any (x: x) (mapAttrsToList isEnabled cfg); +in +{ + options.my.programs.jetbrains = { + pycharm = { + enable = mkEnableOption "pycharm"; + package = mkOption { + default = pkgs.jetbrains.pycharm-community; + }; + }; + idea = { + enable = mkEnableOption "idea"; + package = mkOption { + default = pkgs.jetbrains.idea-community; + }; + }; + }; + + config = mkIf anyEnabled { + home-manager.users.moritz = { + xdg.configFile."ideavim/ideavimrc" = { + source = ./ideavimrc; + }; + home.packages = + let + enabledPackages = filterAttrs isEnabled cfg; + in + mapAttrsToList (_: value: value.package) enabledPackages; + }; + }; +} diff --git a/modules/programs/jetbrains/ideavimrc b/modules/programs/jetbrains/ideavimrc new file mode 100644 index 0000000..0a79200 --- /dev/null +++ b/modules/programs/jetbrains/ideavimrc @@ -0,0 +1,84 @@ +""" Map leader to space --------------------- +let mapleader=" " + +""" Plugins -------------------------------- +set surround +set commentary + +""" Common settings ------------------------- +set showmode +set so=5 +set incsearch +set nu + +""" Which-Key +set which-key +set timeoutlen=5000 + +""" Idea specific settings ------------------ +set ideajoin + +""" Mappings -------------------------------- +"" Quick action +let g:WhichKeyDesc_quick_action = 'q Quick action' +map q (ShowIntentionActions) + +"" Refactor binds +let g:WhichKeyDesc_inline = 'i Inline' +map i (Inline) + +let g:WhichKeyDesc_extract = 'e Extract' +let g:WhichKeyDesc_extract_variable = 'ev Extract variable' +map ev (IntroduceVariable) +let g:WhichKeyDesc_extract_constant = 'ec Extract constant' +map ec (IntroduceConstant) +let g:WhichKeyDesc_extract_field = 'ef Extract field' +map ef (IntroduceField) +let g:WhichKeyDesc_extract_parameter = 'ep Extract parameter' +map ep (IntroduceParameter) + +let g:WhichKeyDesc_rename = 'r Rename' +map r (RenameElement) + +"" Navigation +let g:WhichKeyDesc_prev_buffer = ']b Previous buffer' +map [b (PreviousTab) +let g:WhichKeyDesc_next_buffer = ']b Next buffer' +map ]b (NextTab) + +let g:WhichKeyDesc_prev_error = 'gI Goto Implementation' +map gI (GotoImplementation) + +"" Other +let g:WhichKeyDesc_terminal = 't Terminal' +map t (ActivateTerminalToolWindow) +map (HideActiveWindow) +map = (ReformatCode) + +"" Folding +let g:WhichKeyDesc_folding = 'z Folding' +let g:WhichKeyDesc_folding_toggle = 'za Toggle fold' +map za (ExpandCollapseToggleAction) + +let g:WhichKeyDesc_folding_expand = 'zr Fold less' +map zr (ExpandRegion) +let g:WhichKeyDesc_folding_collapse = 'zR Open all folds' +map zR (ExpandAllRegions) +let g:WhichKeyDesc_folding_collapse = 'zm Fold more' +map zm (CollapseRegion) +let g:WhichKeyDesc_folding_collapse = 'zM Close all folds' +map zM (CollapseAllRegions) + +let g:WhichKeyDesc_folding_collapse_doc = 'zc Collapse doc comments' +map zc (CollapseDocComments) +let g:WhichKeyDesc_folding_expand_doc = 'zC Expand doc comments' +map zC (ExpandDocComments) + +let g:WhichKeyDesc_folding_expand_level_one = 'z1 Expand all to level 1' +map z1 (ExpandAllToLevel1) +let g:WhichKeyDesc_folding_expand_level_two = 'z2 Expand all to level 2' +map z2 (ExpandAllToLevel2) +let g:WhichKeyDesc_folding_expand_level_three = 'z3 Expand all to level 3' +map z3 (ExpandAllToLevel3) +let g:WhichKeyDesc_folding_expand_level_four = 'z4 Expand all to level 4' +map z4 (ExpandAllToLevel4) diff --git a/modules/programs/nvim/default.nix b/modules/programs/nvim/default.nix index 2879ae5..5619db8 100644 --- a/modules/programs/nvim/default.nix +++ b/modules/programs/nvim/default.nix @@ -36,12 +36,13 @@ in nixd nixpkgs-fmt nodePackages.bash-language-server - nodePackages.jsonlint + python3Packages.python-lsp-server + python3Packages.ruff-lsp shellcheck shfmt + stable.yamlfix statix taplo - stable.yamlfix yamllint ]; extraLuaConfig = readFile ./options.lua; diff --git a/modules/programs/nvim/plugins/lua/null-ls-nvim.lua b/modules/programs/nvim/plugins/lua/null-ls-nvim.lua index 3d40357..fe88108 100644 --- a/modules/programs/nvim/plugins/lua/null-ls-nvim.lua +++ b/modules/programs/nvim/plugins/lua/null-ls-nvim.lua @@ -10,7 +10,6 @@ null_ls.setup({ null_ls.builtins.diagnostics.deadnix, null_ls.builtins.diagnostics.dotenv_linter, null_ls.builtins.diagnostics.fish, - null_ls.builtins.diagnostics.jsonlint, null_ls.builtins.diagnostics.shellcheck, null_ls.builtins.diagnostics.statix, null_ls.builtins.diagnostics.trail_space, diff --git a/modules/programs/nvim/plugins/lua/nvim-lspconfig.lua b/modules/programs/nvim/plugins/lua/nvim-lspconfig.lua index 2df09a8..d618a7f 100644 --- a/modules/programs/nvim/plugins/lua/nvim-lspconfig.lua +++ b/modules/programs/nvim/plugins/lua/nvim-lspconfig.lua @@ -23,12 +23,7 @@ local lspconfig = require("lspconfig") local on_attach_def = function(client, bufnr) require("which-key").register({ K = { - function() - local winid = require("ufo").peekFoldedLinesUnderCursor() - if not winid then - vim.lsp.buf.hover() - end - end, + vim.lsp.buf.hover, "Hover", }, [""] = { @@ -102,7 +97,7 @@ local on_attach_def = function(client, bufnr) } local timeout = vim.tbl_contains(slow_lsp_servers, client.name, {}) and 500 or 0 vim.defer_fn(function() - vim.lsp.inlay_hint.enable(bufnr, true) + vim.lsp.inlay_hint.enable(true, { bufnr }) end, timeout) end end