From 67be496482464ea1210f1fe8cb9d608005aa7c9d Mon Sep 17 00:00:00 2001 From: Michael Thomson Date: Wed, 13 Nov 2024 14:11:33 -0500 Subject: [PATCH] neovim before nixvim Signed-off-by: Michael Thomson --- hosts/macbook/configuration.nix | 2 +- hosts/macbook/home.nix | 2 +- modules/home-manager/kitty/default.nix | 15 +++----- modules/home-manager/neovim/default.nix | 2 +- .../nvim/lua/plugins/render-markdown.lua | 21 ++++++---- .../neovim/nvim/lua/plugins/treesitter.lua | 30 ++++++--------- .../neovim/nvim/lua/plugins/zenmode.lua | 8 ++++ .../neovim/nvim/lua/plugins/zk.lua | 23 ----------- modules/home-manager/tmux/default.nix | 7 ++++ modules/home-manager/wezterm/default.nix | 2 +- modules/home-manager/zk/default.nix | 30 --------------- modules/home-manager/zsh/default.nix | 38 ++++++++++++------- 12 files changed, 74 insertions(+), 106 deletions(-) create mode 100644 modules/home-manager/neovim/nvim/lua/plugins/zenmode.lua delete mode 100644 modules/home-manager/neovim/nvim/lua/plugins/zk.lua delete mode 100644 modules/home-manager/zk/default.nix diff --git a/hosts/macbook/configuration.nix b/hosts/macbook/configuration.nix index c11befc..a7137b9 100644 --- a/hosts/macbook/configuration.nix +++ b/hosts/macbook/configuration.nix @@ -45,7 +45,7 @@ skhd = { enable = true; skhdConfig = '' - cmd - return : wezterm + cmd - return : kitty ''; }; }; diff --git a/hosts/macbook/home.nix b/hosts/macbook/home.nix index 89c02f6..eba214e 100644 --- a/hosts/macbook/home.nix +++ b/hosts/macbook/home.nix @@ -6,12 +6,12 @@ ../../modules/home-manager/neovim ../../modules/home-manager/emacs ../../modules/home-manager/wezterm + ../../modules/home-manager/kitty ../../modules/home-manager/zsh ../../modules/home-manager/tmux ../../modules/home-manager/zoxide ../../modules/home-manager/irssi ../../modules/home-manager/email - ../../modules/home-manager/zk ../../modules/home-manager/password-store ../../modules/home-manager/taskwarrior ]; diff --git a/modules/home-manager/kitty/default.nix b/modules/home-manager/kitty/default.nix index 236d0cb..045e968 100644 --- a/modules/home-manager/kitty/default.nix +++ b/modules/home-manager/kitty/default.nix @@ -1,27 +1,22 @@ { pkgs, config, ... }: { - home.packages = with pkgs; [ - (nerdfonts.override { fonts = [ "Iosevka" "NerdFontsSymbolsOnly" ]; }) - ]; - programs.kitty = { enable = true; font = { - name = "Iosevka Nerd Font Mono"; + name = "JetBrainsMono Nerd Font"; size = 12; }; shellIntegration = { enableZshIntegration = true; }; - theme = "Catppuccin-Frappe"; - darwinLaunchOptions = [ - "--single-instance" - ]; + themeFile = "kanagawa"; + # darwinLaunchOptions = [ + # "--single-instance" + # ]; settings = { background_opacity = "0.9"; background_blur = 5; - macos_traditional_fullscreen = "yes"; }; }; } diff --git a/modules/home-manager/neovim/default.nix b/modules/home-manager/neovim/default.nix index c6d0336..6c5dcac 100644 --- a/modules/home-manager/neovim/default.nix +++ b/modules/home-manager/neovim/default.nix @@ -8,7 +8,7 @@ luajit lua-language-server nil - (nerdfonts.override { fonts = [ "Iosevka" ]; }) + (nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) ]; programs.neovim = { diff --git a/modules/home-manager/neovim/nvim/lua/plugins/render-markdown.lua b/modules/home-manager/neovim/nvim/lua/plugins/render-markdown.lua index 51761b4..02a17ca 100644 --- a/modules/home-manager/neovim/nvim/lua/plugins/render-markdown.lua +++ b/modules/home-manager/neovim/nvim/lua/plugins/render-markdown.lua @@ -1,9 +1,16 @@ return { - 'MeanderingProgrammer/render-markdown.nvim', - dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, -- if you use the mini.nvim suite - -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins - -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons - ---@module 'render-markdown' - ---@type render.md.UserConfig - opts = {}, + 'MeanderingProgrammer/render-markdown.nvim', + dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, -- if you use the mini.nvim suite + -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins + -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons + ---@module 'render-markdown' + ---@type render.md.UserConfig + opts = { + -- heading = { + -- position = 'inline', + -- }, + sign = { + enabled = false, + }, + }, } diff --git a/modules/home-manager/neovim/nvim/lua/plugins/treesitter.lua b/modules/home-manager/neovim/nvim/lua/plugins/treesitter.lua index 5d8e43a..50d0a18 100644 --- a/modules/home-manager/neovim/nvim/lua/plugins/treesitter.lua +++ b/modules/home-manager/neovim/nvim/lua/plugins/treesitter.lua @@ -3,31 +3,12 @@ return { 'nvim-treesitter/nvim-treesitter', config = function() require('nvim-treesitter.configs').setup({ - -- Install parsers synchronously (only applied to `ensure_installed`) sync_install = false, - - -- Automatically install missing parsers when entering buffer auto_install = true, - - -- indent module indent = { enable = true }, - - -- highlight module highlight = { enable = true }, - - -- auto close tags in html/jsx/tsx autotag = { enable = true }, - incremental_selection = { - enable = false, - keymaps = { - init_selection = '', - scope_incremental = '', - node_incremental = '', - node_decremental = '', - }, - }, - -- text object selection textobjects = { select = { @@ -70,6 +51,17 @@ return { }, }, }) + vim.wo.foldmethod = 'expr' + vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()' + + function _G.MyFoldText() + local line = vim.fn.getline(vim.v.foldstart) + return line .. " 󱞣" + end + + vim.opt.foldtext = 'v:lua.MyFoldText()' + vim.opt.fillchars:append(',fold: ') + vim.opt.foldlevel = 99; end }, { diff --git a/modules/home-manager/neovim/nvim/lua/plugins/zenmode.lua b/modules/home-manager/neovim/nvim/lua/plugins/zenmode.lua new file mode 100644 index 0000000..3491eff --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/zenmode.lua @@ -0,0 +1,8 @@ +return { + "folke/zen-mode.nvim", + opts = { + window = { + width = 80, + }, + }, +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/zk.lua b/modules/home-manager/neovim/nvim/lua/plugins/zk.lua deleted file mode 100644 index bd10bee..0000000 --- a/modules/home-manager/neovim/nvim/lua/plugins/zk.lua +++ /dev/null @@ -1,23 +0,0 @@ -return { - "zk-org/zk-nvim", - config = function() - require("zk").setup({ - picker = "minipick", - }) - local opts = { noremap=true, silent=false } - - -- Create a new note after asking for its title. - vim.api.nvim_set_keymap("n", "zn", "ZkNew { title = vim.fn.input('Title: ') }", opts) - vim.api.nvim_set_keymap("n", "zd", "ZkNew { dir = \"journal/daily\" }", opts) - - -- Open notes. - vim.api.nvim_set_keymap("n", "zo", "ZkNotes { sort = { 'modified' } }", opts) - -- Open notes associated with the selected tags. - vim.api.nvim_set_keymap("n", "zt", "ZkTags", opts) - - -- Search for the notes matching a given query. - vim.api.nvim_set_keymap("n", "zf", "ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search: ') } }", opts) - -- Search for the notes matching the current visual selection. - vim.api.nvim_set_keymap("v", "zf", ":'<,'>ZkMatch", opts) - end -} diff --git a/modules/home-manager/tmux/default.nix b/modules/home-manager/tmux/default.nix index 3ac4f15..799cf2a 100644 --- a/modules/home-manager/tmux/default.nix +++ b/modules/home-manager/tmux/default.nix @@ -1,8 +1,12 @@ { pkgs, config, ... }: +# TODO: Remove the default shell and default-command once tmux sensibleOnTop fixes their shit +# ref: https://github.com/nix-community/home-manager/issues/5952 + { programs = { tmux = { + shell = "${pkgs.zsh}/bin/zsh"; enable = true; shortcut = "Space"; mouse = true; @@ -31,6 +35,9 @@ set -g window-status-current-style "fg=$border_active_fg" set -g window-status-style "fg=$fg" + + set -gu default-command + set -g default-shell "$SHELL" ''; }; }; diff --git a/modules/home-manager/wezterm/default.nix b/modules/home-manager/wezterm/default.nix index 3e59853..03cb275 100644 --- a/modules/home-manager/wezterm/default.nix +++ b/modules/home-manager/wezterm/default.nix @@ -6,7 +6,7 @@ extraConfig = '' return { -- color_scheme = 'Ayu Dark (Gogh)', - font = wezterm.font('Iosevka Nerd Font'), + font = wezterm.font('JetBrainsMono Nerd Font'), font_size = 16, use_fancy_tab_bar = false, native_macos_fullscreen_mode = false, diff --git a/modules/home-manager/zk/default.nix b/modules/home-manager/zk/default.nix deleted file mode 100644 index f20e097..0000000 --- a/modules/home-manager/zk/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ pkgs, config, ... }: - -{ - programs = { - zk = { - enable = true; - settings = { - notebook = { - dir = "~/notes"; - }; - extra = { - author = "Michael Thomson"; - }; - alias = { - daily = "zk new --no-input \"$ZK_NOTEBOOK_DIR/journal/daily\""; - }; - group = { - daily = { - paths = ["journal/daily"]; - note = { - filename = "{{format-date now '%Y-%m-%d'}}"; - extension = "md"; - template = "daily.md"; - }; - }; - }; - }; - }; - }; -} diff --git a/modules/home-manager/zsh/default.nix b/modules/home-manager/zsh/default.nix index 4c2d63d..fc16c68 100644 --- a/modules/home-manager/zsh/default.nix +++ b/modules/home-manager/zsh/default.nix @@ -2,31 +2,43 @@ { - home.sessionVariables = { - ZK_NOTEBOOK_DIR = "\${HOME}/notes"; - }; - programs = { + fzf = { + enable = true; + enableZshIntegration = true; + tmux = { + enableShellIntegration = true; + }; + }; zsh = { enable = true; oh-my-zsh = { enable = false; }; - antidote = { + autosuggestion = { enable = true; - plugins = [ - "zsh-users/zsh-syntax-highlighting" - "zsh-users/zsh-autosuggestions" - "zsh-users/zsh-history-substring-search" - ]; + }; + syntaxHighlighting = { + enable = true; + }; + enableCompletion = true; + history = { + append = true; + share = true; + ignoreSpace = true; + ignoreAllDups = true; + ignoreDups = true; + }; + historySubstringSearch = { + enable = true; + searchUpKey = "^p"; + searchDownKey = "^n"; }; shellAliases = { cd = "z"; cdi = "zi"; + ls = "ls --color"; }; - initExtra = '' - . "/etc/profiles/per-user/$USER/etc/profile.d/hm-session-vars.sh" - ''; }; starship = { enable = true;