From 198c3b13ebd55dc921c350384685974ba05e9971 Mon Sep 17 00:00:00 2001 From: Addison Beck Date: Wed, 13 Nov 2024 18:01:15 -0500 Subject: [PATCH] Markdown and style tweaks --- config/colorscheme.nix | 2 +- system/with/user/with/program/kitty.nix | 18 +++-- .../program/neovim/auto-commands/default.nix | 12 ++++ .../with/program/neovim/colors/default.nix | 58 +++++++++++++--- .../program/neovim/commands/search_marks.lua | 66 +++++++++++++++++++ system/with/user/with/program/stylix.nix | 2 +- 6 files changed, 142 insertions(+), 16 deletions(-) create mode 100644 system/with/user/with/program/neovim/commands/search_marks.lua diff --git a/config/colorscheme.nix b/config/colorscheme.nix index 3355086..2f1c86c 100644 --- a/config/colorscheme.nix +++ b/config/colorscheme.nix @@ -1 +1 @@ -"nord" +"gruvbox" diff --git a/system/with/user/with/program/kitty.nix b/system/with/user/with/program/kitty.nix index 12d5f07..45ad63c 100644 --- a/system/with/user/with/program/kitty.nix +++ b/system/with/user/with/program/kitty.nix @@ -14,9 +14,19 @@ modify_font strikethrough_thickness 250% modify_font underline_position 150% modify_font underline_thickness 1px - modify_font cell_height 100% - bold_font MonaspiceAr Nerd Font Mono Bold - italic_font MonaspiceRn Nerd Font Mono Italic - bold_italic_font MonaspiceRn Nerd Font Mono Bold Italic + modify_font baseline 3 + modify_font cell_height 85% + modify_font cell_width 95% + + # The regular font is sans serif and is handled by stylix + + # Handwritten + italic_font MonaspiceRn Nerd Font Mono Regular + + # Mechanical + bold_font MonaspiceKr Nerd Font Mono Regular + + # Serif + bold_italic_font MonaspiceXe Nerd Font Mono Regular ''; } diff --git a/system/with/user/with/program/neovim/auto-commands/default.nix b/system/with/user/with/program/neovim/auto-commands/default.nix index 1136889..33f4f50 100644 --- a/system/with/user/with/program/neovim/auto-commands/default.nix +++ b/system/with/user/with/program/neovim/auto-commands/default.nix @@ -1,5 +1,17 @@ {...}: { autoCommands = [ + # disable semantic highlighting + { + event = ["LspAttach"]; + callback = { + __raw = '' + function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + client.server_capabilities.semanticTokensProvider = nil + end + ''; + }; + } { event = [ "FileType" diff --git a/system/with/user/with/program/neovim/colors/default.nix b/system/with/user/with/program/neovim/colors/default.nix index 9a337cf..267896f 100644 --- a/system/with/user/with/program/neovim/colors/default.nix +++ b/system/with/user/with/program/neovim/colors/default.nix @@ -2,7 +2,28 @@ systemTheme, colorscheme, ... -}: { +}: let + markdownInlineCode = { + dark = { + bg = "#282828"; + fg = "#d3869b"; # orange + }; + light = { + bg = "#d5c4a1"; + fg = "#af3a03"; # orange + }; + }; + markdownQuotes = { + dark = { + bg = "#3c3836"; + fg = "#fe8019"; # purple + }; + light = { + bg = "#ebdbb2"; + fg = "#8f3f71"; # purple + }; + }; +in { options = { background = "${systemTheme}"; termguicolors = false; @@ -23,20 +44,16 @@ Nontext = { link = "Normal"; }; - "@markup.heading" = { - underdotted = true; - bold = true; - italic = false; - }; - "@markup.quote.markdown" = { - italic = true; - }; "@function" = { italic = false; }; "@function.builtin" = { italic = false; }; + "@markup.list.checked.markdown" = { + italic = true; + fg = "green"; + }; }; colorscheme = { gruvbox = { @@ -45,7 +62,8 @@ transparent_mode = true; overrides = { Comment = { - bold = true; + bold = false; + italic = true; }; Winbar = { bold = true; @@ -57,6 +75,26 @@ fg = 8; bg = "NONE"; }; + "@markup.raw.markdown_inline" = { + bg = markdownInlineCode.${systemTheme}.bg; + fg = markdownInlineCode.${systemTheme}.fg; + italic = false; + bold = true; + }; + "@markup.link.label.markdown_inline" = { + link = "GruvboxBlue"; + }; + "@markup.quote.markdown" = { + italic = true; + bold = false; + bg = markdownQuotes.${systemTheme}.bg; + fg = markdownQuotes.${systemTheme}.fg; + }; + "@markup.heading" = { + underdotted = true; + bold = true; + italic = true; + }; }; }; }; diff --git a/system/with/user/with/program/neovim/commands/search_marks.lua b/system/with/user/with/program/neovim/commands/search_marks.lua new file mode 100644 index 0000000..f86b11c --- /dev/null +++ b/system/with/user/with/program/neovim/commands/search_marks.lua @@ -0,0 +1,66 @@ +function(opts) + local bufnr = vim.api.nvim_buf_get_name(0) + local local_marks = { + items = vim.fn.getmarklist(bufnr), + name_func = function(_, line) + return vim.api.nvim_buf_get_lines(bufnr, line - 1, line, false)[1] + end, + } + local global_marks = { + items = vim.fn.getmarklist(), + name_func = function(mark, _) + -- get buffer name if it is opened, otherwise get file name + return vim.api.nvim_get_mark(mark, {})[4] + end, + } + local marks_table = {} + local marks_others = {} + local bufname = vim.api.nvim_buf_get_name(opts.bufnr) + local all_marks = {} + opts.mark_type = vim.F.if_nil(opts.mark_type, "all") + if opts.mark_type == "all" then + all_marks = { local_marks, global_marks } + elseif opts.mark_type == "local" then + all_marks = { local_marks } + elseif opts.mark_type == "global" then + all_marks = { global_marks } + end + + for _, cnf in ipairs(all_marks) do + for _, v in ipairs(cnf.items) do + -- strip the first single quote character + local mark = string.sub(v.mark, 2, 3) + local _, lnum, col, _ = unpack(v.pos) + local name = cnf.name_func(mark, lnum) + -- same format to :marks command + local line = string.format("%s %6d %4d %s", mark, lnum, col - 1, name) + local row = { + line = line, + lnum = lnum, + col = col, + filename = utils.path_expand(v.file or bufname), + } + -- non alphanumeric marks goes to last + if mark:match "%w" then + table.insert(marks_table, row) + else + table.insert(marks_others, row) + end + end + end + marks_table = vim.fn.extend(marks_table, marks_others) + + pickers + .new(opts, { + prompt_title = "Marks", + finder = finders.new_table { + results = marks_table, + entry_maker = opts.entry_maker or make_entry.gen_from_marks(opts), + }, + previewer = conf.grep_previewer(opts), + sorter = conf.generic_sorter(opts), + push_cursor_on_edit = true, + push_tagstack_on_edit = true, + }) + :find() +end diff --git a/system/with/user/with/program/stylix.nix b/system/with/user/with/program/stylix.nix index a2553d4..d468740 100644 --- a/system/with/user/with/program/stylix.nix +++ b/system/with/user/with/program/stylix.nix @@ -42,7 +42,7 @@ name = "Noto Color Emoji"; }; }; - stylix.fonts.sizes.terminal = 24; + stylix.fonts.sizes.terminal = 22; stylix.opacity.terminal = 0.7; # This started overwriting the sign column color and I couldn't figure out