Compare commits
4 Commits
327ef34215
...
26398a67c9
Author | SHA1 | Date | |
---|---|---|---|
26398a67c9 | |||
c319078ded | |||
f7ce4f6e42 | |||
cfe47fcd28 |
@ -120,6 +120,61 @@ M.setup = function()
|
|||||||
nargs = "*",
|
nargs = "*",
|
||||||
desc = "Create tempfile and cd to its directory",
|
desc = "Create tempfile and cd to its directory",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local config_home = vim.env.XDG_CONFIG_HOME or vim.env.HOME .. "/.config"
|
||||||
|
local z_lua_path = config_home .. "/zsh/config/plugins/z.lua/z.lua"
|
||||||
|
local cached_z_listing = {}
|
||||||
|
vim.api.nvim_create_user_command("Z", function(opts)
|
||||||
|
cached_z_listing = {}
|
||||||
|
local cmd = { "lua", z_lua_path, "-e", opts.args }
|
||||||
|
local cmd_out = vim.system(cmd, { text = true }):wait()
|
||||||
|
if cmd_out.code > 0 then
|
||||||
|
vim.notify(
|
||||||
|
"Failed with code `" .. cmd_out.code .. "`\nSTDERR: " .. (cmd_out.stderr or ""),
|
||||||
|
vim.log.levels.WARN,
|
||||||
|
{
|
||||||
|
title = "z.lua",
|
||||||
|
---@param win integer The window handle
|
||||||
|
on_open = function(win)
|
||||||
|
vim.api.nvim_set_option_value("filetype", "markdown", { buf = vim.api.nvim_win_get_buf(win) })
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
elseif cmd_out.stdout == "" then
|
||||||
|
vim.notify("Did not receive a match from `z.lua`!", vim.log.levels.WARN, {
|
||||||
|
title = "z.lua",
|
||||||
|
---@param win integer The window handle
|
||||||
|
on_open = function(win)
|
||||||
|
vim.api.nvim_set_option_value("filetype", "markdown", { buf = vim.api.nvim_win_get_buf(win) })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
else
|
||||||
|
local stripped_stdout = cmd_out.stdout:gsub("\n$", "")
|
||||||
|
vim.system({"lua", z_lua_path, "--add", stripped_stdout})
|
||||||
|
vim.cmd("silent! cd " .. stripped_stdout)
|
||||||
|
vim.notify("Chdir to `" .. stripped_stdout .. "`", vim.log.levels.INFO, {
|
||||||
|
title = "z.lua",
|
||||||
|
---@param win integer The window handle
|
||||||
|
on_open = function(win)
|
||||||
|
vim.api.nvim_set_option_value("filetype", "markdown", { buf = vim.api.nvim_win_get_buf(win) })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end, {
|
||||||
|
nargs = "+",
|
||||||
|
complete = function(_, _, _)
|
||||||
|
local cmd = { "lua", z_lua_path, "--complete" }
|
||||||
|
local cmd_out
|
||||||
|
if #cached_z_listing == 0 then
|
||||||
|
cmd_out = vim.system(cmd, { text = true }):wait()
|
||||||
|
if cmd_out.code == 0 and cmd_out.stdout then
|
||||||
|
cached_z_listing = vim.split(cmd_out.stdout, "\n")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return cached_z_listing
|
||||||
|
end,
|
||||||
|
desc = "Invoke `z.lua`",
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
@ -56,14 +56,6 @@ M.setup = function()
|
|||||||
-- Set current focused file as cwd
|
-- Set current focused file as cwd
|
||||||
vim.keymap.set("n", "<leader>cd", ":cd %:p:h<CR>", { silent = true, desc = "Change CWD to Current File" })
|
vim.keymap.set("n", "<leader>cd", ":cd %:p:h<CR>", { silent = true, desc = "Change CWD to Current File" })
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>lh", function()
|
|
||||||
if vim.diagnostic.is_disabled() then
|
|
||||||
vim.diagnostic.enable()
|
|
||||||
else
|
|
||||||
vim.diagnostic.disable()
|
|
||||||
end
|
|
||||||
end, { silent = true, desc = "LSP: Toggle Diagnostics" })
|
|
||||||
|
|
||||||
-- Toggle relativenumber
|
-- Toggle relativenumber
|
||||||
vim.keymap.set("n", "<leader>sr", function()
|
vim.keymap.set("n", "<leader>sr", function()
|
||||||
vim.opt.relativenumber = not vim.opt.relativenumber:get()
|
vim.opt.relativenumber = not vim.opt.relativenumber:get()
|
||||||
|
@ -4,10 +4,10 @@ return {
|
|||||||
dependencies = "nvim-treesitter/nvim-treesitter",
|
dependencies = "nvim-treesitter/nvim-treesitter",
|
||||||
opts = function()
|
opts = function()
|
||||||
local bullets = {
|
local bullets = {
|
||||||
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
}
|
}
|
||||||
|
@ -350,8 +350,7 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition = function()
|
condition = function()
|
||||||
return not vim.bo.modifiable
|
return not vim.bo.modifiable or vim.bo.readonly
|
||||||
or vim.bo.readonly
|
|
||||||
end,
|
end,
|
||||||
provider = " ",
|
provider = " ",
|
||||||
hl = { fg = colors.roninYellow },
|
hl = { fg = colors.roninYellow },
|
||||||
@ -529,6 +528,9 @@ return {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
local ActiveWinbar = {
|
local ActiveWinbar = {
|
||||||
|
init = function(self)
|
||||||
|
self.bufnr = vim.api.nvim_get_current_buf()
|
||||||
|
end,
|
||||||
condition = conditions.is_active,
|
condition = conditions.is_active,
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@ -554,7 +556,9 @@ return {
|
|||||||
hl = { fg = colors.oniViolet, bg = utils.get_highlight("WinBarNC").bg },
|
hl = { fg = colors.oniViolet, bg = utils.get_highlight("WinBarNC").bg },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
provider = " ",
|
provider = function(self)
|
||||||
|
return " " .. (vim.diagnostic.is_disabled(self.bufnr) and " " or" " )
|
||||||
|
end,
|
||||||
hl = {
|
hl = {
|
||||||
bg = colors.oniViolet,
|
bg = colors.oniViolet,
|
||||||
fg = colors.sumiInk0,
|
fg = colors.sumiInk0,
|
||||||
|
@ -198,13 +198,14 @@ return {
|
|||||||
{
|
{
|
||||||
"<leader>lh",
|
"<leader>lh",
|
||||||
function()
|
function()
|
||||||
if vim.diagnostic.is_disabled() then
|
local curr_buf = vim.api.nvim_get_current_buf()
|
||||||
vim.diagnostic.enable()
|
if vim.diagnostic.is_disabled(curr_buf) then
|
||||||
|
vim.diagnostic.enable(curr_buf)
|
||||||
else
|
else
|
||||||
vim.diagnostic.disable()
|
vim.diagnostic.disable(curr_buf)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
desc = "LSP: Toggle Diagnostics",
|
desc = "LSP: Toggle Diagnostics in Current Buffer",
|
||||||
},
|
},
|
||||||
{ "<leader>lD", vim.lsp.buf.declaration, desc = "LSP: Declaration" },
|
{ "<leader>lD", vim.lsp.buf.declaration, desc = "LSP: Declaration" },
|
||||||
{ "<leader>k", vim.lsp.buf.hover, desc = "LSP: Hover" },
|
{ "<leader>k", vim.lsp.buf.hover, desc = "LSP: Hover" },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user