Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ jobs:
go install mvdan.cc/sh/v3/cmd/shfmt@v3.13.1
echo "$HOME/go/bin" >> "$GITHUB_PATH"

- name: Install stylua
uses: JohnnyMorganz/stylua-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
Comment on lines +25 to +28

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Disable the setup action's implicit StyLua run

In this workflow section, JohnnyMorganz/stylua-action@v4 is being used as an installer before the explicit make stylua-check step, but the action's documented contract makes args the command it runs and says to use args: false for install-only usage. Without that input, this step invokes stylua before line 43 rather than just adding it to PATH, so the smoke job can fail at the install step or mutate the workspace before the intended check. Add args: false here, or pass the full --check ... arguments directly to this action.

Useful? React with 👍 / 👎.


- name: Check shell formatting
run: make shell-format-check

Expand All @@ -33,6 +39,9 @@ jobs:
- name: Lint TOML configs
run: make toml-lint

- name: Check Lua formatting with stylua
run: make stylua-check

- name: Check zsh config
run: make zsh-check

Expand Down
1 change: 1 addition & 0 deletions Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ brew "rust" # Systems programming language
brew "sd" # Better sed
brew "shellcheck" # Shell script linter
brew "shfmt" # Shell script formatter
brew "stylua" # Lua formatter (for nvim/ and yazi/ configs)
brew "tmux" # Terminal multiplexer
brew "tokei" # Code statistics
brew "wget" # File downloader
Expand Down
16 changes: 13 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ SHELLCHECK_FILES := .bash_profile .bashrc bin/brew-sync bin/cheatsheet bin/color
TOML_FILES := $(shell find . -path './.git' -prune -o -path './yazi/flavors' -prune -o -path './yazi/plugins' -prune -o -type f -name '*.toml' -print | sort | sed 's,^\./,,')
ZSH_FILES := .zshrc chetmancini.zsh-theme forge-zsh.sh linux_specific.sh mac_specific.sh

.PHONY: format check shell-format shell-format-check shell-syntax shellcheck toml-lint zsh-check
STYLUA ?= stylua
STYLUA_CONFIG := nvim/stylua.toml
STYLUA_FILES := $(shell find . -path './.git' -prune -o -path './yazi/flavors' -prune -o -name '*.lua' -type f -print | sort | sed 's,^\./,,')

format: shell-format
.PHONY: format check shell-format shell-format-check shell-syntax shellcheck toml-lint zsh-check stylua-check stylua-format

check: shell-format-check shell-syntax shellcheck toml-lint zsh-check
format: shell-format stylua-format

check: shell-format-check shell-syntax shellcheck toml-lint zsh-check stylua-check

shell-format:
$(SHFMT) $(SHFMT_FLAGS) -w $(SHFMT_FILES)
Expand All @@ -34,3 +38,9 @@ toml-lint:

zsh-check:
zsh -n $(ZSH_FILES)

stylua-check:
$(STYLUA) --config-path $(STYLUA_CONFIG) --check $(STYLUA_FILES)

stylua-format:
$(STYLUA) --config-path $(STYLUA_CONFIG) $(STYLUA_FILES)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ brew bundle cleanup --file=~/dotfiles/Brewfile
- `install.sh` supports interactive, preview, and headless installs (`--plan`, `--yes`, `--skip-brew`, etc.)
- `doctor` verifies symlinks, theme wiring, TPM, and repo health checks
- GitHub Actions smoke-tests the installer and doctor in a temporary `HOME`
- `make format` formats shell scripts with `shfmt`; `make check` runs formatting, syntax, ShellCheck, TOML, and zsh checks
- `make format` formats shell scripts with `shfmt` and Lua files with `stylua`; `make check` runs formatting, syntax, ShellCheck, TOML, stylua, and zsh checks

### Git
- Conventional commit aliases: `git feat`, `git fix`, `git chore`, etc.
Expand Down
20 changes: 15 additions & 5 deletions nvim/plugin/git.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,26 @@ require("gitsigns").setup({
local map = function(mode, lhs, rhs, desc)
vim.keymap.set(mode, lhs, rhs, { buffer = buffer, desc = desc })
end
map("n", "]h", function() gs.nav_hunk("next") end, "Next Hunk")
map("n", "[h", function() gs.nav_hunk("prev") end, "Prev Hunk")
map("n", "]h", function()
gs.nav_hunk("next")
end, "Next Hunk")
map("n", "[h", function()
gs.nav_hunk("prev")
end, "Prev Hunk")
map("n", "<leader>ghs", gs.stage_hunk, "Stage Hunk")
map("n", "<leader>ghr", gs.reset_hunk, "Reset Hunk")
map("v", "<leader>ghs", function() gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) end, "Stage Hunk")
map("v", "<leader>ghr", function() gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) end, "Reset Hunk")
map("v", "<leader>ghs", function()
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
end, "Stage Hunk")
map("v", "<leader>ghr", function()
gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
end, "Reset Hunk")
map("n", "<leader>ghS", gs.stage_buffer, "Stage Buffer")
map("n", "<leader>ghR", gs.reset_buffer, "Reset Buffer")
map("n", "<leader>ghp", gs.preview_hunk_inline, "Preview Hunk")
map("n", "<leader>ghb", function() gs.blame_line({ full = true }) end, "Blame Line")
map("n", "<leader>ghb", function()
gs.blame_line({ full = true })
end, "Blame Line")
map("n", "<leader>ghd", gs.diffthis, "Diff This")
end,
})
95 changes: 75 additions & 20 deletions nvim/plugin/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,33 @@
local ts = require("nvim-treesitter")

