add chat-gpt and keybindings

This commit is contained in:
sudacode 2023-02-16 10:26:53 -08:00
parent 76c6d58af4
commit 49a154aa32
3 changed files with 69 additions and 2 deletions

View File

@ -51,7 +51,7 @@ nmap <leader>cd :Telescope diagnostics<CR>
nmap <leader>cp :vert Copilot panel<CR>
nmap <leader>cs :lua require("copilot.suggestion").toggle_auto_trigger()<CR>
nnoremap <leader>fb :Telescope buffers<cr>
nnoremap <leader>fb :Telescope file_browser<cr>
nnoremap <leader>ff :Telescope find_files<cr>
nnoremap <leader>fg :Telescope live_grep<cr>
nnoremap <leader>fh :Telescope oldfiles<cr>
@ -93,6 +93,7 @@ nmap <leader>lw :Telescope lsp_dynamic_workspace_symbols<CR>
nmap <leader>n :NvimTreeToggle<CR>
nmap <leader>ob :Telescope file_browser<CR>
nmap <leader>oc :ChatGPT<CR>
nmap <leader>oB :FloatermNew --title=bpytop --opener=vsplit bpytop<CR>
nmap <leader>od :FloatermNew --title=lazydocker --opener=vsplit lazydocker<CR>
nmap <leader>of :wa<CR>:FloatermToggle floatterm<CR>

View File

@ -240,4 +240,70 @@ require('packer').startup(function(use)
use {
'projekt0n/github-nvim-theme'
}
use({
"jackMort/ChatGPT.nvim",
config = function()
require("chatgpt").setup({
welcome_message = WELCOME_MESSAGE, -- set to "" if you don't like the fancy robot
loading_text = "loading",
question_sign = "", -- you can use emoji if you want e.g. 🙂
answer_sign = "", -- 🤖
max_line_length = 120,
yank_register = "+",
chat_layout = {
relative = "editor",
position = "50%",
size = {
height = "80%",
width = "80%",
},
},
chat_window = {
filetype = "chatgpt",
border = {
highlight = "FloatBorder",
style = "rounded",
text = {
top = " ChatGPT ",
},
},
},
chat_input = {
prompt = "",
border = {
highlight = "FloatBorder",
style = "rounded",
text = {
top_align = "center",
top = " Prompt ",
},
},
win_options = {
winhighlight = "Normal:Normal",
},
},
openai_params = {
model = "text-davinci-003",
frequency_penalty = 0,
presence_penalty = 0,
max_tokens = 300,
temperature = 0,
top_p = 1,
n = 1,
},
keymaps = {
close = "<C-c>",
yank_last = "<C-y>",
scroll_up = "<C-u>",
scroll_down = "<C-d>",
}
}
)end,
requires = {
"MunifTanjim/nui.nvim",
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim"
}
})
end)

View File

@ -7,7 +7,7 @@ require("null-ls").setup({
vim.cmd([[
augroup LspFormatting
autocmd! * <buffer>
autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()
autocmd BufWritePre <buffer> lua vim.lsp.buf.format()
augroup END
]])
end