Init commit
This commit is contained in:
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,
|
||||
}
|
||||
Reference in New Issue
Block a user