From 0ed3633404815591fdb8844952d609e483f52544 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sat, 29 Jul 2023 23:56:41 -0400 Subject: [PATCH] add more comments and utilities --- modules/common/applications/kitty.nix | 5 +++- modules/common/applications/media.nix | 6 ++--- modules/common/mail/default.nix | 27 ++++++++++++++++++++- modules/common/neovim/config/align.nix | 3 +++ modules/common/neovim/config/bufferline.nix | 3 +++ modules/common/neovim/config/colors.nix | 2 ++ modules/common/neovim/config/completion.nix | 16 +++++++----- modules/common/shell/utilities.nix | 3 +++ 8 files changed, 54 insertions(+), 11 deletions(-) diff --git a/modules/common/applications/kitty.nix b/modules/common/applications/kitty.nix index fe2ccef..da993c7 100644 --- a/modules/common/applications/kitty.nix +++ b/modules/common/applications/kitty.nix @@ -40,7 +40,10 @@ extraConfig = ""; font.size = 14; keybindings = { + # Use shift+enter to complete text suggestions in fish "shift+enter" = "send_text all \\x1F"; + + # Easy fullscreen toggle (for macOS) "super+f" = "toggle_fullscreen"; }; settings = { @@ -98,7 +101,7 @@ tab_bar_edge = "top"; tab_bar_style = "slant"; - # Audio + # Disable audio enable_audio_bell = false; }; }; diff --git a/modules/common/applications/media.nix b/modules/common/applications/media.nix index 279042b..edd2bc2 100644 --- a/modules/common/applications/media.nix +++ b/modules/common/applications/media.nix @@ -22,8 +22,8 @@ enable = true; bindings = { }; config = { - image-display-duration = 2; - hwdec = "auto-safe"; + image-display-duration = 2; # For cycling through images + hwdec = "auto-safe"; # Attempt to use GPU decoding for video }; scripts = [ @@ -49,7 +49,7 @@ ]; }; - # Set default for opening PDFs + # Set default programs for opening PDFs and other media xdg.mimeApps = { associations.added = { "application/pdf" = [ "pwmt.zathura-cb.desktop" ]; diff --git a/modules/common/mail/default.nix b/modules/common/mail/default.nix index 82c1b15..a98f4b3 100644 --- a/modules/common/mail/default.nix +++ b/modules/common/mail/default.nix @@ -27,19 +27,31 @@ home-manager.users.${config.user} = { programs.mbsync = { enable = true; }; + + # Automatically check for mail and keep files synced locally services.mbsync = lib.mkIf pkgs.stdenv.isLinux { enable = true; frequency = "*:0/5"; postExec = "${pkgs.notmuch}/bin/notmuch new"; }; + + # Used to watch for new mail and trigger sync services.imapnotify.enable = pkgs.stdenv.isLinux; + + # Allows sending email from CLI/sendmail programs.msmtp.enable = true; + + # Better local mail search programs.notmuch = { enable = true; new.ignore = [ ".mbsyncstate.lock" ".mbsyncstate.journal" ]; }; + accounts.email = { + + # Where email files are stored maildirBasePath = "${config.homePath}/mail"; + accounts = { home = let address = "${config.mail.user}@${config.mail.server}"; in { @@ -52,13 +64,17 @@ "hey" "admin" ]; + + # Options for contact completion alot = { }; - flavor = "plain"; + imap = { host = config.mail.imapHost; port = 993; tls.enable = true; }; + + # Watch for mail and run notifications or sync imapnotify = { enable = true; boxes = [ "Inbox" ]; @@ -67,7 +83,11 @@ config.home-manager.users.${config.user}.services.dunst.enable "${pkgs.libnotify}/bin/notify-send 'New mail arrived'"; }; + + # Name of the directory in maildir for this account maildir = { path = "main"; }; + + # Bi-directional syncing options for local files mbsync = { enable = true; create = "both"; @@ -78,12 +98,17 @@ CopyArrivalDate = "yes"; # Sync time of original message }; }; + + # Enable indexing notmuch.enable = true; + + # Used to login and send and receive emails passwordCommand = "${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${ pkgs.writeText "mailpass.age" (builtins.readFile ../../../private/mailpass.age) }"; + smtp = { host = config.mail.smtpHost; port = 465; diff --git a/modules/common/neovim/config/align.nix b/modules/common/neovim/config/align.nix index 37abafe..382f75e 100644 --- a/modules/common/neovim/config/align.nix +++ b/modules/common/neovim/config/align.nix @@ -1,4 +1,7 @@ { pkgs, ... }: { + + # Plugin for aligning text programmatically + plugins = [ pkgs.vimPlugins.tabular ]; lua = '' -- Align diff --git a/modules/common/neovim/config/bufferline.nix b/modules/common/neovim/config/bufferline.nix index 73a6514..c52f21f 100644 --- a/modules/common/neovim/config/bufferline.nix +++ b/modules/common/neovim/config/bufferline.nix @@ -1,4 +1,7 @@ { pkgs, ... }: { + + # Shows buffers in a VSCode-style tab layout + plugins = [ pkgs.vimPlugins.bufferline-nvim pkgs.vimPlugins.vim-bbye # Better closing of buffers diff --git a/modules/common/neovim/config/colors.nix b/modules/common/neovim/config/colors.nix index 7b72e20..06c29e5 100644 --- a/modules/common/neovim/config/colors.nix +++ b/modules/common/neovim/config/colors.nix @@ -1,5 +1,7 @@ { pkgs, lib, config, ... }: { + # Sets Neovim colors based on Nix colorscheme + options.colors = lib.mkOption { type = lib.types.attrsOf lib.types.str; description = "Attrset of base16 colorscheme key value pairs."; diff --git a/modules/common/neovim/config/completion.nix b/modules/common/neovim/config/completion.nix index 37fc25f..a982437 100644 --- a/modules/common/neovim/config/completion.nix +++ b/modules/common/neovim/config/completion.nix @@ -24,12 +24,14 @@ end ''; + # Enable Luasnip snippet completion snippet.expand = dsl.rawLua '' function(args) require("luasnip").lsp_expand(args.body) end ''; + # Basic completion keybinds mapping = { "['']" = dsl.rawLua "require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert })"; @@ -64,24 +66,26 @@ ''; }; + # These are where the completion engine gets its suggestions sources = [ - { name = "nvim_lua"; } - { name = "nvim_lsp"; } - { name = "luasnip"; } - { name = "path"; } + { name = "nvim_lua"; } # Fills in common Neovim lua functions + { name = "nvim_lsp"; } # LSP results + { name = "luasnip"; } # Snippets + { name = "path"; } # Shell completion from current PATH { - name = "buffer"; + name = "buffer"; # Grep for text from the current text buffer keyword_length = 3; max_item_count = 10; } { - name = "rg"; + name = "rg"; # Grep for text from the current directory keyword_length = 6; max_item_count = 10; option = { additional_arguments = "--ignore-case"; }; } ]; + # Styling of the completion menu formatting = { fields = [ "kind" "abbr" "menu" ]; format = dsl.rawLua '' diff --git a/modules/common/shell/utilities.nix b/modules/common/shell/utilities.nix index ea5e015..d11f06d 100644 --- a/modules/common/shell/utilities.nix +++ b/modules/common/shell/utilities.nix @@ -35,6 +35,9 @@ in { tree # View directory hierarchy vimv-rs # Batch rename files unzip # Extract zips + dua # File sizes (du) + du-dust # Disk usage tree (ncdu) + duf # Basic disk information (df) ]; programs.zoxide.enable = true; # Shortcut jump command