Added avante and toggleterm
This commit is contained in:
parent
790032eb3b
commit
e5bea444a9
21
init.lua
21
init.lua
|
@ -195,10 +195,10 @@ vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' }
|
|||
-- Use CTRL+<hjkl> to switch between windows
|
||||
--
|
||||
-- See `:help wincmd` for a list of all window commands
|
||||
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
|
||||
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
|
||||
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
||||
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||
vim.keymap.set('n', '<leader>wh', '<C-w><C-h>', { desc = 'Move focus to the left window' })
|
||||
vim.keymap.set('n', '<leader>wl', '<C-w><C-l>', { desc = 'Move focus to the right window' })
|
||||
vim.keymap.set('n', '<leader>wj', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
||||
vim.keymap.set('n', '<leader>wk', '<C-w><C-k>', { 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,
|
||||
|
|
|
@ -7,8 +7,11 @@ vim.keymap.set('i', 'kj', '<Esc>', { desc = 'escape' })
|
|||
vim.keymap.set('n', '<Tab>', '<Cmd>BufferLineCycleNext<CR>')
|
||||
vim.keymap.set('n', '<S-Tab>', '<Cmd>BufferLineCyclePrev<CR>')
|
||||
|
||||
vim.keymap.set('n', ',,', '<Cmd>ToggleTerm<CR>', { desc = 'Open terminal in horizontal split' })
|
||||
vim.keymap.set('t', ',,', '<Cmd>ToggleTerm<CR>', { desc = 'Open terminal in horizontal split' })
|
||||
|
||||
-- Закрыть буфер
|
||||
vim.keymap.set('n', '<leader>bd', '<Cmd>Bdelete!<CR>')
|
||||
vim.keymap.set('n', '<C-q>', '<Cmd>bdelete<CR>')
|
||||
|
||||
-- Переход к буферу по номеру (например, Alt+1, Alt+2...)
|
||||
for i = 1, 9 do
|
||||
|
|
|
@ -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 {
|
|||
{ '<leader>bP', '<Cmd>BufferLineGroupClose ungrouped<CR>', desc = 'Delete Non-Pinned Buffers' },
|
||||
{ '<leader>br', '<Cmd>BufferLineCloseRight<CR>', desc = 'Delete Buffers to the Right' },
|
||||
{ '<leader>bl', '<Cmd>BufferLineCloseLeft<CR>', desc = 'Delete Buffers to the Left' },
|
||||
{ '<S-h>', '<cmd>BufferLineCyclePrev<cr>', desc = 'Prev Buffer' },
|
||||
{ '<S-l>', '<cmd>BufferLineCycleNext<cr>', desc = 'Next Buffer' },
|
||||
{ '<S-j>', '<cmd>BufferLineCyclePrev<cr>', desc = 'Prev Buffer' },
|
||||
{ '<S-k>', '<cmd>BufferLineCycleNext<cr>', desc = 'Next Buffer' },
|
||||
{ '<S-C-j>', '<cmd>BufferLineMovePrev<cr>', desc = 'Move buffer prev' },
|
||||
{ '<S-C-k>', '<cmd>BufferLineMoveNext<cr>', desc = 'Move buffer next' },
|
||||
{ '[b', '<cmd>BufferLineCyclePrev<cr>', desc = 'Prev Buffer' },
|
||||
{ ']b', '<cmd>BufferLineCycleNext<cr>', desc = 'Next Buffer' },
|
||||
{ '[B', '<cmd>BufferLineMovePrev<cr>', 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 = {} },
|
||||
}
|
||||
|
|
|
@ -11,19 +11,44 @@ return {
|
|||
},
|
||||
cmd = 'Neotree',
|
||||
keys = {
|
||||
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
|
||||
{ '<leader>e', ':Neotree reveal<CR>', 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',
|
||||
['<leader>e'] = 'close_window',
|
||||
['<C-cr>'] = {
|
||||
'open',
|
||||
config = {
|
||||
open_command = 'tabnew', -- Альтернативный вариант параметра
|
||||
},
|
||||
},
|
||||
['oa'] = 'avante_add_files',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue