diff --git a/nvim/lazynvim/lua/config/autocmds.lua b/nvim/lazynvim/lua/config/autocmds.lua index 5e0808f..d706fc8 100644 --- a/nvim/lazynvim/lua/config/autocmds.lua +++ b/nvim/lazynvim/lua/config/autocmds.lua @@ -15,15 +15,15 @@ createCmd("BufEnter", { }) -- Markdown -createCmd("BufWritePost", { - pattern = { "*.md", "*.markdown" }, - group = markdownGroup, - callback = function(_) - local cursor = vim.fn.getpos(".") - vim.cmd("FormatWrite") - vim.fn.setpos(".", cursor) - end, -}) +-- createCmd("BufWritePost", { +-- pattern = { "*.md", "*.markdown" }, +-- group = markdownGroup, +-- callback = function(_) +-- -- local cursor = vim.fn.getpos(".") +-- vim.cmd("FormatWrite") +-- -- vim.fn.setpos(".", cursor) +-- end, +-- }) -- Go createCmd("BufWritePre", { diff --git a/nvim/lazynvim/lua/plugins/formatter.lua b/nvim/lazynvim/lua/plugins/formatter.lua index 7ca3e28..b7eb5b4 100644 --- a/nvim/lazynvim/lua/plugins/formatter.lua +++ b/nvim/lazynvim/lua/plugins/formatter.lua @@ -1,18 +1,30 @@ return { "stevearc/conform.nvim", opts = { - formatters_by_ft = { - lua = { "stulua" }, - markdown = { - "prettier", - prepend_args = { - "--config", "~/.prettierrc.yaml" - }, + formatters = { + ["markdown-toc"] = { + condition = function(_, ctx) + for _, line in ipairs(vim.api.nvim_buf_get_lines(ctx.buf, 0, -1, false)) do + if line:find("") then + return true + end + end + end, }, + ["markdownlint-cli2"] = { + condition = function(_, ctx) + local diag = vim.tbl_filter(function(d) + return d.source == "markdownlint" + end, vim.diagnostic.get(ctx.buf)) + return #diag > 0 + end, + }, + }, + formatters_by_ft = { + ["markdown"] = { "prettier", "markdownlint-cli2", "markdown-toc" }, + ["markdown.mdx"] = { "prettier", "markdownlint-cli2", "markdown-toc" }, + lua = { "stulua" }, swift = { "swiftformat" }, - -- ["*"] = { - -- require("formatter.filetypes.any").remove_trailing_whitespace, - -- }, }, }, } diff --git a/nvim/lazynvim/spell/en.utf-8.add b/nvim/lazynvim/spell/en.utf-8.add index 096d029..b53b064 100755 --- a/nvim/lazynvim/spell/en.utf-8.add +++ b/nvim/lazynvim/spell/en.utf-8.add @@ -14,3 +14,7 @@ wc HVAC dehumidification ansible +orchestrator +ethernet +unifi +wildcard diff --git a/nvim/lazynvim/spell/en.utf-8.add.spl b/nvim/lazynvim/spell/en.utf-8.add.spl index c805b67..d7da2ca 100755 Binary files a/nvim/lazynvim/spell/en.utf-8.add.spl and b/nvim/lazynvim/spell/en.utf-8.add.spl differ diff --git a/zsh/config/.zshrc b/zsh/config/.zshrc index 04fe0e8..cf2075d 100755 --- a/zsh/config/.zshrc +++ b/zsh/config/.zshrc @@ -164,6 +164,7 @@ alias d='docker' # run docker commands quickly alias dc='docker compose' # run docker-compose commands quickly alias dv='dirs -v' # list directory info alias essh='edit-ssh-config' # edit ssh config quickly +alias fl='find-latest' # Find the last modified file in a directory. alias g='git' # access git commands quickly alias ga='git add' # add files to git quickly alias gcb='git checkout -b' # checkout a new git branch, creating if needed. diff --git a/zsh/config/functions/find-latest b/zsh/config/functions/find-latest new file mode 100755 index 0000000..0395e59 --- /dev/null +++ b/zsh/config/functions/find-latest @@ -0,0 +1,7 @@ +#!/bin/zsh + +# Find the last modified file in a directory. +function find-latest() { + local dir=$1 + echo "$(find $dir -maxdepth 1 -mindepth 1 -type f -ctime 30 | sort -nr | head -1)" +}