-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc.dev
More file actions
220 lines (203 loc) · 4.97 KB
/
vimrc.dev
File metadata and controls
220 lines (203 loc) · 4.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
lua << EOF
-- Read Claude API key from ~/.claude-key
local claude_key = ''
local key_file = io.open(os.getenv('HOME') .. '/.claude-key', 'r')
if key_file then
claude_key = key_file:read('*all'):gsub('%s+', '') -- Remove whitespace
key_file:close()
vim.env.ANTHROPIC_API_KEY = claude_key
end
require('codecompanion').setup({
adapters = {
http = {
anthropic = function()
return require("codecompanion.adapters").extend("anthropic", {
env = {
api_key = "ANTHROPIC_API_KEY",
},
})
end,
},
},
strategies = {
chat = {
tools = {
opts = {
default_tools = {
"insert_edit_into_file"
}
}
},
}
},
display = {
chat = {
window = {
position = "right",
width = 0.3
}
},
diff = {
enabled = true,
provider = "inline",
provider_opts = {
inline = {
layout = "buffer"
}
}
}
},
keymaps = {
completion = {
modes = { i = "<C-=>" },
index = 1,
callback = "keymaps.completion",
description = "[Chat] Completion menu",
}
}
})
--require('claudecode').setup({
-- dependencies = { "folke/snacks.nvim" },
-- config = true,
-- {
-- "<leader>as",
-- "<cmd>ClaudeCodeTreeAdd<cr>",
-- desc = "Add file",
-- ft = { "NvimTree", "neo-tree", "oil", "minifiles", "netrw" },
-- },
--})
--require('avante_lib').load()
--"require('avante').setup({
--" ---@alias Provider "claude" | "openai" | "azure" | "gemini" | "cohere" | "copilot" | string
--" provider = "claude", -- Recommend using Claude
--" auto_suggestions_provider = "openai", -- Since auto-suggestions are a high-frequency operation and therefore expensive, it is recommended to specify an inexpensive provider or even a free provider: copilot
--" providers = {
--" claude = {
-- endpoint = "https://api.anthropic.com",
-- disable_tools = true,
-- extra_request_body = {
-- temperature = 0,
-- max_tokens = 4096,
-- },
-- },
-- },
-- behaviour = {
-- auto_suggestions = false, -- Experimental stage
-- auto_set_highlight_group = true,
-- auto_set_keymaps = true,
-- auto_apply_diff_after_generation = false,
-- support_paste_from_clipboard = false,
-- }
--})
EOF
"nmap <Leader>ac :ClaudeCode<cr>
"nmap <Leader>af :ClaudeCodeFocus<cr>
"nmap <leader>ar :ClaudeCode --resume<cr>
"nmap <leader>aC :ClaudeCode --continue<cr>
"nmap <leader>am :ClaudeCodeSelectModel<cr>
"nmap <leader>ab :ClaudeCodeAdd %<cr>
"vmap <leader>as :ClaudeCodeSend<cr>
"nmap <leader>aa :ClaudeCodeDiffAccept<cr>
"nmap <leader>ad :ClaudeCodeDiffDeny<cr>
"nmap <Leader>at :AvanteToggle<CR>
"nmap <Leader>af :AvanteFocus<CR>
nmap <Leader>aa :CodeCompanion
vmap <Leader>aa :CodeCompanion
nmap <Leader>ac :CodeCompanionChat<CR>
set noautochdir
set signcolumn=yes:1
set noshowmode
" lua << EOF
" require('copilot').setup({
" panel = {
" enabled = false,
" auto_refresh = true,
" keymap = {
" jump_prev = "[[",
" jump_next = "]]",
" accept = "<CR>",
" refresh = "ga",
" open = "<M-CR>"
" },
" layout = {
" position = "bottom", -- | top | left | right
" ratio = 0.4
" },
" },
" suggestion = {
" enabled = false,
" auto_trigger = false,
" hide_during_completion = true,
" debounce = 75,
" keymap = {
" accept = "<M-l>",
" accept_word = false,
" accept_line = false,
" next = "<C-]>",
" prev = "<C-[>",
" dismiss = "<C-0>",
" },
" },
" filetypes = {
" yaml = false,
" markdown = false,
" help = false,
" gitcommit = false,
" gitrebase = false,
" hgcommit = false,
" svn = false,
" cvs = false,
" ["."] = false,
" },
" copilot_node_command = 'node', -- Node.js version must be > 18.x
" server_opts_overrides = {},
" })
" EOF
" call coc#config('python', {'pythonPath': split(execute('!which python'), '\n')[-1]})
" nmap <silent> gd <Plug>(coc-definition)
" nmap <silent> gy <Plug>(coc-type-definition)
" nmap <silent> gt <Plug>(coc-implementation)
" nmap <silent> gr <Plug>(coc-references)
nmap <silent> gd :lua vim.lsp.buf.definition()<CR>
nmap <silent> gr :lua vim.lsp.buf.references()<CR>
" Goto definition in a new window
nmap <C-w>gd <C-w>sgd
echo "Dev mode enabled"
" Use K to show documentation in preview window
" nnoremap <silent> K :call <SID>show_documentation()<CR>
" function! s:show_documentation()
" if (index(['vim','help'], &filetype) >= 0)
" execute 'h '.expand('<cword>')
" else
" call CocAction('doHover')
" endif
" endfunction
function! SwitchSourceHeader()
if (expand ("%:e") == "cpp")
try
find %:t:r.h
catch
find %:t:r.hpp
endtry
elseif (expand ("%:e") == "h")
try
find %:t:r.cpp
catch
find %:t:r.hpp
endtry
else
try
find %:t:r.h
catch
find %:t:r.cpp
endtry
endif
endfunction
nmap <Leader>o :call SwitchSourceHeader()<CR>
" Use 'go' to enter a search for the word under the cursor after switching
" source-header
nmap go *<Leader>oggn
nmap <Leader>m :Gdiffsplit!<CR>
command! Gconflicts silent grep! "<<< HEAD" | copen
" When auto-highlight is on, hlsearch is just obstructive
set nohlsearch