diff options
38 files changed, 320 insertions, 282 deletions
diff --git a/modules/communication/neomutt/.neomuttrc b/modules/communication/neomutt/.neomuttrc index 3ed08f9..2f7ef00 100644 --- a/modules/communication/neomutt/.neomuttrc +++ b/modules/communication/neomutt/.neomuttrc @@ -1,3 +1,10 @@ +# Read messages in Neovim. `-` makes Neovim read the message from +# stdin and -R prevents accidental edits to message content. +set pager = "@@PAGER@@ -R -n +'setlocal nolist | silent! 1,2g/^$/delete _ | nohlsearch | setlocal nomodified nomodifiable' -" +# Return directly to the index when Neovim exits and do not prepend +# NeoMutt’s pager status line to the message passed to Neovim. +set noprompt_after +set pager_format = "" # Base16 OneDark Dark terminal colors for neomutt # Each column in the index receives a distinct color to keep the UI organized. diff --git a/modules/communication/neomutt/account/.muttrc b/modules/communication/neomutt/account/.muttrc new file mode 100644 index 0000000..2f8c9f2 --- /dev/null +++ b/modules/communication/neomutt/account/.muttrc @@ -0,0 +1,2 @@ +macro index,pager gs "<enter-command>set my_wait_key=$wait_key wait_key=no<enter><sync-mailbox><shell-escape>neomutt-sync @@QUICK_CHANNEL@@<enter><sync-mailbox><enter-command>set wait_key=$my_wait_key<enter>" +macro index,pager gS "<enter-command>set my_wait_key=$wait_key wait_key=no<enter><sync-mailbox><shell-escape>neomutt-sync @@FULL_CHANNEL@@<enter><sync-mailbox><enter-command>set wait_key=$my_wait_key<enter>" diff --git a/modules/communication/neomutt/account/default.nix b/modules/communication/neomutt/account/default.nix index 5c0f8bf..e2d92eb 100644 --- a/modules/communication/neomutt/account/default.nix +++ b/modules/communication/neomutt/account/default.nix @@ -9,8 +9,8 @@ type = lib.types.attrsOf ( lib.types.submodule { imports = [ + ./flavors/gmail ./options.nix - ./flavors/gmail.nix ./sync-channel.nix ]; } diff --git a/modules/communication/neomutt/account/flavors/gmail/.muttrc b/modules/communication/neomutt/account/flavors/gmail/.muttrc new file mode 100644 index 0000000..c87bba0 --- /dev/null +++ b/modules/communication/neomutt/account/flavors/gmail/.muttrc @@ -0,0 +1,2 @@ +mailboxes =Inbox ="[Gmail]/Drafts" ="[Gmail]/Sent Mail" ="[Gmail]/Spam" ="[Gmail]/Trash" +unset record diff --git a/modules/communication/neomutt/account/flavors/gmail.nix b/modules/communication/neomutt/account/flavors/gmail/default.nix index 9cb51b2..66d7db3 100644 --- a/modules/communication/neomutt/account/flavors/gmail.nix +++ b/modules/communication/neomutt/account/flavors/gmail/default.nix @@ -30,10 +30,7 @@ }; }; - neomutt.extraConfig = lib.mkBefore '' - mailboxes =Inbox ="[Gmail]/Drafts" ="[Gmail]/Sent Mail" ="[Gmail]/Spam" ="[Gmail]/Trash" - unset record - ''; + neomutt.extraConfig = lib.mkBefore (builtins.readFile ./.muttrc); notmuch.neomutt.virtualMailboxes = lib.mkDefault [ { diff --git a/modules/communication/neomutt/account/sync-channel.nix b/modules/communication/neomutt/account/sync-channel.nix index 7e538f2..6f3bd54 100644 --- a/modules/communication/neomutt/account/sync-channel.nix +++ b/modules/communication/neomutt/account/sync-channel.nix @@ -3,7 +3,7 @@ lib, name, ... -}@inputs: +}: let mbsyncNamesFromName = (import ../lib.nix { inherit lib; }).mbsyncNamesFromName; @@ -14,9 +14,12 @@ in let mbsyncNames = mbsyncNamesFromName name; in - '' - macro index,pager gs "<enter-command>set my_wait_key=$wait_key wait_key=no<enter><sync-mailbox><shell-escape>neomutt-sync ${mbsyncNames.channels.quick}<enter><sync-mailbox><enter-command>set wait_key=$my_wait_key<enter>" - macro index,pager gS "<enter-command>set my_wait_key=$wait_key wait_key=no<enter><sync-mailbox><shell-escape>neomutt-sync ${mbsyncNames.channels.full}<enter><sync-mailbox><enter-command>set wait_key=$my_wait_key<enter>" - ''; + builtins.replaceStrings + [ "@@QUICK_CHANNEL@@" "@@FULL_CHANNEL@@" ] + [ + mbsyncNames.channels.quick + mbsyncNames.channels.full + ] + (builtins.readFile ./.muttrc); }; } diff --git a/modules/communication/neomutt/default.nix b/modules/communication/neomutt/default.nix index 84e6c61..b9f22e0 100644 --- a/modules/communication/neomutt/default.nix +++ b/modules/communication/neomutt/default.nix @@ -79,14 +79,9 @@ in xdg.mimeApps.defaultApplications = { "x-scheme-handler/mailto" = "neomutt.desktop"; }; - xdg.configFile."neomutt/mailcap".text = '' - text/html; ${lib.getExe config.web.chawan.package} '%s'; nametemplate=%s.html - image/*; xdg-open '%s' & - application/pdf; xdg-open '%s'; nametemplate=%s.pdf - video/*; xdg-open '%s' & - audio/*; xdg-open '%s' & - application/*; xdg-open '%s' & - ''; + xdg.configFile."neomutt/mailcap".text = + builtins.replaceStrings [ "@@HTML_VIEWER@@" ] [ (lib.getExe config.web.chawan.package) ] + (builtins.readFile ./mailcap); programs.neomutt = { enable = true; package = pkgs.symlinkJoin { @@ -107,16 +102,9 @@ in vimKeys = false; unmailboxes = true; checkStatsInterval = 20; - extraConfig = '' - # Read messages in Neovim. `-` makes Neovim read the message from - # stdin and -R prevents accidental edits to message content. - set pager = "${lib.getExe config.development.nixvim.package} -R -n +'setlocal nolist | silent! 1,2g/^$/delete _ | nohlsearch | setlocal nomodified nomodifiable' -" - # Return directly to the index when Neovim exits and do not prepend - # NeoMutt’s pager status line to the message passed to Neovim. - set noprompt_after - set pager_format = "" - '' - + builtins.readFile ./.neomuttrc; + extraConfig = + builtins.replaceStrings [ "@@PAGER@@" ] [ (lib.getExe config.development.nixvim.package) ] + (builtins.readFile ./.neomuttrc); }; }; } diff --git a/modules/communication/neomutt/mailcap b/modules/communication/neomutt/mailcap new file mode 100644 index 0000000..3af2794 --- /dev/null +++ b/modules/communication/neomutt/mailcap @@ -0,0 +1,6 @@ +text/html; @@HTML_VIEWER@@ '%s'; nametemplate=%s.html +image/*; xdg-open '%s' & +application/pdf; xdg-open '%s'; nametemplate=%s.pdf +video/*; xdg-open '%s' & +audio/*; xdg-open '%s' & +application/*; xdg-open '%s' & diff --git a/modules/development/nixvim/default.nix b/modules/development/nixvim/default.nix index 74b0c1f..00712cc 100644 --- a/modules/development/nixvim/default.nix +++ b/modules/development/nixvim/default.nix @@ -78,26 +78,6 @@ in }; }; }; - - autoCmd = [ - { - event = [ "CursorHold" ]; - pattern = "*"; - callback.__raw = '' - function() - vim.diagnostic.open_float(nil, { focus = false }) - end - ''; - } - { - event = [ "FileType" ]; - pattern = [ - "yaml" - "yml" - ]; - command = "setlocal expandtab shiftwidth=2 softtabstop=2 tabstop=2"; - } - ]; }; }; } diff --git a/modules/development/nixvim/plugins/cmp.nix b/modules/development/nixvim/plugins/cmp/default.nix index b2347ba..4698801 100644 --- a/modules/development/nixvim/plugins/cmp.nix +++ b/modules/development/nixvim/plugins/cmp/default.nix @@ -16,15 +16,7 @@ "<C-u>" = "cmp.mapping.scroll_docs(-4)"; # scroll docs up "<C-d>" = "cmp.mapping.scroll_docs(4)"; # scroll docs down - "<Escape>" = '' - cmp.mapping(function(fallback) - if cmp.visible() then - cmp.abort() - else - fallback() - end - end, { "i" }) - ''; + "<Escape>" = builtins.readFile ./escape.lua; }; sources = [ { name = "nvim_lsp"; } diff --git a/modules/development/nixvim/plugins/cmp/escape.lua b/modules/development/nixvim/plugins/cmp/escape.lua new file mode 100644 index 0000000..e215bc7 --- /dev/null +++ b/modules/development/nixvim/plugins/cmp/escape.lua @@ -0,0 +1,7 @@ +cmp.mapping(function(fallback) + if cmp.visible() then + cmp.abort() + else + fallback() + end +end, { "i" }) diff --git a/modules/development/nixvim/plugins/comment.nix b/modules/development/nixvim/plugins/comment/default.nix index 8c69218..8c69218 100644 --- a/modules/development/nixvim/plugins/comment.nix +++ b/modules/development/nixvim/plugins/comment/default.nix diff --git a/modules/development/nixvim/plugins/dap-ui/dap-ui.lua b/modules/development/nixvim/plugins/dap-ui/dap-ui.lua new file mode 100644 index 0000000..bcf4fe3 --- /dev/null +++ b/modules/development/nixvim/plugins/dap-ui/dap-ui.lua @@ -0,0 +1,10 @@ +local dap, dapui = require("dap"), require("dapui") +dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open() +end +dap.listeners.before.event_terminated["dapui_config"] = function() + dapui.close() +end +dap.listeners.before.event_exited["dapui_config"] = function() + dapui.close() +end diff --git a/modules/development/nixvim/plugins/dap-ui.nix b/modules/development/nixvim/plugins/dap-ui/default.nix index cc25d2d..eb83609 100644 --- a/modules/development/nixvim/plugins/dap-ui.nix +++ b/modules/development/nixvim/plugins/dap-ui/default.nix @@ -21,5 +21,8 @@ options.desc = "Debug: Eval Expression Under Cursor"; } ]; + + # Auto open/close dap-ui with the debug session lifecycle + extraConfigLua = builtins.readFile ./dap-ui.lua; }; } diff --git a/modules/development/nixvim/plugins/dap-virtual-text.nix b/modules/development/nixvim/plugins/dap-virtual-text/default.nix index 4fea5ca..4fea5ca 100644 --- a/modules/development/nixvim/plugins/dap-virtual-text.nix +++ b/modules/development/nixvim/plugins/dap-virtual-text/default.nix diff --git a/modules/development/nixvim/plugins/dap.nix b/modules/development/nixvim/plugins/dap/default.nix index 02bffa6..97452ac 100644 --- a/modules/development/nixvim/plugins/dap.nix +++ b/modules/development/nixvim/plugins/dap/default.nix @@ -63,19 +63,5 @@ options.desc = "Debug: Toggle REPL"; } ]; - - # Auto open/close dap-ui with the debug session lifecycle - extraConfigLua = '' - local dap, dapui = require("dap"), require("dapui") - dap.listeners.after.event_initialized["dapui_config"] = function() - dapui.open() - end - dap.listeners.before.event_terminated["dapui_config"] = function() - dapui.close() - end - dap.listeners.before.event_exited["dapui_config"] = function() - dapui.close() - end - ''; }; } diff --git a/modules/development/nixvim/plugins/default.nix b/modules/development/nixvim/plugins/default.nix index 67f7f06..ecc9441 100644 --- a/modules/development/nixvim/plugins/default.nix +++ b/modules/development/nixvim/plugins/default.nix @@ -2,21 +2,21 @@ { ... }: { imports = [ - ./cmp.nix - ./comment.nix - ./dap-ui.nix - ./dap-virtual-text.nix - ./dap.nix - ./gitsigns.nix - ./indent-blankline.nix - ./lsp.nix - ./lualine.nix - ./luasnip.nix - ./noice.nix - ./nvim-tree.nix - ./telescope.nix - ./treesitter.nix - ./web-devicons.nix - ./which-key.nix + ./cmp + ./comment + ./dap-ui + ./dap-virtual-text + ./dap + ./gitsigns + ./indent-blankline + ./lsp + ./lualine + ./luasnip + ./noice + ./nvim-tree + ./telescope + ./treesitter + ./web-devicons + ./which-key ]; } diff --git a/modules/development/nixvim/plugins/gitsigns.nix b/modules/development/nixvim/plugins/gitsigns.nix deleted file mode 100644 index d9bda21..0000000 --- a/modules/development/nixvim/plugins/gitsigns.nix +++ /dev/null @@ -1,112 +0,0 @@ -# Git integration: signs, blame, diffs and hunk operations -{ - config, - lib, - pkgs, - ... -}: -let - base16Colors = import ../../../colors/base16 { inherit config lib pkgs; }; -in -{ - config.programs.nixvim = lib.mkIf config.development.nixvim.enable { - plugins.gitsigns = { - enable = true; - - settings = { - signs = { - add.text = "┃"; - change.text = "┃"; - delete.text = "▁"; - topdelete.text = "▔"; - changedelete.text = "~"; - untracked.text = "┆"; - }; - - signcolumn = false; - numhl = true; - current_line_blame = false; - current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>"; - - on_attach = '' - function(bufnr) - local gitsigns = require('gitsigns') - local function map(mode, lhs, rhs, desc) - vim.keymap.set(mode, lhs, rhs, { buffer = bufnr, silent = true, desc = desc }) - end - - -- Navigation - map('n', ']c', function() gitsigns.nav_hunk('next') end, 'Next hunk') - map('n', '[c', function() gitsigns.nav_hunk('prev') end, 'Previous hunk') - map('n', ']C', function() gitsigns.nav_hunk('last') end, 'Last hunk') - map('n', '[C', function() gitsigns.nav_hunk('first') end, 'First hunk') - - -- Hunk actions - map('n', '<leader>gs', gitsigns.stage_hunk, 'Stage hunk') - map('v', '<leader>gs', function() - gitsigns.stage_hunk({ vim.fn.line('.'), vim.fn.line('v') }) - end, 'Stage visual range hunk') - map('n', '<leader>gr', gitsigns.reset_hunk, 'Reset hunk') - map('v', '<leader>gr', function() - gitsigns.reset_hunk({ vim.fn.line('.'), vim.fn.line('v') }) - end, 'Reset visual range hunk') - map('n', '<leader>gS', gitsigns.stage_buffer, 'Stage buffer') - map('n', '<leader>gR', gitsigns.reset_buffer, 'Reset buffer') - map('n', '<leader>gi', gitsigns.reset_buffer_index, 'Unstage buffer (reset index)') - map('n', '<leader>gu', gitsigns.undo_stage_hunk, 'Undo stage hunk') - - -- Preview - map('n', '<leader>gp', gitsigns.preview_hunk, 'Preview hunk') - map('n', '<leader>gP', gitsigns.preview_hunk_inline, 'Preview hunk inline') - - -- Blame - map('n', '<leader>gb', gitsigns.blame_line, 'Blame line') - map('n', '<leader>gB', function() - gitsigns.blame_line({ full = true }) - end, 'Blame line (full)') - - -- Diffs / base - map('n', '<leader>gd', gitsigns.diffthis, 'Diff this (index)') - map('n', '<leader>gD', function() - gitsigns.diffthis('~') - end, 'Diff this (HEAD)') - map('n', '<leader>gc', function() - gitsigns.change_base(nil, true) - end, 'Change diff base') - - -- Quickfix / location list - map('n', '<leader>gq', gitsigns.setqflist, 'Hunks to quickfix') - map('n', '<leader>gQ', function() - gitsigns.setqflist('all') - end, 'Repo hunks to quickfix') - map('n', '<leader>gl', gitsigns.setloclist, 'Hunks to location list') - - -- Toggles - map('n', '<leader>gts', gitsigns.toggle_signs, 'Toggle signs') - map('n', '<leader>gtl', gitsigns.toggle_linehl, 'Toggle line highlight') - map('n', '<leader>gtn', gitsigns.toggle_numhl, 'Toggle number highlight') - map('n', '<leader>gtw', gitsigns.toggle_word_diff, 'Toggle word diff') - map('n', '<leader>gtb', gitsigns.toggle_current_line_blame, 'Toggle current line blame') - map('n', '<leader>gtd', gitsigns.toggle_deleted, 'Toggle deleted lines') - - -- Misc - map('n', '<leader>gF', gitsigns.refresh, 'Refresh gitsigns') - - -- Text object - map({ 'o', 'x' }, 'ih', gitsigns.select_hunk, 'Select hunk text object') - end - ''; - }; - }; - - highlight = with base16Colors.colorsWithHashPrefix; { - GitSignsAdd.fg = base0B; - GitSignsChange.fg = base0A; - GitSignsDelete.fg = base08; - GitSignsTopdelete.fg = base08; - GitSignsChangedelete.fg = base0A; - GitSignsUntracked.fg = base0C; - GitSignsCurrentLineBlame.fg = base04; - }; - }; -} diff --git a/modules/development/nixvim/plugins/gitsigns/default.nix b/modules/development/nixvim/plugins/gitsigns/default.nix new file mode 100644 index 0000000..af8b920 --- /dev/null +++ b/modules/development/nixvim/plugins/gitsigns/default.nix @@ -0,0 +1,45 @@ +# Git integration: signs, blame, diffs and hunk operations +{ + config, + lib, + pkgs, + ... +}: +let + base16Colors = import ../../../../colors/base16 { inherit config lib pkgs; }; +in +{ + config.programs.nixvim = lib.mkIf config.development.nixvim.enable { + plugins.gitsigns = { + enable = true; + + settings = { + signs = { + add.text = "┃"; + change.text = "┃"; + delete.text = "▁"; + topdelete.text = "▔"; + changedelete.text = "~"; + untracked.text = "┆"; + }; + + signcolumn = false; + numhl = true; + current_line_blame = false; + current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>"; + + on_attach = builtins.readFile ./on-attach.lua; + }; + }; + + highlight = with base16Colors.colorsWithHashPrefix; { + GitSignsAdd.fg = base0B; + GitSignsChange.fg = base0A; + GitSignsDelete.fg = base08; + GitSignsTopdelete.fg = base08; + GitSignsChangedelete.fg = base0A; + GitSignsUntracked.fg = base0C; + GitSignsCurrentLineBlame.fg = base04; + }; + }; +} diff --git a/modules/development/nixvim/plugins/gitsigns/on-attach.lua b/modules/development/nixvim/plugins/gitsigns/on-attach.lua new file mode 100644 index 0000000..5f63330 --- /dev/null +++ b/modules/development/nixvim/plugins/gitsigns/on-attach.lua @@ -0,0 +1,66 @@ +function(bufnr) + local gitsigns = require('gitsigns') + local function map(mode, lhs, rhs, desc) + vim.keymap.set(mode, lhs, rhs, { buffer = bufnr, silent = true, desc = desc }) + end + + -- Navigation + map('n', ']c', function() gitsigns.nav_hunk('next') end, 'Next hunk') + map('n', '[c', function() gitsigns.nav_hunk('prev') end, 'Previous hunk') + map('n', ']C', function() gitsigns.nav_hunk('last') end, 'Last hunk') + map('n', '[C', function() gitsigns.nav_hunk('first') end, 'First hunk') + + -- Hunk actions + map('n', '<leader>gs', gitsigns.stage_hunk, 'Stage hunk') + map('v', '<leader>gs', function() + gitsigns.stage_hunk({ vim.fn.line('.'), vim.fn.line('v') }) + end, 'Stage visual range hunk') + map('n', '<leader>gr', gitsigns.reset_hunk, 'Reset hunk') + map('v', '<leader>gr', function() + gitsigns.reset_hunk({ vim.fn.line('.'), vim.fn.line('v') }) + end, 'Reset visual range hunk') + map('n', '<leader>gS', gitsigns.stage_buffer, 'Stage buffer') + map('n', '<leader>gR', gitsigns.reset_buffer, 'Reset buffer') + map('n', '<leader>gi', gitsigns.reset_buffer_index, 'Unstage buffer (reset index)') + map('n', '<leader>gu', gitsigns.undo_stage_hunk, 'Undo stage hunk') + + -- Preview + map('n', '<leader>gp', gitsigns.preview_hunk, 'Preview hunk') + map('n', '<leader>gP', gitsigns.preview_hunk_inline, 'Preview hunk inline') + + -- Blame + map('n', '<leader>gb', gitsigns.blame_line, 'Blame line') + map('n', '<leader>gB', function() + gitsigns.blame_line({ full = true }) + end, 'Blame line (full)') + + -- Diffs / base + map('n', '<leader>gd', gitsigns.diffthis, 'Diff this (index)') + map('n', '<leader>gD', function() + gitsigns.diffthis('~') + end, 'Diff this (HEAD)') + map('n', '<leader>gc', function() + gitsigns.change_base(nil, true) + end, 'Change diff base') + + -- Quickfix / location list + map('n', '<leader>gq', gitsigns.setqflist, 'Hunks to quickfix') + map('n', '<leader>gQ', function() + gitsigns.setqflist('all') + end, 'Repo hunks to quickfix') + map('n', '<leader>gl', gitsigns.setloclist, 'Hunks to location list') + + -- Toggles + map('n', '<leader>gts', gitsigns.toggle_signs, 'Toggle signs') + map('n', '<leader>gtl', gitsigns.toggle_linehl, 'Toggle line highlight') + map('n', '<leader>gtn', gitsigns.toggle_numhl, 'Toggle number highlight') + map('n', '<leader>gtw', gitsigns.toggle_word_diff, 'Toggle word diff') + map('n', '<leader>gtb', gitsigns.toggle_current_line_blame, 'Toggle current line blame') + map('n', '<leader>gtd', gitsigns.toggle_deleted, 'Toggle deleted lines') + + -- Misc + map('n', '<leader>gF', gitsigns.refresh, 'Refresh gitsigns') + + -- Text object + map({ 'o', 'x' }, 'ih', gitsigns.select_hunk, 'Select hunk text object') +end diff --git a/modules/development/nixvim/plugins/indent-blankline.nix b/modules/development/nixvim/plugins/indent-blankline/default.nix index 6890dbf..6890dbf 100644 --- a/modules/development/nixvim/plugins/indent-blankline.nix +++ b/modules/development/nixvim/plugins/indent-blankline/default.nix diff --git a/modules/development/nixvim/plugins/lsp.nix b/modules/development/nixvim/plugins/lsp.nix deleted file mode 100644 index 6c64a37..0000000 --- a/modules/development/nixvim/plugins/lsp.nix +++ /dev/null @@ -1,33 +0,0 @@ -# Language Server Protocol configuration -{ config, lib, ... }: -{ - config.programs.nixvim.plugins.lsp = lib.mkIf config.development.nixvim.enable { - enable = true; - inlayHints = true; - autoLoad = true; - - keymaps = { - lspBuf = { - "<leader>lh" = "hover"; - "<leader>lr" = "references"; - "<leader>ld" = "definition"; - "<leader>li" = "implementation"; - "<leader>lt" = "type_definition"; - "<leader>lD" = "declaration"; - "<leader>lR" = "rename"; - "<leader>la" = "code_action"; - "<leader>lf" = "format"; - "<leader>ls" = "signature_help"; - "<leader>lwa" = "add_workspace_folder"; - "<leader>lwr" = "remove_workspace_folder"; - "<leader>lwl" = "list_workspace_folders"; - }; - diagnostic = { - "<leader>le" = "open_float"; - "<leader>lq" = "setloclist"; - "[d" = "goto_prev"; - "]d" = "goto_next"; - }; - }; - }; -} diff --git a/modules/development/nixvim/plugins/lsp/default.nix b/modules/development/nixvim/plugins/lsp/default.nix new file mode 100644 index 0000000..1d56b66 --- /dev/null +++ b/modules/development/nixvim/plugins/lsp/default.nix @@ -0,0 +1,43 @@ +# Language Server Protocol configuration +{ config, lib, ... }: +{ + config.programs.nixvim = lib.mkIf config.development.nixvim.enable { + plugins.lsp = { + enable = true; + inlayHints = true; + autoLoad = true; + + keymaps = { + lspBuf = { + "<leader>lh" = "hover"; + "<leader>lr" = "references"; + "<leader>ld" = "definition"; + "<leader>li" = "implementation"; + "<leader>lt" = "type_definition"; + "<leader>lD" = "declaration"; + "<leader>lR" = "rename"; + "<leader>la" = "code_action"; + "<leader>lf" = "format"; + "<leader>ls" = "signature_help"; + "<leader>lwa" = "add_workspace_folder"; + "<leader>lwr" = "remove_workspace_folder"; + "<leader>lwl" = "list_workspace_folders"; + }; + diagnostic = { + "<leader>le" = "open_float"; + "<leader>lq" = "setloclist"; + "[d" = "goto_prev"; + "]d" = "goto_next"; + }; + }; + }; + + autoCmd = [ + { + event = [ "CursorHold" ]; + pattern = "*"; + callback.__raw = builtins.readFile ./open-diagnostic-float.lua; + } + ]; + }; +} diff --git a/modules/development/nixvim/plugins/lsp/open-diagnostic-float.lua b/modules/development/nixvim/plugins/lsp/open-diagnostic-float.lua new file mode 100644 index 0000000..fbfb9b9 --- /dev/null +++ b/modules/development/nixvim/plugins/lsp/open-diagnostic-float.lua @@ -0,0 +1,3 @@ +function() + vim.diagnostic.open_float(nil, { focus = false }) +end diff --git a/modules/development/nixvim/plugins/lualine.nix b/modules/development/nixvim/plugins/lualine/default.nix index 55326ee..a7dd083 100644 --- a/modules/development/nixvim/plugins/lualine.nix +++ b/modules/development/nixvim/plugins/lualine/default.nix @@ -6,7 +6,7 @@ ... }: let - base16Colors = import ../../../colors/base16 { inherit config lib pkgs; }; + base16Colors = import ../../../../colors/base16 { inherit config lib pkgs; }; in { config.programs.nixvim.plugins.lualine = lib.mkIf config.development.nixvim.enable { diff --git a/modules/development/nixvim/plugins/luasnip.nix b/modules/development/nixvim/plugins/luasnip/default.nix index cab0f62..cab0f62 100644 --- a/modules/development/nixvim/plugins/luasnip.nix +++ b/modules/development/nixvim/plugins/luasnip/default.nix diff --git a/modules/development/nixvim/plugins/noice.nix b/modules/development/nixvim/plugins/noice/default.nix index 8f2ea0d..8f2ea0d 100644 --- a/modules/development/nixvim/plugins/noice.nix +++ b/modules/development/nixvim/plugins/noice/default.nix diff --git a/modules/development/nixvim/plugins/nvim-tree.nix b/modules/development/nixvim/plugins/nvim-tree/default.nix index f54ada2..f54ada2 100644 --- a/modules/development/nixvim/plugins/nvim-tree.nix +++ b/modules/development/nixvim/plugins/nvim-tree/default.nix diff --git a/modules/development/nixvim/plugins/telescope.nix b/modules/development/nixvim/plugins/telescope/default.nix index 505a3eb..505a3eb 100644 --- a/modules/development/nixvim/plugins/telescope.nix +++ b/modules/development/nixvim/plugins/telescope/default.nix diff --git a/modules/development/nixvim/plugins/treesitter.nix b/modules/development/nixvim/plugins/treesitter/default.nix index 6150ad2..6150ad2 100644 --- a/modules/development/nixvim/plugins/treesitter.nix +++ b/modules/development/nixvim/plugins/treesitter/default.nix diff --git a/modules/development/nixvim/plugins/web-devicons.nix b/modules/development/nixvim/plugins/web-devicons/default.nix index 61ca5e9..61ca5e9 100644 --- a/modules/development/nixvim/plugins/web-devicons.nix +++ b/modules/development/nixvim/plugins/web-devicons/default.nix diff --git a/modules/development/nixvim/plugins/which-key.nix b/modules/development/nixvim/plugins/which-key/default.nix index 3a0c0ef..3a0c0ef 100644 --- a/modules/development/nixvim/plugins/which-key.nix +++ b/modules/development/nixvim/plugins/which-key/default.nix diff --git a/modules/terminal/kitty/default.nix b/modules/terminal/kitty/default.nix index d840667..f72f862 100644 --- a/modules/terminal/kitty/default.nix +++ b/modules/terminal/kitty/default.nix @@ -26,25 +26,7 @@ in programs.kitty = { enable = true; - extraConfig = '' - # Keep normal clicks for selection and prompt placement; Ctrl+click opens links. - mouse_map left click ungrabbed mouse_handle_click selection prompt - mouse_map ctrl+left click grabbed,ungrabbed mouse_handle_click link - - # Vim-style navigation between Kitty windows in the current tab. - map ctrl+shift+h neighboring_window left - map ctrl+shift+j neighboring_window bottom - map ctrl+shift+k neighboring_window top - map ctrl+shift+l neighboring_window right - - # Line scrolling - map ctrl+shift+j scroll_line_down - map ctrl+shift+k scroll_line_up - - # Page scrolling (half-page / full-page) - map ctrl+shift+u scroll_page_up - map ctrl+shift+d scroll_page_down - ''; + extraConfig = builtins.readFile ./kitty.conf; settings = with base16Colors.colorsWithHashPrefix; { window_padding_width = 10; font_size = config.fonts.size; diff --git a/modules/terminal/kitty/kitty.conf b/modules/terminal/kitty/kitty.conf new file mode 100644 index 0000000..c55fbce --- /dev/null +++ b/modules/terminal/kitty/kitty.conf @@ -0,0 +1,17 @@ +# Keep normal clicks for selection and prompt placement; Ctrl+click opens links. +mouse_map left click ungrabbed mouse_handle_click selection prompt +mouse_map ctrl+left click grabbed,ungrabbed mouse_handle_click link + +# Vim-style navigation between Kitty windows in the current tab. +map ctrl+shift+h neighboring_window left +map ctrl+shift+j neighboring_window bottom +map ctrl+shift+k neighboring_window top +map ctrl+shift+l neighboring_window right + +# Line scrolling +map ctrl+shift+j scroll_line_down +map ctrl+shift+k scroll_line_up + +# Page scrolling (half-page / full-page) +map ctrl+shift+u scroll_page_up +map ctrl+shift+d scroll_page_down diff --git a/modules/terminal/zsh/default.nix b/modules/terminal/zsh/default.nix index 0f0471c..8b7897c 100644 --- a/modules/terminal/zsh/default.nix +++ b/modules/terminal/zsh/default.nix @@ -25,22 +25,9 @@ dotDir = "${config.xdg.configHome}/zsh"; history.path = "${config.xdg.cacheHome}/zsh/history"; enableCompletion = true; - initContent = '' - setopt PROMPT_SUBST - - # Vi insert/command modes for command-line editing. Escape enters normal mode. - bindkey -v - KEYTIMEOUT=1 - - autoload -U colors && colors - - export GPG_TTY="$(tty)" - gpg-connect-agent updatestartuptty /bye >/dev/null 2>&1 - - bindkey "^[[3~" delete-char - bindkey "^?" backward-delete-char - ${nixCommandWrappers} - ''; + initContent = builtins.replaceStrings [ "@@NIX_COMMAND_WRAPPERS@@" ] [ nixCommandWrappers ] ( + builtins.readFile ./init.sh + ); }; home.sessionVariables.SHELL = "${lib.getExe config.terminal.zsh.package}"; diff --git a/modules/terminal/zsh/init.sh b/modules/terminal/zsh/init.sh new file mode 100644 index 0000000..b44895c --- /dev/null +++ b/modules/terminal/zsh/init.sh @@ -0,0 +1,14 @@ +setopt PROMPT_SUBST + +# Vi insert/command modes for command-line editing. Escape enters normal mode. +bindkey -v +KEYTIMEOUT=1 + +autoload -U colors && colors + +export GPG_TTY="$(tty)" +gpg-connect-agent updatestartuptty /bye >/dev/null 2>&1 + +bindkey "^[[3~" delete-char +bindkey "^?" backward-delete-char +@@NIX_COMMAND_WRAPPERS@@ diff --git a/modules/web/chawan/default.nix b/modules/web/chawan/default.nix index 2169d0c..2de49bd 100644 --- a/modules/web/chawan/default.nix +++ b/modules/web/chawan/default.nix @@ -43,20 +43,7 @@ settings = { buffer = { images = true; - user-style = '' - html, body, div, section, article, main, header, footer, nav, aside, table, tr, td, th, ul, ol, li, span, p, pre, code { - background-color: black !important; - color: white !important; - } - a, a:link { color: #6bb6ff !important; } - a:visited { color: #d19aff !important; } - @media (prefers-color-scheme: light) { - html, body, div, section, article, main, header, footer, nav, aside, table, tr, td, th, ul, ol, li, span, p, pre, code { - background-color: black !important; - color: white !important; - } - } - ''; + user-style = builtins.readFile ./user-style.css; }; display = { image-mode = "auto"; diff --git a/modules/web/chawan/user-style.css b/modules/web/chawan/user-style.css new file mode 100644 index 0000000..81d368b --- /dev/null +++ b/modules/web/chawan/user-style.css @@ -0,0 +1,56 @@ +html, +body, +div, +section, +article, +main, +header, +footer, +nav, +aside, +table, +tr, +td, +th, +ul, +ol, +li, +span, +p, +pre, +code { + background-color: black !important; + color: white !important; +} +a, a:link { + color: #6bb6ff !important; +} +a:visited { + color: #d19aff !important; +} +@media (prefers-color-scheme: light) { + html, + body, + div, + section, + article, + main, + header, + footer, + nav, + aside, + table, + tr, + td, + th, + ul, + ol, + li, + span, + p, + pre, + code { + background-color: black !important; + color: white !important; + } +} |
