-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc.dev
141 lines (130 loc) · 3.46 KB
/
vimrc.dev
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
lua << EOF
-- Read Claude API key from ~/.claude
local claude_key = ''
local key_file = io.open(os.getenv('HOME') .. '/.claude', '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('avante_lib').load()
require('render-markdown').setup({
file_types = {"markdown", "Avante"}
})
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
claude = {
endpoint = "https://api.anthropic.com",
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>at :AvanteToggle<CR>
nmap <Leader>af :AvanteFocus<CR>
set noautochdir
set signcolumn=yes
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