From 49a154aa32779ce6fabfdf3b0977a5e4eefb0b78 Mon Sep 17 00:00:00 2001 From: sudacode Date: Thu, 16 Feb 2023 10:26:53 -0800 Subject: [PATCH] add chat-gpt and keybindings --- keybindings.vim | 3 +- lua/plugins.lua | 66 ++++++++++++++++++++++++++++++++++++++++ plugin-confs/null-ls.lua | 2 +- 3 files changed, 69 insertions(+), 2 deletions(-) diff --git a/keybindings.vim b/keybindings.vim index bb0c7cb..6b1cc84 100644 --- a/keybindings.vim +++ b/keybindings.vim @@ -51,7 +51,7 @@ nmap cd :Telescope diagnostics nmap cp :vert Copilot panel nmap cs :lua require("copilot.suggestion").toggle_auto_trigger() -nnoremap fb :Telescope buffers +nnoremap fb :Telescope file_browser nnoremap ff :Telescope find_files nnoremap fg :Telescope live_grep nnoremap fh :Telescope oldfiles @@ -93,6 +93,7 @@ nmap lw :Telescope lsp_dynamic_workspace_symbols nmap n :NvimTreeToggle nmap ob :Telescope file_browser +nmap oc :ChatGPT nmap oB :FloatermNew --title=bpytop --opener=vsplit bpytop nmap od :FloatermNew --title=lazydocker --opener=vsplit lazydocker nmap of :wa:FloatermToggle floatterm diff --git a/lua/plugins.lua b/lua/plugins.lua index 6f2a611..04a34b5 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -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 = "", + yank_last = "", + scroll_up = "", + scroll_down = "", + } + } + )end, + requires = { + "MunifTanjim/nui.nvim", + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope.nvim" + } + }) end) diff --git a/plugin-confs/null-ls.lua b/plugin-confs/null-ls.lua index ff9843c..16f77ba 100644 --- a/plugin-confs/null-ls.lua +++ b/plugin-confs/null-ls.lua @@ -7,7 +7,7 @@ require("null-ls").setup({ vim.cmd([[ augroup LspFormatting autocmd! * - autocmd BufWritePre lua vim.lsp.buf.formatting_sync() + autocmd BufWritePre lua vim.lsp.buf.format() augroup END ]]) end