From 36c66e33e66c1dfeb74f97e320b8fbc26b177661 Mon Sep 17 00:00:00 2001 From: grechkagk-thinkpad Date: Sun, 1 Feb 2026 16:42:22 +0800 Subject: [PATCH] 0.0.1 --- .gitignore | 1 + init.lua | 25 ++++++++++++++++ lua/config/lazy.lua | 26 ++++++++++++++++ lua/config/lazy.py | 3 ++ lua/plugins/cmp.lua | 44 +++++++++++++++++++++++++++ lua/plugins/conform.lua | 37 +++++++++++++++++++++++ lua/plugins/github-theme.lua | 13 ++++++++ lua/plugins/mason.lua | 58 ++++++++++++++++++++++++++++++++++++ lua/plugins/mini.lua | 4 +++ lua/plugins/oil.lua | 15 ++++++++++ lua/plugins/project.lua | 5 ++++ lua/plugins/snacks.lua | 57 +++++++++++++++++++++++++++++++++++ lua/plugins/telescope.lua | 9 ++++++ lua/plugins/test.md | 5 ++++ lua/plugins/themery.lua | 16 ++++++++++ lua/plugins/treesitter.lua | 12 ++++++++ lua/plugins/which-key.lua | 18 +++++++++++ 17 files changed, 348 insertions(+) create mode 100644 .gitignore create mode 100644 init.lua create mode 100644 lua/config/lazy.lua create mode 100644 lua/config/lazy.py create mode 100644 lua/plugins/cmp.lua create mode 100644 lua/plugins/conform.lua create mode 100644 lua/plugins/github-theme.lua create mode 100644 lua/plugins/mason.lua create mode 100644 lua/plugins/mini.lua create mode 100644 lua/plugins/oil.lua create mode 100644 lua/plugins/project.lua create mode 100644 lua/plugins/snacks.lua create mode 100644 lua/plugins/telescope.lua create mode 100644 lua/plugins/test.md create mode 100644 lua/plugins/themery.lua create mode 100644 lua/plugins/treesitter.lua create mode 100644 lua/plugins/which-key.lua diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..76aade5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +./lazy-lock.json diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..79b9b9e --- /dev/null +++ b/init.lua @@ -0,0 +1,25 @@ +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +vim.opt.backspace = "2" +vim.opt.laststatus = 2 +vim.opt.autowrite = true +vim.opt.cursorline = true +vim.opt.autoread = true + +vim.opt.tabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.shiftround = true +vim.opt.expandtab = true + +vim.opt.number = true +vim.opt.relativenumber = true + +require("config.lazy") + +vim.keymap.set("n", "h", ":noh") + +-- terminal +vim.keymap.set("t", "", [[]], { desc = "Exit terminal mode" }) + +vim.keymap.set("n", "t", ":tabnew", { desc = "Open tab" }) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..2249003 --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,26 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +require("lazy").setup({ + spec = { + { import = "plugins" }, + }, + checker = { enabled = true }, + install = { colorscheme = { "github_dark", "habamax" } }, +}) diff --git a/lua/config/lazy.py b/lua/config/lazy.py new file mode 100644 index 0000000..e727d54 --- /dev/null +++ b/lua/config/lazy.py @@ -0,0 +1,3 @@ +for i in range(100): + print(i) +print("hello world") diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua new file mode 100644 index 0000000..7e5b14c --- /dev/null +++ b/lua/plugins/cmp.lua @@ -0,0 +1,44 @@ +return { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + }, + + config = function() + local cmp = require("cmp") + + cmp.setup({ + completion = { + completeopt = "menu,menuone,noinsert", + }, + + preselect = cmp.PreselectMode.Item, + + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.select_prev_item(), + + [""] = cmp.mapping.complete(), + + [""] = cmp.mapping.confirm({ select = true }), + }), + + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "path" }, + }, { + { name = "buffer" }, + }), + + formatting = { + fields = { "kind", "abbr", "menu" }, + }, + }) + end, +} diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua new file mode 100644 index 0000000..a755d3b --- /dev/null +++ b/lua/plugins/conform.lua @@ -0,0 +1,37 @@ +return { + "stevearc/conform.nvim", + event = { "BufWritePre" }, + cmd = { "ConformInfo" }, + keys = { + { + "f", + function() + require("conform").format({ async = true }) + end, + mode = "", + desc = "Format buffer", + }, + }, + opts = { + formatters_by_ft = { + lua = { "stylua" }, + python = { "ruff", "black" }, + javascript = { "prettierd", "prettier", stop_after_first = true }, + }, + default_format_opts = { + lsp_format = "fallback", + }, + format_on_save = { + timeout_ms = 500, + lsp_fallback = true, -- современный стандарт + }, + formatters = { + shfmt = { + append_args = { "-i", "2" }, + }, + }, + }, + init = function() + vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" + end, +} diff --git a/lua/plugins/github-theme.lua b/lua/plugins/github-theme.lua new file mode 100644 index 0000000..7cd4e88 --- /dev/null +++ b/lua/plugins/github-theme.lua @@ -0,0 +1,13 @@ +return { + "projekt0n/github-nvim-theme", + name = "github-theme", + lazy = false, + priority = 1000, + config = function() + require("github-theme").setup({ + -- здесь можно добавить свои опции, если нужно + }) + + vim.cmd("colorscheme github_dark") + end, +} diff --git a/lua/plugins/mason.lua b/lua/plugins/mason.lua new file mode 100644 index 0000000..a2c8afa --- /dev/null +++ b/lua/plugins/mason.lua @@ -0,0 +1,58 @@ +return { + { + "neovim/nvim-lspconfig", + dependencies = { + { "williamboman/mason.nvim" }, + { "williamboman/mason-lspconfig.nvim" }, + { "hrsh7th/nvim-cmp" }, + }, + + config = function() + -- Mason + require("mason").setup() + + local lspconfig = require("lspconfig") + + -- Capabilities (для nvim-cmp) + local capabilities = vim.lsp.protocol.make_client_capabilities() + local ok, cmp_lsp = pcall(require, "cmp_nvim_lsp") + if ok then + capabilities = cmp_lsp.default_capabilities(capabilities) + end + + -- Mason-LSP + require("mason-lspconfig").setup({ + ensure_installed = { + "lua_ls", + "pyright", + "clangd", + "rust_analyzer", + "ts_ls", + }, + + handlers = { + -- дефолт для всех серверов + function(server_name) + lspconfig[server_name].setup({ + capabilities = capabilities, + }) + end, + + -- кастом для lua + ["lua_ls"] = function() + lspconfig.lua_ls.setup({ + capabilities = capabilities, + settings = { + Lua = { + diagnostics = { globals = { "vim" } }, + workspace = { checkThirdParty = false }, + telemetry = { enable = false }, + }, + }, + }) + end, + }, + }) + end, + }, +} diff --git a/lua/plugins/mini.lua b/lua/plugins/mini.lua new file mode 100644 index 0000000..3b50686 --- /dev/null +++ b/lua/plugins/mini.lua @@ -0,0 +1,4 @@ +return { + "nvim-mini/mini.nvim", + version = "*", +} diff --git a/lua/plugins/oil.lua b/lua/plugins/oil.lua new file mode 100644 index 0000000..0bd89d0 --- /dev/null +++ b/lua/plugins/oil.lua @@ -0,0 +1,15 @@ +return { + "stevearc/oil.nvim", + ---@module 'oil' + ---@type oil.SetupOpts + opts = {}, + -- Optional dependencies + dependencies = { { "nvim-mini/mini.icons", opts = {} } }, + -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons + -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. + keys = { + { "-", "Oil", desc = "Oil: Open parent directory" }, + { "e", "Oil", desc = "Oil: Explorer" }, + }, + lazy = false, +} diff --git a/lua/plugins/project.lua b/lua/plugins/project.lua new file mode 100644 index 0000000..da0c412 --- /dev/null +++ b/lua/plugins/project.lua @@ -0,0 +1,5 @@ +return { + "DrKJeff16/project.nvim", + dependencies = {}, + opts = {}, +} diff --git a/lua/plugins/snacks.lua b/lua/plugins/snacks.lua new file mode 100644 index 0000000..1eec86b --- /dev/null +++ b/lua/plugins/snacks.lua @@ -0,0 +1,57 @@ +return { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + + opts = { + dashboard = { + enabled = true, + preset = { + header = [[ + ░▒▓██████▓▒░░▒▓█▓▒░░▒▓█▓▒░ ░▒▓███████▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓██████████████▓▒░ +░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░ +░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░ +░▒▓█▓▒▒▓███▓▒░▒▓███████▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░ +░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▓█▓▒░ ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░ +░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓██▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▓█▓▒░ ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░ + ░▒▓██████▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓██▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓██▓▒░ ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░ +workspace by grechkagk :3 ]], + keys = { + { icon = " ", key = "f", desc = "Find File", action = ":lua Snacks.dashboard.pick('files')" }, + { icon = " ", key = "n", desc = "New File", action = ":ene | startinsert" }, + { + icon = " ", + key = "g", + desc = "Find Text", + action = ":lua Snacks.dashboard.pick('live_grep')", + }, + { + icon = " ", + key = "r", + desc = "Recent Files", + action = ":lua Snacks.dashboard.pick('oldfiles')", + }, + { + icon = " ", + key = "c", + desc = "Config", + action = ":lua Snacks.dashboard.pick('files', {cwd = vim.fn.stdpath('config')})", + }, + { icon = " ", key = "s", desc = "Restore Session", section = "session" }, + { + icon = "󰒲 ", + key = "L", + desc = "Lazy", + action = ":Lazy", + enabled = package.loaded.lazy ~= nil, + }, + { icon = " ", key = "q", desc = "Quit", action = ":qa" }, + }, + }, + sections = { + { section = "header" }, + { section = "keys", gap = 1, padding = 1 }, + }, + }, + }, +} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..b247217 --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,9 @@ +return { + "nvim-telescope/telescope.nvim", + version = "*", + dependencies = { + "nvim-lua/plenary.nvim", + -- optional but recommended + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + }, +} diff --git a/lua/plugins/test.md b/lua/plugins/test.md new file mode 100644 index 0000000..db67cbb --- /dev/null +++ b/lua/plugins/test.md @@ -0,0 +1,5 @@ +# TEST TEXT! + + +hello world! +:3 diff --git a/lua/plugins/themery.lua b/lua/plugins/themery.lua new file mode 100644 index 0000000..619d77c --- /dev/null +++ b/lua/plugins/themery.lua @@ -0,0 +1,16 @@ +return { + "zaldih/themery.nvim", + lazy = false, + config = function() + require("themery").setup({ + themes = { + "github_dark", + "github_light", + }, + livePreview = true, + }) + end, + keys = { + { "c", "Themery", desc = "theme picker" }, + }, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..59d925b --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,12 @@ +return { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + lazy = false, + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { "lua", "vim", "vimdoc", "query" }, + highlight = { enable = true }, + indent = { enable = true }, + }) + end, +} diff --git a/lua/plugins/which-key.lua b/lua/plugins/which-key.lua new file mode 100644 index 0000000..8b85fc2 --- /dev/null +++ b/lua/plugins/which-key.lua @@ -0,0 +1,18 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Local Keymaps (which-key)", + }, + }, +}