From 7eec83d04d04b59d3760b3ab1ece8a11b12adabe Mon Sep 17 00:00:00 2001 From: ttak0422 Date: Tue, 17 Dec 2024 01:59:17 +0900 Subject: [PATCH] chore(other): setup --- flake.lock | 23 ++++++++++++++++++++--- flake.nix | 4 ++++ fnl/hook-buffer.fnl | 3 ++- fnl/other.fnl | 29 +++++++++++++++++++++++++++++ lua/autogen/hook-buffer.lua | 2 +- lua/autogen/other.lua | 11 +++++++++++ main/default.nix | 1 + main/tool.nix | 5 +++++ 8 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 fnl/other.fnl create mode 100644 lua/autogen/other.lua diff --git a/flake.lock b/flake.lock index d026608..bd68be6 100644 --- a/flake.lock +++ b/flake.lock @@ -4428,11 +4428,11 @@ "oil-nvim": { "flake": false, "locked": { - "lastModified": 1730303616, - "narHash": "sha256-m0ttlgxBR3yeXels1c2a4AUKQ7S9w9kAywImBYHqVgU=", + "lastModified": 1733872944, + "narHash": "sha256-LM/RWrh3zSVuiO3uI9lcZRjx1T1kw0L2fB1fQCBnHX4=", "owner": "stevearc", "repo": "oil.nvim", - "rev": "52cc8a1fb35ea6ce1df536143add7ce7215c63c0", + "rev": "dba037598843973b8c54bc5ce0318db4a0da439d", "type": "github" }, "original": { @@ -4473,6 +4473,22 @@ "type": "github" } }, + "other-nvim": { + "flake": false, + "locked": { + "lastModified": 1733008756, + "narHash": "sha256-mHN1anRlOBN0Wvl2T8zBHV7BfMLH7C8dmTIqBTzr414=", + "owner": "rgroli", + "repo": "other.nvim", + "rev": "933aa489ad02f8f973269a565bfea16cc784cbbf", + "type": "github" + }, + "original": { + "owner": "rgroli", + "repo": "other.nvim", + "type": "github" + } + }, "overseer-nvim": { "flake": false, "locked": { @@ -4920,6 +4936,7 @@ "oil-nvim": "oil-nvim", "oil-vcs-status": "oil-vcs-status", "open-nvim": "open-nvim", + "other-nvim": "other-nvim", "overseer-nvim": "overseer-nvim", "pathlib-nvim": "pathlib-nvim", "pgmnt-vim": "pgmnt-vim", diff --git a/flake.nix b/flake.nix index 95f8667..5e17a08 100644 --- a/flake.nix +++ b/flake.nix @@ -1324,6 +1324,10 @@ url = "github:Shougo/ddc-source-omni"; flake = false; }; + other-nvim = { + url = "github:rgroli/other.nvim"; + flake = false; + }; }; outputs = diff --git a/fnl/hook-buffer.fnl b/fnl/hook-buffer.fnl index 130597e..36c7f8d 100644 --- a/fnl/hook-buffer.fnl +++ b/fnl/hook-buffer.fnl @@ -91,7 +91,8 @@ ; (dapui.toggle {:reset true}))) (desc "dap toggle ui")] ;; copilot chat - [:ta (cmd :CopilotChatToggle)]])] + [:ta (cmd :CopilotChatToggle)] + [:O (cmd :Other)]])] (vim.keymap.set :n (. k 1) (. k 2) (or (. k 3) opts))) (each [_ k (ipairs [;; translate [:T (cmd "Translate JA")] diff --git a/fnl/other.fnl b/fnl/other.fnl new file mode 100644 index 0000000..78b1f2e --- /dev/null +++ b/fnl/other.fnl @@ -0,0 +1,29 @@ +(let [other (require :other-nvim) + window (require :other-nvim.helper.window) + util (require :other-nvim.helper.util) + builtinMappings (require :other-nvim.builtin.mappings) + transformers (require :other-nvim.builtin.transformers) + mappings [:golang] + transformers {:camelToKebap transformers.camelToKebap + :kebapToCamel transformers.kebapToCamel + :pluralize transformers.pluralize + :singularize transformers.singularize} + keybindings {: "open_file_by_command()" + : "close_window()" + :q "close_window()" + : "close_window()" + :o "open_file()" + :t "open_file_tabnew()" + :v "open_file_vs()" + :s "open_file_sp()"} + style {:border :none + :seperator "|" + :newFileIndicator "(* new *)" + :width 0.7 + :minHeight 2}] + (other.setup {:showMissingFiles true + :rememberBuffers true + : mappings + : transformers + : keybindings + : style})) diff --git a/lua/autogen/hook-buffer.lua b/lua/autogen/hook-buffer.lua index 97a24da..83fdda4 100644 --- a/lua/autogen/hook-buffer.lua +++ b/lua/autogen/hook-buffer.lua @@ -27,7 +27,7 @@ local function _4_() local dap = require("dap") return dap.set_breakpoint(vim.fn.input("Breakpoint condition: ")) end -for _, k in ipairs({{"gpd", lcmd("require('goto-preview').goto_preview_definition()"), desc("preview definition")}, {"gpi", lcmd("require('goto-preview').goto_preview_implementation()"), desc("preview implementation")}, {"gpr", lcmd("require('goto-preview').goto_preview_references()"), desc("preview references")}, {"gP", lcmd("require('goto-preview').close_all_win()"), desc("close all preview")}, {"gb", lcmd("require('dropbar.api').pick()"), desc("pick")}, {"", lcmd("require('dap').continue()"), desc("continue")}, {"", lcmd("require('dap').step_over()"), desc("step over")}, {"", lcmd("require('dap').step_into()"), desc("step into")}, {"", lcmd("require('dap').step_out()"), desc("step out")}, {"db", lcmd("require('dap').toggle_breakpoint()"), desc("dap toggle breakpoint")}, {"dB", _4_, desc("dap set breakpoint with condition")}, {"dr", lcmd("require('dap').repl.toggle()"), desc("dap toggle repl")}, {"dl", lcmd("require('dap').run_last()"), desc("dap run last")}, {"dd", cmd("ToggleDapUI"), desc("dap toggle ui")}, {"ta", cmd("CopilotChatToggle")}}) do +for _, k in ipairs({{"gpd", lcmd("require('goto-preview').goto_preview_definition()"), desc("preview definition")}, {"gpi", lcmd("require('goto-preview').goto_preview_implementation()"), desc("preview implementation")}, {"gpr", lcmd("require('goto-preview').goto_preview_references()"), desc("preview references")}, {"gP", lcmd("require('goto-preview').close_all_win()"), desc("close all preview")}, {"gb", lcmd("require('dropbar.api').pick()"), desc("pick")}, {"", lcmd("require('dap').continue()"), desc("continue")}, {"", lcmd("require('dap').step_over()"), desc("step over")}, {"", lcmd("require('dap').step_into()"), desc("step into")}, {"", lcmd("require('dap').step_out()"), desc("step out")}, {"db", lcmd("require('dap').toggle_breakpoint()"), desc("dap toggle breakpoint")}, {"dB", _4_, desc("dap set breakpoint with condition")}, {"dr", lcmd("require('dap').repl.toggle()"), desc("dap toggle repl")}, {"dl", lcmd("require('dap').run_last()"), desc("dap run last")}, {"dd", cmd("ToggleDapUI"), desc("dap toggle ui")}, {"ta", cmd("CopilotChatToggle")}, {"O", cmd("Other")}}) do vim.keymap.set("n", k[1], k[2], (k[3] or opts)) end for _, k in ipairs({{"T", cmd("Translate JA")}, {"K", lcmd("require('dapui').eval()"), desc("dap evaluate expression")}, {"ta", cmd("CopilotChat")}}) do diff --git a/lua/autogen/other.lua b/lua/autogen/other.lua new file mode 100644 index 0000000..549da77 --- /dev/null +++ b/lua/autogen/other.lua @@ -0,0 +1,11 @@ +-- [nfnl] Compiled from fnl/other.fnl by https://github.com/Olical/nfnl, do not edit. +local other = require("other-nvim") +local window = require("other-nvim.helper.window") +local util = require("other-nvim.helper.util") +local builtinMappings = require("other-nvim.builtin.mappings") +local transformers = require("other-nvim.builtin.transformers") +local mappings = {"golang"} +local transformers0 = {camelToKebap = transformers.camelToKebap, kebapToCamel = transformers.kebapToCamel, pluralize = transformers.pluralize, singularize = transformers.singularize} +local keybindings = {[""] = "open_file_by_command()", [""] = "close_window()", q = "close_window()", [""] = "close_window()", o = "open_file()", t = "open_file_tabnew()", v = "open_file_vs()", s = "open_file_sp()"} +local style = {border = "none", seperator = "|", newFileIndicator = "(* new *)", width = 0.7, minHeight = 2} +return other.setup({showMissingFiles = true, rememberBuffers = true, mappings = mappings, transformers = transformers0, keybindings = keybindings, style = style}) diff --git a/main/default.nix b/main/default.nix index 08eec93..a64e5ec 100644 --- a/main/default.nix +++ b/main/default.nix @@ -166,6 +166,7 @@ let window-picker lir oil + other dotfyle-metadata copilot-chat screenkey diff --git a/main/tool.nix b/main/tool.nix index 27a1e82..952f056 100644 --- a/main/tool.nix +++ b/main/tool.nix @@ -99,6 +99,11 @@ rec { postConfig = read ../lua/autogen/oil.lua; hooks.modules = [ "oil" ]; }; + other = { + package = other-nvim; + postConfig = read ../lua/autogen/other.lua; + hooks.commands = [ "Other" ]; + }; dotfyle-metadata = { package = dotfyle-metadata-nvim; hooks.commands = [ "DotfyleGenerate" ];