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)
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)
vim.fn.termopen(cmd, {
on_exit = function(_, code)
if code == 0 then
vim.notify("󰄬 " .. cmd .. " success")
pcall(vim.cmd, "bdelete!")
else
vim.notify("󰅚 " .. cmd .. " failed (" .. code .. ")", vim.log.levels.ERROR)
end
end,
})
vim.api.nvim_buf_call(buf, function()
vim.fn.termopen(cmd, {
on_exit = function(_, code)
if code == 0 then
vim.notify("󰄬 " .. cmd .. " success")
pcall(vim.api.nvim_buf_delete, buf, { force = true })
else
vim.notify("󰅚 " .. cmd .. " failed (" .. code .. ")", vim.log.levels.ERROR)
end
end,
})
end)
end
--- 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)
end
local recipes = vim.split(vim.trim(obj.stdout), "%s+")
require("mini.pick").start({
source = {
items = recipes,
items = vim.split(vim.trim(obj.stdout), "%s+"),
name = "󱁤 Just Tasks",
choose = function(choice)
run_task("just " .. choice)
end,
choose = function(choice) run_task("just " .. choice) end,
},
})
end
+8 -2
View File
@@ -1,8 +1,9 @@
-- Colortheme ==================================================================
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({
enable = {
terminal = false,
legacy_highlights = false,
migrations = false,
},
@@ -28,7 +29,7 @@ Config.now_if_args(function()
Config.autocmd('FileType', filetypes, function(ev)
if pcall(vim.treesitter.start, ev.buf) 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()"
end
end
@@ -75,6 +76,11 @@ Config.now_if_args(function()
formatters_by_ft = {
go = { "gofumpt", "goimports" },
php = { "php_cs_fixer" },
json = { "jq" },
javascript = { "biome" },
typescript = { "biome" },
javascriptreact = { "biome" },
typescriptreact = { "biome" },
},
})
end)