From 6b8707001cdcab2f612244b08f3ae889e5d18838 Mon Sep 17 00:00:00 2001 From: lootboxer <> Date: Wed, 5 Mar 2025 23:35:23 +0300 Subject: [PATCH 1/7] My changes --- init.lua | 92 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 80 insertions(+), 12 deletions(-) diff --git a/init.lua b/init.lua index 5cac3d14..fad32295 100644 --- a/init.lua +++ b/init.lua @@ -87,11 +87,11 @@ P.S. You can delete this when you're done too. It's your config now! :) -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' +vim.g.mapleader = ';' +vim.g.maplocalleader = ';' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.opt` @@ -110,6 +110,9 @@ vim.opt.mouse = 'a' -- Don't show the mode, since it's already in the status line vim.opt.showmode = false +-- Disable swapfiles +vim.opt.swapfile = false -- Disable .swp files + -- Sync clipboard between OS and Neovim. -- Schedule the setting after `UiEnter` because it can increase startup-time. -- Remove this option if you want your OS clipboard to remain independent. @@ -189,6 +192,10 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +-- Custom Keybinds. +vim.keymap.set('i', 'jk', '', { desc = 'escape' }) +vim.keymap.set('i', 'kj', '', { desc = 'escape' }) + -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -659,9 +666,9 @@ require('lazy').setup({ -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { -- clangd = {}, - -- gopls = {}, + gopls = {}, -- pyright = {}, - -- rust_analyzer = {}, + rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- -- Some languages (like typescript) have entire language plugins that can be useful: @@ -670,7 +677,65 @@ require('lazy').setup({ -- But for many setups, the LSP (`ts_ls`) will work just fine -- ts_ls = {}, -- - + -- Vue 3 + volar = { + init_options = { + vue = { + hybridMode = false, + }, + }, + settings = { + typescript = { + inlayHints = { + enumMemberValues = { + enabled = true, + }, + functionLikeReturnTypes = { + enabled = true, + }, + propertyDeclarationTypes = { + enabled = true, + }, + parameterTypes = { + enabled = true, + suppressWhenArgumentMatchesName = true, + }, + variableTypes = { + enabled = true, + }, + }, + }, + }, + }, + -- TypeScript + ts_ls = { + init_options = { + plugins = { + { + name = '@vue/typescript-plugin', + location = vim.fn.stdpath 'data' .. '/mason/packages/vue-language-server/node_modules/@vue/language-server', + languages = { 'vue' }, + }, + }, + }, + settings = { + typescript = { + tsserver = { + useSyntaxServer = false, + }, + inlayHints = { + includeInlayParameterNameHints = 'all', + includeInlayParameterNameHintsWhenArgumentMatchesName = true, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayVariableTypeHintsWhenTypeMatchesName = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + }, + }, + }, + }, lua_ls = { -- cmd = { ... }, -- filetypes = { ... }, @@ -685,6 +750,9 @@ require('lazy').setup({ }, }, }, + + -- python lsp + pyright = {}, } -- Ensure the servers and tools above are installed @@ -838,7 +906,7 @@ require('lazy').setup({ -- If you prefer more traditional completion keymaps, -- you can uncomment the following lines - --[''] = cmp.mapping.confirm { select = true }, + [''] = cmp.mapping.confirm { select = true }, --[''] = cmp.mapping.select_next_item(), --[''] = cmp.mapping.select_prev_item(), @@ -982,11 +1050,11 @@ require('lazy').setup({ -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- -- require 'kickstart.plugins.debug', - -- require 'kickstart.plugins.indent_line', - -- require 'kickstart.plugins.lint', - -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + require 'kickstart.plugins.indent_line', + require 'kickstart.plugins.lint', + require 'kickstart.plugins.autopairs', + require 'kickstart.plugins.neo-tree', + require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. From 790032eb3ba1d8f1104a25173e8ef71b0c5cb85d Mon Sep 17 00:00:00 2001 From: lootboxer <> Date: Thu, 13 Mar 2025 01:28:55 +0300 Subject: [PATCH 2/7] Aded some keybinds and plugins --- init.lua | 12 +++--- lua/custom/keybindings.lua | 16 ++++++++ lua/custom/plugins/init.lua | 66 +++++++++++++++++++++++++++++- lua/kickstart/plugins/neo-tree.lua | 6 +++ 4 files changed, 93 insertions(+), 7 deletions(-) create mode 100644 lua/custom/keybindings.lua diff --git a/init.lua b/init.lua index 577e4b2d..6d63e4e7 100644 --- a/init.lua +++ b/init.lua @@ -84,6 +84,9 @@ I hope you enjoy your Neovim journey, P.S. You can delete this when you're done too. It's your config now! :) --]] +-- Custom config. +require 'custom.keybindings' + -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) @@ -197,10 +200,6 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) --- Custom Keybinds. -vim.keymap.set('i', 'jk', '', { desc = 'escape' }) -vim.keymap.set('i', 'kj', '', { desc = 'escape' }) - -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -918,7 +917,8 @@ require('lazy').setup({ -- Manually trigger a completion from nvim-cmp. -- Generally you don't need this, because nvim-cmp will display -- completions whenever it has completion options available. - [''] = cmp.mapping.complete {}, + -- [''] = cmp.mapping.complete {}, + [''] = cmp.mapping.complete {}, -- Think of as moving to the right of your snippet expansion. -- So if you have a snippet that's like: @@ -1065,7 +1065,7 @@ require('lazy').setup({ -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! diff --git a/lua/custom/keybindings.lua b/lua/custom/keybindings.lua new file mode 100644 index 00000000..c15a9970 --- /dev/null +++ b/lua/custom/keybindings.lua @@ -0,0 +1,16 @@ +-- Custom Keybinds. + +vim.keymap.set('i', 'jk', '', { desc = 'escape' }) +vim.keymap.set('i', 'kj', '', { desc = 'escape' }) + +-- Перемещение между буферами +vim.keymap.set('n', '', 'BufferLineCycleNext') +vim.keymap.set('n', '', 'BufferLineCyclePrev') + +-- Закрыть буфер +vim.keymap.set('n', 'bd', 'Bdelete!') + +-- Переход к буферу по номеру (например, Alt+1, Alt+2...) +for i = 1, 9 do + vim.keymap.set('n', '', 'BufferLineGoToBuffer ' .. i .. '') +end diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8..23f2215f 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,4 +2,68 @@ -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information -return {} +return { + { + 'akinsho/bufferline.nvim', + dependencies = 'nvim-tree/nvim-web-devicons', + + event = 'VeryLazy', + keys = { + { 'bp', 'BufferLineTogglePin', desc = 'Toggle Pin' }, + { 'bP', 'BufferLineGroupClose ungrouped', desc = 'Delete Non-Pinned Buffers' }, + { 'br', 'BufferLineCloseRight', desc = 'Delete Buffers to the Right' }, + { 'bl', 'BufferLineCloseLeft', desc = 'Delete Buffers to the Left' }, + { '', 'BufferLineCyclePrev', desc = 'Prev Buffer' }, + { '', 'BufferLineCycleNext', desc = 'Next Buffer' }, + { '[b', 'BufferLineCyclePrev', desc = 'Prev Buffer' }, + { ']b', 'BufferLineCycleNext', desc = 'Next Buffer' }, + { '[B', 'BufferLineMovePrev', desc = 'Move buffer prev' }, + { ']B', 'BufferLineMoveNext', desc = 'Move buffer next' }, + }, + opts = { + options = { + -- stylua: ignore + close_command = function(n) Snacks.bufdelete(n) end, + -- stylua: ignore + right_mouse_command = function(n) Snacks.bufdelete(n) end, + diagnostics = 'nvim_lsp', + always_show_bufferline = false, + diagnostics_indicator = function(_, _, diag) + local icons = LazyVim.config.icons.diagnostics + local ret = (diag.error and icons.Error .. diag.error .. ' ' or '') .. (diag.warning and icons.Warn .. diag.warning or '') + return vim.trim(ret) + end, + offsets = { + { + filetype = 'neo-tree', + text = 'Neo-tree', + highlight = 'Directory', + text_align = 'left', + }, + { + filetype = 'snacks_layout_box', + }, + }, + show_buffer_icons = true, + color_icons = true, + }, + }, + config = function(_, opts) + require('bufferline').setup(opts) + -- Fix bufferline when restoring a session + vim.api.nvim_create_autocmd({ 'BufAdd', 'BufDelete' }, { + callback = function() + vim.schedule(function() + pcall(nvim_bufferline) + end) + end, + }) + end, + }, + { + 'numToStr/Comment.nvim', + opts = { + -- add any options here + }, + }, +} diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua index bd442269..6cb96f02 100644 --- a/lua/kickstart/plugins/neo-tree.lua +++ b/lua/kickstart/plugins/neo-tree.lua @@ -18,6 +18,12 @@ return { window = { mappings = { ['\\'] = 'close_window', + [''] = { + 'open', + config = { + open_command = 'tabnew', -- Альтернативный вариант параметра + }, + }, }, }, }, From e5bea444a90443e71f56a5f45accb67814ec5ecf Mon Sep 17 00:00:00 2001 From: lootboxer <> Date: Tue, 15 Apr 2025 02:43:46 +0300 Subject: [PATCH 3/7] Added avante and toggleterm --- init.lua | 21 +++++-- lua/custom/keybindings.lua | 5 +- lua/custom/plugins/init.lua | 94 ++++++++++++++++++++++++++---- lua/kickstart/plugins/neo-tree.lua | 29 ++++++++- 4 files changed, 129 insertions(+), 20 deletions(-) diff --git a/init.lua b/init.lua index 6d63e4e7..61cb846a 100644 --- a/init.lua +++ b/init.lua @@ -195,10 +195,10 @@ vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' } -- Use CTRL+ to switch between windows -- -- See `:help wincmd` for a list of all window commands -vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +vim.keymap.set('n', 'wh', '', { desc = 'Move focus to the left window' }) +vim.keymap.set('n', 'wl', '', { desc = 'Move focus to the right window' }) +vim.keymap.set('n', 'wj', '', { desc = 'Move focus to the lower window' }) +vim.keymap.set('n', 'wk', '', { desc = 'Move focus to the upper window' }) -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -998,7 +998,18 @@ require('lazy').setup({ -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren -- - sd' - [S]urround [D]elete [']quotes -- - sr)' - [S]urround [R]eplace [)] ['] - require('mini.surround').setup() + require('mini.surround').setup { + custom_surroundings = { + [')'] = { output = { left = '( ', right = ' )' } }, + ['('] = { output = { left = '(', right = ')' } }, + ['{'] = { output = { left = '{\n', right = '\n}' } }, + ['['] = { output = { left = '[', right = ']' } }, + }, + } + + -- // custom mini plugins + -- + require('mini.starter').setup() -- Simple and easy statusline. -- You could remove this setup call if you don't like it, diff --git a/lua/custom/keybindings.lua b/lua/custom/keybindings.lua index c15a9970..ebefc21f 100644 --- a/lua/custom/keybindings.lua +++ b/lua/custom/keybindings.lua @@ -7,8 +7,11 @@ vim.keymap.set('i', 'kj', '', { desc = 'escape' }) vim.keymap.set('n', '', 'BufferLineCycleNext') vim.keymap.set('n', '', 'BufferLineCyclePrev') +vim.keymap.set('n', ',,', 'ToggleTerm', { desc = 'Open terminal in horizontal split' }) +vim.keymap.set('t', ',,', 'ToggleTerm', { desc = 'Open terminal in horizontal split' }) + -- Закрыть буфер -vim.keymap.set('n', 'bd', 'Bdelete!') +vim.keymap.set('n', '', 'bdelete') -- Переход к буферу по номеру (например, Alt+1, Alt+2...) for i = 1, 9 do diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 23f2215f..158dd1cc 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -1,5 +1,3 @@ --- You can add your own plugins here or in other files in this directory! --- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information return { @@ -13,8 +11,10 @@ return { { 'bP', 'BufferLineGroupClose ungrouped', desc = 'Delete Non-Pinned Buffers' }, { 'br', 'BufferLineCloseRight', desc = 'Delete Buffers to the Right' }, { 'bl', 'BufferLineCloseLeft', desc = 'Delete Buffers to the Left' }, - { '', 'BufferLineCyclePrev', desc = 'Prev Buffer' }, - { '', 'BufferLineCycleNext', desc = 'Next Buffer' }, + { '', 'BufferLineCyclePrev', desc = 'Prev Buffer' }, + { '', 'BufferLineCycleNext', desc = 'Next Buffer' }, + { '', 'BufferLineMovePrev', desc = 'Move buffer prev' }, + { '', 'BufferLineMoveNext', desc = 'Move buffer next' }, { '[b', 'BufferLineCyclePrev', desc = 'Prev Buffer' }, { ']b', 'BufferLineCycleNext', desc = 'Next Buffer' }, { '[B', 'BufferLineMovePrev', desc = 'Move buffer prev' }, @@ -23,15 +23,14 @@ return { opts = { options = { -- stylua: ignore - close_command = function(n) Snacks.bufdelete(n) end, + -- // close_command = require('bufdelete').bufdelete, -- stylua: ignore - right_mouse_command = function(n) Snacks.bufdelete(n) end, + -- // right_mouse_command = require('bufdelete').bufdelete, diagnostics = 'nvim_lsp', always_show_bufferline = false, - diagnostics_indicator = function(_, _, diag) - local icons = LazyVim.config.icons.diagnostics - local ret = (diag.error and icons.Error .. diag.error .. ' ' or '') .. (diag.warning and icons.Warn .. diag.warning or '') - return vim.trim(ret) + diagnostics_indicator = function(count, level, diagnostics_dict, context) + local icon = level:match 'error' and ' ' or ' ' + return ' ' .. icon .. count end, offsets = { { @@ -61,9 +60,80 @@ return { end, }, { - 'numToStr/Comment.nvim', + 'mattn/emmet-vim', + }, + { + 'yetone/avante.nvim', + event = 'VeryLazy', + version = false, -- Never set this value to "*"! Never! opts = { - -- add any options here + provider = 'openrouter', + vendors = { + openai = { + endpoint = 'https://api.openai.com/v1', + model = 'gpt-4o', -- your desired model (or use gpt-4o, etc.) + timeout = 30000, -- Timeout in milliseconds, increase this for reasoning models + temperature = 0, + max_completion_tokens = 8192, -- Increase this to include reasoning tokens (for reasoning models) + --reasoning_effort = "medium", -- low|medium|high, only used for reasoning models + }, + deepseek = { + __inherited_from = 'openai', + api_key_name = 'DEEPSEEK_API_KEY', + api_endpoint = 'https://api.deepseek.com', + model = 'deepseek-coder', + max_tokens = 200, + }, + openrouter = { + __inherited_from = 'openai', + endpoint = 'https://openrouter.ai/api/v1', + api_key_name = 'OPENROUTER_API_KEY', + model = 'mistralai/mistral-7b-instruct:free', + }, + }, + }, + -- if you want to build from source then do `make BUILD_FROM_SOURCE=true` + build = 'make', + -- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows + dependencies = { + 'nvim-treesitter/nvim-treesitter', + 'stevearc/dressing.nvim', + 'nvim-lua/plenary.nvim', + 'MunifTanjim/nui.nvim', + --- The below dependencies are optional, + 'echasnovski/mini.pick', -- for file_selector provider mini.pick + 'nvim-telescope/telescope.nvim', -- for file_selector provider telescope + 'hrsh7th/nvim-cmp', -- autocompletion for avante commands and mentions + -- 'ibhagwan/fzf-lua', -- for file_selector provider fzf + -- 'nvim-tree/nvim-web-devicons', -- or echasnovski/mini.icons + 'echasnovski/mini.icons', -- or echasnovski/mini.icons + -- 'zbirenbaum/copilot.lua', -- for providers='copilot' + -- { + -- -- support for image pasting + -- 'HakonHarnes/img-clip.nvim', + -- event = 'VeryLazy', + -- opts = { + -- -- recommended settings + -- default = { + -- embed_image_as_base64 = false, + -- prompt_for_file_name = false, + -- drag_and_drop = { + -- insert_mode = true, + -- }, + -- -- required for Windows users + -- use_absolute_path = true, + -- }, + -- }, + -- }, + { + -- Make sure to set this up properly if you have lazy=true + 'MeanderingProgrammer/render-markdown.nvim', + opts = { + file_types = { 'markdown', 'Avante' }, + }, + ft = { 'markdown', 'Avante' }, + }, }, }, + { 'akinsho/toggleterm.nvim', version = '*', opts = {} }, } diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua index 6cb96f02..72ee20d7 100644 --- a/lua/kickstart/plugins/neo-tree.lua +++ b/lua/kickstart/plugins/neo-tree.lua @@ -11,19 +11,44 @@ return { }, cmd = 'Neotree', keys = { - { '\\', ':Neotree reveal', desc = 'NeoTree reveal', silent = true }, + { 'e', ':Neotree reveal', desc = 'NeoTree reveal', silent = true }, }, opts = { filesystem = { + bind_to_cwd = true, + commands = { + avante_add_files = function(state) + local node = state.tree:get_node() + local filepath = node:get_id() + local relative_path = require('avante.utils').relative_path(filepath) + + local sidebar = require('avante').get() + + local open = sidebar:is_open() + -- ensure avante sidebar is open + if not open then + require('avante.api').ask() + sidebar = require('avante').get() + end + + sidebar.file_selector:add_selected_file(relative_path) + + -- remove neo tree buffer + if not open then + sidebar.file_selector:remove_selected_file 'neo-tree filesystem [1]' + end + end, + }, window = { mappings = { - ['\\'] = 'close_window', + ['e'] = 'close_window', [''] = { 'open', config = { open_command = 'tabnew', -- Альтернативный вариант параметра }, }, + ['oa'] = 'avante_add_files', }, }, }, From c8196ef4af92d03e78b7d093ca9bd3c4b39490a5 Mon Sep 17 00:00:00 2001 From: lootboxer <> Date: Tue, 15 Apr 2025 03:21:17 +0300 Subject: [PATCH 4/7] revert some unnessecceries --- init.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 61cb846a..e83307e4 100644 --- a/init.lua +++ b/init.lua @@ -195,10 +195,10 @@ vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' } -- Use CTRL+ to switch between windows -- -- See `:help wincmd` for a list of all window commands -vim.keymap.set('n', 'wh', '', { desc = 'Move focus to the left window' }) -vim.keymap.set('n', 'wl', '', { desc = 'Move focus to the right window' }) -vim.keymap.set('n', 'wj', '', { desc = 'Move focus to the lower window' }) -vim.keymap.set('n', 'wk', '', { desc = 'Move focus to the upper window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -917,8 +917,7 @@ require('lazy').setup({ -- Manually trigger a completion from nvim-cmp. -- Generally you don't need this, because nvim-cmp will display -- completions whenever it has completion options available. - -- [''] = cmp.mapping.complete {}, - [''] = cmp.mapping.complete {}, + [''] = cmp.mapping.complete {}, -- Think of as moving to the right of your snippet expansion. -- So if you have a snippet that's like: From b45829690c0033277848e84f393eefdb1c9f4f57 Mon Sep 17 00:00:00 2001 From: lootboxer <> Date: Tue, 15 Apr 2025 03:26:30 +0300 Subject: [PATCH 5/7] revert cmp keybinding --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index e83307e4..daf5a44a 100644 --- a/init.lua +++ b/init.lua @@ -910,7 +910,7 @@ require('lazy').setup({ -- If you prefer more traditional completion keymaps, -- you can uncomment the following lines - [''] = cmp.mapping.confirm { select = true }, + --[''] = cmp.mapping.confirm { select = true }, --[''] = cmp.mapping.select_next_item(), --[''] = cmp.mapping.select_prev_item(), From 392e633f0e194be7aa0f510aad070e433f38b2e8 Mon Sep 17 00:00:00 2001 From: lootboxer <> Date: Fri, 18 Apr 2025 00:32:10 +0300 Subject: [PATCH 6/7] Friendly snippets, for blink.cmp --- init.lua | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index ca5ff1f3..0345f62e 100644 --- a/init.lua +++ b/init.lua @@ -858,12 +858,12 @@ require('lazy').setup({ -- `friendly-snippets` contains a variety of premade snippets. -- See the README about individual language/framework/plugin snippets: -- https://github.com/rafamadriz/friendly-snippets - -- { - -- 'rafamadriz/friendly-snippets', - -- config = function() - -- require('luasnip.loaders.from_vscode').lazy_load() - -- end, - -- }, + { + 'rafamadriz/friendly-snippets', + config = function() + require('luasnip.loaders.from_vscode').lazy_load() + end, + }, }, opts = {}, }, @@ -896,6 +896,18 @@ require('lazy').setup({ -- See :h blink-cmp-config-keymap for defining your own keymap preset = 'default', + [''] = { + function(cmp) + if cmp.snippet_active() then + return cmp.accept() + else + return cmp.select_and_accept() + end + end, + 'snippet_forward', + 'fallback', + }, + -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps }, @@ -910,6 +922,9 @@ require('lazy').setup({ -- By default, you may press `` to show the documentation. -- Optionally, set `auto_show = true` to show the documentation after a delay. documentation = { auto_show = false, auto_show_delay_ms = 500 }, + ghost_text = { + enabled = true, + }, }, sources = { From 48c85c077cc0efd07c36ef1c5aa53dc01c54e8cf Mon Sep 17 00:00:00 2001 From: lootboxer <> Date: Tue, 22 Jul 2025 03:09:47 +0300 Subject: [PATCH 7/7] Added some configs and plugins --- init.lua | 106 +++++++++++++--------- lua/custom/keybindings.lua | 9 +- lua/custom/plugins/init.lua | 71 ++++++--------- lua/kickstart/plugins/autopairs.lua | 8 -- lua/kickstart/plugins/neo-tree.lua | 2 +- lua/kickstart/plugins/nvim-ts-autotag.lua | 5 + 6 files changed, 99 insertions(+), 102 deletions(-) delete mode 100644 lua/kickstart/plugins/autopairs.lua create mode 100644 lua/kickstart/plugins/nvim-ts-autotag.lua diff --git a/init.lua b/init.lua index 08a63a5c..04c183f1 100644 --- a/init.lua +++ b/init.lua @@ -206,10 +206,10 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the lower win vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) -- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes --- vim.keymap.set("n", "", "H", { desc = "Move window to the left" }) --- vim.keymap.set("n", "", "L", { desc = "Move window to the right" }) --- vim.keymap.set("n", "", "J", { desc = "Move window to the lower" }) --- vim.keymap.set("n", "", "K", { desc = "Move window to the upper" }) +vim.keymap.set('n', '', 'H', { desc = 'Move window to the left' }) +vim.keymap.set('n', '', 'L', { desc = 'Move window to the right' }) +vim.keymap.set('n', '', 'J', { desc = 'Move window to the lower' }) +vim.keymap.set('n', '', 'K', { desc = 'Move window to the upper' }) -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -690,31 +690,14 @@ require('lazy').setup({ -- ts_ls = {}, -- -- Vue 3 - volar = { + -- + vuels = { + filetypes = { 'vue', 'javascript', 'typescript' }, init_options = { - vue = { - hybridMode = false, - }, - }, - settings = { - typescript = { - inlayHints = { - enumMemberValues = { - enabled = true, - }, - functionLikeReturnTypes = { - enabled = true, - }, - propertyDeclarationTypes = { - enabled = true, - }, - parameterTypes = { - enabled = true, - suppressWhenArgumentMatchesName = true, - }, - variableTypes = { - enabled = true, - }, + config = { + vetur = { -- For Vue 2 compatibility (optional) + validation = { template = true, script = true, style = true }, + format = { enable = false }, -- Disable if using Prettier }, }, }, @@ -732,9 +715,6 @@ require('lazy').setup({ }, settings = { typescript = { - tsserver = { - useSyntaxServer = false, - }, inlayHints = { includeInlayParameterNameHints = 'all', includeInlayParameterNameHintsWhenArgumentMatchesName = true, @@ -747,6 +727,7 @@ require('lazy').setup({ }, }, }, + filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' }, }, lua_ls = { -- cmd = { ... }, @@ -765,6 +746,10 @@ require('lazy').setup({ -- python lsp pyright = {}, + -- CSS/SCSS LSP + cssls = { + filetypes = { 'css', 'scss', 'sass' }, + }, } -- Ensure the servers and tools above are installed @@ -784,10 +769,16 @@ require('lazy').setup({ vim.list_extend(ensure_installed, { 'stylua', -- Used to format Lua code }) + vim.filetype.add { + extension = { + vue = 'vue', + }, + } require('mason-tool-installer').setup { ensure_installed = ensure_installed } require('mason-lspconfig').setup { - ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) + ensure_installed = { 'vuels', 'lua_ls' }, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) + automatic_enable = true, automatic_installation = false, handlers = { function(server_name) @@ -839,7 +830,7 @@ require('lazy').setup({ -- python = { "isort", "black" }, -- -- You can use 'stop_after_first' to run the first available formatter from the list - -- javascript = { "prettierd", "prettier", stop_after_first = true }, + -- javascript = { 'prettierd', 'prettier', stop_after_first = true }, }, }, }, @@ -866,16 +857,18 @@ require('lazy').setup({ -- `friendly-snippets` contains a variety of premade snippets. -- See the README about individual language/framework/plugin snippets: -- https://github.com/rafamadriz/friendly-snippets - { - 'rafamadriz/friendly-snippets', - config = function() - require('luasnip.loaders.from_vscode').lazy_load() - end, - }, + -- { + -- 'rafamadriz/friendly-snippets', + -- config = function() + -- require('luasnip.loaders.from_vscode').lazy_load() + -- end, + -- }, }, opts = {}, }, 'folke/lazydev.nvim', + -- custom deps + 'Kaiser-Yang/blink-cmp-avante', }, --- @module 'blink.cmp' --- @type blink.cmp.Config @@ -911,6 +904,7 @@ require('lazy').setup({ else return cmp.select_and_accept() end + vim.api.nvim_command '' end, 'snippet_forward', 'fallback', @@ -936,9 +930,16 @@ require('lazy').setup({ }, sources = { - default = { 'lsp', 'path', 'snippets', 'lazydev' }, + default = { 'lsp', 'path', 'snippets', 'lazydev', 'avante' }, providers = { lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 }, + avante = { + module = 'blink-cmp-avante', + name = 'Avante', + opts = { + -- options for blink-cmp-avante + }, + }, }, }, @@ -1011,6 +1012,7 @@ require('lazy').setup({ -- // custom mini plugins -- require('mini.starter').setup() + -- require('mini.bufremove').setup() -- Simple and easy statusline. -- You could remove this setup call if you don't like it, @@ -1037,7 +1039,24 @@ require('lazy').setup({ main = 'nvim-treesitter.configs', -- Sets main module to use for opts -- [[ Configure Treesitter ]] See `:help nvim-treesitter` opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, + ensure_installed = { + 'bash', + 'c', + 'diff', + 'html', + 'lua', + 'luadoc', + 'markdown', + 'markdown_inline', + 'query', + 'vim', + 'vimdoc', + 'html', + 'javascript', + 'typescript', + 'tsx', + 'vue', + }, -- Autoinstall languages that are not installed auto_install = true, highlight = { @@ -1048,6 +1067,9 @@ require('lazy').setup({ additional_vim_regex_highlighting = { 'ruby' }, }, indent = { enable = true, disable = { 'ruby' } }, + autotag = { + enabled = true, + }, }, -- There are additional nvim-treesitter modules that you can use to interact -- with nvim-treesitter. You should go explore a few and see what interests you: @@ -1069,9 +1091,9 @@ require('lazy').setup({ -- require 'kickstart.plugins.debug', require 'kickstart.plugins.indent_line', require 'kickstart.plugins.lint', - require 'kickstart.plugins.autopairs', require 'kickstart.plugins.neo-tree', require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + require 'kickstart.plugins.nvim-ts-autotag', -- adds nvim-ts-autotag -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. diff --git a/lua/custom/keybindings.lua b/lua/custom/keybindings.lua index ebefc21f..e5be4a4f 100644 --- a/lua/custom/keybindings.lua +++ b/lua/custom/keybindings.lua @@ -3,17 +3,12 @@ vim.keymap.set('i', 'jk', '', { desc = 'escape' }) vim.keymap.set('i', 'kj', '', { desc = 'escape' }) --- Перемещение между буферами -vim.keymap.set('n', '', 'BufferLineCycleNext') -vim.keymap.set('n', '', 'BufferLineCyclePrev') - vim.keymap.set('n', ',,', 'ToggleTerm', { desc = 'Open terminal in horizontal split' }) vim.keymap.set('t', ',,', 'ToggleTerm', { desc = 'Open terminal in horizontal split' }) --- Закрыть буфер -vim.keymap.set('n', '', 'bdelete') +-- vim.keymap.set('n', '', 'bdelete') --- Переход к буферу по номеру (например, Alt+1, Alt+2...) +-- Change buffer by number (example Alt+1, Alt+2...) for i = 1, 9 do vim.keymap.set('n', '', 'BufferLineGoToBuffer ' .. i .. '') end diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 158dd1cc..26d81232 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -7,27 +7,15 @@ return { event = 'VeryLazy', keys = { - { 'bp', 'BufferLineTogglePin', desc = 'Toggle Pin' }, - { 'bP', 'BufferLineGroupClose ungrouped', desc = 'Delete Non-Pinned Buffers' }, - { 'br', 'BufferLineCloseRight', desc = 'Delete Buffers to the Right' }, - { 'bl', 'BufferLineCloseLeft', desc = 'Delete Buffers to the Left' }, - { '', 'BufferLineCyclePrev', desc = 'Prev Buffer' }, - { '', 'BufferLineCycleNext', desc = 'Next Buffer' }, + { '', 'BufferLineCyclePrev', desc = 'Prev Buffer' }, + { '', 'BufferLineCycleNext', desc = 'Next Buffer' }, { '', 'BufferLineMovePrev', desc = 'Move buffer prev' }, { '', 'BufferLineMoveNext', desc = 'Move buffer next' }, - { '[b', 'BufferLineCyclePrev', desc = 'Prev Buffer' }, - { ']b', 'BufferLineCycleNext', desc = 'Next Buffer' }, - { '[B', 'BufferLineMovePrev', desc = 'Move buffer prev' }, - { ']B', 'BufferLineMoveNext', desc = 'Move buffer next' }, }, opts = { options = { - -- stylua: ignore - -- // close_command = require('bufdelete').bufdelete, - -- stylua: ignore - -- // right_mouse_command = require('bufdelete').bufdelete, diagnostics = 'nvim_lsp', - always_show_bufferline = false, + always_show_bufferline = true, diagnostics_indicator = function(count, level, diagnostics_dict, context) local icon = level:match 'error' and ' ' or ' ' return ' ' .. icon .. count @@ -47,17 +35,6 @@ return { color_icons = true, }, }, - config = function(_, opts) - require('bufferline').setup(opts) - -- Fix bufferline when restoring a session - vim.api.nvim_create_autocmd({ 'BufAdd', 'BufDelete' }, { - callback = function() - vim.schedule(function() - pcall(nvim_bufferline) - end) - end, - }) - end, }, { 'mattn/emmet-vim', @@ -67,28 +44,13 @@ return { event = 'VeryLazy', version = false, -- Never set this value to "*"! Never! opts = { - provider = 'openrouter', - vendors = { - openai = { - endpoint = 'https://api.openai.com/v1', - model = 'gpt-4o', -- your desired model (or use gpt-4o, etc.) - timeout = 30000, -- Timeout in milliseconds, increase this for reasoning models - temperature = 0, - max_completion_tokens = 8192, -- Increase this to include reasoning tokens (for reasoning models) - --reasoning_effort = "medium", -- low|medium|high, only used for reasoning models - }, + provider = 'deepseek', + providers = { deepseek = { __inherited_from = 'openai', api_key_name = 'DEEPSEEK_API_KEY', - api_endpoint = 'https://api.deepseek.com', + endpoint = 'https://api.deepseek.com', model = 'deepseek-coder', - max_tokens = 200, - }, - openrouter = { - __inherited_from = 'openai', - endpoint = 'https://openrouter.ai/api/v1', - api_key_name = 'OPENROUTER_API_KEY', - model = 'mistralai/mistral-7b-instruct:free', }, }, }, @@ -136,4 +98,25 @@ return { }, }, { 'akinsho/toggleterm.nvim', version = '*', opts = {} }, + { + 'antosha417/nvim-lsp-file-operations', + dependencies = { + 'nvim-lua/plenary.nvim', + -- Uncomment whichever supported plugin(s) you use + -- "nvim-tree/nvim-tree.lua", + 'nvim-neo-tree/neo-tree.nvim', + -- "simonmclean/triptych.nvim" + }, + config = function() + require('lsp-file-operations').setup() + end, + }, + { + 'nvim-treesitter/nvim-treesitter', + dependencies = { + -- Add nvim-ts-autotag + { 'windwp/nvim-ts-autotag' }, + }, + opts = {}, + }, } diff --git a/lua/kickstart/plugins/autopairs.lua b/lua/kickstart/plugins/autopairs.lua deleted file mode 100644 index 386d392e..00000000 --- a/lua/kickstart/plugins/autopairs.lua +++ /dev/null @@ -1,8 +0,0 @@ --- autopairs --- https://github.com/windwp/nvim-autopairs - -return { - 'windwp/nvim-autopairs', - event = 'InsertEnter', - opts = {}, -} diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua index b4d2a10b..34ce6c5a 100644 --- a/lua/kickstart/plugins/neo-tree.lua +++ b/lua/kickstart/plugins/neo-tree.lua @@ -45,7 +45,7 @@ return { [''] = { 'open', config = { - open_command = 'tabnew', -- Альтернативный вариант параметра + open_command = 'tabnew', }, }, ['oa'] = 'avante_add_files', diff --git a/lua/kickstart/plugins/nvim-ts-autotag.lua b/lua/kickstart/plugins/nvim-ts-autotag.lua new file mode 100644 index 00000000..3272de25 --- /dev/null +++ b/lua/kickstart/plugins/nvim-ts-autotag.lua @@ -0,0 +1,5 @@ +return { + 'windwp/nvim-ts-autotag', + event = 'InsertEnter', + opts = {}, +}