From 711fa5af01fd91b21289cb5feeda608384f432c1 Mon Sep 17 00:00:00 2001 From: StuartStephens Date: Sun, 19 Oct 2025 22:23:22 -0400 Subject: [PATCH] update config from opencode --- init.lua | 2 + lazy-lock.json | 3 +- lua/custom/keymaps.lua | 65 +++++++++++++++ lua/custom/options.lua | 44 ++++++++++ lua/custom/plugins/copilot.lua | 3 - lua/custom/plugins/harpoon-remaps.lua | 20 ----- lua/custom/plugins/harpoon.lua | 18 ++++ lua/custom/plugins/init.lua | 113 -------------------------- lua/custom/plugins/nvim-surround.lua | 10 --- lua/custom/plugins/opencode.lua | 48 +++++++++++ 10 files changed, 179 insertions(+), 147 deletions(-) create mode 100644 lua/custom/keymaps.lua create mode 100644 lua/custom/options.lua delete mode 100644 lua/custom/plugins/copilot.lua delete mode 100644 lua/custom/plugins/harpoon-remaps.lua delete mode 100644 lua/custom/plugins/nvim-surround.lua create mode 100644 lua/custom/plugins/opencode.lua diff --git a/init.lua b/init.lua index 678cc2af..742e3320 100644 --- a/init.lua +++ b/init.lua @@ -1037,3 +1037,5 @@ require('lazy').setup({ -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et +require 'custom.options' +require 'custom.keymaps' diff --git a/lazy-lock.json b/lazy-lock.json index 39ee3f9f..a13574a7 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -36,11 +36,12 @@ "nvim-lspconfig": { "branch": "master", "commit": "ac98db2f9f06a56498ec890a96928774eae412c3" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" }, - "nvim-surround": { "branch": "main", "commit": "a868c256c861044beb9794b4dd126480dcdfbdad" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-treesitter-context": { "branch": "master", "commit": "41847d3dafb5004464708a3db06b14f12bde548a" }, "nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" }, + "opencode.nvim": { "branch": "main", "commit": "4393e41377289eb8e9bdd6851b7ce7c2112e1627" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "snacks.nvim": { "branch": "main", "commit": "a0df15ebcdbb540980f3dcc1795626dc134c656a" }, "solarized-osaka.nvim": { "branch": "main", "commit": "f796014c14b1910e08d42cc2077fef34f08e0295" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, diff --git a/lua/custom/keymaps.lua b/lua/custom/keymaps.lua new file mode 100644 index 00000000..a24190b5 --- /dev/null +++ b/lua/custom/keymaps.lua @@ -0,0 +1,65 @@ +local opts = { noremap = true, silent = true } + +local keymap = vim.keymap.set + +-- Exit file +-- vim.keymap.set("n", "pv", vim.cmd.Ex) +-- vim.api.nvim_set_keymap('n', 'pv', ':bd', { noremap = true, silent = true }) +-- Vertical Movement +vim.keymap.set('n', '', 'zz') +vim.keymap.set('n', '', 'zz') +vim.keymap.set('n', 'n', 'nzzzv') +vim.keymap.set('n', 'N', 'Nzzzv') + +-- Better window navigation +keymap('n', '', 'h', opts) +keymap('n', '', 'j', opts) +keymap('n', '', 'k', opts) +keymap('n', '', 'l', opts) + +-- Resize with arrows +keymap('n', '', ':resize -2', opts) +keymap('n', '', ':resize +2', opts) +keymap('n', '', ':vertical resize -2', opts) +keymap('n', '', ':vertical resize +2', opts) + +-- Navigate buffers +keymap('n', '', ':bnext', opts) +keymap('n', '', ':bprevious', opts) + +-- Move text up and down +keymap('n', '', ':m .+1==', opts) +keymap('n', '', ':m .-2==', opts) + +-- Insert -- +-- Press jk fast to exit insert mode +keymap('i', 'jk', '', opts) +keymap('i', 'kj', '', opts) + +-- Visual -- +-- Press jk fast to exit visual mode +keymap('v', 'jk', '', opts) +keymap('v', 'kj', '', opts) + +-- Stay in indent mode +keymap('v', '<', '', '>gv^', opts) + +-- Move text up and down +keymap('v', '', ":m '>+1gv=gv", opts) +keymap('v', '', ":m '<-2gv=gv", opts) +keymap('v', 'p', '"_dP', opts) + +-- Visual Block -- +-- Move text up and down +keymap('x', 'J', ":m '>+1gv=gv", opts) +keymap('x', 'K', ":m '<-2gv=gv", opts) +keymap('x', '', ":m '>+1gv=gv", opts) +keymap('x', '', ":m '<-2gv=gv", opts) + +-- Don't yank when deleting -- +keymap('n', 'd', '"_d', opts) + +-- Quickfix Step File -- +keymap('n', '', ':cnext', opts) +keymap('n', '', ':cprev', opts) diff --git a/lua/custom/options.lua b/lua/custom/options.lua new file mode 100644 index 00000000..0676501b --- /dev/null +++ b/lua/custom/options.lua @@ -0,0 +1,44 @@ +-- set termguicolors to enable highlight groups +vim.opt.termguicolors = true + +-- Kickstart stuff? +vim.opt.guicursor = '' + +vim.opt.nu = true +vim.opt.relativenumber = true + +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + +vim.opt.smartindent = true + +vim.opt.wrap = false + +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = os.getenv 'HOME' .. '/.vim/undodir' +vim.opt.undofile = true + +vim.opt.hlsearch = false +vim.opt.incsearch = true + +vim.opt.termguicolors = true + +vim.opt.scrolloff = 12 +vim.opt.signcolumn = 'yes' +vim.opt.isfname:append '@-@' + +vim.opt.updatetime = 50 + +vim.opt.colorcolumn = '80' + +-- Neorg settings -- +vim.opt.foldmethod = 'indent' +vim.opt.foldlevelstart = 1 +vim.opt.conceallevel = 1 +vim.opt.concealcursor = 'nc' + +-- Neovim config for inline hints +vim.lsp.inlay_hint.enable(true) diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua deleted file mode 100644 index 1a30a93c..00000000 --- a/lua/custom/plugins/copilot.lua +++ /dev/null @@ -1,3 +0,0 @@ -return { - -- 'github/copilot.vim', -} diff --git a/lua/custom/plugins/harpoon-remaps.lua b/lua/custom/plugins/harpoon-remaps.lua deleted file mode 100644 index 3175038b..00000000 --- a/lua/custom/plugins/harpoon-remaps.lua +++ /dev/null @@ -1,20 +0,0 @@ -local mark = require 'harpoon.mark' -local ui = require 'harpoon.ui' - -vim.keymap.set('n', 'pa', mark.add_file) -vim.keymap.set('n', '', ui.toggle_quick_menu) - -vim.keymap.set('n', '', function() - ui.nav_file(1) -end) -vim.keymap.set('n', '', function() - ui.nav_file(2) -end) -vim.keymap.set('n', '', function() - ui.nav_file(3) -end) -vim.keymap.set('n', '', function() - ui.nav_file(4) -end) - -return {} diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua index bd34a525..74da576e 100644 --- a/lua/custom/plugins/harpoon.lua +++ b/lua/custom/plugins/harpoon.lua @@ -3,5 +3,23 @@ return { dependencies = { 'nvim-lua/plenary.nvim' }, config = function() require('harpoon').setup {} + local mark = require 'harpoon.mark' + local ui = require 'harpoon.ui' + + vim.keymap.set('n', 'pa', mark.add_file) + vim.keymap.set('n', '', ui.toggle_quick_menu) + + vim.keymap.set('n', '', function() + ui.nav_file(1) + end) + vim.keymap.set('n', '', function() + ui.nav_file(2) + end) + vim.keymap.set('n', '', function() + ui.nav_file(3) + end) + vim.keymap.set('n', '', function() + ui.nav_file(4) + end) end, } diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 6d8365a5..be0eb9d8 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,117 +2,4 @@ -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information - --- disable netrw at the very start of your init.lua -vim.g.loaded_netrw = 1 -vim.g.loaded_netrwPlugin = 1 - --- set termguicolors to enable highlight groups -vim.opt.termguicolors = true - --- Kickstart stuff? -vim.opt.guicursor = '' - -vim.opt.nu = true -vim.opt.relativenumber = true - -vim.opt.tabstop = 4 -vim.opt.softtabstop = 4 -vim.opt.shiftwidth = 4 -vim.opt.expandtab = true - -vim.opt.smartindent = true - -vim.opt.wrap = false - -vim.opt.swapfile = false -vim.opt.backup = false -vim.opt.undodir = os.getenv 'HOME' .. '/.vim/undodir' -vim.opt.undofile = true - -vim.opt.hlsearch = false -vim.opt.incsearch = true - -vim.opt.termguicolors = true - -vim.opt.scrolloff = 12 -vim.opt.signcolumn = 'yes' -vim.opt.isfname:append '@-@' - -vim.opt.updatetime = 50 - -vim.opt.colorcolumn = '80' - -local opts = { noremap = true, silent = true } - -local keymap = vim.keymap.set - --- Exit file --- vim.keymap.set("n", "pv", vim.cmd.Ex) --- vim.api.nvim_set_keymap('n', 'pv', ':bd', { noremap = true, silent = true }) --- Vertical Movement -vim.keymap.set('n', '', 'zz') -vim.keymap.set('n', '', 'zz') -vim.keymap.set('n', 'n', 'nzzzv') -vim.keymap.set('n', 'N', 'Nzzzv') - --- Better window navigation -keymap('n', '', 'h', opts) -keymap('n', '', 'j', opts) -keymap('n', '', 'k', opts) -keymap('n', '', 'l', opts) - --- Resize with arrows -keymap('n', '', ':resize -2', opts) -keymap('n', '', ':resize +2', opts) -keymap('n', '', ':vertical resize -2', opts) -keymap('n', '', ':vertical resize +2', opts) - --- Navigate buffers -keymap('n', '', ':bnext', opts) -keymap('n', '', ':bprevious', opts) - --- Move text up and down -keymap('n', '', ':m .+1==', opts) -keymap('n', '', ':m .-2==', opts) - --- Insert -- --- Press jk fast to exit insert mode -keymap('i', 'jk', '', opts) -keymap('i', 'kj', '', opts) - --- Visual -- --- Press jk fast to exit visual mode -keymap('v', 'jk', '', opts) -keymap('v', 'kj', '', opts) - --- Stay in indent mode -keymap('v', '<', '', '>gv^', opts) - --- Move text up and down -keymap('v', '', ":m '>+1gv=gv", opts) -keymap('v', '', ":m '<-2gv=gv", opts) -keymap('v', 'p', '"_dP', opts) - --- Visual Block -- --- Move text up and down -keymap('x', 'J', ":m '>+1gv=gv", opts) -keymap('x', 'K', ":m '<-2gv=gv", opts) -keymap('x', '', ":m '>+1gv=gv", opts) -keymap('x', '', ":m '<-2gv=gv", opts) - --- Don't yank when deleting -- -keymap('n', 'd', '"_d', opts) - --- Quickfix Step File -- -keymap('n', '', ':cnext', opts) -keymap('n', '', ':cprev', opts) - --- Neorg settings -- -vim.opt.foldmethod = 'indent' -vim.opt.foldlevelstart = 1 -vim.opt.conceallevel = 1 -vim.opt.concealcursor = 'nc' - return {} diff --git a/lua/custom/plugins/nvim-surround.lua b/lua/custom/plugins/nvim-surround.lua deleted file mode 100644 index e32286cc..00000000 --- a/lua/custom/plugins/nvim-surround.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - 'kylechui/nvim-surround', - version = '*', -- Use for stability; omit to use `main` branch for the latest features - event = 'VeryLazy', - config = function() - require('nvim-surround').setup { - -- Configuration here, or leave empty to use defaults - } - end, -} diff --git a/lua/custom/plugins/opencode.lua b/lua/custom/plugins/opencode.lua new file mode 100644 index 00000000..5f412d33 --- /dev/null +++ b/lua/custom/plugins/opencode.lua @@ -0,0 +1,48 @@ +return { + 'NickvanDyke/opencode.nvim', + dependencies = { + -- Recommended for `ask()` and `select()`. + -- Required for `toggle()`. + { 'folke/snacks.nvim', opts = { input = {}, picker = {} } }, + }, + config = function() + vim.g.opencode_opts = { + -- Your configuration, if any — see `lua/opencode/config.lua` + } + + -- Required for `vim.g.opencode_opts.auto_reload` + vim.opt.autoread = true + + -- Recommended/example keymaps + vim.keymap.set({ 'n', 'x' }, 'oa', function() + require('opencode').ask('@this: ', { submit = true }) + end, { desc = 'Ask about this' }) + vim.keymap.set({ 'n', 'x' }, 'os', function() + require('opencode').select() + end, { desc = 'Select prompt' }) + vim.keymap.set({ 'n', 'x' }, 'o+', function() + require('opencode').prompt '@this' + end, { desc = 'Add this' }) + vim.keymap.set('n', 'ot', function() + require('opencode').toggle() + end, { desc = 'Toggle embedded' }) + vim.keymap.set('n', 'oc', function() + require('opencode').command() + end, { desc = 'Select command' }) + vim.keymap.set('n', 'on', function() + require('opencode').command 'session_new' + end, { desc = 'New session' }) + vim.keymap.set('n', 'oi', function() + require('opencode').command 'session_interrupt' + end, { desc = 'Interrupt session' }) + vim.keymap.set('n', 'oA', function() + require('opencode').command 'agent_cycle' + end, { desc = 'Cycle selected agent' }) + vim.keymap.set('n', '', function() + require('opencode').command 'messages_half_page_up' + end, { desc = 'Messages half page up' }) + vim.keymap.set('n', '', function() + require('opencode').command 'messages_half_page_down' + end, { desc = 'Messages half page down' }) + end, +}