local desired_parsers = {
"bash", "c", "css", "diff", "html", "javascript", "jsdoc", "json", "jsonc",
"lua", "luadoc", "luap", "markdown", "markdown_inline", "printf", "python",
"query", "regex", "rust", "sql", "toml", "tsx", "typescript", "vim",
"vimdoc", "xml", "yaml",
"bash",
"c",
"css",
"diff",
"html",
"javascript",
"jsdoc",
"json",
"jsonc",
"lua",
"luadoc",
"luap",
"markdown",
"markdown_inline",
"printf",
"python",
"query",
"regex",
"rust",
"sql",
"toml",
"tsx",
"typescript",
"vim",
"vimdoc",
"xml",
"yaml",
}

vim.api.nvim_create_autocmd("VimEnter", {
Expand All @@ -27,24 +50,56 @@ require("nvim-treesitter-textobjects").setup()
local move = require("nvim-treesitter-textobjects.move")
local map = vim.keymap.set

map({ "n", "x", "o" }, "]f", function() move.goto_next_start("@function.outer") end, { desc = "Next Function Start" })
map({ "n", "x", "o" }, "]F", function() move.goto_next_end("@function.outer") end, { desc = "Next Function End" })
map({ "n", "x", "o" }, "]c", function() move.goto_next_start("@class.outer") end, { desc = "Next Class Start" })
map({ "n", "x", "o" }, "]C", function() move.goto_next_end("@class.outer") end, { desc = "Next Class End" })
map({ "n", "x", "o" }, "]a", function() move.goto_next_start("@parameter.inner") end, { desc = "Next Parameter" })
map({ "n", "x", "o" }, "[f", function() move.goto_previous_start("@function.outer") end, { desc = "Prev Function Start" })
map({ "n", "x", "o" }, "[F", function() move.goto_previous_end("@function.outer") end, { desc = "Prev Function End" })
map({ "n", "x", "o" }, "[c", function() move.goto_previous_start("@class.outer") end, { desc = "Prev Class Start" })
map({ "n", "x", "o" }, "[C", function() move.goto_previous_end("@class.outer") end, { desc = "Prev Class End" })
map({ "n", "x", "o" }, "[a", function() move.goto_previous_start("@parameter.inner") end, { desc = "Prev Parameter" })
map({ "n", "x", "o" }, "]f", function()
move.goto_next_start("@function.outer")
end, { desc = "Next Function Start" })
map({ "n", "x", "o" }, "]F", function()
move.goto_next_end("@function.outer")
end, { desc = "Next Function End" })
map({ "n", "x", "o" }, "]c", function()
move.goto_next_start("@class.outer")
end, { desc = "Next Class Start" })
map({ "n", "x", "o" }, "]C", function()
move.goto_next_end("@class.outer")
end, { desc = "Next Class End" })
map({ "n", "x", "o" }, "]a", function()
move.goto_next_start("@parameter.inner")
end, { desc = "Next Parameter" })
map({ "n", "x", "o" }, "[f", function()
move.goto_previous_start("@function.outer")
end, { desc = "Prev Function Start" })
map({ "n", "x", "o" }, "[F", function()
move.goto_previous_end("@function.outer")
end, { desc = "Prev Function End" })
map({ "n", "x", "o" }, "[c", function()
move.goto_previous_start("@class.outer")
end, { desc = "Prev Class Start" })
map({ "n", "x", "o" }, "[C", function()
move.goto_previous_end("@class.outer")
end, { desc = "Prev Class End" })
map({ "n", "x", "o" }, "[a", function()
move.goto_previous_start("@parameter.inner")
end, { desc = "Prev Parameter" })

local select = require("nvim-treesitter-textobjects.select")
map({ "x", "o" }, "af", function() select.select_textobject("@function.outer") end, { desc = "outer function" })
map({ "x", "o" }, "if", function() select.select_textobject("@function.inner") end, { desc = "inner function" })
map({ "x", "o" }, "ac", function() select.select_textobject("@class.outer") end, { desc = "outer class" })
map({ "x", "o" }, "ic", function() select.select_textobject("@class.inner") end, { desc = "inner class" })
map({ "x", "o" }, "aa", function() select.select_textobject("@parameter.outer") end, { desc = "outer parameter" })
map({ "x", "o" }, "ia", function() select.select_textobject("@parameter.inner") end, { desc = "inner parameter" })
map({ "x", "o" }, "af", function()
select.select_textobject("@function.outer")
end, { desc = "outer function" })
map({ "x", "o" }, "if", function()
select.select_textobject("@function.inner")
end, { desc = "inner function" })
map({ "x", "o" }, "ac", function()
select.select_textobject("@class.outer")
end, { desc = "outer class" })
map({ "x", "o" }, "ic", function()
select.select_textobject("@class.inner")
end, { desc = "inner class" })
map({ "x", "o" }, "aa", function()
select.select_textobject("@parameter.outer")
end, { desc = "outer parameter" })
map({ "x", "o" }, "ia", function()
select.select_textobject("@parameter.inner")
end, { desc = "inner parameter" })

-- Autotag and comments
require("nvim-ts-autotag").setup()
Expand Down
31 changes: 14 additions & 17 deletions yazi/init.lua
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
require("git"):setup()


require("full-border"):setup {
-- Available values: ui.Border.PLAIN, ui.Border.ROUNDED
type = ui.Border.ROUNDED,
}

require("full-border"):setup({
-- Available values: ui.Border.PLAIN, ui.Border.ROUNDED
type = ui.Border.ROUNDED,
})

function Linemode:size_and_mtime()
local time = math.floor(self._file.cha.mtime or 0)
if time == 0 then
time = ""
elseif os.date("%Y", time) == os.date("%Y") then
time = os.date("%b %d %H:%M", time)
else
time = os.date("%b %d %Y", time)
end
local time = math.floor(self._file.cha.mtime or 0)
if time == 0 then
time = ""
elseif os.date("%Y", time) == os.date("%Y") then
time = os.date("%b %d %H:%M", time)
else
time = os.date("%b %d %Y", time)
end

local size = self._file:size()
return string.format("%s %s", size and ya.readable_size(size) or "-", time)
local size = self._file:size()
return string.format("%s %s", size and ya.readable_size(size) or "-", time)
end

74 changes: 37 additions & 37 deletions yazi/plugins/full-border.yazi/main.lua
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
--- @since 25.2.26

local function setup(_, opts)
local type = opts and opts.type or ui.Border.ROUNDED
local old_build = Tab.build

Tab.build = function(self, ...)
local bar = function(c, x, y)
if x <= 0 or x == self._area.w - 1 or th.mgr.border_symbol ~= "│" then
return ui.Bar(ui.Edge.TOP)
end

return ui.Bar(ui.Edge.TOP)
:area(
ui.Rect { x = x, y = math.max(0, y), w = ya.clamp(0, self._area.w - x, 1), h = math.min(1, self._area.h) }
)
:symbol(c)
end

local c = self._chunks
self._chunks = {
c[1]:pad(ui.Pad.y(1)),
c[2]:pad(ui.Pad(1, c[3].w > 0 and 0 or 1, 1, c[1].w > 0 and 0 or 1)),
c[3]:pad(ui.Pad.y(1)),
}

local style = th.mgr.border_style
self._base = ya.list_merge(self._base or {}, {
ui.Border(ui.Edge.ALL):area(self._area):type(type):style(style),
ui.Bar(ui.Edge.RIGHT):area(self._chunks[1]):style(style),
ui.Bar(ui.Edge.LEFT):area(self._chunks[3]):style(style),

bar("┬", c[1].right - 1, c[1].y),
bar("┴", c[1].right - 1, c[1].bottom - 1),
bar("┬", c[2].right, c[2].y),
bar("┴", c[2].right, c[2].bottom - 1),
})

old_build(self, ...)
end
local type = opts and opts.type or ui.Border.ROUNDED
local old_build = Tab.build

Tab.build = function(self, ...)
local bar = function(c, x, y)
if x <= 0 or x == self._area.w - 1 or th.mgr.border_symbol ~= "│" then
return ui.Bar(ui.Edge.TOP)
end

return ui.Bar(ui.Edge.TOP)
:area(
ui.Rect({ x = x, y = math.max(0, y), w = ya.clamp(0, self._area.w - x, 1), h = math.min(1, self._area.h) })
)
:symbol(c)
end

local c = self._chunks
self._chunks = {
c[1]:pad(ui.Pad.y(1)),
c[2]:pad(ui.Pad(1, c[3].w > 0 and 0 or 1, 1, c[1].w > 0 and 0 or 1)),
c[3]:pad(ui.Pad.y(1)),
}

local style = th.mgr.border_style
self._base = ya.list_merge(self._base or {}, {
ui.Border(ui.Edge.ALL):area(self._area):type(type):style(style),
ui.Bar(ui.Edge.RIGHT):area(self._chunks[1]):style(style),
ui.Bar(ui.Edge.LEFT):area(self._chunks[3]):style(style),

bar("┬", c[1].right - 1, c[1].y),
bar("┴", c[1].right - 1, c[1].bottom - 1),
bar("┬", c[2].right, c[2].y),
bar("┴", c[2].right, c[2].bottom - 1),
})

old_build(self, ...)
end
end

return { setup = setup }
Loading
Loading