From 47197902c8192e7fe39c34d8bae776a1aac989fd Mon Sep 17 00:00:00 2001 From: js0ny Date: Fri, 21 Mar 2025 00:45:00 +0000 Subject: [PATCH 01/35] Minor fix --- tools/nvim/lua/plugins/appearance.lua | 34 +++++++++++------------ tools/nvim/lua/plugins/init.lua | 2 +- tools/nvim/lua/plugins/mod/toggleterm.lua | 7 ----- 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/tools/nvim/lua/plugins/appearance.lua b/tools/nvim/lua/plugins/appearance.lua index 74b2ee6..d6fcbf4 100644 --- a/tools/nvim/lua/plugins/appearance.lua +++ b/tools/nvim/lua/plugins/appearance.lua @@ -23,8 +23,8 @@ return { }, { "olimorris/onedarkpro.nvim", cmd = "Telescope colorscheme" }, { "rebelot/kanagawa.nvim", cmd = "Telescope colorscheme" }, - -- Highlight objects under the cursor - { "RRethy/vim-illuminate" }, + -- -- Highlight objects under the cursor + -- { "RRethy/vim-illuminate" }, { -- Modern Status Line "nvim-lualine/lualine.nvim", dependencies = { "nvim-tree/nvim-web-devicons" }, @@ -91,19 +91,19 @@ return { opts = {}, dependencies = { "nvim-lua/plenary.nvim" }, }, - { - "folke/noice.nvim", - event = "VeryLazy", - opts = { - -- add any options here - }, - dependencies = { - -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries - "MunifTanjim/nui.nvim", - -- OPTIONAL: - -- `nvim-notify` is only needed, if you want to use the notification view. - -- If not available, we use `mini` as the fallback - "rcarriga/nvim-notify", - }, - }, + -- { + -- "folke/noice.nvim", + -- event = "VeryLazy", + -- opts = { + -- -- add any options here + -- }, + -- dependencies = { + -- -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + -- "MunifTanjim/nui.nvim", + -- -- OPTIONAL: + -- -- `nvim-notify` is only needed, if you want to use the notification view. + -- -- If not available, we use `mini` as the fallback + -- "rcarriga/nvim-notify", + -- }, + -- }, } diff --git a/tools/nvim/lua/plugins/init.lua b/tools/nvim/lua/plugins/init.lua index 1fe560c..4bb32b4 100644 --- a/tools/nvim/lua/plugins/init.lua +++ b/tools/nvim/lua/plugins/init.lua @@ -15,5 +15,5 @@ require("lazy").setup({ -- Configure any other settings here. See the documentation for more details. -- colorscheme that will be used when installing plugins. -- automatically check for plugin updates - checker = { enabled = true }, + checker = { enabled = false }, }) diff --git a/tools/nvim/lua/plugins/mod/toggleterm.lua b/tools/nvim/lua/plugins/mod/toggleterm.lua index 5b61c26..693f563 100644 --- a/tools/nvim/lua/plugins/mod/toggleterm.lua +++ b/tools/nvim/lua/plugins/mod/toggleterm.lua @@ -14,13 +14,6 @@ return { { "!", "ToggleTerm direction=float", desc = "Toggle Terminal" }, { "tf", "ToggleTerm direction=float", desc = "Toggle Terminal" }, { "tt", "ToggleTerm", desc = "Spawn a float terminal" }, - -- TODO: Implement lazygit - -- { - -- "gg", - -- "lua _lazygit_toggle()", - -- -- require("toggleterm.terminal").Terminal:new({ cmd = "lazygit", hidden = true }), - -- desc = "Toggle LazyGit", - -- }, }, event = "ColorScheme", opts = { From 569238e45f241de366cd96aaf46a019facc94073 Mon Sep 17 00:00:00 2001 From: js0ny Date: Fri, 21 Mar 2025 00:46:30 +0000 Subject: [PATCH 02/35] feat(nvim): Change completion source to blink.cmp * fix: Completion does not work under Linux * chore: Load less LSPs * feat: Add selection border for completions --- tools/nvim/lua/plugins/completion.lua | 11 ++-- tools/nvim/lua/plugins/lsp.lua | 5 +- tools/nvim/lua/plugins/mod/blink-cmp.lua | 64 +++++++++++++++++++ tools/nvim/lua/plugins/mod/nvim-cmp.lua | 8 --- tools/nvim/lua/plugins/mod/nvim-lspconfig.lua | 42 ++++++++++++ 5 files changed, 112 insertions(+), 18 deletions(-) create mode 100644 tools/nvim/lua/plugins/mod/blink-cmp.lua create mode 100644 tools/nvim/lua/plugins/mod/nvim-lspconfig.lua diff --git a/tools/nvim/lua/plugins/completion.lua b/tools/nvim/lua/plugins/completion.lua index eae382d..62e9179 100644 --- a/tools/nvim/lua/plugins/completion.lua +++ b/tools/nvim/lua/plugins/completion.lua @@ -1,8 +1,9 @@ return { - { import = "plugins.mod.nvim-cmp" }, - { - "saadparwaiz1/cmp_luasnip", - }, + -- { import = "plugins.mod.nvim-cmp" }, + -- { + -- "saadparwaiz1/cmp_luasnip", + -- }, + { import = "plugins.mod.blink-cmp" }, { "L3MON4D3/LuaSnip", build = "make install_jsregexp", @@ -11,8 +12,6 @@ return { require("luasnip.loaders.from_vscode").lazy_load({ paths = "~/.config/lsp-snippets" }) -- require("luasnip.loaders.from_vscode").lazy_load() end, - -- TODO: Remove this, simply delete this will let nvim-cmp not work - -- dependencies = { "rafamadriz/friendly-snippets" }, }, { "zbirenbaum/copilot-cmp", diff --git a/tools/nvim/lua/plugins/lsp.lua b/tools/nvim/lua/plugins/lsp.lua index 6f280fd..976ea96 100644 --- a/tools/nvim/lua/plugins/lsp.lua +++ b/tools/nvim/lua/plugins/lsp.lua @@ -1,8 +1,5 @@ return { - { - "neovim/nvim-lspconfig", - lazy = false, - }, + { import = "plugins.mod.nvim-lspconfig" }, { import = "plugins.mod.render-markdown" }, -- { import = "plugins.mod.markview" }, { diff --git a/tools/nvim/lua/plugins/mod/blink-cmp.lua b/tools/nvim/lua/plugins/mod/blink-cmp.lua new file mode 100644 index 0000000..a67cf4a --- /dev/null +++ b/tools/nvim/lua/plugins/mod/blink-cmp.lua @@ -0,0 +1,64 @@ +return { + "saghen/blink.cmp", + -- optional: provides snippets for the snippet source + dependencies = { "L3MON4D3/LuaSnip", version = "v2.*" }, + + -- use a release tag to download pre-built binaries + version = "*", + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + keymap = { + preset = "default", + [""] = { + function(cmp) + if cmp.snippet_active() then + return cmp.accept() + else + return cmp.select_and_accept() + end + end, + "snippet_forward", + "fallback", + }, + [""] = { "select_and_accept" }, + [""] = { "hide", "fallback" }, + [""] = { "accept", "fallback" }, + }, + completion = { + menu = { border = "single" }, + documentation = { window = { border = "single" } }, + }, + signature = { window = { border = "single" } }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = "normal", + }, + + snippets = { + preset = "luasnip", + }, + + sources = { + default = { "lazydev", "lsp", "path", "snippets", "buffer" }, + providers = { + lazydev = { + name = "LazyDev", + module = "lazydev.integrations.blink", + score_offset = 100, + }, + }, + }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = "prefer_rust_with_warning" }, + }, + opts_extend = { "sources.default" }, +} diff --git a/tools/nvim/lua/plugins/mod/nvim-cmp.lua b/tools/nvim/lua/plugins/mod/nvim-cmp.lua index 8cabbf5..6c4a0a4 100644 --- a/tools/nvim/lua/plugins/mod/nvim-cmp.lua +++ b/tools/nvim/lua/plugins/mod/nvim-cmp.lua @@ -1,11 +1,3 @@ -local function set_keymaps(keymaps_cmp) - local mappings = {} - for _, map in ipairs(keymaps_cmp) do - mappings[map.keys] = map.cmd - end - return mappings -end - return { "hrsh7th/nvim-cmp", -- lazy = false, diff --git a/tools/nvim/lua/plugins/mod/nvim-lspconfig.lua b/tools/nvim/lua/plugins/mod/nvim-lspconfig.lua new file mode 100644 index 0000000..6671b35 --- /dev/null +++ b/tools/nvim/lua/plugins/mod/nvim-lspconfig.lua @@ -0,0 +1,42 @@ +return { + "neovim/nvim-lspconfig", + dependencies = { "saghen/blink.cmp" }, + + -- example using `opts` for defining servers + opts = { + servers = { + lua_ls = {}, + bashls = {}, + clangd = {}, + eslint = {}, -- JavaScript + gopls = {}, -- Go + jsonls = {}, -- JSON + markdown_oxide = {}, -- Markdown + omnisharp = {}, -- C# & F# + powershell_es = {}, -- PowerShell + pyright = {}, -- Python + taplo = {}, -- TOML + ts_ls = {}, -- TypeScript + vimls = {}, -- vimscript + yamlls = {}, -- YAML + beancount = {}, -- Beancount + }, + }, + config = function(_, opts) + local lspconfig = require("lspconfig") + for server, config in pairs(opts.servers) do + -- passing config.capabilities to blink.cmp merges with the capabilities in your + -- `opts[server].capabilities, if you've defined it + config.capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities) + lspconfig[server].setup(config) + end + end, + + -- example calling setup directly for each LSP + -- config = function() + -- local capabilities = require('blink.cmp').get_lsp_capabilities() + -- local lspconfig = require('lspconfig') + -- + -- lspconfig['lua_ls'].setup({ capabilities = capabilities }) + -- end +} From 61591c48a6e71abd7fa76dd686701fda2298842f Mon Sep 17 00:00:00 2001 From: js0ny Date: Fri, 21 Mar 2025 00:48:37 +0000 Subject: [PATCH 03/35] fix(nvim): Fix multicursor and port to lua --- tools/nvim/lua/plugins/edit.lua | 47 +++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/tools/nvim/lua/plugins/edit.lua b/tools/nvim/lua/plugins/edit.lua index 117587c..6e7e709 100644 --- a/tools/nvim/lua/plugins/edit.lua +++ b/tools/nvim/lua/plugins/edit.lua @@ -13,8 +13,51 @@ return { }, }, { - "js0ny/vim-visual-multi-colemak-hnei", - -- "mg979/vim-visual-multi", + "js0ny/multiple-cursors.nvim", + version = "*", -- Use the latest tagged version + -- opts = , -- This causes the plugin setup function to be called + keys = { + { "", "MultipleCursorsAddDown", mode = { "n", "x" }, desc = "Add cursor and move down" }, + { "", "MultipleCursorsAddUp", mode = { "n", "x" }, desc = "Add cursor and move up" }, + + { "", "MultipleCursorsAddUp", mode = { "n", "i", "x" }, desc = "Add cursor and move up" }, + { "", "MultipleCursorsAddDown", mode = { "n", "i", "x" }, desc = "Add cursor and move down" }, + + { "", "MultipleCursorsMouseAddDelete", mode = { "n", "i" }, desc = "Add or remove cursor" }, + }, + config = function() + local normal_mode_motion = require("multiple-cursors.normal_mode.motion") + local normal_mode_edit = require("multiple-cursors.normal_mode.edit") + + local visual_mode_edit = require("multiple-cursors.visual_mode.edit") + local normal_mode_mode_change = require("multiple-cursors.normal_mode.mode_change") + + local visual_mode_modify_area = require("multiple-cursors.visual_mode.modify_area") + require("multiple-cursors").setup({ + pre_hook = function() + require("nvim-autopairs").disable() + end, + post_hook = function() + require("nvim-autopairs").enable() + end, + custom_key_maps = { + { { "n", "x" }, { "e", "" }, normal_mode_motion.k, "nowrap" }, + { { "n", "x" }, { "n", "" }, normal_mode_motion.j, "nowrap" }, + { { "n", "x" }, { "i", "", "" }, normal_mode_motion.l, "nowrap" }, + { { "n", "x" }, "j", normal_mode_motion.e, "nowrap" }, + { { "n", "x" }, "J", normal_mode_motion.E, "nowrap" }, + { { "n", "x" }, "gj", normal_mode_motion.ge, "nowrap" }, + { { "n", "x" }, "gJ", normal_mode_motion.gE, "nowrap" }, + { "n", "E", normal_mode_edit.J, "nowrap" }, + { "n", "gE", normal_mode_edit.gJ, "nowrap" }, + { "n", { "l", "" }, normal_mode_mode_change.i, "nowrap" }, + { "n", "L", normal_mode_mode_change.I, "nowrap" }, + { "x", "l", visual_mode_modify_area.i, "nowrap" }, + { "x", "E", visual_mode_edit.J, "nowrap" }, + { "x", "gE", visual_mode_edit.gJ, "nowrap" }, + }, + }) + end, }, { import = "plugins.mod.autopairs" }, { From 9aef06aa749026acbfeeece8f5fabc62c029bba2 Mon Sep 17 00:00:00 2001 From: js0ny Date: Fri, 21 Mar 2025 16:07:50 +0000 Subject: [PATCH 04/35] Minor fix --- platforms/linux/hypr/hyprland.conf | 2 +- platforms/linux/kde/kglobalshortcutsrc | 38 ++++++++-------- tools/nvim/lua/plugins/lsp.lua | 39 +++------------- tools/nvim/lua/plugins/mod/blink-cmp.lua | 8 ++++ tools/nvim/lua/plugins/mod/lang-org.lua | 45 +++++++++++++++++++ tools/nvim/lua/plugins/mod/nvim-lspconfig.lua | 1 + 6 files changed, 79 insertions(+), 54 deletions(-) create mode 100644 tools/nvim/lua/plugins/mod/lang-org.lua diff --git a/platforms/linux/hypr/hyprland.conf b/platforms/linux/hypr/hyprland.conf index 8ecf5a9..d01aa2b 100644 --- a/platforms/linux/hypr/hyprland.conf +++ b/platforms/linux/hypr/hyprland.conf @@ -54,7 +54,7 @@ monitor=DP-2,3840x2160@59,0x0,1.666667 # See https://wiki.hyprland.org/Configuring/Keywords/ # Set programs that you use -$terminal = wezterm-gui +$terminal = kitty $fileManager = dolphin $menu = wofi diff --git a/platforms/linux/kde/kglobalshortcutsrc b/platforms/linux/kde/kglobalshortcutsrc index 8cbec13..1ae46b8 100644 --- a/platforms/linux/kde/kglobalshortcutsrc +++ b/platforms/linux/kde/kglobalshortcutsrc @@ -42,15 +42,15 @@ _k_friendly_name=Krusader bring_main_window_to_top=Meta+K,Meta+K,Bring Main Window to Top [ksmserver] -Halt Without Confirmation=none,,Shut Down Without Confirmation +Halt Without Confirmation=none,none,Shut Down Without Confirmation Lock Session=Meta+L\tScreensaver,Meta+L\tScreensaver,Lock Session Log Out=Ctrl+Alt+Del,Ctrl+Alt+Del,Show Logout Screen -Log Out Without Confirmation=none,,Log Out Without Confirmation -LogOut=none,,Log Out -Reboot=none,,Reboot -Reboot Without Confirmation=none,,Reboot Without Confirmation -Shut Down=none,,Shut Down -_k_friendly_name=Session Management +Log Out Without Confirmation=none,none,Log Out Without Confirmation +LogOut=none,none,Log Out +Reboot=none,none,Reboot +Reboot Without Confirmation=none,none,Reboot Without Confirmation +Shut Down=none,none,Shut Down +_k_friendly_name=KWin [kwin] Activate Window Demanding Attention=Meta+Ctrl+A,Meta+Ctrl+A,Activate Window Demanding Attention @@ -248,11 +248,11 @@ view_zoom_out=Meta+-,Meta+-,Zoom Out [mediacontrol] _k_friendly_name=Media Controller -mediavolumedown=none,,Media volume down -mediavolumeup=none,,Media volume up +mediavolumedown=none,none,Media volume down +mediavolumeup=none,none,Media volume up nextmedia=Media Next,Media Next,Media playback next pausemedia=Media Pause,Media Pause,Pause media playback -playmedia=none,,Play media playback +playmedia=none,none,Play media playback playpausemedia=Media Play,Media Play,Play/Pause media playback previousmedia=Media Previous,Media Previous,Media playback previous stopmedia=Media Stop,Media Stop,Stop media playback @@ -277,7 +277,7 @@ powerProfile=Battery\tMeta+B,Battery\tMeta+B,Switch Power Profile _k_friendly_name=plasmashell activate application launcher=Meta\tAlt+F1,Meta\tAlt+F1,Activate Application Launcher activate task manager entry 1=none,Meta+1,Activate Task Manager Entry 1 -activate task manager entry 10=none,,Activate Task Manager Entry 10 +activate task manager entry 10=none,none,Activate Task Manager Entry 10 activate task manager entry 2=none,Meta+2,Activate Task Manager Entry 2 activate task manager entry 3=none,Meta+3,Activate Task Manager Entry 3 activate task manager entry 4=none,Meta+4,Activate Task Manager Entry 4 @@ -287,22 +287,22 @@ activate task manager entry 7=none,Meta+7,Activate Task Manager Entry 7 activate task manager entry 8=none,Meta+8,Activate Task Manager Entry 8 activate task manager entry 9=none,Meta+9,Activate Task Manager Entry 9 activate widget 3=none,none,Activate Application Launcher Widget -clear-history=none,,Clear Clipboard History +clear-history=none,none,Clear Clipboard History clipboard_action=Meta+Ctrl+X,Meta+Ctrl+X,Automatic Action Popup Menu cycle-panels=Meta+Alt+P,Meta+Alt+P,Move keyboard focus between panels -cycleNextAction=none,,Next History Item -cyclePrevAction=none,,Previous History Item +cycleNextAction=none,none,Next History Item +cyclePrevAction=none,none,Previous History Item manage activities=none,Meta+Q,Show Activity Switcher next activity=Meta+A,none,Walk through activities previous activity=Meta+Shift+A,none,Walk through activities (Reverse) -repeat_action=none,,Manually Invoke Action on Current Clipboard +repeat_action=none,none,Manually Invoke Action on Current Clipboard show dashboard=Ctrl+F12,Ctrl+F12,Show Desktop -show-barcode=none,,Show Barcode… +show-barcode=none,none,Show Barcode… show-on-mouse-pos=Meta+V,Meta+V,Show Clipboard Items at Mouse Position stop current activity=Meta+S,Meta+S,Stop Current Activity -switch to next activity=none,,Switch to Next Activity -switch to previous activity=none,,Switch to Previous Activity -toggle do not disturb=none,,Toggle do not disturb +switch to next activity=none,none,Switch to Next Activity +switch to previous activity=none,none,Switch to Previous Activity +toggle do not disturb=none,none,Toggle do not disturb [services][kitty.desktop] _launch=Meta+R diff --git a/tools/nvim/lua/plugins/lsp.lua b/tools/nvim/lua/plugins/lsp.lua index 976ea96..07a23ae 100644 --- a/tools/nvim/lua/plugins/lsp.lua +++ b/tools/nvim/lua/plugins/lsp.lua @@ -41,39 +41,7 @@ return { "NoahTheDuke/vim-just", ft = { "just" }, }, - { - "akinsho/org-bullets.nvim", - ft = { "org" }, - config = function() - require("org-bullets").setup() - end, - }, - { - "nvim-orgmode/orgmode", - ft = { "org" }, - config = function() - -- Setup orgmode - require("orgmode").setup({ - org_agenda_files = "~/OrgFiles/tasks/*", - org_default_notes_file = "~/OrgFiles/tasks/inbox.org", - org_archive_location = "~/OrgFiles/archive/%s_archive::", - org_todo_keywords = { "TODO(t)", "NEXT(n)", "WAIT(w)", "|", "DONE(d)", "CANCELLED(c)" }, - org_hide_leading_stars = true, - org_hide_emphasis_markers = true, - org_log_into_drawer = "LOGBOOK", - org_highlight_latex_and_related = "native", - org_startup_indented = true, - org_deadline_warning_days = 10, - }) - - -- NOTE: If you are using nvim-treesitter with ~ensure_installed = "all"~ option - -- add ~org~ to ignore_install - -- require('nvim-treesitter.configs').setup({ - -- ensure_installed = 'all', - -- ignore_install = { 'org' }, - -- }) - end, - }, + { import = "plugins.mod.lang-org" }, { import = "plugins.mod.trouble-nvim" }, { "nvim-treesitter/nvim-treesitter", @@ -87,10 +55,13 @@ return { "VeryLazy", }, opts = { - ensure_installed = { "markdown", "markdown_inline", "latex", "python" }, + ensure_installed = { "c", "lua", "vim", "vimdoc", "markdown", "markdown_inline" }, highlight = { enable = true }, indent = { enable = true }, }, + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) + end, }, { "folke/lazydev.nvim", diff --git a/tools/nvim/lua/plugins/mod/blink-cmp.lua b/tools/nvim/lua/plugins/mod/blink-cmp.lua index a67cf4a..75fe1d7 100644 --- a/tools/nvim/lua/plugins/mod/blink-cmp.lua +++ b/tools/nvim/lua/plugins/mod/blink-cmp.lua @@ -44,12 +44,20 @@ return { sources = { default = { "lazydev", "lsp", "path", "snippets", "buffer" }, + per_filetype = { + org = { "orgmode" }, + }, providers = { lazydev = { name = "LazyDev", module = "lazydev.integrations.blink", score_offset = 100, }, + orgmode = { + name = "Orgmode", + module = "orgmode.org.autocompletion.blink", + fallbacks = { "buffer" }, + }, }, }, diff --git a/tools/nvim/lua/plugins/mod/lang-org.lua b/tools/nvim/lua/plugins/mod/lang-org.lua new file mode 100644 index 0000000..9cce736 --- /dev/null +++ b/tools/nvim/lua/plugins/mod/lang-org.lua @@ -0,0 +1,45 @@ +return { + "nvim-orgmode/orgmode", + dependencies = { + "nvim-telescope/telescope.nvim", + "nvim-orgmode/telescope-orgmode.nvim", + "nvim-orgmode/org-bullets.nvim", + "Saghen/blink.cmp", + }, + event = "VeryLazy", + config = function() + require("orgmode").setup({ + org_agenda_files = "~/OrgFiles/tasks/*", + org_default_notes_file = "~/OrgFiles/tasks/inbox.org", + org_archive_location = "~/OrgFiles/archive/%s_archive::", + org_todo_keywords = { "TODO(t)", "NEXT(n)", "WAIT(w)", "|", "DONE(d)", "CANCELLED(c)" }, + org_hide_leading_stars = true, + org_hide_emphasis_markers = true, + org_log_into_drawer = "LOGBOOK", + org_highlight_latex_and_related = "native", + org_startup_indented = true, + org_deadline_warning_days = 10, + }) + require("org-bullets").setup() + require("blink.cmp").setup({ + sources = { + per_filetype = { + org = { "orgmode" }, + }, + providers = { + orgmode = { + name = "Orgmode", + module = "orgmode.org.autocompletion.blink", + fallbacks = { "buffer" }, + }, + }, + }, + }) + + require("telescope").setup() + require("telescope").load_extension("orgmode") + vim.keymap.set("n", "r", require("telescope").extensions.orgmode.refile_heading) + vim.keymap.set("n", "fh", require("telescope").extensions.orgmode.search_headings) + vim.keymap.set("n", "li", require("telescope").extensions.orgmode.insert_link) + end, +} diff --git a/tools/nvim/lua/plugins/mod/nvim-lspconfig.lua b/tools/nvim/lua/plugins/mod/nvim-lspconfig.lua index 6671b35..e8dd9b8 100644 --- a/tools/nvim/lua/plugins/mod/nvim-lspconfig.lua +++ b/tools/nvim/lua/plugins/mod/nvim-lspconfig.lua @@ -16,6 +16,7 @@ return { powershell_es = {}, -- PowerShell pyright = {}, -- Python taplo = {}, -- TOML + rust_analyzer = {}, -- Rust ts_ls = {}, -- TypeScript vimls = {}, -- vimscript yamlls = {}, -- YAML From b81700798609718cd8ab7242121a8100d5380f3c Mon Sep 17 00:00:00 2001 From: js0ny Date: Fri, 21 Mar 2025 16:30:47 +0000 Subject: [PATCH 05/35] Add keyd app specific confs --- platforms/linux/etc/keyd/app.conf | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 platforms/linux/etc/keyd/app.conf diff --git a/platforms/linux/etc/keyd/app.conf b/platforms/linux/etc/keyd/app.conf new file mode 100644 index 0000000..71baef2 --- /dev/null +++ b/platforms/linux/etc/keyd/app.conf @@ -0,0 +1,19 @@ +[org-telegram-desktop] + +alt.n = macro(C-tab) +alt.e = C-S-tab + +[wechat] + +alt.n = A-down +alt.e = A-up + +[qq] +alt.n = C-down +alt.e = C-up +alt.h = C-left +alt.i = enter + +[zotero] +alt.n = pagedown +alt.e = pageup From ee793c54aff9aea9ee1b690dd99ec78a87cd181a Mon Sep 17 00:00:00 2001 From: js0ny Date: Sun, 23 Mar 2025 21:02:21 +0000 Subject: [PATCH 06/35] Use `just` to manage specific configs --- .directory | 2 + .gitignore | 4 +- Justfile | 98 +++- platforms/linux/hypr/hyprland.conf | 12 +- platforms/linux/hypr/hyprlock.conf | 69 +++ platforms/linux/kde/elisarc | 5 - platforms/linux/kde/kglobalshortcutsrc | 469 +++++++++--------- .../linux/systemd/user/emacs-daemon.service | 13 + platforms/linux/systemd/user/keyd-app.service | 13 + .../{ => user}/symlink-wayland-socket.service | 0 tools/bash/bashrc | 2 + tools/doom/config.el | 16 +- tools/kitty/kitty.conf | 10 +- tools/nvim/lua/config/servers.lua | 44 +- tools/wezterm/appearance.lua | 2 +- 15 files changed, 471 insertions(+), 288 deletions(-) create mode 100644 .directory create mode 100644 platforms/linux/hypr/hyprlock.conf delete mode 100644 platforms/linux/kde/elisarc create mode 100644 platforms/linux/systemd/user/emacs-daemon.service create mode 100644 platforms/linux/systemd/user/keyd-app.service rename platforms/wsl/systemd/{ => user}/symlink-wayland-socket.service (100%) diff --git a/.directory b/.directory new file mode 100644 index 0000000..5092fe1 --- /dev/null +++ b/.directory @@ -0,0 +1,2 @@ +[Desktop Entry] +Icon=configurator diff --git a/.gitignore b/.gitignore index 0c31ce4..e114c5f 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,6 @@ lazy-lock.json # Emacs *.elc -common/**/*current* \ No newline at end of file +common/**/*current* + +default.target.wants diff --git a/Justfile b/Justfile index 80b773e..b17af47 100644 --- a/Justfile +++ b/Justfile @@ -1,27 +1,56 @@ set shell := ["fish", "-c"] set windows-shell := ["pwsh", "-c"] + +PLATFORM := \ + if os() == "linux" { + if env("WSL_DISTRO_NAME","") != "" { + "wsl" + } else { + "linux" + } + } else if os() == "windows" { + "win" + } else if os() == "macos" { + "mac" + } else { "" } DOTFILES := join(home_directory(), ".dotfiles") XDG_CONFIG_HOME := \ - if env_var("XDG_CONFIG_HOME") != "" {env_var("XDG_CONFIG_HOME")} \ + if env("XDG_CONFIG_HOME") != "" {env("XDG_CONFIG_HOME")} \ else { if os_family() == "windows" { - env_var("APPDATA") + env("APPDATA") } else { join(home_directory(), ".config") } } XDG_DATA_HOME := \ - if env_var("XDG_DATA_HOME") != "" {env_var("XDG_DATA_HOME")} \ + if env("XDG_DATA_HOME") != "" {env("XDG_DATA_HOME")} \ else { if os_family() == "windows" { - env_var("LOCALAPPDATA") + env("LOCALAPPDATA") } else { join(home_directory(), ".local/share") } } +XDG_STATE_HOME := \ + if env("XDG_STATE_HOME") != "" {env("XDG_STATE_HOME")} \ + else { + if os_family() == "windows" { + join(env("LOCALAPPDATA"), "state") + } else { + join(home_directory(), ".local/state") + } + } + +LN := \ + if os_family() == "windows" { # Sudo and coreutils are required + "sudo ln -sf" + } else { + "ln -sf" + } test: echo {{DOTFILES}} @@ -37,18 +66,69 @@ check: @just check_shell format: @just format_shell - - push: git push github master git push codeberg master setup: @just ideavim + @just vivaldi ideavim: - ln -sf {{DOTFILES}}/common/ideavimrc $XDG_CONFIG_HOME/ideavim/ideavimrc - git clone https://github.com/MarcoIeni/intellimacs {{join(home_directory(), ".local/share/intellimacs")}} + ln -sf {{DOTFILES}}/common/ideavimrc {{XDG_CONFIG_HOME}}/ideavim/ideavimrc + git clone https://github.com/MarcoIeni/intellimacs {{join(home_directory(), ".local/share/intellimacs")}} --depth 1 + +vivaldi: + curl https://github.com/SocietasEvanescentes/Vivaldi/files/12446831/Rose.Pine.Dawn.zip > $HOME/Downloads/vivaldi-light.zip # Rose Pine Dawn + curl https://github.com/catppuccin/vivaldi/releases/download/1.0.0-ctpv2/Catppuccin.Mocha.Lavender.zip > $HOME/Downloads/vivaldi-dark.zip # Catppuccino Mocha Lavender + +[linux] +systemd: + ln -sf {{DOTFILES}}/platforms/{{PLATFORM}}/systemd {{XDG_CONFIG_HOME}}/systemd/ + + +uv: + uv init {{XDG_DATA_HOME}}/uvenv + cd {{XDG_DATA_HOME}}/uvenv + uv venv + uv add -r {{DOTFILES}}/bootstrap/components/requirements.txt + +[unix] +vim: + mkdir -p {{XDG_DATA_HOME}}/vim/after + mkdir -p {{XDG_STATE_HOME}}/vim/{backup,swap,undo,view} + mkdir -p {{XDG_CONFIG_HOME}}/vim/ + ln -sf {{DOTFILES}}/common/vimrc {{XDG_CONFIG_HOME}}/vim/vimrc + + +[windows] +vim: + New-Item -ItemType SymbolicLink -Path $HOME/_vimrc -Value {{DOTFILES}}/common/vim.noxdg.vimrc + +yazi: + which yazi || cargo install --locked yazi-fm yazi-cli + -ya pack -a llanosrocas/yaziline + -ya pack -a yazi-rs/plugins:git + -ya pack -a Rolv-Apneseth/starship + +wezterm: + which wezterm + {{LN}} {{DOTFILES}}/tools/wezterm {{XDG_CONFIG_HOME}}/wezterm/wezterm.lua + +neovim: + which nvim + {{LN}} {{DOTFILES}}/tools/nvim {{XDG_CONFIG_HOME}}/nvim + nvim --headless +checkhealth +"w nvim-healthcheck.txt" +qall + + +[linux] +bash: + {{LN}} {{DOTFILES}}/tools/bash {{XDG_CONFIG_HOME}}/bash + sudo cp $DOTFILES/tools/bash/xdg-compat.sh /etc/profile.d/xdg-compat.sh + +[linux] +flatpak: + flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo [private] pull: @@ -73,4 +153,4 @@ format_shell: [private] check_info: shellcheck -x -s sh **/*.sh platforms/mac/yabairc - shellcheck -x -s bash **/*.bash tools/bash/* scripts/*.{sh,zsh,bash} **/*.bashrc \ No newline at end of file + shellcheck -x -s bash **/*.bash tools/bash/* scripts/*.{sh,zsh,bash} **/*.bashrc diff --git a/platforms/linux/hypr/hyprland.conf b/platforms/linux/hypr/hyprland.conf index d01aa2b..6d9a6aa 100644 --- a/platforms/linux/hypr/hyprland.conf +++ b/platforms/linux/hypr/hyprland.conf @@ -147,12 +147,12 @@ decoration { active_opacity = 1.0 inactive_opacity = 1.0 - shadow { - enabled = true - range = 4 - render_power = 3 - color = $base - } + # shadow { + # enabled = true + # range = 4 + # render_power = 3 + # color = $base + # } # https://wiki.hyprland.org/Configuring/Variables/#blur blur { diff --git a/platforms/linux/hypr/hyprlock.conf b/platforms/linux/hypr/hyprlock.conf new file mode 100644 index 0000000..fa7a65e --- /dev/null +++ b/platforms/linux/hypr/hyprlock.conf @@ -0,0 +1,69 @@ +# BACKGROUND +background { + monitor = + path = ~/.config/hypr/walls/1.png + # blur_passes = 0 + # contrast = 1 + # brightness = 1 + # vibrancy = 0.2 + # vibrancy_darkness = 0.2 +} + +# GENERAL +general { + no_fade_in = false + no_fade_out = false + hide_cursor = true + grace = 0 + disable_loading_bar = true + ignore_empty_input = true +} + +# INPUT FIELD +input-field { + monitor = + size = 250, 60 + outline_thickness = 2 + dots_size = 0.2 # Scale of input-field height, 0.2 - 0.8 + dots_spacing = 0.35 # Scale of dots' absolute size, 0.0 - 1.0 + dots_center = true + outer_color = rgba(0, 0, 0, 0) + inner_color = rgba(0, 0, 0, 0.2) + font_color = rgb(205, 214, 244) + fade_on_empty = false + rounding = -1 + placeholder_text = Password + hide_input = false + position = 0, -200 + halign = center + valign = center + check_color = rgb(108, 112, 134) + fail_color = rgb(243, 139, 168) # if authentication failed, changes outer_color and fail message color + fail_text = $ATTEMPTS # can be set to empty + fail_timeout = 2000 # milliseconds before fail_text and fail_color disappears + fail_transition = 300 # transition time in ms between normal outer_color and fail_color +} + +# DATE +label { + monitor = + text = cmd[update:1000] date +"%A, %B %d" + color = rgb(205, 214, 244) + font_size = 22 + font_family = JetBrains Mono + position = 0, 300 + halign = center + valign = center +} + +# TIME +label { + monitor = + text = cmd[update:1000] date +"%-I:%M" + color = rgb(205, 214, 244) + font_size = 95 + font_family = JetBrains Mono Extrabold + position = 0, 200 + halign = center + valign = center +} diff --git a/platforms/linux/kde/elisarc b/platforms/linux/kde/elisarc deleted file mode 100644 index 2995c64..0000000 --- a/platforms/linux/kde/elisarc +++ /dev/null @@ -1,5 +0,0 @@ -[ElisaFileIndexer] -RootPath[$e]=$HOME/Music - -[Views] -InitialFilesViewPath=/mnt/d/Media/Music diff --git a/platforms/linux/kde/kglobalshortcutsrc b/platforms/linux/kde/kglobalshortcutsrc index 1ae46b8..c8bcce4 100644 --- a/platforms/linux/kde/kglobalshortcutsrc +++ b/platforms/linux/kde/kglobalshortcutsrc @@ -1,13 +1,15 @@ [ActivityManager] _k_friendly_name=Activity Manager switch-to-activity-32e1f2d2-08d1-4a8b-886a-0a062f999068=none,none,Switch to activity "Default" +switch-to-activity-e1ebfdac-0f52-47a5-9e7a-d9eb5cc26845=none,none,切换到活动“默认” [KDE Keyboard Layout Switcher] Switch keyboard layout to English (Colemak)=none,none,Switch keyboard layout to English (Colemak) Switch keyboard layout to English (US)=none,none,Switch keyboard layout to English (US) -Switch to Last-Used Keyboard Layout=Meta+Alt+L,Meta+Alt+L,Switch to Last-Used Keyboard Layout -Switch to Next Keyboard Layout=Meta+Alt+K,Meta+Alt+K,Switch to Next Keyboard Layout -_k_friendly_name=Keyboard Layout Switcher +Switch keyboard layout to 英语(美国)=none,none,切换键盘布局为 英语(美国) +Switch to Last-Used Keyboard Layout=Meta+Alt+L,Meta+Alt+L,切换到上次使用过的键盘布局 +Switch to Next Keyboard Layout=Meta+Alt+K,Meta+Alt+K,切换到下一个键盘布局 +_k_friendly_name=键盘布局切换器 [Strawberry] _k_friendly_name=Strawberry @@ -17,54 +19,54 @@ prev_track=none,none,Previous track stop=none,none,Stop [kaccess] -Toggle Screen Reader On and Off=Meta+Alt+S,Meta+Alt+S,Toggle Screen Reader On and Off -_k_friendly_name=Accessibility +Toggle Screen Reader On and Off=Meta+Alt+S,Meta+Alt+S,切换屏幕阅读器开关 +_k_friendly_name=无障碍辅助 [kcm_touchpad] Disable Touchpad=Touchpad Off,Touchpad Off, Enable Touchpad=Touchpad On,Touchpad On, Toggle Touchpad=Touchpad Toggle\tMeta+Ctrl+Zenkaku Hankaku,Touchpad Toggle\tTouchpad Toggle\tMeta+Ctrl+Touchpad Toggle\tMeta+Ctrl+Zenkaku Hankaku, -_k_friendly_name=Touchpad +_k_friendly_name=触摸板 [kmix] -_k_friendly_name=KMix -decrease_microphone_volume=Microphone Volume Down,Microphone Volume Down,Decrease Microphone Volume -decrease_volume=Volume Down,Volume Down,Decrease Volume -decrease_volume_small=Shift+Volume Down,Shift+Volume Down,Decrease Volume by 1% -increase_microphone_volume=Microphone Volume Up,Microphone Volume Up,Increase Microphone Volume -increase_volume=Volume Up,Volume Up,Increase Volume -increase_volume_small=Shift+Volume Up,Shift+Volume Up,Increase Volume by 1% -mic_mute=Microphone Mute\tMeta+Volume Mute,Microphone Mute\tMeta+Volume Mute,Mute Microphone -mute=Volume Mute,Volume Mute,Mute +_k_friendly_name=音量 +decrease_microphone_volume=Microphone Volume Down,Microphone Volume Down,降低麦克风音量 +decrease_volume=Volume Down,Volume Down,降低音量 +decrease_volume_small=Shift+Volume Down,Shift+Volume Down,音量降低 1% +increase_microphone_volume=Microphone Volume Up,Microphone Volume Up,提高麦克风音量 +increase_volume=Volume Up,Volume Up,提高音量 +increase_volume_small=Shift+Volume Up,Shift+Volume Up,音量提高 1% +mic_mute=Microphone Mute\tMeta+Volume Mute,Microphone Mute\tMeta+Volume Mute,麦克风静音 +mute=Volume Mute,Volume Mute,静音 [krusader] _k_friendly_name=Krusader bring_main_window_to_top=Meta+K,Meta+K,Bring Main Window to Top [ksmserver] -Halt Without Confirmation=none,none,Shut Down Without Confirmation +Halt Without Confirmation=none,,关机 (无需确认) Lock Session=Meta+L\tScreensaver,Meta+L\tScreensaver,Lock Session -Log Out=Ctrl+Alt+Del,Ctrl+Alt+Del,Show Logout Screen -Log Out Without Confirmation=none,none,Log Out Without Confirmation -LogOut=none,none,Log Out -Reboot=none,none,Reboot -Reboot Without Confirmation=none,none,Reboot Without Confirmation -Shut Down=none,none,Shut Down -_k_friendly_name=KWin +Log Out=Ctrl+Alt+Del,Ctrl+Alt+Del,显示注销屏幕 +Log Out Without Confirmation=none,,注销 (无需确认) +LogOut=none,,注销 +Reboot=none,,重启 +Reboot Without Confirmation=none,,重启 (无需确认) +Shut Down=none,,关机 +_k_friendly_name=Session Management [kwin] -Activate Window Demanding Attention=Meta+Ctrl+A,Meta+Ctrl+A,Activate Window Demanding Attention -Cycle Overview=none,none,Cycle through Overview and Grid View -Cycle Overview Opposite=none,none,Cycle through Grid View and Overview -Decrease Opacity=none,,Decrease Opacity of Active Window by 5% -Edit Tiles=Meta+T,Meta+T,Toggle Tiles Editor -Expose=Ctrl+F9,Ctrl+F9,Toggle Present Windows (Current desktop) -ExposeAll=Ctrl+F10\tLaunch (C),Ctrl+F10\tLaunch (C),Toggle Present Windows (All desktops) -ExposeClass=Ctrl+F7,Ctrl+F7,Toggle Present Windows (Window class) -ExposeClassCurrentDesktop=none,none,Toggle Present Windows (Window class on current desktop) -Grid View=Meta+G,Meta+G,Toggle Grid View -Increase Opacity=none,,Increase Opacity of Active Window by 5% -Kill Window=Meta+Ctrl+Esc,Meta+Ctrl+Esc,Kill Window +Activate Window Demanding Attention=Meta+Ctrl+A,Meta+Ctrl+A,激活请求注意的窗口 +Cycle Overview=none,none,循环显示桌面概览和网格视图 +Cycle Overview Opposite=none,none,循环显示网格视图和桌面概览 +Decrease Opacity=none,,降低活动窗口不透明度 5% +Edit Tiles=Meta+T,Meta+T,磁贴编辑器开关 +Expose=Ctrl+F9,Ctrl+F9,显示/隐藏窗口平铺 (当前桌面) +ExposeAll=Ctrl+F10\tLaunch (C),Ctrl+F10\tLaunch (C),显示/隐藏窗口平铺 (全部桌面) +ExposeClass=Ctrl+F7,Ctrl+F7,显示/隐藏窗口平铺 (窗口类) +ExposeClassCurrentDesktop=none,none,显示/隐藏窗口平铺 (当前桌面的窗口类) +Grid View=Meta+G,Meta+G,切换网格视图 +Increase Opacity=none,,提高活动窗口不透明度 5% +Kill Window=Meta+Ctrl+Esc,Meta+Ctrl+Esc,强制终止窗口 KrohnkiteBTreeLayout=Meta+X,none,Krohnkite: BTree Layout KrohnkiteColumnsLayout=none,none,Krohnkite: Columns Layout KrohnkiteDecrease=none,none,Krohnkite: Decrease @@ -99,210 +101,210 @@ KrohnkiteTileLayout=none,none,Krohnkite: Tile Layout KrohnkiteToggleFloat=Meta+Shift+F,none,Krohnkite: Toggle Float KrohnkiteTreeColumnLayout=none,none,Krohnkite: Tree Column Layout KrohnkitegrowWidth=Meta+Ctrl+I,none,Krohnkite: Grow Width -Move Tablet to Next Output=none,none,Move the tablet to the next output -MoveMouseToCenter=Meta+F6,Meta+F6,Move Mouse to Centre -MoveMouseToFocus=Meta+F5,Meta+F5,Move Mouse to Focus -MoveZoomDown=none,none,Move Zoomed Area Downwards -MoveZoomLeft=none,none,Move Zoomed Area to Left -MoveZoomRight=none,none,Move Zoomed Area to Right -MoveZoomUp=none,none,Move Zoomed Area Upwards -Overview=Meta+W\tMeta+Tab,Meta+W,Toggle Overview -Setup Window Shortcut=none,,Setup Window Shortcut -Show Desktop=Meta+D,Meta+D,Peek at Desktop -Switch One Desktop Down=Meta+Ctrl+Down,Meta+Ctrl+Down,Switch One Desktop Down -Switch One Desktop Up=Meta+Ctrl+Up,Meta+Ctrl+Up,Switch One Desktop Up -Switch One Desktop to the Left=Meta+Ctrl+Left,Meta+Ctrl+Left,Switch One Desktop to the Left -Switch One Desktop to the Right=Meta+Ctrl+Right,Meta+Ctrl+Right,Switch One Desktop to the Right -Switch Window Down=Meta+Alt+Down,Meta+Alt+Down,Switch to Window Below -Switch Window Left=Meta+Alt+Left,Meta+Alt+Left,Switch to Window to the Left -Switch Window Right=Meta+Alt+Right,Meta+Alt+Right,Switch to Window to the Right -Switch Window Up=Meta+Alt+Up,Meta+Alt+Up,Switch to Window Above -Switch to Desktop 1=Meta+1,Ctrl+F1,Switch to Desktop 1 -Switch to Desktop 10=none,,Switch to Desktop 10 -Switch to Desktop 11=none,,Switch to Desktop 11 -Switch to Desktop 12=none,,Switch to Desktop 12 -Switch to Desktop 13=none,,Switch to Desktop 13 -Switch to Desktop 14=none,,Switch to Desktop 14 -Switch to Desktop 15=none,,Switch to Desktop 15 -Switch to Desktop 16=none,,Switch to Desktop 16 -Switch to Desktop 17=none,,Switch to Desktop 17 -Switch to Desktop 18=none,,Switch to Desktop 18 -Switch to Desktop 19=none,,Switch to Desktop 19 -Switch to Desktop 2=Meta+2,Ctrl+F2,Switch to Desktop 2 -Switch to Desktop 20=none,,Switch to Desktop 20 -Switch to Desktop 3=Meta+3,Ctrl+F3,Switch to Desktop 3 -Switch to Desktop 4=Meta+4,Ctrl+F4,Switch to Desktop 4 -Switch to Desktop 5=Meta+5,,Switch to Desktop 5 -Switch to Desktop 6=Meta+6,,Switch to Desktop 6 -Switch to Desktop 7=Meta+7,,Switch to Desktop 7 -Switch to Desktop 8=Meta+8,,Switch to Desktop 8 -Switch to Desktop 9=Meta+9,,Switch to Desktop 9 -Switch to Next Desktop=none,,Switch to Next Desktop -Switch to Next Screen=none,,Switch to Next Screen -Switch to Previous Desktop=none,,Switch to Previous Desktop -Switch to Previous Screen=none,,Switch to Previous Screen -Switch to Screen 0=none,,Switch to Screen 0 -Switch to Screen 1=none,,Switch to Screen 1 -Switch to Screen 2=none,,Switch to Screen 2 -Switch to Screen 3=none,,Switch to Screen 3 -Switch to Screen 4=none,,Switch to Screen 4 -Switch to Screen 5=none,,Switch to Screen 5 -Switch to Screen 6=none,,Switch to Screen 6 -Switch to Screen 7=none,,Switch to Screen 7 -Switch to Screen Above=none,,Switch to Screen Above -Switch to Screen Below=none,,Switch to Screen Below -Switch to Screen to the Left=none,,Switch to Screen to the Left -Switch to Screen to the Right=none,,Switch to Screen to the Right -Toggle Night Color=none,none,Suspend/Resume Night Light -Toggle Window Raise/Lower=none,,Toggle Window Raise/Lower -Walk Through Windows=Alt+Tab,Alt+Tab,Walk Through Windows -Walk Through Windows (Reverse)=Alt+Shift+Tab,Alt+Shift+Tab,Walk Through Windows (Reverse) -Walk Through Windows Alternative=none,,Walk Through Windows Alternative -Walk Through Windows Alternative (Reverse)=none,,Walk Through Windows Alternative (Reverse) -Walk Through Windows of Current Application=Alt+`,Alt+`,Walk Through Windows of Current Application -Walk Through Windows of Current Application (Reverse)=Alt+~,Alt+~,Walk Through Windows of Current Application (Reverse) -Walk Through Windows of Current Application Alternative=none,,Walk Through Windows of Current Application Alternative -Walk Through Windows of Current Application Alternative (Reverse)=none,,Walk Through Windows of Current Application Alternative (Reverse) -Window Above Other Windows=none,,Keep Window Above Others -Window Below Other Windows=none,,Keep Window Below Others -Window Close=Alt+F4\tMeta+Q,Alt+F4,Close Window -Window Custom Quick Tile Bottom=none,,Custom Quick Tile Window to the Bottom -Window Custom Quick Tile Left=none,,Custom Quick Tile Window to the Left -Window Custom Quick Tile Right=none,,Custom Quick Tile Window to the Right -Window Custom Quick Tile Top=none,,Custom Quick Tile Window to the Top -Window Fullscreen=none,,Make Window Fullscreen -Window Grow Horizontal=none,,Expand Window Horizontally -Window Grow Vertical=none,,Expand Window Vertically -Window Lower=none,,Lower Window -Window Maximize=Meta+PgUp,Meta+PgUp,Maximise Window -Window Maximize Horizontal=none,,Maximise Window Horizontally -Window Maximize Vertical=none,,Maximise Window Vertically -Window Minimize=Meta+PgDown,Meta+PgDown,Minimise Window -Window Move=none,,Move Window -Window Move Center=none,,Move Window to the Centre -Window No Border=none,,Toggle Window Titlebar and Frame -Window On All Desktops=none,,Keep Window on All Desktops -Window One Desktop Down=Meta+Ctrl+Shift+Down,Meta+Ctrl+Shift+Down,Window One Desktop Down -Window One Desktop Up=Meta+Ctrl+Shift+Up,Meta+Ctrl+Shift+Up,Window One Desktop Up -Window One Desktop to the Left=Meta+Ctrl+Shift+Left,Meta+Ctrl+Shift+Left,Window One Desktop to the Left -Window One Desktop to the Right=Meta+Ctrl+Shift+Right,Meta+Ctrl+Shift+Right,Window One Desktop to the Right -Window One Screen Down=none,,Move Window One Screen Down -Window One Screen Up=none,,Move Window One Screen Up -Window One Screen to the Left=none,,Move Window One Screen to the Left -Window One Screen to the Right=none,,Move Window One Screen to the Right -Window Operations Menu=Alt+F3,Alt+F3,Window Operations Menu -Window Pack Down=none,,Move Window Down -Window Pack Left=none,,Move Window Left -Window Pack Right=none,,Move Window Right -Window Pack Up=none,,Move Window Up -Window Quick Tile Bottom=Meta+Down,Meta+Down,Quick Tile Window to the Bottom -Window Quick Tile Bottom Left=none,,Quick Tile Window to the Bottom Left -Window Quick Tile Bottom Right=none,,Quick Tile Window to the Bottom Right -Window Quick Tile Left=Meta+Left,Meta+Left,Quick Tile Window to the Left -Window Quick Tile Right=Meta+Right,Meta+Right,Quick Tile Window to the Right -Window Quick Tile Top=Meta+Up,Meta+Up,Quick Tile Window to the Top -Window Quick Tile Top Left=none,,Quick Tile Window to the Top Left -Window Quick Tile Top Right=none,,Quick Tile Window to the Top Right -Window Raise=none,,Raise Window -Window Resize=none,,Resize Window -Window Shade=none,,Shade Window -Window Shrink Horizontal=none,,Shrink Window Horizontally -Window Shrink Vertical=none,,Shrink Window Vertically -Window to Desktop 1=Meta+!,,Window to Desktop 1 -Window to Desktop 10=none,,Window to Desktop 10 -Window to Desktop 11=none,,Window to Desktop 11 -Window to Desktop 12=none,,Window to Desktop 12 -Window to Desktop 13=none,,Window to Desktop 13 -Window to Desktop 14=none,,Window to Desktop 14 -Window to Desktop 15=none,,Window to Desktop 15 -Window to Desktop 16=none,,Window to Desktop 16 -Window to Desktop 17=none,,Window to Desktop 17 -Window to Desktop 18=none,,Window to Desktop 18 -Window to Desktop 19=none,,Window to Desktop 19 -Window to Desktop 2=Meta+@,,Window to Desktop 2 -Window to Desktop 20=none,,Window to Desktop 20 -Window to Desktop 3=Meta+#,,Window to Desktop 3 -Window to Desktop 4=Meta+$,,Window to Desktop 4 -Window to Desktop 5=Meta+%,,Window to Desktop 5 -Window to Desktop 6=Meta+^,,Window to Desktop 6 -Window to Desktop 7=Meta+&,,Window to Desktop 7 -Window to Desktop 8=Meta+*,,Window to Desktop 8 -Window to Desktop 9=none,,Window to Desktop 9 -Window to Next Desktop=none,,Window to Next Desktop -Window to Next Screen=Meta+Shift+Right,Meta+Shift+Right,Move Window to Next Screen -Window to Previous Desktop=none,,Window to Previous Desktop -Window to Previous Screen=Meta+Shift+Left,Meta+Shift+Left,Move Window to Previous Screen -Window to Screen 0=none,,Move Window to Screen 0 -Window to Screen 1=none,,Move Window to Screen 1 -Window to Screen 2=none,,Move Window to Screen 2 -Window to Screen 3=none,,Move Window to Screen 3 -Window to Screen 4=none,,Move Window to Screen 4 -Window to Screen 5=none,,Move Window to Screen 5 -Window to Screen 6=none,,Move Window to Screen 6 -Window to Screen 7=none,,Move Window to Screen 7 +Move Tablet to Next Output=none,none,移动数位板到下一个输出设备 +MoveMouseToCenter=Meta+F6,Meta+F6,移动鼠标到中央 +MoveMouseToFocus=Meta+F5,Meta+F5,移动鼠标到焦点 +MoveZoomDown=none,none,将缩放区域向下移动 +MoveZoomLeft=none,none,将缩放区域向左移动 +MoveZoomRight=none,none,将缩放区域向右移动 +MoveZoomUp=none,none,将缩放区域向上移动 +Overview=Meta+W\tMeta+Tab,Meta+W,显示/隐藏桌面总览 +Setup Window Shortcut=none,,设置窗口快捷键 +Show Desktop=Meta+D,Meta+D,暂时显示桌面 +Switch One Desktop Down=Meta+Ctrl+Down,Meta+Ctrl+Down,切换到下方桌面 +Switch One Desktop Up=Meta+Ctrl+Up,Meta+Ctrl+Up,切换到上方桌面 +Switch One Desktop to the Left=Meta+Ctrl+Left,Meta+Ctrl+Left,切换到左侧桌面 +Switch One Desktop to the Right=Meta+Ctrl+Right,Meta+Ctrl+Right,切换到右侧桌面 +Switch Window Down=Meta+Alt+Down,Meta+Alt+Down,切换到下面的窗口 +Switch Window Left=Meta+Alt+Left,Meta+Alt+Left,切换到左侧的窗口 +Switch Window Right=Meta+Alt+Right,Meta+Alt+Right,切换到右侧的窗口 +Switch Window Up=Meta+Alt+Up,Meta+Alt+Up,切换到上面的窗口 +Switch to Desktop 1=Meta+1,Ctrl+F1,切换到桌面 1 +Switch to Desktop 10=none,,切换到桌面 10 +Switch to Desktop 11=none,,切换到桌面 11 +Switch to Desktop 12=none,,切换到桌面 12 +Switch to Desktop 13=none,,切换到桌面 13 +Switch to Desktop 14=none,,切换到桌面 14 +Switch to Desktop 15=none,,切换到桌面 15 +Switch to Desktop 16=none,,切换到桌面 16 +Switch to Desktop 17=none,,切换到桌面 17 +Switch to Desktop 18=none,,切换到桌面 18 +Switch to Desktop 19=none,,切换到桌面 19 +Switch to Desktop 2=Meta+2,Ctrl+F2,切换到桌面 2 +Switch to Desktop 20=none,,切换到桌面 20 +Switch to Desktop 3=Meta+3,Ctrl+F3,切换到桌面 3 +Switch to Desktop 4=Meta+4,Ctrl+F4,切换到桌面 4 +Switch to Desktop 5=Meta+5,,切换到桌面 5 +Switch to Desktop 6=Meta+6,,切换到桌面 6 +Switch to Desktop 7=Meta+7,,切换到桌面 7 +Switch to Desktop 8=Meta+8,,切换到桌面 8 +Switch to Desktop 9=Meta+9,,切换到桌面 9 +Switch to Next Desktop=none,,切换到下一桌面 +Switch to Next Screen=none,,切换到下一屏幕 +Switch to Previous Desktop=none,,切换到上一桌面 +Switch to Previous Screen=none,,切换到上一屏幕 +Switch to Screen 0=none,,切换到屏幕 0 +Switch to Screen 1=none,,切换到屏幕 1 +Switch to Screen 2=none,,切换到屏幕 2 +Switch to Screen 3=none,,切换到屏幕 3 +Switch to Screen 4=none,,切换到屏幕 4 +Switch to Screen 5=none,,切换到屏幕 5 +Switch to Screen 6=none,,切换到屏幕 6 +Switch to Screen 7=none,,切换到屏幕 7 +Switch to Screen Above=none,,切换到上方屏幕 +Switch to Screen Below=none,,切换到下方屏幕 +Switch to Screen to the Left=none,,切换到左侧屏幕 +Switch to Screen to the Right=none,,切换到右侧屏幕 +Toggle Night Color=none,none,暂停/继续夜间色温 +Toggle Window Raise/Lower=none,,提升/降低窗口 +Walk Through Windows=Alt+Tab,Alt+Tab,遍历窗口 +Walk Through Windows (Reverse)=Alt+Shift+Tab,Alt+Shift+Tab,遍历窗口 (反向) +Walk Through Windows Alternative=none,,遍历窗口交替 +Walk Through Windows Alternative (Reverse)=none,,遍历窗口交替 (反向) +Walk Through Windows of Current Application=Alt+`,Alt+`,遍历当前应用程序窗口 +Walk Through Windows of Current Application (Reverse)=Alt+~,Alt+~,遍历当前应用程序窗口 (反向) +Walk Through Windows of Current Application Alternative=none,,遍历当前应用程序窗口交替 +Walk Through Windows of Current Application Alternative (Reverse)=none,,遍历当前应用程序窗口交替 (反向) +Window Above Other Windows=none,,窗口置顶 +Window Below Other Windows=none,,窗口置底 +Window Close=Alt+F4\tMeta+Q,Alt+F4,关闭窗口 +Window Custom Quick Tile Bottom=none,,自定义快速铺放窗口到下方 +Window Custom Quick Tile Left=none,,自定义快速铺放窗口到左侧 +Window Custom Quick Tile Right=none,,自定义快速铺放窗口到右侧 +Window Custom Quick Tile Top=none,,自定义快速铺放窗口到上方 +Window Fullscreen=none,,全屏显示窗口 +Window Grow Horizontal=none,,水平扩展窗口 +Window Grow Vertical=none,,垂直扩展窗口 +Window Lower=none,,降低窗口 +Window Maximize=Meta+PgUp,Meta+PgUp,最大化窗口 +Window Maximize Horizontal=none,,水平最大化窗口 +Window Maximize Vertical=none,,垂直最大化窗口 +Window Minimize=Meta+PgDown,Meta+PgDown,最小化窗口 +Window Move=none,,移动窗口 +Window Move Center=none,,移动窗口到中央 +Window No Border=none,,显示/隐藏窗口标题栏和框架 +Window On All Desktops=none,,在所有桌面上显示窗口 +Window One Desktop Down=Meta+Ctrl+Shift+Down,Meta+Ctrl+Shift+Down,窗口下移一个桌面 +Window One Desktop Up=Meta+Ctrl+Shift+Up,Meta+Ctrl+Shift+Up,窗口上移一个桌面 +Window One Desktop to the Left=Meta+Ctrl+Shift+Left,Meta+Ctrl+Shift+Left,窗口左移一个桌面 +Window One Desktop to the Right=Meta+Ctrl+Shift+Right,Meta+Ctrl+Shift+Right,窗口右移一个桌面 +Window One Screen Down=none,,移动窗口到下方屏幕 +Window One Screen Up=none,,移动窗口到上方屏幕 +Window One Screen to the Left=none,,移动窗口到左侧屏幕 +Window One Screen to the Right=none,,移动窗口到右侧屏幕 +Window Operations Menu=Alt+F3,Alt+F3,窗口操作菜单 +Window Pack Down=none,,下移窗口 +Window Pack Left=none,,左移窗口 +Window Pack Right=none,,右移窗口 +Window Pack Up=none,,上移窗口 +Window Quick Tile Bottom=Meta+Down,Meta+Down,快速铺放窗口到下方 +Window Quick Tile Bottom Left=none,,快速铺放窗口到左下方 +Window Quick Tile Bottom Right=none,,快速铺放窗口到右下方 +Window Quick Tile Left=Meta+Left,Meta+Left,快速铺放窗口到左侧 +Window Quick Tile Right=Meta+Right,Meta+Right,快速铺放窗口到右侧 +Window Quick Tile Top=Meta+Up,Meta+Up,快速铺放窗口到上方 +Window Quick Tile Top Left=none,,快速铺放窗口到左上方 +Window Quick Tile Top Right=none,,快速铺放窗口到右上方 +Window Raise=none,,提升窗口 +Window Resize=none,,调整窗口大小 +Window Shade=none,,折叠窗口 +Window Shrink Horizontal=none,,水平缩小窗口 +Window Shrink Vertical=none,,垂直缩小窗口 +Window to Desktop 1=Meta+!,,窗口移动到桌面 1 +Window to Desktop 10=none,,窗口移动到桌面 10 +Window to Desktop 11=none,,窗口移动到桌面 11 +Window to Desktop 12=none,,窗口移动到桌面 12 +Window to Desktop 13=none,,窗口移动到桌面 13 +Window to Desktop 14=none,,窗口移动到桌面 14 +Window to Desktop 15=none,,窗口移动到桌面 15 +Window to Desktop 16=none,,窗口移动到桌面 16 +Window to Desktop 17=none,,窗口移动到桌面 17 +Window to Desktop 18=none,,窗口移动到桌面 18 +Window to Desktop 19=none,,窗口移动到桌面 19 +Window to Desktop 2=Meta+@,,窗口移动到桌面 2 +Window to Desktop 20=none,,窗口移动到桌面 20 +Window to Desktop 3=Meta+#,,窗口移动到桌面 3 +Window to Desktop 4=Meta+$,,窗口移动到桌面 4 +Window to Desktop 5=Meta+%,,窗口移动到桌面 5 +Window to Desktop 6=Meta+^,,窗口移动到桌面 6 +Window to Desktop 7=Meta+&,,窗口移动到桌面 7 +Window to Desktop 8=Meta+*,,窗口移动到桌面 8 +Window to Desktop 9=none,,窗口移动到桌面 9 +Window to Next Desktop=none,,窗口移动到下一桌面 +Window to Next Screen=Meta+Shift+Right,Meta+Shift+Right,移动窗口到下一屏幕 +Window to Previous Desktop=none,,窗口移动到上一桌面 +Window to Previous Screen=Meta+Shift+Left,Meta+Shift+Left,移动窗口到上一屏幕 +Window to Screen 0=none,,移动窗口到屏幕 0 +Window to Screen 1=none,,移动窗口到屏幕 1 +Window to Screen 2=none,,移动窗口到屏幕 2 +Window to Screen 3=none,,移动窗口到屏幕 3 +Window to Screen 4=none,,移动窗口到屏幕 4 +Window to Screen 5=none,,移动窗口到屏幕 5 +Window to Screen 6=none,,移动窗口到屏幕 6 +Window to Screen 7=none,,移动窗口到屏幕 7 _k_friendly_name=KWin -disableInputCapture=Meta+Shift+Esc,Meta+Shift+Esc,Disable Active Input Capture -view_actual_size=Meta+0,Meta+0,Zoom to Actual Size -view_zoom_in=Meta++\tMeta+=,Meta++\tMeta+=,Zoom In -view_zoom_out=Meta+-,Meta+-,Zoom Out +disableInputCapture=Meta+Shift+Esc,Meta+Shift+Esc,禁用活动输入捕获 +view_actual_size=Meta+0,Meta+0,缩放为实际大小(A) +view_zoom_in=Meta++\tMeta+=,Meta++\tMeta+=,放大(I) +view_zoom_out=Meta+-,Meta+-,缩小(O) [mediacontrol] -_k_friendly_name=Media Controller -mediavolumedown=none,none,Media volume down -mediavolumeup=none,none,Media volume up -nextmedia=Media Next,Media Next,Media playback next -pausemedia=Media Pause,Media Pause,Pause media playback -playmedia=none,none,Play media playback -playpausemedia=Media Play,Media Play,Play/Pause media playback -previousmedia=Media Previous,Media Previous,Media playback previous -stopmedia=Media Stop,Media Stop,Stop media playback +_k_friendly_name=媒体控制器 +mediavolumedown=none,,媒体音量降低 +mediavolumeup=none,,媒体音量提高 +nextmedia=Media Next,Media Next,播放下一首媒体 +pausemedia=Media Pause,Media Pause,暂停媒体播放 +playmedia=none,,播放媒体 +playpausemedia=Media Play,Media Play,播放/暂停媒体播放 +previousmedia=Media Previous,Media Previous,播放上一首媒体 +stopmedia=Media Stop,Media Stop,停止媒体播放 [org_kde_powerdevil] -Decrease Keyboard Brightness=Keyboard Brightness Down,Keyboard Brightness Down,Decrease Keyboard Brightness -Decrease Screen Brightness=Monitor Brightness Down,Monitor Brightness Down,Decrease Screen Brightness -Decrease Screen Brightness Small=Shift+Monitor Brightness Down,Shift+Monitor Brightness Down,Decrease Screen Brightness by 1% -Hibernate=Hibernate,Hibernate,Hibernate -Increase Keyboard Brightness=Keyboard Brightness Up,Keyboard Brightness Up,Increase Keyboard Brightness -Increase Screen Brightness=Monitor Brightness Up,Monitor Brightness Up,Increase Screen Brightness -Increase Screen Brightness Small=Shift+Monitor Brightness Up,Shift+Monitor Brightness Up,Increase Screen Brightness by 1% -PowerDown=Power Down,Power Down,Power Down -PowerOff=Power Off,Power Off,Power Off -Sleep=Sleep,Sleep,Suspend -Toggle Keyboard Backlight=Keyboard Light On/Off,Keyboard Light On/Off,Toggle Keyboard Backlight -Turn Off Screen=none,none,Turn Off Screen -_k_friendly_name=Power Management -powerProfile=Battery\tMeta+B,Battery\tMeta+B,Switch Power Profile +Decrease Keyboard Brightness=Keyboard Brightness Down,Keyboard Brightness Down,降低键盘亮度 +Decrease Screen Brightness=Monitor Brightness Down,Monitor Brightness Down,降低屏幕亮度 +Decrease Screen Brightness Small=Shift+Monitor Brightness Down,Shift+Monitor Brightness Down,降低屏幕亮度 1% +Hibernate=Hibernate,Hibernate,休眠 +Increase Keyboard Brightness=Keyboard Brightness Up,Keyboard Brightness Up,提高键盘亮度 +Increase Screen Brightness=Monitor Brightness Up,Monitor Brightness Up,提高屏幕亮度 +Increase Screen Brightness Small=Shift+Monitor Brightness Up,Shift+Monitor Brightness Up,提高屏幕亮度 1% +PowerDown=Power Down,Power Down,断电 +PowerOff=Power Off,Power Off,关机 +Sleep=Sleep,Sleep,挂起 +Toggle Keyboard Backlight=Keyboard Light On/Off,Keyboard Light On/Off,开关键盘背光 +Turn Off Screen=none,none,关闭屏幕 +_k_friendly_name=电源管理 +powerProfile=Battery\tMeta+B,Battery\tMeta+B,切换电源管理方案 [plasmashell] _k_friendly_name=plasmashell -activate application launcher=Meta\tAlt+F1,Meta\tAlt+F1,Activate Application Launcher -activate task manager entry 1=none,Meta+1,Activate Task Manager Entry 1 -activate task manager entry 10=none,none,Activate Task Manager Entry 10 -activate task manager entry 2=none,Meta+2,Activate Task Manager Entry 2 -activate task manager entry 3=none,Meta+3,Activate Task Manager Entry 3 -activate task manager entry 4=none,Meta+4,Activate Task Manager Entry 4 -activate task manager entry 5=none,Meta+5,Activate Task Manager Entry 5 -activate task manager entry 6=none,Meta+6,Activate Task Manager Entry 6 -activate task manager entry 7=none,Meta+7,Activate Task Manager Entry 7 -activate task manager entry 8=none,Meta+8,Activate Task Manager Entry 8 -activate task manager entry 9=none,Meta+9,Activate Task Manager Entry 9 +activate application launcher=Meta\tAlt+F1,Meta\tAlt+F1,激活应用程序启动器 +activate task manager entry 1=none,Meta+1,激活任务管理器条目 1 +activate task manager entry 10=none,,激活任务管理器条目 10 +activate task manager entry 2=none,Meta+2,激活任务管理器条目 2 +activate task manager entry 3=none,Meta+3,激活任务管理器条目 3 +activate task manager entry 4=none,Meta+4,激活任务管理器条目 4 +activate task manager entry 5=none,Meta+5,激活任务管理器条目 5 +activate task manager entry 6=none,Meta+6,激活任务管理器条目 6 +activate task manager entry 7=none,Meta+7,激活任务管理器条目 7 +activate task manager entry 8=none,Meta+8,激活任务管理器条目 8 +activate task manager entry 9=none,Meta+9,激活任务管理器条目 9 activate widget 3=none,none,Activate Application Launcher Widget -clear-history=none,none,Clear Clipboard History -clipboard_action=Meta+Ctrl+X,Meta+Ctrl+X,Automatic Action Popup Menu -cycle-panels=Meta+Alt+P,Meta+Alt+P,Move keyboard focus between panels -cycleNextAction=none,none,Next History Item -cyclePrevAction=none,none,Previous History Item -manage activities=none,Meta+Q,Show Activity Switcher -next activity=Meta+A,none,Walk through activities -previous activity=Meta+Shift+A,none,Walk through activities (Reverse) -repeat_action=none,none,Manually Invoke Action on Current Clipboard -show dashboard=Ctrl+F12,Ctrl+F12,Show Desktop -show-barcode=none,none,Show Barcode… -show-on-mouse-pos=Meta+V,Meta+V,Show Clipboard Items at Mouse Position -stop current activity=Meta+S,Meta+S,Stop Current Activity -switch to next activity=none,none,Switch to Next Activity -switch to previous activity=none,none,Switch to Previous Activity -toggle do not disturb=none,none,Toggle do not disturb +clear-history=none,,清除剪贴板历史(L) +clipboard_action=Meta+Ctrl+X,Meta+Ctrl+X,自动弹出操作菜单 +cycle-panels=Meta+Alt+P,Meta+Alt+P,在面板之间移动键盘焦点 +cycleNextAction=none,,下一条历史记录 +cyclePrevAction=none,,上一条历史记录 +manage activities=none,Meta+Q,显示活动切换器 +next activity=Meta+A,none,遍历活动 +previous activity=Meta+Shift+A,none,遍历活动 (反向) +repeat_action=none,,在当前剪贴板上手动执行操作 +show dashboard=Ctrl+F12,Ctrl+F12,显示桌面 +show-barcode=none,,显示条形码(S)… +show-on-mouse-pos=Meta+V,Meta+V,在鼠标位置显示剪贴板项目 +stop current activity=Meta+S,Meta+S,停止当前活动 +switch to next activity=none,,切换到下一个活动 +switch to previous activity=none,,切换到上一个活动 +toggle do not disturb=none,,切换勿扰模式 [services][kitty.desktop] _launch=Meta+R @@ -314,8 +316,7 @@ _launch=Meta+F _launch=none [services][org.kde.krunner.desktop] -RunClipboard=Alt+Shift+F2\tAlt+Space -_launch=Alt+F2\tSearch +_launch=Alt+F2\tSearch\tAlt+Space [services][org.kde.kscreen.desktop] ShowOSD=Display @@ -336,5 +337,5 @@ Toggle touch tool=Meta+Ctrl+T,Meta+Ctrl+T,Enable/Disable the Touch Tool _k_friendly_name=Wacom Tablet [yakuake] -_k_friendly_name=Yakuake -toggle-window-state=Meta+`,F12,Open/Retract Yakuake +_k_friendly_name=Yakuake 下拉式终端 +toggle-window-state=Meta+`,F12,展开/折叠 Yakuake 窗口 diff --git a/platforms/linux/systemd/user/emacs-daemon.service b/platforms/linux/systemd/user/emacs-daemon.service new file mode 100644 index 0000000..c9bdc3f --- /dev/null +++ b/platforms/linux/systemd/user/emacs-daemon.service @@ -0,0 +1,13 @@ +[Unit] +Description=Emacs text editor +Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/ + +[Service] +Type=forking +ExecStart=/usr/bin/emacs --daemon +ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)" +Environment=SSH_AUTH_SOCK=%t/keyring/ssh +Restart=on-failure + +[Install] +WantedBy=default.target diff --git a/platforms/linux/systemd/user/keyd-app.service b/platforms/linux/systemd/user/keyd-app.service new file mode 100644 index 0000000..f20c7c0 --- /dev/null +++ b/platforms/linux/systemd/user/keyd-app.service @@ -0,0 +1,13 @@ +[Unit] +Description=Keyd Application Specific Mapping +Documentation=man:keyd-application-mapper(1) https://github.com/rvaiya/keyd + +[Service] +Type=forking +ExecStart=/usr/bin/keyd-application-mapper -d +ExecStop=pkill keyd-applicatio +Restart=on-failure + +[Install] +WantedBy=default.target + diff --git a/platforms/wsl/systemd/symlink-wayland-socket.service b/platforms/wsl/systemd/user/symlink-wayland-socket.service similarity index 100% rename from platforms/wsl/systemd/symlink-wayland-socket.service rename to platforms/wsl/systemd/user/symlink-wayland-socket.service diff --git a/tools/bash/bashrc b/tools/bash/bashrc index 4f79d68..8ec8bbd 100644 --- a/tools/bash/bashrc +++ b/tools/bash/bashrc @@ -5,6 +5,8 @@ # ln -sf $DOTFILES/tools/bash/bashrc ~/.bashrc export DOTFILES=$HOME/.dotfiles +# Force to choose English font name +export LC_CTYPE=en_GB.UTF-8 if [ -n "$WSL_DISTRO_NAME" ]; then alias clip="clip.exe" diff --git a/tools/doom/config.el b/tools/doom/config.el index f6d71f8..8bf26d8 100644 --- a/tools/doom/config.el +++ b/tools/doom/config.el @@ -22,20 +22,20 @@ ;; accept. For example: ;; ;; https://emacs-china.org/t/doom-emacs/23513/13 -(setq doom-font (font-spec :family "Iosevka Nerd Font Propo" :size 14) +(setq doom-font (font-spec :family "Sarasa Mono SC Nerd Font" :size 14) doom-serif-font doom-font - doom-symbol-font (font-spec :family "LXGW WenKai Mono") - doom-variable-pitch-font (font-spec :family "LXGW WenKai Mono" :weight 'extra-bold)) + doom-symbol-font (font-spec :family "Sarasa Mono SC Nerd Font") + doom-variable-pitch-font (font-spec :family "Sarasa Mono SC Nerd Font" :weight 'extra-bold)) ;; 如果不把这玩意设置为 nil, 会默认去用 fontset-default 来展示, 配置无效 (setq use-default-font-for-symbols nil) ;; Doom 的字体加载顺序问题, 如果不设定这个 hook, 配置会被覆盖失效 -(add-hook! 'after-setting-font-hook - (set-fontset-font t 'latin (font-spec :family "Iosevka Nerd Font Propo")) - (set-fontset-font t 'symbol (font-spec :family "Symbola")) - (set-fontset-font t 'mathematical (font-spec :family "Symbola")) - (set-fontset-font t 'emoji (font-spec :family "Symbola"))) +;;(add-hook! 'after-setting-font-hook +;; (set-fontset-font t 'latin (font-spec :family "Iosevka Nerd Font Propo")) +;; (set-fontset-font t 'symbol (font-spec :family "Symbola")) +;; (set-fontset-font t 'mathematical (font-spec :family "Symbola")) +;; (set-fontset-font t 'emoji (font-spec :family "Symbola"))) ;; (dolist (charset '(kana han cjk-misc bopomofo)) ;; (set-fontset-font t charset (font-spec :family "LXGW WenKai Mono" :size 16))) diff --git a/tools/kitty/kitty.conf b/tools/kitty/kitty.conf index 4acdec9..e7b86d0 100644 --- a/tools/kitty/kitty.conf +++ b/tools/kitty/kitty.conf @@ -3,7 +3,7 @@ # Fonts {{{ # Family -font_family family="Iosevka Nerd Font" +font_family family="Sarasa Term SC Nerd Font" bold_font auto italic_font auto bold_italic_font auto @@ -77,3 +77,11 @@ map ctrl+q>shift+I kitten window.py -resize right map cmd+enter toggle_layout stack map ctrl+shift+enter toggle_layout stack # }}} + + +# BEGIN_KITTY_FONTS +font_family family="Sarasa Term SC Nerd Font" +bold_font auto +italic_font auto +bold_italic_font auto +# END_KITTY_FONTS diff --git a/tools/nvim/lua/config/servers.lua b/tools/nvim/lua/config/servers.lua index 3508981..a45c8c1 100644 --- a/tools/nvim/lua/config/servers.lua +++ b/tools/nvim/lua/config/servers.lua @@ -6,30 +6,28 @@ local M = {} -- Use :Mason to list all available servers M.servers = { "ast_grep", - "bashls", -- Bash - "clangd", -- C/C++ - "cssls", -- CSS - "denols", -- Deno - -- "cmake", -- CMake - "eslint", -- JavaScript - "gopls", -- Go - "hls", -- Haskell - "html", -- HTML - "jsonls", -- JSON - "lua_ls", -- Lua + "bashls", -- Bash + "clangd", -- C/C++ + "cssls", -- CSS + "denols", -- Deno + "eslint", -- JavaScript + "gopls", -- Go + "html", -- HTML + "jsonls", -- JSON + "lua_ls", -- Lua "markdown_oxide", -- Markdown - "omnisharp", -- C# & F# - "powershell_es", -- PowerShell - "pyright", -- Python - "rust_analyzer", -- Rust - "svelte", -- Svelte - "svlangserver", -- SystemVerilog - "tailwindcss", -- TailwindCSS - "taplo", -- TOML - "ts_ls", -- TypeScript - "vimls", -- vimscript - "yamlls", -- YAML - "beancount", -- Beancount + "omnisharp", -- C# & F# + "powershell_es", -- PowerShell + "pyright", -- Python + "rust_analyzer", -- Rust + "svelte", -- Svelte + "svlangserver", -- SystemVerilog + "tailwindcss", -- TailwindCSS + "taplo", -- TOML + "ts_ls", -- TypeScript + "vimls", -- vimscript + "yamlls", -- YAML + "beancount", -- Beancount } -- Configuration for each server defines here diff --git a/tools/wezterm/appearance.lua b/tools/wezterm/appearance.lua index 9b32511..23d2f7a 100644 --- a/tools/wezterm/appearance.lua +++ b/tools/wezterm/appearance.lua @@ -25,7 +25,7 @@ end return function(config) config.max_fps = 120 config.font = wezterm.font({ - family = "JetBrainsMono Nerd Font", + family = "Sarasa Term SC Nerd Font", }) config.color_scheme = scheme_for_appearance(get_appearance()) config.font_size = 12.0 From ccaf0ce33e9630b9f5bc97b162e2f0b351848adb Mon Sep 17 00:00:00 2001 From: js0ny Date: Tue, 25 Mar 2025 01:19:32 +0000 Subject: [PATCH 07/35] fix and some QoL changes * antidots on readline inputrc * keyd to platforms/linux/keyd * org hide archive and sync vanilla with doom on custom vars * delete some appearance plugins --- Justfile | 39 +++++++++++++++++++-- bootstrap/components/symlinks.bash | 2 +- platforms/linux/kde/kglobalshortcutsrc | 6 ++-- platforms/linux/{etc => }/keyd/app.conf | 0 platforms/linux/{etc => }/keyd/default.conf | 0 tools/bash/profile | 3 ++ tools/doom/org.el | 2 +- tools/emacs.d/lisp/init-org.el | 4 +++ tools/nvim/lua/plugins/appearance.lua | 4 +-- 9 files changed, 50 insertions(+), 10 deletions(-) rename platforms/linux/{etc => }/keyd/app.conf (100%) rename platforms/linux/{etc => }/keyd/default.conf (100%) diff --git a/Justfile b/Justfile index b17af47..f09a4a3 100644 --- a/Justfile +++ b/Justfile @@ -45,12 +45,19 @@ XDG_STATE_HOME := \ } } +# Sudo and coreutils are required LN := \ - if os_family() == "windows" { # Sudo and coreutils are required + if os_family() == "windows" { "sudo ln -sf" } else { "ln -sf" } +CLIP := \ + if os() == "windows" { "clip.exe" } \ + else if os() == "linux" { "wl-copy" } \ + else if os() == "macos" { "pbcopy" } \ + else { "" } + test: echo {{DOTFILES}} @@ -78,9 +85,11 @@ ideavim: ln -sf {{DOTFILES}}/common/ideavimrc {{XDG_CONFIG_HOME}}/ideavim/ideavimrc git clone https://github.com/MarcoIeni/intellimacs {{join(home_directory(), ".local/share/intellimacs")}} --depth 1 +[unix] vivaldi: - curl https://github.com/SocietasEvanescentes/Vivaldi/files/12446831/Rose.Pine.Dawn.zip > $HOME/Downloads/vivaldi-light.zip # Rose Pine Dawn - curl https://github.com/catppuccin/vivaldi/releases/download/1.0.0-ctpv2/Catppuccin.Mocha.Lavender.zip > $HOME/Downloads/vivaldi-dark.zip # Catppuccino Mocha Lavender + curl -L https://github.com/SocietasEvanescentes/Vivaldi/files/12446831/Rose.Pine.Dawn.zip -o "$HOME/Downloads/vivaldi-light.zip" # Rose Pine Dawn + curl -L https://github.com/catppuccin/vivaldi/releases/download/1.0.0-ctpv2/Catppuccin.Mocha.Lavender.zip -o "$HOME/Downloads/vivaldi-dark.zip" # Catppuccino Mocha Lavender + [linux] systemd: @@ -120,12 +129,36 @@ neovim: {{LN}} {{DOTFILES}}/tools/nvim {{XDG_CONFIG_HOME}}/nvim nvim --headless +checkhealth +"w nvim-healthcheck.txt" +qall +[unix] +thunderbird: + curl -L https://github.com/wshanks/tbkeys/releases/download/v2.4.0/tbkeys.xpi -o "$HOME/Downloads/tbkeys.xpi" + curl -L https://github.com/htyxyt/htyxyt-immersive-translate-Thunderbird/releases/download/thunderbird-v1.14.8/immersive-translate-Thunderbird.v1.14.8.xpi -o "$HOME/Downloads/immersive-translate-Thunderbird.xpi" + cat {{DOTFILES}}/tools/thunderbird/tbkeys.json | {{CLIP}} + +[linux] +readline: + mkdir -p {{XDG_CONFIG_HOME}}/readline + {{LN}} {{DOTFILES}}/common/inputrc {{XDG_CONFIG_HOME}}/readline/inputrc [linux] bash: {{LN}} {{DOTFILES}}/tools/bash {{XDG_CONFIG_HOME}}/bash sudo cp $DOTFILES/tools/bash/xdg-compat.sh /etc/profile.d/xdg-compat.sh +[linux] +keyd: + -which keyd || sudo pacman -S keyd --noconfirm || sudo apt install keyd --yes || @just build_keyd + sudo cp {{DOTFILES}}/platforms/linux/keyd/keyd.conf /etc/keyd/default.conf + mkdir -p {{XDG_CONFIG_HOME}}/keyd + {{LN}} {{DOTFILES}}/platforms/linux/keyd/app.conf {{XDG_CONFIG_HOME}}/keyd/app.conf + sudo systemctl enable keyd + +[linux] +[private] +build_keyd: + git clone https://github.com/rvaiya/keyd $HOME/.local/build/keyd + cd $HOME/.local/build/keyd && make && sudo make install + [linux] flatpak: flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo diff --git a/bootstrap/components/symlinks.bash b/bootstrap/components/symlinks.bash index b166bf4..2273a84 100644 --- a/bootstrap/components/symlinks.bash +++ b/bootstrap/components/symlinks.bash @@ -68,7 +68,7 @@ if [ $(uname) = "Darwin" ]; then else echo "[INFO] Running on Linux" linkDots+=( - ["$DOTFILES/common/inputrc"]="$HOME/.inputrc" + ["$DOTFILES/common/inputrc"]="$XDG_CONFIG_HOME/readline/inputrc" ) # WSL1 : Microsoft # WSL2 : microsoft diff --git a/platforms/linux/kde/kglobalshortcutsrc b/platforms/linux/kde/kglobalshortcutsrc index c8bcce4..e80a834 100644 --- a/platforms/linux/kde/kglobalshortcutsrc +++ b/platforms/linux/kde/kglobalshortcutsrc @@ -1,5 +1,5 @@ [ActivityManager] -_k_friendly_name=Activity Manager +_k_friendly_name=活动管理器 switch-to-activity-32e1f2d2-08d1-4a8b-886a-0a062f999068=none,none,Switch to activity "Default" switch-to-activity-e1ebfdac-0f52-47a5-9e7a-d9eb5cc26845=none,none,切换到活动“默认” @@ -45,14 +45,14 @@ bring_main_window_to_top=Meta+K,Meta+K,Bring Main Window to Top [ksmserver] Halt Without Confirmation=none,,关机 (无需确认) -Lock Session=Meta+L\tScreensaver,Meta+L\tScreensaver,Lock Session +Lock Session=Meta+L\tScreensaver,Meta+L\tScreensaver,锁定会话 Log Out=Ctrl+Alt+Del,Ctrl+Alt+Del,显示注销屏幕 Log Out Without Confirmation=none,,注销 (无需确认) LogOut=none,,注销 Reboot=none,,重启 Reboot Without Confirmation=none,,重启 (无需确认) Shut Down=none,,关机 -_k_friendly_name=Session Management +_k_friendly_name=会话管理 [kwin] Activate Window Demanding Attention=Meta+Ctrl+A,Meta+Ctrl+A,激活请求注意的窗口 diff --git a/platforms/linux/etc/keyd/app.conf b/platforms/linux/keyd/app.conf similarity index 100% rename from platforms/linux/etc/keyd/app.conf rename to platforms/linux/keyd/app.conf diff --git a/platforms/linux/etc/keyd/default.conf b/platforms/linux/keyd/default.conf similarity index 100% rename from platforms/linux/etc/keyd/default.conf rename to platforms/linux/keyd/default.conf diff --git a/tools/bash/profile b/tools/bash/profile index 7413952..ec7c896 100644 --- a/tools/bash/profile +++ b/tools/bash/profile @@ -42,8 +42,11 @@ minimal_path=( "/usr/local/sbin" "$HOME/.local/bin" "$HOME/.local/sbin" + "$HOME/.local/scripts" ) +export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc + for p in "${minimal_path[@]}"; do pathadd "$p" done diff --git a/tools/doom/org.el b/tools/doom/org.el index 56b0bbd..dd7bbae 100644 --- a/tools/doom/org.el +++ b/tools/doom/org.el @@ -15,7 +15,7 @@ (save-excursion (insert char ?\u200B))) ;; Directory - (setq org-archive-location "~/OrgFiles/archive/%s_archive::") + (setq org-archive-location "~/OrgFiles/.archive/%s_archive::") (setq org-default-notes-file "~/OrgFiles/tasks/inbox.org") ;; Initial Visibility diff --git a/tools/emacs.d/lisp/init-org.el b/tools/emacs.d/lisp/init-org.el index 40d5ec7..086cca9 100644 --- a/tools/emacs.d/lisp/init-org.el +++ b/tools/emacs.d/lisp/init-org.el @@ -22,6 +22,10 @@ (org-directory "~/OrgFiles/") (org-agenda-files (list (concat org-directory "tasks/"))) (org-persist-directory (expand-file-name "org-persist" user-emacs-data)) + (org-archive-location "~/OrgFiles/.archive/%s_archive::") + (org-default-notes-file "~/OrgFiles/tasks/inbox.org") + (org-startup-folded "show2levels") + (org-log-into-drawer "LOGBOOK") (org-pretty-entities t) (org-src-fontify-natively t) (org-src-tab-acts-natively t) ; Use TAB to indent inside source block diff --git a/tools/nvim/lua/plugins/appearance.lua b/tools/nvim/lua/plugins/appearance.lua index d6fcbf4..42334f9 100644 --- a/tools/nvim/lua/plugins/appearance.lua +++ b/tools/nvim/lua/plugins/appearance.lua @@ -21,7 +21,7 @@ return { variant = "dawn", }, }, - { "olimorris/onedarkpro.nvim", cmd = "Telescope colorscheme" }, + -- { "olimorris/onedarkpro.nvim", cmd = "Telescope colorscheme" }, { "rebelot/kanagawa.nvim", cmd = "Telescope colorscheme" }, -- -- Highlight objects under the cursor -- { "RRethy/vim-illuminate" }, @@ -42,7 +42,7 @@ return { }, }, }, - { import = "plugins.mod.alpha-nvim" }, -- Dashboard + -- { import = "plugins.mod.alpha-nvim" }, -- Dashboard { -- Breadcrumb "Bekaboo/dropbar.nvim", dependencies = { From 797ddef79b66b938740aed1609ca96684a00995d Mon Sep 17 00:00:00 2001 From: js0ny Date: Tue, 25 Mar 2025 01:21:43 +0000 Subject: [PATCH 08/35] refractor(nvim): Put lang specific config to plugins/mod/lang * Local leader to * Add org mappings to match emacs behaviour * Put lang specific config to plugins/mod/lang, currently markdown and org --- tools/nvim/lua/plugins/lazy-nvim.lua | 2 +- tools/nvim/lua/plugins/lsp.lua | 5 +- tools/nvim/lua/plugins/misc.lua | 3 +- tools/nvim/lua/plugins/mod/lang-org.lua | 45 ---------- .../lua/plugins/mod/lang/markdown/init.lua | 6 ++ .../markdown/markview.lua.bak} | 0 .../mod/{ => lang/markdown}/obsidian-nvim.lua | 0 .../{ => lang/markdown}/render-markdown.lua | 15 ++-- tools/nvim/lua/plugins/mod/lang/org.lua | 82 +++++++++++++++++++ .../lua/plugins/mod/lualine/components.lua | 7 ++ tools/nvim/lua/plugins/mod/lualine/init.lua | 1 + 11 files changed, 107 insertions(+), 59 deletions(-) delete mode 100644 tools/nvim/lua/plugins/mod/lang-org.lua create mode 100644 tools/nvim/lua/plugins/mod/lang/markdown/init.lua rename tools/nvim/lua/plugins/mod/{markview.lua => lang/markdown/markview.lua.bak} (100%) rename tools/nvim/lua/plugins/mod/{ => lang/markdown}/obsidian-nvim.lua (100%) rename tools/nvim/lua/plugins/mod/{ => lang/markdown}/render-markdown.lua (95%) create mode 100644 tools/nvim/lua/plugins/mod/lang/org.lua diff --git a/tools/nvim/lua/plugins/lazy-nvim.lua b/tools/nvim/lua/plugins/lazy-nvim.lua index a5b8fbf..c1396ee 100644 --- a/tools/nvim/lua/plugins/lazy-nvim.lua +++ b/tools/nvim/lua/plugins/lazy-nvim.lua @@ -19,4 +19,4 @@ vim.opt.rtp:prepend(lazypath) -- loading lazy.nvim so that mappings are correct. -- This is also a good place to setup other settings (vim.opt) vim.g.mapleader = " " -vim.g.maplocalleader = "\\" +vim.g.maplocalleader = "" diff --git a/tools/nvim/lua/plugins/lsp.lua b/tools/nvim/lua/plugins/lsp.lua index 07a23ae..7bc52b0 100644 --- a/tools/nvim/lua/plugins/lsp.lua +++ b/tools/nvim/lua/plugins/lsp.lua @@ -1,7 +1,5 @@ return { { import = "plugins.mod.nvim-lspconfig" }, - { import = "plugins.mod.render-markdown" }, - -- { import = "plugins.mod.markview" }, { "lervag/vimtex", ft = { "tex", "bib" }, @@ -41,7 +39,8 @@ return { "NoahTheDuke/vim-just", ft = { "just" }, }, - { import = "plugins.mod.lang-org" }, + { import = "plugins.mod.lang.org" }, + { import = "plugins.mod.lang.markdown" }, { import = "plugins.mod.trouble-nvim" }, { "nvim-treesitter/nvim-treesitter", diff --git a/tools/nvim/lua/plugins/misc.lua b/tools/nvim/lua/plugins/misc.lua index db52927..c5a1af2 100644 --- a/tools/nvim/lua/plugins/misc.lua +++ b/tools/nvim/lua/plugins/misc.lua @@ -1,5 +1,5 @@ return { - { "wakatime/vim-wakatime", lazy = false }, + { "wakatime/vim-wakatime", lazy = false }, { import = "plugins.mod.toggleterm" }, { "CRAG666/code_runner.nvim", @@ -18,7 +18,6 @@ return { }, }, }, - { import = "plugins.mod.obsidian-nvim" }, { import = "plugins.mod.which-keys-nvim" }, { import = "plugins.mod.copilot-lua" }, { import = "plugins.mod.avante-nvim" }, diff --git a/tools/nvim/lua/plugins/mod/lang-org.lua b/tools/nvim/lua/plugins/mod/lang-org.lua deleted file mode 100644 index 9cce736..0000000 --- a/tools/nvim/lua/plugins/mod/lang-org.lua +++ /dev/null @@ -1,45 +0,0 @@ -return { - "nvim-orgmode/orgmode", - dependencies = { - "nvim-telescope/telescope.nvim", - "nvim-orgmode/telescope-orgmode.nvim", - "nvim-orgmode/org-bullets.nvim", - "Saghen/blink.cmp", - }, - event = "VeryLazy", - config = function() - require("orgmode").setup({ - org_agenda_files = "~/OrgFiles/tasks/*", - org_default_notes_file = "~/OrgFiles/tasks/inbox.org", - org_archive_location = "~/OrgFiles/archive/%s_archive::", - org_todo_keywords = { "TODO(t)", "NEXT(n)", "WAIT(w)", "|", "DONE(d)", "CANCELLED(c)" }, - org_hide_leading_stars = true, - org_hide_emphasis_markers = true, - org_log_into_drawer = "LOGBOOK", - org_highlight_latex_and_related = "native", - org_startup_indented = true, - org_deadline_warning_days = 10, - }) - require("org-bullets").setup() - require("blink.cmp").setup({ - sources = { - per_filetype = { - org = { "orgmode" }, - }, - providers = { - orgmode = { - name = "Orgmode", - module = "orgmode.org.autocompletion.blink", - fallbacks = { "buffer" }, - }, - }, - }, - }) - - require("telescope").setup() - require("telescope").load_extension("orgmode") - vim.keymap.set("n", "r", require("telescope").extensions.orgmode.refile_heading) - vim.keymap.set("n", "fh", require("telescope").extensions.orgmode.search_headings) - vim.keymap.set("n", "li", require("telescope").extensions.orgmode.insert_link) - end, -} diff --git a/tools/nvim/lua/plugins/mod/lang/markdown/init.lua b/tools/nvim/lua/plugins/mod/lang/markdown/init.lua new file mode 100644 index 0000000..9374576 --- /dev/null +++ b/tools/nvim/lua/plugins/mod/lang/markdown/init.lua @@ -0,0 +1,6 @@ +return { + { import = "plugins.mod.lang.markdown.render-markdown" }, + -- { import = "plugins.mod.lang.markdown.markview" }, + { import = "plugins.mod.lang.markdown.obsidian-nvim" }, + { "bullets-vim/bullets.vim" }, +} diff --git a/tools/nvim/lua/plugins/mod/markview.lua b/tools/nvim/lua/plugins/mod/lang/markdown/markview.lua.bak similarity index 100% rename from tools/nvim/lua/plugins/mod/markview.lua rename to tools/nvim/lua/plugins/mod/lang/markdown/markview.lua.bak diff --git a/tools/nvim/lua/plugins/mod/obsidian-nvim.lua b/tools/nvim/lua/plugins/mod/lang/markdown/obsidian-nvim.lua similarity index 100% rename from tools/nvim/lua/plugins/mod/obsidian-nvim.lua rename to tools/nvim/lua/plugins/mod/lang/markdown/obsidian-nvim.lua diff --git a/tools/nvim/lua/plugins/mod/render-markdown.lua b/tools/nvim/lua/plugins/mod/lang/markdown/render-markdown.lua similarity index 95% rename from tools/nvim/lua/plugins/mod/render-markdown.lua rename to tools/nvim/lua/plugins/mod/lang/markdown/render-markdown.lua index 1eda692..f89a3e1 100644 --- a/tools/nvim/lua/plugins/mod/render-markdown.lua +++ b/tools/nvim/lua/plugins/mod/lang/markdown/render-markdown.lua @@ -14,14 +14,13 @@ return { top_pad = 0, bottom_pad = 0, }, - heading = { - sign = false, - position = "inline", - width = "block", - left_margin = 0.5, - left_pad = 0.2, - right_pad = 0.2, - }, + -- heading = { + -- position = "overlay", + -- width = "block", + -- left_margin = 0.5, + -- left_pad = 0.2, + -- right_pad = 0.2, + -- }, link = { custom = { python = { pattern = "%.py", icon = " " }, diff --git a/tools/nvim/lua/plugins/mod/lang/org.lua b/tools/nvim/lua/plugins/mod/lang/org.lua new file mode 100644 index 0000000..5f2bcbe --- /dev/null +++ b/tools/nvim/lua/plugins/mod/lang/org.lua @@ -0,0 +1,82 @@ +return { + { + "nvim-orgmode/orgmode", + dependencies = { + "nvim-telescope/telescope.nvim", + "nvim-orgmode/telescope-orgmode.nvim", + "nvim-orgmode/org-bullets.nvim", + "Saghen/blink.cmp", + }, + cmd = { + "Org", + }, + keys = { + { "A", "Org agenda", desc = "Org Agenda" }, + }, + event = "VeryLazy", + config = function() + require("orgmode").setup({ + org_agenda_files = "~/OrgFiles/tasks/*", + org_default_notes_file = "~/OrgFiles/tasks/inbox.org", + org_archive_location = "~/OrgFiles/archive/%s_archive::", + org_todo_keywords = { "TODO(t)", "NEXT(n)", "WAIT(w)", "|", "DONE(d)", "CANCELLED(c)" }, + org_hide_leading_stars = true, + org_hide_emphasis_markers = true, + org_log_into_drawer = "LOGBOOK", + org_highlight_latex_and_related = "native", + org_startup_indented = true, + org_deadline_warning_days = 10, + mappings = { + agenda = { + org_agenda_schedule = "", + org_agenda_deadline = "", + org_agenda_todo = "", + org_agenda_set_tags = "", + org_agenda_earlier = { "[[", "<" }, + org_agenda_later = { "]]", ">" }, + }, + org = { + org_deadline = "", + org_schedule = "", + org_todo = "", + org_set_tags_command = "", + }, + }, + }) + require("org-bullets").setup() + require("blink.cmp").setup({ + sources = { + per_filetype = { + org = { "orgmode" }, + }, + providers = { + orgmode = { + name = "Orgmode", + module = "orgmode.org.autocompletion.blink", + fallbacks = { "buffer" }, + }, + }, + }, + }) + + require("telescope").setup() + require("telescope").load_extension("orgmode") + -- vim.keymap.set("n", "r", require("telescope").extensions.orgmode.refile_heading) + vim.keymap.set("n", "oP", require("telescope").extensions.orgmode.search_headings) + vim.keymap.set("n", "op", "Telescope find_files cwd=~/OrgFiles") + -- vim.keymap.set("n", "li", require("telescope").extensions.orgmode.insert_link) + end, + }, + -- { + -- dir = "~/Source/org-pomodoro.nvim", + -- name = "org-pomodoro.nvim", + -- lazy = false, + -- opts = {}, + -- dependencies = { + -- "nvim-orgmode/orgmode", + -- }, + -- cmd = { + -- "OrgPomodoro", + -- }, + -- }, +} diff --git a/tools/nvim/lua/plugins/mod/lualine/components.lua b/tools/nvim/lua/plugins/mod/lualine/components.lua index daa319e..1ec6b4e 100644 --- a/tools/nvim/lua/plugins/mod/lualine/components.lua +++ b/tools/nvim/lua/plugins/mod/lualine/components.lua @@ -112,6 +112,13 @@ M.progress = { "progress", } +-- TODO: Implement orgmode +M.orgmode = { + function() + return _G.orgmode.statusline() + end, +} + -- local conditions = { -- buffer_not_empty = function() -- return vim.fn.empty(vim.fn.expand("%:t")) ~= 1 diff --git a/tools/nvim/lua/plugins/mod/lualine/init.lua b/tools/nvim/lua/plugins/mod/lualine/init.lua index 5944677..7cdeb1c 100644 --- a/tools/nvim/lua/plugins/mod/lualine/init.lua +++ b/tools/nvim/lua/plugins/mod/lualine/init.lua @@ -36,6 +36,7 @@ local config = { components.diagnostics, }, lualine_x = { + components.orgmode, components.indent, components.encoding, components.eol, From 1716712787f3c38659452c2438834c6b420f5fbd Mon Sep 17 00:00:00 2001 From: js0ny Date: Tue, 25 Mar 2025 11:41:45 +0000 Subject: [PATCH 09/35] Minor Fix --- Justfile | 10 ++++---- tools/fish/conf.d/alias.fish | 10 ++++++++ tools/nvim/lua/plugins/misc.lua | 3 ++- .../mod/lang/markdown/obsidian-nvim.lua | 2 +- tools/nvim/lua/plugins/mod/lang/org.lua | 6 ++++- tools/nvim/lua/plugins/mod/snacks-nvim.lua | 23 +++++++++++++++++++ 6 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 tools/nvim/lua/plugins/mod/snacks-nvim.lua diff --git a/Justfile b/Justfile index f09a4a3..4c45570 100644 --- a/Justfile +++ b/Justfile @@ -16,7 +16,7 @@ PLATFORM := \ } else { "" } DOTFILES := join(home_directory(), ".dotfiles") XDG_CONFIG_HOME := \ - if env("XDG_CONFIG_HOME") != "" {env("XDG_CONFIG_HOME")} \ + if env("XDG_CONFIG_HOME", "") != "" {env("XDG_CONFIG_HOME", "")} \ else { if os_family() == "windows" { env("APPDATA") @@ -26,20 +26,20 @@ XDG_CONFIG_HOME := \ } XDG_DATA_HOME := \ - if env("XDG_DATA_HOME") != "" {env("XDG_DATA_HOME")} \ + if env("XDG_DATA_HOME", "") != "" {env("XDG_DATA_HOME", "")} \ else { if os_family() == "windows" { - env("LOCALAPPDATA") + env("LOCALAPPDATA", "") } else { join(home_directory(), ".local/share") } } XDG_STATE_HOME := \ - if env("XDG_STATE_HOME") != "" {env("XDG_STATE_HOME")} \ + if env("XDG_STATE_HOME", "") != "" {env("XDG_STATE_HOME", "")} \ else { if os_family() == "windows" { - join(env("LOCALAPPDATA"), "state") + join(env("LOCALAPPDATA", ""), "state") } else { join(home_directory(), ".local/state") } diff --git a/tools/fish/conf.d/alias.fish b/tools/fish/conf.d/alias.fish index 1a505b3..3a3dd15 100644 --- a/tools/fish/conf.d/alias.fish +++ b/tools/fish/conf.d/alias.fish @@ -141,6 +141,16 @@ if command -v apt > /dev/null abbr --add aptl "apt list --installed" end + +if command -v dnf > /dev/null + abbr --add dnf "sudo dnf" + abbr --add dnfi "sudo dnf install" + abbr --add dnfr "sudo dnf remove" + abbr --add dnfu "sudo dnf update" + abbr --add dnfs "dnf search" + abbr --add dnfl "dnf list --installed" +end + if test "$TERM" = "xterm-ghostty" -o "$TERM" = "xterm-kitty" abbr --add icat "kitten icat" else if test "$TERM_PROGRAM" = "WezTerm" diff --git a/tools/nvim/lua/plugins/misc.lua b/tools/nvim/lua/plugins/misc.lua index c5a1af2..e80320d 100644 --- a/tools/nvim/lua/plugins/misc.lua +++ b/tools/nvim/lua/plugins/misc.lua @@ -1,5 +1,5 @@ return { - { "wakatime/vim-wakatime", lazy = false }, + { "wakatime/vim-wakatime", lazy = false }, { import = "plugins.mod.toggleterm" }, { "CRAG666/code_runner.nvim", @@ -42,4 +42,5 @@ return { -- "3rd/image.nvim", -- opts = {}, -- }, + { import = "plugins.mod.snacks-nvim" }, } diff --git a/tools/nvim/lua/plugins/mod/lang/markdown/obsidian-nvim.lua b/tools/nvim/lua/plugins/mod/lang/markdown/obsidian-nvim.lua index edbd861..befc64a 100644 --- a/tools/nvim/lua/plugins/mod/lang/markdown/obsidian-nvim.lua +++ b/tools/nvim/lua/plugins/mod/lang/markdown/obsidian-nvim.lua @@ -52,7 +52,7 @@ return { }, }, completion = { - nvim_cmp = true, + nvim_cmp = false, min_chars = 2, }, ui = { diff --git a/tools/nvim/lua/plugins/mod/lang/org.lua b/tools/nvim/lua/plugins/mod/lang/org.lua index 5f2bcbe..e97355d 100644 --- a/tools/nvim/lua/plugins/mod/lang/org.lua +++ b/tools/nvim/lua/plugins/mod/lang/org.lua @@ -1,18 +1,22 @@ return { { - "nvim-orgmode/orgmode", + -- "js0ny/nvim-orgmode", + name = "orgmode", dependencies = { "nvim-telescope/telescope.nvim", "nvim-orgmode/telescope-orgmode.nvim", "nvim-orgmode/org-bullets.nvim", "Saghen/blink.cmp", }, + branch = "feat-image-match-latex", cmd = { "Org", }, keys = { { "A", "Org agenda", desc = "Org Agenda" }, }, + dir = "~/Source/Forks/nvim-orgmode", + dev = true, event = "VeryLazy", config = function() require("orgmode").setup({ diff --git a/tools/nvim/lua/plugins/mod/snacks-nvim.lua b/tools/nvim/lua/plugins/mod/snacks-nvim.lua new file mode 100644 index 0000000..282cf39 --- /dev/null +++ b/tools/nvim/lua/plugins/mod/snacks-nvim.lua @@ -0,0 +1,23 @@ +-- Welcome to nvim's systemd :D + +return { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + ---@type snacks.Config + opts = { + -- bigfile = { enabled = true }, + -- dashboard = { enabled = true }, + -- explorer = { enabled = true }, + -- indent = { enabled = true }, + -- input = { enabled = true }, + -- picker = { enabled = true }, + -- notifier = { enabled = true }, + -- quickfile = { enabled = true }, + -- scope = { enabled = true }, + -- scroll = { enabled = true }, + -- statuscolumn = { enabled = true }, + -- words = { enabled = true }, + image = { enabled = true }, + }, +} From 48331347fd458cb924bf9af1b9fb7f3e51e8dc6a Mon Sep 17 00:00:00 2001 From: js0ny Date: Wed, 26 Mar 2025 14:28:52 +0000 Subject: [PATCH 10/35] perf(nvim): Apply lazy load for all plugins --- Justfile | 12 +- platforms/linux/user-dirs.dirs | 10 ++ tools/bash/xdg-compat.sh | 6 +- tools/nvim/lua/config/servers.lua | 38 ++--- tools/nvim/lua/keymaps/leaders.lua | 140 +++++++++--------- tools/nvim/lua/keymaps/nvim-tree.lua | 2 + tools/nvim/lua/plugins/appearance.lua | 37 +++-- tools/nvim/lua/plugins/completion.lua | 12 +- tools/nvim/lua/plugins/dap.lua | 6 +- tools/nvim/lua/plugins/edit.lua | 54 +++---- tools/nvim/lua/plugins/fileutils.lua | 14 +- tools/nvim/lua/plugins/lsp.lua | 21 ++- tools/nvim/lua/plugins/misc.lua | 38 ++--- tools/nvim/lua/plugins/mod/avante-nvim.lua | 2 + tools/nvim/lua/plugins/mod/blink-cmp.lua | 3 +- tools/nvim/lua/plugins/mod/bufferline.lua | 2 +- .../lua/plugins/mod/lang/markdown/init.lua | 2 +- .../mod/lang/markdown/render-markdown.lua | 2 +- tools/nvim/lua/plugins/mod/lang/org.lua | 12 +- tools/nvim/lua/plugins/mod/lualine/init.lua | 2 +- tools/nvim/lua/plugins/mod/nvim-lspconfig.lua | 5 + tools/nvim/lua/plugins/mod/snacks-nvim.lua | 18 ++- tools/nvim/lua/plugins/mod/telescope.lua | 39 ++--- 23 files changed, 274 insertions(+), 203 deletions(-) create mode 100644 platforms/linux/user-dirs.dirs diff --git a/Justfile b/Justfile index 4c45570..8746a66 100644 --- a/Justfile +++ b/Justfile @@ -143,7 +143,7 @@ readline: [linux] bash: {{LN}} {{DOTFILES}}/tools/bash {{XDG_CONFIG_HOME}}/bash - sudo cp $DOTFILES/tools/bash/xdg-compat.sh /etc/profile.d/xdg-compat.sh + sudo cp {{DOTFILES}}/tools/bash/xdg-compat.sh /etc/profile.d/xdg-compat.sh [linux] keyd: @@ -159,6 +159,16 @@ build_keyd: git clone https://github.com/rvaiya/keyd $HOME/.local/build/keyd cd $HOME/.local/build/keyd && make && sudo make install +[unix] +kitty: + which kitty + {{LN}} {{DOTFILES}}/tools/kitty {{XDG_CONFIG_HOME}}/kitty + +[unix] +zotero: + curl -L https://github.com/syt2/zotero-addons/releases/download/V1.8.1/zotero-addons.xpi -o "$HOME/Downloads/zotero-addons.xpi" + + [linux] flatpak: flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo diff --git a/platforms/linux/user-dirs.dirs b/platforms/linux/user-dirs.dirs new file mode 100644 index 0000000..fd18e7b --- /dev/null +++ b/platforms/linux/user-dirs.dirs @@ -0,0 +1,10 @@ +# Force to use English for directory names + +XDG_DESKTOP_DIR="$HOME/Desktop" +XDG_DOWNLOAD_DIR="$HOME/Downloads" +XDG_TEMPLATES_DIR="$HOME/Templates" +XDG_PUBLICSHARE_DIR="$HOME/" +XDG_DOCUMENTS_DIR="$HOME/Documents" +XDG_MUSIC_DIR="$HOME/Music" +XDG_PICTURES_DIR="$HOME/Pictures" +XDG_VIDEOS_DIR="$HOME/Videos" diff --git a/tools/bash/xdg-compat.sh b/tools/bash/xdg-compat.sh index e8b9961..912d5b4 100644 --- a/tools/bash/xdg-compat.sh +++ b/tools/bash/xdg-compat.sh @@ -8,9 +8,9 @@ # Set XDG Base Directory Path export XDG_CONFIG_HOME="$HOME/.config" -export XDG_CACHE_HOME="~/.cache" -export XDG_DATA_HOME="~/.local/share" -export XDG_STATE_HOME="~/.local/state" +export XDG_CACHE_HOME="$HOME/.cache" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_STATE_HOME="$HOME/.local/state" export XDG_RUNTIME_DIR="/run/user/$(id -u)" # Source user's XDG-compliant Bash configs diff --git a/tools/nvim/lua/config/servers.lua b/tools/nvim/lua/config/servers.lua index a45c8c1..c1c3434 100644 --- a/tools/nvim/lua/config/servers.lua +++ b/tools/nvim/lua/config/servers.lua @@ -5,29 +5,21 @@ local M = {} -- Ensure that the following servers are installed and set -- Use :Mason to list all available servers M.servers = { - "ast_grep", - "bashls", -- Bash - "clangd", -- C/C++ - "cssls", -- CSS - "denols", -- Deno - "eslint", -- JavaScript - "gopls", -- Go - "html", -- HTML - "jsonls", -- JSON - "lua_ls", -- Lua - "markdown_oxide", -- Markdown - "omnisharp", -- C# & F# - "powershell_es", -- PowerShell - "pyright", -- Python - "rust_analyzer", -- Rust - "svelte", -- Svelte - "svlangserver", -- SystemVerilog - "tailwindcss", -- TailwindCSS - "taplo", -- TOML - "ts_ls", -- TypeScript - "vimls", -- vimscript - "yamlls", -- YAML - "beancount", -- Beancount + "bashls", -- Bash + "clangd", -- C/C++ + "eslint", -- JavaScript + "gopls", -- Go + "html", -- HTML + "jsonls", -- JSON + "lua_ls", -- Lua + -- "markdown_oxide", -- Markdown + "pyright", -- Python + "rust_analyzer", -- Rust + "taplo", -- TOML + "ts_ls", -- TypeScript + "vimls", -- vimscript + "yamlls", -- YAML + "beancount", -- Beancount } -- Configuration for each server defines here diff --git a/tools/nvim/lua/keymaps/leaders.lua b/tools/nvim/lua/keymaps/leaders.lua index 2026f79..5932ed2 100644 --- a/tools/nvim/lua/keymaps/leaders.lua +++ b/tools/nvim/lua/keymaps/leaders.lua @@ -42,61 +42,61 @@ vim.api.nvim_create_user_command("Rename", renameCurrentBuffer, {}) local leader_mappings = { general = { - { keys = "-", cmd = ":split", opts = { desc = "Split to down" } }, - { keys = "\\", cmd = ":vsplit", opts = { desc = "Split to right" } }, - { keys = "|", cmd = ":vsplit", opts = { desc = "Split to right" } }, - { keys = "h", cmd = "h", opts = { desc = "Left Window" } }, - { keys = "n", cmd = "j", opts = { desc = "Down Window" } }, - { keys = "e", cmd = "k", opts = { desc = "Up Window" } }, - { keys = "i", cmd = "l", opts = { desc = "Right Window" } }, - { keys = "", cmd = "b#", opts = { desc = "Switch to last buffer" } }, - { keys = '"', cmd = ":!wezterm-gui &", pots = { desc = "Open External Terminal(wezterm)" } }, + { keys = "-", cmd = ":split", opts = { desc = "Split to down" } }, + { keys = "\\", cmd = ":vsplit", opts = { desc = "Split to right" } }, + { keys = "|", cmd = ":vsplit", opts = { desc = "Split to right" } }, + { keys = "h", cmd = "h", opts = { desc = "Left Window" } }, + { keys = "n", cmd = "j", opts = { desc = "Down Window" } }, + { keys = "e", cmd = "k", opts = { desc = "Up Window" } }, + { keys = "i", cmd = "l", opts = { desc = "Right Window" } }, + { keys = "", cmd = "b#", opts = { desc = "Switch to last buffer" } }, + { keys = '"', cmd = ":!wezterm-gui &", pots = { desc = "Open External Terminal(wezterm)" } }, }, b = { -- +buffer - { keys = "0", cmd = "b#", opts = { desc = "Switch to last buffer" } }, - { keys = "1", cmd = ":BufferLineGotoBuffer 1", opts = { desc = "Switch to Buffer #1" } }, - { keys = "2", cmd = ":BufferLineGotoBuffer 2", opts = { desc = "Switch to Buffer #2" } }, - { keys = "3", cmd = ":BufferLineGotoBuffer 3", opts = { desc = "Switch to Buffer #3" } }, - { keys = "4", cmd = ":BufferLineGotoBuffer 4", opts = { desc = "Switch to Buffer #4" } }, - { keys = "5", cmd = ":BufferLineGotoBuffer 5", opts = { desc = "Switch to Buffer #5" } }, - { keys = "6", cmd = ":BufferLineGotoBuffer 6", opts = { desc = "Switch to Buffer #6" } }, - { keys = "7", cmd = ":BufferLineGotoBuffer 7", opts = { desc = "Switch to Buffer #7" } }, - { keys = "8", cmd = ":BufferLineGotoBuffer 8", opts = { desc = "Switch to Buffer #8" } }, - { keys = "9", cmd = ":BufferLineGotoBuffer 9", opts = { desc = "Switch to Buffer #9" } }, - { keys = "b", cmd = ":BufferLinePick", opts = { desc = "Quick Switch Buffers" } }, - { keys = "d", cmd = ":bdelete", opts = { desc = "Delete Buffer" } }, - { keys = "D", cmd = ":BufferLineCloseOthers", opts = { desc = "Delete Other Buffers" } }, - { keys = "xx", cmd = ":BufferLineCloseOthers", opts = { desc = "Delete Other Buffers" } }, - { keys = "xh", cmd = ":BufferLineCloseLeft", opts = { desc = "Delete Buffers Left" } }, - { keys = "xi", cmd = ":BufferLineCloseRight", opts = { desc = "Delete Buffers Right" } }, - { keys = "X", cmd = ":BufferLineCloseOthers", opts = { desc = "Delete Other Buffers" } }, - { keys = "h", cmd = ":bprevious", opts = { desc = "Previous Buffer" } }, - { keys = "i", cmd = ":bnext", opts = { desc = "Next Buffer" } }, - { keys = "H", cmd = ":bfirst", opts = { desc = "First Buffer" } }, - { keys = "I", cmd = ":blast", opts = { desc = "Last Buffer" } }, - { keys = "0", cmd = ":bfirst", opts = { desc = "First Buffer" } }, - { keys = "^", cmd = ":bfirst", opts = { desc = "First Buffer" } }, - { keys = "$", cmd = ":blast", opts = { desc = "Last Buffer" } }, - { keys = "s", cmd = ":new", opts = { desc = "Scratch buffers" } }, - { keys = "t", cmd = ":BufferLineTogglePin", opts = { desc = "Pin Buffer" } }, - { keys = "y", cmd = ":%y+", opts = { desc = "Copy Buffer to Clipboard" } }, + { keys = "0", cmd = "b#", opts = { desc = "Switch to last buffer" } }, + { keys = "1", cmd = ":BufferLineGotoBuffer 1", opts = { desc = "Switch to Buffer #1" } }, + { keys = "2", cmd = ":BufferLineGotoBuffer 2", opts = { desc = "Switch to Buffer #2" } }, + { keys = "3", cmd = ":BufferLineGotoBuffer 3", opts = { desc = "Switch to Buffer #3" } }, + { keys = "4", cmd = ":BufferLineGotoBuffer 4", opts = { desc = "Switch to Buffer #4" } }, + { keys = "5", cmd = ":BufferLineGotoBuffer 5", opts = { desc = "Switch to Buffer #5" } }, + { keys = "6", cmd = ":BufferLineGotoBuffer 6", opts = { desc = "Switch to Buffer #6" } }, + { keys = "7", cmd = ":BufferLineGotoBuffer 7", opts = { desc = "Switch to Buffer #7" } }, + { keys = "8", cmd = ":BufferLineGotoBuffer 8", opts = { desc = "Switch to Buffer #8" } }, + { keys = "9", cmd = ":BufferLineGotoBuffer 9", opts = { desc = "Switch to Buffer #9" } }, + { keys = "b", cmd = ":BufferLinePick", opts = { desc = "Quick Switch Buffers" } }, + { keys = "d", cmd = ":bdelete", opts = { desc = "Delete Buffer" } }, + { keys = "D", cmd = ":BufferLineCloseOthers", opts = { desc = "Delete Other Buffers" } }, + { keys = "xx", cmd = ":BufferLineCloseOthers", opts = { desc = "Delete Other Buffers" } }, + { keys = "xh", cmd = ":BufferLineCloseLeft", opts = { desc = "Delete Buffers Left" } }, + { keys = "xi", cmd = ":BufferLineCloseRight", opts = { desc = "Delete Buffers Right" } }, + { keys = "X", cmd = ":BufferLineCloseOthers", opts = { desc = "Delete Other Buffers" } }, + { keys = "h", cmd = ":bprevious", opts = { desc = "Previous Buffer" } }, + { keys = "i", cmd = ":bnext", opts = { desc = "Next Buffer" } }, + { keys = "H", cmd = ":bfirst", opts = { desc = "First Buffer" } }, + { keys = "I", cmd = ":blast", opts = { desc = "Last Buffer" } }, + { keys = "0", cmd = ":bfirst", opts = { desc = "First Buffer" } }, + { keys = "^", cmd = ":bfirst", opts = { desc = "First Buffer" } }, + { keys = "$", cmd = ":blast", opts = { desc = "Last Buffer" } }, + { keys = "s", cmd = ":new", opts = { desc = "Scratch buffers" } }, + { keys = "t", cmd = ":BufferLineTogglePin", opts = { desc = "Pin Buffer" } }, + { keys = "y", cmd = ":%y+", opts = { desc = "Copy Buffer to Clipboard" } }, }, c = { -- +code/compile { keys = "R", cmd = vim.lsp.buf.rename, opts = { desc = "Rename symbol under cursor" } }, - { keys = "f", cmd = formatFx, opts = { desc = "Format buffer" } }, + { keys = "f", cmd = formatFx, opts = { desc = "Format buffer" } }, }, f = { -- +file/find - { keys = "n", cmd = ":new", opts = { desc = "New File" } }, - { keys = "s", cmd = ":write", opts = { desc = "Save File" } }, - { keys = "S", cmd = ":wall", opts = { desc = "Save All Files" } }, - { keys = "D", cmd = "!trash-rm %", opts = { desc = "Delete current file" } }, - { keys = "t", cmd = ":NvimTreeFindFileToggle", opts = { desc = "Toggle File Tree" } }, - { keys = "o", cmd = ":!open %", opts = { desc = "Open file in default program" } }, - { keys = "R", cmd = renameCurrentBuffer, opts = { desc = "Rename current file" } }, - { keys = "x", cmd = ":Lazy", opts = { desc = "Open extension view" } }, - { keys = "yy", cmd = ":let @+ = expand('%:p')", opts = { desc = "Copy file path" } }, - { keys = "yY", cmd = ":let @+ = expand('%')", opts = { desc = "Copy relative file path" } }, - { keys = "yn", cmd = ":let @+ = expand('%:t')", opts = { desc = "Copy file name" } }, + { keys = "n", cmd = ":new", opts = { desc = "New File" } }, + { keys = "s", cmd = ":write", opts = { desc = "Save File" } }, + { keys = "S", cmd = ":wall", opts = { desc = "Save All Files" } }, + { keys = "D", cmd = "!trash-rm %", opts = { desc = "Delete current file" } }, + -- { keys = "t", cmd = ":NvimTreeFindFileToggle", opts = { desc = "Toggle File Tree" } }, + { keys = "o", cmd = ":!open %", opts = { desc = "Open file in default program" } }, + { keys = "R", cmd = renameCurrentBuffer, opts = { desc = "Rename current file" } }, + { keys = "x", cmd = ":Lazy", opts = { desc = "Open extension view" } }, + { keys = "yy", cmd = ":let @+ = expand('%:p')", opts = { desc = "Copy file path" } }, + { keys = "yY", cmd = ":let @+ = expand('%')", opts = { desc = "Copy relative file path" } }, + { keys = "yn", cmd = ":let @+ = expand('%:t')", opts = { desc = "Copy file name" } }, { keys = "yN", cmd = ":let @+ = expand('%:t:r')", opts = { desc = "Copy file name without extension" } }, { keys = "yd", cmd = ":let @+ = expand('%:p:h')", opts = { desc = "Copy directory path" } }, { @@ -118,37 +118,37 @@ local leader_mappings = { p = { -- +project }, q = { -- +quit - { keys = "q", cmd = ":q", opts = { desc = "Quit" } }, - { keys = "Q", cmd = ":qa!", opts = { desc = "Force Quit" } }, - { keys = "w", cmd = ":wq", opts = { desc = "Write and Quit" } }, + { keys = "q", cmd = ":q", opts = { desc = "Quit" } }, + { keys = "Q", cmd = ":qa!", opts = { desc = "Force Quit" } }, + { keys = "w", cmd = ":wq", opts = { desc = "Write and Quit" } }, { keys = "W", cmd = ":wall:qa!", opts = { desc = "Write all and Force Quit" } }, }, t = { -- +toggle/test - { keys = "f", cmd = ":NvimTreeToggle", opts = { desc = "Toggle File Explorer" } }, + { keys = "f", cmd = ":NvimTreeToggle", opts = { desc = "Toggle File Explorer" } }, { keys = "F", cmd = ":FormatToggle", opts = { desc = "Toggle autoformat-on-save" } }, }, u = { -- +ui { keys = " ", cmd = ":set list!", opts = { desc = "Toggle show all symbols" } }, }, w = { -- +window - { keys = "h", cmd = "h", opts = { desc = "Left Window" } }, - { keys = "n", cmd = "j", opts = { desc = "Down Window" } }, - { keys = "e", cmd = "k", opts = { desc = "Up Window" } }, - { keys = "i", cmd = "l", opts = { desc = "Right Window" } }, - { keys = "H", cmd = "H", opts = { desc = "Move Window Left" } }, - { keys = "N", cmd = "J", opts = { desc = "Move Window Down" } }, - { keys = "E", cmd = "K", opts = { desc = "Move Window Up" } }, - { keys = "I", cmd = "L", opts = { desc = "Move Window Right" } }, - { keys = "-", cmd = ":split", opts = { desc = "Split to down" } }, - { keys = "|", cmd = ":vsplit", opts = { desc = "Split to right" } }, - { keys = "/", cmd = ":vsplit", opts = { desc = "Split to right" } }, - { keys = "d", cmd = "c", opts = { desc = "Close Window" } }, - { keys = "D", cmd = "o", opts = { desc = "Close Other Windows" } }, - { keys = "r", cmd = "r", opts = { desc = "Rotate Windows" } }, - { keys = "R", cmd = "R", opts = { desc = "Reverse Rotate Windows" } }, - { keys = "t", cmd = "T", opts = { desc = "Move Window to New Tab" } }, - { keys = "]", cmd = ":resize +5", opts = { desc = "Increase Window Size" } }, - { keys = "[", cmd = ":resize -5", opts = { desc = "Decrease Window Size" } }, + { keys = "h", cmd = "h", opts = { desc = "Left Window" } }, + { keys = "n", cmd = "j", opts = { desc = "Down Window" } }, + { keys = "e", cmd = "k", opts = { desc = "Up Window" } }, + { keys = "i", cmd = "l", opts = { desc = "Right Window" } }, + { keys = "H", cmd = "H", opts = { desc = "Move Window Left" } }, + { keys = "N", cmd = "J", opts = { desc = "Move Window Down" } }, + { keys = "E", cmd = "K", opts = { desc = "Move Window Up" } }, + { keys = "I", cmd = "L", opts = { desc = "Move Window Right" } }, + { keys = "-", cmd = ":split", opts = { desc = "Split to down" } }, + { keys = "|", cmd = ":vsplit", opts = { desc = "Split to right" } }, + { keys = "/", cmd = ":vsplit", opts = { desc = "Split to right" } }, + { keys = "d", cmd = "c", opts = { desc = "Close Window" } }, + { keys = "D", cmd = "o", opts = { desc = "Close Other Windows" } }, + { keys = "r", cmd = "r", opts = { desc = "Rotate Windows" } }, + { keys = "R", cmd = "R", opts = { desc = "Reverse Rotate Windows" } }, + { keys = "t", cmd = "T", opts = { desc = "Move Window to New Tab" } }, + { keys = "]", cmd = ":resize +5", opts = { desc = "Increase Window Size" } }, + { keys = "[", cmd = ":resize -5", opts = { desc = "Decrease Window Size" } }, { keys = "M", cmd = ":resize:vertical resize", opts = { desc = "Maximize window size" } }, }, } diff --git a/tools/nvim/lua/keymaps/nvim-tree.lua b/tools/nvim/lua/keymaps/nvim-tree.lua index 5fb5d26..03192d4 100644 --- a/tools/nvim/lua/keymaps/nvim-tree.lua +++ b/tools/nvim/lua/keymaps/nvim-tree.lua @@ -1,5 +1,7 @@ local M = {} +M.event = "BufEnter" + M.global = { { mode = "n", keys = "E", cmd = ":NvimTreeToggle" }, { mode = "n", keys = "", cmd = ":NvimTreeFindFileToggle" }, diff --git a/tools/nvim/lua/plugins/appearance.lua b/tools/nvim/lua/plugins/appearance.lua index 42334f9..e75155a 100644 --- a/tools/nvim/lua/plugins/appearance.lua +++ b/tools/nvim/lua/plugins/appearance.lua @@ -1,8 +1,19 @@ +-- https://stackoverflow.com/a/73365602 +vim.api.nvim_create_autocmd("TextYankPost", { + group = vim.api.nvim_create_augroup("highlight_yank", {}), + desc = "Hightlight selection on yank", + pattern = "*", + callback = function() + vim.highlight.on_yank({ higroup = "IncSearch", timeout = 500 }) + end, +}) + return { -- Colorschemes { "catppuccin/nvim", name = "catppuccin", + lazy = true, opts = { flavor = "auto", background = { @@ -10,6 +21,7 @@ return { dark = "mocha", }, integrations = { + -- lualine = true, "lualine", }, }, @@ -20,6 +32,7 @@ return { opts = { variant = "dawn", }, + cmd = "Telescope colorscheme", }, -- { "olimorris/onedarkpro.nvim", cmd = "Telescope colorscheme" }, { "rebelot/kanagawa.nvim", cmd = "Telescope colorscheme" }, @@ -28,20 +41,22 @@ return { { -- Modern Status Line "nvim-lualine/lualine.nvim", dependencies = { "nvim-tree/nvim-web-devicons" }, + event = "VeryLazy", config = function() require("plugins.mod.lualine") end, }, - { -- Highlight yanked text - "gbprod/yanky.nvim", - opts = { - highlight = { - on_put = true, - on_yank = true, - timer = 500, - }, - }, - }, + -- { -- Highlight yanked text + -- "gbprod/yanky.nvim", + -- event = "LazyFile", + -- opts = { + -- highlight = { + -- on_put = true, + -- on_yank = true, + -- timer = 500, + -- }, + -- }, + -- }, -- { import = "plugins.mod.alpha-nvim" }, -- Dashboard { -- Breadcrumb "Bekaboo/dropbar.nvim", @@ -88,6 +103,8 @@ return { }, { -- Highlight and navigate between TODOs "folke/todo-comments.nvim", + cmd = { "TodoTelescope" }, + event = "BufRead", opts = {}, dependencies = { "nvim-lua/plenary.nvim" }, }, diff --git a/tools/nvim/lua/plugins/completion.lua b/tools/nvim/lua/plugins/completion.lua index 62e9179..98ef519 100644 --- a/tools/nvim/lua/plugins/completion.lua +++ b/tools/nvim/lua/plugins/completion.lua @@ -10,14 +10,10 @@ return { event = "InsertEnter", config = function() require("luasnip.loaders.from_vscode").lazy_load({ paths = "~/.config/lsp-snippets" }) - -- require("luasnip.loaders.from_vscode").lazy_load() end, }, - { - "zbirenbaum/copilot-cmp", - opts = {}, - -- config = function() - -- require("copilot_cmp").setup() - -- end, - }, + -- { + -- "zbirenbaum/copilot-cmp", + -- opts = {}, + -- }, } diff --git a/tools/nvim/lua/plugins/dap.lua b/tools/nvim/lua/plugins/dap.lua index d9fe1e5..37c5cc7 100644 --- a/tools/nvim/lua/plugins/dap.lua +++ b/tools/nvim/lua/plugins/dap.lua @@ -2,6 +2,7 @@ return { { "mfussenegger/nvim-dap", + event = "BufReadPre", config = function() local dap = require("dap") dap.adapters.codelldb = { @@ -28,10 +29,13 @@ return { "rcarriga/nvim-dap-ui", opts = {}, dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" }, + cmd = "DapNew", }, - { "theHamsta/nvim-dap-virtual-text", opts = {} }, + { "theHamsta/nvim-dap-virtual-text", opts = {}, cmd = "DapNew" }, { "mfussenegger/nvim-dap-python", + event = "BufReadPost", + ft = "python", config = function() require("dap-python").setup("uv") end, diff --git a/tools/nvim/lua/plugins/edit.lua b/tools/nvim/lua/plugins/edit.lua index 6e7e709..dabc547 100644 --- a/tools/nvim/lua/plugins/edit.lua +++ b/tools/nvim/lua/plugins/edit.lua @@ -1,15 +1,15 @@ return { { "folke/flash.nvim", - event = "VeryLazy", + event = "BufEnter", opts = {}, - -- stylua: ignore + -- stylua: ignore keys = { - { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, - { "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, - { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, - { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, - { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, + { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + { "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, + { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, + { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, + { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, }, }, { @@ -17,13 +17,13 @@ return { version = "*", -- Use the latest tagged version -- opts = , -- This causes the plugin setup function to be called keys = { - { "", "MultipleCursorsAddDown", mode = { "n", "x" }, desc = "Add cursor and move down" }, - { "", "MultipleCursorsAddUp", mode = { "n", "x" }, desc = "Add cursor and move up" }, + { "", "MultipleCursorsAddDown", mode = { "n", "x" }, desc = "Add cursor and move down" }, + { "", "MultipleCursorsAddUp", mode = { "n", "x" }, desc = "Add cursor and move up" }, - { "", "MultipleCursorsAddUp", mode = { "n", "i", "x" }, desc = "Add cursor and move up" }, - { "", "MultipleCursorsAddDown", mode = { "n", "i", "x" }, desc = "Add cursor and move down" }, + { "", "MultipleCursorsAddUp", mode = { "n", "i", "x" }, desc = "Add cursor and move up" }, + { "", "MultipleCursorsAddDown", mode = { "n", "i", "x" }, desc = "Add cursor and move down" }, - { "", "MultipleCursorsMouseAddDelete", mode = { "n", "i" }, desc = "Add or remove cursor" }, + { "", "MultipleCursorsMouseAddDelete", mode = { "n", "i" }, desc = "Add or remove cursor" }, }, config = function() local normal_mode_motion = require("multiple-cursors.normal_mode.motion") @@ -41,20 +41,20 @@ return { require("nvim-autopairs").enable() end, custom_key_maps = { - { { "n", "x" }, { "e", "" }, normal_mode_motion.k, "nowrap" }, - { { "n", "x" }, { "n", "" }, normal_mode_motion.j, "nowrap" }, - { { "n", "x" }, { "i", "", "" }, normal_mode_motion.l, "nowrap" }, - { { "n", "x" }, "j", normal_mode_motion.e, "nowrap" }, - { { "n", "x" }, "J", normal_mode_motion.E, "nowrap" }, - { { "n", "x" }, "gj", normal_mode_motion.ge, "nowrap" }, - { { "n", "x" }, "gJ", normal_mode_motion.gE, "nowrap" }, - { "n", "E", normal_mode_edit.J, "nowrap" }, - { "n", "gE", normal_mode_edit.gJ, "nowrap" }, - { "n", { "l", "" }, normal_mode_mode_change.i, "nowrap" }, - { "n", "L", normal_mode_mode_change.I, "nowrap" }, - { "x", "l", visual_mode_modify_area.i, "nowrap" }, - { "x", "E", visual_mode_edit.J, "nowrap" }, - { "x", "gE", visual_mode_edit.gJ, "nowrap" }, + { { "n", "x" }, { "e", "" }, normal_mode_motion.k, "nowrap" }, + { { "n", "x" }, { "n", "" }, normal_mode_motion.j, "nowrap" }, + { { "n", "x" }, { "i", "", "" }, normal_mode_motion.l, "nowrap" }, + { { "n", "x" }, "j", normal_mode_motion.e, "nowrap" }, + { { "n", "x" }, "J", normal_mode_motion.E, "nowrap" }, + { { "n", "x" }, "gj", normal_mode_motion.ge, "nowrap" }, + { { "n", "x" }, "gJ", normal_mode_motion.gE, "nowrap" }, + { "n", "E", normal_mode_edit.J, "nowrap" }, + { "n", "gE", normal_mode_edit.gJ, "nowrap" }, + { "n", { "l", "" }, normal_mode_mode_change.i, "nowrap" }, + { "n", "L", normal_mode_mode_change.I, "nowrap" }, + { "x", "l", visual_mode_modify_area.i, "nowrap" }, + { "x", "E", visual_mode_edit.J, "nowrap" }, + { "x", "gE", visual_mode_edit.gJ, "nowrap" }, }, }) end, @@ -63,7 +63,7 @@ return { { "kylechui/nvim-surround", version = "*", -- Use for stability; omit to use `main` branch for the latest features - event = "VeryLazy", + event = "BufEnter", opts = {}, }, { diff --git a/tools/nvim/lua/plugins/fileutils.lua b/tools/nvim/lua/plugins/fileutils.lua index d195e48..56a79e2 100644 --- a/tools/nvim/lua/plugins/fileutils.lua +++ b/tools/nvim/lua/plugins/fileutils.lua @@ -1,17 +1,18 @@ return { { "rmagatti/auto-session", - lazy = false, + event = "BufReadPre", opts = { suppressed_dirs = { "~/", "~/Projects", "~/Downloads", "/" }, }, }, - { import = "plugins.mod.nvim-tree" }, + -- { import = "plugins.mod.nvim-tree" }, { import = "plugins.mod.telescope" }, -- { import = "plugins.mod.fzf" }, { "ahmedkhalf/project.nvim", + event = "VeryLazy", opts = { detection_methods = { "lsp", "pattern" }, patterns = { ".git", "Makefile", "package.json" }, @@ -46,5 +47,14 @@ return { -- }, { "NeogitOrg/neogit", + -- dependencies = { + -- "nvim-lua/plenary.nvim", -- required + -- "nvim-telescope/telescope.nvim", -- optional + -- }, + config = true, + -- event = "VeryLazy", + cmd = { + "Neogit", + }, }, } diff --git a/tools/nvim/lua/plugins/lsp.lua b/tools/nvim/lua/plugins/lsp.lua index 7bc52b0..db5238b 100644 --- a/tools/nvim/lua/plugins/lsp.lua +++ b/tools/nvim/lua/plugins/lsp.lua @@ -12,6 +12,7 @@ return { }, { "js0ny/luasnip-latex-snippets.nvim", + ft = { "tex", "markdown" }, -- vimtex isn't required if using treesitter requires = { "L3MON4D3/LuaSnip", "lervag/vimtex" }, config = function() @@ -20,10 +21,18 @@ return { require("luasnip").config.setup({ enable_autosnippets = true }) end, }, - { "williamboman/mason.nvim", config = true }, + { + "williamboman/mason.nvim", + cmd = "Mason", + build = ":MasonUpdate", + opts_extend = { "ensure_installed" }, + opts = { + ensure_installed = require("config.servers").servers, + }, + }, { "williamboman/mason-lspconfig.nvim", - lazy = false, + event = "BufReadPre", dependencies = { { "williamboman/mason.nvim" }, { "neovim/nvim-lspconfig" }, @@ -34,7 +43,7 @@ return { }, }, { import = "plugins.mod.conform-nvim" }, - { "nvim-treesitter/nvim-treesitter-context" }, + { "nvim-treesitter/nvim-treesitter-context", lazy = true }, { "NoahTheDuke/vim-just", ft = { "just" }, @@ -58,9 +67,9 @@ return { highlight = { enable = true }, indent = { enable = true }, }, - config = function(_, opts) - require("nvim-treesitter.configs").setup(opts) - end, + -- config = function(_, opts) + -- require("nvim-treesitter.configs").setup(opts) + -- end, }, { "folke/lazydev.nvim", diff --git a/tools/nvim/lua/plugins/misc.lua b/tools/nvim/lua/plugins/misc.lua index e80320d..1db8a99 100644 --- a/tools/nvim/lua/plugins/misc.lua +++ b/tools/nvim/lua/plugins/misc.lua @@ -1,23 +1,24 @@ return { + { "nvim-lua/plenary.nvim", lazy = true }, { "wakatime/vim-wakatime", lazy = false }, { import = "plugins.mod.toggleterm" }, - { - "CRAG666/code_runner.nvim", - config = true, - keys = { - { "cr", "RunCode", desc = "Run code" }, - }, - dependencies = { - - { - "CRAG666/betterTerm.nvim", - opts = { - position = "bot", - size = 15, - }, - }, - }, - }, + -- { + -- "CRAG666/code_runner.nvim", + -- config = true, + -- keys = { + -- { "cr", "RunCode", desc = "Run code" }, + -- }, + -- dependencies = { + -- + -- { + -- "CRAG666/betterTerm.nvim", + -- opts = { + -- position = "bot", + -- size = 15, + -- }, + -- }, + -- }, + -- }, { import = "plugins.mod.which-keys-nvim" }, { import = "plugins.mod.copilot-lua" }, { import = "plugins.mod.avante-nvim" }, @@ -27,7 +28,8 @@ return { cmd = { "Leet", }, - event = "VeryLazy", + lazy = true, + -- event = "VeryLazy", dependencies = { "nvim-telescope/telescope.nvim", -- "ibhagwan/fzf-lua", diff --git a/tools/nvim/lua/plugins/mod/avante-nvim.lua b/tools/nvim/lua/plugins/mod/avante-nvim.lua index 8911077..9e8ea29 100644 --- a/tools/nvim/lua/plugins/mod/avante-nvim.lua +++ b/tools/nvim/lua/plugins/mod/avante-nvim.lua @@ -33,6 +33,8 @@ return { -- support for image pasting "HakonHarnes/img-clip.nvim", event = "VeryLazy", + ft = { "avante", "markdown", "typst", "org", "tex" }, + cmd = "PasteImage", opts = { -- recommended settings default = { diff --git a/tools/nvim/lua/plugins/mod/blink-cmp.lua b/tools/nvim/lua/plugins/mod/blink-cmp.lua index 75fe1d7..9de0911 100644 --- a/tools/nvim/lua/plugins/mod/blink-cmp.lua +++ b/tools/nvim/lua/plugins/mod/blink-cmp.lua @@ -1,10 +1,11 @@ return { "saghen/blink.cmp", -- optional: provides snippets for the snippet source - dependencies = { "L3MON4D3/LuaSnip", version = "v2.*" }, + -- dependencies = { "L3MON4D3/LuaSnip", version = "v2.*" }, -- use a release tag to download pre-built binaries version = "*", + event = "InsertEnter", ---@module 'blink.cmp' ---@type blink.cmp.Config diff --git a/tools/nvim/lua/plugins/mod/bufferline.lua b/tools/nvim/lua/plugins/mod/bufferline.lua index 171898e..a284fd6 100644 --- a/tools/nvim/lua/plugins/mod/bufferline.lua +++ b/tools/nvim/lua/plugins/mod/bufferline.lua @@ -10,7 +10,7 @@ return { "akinsho/bufferline.nvim", dependencies = "nvim-tree/nvim-web-devicons", -- 图标支持 after = "catppuccin", - lazy = false, + event = "VeryLazy", keys = { { "b1", "BufferLineGotoBuffer 1", desc = "Switch to Buffer #1" }, { "b2", "BufferLineGotoBuffer 2", desc = "Switch to Buffer #2" }, diff --git a/tools/nvim/lua/plugins/mod/lang/markdown/init.lua b/tools/nvim/lua/plugins/mod/lang/markdown/init.lua index 9374576..cad97de 100644 --- a/tools/nvim/lua/plugins/mod/lang/markdown/init.lua +++ b/tools/nvim/lua/plugins/mod/lang/markdown/init.lua @@ -2,5 +2,5 @@ return { { import = "plugins.mod.lang.markdown.render-markdown" }, -- { import = "plugins.mod.lang.markdown.markview" }, { import = "plugins.mod.lang.markdown.obsidian-nvim" }, - { "bullets-vim/bullets.vim" }, + { "bullets-vim/bullets.vim", ft = "markdown" }, } diff --git a/tools/nvim/lua/plugins/mod/lang/markdown/render-markdown.lua b/tools/nvim/lua/plugins/mod/lang/markdown/render-markdown.lua index f89a3e1..f0434dd 100644 --- a/tools/nvim/lua/plugins/mod/lang/markdown/render-markdown.lua +++ b/tools/nvim/lua/plugins/mod/lang/markdown/render-markdown.lua @@ -1,7 +1,7 @@ return { { "MeanderingProgrammer/render-markdown.nvim", - lazy = false, + event = "BufRead", ft = { "markdown", "Avante" }, opts = { file_types = { "markdown", "Avante" }, diff --git a/tools/nvim/lua/plugins/mod/lang/org.lua b/tools/nvim/lua/plugins/mod/lang/org.lua index e97355d..f89f823 100644 --- a/tools/nvim/lua/plugins/mod/lang/org.lua +++ b/tools/nvim/lua/plugins/mod/lang/org.lua @@ -1,23 +1,23 @@ return { { - -- "js0ny/nvim-orgmode", - name = "orgmode", + "nvim-orgmode/orgmode", dependencies = { "nvim-telescope/telescope.nvim", "nvim-orgmode/telescope-orgmode.nvim", "nvim-orgmode/org-bullets.nvim", "Saghen/blink.cmp", }, - branch = "feat-image-match-latex", cmd = { "Org", }, + ft = { + "org", + "orgagenda", + }, keys = { { "A", "Org agenda", desc = "Org Agenda" }, }, - dir = "~/Source/Forks/nvim-orgmode", - dev = true, - event = "VeryLazy", + event = "BufEnter *.org", config = function() require("orgmode").setup({ org_agenda_files = "~/OrgFiles/tasks/*", diff --git a/tools/nvim/lua/plugins/mod/lualine/init.lua b/tools/nvim/lua/plugins/mod/lualine/init.lua index 7cdeb1c..2cf85d9 100644 --- a/tools/nvim/lua/plugins/mod/lualine/init.lua +++ b/tools/nvim/lua/plugins/mod/lualine/init.lua @@ -14,7 +14,7 @@ Remote | Git Branch | Diagnostics | Command | | MID | | Line:Column | Indent | E local config = { options = { disabled_filetypes = { - statusline = { "NvimTree", "alpha", "grug-far" }, + statusline = { "NvimTree", "alpha", "grug-far", "snacks_dashboard" }, }, -- Disable sections and component separators component_separators = { left = "", right = "" }, diff --git a/tools/nvim/lua/plugins/mod/nvim-lspconfig.lua b/tools/nvim/lua/plugins/mod/nvim-lspconfig.lua index e8dd9b8..3136516 100644 --- a/tools/nvim/lua/plugins/mod/nvim-lspconfig.lua +++ b/tools/nvim/lua/plugins/mod/nvim-lspconfig.lua @@ -1,6 +1,11 @@ return { "neovim/nvim-lspconfig", dependencies = { "saghen/blink.cmp" }, + event = { + "BufReadPost", + "BufWritePost", + "BufNewFile", + }, -- example using `opts` for defining servers opts = { diff --git a/tools/nvim/lua/plugins/mod/snacks-nvim.lua b/tools/nvim/lua/plugins/mod/snacks-nvim.lua index 282cf39..87dc536 100644 --- a/tools/nvim/lua/plugins/mod/snacks-nvim.lua +++ b/tools/nvim/lua/plugins/mod/snacks-nvim.lua @@ -7,17 +7,27 @@ return { ---@type snacks.Config opts = { -- bigfile = { enabled = true }, - -- dashboard = { enabled = true }, - -- explorer = { enabled = true }, - -- indent = { enabled = true }, + dashboard = { enabled = true }, + explorer = { enabled = true }, + indent = { enabled = true }, -- input = { enabled = true }, -- picker = { enabled = true }, -- notifier = { enabled = true }, -- quickfile = { enabled = true }, -- scope = { enabled = true }, -- scroll = { enabled = true }, - -- statuscolumn = { enabled = true }, + statuscolumn = { enabled = true }, -- words = { enabled = true }, image = { enabled = true }, }, + keys = { + { + "ft", + function() + require("snacks").explorer() + end + , + desc = "Toggle File Explorer" + }, + } } diff --git a/tools/nvim/lua/plugins/mod/telescope.lua b/tools/nvim/lua/plugins/mod/telescope.lua index 34027ca..e55145d 100644 --- a/tools/nvim/lua/plugins/mod/telescope.lua +++ b/tools/nvim/lua/plugins/mod/telescope.lua @@ -1,5 +1,6 @@ return { "nvim-telescope/telescope.nvim", + cmd = "Telescope", opts = { defaults = { prompt_prefix = require("config.icons").telescope, @@ -28,24 +29,24 @@ return { }, dependencies = { "nvim-lua/plenary.nvim" }, keys = { - { "", "Telescope find_files", desc = "Find Files" }, - { "fc", "Telescope find_files cwd=~/.config/nvim", desc = "Edit configs" }, - { "/", "Telescope live_grep", desc = "Grep Files" }, - { ";", "Telescope", desc = "Show Telescope Commands" }, - { "ui", "Telescope colorscheme", desc = "Change colorscheme" }, - { "pp", "Telescope projects", desc = "List all Projects" }, - { "pg", "Telescope projects", desc = "List all Git Projects" }, - { "ps", "Telescope session-lens", desc = "List all sessions" }, - { "gs", "Telescope git_status", desc = "Git Status" }, - { "gt", "Telescope git_branches", desc = "Git Branches" }, - { "gc", "Telescope git_commits", desc = "Show commits" }, - { "fb", "Telescope buffers", desc = "List Buffers" }, - { "ff", "Telescope fd", desc = "Find Files" }, - { "fh", "Telescope oldfiles", desc = "Recent Files" }, - { "ce", "Telescope diagnostics", desc = "Navigate errors/warnings" }, - { "cs", "Telescope treesitter", desc = "Search symbols" }, - { "cS", "Telescope grep_string", desc = "Search current symbol" }, - { "bB", "Telescope buffers", desc = "List Buffers" }, - { "fl", "Telescope filetypes", desc = "Set Filetype/Lang to ..." }, + { "", "Telescope find_files", desc = "Find Files" }, + { "fc", "Telescope find_files cwd=~/.config/nvim", desc = "Edit configs" }, + { "/", "Telescope live_grep", desc = "Grep Files" }, + { ";", "Telescope", desc = "Show Telescope Commands" }, + { "ui", "Telescope colorscheme", desc = "Change colorscheme" }, + { "pp", "Telescope projects", desc = "List all Projects" }, + { "pg", "Telescope projects", desc = "List all Git Projects" }, + { "ps", "Telescope session-lens", desc = "List all sessions" }, + { "gs", "Telescope git_status", desc = "Git Status" }, + { "gt", "Telescope git_branches", desc = "Git Branches" }, + { "gc", "Telescope git_commits", desc = "Show commits" }, + { "fb", "Telescope buffers", desc = "List Buffers" }, + { "ff", "Telescope fd", desc = "Find Files" }, + { "fh", "Telescope oldfiles", desc = "Recent Files" }, + { "ce", "Telescope diagnostics", desc = "Navigate errors/warnings" }, + { "cs", "Telescope treesitter", desc = "Search symbols" }, + { "cS", "Telescope grep_string", desc = "Search current symbol" }, + { "bB", "Telescope buffers", desc = "List Buffers" }, + { "fl", "Telescope filetypes", desc = "Set Filetype/Lang to ..." }, }, } From 124703b2e0f2dc6bda266f9c0f49dc18aaeed4f7 Mon Sep 17 00:00:00 2001 From: js0ny Date: Wed, 26 Mar 2025 16:43:51 +0000 Subject: [PATCH 11/35] feat?(nvim): Migrate to 0.11 --- tools/nvim/lsp/clangd.lua | 5 +++ tools/nvim/lsp/luals.lua | 1 + tools/nvim/lua/config/migration.lua | 14 +++++++ tools/nvim/lua/plugins/fileutils.lua | 5 ++- tools/nvim/lua/plugins/lsp.lua | 6 +-- tools/nvim/lua/plugins/mod/snacks-nvim.lua | 46 ++++++++++++++++++---- 6 files changed, 66 insertions(+), 11 deletions(-) create mode 100644 tools/nvim/lsp/clangd.lua create mode 100644 tools/nvim/lsp/luals.lua create mode 100644 tools/nvim/lua/config/migration.lua diff --git a/tools/nvim/lsp/clangd.lua b/tools/nvim/lsp/clangd.lua new file mode 100644 index 0000000..427d4b4 --- /dev/null +++ b/tools/nvim/lsp/clangd.lua @@ -0,0 +1,5 @@ +return { + cmd = { "clangd", "--background-index" }, + root_markers = { "compile_commands.json", "compile_flags.txt", ".clangd" }, + filetypes = { "c", "cpp" }, +} diff --git a/tools/nvim/lsp/luals.lua b/tools/nvim/lsp/luals.lua new file mode 100644 index 0000000..a564707 --- /dev/null +++ b/tools/nvim/lsp/luals.lua @@ -0,0 +1 @@ +return {} diff --git a/tools/nvim/lua/config/migration.lua b/tools/nvim/lua/config/migration.lua new file mode 100644 index 0000000..cbc7c1e --- /dev/null +++ b/tools/nvim/lua/config/migration.lua @@ -0,0 +1,14 @@ +local nvim_version = vim.version() + +if nvim_version.minor ~= 11 then + return +end + +vim.diagnostic.config({ + virtual_lines = true, +}) + +vim.lsp.enable({ + "clangd", + "luals", +}) diff --git a/tools/nvim/lua/plugins/fileutils.lua b/tools/nvim/lua/plugins/fileutils.lua index 56a79e2..c1c6154 100644 --- a/tools/nvim/lua/plugins/fileutils.lua +++ b/tools/nvim/lua/plugins/fileutils.lua @@ -2,7 +2,10 @@ return { { "rmagatti/auto-session", event = "BufReadPre", - + cmd = { + "SessionSearch", + "SessionSave", + }, opts = { suppressed_dirs = { "~/", "~/Projects", "~/Downloads", "/" }, }, diff --git a/tools/nvim/lua/plugins/lsp.lua b/tools/nvim/lua/plugins/lsp.lua index db5238b..14b9a34 100644 --- a/tools/nvim/lua/plugins/lsp.lua +++ b/tools/nvim/lua/plugins/lsp.lua @@ -27,7 +27,7 @@ return { build = ":MasonUpdate", opts_extend = { "ensure_installed" }, opts = { - ensure_installed = require("config.servers").servers, + -- ensure_installed = require("config.servers").servers, }, }, { @@ -38,8 +38,8 @@ return { { "neovim/nvim-lspconfig" }, }, opts = { - ensure_installed = require("config.servers").servers, - automatic_installation = false, + -- ensure_installed = require("config.servers").servers, + -- automatic_installation = false, }, }, { import = "plugins.mod.conform-nvim" }, diff --git a/tools/nvim/lua/plugins/mod/snacks-nvim.lua b/tools/nvim/lua/plugins/mod/snacks-nvim.lua index 87dc536..632000c 100644 --- a/tools/nvim/lua/plugins/mod/snacks-nvim.lua +++ b/tools/nvim/lua/plugins/mod/snacks-nvim.lua @@ -7,11 +7,44 @@ return { ---@type snacks.Config opts = { -- bigfile = { enabled = true }, - dashboard = { enabled = true }, - explorer = { enabled = true }, + dashboard = { + enabled = true, + preset = { + keys = { + { key = "p", icon = "󰈞 ", desc = "查找项目", action = "Telescope projects" }, + { key = "h", icon = " ", desc = "历史文件", action = "Telescope oldfiles" }, + { key = "l", icon = " ", desc = "加载会话", action = "SessionSearch" }, + { + key = "c", + icon = " ", + desc = "转到设置", + action = "Telescope find_files cwd=~/.config/nvim", + }, + { key = "q", icon = "󱊷 ", desc = "退出", action = "qa" }, + }, + }, + sections = { + { section = "header" }, + { icon = " ", title = "Keymaps", section = "keys", indent = 2, padding = 1 }, + { icon = " ", title = "Recent Files", section = "recent_files", indent = 2, padding = 1 }, + { icon = " ", title = "Projects", section = "projects", indent = 2, padding = 1 }, + { section = "startup" }, + }, + }, + explorer = { + -- TODO: Remap some keys in explorer + -- win = { + -- list = { + -- keys = { + -- ["l"] = "focus_input", + -- ["i"] = "confirm", + -- ["O"] = "explorer_open", -- Open with system default + -- }, + -- }, + -- }, + }, indent = { enabled = true }, -- input = { enabled = true }, - -- picker = { enabled = true }, -- notifier = { enabled = true }, -- quickfile = { enabled = true }, -- scope = { enabled = true }, @@ -25,9 +58,8 @@ return { "ft", function() require("snacks").explorer() - end - , - desc = "Toggle File Explorer" + end, + desc = "Toggle File Explorer", }, - } + }, } From 8dc68ca138d17d696f435c315aa8d485559c013e Mon Sep 17 00:00:00 2001 From: js0ny Date: Wed, 2 Apr 2025 19:26:14 +0100 Subject: [PATCH 12/35] chore(linux): Minor change --- platforms/linux/hypr/.gitignore | 1 + platforms/linux/hypr/hypridle.conf | 14 +++++++++++ platforms/linux/hypr/hyprland.conf | 34 ++++++++++++++------------ platforms/linux/kde/kglobalshortcutsrc | 12 +++++---- platforms/linux/neovide.toml | 26 ++++++++++++++++++++ platforms/linux/user-dirs.dirs | 9 +++++-- platforms/linux/user-dirs.locale | 1 + 7 files changed, 75 insertions(+), 22 deletions(-) create mode 100644 platforms/linux/hypr/.gitignore create mode 100644 platforms/linux/hypr/hypridle.conf create mode 100644 platforms/linux/neovide.toml create mode 100644 platforms/linux/user-dirs.locale diff --git a/platforms/linux/hypr/.gitignore b/platforms/linux/hypr/.gitignore new file mode 100644 index 0000000..5df1b9b --- /dev/null +++ b/platforms/linux/hypr/.gitignore @@ -0,0 +1 @@ +.sass-cache diff --git a/platforms/linux/hypr/hypridle.conf b/platforms/linux/hypr/hypridle.conf new file mode 100644 index 0000000..6451aac --- /dev/null +++ b/platforms/linux/hypr/hypridle.conf @@ -0,0 +1,14 @@ +general { + lock_cmd = notify-send "lock!" # dbus/sysd lock command (loginctl lock-session) + unlock_cmd = notify-send "unlock!" # same as above, but unlock + before_sleep_cmd = notify-send "Zzz" # command ran before sleep + after_sleep_cmd = notify-send "Awake!" # command ran after sleep + ignore_dbus_inhibit = false # whether to ignore dbus-sent idle-inhibit requests (used by e.g. firefox or steam) + ignore_systemd_inhibit = false # whether to ignore systemd-inhibit --what=idle inhibitors +} + +listener { + timeout = 600 # in seconds + on-timeout = notify-send "You are idle!" # command to run when timeout has passed + on-resume = notify-send "Welcome back!" # command to run when activity is detected after timeout has fired. +} diff --git a/platforms/linux/hypr/hyprland.conf b/platforms/linux/hypr/hyprland.conf index 6d9a6aa..5330165 100644 --- a/platforms/linux/hypr/hyprland.conf +++ b/platforms/linux/hypr/hyprland.conf @@ -44,7 +44,7 @@ xwayland { # monitor=,preferred,auto,auto # Format: # MONITOR_NAME,RESOLUTION@REFRESH_RATE,OFFSET_XxOFFSET_Y,SCALE -monitor=DP-2,3840x2160@59,0x0,1.666667 +monitor=DP-2,3840x2160@60,0x0,1.875 ################### @@ -56,7 +56,7 @@ monitor=DP-2,3840x2160@59,0x0,1.666667 # Set programs that you use $terminal = kitty $fileManager = dolphin -$menu = wofi +$menu = rofi ################# @@ -68,11 +68,11 @@ $menu = wofi # exec-once = $terminal # exec-once = nm-applet & -# exec-once = waybar & hyprpaper & mako & systemctl --user start hyprpolkitagent & fcitx5 & albert # Top Bar exec-once = waybar & # Notifications exec-once = mako & +# exec-once = hyprpanel & # wallpapers exec-once = hyprpaper & # Authentication agent @@ -147,12 +147,12 @@ decoration { active_opacity = 1.0 inactive_opacity = 1.0 - # shadow { - # enabled = true - # range = 4 - # render_power = 3 - # color = $base - # } + shadow { + enabled = true + range = 4 + render_power = 3 + color = $base + } # https://wiki.hyprland.org/Configuring/Variables/#blur blur { @@ -231,7 +231,7 @@ input { kb_layout = us kb_variant = kb_model = - kb_options = caps:escape + kb_options = kb_rules = follow_mouse = 1 @@ -266,12 +266,12 @@ $mainMod = SUPER # Sets "Windows" key as main modifier # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more bind = $mainMod, R, exec, $terminal bind = $mainMod, Q, killactive, -bind = $mainMod, M, exit, +# bind = $mainMod, M, exit, bind = $mainMod, F, exec, $fileManager -bind = $mainMod, V, exec, cliphist list | wofi --dmenu | cliphist decode | wl-copy -bind = $mainMod SHIFT, V, togglefloating +bind = $mainMod, V, exec, cliphist list | rofi --dmenu | cliphist decode | wl-copy +bind = $mainMod SHIFT, F, togglefloating -bind = $mainMod, space, exec, $menu +bind = alt, space, exec, $menu -show drun bind = $mainMod, P, pseudo, # dwindle bind = $mainMod, X, togglesplit, # dwindle @@ -284,8 +284,12 @@ bind = $mainMod, h, movefocus, l bind = $mainMod, i, movefocus, r bind = $mainMod, e, movefocus, u bind = $mainMod, n, movefocus, d +bind = $mainMod alt, h, swapwindow, l +bind = $mainMod alt, i, swapwindow, r +bind = $mainMod alt, e, swapwindow, u +bind = $mainMod alt, n, swapwindow, d -bind = $mainMod, c, exec, grimblast copy area +bind = $mainMod, c, exec, hyprshot -m region -o $HOME/Pictures/Screenshots/ # Switch workspaces with mainMod + [0-9] bind = $mainMod, 1, workspace, 1 diff --git a/platforms/linux/kde/kglobalshortcutsrc b/platforms/linux/kde/kglobalshortcutsrc index e80a834..a74c408 100644 --- a/platforms/linux/kde/kglobalshortcutsrc +++ b/platforms/linux/kde/kglobalshortcutsrc @@ -41,7 +41,7 @@ mute=Volume Mute,Volume Mute,静音 [krusader] _k_friendly_name=Krusader -bring_main_window_to_top=Meta+K,Meta+K,Bring Main Window to Top +bring_main_window_to_top=none,Meta+K,Bring Main Window to Top [ksmserver] Halt Without Confirmation=none,,关机 (无需确认) @@ -172,14 +172,14 @@ Window Custom Quick Tile Bottom=none,,自定义快速铺放窗口到下方 Window Custom Quick Tile Left=none,,自定义快速铺放窗口到左侧 Window Custom Quick Tile Right=none,,自定义快速铺放窗口到右侧 Window Custom Quick Tile Top=none,,自定义快速铺放窗口到上方 -Window Fullscreen=none,,全屏显示窗口 +Window Fullscreen=Meta+F11,,全屏显示窗口 Window Grow Horizontal=none,,水平扩展窗口 Window Grow Vertical=none,,垂直扩展窗口 Window Lower=none,,降低窗口 Window Maximize=Meta+PgUp,Meta+PgUp,最大化窗口 Window Maximize Horizontal=none,,水平最大化窗口 Window Maximize Vertical=none,,垂直最大化窗口 -Window Minimize=Meta+PgDown,Meta+PgDown,最小化窗口 +Window Minimize=Meta+PgDown\tMeta+M,Meta+PgDown,最小化窗口 Window Move=none,,移动窗口 Window Move Center=none,,移动窗口到中央 Window No Border=none,,显示/隐藏窗口标题栏和框架 @@ -229,7 +229,7 @@ Window to Desktop 5=Meta+%,,窗口移动到桌面 5 Window to Desktop 6=Meta+^,,窗口移动到桌面 6 Window to Desktop 7=Meta+&,,窗口移动到桌面 7 Window to Desktop 8=Meta+*,,窗口移动到桌面 8 -Window to Desktop 9=none,,窗口移动到桌面 9 +Window to Desktop 9=Meta+(,,窗口移动到桌面 9 Window to Next Desktop=none,,窗口移动到下一桌面 Window to Next Screen=Meta+Shift+Right,Meta+Shift+Right,移动窗口到下一屏幕 Window to Previous Desktop=none,,窗口移动到上一桌面 @@ -288,6 +288,8 @@ activate task manager entry 6=none,Meta+6,激活任务管理器条目 6 activate task manager entry 7=none,Meta+7,激活任务管理器条目 7 activate task manager entry 8=none,Meta+8,激活任务管理器条目 8 activate task manager entry 9=none,Meta+9,激活任务管理器条目 9 +activate widget 115=none,none,激活 应用程序启动器 挂件 +activate widget 120=none,none,激活 数字时钟 挂件 activate widget 3=none,none,Activate Application Launcher Widget clear-history=none,,清除剪贴板历史(L) clipboard_action=Meta+Ctrl+X,Meta+Ctrl+X,自动弹出操作菜单 @@ -316,7 +318,7 @@ _launch=Meta+F _launch=none [services][org.kde.krunner.desktop] -_launch=Alt+F2\tSearch\tAlt+Space +_launch=Alt+F2\tMeta+K\tSearch\tAlt+Space [services][org.kde.kscreen.desktop] ShowOSD=Display diff --git a/platforms/linux/neovide.toml b/platforms/linux/neovide.toml new file mode 100644 index 0000000..93cf59c --- /dev/null +++ b/platforms/linux/neovide.toml @@ -0,0 +1,26 @@ +# $XDG_CONFIG_HOME/neovide/config.toml +# ln -sf $DOTFILES/mac/neovide.toml $XDG_CONFIG_HOME/neovide/config.toml +# New-Item -ItemType SymbolicLink -Path $Env:XDG_CONFIG_HOME/neovide/config.toml -Value $DOTFILES\mac\neovide.toml (Mac) +# https://neovide.dev/config-file.html?highlight=toml#config-file +# 设置为 fork 默认后台运行,不会占用终端 +fork = true +# frame = "full" +idle = true +maximized = false +# neovim-bin = "/opt/homebrew/bin/nvim" +frame = "transparent" +no-multigrid = false +srgb = false +tabs = true +theme = "auto" +title-hidden = true +vsync = true +wsl = false + +[font] +normal = [ + "Maple Mono NF CN", + "Iosevka Nerd Font", + "霞鹜文楷等宽", +] # Will use the bundled Fira Code Nerd Font by default +size = 14.0 diff --git a/platforms/linux/user-dirs.dirs b/platforms/linux/user-dirs.dirs index fd18e7b..ae7f277 100644 --- a/platforms/linux/user-dirs.dirs +++ b/platforms/linux/user-dirs.dirs @@ -1,5 +1,10 @@ -# Force to use English for directory names - +# This file is written by xdg-user-dirs-update +# If you want to change or add directories, just edit the line you're +# interested in. All local changes will be retained on the next run. +# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped +# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an +# absolute path. No other format is supported. +# XDG_DESKTOP_DIR="$HOME/Desktop" XDG_DOWNLOAD_DIR="$HOME/Downloads" XDG_TEMPLATES_DIR="$HOME/Templates" diff --git a/platforms/linux/user-dirs.locale b/platforms/linux/user-dirs.locale new file mode 100644 index 0000000..2c28678 --- /dev/null +++ b/platforms/linux/user-dirs.locale @@ -0,0 +1 @@ +zh_CN \ No newline at end of file From 0164b1ca8a42b776639ec9e7214db1e44a960e62 Mon Sep 17 00:00:00 2001 From: js0ny Date: Wed, 2 Apr 2025 19:26:55 +0100 Subject: [PATCH 13/35] fix(emacs): Use `:custom` and follow naming convention --- tools/doom/config.el | 10 +++++---- tools/emacs.d/.gitignore | 2 ++ tools/emacs.d/lisp/init-evil.el | 6 ++++-- tools/emacs.d/lisp/init-org.el | 37 +++++++-------------------------- 4 files changed, 20 insertions(+), 35 deletions(-) diff --git a/tools/doom/config.el b/tools/doom/config.el index 8bf26d8..0ea0060 100644 --- a/tools/doom/config.el +++ b/tools/doom/config.el @@ -133,10 +133,12 @@ (if (eq system-type 'gnu/linux) (use-package! rime - :config - (setq default-input-method "rime") - (add-hook! (org-mode markdown-mode) (activate-input-method default-input-method)) - (setq rime-user-data-dir (expand-file-name "emacs-rime" (getenv "XDG_CONFIG_HOME"))) + :custom + (rime-user-data-dir (expand-file-name "emacs-rime" (getenv "XDG_CONFIG_HOME"))) + ; (rime-share-data-dir "~/.local/share/fcitx5/rime") + (default-input-method "rime") + ;; :config + ;; (add-hook! (org-mode markdown-mode) (activate-input-method default-input-method)) )) (load! "calendar.el") diff --git a/tools/emacs.d/.gitignore b/tools/emacs.d/.gitignore index f889e69..62c7ec6 100644 --- a/tools/emacs.d/.gitignore +++ b/tools/emacs.d/.gitignore @@ -26,3 +26,5 @@ bookmarks .cache eln-cache org-persist + +local.el diff --git a/tools/emacs.d/lisp/init-evil.el b/tools/emacs.d/lisp/init-evil.el index 183c22a..470917a 100644 --- a/tools/emacs.d/lisp/init-evil.el +++ b/tools/emacs.d/lisp/init-evil.el @@ -44,8 +44,10 @@ (global-evil-leader-mode) (evil-leader/set-leader "") (evil-leader/set-key - "b" 'buffer-menu - "ft" 'treemacs)) + "ft" 'treemacs + "fc" '(dired user-emacs-directory) + "b" 'buffer-menu + )) ;; Evil Commentary: Use gc to toggle comments (use-package evil-commentary diff --git a/tools/emacs.d/lisp/init-org.el b/tools/emacs.d/lisp/init-org.el index 086cca9..2259899 100644 --- a/tools/emacs.d/lisp/init-org.el +++ b/tools/emacs.d/lisp/init-org.el @@ -98,13 +98,13 @@ ;; For CJK users ;; Insert zero width space around the emphasis symbols, this might be useful for ;; languages that does not rely on space -(defun my/insert-emphasis-with-zws (char) +(defun js0ny/insert-emphasis-with-zws (char) (interactive "c") (insert ?\u200B char) (save-excursion (insert char ?\u200B))) -(global-set-key (kbd "C-c b") (lambda () (interactive) (my/insert-emphasis-with-zws ?*))) -(global-set-key (kbd "C-c i") (lambda () (interactive) (my/insert-emphasis-with-zws ?/))) +(global-set-key (kbd "C-c b") (lambda () (interactive) (js0ny/insert-emphasis-with-zws ?*))) +(global-set-key (kbd "C-c i") (lambda () (interactive) (js0ny/insert-emphasis-with-zws ?/))) ;; Pomodoro for org clock (use-package org-pomodoro) @@ -213,7 +213,7 @@ ;; Integrate Emacs Timer with System Notifications ;; 定义通知函数 -(defun my/org-clock-notification (title message &optional icon) +(defun js0ny/org-clock-notification (title message &optional icon) "发送一个系统通知" (alert message :title title @@ -221,7 +221,7 @@ :category 'org-clock)) ;; 添加定时器检查函数 -(defun my/org-clock-check-timer () +(defun js0ny/org-clock-check-timer () "检查当前正在运行的 clock 是否到期" (when (org-clocking-p) (let* ((clocked-time (org-clock-get-clocked-time)) @@ -230,45 +230,24 @@ "0"))) (remaining (- effort clocked-time))) (when (and (> effort 0) (<= remaining 0)) - (my/org-clock-notification + (js0ny/org-clock-notification "Org Clock 提醒" (format "任务 '%s' 的预计时间已到!" (org-clock-get-clock-string))))))) ;; 设置定时器,每分钟检查一次 -(run-with-timer 0 60 #'my/org-clock-check-timer) +(run-with-timer 0 60 #'js0ny/org-clock-check-timer) ;; 在 org-clock-in-hook 中添加检查 (add-hook 'org-clock-in-hook (lambda () (let ((effort (org-entry-get (point) "Effort"))) (when effort - (my/org-clock-notification + (js0ny/org-clock-notification "开始计时" (format "开始计时任务: %s\n预计用时: %s" (org-get-heading t t t t) effort)))))) -(use-package org-roam - :ensure t - :custom - (org-roam-directory (file-truename (concat org-directory "roam"))) - :bind (("C-c n l" . org-roam-buffer-toggle) - ("C-c n f" . org-roam-node-find) - ("C-c n g" . org-roam-graph) - ("C-c n i" . org-roam-node-insert) - ("C-c n c" . org-roam-capture) - ;; Dailies - ("C-c n j" . org-roam-dailies-capture-today)) - :config - ;; If you're using a vertical completion framework, you might want a more informative completion interface - (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag))) - (setq org-roam-db-location (expand-file-name "org-roam.db" user-emacs-data)) - (org-roam-db-autosync-mode) - ;; If using org-roam-protocol - (require 'org-roam-protocol)) - - (provide 'init-org) - From e8d55687453420d489b4ed305a550f7b06a461cd Mon Sep 17 00:00:00 2001 From: js0ny Date: Wed, 2 Apr 2025 19:29:45 +0100 Subject: [PATCH 14/35] feat(keymaps): Use `cd` to LSP Rename (N) --- tools/fish/.gitignore | 1 + tools/kitty/kitty.conf | 14 ++++---------- tools/nvim/lua/keymaps/lspkeys.lua | 31 ++++++++++++++++++++++++++++++ tools/vscode/vscode.vimrc | 2 ++ tools/zed/keymap.json | 16 ++++++++++++++- tools/zed/settings.json | 3 +++ 6 files changed, 56 insertions(+), 11 deletions(-) diff --git a/tools/fish/.gitignore b/tools/fish/.gitignore index cafc8ed..1784bfc 100644 --- a/tools/fish/.gitignore +++ b/tools/fish/.gitignore @@ -1,3 +1,4 @@ fish_variables completions functions/br.fish +functions/dotenv.fish diff --git a/tools/kitty/kitty.conf b/tools/kitty/kitty.conf index e7b86d0..e9393a4 100644 --- a/tools/kitty/kitty.conf +++ b/tools/kitty/kitty.conf @@ -3,10 +3,10 @@ # Fonts {{{ # Family -font_family family="Sarasa Term SC Nerd Font" -bold_font auto -italic_font auto -bold_italic_font auto +font_family family="Maple Mono NF CN" +bold_font auto +italic_font auto +bold_italic_font auto # Ligature disable_ligatures never @@ -79,9 +79,3 @@ map ctrl+shift+enter toggle_layout stack # }}} -# BEGIN_KITTY_FONTS -font_family family="Sarasa Term SC Nerd Font" -bold_font auto -italic_font auto -bold_italic_font auto -# END_KITTY_FONTS diff --git a/tools/nvim/lua/keymaps/lspkeys.lua b/tools/nvim/lua/keymaps/lspkeys.lua index 737d4fe..e972217 100644 --- a/tools/nvim/lua/keymaps/lspkeys.lua +++ b/tools/nvim/lua/keymaps/lspkeys.lua @@ -7,6 +7,37 @@ local M = { { keys = ",", cmd = vim.lsp.buf.code_action, opts = { desc = "Code Action" } }, { keys = "ga", cmd = vim.lsp.buf.code_action, opts = { desc = "Code Action" } }, { keys = "gh", cmd = vim.lsp.buf.hover, opts = { desc = "Show hover" } }, + -- [c]hange [d]efinition + { keys = "cd", cmd = vim.lsp.buf.rename, opts = { desc = "Rename symbol under cursor" } }, } +-- local function smart_split_definition() +-- local width = vim.api.nvim_win_get_width(0) +-- if width > 80 then -- Adjust 80 to your preference +-- vim.api.nvim_command("vsp") +-- else +-- vim.api.nvim_command("sp") +-- end +-- vim.lsp.buf.definition() +-- end +-- vim.keymap.set("n", "d", smart_split_definition, { desc = "Go to Definition (Smart Split)" }) + +local function smart_split(func) + local width = vim.api.nvim_win_get_width(0) + if width > 80 then + vim.api.nvim_command("vsp") + else + vim.api.nvim_command("sp") + end + func() +end + +vim.keymap.set("n", "d", function() + smart_split(vim.lsp.buf.definition) +end, { desc = "Go to Definition (Smart Split)" }) + +vim.keymap.set("n", "D", function() + smart_split(vim.lsp.buf.declaration) +end, { desc = "Go to Declaration (Smart Split)" }) + return M diff --git a/tools/vscode/vscode.vimrc b/tools/vscode/vscode.vimrc index 2ced56a..0578a25 100644 --- a/tools/vscode/vscode.vimrc +++ b/tools/vscode/vscode.vimrc @@ -59,6 +59,8 @@ noremap gr editor.action.goToReferences noremap gpr editor.action.referenceSearch.trigger noremap ga editor.action.quickFix +" Rename, or [c]hange [d]efinition +noremap cd editor.action.rename " Requires matchit by redguardtoo " nnoremap % extension.matchitJumpItems diff --git a/tools/zed/keymap.json b/tools/zed/keymap.json index 5d66f96..516848a 100644 --- a/tools/zed/keymap.json +++ b/tools/zed/keymap.json @@ -47,7 +47,21 @@ "bindings": { "N": "vim::JoinLines", "l": "vim::InsertBefore", - "L": "vim::InsertFirstNonWhitespace", + "L": "vim::InsertFirstNonWhitespace" + } + }, + { + "context": "vim_mode == visual || vim_mode == operator", + + "bindings": { + "H": "vim::StartOfLine", + "I": "vim::EndOfLine" + } + }, + { + "context": "vim_mode == normal", + + "bindings": { "H": "pane::ActivatePrevItem", "I": "pane::ActivateNextItem" } diff --git a/tools/zed/settings.json b/tools/zed/settings.json index fc127f3..af1df69 100644 --- a/tools/zed/settings.json +++ b/tools/zed/settings.json @@ -18,6 +18,9 @@ // custom settings, run `zed: open default settings` from the // command palette (cmd-shift-p / ctrl-shift-p) { + "outline_panel": { + "dock": "right" + }, "edit_predictions": { "disabled_globs": ["*.bean"], "mode": "eager_preview", From 4da1667c54f1ce613dbb168c50e373618e6e2b94 Mon Sep 17 00:00:00 2001 From: js0ny Date: Wed, 2 Apr 2025 19:32:34 +0100 Subject: [PATCH 15/35] chore(nvim): Remove useless comments --- tools/browser/surfingkeys.js | 10 ++++++++ tools/nvim/lua/config/servers.lua | 1 - tools/nvim/lua/plugins/appearance.lua | 30 ------------------------ tools/nvim/lua/plugins/completion.lua | 8 ------- tools/nvim/lua/plugins/fileutils.lua | 25 -------------------- tools/nvim/lua/plugins/init.lua | 4 ---- tools/nvim/lua/plugins/lsp.lua | 10 +------- tools/nvim/lua/plugins/misc.lua | 21 ----------------- tools/nvim/lua/plugins/mod/blink-cmp.lua | 6 +++++ tools/nvim/lua/plugins/mod/lang/org.lua | 4 +++- 10 files changed, 20 insertions(+), 99 deletions(-) diff --git a/tools/browser/surfingkeys.js b/tools/browser/surfingkeys.js index adb94ec..f000a4f 100644 --- a/tools/browser/surfingkeys.js +++ b/tools/browser/surfingkeys.js @@ -341,6 +341,16 @@ mapkey("yY", "yank link without parameter", function () { Clipboard.write(url.origin + url.pathname); }); +unmap("yma") +unmap("ymc") +unmap("ymv") + +map("ym", "yank link as markdown", function () { + const url = new URL(window.location.href); + const title = document.title; + Clipboard.write(`[${title}](${url.origin + url.pathname})`); +}); + // #region bilibili.com mapkey( ",n", diff --git a/tools/nvim/lua/config/servers.lua b/tools/nvim/lua/config/servers.lua index c1c3434..0b2b37a 100644 --- a/tools/nvim/lua/config/servers.lua +++ b/tools/nvim/lua/config/servers.lua @@ -7,7 +7,6 @@ local M = {} M.servers = { "bashls", -- Bash "clangd", -- C/C++ - "eslint", -- JavaScript "gopls", -- Go "html", -- HTML "jsonls", -- JSON diff --git a/tools/nvim/lua/plugins/appearance.lua b/tools/nvim/lua/plugins/appearance.lua index e75155a..16a06b9 100644 --- a/tools/nvim/lua/plugins/appearance.lua +++ b/tools/nvim/lua/plugins/appearance.lua @@ -34,10 +34,7 @@ return { }, cmd = "Telescope colorscheme", }, - -- { "olimorris/onedarkpro.nvim", cmd = "Telescope colorscheme" }, { "rebelot/kanagawa.nvim", cmd = "Telescope colorscheme" }, - -- -- Highlight objects under the cursor - -- { "RRethy/vim-illuminate" }, { -- Modern Status Line "nvim-lualine/lualine.nvim", dependencies = { "nvim-tree/nvim-web-devicons" }, @@ -46,18 +43,6 @@ return { require("plugins.mod.lualine") end, }, - -- { -- Highlight yanked text - -- "gbprod/yanky.nvim", - -- event = "LazyFile", - -- opts = { - -- highlight = { - -- on_put = true, - -- on_yank = true, - -- timer = 500, - -- }, - -- }, - -- }, - -- { import = "plugins.mod.alpha-nvim" }, -- Dashboard { -- Breadcrumb "Bekaboo/dropbar.nvim", dependencies = { @@ -108,19 +93,4 @@ return { opts = {}, dependencies = { "nvim-lua/plenary.nvim" }, }, - -- { - -- "folke/noice.nvim", - -- event = "VeryLazy", - -- opts = { - -- -- add any options here - -- }, - -- dependencies = { - -- -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries - -- "MunifTanjim/nui.nvim", - -- -- OPTIONAL: - -- -- `nvim-notify` is only needed, if you want to use the notification view. - -- -- If not available, we use `mini` as the fallback - -- "rcarriga/nvim-notify", - -- }, - -- }, } diff --git a/tools/nvim/lua/plugins/completion.lua b/tools/nvim/lua/plugins/completion.lua index 98ef519..b53d6ea 100644 --- a/tools/nvim/lua/plugins/completion.lua +++ b/tools/nvim/lua/plugins/completion.lua @@ -1,8 +1,4 @@ return { - -- { import = "plugins.mod.nvim-cmp" }, - -- { - -- "saadparwaiz1/cmp_luasnip", - -- }, { import = "plugins.mod.blink-cmp" }, { "L3MON4D3/LuaSnip", @@ -12,8 +8,4 @@ return { require("luasnip.loaders.from_vscode").lazy_load({ paths = "~/.config/lsp-snippets" }) end, }, - -- { - -- "zbirenbaum/copilot-cmp", - -- opts = {}, - -- }, } diff --git a/tools/nvim/lua/plugins/fileutils.lua b/tools/nvim/lua/plugins/fileutils.lua index c1c6154..2ae591f 100644 --- a/tools/nvim/lua/plugins/fileutils.lua +++ b/tools/nvim/lua/plugins/fileutils.lua @@ -28,34 +28,9 @@ return { end, dependencies = { "nvim-telescope/telescope.nvim" }, }, - -- { - -- "kdheepak/lazygit.nvim", - -- lazy = true, - -- cmd = { - -- "LazyGit", - -- "LazyGitConfig", - -- "LazyGitCurrentFile", - -- "LazyGitFilter", - -- "LazyGitFilterCurrentFile", - -- }, - -- -- optional for floating window border decoration - -- dependencies = { - -- "nvim-lua/plenary.nvim", - -- }, - -- -- setting the keybinding for LazyGit with 'keys' is recommended in - -- -- order to load the plugin when the command is run for the first time - -- keys = { - -- { "gg", "LazyGit", desc = "LazyGit" }, - -- }, - -- }, { "NeogitOrg/neogit", - -- dependencies = { - -- "nvim-lua/plenary.nvim", -- required - -- "nvim-telescope/telescope.nvim", -- optional - -- }, config = true, - -- event = "VeryLazy", cmd = { "Neogit", }, diff --git a/tools/nvim/lua/plugins/init.lua b/tools/nvim/lua/plugins/init.lua index 4bb32b4..dacc8df 100644 --- a/tools/nvim/lua/plugins/init.lua +++ b/tools/nvim/lua/plugins/init.lua @@ -3,7 +3,6 @@ require("plugins.lazy-nvim") -- Setup lazy.nvim require("lazy").setup({ spec = { - -- import your plugins { import = "plugins.appearance" }, { import = "plugins.completion" }, { import = "plugins.fileutils" }, @@ -12,8 +11,5 @@ require("lazy").setup({ { import = "plugins.edit" }, { import = "plugins.misc" }, }, - -- Configure any other settings here. See the documentation for more details. - -- colorscheme that will be used when installing plugins. - -- automatically check for plugin updates checker = { enabled = false }, }) diff --git a/tools/nvim/lua/plugins/lsp.lua b/tools/nvim/lua/plugins/lsp.lua index 14b9a34..ef3e472 100644 --- a/tools/nvim/lua/plugins/lsp.lua +++ b/tools/nvim/lua/plugins/lsp.lua @@ -3,10 +3,7 @@ return { { "lervag/vimtex", ft = { "tex", "bib" }, - -- lazy = false, -- we don't want to lazy load VimTeX - -- tag = "v2.15", -- uncomment to pin to a specific release init = function() - -- VimTeX configuration goes here, e.g. vim.g.vimtex_view_method = "okular" end, }, @@ -25,7 +22,7 @@ return { "williamboman/mason.nvim", cmd = "Mason", build = ":MasonUpdate", - opts_extend = { "ensure_installed" }, + -- opts_extend = { "ensure_installed" }, opts = { -- ensure_installed = require("config.servers").servers, }, @@ -67,17 +64,12 @@ return { highlight = { enable = true }, indent = { enable = true }, }, - -- config = function(_, opts) - -- require("nvim-treesitter.configs").setup(opts) - -- end, }, { "folke/lazydev.nvim", ft = "lua", -- only load on lua files opts = { library = { - -- See the configuration section for more details - -- Load luvit types when the `vim.uv` word is found { path = "${3rd}/luv/library", words = { "vim%.uv" } }, }, }, diff --git a/tools/nvim/lua/plugins/misc.lua b/tools/nvim/lua/plugins/misc.lua index 1db8a99..3514978 100644 --- a/tools/nvim/lua/plugins/misc.lua +++ b/tools/nvim/lua/plugins/misc.lua @@ -2,23 +2,6 @@ return { { "nvim-lua/plenary.nvim", lazy = true }, { "wakatime/vim-wakatime", lazy = false }, { import = "plugins.mod.toggleterm" }, - -- { - -- "CRAG666/code_runner.nvim", - -- config = true, - -- keys = { - -- { "cr", "RunCode", desc = "Run code" }, - -- }, - -- dependencies = { - -- - -- { - -- "CRAG666/betterTerm.nvim", - -- opts = { - -- position = "bot", - -- size = 15, - -- }, - -- }, - -- }, - -- }, { import = "plugins.mod.which-keys-nvim" }, { import = "plugins.mod.copilot-lua" }, { import = "plugins.mod.avante-nvim" }, @@ -32,7 +15,6 @@ return { -- event = "VeryLazy", dependencies = { "nvim-telescope/telescope.nvim", - -- "ibhagwan/fzf-lua", "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim", }, @@ -41,8 +23,5 @@ return { }, }, { import = "plugins.mod.image-nvim" }, - -- "3rd/image.nvim", - -- opts = {}, - -- }, { import = "plugins.mod.snacks-nvim" }, } diff --git a/tools/nvim/lua/plugins/mod/blink-cmp.lua b/tools/nvim/lua/plugins/mod/blink-cmp.lua index 9de0911..9735dfb 100644 --- a/tools/nvim/lua/plugins/mod/blink-cmp.lua +++ b/tools/nvim/lua/plugins/mod/blink-cmp.lua @@ -10,6 +10,12 @@ return { ---@module 'blink.cmp' ---@type blink.cmp.Config opts = { + enabled = function() + if vim.fn.getcmdtype() ~= "" then + return true + end + return not vim.tbl_contains({ "TelescopePrompt", "dap-repl", "snacks_picker_list" }, vim.bo.filetype) + end, keymap = { preset = "default", [""] = { diff --git a/tools/nvim/lua/plugins/mod/lang/org.lua b/tools/nvim/lua/plugins/mod/lang/org.lua index f89f823..76d0175 100644 --- a/tools/nvim/lua/plugins/mod/lang/org.lua +++ b/tools/nvim/lua/plugins/mod/lang/org.lua @@ -22,7 +22,7 @@ return { require("orgmode").setup({ org_agenda_files = "~/OrgFiles/tasks/*", org_default_notes_file = "~/OrgFiles/tasks/inbox.org", - org_archive_location = "~/OrgFiles/archive/%s_archive::", + org_archive_location = "~/OrgFiles/.archive/%s_archive::", org_todo_keywords = { "TODO(t)", "NEXT(n)", "WAIT(w)", "|", "DONE(d)", "CANCELLED(c)" }, org_hide_leading_stars = true, org_hide_emphasis_markers = true, @@ -38,12 +38,14 @@ return { org_agenda_set_tags = "", org_agenda_earlier = { "[[", "<" }, org_agenda_later = { "]]", ">" }, + org_agenda_archive = "$", }, org = { org_deadline = "", org_schedule = "", org_todo = "", org_set_tags_command = "", + org_archive_subtree = "$", }, }, }) From 9315c6e55de0e303e79a9630113c87e385188a38 Mon Sep 17 00:00:00 2001 From: js0ny Date: Wed, 2 Apr 2025 20:09:30 +0100 Subject: [PATCH 16/35] feat!(nvim): Migrate to v0.11 built-in lsp configs --- Justfile | 31 +++++++++++++-- tools/nvim/init.lua | 1 + tools/nvim/lsp/bashls.lua | 15 ++++++++ tools/nvim/lsp/clangd.lua | 29 +++++++++++++- tools/nvim/lsp/gopls.lua | 19 ++++++++++ tools/nvim/lsp/jsonls.lua | 18 +++++++++ tools/nvim/lsp/luals.lua | 38 ++++++++++++++++++- tools/nvim/lsp/pyright.lua | 27 +++++++++++++ tools/nvim/lsp/rust_analyzer.lua | 33 ++++++++++++++++ tools/nvim/lsp/taplo.lua | 32 ++++++++++++++++ tools/nvim/lsp/vimls.lua | 19 ++++++++++ tools/nvim/lsp/yamlls.lua | 9 +++++ tools/nvim/lua/config/migration.lua | 25 ++++++++++-- tools/nvim/lua/plugins/lsp.lua | 26 ++++++------- tools/nvim/lua/plugins/mod/nvim-lspconfig.lua | 8 ---- tools/nvim/readme.md | 4 ++ 16 files changed, 303 insertions(+), 31 deletions(-) create mode 100644 tools/nvim/lsp/bashls.lua create mode 100644 tools/nvim/lsp/gopls.lua create mode 100644 tools/nvim/lsp/jsonls.lua create mode 100644 tools/nvim/lsp/pyright.lua create mode 100644 tools/nvim/lsp/rust_analyzer.lua create mode 100644 tools/nvim/lsp/taplo.lua create mode 100644 tools/nvim/lsp/vimls.lua create mode 100644 tools/nvim/lsp/yamlls.lua create mode 100644 tools/nvim/readme.md diff --git a/Justfile b/Justfile index 8746a66..f27306c 100644 --- a/Justfile +++ b/Justfile @@ -1,8 +1,9 @@ -set shell := ["fish", "-c"] +# set shell := ["fish", "-c"] +set shell := ["bash", "-c"] set windows-shell := ["pwsh", "-c"] -PLATFORM := \ +OS := \ if os() == "linux" { if env("WSL_DISTRO_NAME","") != "" { "wsl" @@ -93,7 +94,7 @@ vivaldi: [linux] systemd: - ln -sf {{DOTFILES}}/platforms/{{PLATFORM}}/systemd {{XDG_CONFIG_HOME}}/systemd/ + ln -sf {{DOTFILES}}/platforms/{{OS}}/systemd {{XDG_CONFIG_HOME}}/systemd/ uv: @@ -129,6 +130,12 @@ neovim: {{LN}} {{DOTFILES}}/tools/nvim {{XDG_CONFIG_HOME}}/nvim nvim --headless +checkhealth +"w nvim-healthcheck.txt" +qall +[unix] +neovide: + which neovide + -mkdir -p {{XDG_CONFIG_HOME}}/neovide + {{LN}} {{DOTFILES}}/platforms/{{OS}}/neovide.toml {{XDG_CONFIG_HOME}}/neovide/config.toml + [unix] thunderbird: curl -L https://github.com/wshanks/tbkeys/releases/download/v2.4.0/tbkeys.xpi -o "$HOME/Downloads/tbkeys.xpi" @@ -168,6 +175,24 @@ kitty: zotero: curl -L https://github.com/syt2/zotero-addons/releases/download/V1.8.1/zotero-addons.xpi -o "$HOME/Downloads/zotero-addons.xpi" +[unix] +fish: + {{LN}} {{DOTFILES}}/tools/fish {{XDG_CONFIG_HOME}}/fish + curl -L https://raw.githubusercontent.com/SpaceAceMonkey/dotenv-for-fish/refs/heads/main/dotenv.fish -o "{{DOTFILES}}/tools/fish/functions/dotenv.fish" + + +[unix] +zsh: + -[[ -f /etc/zshenv ]] && sudo cp {{DOTFILES}}/tools/zsh/global.zshenv /etc/zshenv # or /etc/zsh/zshenv + -[[ -f /etc/zsh/zshenv ]] && sudo cp {{DOTFILES}}/tools/zsh/global.zshenv /etc/zsh/zshenv + mkdir -p {{XDG_CONFIG_HOME}}/zsh + {{LN}} {{DOTFILES}}/tools/zsh/zshenv {{XDG_CONFIG_HOME}}/zsh/.zshenv + {{LN}} {{DOTFILES}}/tools/zsh/zshrc {{XDG_CONFIG_HOME}}/zsh/.zshrc + {{LN}} {{DOTFILES}}/tools/zsh/zprofile {{XDG_CONFIG_HOME}}/zsh/.zprofile + test -d {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-autosuggestions || git clone --depth 1 https://github.com/zsh-users/zsh-autosuggestions.git {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-autosuggestions + test -d {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-syntax-highlighting || git clone --depth 1 https://github.com/zsh-users/zsh-syntax-highlighting.git {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-syntax-highlighting + test -d {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-history-substring-search || git clone --depth 1 https://github.com/zsh-users/zsh-history-substring-search.git {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-history-substring-search + test -d {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-completions || git clone --depth 1 https://github.com/zsh-users/zsh-completions.git {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-completions [linux] flatpak: diff --git a/tools/nvim/init.lua b/tools/nvim/init.lua index 215b740..364ba8a 100644 --- a/tools/nvim/init.lua +++ b/tools/nvim/init.lua @@ -16,6 +16,7 @@ else -- Vanilla neovim end require("config.keymaps") require("config.diagnostics") +require("config.migration") -- If current session is spawn by neovide, do: if vim.g.neovide then diff --git a/tools/nvim/lsp/bashls.lua b/tools/nvim/lsp/bashls.lua new file mode 100644 index 0000000..5a759cc --- /dev/null +++ b/tools/nvim/lsp/bashls.lua @@ -0,0 +1,15 @@ +-- Bash +--[[ Installation +brew install bash-language-server +npm i -g bash-language-server +dnf install -y nodejs-bash-language-server # Fedora Linux +--]] +return { + cmd = { "bash-language-server", "start" }, + filetypes = { "bash", "sh" }, + settings = { + bashIde = { + globPattern = vim.env.GLOB_PATTERN or "*@(.sh|.inc|.bash|.command)", + }, + }, +} diff --git a/tools/nvim/lsp/clangd.lua b/tools/nvim/lsp/clangd.lua index 427d4b4..d9b1b41 100644 --- a/tools/nvim/lsp/clangd.lua +++ b/tools/nvim/lsp/clangd.lua @@ -1,5 +1,30 @@ +-- C/C++ +-- Clangd requires compile_commands.json to work and the easiest way to generate it is to use CMake. +-- How to use clangd C/C++ LSP in any project: https://gist.github.com/Strus/042a92a00070a943053006bf46912ae9 + return { - cmd = { "clangd", "--background-index" }, - root_markers = { "compile_commands.json", "compile_flags.txt", ".clangd" }, + cmd = { + "clangd", + "--clang-tidy", + "--header-insertion=iwyu", + "--completion-style=detailed", + "--function-arg-placeholders", + "--fallback-style=none", + }, filetypes = { "c", "cpp" }, + root_markers = { + ".clangd", + ".clang-format", + "compile_commands.json", + "compile_flags.txt", + ".git", + }, + capabilities = { + textDocument = { + completion = { + editsNearCursor = true, + }, + }, + offsetEncoding = { "utf-8", "utf-16" }, + }, } diff --git a/tools/nvim/lsp/gopls.lua b/tools/nvim/lsp/gopls.lua new file mode 100644 index 0000000..0833e6c --- /dev/null +++ b/tools/nvim/lsp/gopls.lua @@ -0,0 +1,19 @@ +-- Golang +--[[ Installation +go install golang.org/x/tools/gopls@latest +brew install gopls +--]] +return { + cmd = { "gopls" }, + filetypes = { "go", "gomod", "gowork", "gotmpl" }, + root_markers = { "go.work", "go.mod", ".git" }, + settings = { + gopls = { + analyses = { + unusedparams = true, + }, + staticcheck = true, + -- semanticTokens = true, -- go's semantic token highlight is not accurate so far + }, + }, +} diff --git a/tools/nvim/lsp/jsonls.lua b/tools/nvim/lsp/jsonls.lua new file mode 100644 index 0000000..38b625d --- /dev/null +++ b/tools/nvim/lsp/jsonls.lua @@ -0,0 +1,18 @@ +-- JSON +--[[ +npm i vscode-json-languageserver +--]] +return { + cmd = { "vscode-json-language-server", "--stdio" }, + filetypes = { "json", "jsonc" }, + root_markers = { ".git" }, + init_options = { + provideFormatter = true, + }, + settings = { + -- See setting options + -- https://github.com/microsoft/vscode/tree/main/extensions/json-language-features/server#settings + json = { + }, + }, +} diff --git a/tools/nvim/lsp/luals.lua b/tools/nvim/lsp/luals.lua index a564707..f59f77a 100644 --- a/tools/nvim/lsp/luals.lua +++ b/tools/nvim/lsp/luals.lua @@ -1 +1,37 @@ -return {} +-- Lua +--[[ Installation +scoop install lua-language-server +brew install lua-language-server +sudo port install lua-language-server +--]] +--[[ Build: Ninja & C++17 Required +git clone https://github.com/LuaLS/lua-language-server --depth 1 +cd lua-language-server +./make.sh +--]] +--[[ Note: For building from source, wrapper script is required +Accompanied with a wrapper script +#!/bin/bash +exec "$HOME/.local/build/lua-language-server/bin/lua-language-server" "$@" +--]] +return { + cmd = { "lua-language-server" }, + root_markers = { + ".luarc.json", + ".luarc.jsonc", + ".luacheckrc", + ".stylua.toml", + "stylua.toml", + "selene.toml", + "selene.yml", + }, + filetypes = { "lua" }, + settings = { + Lua = { + hint = { + enable = true, + setType = true, + }, + }, + }, +} diff --git a/tools/nvim/lsp/pyright.lua b/tools/nvim/lsp/pyright.lua new file mode 100644 index 0000000..8967cfc --- /dev/null +++ b/tools/nvim/lsp/pyright.lua @@ -0,0 +1,27 @@ +-- Python +--[[ Installation +uv tool install pyright +--]] +return { + cmd = { "pyright-langserver", "--stdio" }, + filetypes = { "python" }, + root_markers = { + ".python_version", + "pyproject.toml", + "setup.py", + "setup.cfg", + "requirements.txt", + "Pipfile", + "pyrightconfig.json", + ".git", + }, + settings = { + python = { + analysis = { + autoSearchPaths = true, + useLibraryCodeForTypes = true, + diagnosticMode = "openFilesOnly", + }, + }, + }, +} diff --git a/tools/nvim/lsp/rust_analyzer.lua b/tools/nvim/lsp/rust_analyzer.lua new file mode 100644 index 0000000..a2ba78f --- /dev/null +++ b/tools/nvim/lsp/rust_analyzer.lua @@ -0,0 +1,33 @@ +-- Rust +--[[ Installation +rustup component add rust-src +--]] +return { + cmd = { "rust-analyzer" }, + filetypes = { "rust" }, + root_dir = function(bufnr, cb) + local root = vim.fs.root(bufnr, { "Cargo.toml" }) + if root then + vim.system({ "cargo", "metadata", "--no-depts", "--format-version", "1" }, { cwd = root }, function(obj) + if obj.code ~= 0 then + cb(root) + else + local success, result = pcall(vim.json.decode, obj.stdout) + if success and result.workspace_root then + cb(result.workspace_root) + else + cb(root) + end + end + end) + else + cb(vim.fs.root(bufnr, { "rust-project.json", ".git" })) + end + end, + before_init = function(init_params, config) + -- See https://github.com/rust-lang/rust-analyzer/blob/eb5da56d839ae0a9e9f50774fa3eb78eb0964550/docs/dev/lsp-extensions.md?plain=1#L26 + if config.settings and config.settings["rust-analyzer"] then + init_params.initializationOptions = config.settings["rust-analyzer"] + end + end, +} diff --git a/tools/nvim/lsp/taplo.lua b/tools/nvim/lsp/taplo.lua new file mode 100644 index 0000000..1b9f634 --- /dev/null +++ b/tools/nvim/lsp/taplo.lua @@ -0,0 +1,32 @@ +-- TOML +--[[ Installation +cargo install taplo-cli --locked +brew install taplo +pnpm install -g @taplo/cli +--]] +return { + cmd = { "taplo", "lsp", "stdio" }, + filetypes = { "toml" }, + root_markers = { ".git" }, + settings = { + -- See all the setting options + -- https://github.com/tamasfe/taplo/blob/master/editors/vscode/package.json + evenBetterToml = { + taplo = { + configFile = { + enabled = true, + }, + }, + schema = { + enabled = true, + catalogs = { + "https://www.schemastore.org/api/json/catalog.json", + }, + cache = { + memoryExpiration = 60, + diskExpiration = 600, + }, + }, + }, + }, +} diff --git a/tools/nvim/lsp/vimls.lua b/tools/nvim/lsp/vimls.lua new file mode 100644 index 0000000..6e3de79 --- /dev/null +++ b/tools/nvim/lsp/vimls.lua @@ -0,0 +1,19 @@ +return { + cmd = { "vim-language-server", "--stdio" }, + filetypes = { "vim" }, + root_markers = { ".git" }, + init_options = { + isNeovim = true, + iskeyword = "@,48-57,_,192-255,-#", + vimruntime = "", + runtimepath = "", + diagnostic = { enable = true }, + indexes = { + runtimepath = true, + gap = 100, + count = 3, + projectRootPatterns = { "runtime", "nvim", ".git", "autoload", "plugin" }, + }, + suggest = { fromVimruntime = true, fromRuntimepath = true }, + }, +} diff --git a/tools/nvim/lsp/yamlls.lua b/tools/nvim/lsp/yamlls.lua new file mode 100644 index 0000000..b85e6ee --- /dev/null +++ b/tools/nvim/lsp/yamlls.lua @@ -0,0 +1,9 @@ +return { + cmd = { "yaml-language-server", "--stdio" }, + filetypes = { "yaml", "yaml.docker-compose", "yaml.gitlab" }, + root_markers = { ".git" }, + settings = { + yaml = { + }, + }, +} diff --git a/tools/nvim/lua/config/migration.lua b/tools/nvim/lua/config/migration.lua index cbc7c1e..9cb9236 100644 --- a/tools/nvim/lua/config/migration.lua +++ b/tools/nvim/lua/config/migration.lua @@ -1,14 +1,31 @@ local nvim_version = vim.version() + if nvim_version.minor ~= 11 then return end + vim.diagnostic.config({ virtual_lines = true, }) -vim.lsp.enable({ - "clangd", - "luals", -}) +-- vim.lsp.enable({ +-- "clangd", +-- "luals", +-- }) + +local lsp_configs = {} +for _, v in ipairs(vim.api.nvim_get_runtime_file('lsp/*', true)) do + local name = vim.fn.fnamemodify(v, ':t:r') + lsp_configs[name] = true +end + +vim.lsp.enable(vim.tbl_keys(lsp_configs)) + +-- Delete 0.11 new gr- keymaps +vim.keymap.del({ "n" }, "grn") +vim.keymap.del({ "n", "x" }, "gra") +vim.keymap.del({ "n" }, "gri") + + diff --git a/tools/nvim/lua/plugins/lsp.lua b/tools/nvim/lua/plugins/lsp.lua index ef3e472..8af33e4 100644 --- a/tools/nvim/lua/plugins/lsp.lua +++ b/tools/nvim/lua/plugins/lsp.lua @@ -1,5 +1,5 @@ return { - { import = "plugins.mod.nvim-lspconfig" }, + -- { import = "plugins.mod.nvim-lspconfig" }, { "lervag/vimtex", ft = { "tex", "bib" }, @@ -27,18 +27,18 @@ return { -- ensure_installed = require("config.servers").servers, }, }, - { - "williamboman/mason-lspconfig.nvim", - event = "BufReadPre", - dependencies = { - { "williamboman/mason.nvim" }, - { "neovim/nvim-lspconfig" }, - }, - opts = { - -- ensure_installed = require("config.servers").servers, - -- automatic_installation = false, - }, - }, + -- { + -- "williamboman/mason-lspconfig.nvim", + -- event = "BufReadPre", + -- dependencies = { + -- { "williamboman/mason.nvim" }, + -- { "neovim/nvim-lspconfig" }, + -- }, + -- opts = { + -- -- ensure_installed = require("config.servers").servers, + -- -- automatic_installation = false, + -- }, + -- }, { import = "plugins.mod.conform-nvim" }, { "nvim-treesitter/nvim-treesitter-context", lazy = true }, { diff --git a/tools/nvim/lua/plugins/mod/nvim-lspconfig.lua b/tools/nvim/lua/plugins/mod/nvim-lspconfig.lua index 3136516..4a9d190 100644 --- a/tools/nvim/lua/plugins/mod/nvim-lspconfig.lua +++ b/tools/nvim/lua/plugins/mod/nvim-lspconfig.lua @@ -38,11 +38,3 @@ return { end end, - -- example calling setup directly for each LSP - -- config = function() - -- local capabilities = require('blink.cmp').get_lsp_capabilities() - -- local lspconfig = require('lspconfig') - -- - -- lspconfig['lua_ls'].setup({ capabilities = capabilities }) - -- end -} diff --git a/tools/nvim/readme.md b/tools/nvim/readme.md new file mode 100644 index 0000000..72823e0 --- /dev/null +++ b/tools/nvim/readme.md @@ -0,0 +1,4 @@ +## Language Servers (v0.11) + +[References](https://github.com/rockyzhang24/dotfiles/tree/master/.config/nvim/lsp) + From 5f5e41c2471246352a4691ca1eca36ee789740d6 Mon Sep 17 00:00:00 2001 From: js0ny Date: Thu, 3 Apr 2025 01:09:07 +0100 Subject: [PATCH 17/35] feat(nvim): LSPs and refractor plugins.lang --- tools/nvim/lsp/beancount.lua | 16 +++++++ tools/nvim/lsp/markdown_oxide.lua | 15 +++++++ tools/nvim/lua/plugins/init.lua | 2 +- tools/nvim/lua/plugins/lang/beancount.lua | 13 ++++++ .../lua/plugins/{lsp.lua => lang/init.lua} | 43 ++++--------------- tools/nvim/lua/plugins/lang/just.lua | 4 ++ tools/nvim/lua/plugins/lang/lua.lua | 9 ++++ tools/nvim/lua/plugins/lang/markdown/init.lua | 6 +++ .../{mod => }/lang/markdown/markview.lua.bak | 0 .../{mod => }/lang/markdown/obsidian-nvim.lua | 0 .../lang/markdown/render-markdown.lua | 0 tools/nvim/lua/plugins/{mod => }/lang/org.lua | 0 tools/nvim/lua/plugins/lang/tex.lua | 7 +++ tools/nvim/lua/plugins/lang/typst.lua | 6 +++ .../lua/plugins/mod/lang/markdown/init.lua | 6 --- 15 files changed, 85 insertions(+), 42 deletions(-) create mode 100644 tools/nvim/lsp/beancount.lua create mode 100644 tools/nvim/lsp/markdown_oxide.lua create mode 100644 tools/nvim/lua/plugins/lang/beancount.lua rename tools/nvim/lua/plugins/{lsp.lua => lang/init.lua} (54%) create mode 100644 tools/nvim/lua/plugins/lang/just.lua create mode 100644 tools/nvim/lua/plugins/lang/lua.lua create mode 100644 tools/nvim/lua/plugins/lang/markdown/init.lua rename tools/nvim/lua/plugins/{mod => }/lang/markdown/markview.lua.bak (100%) rename tools/nvim/lua/plugins/{mod => }/lang/markdown/obsidian-nvim.lua (100%) rename tools/nvim/lua/plugins/{mod => }/lang/markdown/render-markdown.lua (100%) rename tools/nvim/lua/plugins/{mod => }/lang/org.lua (100%) create mode 100644 tools/nvim/lua/plugins/lang/tex.lua create mode 100644 tools/nvim/lua/plugins/lang/typst.lua delete mode 100644 tools/nvim/lua/plugins/mod/lang/markdown/init.lua diff --git a/tools/nvim/lsp/beancount.lua b/tools/nvim/lsp/beancount.lua new file mode 100644 index 0000000..d2e36e3 --- /dev/null +++ b/tools/nvim/lsp/beancount.lua @@ -0,0 +1,16 @@ +-- Beancount +--[[ Installation: +Dependency: +uv tool install beancount +LSP: +cargo install beancount-language-server +brew install beancount-language-server +--]] + + +return { + cmd = { "beancount-language-server" }, + filetypes = { "beancount" }, + settings = { + }, +} diff --git a/tools/nvim/lsp/markdown_oxide.lua b/tools/nvim/lsp/markdown_oxide.lua new file mode 100644 index 0000000..ca77e74 --- /dev/null +++ b/tools/nvim/lsp/markdown_oxide.lua @@ -0,0 +1,15 @@ +-- Markdown PKM +--[[ Installation: +cargo install --locked --git https://github.com/Feel-ix-343/markdown-oxide.git markdown-oxide +--]] +return { + cmd = { "markdown-oxide" }, + root_markers = { + ".obsidian", + }, + filetypes = { "markdown" }, + settings = { + Markdown = { + }, + }, +} diff --git a/tools/nvim/lua/plugins/init.lua b/tools/nvim/lua/plugins/init.lua index dacc8df..4cde917 100644 --- a/tools/nvim/lua/plugins/init.lua +++ b/tools/nvim/lua/plugins/init.lua @@ -6,7 +6,7 @@ require("lazy").setup({ { import = "plugins.appearance" }, { import = "plugins.completion" }, { import = "plugins.fileutils" }, - { import = "plugins.lsp" }, + { import = "plugins.lang" }, { import = "plugins.dap" }, { import = "plugins.edit" }, { import = "plugins.misc" }, diff --git a/tools/nvim/lua/plugins/lang/beancount.lua b/tools/nvim/lua/plugins/lang/beancount.lua new file mode 100644 index 0000000..3bff652 --- /dev/null +++ b/tools/nvim/lua/plugins/lang/beancount.lua @@ -0,0 +1,13 @@ +-- 在 init.lua 或者你的配置文件中添加 +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = "*.bean", + callback = function() + vim.bo.filetype = "beancount" + end, +}) + + +return { + "nathangrigg/vim-beancount", + ft = "beancount", +} diff --git a/tools/nvim/lua/plugins/lsp.lua b/tools/nvim/lua/plugins/lang/init.lua similarity index 54% rename from tools/nvim/lua/plugins/lsp.lua rename to tools/nvim/lua/plugins/lang/init.lua index 8af33e4..5d390eb 100644 --- a/tools/nvim/lua/plugins/lsp.lua +++ b/tools/nvim/lua/plugins/lang/init.lua @@ -1,23 +1,12 @@ return { - -- { import = "plugins.mod.nvim-lspconfig" }, - { - "lervag/vimtex", - ft = { "tex", "bib" }, - init = function() - vim.g.vimtex_view_method = "okular" - end, - }, - { - "js0ny/luasnip-latex-snippets.nvim", - ft = { "tex", "markdown" }, - -- vimtex isn't required if using treesitter - requires = { "L3MON4D3/LuaSnip", "lervag/vimtex" }, - config = function() - require("luasnip-latex-snippets").setup() - -- or setup({ use_treesitter = true }) - require("luasnip").config.setup({ enable_autosnippets = true }) - end, - }, + { import = "plugins.lang.org" }, + { import = "plugins.lang.markdown" }, + { import = "plugins.lang.just" }, + { import = "plugins.lang.typst" }, + { import = "plugins.lang.beancount" }, + { import = "plugins.lang.tex" }, + { import = "plugins.lang.lua" }, + { import = "plugins.mod.trouble-nvim" }, { "williamboman/mason.nvim", cmd = "Mason", @@ -41,13 +30,6 @@ return { -- }, { import = "plugins.mod.conform-nvim" }, { "nvim-treesitter/nvim-treesitter-context", lazy = true }, - { - "NoahTheDuke/vim-just", - ft = { "just" }, - }, - { import = "plugins.mod.lang.org" }, - { import = "plugins.mod.lang.markdown" }, - { import = "plugins.mod.trouble-nvim" }, { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate", @@ -65,13 +47,4 @@ return { indent = { enable = true }, }, }, - { - "folke/lazydev.nvim", - ft = "lua", -- only load on lua files - opts = { - library = { - { path = "${3rd}/luv/library", words = { "vim%.uv" } }, - }, - }, - }, } diff --git a/tools/nvim/lua/plugins/lang/just.lua b/tools/nvim/lua/plugins/lang/just.lua new file mode 100644 index 0000000..41ae68a --- /dev/null +++ b/tools/nvim/lua/plugins/lang/just.lua @@ -0,0 +1,4 @@ +return { + "NoahTheDuke/vim-just", + ft = { "just" }, +} diff --git a/tools/nvim/lua/plugins/lang/lua.lua b/tools/nvim/lua/plugins/lang/lua.lua new file mode 100644 index 0000000..39d161d --- /dev/null +++ b/tools/nvim/lua/plugins/lang/lua.lua @@ -0,0 +1,9 @@ +return { + "folke/lazydev.nvim", + ft = "lua", -- only load on lua files + opts = { + library = { + { path = "${3rd}/luv/library", words = { "vim%.uv" } }, + }, + }, +} diff --git a/tools/nvim/lua/plugins/lang/markdown/init.lua b/tools/nvim/lua/plugins/lang/markdown/init.lua new file mode 100644 index 0000000..0e05d47 --- /dev/null +++ b/tools/nvim/lua/plugins/lang/markdown/init.lua @@ -0,0 +1,6 @@ +return { + { import = "plugins.lang.markdown.render-markdown" }, + -- { import = "plugins.mod.lang.markdown.markview" }, + { import = "plugins.lang.markdown.obsidian-nvim" }, + { "bullets-vim/bullets.vim", ft = "markdown" }, +} diff --git a/tools/nvim/lua/plugins/mod/lang/markdown/markview.lua.bak b/tools/nvim/lua/plugins/lang/markdown/markview.lua.bak similarity index 100% rename from tools/nvim/lua/plugins/mod/lang/markdown/markview.lua.bak rename to tools/nvim/lua/plugins/lang/markdown/markview.lua.bak diff --git a/tools/nvim/lua/plugins/mod/lang/markdown/obsidian-nvim.lua b/tools/nvim/lua/plugins/lang/markdown/obsidian-nvim.lua similarity index 100% rename from tools/nvim/lua/plugins/mod/lang/markdown/obsidian-nvim.lua rename to tools/nvim/lua/plugins/lang/markdown/obsidian-nvim.lua diff --git a/tools/nvim/lua/plugins/mod/lang/markdown/render-markdown.lua b/tools/nvim/lua/plugins/lang/markdown/render-markdown.lua similarity index 100% rename from tools/nvim/lua/plugins/mod/lang/markdown/render-markdown.lua rename to tools/nvim/lua/plugins/lang/markdown/render-markdown.lua diff --git a/tools/nvim/lua/plugins/mod/lang/org.lua b/tools/nvim/lua/plugins/lang/org.lua similarity index 100% rename from tools/nvim/lua/plugins/mod/lang/org.lua rename to tools/nvim/lua/plugins/lang/org.lua diff --git a/tools/nvim/lua/plugins/lang/tex.lua b/tools/nvim/lua/plugins/lang/tex.lua new file mode 100644 index 0000000..cb9321d --- /dev/null +++ b/tools/nvim/lua/plugins/lang/tex.lua @@ -0,0 +1,7 @@ +return { + "lervag/vimtex", + ft = { "tex", "bib" }, + init = function() + vim.g.vimtex_view_method = "okular" + end, +} diff --git a/tools/nvim/lua/plugins/lang/typst.lua b/tools/nvim/lua/plugins/lang/typst.lua new file mode 100644 index 0000000..74aa279 --- /dev/null +++ b/tools/nvim/lua/plugins/lang/typst.lua @@ -0,0 +1,6 @@ +return { + 'chomosuke/typst-preview.nvim', + ft = { 'typst' }, + version = '1.*', + opts = {}, -- lazy.nvim will implicitly calls `setup {}` +} diff --git a/tools/nvim/lua/plugins/mod/lang/markdown/init.lua b/tools/nvim/lua/plugins/mod/lang/markdown/init.lua deleted file mode 100644 index cad97de..0000000 --- a/tools/nvim/lua/plugins/mod/lang/markdown/init.lua +++ /dev/null @@ -1,6 +0,0 @@ -return { - { import = "plugins.mod.lang.markdown.render-markdown" }, - -- { import = "plugins.mod.lang.markdown.markview" }, - { import = "plugins.mod.lang.markdown.obsidian-nvim" }, - { "bullets-vim/bullets.vim", ft = "markdown" }, -} From b0610adaaefbf4ad2a80fb87d6cdc8aaabfe99de Mon Sep 17 00:00:00 2001 From: js0ny Date: Thu, 3 Apr 2025 01:38:14 +0100 Subject: [PATCH 18/35] feat(nvim): Change explorer to `neo-tree` --- tools/nvim/lua/plugins/edit.lua | 48 +----------- tools/nvim/lua/plugins/fileutils.lua | 15 ++-- tools/nvim/lua/plugins/mod/mc.lua | 47 ++++++++++++ tools/nvim/lua/plugins/mod/neo-tree.lua | 89 ++++++++++++++++++++++ tools/nvim/lua/plugins/mod/snacks-nvim.lua | 38 ++++----- 5 files changed, 164 insertions(+), 73 deletions(-) create mode 100644 tools/nvim/lua/plugins/mod/mc.lua create mode 100644 tools/nvim/lua/plugins/mod/neo-tree.lua diff --git a/tools/nvim/lua/plugins/edit.lua b/tools/nvim/lua/plugins/edit.lua index dabc547..a414cda 100644 --- a/tools/nvim/lua/plugins/edit.lua +++ b/tools/nvim/lua/plugins/edit.lua @@ -12,53 +12,7 @@ return { { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, }, }, - { - "js0ny/multiple-cursors.nvim", - version = "*", -- Use the latest tagged version - -- opts = , -- This causes the plugin setup function to be called - keys = { - { "", "MultipleCursorsAddDown", mode = { "n", "x" }, desc = "Add cursor and move down" }, - { "", "MultipleCursorsAddUp", mode = { "n", "x" }, desc = "Add cursor and move up" }, - - { "", "MultipleCursorsAddUp", mode = { "n", "i", "x" }, desc = "Add cursor and move up" }, - { "", "MultipleCursorsAddDown", mode = { "n", "i", "x" }, desc = "Add cursor and move down" }, - - { "", "MultipleCursorsMouseAddDelete", mode = { "n", "i" }, desc = "Add or remove cursor" }, - }, - config = function() - local normal_mode_motion = require("multiple-cursors.normal_mode.motion") - local normal_mode_edit = require("multiple-cursors.normal_mode.edit") - - local visual_mode_edit = require("multiple-cursors.visual_mode.edit") - local normal_mode_mode_change = require("multiple-cursors.normal_mode.mode_change") - - local visual_mode_modify_area = require("multiple-cursors.visual_mode.modify_area") - require("multiple-cursors").setup({ - pre_hook = function() - require("nvim-autopairs").disable() - end, - post_hook = function() - require("nvim-autopairs").enable() - end, - custom_key_maps = { - { { "n", "x" }, { "e", "" }, normal_mode_motion.k, "nowrap" }, - { { "n", "x" }, { "n", "" }, normal_mode_motion.j, "nowrap" }, - { { "n", "x" }, { "i", "", "" }, normal_mode_motion.l, "nowrap" }, - { { "n", "x" }, "j", normal_mode_motion.e, "nowrap" }, - { { "n", "x" }, "J", normal_mode_motion.E, "nowrap" }, - { { "n", "x" }, "gj", normal_mode_motion.ge, "nowrap" }, - { { "n", "x" }, "gJ", normal_mode_motion.gE, "nowrap" }, - { "n", "E", normal_mode_edit.J, "nowrap" }, - { "n", "gE", normal_mode_edit.gJ, "nowrap" }, - { "n", { "l", "" }, normal_mode_mode_change.i, "nowrap" }, - { "n", "L", normal_mode_mode_change.I, "nowrap" }, - { "x", "l", visual_mode_modify_area.i, "nowrap" }, - { "x", "E", visual_mode_edit.J, "nowrap" }, - { "x", "gE", visual_mode_edit.gJ, "nowrap" }, - }, - }) - end, - }, + { import = "plugins.mod.mc" }, -- Multiple-cursors { import = "plugins.mod.autopairs" }, { "kylechui/nvim-surround", diff --git a/tools/nvim/lua/plugins/fileutils.lua b/tools/nvim/lua/plugins/fileutils.lua index 2ae591f..5f18020 100644 --- a/tools/nvim/lua/plugins/fileutils.lua +++ b/tools/nvim/lua/plugins/fileutils.lua @@ -28,11 +28,12 @@ return { end, dependencies = { "nvim-telescope/telescope.nvim" }, }, - { - "NeogitOrg/neogit", - config = true, - cmd = { - "Neogit", - }, - }, + -- { + -- "NeogitOrg/neogit", + -- config = true, + -- cmd = { + -- "Neogit", + -- }, + -- }, + { import = "plugins.mod.neo-tree" } } diff --git a/tools/nvim/lua/plugins/mod/mc.lua b/tools/nvim/lua/plugins/mod/mc.lua new file mode 100644 index 0000000..5c63338 --- /dev/null +++ b/tools/nvim/lua/plugins/mod/mc.lua @@ -0,0 +1,47 @@ +return { + "js0ny/multiple-cursors.nvim", + version = "*", -- Use the latest tagged version + -- opts = , -- This causes the plugin setup function to be called + keys = { + { "", "MultipleCursorsAddDown", mode = { "n", "x" }, desc = "Add cursor and move down" }, + { "", "MultipleCursorsAddUp", mode = { "n", "x" }, desc = "Add cursor and move up" }, + + { "", "MultipleCursorsAddUp", mode = { "n", "i", "x" }, desc = "Add cursor and move up" }, + { "", "MultipleCursorsAddDown", mode = { "n", "i", "x" }, desc = "Add cursor and move down" }, + + { "", "MultipleCursorsMouseAddDelete", mode = { "n", "i" }, desc = "Add or remove cursor" }, + }, + config = function() + local normal_mode_motion = require("multiple-cursors.normal_mode.motion") + local normal_mode_edit = require("multiple-cursors.normal_mode.edit") + + local visual_mode_edit = require("multiple-cursors.visual_mode.edit") + local normal_mode_mode_change = require("multiple-cursors.normal_mode.mode_change") + + local visual_mode_modify_area = require("multiple-cursors.visual_mode.modify_area") + require("multiple-cursors").setup({ + pre_hook = function() + require("nvim-autopairs").disable() + end, + post_hook = function() + require("nvim-autopairs").enable() + end, + custom_key_maps = { + { { "n", "x" }, { "e", "" }, normal_mode_motion.k, "nowrap" }, + { { "n", "x" }, { "n", "" }, normal_mode_motion.j, "nowrap" }, + { { "n", "x" }, { "i", "", "" }, normal_mode_motion.l, "nowrap" }, + { { "n", "x" }, "j", normal_mode_motion.e, "nowrap" }, + { { "n", "x" }, "J", normal_mode_motion.E, "nowrap" }, + { { "n", "x" }, "gj", normal_mode_motion.ge, "nowrap" }, + { { "n", "x" }, "gJ", normal_mode_motion.gE, "nowrap" }, + { "n", "E", normal_mode_edit.J, "nowrap" }, + { "n", "gE", normal_mode_edit.gJ, "nowrap" }, + { "n", { "l", "" }, normal_mode_mode_change.i, "nowrap" }, + { "n", "L", normal_mode_mode_change.I, "nowrap" }, + { "x", "l", visual_mode_modify_area.i, "nowrap" }, + { "x", "E", visual_mode_edit.J, "nowrap" }, + { "x", "gE", visual_mode_edit.gJ, "nowrap" }, + }, + }) + end, +} diff --git a/tools/nvim/lua/plugins/mod/neo-tree.lua b/tools/nvim/lua/plugins/mod/neo-tree.lua new file mode 100644 index 0000000..0502999 --- /dev/null +++ b/tools/nvim/lua/plugins/mod/neo-tree.lua @@ -0,0 +1,89 @@ +return { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + -- {"3rd/image.nvim", opts = {}}, -- Optional image support in preview window: See `# Preview Mode` for more information + }, + lazy = false, -- neo-tree will lazily load itself + ---@module "neo-tree" + ---@type neotree.Config? + opts = { + window = { +mappings = { + [""] = "noop", + ["e"] = "noop", + ["<2-LeftMouse>"] = "open", + [""] = "open", + ["i"] = "open", + [""] = "cancel", -- close preview or floating neo-tree window + ["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = true } }, + -- Read `# Preview Mode` for more information + -- ["i"] = "focus_preview", + ["S"] = "open_split", + ["s"] = "open_vsplit", + -- ["S"] = "split_with_window_picker", + -- ["s"] = "vsplit_with_window_picker", + ["t"] = "open_tabnew", + -- [""] = "open_drop", + -- ["t"] = "open_tab_drop", + ["w"] = "open_with_window_picker", + --["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing + ["C"] = "close_node", + -- ['C'] = 'close_all_subnodes', + ["z"] = "close_all_nodes", + --["Z"] = "expand_all_nodes", + ["a"] = { + "add", + -- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details + -- some commands may take optional config options, see `:h neo-tree-mappings` for details + config = { + show_path = "none", -- "none", "relative", "absolute" + }, + }, + ["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion. + ["d"] = "delete", + ["r"] = "rename", + ["b"] = "rename_basename", + ["y"] = "copy_to_clipboard", + ["x"] = "cut_to_clipboard", + ["p"] = "paste_from_clipboard", + ["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add": + -- ["c"] = { + -- "copy", + -- config = { + -- show_path = "none" -- "none", "relative", "absolute" + -- } + --} + ["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add". + ["q"] = "close_window", + ["R"] = "refresh", + ["?"] = "show_help", + ["<"] = "prev_source", + [">"] = "next_source", + ["l"] = "show_file_details", + -- ["i"] = { + -- "show_file_details", + -- -- format strings of the timestamps shown for date created and last modified (see `:h os.date()`) + -- -- both options accept a string or a function that takes in the date in seconds and returns a string to display + -- -- config = { + -- -- created_format = "%Y-%m-%d %I:%M %p", + -- -- modified_format = "relative", -- equivalent to the line below + -- -- modified_format = function(seconds) return require('neo-tree.utils').relative_date(seconds) end + -- -- } + -- }, + } + } + -- fill any relevant options here + }, + keys = { + { + "ft", + "Neotree toggle", + desc = "Toggle File Explorer", + } + } + +} diff --git a/tools/nvim/lua/plugins/mod/snacks-nvim.lua b/tools/nvim/lua/plugins/mod/snacks-nvim.lua index 632000c..6e33e1d 100644 --- a/tools/nvim/lua/plugins/mod/snacks-nvim.lua +++ b/tools/nvim/lua/plugins/mod/snacks-nvim.lua @@ -31,18 +31,18 @@ return { { section = "startup" }, }, }, - explorer = { - -- TODO: Remap some keys in explorer - -- win = { - -- list = { - -- keys = { - -- ["l"] = "focus_input", - -- ["i"] = "confirm", - -- ["O"] = "explorer_open", -- Open with system default - -- }, - -- }, - -- }, - }, + -- explorer = { + -- -- TODO: Remap some keys in explorer + -- -- win = { + -- -- list = { + -- -- keys = { + -- -- ["l"] = "focus_input", + -- -- ["i"] = "confirm", + -- -- ["O"] = "explorer_open", -- Open with system default + -- -- }, + -- -- }, + -- -- }, + -- }, indent = { enabled = true }, -- input = { enabled = true }, -- notifier = { enabled = true }, @@ -54,12 +54,12 @@ return { image = { enabled = true }, }, keys = { - { - "ft", - function() - require("snacks").explorer() - end, - desc = "Toggle File Explorer", - }, + -- { + -- "ft", + -- function() + -- require("snacks").explorer() + -- end, + -- desc = "Toggle File Explorer", + -- }, }, } From c86b0606d34eb95deee1e2d2b6bde9c14d0238e0 Mon Sep 17 00:00:00 2001 From: js0ny Date: Mon, 7 Apr 2025 08:46:31 +0100 Subject: [PATCH 19/35] feat(key): Better qwerty switch --- common/vimrc+qwerty.vimrc | 60 ++++++++++++++++++++++++++++++++ tools/tmux/+colemak.tmux | 12 +++++++ tools/tmux/+qwerty.tmux | 12 +++++++ {common => tools/tmux}/tmux.conf | 13 ++----- 4 files changed, 87 insertions(+), 10 deletions(-) create mode 100644 common/vimrc+qwerty.vimrc create mode 100644 tools/tmux/+colemak.tmux create mode 100644 tools/tmux/+qwerty.tmux rename {common => tools/tmux}/tmux.conf (84%) diff --git a/common/vimrc+qwerty.vimrc b/common/vimrc+qwerty.vimrc new file mode 100644 index 0000000..2c7a6a2 --- /dev/null +++ b/common/vimrc+qwerty.vimrc @@ -0,0 +1,60 @@ +" $XDG_CONFIG_HOME/vim/vimrc +" This is a minimal setup of vimrc +" ln -sf $DOTFILES/.config/vim/vimrc $XDG_CONFIG_HOME/vim/vimrc + +" Colemak Keys + +" Arrow remap +nnoremap J 5j +nnoremap K 5k +vnoremap H ^ +xnoremap H ^ +onoremap H ^ +vnoremap L $ +xnoremap L $ +onoremap L $ + +" Normal minimal setup + +noremap Y y$ +set expandtab +set tabstop=4 +set shiftwidth=4 +set autoindent +set smartindent +set wrap +set scrolloff=3 +set hlsearch +set incsearch +set ignorecase +set smartcase + +set number +set relativenumber + +set laststatus=2 +set showcmd +set statusline=%<%f\ %h%m%r\ %=\ [%l,%v]\ [%p%%]\ [\ %Y]\ [󱑉\ %{strftime('%H:%M:%S')}] + + +" XDG Directory Specifications +" Reference to https://jorenar.com/blog/vim-xdg + +if empty($XDG_CACHE_HOME) | let $XDG_CACHE_HOME = $HOME."/.cache" | endif +if empty($XDG_CONFIG_HOME) | let $XDG_CONFIG_HOME = $HOME."/.config" | endif +if empty($XDG_DATA_HOME) | let $XDG_DATA_HOME = $HOME."/.local/share" | endif +if empty($XDG_STATE_HOME) | let $XDG_STATE_HOME = $HOME."/.local/state" | endif + +set viminfo+=n$XDG_STATE_HOME/vim/viminfo +set packpath^=$XDG_DATA_HOME/vim +set packpath+=$XDG_DATA_HOME/vim/after +set backupdir=$XDG_STATE_HOME/vim/backup +set directory=$XDG_STATE_HOME/vim/swap +set undodir=$XDG_STATE_HOME/vim/undo +set viewdir=$XDG_STATE_HOME/vim/view +" set shada+=n$XDG_STATE_HOME/vim/shada +" Leader +let mapleader = "\" +nnoremap :FZF +" Misc +syntax on diff --git a/tools/tmux/+colemak.tmux b/tools/tmux/+colemak.tmux new file mode 100644 index 0000000..dd6c195 --- /dev/null +++ b/tools/tmux/+colemak.tmux @@ -0,0 +1,12 @@ +# vim: ft=tmux + +bind h select-pane -L +bind n select-pane -D +bind e select-pane -U +bind i select-pane -R +bind -r H resize-pane -L 5 +bind -r N resize-pane -D 5 +bind -r E resize-pane -U 5 +bind -r I resize-pane -R 5 +bind C-h select-window -t :- +bind C-i select-window -t :+ diff --git a/tools/tmux/+qwerty.tmux b/tools/tmux/+qwerty.tmux new file mode 100644 index 0000000..64b1366 --- /dev/null +++ b/tools/tmux/+qwerty.tmux @@ -0,0 +1,12 @@ +# vim: ft=tmux + +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R +bind -r H resize-pane -L 5 +bind -r J resize-pane -D 5 +bind -r K resize-pane -U 5 +bind -r L resize-pane -R 5 +bind C-h select-window -t :- +bind C-l select-window -t :+ diff --git a/common/tmux.conf b/tools/tmux/tmux.conf similarity index 84% rename from common/tmux.conf rename to tools/tmux/tmux.conf index 53131ce..b16d669 100644 --- a/common/tmux.conf +++ b/tools/tmux/tmux.conf @@ -52,17 +52,10 @@ bind | split-window -h unbind '"' bind - split-window -v unbind % -bind h select-pane -L -bind n select-pane -D -bind e select-pane -U -bind i select-pane -R -bind -r H resize-pane -L 5 -bind -r N resize-pane -D 5 -bind -r E resize-pane -U 5 -bind -r I resize-pane -R 5 -bind C-h select-window -t :- -bind C-i select-window -t :+ bind ` resize-pane -Z +source-file ~/.config/tmux/+colemak.tmux + + # Status Bar # ----------------- From 68fee530a11914d8d93ab3a18349ceb938635195 Mon Sep 17 00:00:00 2001 From: js0ny Date: Mon, 7 Apr 2025 08:46:53 +0100 Subject: [PATCH 20/35] feat(wezterm): Better qwerty switch --- tools/wezterm/appearance.lua | 2 +- tools/wezterm/keymaps.lua | 268 ------------------------------ tools/wezterm/keymaps/colemak.lua | 44 +++++ tools/wezterm/keymaps/init.lua | 183 ++++++++++++++++++++ tools/wezterm/keymaps/leaders.lua | 67 ++++++++ tools/wezterm/keymaps/qwerty.lua | 45 +++++ 6 files changed, 340 insertions(+), 269 deletions(-) delete mode 100644 tools/wezterm/keymaps.lua create mode 100644 tools/wezterm/keymaps/colemak.lua create mode 100644 tools/wezterm/keymaps/init.lua create mode 100644 tools/wezterm/keymaps/leaders.lua create mode 100644 tools/wezterm/keymaps/qwerty.lua diff --git a/tools/wezterm/appearance.lua b/tools/wezterm/appearance.lua index 23d2f7a..874b6e8 100644 --- a/tools/wezterm/appearance.lua +++ b/tools/wezterm/appearance.lua @@ -25,7 +25,7 @@ end return function(config) config.max_fps = 120 config.font = wezterm.font({ - family = "Sarasa Term SC Nerd Font", + family = "Maple Mono NF CN", }) config.color_scheme = scheme_for_appearance(get_appearance()) config.font_size = 12.0 diff --git a/tools/wezterm/keymaps.lua b/tools/wezterm/keymaps.lua deleted file mode 100644 index 25de9ea..0000000 --- a/tools/wezterm/keymaps.lua +++ /dev/null @@ -1,268 +0,0 @@ --- vim: foldmethod=marker foldmarker=#region,#endregion --- Reference to: https://github.com/KevinSilvester/wezterm-config/blob/master/config/bindings.lua -local wezterm = require("wezterm") -local action = wezterm.action -local act = wezterm.action -local os_type = require("utils").detected_os - -local SUPER - -if os_type.is_mac then - SUPER = "SUPER" -else - SUPER = "ALT" -end - --- #region Key Tables -local key_tables = { - copy_mode = { - -- #region Built-in CopyMode - -- This keymaps seems cannot be merged. - { key = "Tab", mods = "NONE", action = act.CopyMode("MoveForwardWord") }, - { key = "Tab", mods = "SHIFT", action = act.CopyMode("MoveBackwardWord") }, - { key = "Enter", mods = "NONE", action = act.CopyMode("MoveToStartOfNextLine") }, - { key = "Escape", mods = "NONE", action = act.Multiple({ "ScrollToBottom", { CopyMode = "Close" } }) }, - { key = "Space", mods = "NONE", action = act.CopyMode({ SetSelectionMode = "Cell" }) }, - { key = "$", mods = "NONE", action = act.CopyMode("MoveToEndOfLineContent") }, - { key = "$", mods = "SHIFT", action = act.CopyMode("MoveToEndOfLineContent") }, - { key = ",", mods = "NONE", action = act.CopyMode("JumpReverse") }, - { key = "0", mods = "NONE", action = act.CopyMode("MoveToStartOfLine") }, - { key = ";", mods = "NONE", action = act.CopyMode("JumpAgain") }, - { key = "F", mods = "NONE", action = act.CopyMode({ JumpBackward = { prev_char = false } }) }, - { key = "F", mods = "SHIFT", action = act.CopyMode({ JumpBackward = { prev_char = false } }) }, - { key = "G", mods = "NONE", action = act.CopyMode("MoveToScrollbackBottom") }, - { key = "G", mods = "SHIFT", action = act.CopyMode("MoveToScrollbackBottom") }, - { key = "H", mods = "NONE", action = act.CopyMode("MoveToViewportTop") }, - { key = "H", mods = "SHIFT", action = act.CopyMode("MoveToViewportTop") }, - { key = "L", mods = "NONE", action = act.CopyMode("MoveToViewportBottom") }, - { key = "L", mods = "SHIFT", action = act.CopyMode("MoveToViewportBottom") }, - { key = "M", mods = "NONE", action = act.CopyMode("MoveToViewportMiddle") }, - { key = "M", mods = "SHIFT", action = act.CopyMode("MoveToViewportMiddle") }, - { key = "O", mods = "NONE", action = act.CopyMode("MoveToSelectionOtherEndHoriz") }, - { key = "O", mods = "SHIFT", action = act.CopyMode("MoveToSelectionOtherEndHoriz") }, - { key = "T", mods = "NONE", action = act.CopyMode({ JumpBackward = { prev_char = true } }) }, - { key = "T", mods = "SHIFT", action = act.CopyMode({ JumpBackward = { prev_char = true } }) }, - { key = "V", mods = "NONE", action = act.CopyMode({ SetSelectionMode = "Line" }) }, - { key = "V", mods = "SHIFT", action = act.CopyMode({ SetSelectionMode = "Line" }) }, - { key = "^", mods = "NONE", action = act.CopyMode("MoveToStartOfLineContent") }, - { key = "^", mods = "SHIFT", action = act.CopyMode("MoveToStartOfLineContent") }, - { key = "b", mods = "NONE", action = act.CopyMode("MoveBackwardWord") }, - { key = "b", mods = "ALT", action = act.CopyMode("MoveBackwardWord") }, - { key = "b", mods = "CTRL", action = act.CopyMode("PageUp") }, - { key = "c", mods = "CTRL", action = act.Multiple({ "ScrollToBottom", { CopyMode = "Close" } }) }, - { key = "d", mods = "CTRL", action = act.CopyMode({ MoveByPage = 0.5 }) }, - { key = "e", mods = "NONE", action = act.CopyMode("MoveForwardWordEnd") }, - { key = "f", mods = "NONE", action = act.CopyMode({ JumpForward = { prev_char = false } }) }, - { key = "f", mods = "ALT", action = act.CopyMode("MoveForwardWord") }, - { key = "f", mods = "CTRL", action = act.CopyMode("PageDown") }, - { key = "g", mods = "NONE", action = act.CopyMode("MoveToScrollbackTop") }, - { key = "g", mods = "CTRL", action = act.Multiple({ "ScrollToBottom", { CopyMode = "Close" } }) }, - { key = "h", mods = "NONE", action = act.CopyMode("MoveLeft") }, - { key = "j", mods = "NONE", action = act.CopyMode("MoveDown") }, - { key = "k", mods = "NONE", action = act.CopyMode("MoveUp") }, - { key = "l", mods = "NONE", action = act.CopyMode("MoveRight") }, - { key = "m", mods = "ALT", action = act.CopyMode("MoveToStartOfLineContent") }, - { key = "o", mods = "NONE", action = act.CopyMode("MoveToSelectionOtherEnd") }, - { key = "q", mods = "NONE", action = act.Multiple({ "ScrollToBottom", { CopyMode = "Close" } }) }, - { key = "t", mods = "NONE", action = act.CopyMode({ JumpForward = { prev_char = true } }) }, - { key = "u", mods = "CTRL", action = act.CopyMode({ MoveByPage = -0.5 }) }, - { key = "v", mods = "NONE", action = act.CopyMode({ SetSelectionMode = "Cell" }) }, - { key = "v", mods = "CTRL", action = act.CopyMode({ SetSelectionMode = "Block" }) }, - { key = "w", mods = "NONE", action = act.CopyMode("MoveForwardWord") }, - { - key = "y", - mods = "NONE", - action = act.Multiple({ - { CopyTo = "ClipboardAndPrimarySelection" }, - { Multiple = { "ScrollToBottom", { CopyMode = "Close" } } }, - }), - }, - { key = "PageUp", mods = "NONE", action = act.CopyMode("PageUp") }, - { key = "PageDown", mods = "NONE", action = act.CopyMode("PageDown") }, - { key = "End", mods = "NONE", action = act.CopyMode("MoveToEndOfLineContent") }, - { key = "Home", mods = "NONE", action = act.CopyMode("MoveToStartOfLine") }, - { key = "LeftArrow", mods = "NONE", action = act.CopyMode("MoveLeft") }, - { key = "LeftArrow", mods = "ALT", action = act.CopyMode("MoveBackwardWord") }, - { key = "RightArrow", mods = "NONE", action = act.CopyMode("MoveRight") }, - { key = "RightArrow", mods = "ALT", action = act.CopyMode("MoveForwardWord") }, - { key = "UpArrow", mods = "NONE", action = act.CopyMode("MoveUp") }, - { key = "DownArrow", mods = "NONE", action = act.CopyMode("MoveDown") }, - -- #endregion - -- #region Customized CopyMode - { key = "n", mods = "NONE", action = act.CopyMode("MoveDown") }, - { key = "e", mods = "NONE", action = act.CopyMode("MoveUp") }, - { key = "i", mods = "NONE", action = act.CopyMode("MoveRight") }, - { key = "j", mods = "NONE", action = act.CopyMode("MoveForwardWordEnd") }, - -- #endregion - }, - resize_pane = { - { key = "h", mods = "NONE", action = act.AdjustPaneSize({ "Left", 1 }) }, - { key = "n", mods = "NONE", action = act.AdjustPaneSize({ "Down", 1 }) }, - { key = "e", mods = "NONE", action = act.AdjustPaneSize({ "Up", 1 }) }, - { key = "i", mods = "NONE", action = act.AdjustPaneSize({ "Right", 1 }) }, - { key = "q", mods = "NONE", action = "PopKeyTable" }, - }, -} --- #endregion - --- #region Leader Keymaps -local leader_keys = { - { - key = "q", - mods = "LEADER", - action = act.SendKey({ key = "q", mods = "CTRL" }), - }, - -- Windows Management - { -- leader keys - key = "|", - mods = "LEADER|SHIFT", - action = act.SplitHorizontal({ domain = "CurrentPaneDomain" }), - }, - { - key = "-", - mods = "LEADER", - action = act.SplitVertical({ domain = "CurrentPaneDomain" }), - }, - { - key = "h", - mods = "LEADER", - action = act.ActivatePaneDirection("Left"), - }, - { - key = "n", - mods = "LEADER", - action = act.ActivatePaneDirection("Down"), - }, - { - key = "e", - mods = "LEADER", - action = act.ActivatePaneDirection("Up"), - }, - { - key = "i", - mods = "LEADER", - action = act.ActivatePaneDirection("Right"), - }, - { - key = "H", - mods = "LEADER", - action = act.AdjustPaneSize({ "Left", 5 }), - }, - { - key = "N", - mods = "LEADER", - action = act.AdjustPaneSize({ "Down", 5 }), - }, - { - key = "E", - mods = "LEADER", - action = act.AdjustPaneSize({ "Up", 5 }), - }, - { - key = "I", - mods = "LEADER", - action = act.AdjustPaneSize({ "Right", 5 }), - }, - { - key = "/", - mods = "LEADER", - action = act.Search({ Regex = "" }), - }, - { - key = "?", - mods = "LEADER|SHIFT", - action = act.Search({ CaseSensitiveString = "" }), - }, - { - key = ";", - mods = "LEADER", - action = act.ShowLauncher, - }, - { - key = ":", - mods = "LEADER|SHIFT", - action = act.ActivateCommandPalette, - }, - { - key = "r", - mods = "LEADER", - action = act.ActivateKeyTable({ - name = "resize_pane", - one_shot = false, - timeout_milliseconds = 2000, - }), - }, -} --- #endregion - --- #region Ctrl Keymaps -local ctrl_keys = { - { - key = "W", - mods = "CTRL", - action = act.CloseCurrentPane({ confirm = true }), - }, - { -- ^C to copy if selection is active, otherwise send signal - -- https://wezfurlong.org/wezterm/config/lua/keyassignment/ClearSelection.html?h=selection - key = "c", - mods = "CTRL", - action = wezterm.action_callback(function(window, pane) - local has_selection = window:get_selection_text_for_pane(pane) ~= "" - if has_selection then - window:perform_action(act.CopyTo("ClipboardAndPrimarySelection"), pane) - - window:perform_action(act.ClearSelection, pane) - else - window:perform_action(act.SendKey({ key = "c", mods = "CTRL" }), pane) - end - end), - }, -} --- #endregion - --- #region SUPER Keymaps -local super_keys = { - { key = "LeftArrow", mods = SUPER, action = act.SendString("\u{1b}OH") }, - { key = "RightArrow", mods = SUPER, action = act.SendString("\u{1b}OF") }, - { key = "Backspace", mods = SUPER, action = act.SendString("\u{15}") }, - { key = "0", mods = SUPER, action = act.ActivateTab(-1) }, - { key = "t", mods = SUPER, action = act.SpawnTab("DefaultDomain") }, - { key = "w", mods = SUPER, action = act.CloseCurrentTab({ confirm = false }) }, -} -for i = 1, 9 do - table.insert(super_keys, { key = tostring(i), mods = SUPER, action = act.ActivateTab(i - 1) }) -end --- #endregion - --- Concat all keymaps -local keys = {} - -for _, keymap in ipairs(leader_keys) do - table.insert(keys, keymap) -end - -for _, keymap in ipairs(ctrl_keys) do - table.insert(keys, keymap) -end - -for _, keymap in ipairs(super_keys) do - table.insert(keys, keymap) -end - -return function(config) - config.leader = { key = "q", mods = "CTRL" } - config.keys = keys - config.key_tables = key_tables - config.mouse_bindings = { - { - event = { Up = { streak = 1, button = "Left" } }, - mods = "CTRL", - action = act.OpenLinkAtMouseCursor, - }, - { - event = { Up = { streak = 1, button = "Left" } }, - mods = "SUPER", - action = act.OpenLinkAtMouseCursor, - }, - } -end diff --git a/tools/wezterm/keymaps/colemak.lua b/tools/wezterm/keymaps/colemak.lua new file mode 100644 index 0000000..0a52893 --- /dev/null +++ b/tools/wezterm/keymaps/colemak.lua @@ -0,0 +1,44 @@ +local M = {} +local wezterm = require("wezterm") +local act = wezterm.action + +M.leader = { + { + key = "n", + mods = "LEADER", + action = act.ActivatePaneDirection("Down"), + }, + { + key = "e", + mods = "LEADER", + action = act.ActivatePaneDirection("Up"), + }, + { + key = "i", + mods = "LEADER", + action = act.ActivatePaneDirection("Right"), + }, + { + key = "N", + mods = "LEADER", + action = act.AdjustPaneSize({ "Down", 5 }), + }, + { + key = "E", + mods = "LEADER", + action = act.AdjustPaneSize({ "Up", 5 }), + }, + { + key = "I", + mods = "LEADER", + action = act.AdjustPaneSize({ "Right", 5 }), + }, +} + +local leader_common = require("keymaps.leaders").common + +for _, v in ipairs(leader_common) do + table.insert(M.leader, v) +end + +return M diff --git a/tools/wezterm/keymaps/init.lua b/tools/wezterm/keymaps/init.lua new file mode 100644 index 0000000..d9349cf --- /dev/null +++ b/tools/wezterm/keymaps/init.lua @@ -0,0 +1,183 @@ +-- vim: foldmethod=marker foldmarker=#region,#endregion +-- Reference to: https://github.com/KevinSilvester/wezterm-config/blob/master/config/bindings.lua +local wezterm = require("wezterm") +local action = wezterm.action +local act = wezterm.action +local os_type = require("utils").detected_os + +local SUPER + +if os_type.is_mac then + SUPER = "SUPER" +else + SUPER = "ALT" +end + +local layout = require("keymaps.colemak") + +-- #region Key Tables +local key_tables = { + copy_mode = { + -- #region Built-in CopyMode + -- This keymaps seems cannot be merged. + { key = "Tab", mods = "NONE", action = act.CopyMode("MoveForwardWord") }, + { key = "Tab", mods = "SHIFT", action = act.CopyMode("MoveBackwardWord") }, + { key = "Enter", mods = "NONE", action = act.CopyMode("MoveToStartOfNextLine") }, + { key = "Escape", mods = "NONE", action = act.Multiple({ "ScrollToBottom", { CopyMode = "Close" } }) }, + { key = "Space", mods = "NONE", action = act.CopyMode({ SetSelectionMode = "Cell" }) }, + { key = "$", mods = "NONE", action = act.CopyMode("MoveToEndOfLineContent") }, + { key = "$", mods = "SHIFT", action = act.CopyMode("MoveToEndOfLineContent") }, + { key = ",", mods = "NONE", action = act.CopyMode("JumpReverse") }, + { key = "0", mods = "NONE", action = act.CopyMode("MoveToStartOfLine") }, + { key = ";", mods = "NONE", action = act.CopyMode("JumpAgain") }, + { key = "F", mods = "NONE", action = act.CopyMode({ JumpBackward = { prev_char = false } }) }, + { key = "F", mods = "SHIFT", action = act.CopyMode({ JumpBackward = { prev_char = false } }) }, + { key = "G", mods = "NONE", action = act.CopyMode("MoveToScrollbackBottom") }, + { key = "G", mods = "SHIFT", action = act.CopyMode("MoveToScrollbackBottom") }, + { key = "H", mods = "NONE", action = act.CopyMode("MoveToViewportTop") }, + { key = "H", mods = "SHIFT", action = act.CopyMode("MoveToViewportTop") }, + { key = "L", mods = "NONE", action = act.CopyMode("MoveToViewportBottom") }, + { key = "L", mods = "SHIFT", action = act.CopyMode("MoveToViewportBottom") }, + { key = "M", mods = "NONE", action = act.CopyMode("MoveToViewportMiddle") }, + { key = "M", mods = "SHIFT", action = act.CopyMode("MoveToViewportMiddle") }, + { key = "O", mods = "NONE", action = act.CopyMode("MoveToSelectionOtherEndHoriz") }, + { key = "O", mods = "SHIFT", action = act.CopyMode("MoveToSelectionOtherEndHoriz") }, + { key = "T", mods = "NONE", action = act.CopyMode({ JumpBackward = { prev_char = true } }) }, + { key = "T", mods = "SHIFT", action = act.CopyMode({ JumpBackward = { prev_char = true } }) }, + { key = "V", mods = "NONE", action = act.CopyMode({ SetSelectionMode = "Line" }) }, + { key = "V", mods = "SHIFT", action = act.CopyMode({ SetSelectionMode = "Line" }) }, + { key = "^", mods = "NONE", action = act.CopyMode("MoveToStartOfLineContent") }, + { key = "^", mods = "SHIFT", action = act.CopyMode("MoveToStartOfLineContent") }, + { key = "b", mods = "NONE", action = act.CopyMode("MoveBackwardWord") }, + { key = "b", mods = "ALT", action = act.CopyMode("MoveBackwardWord") }, + { key = "b", mods = "CTRL", action = act.CopyMode("PageUp") }, + { key = "c", mods = "CTRL", action = act.Multiple({ "ScrollToBottom", { CopyMode = "Close" } }) }, + { key = "d", mods = "CTRL", action = act.CopyMode({ MoveByPage = 0.5 }) }, + { key = "e", mods = "NONE", action = act.CopyMode("MoveForwardWordEnd") }, + { key = "f", mods = "NONE", action = act.CopyMode({ JumpForward = { prev_char = false } }) }, + { key = "f", mods = "ALT", action = act.CopyMode("MoveForwardWord") }, + { key = "f", mods = "CTRL", action = act.CopyMode("PageDown") }, + { key = "g", mods = "NONE", action = act.CopyMode("MoveToScrollbackTop") }, + { key = "g", mods = "CTRL", action = act.Multiple({ "ScrollToBottom", { CopyMode = "Close" } }) }, + { key = "h", mods = "NONE", action = act.CopyMode("MoveLeft") }, + { key = "j", mods = "NONE", action = act.CopyMode("MoveDown") }, + { key = "k", mods = "NONE", action = act.CopyMode("MoveUp") }, + { key = "l", mods = "NONE", action = act.CopyMode("MoveRight") }, + { key = "m", mods = "ALT", action = act.CopyMode("MoveToStartOfLineContent") }, + { key = "o", mods = "NONE", action = act.CopyMode("MoveToSelectionOtherEnd") }, + { key = "q", mods = "NONE", action = act.Multiple({ "ScrollToBottom", { CopyMode = "Close" } }) }, + { key = "t", mods = "NONE", action = act.CopyMode({ JumpForward = { prev_char = true } }) }, + { key = "u", mods = "CTRL", action = act.CopyMode({ MoveByPage = -0.5 }) }, + { key = "v", mods = "NONE", action = act.CopyMode({ SetSelectionMode = "Cell" }) }, + { key = "v", mods = "CTRL", action = act.CopyMode({ SetSelectionMode = "Block" }) }, + { key = "w", mods = "NONE", action = act.CopyMode("MoveForwardWord") }, + { + key = "y", + mods = "NONE", + action = act.Multiple({ + { CopyTo = "ClipboardAndPrimarySelection" }, + { Multiple = { "ScrollToBottom", { CopyMode = "Close" } } }, + }), + }, + { key = "PageUp", mods = "NONE", action = act.CopyMode("PageUp") }, + { key = "PageDown", mods = "NONE", action = act.CopyMode("PageDown") }, + { key = "End", mods = "NONE", action = act.CopyMode("MoveToEndOfLineContent") }, + { key = "Home", mods = "NONE", action = act.CopyMode("MoveToStartOfLine") }, + { key = "LeftArrow", mods = "NONE", action = act.CopyMode("MoveLeft") }, + { key = "LeftArrow", mods = "ALT", action = act.CopyMode("MoveBackwardWord") }, + { key = "RightArrow", mods = "NONE", action = act.CopyMode("MoveRight") }, + { key = "RightArrow", mods = "ALT", action = act.CopyMode("MoveForwardWord") }, + { key = "UpArrow", mods = "NONE", action = act.CopyMode("MoveUp") }, + { key = "DownArrow", mods = "NONE", action = act.CopyMode("MoveDown") }, + -- #endregion + -- #region Customized CopyMode + { key = "n", mods = "NONE", action = act.CopyMode("MoveDown") }, + { key = "e", mods = "NONE", action = act.CopyMode("MoveUp") }, + { key = "i", mods = "NONE", action = act.CopyMode("MoveRight") }, + { key = "j", mods = "NONE", action = act.CopyMode("MoveForwardWordEnd") }, + -- #endregion + }, + resize_pane = { + { key = "h", mods = "NONE", action = act.AdjustPaneSize({ "Left", 1 }) }, + { key = "n", mods = "NONE", action = act.AdjustPaneSize({ "Down", 1 }) }, + { key = "e", mods = "NONE", action = act.AdjustPaneSize({ "Up", 1 }) }, + { key = "i", mods = "NONE", action = act.AdjustPaneSize({ "Right", 1 }) }, + { key = "q", mods = "NONE", action = "PopKeyTable" }, + }, +} +-- #endregion + +local leader_keys = layout.leader + + +-- #region Ctrl Keymaps +local ctrl_keys = { + { + key = "W", + mods = "CTRL", + action = act.CloseCurrentPane({ confirm = true }), + }, + { -- ^C to copy if selection is active, otherwise send signal + -- https://wezfurlong.org/wezterm/config/lua/keyassignment/ClearSelection.html?h=selection + key = "c", + mods = "CTRL", + action = wezterm.action_callback(function(window, pane) + local has_selection = window:get_selection_text_for_pane(pane) ~= "" + if has_selection then + window:perform_action(act.CopyTo("ClipboardAndPrimarySelection"), pane) + + window:perform_action(act.ClearSelection, pane) + else + window:perform_action(act.SendKey({ key = "c", mods = "CTRL" }), pane) + end + end), + }, +} +-- #endregion + +-- #region SUPER Keymaps +local super_keys = { + { key = "LeftArrow", mods = SUPER, action = act.SendString("\u{1b}OH") }, + { key = "RightArrow", mods = SUPER, action = act.SendString("\u{1b}OF") }, + { key = "Backspace", mods = SUPER, action = act.SendString("\u{15}") }, + { key = "0", mods = SUPER, action = act.ActivateTab(-1) }, + { key = "t", mods = SUPER, action = act.SpawnTab("DefaultDomain") }, + { key = "w", mods = SUPER, action = act.CloseCurrentTab({ confirm = false }) }, +} +for i = 1, 9 do + table.insert(super_keys, { key = tostring(i), mods = SUPER, action = act.ActivateTab(i - 1) }) +end +-- #endregion + +-- Concat all keymaps +local keys = {} + +for _, keymap in ipairs(leader_keys) do + table.insert(keys, keymap) +end + +for _, keymap in ipairs(ctrl_keys) do + table.insert(keys, keymap) +end + +for _, keymap in ipairs(super_keys) do + table.insert(keys, keymap) +end + +return function(config) + config.leader = { key = "q", mods = "CTRL" } + config.keys = keys + config.key_tables = key_tables + config.mouse_bindings = { + { + event = { Up = { streak = 1, button = "Left" } }, + mods = "CTRL", + action = act.OpenLinkAtMouseCursor, + }, + { + event = { Up = { streak = 1, button = "Left" } }, + mods = "SUPER", + action = act.OpenLinkAtMouseCursor, + }, + } +end diff --git a/tools/wezterm/keymaps/leaders.lua b/tools/wezterm/keymaps/leaders.lua new file mode 100644 index 0000000..0e9be6d --- /dev/null +++ b/tools/wezterm/keymaps/leaders.lua @@ -0,0 +1,67 @@ +local M = {} +local wezterm = require("wezterm") +local act = wezterm.action + +-- #region Leader Keymaps +M.common = { + { + key = "q", + mods = "LEADER", + action = act.SendKey({ key = "q", mods = "CTRL" }), + }, + -- Windows Management + { -- leader keys + key = "|", + mods = "LEADER|SHIFT", + action = act.SplitHorizontal({ domain = "CurrentPaneDomain" }), + }, + { + key = "-", + mods = "LEADER", + action = act.SplitVertical({ domain = "CurrentPaneDomain" }), + }, + { + key = "h", + mods = "LEADER", + action = act.ActivatePaneDirection("Left"), + }, + { + key = "H", + mods = "LEADER", + action = act.AdjustPaneSize({ "Left", 5 }), + }, + { + key = "/", + mods = "LEADER", + action = act.Search({ Regex = "" }), + }, + { + key = "?", + mods = "LEADER|SHIFT", + action = act.Search({ CaseSensitiveString = "" }), + }, + { + key = ";", + mods = "LEADER", + action = act.ShowLauncher, + }, + { + key = ":", + mods = "LEADER|SHIFT", + action = act.ActivateCommandPalette, + }, + { + key = "r", + mods = "LEADER", + action = act.ActivateKeyTable({ + name = "resize_pane", + one_shot = false, + timeout_milliseconds = 2000, + }), + }, +} +-- #endregion + + + +return M diff --git a/tools/wezterm/keymaps/qwerty.lua b/tools/wezterm/keymaps/qwerty.lua new file mode 100644 index 0000000..00bbb4f --- /dev/null +++ b/tools/wezterm/keymaps/qwerty.lua @@ -0,0 +1,45 @@ +local M = {} +local wezterm = require("wezterm") +local act = wezterm.action + +M.qwerty = { + + { + key = "j", + mods = "LEADER", + action = act.ActivatePaneDirection("Down"), + }, + { + key = "k", + mods = "LEADER", + action = act.ActivatePaneDirection("Up"), + }, + { + key = "l", + mods = "LEADER", + action = act.ActivatePaneDirection("Right"), + }, + { + key = "J", + mods = "LEADER", + action = act.AdjustPaneSize({ "Down", 5 }), + }, + { + key = "K", + mods = "LEADER", + action = act.AdjustPaneSize({ "Up", 5 }), + }, + { + key = "L", + mods = "LEADER", + action = act.AdjustPaneSize({ "Right", 5 }), + }, +} + +local leader_common = require("keymaps.leaders").common + +for _, v in ipairs(leader_common) do + table.insert(M.leader, v) +end + +return M From 14fe2aad5f5398fe7120cdad5d0c5e1847107e4c Mon Sep 17 00:00:00 2001 From: js0ny Date: Mon, 7 Apr 2025 08:50:00 +0100 Subject: [PATCH 21/35] feat(hypr): Enabling lockscreen and switching daemon --- bootstrap/linux/chromium-flags.bash | 35 ++- bootstrap/linux/chromium-flags.hypr.bash | 71 +++++ platforms/linux/chromium-flags.hypr.conf | 5 + platforms/linux/electron-flags.hypr.conf | 5 + platforms/linux/hypr/hypridle.conf | 2 +- platforms/linux/hypr/hyprland.conf | 35 ++- platforms/linux/hypr/hyprpaper.conf | 3 +- platforms/linux/kde/kglobalshortcutsrc | 13 + platforms/linux/waybar/config | 37 --- platforms/linux/waybar/config.jsonc | 213 +++++++++++++ platforms/linux/waybar/modules | 149 --------- platforms/linux/waybar/style.css | 376 ++++++++++++++++------- 12 files changed, 634 insertions(+), 310 deletions(-) create mode 100755 bootstrap/linux/chromium-flags.hypr.bash create mode 100644 platforms/linux/chromium-flags.hypr.conf create mode 100644 platforms/linux/electron-flags.hypr.conf delete mode 100644 platforms/linux/waybar/config create mode 100644 platforms/linux/waybar/config.jsonc delete mode 100644 platforms/linux/waybar/modules diff --git a/bootstrap/linux/chromium-flags.bash b/bootstrap/linux/chromium-flags.bash index c3a9ae9..2ad6bbd 100755 --- a/bootstrap/linux/chromium-flags.bash +++ b/bootstrap/linux/chromium-flags.bash @@ -10,6 +10,31 @@ XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" BROWSER_FLAG=$DOTFILES/platforms/linux/chromium-flags.conf ELECTRON_FLAG=$DOTFILES/platforms/linux/electron-flags.conf + +parse_args() { + while [[ $# -gt 0 ]]; do + case "$1" in + # --debug|-d) + # export LOG_LEVEL="DEBUG" + # log_debug "Debug mode enabled" + # shift + # ;; + --force|-f) + FORCE_FILE="true" + echo "Force update enabled" + shift + ;; + *) + echo "Unknown argument: $1" + echo "Usage: chromium-flags.sh [--debug|-d] [--force|-f]" + exit 1 + ;; + esac + done +} + +parse_args "$@" + # Browser Flags browser_flags_path=( @@ -24,23 +49,23 @@ browser_flags_path=( electron_flags_path=( "$XDG_CONFIG_HOME/electron-flags.conf" # General "$XDG_CONFIG_HOME/code-flags.conf" # VSCode - "$XDG_CONFIG_HOME/qq-electron-flags.conf" # Slack + "$XDG_CONFIG_HOME/qq-electron-flags.conf" # QQ ) for path in "${browser_flags_path[@]}"; do - if [ -f "$path" ]; then + if [ -f "$path" ] && [ "$FORCE_FILE" != "true" ]; then echo "[INFO] Found Browser Flags: $path" else echo "[INFO] Creating Browser Flags: $path" - ln -s "$BROWSER_FLAG" "$path" + ln -sf "$BROWSER_FLAG" "$path" fi done for path in "${electron_flags_path[@]}"; do - if [ -f "$path" ]; then + if [ -f "$path" ] && [ "$FORCE_FILE" != "true" ]; then echo "[INFO] Found Electron Flags: $path" else echo "[INFO] Creating Electron Flags: $path" - ln -s "$ELECTRON_FLAG" "$path" + ln -sf "$ELECTRON_FLAG" "$path" fi done diff --git a/bootstrap/linux/chromium-flags.hypr.bash b/bootstrap/linux/chromium-flags.hypr.bash new file mode 100755 index 0000000..982fb59 --- /dev/null +++ b/bootstrap/linux/chromium-flags.hypr.bash @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +# vim:ft=bash +# chromium-flags.sh +# Set Chromium & Electron Flags + +echo "[INFO] Set Chromium & Electron Flags" + +DOTFILES="${DOTFILES:-$HOME/.dotfiles}" +XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" +BROWSER_FLAG=$DOTFILES/platforms/linux/chromium-flags.hypr.conf +ELECTRON_FLAG=$DOTFILES/platforms/linux/electron-flags.hypr.conf + + +parse_args() { + while [[ $# -gt 0 ]]; do + case "$1" in + # --debug|-d) + # export LOG_LEVEL="DEBUG" + # log_debug "Debug mode enabled" + # shift + # ;; + --force|-f) + FORCE_FILE="true" + echo "Force update enabled" + shift + ;; + *) + echo "Unknown argument: $1" + echo "Usage: chromium-flags.sh [--debug|-d] [--force|-f]" + exit 1 + ;; + esac + done +} + +parse_args "$@" + +# Browser Flags + +browser_flags_path=( + "$XDG_CONFIG_HOME/chromium-flags.conf" # Chromium + "$XDG_CONFIG_HOME/chrome-flags.conf" # Google Chrome + "$XDG_CONFIG_HOME/thorium-flags.conf" # Thorium + "$XDG_CONFIG_HOME/vivaldi-flags.conf" # Vivaldi + "$XDG_CONFIG_HOME/vivaldi-stable.conf" # Vivaldi + +) + +electron_flags_path=( + "$XDG_CONFIG_HOME/electron-flags.conf" # General + "$XDG_CONFIG_HOME/code-flags.conf" # VSCode + "$XDG_CONFIG_HOME/qq-electron-flags.conf" # QQ +) + +for path in "${browser_flags_path[@]}"; do + if [ -f "$path" ] && [ "$FORCE_FILE" != "true" ]; then + echo "[INFO] Found Browser Flags: $path" + else + echo "[INFO] Creating Browser Flags: $path" + ln -sf "$BROWSER_FLAG" "$path" + fi +done + +for path in "${electron_flags_path[@]}"; do + if [ -f "$path" ] && [ "$FORCE_FILE" != "true" ]; then + echo "[INFO] Found Electron Flags: $path" + else + echo "[INFO] Creating Electron Flags: $path" + ln -sf "$ELECTRON_FLAG" "$path" + fi +done diff --git a/platforms/linux/chromium-flags.hypr.conf b/platforms/linux/chromium-flags.hypr.conf new file mode 100644 index 0000000..60a9ab2 --- /dev/null +++ b/platforms/linux/chromium-flags.hypr.conf @@ -0,0 +1,5 @@ +--UseOzonePlatform=wayland +--ozone-platform=wayland +--password-store=kwallet6 +--enable-wayland-ime +--force-device-scale-factor=1.75 diff --git a/platforms/linux/electron-flags.hypr.conf b/platforms/linux/electron-flags.hypr.conf new file mode 100644 index 0000000..312f3e6 --- /dev/null +++ b/platforms/linux/electron-flags.hypr.conf @@ -0,0 +1,5 @@ +--enable-features=WaylandWindowDecorations +--enable-features=UseOzonePlatform +--ozone-platform-hint=auto +--enable-wayland-ime +--force-device-scale-factor=1.75 diff --git a/platforms/linux/hypr/hypridle.conf b/platforms/linux/hypr/hypridle.conf index 6451aac..540d279 100644 --- a/platforms/linux/hypr/hypridle.conf +++ b/platforms/linux/hypr/hypridle.conf @@ -9,6 +9,6 @@ general { listener { timeout = 600 # in seconds - on-timeout = notify-send "You are idle!" # command to run when timeout has passed + on-timeout = swaylock # command to run when timeout has passed on-resume = notify-send "Welcome back!" # command to run when activity is detected after timeout has fired. } diff --git a/platforms/linux/hypr/hyprland.conf b/platforms/linux/hypr/hyprland.conf index 5330165..0812be1 100644 --- a/platforms/linux/hypr/hyprland.conf +++ b/platforms/linux/hypr/hyprland.conf @@ -44,7 +44,7 @@ xwayland { # monitor=,preferred,auto,auto # Format: # MONITOR_NAME,RESOLUTION@REFRESH_RATE,OFFSET_XxOFFSET_Y,SCALE -monitor=DP-2,3840x2160@60,0x0,1.875 +monitor=DP-2,3840x2160@60,0x0,1.667 ################### @@ -71,10 +71,11 @@ $menu = rofi # Top Bar exec-once = waybar & # Notifications -exec-once = mako & +exec-once = dunst & # exec-once = hyprpanel & # wallpapers -exec-once = hyprpaper & +exec-once = swww-daemon & +exec-once = hypridle & # Authentication agent exec-once = systemctl --user start hyprpolkitagent # Input Method @@ -106,8 +107,7 @@ env = QT_QPA_PLATFORMTHEME,qt6ct # for Qt apps # https://discuss.kde.org/t/the-themes-i-use-with-qt6ct-are-not-applied-in-discover/17118 env = QT_QUICK_CONTROLS_STYLE,org.kde.desktop -env = LC_CTYPE,zh_CN.UTF-8 -env = LC_ALL,zh_CN.UTF-8 +env = LC_CTYPE,en_GB.UTF-8 ##################### @@ -144,8 +144,8 @@ decoration { rounding = 10 # Change transparency of focused and unfocused windows - active_opacity = 1.0 - inactive_opacity = 1.0 + active_opacity = 0.97 + inactive_opacity = 0.85 shadow { enabled = true @@ -268,8 +268,11 @@ bind = $mainMod, R, exec, $terminal bind = $mainMod, Q, killactive, # bind = $mainMod, M, exit, bind = $mainMod, F, exec, $fileManager -bind = $mainMod, V, exec, cliphist list | rofi --dmenu | cliphist decode | wl-copy -bind = $mainMod SHIFT, F, togglefloating +bind = $mainMod, V, exec, cliphist list | $menu -dmenu | cliphist decode | wl-copy +bind = $mainMod, W, exec, $menu -show window +bind = $mainMod SHIFT, F, exec, hyprctl --batch "dispatch togglefloating ; dispatch resizeactive exact 800 1000 ; dispatch centerwindow 1;" + + bind = alt, space, exec, $menu -show drun bind = $mainMod, P, pseudo, # dwindle @@ -284,12 +287,14 @@ bind = $mainMod, h, movefocus, l bind = $mainMod, i, movefocus, r bind = $mainMod, e, movefocus, u bind = $mainMod, n, movefocus, d -bind = $mainMod alt, h, swapwindow, l -bind = $mainMod alt, i, swapwindow, r -bind = $mainMod alt, e, swapwindow, u -bind = $mainMod alt, n, swapwindow, d +bind = $mainMod SHIFT, h, swapwindow, l +bind = $mainMod SHIFT, i, swapwindow, r +bind = $mainMod SHIFT, e, swapwindow, u +bind = $mainMod SHIFT, n, swapwindow, d -bind = $mainMod, c, exec, hyprshot -m region -o $HOME/Pictures/Screenshots/ +bind = $mainMod SHIFT, l, exec, swaylock + +bind = $mainMod, c, exec, grimblast copysave area $HOME/Pictures/Screenshots/"$(date +%Y%m%d-%H%M%S)" # Switch workspaces with mainMod + [0-9] bind = $mainMod, 1, workspace, 1 @@ -359,3 +364,5 @@ windowrulev2 = suppressevent maximize, class:.* # Fix some dragging issues with XWayland windowrulev2 = nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0 + +windowrulev2 = float, class:qt6ct, diff --git a/platforms/linux/hypr/hyprpaper.conf b/platforms/linux/hypr/hyprpaper.conf index 129a0a5..370cf06 100644 --- a/platforms/linux/hypr/hyprpaper.conf +++ b/platforms/linux/hypr/hyprpaper.conf @@ -9,4 +9,5 @@ # ln -sf $DOTFILES/platforms/linux/hypr $XDG_CONFIG_HOME/hypr preload = ~/Pictures/Wallpaper/current.jpg -wallpaper = DP-2, ~/Pictures/Wallpaper/current.jpg +preload = ~/Pictures/Wallpaper/current.png +wallpaper = DP-2, ~/Pictures/Wallpaper/current.png diff --git a/platforms/linux/kde/kglobalshortcutsrc b/platforms/linux/kde/kglobalshortcutsrc index a74c408..efa92bc 100644 --- a/platforms/linux/kde/kglobalshortcutsrc +++ b/platforms/linux/kde/kglobalshortcutsrc @@ -3,6 +3,14 @@ _k_friendly_name=活动管理器 switch-to-activity-32e1f2d2-08d1-4a8b-886a-0a062f999068=none,none,Switch to activity "Default" switch-to-activity-e1ebfdac-0f52-47a5-9e7a-d9eb5cc26845=none,none,切换到活动“默认” +[Clementine] +_k_friendly_name=Clementine +next_album=Shift+Media Next,none,Next album +next_track=none,none,下一个曲目 +play_pause=none,none,播放/暂停 +prev_track=none,none,上一个曲目 +stop=none,none,停止 + [KDE Keyboard Layout Switcher] Switch keyboard layout to English (Colemak)=none,none,Switch keyboard layout to English (Colemak) Switch keyboard layout to English (US)=none,none,Switch keyboard layout to English (US) @@ -54,6 +62,11 @@ Reboot Without Confirmation=none,,重启 (无需确认) Shut Down=none,,关机 _k_friendly_name=会话管理 +[ktorrent] +_k_friendly_name=KTorrent +queue_suspend=Alt+Shift+P,Alt+Shift+P,暂停种子 +show_kt=Alt+Shift+T,Alt+Shift+T,显示/隐藏 KTorrent + [kwin] Activate Window Demanding Attention=Meta+Ctrl+A,Meta+Ctrl+A,激活请求注意的窗口 Cycle Overview=none,none,循环显示桌面概览和网格视图 diff --git a/platforms/linux/waybar/config b/platforms/linux/waybar/config deleted file mode 100644 index d8ba47c..0000000 --- a/platforms/linux/waybar/config +++ /dev/null @@ -1,37 +0,0 @@ -{ - "include": "~/.config/waybar/modules", - "name": "main-bar", - "id": "main-bar", - "layer": "top", - "mode": "dock", - "exclusive": true, - "passthrough": false, - "position": "top", - "output": "DP-2", - "height": 32, - "width": "", - "spacing": 6, - "margin": 0, - "margin-top": 0, - "margin-bottom": 0, - "margin-left": 0, - "margin-right": 0, - "fixed-center": true, - "ipc": true, - "modules-left": [ - "custom/menu", - "hyprland/workspaces" - ], - // "modules-center": [ - // "hyprland/window", - // "mpd" - // ], - "modules-right": [ - "tray", - "pulseaudio", - "custom/weather", - "battery", - "clock", - "custom/power" - ] -} \ No newline at end of file diff --git a/platforms/linux/waybar/config.jsonc b/platforms/linux/waybar/config.jsonc new file mode 100644 index 0000000..c4eb83b --- /dev/null +++ b/platforms/linux/waybar/config.jsonc @@ -0,0 +1,213 @@ +// -*- mode: jsonc -*- +{ + // "layer": "top", // Waybar at top layer + // "position": "bottom", // Waybar position (top|bottom|left|right) + "include": [ + "~/.config/waybar/modules/hyprland-workspace.jsonc" + ], + "height": 30, // Waybar height (to be removed for auto height) + // "width": 1280, // Waybar width + "spacing": 4, // Gaps between modules (4px) + // Choose the order of the modules + "modules-left": [ + "hyprland/workspaces#rw", + "sway/mode", + "sway/scratchpad" + ], + "modules-center": [ + "hyprland/window" + ], + "modules-right": [ + "tray", + // "idle_inhibitor", + "pulseaudio", + "network", + // "power-profiles-daemon", + "cpu", + "memory", + "temperature", + "backlight", + // "hyprland/language", + "battery", + "clock" + ], + // 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": "" + } + }, + "sway/mode": { + "format": "{}" + }, + "sway/scratchpad": { + "format": "{icon} {count}", + "show-empty": false, + "format-icons": ["", ""], + "tooltip": true, + "tooltip-format": "{app}: {title}" + }, + "mpd": { + "format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {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": " ", + "on": " " + }, + "repeat-icons": { + "on": " " + }, + "single-icons": { + "on": "1 " + }, + "state-icons": { + "paused": "", + "playing": "" + }, + "tooltip-format": "MPD (connected)", + "tooltip-format-disconnected": "MPD (disconnected)" + }, + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + } + }, + "tray": { + // "icon-size": 21, + "spacing": 10 + }, + "clock": { + // "timezone": "America/New_York", + "tooltip-format": "{:%Y %B}\n{calendar}", + "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 + }, + "custom/power": { + "format" : "⏻ ", + "tooltip": false, + "menu": "on-click", + "menu-file": "$HOME/.config/waybar/power_menu.xml", // Menu file in resources folder + "menu-actions": { + "shutdown": "shutdown", + "reboot": "reboot", + "suspend": "systemctl suspend", + "hibernate": "systemctl hibernate" + } + } +} diff --git a/platforms/linux/waybar/modules b/platforms/linux/waybar/modules deleted file mode 100644 index 48dd848..0000000 --- a/platforms/linux/waybar/modules +++ /dev/null @@ -1,149 +0,0 @@ -// Waybar modules configuration -{ - // waybar-backlight - "backlight": { - "interval": 2, - "align": 0, - "rotate": 0, - //"device": "amdgpu_bl0", - "format": "{icon} {percent}%", - "format-icons": [ - "", - "", - "", - "" - ], - // Commands to execute on events - "on-click": "", - "on-click-middle": "", - "on-click-right": "", - "on-update": "", - "on-scroll-up": "light -A 5%", - "on-scroll-down": "light -U 5%", - "smooth-scrolling-threshold": 1 - }, - "hyprland/workspaces": { - "format": "{icon} {windows}", - "format-window-separator": " ", - "window-rewrite-default": "", - "window-rewrite": { - "title<.*youtube.*>": "", - "class": "", - "class<.*wezterm>": "", - "class": "", - "class": "󱓞", - "class title<.*github.*>": "", - "class": "󰰬", - "obsidian": "󱓩", - "foot": "", - "Cider": "", - "class": "", - "code": "󰨞", - "class<.*telegram.*>": "", - "discord": "", - "neovide": "", - "class": "", - "class<.*wechat.*>": "", - "QQ": "", - "class": "", - "Zotero": "", - "class": "", - "class": "", - } - }, - // waybar-battery - "battery": { - "interval": 60, - "align": 0, - "rotate": 0, - //"bat": "BAT1", - //"adapter": "ACAD", - "full-at": 100, - "design-capacity": false, - "states": { - "good": 95, - "warning": 30, - "critical": 15 - }, - "format": "{icon} {capacity}%", - "format-charging": " {capacity}%", - "format-plugged": " {capacity}%", - "format-full": "{icon} Full", - //"format-good": "", - "format-alt": "{icon} {time}", - "format-icons": [ - "", - "", - "", - "", - "" - ], - "format-time": "{H}h {M}min", - "tooltip": true - }, - // waybar-clock - "clock": { - "interval": 1, - "align": 0, - "rotate": 0, - "tooltip-format": "{:%B %Y}\n{calendar}", - "format": " {:%H:%M:%S}", - "format-alt": " {:%a %b %d, %G}" - }, - // waybar-cpu - "cpu": { - "interval": 5, - "format": " {usage}%" - }, - // waybar-custom - "custom/menu": { - "format": "󰣇 ", - "tooltip": false, - "on-click": "wofi" - }, - "custom/power": { - "format": "⏻", - "tooltip": false, - "on-click": "wlogout" - }, - // weather-custom - "custom/weather": { - "format": "{}", - "format-alt": "{alt}: {}", - "format-alt-click": "click-right", - "interval": 1800, - "return-type": "json", - "exec": "~/.config/hypr/scripts/weather.sh", - "exec-if": "ping wttr.in -c1" - }, - // waybar-tray - "tray": { - "icon-size": 16, - "spacing": 10 - }, - "pulseaudio": { - "format": "{volume}% {icon}", - "format-bluetooth": "{volume}% {icon}", - "format-muted": "", - "format-icons": { - "alsa_output.pci-0000_00_1f.3.analog-stereo": "", - "alsa_output.pci-0000_00_1f.3.analog-stereo-muted": "", - "headphone": "", - "hands-free": "", - "headset": "", - "phone": "", - "phone-muted": "", - "portable": "", - "car": "", - "default": [ - "", - "" - ] - }, - "scroll-step": 1, - "on-click": "pavucontrol", - "ignored-sinks": [ - "Easy Effects Sink" - ] - } -} diff --git a/platforms/linux/waybar/style.css b/platforms/linux/waybar/style.css index c149fca..d22641d 100644 --- a/platforms/linux/waybar/style.css +++ b/platforms/linux/waybar/style.css @@ -1,184 +1,354 @@ -/** ********** Fonts ********** **/ +@define-color rosewater #f5e0dc; +@define-color flamingo #f2cdcd; +@define-color pink #f5c2e7; +@define-color mauve #cba6f7; +@define-color red #f38ba8; +@define-color maroon #eba0ac; +@define-color peach #fab387; +@define-color yellow #f9e2af; +@define-color green #a6e3a1; +@define-color teal #94e2d5; +@define-color sky #89dceb; +@define-color sapphire #74c7ec; +@define-color blue #89b4fa; +@define-color lavender #b4befe; +@define-color text #cdd6f4; +@define-color subtext1 #bac2de; +@define-color subtext0 #a6adc8; +@define-color overlay2 #9399b2; +@define-color overlay1 #7f849c; +@define-color overlay0 #6c7086; +@define-color surface2 #585b70; +@define-color surface1 #45475a; +@define-color surface0 #313244; +@define-color base #1e1e2e; +@define-color mantle #181825; +@define-color crust #11111b;* + * { - font-family: "JetBrains Mono", "Iosevka Nerd Font", archcraft, sans-serif; - font-size: 12px; + font-family: 'Maple Mono NF SC', 'Noto Sans Mono', 'Font Awesome 6 Free', 'Font Awesome 6 Brands', monospace; + font-size: 13px; } -/** ********** Waybar Window ********** **/ window#waybar { - background-color: #1e1e2e; - color: #1e1e2e; - border-bottom: 2px solid #313244; + /* background-color: rgba(43, 48, 59, 0.5); */ + /* border-bottom: 3px solid rgba(100, 114, 125, 0.5); */ + background-color: @base; + color: #ffffff; transition-property: background-color; transition-duration: .5s; } window#waybar.hidden { - opacity: 0.5; + opacity: 0.2; } -/** ********** Backlight ********** **/ -#backlight { - background-color: #cba6f7; +/* +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, +#cpu, +#memory, +#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 ********** **/ #battery { - background-color: #f9e2af; + background-color: #ffffff; + color: #000000; } -#battery.charging { -} - -#battery.plugged { +#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: #f38ba8; - color: #f38ba8; + background-color: #f53c3c; + color: #ffffff; animation-name: blink; animation-duration: 0.5s; - animation-timing-function: linear; + animation-timing-function: steps(12); animation-iteration-count: infinite; animation-direction: alternate; } -/** ********** Clock ********** **/ -#clock { - background-color: #a6e3a1; +#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 ********** **/ #cpu { - background-color: #89dceb; + background-color: #2ecc71; + color: #000000; } -/** ********** Memory ********** **/ #memory { - background-color: #eba0ac; + background-color: #9b59b6; } -/** ********** Disk ********** **/ #disk { - background-color: #b4befe; + background-color: #964B00; } -/** ********** Tray ********** **/ -#tray { - background-color: #cdd6f4; +#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; -} -#tray > .active { + background-color: #eb4d4b; +} + +#idle_inhibitor { + background-color: #2d3436; +} + +#idle_inhibitor.activated { + background-color: #ecf0f1; + color: #2d3436; } -/** ********** MPD ********** **/ #mpd { - background-color: #94e2d5; + background-color: #66cc99; + color: #2a5c45; } #mpd.disconnected { - background-color: #f38ba8; + background-color: #f53c3c; } #mpd.stopped { - background-color: #f5c2e7; -} - -#mpd.playing { - background-color: #74c7ec; + background-color: #90b1b1; } #mpd.paused { + background-color: #51a37a; } -/** ********** Pulseaudio ********** **/ -#pulseaudio { - background-color: #fab387; +#language { + background: #00b093; + color: #740864; + padding: 0 5px; + margin: 0 5px; + min-width: 16px; } -#pulseaudio.bluetooth { - background-color: #f5c2e7; -} -#pulseaudio.muted { - background-color: #313244; - color: #cdd6f4; +#keyboard-state { + background: #97e1ad; + color: #000000; + padding: 0 0px; + margin: 0 5px; + min-width: 16px; } -/** ********** Network ********** **/ -#network { - background-color: #89b4fa; +#keyboard-state > label { + padding: 0 5px; } -#network.disconnected,#network.disabled { - background-color: #313244; - color: #cdd6f4; -} -#network.linked { -} -#network.ethernet { -} -#network.wifi { +#keyboard-state > label.locked { + background: rgba(0, 0, 0, 0.2); } -/** ********** Custom ********** **/ -#custom-menu, #custom-power, #custom-weather, #custom-updater { - border-radius: 4px; - margin: 6px 0px; - padding: 2px 8px; +#scratchpad { + background: rgba(0, 0, 0, 0.2); } -#custom-menu { - background-color: #f5c2e7; - margin-left: 6px; - padding: 2px 6px; - font-size: 16px; +#scratchpad.empty { + background-color: transparent; } -#custom-power { - background-color: #f38ba8; - margin-right: 6px; - padding: 2px 8px; - font-size: 16px; +#privacy { + padding: 0; } -#custom-updater { - background-color: #e6ed7b; - margin-right: 6px; - padding: 2px 8px; - font-size: 12px; +#privacy-item { + padding: 0 5px; + color: white; } -#custom-weather { - background-color: #cba6f7; - margin-right: 6px; - padding: 2px 8px; - font-size: 12px; +#privacy-item.screenshare { + background-color: #cf5700; } -/** Common style **/ -#backlight, -#battery, -#clock, -#cpu, -#disk, -#mode, -#memory, -#mpd, -#tray, -#pulseaudio, -#network { - border-radius: 4px; - margin: 6px 0px; - padding: 2px 8px; +#privacy-item.audio-in { + background-color: #1ca000; +} + +#privacy-item.audio-out { + background-color: #0069d4; } From c37d7bb33ec10ef71cf146a99faa5f7744afe7e3 Mon Sep 17 00:00:00 2001 From: js0ny Date: Mon, 7 Apr 2025 08:50:38 +0100 Subject: [PATCH 22/35] feat(waybar): Hyprland workspace --- .../waybar/modules/hyprland-workspace.jsonc | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 platforms/linux/waybar/modules/hyprland-workspace.jsonc diff --git a/platforms/linux/waybar/modules/hyprland-workspace.jsonc b/platforms/linux/waybar/modules/hyprland-workspace.jsonc new file mode 100644 index 0000000..917b78c --- /dev/null +++ b/platforms/linux/waybar/modules/hyprland-workspace.jsonc @@ -0,0 +1,106 @@ + +{ +"hyprland/workspaces#rw": { + "disable-scroll": true, + "all-outputs": true, + "warp-on-scroll": false, + "sort-by-number": true, + "show-special": false, + "on-click": "activate", + "on-scroll-up": "hyprctl dispatch workspace e+1", + "on-scroll-down": "hyprctl dispatch workspace e-1", + "persistent-workspaces": { + "*": 5 + }, + + "format-icons": { + "active": "", + "default": "", + }, + "format": "{icon} {windows}", + "format-window-separator": " ", + "window-rewrite-default": " ", + "window-rewrite": { + "title<.*amazon.*>": " ", + "title<.*reddit.*>": " ", + + "class": " ", + "class": "󰰷 ", + "class": " ", + "class": " ", + "class": " ", + "class": "🦁 ", + "class": " ", + "class": "🦊 ", + + "class": " ", + "class": " ", + "class": " ", + "class": " ", + + "class<[Tt]hunderbird|[Tt]hunderbird-esr>": " ", + "class": " ", + "title<.*gmail.*>": "󰊫 ", + + "class<[Tt]elegram-desktop|org.telegram.desktop|io.github.tdesktop_x64.TDesktop>": " ", + "class": " ", + "title<.*whatsapp.*>": " ", + "title<.*zapzap.*>": " ", + "title<.*messenger.*>": " ", + "title<.*facebook.*>": " ", + "title<.*reddit.*>": " ", + + + "title<.*ChatGPT.*>": "󰚩 ", + "title<.*deepseek.*>": "󰚩 ", + "title<.*qwen.*>": "󰚩 ", + "class": "󰅳 ", + "class": " ", + + "class": " ", + "class": " ", + "class": "󰎆 ", + "title<.*Picture-in-Picture.*>": " ", + "title<.*youtube.*>": " ", + "class": "󰕼 ", + "title<.*cmus.*>": " ", + "class<[Ss]potify>": " ", + + "class": " ", + "class<.virt-manager-wrapped>": " ", + "class": "💽 ", + "title": "💽 ", + "class": "🖥️ ", + + "class": "󰨞 ", + "class": "󰵁", + "class": "󰅩 ", + "title<.*github.*>": " ", + "class": " ", + "class": " ", + "class": "󰏆 ", + "class": " ", + "title<.*nvim ~.*>": " ", + "title<.*vim.*>": " ", + "title<.*nvim.*>": " ", + "title<.*figma.*>": " ", + "title<.*jira.*>": " ", + "class": " ", + + "class": " ", + + "class": "󰒃 ", + "class": " ", + "class<[Pp]avucontrol|org.pulseaudio.pavucontrol>": "󱡫 ", + "class": " ", + "class": "󰝰 ", + "class":"", + "class": " ", + "class": "📱 ", + "class": " ", + "class": "󰓃", + "class":"", + "class": "󰹛", + } + } +} From 866174e7e27b1e8dd5a7414ec4844dcf45941da4 Mon Sep 17 00:00:00 2001 From: js0ny Date: Mon, 7 Apr 2025 08:51:19 +0100 Subject: [PATCH 23/35] Minor fix --- tools/fish/conf.d/0init.fish | 3 ++- tools/nvim/lua/plugins/appearance.lua | 1 + tools/nvim/lua/plugins/mod/snacks-nvim.lua | 16 +++------------- tools/vscode/vscode.vimrc | 7 ++++--- tools/zsh/zprofile | 1 - tools/zsh/zshenv | 10 +++++++++- tools/zsh/zshrc | 2 ++ 7 files changed, 21 insertions(+), 19 deletions(-) diff --git a/tools/fish/conf.d/0init.fish b/tools/fish/conf.d/0init.fish index 6fa2a74..08f8d40 100644 --- a/tools/fish/conf.d/0init.fish +++ b/tools/fish/conf.d/0init.fish @@ -23,13 +23,14 @@ else set -gx XDG_RUNTIME_DIR /run/user/(id -u) end +set -gx GHCUP_USE_XDG_DIRS 1 set -gx PAGER "less -R" set -gx EDITOR nvim set -gx VISUAL nvim # Minimal PATH for early commands -for dir in /usr/local/bin /usr/bin /bin /usr/sbin /sbin "$HOME/.local/bin" +for dir in /usr/local/bin /usr/bin /bin /usr/sbin /sbin "$HOME/.local/bin" /opt/share/bin if test -d "$dir" -a ! -L "$dir" fish_add_path "$dir" end diff --git a/tools/nvim/lua/plugins/appearance.lua b/tools/nvim/lua/plugins/appearance.lua index 16a06b9..f0a2d18 100644 --- a/tools/nvim/lua/plugins/appearance.lua +++ b/tools/nvim/lua/plugins/appearance.lua @@ -80,6 +80,7 @@ return { opts = { current_line_blame = true, }, + event = "BufReadPre", keys = { { "gb", "Gitsigns blame", desc = "Blame file" }, { "gd", "Gitsigns diffthis", desc = "Diff file" }, diff --git a/tools/nvim/lua/plugins/mod/snacks-nvim.lua b/tools/nvim/lua/plugins/mod/snacks-nvim.lua index 6e33e1d..82d1b09 100644 --- a/tools/nvim/lua/plugins/mod/snacks-nvim.lua +++ b/tools/nvim/lua/plugins/mod/snacks-nvim.lua @@ -6,7 +6,7 @@ return { lazy = false, ---@type snacks.Config opts = { - -- bigfile = { enabled = true }, + bigfile = { enabled = true }, dashboard = { enabled = true, preset = { @@ -32,22 +32,12 @@ return { }, }, -- explorer = { - -- -- TODO: Remap some keys in explorer - -- -- win = { - -- -- list = { - -- -- keys = { - -- -- ["l"] = "focus_input", - -- -- ["i"] = "confirm", - -- -- ["O"] = "explorer_open", -- Open with system default - -- -- }, - -- -- }, - -- -- }, -- }, indent = { enabled = true }, -- input = { enabled = true }, - -- notifier = { enabled = true }, + notifier = { enabled = true }, -- quickfile = { enabled = true }, - -- scope = { enabled = true }, + scope = { enabled = true }, -- scroll = { enabled = true }, statuscolumn = { enabled = true }, -- words = { enabled = true }, diff --git a/tools/vscode/vscode.vimrc b/tools/vscode/vscode.vimrc index 0578a25..d545641 100644 --- a/tools/vscode/vscode.vimrc +++ b/tools/vscode/vscode.vimrc @@ -60,7 +60,7 @@ noremap gpr editor.action.referenceSearch.trigger noremap ga editor.action.quickFix " Rename, or [c]hange [d]efinition -noremap cd editor.action.rename +nnoremap cd editor.action.rename " Requires matchit by redguardtoo " nnoremap % extension.matchitJumpItems @@ -74,8 +74,9 @@ vnoremap > editor.action.indentLines " 分词版本的w和b,支持中文,需要插件 " 为了保证递归解析,而不是打断,使用 `nmap` 而不是 `nnoremap` " Comment if you don't use cjk or the plugin -nmap w cjkWordHandler.cursorWordEndRight -nmap b cjkWordHandler.cursorWordStartLeft +" This is buggy +"nmap w cjkWordHandler.cursorWordEndRight +"nmap b cjkWordHandler.cursorWordStartLeft " will be parsed by VSCode itself. " noremap n j diff --git a/tools/zsh/zprofile b/tools/zsh/zprofile index 3bfe9da..e69de29 100644 --- a/tools/zsh/zprofile +++ b/tools/zsh/zprofile @@ -1 +0,0 @@ -export FZF_DEFAULT_OPTS_FILE="$DOTFILES/common/fzfrc" diff --git a/tools/zsh/zshenv b/tools/zsh/zshenv index 943bc7f..d7e852f 100644 --- a/tools/zsh/zshenv +++ b/tools/zsh/zshenv @@ -33,8 +33,11 @@ export PAGER="less -R" export EDITOR="nvim" export VISUAL="nvim" +export GHCUP_USE_XDG_DIRS=1 +export RUSTUP_HOME="$XDG_DATA_HOME"/rustup + # Minimal PATH for early commands -export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH" +export PATH="$HOME/.local/bin:/opt/share/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH" if [ -d "/opt/homebrew/bin" ]; then # macOS export PATH="/opt/homebrew/bin:$PATH" @@ -135,6 +138,10 @@ fi if command -v emacs >/dev/null; then export SPACEMACSDIR="$XDG_CONFIG_HOME"/spacemacs fi +# Fzf +if command -v fzf > /dev/null; then + export FZF_DEFAULT_OPTS_FILE="$HOME/.dotfiles/common/fzfrc" +fi # tldr # Works only with C client (did not verify) if command -v tldr >/dev/null; then @@ -162,3 +169,4 @@ fi if command -v vcpkg >/dev/null; then export VCPKG_ROOT="$XDG_DATA_HOME"/vcpkg fi + diff --git a/tools/zsh/zshrc b/tools/zsh/zshrc index 209532b..26ee997 100644 --- a/tools/zsh/zshrc +++ b/tools/zsh/zshrc @@ -32,3 +32,5 @@ esac for file in $DOTFILES/tools/zsh/mod/*.zsh; do source $file done + +[ -f "/home/js0ny/.local/share/ghcup/env" ] && . "/home/js0ny/.local/share/ghcup/env" # ghcup-env \ No newline at end of file From e0ca95b7a40aa4c9f890112d269202b0459c7350 Mon Sep 17 00:00:00 2001 From: js0ny Date: Tue, 8 Apr 2025 18:29:41 +0100 Subject: [PATCH 24/35] chore(zed): Auto update to new setting items --- tools/zed/keymap.json | 6 +++--- tools/zed/keymap_backup.json | 24 +++++++++++++++++++++--- tools/zed/settings.json | 2 +- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/tools/zed/keymap.json b/tools/zed/keymap.json index 516848a..1d95b9f 100644 --- a/tools/zed/keymap.json +++ b/tools/zed/keymap.json @@ -62,7 +62,7 @@ "context": "vim_mode == normal", "bindings": { - "H": "pane::ActivatePrevItem", + "H": "pane::ActivatePreviousItem", "I": "pane::ActivateNextItem" } }, @@ -89,7 +89,7 @@ "e": "vim::Up", "i": "vim::Right", "k": "search::SelectNextMatch", - "K": "search::SelectPrevMatch", + "K": "search::SelectPreviousMatch", "N": ["workspace::SendKeystrokes", "n n n n n"], "E": ["workspace::SendKeystrokes", "e e e e e"] } @@ -99,7 +99,7 @@ "bindings": { "n": "menu::SelectNext", - "e": "menu::SelectPrev", + "e": "menu::SelectPrevious", "i": "project_panel::ExpandSelectedEntry", "A": "project_panel::NewDirectory", "a": "project_panel::NewFile", diff --git a/tools/zed/keymap_backup.json b/tools/zed/keymap_backup.json index 2791e19..516848a 100644 --- a/tools/zed/keymap_backup.json +++ b/tools/zed/keymap_backup.json @@ -47,20 +47,38 @@ "bindings": { "N": "vim::JoinLines", "l": "vim::InsertBefore", - "L": "vim::InsertFirstNonWhitespace", + "L": "vim::InsertFirstNonWhitespace" + } + }, + { + "context": "vim_mode == visual || vim_mode == operator", + + "bindings": { + "H": "vim::StartOfLine", + "I": "vim::EndOfLine" + } + }, + { + "context": "vim_mode == normal", + + "bindings": { "H": "pane::ActivatePrevItem", "I": "pane::ActivateNextItem" } }, { - "context": "vim_mode == normal || not_editing || EmptyPane", + "context": "GitPanel || ProjectPanel || CollabPanel || OutlinePanel || ChatPanel || VimControl || EmptyPane || SharedScreen || MarkdownPreview || KeyContextView", "bindings": { "space space": "file_finder::Toggle", "space ;": "command_palette::Toggle", "space f c": "zed::OpenSettings", "space f e c": "zed::OpenSettings", - "space f t": "project_panel::ToggleFocus" + "space f t": "project_panel::ToggleFocus", + "ctrl-w h": "workspace::ActivatePaneLeft", + "ctrl-w i": "workspace::ActivatePaneRight", + "ctrl-w e": "workspace::ActivatePaneUp", + "ctrl-w n": "workspace::ActivatePaneDown" } }, { diff --git a/tools/zed/settings.json b/tools/zed/settings.json index af1df69..14e8124 100644 --- a/tools/zed/settings.json +++ b/tools/zed/settings.json @@ -39,6 +39,6 @@ "dark": "Catppuccin Mocha" }, "relative_line_numbers": true, - "buffer_font_family": "JetBrainsMono Nerd Font", + "buffer_font_family": "Maple Mono NF CN", "remove_trailing_whitespace_on_save": true } From c25d4ec182b4f9e56e2844bf5956ca2bc5d516e1 Mon Sep 17 00:00:00 2001 From: js0ny Date: Tue, 8 Apr 2025 18:30:49 +0100 Subject: [PATCH 25/35] feat(nvim): Change picker to FzfLua --- tools/nvim/lua/plugins/appearance.lua | 86 +++++++++---------- tools/nvim/lua/plugins/fileutils.lua | 34 ++++---- .../plugins/lang/markdown/obsidian-nvim.lua | 22 ++++- tools/nvim/lua/plugins/lang/org.lua | 12 +-- tools/nvim/lua/plugins/lazy-nvim.lua | 4 +- tools/nvim/lua/plugins/misc.lua | 7 +- tools/nvim/lua/plugins/mod/avante-nvim.lua | 13 +-- tools/nvim/lua/plugins/mod/fzf.lua | 24 ++++++ tools/nvim/lua/plugins/mod/snacks-nvim.lua | 6 +- tools/nvim/lua/plugins/mod/telescope.lua | 2 +- 10 files changed, 128 insertions(+), 82 deletions(-) diff --git a/tools/nvim/lua/plugins/appearance.lua b/tools/nvim/lua/plugins/appearance.lua index f0a2d18..3ba6ab5 100644 --- a/tools/nvim/lua/plugins/appearance.lua +++ b/tools/nvim/lua/plugins/appearance.lua @@ -32,9 +32,9 @@ return { opts = { variant = "dawn", }, - cmd = "Telescope colorscheme", + cmd = "FzfLua colorschemes", }, - { "rebelot/kanagawa.nvim", cmd = "Telescope colorscheme" }, + { "rebelot/kanagawa.nvim", cmd = "FzfLua colorschemes" }, { -- Modern Status Line "nvim-lualine/lualine.nvim", dependencies = { "nvim-tree/nvim-web-devicons" }, @@ -43,55 +43,55 @@ return { require("plugins.mod.lualine") end, }, - { -- Breadcrumb - "Bekaboo/dropbar.nvim", - dependencies = { - "nvim-telescope/telescope-fzf-native.nvim", - build = "make", - }, - opts = {}, - keys = { - { - "+", - function() - require("dropbar.api").pick() - end, - desc = "Pick symbols in winbar", - }, - { - "[;", - function() - require("dropbar.api").goto_context_start() - end, - desc = "Go to start of current context", - }, - { - "];", - function() - require("dropbar.api").select_next_context() - end, - desc = "Select next context", - }, - }, - }, + -- { -- Breadcrumb + -- "Bekaboo/dropbar.nvim", + -- dependencies = { + -- "nvim-telescope/telescope-fzf-native.nvim", + -- build = "make", + -- }, + -- opts = {}, + -- keys = { + -- { + -- "+", + -- function() + -- require("dropbar.api").pick() + -- end, + -- desc = "Pick symbols in winbar", + -- }, + -- { + -- "[;", + -- function() + -- require("dropbar.api").goto_context_start() + -- end, + -- desc = "Go to start of current context", + -- }, + -- { + -- "];", + -- function() + -- require("dropbar.api").select_next_context() + -- end, + -- desc = "Select next context", + -- }, + -- }, + -- }, { import = "plugins.mod.bufferline" }, -- Buffer Top Bar - { -- Git Blames, Changes + { -- Git Blames, Changes "lewis6991/gitsigns.nvim", opts = { current_line_blame = true, }, event = "BufReadPre", keys = { - { "gb", "Gitsigns blame", desc = "Blame file" }, - { "gd", "Gitsigns diffthis", desc = "Diff file" }, + { "gb", "Gitsigns blame", desc = "Blame file" }, + { "gd", "Gitsigns diffthis", desc = "Diff file" }, { "gB", "Gitsigns toggle_current_line_blame", desc = "Toggle line blame" }, }, }, - { -- Highlight and navigate between TODOs - "folke/todo-comments.nvim", - cmd = { "TodoTelescope" }, - event = "BufRead", - opts = {}, - dependencies = { "nvim-lua/plenary.nvim" }, - }, + -- { -- Highlight and navigate between TODOs + -- "folke/todo-comments.nvim", + -- cmd = { "TodoTelescope" }, + -- event = "BufRead", + -- opts = {}, + -- dependencies = { "nvim-lua/plenary.nvim" }, + -- }, } diff --git a/tools/nvim/lua/plugins/fileutils.lua b/tools/nvim/lua/plugins/fileutils.lua index 5f18020..d78119a 100644 --- a/tools/nvim/lua/plugins/fileutils.lua +++ b/tools/nvim/lua/plugins/fileutils.lua @@ -11,23 +11,23 @@ return { }, }, -- { import = "plugins.mod.nvim-tree" }, - { import = "plugins.mod.telescope" }, - -- { import = "plugins.mod.fzf" }, - { - "ahmedkhalf/project.nvim", - event = "VeryLazy", - opts = { - detection_methods = { "lsp", "pattern" }, - patterns = { ".git", "Makefile", "package.json" }, - sync_root_with_cwd = true, - silent_chdir = true, - scope_chdir = "global", - }, - config = function() - require("telescope").load_extension("projects") - end, - dependencies = { "nvim-telescope/telescope.nvim" }, - }, + -- { import = "plugins.mod.telescope" }, + { import = "plugins.mod.fzf" }, + -- { + -- "ahmedkhalf/project.nvim", + -- event = "VeryLazy", + -- opts = { + -- detection_methods = { "lsp", "pattern" }, + -- patterns = { ".git", "Makefile", "package.json" }, + -- sync_root_with_cwd = true, + -- silent_chdir = true, + -- scope_chdir = "global", + -- }, + -- config = function() + -- require("telescope").load_extension("projects") + -- end, + -- dependencies = { "nvim-telescope/telescope.nvim" }, + -- }, -- { -- "NeogitOrg/neogit", -- config = true, diff --git a/tools/nvim/lua/plugins/lang/markdown/obsidian-nvim.lua b/tools/nvim/lua/plugins/lang/markdown/obsidian-nvim.lua index befc64a..584c96a 100644 --- a/tools/nvim/lua/plugins/lang/markdown/obsidian-nvim.lua +++ b/tools/nvim/lua/plugins/lang/markdown/obsidian-nvim.lua @@ -1,5 +1,5 @@ return { - "epwalsh/obsidian.nvim", + "obsidian-nvim/obsidian.nvim", version = "*", -- recommended, use latest release instead of latest commit -- lazy = false, ft = "markdown", @@ -38,11 +38,15 @@ return { -- "BufReadPre path/to/my-vault/*.md", -- "BufNewFile path/to/my-vault/*.md", -- }, + keys = { + { "fo", "ObsidianQuickSwitch", desc = "Obsidian: Quick Switch" }, + }, dependencies = { -- Required. "nvim-lua/plenary.nvim", -- see below for full list of optional dependencies 👇 + "ibhagwan/fzf-lua", }, opts = { workspaces = { @@ -53,11 +57,18 @@ return { }, completion = { nvim_cmp = false, + blink = true, min_chars = 2, }, ui = { enable = false, }, + daily_notes = { + folder = "_Global/Periodic", + date_format = "%Y-%m-%d", + default_tags = { "daily" }, + template = nil, + }, -- see below for full list of options 👇 attachments = { img_folder = "_Global/Assets", @@ -65,5 +76,14 @@ return { return string.format("%s-", os.time()) end, }, + mappings = { + [""] = { + action = function() + require("obsidian").util.smart_action() + end, + opts = { buffer = true, expr = true }, + }, + }, + new_notes_location = "current_dir", }, } diff --git a/tools/nvim/lua/plugins/lang/org.lua b/tools/nvim/lua/plugins/lang/org.lua index 76d0175..a74c3d4 100644 --- a/tools/nvim/lua/plugins/lang/org.lua +++ b/tools/nvim/lua/plugins/lang/org.lua @@ -2,8 +2,8 @@ return { { "nvim-orgmode/orgmode", dependencies = { - "nvim-telescope/telescope.nvim", - "nvim-orgmode/telescope-orgmode.nvim", + -- "nvim-telescope/telescope.nvim", + -- "nvim-orgmode/telescope-orgmode.nvim", "nvim-orgmode/org-bullets.nvim", "Saghen/blink.cmp", }, @@ -65,11 +65,11 @@ return { }, }) - require("telescope").setup() - require("telescope").load_extension("orgmode") + -- require("telescope").setup() + -- require("telescope").load_extension("orgmode") -- vim.keymap.set("n", "r", require("telescope").extensions.orgmode.refile_heading) - vim.keymap.set("n", "oP", require("telescope").extensions.orgmode.search_headings) - vim.keymap.set("n", "op", "Telescope find_files cwd=~/OrgFiles") + -- vim.keymap.set("n", "oP", require("telescope").extensions.orgmode.search_headings) + vim.keymap.set("n", "op", "FzfLua files cwd=~/OrgFiles") -- vim.keymap.set("n", "li", require("telescope").extensions.orgmode.insert_link) end, }, diff --git a/tools/nvim/lua/plugins/lazy-nvim.lua b/tools/nvim/lua/plugins/lazy-nvim.lua index c1396ee..f511aca 100644 --- a/tools/nvim/lua/plugins/lazy-nvim.lua +++ b/tools/nvim/lua/plugins/lazy-nvim.lua @@ -6,7 +6,7 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then if vim.v.shell_error ~= 0 then vim.api.nvim_echo({ { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, - { out, "WarningMsg" }, + { out, "WarningMsg" }, { "\nPress any key to exit..." }, }, true, {}) vim.fn.getchar() @@ -19,4 +19,4 @@ vim.opt.rtp:prepend(lazypath) -- loading lazy.nvim so that mappings are correct. -- This is also a good place to setup other settings (vim.opt) vim.g.mapleader = " " -vim.g.maplocalleader = "" +vim.g.maplocalleader = "\\" diff --git a/tools/nvim/lua/plugins/misc.lua b/tools/nvim/lua/plugins/misc.lua index 3514978..cb9db10 100644 --- a/tools/nvim/lua/plugins/misc.lua +++ b/tools/nvim/lua/plugins/misc.lua @@ -1,6 +1,6 @@ return { - { "nvim-lua/plenary.nvim", lazy = true }, - { "wakatime/vim-wakatime", lazy = false }, + { "nvim-lua/plenary.nvim", lazy = true }, + { "wakatime/vim-wakatime", lazy = false }, { import = "plugins.mod.toggleterm" }, { import = "plugins.mod.which-keys-nvim" }, { import = "plugins.mod.copilot-lua" }, @@ -14,7 +14,8 @@ return { lazy = true, -- event = "VeryLazy", dependencies = { - "nvim-telescope/telescope.nvim", + -- "nvim-telescope/telescope.nvim", + "ibhagwan/fzf-lua", "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim", }, diff --git a/tools/nvim/lua/plugins/mod/avante-nvim.lua b/tools/nvim/lua/plugins/mod/avante-nvim.lua index 9e8ea29..90b0d6b 100644 --- a/tools/nvim/lua/plugins/mod/avante-nvim.lua +++ b/tools/nvim/lua/plugins/mod/avante-nvim.lua @@ -8,10 +8,10 @@ return { -- for example provider = "openai", openai = { - endpoint = "https://yunwu.ai/v1", + endpoint = "https://aihubmix.com/v1", model = "claude-3-7-sonnet-20250219", -- your desired model (or use gpt-4o, etc.) - timeout = 30000, -- timeout in milliseconds - temperature = 0, -- adjust if needed + timeout = 30000, -- timeout in milliseconds + temperature = 0, -- adjust if needed max_tokens = 4096, -- reasoning_effort = "high" -- only supported for "o" models }, @@ -25,10 +25,11 @@ return { "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim", --- The below dependencies are optional, - "nvim-telescope/telescope.nvim", -- for file_selector provider telescope - "hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions + -- "nvim-telescope/telescope.nvim", -- for file_selector provider telescope + "ibhagwan/fzf-lua", + "hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions "nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons - "zbirenbaum/copilot.lua", -- for providers='copilot' + "zbirenbaum/copilot.lua", -- for providers='copilot' { -- support for image pasting "HakonHarnes/img-clip.nvim", diff --git a/tools/nvim/lua/plugins/mod/fzf.lua b/tools/nvim/lua/plugins/mod/fzf.lua index dc149e3..45507c1 100644 --- a/tools/nvim/lua/plugins/mod/fzf.lua +++ b/tools/nvim/lua/plugins/mod/fzf.lua @@ -2,5 +2,29 @@ return { "ibhagwan/fzf-lua", -- optional for icon support dependencies = { "nvim-tree/nvim-web-devicons" }, + cmd = "FzfLua", + keys = { + { "", "FzfLua files", desc = "Find Files" }, + { "fc", "FzfLua files cwd=~/.config/nvim", desc = "Edit configs" }, + { "/", "FzfLua live_grep", desc = "Grep Files" }, + { ";", "FzfLua", desc = "Show Telescope Commands" }, + { "ui", "FzfLua colorschemes", desc = "Change colorscheme" }, + -- find_files { "pp", "FzfLua projects", desc = "Listfind_files all Projects" }, + { "pd", "FzfLua zoxide", desc = "List recent directories" }, + -- { "pg", "FzfLua projects", desc = "List all Git Projects" }, + { "ps", "FzfLua session-lens", desc = "List all sessions" }, + { "gs", "FzfLua git_status", desc = "Git Status" }, + { "gt", "FzfLua git_branches", desc = "Git Branches" }, + { "gc", "FzfLua git_commits", desc = "Show commits" }, + { "fb", "FzfLua buffers", desc = "List Buffers" }, + { "ff", "FzfLua fd", desc = "Find Files" }, + { "fh", "FzfLua oldfiles", desc = "Recent Files" }, + { "ce", "FzfLua diagnostics", desc = "Navigate errors/warnings" }, + { "cs", "FzfLua treesitter", desc = "Search symbols" }, + { "cS", "FzfLua grep_string", desc = "Search current symbol" }, + { "bB", "FzfLua buffers", desc = "List Buffers" }, + { "fl", ":FzfLua filetypes", desc = "Set Filetype/Lang to ..." }, + { "R", "FzfLua resume", desc = "Resume FzfLua" }, + }, opts = {}, } diff --git a/tools/nvim/lua/plugins/mod/snacks-nvim.lua b/tools/nvim/lua/plugins/mod/snacks-nvim.lua index 82d1b09..998cb6c 100644 --- a/tools/nvim/lua/plugins/mod/snacks-nvim.lua +++ b/tools/nvim/lua/plugins/mod/snacks-nvim.lua @@ -11,14 +11,14 @@ return { enabled = true, preset = { keys = { - { key = "p", icon = "󰈞 ", desc = "查找项目", action = "Telescope projects" }, - { key = "h", icon = " ", desc = "历史文件", action = "Telescope oldfiles" }, + -- { key = "p", icon = "󰈞 ", desc = "查找项目", action = "Telescope projects" }, + { key = "h", icon = " ", desc = "历史文件", action = "FzfLua oldfiles" }, { key = "l", icon = " ", desc = "加载会话", action = "SessionSearch" }, { key = "c", icon = " ", desc = "转到设置", - action = "Telescope find_files cwd=~/.config/nvim", + action = "FzfLua files cwd=~/.config/nvim", }, { key = "q", icon = "󱊷 ", desc = "退出", action = "qa" }, }, diff --git a/tools/nvim/lua/plugins/mod/telescope.lua b/tools/nvim/lua/plugins/mod/telescope.lua index e55145d..6a5d4ca 100644 --- a/tools/nvim/lua/plugins/mod/telescope.lua +++ b/tools/nvim/lua/plugins/mod/telescope.lua @@ -33,7 +33,7 @@ return { { "fc", "Telescope find_files cwd=~/.config/nvim", desc = "Edit configs" }, { "/", "Telescope live_grep", desc = "Grep Files" }, { ";", "Telescope", desc = "Show Telescope Commands" }, - { "ui", "Telescope colorscheme", desc = "Change colorscheme" }, + { "ui", "FzfLua colorscheme", desc = "Change colorscheme" }, { "pp", "Telescope projects", desc = "List all Projects" }, { "pg", "Telescope projects", desc = "List all Git Projects" }, { "ps", "Telescope session-lens", desc = "List all sessions" }, From 6eff59e387f10070d002a3868328610a646a7f8b Mon Sep 17 00:00:00 2001 From: js0ny Date: Tue, 8 Apr 2025 19:05:25 +0100 Subject: [PATCH 26/35] feat(nvim): FzfLua as Picker --- tools/nvim/lua/config/colorscheme.lua | 2 +- tools/nvim/lua/keymaps/leaders.lua | 2 +- tools/nvim/lua/keymaps/modifier.lua | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/nvim/lua/config/colorscheme.lua b/tools/nvim/lua/config/colorscheme.lua index 8740356..503070c 100644 --- a/tools/nvim/lua/config/colorscheme.lua +++ b/tools/nvim/lua/config/colorscheme.lua @@ -1,2 +1,2 @@ --- Change the colorscheme here, use SPACE u i or :Telescope colorscheme to change colorscheme +-- Change the colorscheme here, use SPACE u i or :FzfLua colorscheme to change colorscheme vim.cmd.colorscheme("catppuccin") diff --git a/tools/nvim/lua/keymaps/leaders.lua b/tools/nvim/lua/keymaps/leaders.lua index 5932ed2..4146870 100644 --- a/tools/nvim/lua/keymaps/leaders.lua +++ b/tools/nvim/lua/keymaps/leaders.lua @@ -91,7 +91,7 @@ local leader_mappings = { { keys = "S", cmd = ":wall", opts = { desc = "Save All Files" } }, { keys = "D", cmd = "!trash-rm %", opts = { desc = "Delete current file" } }, -- { keys = "t", cmd = ":NvimTreeFindFileToggle", opts = { desc = "Toggle File Tree" } }, - { keys = "o", cmd = ":!open %", opts = { desc = "Open file in default program" } }, + -- { keys = "o", cmd = ":!open %", opts = { desc = "Open file in default program" } }, { keys = "R", cmd = renameCurrentBuffer, opts = { desc = "Rename current file" } }, { keys = "x", cmd = ":Lazy", opts = { desc = "Open extension view" } }, { keys = "yy", cmd = ":let @+ = expand('%:p')", opts = { desc = "Copy file path" } }, diff --git a/tools/nvim/lua/keymaps/modifier.lua b/tools/nvim/lua/keymaps/modifier.lua index cfcd38d..cd4b90a 100644 --- a/tools/nvim/lua/keymaps/modifier.lua +++ b/tools/nvim/lua/keymaps/modifier.lua @@ -1,10 +1,10 @@ local keymaps_modifier = { -- Use C-w to move between windows - { keys = "h", cmd = "h", opts = { desc = "left Window" } }, - { keys = "n", cmd = "j", opts = { desc = "Down Window" } }, - { keys = "e", cmd = "k", opts = { desc = "Up Window" } }, - { keys = "i", cmd = "l", opts = { desc = "Right Window" } }, - { keys = "", cmd = "Telescope commands", opts = { desc = "Commands" } }, + { keys = "h", cmd = "h", opts = { desc = "left Window" } }, + { keys = "n", cmd = "j", opts = { desc = "Down Window" } }, + { keys = "e", cmd = "k", opts = { desc = "Up Window" } }, + { keys = "i", cmd = "l", opts = { desc = "Right Window" } }, + { keys = "", cmd = "FzfLua commands", opts = { desc = "Commands" } }, } return keymaps_modifier From bc0b70b0f9ba7145c751013121daced17506e7e5 Mon Sep 17 00:00:00 2001 From: js0ny Date: Tue, 8 Apr 2025 19:05:42 +0100 Subject: [PATCH 27/35] feat(nvim): Enhanced treesitter and separate configs --- tools/nvim/lua/plugins/lang/init.lua | 19 +------------------ tools/nvim/lua/plugins/lang/treesitter.lua | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 18 deletions(-) create mode 100644 tools/nvim/lua/plugins/lang/treesitter.lua diff --git a/tools/nvim/lua/plugins/lang/init.lua b/tools/nvim/lua/plugins/lang/init.lua index 5d390eb..08be240 100644 --- a/tools/nvim/lua/plugins/lang/init.lua +++ b/tools/nvim/lua/plugins/lang/init.lua @@ -6,6 +6,7 @@ return { { import = "plugins.lang.beancount" }, { import = "plugins.lang.tex" }, { import = "plugins.lang.lua" }, + { import = "plugins.lang.treesitter" }, { import = "plugins.mod.trouble-nvim" }, { "williamboman/mason.nvim", @@ -29,22 +30,4 @@ return { -- }, -- }, { import = "plugins.mod.conform-nvim" }, - { "nvim-treesitter/nvim-treesitter-context", lazy = true }, - { - "nvim-treesitter/nvim-treesitter", - run = ":TSUpdate", - cmd = { - "TSInstall", - "TSUpdate", - "TSUpdateSync", - }, - event = { - "VeryLazy", - }, - opts = { - ensure_installed = { "c", "lua", "vim", "vimdoc", "markdown", "markdown_inline" }, - highlight = { enable = true }, - indent = { enable = true }, - }, - }, } diff --git a/tools/nvim/lua/plugins/lang/treesitter.lua b/tools/nvim/lua/plugins/lang/treesitter.lua new file mode 100644 index 0000000..c778722 --- /dev/null +++ b/tools/nvim/lua/plugins/lang/treesitter.lua @@ -0,0 +1,20 @@ +return { + { "nvim-treesitter/nvim-treesitter-context", lazy = true }, + { + "nvim-treesitter/nvim-treesitter", + run = ":TSUpdate", + cmd = { + "TSInstall", + "TSUpdate", + "TSUpdateSync", + }, + event = { + "BufReadPre", + }, + opts = { + ensure_installed = { "c", "lua", "vim", "vimdoc", "markdown", "markdown_inline" }, + highlight = { enable = true }, + indent = { enable = true }, + }, + }, +} From 9d6298009cc7a054c6b5b19e24bfa54fdb7cc634 Mon Sep 17 00:00:00 2001 From: js0ny Date: Tue, 8 Apr 2025 19:05:54 +0100 Subject: [PATCH 28/35] feat(waybar): More icons for apps --- .../waybar/modules/hyprland-workspace.jsonc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/platforms/linux/waybar/modules/hyprland-workspace.jsonc b/platforms/linux/waybar/modules/hyprland-workspace.jsonc index 917b78c..dafc09c 100644 --- a/platforms/linux/waybar/modules/hyprland-workspace.jsonc +++ b/platforms/linux/waybar/modules/hyprland-workspace.jsonc @@ -26,6 +26,7 @@ "class": " ", "class": "󰰷 ", + "class": "󰰬 ", "class": " ", "class": " ", "class": " ", @@ -33,7 +34,7 @@ "class": " ", "class": "🦊 ", - "class": " ", + "class": " ", "class": " ", "class": " ", "class": " ", @@ -72,22 +73,28 @@ "title": "💽 ", "class": "🖥️ ", - "class": "󰨞 ", - "class": "󰵁", + "class": "󰨞 ", + "class": "󰵁", "class": "󰅩 ", "title<.*github.*>": " ", "class": " ", "class": " ", "class": "󰏆 ", "class": " ", - "title<.*nvim ~.*>": " ", + // "title<.*nvim ~.*>": " ", "title<.*vim.*>": " ", "title<.*nvim.*>": " ", + "class": " ", + "class": " ", + "class": "🍒", "title<.*figma.*>": " ", "title<.*jira.*>": " ", "class": " ", - "class": " ", + "class": " ", + "class": "󱉟 ", + + "class": " ", "class": "󰒃 ", "class": " ", From 09ea52b06452b2ded378f70f3b4f5fdd987979cc Mon Sep 17 00:00:00 2001 From: js0ny Date: Tue, 8 Apr 2025 20:22:47 +0100 Subject: [PATCH 29/35] feat(screen): Add screen config (for tty connection) --- tools/screen/+colemak.screenrc | 15 +++++++++ tools/screen/+qwerty.screenrc | 16 ++++++++++ tools/screen/screenrc | 56 ++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 tools/screen/+colemak.screenrc create mode 100644 tools/screen/+qwerty.screenrc create mode 100644 tools/screen/screenrc diff --git a/tools/screen/+colemak.screenrc b/tools/screen/+colemak.screenrc new file mode 100644 index 0000000..32257b0 --- /dev/null +++ b/tools/screen/+colemak.screenrc @@ -0,0 +1,15 @@ +# vim: ft=screen + +bind h focus left +bind n focus down +bind e focus up +bind i focus right + +bind H resize -h -5 +bind N resize -v +5 +bind E resize -v -5 +bind I resize -h +5 + +# Window navigation (prev/next) +bind ^h prev +bind ^i next diff --git a/tools/screen/+qwerty.screenrc b/tools/screen/+qwerty.screenrc new file mode 100644 index 0000000..95768e3 --- /dev/null +++ b/tools/screen/+qwerty.screenrc @@ -0,0 +1,16 @@ +# vim: ft=screen + +bind h focus left +bind j focus down +bind k focus up +bind l focus right + +bind H resize -h -5 +bind J resize -v +5 +bind K resize -v -5 +bind L resize -h +5 + +# Window navigation (prev/next) +bind ^h prev +bind ^l next + diff --git a/tools/screen/screenrc b/tools/screen/screenrc new file mode 100644 index 0000000..957cb4b --- /dev/null +++ b/tools/screen/screenrc @@ -0,0 +1,56 @@ +# export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc +# export SCREENDIR="${XDG_RUNTIME_DIR}/screen" +# $XDG_CONFIG_HOME/screen/screenrc + +# Set prefix key to Ctrl-a +escape ^Aa +# Allow sending Ctrl+a to applications by pressing Ctrl+a twice +bind a command -c screen + +# Enable mouse scrolling and click +termcapinfo xterm* ti@:te@ + +# 256 colors support +term screen-256color +attrcolor b ".I" +defbce "on" + +# Set window titles +autodetach on +shelltitle "$ |bash" +startup_message off +altscreen on +defscrollback 4096 # History limit + +# Status line (similar to tmux status bar) +hardstatus alwayslastline +hardstatus string '%{= kG}[%{G}%H%{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c%{g}]' + +# Start window numbering at 1 +bind c screen 1 +bind 0 select 10 +bind ^c screen 1 +screen 1 + +# Visual bell instead of audible bell +vbell on +vbell_msg " Bell " + +# Window splitting with | and - +# Note: Screen doesn't support true splitting like tmux +# These commands just create regions, not true panes +bind | split +bind - split -v + +# Default to vi keybindings +defutf8 on +defescape ^Aa +markkeys h=^B:l=^F:$=^E:^U=^Z:^D=^V + +bind x kill + +source ~/.config/screen/+colemak.screenrc + + +# Reload config (not directly supported in screen, but added for reference) +# To reload config in screen, you typically do Ctrl+a : source ~/.screenrc From 5c526106ee65f5386a1a4a39f759206098575178 Mon Sep 17 00:00:00 2001 From: js0ny Date: Tue, 8 Apr 2025 20:23:00 +0100 Subject: [PATCH 30/35] feat(screen): Add screen config for tty connections --- Justfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Justfile b/Justfile index f27306c..5c6cdd2 100644 --- a/Justfile +++ b/Justfile @@ -180,6 +180,10 @@ fish: {{LN}} {{DOTFILES}}/tools/fish {{XDG_CONFIG_HOME}}/fish curl -L https://raw.githubusercontent.com/SpaceAceMonkey/dotenv-for-fish/refs/heads/main/dotenv.fish -o "{{DOTFILES}}/tools/fish/functions/dotenv.fish" +[unix] +screen: + {{LN}} {{DOTFILES}}/tools/screen {{XDG_CONFIG_HOME}}/screen + [unix] zsh: From 4270bc9e5d0f54750e3373d5ce29d02e75548df1 Mon Sep 17 00:00:00 2001 From: js0ny Date: Wed, 9 Apr 2025 01:23:32 +0100 Subject: [PATCH 31/35] feat(hypr): dunst, swaylock --- Justfile | 18 +- platforms/linux/dunstrc | 495 ++++++++++++++++++ platforms/linux/hypr/hypridle.conf | 5 + platforms/linux/hypr/hyprland.conf | 54 +- platforms/linux/hypr/hyprland/+colemak.conf | 10 + platforms/linux/hypr/hyprland/+qwerty.conf | 11 + platforms/linux/hypr/{ => hyprland}/dark.conf | 6 + platforms/linux/hypr/hyprland/rules.conf | 78 +++ platforms/linux/swaylock | 6 + platforms/linux/waybar/config.jsonc | 190 +------ .../waybar/modules/hyprland-workspace.jsonc | 12 +- platforms/linux/waybar/modules/misc.jsonc | 187 +++++++ platforms/linux/waybar/style.css | 6 +- 13 files changed, 846 insertions(+), 232 deletions(-) create mode 100644 platforms/linux/dunstrc create mode 100644 platforms/linux/hypr/hyprland/+colemak.conf create mode 100644 platforms/linux/hypr/hyprland/+qwerty.conf rename platforms/linux/hypr/{ => hyprland}/dark.conf (78%) create mode 100644 platforms/linux/hypr/hyprland/rules.conf create mode 100644 platforms/linux/swaylock create mode 100644 platforms/linux/waybar/modules/misc.jsonc diff --git a/Justfile b/Justfile index 5c6cdd2..5da1fca 100644 --- a/Justfile +++ b/Justfile @@ -184,7 +184,6 @@ fish: screen: {{LN}} {{DOTFILES}}/tools/screen {{XDG_CONFIG_HOME}}/screen - [unix] zsh: -[[ -f /etc/zshenv ]] && sudo cp {{DOTFILES}}/tools/zsh/global.zshenv /etc/zshenv # or /etc/zsh/zshenv @@ -202,10 +201,25 @@ zsh: flatpak: flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo +[linux] +swaylock: + mkdir -p {{XDG_CONFIG_HOME}}/swaylock + {{LN}} {{DOTFILES}}/platforms/linux/swaylock {{XDG_CONFIG_HOME}}/swaylock/config + +[linux] +dunst: + mkdir -p {{XDG_CONFIG_HOME}}/dunst + {{LN}} {{DOTFILES}}/platforms/linux/dunst {{XDG_CONFIG_HOME}}/dunst/dunstrc + +[linux] +hyprland: + {{LN}} {{DOTFILES}}/platforms/linux/hypr {{XDG_CONFIG_HOME}}/hypr + @just dunst + @just swaylock + [private] pull: git pull github master - git pull codeberg master [private] diff --git a/platforms/linux/dunstrc b/platforms/linux/dunstrc new file mode 100644 index 0000000..ca6fb18 --- /dev/null +++ b/platforms/linux/dunstrc @@ -0,0 +1,495 @@ +# See dunst(5) for all configuration options + +[global] + ### Display ### + + # Which monitor should the notifications be displayed on. + monitor = 0 + + # Display notification on focused monitor. Possible modes are: + # mouse: follow mouse pointer + # keyboard: follow window with keyboard focus + # none: don't follow anything + # + # "keyboard" needs a window manager that exports the + # _NET_ACTIVE_WINDOW property. + # This should be the case for almost all modern window managers. + # + # If this option is set to mouse or keyboard, the monitor option + # will be ignored. + follow = none + + ### Geometry ### + + # The width of the window, excluding the frame. + # dynamic width from 0 to 300 + # width = (0, 300) + # constant width of 300 + width = 300 + + # The height of a single notification, excluding the frame. + # dynamic height from 0 to 300 + height = (0, 300) + # constant height of 300 + # height = 300 + # NOTE: Dunst from version 1.11 and older don't support dynamic height + # and the given value is treated as the maximum height + + # Position the notification in the top right corner + origin = top-right + + # Offset from the origin + # NOTE: Dunst from version 1.11 and older use this alternative notation + # offset = 10x50 + offset = (10, 50) + + # Scale factor. It is auto-detected if value is 0. + scale = 2 + + # Maximum number of notification (0 means no limit) + notification_limit = 20 + + ### Progress bar ### + + # Turn on the progress bar. It appears when a progress hint is passed with + # for example dunstify -h int:value:12 + progress_bar = true + + # Set the progress bar height. This includes the frame, so make sure + # it's at least twice as big as the frame width. + progress_bar_height = 10 + + # Set the frame width of the progress bar + progress_bar_frame_width = 1 + + # Set the minimum width for the progress bar + progress_bar_min_width = 150 + + # Set the maximum width for the progress bar + progress_bar_max_width = 300 + + # Corner radius for the progress bar. 0 disables rounded corners. + progress_bar_corner_radius = 0 + + # Define which corners to round when drawing the progress bar. If progress_bar_corner_radius + # is set to 0 this option will be ignored. + progress_bar_corners = all + + # Corner radius for the icon image. + icon_corner_radius = 0 + + # Define which corners to round when drawing the icon image. If icon_corner_radius + # is set to 0 this option will be ignored. + icon_corners = all + + # Show how many messages are currently hidden (because of + # notification_limit). + indicate_hidden = yes + + # The transparency of the window. Range: [0; 100]. + # This option will only work if a compositing window manager is + # present (e.g. xcompmgr, compiz, etc.). (X11 only) + transparency = 0 + + # Draw a line of "separator_height" pixel height between two + # notifications. + # Set to 0 to disable. + # If gap_size is greater than 0, this setting will be ignored. + separator_height = 2 + + # Padding between text and separator. + padding = 8 + + # Horizontal padding. + horizontal_padding = 8 + + # Padding between text and icon. + text_icon_padding = 0 + + # Defines width in pixels of frame around the notification window. + # Set to 0 to disable. + frame_width = 3 + + # Defines color of the frame around the notification window. + frame_color = "#89b4fa" + highlight = "#89b4fa" + + # Size of gap to display between notifications - requires a compositor. + # If value is greater than 0, separator_height will be ignored and a border + # of size frame_width will be drawn around each notification instead. + # Click events on gaps do not currently propagate to applications below. + gap_size = 0 + + # Define a color for the separator. + # possible values are: + # * auto: dunst tries to find a color fitting to the background; + # * foreground: use the same color as the foreground; + # * frame: use the same color as the frame; + # * anything else will be interpreted as a X color. + separator_color = frame + + # Sort type. + # possible values are: + # * id: sort by id + # * urgency_ascending: sort by urgency (low then normal then critical) + # * urgency_descending: sort by urgency (critical then normal then low) + # * update: sort by update (most recent always at the top) + sort = yes + + # Don't remove messages, if the user is idle (no mouse or keyboard input) + # for longer than idle_threshold seconds. + # Set to 0 to disable. + # A client can set the 'transient' hint to bypass this. See the rules + # section for how to disable this if necessary + # idle_threshold = 120 + + ### Text ### + + font = Maple Mono NF CN 8 + + # The spacing between lines. If the height is smaller than the + # font height, it will get raised to the font height. + line_height = 0 + + # Possible values are: + # full: Allow a small subset of html markup in notifications: + # bold + # italic + # strikethrough + # underline + # + # For a complete reference see + # . + # + # strip: This setting is provided for compatibility with some broken + # clients that send markup even though it's not enabled on the + # server. Dunst will try to strip the markup but the parsing is + # simplistic so using this option outside of matching rules for + # specific applications *IS GREATLY DISCOURAGED*. + # + # no: Disable markup parsing, incoming notifications will be treated as + # plain text. Dunst will not advertise that it has the body-markup + # capability if this is set as a global setting. + # + # It's important to note that markup inside the format option will be parsed + # regardless of what this is set to. + markup = full + + # The format of the message. Possible variables are: + # %a appname + # %s summary + # %b body + # %i iconname (including its path) + # %I iconname (without its path) + # %p progress value if set ([ 0%] to [100%]) or nothing + # %n progress value if set without any extra characters + # %% Literal % + # Markup is allowed + format = "%s\n%b" + + # Alignment of message text. + # Possible values are "left", "center" and "right". + alignment = left + + # Vertical alignment of message text and icon. + # Possible values are "top", "center" and "bottom". + vertical_alignment = center + + # Show age of message if message is older than show_age_threshold + # seconds. + # Set to -1 to disable. + show_age_threshold = 60 + + # Specify where to make an ellipsis in long lines. + # Possible values are "start", "middle" and "end". + ellipsize = middle + + # Ignore newlines '\n' in notifications. + ignore_newline = no + + # Stack together notifications with the same content + stack_duplicates = true + + # Hide the count of stacked notifications with the same content + hide_duplicate_count = false + + # Display indicators for URLs (U) and actions (A). + show_indicators = yes + + ### Icons ### + + # Recursive icon lookup. You can set a single theme, instead of having to + # define all lookup paths. + enable_recursive_icon_lookup = true + + # Set icon theme (only used for recursive icon lookup) + icon_theme = "Papirus-Dark, Papirus, breeze, Adwaita" + # You can also set multiple icon themes, with the leftmost one being used first. + # icon_theme = "Adwaita, breeze" + + # Align icons left/right/top/off + icon_position = left + + # Scale small icons up to this size, set to 0 to disable. Helpful + # for e.g. small files or high-dpi screens. In case of conflict, + # max_icon_size takes precedence over this. + min_icon_size = 32 + + # Scale larger icons down to this size, set to 0 to disable + max_icon_size = 128 + + # Paths to default icons (only necessary when not using recursive icon lookup) + icon_path = /home/js0ny/.local/share/icons/ePapirus/16x16/:/usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/ + + ### History ### + + # Should a notification popped up from history be sticky or timeout + # as if it would normally do. + sticky_history = yes + + # Maximum amount of notifications kept in history + history_length = 20 + + ### Misc/Advanced ### + + # dmenu path. + dmenu = /usr/bin/dmenu -p dunst: + + # Browser for opening urls in context menu. + browser = /usr/bin/xdg-open + + # Always run rule-defined scripts, even if the notification is suppressed + always_run_script = true + + # Define the title of the windows spawned by dunst (X11 only) + title = Dunst + + # Define the class of the windows spawned by dunst (X11 only) + class = Dunst + + # Define the corner radius of the notification window + # in pixel size. If the radius is 0, you have no rounded + # corners. + # The radius will be automatically lowered if it exceeds half of the + # notification height to avoid clipping text and/or icons. + corner_radius = 0 + + # Define which corners to round when drawing the window. If the corner radius + # is set to 0 this option will be ignored. + # + # Comma-separated list of the corners. The accepted corner values are bottom-right, + # bottom-left, top-right, top-left, top, bottom, left, right or all. + corners = all + + # Ignore the dbus closeNotification message. + # Useful to enforce the timeout set by dunst configuration. Without this + # parameter, an application may close the notification sent before the + # user defined timeout. + ignore_dbusclose = false + + ### Wayland ### + # These settings are Wayland-specific. They have no effect when using X11 + + # Uncomment this if you want to let notifications appear under fullscreen + # applications (default: overlay) + # layer = top + + # Set this to true to use X11 output on Wayland. + force_xwayland = false + + ### Legacy + + # Use the Xinerama extension instead of RandR for multi-monitor support. + # This setting is provided for compatibility with older nVidia drivers that + # do not support RandR and using it on systems that support RandR is highly + # discouraged. + # + # By enabling this setting dunst will not be able to detect when a monitor + # is connected or disconnected which might break follow mode if the screen + # layout changes. + force_xinerama = false + + ### mouse + + # Defines list of actions for each mouse event + # Possible values are: + # * none: Don't do anything. + # * do_action: Invoke the action determined by the action_name rule. If there is no + # such action, open the context menu. + # * open_url: If the notification has exactly one url, open it. If there are multiple + # ones, open the context menu. + # * close_current: Close current notification. + # * close_all: Close all notifications. + # * context: Open context menu for the notification. + # * context_all: Open context menu for all notifications. + # These values can be strung together for each mouse event, and + # will be executed in sequence. + mouse_left_click = close_current + mouse_middle_click = do_action, close_current + mouse_right_click = close_all + +# Experimental features that may or may not work correctly. Do not expect them +# to have a consistent behaviour across releases. +[experimental] + # Calculate the dpi to use on a per-monitor basis. + # If this setting is enabled the Xft.dpi value will be ignored and instead + # dunst will attempt to calculate an appropriate dpi value for each monitor + # using the resolution and physical size. This might be useful in setups + # where there are multiple screens with very different dpi values. + per_monitor_dpi = false + + +[urgency_low] + # IMPORTANT: colors have to be defined in quotation marks. + # Otherwise the "#" and following would be interpreted as a comment. + background = "#1e1e2e" + foreground = "#cdd6f4" + timeout = 10 + # Icon for notifications with low urgency + default_icon = dialog-information + +[urgency_normal] + background = "#1e1e2e" + foreground = "#cdd6f4" + timeout = 10 + override_pause_level = 30 + # Icon for notifications with normal urgency + default_icon = dialog-information + +[urgency_critical] + background = "#1e1e2e" + foreground = "#cdd6f4" + frame_color = "#fab387" + timeout = 0 + override_pause_level = 60 + # Icon for notifications with critical urgency + default_icon = dialog-warning + +# Every section that isn't one of the above is interpreted as a rules to +# override settings for certain messages. +# +# Messages can be matched by +# appname (discouraged, see desktop_entry) +# body +# category +# desktop_entry +# icon +# match_transient +# msg_urgency +# stack_tag +# summary +# +# and you can override the +# background +# foreground +# format +# frame_color +# fullscreen +# new_icon +# set_stack_tag +# set_transient +# set_category +# timeout +# urgency +# icon_position +# skip_display +# history_ignore +# action_name +# word_wrap +# ellipsize +# alignment +# hide_text +# override_pause_level +# +# Shell-like globbing will get expanded. +# +# Instead of the appname filter, it's recommended to use the desktop_entry filter. +# GLib based applications export their desktop-entry name. In comparison to the appname, +# the desktop-entry won't get localized. +# +# You can also allow a notification to appear even when paused. Notification will appear whenever notification's override_pause_level >= dunst's paused level. +# This can be used to set partial pause modes, where more urgent notifications get through, but less urgent stay paused. To do that, you can override the following in the rules: +# override_pause_level = X + +# SCRIPTING +# You can specify a script that gets run when the rule matches by +# setting the "script" option. +# The script will be called as follows: +# script appname summary body icon urgency +# where urgency can be "LOW", "NORMAL" or "CRITICAL". +# +# NOTE: It might be helpful to run dunst -print in a terminal in order +# to find fitting options for rules. + +# Disable the transient hint so that idle_threshold cannot be bypassed from the +# client +#[transient_disable] +# match_transient = yes +# set_transient = no +# +# Make the handling of transient notifications more strict by making them not +# be placed in history. +#[transient_history_ignore] +# match_transient = yes +# history_ignore = yes + +# fullscreen values +# show: show the notifications, regardless if there is a fullscreen window opened +# delay: displays the new notification, if there is no fullscreen window active +# If the notification is already drawn, it won't get undrawn. +# pushback: same as delay, but when switching into fullscreen, the notification will get +# withdrawn from screen again and will get delayed like a new notification +#[fullscreen_delay_everything] +# fullscreen = delay +#[fullscreen_show_critical] +# msg_urgency = critical +# fullscreen = show + +#[espeak] +# summary = "*" +# script = dunst_espeak.sh + +#[script-test] +# summary = "*script*" +# script = dunst_test.sh + +#[ignore] +# # This notification will not be displayed +# summary = "foobar" +# skip_display = true + +#[history-ignore] +# # This notification will not be saved in history +# summary = "foobar" +# history_ignore = yes + +#[skip-display] +# # This notification will not be displayed, but will be included in the history +# summary = "foobar" +# skip_display = yes + +#[signed_on] +# appname = Pidgin +# summary = "*signed on*" +# urgency = low +# +#[signed_off] +# appname = Pidgin +# summary = *signed off* +# urgency = low +# +#[says] +# appname = Pidgin +# summary = *says* +# urgency = critical +# +#[twitter] +# appname = Pidgin +# summary = *twitter.com* +# urgency = normal +# +#[stack-volumes] +# appname = "some_volume_notifiers" +# set_stack_tag = "volume" +# +# vim: ft=cfg diff --git a/platforms/linux/hypr/hypridle.conf b/platforms/linux/hypr/hypridle.conf index 540d279..febf165 100644 --- a/platforms/linux/hypr/hypridle.conf +++ b/platforms/linux/hypr/hypridle.conf @@ -12,3 +12,8 @@ listener { on-timeout = swaylock # command to run when timeout has passed on-resume = notify-send "Welcome back!" # command to run when activity is detected after timeout has fired. } + +listener { + timeout = 1800 # 30min + on-timeout = systemctl suspend # suspend pc +} diff --git a/platforms/linux/hypr/hyprland.conf b/platforms/linux/hypr/hyprland.conf index 0812be1..cf22572 100644 --- a/platforms/linux/hypr/hyprland.conf +++ b/platforms/linux/hypr/hyprland.conf @@ -14,7 +14,11 @@ # OR EDIT THIS ONE ACCORDING TO THE WIKI INSTRUCTIONS. # ####################################################################################### -source=~/.config/hypr/dark.conf +$mainMod = SUPER # Sets "Windows" key as main modifier + +source=~/.config/hypr/hyprland/dark.conf +source=~/.config/hypr/hyprland/+colemak.conf +source=~/.config/hypr/hyprland/rules.conf autogenerated = 0 # remove this line to remove the warning @@ -25,11 +29,6 @@ autogenerated = 0 # remove this line to remove the warning # 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 -# - xwayland { force_zero_scaling = true } @@ -87,9 +86,6 @@ exec-once = wl-paste --watch cliphist store exec-once = blueman-applet & # Time Tracker exec-once = aw-qt & -# https://github.com/hyprwm/Hyprland/discussions/5867 -exec = gsettings set org.gnome.desktop.interface gtk-theme "Breeze-Dark" # for GTK3 apps -exec = gsettings set org.gnome.desktop.interface color-scheme "prefer-dark" # for GTK4 apps @@ -104,7 +100,6 @@ exec = gsettings set org.gnome.desktop.interface color-scheme "prefer-dark" # env = HYPRCURSOR_SIZE,24 env = QT_QPA_PLATFORMTHEME,qt6ct # for Qt apps -# https://discuss.kde.org/t/the-themes-i-use-with-qt6ct-are-not-applied-in-discover/17118 env = QT_QUICK_CONTROLS_STYLE,org.kde.desktop env = LC_CTYPE,en_GB.UTF-8 @@ -264,13 +259,15 @@ device { $mainMod = SUPER # Sets "Windows" key as main modifier # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more + + +## Open Applications bind = $mainMod, R, exec, $terminal bind = $mainMod, Q, killactive, # bind = $mainMod, M, exit, -bind = $mainMod, F, exec, $fileManager bind = $mainMod, V, exec, cliphist list | $menu -dmenu | cliphist decode | wl-copy bind = $mainMod, W, exec, $menu -show window -bind = $mainMod SHIFT, F, exec, hyprctl --batch "dispatch togglefloating ; dispatch resizeactive exact 800 1000 ; dispatch centerwindow 1;" +bind = $mainMod SHIFT, F, exec, hyprctl --batch "dispatch togglefloating ; dispatch resizeactive exact 1440 810 ; dispatch centerwindow 1;" @@ -283,17 +280,10 @@ bind = $mainMod, left, movefocus, l bind = $mainMod, right, movefocus, r bind = $mainMod, up, movefocus, u bind = $mainMod, down, movefocus, d -bind = $mainMod, h, movefocus, l -bind = $mainMod, i, movefocus, r -bind = $mainMod, e, movefocus, u -bind = $mainMod, n, movefocus, d -bind = $mainMod SHIFT, h, swapwindow, l -bind = $mainMod SHIFT, i, swapwindow, r -bind = $mainMod SHIFT, e, swapwindow, u -bind = $mainMod SHIFT, n, swapwindow, d bind = $mainMod SHIFT, l, exec, swaylock + bind = $mainMod, c, exec, grimblast copysave area $HOME/Pictures/Screenshots/"$(date +%Y%m%d-%H%M%S)" # Switch workspaces with mainMod + [0-9] @@ -321,8 +311,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 +bind = $mainMod, GRAVE, togglespecialworkspace, magic +bind = $mainMod SHIFT, GRAVE, movetoworkspace, special:magic # Scroll through existing workspaces with mainMod + scroll bind = $mainMod, mouse_down, workspace, e+1 @@ -346,23 +336,3 @@ bindl = , XF86AudioPause, exec, playerctl play-pause bindl = , XF86AudioPlay, exec, playerctl play-pause bindl = , XF86AudioPrev, exec, playerctl previous -############################## -### WINDOWS AND WORKSPACES ### -############################## - -# 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)$ - -# Ignore maximize requests from apps. You'll probably like this. -windowrulev2 = suppressevent maximize, class:.* - -# Fix some dragging issues with XWayland -windowrulev2 = nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0 - -windowrulev2 = float, class:qt6ct, diff --git a/platforms/linux/hypr/hyprland/+colemak.conf b/platforms/linux/hypr/hyprland/+colemak.conf new file mode 100644 index 0000000..77a1407 --- /dev/null +++ b/platforms/linux/hypr/hyprland/+colemak.conf @@ -0,0 +1,10 @@ +bind = $mainMod, H, movefocus, l +bind = $mainMod, I, movefocus, r +bind = $mainMod, E, movefocus, u +bind = $mainMod, N, movefocus, d +bind = $mainMod SHIFT, H, swapwindow, l +bind = $mainMod SHIFT, I, swapwindow, r +bind = $mainMod SHIFT, E, swapwindow, u +bind = $mainMod SHIFT, N, swapwindow, d +bind = $mainMod, F, exec, $fileManager + diff --git a/platforms/linux/hypr/hyprland/+qwerty.conf b/platforms/linux/hypr/hyprland/+qwerty.conf new file mode 100644 index 0000000..9f51a6b --- /dev/null +++ b/platforms/linux/hypr/hyprland/+qwerty.conf @@ -0,0 +1,11 @@ +bind = $mainMod, H, movefocus, l +bind = $mainMod, L, movefocus, r +bind = $mainMod, K, movefocus, u +bind = $mainMod, J, movefocus, d +bind = $mainMod SHIFT, H, swapwindow, l +bind = $mainMod SHIFT, L, swapwindow, r +bind = $mainMod SHIFT, K, swapwindow, u +bind = $mainMod SHIFT, J, swapwindow, d +bind = $mainMod, E, exec, $fileManager + + diff --git a/platforms/linux/hypr/dark.conf b/platforms/linux/hypr/hyprland/dark.conf similarity index 78% rename from platforms/linux/hypr/dark.conf rename to platforms/linux/hypr/hyprland/dark.conf index 245e6ed..417eaa6 100644 --- a/platforms/linux/hypr/dark.conf +++ b/platforms/linux/hypr/hyprland/dark.conf @@ -76,3 +76,9 @@ $mantleAlpha = 181825 $crust = rgb(11111b) $crustAlpha = 11111b + +# https://github.com/hyprwm/Hyprland/discussions/5867 +exec = gsettings set org.gnome.desktop.interface gtk-theme "BreezeDark" # for GTK3 apps +exec = gsettings set org.gnome.desktop.interface color-scheme "prefer-dark" # for GTK4 apps +exec = kwriteconfig5 --group "General" --key "ColorScheme" "BreezeDark" +exec = hyprsunset -t 6000 & diff --git a/platforms/linux/hypr/hyprland/rules.conf b/platforms/linux/hypr/hyprland/rules.conf new file mode 100644 index 0000000..8d014f5 --- /dev/null +++ b/platforms/linux/hypr/hyprland/rules.conf @@ -0,0 +1,78 @@ +############################## +### WINDOWS AND WORKSPACES ### +############################## + +# 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)$ + +# Ignore maximize requests from apps. You'll probably like this. +windowrulev2 = suppressevent maximize, class:.* + +# Fix some dragging issues with XWayland +windowrulev2 = nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0 + +windowrulev2 = float, class:qt6ct +windowrulev2 = float, size 2560 1440, class:^(org.kde.gwenview)$ +windowrulev2 = float, size 50%, center, class:^(org.kde.konsole)$ + + +windowrulev2 = float, class:^(steam)$ + +# Browser Extension Popup +windowrulev2 = float, title:^(Bitwarden - )(.*)$ + +# 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)(.*)$ +windowrulev2 = float, title:^(画中画)(.*)$ +windowrulev2 = keepaspectratio, title:^(画中画)(.*)$ +windowrulev2 = move 73% 72%, title:^(画中画)(.*)$ +windowrulev2 = size 25%, title:^(画中画)(.*)$ +windowrulev2 = float, title:^(画中画)(.*)$ +windowrulev2 = pin, title:^(画中画)(.*)$ + +# Dialog windows – float+center these windows. +windowrulev2 = center, title:^(Open File)(.*)$ +windowrulev2 = center, title:^(打开文件)(.*)$ +windowrulev2 = center, title:^(Select a File)(.*)$ +windowrulev2 = center, title:^(选择文件)(.*)$ +windowrulev2 = center, title:^(Choose wallpaper)(.*)$ +windowrulev2 = center, title:^(Open Folder)(.*)$ +windowrulev2 = center, title:^(Save As)(.*)$ +windowrulev2 = center, title:^(保存)(.*)$ +windowrulev2 = center, title:^(Library)(.*)$ +windowrulev2 = center, title:^(File Upload)(.*)$ +windowrulev2 = float, title:^(Open File)(.*)$ +windowrulev2 = center, title:^(打开文件)(.*)$ +windowrulev2 = float, title:^(Select a File)(.*)$ +windowrulev2 = center, title:^(选择文件)(.*)$ +windowrulev2 = float, title:^(Choose wallpaper)(.*)$ +windowrulev2 = float, title:^(Open Folder)(.*)$ +windowrulev2 = float, title:^(Save As)(.*)$ +windowrulev2 = center, title:^(保存)(.*)$ +windowrulev2 = float, title:^(Library)(.*)$ +windowrulev2 = float, title:^(File Upload)(.*)$ + +# Centering pictures preview windows +# Telegram +windowrulev2 = center, title:^(Media viewer)(.*)$ +windowrulev2 = float, title:^(Media viewer)(.*)$ +windowrulev2 = size 50%, title:^(Media viewer)(.*)$ +# WeChat +windowrulev2 = center, title:^(预览)(.*)$ +windowrulev2 = float, title:^(预览)(.*)$ +windowrulev2 = size 50%, title:^(预览)(.*)$ +# QQ +windowrulev2 = center, title:^(图片查看器)(.*)$ +windowrulev2 = float, title:^(图片查看器)(.*)$ +windowrulev2 = size 50%, title:^(图片查看器)(.*)$ diff --git a/platforms/linux/swaylock b/platforms/linux/swaylock new file mode 100644 index 0000000..511ad11 --- /dev/null +++ b/platforms/linux/swaylock @@ -0,0 +1,6 @@ +image=~/Pictures/Wallpaper/lock.png +ignore-empty-password +show-failed-attempts +show-keyboard-layout + + diff --git a/platforms/linux/waybar/config.jsonc b/platforms/linux/waybar/config.jsonc index c4eb83b..59cd513 100644 --- a/platforms/linux/waybar/config.jsonc +++ b/platforms/linux/waybar/config.jsonc @@ -3,20 +3,21 @@ // "layer": "top", // Waybar at top layer // "position": "bottom", // Waybar position (top|bottom|left|right) "include": [ - "~/.config/waybar/modules/hyprland-workspace.jsonc" + "~/.config/waybar/modules/hyprland-workspace.jsonc", + "~/.config/waybar/modules/misc.jsonc" ], "height": 30, // Waybar height (to be removed for auto height) // "width": 1280, // Waybar width "spacing": 4, // Gaps between modules (4px) // Choose the order of the modules "modules-left": [ - "hyprland/workspaces#rw", + "hyprland/workspaces", "sway/mode", "sway/scratchpad" ], - "modules-center": [ - "hyprland/window" - ], + // "modules-center": [ + // "hyprland/window" + // ], "modules-right": [ "tray", // "idle_inhibitor", @@ -31,183 +32,4 @@ "battery", "clock" ], - // 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": "" - } - }, - "sway/mode": { - "format": "{}" - }, - "sway/scratchpad": { - "format": "{icon} {count}", - "show-empty": false, - "format-icons": ["", ""], - "tooltip": true, - "tooltip-format": "{app}: {title}" - }, - "mpd": { - "format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {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": " ", - "on": " " - }, - "repeat-icons": { - "on": " " - }, - "single-icons": { - "on": "1 " - }, - "state-icons": { - "paused": "", - "playing": "" - }, - "tooltip-format": "MPD (connected)", - "tooltip-format-disconnected": "MPD (disconnected)" - }, - "idle_inhibitor": { - "format": "{icon}", - "format-icons": { - "activated": "", - "deactivated": "" - } - }, - "tray": { - // "icon-size": 21, - "spacing": 10 - }, - "clock": { - // "timezone": "America/New_York", - "tooltip-format": "{:%Y %B}\n{calendar}", - "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 - }, - "custom/power": { - "format" : "⏻ ", - "tooltip": false, - "menu": "on-click", - "menu-file": "$HOME/.config/waybar/power_menu.xml", // Menu file in resources folder - "menu-actions": { - "shutdown": "shutdown", - "reboot": "reboot", - "suspend": "systemctl suspend", - "hibernate": "systemctl hibernate" - } - } } diff --git a/platforms/linux/waybar/modules/hyprland-workspace.jsonc b/platforms/linux/waybar/modules/hyprland-workspace.jsonc index dafc09c..892823f 100644 --- a/platforms/linux/waybar/modules/hyprland-workspace.jsonc +++ b/platforms/linux/waybar/modules/hyprland-workspace.jsonc @@ -1,6 +1,6 @@ { -"hyprland/workspaces#rw": { +"hyprland/workspaces": { "disable-scroll": true, "all-outputs": true, "warp-on-scroll": false, @@ -14,6 +14,16 @@ }, "format-icons": { + "1": "一", + "2": "二", + "3": "三", + "4": "四", + "5": "五", + "6": "六", + "7": "七", + "8": "八", + "9": "九", + "10": "十", "active": "", "default": "", }, diff --git a/platforms/linux/waybar/modules/misc.jsonc b/platforms/linux/waybar/modules/misc.jsonc new file mode 100644 index 0000000..59c0fbf --- /dev/null +++ b/platforms/linux/waybar/modules/misc.jsonc @@ -0,0 +1,187 @@ +{ + "keyboard-state": { + "numlock": true, + "capslock": true, + "format": "{name} {icon}", + "format-icons": { + "locked": "", + "unlocked": "" + } + }, + "sway/mode": { + "format": "{}" + }, + "sway/scratchpad": { + "format": "{icon} {count}", + "show-empty": false, + "format-icons": [ + "", + "" + ], + "tooltip": true, + "tooltip-format": "{app}: {title}" + }, + "mpd": { + "format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {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": " ", + "on": " " + }, + "repeat-icons": { + "on": " " + }, + "single-icons": { + "on": "1 " + }, + "state-icons": { + "paused": "", + "playing": "" + }, + "tooltip-format": "MPD (connected)", + "tooltip-format-disconnected": "MPD (disconnected)" + }, + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + } + }, + "tray": { + // "icon-size": 21, + "spacing": 10 + }, + "clock": { + // "timezone": "America/New_York", + "tooltip-format": "{:%Y %B}\n{calendar}", + "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 + }, + "custom/power": { + "format": "⏻ ", + "tooltip": false, + "menu": "on-click", + "menu-file": "$HOME/.config/waybar/power_menu.xml", // Menu file in resources folder + "menu-actions": { + "shutdown": "shutdown", + "reboot": "reboot", + "suspend": "systemctl suspend", + "hibernate": "systemctl hibernate" + } + } +} \ No newline at end of file diff --git a/platforms/linux/waybar/style.css b/platforms/linux/waybar/style.css index d22641d..685c9c1 100644 --- a/platforms/linux/waybar/style.css +++ b/platforms/linux/waybar/style.css @@ -34,7 +34,7 @@ window#waybar { /* background-color: rgba(43, 48, 59, 0.5); */ /* border-bottom: 3px solid rgba(100, 114, 125, 0.5); */ background-color: @base; - color: #ffffff; + color: @text; transition-property: background-color; transition-duration: .5s; } @@ -196,7 +196,7 @@ label:focus { } #cpu { - background-color: #2ecc71; + background-color: @green; color: #000000; } @@ -213,7 +213,7 @@ label:focus { } #network { - background-color: #2980b9; + background-color: @blue; } #network.disconnected { From 4ce449ef3781d2e9887bf0577fb8b82b410377bb Mon Sep 17 00:00:00 2001 From: js0ny Date: Wed, 9 Apr 2025 10:07:14 +0100 Subject: [PATCH 32/35] feat(rofi): As launcher --- Justfile | 13 +- platforms/linux/rofi/catppuccin-mocha.rasi | 29 ++++ platforms/linux/rofi/config.rasi | 172 +++++++++++++++++++++ platforms/linux/rofi/rosepine-dawn.rasi | 37 +++++ 4 files changed, 249 insertions(+), 2 deletions(-) create mode 100644 platforms/linux/rofi/catppuccin-mocha.rasi create mode 100644 platforms/linux/rofi/config.rasi create mode 100644 platforms/linux/rofi/rosepine-dawn.rasi diff --git a/Justfile b/Justfile index 5da1fca..70cdb76 100644 --- a/Justfile +++ b/Justfile @@ -209,13 +209,22 @@ swaylock: [linux] dunst: mkdir -p {{XDG_CONFIG_HOME}}/dunst - {{LN}} {{DOTFILES}}/platforms/linux/dunst {{XDG_CONFIG_HOME}}/dunst/dunstrc + {{LN}} {{DOTFILES}}/platforms/linux/dunstrc {{XDG_CONFIG_HOME}}/dunst/dunstrc + +[linux] +hypr: + {{LN}} {{DOTFILES}}/platforms/linux/hypr {{XDG_CONFIG_HOME}}/hypr + +[linux] +rofi: + {{LN}} {{DOTFILES}}/platforms/linux/rofi {{XDG_CONFIG_HOME}}/rofi [linux] hyprland: - {{LN}} {{DOTFILES}}/platforms/linux/hypr {{XDG_CONFIG_HOME}}/hypr + @just hypr @just dunst @just swaylock + @just rofi [private] pull: diff --git a/platforms/linux/rofi/catppuccin-mocha.rasi b/platforms/linux/rofi/catppuccin-mocha.rasi new file mode 100644 index 0000000..e364663 --- /dev/null +++ b/platforms/linux/rofi/catppuccin-mocha.rasi @@ -0,0 +1,29 @@ +* { + rosewater: #f5e0dc; + flamingo: #f2cdcd; + pink: #f5c2e7; + mauve: #cba6f7; + red: #f38ba8; + maroon: #eba0ac; + peach: #fab387; + yellow: #f9e2af; + green: #a6e3a1; + teal: #94e2d5; + sky: #89dceb; + sapphire: #74c7ec; + blue: #89b4fa; + lavender: #b4befe; + text: #cdd6f4; + subtext1: #bac2de; + subtext0: #a6adc8; + overlay2: #9399b2; + overlay1: #7f849c; + overlay0: #6c7086; + surface2: #585b70; + surface1: #45475a; + surface0: #313244; + base: #1e1e2e; + mantle: #181825; + crust: #11111b; + accent: @lavender; + } diff --git a/platforms/linux/rofi/config.rasi b/platforms/linux/rofi/config.rasi new file mode 100644 index 0000000..db6065f --- /dev/null +++ b/platforms/linux/rofi/config.rasi @@ -0,0 +1,172 @@ +@import "catppuccin-mocha" + +* { + selected-active-foreground: @background; + lightfg: @text; + separatorcolor: @foreground; + urgent-foreground: @red; + alternate-urgent-background: @lightbg; + lightbg: @mantle; + background-color: transparent; + border-color: @foreground; + normal-background: @background; + selected-urgent-background: @red; + alternate-active-background: @lightbg; + spacing: 2; + alternate-normal-foreground: @foreground; + urgent-background: @background; + selected-normal-foreground: @lightbg; + active-foreground: @blue; + background: @base; + selected-active-background: @blue; + active-background: @background; + selected-normal-background: @pink; + alternate-normal-background: @lightbg; + foreground: @text; + selected-urgent-foreground: @background; + normal-foreground: @foreground; + alternate-urgent-foreground: @red; + alternate-active-foreground: @blue; + +} +element { + padding: 1px ; + cursor: pointer; + spacing: 5px ; + border: 0; +} +element normal.normal { + background-color: @normal-background; + text-color: @normal-foreground; +} +element normal.urgent { + background-color: @urgent-background; + text-color: @urgent-foreground; +} +element normal.active { + background-color: @active-background; + text-color: @active-foreground; +} +element selected.normal { + background-color: @selected-normal-background; + text-color: @selected-normal-foreground; +} +element selected.urgent { + background-color: @selected-urgent-background; + text-color: @selected-urgent-foreground; +} +element selected.active { + background-color: @selected-active-background; + text-color: @selected-active-foreground; +} +element alternate.normal { + background-color: @alternate-normal-background; + text-color: @alternate-normal-foreground; +} +element alternate.urgent { + background-color: @alternate-urgent-background; + text-color: @alternate-urgent-foreground; +} +element alternate.active { + background-color: @alternate-active-background; + text-color: @alternate-active-foreground; +} +element-text { + background-color: transparent; + cursor: inherit; + highlight: inherit; + text-color: inherit; +} +element-icon { + background-color: transparent; + size: 1.0000em ; + cursor: inherit; + text-color: inherit; +} +window { + location: center; + border-radius: 10px; + padding: 5; + background-color: @background; + border: 1; +} +mainbox { + padding: 0; + border: 0; +} +message { + padding: 1px ; + border-color: @separatorcolor; + border: 2px dash 0px 0px ; +} +textbox { + text-color: @foreground; +} +listview { + padding: 2px 0px 0px ; + scrollbar: true; + border-color: @separatorcolor; + spacing: 2px ; + fixed-height: 0; + border: 2px dash 0px 0px ; +} +scrollbar { + width: 4px ; + padding: 0; + handle-width: 8px ; + border: 0; + handle-color: @normal-foreground; +} +sidebar { + border-color: @separatorcolor; + border: 2px dash 0px 0px ; +} +button { + cursor: pointer; + spacing: 0; + text-color: @normal-foreground; +} +button selected { + background-color: @selected-normal-background; + text-color: @selected-normal-foreground; +} +num-filtered-rows { + expand: false; + text-color: Gray; +} +num-rows { + expand: false; + text-color: Gray; +} +textbox-num-sep { + expand: false; + str: "/"; + text-color: Gray; +} +inputbar { + padding: 1px ; + spacing: 0px ; + text-color: @normal-foreground; + children: [ "prompt","textbox-prompt-colon","entry","num-filtered-rows","textbox-num-sep","num-rows","case-indicator" ]; +} +case-indicator { + spacing: 0; + text-color: @normal-foreground; +} +entry { + text-color: @normal-foreground; + cursor: text; + spacing: 0; + placeholder-color: Gray; + placeholder: "搜索..."; +} +prompt { + spacing: 0; + text-color: @accent; +} +textbox-prompt-colon { + margin: 0px 0.3000em 0.0000em 0.0000em ; + expand: false; + str: ">"; + text-color: inherit; +} diff --git a/platforms/linux/rofi/rosepine-dawn.rasi b/platforms/linux/rofi/rosepine-dawn.rasi new file mode 100644 index 0000000..f63c3a9 --- /dev/null +++ b/platforms/linux/rofi/rosepine-dawn.rasi @@ -0,0 +1,37 @@ +* { + bg: #faf4ed; + cur: #fffaf3; + fgd: #575279; + cmt: #9893a5; + cya: #56949f; + grn: #286983; + ora: #d7827e; + pur: #907aa9; + red: #b4637a; + yel: #ea9d34; + + alt-fgd: #faf4ed; + + font: "Cartograph CF 12"; + + foreground: @fgd; + background: @bg; + + active-background: @grn; + active-foreground: @alt-fgd; + + urgent-background: @red; + urgent-foreground: @alt-fgd; + + selected-background: @active-background; + selected-foreground: @active-foreground; + + selected-urgent-background: @urgent-background; + selected-urgent-foreground: @urgent-foreground; + + selected-active-background: @active-background; + selected-active-foreground: @active-foreground; + + separatorcolor: @active-background; + bordercolor: @ora; +} From d43a4b7106f5d8446debf6f6bb2e27d0ed789de1 Mon Sep 17 00:00:00 2001 From: js0ny Date: Wed, 9 Apr 2025 10:07:37 +0100 Subject: [PATCH 33/35] chore(colors): Dark -> Catppuccin Mocha Lavender --- platforms/linux/hypr/hyprland.conf | 20 ++++++++++++-------- platforms/linux/user-dirs.dirs | 10 ++-------- platforms/linux/waybar/style.css | 10 +++++----- tools/kitty/dark-theme.auto.conf | 9 +++++---- 4 files changed, 24 insertions(+), 25 deletions(-) diff --git a/platforms/linux/hypr/hyprland.conf b/platforms/linux/hypr/hyprland.conf index cf22572..d440d50 100644 --- a/platforms/linux/hypr/hyprland.conf +++ b/platforms/linux/hypr/hyprland.conf @@ -56,6 +56,7 @@ monitor=DP-2,3840x2160@60,0x0,1.667 $terminal = kitty $fileManager = dolphin $menu = rofi +$iconTheme = Papirus ################# @@ -119,9 +120,8 @@ general { border_size = 3 # https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors - # col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg - col.active_border = $mauve - col.inactive_border = $overlay2 + col.active_border = $lavender $pink 45deg + col.inactive_border = $overlay1 # Set to true enable resizing windows by clicking and dragging on borders and gaps resize_on_border = true @@ -140,7 +140,7 @@ decoration { # Change transparency of focused and unfocused windows active_opacity = 0.97 - inactive_opacity = 0.85 + inactive_opacity = 0.90 shadow { enabled = true @@ -264,14 +264,17 @@ $mainMod = SUPER # Sets "Windows" key as main modifier ## Open Applications bind = $mainMod, R, exec, $terminal bind = $mainMod, Q, killactive, -# bind = $mainMod, M, exit, -bind = $mainMod, V, exec, cliphist list | $menu -dmenu | cliphist decode | wl-copy -bind = $mainMod, W, exec, $menu -show window +# bind = $mainMod, M, exit bind = $mainMod SHIFT, F, exec, hyprctl --batch "dispatch togglefloating ; dispatch resizeactive exact 1440 810 ; dispatch centerwindow 1;" +## Launcher +bind = $mainMod, W, exec, $menu -show window -icon-theme $iconTheme -show-icons +bind = $mainMod, V, exec, cliphist list | $menu -dmenu | cliphist decode | wl-copy +bind = $mainMod, D, exec, $HOME/.local/scripts/picker/sdcv.sh +bind = alt, space, exec, $menu -show drun -icon-theme $iconTheme -show-icons +bind = $mainMod, SLASH, exec, $HOME/.local/scripts/picker/baloo.sh -bind = alt, space, exec, $menu -show drun bind = $mainMod, P, pseudo, # dwindle bind = $mainMod, X, togglesplit, # dwindle @@ -285,6 +288,7 @@ bind = $mainMod SHIFT, l, exec, swaylock bind = $mainMod, c, exec, grimblast copysave area $HOME/Pictures/Screenshots/"$(date +%Y%m%d-%H%M%S)" +bind = $mainMod SHIFT, c, exec, notify-send "Color: $(hyprpicker)" # Switch workspaces with mainMod + [0-9] bind = $mainMod, 1, workspace, 1 diff --git a/platforms/linux/user-dirs.dirs b/platforms/linux/user-dirs.dirs index ae7f277..cc0dcf4 100644 --- a/platforms/linux/user-dirs.dirs +++ b/platforms/linux/user-dirs.dirs @@ -1,14 +1,8 @@ -# This file is written by xdg-user-dirs-update -# If you want to change or add directories, just edit the line you're -# interested in. All local changes will be retained on the next run. -# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped -# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an -# absolute path. No other format is supported. -# +# $DOTFILES/platforms/linux/user-dirs.dirs XDG_DESKTOP_DIR="$HOME/Desktop" XDG_DOWNLOAD_DIR="$HOME/Downloads" XDG_TEMPLATES_DIR="$HOME/Templates" -XDG_PUBLICSHARE_DIR="$HOME/" +XDG_PUBLICSHARE_DIR="$HOME/Public" XDG_DOCUMENTS_DIR="$HOME/Documents" XDG_MUSIC_DIR="$HOME/Music" XDG_PICTURES_DIR="$HOME/Pictures" diff --git a/platforms/linux/waybar/style.css b/platforms/linux/waybar/style.css index 685c9c1..2eaba05 100644 --- a/platforms/linux/waybar/style.css +++ b/platforms/linux/waybar/style.css @@ -77,7 +77,7 @@ button:hover { /* you can set a style on hover for any module like this */ #pulseaudio:hover { - background-color: #a37800; + background-color: @lavender; } #workspaces button { @@ -201,7 +201,7 @@ label:focus { } #memory { - background-color: #9b59b6; + background-color: @mauve; } #disk { @@ -221,7 +221,7 @@ label:focus { } #pulseaudio { - background-color: #f1c40f; + background-color: @yellow; color: #000000; } @@ -254,7 +254,7 @@ label:focus { } #temperature { - background-color: #f0932b; + background-color: @peach; } #temperature.critical { @@ -262,7 +262,7 @@ label:focus { } #tray { - background-color: #2980b9; + background-color: @blue; } #tray > .passive { diff --git a/tools/kitty/dark-theme.auto.conf b/tools/kitty/dark-theme.auto.conf index 2533db7..09cb0f1 100644 --- a/tools/kitty/dark-theme.auto.conf +++ b/tools/kitty/dark-theme.auto.conf @@ -6,6 +6,7 @@ ## upstream: https://github.com/catppuccin/kitty/blob/main/mocha.conf ## blurb: Soothing pastel theme for the high-spirited! +# Accent: Lavender #B4BEFE # The basic colors @@ -32,16 +33,16 @@ macos_titlebar_color system # Tab bar colors active_tab_foreground #11111B -active_tab_background #CBA6F7 +active_tab_background #B4BEFE inactive_tab_foreground #CDD6F4 -inactive_tab_background #181825 -tab_bar_background #11111B +inactive_tab_background #1E1E2E +tab_bar_background #181825 # Colors for marks (marked text in the terminal) mark1_foreground #1E1E2E mark1_background #B4BEFE mark2_foreground #1E1E2E -mark2_background #CBA6F7 +mark2_background #B4BEFE mark3_foreground #1E1E2E mark3_background #74C7EC From dae3143f86e5822370f4cf36d6eea4edac0981d6 Mon Sep 17 00:00:00 2001 From: js0ny Date: Wed, 9 Apr 2025 11:02:02 +0100 Subject: [PATCH 34/35] feat(just): Add justfiles for setup --- .gitignore | 2 - .just.d/check.just | 45 +++++ .just.d/cmds.just | 26 +++ .just.d/common.just | 34 ++++ .just.d/linux.just | 49 ++++++ .just.d/misc.just | 15 ++ .just.d/tools.just | 55 +++++++ .just.d/vars.just | 42 +++++ Justfile | 256 ++--------------------------- common/fzfrc | 10 ++ platforms/linux/hypr/hyprland.conf | 8 +- readme.org | 21 ++- 12 files changed, 310 insertions(+), 253 deletions(-) create mode 100644 .just.d/check.just create mode 100644 .just.d/cmds.just create mode 100644 .just.d/common.just create mode 100644 .just.d/linux.just create mode 100644 .just.d/misc.just create mode 100644 .just.d/tools.just create mode 100644 .just.d/vars.just create mode 100644 common/fzfrc diff --git a/.gitignore b/.gitignore index e114c5f..10c7e8b 100644 --- a/.gitignore +++ b/.gitignore @@ -23,8 +23,6 @@ xdg-ninja/ PowerToys/ # Nushell tools/nushell/ -# fzf -common/fzfrc # OS generated files .DS_Store diff --git a/.just.d/check.just b/.just.d/check.just new file mode 100644 index 0000000..b06d518 --- /dev/null +++ b/.just.d/check.just @@ -0,0 +1,45 @@ + +test: + echo "DOTFILES={{DOTFILES}}" + echo "XDG_CONFIG_HOME={{XDG_CONFIG_HOME}}" + echo "XDG_DATA_HOME={{XDG_DATA_HOME}}" + + +check: + @just check_shell +format: + @just format_shell + + +[private] +[unix] +check_shell: + shellcheck -x -s sh --severity=error **/*.sh platforms/mac/yabairc + shellcheck -x -s bash --severity=error **/*.bash tools/bash/* **/*.bashrc + +[private] +[unix] +format_shell: + shfmt -w -i 2 -ci -bn -p **/*.sh + shfmt -w -i 2 -ci -bn -ln bash **/*.bash platforms/mac/sketchybar/sketchybarrc + # Ignore syntax errors in zsh files + shfmt -w -i 2 -ci -bn -ln bash **/*.zsh tools/zsh/**/* **/zshrc || true + +[private] +check_info: + shellcheck -x -s sh **/*.sh platforms/mac/yabairc + shellcheck -x -s bash **/*.bash tools/bash/* scripts/*.{sh,zsh,bash} **/*.bashrc + +[private] +init: + git remote add github git@github.com:js0ny/dotfiles.git + git remote add codeberg git@codeberg.org:js0ny/dotfiles.git + +[private] +push: + git push github master + git push codeberg master + +[private] +pull: + git pull github master diff --git a/.just.d/cmds.just b/.just.d/cmds.just new file mode 100644 index 0000000..8d9a4bd --- /dev/null +++ b/.just.d/cmds.just @@ -0,0 +1,26 @@ + +# Sudo and coreutils are required +LN := \ + if os_family() == "windows" { + "sudo ln -sf" + } else { + "ln -sf" + } +CLIP := \ + if os() == "windows" { "clip.exe" } \ + else if os() == "linux" { "wl-copy" } \ + else if os() == "macos" { "pbcopy" } \ + else { "" } + + +CURL := \ + if os() == "windows" { "Invoke-WebRequest" } \ + else if os() == "linux" { "curl" } \ + else if os() == "macos" { "curl" } \ + else { "" } + +CURL_OUT := \ + if os() == "windows" { "-OutFile" } \ + else if os() == "linux" { "-o" } \ + else if os() == "macos" { "-o" } \ + else { "" } diff --git a/.just.d/common.just b/.just.d/common.just new file mode 100644 index 0000000..606cc32 --- /dev/null +++ b/.just.d/common.just @@ -0,0 +1,34 @@ +ideavim: + {{LN}} {{DOTFILES}}/common/ideavimrc {{XDG_CONFIG_HOME}}/ideavim/ideavimrc + git clone https://github.com/MarcoIeni/intellimacs {{join(home_directory(), ".local/share/intellimacs")}} --depth 1 + +lsd: + -mkdir {{XDG_CONFIG_HOME}}/lsd + {{LN}} {{DOTFILES}}/common/lsd.yaml {{XDG_CONFIG_HOME}}/lsd/config.yaml + + +[unix] +neovide: + which neovide + -mkdir -p {{XDG_CONFIG_HOME}}/neovide + {{LN}} {{DOTFILES}}/platforms/{{OS}}/neovide.toml {{XDG_CONFIG_HOME}}/neovide/config.toml + + +[linux] +readline: + mkdir -p {{XDG_CONFIG_HOME}}/readline + {{LN}} {{DOTFILES}}/common/inputrc {{XDG_CONFIG_HOME}}/readline/inputrc + + +[unix] +vim: + mkdir -p {{XDG_DATA_HOME}}/vim/after + mkdir -p {{XDG_STATE_HOME}}/vim/{backup,swap,undo,view} + mkdir -p {{XDG_CONFIG_HOME}}/vim/ + ln -sf {{DOTFILES}}/common/vimrc {{XDG_CONFIG_HOME}}/vim/vimrc + + +[windows] +vim: + New-Item -ItemType SymbolicLink -Path $HOME/_vimrc -Value {{DOTFILES}}/common/vim.noxdg.vimrc + diff --git a/.just.d/linux.just b/.just.d/linux.just new file mode 100644 index 0000000..7c6d56a --- /dev/null +++ b/.just.d/linux.just @@ -0,0 +1,49 @@ + +[linux] +systemd: + ln -sf {{DOTFILES}}/platforms/{{OS}}/systemd {{XDG_CONFIG_HOME}}/systemd/ + +[linux] +keyd: + -which keyd || sudo pacman -S keyd --noconfirm || sudo apt install keyd --yes || @just build_keyd + sudo cp {{DOTFILES}}/platforms/linux/keyd/keyd.conf /etc/keyd/default.conf + mkdir -p {{XDG_CONFIG_HOME}}/keyd + {{LN}} {{DOTFILES}}/platforms/linux/keyd/app.conf {{XDG_CONFIG_HOME}}/keyd/app.conf + sudo systemctl enable keyd + +[linux] +[private] +build_keyd: + git clone https://github.com/rvaiya/keyd $HOME/.local/build/keyd + cd $HOME/.local/build/keyd && make && sudo make install + +[linux] +flatpak: + flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo + +[linux] +swaylock: + mkdir -p {{XDG_CONFIG_HOME}}/swaylock + {{LN}} {{DOTFILES}}/platforms/linux/swaylock {{XDG_CONFIG_HOME}}/swaylock/config + +[linux] +dunst: + mkdir -p {{XDG_CONFIG_HOME}}/dunst + {{LN}} {{DOTFILES}}/platforms/linux/dunstrc {{XDG_CONFIG_HOME}}/dunst/dunstrc + +[linux] +hypr: + {{LN}} {{DOTFILES}}/platforms/linux/hypr {{XDG_CONFIG_HOME}}/hypr + +[linux] +rofi: + {{LN}} {{DOTFILES}}/platforms/linux/rofi {{XDG_CONFIG_HOME}}/rofi + +[linux] +hyprland: + @just hypr + @just dunst + @just swaylock + @just rofi + + diff --git a/.just.d/misc.just b/.just.d/misc.just new file mode 100644 index 0000000..cb85132 --- /dev/null +++ b/.just.d/misc.just @@ -0,0 +1,15 @@ +uv: + uv init {{XDG_DATA_HOME}}/uvenv + cd {{XDG_DATA_HOME}}/uvenv + uv venv + uv add -r {{DOTFILES}}/bootstrap/components/requirements.txt + +vivaldi: + {{CURL}} https://github.com/SocietasEvanescentes/Vivaldi/files/12446831/Rose.Pine.Dawn.zip {{CURL_OUT}} "$HOME/Downloads/vivaldi-light.zip" # Rose Pine Dawn + {{CURL}} https://github.com/catppuccin/vivaldi/releases/download/1.0.0-ctpv2/Catppuccin.Mocha.Lavender.zip {{CURL_OUT}} "$HOME/Downloads/vivaldi-dark.zip" # Catppuccino Mocha Lavender + + +zotero: + {{CURL}} https://github.com/syt2/zotero-addons/releases/download/V1.8.1/zotero-addons.xpi {{CURL_OUT}} "$HOME/Downloads/zotero-addons.xpi" + + diff --git a/.just.d/tools.just b/.just.d/tools.just new file mode 100644 index 0000000..7f17c9b --- /dev/null +++ b/.just.d/tools.just @@ -0,0 +1,55 @@ +[unix] +kitty: + which kitty + {{LN}} {{DOTFILES}}/tools/kitty {{XDG_CONFIG_HOME}}/kitty + +neovim: + which nvim + {{LN}} {{DOTFILES}}/tools/nvim {{XDG_CONFIG_HOME}}/nvim + nvim --headless +checkhealth +"w nvim-healthcheck.txt" +qall + +nvim: + @just neovim + +[linux] +bash: + {{LN}} {{DOTFILES}}/tools/bash {{XDG_CONFIG_HOME}}/bash + sudo cp {{DOTFILES}}/tools/bash/xdg-compat.sh /etc/profile.d/xdg-compat.sh + +[unix] +fish: + {{LN}} {{DOTFILES}}/tools/fish {{XDG_CONFIG_HOME}}/fish + {{CURL}} https://raw.githubusercontent.com/SpaceAceMonkey/dotenv-for-fish/refs/heads/main/dotenv.fish {{CURL_OUT}} "{{DOTFILES}}/tools/fish/functions/dotenv.fish" + +[unix] +screen: + {{LN}} {{DOTFILES}}/tools/screen {{XDG_CONFIG_HOME}}/screen + +thunderbird: + {{CURL}} https://github.com/wshanks/tbkeys/releases/download/v2.4.0/tbkeys.xpi {{CURL_OUT}} "$HOME/Downloads/tbkeys.xpi" + {{CURL}} https://github.com/htyxyt/htyxyt-immersive-translate-Thunderbird/releases/download/thunderbird-v1.14.8/immersive-translate-Thunderbird.v1.14.8.xpi {{CURL_OUT}} "$HOME/Downloads/immersive-translate-Thunderbird.xpi" + cat {{DOTFILES}}/tools/thunderbird/tbkeys.json | {{CLIP}} + +wezterm: + which wezterm + {{LN}} {{DOTFILES}}/tools/wezterm {{XDG_CONFIG_HOME}}/wezterm + + +yazi: + which yazi || cargo install --locked yazi-fm yazi-cli + -ya pack -a llanosrocas/yaziline + -ya pack -a yazi-rs/plugins:git + -ya pack -a Rolv-Apneseth/starship + +[unix] +zsh: + -[[ -f /etc/zshenv ]] && sudo cp {{DOTFILES}}/tools/zsh/global.zshenv /etc/zshenv # or /etc/zsh/zshenv + -[[ -f /etc/zsh/zshenv ]] && sudo cp {{DOTFILES}}/tools/zsh/global.zshenv /etc/zsh/zshenv + mkdir -p {{XDG_CONFIG_HOME}}/zsh + {{LN}} {{DOTFILES}}/tools/zsh/zshenv {{XDG_CONFIG_HOME}}/zsh/.zshenv + {{LN}} {{DOTFILES}}/tools/zsh/zshrc {{XDG_CONFIG_HOME}}/zsh/.zshrc + {{LN}} {{DOTFILES}}/tools/zsh/zprofile {{XDG_CONFIG_HOME}}/zsh/.zprofile + test -d {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-autosuggestions || git clone --depth 1 https://github.com/zsh-users/zsh-autosuggestions.git {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-autosuggestions + test -d {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-syntax-highlighting || git clone --depth 1 https://github.com/zsh-users/zsh-syntax-highlighting.git {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-syntax-highlighting + test -d {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-history-substring-search || git clone --depth 1 https://github.com/zsh-users/zsh-history-substring-search.git {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-history-substring-search + test -d {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-completions || git clone --depth 1 https://github.com/zsh-users/zsh-completions.git {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-completions diff --git a/.just.d/vars.just b/.just.d/vars.just new file mode 100644 index 0000000..5fd1146 --- /dev/null +++ b/.just.d/vars.just @@ -0,0 +1,42 @@ +OS := \ + if os() == "linux" { + if env("WSL_DISTRO_NAME","") != "" { + "wsl" + } else { + "linux" + } + } else if os() == "windows" { + "win" + } else if os() == "macos" { + "mac" + } else { "" } +DOTFILES := join(home_directory(), ".dotfiles") +XDG_CONFIG_HOME := \ + if env("XDG_CONFIG_HOME", "") != "" {env("XDG_CONFIG_HOME", "")} \ + else { + if os_family() == "windows" { + env("APPDATA") + } else { + join(home_directory(), ".config") + } + } + +XDG_DATA_HOME := \ + if env("XDG_DATA_HOME", "") != "" {env("XDG_DATA_HOME", "")} \ + else { + if os_family() == "windows" { + env("LOCALAPPDATA", "") + } else { + join(home_directory(), ".local/share") + } + } + +XDG_STATE_HOME := \ + if env("XDG_STATE_HOME", "") != "" {env("XDG_STATE_HOME", "")} \ + else { + if os_family() == "windows" { + join(env("LOCALAPPDATA", ""), "state") + } else { + join(home_directory(), ".local/state") + } + } diff --git a/Justfile b/Justfile index 70cdb76..e81b300 100644 --- a/Justfile +++ b/Justfile @@ -2,250 +2,14 @@ set shell := ["bash", "-c"] set windows-shell := ["pwsh", "-c"] +import '.just.d/vars.just' +import '.just.d/cmds.just' +import '.just.d/common.just' +import '.just.d/tools.just' +import '.just.d/misc.just' +import '.just.d/linux.just' +import '.just.d/check.just' -OS := \ - if os() == "linux" { - if env("WSL_DISTRO_NAME","") != "" { - "wsl" - } else { - "linux" - } - } else if os() == "windows" { - "win" - } else if os() == "macos" { - "mac" - } else { "" } -DOTFILES := join(home_directory(), ".dotfiles") -XDG_CONFIG_HOME := \ - if env("XDG_CONFIG_HOME", "") != "" {env("XDG_CONFIG_HOME", "")} \ - else { - if os_family() == "windows" { - env("APPDATA") - } else { - join(home_directory(), ".config") - } - } - -XDG_DATA_HOME := \ - if env("XDG_DATA_HOME", "") != "" {env("XDG_DATA_HOME", "")} \ - else { - if os_family() == "windows" { - env("LOCALAPPDATA", "") - } else { - join(home_directory(), ".local/share") - } - } - -XDG_STATE_HOME := \ - if env("XDG_STATE_HOME", "") != "" {env("XDG_STATE_HOME", "")} \ - else { - if os_family() == "windows" { - join(env("LOCALAPPDATA", ""), "state") - } else { - join(home_directory(), ".local/state") - } - } - -# Sudo and coreutils are required -LN := \ - if os_family() == "windows" { - "sudo ln -sf" - } else { - "ln -sf" - } -CLIP := \ - if os() == "windows" { "clip.exe" } \ - else if os() == "linux" { "wl-copy" } \ - else if os() == "macos" { "pbcopy" } \ - else { "" } - - -test: - echo {{DOTFILES}} - echo {{XDG_CONFIG_HOME}} - echo {{XDG_DATA_HOME}} - -init: - git remote remove origin - git remote add github git@github.com:js0ny/dotfiles.git - git remote add codeberg git@codeberg.org:js0ny/dotfiles.git - -check: - @just check_shell -format: - @just format_shell -push: - git push github master - git push codeberg master - -setup: - @just ideavim - @just vivaldi - -ideavim: - ln -sf {{DOTFILES}}/common/ideavimrc {{XDG_CONFIG_HOME}}/ideavim/ideavimrc - git clone https://github.com/MarcoIeni/intellimacs {{join(home_directory(), ".local/share/intellimacs")}} --depth 1 - -[unix] -vivaldi: - curl -L https://github.com/SocietasEvanescentes/Vivaldi/files/12446831/Rose.Pine.Dawn.zip -o "$HOME/Downloads/vivaldi-light.zip" # Rose Pine Dawn - curl -L https://github.com/catppuccin/vivaldi/releases/download/1.0.0-ctpv2/Catppuccin.Mocha.Lavender.zip -o "$HOME/Downloads/vivaldi-dark.zip" # Catppuccino Mocha Lavender - - -[linux] -systemd: - ln -sf {{DOTFILES}}/platforms/{{OS}}/systemd {{XDG_CONFIG_HOME}}/systemd/ - - -uv: - uv init {{XDG_DATA_HOME}}/uvenv - cd {{XDG_DATA_HOME}}/uvenv - uv venv - uv add -r {{DOTFILES}}/bootstrap/components/requirements.txt - -[unix] -vim: - mkdir -p {{XDG_DATA_HOME}}/vim/after - mkdir -p {{XDG_STATE_HOME}}/vim/{backup,swap,undo,view} - mkdir -p {{XDG_CONFIG_HOME}}/vim/ - ln -sf {{DOTFILES}}/common/vimrc {{XDG_CONFIG_HOME}}/vim/vimrc - - -[windows] -vim: - New-Item -ItemType SymbolicLink -Path $HOME/_vimrc -Value {{DOTFILES}}/common/vim.noxdg.vimrc - -yazi: - which yazi || cargo install --locked yazi-fm yazi-cli - -ya pack -a llanosrocas/yaziline - -ya pack -a yazi-rs/plugins:git - -ya pack -a Rolv-Apneseth/starship - -wezterm: - which wezterm - {{LN}} {{DOTFILES}}/tools/wezterm {{XDG_CONFIG_HOME}}/wezterm/wezterm.lua - -neovim: - which nvim - {{LN}} {{DOTFILES}}/tools/nvim {{XDG_CONFIG_HOME}}/nvim - nvim --headless +checkhealth +"w nvim-healthcheck.txt" +qall - -[unix] -neovide: - which neovide - -mkdir -p {{XDG_CONFIG_HOME}}/neovide - {{LN}} {{DOTFILES}}/platforms/{{OS}}/neovide.toml {{XDG_CONFIG_HOME}}/neovide/config.toml - -[unix] -thunderbird: - curl -L https://github.com/wshanks/tbkeys/releases/download/v2.4.0/tbkeys.xpi -o "$HOME/Downloads/tbkeys.xpi" - curl -L https://github.com/htyxyt/htyxyt-immersive-translate-Thunderbird/releases/download/thunderbird-v1.14.8/immersive-translate-Thunderbird.v1.14.8.xpi -o "$HOME/Downloads/immersive-translate-Thunderbird.xpi" - cat {{DOTFILES}}/tools/thunderbird/tbkeys.json | {{CLIP}} - -[linux] -readline: - mkdir -p {{XDG_CONFIG_HOME}}/readline - {{LN}} {{DOTFILES}}/common/inputrc {{XDG_CONFIG_HOME}}/readline/inputrc - -[linux] -bash: - {{LN}} {{DOTFILES}}/tools/bash {{XDG_CONFIG_HOME}}/bash - sudo cp {{DOTFILES}}/tools/bash/xdg-compat.sh /etc/profile.d/xdg-compat.sh - -[linux] -keyd: - -which keyd || sudo pacman -S keyd --noconfirm || sudo apt install keyd --yes || @just build_keyd - sudo cp {{DOTFILES}}/platforms/linux/keyd/keyd.conf /etc/keyd/default.conf - mkdir -p {{XDG_CONFIG_HOME}}/keyd - {{LN}} {{DOTFILES}}/platforms/linux/keyd/app.conf {{XDG_CONFIG_HOME}}/keyd/app.conf - sudo systemctl enable keyd - -[linux] -[private] -build_keyd: - git clone https://github.com/rvaiya/keyd $HOME/.local/build/keyd - cd $HOME/.local/build/keyd && make && sudo make install - -[unix] -kitty: - which kitty - {{LN}} {{DOTFILES}}/tools/kitty {{XDG_CONFIG_HOME}}/kitty - -[unix] -zotero: - curl -L https://github.com/syt2/zotero-addons/releases/download/V1.8.1/zotero-addons.xpi -o "$HOME/Downloads/zotero-addons.xpi" - -[unix] -fish: - {{LN}} {{DOTFILES}}/tools/fish {{XDG_CONFIG_HOME}}/fish - curl -L https://raw.githubusercontent.com/SpaceAceMonkey/dotenv-for-fish/refs/heads/main/dotenv.fish -o "{{DOTFILES}}/tools/fish/functions/dotenv.fish" - -[unix] -screen: - {{LN}} {{DOTFILES}}/tools/screen {{XDG_CONFIG_HOME}}/screen - -[unix] -zsh: - -[[ -f /etc/zshenv ]] && sudo cp {{DOTFILES}}/tools/zsh/global.zshenv /etc/zshenv # or /etc/zsh/zshenv - -[[ -f /etc/zsh/zshenv ]] && sudo cp {{DOTFILES}}/tools/zsh/global.zshenv /etc/zsh/zshenv - mkdir -p {{XDG_CONFIG_HOME}}/zsh - {{LN}} {{DOTFILES}}/tools/zsh/zshenv {{XDG_CONFIG_HOME}}/zsh/.zshenv - {{LN}} {{DOTFILES}}/tools/zsh/zshrc {{XDG_CONFIG_HOME}}/zsh/.zshrc - {{LN}} {{DOTFILES}}/tools/zsh/zprofile {{XDG_CONFIG_HOME}}/zsh/.zprofile - test -d {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-autosuggestions || git clone --depth 1 https://github.com/zsh-users/zsh-autosuggestions.git {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-autosuggestions - test -d {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-syntax-highlighting || git clone --depth 1 https://github.com/zsh-users/zsh-syntax-highlighting.git {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-syntax-highlighting - test -d {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-history-substring-search || git clone --depth 1 https://github.com/zsh-users/zsh-history-substring-search.git {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-history-substring-search - test -d {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-completions || git clone --depth 1 https://github.com/zsh-users/zsh-completions.git {{XDG_CONFIG_HOME}}/zsh/plugins/zsh-completions - -[linux] -flatpak: - flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo - -[linux] -swaylock: - mkdir -p {{XDG_CONFIG_HOME}}/swaylock - {{LN}} {{DOTFILES}}/platforms/linux/swaylock {{XDG_CONFIG_HOME}}/swaylock/config - -[linux] -dunst: - mkdir -p {{XDG_CONFIG_HOME}}/dunst - {{LN}} {{DOTFILES}}/platforms/linux/dunstrc {{XDG_CONFIG_HOME}}/dunst/dunstrc - -[linux] -hypr: - {{LN}} {{DOTFILES}}/platforms/linux/hypr {{XDG_CONFIG_HOME}}/hypr - -[linux] -rofi: - {{LN}} {{DOTFILES}}/platforms/linux/rofi {{XDG_CONFIG_HOME}}/rofi - -[linux] -hyprland: - @just hypr - @just dunst - @just swaylock - @just rofi - -[private] -pull: - git pull github master - - -[private] -[unix] -check_shell: - shellcheck -x -s sh --severity=error **/*.sh platforms/mac/yabairc - shellcheck -x -s bash --severity=error **/*.bash tools/bash/* **/*.bashrc - -[private] -[unix] -format_shell: - shfmt -w -i 2 -ci -bn -p **/*.sh - shfmt -w -i 2 -ci -bn -ln bash **/*.bash platforms/mac/sketchybar/sketchybarrc - # Ignore syntax errors in zsh files - shfmt -w -i 2 -ci -bn -ln bash **/*.zsh tools/zsh/**/* **/zshrc || true - -[private] -check_info: - shellcheck -x -s sh **/*.sh platforms/mac/yabairc - shellcheck -x -s bash **/*.bash tools/bash/* scripts/*.{sh,zsh,bash} **/*.bashrc +_default: + @just test + @just --list diff --git a/common/fzfrc b/common/fzfrc new file mode 100644 index 0000000..a2beb38 --- /dev/null +++ b/common/fzfrc @@ -0,0 +1,10 @@ +# --preview 'bat --color=always --style=numbers {}' +--bind alt-n:preview-down,alt-e:preview-up +--bind ctrl-e:up +--bind alt-p:toggle-preview +--color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8 +--color=fg:#cdd6f4,header:#f38ba8,info:#f5c2e7,pointer:#f5e0dc +--color=marker:#b4befe,fg+:#cdd6f4,prompt:#f5c2e7,hl+:#f38ba8 +--color=selected-bg:#45475a +--color=border:#313244,label:#cdd6f4 + diff --git a/platforms/linux/hypr/hyprland.conf b/platforms/linux/hypr/hyprland.conf index d440d50..12e9f70 100644 --- a/platforms/linux/hypr/hyprland.conf +++ b/platforms/linux/hypr/hyprland.conf @@ -15,6 +15,10 @@ # ####################################################################################### $mainMod = SUPER # Sets "Windows" key as main modifier +$terminal = kitty +$fileManager = dolphin +$menu = rofi +$iconTheme = Papirus source=~/.config/hypr/hyprland/dark.conf source=~/.config/hypr/hyprland/+colemak.conf @@ -53,10 +57,6 @@ monitor=DP-2,3840x2160@60,0x0,1.667 # See https://wiki.hyprland.org/Configuring/Keywords/ # Set programs that you use -$terminal = kitty -$fileManager = dolphin -$menu = rofi -$iconTheme = Papirus ################# diff --git a/readme.org b/readme.org index 8748069..66c7dea 100644 --- a/readme.org +++ b/readme.org @@ -8,12 +8,31 @@ Works for Windows, Linux and MacOS. ** Setup -*** GNU/Linux and macOS + +*** From Scratch (Linux/MacOS) #+begin_src shell curl https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/bootstrap/setup.sh -o setup.sh && chmod u+x setup.sh && ./setup.sh #+end_src +*** Via =just= script + +Make sure you have =just= installed + +#+begin_src shell +which just +#+end_src + +Then run + +#+begin_src shell +just +#+end_src + +This will list all available tasks. + +All the just scripts are in =Justfile= and under =.just.d/= directory. + ** Structure #+begin_src shell From 5ddef6771426920e0eec68a8624f0928a2327410 Mon Sep 17 00:00:00 2001 From: js0ny Date: Thu, 10 Apr 2025 01:53:54 +0100 Subject: [PATCH 35/35] fix(fzf): run command will change shell-integration behaviour --- common/fzfrc | 18 +++++++++--------- tools/kitty/kitty.conf | 1 + tools/zsh/zshenv | 7 ++++--- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/common/fzfrc b/common/fzfrc index a2beb38..4d88a35 100644 --- a/common/fzfrc +++ b/common/fzfrc @@ -1,10 +1,10 @@ # --preview 'bat --color=always --style=numbers {}' ---bind alt-n:preview-down,alt-e:preview-up ---bind ctrl-e:up ---bind alt-p:toggle-preview ---color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8 ---color=fg:#cdd6f4,header:#f38ba8,info:#f5c2e7,pointer:#f5e0dc ---color=marker:#b4befe,fg+:#cdd6f4,prompt:#f5c2e7,hl+:#f38ba8 ---color=selected-bg:#45475a ---color=border:#313244,label:#cdd6f4 - +# --bind alt-n:preview-down,alt-e:preview-up +# --bind ctrl-e:up +# --bind alt-p:toggle-preview +# --color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8 +# --color=fg:#cdd6f4,header:#f38ba8,info:#f5c2e7,pointer:#f5e0dc +# --color=marker:#b4befe,fg+:#cdd6f4,prompt:#f5c2e7,hl+:#f38ba8 +# --color=selected-bg:#45475a +# --color=border:#313244,label:#cdd6f4 +# diff --git a/tools/kitty/kitty.conf b/tools/kitty/kitty.conf index e9393a4..2c09cce 100644 --- a/tools/kitty/kitty.conf +++ b/tools/kitty/kitty.conf @@ -79,3 +79,4 @@ map ctrl+shift+enter toggle_layout stack # }}} +shell fish diff --git a/tools/zsh/zshenv b/tools/zsh/zshenv index d7e852f..eabb593 100644 --- a/tools/zsh/zshenv +++ b/tools/zsh/zshenv @@ -139,9 +139,10 @@ if command -v emacs >/dev/null; then export SPACEMACSDIR="$XDG_CONFIG_HOME"/spacemacs fi # Fzf -if command -v fzf > /dev/null; then - export FZF_DEFAULT_OPTS_FILE="$HOME/.dotfiles/common/fzfrc" -fi +# This will make shell integration buggy +# if command -v fzf > /dev/null; then +# export FZF_DEFAULT_OPTS_FILE="$HOME/.dotfiles/common/fzfrc" +# fi # tldr # Works only with C client (did not verify) if command -v tldr >/dev/null; then