From e4b92a679d3a9ca595aed16b5bdd76d07b43f9f3 Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Tue, 17 Jan 2023 15:07:16 +0100 Subject: [PATCH] update nvim stuff --- mzte-nv/conf/ftplugin/java.lua | 2 + mzte-nv/conf/lua/pluginconf/line.lua | 2 +- mzte-nv/conf/lua/pluginconf/nvim_fidget.lua | 7 ++ mzte-nv/conf/lua/plugins.lua | 10 +-- mzte-nv/src/compiler.zig | 4 +- mzte-nv/src/main.zig | 84 +++++++++++---------- 6 files changed, 61 insertions(+), 48 deletions(-) create mode 100644 mzte-nv/conf/lua/pluginconf/nvim_fidget.lua diff --git a/mzte-nv/conf/ftplugin/java.lua b/mzte-nv/conf/ftplugin/java.lua index 1a8e6d3..659b104 100644 --- a/mzte-nv/conf/ftplugin/java.lua +++ b/mzte-nv/conf/ftplugin/java.lua @@ -40,6 +40,8 @@ jdtls.start_or_attach { on_attach = function(client, _) -- formatting is handled by clang-format client.server_capabilities.documentFormattingProvider = false + -- java lsp has shit highlights + client.server_capabilities.semanticTokensProvider = false require("jdtls.setup").add_commands() jdtls.setup_dap { hotcodereplace = "auto", diff --git a/mzte-nv/conf/lua/pluginconf/line.lua b/mzte-nv/conf/lua/pluginconf/line.lua index fc7bf5d..78350de 100644 --- a/mzte-nv/conf/lua/pluginconf/line.lua +++ b/mzte-nv/conf/lua/pluginconf/line.lua @@ -5,7 +5,7 @@ lline.setup { theme = "dracula", }, sections = { - lualine_b = { "branch", "diff", "lsp_progress" }, + lualine_b = { "branch", "diff" }, lualine_c = { "filename", "diagnostics" }, }, } diff --git a/mzte-nv/conf/lua/pluginconf/nvim_fidget.lua b/mzte-nv/conf/lua/pluginconf/nvim_fidget.lua new file mode 100644 index 0000000..a35ebf0 --- /dev/null +++ b/mzte-nv/conf/lua/pluginconf/nvim_fidget.lua @@ -0,0 +1,7 @@ +local fidget = require "fidget" + +fidget.setup { + text = { + spinner = "zip", + }, +} diff --git a/mzte-nv/conf/lua/plugins.lua b/mzte-nv/conf/lua/plugins.lua index 43d55cf..43b0b2f 100644 --- a/mzte-nv/conf/lua/plugins.lua +++ b/mzte-nv/conf/lua/plugins.lua @@ -29,11 +29,6 @@ local function cmp_plugins(use) }, } - use { - "simrat39/rust-tools.nvim", - config = pconf "rust_tools", - } - use { "Saecki/crates.nvim", config = function() @@ -184,6 +179,11 @@ require("packer").startup(function(use) config = pconf "nvim_recorder", } + use { + "j-hui/fidget.nvim", + config = pconf "nvim_fidget", + } + cmp_plugins(use) end) diff --git a/mzte-nv/src/compiler.zig b/mzte-nv/src/compiler.zig index e899fc5..f752655 100644 --- a/mzte-nv/src/compiler.zig +++ b/mzte-nv/src/compiler.zig @@ -3,7 +3,9 @@ const c = @import("ffi.zig").c; const log = std.log.scoped(.compiler); -pub const log_level = .debug; +pub const std_options = struct { + pub const log_level = .debug; +}; pub fn main() !void { if (std.os.argv.len != 2) { diff --git a/mzte-nv/src/main.zig b/mzte-nv/src/main.zig index c58a773..b98a862 100644 --- a/mzte-nv/src/main.zig +++ b/mzte-nv/src/main.zig @@ -14,52 +14,54 @@ const modules = struct { var lua_state: ?*c.lua_State = null; -pub fn log( - comptime level: std.log.Level, - comptime scope: @TypeOf(.EnumLiteral), - comptime format: []const u8, - args: anytype, -) void { - // if there's no lua state, we can't invoke nvim notifications. - const l = lua_state orelse return; +pub const std_options = struct { + pub fn logFn( + comptime level: std.log.Level, + comptime scope: @TypeOf(.EnumLiteral), + comptime format: []const u8, + args: anytype, + ) void { + // if there's no lua state, we can't invoke nvim notifications. + const l = lua_state orelse return; - const stacktop = c.lua_gettop(l); - defer c.lua_settop(l, stacktop); + const stacktop = c.lua_gettop(l); + defer c.lua_settop(l, stacktop); - var fmtbuf: [2048]u8 = undefined; + var fmtbuf: [2048]u8 = undefined; - c.lua_getglobal(l, "vim"); - c.lua_getfield(l, -1, "log"); - c.lua_getfield(l, -1, "levels"); - switch (level) { - .err => c.lua_getfield(l, -1, "ERROR"), - .warn => c.lua_getfield(l, -1, "WARN"), - .info => c.lua_getfield(l, -1, "INFO"), - .debug => c.lua_getfield(l, -1, "DEBUG"), + c.lua_getglobal(l, "vim"); + c.lua_getfield(l, -1, "log"); + c.lua_getfield(l, -1, "levels"); + switch (level) { + .err => c.lua_getfield(l, -1, "ERROR"), + .warn => c.lua_getfield(l, -1, "WARN"), + .info => c.lua_getfield(l, -1, "INFO"), + .debug => c.lua_getfield(l, -1, "DEBUG"), + } + + const vim_lvl = c.lua_tointeger(l, -1); + c.lua_pop(l, 3); + + c.lua_getfield(l, -1, "notify"); + + const msg = std.fmt.bufPrintZ(&fmtbuf, format, args) catch return; + c.lua_pushstring(l, msg.ptr); + + c.lua_pushinteger(l, vim_lvl); + + const title = std.fmt.bufPrintZ( + &fmtbuf, + "MZTE-NV ({s})", + .{@tagName(scope)}, + ) catch return; + ser.luaPushAny(l, .{ + .title = title, + }); + c.lua_call(l, 3, 0); } - const vim_lvl = c.lua_tointeger(l, -1); - c.lua_pop(l, 3); - - c.lua_getfield(l, -1, "notify"); - - const msg = std.fmt.bufPrintZ(&fmtbuf, format, args) catch return; - c.lua_pushstring(l, msg.ptr); - - c.lua_pushinteger(l, vim_lvl); - - const title = std.fmt.bufPrintZ( - &fmtbuf, - "MZTE-NV ({s})", - .{@tagName(scope)}, - ) catch return; - ser.luaPushAny(l, .{ - .title = title, - }); - c.lua_call(l, 3, 0); -} - -pub const log_level = .debug; + pub const log_level = .debug; +}; export fn luaopen_mzte_nv(l_: ?*c.lua_State) c_int { lua_state = l_;