mirror of
https://github.com/mikkelsvartveit/dotfiles.git
synced 2025-12-22 19:22:38 +00:00
Add opencode
This commit is contained in:
parent
a5008165d3
commit
0b5c8ba97f
7 changed files with 97 additions and 42 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -22,6 +22,7 @@
|
||||||
!zed/settings.json
|
!zed/settings.json
|
||||||
!zed/keymap.json
|
!zed/keymap.json
|
||||||
!zed/tasks.json
|
!zed/tasks.json
|
||||||
|
!opencode/**/*
|
||||||
|
|
||||||
# Blacklist some stuff again
|
# Blacklist some stuff again
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ alias nvimconfig="cd ~/.config/nvim && nvim && cd -"
|
||||||
|
|
||||||
abbr v "nvim"
|
abbr v "nvim"
|
||||||
abbr c "claude"
|
abbr c "claude"
|
||||||
|
abbr oc "opencode"
|
||||||
abbr ws "windsurf"
|
abbr ws "windsurf"
|
||||||
abbr lg "lazygit"
|
abbr lg "lazygit"
|
||||||
abbr p "pnpm"
|
abbr p "pnpm"
|
||||||
|
|
@ -80,7 +81,8 @@ fish_add_path "$HOME/Library/pnpm" # pnpm
|
||||||
fish_add_path "$HOME/go/bin" # Go
|
fish_add_path "$HOME/go/bin" # Go
|
||||||
fish_add_path "$HOME/.cargo/bin" # Rust
|
fish_add_path "$HOME/.cargo/bin" # Rust
|
||||||
fish_add_path "$HOME/.codeium/windsurf/bin" # Windsurf
|
fish_add_path "$HOME/.codeium/windsurf/bin" # Windsurf
|
||||||
fish_add_path "$HOME/.claude/local" # Claude Code
|
fish_add_path "/opt/homebrew/opt/libpq/bin" # libpg (Postgres CLI tools)
|
||||||
|
fish_add_path "$HOME/.opencode/bin" # opencode
|
||||||
if [ -f "$HOME/Applications/google-cloud-sdk/path.fish.inc" ]; . "$HOME/Applications/google-cloud-sdk/path.fish.inc"; end # Google Cloud SDK
|
if [ -f "$HOME/Applications/google-cloud-sdk/path.fish.inc" ]; . "$HOME/Applications/google-cloud-sdk/path.fish.inc"; end # Google Cloud SDK
|
||||||
|
|
||||||
# Initialize pnpm
|
# Initialize pnpm
|
||||||
|
|
@ -102,3 +104,6 @@ source ~/.orbstack/shell/init2.fish 2>/dev/null || :
|
||||||
|
|
||||||
# Initialize zoxide
|
# Initialize zoxide
|
||||||
zoxide init fish --cmd j | source
|
zoxide init fish --cmd j | source
|
||||||
|
|
||||||
|
# Claude Code
|
||||||
|
alias claude="~/.claude/local/claude"
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,28 @@
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>AIFeatureFunctionCalling</key>
|
||||||
|
<true/>
|
||||||
|
<key>AIFeatureHostedCodeInterpeter</key>
|
||||||
|
<true/>
|
||||||
|
<key>AIFeatureHostedFileSearch</key>
|
||||||
|
<true/>
|
||||||
|
<key>AIFeatureHostedWebSearch</key>
|
||||||
|
<true/>
|
||||||
|
<key>AIFeatureStreamingResponses</key>
|
||||||
|
<true/>
|
||||||
|
<key>AITermAPI</key>
|
||||||
|
<integer>2</integer>
|
||||||
|
<key>AIVectorStore</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>AiMaxTokens</key>
|
||||||
|
<integer>1000000</integer>
|
||||||
|
<key>AiModel</key>
|
||||||
|
<string>gpt-4.1</string>
|
||||||
|
<key>AiResponseMaxTokens</key>
|
||||||
|
<integer>32768</integer>
|
||||||
|
<key>AitermURL</key>
|
||||||
|
<string>https://api.openai.com/v1/responses</string>
|
||||||
<key>AllowClipboardAccess</key>
|
<key>AllowClipboardAccess</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>AlternateMouseScroll</key>
|
<key>AlternateMouseScroll</key>
|
||||||
|
|
@ -1947,7 +1969,7 @@
|
||||||
<key>PromptOnQuit</key>
|
<key>PromptOnQuit</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>ShowFullScreenTabBar</key>
|
<key>ShowFullScreenTabBar</key>
|
||||||
<true/>
|
<false/>
|
||||||
<key>SmartPlacement</key>
|
<key>SmartPlacement</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>SoundForEsc</key>
|
<key>SoundForEsc</key>
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,9 @@ set scrolloff=4
|
||||||
set undofile
|
set undofile
|
||||||
set undodir=~/.local/share/nvim/undo
|
set undodir=~/.local/share/nvim/undo
|
||||||
|
|
||||||
|
" Don't comment out next line when creating new line
|
||||||
|
set formatoptions-=cro
|
||||||
|
|
||||||
" Allow using uppercase W and Q commands to save/quit
|
" Allow using uppercase W and Q commands to save/quit
|
||||||
command WQ wq
|
command WQ wq
|
||||||
command Wq wq
|
command Wq wq
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
"LuaSnip": { "branch": "master", "commit": "fb525166ccc30296fb3457441eb979113de46b00" },
|
"LuaSnip": { "branch": "master", "commit": "fb525166ccc30296fb3457441eb979113de46b00" },
|
||||||
"auto-session": { "branch": "main", "commit": "fffb13dcbe8731b8650e5bf1caa749a485d20556" },
|
"auto-session": { "branch": "main", "commit": "fffb13dcbe8731b8650e5bf1caa749a485d20556" },
|
||||||
"catppuccin": { "branch": "main", "commit": "fa42eb5e26819ef58884257d5ae95dd0552b9a66" },
|
"catppuccin": { "branch": "main", "commit": "fa42eb5e26819ef58884257d5ae95dd0552b9a66" },
|
||||||
"claudecode.nvim": { "branch": "main", "commit": "2603ec0b59857bb9329223f18705241dd615bbef" },
|
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
|
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
|
||||||
"code_runner.nvim": { "branch": "main", "commit": "65c8d11f507073b915f10faa88ea05bd4fbf69ce" },
|
"code_runner.nvim": { "branch": "main", "commit": "65c8d11f507073b915f10faa88ea05bd4fbf69ce" },
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "88205953bd748322b49b26e1dfb0389932520dc9" },
|
"gitsigns.nvim": { "branch": "main", "commit": "88205953bd748322b49b26e1dfb0389932520dc9" },
|
||||||
|
|
@ -20,6 +19,7 @@
|
||||||
"nvim-tree.lua": { "branch": "master", "commit": "e14989c0eaa6f9c299d48f7e45ce1ed04b21180f" },
|
"nvim-tree.lua": { "branch": "master", "commit": "e14989c0eaa6f9c299d48f7e45ce1ed04b21180f" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" },
|
"nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" },
|
||||||
|
"opencode.nvim": { "branch": "main", "commit": "0fd675bb6ae7c29ee4ff352ab421cb4f17ca7c0d" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||||
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
|
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
|
||||||
"supermaven-nvim": { "branch": "main", "commit": "07d20fce48a5629686aefb0a7cd4b25e33947d50" },
|
"supermaven-nvim": { "branch": "main", "commit": "07d20fce48a5629686aefb0a7cd4b25e33947d50" },
|
||||||
|
|
|
||||||
|
|
@ -191,50 +191,64 @@ require("lazy").setup({
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Claude Code integration
|
|
||||||
{
|
{
|
||||||
"coder/claudecode.nvim",
|
"NickvanDyke/opencode.nvim",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"folke/snacks.nvim",
|
-- Recommended for better prompt input, and required to use `opencode.nvim`'s embedded terminal — otherwise optional
|
||||||
|
{ "folke/snacks.nvim", opts = { input = { enabled = true } } },
|
||||||
},
|
},
|
||||||
opts = {
|
config = function()
|
||||||
terminal_cmd = "~/.claude/local/claude", -- Use local installation
|
vim.g.opencode_opts = {
|
||||||
|
-- Your configuration, if any — see `lua/opencode/config.lua`
|
||||||
terminal = {
|
terminal = {
|
||||||
provider = "snacks",
|
win = {
|
||||||
split_side = "right",
|
enter = true,
|
||||||
split_width_percentage = 0.4,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
config = true,
|
}
|
||||||
init = function()
|
|
||||||
vim.keymap.set(
|
|
||||||
{ "n", "v", "i", "t" },
|
|
||||||
"<C-,>",
|
|
||||||
"<cmd>ClaudeCodeFocus<CR>",
|
|
||||||
{ noremap = true, silent = true }
|
|
||||||
)
|
|
||||||
|
|
||||||
vim.keymap.set(
|
-- Required for `opts.auto_reload`
|
||||||
{ "n", "v", "i", "t" },
|
vim.opt.autoread = true
|
||||||
"<C-.>",
|
|
||||||
"<cmd>ClaudeCodeSend<CR>",
|
|
||||||
{ noremap = true, silent = true }
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Update buffer when Claude Code has made changes
|
-- Recommended keymaps
|
||||||
vim.api.nvim_create_autocmd({
|
vim.keymap.set("n", "<leader>at", function()
|
||||||
"BufEnter",
|
require("opencode").toggle()
|
||||||
"BufWinEnter",
|
end, { desc = "Toggle" })
|
||||||
}, {
|
vim.keymap.set("n", "<leader>aA", function()
|
||||||
group = augroup,
|
require("opencode").ask()
|
||||||
pattern = "*",
|
end, { desc = "Ask" })
|
||||||
callback = function()
|
vim.keymap.set("n", "<leader>aa", function()
|
||||||
if vim.fn.filereadable(vim.fn.expand("%")) == 1 then
|
require("opencode").ask("@cursor: ")
|
||||||
vim.cmd("checktime")
|
end, { desc = "Ask about this" })
|
||||||
end
|
vim.keymap.set("v", "<leader>aa", function()
|
||||||
end,
|
require("opencode").ask("@selection: ")
|
||||||
desc = "Check for file changes on disk",
|
end, { desc = "Ask about selection" })
|
||||||
})
|
vim.keymap.set("n", "<leader>a+", function()
|
||||||
|
require("opencode").append_prompt("@buffer")
|
||||||
|
end, { desc = "Add buffer to prompt" })
|
||||||
|
vim.keymap.set("v", "<leader>a+", function()
|
||||||
|
require("opencode").append_prompt("@selection")
|
||||||
|
end, { desc = "Add selection to prompt" })
|
||||||
|
vim.keymap.set("n", "<leader>an", function()
|
||||||
|
require("opencode").command("session_new")
|
||||||
|
end, { desc = "New session" })
|
||||||
|
vim.keymap.set("n", "<leader>ay", function()
|
||||||
|
require("opencode").command("messages_copy")
|
||||||
|
end, { desc = "Copy last response" })
|
||||||
|
vim.keymap.set("n", "<S-C-u>", function()
|
||||||
|
require("opencode").command("messages_half_page_up")
|
||||||
|
end, { desc = "Messages half page up" })
|
||||||
|
vim.keymap.set("n", "<S-C-d>", function()
|
||||||
|
require("opencode").command("messages_half_page_down")
|
||||||
|
end, { desc = "Messages half page down" })
|
||||||
|
vim.keymap.set({ "n", "v" }, "<leader>as", function()
|
||||||
|
require("opencode").select()
|
||||||
|
end, { desc = "Select prompt" })
|
||||||
|
|
||||||
|
-- Toggle with Ctrl + ,
|
||||||
|
vim.keymap.set({ "n", "v", "i", "t" }, "<C-,>", function()
|
||||||
|
require("opencode").toggle()
|
||||||
|
end, { desc = "Toggle" })
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
10
opencode/opencode.json
Normal file
10
opencode/opencode.json
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://opencode.ai/config.json",
|
||||||
|
"mcp": {
|
||||||
|
"context7": {
|
||||||
|
"type": "remote",
|
||||||
|
"url": "https://mcp.context7.com/mcp",
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue