From 7f1d7f48dd117cbf27eadcaca50c0a7b305586ae Mon Sep 17 00:00:00 2001 From: Archie Fox Date: Fri, 25 Jul 2025 13:09:33 +0300 Subject: [PATCH] Init commit --- .gitignore | 11 + LICENSE | 201 ++++++++++++++++++ README.md | 4 + init.lua | 7 + lua/config/autocmds.lua | 53 +++++ lua/config/bufferline.lua | 25 +++ lua/config/hyprls.lua | 12 ++ lua/config/image.lua | 38 ++++ lua/config/keymaps.lua | 65 ++++++ lua/config/lazy.lua | 53 +++++ lua/config/luasnip.lua | 19 ++ lua/config/options.lua | 11 + lua/plugins/disabled.lua | 6 + lua/plugins/example.lua | 197 +++++++++++++++++ lua/plugins/glow.lua | 15 ++ lua/plugins/init.lua | 3 + lua/plugins/luarocks.lua | 7 + lua/plugins/luasnip.lua | 7 + lua/plugins/markdown-preview.lua | 32 +++ lua/plugins/markdown-togglecheck.lua | 11 + lua/plugins/neorg.lua | 29 +++ lua/plugins/noice.lua | 12 ++ lua/plugins/nvim-cmp.lua | 305 +++++++++++++++++++++++++++ lua/plugins/obsidian.lua | 45 ++++ lua/plugins/snacks.lua | 121 +++++++++++ lua/plugins/vim-markdown.lua | 23 ++ lua/plugins/vim-table-mode.lua | 9 + lua/plugins/yazi.lua | 42 ++++ lua/snippets/go.lua | 103 +++++++++ stylua.toml | 3 + 30 files changed, 1469 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 init.lua create mode 100644 lua/config/autocmds.lua create mode 100644 lua/config/bufferline.lua create mode 100644 lua/config/hyprls.lua create mode 100644 lua/config/image.lua create mode 100644 lua/config/keymaps.lua create mode 100644 lua/config/lazy.lua create mode 100644 lua/config/luasnip.lua create mode 100644 lua/config/options.lua create mode 100644 lua/plugins/disabled.lua create mode 100644 lua/plugins/example.lua create mode 100644 lua/plugins/glow.lua create mode 100644 lua/plugins/init.lua create mode 100644 lua/plugins/luarocks.lua create mode 100644 lua/plugins/luasnip.lua create mode 100644 lua/plugins/markdown-preview.lua create mode 100644 lua/plugins/markdown-togglecheck.lua create mode 100644 lua/plugins/neorg.lua create mode 100644 lua/plugins/noice.lua create mode 100644 lua/plugins/nvim-cmp.lua create mode 100644 lua/plugins/obsidian.lua create mode 100644 lua/plugins/snacks.lua create mode 100644 lua/plugins/vim-markdown.lua create mode 100644 lua/plugins/vim-table-mode.lua create mode 100644 lua/plugins/yazi.lua create mode 100644 lua/snippets/go.lua create mode 100644 stylua.toml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..58b5b0d --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +tt.* +.tests +doc/tags +debug +.repro +foo.* +*.log +data +lazy-lock.json +lazyvim.json +.neoconf.json diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..185280b --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# πŸ’€ LazyVim + +A starter template for [LazyVim](https://github.com/LazyVim/LazyVim). +Refer to the [documentation](https://lazyvim.github.io/installation) to get started. diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..fb47285 --- /dev/null +++ b/init.lua @@ -0,0 +1,7 @@ +-- bootstrap lazy.nvim, LazyVim and your plugins +require("config.lazy") +require("config.luasnip") +require("config.hyprls") +require("config.bufferline") + +require("colorizer").setup() diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua new file mode 100644 index 0000000..48e3398 --- /dev/null +++ b/lua/config/autocmds.lua @@ -0,0 +1,53 @@ +-- Autocmds are automatically loaded on the VeryLazy event +-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua +-- +-- Add any additional autocmds here +-- with `vim.api.nvim_create_autocmd` +-- +-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults) +-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell") +-- Автокоманды для Markdown Ρ„Π°ΠΉΠ»ΠΎΠ² +vim.api.nvim_create_augroup("MarkdownSettings", { clear = true }) + +vim.api.nvim_create_autocmd("FileType", { + group = "MarkdownSettings", + pattern = "markdown", + callback = function() + -- Настройка пСрСноса строк + vim.opt_local.wrap = true + vim.opt_local.linebreak = true + vim.opt_local.showbreak = "β†ͺ " + + -- Настройка отступов + vim.opt_local.tabstop = 2 + vim.opt_local.shiftwidth = 2 + vim.opt_local.softtabstop = 2 + vim.opt_local.expandtab = true + + -- Π’ΠΊΠ»ΡŽΡ‡Π΅Π½ΠΈΠ΅ ΠΏΡ€ΠΎΠ²Π΅Ρ€ΠΊΠΈ ΠΎΡ€Ρ„ΠΎΠ³Ρ€Π°Ρ„ΠΈΠΈ + vim.opt_local.spell = false + vim.opt_local.spelllang = "en,ru" + + -- Π‘ΠΊΡ€Ρ‹Ρ‚ΠΈΠ΅ Ρ€Π°Π·ΠΌΠ΅Ρ‚ΠΊΠΈ + vim.opt_local.conceallevel = 2 + + -- АвтоматичСскоС сохранСниС ΠΏΡ€ΠΈ ΠΏΠ΅Ρ€Π΅ΠΊΠ»ΡŽΡ‡Π΅Π½ΠΈΠΈ Π±ΡƒΡ„Π΅Ρ€ΠΎΠ² + vim.opt_local.autowrite = true + end, +}) + +-- АвтоматичСскоС ΠΎΠ±Π½ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ Π²Ρ€Π΅ΠΌΠ΅Π½ΠΈ ΠΌΠΎΠ΄ΠΈΡ„ΠΈΠΊΠ°Ρ†ΠΈΠΈ +vim.api.nvim_create_autocmd("BufWritePre", { + group = "MarkdownSettings", + pattern = "*.md", + callback = function() + local lines = vim.api.nvim_buf_get_lines(0, 0, 10, false) + for i, line in ipairs(lines) do + if line:match("^modified:") then + local new_line = "modified: " .. os.date("%Y-%m-%d %H:%M:%S") + vim.api.nvim_buf_set_lines(0, i - 1, i, false, { new_line }) + break + end + end + end, +}) diff --git a/lua/config/bufferline.lua b/lua/config/bufferline.lua new file mode 100644 index 0000000..db64eb8 --- /dev/null +++ b/lua/config/bufferline.lua @@ -0,0 +1,25 @@ +local bufferline = require("bufferline") +bufferline.setup({ + options = { + mode = "buffers", -- set to "tabs" to only show tabpages instead + style_preset = bufferline.style_preset.no_bold, -- or bufferline.style_preset.minimal, + -- separator_style = "slant", + themable = true, -- allows highlight groups to be overriden i.e. sets highlights as default + numbers = "ordinal", + close_command = "bdelete! %d", -- can be a string | function, | false see "Mouse actions" + offsets = { + { + filetype = "neo-tree", + text = "File Explorer", + text_align = "center", + separator = false, + }, + }, + indicator = { + icon = "", -- this should be omitted if indicator style is not 'icon' + style = "underline", + }, + always_show_bufferline = true, + diagnostics = "nvim_lsp", + }, +}) diff --git a/lua/config/hyprls.lua b/lua/config/hyprls.lua new file mode 100644 index 0000000..51fbe20 --- /dev/null +++ b/lua/config/hyprls.lua @@ -0,0 +1,12 @@ +-- Hyprlang LSP +vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { + pattern = { "*.hl", "hypr*.conf" }, + callback = function(event) + print(string.format("starting hyprls for %s", vim.inspect(event))) + vim.lsp.start({ + name = "hyprlang", + cmd = { "hyprls" }, + root_dir = vim.fn.getcwd(), + }) + end, +}) diff --git a/lua/config/image.lua b/lua/config/image.lua new file mode 100644 index 0000000..3bc5f5e --- /dev/null +++ b/lua/config/image.lua @@ -0,0 +1,38 @@ +require("image").setup({ + backend = "kitty", + processor = "magick_rock", -- or "magick_rock" + integrations = { + markdown = { + enabled = true, + clear_in_insert_mode = false, + download_remote_images = true, + only_render_image_at_cursor = false, + only_render_image_at_cursor_mode = "popup", + floating_windows = false, -- if true, images will be rendered in floating markdown windows + filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here + }, + neorg = { + enabled = true, + filetypes = { "norg" }, + }, + typst = { + enabled = true, + filetypes = { "typst" }, + }, + html = { + enabled = false, + }, + css = { + enabled = false, + }, + }, + max_width = nil, + max_height = nil, + max_width_window_percentage = nil, + max_height_window_percentage = 50, + window_overlap_clear_enabled = false, -- toggles images when windows are overlapped + window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "snacks_notif", "scrollview", "scrollview_sign" }, + editor_only_render_when_focused = false, -- auto show/hide images when the editor gains/looses focus + tmux_show_only_in_active_window = false, -- auto show/hide images in the correct Tmux window (needs visual-activity off) + hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp", "*.avif" }, -- render image files as images when opened +}) diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua new file mode 100644 index 0000000..793229f --- /dev/null +++ b/lua/config/keymaps.lua @@ -0,0 +1,65 @@ +-- Keymaps are automatically loaded on the VeryLazy event +-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua +-- Add any additional keymaps here + +local k = vim.keymap + +-- k.set("n", ";", ":", { desc = "" }) +k.set("i", "jj", "", { desc = "" }) +k.set("i", "jk", "w", { desc = "Save" }) + +k.set("n", "a", ":keepjumps normal! ggVG") + +k.set({ "n", "v" }, "", ":lua Snacks.terminal.get()", { desc = "Terminal" }) +k.set({ "t", "n", "v" }, "", "h", { desc = "Go to left window" }) +k.set({ "t", "n", "v" }, "", "j", { desc = "Go to bottom window" }) +k.set({ "t", "n", "v" }, "", "k", { desc = "Go to top window" }) +k.set({ "t", "n", "v" }, "", "l", { desc = "Go to right window" }) + +k.set("n", "li", "LspInfo", { desc = "LSP Info" }) +k.set("n", "o", ":lua Snacks.dashboard()", { desc = "Dashboard" }) + +-- ΠžΡΠ½ΠΎΠ²Π½Ρ‹Π΅ горячиС клавиши для Obsidian +k.set("n", "of", ":ObsidianQuickSwitch", { desc = "Quick switch" }) +k.set("n", "on", ":ObsidianNew", { desc = "New note" }) +k.set("n", "os", ":ObsidianSearch", { desc = "Search notes" }) +k.set("n", "ot", ":ObsidianTags", { desc = "Tags" }) +k.set("n", "ob", ":ObsidianBacklinks", { desc = "Backlinks" }) +k.set("n", "ol", ":ObsidianLinks", { desc = "Links" }) +k.set("n", "oo", ":ObsidianOpen", { desc = "Open in Obsidian" }) +k.set("n", "or", ":ObsidianRename", { desc = "Rename note" }) +k.set("n", "op", ":ObsidianPasteImg", { desc = "Paste image" }) +k.set("n", "ow", ":ObsidianWorkspace", { desc = "Switch workspace" }) + +-- ГорячиС клавиши для Markdown +k.set("n", "mp", ":MarkdownPreviewToggle", { desc = "Toggle preview" }) +k.set("n", "mg", ":Glow", { desc = "Glow preview" }) +k.set("n", "mt", ":TableModeToggle", { desc = "Table mode" }) +k.set("n", "mc", ":lua require('markdown-togglecheck').toggle()", { desc = "Toggle checkbox" }) + +-- Splitting & Resizing +k.set("n", "sv", ":vsplit", { desc = "Split window vertically" }) +k.set("n", "sh", ":split", { desc = "Split window horizontally" }) +k.set("n", "", ":resize +2", { desc = "Increase window height" }) +k.set("n", "", ":resize -2", { desc = "Decrease window height" }) +k.set("n", "", ":vertical resize -2", { desc = "Decrease window width" }) +k.set("n", "", ":vertical resize +2", { desc = "Increase window width" }) + +-- Move lines up/down +k.set("n", "", ":m .+1==", { desc = "Move line down" }) +k.set("n", "", ":m .-2==", { desc = "Move line up" }) +k.set("v", "", ":m '>+1gv=gv", { desc = "Move selection down" }) +k.set("v", "", ":m '<-2gv=gv", { desc = "Move selection up" }) + +-- Better indenting in visual mode +k.set("v", "<", "", ">gv", { desc = "Indent right and reselect" }) + +vim.keymap.set("n", "gg", function() + vim.api.nvim_win_set_cursor(0, { 1, 0 }) +end, { desc = "Go to first line" }) + +vim.keymap.set("n", "G", function() + local line_count = vim.api.nvim_buf_line_count(0) + vim.api.nvim_win_set_cursor(0, { line_count, 0 }) +end, { desc = "Go to last line" }) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..d73bfa1 --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,53 @@ +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) + +require("lazy").setup({ + spec = { + -- add LazyVim and import its plugins + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- import/override with your plugins + { import = "plugins" }, + }, + defaults = { + -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. + -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. + lazy = false, + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = false, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + }, + install = { colorscheme = { "tokyonight", "habamax" } }, + checker = { + enabled = true, -- check for plugin updates periodically + notify = false, -- notify on update + }, -- automatically check for plugin updates + performance = { + rtp = { + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + -- "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/lua/config/luasnip.lua b/lua/config/luasnip.lua new file mode 100644 index 0000000..bbb4c1e --- /dev/null +++ b/lua/config/luasnip.lua @@ -0,0 +1,19 @@ +require("luasnip.loaders.from_lua").lazy_load({ paths = "~/.config/nvim/lua/snippets" }) + +local ls = require("luasnip") + +vim.keymap.set({ "i" }, "", function() + ls.expand() +end, { silent = true }) +vim.keymap.set({ "i", "s" }, "", function() + ls.jump(1) +end, { silent = true }) +vim.keymap.set({ "i", "s" }, "", function() + ls.jump(-1) +end, { silent = true }) + +vim.keymap.set({ "i", "s" }, "", function() + if ls.choice_active() then + ls.change_choice(1) + end +end, { silent = true }) diff --git a/lua/config/options.lua b/lua/config/options.lua new file mode 100644 index 0000000..bc9734b --- /dev/null +++ b/lua/config/options.lua @@ -0,0 +1,11 @@ +-- Options are automatically loaded before lazy.nvim startup +-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua +-- Add any additional options here +O = vim.opt + +O.swapfile = false +O.fileformat = "unix" +O.wrap = true + +-- НС Π°Π²Ρ‚ΠΎΠΊΠΎΠΌΠΌΠ΅Π½Ρ‚ΠΈΡ€ΠΎΠ²Π°Ρ‚ΡŒ Π½ΠΎΠ²Ρ‹Π΅ Π»ΠΈΠ½ΠΈΠΈ ΠΏΡ€ΠΈ ΠΏΠ΅Ρ€Π΅Ρ…ΠΎΠ΄Π΅ Π½Π° Π½ΠΎΠ²ΡƒΡŽ строку +vim.cmd([[autocmd BufEnter * set fo-=c fo-=r fo-=o]]) diff --git a/lua/plugins/disabled.lua b/lua/plugins/disabled.lua new file mode 100644 index 0000000..ad86440 --- /dev/null +++ b/lua/plugins/disabled.lua @@ -0,0 +1,6 @@ +return { + -- disable trouble + { "akinsho/bufferline.nvim", enabled = true }, + { "hrsh7th/nvim-cmp", enabled = false }, + { "folke/snacks.nvim", enabled = true }, +} diff --git a/lua/plugins/example.lua b/lua/plugins/example.lua new file mode 100644 index 0000000..17f53d6 --- /dev/null +++ b/lua/plugins/example.lua @@ -0,0 +1,197 @@ +-- since this is just an example spec, don't actually load anything here and return an empty spec +-- stylua: ignore +if true then return {} end + +-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim +-- +-- In your plugin files, you can: +-- * add extra plugins +-- * disable/enabled LazyVim plugins +-- * override the configuration of LazyVim plugins +return { + -- add gruvbox + { "ellisonleao/gruvbox.nvim" }, + + -- Configure LazyVim to load gruvbox + { + "LazyVim/LazyVim", + opts = { + colorscheme = "gruvbox", + }, + }, + + -- change trouble config + { + "folke/trouble.nvim", + -- opts will be merged with the parent spec + opts = { use_diagnostic_signs = true }, + }, + + -- disable trouble + { "folke/trouble.nvim", enabled = false }, + + -- override nvim-cmp and add cmp-emoji + { + "hrsh7th/nvim-cmp", + dependencies = { "hrsh7th/cmp-emoji" }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + table.insert(opts.sources, { name = "emoji" }) + end, + }, + + -- change some telescope options and a keymap to browse plugin files + { + "nvim-telescope/telescope.nvim", + keys = { + -- add a keymap to browse plugin files + -- stylua: ignore + { + "fp", + function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end, + desc = "Find Plugin File", + }, + }, + -- change some options + opts = { + defaults = { + layout_strategy = "horizontal", + layout_config = { prompt_position = "top" }, + sorting_strategy = "ascending", + winblend = 0, + }, + }, + }, + + -- add pyright to lspconfig + { + "neovim/nvim-lspconfig", + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- pyright will be automatically installed with mason and loaded with lspconfig + pyright = {}, + }, + }, + }, + + -- add tsserver and setup with typescript.nvim instead of lspconfig + { + "neovim/nvim-lspconfig", + dependencies = { + "jose-elias-alvarez/typescript.nvim", + init = function() + require("lazyvim.util").lsp.on_attach(function(_, buffer) + -- stylua: ignore + vim.keymap.set( "n", "co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" }) + vim.keymap.set("n", "cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer }) + end) + end, + }, + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- tsserver will be automatically installed with mason and loaded with lspconfig + tsserver = {}, + }, + -- you can do any additional lsp server setup here + -- return true if you don't want this server to be setup with lspconfig + ---@type table + setup = { + -- example to setup with typescript.nvim + tsserver = function(_, opts) + require("typescript").setup({ server = opts }) + return true + end, + -- Specify * to use this function as a fallback for any server + -- ["*"] = function(server, opts) end, + }, + }, + }, + + -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, + -- treesitter, mason and typescript.nvim. So instead of the above, you can use: + { import = "lazyvim.plugins.extras.lang.typescript" }, + + -- add more treesitter parsers + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "bash", + "html", + "javascript", + "json", + "lua", + "markdown", + "markdown_inline", + "python", + "query", + "regex", + "tsx", + "typescript", + "vim", + "yaml", + }, + }, + }, + + -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above + -- would overwrite `ensure_installed` with the new value. + -- If you'd rather extend the default config, use the code below instead: + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + -- add tsx and treesitter + vim.list_extend(opts.ensure_installed, { + "tsx", + "typescript", + }) + end, + }, + + -- the opts function can also be used to change the default opts: + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function(_, opts) + table.insert(opts.sections.lualine_x, { + function() + return "πŸ˜„" + end, + }) + end, + }, + + -- or you can return new options to override all the defaults + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function() + return { + --[[add your custom lualine config here]] + } + end, + }, + + -- use mini.starter instead of alpha + { import = "lazyvim.plugins.extras.ui.mini-starter" }, + + -- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc + { import = "lazyvim.plugins.extras.lang.json" }, + + -- add any tools you want to have installed below + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "stylua", + "shellcheck", + "shfmt", + "flake8", + }, + }, + }, +} diff --git a/lua/plugins/glow.lua b/lua/plugins/glow.lua new file mode 100644 index 0000000..908fb48 --- /dev/null +++ b/lua/plugins/glow.lua @@ -0,0 +1,15 @@ +return { + "ellisonleao/glow.nvim", + config = true, + cmd = "Glow", + ft = "markdown", + opts = { + border = "shadow", + style = "dark", + pager = false, + width = 120, + height = 100, + width_ratio = 0.8, + height_ratio = 0.8, + }, +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua new file mode 100644 index 0000000..90d3378 --- /dev/null +++ b/lua/plugins/init.lua @@ -0,0 +1,3 @@ +return { + { "norcalli/nvim-colorizer.lua" }, +} diff --git a/lua/plugins/luarocks.lua b/lua/plugins/luarocks.lua new file mode 100644 index 0000000..1267b63 --- /dev/null +++ b/lua/plugins/luarocks.lua @@ -0,0 +1,7 @@ +return { + "vhyrro/luarocks.nvim", + priority = 1001, -- this plugin needs to run before anything else + opts = { + rocks = { "magick" }, + }, +} diff --git a/lua/plugins/luasnip.lua b/lua/plugins/luasnip.lua new file mode 100644 index 0000000..3d8d7b4 --- /dev/null +++ b/lua/plugins/luasnip.lua @@ -0,0 +1,7 @@ +return { + "L3MON4D3/LuaSnip", + -- follow latest release. + version = "v2.*", -- Replace by the latest released major (first number of latest release) + -- install jsregexp (optional!). + build = "make install_jsregexp", +} diff --git a/lua/plugins/markdown-preview.lua b/lua/plugins/markdown-preview.lua new file mode 100644 index 0000000..a0bf515 --- /dev/null +++ b/lua/plugins/markdown-preview.lua @@ -0,0 +1,32 @@ +return { + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + ft = { "markdown" }, + build = function() + vim.fn["mkdp#util#install"]() + end, + config = function() + vim.g.mkdp_auto_start = 0 + vim.g.mkdp_auto_close = 1 + vim.g.mkdp_refresh_slow = 0 + vim.g.mkdp_command_for_global = 0 + vim.g.mkdp_open_to_the_world = 0 + vim.g.mkdp_open_ip = "" + vim.g.mkdp_browser = "" + vim.g.mkdp_echo_preview_url = 0 + vim.g.mkdp_browserfunc = "" + vim.g.mkdp_preview_options = { + mkit = {}, + katex = {}, + uml = {}, + maid = {}, + disable_sync_scroll = 0, + sync_scroll_type = "middle", + hide_yaml_meta = 1, + } + vim.g.mkdp_markdown_css = "" + vim.g.mkdp_highlight_css = "" + vim.g.mkdp_port = "" + vim.g.mkdp_page_title = "γ€Œ${name}」" + end, +} diff --git a/lua/plugins/markdown-togglecheck.lua b/lua/plugins/markdown-togglecheck.lua new file mode 100644 index 0000000..bbd5aee --- /dev/null +++ b/lua/plugins/markdown-togglecheck.lua @@ -0,0 +1,11 @@ +return { + "nfrid/markdown-togglecheck", + dependencies = { "nfrid/treesitter-utils" }, + ft = "markdown", + config = function() + require("markdown-togglecheck").setup({ + create_checkbox = true, + remove_checkbox = true, + }) + end, +} diff --git a/lua/plugins/neorg.lua b/lua/plugins/neorg.lua new file mode 100644 index 0000000..7c0800d --- /dev/null +++ b/lua/plugins/neorg.lua @@ -0,0 +1,29 @@ +return { + "nvim-neorg/neorg", + lazy = false, -- Disable lazy loading as some `lazy.nvim` distributions set `lazy = true` by default + version = "*", -- Pin Neorg to the latest stable release + config = function() + require("neorg").setup({ + lazy = false, + load = { + ["core.defaults"] = {}, + ["core.concealer"] = {}, -- We added this line! + ["core.summary"] = {}, -- We added this line! + ["core.journal"] = { + config = { + journal_folder = "journal", + }, + }, -- We added this line! + ["core.dirman"] = { + config = { + workspaces = { + default = "~/Share/notes/default", + journal = "~/Share/notes/journal", + }, + default_workspace = "default", + }, + }, + }, + }) + end, +} diff --git a/lua/plugins/noice.lua b/lua/plugins/noice.lua new file mode 100644 index 0000000..6d41049 --- /dev/null +++ b/lua/plugins/noice.lua @@ -0,0 +1,12 @@ +return { + "folke/noice.nvim", + opts = { + cmdline = { + enabled = true, + view = "cmdline", + }, + messages = { + enabled = true, + }, + }, +} diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua new file mode 100644 index 0000000..740c7b6 --- /dev/null +++ b/lua/plugins/nvim-cmp.lua @@ -0,0 +1,305 @@ +return { + "hrsh7th/nvim-cmp", + version = false, -- last release is way too old + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "hrsh7th/cmp-nvim-lua", + "hrsh7th/cmp-emoji", + "hrsh7th/cmp-calc", + "f3fora/cmp-spell", + "hrsh7th/cmp-nvim-lsp-signature-help", + "onsails/lspkind.nvim", + }, + opts = function() + vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) + local cmp = require("cmp") + local defaults = require("cmp.config.default")() + local lspkind = require("lspkind") + + -- ΠŸΡ€ΠΎΠ²Π΅Ρ€ΡΠ΅ΠΌ Π½Π°Π»ΠΈΡ‡ΠΈΠ΅ luasnip + local has_luasnip = pcall(require, "luasnip") + local luasnip = has_luasnip and require("luasnip") or nil + + return { + completion = { + completeopt = "menu,menuone,noinsert", + }, + snippet = { + expand = function(args) + if luasnip then + luasnip.lsp_expand(args.body) + end + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), -- Accept currently selected item and replace + [""] = function(fallback) + cmp.abort() + fallback() + end, + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip and luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip and luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }), + sources = cmp.config.sources({ + { + name = "nvim_lsp", + priority = 1000, + -- Π‘ΠΏΠ΅Ρ†ΠΈΠ°Π»ΡŒΠ½Ρ‹Π΅ настройки для Go + entry_filter = function(entry, ctx) + local kind = entry:get_kind() + -- Для Go Ρ„Π°ΠΉΠ»ΠΎΠ² ΠΏΡ€ΠΈΠΎΡ€ΠΈΡ‚ΠΈΠ·ΠΈΡ€ΡƒΠ΅ΠΌ Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΈ ΠΈ ΠΌΠ΅Ρ‚ΠΎΠ΄Ρ‹ + if vim.bo.filetype == "go" then + if + kind == require("cmp.types").lsp.CompletionItemKind.Function + or kind == require("cmp.types").lsp.CompletionItemKind.Method + then + return true + end + end + return true + end, + }, + -- ДобавляСм luasnip Ρ‚ΠΎΠ»ΡŒΠΊΠΎ Ссли ΠΎΠ½ доступСн + has_luasnip and { name = "luasnip", priority = 750 } or nil, + { name = "nvim_lsp_signature_help", priority = 700 }, + { name = "nvim_lua", priority = 600 }, + }, { + { name = "buffer", priority = 500, keyword_length = 3 }, + { name = "path", priority = 400 }, + { name = "emoji", priority = 300 }, + { name = "calc", priority = 250 }, + { name = "spell", priority = 200, keyword_length = 4 }, + }), + formatting = { + format = lspkind.cmp_format({ + mode = "symbol_text", + maxwidth = 50, + ellipsis_char = "...", + before = function(entry, vim_item) + -- Π‘ΠΏΠ΅Ρ†ΠΈΠ°Π»ΡŒΠ½Π°Ρ ΠΎΠ±Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° для Go + if vim.bo.filetype == "go" then + -- ДобавляСм Ρ‚ΠΈΠΏ для Go Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΉ ΠΈ ΠΌΠ΅Ρ‚ΠΎΠ΄ΠΎΠ² + if entry.source.name == "nvim_lsp" then + local completion_item = entry.completion_item + if completion_item.detail then + -- ΠžΠ±Ρ€Π΅Π·Π°Π΅ΠΌ слишком Π΄Π»ΠΈΠ½Π½Ρ‹Π΅ Π΄Π΅Ρ‚Π°Π»ΠΈ для Go + local detail = completion_item.detail + if string.len(detail) > 30 then + detail = string.sub(detail, 1, 27) .. "..." + end + vim_item.menu = detail + else + vim_item.menu = "[LSP]" + end + end + else + -- Source name для Π΄Ρ€ΡƒΠ³ΠΈΡ… языков + vim_item.menu = ({ + nvim_lsp = "[LSP]", + luasnip = "[Snippet]", + buffer = "[Buffer]", + path = "[Path]", + nvim_lua = "[Lua]", + emoji = "[Emoji]", + calc = "[Calc]", + spell = "[Spell]", + nvim_lsp_signature_help = "[Signature]", + })[entry.source.name] or "[Unknown]" + end + + return vim_item + end, + }), + }, + experimental = { + ghost_text = { + hl_group = "CmpGhostText", + }, + }, + sorting = defaults.sorting, + window = { + completion = cmp.config.window.bordered({ + border = "rounded", + winhighlight = "Normal:CmpPmenu,CursorLine:CmpSel,Search:None", + }), + documentation = cmp.config.window.bordered({ + border = "rounded", + winhighlight = "Normal:CmpDoc", + }), + }, + preselect = cmp.PreselectMode.Item, + performance = { + debounce = 60, + throttle = 30, + fetching_timeout = 500, + confirm_resolve_timeout = 80, + async_budget = 1, + max_view_entries = 200, + }, + matching = { + disallow_fuzzy_matching = false, + disallow_fullfuzzy_matching = false, + disallow_partial_fuzzy_matching = true, + disallow_partial_matching = false, + disallow_prefix_unmatching = false, + }, + } + end, + config = function(_, opts) + local cmp = require("cmp") + cmp.setup(opts) + + -- Π‘ΠΏΠ΅Ρ†ΠΈΠ°Π»ΡŒΠ½Π°Ρ конфигурация для Go Ρ„Π°ΠΉΠ»ΠΎΠ² + local go_sources = { + { + name = "nvim_lsp", + priority = 1000, + -- Настройки ΡΠΏΠ΅Ρ†ΠΈΠ°Π»ΡŒΠ½ΠΎ для gopls + option = { + -- Π’ΠΊΠ»ΡŽΡ‡Π°Π΅ΠΌ Π΄ΠΎΠΊΡƒΠΌΠ΅Π½Ρ‚Π°Ρ†ΠΈΡŽ для всСх элСмСнтов + get_trigger_characters = function() + return { ".", ":" } + end, + }, + }, + { name = "nvim_lsp_signature_help", priority = 700 }, + } + + -- ДобавляСм luasnip Ρ‚ΠΎΠ»ΡŒΠΊΠΎ Ссли ΠΎΠ½ доступСн + if has_luasnip then + table.insert(go_sources, 2, { name = "luasnip", priority = 750 }) + end + + cmp.setup.filetype("go", { + sources = cmp.config.sources(go_sources, { + { name = "buffer", priority = 500, keyword_length = 2 }, -- МСньшС символов для Go + { name = "path", priority = 400 }, + }), + formatting = { + format = lspkind.cmp_format({ + mode = "symbol_text", + maxwidth = 60, -- Π‘ΠΎΠ»ΡŒΡˆΠ΅ мСста для Go Ρ‚ΠΈΠΏΠΎΠ² + ellipsis_char = "...", + before = function(entry, vim_item) + if entry.source.name == "nvim_lsp" then + local completion_item = entry.completion_item + if completion_item.detail then + local detail = completion_item.detail + -- Π‘ΠΏΠ΅Ρ†ΠΈΠ°Π»ΡŒΠ½Π°Ρ ΠΎΠ±Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° Go Ρ‚ΠΈΠΏΠΎΠ² + if string.match(detail, "^func") then + vim_item.menu = "[func] " .. detail:sub(1, 40) + elseif string.match(detail, "^type") then + vim_item.menu = "[type] " .. detail:sub(1, 40) + elseif string.match(detail, "^var") then + vim_item.menu = "[var] " .. detail:sub(1, 40) + elseif string.match(detail, "^const") then + vim_item.menu = "[const] " .. detail:sub(1, 40) + else + vim_item.menu = detail:sub(1, 50) + end + else + vim_item.menu = "[LSP]" + end + else + vim_item.menu = ({ + luasnip = "[Snippet]", + buffer = "[Buffer]", + path = "[Path]", + nvim_lsp_signature_help = "[Signature]", + })[entry.source.name] or "[Unknown]" + end + return vim_item + end, + }), + }, + matching = { + disallow_fuzzy_matching = false, + disallow_fullfuzzy_matching = false, + disallow_partial_fuzzy_matching = false, -- Π Π°Π·Ρ€Π΅ΡˆΠ°Π΅ΠΌ для Go + disallow_partial_matching = false, + disallow_prefix_unmatching = false, + }, + }) + + -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline({ "/", "?" }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" }, + }, + }) + + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), + matching = { disallow_symbol_nonprefix_matching = false }, + }) + + -- Auto-pairs integration (провСряСм Π½Π°Π»ΠΈΡ‡ΠΈΠ΅ ΠΏΠ»Π°Π³ΠΈΠ½Π°) + local has_autopairs, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp") + if has_autopairs then + cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) + end + + -- Go specific autocmds + vim.api.nvim_create_autocmd("FileType", { + pattern = "go", + callback = function() + -- Настройки для ΡƒΠ»ΡƒΡ‡ΡˆΠ΅Π½ΠΈΡ Ρ€Π°Π±ΠΎΡ‚Ρ‹ с gopls + vim.opt_local.completeopt = "menu,menuone,noinsert,preview" + + -- АвтоматичСский ΠΈΠΌΠΏΠΎΡ€Ρ‚ ΠΏΡ€ΠΈ Π°Π²Ρ‚ΠΎΠ΄ΠΎΠΏΠΎΠ»Π½Π΅Π½ΠΈΠΈ + vim.api.nvim_create_autocmd("BufWritePre", { + pattern = "*.go", + callback = function() + local params = vim.lsp.util.make_range_params() + params.context = { only = { "source.organizeImports" } } + local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 1000) + for _, res in pairs(result or {}) do + for _, r in pairs(res.result or {}) do + if r.edit then + vim.lsp.util.apply_workspace_edit(r.edit, "utf-8") + end + end + end + end, + }) + end, + }) + end, +} diff --git a/lua/plugins/obsidian.lua b/lua/plugins/obsidian.lua new file mode 100644 index 0000000..d762762 --- /dev/null +++ b/lua/plugins/obsidian.lua @@ -0,0 +1,45 @@ +return { + "epwalsh/obsidian.nvim", + version = "*", + lazy = false, + ft = "markdown", + dependencies = { + "L3MON4D3/LuaSnip", + "nvim-lua/plenary.nvim", + }, + config = function() + -- ваша конфигурация + vim.opt_local.spell = false + end, + opts = { + workspaces = { + { + name = "personal", + path = "~/Share/Obsidian/default", + }, + }, + + -- Настройка создания Π½ΠΎΠ²Ρ‹Ρ… Π·Π°ΠΌΠ΅Ρ‚ΠΎΠΊ + note_id_func = function(title) + return title + end, + + -- Настройка ссылок + wiki_link_func = function(opts) + return require("obsidian.util").wiki_link_id_prefix(opts) + end, + + -- Настройка шаблонов + templates = { + subdir = "Templates", + date_format = "%Y-%m-%d", + time_format = "%H:%M", + }, + + -- АвтодополнСниС + completion = { + nvim_cmp = false, + min_chars = 2, + }, + }, +} diff --git a/lua/plugins/snacks.lua b/lua/plugins/snacks.lua new file mode 100644 index 0000000..2afa83c --- /dev/null +++ b/lua/plugins/snacks.lua @@ -0,0 +1,121 @@ +return { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + ---@type snacks.Config + opts = { + bigfile = { enabled = true }, + dashboard = { enabled = true }, + explorer = { enabled = true }, + indent = { enabled = true }, + input = { enabled = true }, + notifier = { + enabled = true, + timeout = 3000, + }, + picker = { enabled = true, debug = { scores = true } }, + quickfile = { enabled = true }, + scope = { enabled = true }, + scroll = { enabled = false }, + statuscolumn = { enabled = true }, + words = { enabled = true }, + styles = { + notification = { + -- wo = { wrap = true } -- Wrap notifications + }, + }, + }, + keys = { + { + "ff", + function() + Snacks.picker.files({ layout = "ivy" }) + end, + desc = "Find Files", + }, + { + "", + function() + Snacks.picker.keymaps({ layout = "vertical" }) + end, + desc = "Dashboard", + }, + { + "", + function() + Snacks.picker.buffers({ + on_show = function() + vim.cmd.stopinsert() + end, + finder = "buffers", + format = "buffer", + hidden = false, + unloaded = true, + current = true, + sort_lastused = true, + win = { + input = { + keys = { + ["d"] = "bufdelete", + }, + }, + list = { keys = { ["d"] = "bufdelete" } }, + }, + layout = "ivy", + }) + end, + desc = "[P]Snacks picker buffers", + }, + -- LSP + { + "gd", + function() + Snacks.picker.lsp_definitions() + end, + desc = "Goto Definition", + }, + { + "gD", + function() + Snacks.picker.lsp_declarations() + end, + desc = "Goto Declaration", + }, + { + "gr", + function() + Snacks.picker.lsp_references() + end, + nowait = true, + desc = "References", + }, + { + "gI", + function() + Snacks.picker.lsp_implementations() + end, + desc = "Goto Implementation", + }, + { + "gy", + function() + Snacks.picker.lsp_type_definitions() + end, + desc = "Goto T[y]pe Definition", + }, + { + "ss", + function() + Snacks.picker.lsp_symbols() + end, + desc = "LSP Symbols", + }, + { + "sS", + function() + Snacks.picker.lsp_workspace_symbols() + end, + desc = "LSP Workspace Symbols", + }, + }, +} diff --git a/lua/plugins/vim-markdown.lua b/lua/plugins/vim-markdown.lua new file mode 100644 index 0000000..a6b2394 --- /dev/null +++ b/lua/plugins/vim-markdown.lua @@ -0,0 +1,23 @@ +return { + "preservim/vim-markdown", + ft = "markdown", + config = function() + vim.g.vim_markdown_folding_disabled = 1 + vim.g.vim_markdown_frontmatter = 1 + vim.g.vim_markdown_conceal = 2 + vim.g.vim_markdown_fenced_languages = { + "html", + "python", + "bash=sh", + "javascript", + "typescript", + "lua", + } + vim.g.vim_markdown_follow_anchor = 1 + vim.g.vim_markdown_math = 1 + vim.g.vim_markdown_strikethrough = 1 + vim.g.vim_markdown_autowrite = 1 + vim.g.vim_markdown_edit_url_in = "tab" + vim.g.vim_markdown_new_list_item_indent = 2 + end, +} diff --git a/lua/plugins/vim-table-mode.lua b/lua/plugins/vim-table-mode.lua new file mode 100644 index 0000000..ecb91db --- /dev/null +++ b/lua/plugins/vim-table-mode.lua @@ -0,0 +1,9 @@ +return { + "dhruvasagar/vim-table-mode", + ft = "markdown", + config = function() + vim.g.table_mode_corner = "|" + vim.g.table_mode_corner_corner = "|" + vim.g.table_mode_header_fillchar = "=" + end, +} diff --git a/lua/plugins/yazi.lua b/lua/plugins/yazi.lua new file mode 100644 index 0000000..ea2518f --- /dev/null +++ b/lua/plugins/yazi.lua @@ -0,0 +1,42 @@ +return { + "mikavilpas/yazi.nvim", + event = "VeryLazy", + dependencies = { + -- check the installation instructions at + -- https://github.com/folke/snacks.nvim + "folke/snacks.nvim", + }, + keys = { + -- πŸ‘‡ in this section, choose your own keymappings! + { + "y", + mode = { "n", "v" }, + "Yazi", + desc = "Open yazi at the current file", + }, + { + -- Open in the current working directory + "cw", + "Yazi cwd", + desc = "Open the file manager in nvim's working directory", + }, + { + "", + "Yazi toggle", + desc = "Resume the last yazi session", + }, + }, + opts = { + -- if you want to open yazi instead of netrw, see below for more info + open_for_directories = false, + keymaps = { + show_help = "", + }, + }, + -- πŸ‘‡ if you use `open_for_directories=true`, this is recommended + init = function() + -- More details: https://github.com/mikavilpas/yazi.nvim/issues/802 + -- vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + end, +} diff --git a/lua/snippets/go.lua b/lua/snippets/go.lua new file mode 100644 index 0000000..15a0ec2 --- /dev/null +++ b/lua/snippets/go.lua @@ -0,0 +1,103 @@ +local ls = require("luasnip") +local s = ls.snippet +local t = ls.text_node +local i = ls.insert_node +local c = ls.choice_node +local fmt = require("luasnip.extras.fmt").fmt +local rep = require("luasnip.extras").rep + +return { + + -- func + s( + "fn", + fmt("func {}() {{\n\t{}\n}}", { + i(1, "functionName"), + i(2, "// body"), + }) + ), + + -- main + s( + "main", + fmt( + [[ + func main() {{ + {} + }} + ]], + { + i(1, "// your code here"), + } + ) + ), + + -- if err != nil + s( + "ifr", + fmt( + [[ + if err != nil {{ + return {} + }} + ]], + { + i(1, "err"), + } + ) + ), + + -- for loop + s( + "for", + fmt( + [[ + for {} := 0; {} < {}; {}++ {{ + {} + }} + ]], + { + i(1, "i"), + rep(1), + i(2, "n"), + rep(1), + i(3, "// body"), + } + ) + ), + + -- struct + s( + "struct", + fmt( + [[ + type {} struct {{ + {} + }} + ]], + { + i(1, "MyStruct"), + i(2, "Field string"), + } + ) + ), + + -- method + s( + "meth", + fmt( + [[ + func ({}) {}({}) {} {{ + {} + }} + ]], + { + i(1, "m *MyStruct"), + i(2, "MethodName"), + i(3, ""), + i(4, ""), + i(5, "// body"), + } + ) + ), +} diff --git a/stylua.toml b/stylua.toml new file mode 100644 index 0000000..5d6c50d --- /dev/null +++ b/stylua.toml @@ -0,0 +1,3 @@ +indent_type = "Spaces" +indent_width = 2 +column_width = 120 \ No newline at end of file