diff --git a/lazy-lock.json b/lazy-lock.json index 392f362..61727b0 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -23,6 +23,7 @@ "nvim-treesitter": { "branch": "main", "commit": "6620ae1c44dfa8623b22d0cbf873a9e8d073b849" }, "nvim-ts-autotag": { "branch": "main", "commit": "8e1c0a389f20bf7f5b0dd0e00306c1247bda2595" }, "nvim-web-devicons": { "branch": "master", "commit": "d7462543c9e366c0d196c7f67a945eaaf5d99414" }, + "opencode.nvim": { "branch": "main", "commit": "1088ee70dd997d785a1757d351c07407f0abfc9f" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, "sg.nvim": { "branch": "master", "commit": "775f22b75a9826eabf69b0094dd1d51d619fe552" }, diff --git a/lua/chadrc.lua b/lua/chadrc.lua index 627586e..a9d5024 100644 --- a/lua/chadrc.lua +++ b/lua/chadrc.lua @@ -1,24 +1,47 @@ --- This file needs to have same structure as nvconfig.lua -- https://github.com/NvChad/ui/blob/v3.0/lua/nvconfig.lua --- Please read that file to know all available options :( ---@type ChadrcConfig local M = {} M.base46 = { - theme = "radium", + theme = "radium", - -- hl_override = { - -- Comment = { italic = true }, - -- ["@comment"] = { italic = true }, - -- }, + hl_override = { + Comment = { italic = true }, + ["@comment"] = { italic = true }, + }, } --- M.nvdash = { load_on_startup = true } --- M.ui = { --- tabufline = { --- lazyload = false --- } --- } +M.ui = { + telescope = { style = "bordered" }, + statusline = { + order = { "mode", "file", "git", "%=", "lsp_msg", "%=", "diagnostics", "cwd", "cursor" }, + }, +} + +M.nvdash = { + load_on_startup = true, + buttons = { + { txt = " Find File", keys = "ff", cmd = "Telescope find_files" }, + { txt = " Recent Files", keys = "fo", cmd = "Telescope oldfiles" }, + { txt = "󰈭 Find Word", keys = "fw", cmd = "Telescope live_grep" }, + { txt = " Neogit", keys = "gl", cmd = "Neogit" }, + + { txt = "─", hl = "NvDashFooter", no_gap = true, rep = true }, + + { + txt = function() + local stats = require("lazy").stats() + local ms = math.floor(stats.startuptime) .. " ms" + return " Loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms + end, + hl = "NvDashFooter", + no_gap = true, + content = "fit", + }, + + { txt = "─", hl = "NvDashFooter", no_gap = true, rep = true }, + }, +} return M diff --git a/lua/mappings.lua b/lua/mappings.lua index 783b78f..2d17040 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -4,6 +4,11 @@ require "nvchad.mappings" local map = vim.keymap.set +vim.g.copilot_no_tab_map = true +vim.keymap.set("i", "", function() + vim.fn.feedkeys(vim.fn["copilot#Accept"](), "") +end, { expr = true }) + map("n", ";", ":", { desc = "CMD enter command mode" }) map("i", "jk", "") diff --git a/lua/options.lua b/lua/options.lua index 39d12ab..8da367f 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -13,3 +13,5 @@ vim.api.nvim_create_autocmd("FileType", { vim.keymap.set("v", "<", "", ">gv", { desc = "Keep selection after indent" }) + +vim.opt.shell = "fish" diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index d58e57b..2b503db 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -150,4 +150,80 @@ return { "github/copilot.vim", lazy = false, }, + + { + "nickjvandyke/opencode.nvim", + version = "*", -- Latest stable release + lazy = false, + dependencies = { + { + "folke/snacks.nvim", + optional = true, + opts = { + input = {}, -- Enhances `ask()` + picker = { -- Enhances `select()` + actions = { + opencode_send = function(...) + return require("opencode").snacks_picker_send(...) + end, + }, + win = { + input = { + keys = { + [""] = { "opencode_send", mode = { "n", "i" } }, + }, + }, + }, + }, + }, + }, + }, + config = function() + ---@type opencode.Opts + vim.g.opencode_opts = { + -- Your configuration, if any; goto definition on the type or field for details + } + + vim.o.autoread = true -- Required for `opts.events.reload` + + local o = function() + return require "opencode" + end + + -- Toggle Opencode panel + vim.keymap.set({ "n", "t" }, "ct", function() + o().toggle() + end, { desc = "Opencode: Toggle panel" }) + + -- Ask (submit selection) + vim.keymap.set({ "n", "x" }, "ca", function() + o().ask("@this: ", { submit = true }) + end, { desc = "Opencode: Ask selection" }) + + -- Execute action + vim.keymap.set({ "n", "x" }, "ce", function() + o().select() + end, { desc = "Opencode: Execute action" }) + + -- Send selection + vim.keymap.set({ "n", "x" }, "cs", function() + return o().operator "@this " + end, { expr = true, desc = "Opencode: Send selection" }) + + -- Send current line + vim.keymap.set("n", "cl", function() + return o().operator "@this " .. "_" + end, { expr = true, desc = "Opencode: Send line" }) + + -- Scroll up in Opencode panel + vim.keymap.set("n", "cu", function() + o().command "session.half.page.up" + end, { desc = "Opencode: Scroll up" }) + + -- Scroll down in Opencode panel + vim.keymap.set("n", "cd", function() + o().command "session.half.page.down" + end, { desc = "Opencode: Scroll down" }) + end, + }, }