This commit is contained in:
СЕМА 2025-04-10 22:48:33 +03:00
parent dde7d87052
commit 73175fd40c
5 changed files with 97 additions and 12 deletions

View File

@ -15,10 +15,5 @@ require("config.indent-blankline")
require("config.fzf") require("config.fzf")
require("config.mkdx") require("config.mkdx")
require("config.mutton") --require("config.mutton")
vim.api.nvim_create_autocmd("FileType", { require("config.cigan")
pattern = "mchat",
callback = function()
vim.opt_local.foldenable = false
end,
})

58
lua/config/cigan.lua Normal file
View File

@ -0,0 +1,58 @@
vim.api.nvim_set_keymap("n", "<leader><Enter>", ":lua SaveAndRunScript()<CR>", { noremap = true, silent = true })
function SaveAndRunScript()
-- Проверяем, что открыт именно буфер ~/cigan/ui.md
local current_buf = vim.api.nvim_buf_get_name(0)
local target_file = vim.fn.expand("~/desktop/govno/ui.md")
if current_buf ~= target_file then
vim.notify("Ошибка: Открыт не файл ~/desktop/govno/ui.md", vim.log.levels.ERROR)
return
end
-- Сохраняем изменения в текущем файле
vim.cmd("write")
-- Запускаем скрипт ~/cigan/interface.py асинхронно
local script_path = vim.fn.expand("~/dev/cigan/interface.py")
vim.fn.jobstart("bash " .. script_path, {
on_exit = function(_, exit_code)
if exit_code ~= 0 then
vim.notify("Ошибка при выполнении скрипта", vim.log.levels.ERROR)
return
end
-- Обновляем буфер ~/cigan/ui.md и переходим в конец файла
vim.cmd("edit")
vim.cmd('echo "Сгенерировано!"')
--vim.cmd("normal! G") -- Переход в конец файла
-- Добавляем нажатие 20 и Ctrl+e
--vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("2<C-e>", true, false, true), "n", true)
end,
})
end
vim.api.nvim_set_keymap('n', '<leader>y', ':lua CheckBufferAndRun()<CR>', { noremap = true, silent = false })
function CheckBufferAndRun()
-- Получаем полный путь к текущему файлу
local current_file = vim.fn.expand('%:p')
-- Путь к целевому файлу
local target_file = vim.fn.expand('~/desktop/govno/ui.md')
-- Проверяем, совпадает ли текущий файл с целевым
if current_file == target_file then
-- Выполняем скрипт на удаленном сервере через SSH
vim.cmd('!ssh xer@dev "~/cigan/new_chat.sh"')
vim.cmd('echo "Новый чат создан!"')
else
-- Выводим сообщение об ошибке
vim.cmd('echo "Ошибка: Эта команда работает только в файле ~/desktop/govno/ui.md"')
end
end

View File

@ -1,5 +1,27 @@
require'nvim-treesitter.configs'.setup { require'nvim-treesitter.configs'.setup {
ensure_installed = { "markdown", "bash", "markdown_inline", "lua", "python", "javascript", "html", "css", "c", "cpp", "rust" }, highlight = {
highlight = { enable = true }, enable = true,
indent = { enable = true } disable = function(lang, buf)
-- Проверяем, существует ли буфер и связан ли он с файлом
if not buf or buf == 0 then
return true
end
-- Получаем информацию о файле
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if not ok or not stats or not stats.size then
return true
end
-- Отключаем подсветку для больших файлов
local max_filesize = 500 * 1024 -- 500 KB
if stats.size > max_filesize then
return true
end
-- Включаем подсветку для всех остальных случаев
return false
end,
},
} }

View File

@ -1,5 +1,6 @@
require('render-markdown').setup({ require('render-markdown').setup({
render_modes = true, debounce = 100,
-- render_modes = true,
heading = { heading = {
enabled = true, enabled = true,
icons = { "", }, icons = { "", },
@ -7,7 +8,7 @@ require('render-markdown').setup({
border = { true, true, true, false, false, false}, border = { true, true, true, false, false, false},
border_virtual = true, border_virtual = true,
width = 'block', width = 'block',
right_pad = 2, right_pad = 1,
left_pad = 1, left_pad = 1,
}, },
sign = { enabled = false }, sign = { enabled = false },

View File

@ -16,6 +16,15 @@ return {
{ {
"rebelot/kanagawa.nvim", -- Kanagawa тема "rebelot/kanagawa.nvim", -- Kanagawa тема
}, },
{
"navarasu/onedark.nvim",
config = function()
require("onedark").setup({
style = "dark", -- Выберите стиль: 'dark', 'darker', 'cool', 'deep', 'warm', 'warmer'
})
require("onedark").load() -- Активируйте тему
end,
},
-- Иконки -- Иконки
{ {