From 42d75df1f130a3c5a42c957ed83ddb771c31c49c Mon Sep 17 00:00:00 2001 From: Pratik Tripathy Date: Sun, 17 Mar 2024 17:31:37 +0530 Subject: [PATCH] NeoVIM - Formatting for: added yaml, configured markdown with new configuration file, prettierd configuration updates for bracketsSameLine - Linting: added dockerfile, markdown --- common/.config/marksman/config.toml | 36 +++++++++++++++++++ .../nvim/lua/plugins/code-formatting.lua | 17 +++++++-- common/.config/nvim/lua/plugins/code-lint.lua | 8 +++++ common/.config/templates/.prettierrc | 3 +- common/.config/templates/markdownlint.json | 26 ++++++++++++++ 5 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 common/.config/marksman/config.toml create mode 100644 common/.config/templates/markdownlint.json diff --git a/common/.config/marksman/config.toml b/common/.config/marksman/config.toml new file mode 100644 index 0000000..ab8188d --- /dev/null +++ b/common/.config/marksman/config.toml @@ -0,0 +1,36 @@ +[core] + +markdown.file_extensions = ["md", "markdown"] +# Configures text sync protocol between the editor (LSP client) +# and Marksman (LSP server). +# Can be either 'full' or `incremental`: +# * full: the whole copy of a document is sent by the editor +# on every update, +# * incremental: only the changed parts are sent by +# the editor. This will result in less trafic between +# the editor and Marksman, but the overall performance +# impact is marginal. +# Defaults to `full` because the editors have bugs in incremental +# sync which result in slightly correpted state and are really hard +# to diagnose. +text_sync = "incremental" +# Use incremental resolution of project-wide references. +# This is much more efficient but is currently experimental +incremental_references = true +# For debugging only! Enables extra validation checks around +# incremental state updates. SIGNIFICANTLY IMPACTS PERFORMANCE +paranoid = false + +[code_action] +# Enable/disable "Table of Contents" code action +toc.enable = true + +# Enable/disable "Create missing linked file" code action +create_missing_file.enable = false + +[completion] +# The style of wiki links completion. +# Other values include: +# * "file-stem" to complete using file name without an extension, +# * "file-path-stem" same as above but using file path. +wiki.style = "title-slug" diff --git a/common/.config/nvim/lua/plugins/code-formatting.lua b/common/.config/nvim/lua/plugins/code-formatting.lua index b2e6c95..30803f3 100644 --- a/common/.config/nvim/lua/plugins/code-formatting.lua +++ b/common/.config/nvim/lua/plugins/code-formatting.lua @@ -16,9 +16,9 @@ return { css = { { "prettierd", "prettier" } }, html = { { "prettierd", "prettier" } }, json = { { "prettierd", "prettier" } }, - yaml = { { "prettierd", "prettier" } }, - markdown = { { "prettierd", "prettier" } }, graphql = { { "prettierd", "prettier" } }, + yaml = { { "yamlfmt", "prettierd" } }, + markdown = { { "markdownlint" } }, lua = { "stylua" }, python = { "black" }, sh = { { "shfmt", "shellharden" } }, @@ -37,6 +37,19 @@ return { shfmt = { prepend_args = { "-i", "4" }, }, + markdownlint = { + prepend_args = { + "--config", + "~/.config/templates/markdownlint.json", + }, + }, + yamlfmt = { + prepend_args = { + "-formatter", + "include_document_start=true,retain_line_breaks_single=true", + "-gitignore_excludes", + }, + }, }, }) diff --git a/common/.config/nvim/lua/plugins/code-lint.lua b/common/.config/nvim/lua/plugins/code-lint.lua index 8faeba0..976aef8 100644 --- a/common/.config/nvim/lua/plugins/code-lint.lua +++ b/common/.config/nvim/lua/plugins/code-lint.lua @@ -19,9 +19,17 @@ return { javascript = { "codespell" }, typescriptreact = { "codespell" }, javascriptreact = { "codespell" }, + dockerfile = { "hadolint" }, html = { "codespell" }, } + local markdownlint = lint.linters.markdownlint + markdownlint.args = { + "--config", + "~/.config/templates/markdownlint.json", + "--", + } + local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, { diff --git a/common/.config/templates/.prettierrc b/common/.config/templates/.prettierrc index 5dec022..726f5a1 100644 --- a/common/.config/templates/.prettierrc +++ b/common/.config/templates/.prettierrc @@ -3,5 +3,6 @@ "useTabs": false, "semi": true, "singleQuote": false, - "trailingComma": "all" + "trailingComma": "all", + "bracketSameLine": true } diff --git a/common/.config/templates/markdownlint.json b/common/.config/templates/markdownlint.json new file mode 100644 index 0000000..b4b1128 --- /dev/null +++ b/common/.config/templates/markdownlint.json @@ -0,0 +1,26 @@ +{ + "default": true, + "MD013": false, + "MD028": false, + "MD033": false, + "MD038": false, + "MD051": false, + "MD003": { + "style": "consistent" + }, + "MD007": { + "indent": 4 + }, + "MD029": { + "style": "ordered" + }, + "MD046": { + "style": "fenced" + }, + "MD049": { + "style": "underscore" + }, + "MD050": { + "style": "underscore" + } +}