diff --git a/helix/config.toml b/helix/config.toml new file mode 100644 index 0000000..ee8eee9 --- /dev/null +++ b/helix/config.toml @@ -0,0 +1 @@ +theme = "theme" diff --git a/helix/themes/theme.toml b/helix/themes/theme.toml new file mode 100644 index 0000000..746d4b7 --- /dev/null +++ b/helix/themes/theme.toml @@ -0,0 +1,4 @@ +inherits = "catppuccin_mocha" + +"ui.background" = {} +"ui.statusline" = {} diff --git a/yazi/keymap.toml b/yazi/keymap.toml new file mode 100644 index 0000000..2286d19 --- /dev/null +++ b/yazi/keymap.toml @@ -0,0 +1,4 @@ +[[mgr.prepend_keymap]] +on = [ "g", "i" ] +run = "plugin lazygit" +desc = "run lazygit" diff --git a/yazi/package.toml b/yazi/package.toml new file mode 100644 index 0000000..a392915 --- /dev/null +++ b/yazi/package.toml @@ -0,0 +1,7 @@ +[[plugin.deps]] +use = "Lil-Dank/lazygit" +rev = "8f37dc5" +hash = "ee71543790f0ce3951161045a3787abd" + +[flavor] +deps = [] diff --git a/yazi/plugins/lazygit.yazi/LICENSE b/yazi/plugins/lazygit.yazi/LICENSE new file mode 100644 index 0000000..ae1f60d --- /dev/null +++ b/yazi/plugins/lazygit.yazi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Darius + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/yazi/plugins/lazygit.yazi/README.md b/yazi/plugins/lazygit.yazi/README.md new file mode 100644 index 0000000..5ce8f24 --- /dev/null +++ b/yazi/plugins/lazygit.yazi/README.md @@ -0,0 +1,29 @@ +# lazygit.yazi +Plugin for [Yazi](https://github.com/sxyazi/yazi) to manage git repos with [lazygit](https://github.com/jesseduffield/lazygit) +## Dependencies +Make sure [lazygit](https://github.com/jesseduffield/lazygit) is installed and in your `PATH`. +## Installation + +### Using `ya pkg` +``` + ya pkg add Lil-Dank/lazygit +``` + +### Manual +**Linux/macOS** +``` +git clone https://github.com/Lil-Dank/lazygit.yazi.git ~/.config/yazi/plugins/lazygit.yazi +``` +**Windows** +``` +git clone https://github.com/Lil-Dank/lazygit.yazi.git %AppData%\yazi\config\plugins\lazygit.yazi +``` +## Configuration +add this to your **keymap.toml** file +```toml +[[mgr.prepend_keymap]] +on = [ "g", "i" ] +run = "plugin lazygit" +desc = "run lazygit" +``` +you can customize the keybinding however you like. Please refer to the [keymap.toml](https://yazi-rs.github.io/docs/configuration/keymap) documentation diff --git a/yazi/plugins/lazygit.yazi/main.lua b/yazi/plugins/lazygit.yazi/main.lua new file mode 100644 index 0000000..32d7f18 --- /dev/null +++ b/yazi/plugins/lazygit.yazi/main.lua @@ -0,0 +1,31 @@ +return { + entry = function() + local output = Command("git"):arg("status"):stderr(Command.PIPED):output() + if output.stderr ~= "" then + ya.notify({ + title = "lazygit", + content = "Not in a git directory\nError: " .. output.stderr, + level = "warn", + timeout = 5, + }) + else + permit = ya.hide() + local output, err_code = Command("lazygit"):stderr(Command.PIPED):output() + if err_code ~= nil then + ya.notify({ + title = "Failed to run lazygit command", + content = "Status: " .. err_code, + level = "error", + timeout = 5, + }) + elseif not output.status.success then + ya.notify({ + title = "lazygit in" .. cwd .. "failed, exit code " .. output.status.code, + content = output.stderr, + level = "error", + timeout = 5, + }) + end + end + end, +}