markdown writting

This commit is contained in:
Hadi
2025-02-04 20:40:54 +01:00
parent 0e5fbb9ea5
commit 6f1bcbf4dc
3 changed files with 230 additions and 165 deletions

View File

@@ -1,13 +1,108 @@
{ config, ... }: { config, ... }:
let let
accent = "#${config.lib.stylix.colors.base0D}"; accent = "#${config.lib.stylix.colors.base0D}";
accent-alt = "#${config.lib.stylix.colors.base08}";
muted = "#${config.lib.stylix.colors.base03}"; muted = "#${config.lib.stylix.colors.base03}";
background = "#${config.lib.stylix.colors.base00}";
in { in {
programs.nixvim = { programs.nixvim = {
plugins.mkdnflow = { # Markdown settings
extraFiles."after/ftplugin/markdown.lua".text = ''
vim.bo.tabstop = 2
vim.bo.shiftwidth = 2
vim.bo.expandtab = true
'';
# Highlight colors
highlight = {
Headline1 = {
bg = "#4B4266";
fg = accent;
};
Headline2 = {
bg = "#3B575E";
fg = "#9FFEFE";
};
Headline3 = {
bg = "#3B5742";
fg = "#9FFE9F";
};
Headline4 = {
bg = "#574842";
fg = "#FECB9F";
};
RenderMarkdownTodo.fg = "#f78c6c";
RenderMarkdownWarning.fg = "#ff5370";
RenderMarkdownDone.fg = muted;
};
# Plugins
plugins = {
# Paste images from clipboard
clipboard-image = {
enable = true;
settings = { default.img_dir = [ "%:p:h" "img" ]; };
};
# Zen mode
zen-mode = {
enable = true;
settings = {
on_close = ''
function()
end
'';
on_open = ''
function()
end
'';
plugins = {
gitsigns = { enabled = false; };
options = {
enabled = true;
ruler = false;
showcmd = false;
laststatus = "0";
kitty = {
enabled = true;
font = "+4";
};
};
};
window = {
backdrop = 0.95;
height = 1;
options = {
signcolumn = "no";
number = false;
relativenumber = false;
};
width = 0.8;
};
};
};
# Display images in markdown
image = {
enable = true;
integrations.markdown = {
clearInInsertMode = true;
onlyRenderImageAtCursor = true;
};
};
# This one takes care of the markdown titles
headlines = {
enable = true;
settings = {
markdown = {
headline_highlights =
[ "Headline1" "Headline2" "Headline3" "Headline4" ];
};
};
};
# MkdnFlow is a plugin that helps you navigate markdown files
mkdnflow = {
enable = true; enable = true;
modules = { conceal = false; }; modules = { conceal = false; };
toDo.symbols = [ " " "-" "x" "!" "/" ]; toDo.symbols = [ " " "-" "x" "!" "/" ];
@@ -114,41 +209,12 @@ in {
}; };
}; };
}; };
extraFiles = {
"after/ftplugin/markdown.lua".text = '' # Render UI elements
vim.bo.tabstop = 2 render-markdown = {
vim.bo.shiftwidth = 2
vim.bo.expandtab = true
'';
};
highlight = {
RenderMarkdownBg.bg = background;
RenderMarkdownH1.fg = accent;
RenderMarkdownH2.fg = accent;
RenderMarkdownH3.fg = accent-alt;
RenderMarkdownH4.fg = accent-alt;
RenderMarkdownH5.fg = accent-alt;
RenderMarkdownH6.fg = accent-alt;
RenderMarkdownTodo.fg = "#f78c6c";
RenderMarkdownWarning.fg = "#ff5370";
RenderMarkdownDone.fg = muted;
};
plugins.render-markdown = {
enable = true; enable = true;
settings = { settings = {
heading = { heading = { enabled = false; };
icons = [ "# " "󰲣 " "󰲥 " "󰲧 " "󰲩 " "󰲫 " ];
sign = false;
backgrounds = [ "RenderMarkdownBg" ];
foregrounds = [
"RenderMarkdownH1"
"RenderMarkdownH2"
"RenderMarkdownH3"
"RenderMarkdownH4"
"RenderMarkdownH5"
"RenderMarkdownH6"
];
};
checkbox = { checkbox = {
unchecked = { highlight = "RenderMarkdownTodo"; }; unchecked = { highlight = "RenderMarkdownTodo"; };
checked = { highlight = "RenderMarkdownDone"; }; checked = { highlight = "RenderMarkdownDone"; };
@@ -173,4 +239,5 @@ in {
}; };
}; };
}; };
};
} }

View File

@@ -7,6 +7,11 @@
settings = { settings = {
default_file_explorer = false; default_file_explorer = false;
skip_confirm_for_simple_edits = true; skip_confirm_for_simple_edits = true;
view_options.is_hidden_file = ''
function(name, bufnr)
return vim.startswith(name, ".") or name == "img"
end
'';
win_options = { win_options = {
concealcursor = "ncv"; concealcursor = "ncv";
conceallevel = 3; conceallevel = 3;

View File

@@ -3,17 +3,10 @@
highlightOverride = { highlightOverride = {
FloatBorder.fg = "#${config.lib.stylix.colors.base0D}"; FloatBorder.fg = "#${config.lib.stylix.colors.base0D}";
}; };
nixpkgs.config = { allowUnfree = true; };
plugins = { plugins = {
# FIXME: broken on unstable copilot-vim.enable = true;
# copilot-vim.enable = true;
flash.enable = true; flash.enable = true;
image = {
enable = true;
integrations.markdown = {
clearInInsertMode = true;
onlyRenderImageAtCursor = true;
};
};
tmux-navigator.enable = true; tmux-navigator.enable = true;
comment.enable = true; comment.enable = true;
nvim-autopairs.enable = true; nvim-autopairs.enable = true;