- Neovim 0.10.2+ or vim 9.1.0+. Both editor need python3 support.
- Python3 with httpx installed.
pip3 install httpx[http2]
call plug#begin()
Plug 'fftyjw/DeepSeekChat.vim'
call plug#end()
"ApiKey must set for non-local models.
let g:deepseek_chat_cfg = {
\ "ApiKey": "<your api key>",
\ }:DeepSeekChatOpen- Open chat window.:DeepSeekChat- Ask a question using the text you input in the chat buffer. If there is any text visually selected, the selected text will be used. Otherwise, it will use all the text from the current line up to the separator line or the tip line (If generated by the plugin itself).:DeepSeekChatNew- Start a new chat session. This will clear the chat history.:DeepSeekChatDebug- Print debug info, include config and chat history.
In the chat buffer, these mappings are set by default. You can disable it by set g:deepseek_chat_automap to 0
-
<C-s>- Command DeepSeekChat -
<C-n>- Command DeepSeekChatNew -
<C-d>- Command DeepSeekChatDebugYou can define your own mapings like this:
let g:deepseek_chat_automap=0 function! MyDeepSeekChatMap() if bufname('%') == 'deepseekchat' nnoremap <buffer> <c-s> :<C-u>call deepseekchat#cmd('chat')<CR> inoremap <buffer> <c-s> <esc>:call deepseekchat#cmd('chat')<CR> vnoremap <buffer> <c-s> <esc>:call deepseekchat#cmd_v('chat')<CR> noremap <buffer> <c-n> :<C-u>call deepseekchat#cmd('new')<CR> inoremap <buffer> <c-n> <esc>:call deepseekchat#cmd('new')<CR> noremap <buffer> <c-d> :<C-u>call deepseekchat#cmd('debug')<CR> inoremap <buffer> <c-d> <esc>:call deepseekchat#cmd('debug')<CR> endif endfunction autocmd BufEnter * call MyDeepSeekChatMap() noremap <leader>ss :DeepSeekChatOpen<CR>
g:deepseek_chat_cfgBasic configs. Example:
"Online model
let g:deepseek_chat_cfg = {
\ "ApiKey": "xxxxxxx", "Put your api key here. This is required for non-local models.
\ "The chat buffer's filetype is 'markdown'. To render it nicely, the plugin offers 2 types of separator lines:
\ " 1: A black 2-pixel-high separator line.
\ " 2: Normal separator line.(Markdown code: ***).
\ "If this config is set to 0, there will be no separator lines.
\ "HtmlSepType": 0,
\ }
"Local model
let g:deepseek_chat_cfg = {
\ "AIServerType": "Use 'deepseek' for online models and 'ollama' for local models.
\ "Model": "xxxxxx", "Put your local model name here.
\ "HideThink": 1,
\ "HtmlSepType": 0,
\ }g:deepseek_chat_automap0: Disable auto mapping. 1: Enable auto mapping. Default 1.
