Init commit
This commit is contained in:
11
.gitignore
vendored
Normal file
11
.gitignore
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
tt.*
|
||||||
|
.tests
|
||||||
|
doc/tags
|
||||||
|
debug
|
||||||
|
.repro
|
||||||
|
foo.*
|
||||||
|
*.log
|
||||||
|
data
|
||||||
|
lazy-lock.json
|
||||||
|
lazyvim.json
|
||||||
|
.neoconf.json
|
||||||
201
LICENSE
Normal file
201
LICENSE
Normal file
@@ -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.
|
||||||
4
README.md
Normal file
4
README.md
Normal file
@@ -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.
|
||||||
7
init.lua
Normal file
7
init.lua
Normal file
@@ -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()
|
||||||
53
lua/config/autocmds.lua
Normal file
53
lua/config/autocmds.lua
Normal file
@@ -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,
|
||||||
|
})
|
||||||
25
lua/config/bufferline.lua
Normal file
25
lua/config/bufferline.lua
Normal file
@@ -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",
|
||||||
|
},
|
||||||
|
})
|
||||||
12
lua/config/hyprls.lua
Normal file
12
lua/config/hyprls.lua
Normal file
@@ -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,
|
||||||
|
})
|
||||||
38
lua/config/image.lua
Normal file
38
lua/config/image.lua
Normal file
@@ -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
|
||||||
|
})
|
||||||
65
lua/config/keymaps.lua
Normal file
65
lua/config/keymaps.lua
Normal file
@@ -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", "<esc>", { desc = "" })
|
||||||
|
k.set("i", "jk", "<esc><cmd>w<cr>", { desc = "Save" })
|
||||||
|
|
||||||
|
k.set("n", "<leader>a", ":keepjumps normal! ggVG<cr>")
|
||||||
|
|
||||||
|
k.set({ "n", "v" }, "<M-t>", ":lua Snacks.terminal.get()<cr>", { desc = "Terminal" })
|
||||||
|
k.set({ "t", "n", "v" }, "<C-h>", "<C-\\><C-n><C-w>h", { desc = "Go to left window" })
|
||||||
|
k.set({ "t", "n", "v" }, "<C-j>", "<C-\\><C-n><C-w>j", { desc = "Go to bottom window" })
|
||||||
|
k.set({ "t", "n", "v" }, "<C-k>", "<C-\\><C-n><C-w>k", { desc = "Go to top window" })
|
||||||
|
k.set({ "t", "n", "v" }, "<C-l>", "<C-\\><C-n><C-w>l", { desc = "Go to right window" })
|
||||||
|
|
||||||
|
k.set("n", "<leader>li", "<cmd>LspInfo<cr>", { desc = "LSP Info" })
|
||||||
|
k.set("n", "<leader>o", ":lua Snacks.dashboard()<cr>", { desc = "Dashboard" })
|
||||||
|
|
||||||
|
-- Основные горячие клавиши для Obsidian
|
||||||
|
k.set("n", "<leader>of", ":ObsidianQuickSwitch<CR>", { desc = "Quick switch" })
|
||||||
|
k.set("n", "<leader>on", ":ObsidianNew<CR>", { desc = "New note" })
|
||||||
|
k.set("n", "<leader>os", ":ObsidianSearch<CR>", { desc = "Search notes" })
|
||||||
|
k.set("n", "<leader>ot", ":ObsidianTags<CR>", { desc = "Tags" })
|
||||||
|
k.set("n", "<leader>ob", ":ObsidianBacklinks<CR>", { desc = "Backlinks" })
|
||||||
|
k.set("n", "<leader>ol", ":ObsidianLinks<CR>", { desc = "Links" })
|
||||||
|
k.set("n", "<leader>oo", ":ObsidianOpen<CR>", { desc = "Open in Obsidian" })
|
||||||
|
k.set("n", "<leader>or", ":ObsidianRename<CR>", { desc = "Rename note" })
|
||||||
|
k.set("n", "<leader>op", ":ObsidianPasteImg<CR>", { desc = "Paste image" })
|
||||||
|
k.set("n", "<leader>ow", ":ObsidianWorkspace<CR>", { desc = "Switch workspace" })
|
||||||
|
|
||||||
|
-- Горячие клавиши для Markdown
|
||||||
|
k.set("n", "<leader>mp", ":MarkdownPreviewToggle<CR>", { desc = "Toggle preview" })
|
||||||
|
k.set("n", "<leader>mg", ":Glow<CR>", { desc = "Glow preview" })
|
||||||
|
k.set("n", "<leader>mt", ":TableModeToggle<CR>", { desc = "Table mode" })
|
||||||
|
k.set("n", "<leader>mc", ":lua require('markdown-togglecheck').toggle()<CR>", { desc = "Toggle checkbox" })
|
||||||
|
|
||||||
|
-- Splitting & Resizing
|
||||||
|
k.set("n", "<leader>sv", ":vsplit<CR>", { desc = "Split window vertically" })
|
||||||
|
k.set("n", "<leader>sh", ":split<CR>", { desc = "Split window horizontally" })
|
||||||
|
k.set("n", "<C-Up>", ":resize +2<CR>", { desc = "Increase window height" })
|
||||||
|
k.set("n", "<C-Down>", ":resize -2<CR>", { desc = "Decrease window height" })
|
||||||
|
k.set("n", "<C-Left>", ":vertical resize -2<CR>", { desc = "Decrease window width" })
|
||||||
|
k.set("n", "<C-Right>", ":vertical resize +2<CR>", { desc = "Increase window width" })
|
||||||
|
|
||||||
|
-- Move lines up/down
|
||||||
|
k.set("n", "<A-j>", ":m .+1<CR>==", { desc = "Move line down" })
|
||||||
|
k.set("n", "<A-k>", ":m .-2<CR>==", { desc = "Move line up" })
|
||||||
|
k.set("v", "<A-j>", ":m '>+1<CR>gv=gv", { desc = "Move selection down" })
|
||||||
|
k.set("v", "<A-k>", ":m '<-2<CR>gv=gv", { desc = "Move selection up" })
|
||||||
|
|
||||||
|
-- Better indenting in visual mode
|
||||||
|
k.set("v", "<", "<gv", { desc = "Indent left and reselect" })
|
||||||
|
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" })
|
||||||
53
lua/config/lazy.lua
Normal file
53
lua/config/lazy.lua
Normal file
@@ -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",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
19
lua/config/luasnip.lua
Normal file
19
lua/config/luasnip.lua
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
require("luasnip.loaders.from_lua").lazy_load({ paths = "~/.config/nvim/lua/snippets" })
|
||||||
|
|
||||||
|
local ls = require("luasnip")
|
||||||
|
|
||||||
|
vim.keymap.set({ "i" }, "<C-K>", function()
|
||||||
|
ls.expand()
|
||||||
|
end, { silent = true })
|
||||||
|
vim.keymap.set({ "i", "s" }, "<Tab>", function()
|
||||||
|
ls.jump(1)
|
||||||
|
end, { silent = true })
|
||||||
|
vim.keymap.set({ "i", "s" }, "<S-Tab>", function()
|
||||||
|
ls.jump(-1)
|
||||||
|
end, { silent = true })
|
||||||
|
|
||||||
|
vim.keymap.set({ "i", "s" }, "<C-E>", function()
|
||||||
|
if ls.choice_active() then
|
||||||
|
ls.change_choice(1)
|
||||||
|
end
|
||||||
|
end, { silent = true })
|
||||||
11
lua/config/options.lua
Normal file
11
lua/config/options.lua
Normal file
@@ -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]])
|
||||||
6
lua/plugins/disabled.lua
Normal file
6
lua/plugins/disabled.lua
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
return {
|
||||||
|
-- disable trouble
|
||||||
|
{ "akinsho/bufferline.nvim", enabled = true },
|
||||||
|
{ "hrsh7th/nvim-cmp", enabled = false },
|
||||||
|
{ "folke/snacks.nvim", enabled = true },
|
||||||
|
}
|
||||||
197
lua/plugins/example.lua
Normal file
197
lua/plugins/example.lua
Normal file
@@ -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
|
||||||
|
{
|
||||||
|
"<leader>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", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
|
||||||
|
vim.keymap.set("n", "<leader>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<string, fun(server:string, opts:_.lspconfig.options):boolean?>
|
||||||
|
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",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
15
lua/plugins/glow.lua
Normal file
15
lua/plugins/glow.lua
Normal file
@@ -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,
|
||||||
|
},
|
||||||
|
}
|
||||||
3
lua/plugins/init.lua
Normal file
3
lua/plugins/init.lua
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
return {
|
||||||
|
{ "norcalli/nvim-colorizer.lua" },
|
||||||
|
}
|
||||||
7
lua/plugins/luarocks.lua
Normal file
7
lua/plugins/luarocks.lua
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
return {
|
||||||
|
"vhyrro/luarocks.nvim",
|
||||||
|
priority = 1001, -- this plugin needs to run before anything else
|
||||||
|
opts = {
|
||||||
|
rocks = { "magick" },
|
||||||
|
},
|
||||||
|
}
|
||||||
7
lua/plugins/luasnip.lua
Normal file
7
lua/plugins/luasnip.lua
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
return {
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
-- follow latest release.
|
||||||
|
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
|
||||||
|
-- install jsregexp (optional!).
|
||||||
|
build = "make install_jsregexp",
|
||||||
|
}
|
||||||
32
lua/plugins/markdown-preview.lua
Normal file
32
lua/plugins/markdown-preview.lua
Normal file
@@ -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,
|
||||||
|
}
|
||||||
11
lua/plugins/markdown-togglecheck.lua
Normal file
11
lua/plugins/markdown-togglecheck.lua
Normal file
@@ -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,
|
||||||
|
}
|
||||||
29
lua/plugins/neorg.lua
Normal file
29
lua/plugins/neorg.lua
Normal file
@@ -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,
|
||||||
|
}
|
||||||
12
lua/plugins/noice.lua
Normal file
12
lua/plugins/noice.lua
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
return {
|
||||||
|
"folke/noice.nvim",
|
||||||
|
opts = {
|
||||||
|
cmdline = {
|
||||||
|
enabled = true,
|
||||||
|
view = "cmdline",
|
||||||
|
},
|
||||||
|
messages = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
305
lua/plugins/nvim-cmp.lua
Normal file
305
lua/plugins/nvim-cmp.lua
Normal file
@@ -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({
|
||||||
|
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||||
|
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||||
|
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
|
["<C-e>"] = cmp.mapping.abort(),
|
||||||
|
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item
|
||||||
|
["<S-CR>"] = cmp.mapping.confirm({
|
||||||
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
|
select = true,
|
||||||
|
}), -- Accept currently selected item and replace
|
||||||
|
["<C-CR>"] = function(fallback)
|
||||||
|
cmp.abort()
|
||||||
|
fallback()
|
||||||
|
end,
|
||||||
|
["<Tab>"] = 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" }),
|
||||||
|
["<S-Tab>"] = 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,
|
||||||
|
}
|
||||||
45
lua/plugins/obsidian.lua
Normal file
45
lua/plugins/obsidian.lua
Normal file
@@ -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,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
121
lua/plugins/snacks.lua
Normal file
121
lua/plugins/snacks.lua
Normal file
@@ -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 = {
|
||||||
|
{
|
||||||
|
"<leader>ff",
|
||||||
|
function()
|
||||||
|
Snacks.picker.files({ layout = "ivy" })
|
||||||
|
end,
|
||||||
|
desc = "Find Files",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<M-k>",
|
||||||
|
function()
|
||||||
|
Snacks.picker.keymaps({ layout = "vertical" })
|
||||||
|
end,
|
||||||
|
desc = "Dashboard",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<S-b>",
|
||||||
|
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",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>ss",
|
||||||
|
function()
|
||||||
|
Snacks.picker.lsp_symbols()
|
||||||
|
end,
|
||||||
|
desc = "LSP Symbols",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>sS",
|
||||||
|
function()
|
||||||
|
Snacks.picker.lsp_workspace_symbols()
|
||||||
|
end,
|
||||||
|
desc = "LSP Workspace Symbols",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
23
lua/plugins/vim-markdown.lua
Normal file
23
lua/plugins/vim-markdown.lua
Normal file
@@ -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,
|
||||||
|
}
|
||||||
9
lua/plugins/vim-table-mode.lua
Normal file
9
lua/plugins/vim-table-mode.lua
Normal file
@@ -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,
|
||||||
|
}
|
||||||
42
lua/plugins/yazi.lua
Normal file
42
lua/plugins/yazi.lua
Normal file
@@ -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!
|
||||||
|
{
|
||||||
|
"<leader>y",
|
||||||
|
mode = { "n", "v" },
|
||||||
|
"<cmd>Yazi<cr>",
|
||||||
|
desc = "Open yazi at the current file",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
-- Open in the current working directory
|
||||||
|
"<leader>cw",
|
||||||
|
"<cmd>Yazi cwd<cr>",
|
||||||
|
desc = "Open the file manager in nvim's working directory",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<c-up>",
|
||||||
|
"<cmd>Yazi toggle<cr>",
|
||||||
|
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 = "<f1>",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- 👇 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,
|
||||||
|
}
|
||||||
103
lua/snippets/go.lua
Normal file
103
lua/snippets/go.lua
Normal file
@@ -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"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
),
|
||||||
|
}
|
||||||
3
stylua.toml
Normal file
3
stylua.toml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
indent_type = "Spaces"
|
||||||
|
indent_width = 2
|
||||||
|
column_width = 120
|
||||||
Reference in New Issue
Block a user