From db6c0f9b4e5e22d7e8dd223bed94ca9af0fe8b4a Mon Sep 17 00:00:00 2001 From: ksyasuda Date: Thu, 13 Feb 2025 00:38:12 -0800 Subject: [PATCH] update --- init.vim | 1 + lua/plugins.lua | 335 +++++++++++++--------------- lua/settings.lua | 9 +- plugin-confs/nvim-cmp.lua | 2 +- plugin-confs/treesitter-context.lua | 14 ++ 5 files changed, 180 insertions(+), 181 deletions(-) create mode 100644 plugin-confs/treesitter-context.lua diff --git a/init.vim b/init.vim index 57de09b..fec53d7 100755 --- a/init.vim +++ b/init.vim @@ -22,6 +22,7 @@ source ~/.config/nvim/plugin-confs/lualine.lua source ~/.config/nvim/plugin-confs/nvimtree.lua source ~/.config/nvim/plugin-confs/presence.lua source ~/.config/nvim/plugin-confs/treesitter.lua +source ~/.config/nvim/plugin-confs/treesitter-context.lua source ~/.config/nvim/plugin-confs/whichkey.lua source ~/.config/nvim/plugin-confs/telescope.lua source ~/.config/nvim/plugin-confs/telescope-file-browser.lua diff --git a/lua/plugins.lua b/lua/plugins.lua index 270c5c2..31d0a54 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -10,6 +10,7 @@ require('packer').startup(function(use) require('nvim-treesitter.install').update({ with_sync = true }) end } + use { 'nvim-treesitter/nvim-treesitter-context' } -- TELESCOPE {{{ @@ -95,181 +96,153 @@ require('packer').startup(function(use) "jackMort/ChatGPT.nvim", commit = "24bcca7", config = function() - require("chatgpt").setup( - { - api_key_cmd = "cat /home/sudacode/.openaikey", - yank_register = "+", - edit_with_instructions = { - diff = false, - keymaps = { - close = "", - accept = "", - toggle_diff = "", - toggle_settings = "", - toggle_help = "", - cycle_windows = "", - use_output_as_input = "", - }, - }, - chat = { - welcome_message = WELCOME_MESSAGE, - loading_text = "Loading, please wait ...", - question_sign = "", -- 🙂 - answer_sign = "ﮧ", -- 🤖 - border_left_sign = "", - border_right_sign = "", - max_line_length = 120, - sessions_window = { - active_sign = "  ", - inactive_sign = "  ", - current_line_sign = "", - border = { - style = "rounded", - text = { - top = " Sessions ", - }, - }, - win_options = { - winhighlight = "Normal:Normal,FloatBorder:FloatBorder", - }, - }, - keymaps = { - close = "", - yank_last = "", - yank_last_code = "", - scroll_up = "", - scroll_down = "", - new_session = "", - cycle_windows = "", - cycle_modes = "", - next_message = "", - prev_message = "", - select_session = "", - rename_session = "r", - delete_session = "d", - draft_message = "", - edit_message = "e", - delete_message = "d", - toggle_settings = "", - toggle_sessions = "", - toggle_help = "", - toggle_message_role = "", - toggle_system_role_open = "", - stop_generating = "", - }, - }, - popup_layout = { - default = "center", - center = { - width = "80%", - height = "80%", - }, - right = { - width = "30%", - width_settings_open = "50%", - }, - }, - popup_window = { - border = { - highlight = "FloatBorder", - style = "rounded", - text = { - top = " ChatGPT ", - }, - }, - win_options = { - wrap = true, - linebreak = true, - foldcolumn = "1", - winhighlight = "Normal:Normal,FloatBorder:FloatBorder", - }, - buf_options = { - filetype = "markdown", - }, - }, - system_window = { - border = { - highlight = "FloatBorder", - style = "rounded", - text = { - top = " SYSTEM ", - }, - }, - win_options = { - wrap = true, - linebreak = true, - foldcolumn = "2", - winhighlight = "Normal:Normal,FloatBorder:FloatBorder", - }, - }, - popup_input = { - prompt = "  ", - border = { - highlight = "FloatBorder", - style = "rounded", - text = { - top_align = "center", - top = " Prompt ", - }, - }, - win_options = { - winhighlight = "Normal:Normal,FloatBorder:FloatBorder", - }, - submit = "", - submit_n = "", - max_visible_lines = 20, - }, - settings_window = { - setting_sign = "  ", - border = { - style = "rounded", - text = { - top = " Settings ", - }, - }, - win_options = { - winhighlight = "Normal:Normal,FloatBorder:FloatBorder", - }, - }, - help_window = { - setting_sign = "  ", - border = { - style = "rounded", - text = { - top = " Help ", - }, - }, - win_options = { - winhighlight = "Normal:Normal,FloatBorder:FloatBorder", - }, - }, - openai_params = { - model = "gpt-3.5-turbo", - frequency_penalty = 0, - presence_penalty = 0, - max_tokens = 300, - temperature = 0, - top_p = 1, - n = 1, - }, - openai_edit_params = { - model = "gpt-3.5-turbo", - frequency_penalty = 0, - presence_penalty = 0, - temperature = 0, - top_p = 1, - n = 1, - }, - use_openai_functions_for_edits = false, - actions_paths = {}, - show_quickfixes_cmd = "Trouble quickfix", - predefined_chat_gpt_prompts = "https://raw.githubusercontent.com/f/awesome-chatgpt-prompts/main/prompts.csv", - highlights = { - help_key = "@symbol", - help_description = "@comment", - }, - } - ) + require("chatgpt").setup({ + api_key_cmd = "cat /home/sudacode/.openaikey", + yank_register = "+", + edit_with_instructions = { + diff = false, + keymaps = { + close = "", + accept = "", + toggle_diff = "", + toggle_settings = "", + toggle_help = "", + cycle_windows = "", + use_output_as_input = "" + } + }, + chat = { + welcome_message = WELCOME_MESSAGE, + loading_text = "Loading, please wait ...", + question_sign = "", -- 🙂 + answer_sign = "ﮧ", -- 🤖 + border_left_sign = "", + border_right_sign = "", + max_line_length = 120, + sessions_window = { + active_sign = "  ", + inactive_sign = "  ", + current_line_sign = "", + border = { + style = "rounded", + text = { top = " Sessions " } + }, + win_options = { + winhighlight = "Normal:Normal,FloatBorder:FloatBorder" + } + }, + keymaps = { + close = "", + yank_last = "", + yank_last_code = "", + scroll_up = "", + scroll_down = "", + new_session = "", + cycle_windows = "", + cycle_modes = "", + next_message = "", + prev_message = "", + select_session = "", + rename_session = "r", + delete_session = "d", + draft_message = "", + edit_message = "e", + delete_message = "d", + toggle_settings = "", + toggle_sessions = "", + toggle_help = "", + toggle_message_role = "", + toggle_system_role_open = "", + stop_generating = "" + } + }, + popup_layout = { + default = "center", + center = { width = "80%", height = "80%" }, + right = { width = "30%", width_settings_open = "50%" } + }, + popup_window = { + border = { + highlight = "FloatBorder", + style = "rounded", + text = { top = " ChatGPT " } + }, + win_options = { + wrap = true, + linebreak = true, + foldcolumn = "1", + winhighlight = "Normal:Normal,FloatBorder:FloatBorder" + }, + buf_options = { filetype = "markdown" } + }, + system_window = { + border = { + highlight = "FloatBorder", + style = "rounded", + text = { top = " SYSTEM " } + }, + win_options = { + wrap = true, + linebreak = true, + foldcolumn = "2", + winhighlight = "Normal:Normal,FloatBorder:FloatBorder" + } + }, + popup_input = { + prompt = "  ", + border = { + highlight = "FloatBorder", + style = "rounded", + text = { top_align = "center", top = " Prompt " } + }, + win_options = { + winhighlight = "Normal:Normal,FloatBorder:FloatBorder" + }, + submit = "", + submit_n = "", + max_visible_lines = 20 + }, + settings_window = { + setting_sign = "  ", + border = { style = "rounded", text = { top = " Settings " } }, + win_options = { + winhighlight = "Normal:Normal,FloatBorder:FloatBorder" + } + }, + help_window = { + setting_sign = "  ", + border = { style = "rounded", text = { top = " Help " } }, + win_options = { + winhighlight = "Normal:Normal,FloatBorder:FloatBorder" + } + }, + openai_params = { + model = "gpt-3.5-turbo", + frequency_penalty = 0, + presence_penalty = 0, + max_tokens = 300, + temperature = 0, + top_p = 1, + n = 1 + }, + openai_edit_params = { + model = "gpt-3.5-turbo", + frequency_penalty = 0, + presence_penalty = 0, + temperature = 0, + top_p = 1, + n = 1 + }, + use_openai_functions_for_edits = false, + actions_paths = {}, + show_quickfixes_cmd = "Trouble quickfix", + predefined_chat_gpt_prompts = + "https://raw.githubusercontent.com/f/awesome-chatgpt-prompts/main/prompts.csv", + highlights = { + help_key = "@symbol", + help_description = "@comment" + } + }) end, requires = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim", @@ -299,7 +272,8 @@ require('packer').startup(function(use) use { 'hrsh7th/cmp-path' } use { 'hrsh7th/nvim-cmp' } use { 'https://git.sr.ht/~whynothugo/lsp_lines.nvim' } - use { 'jose-elias-alvarez/null-ls.nvim' } + -- use { 'jose-elias-alvarez/null-ls.nvim' } + use { 'nvimtools/none-ls.nvim' } use { 'neovim/nvim-lspconfig' } use { 'onsails/lspkind-nvim' } @@ -324,6 +298,15 @@ require('packer').startup(function(use) -- }}} -- UI {{{ + use { + "lukas-reineke/indent-blankline.nvim", + config = function() + opts = {} + -- Other blankline configuration here + require("ibl").setup(require("indent-rainbowline").make_opts(opts)) + end, + requires = { "TheGLander/indent-rainbowline.nvim" } + } use { 'glepnir/dashboard-nvim', diff --git a/lua/settings.lua b/lua/settings.lua index d08ec8d..8d4ebb5 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -19,6 +19,7 @@ o.relativenumber = true o.colorcolumn = '80' o.textwidth = 80 o.shiftwidth = 4 +o.expandtab = true o.tabstop = 4 o.autoindent = true o.ignorecase = true @@ -48,12 +49,12 @@ o.foldmethod = 'marker' g.db_ui_use_nerd_fonts = 1 local border = { - { "╭", "FloatBorder" }, { "─", "FloatBorder" }, { "╮", "FloatBorder" }, - { "│", "FloatBorder" }, { "╯", "FloatBorder" }, { "─", "FloatBorder" }, - { "╰", "FloatBorder" }, { "│", "FloatBorder" } + { "╭", "FloatBorder" }, { "─", "FloatBorder" }, { "╮", "FloatBorder" }, + { "│", "FloatBorder" }, { "╯", "FloatBorder" }, { "─", "FloatBorder" }, + { "╰", "FloatBorder" }, { "│", "FloatBorder" } } l.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border }) l.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, - { border = border }) + { border = border }) diff --git a/plugin-confs/nvim-cmp.lua b/plugin-confs/nvim-cmp.lua index ad17c9d..8be3044 100644 --- a/plugin-confs/nvim-cmp.lua +++ b/plugin-confs/nvim-cmp.lua @@ -215,7 +215,7 @@ cmp.setup.cmdline(':', { local servers = { 'bashls', 'pyright', 'jsonls', 'yamlls', 'vimls', 'dotls', 'dockerls', - 'html', 'cssls', 'lua_ls', 'eslint', 'tsserver', 'angularls', 'ansiblels' + 'html', 'cssls', 'lua_ls', 'eslint', 'ts_ls', 'angularls', 'ansiblels' } for _, lsp in ipairs(servers) do diff --git a/plugin-confs/treesitter-context.lua b/plugin-confs/treesitter-context.lua new file mode 100644 index 0000000..c43a029 --- /dev/null +++ b/plugin-confs/treesitter-context.lua @@ -0,0 +1,14 @@ +require 'treesitter-context'.setup { + enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) + max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit. + min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit. + line_numbers = true, + multiline_threshold = 20, -- Maximum number of lines to show for a single context + trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' + mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline' + -- Separator between context and content. Should be a single character string, like '-'. + -- When separator is set, the context will only show up when there are at least 2 lines above cursorline. + separator = nil, + zindex = 20, -- The Z-index of the context window + on_attach = nil -- (fun(buf: integer): boolean) return false to disable attaching +}