Compare commits

...
3 Commits
2 changed files with 23 additions and 19 deletions
+15 -17
View File
@@ -2,21 +2,22 @@ local M = {}
local function run_task(cmd) local function run_task(cmd)
vim.notify("󰑮 Running: " .. cmd) vim.notify("󰑮 Running: " .. cmd)
vim.cmd("enew")
local buf = vim.api.nvim_get_current_buf() local buf = vim.api.nvim_create_buf(true, true)
pcall(vim.api.nvim_buf_set_name, buf, "just://" .. cmd) pcall(vim.api.nvim_buf_set_name, buf, "just://" .. cmd)
vim.fn.termopen(cmd, { vim.api.nvim_buf_call(buf, function()
on_exit = function(_, code) vim.fn.termopen(cmd, {
if code == 0 then on_exit = function(_, code)
vim.notify("󰄬 " .. cmd .. " success") if code == 0 then
pcall(vim.cmd, "bdelete!") vim.notify("󰄬 " .. cmd .. " success")
else pcall(vim.api.nvim_buf_delete, buf, { force = true })
vim.notify("󰅚 " .. cmd .. " failed (" .. code .. ")", vim.log.levels.ERROR) else
end vim.notify("󰅚 " .. cmd .. " failed (" .. code .. ")", vim.log.levels.ERROR)
end, end
}) end,
})
end)
end end
--- Interactive picker for selecting and running tasks defined in a Justfile. --- Interactive picker for selecting and running tasks defined in a Justfile.
@@ -26,14 +27,11 @@ function M.pick_just_task()
return vim.notify("No recipes or justfile found", vim.log.levels.WARN) return vim.notify("No recipes or justfile found", vim.log.levels.WARN)
end end
local recipes = vim.split(vim.trim(obj.stdout), "%s+")
require("mini.pick").start({ require("mini.pick").start({
source = { source = {
items = recipes, items = vim.split(vim.trim(obj.stdout), "%s+"),
name = "󱁤 Just Tasks", name = "󱁤 Just Tasks",
choose = function(choice) choose = function(choice) run_task("just " .. choice) end,
run_task("just " .. choice)
end,
}, },
}) })
end end
+8 -2
View File
@@ -1,8 +1,9 @@
-- Colortheme ================================================================== -- Colortheme ==================================================================
Config.now(function() Config.now(function()
vim.pack.add({ "https://github.com/rose-pine/neovim" }) vim.pack.add({ { src = "https://github.com/rose-pine/neovim", name = "rose-pine" } })
require("rose-pine").setup({ require("rose-pine").setup({
enable = { enable = {
terminal = false,
legacy_highlights = false, legacy_highlights = false,
migrations = false, migrations = false,
}, },
@@ -28,7 +29,7 @@ Config.now_if_args(function()
Config.autocmd('FileType', filetypes, function(ev) Config.autocmd('FileType', filetypes, function(ev)
if pcall(vim.treesitter.start, ev.buf) then if pcall(vim.treesitter.start, ev.buf) then
if vim.bo[ev.buf].filetype == 'php' then if vim.bo[ev.buf].filetype == 'php' then
-- fixes broken indentation on `o` in php buffers -- Fixes broken indentation on `o` in php buffers
vim.bo[ev.buf].indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" vim.bo[ev.buf].indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end end
end end
@@ -75,6 +76,11 @@ Config.now_if_args(function()
formatters_by_ft = { formatters_by_ft = {
go = { "gofumpt", "goimports" }, go = { "gofumpt", "goimports" },
php = { "php_cs_fixer" }, php = { "php_cs_fixer" },
json = { "jq" },
javascript = { "biome" },
typescript = { "biome" },
javascriptreact = { "biome" },
typescriptreact = { "biome" },
}, },
}) })
end) end)