mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-15 06:32:40 +00:00
feat: Adds find-latest function to zsh, 'fl' alias for it, lazyvim config changes.
This commit is contained in:
@@ -15,15 +15,15 @@ createCmd("BufEnter", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- Markdown
|
-- Markdown
|
||||||
createCmd("BufWritePost", {
|
-- createCmd("BufWritePost", {
|
||||||
pattern = { "*.md", "*.markdown" },
|
-- pattern = { "*.md", "*.markdown" },
|
||||||
group = markdownGroup,
|
-- group = markdownGroup,
|
||||||
callback = function(_)
|
-- callback = function(_)
|
||||||
local cursor = vim.fn.getpos(".")
|
-- -- local cursor = vim.fn.getpos(".")
|
||||||
vim.cmd("FormatWrite")
|
-- vim.cmd("FormatWrite")
|
||||||
vim.fn.setpos(".", cursor)
|
-- -- vim.fn.setpos(".", cursor)
|
||||||
end,
|
-- end,
|
||||||
})
|
-- })
|
||||||
|
|
||||||
-- Go
|
-- Go
|
||||||
createCmd("BufWritePre", {
|
createCmd("BufWritePre", {
|
||||||
|
|||||||
@@ -1,18 +1,30 @@
|
|||||||
return {
|
return {
|
||||||
"stevearc/conform.nvim",
|
"stevearc/conform.nvim",
|
||||||
opts = {
|
opts = {
|
||||||
|
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("<!%-%- toc %-%->") 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 = {
|
formatters_by_ft = {
|
||||||
|
["markdown"] = { "prettier", "markdownlint-cli2", "markdown-toc" },
|
||||||
|
["markdown.mdx"] = { "prettier", "markdownlint-cli2", "markdown-toc" },
|
||||||
lua = { "stulua" },
|
lua = { "stulua" },
|
||||||
markdown = {
|
|
||||||
"prettier",
|
|
||||||
prepend_args = {
|
|
||||||
"--config", "~/.prettierrc.yaml"
|
|
||||||
},
|
|
||||||
},
|
|
||||||
swift = { "swiftformat" },
|
swift = { "swiftformat" },
|
||||||
-- ["*"] = {
|
|
||||||
-- require("formatter.filetypes.any").remove_trailing_whitespace,
|
|
||||||
-- },
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,3 +14,7 @@ wc
|
|||||||
HVAC
|
HVAC
|
||||||
dehumidification
|
dehumidification
|
||||||
ansible
|
ansible
|
||||||
|
orchestrator
|
||||||
|
ethernet
|
||||||
|
unifi
|
||||||
|
wildcard
|
||||||
|
|||||||
Binary file not shown.
@@ -164,6 +164,7 @@ alias d='docker' # run docker commands quickly
|
|||||||
alias dc='docker compose' # run docker-compose commands quickly
|
alias dc='docker compose' # run docker-compose commands quickly
|
||||||
alias dv='dirs -v' # list directory info
|
alias dv='dirs -v' # list directory info
|
||||||
alias essh='edit-ssh-config' # edit ssh config quickly
|
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 g='git' # access git commands quickly
|
||||||
alias ga='git add' # add files to git quickly
|
alias ga='git add' # add files to git quickly
|
||||||
alias gcb='git checkout -b' # checkout a new git branch, creating if needed.
|
alias gcb='git checkout -b' # checkout a new git branch, creating if needed.
|
||||||
|
|||||||
7
zsh/config/functions/find-latest
Executable file
7
zsh/config/functions/find-latest
Executable file
@@ -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)"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user