neovim: move to vim.pack from lazy
This commit is contained in:
@@ -7,15 +7,3 @@ vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
vim.highlight.on_yank({ timeout = 200 })
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
pattern = "*",
|
||||
group = group,
|
||||
callback = function()
|
||||
local lead = "┊"
|
||||
for _ = 1, vim.bo.shiftwidth - 1 do
|
||||
lead = lead .. " "
|
||||
end
|
||||
vim.opt_local.listchars:append({ leadmultispace = lead })
|
||||
end,
|
||||
})
|
||||
|
||||
1
neovim/.config/nvim/after/plugin/autopairs.lua
Normal file
1
neovim/.config/nvim/after/plugin/autopairs.lua
Normal file
@@ -0,0 +1 @@
|
||||
require("nvim-autopairs").setup({})
|
||||
@@ -1,3 +1,5 @@
|
||||
require("Comment").setup({})
|
||||
require("ts_context_commentstring").setup({})
|
||||
local U = require("Comment.utils")
|
||||
|
||||
local ctype_to_commentstring = {
|
||||
@@ -10,6 +10,9 @@ cmp.setup({
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<CR>"] = cmp.mapping(function(fallback)
|
||||
fallback()
|
||||
end),
|
||||
["<C-u>"] = cmp.mapping(function(fallback)
|
||||
if ls.jumpable(1) then
|
||||
ls.jump(1)
|
||||
@@ -121,92 +124,3 @@ cmp.setup.filetype("gitcommit", {
|
||||
})
|
||||
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
local s = ls.snippet
|
||||
local i = ls.insert_node
|
||||
local t = ls.text_node
|
||||
local d = ls.dynamic_node
|
||||
local sn = ls.snippet_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
|
||||
local ts_utils = require("nvim-treesitter.ts_utils")
|
||||
|
||||
ls.add_snippets("go", {
|
||||
s(
|
||||
"iferr",
|
||||
fmt(
|
||||
[[
|
||||
if err != nil {
|
||||
<>
|
||||
}
|
||||
]],
|
||||
{
|
||||
d(1, function()
|
||||
local current_node = ts_utils.get_node_at_cursor(0, true)
|
||||
if not current_node then
|
||||
return ""
|
||||
end
|
||||
|
||||
local func = current_node
|
||||
while func do
|
||||
if func:type() == "function_declaration" then
|
||||
break
|
||||
end
|
||||
func = func:parent()
|
||||
end
|
||||
|
||||
if not func then
|
||||
return ""
|
||||
end
|
||||
|
||||
local return_type_node = func:child(3)
|
||||
if not return_type_node then
|
||||
return ""
|
||||
end
|
||||
|
||||
local params = {}
|
||||
for index = 0, return_type_node:child_count(), 1 do
|
||||
local param = return_type_node:child(index)
|
||||
if param and param:type() == "parameter_declaration" then
|
||||
local text = ts_utils.get_node_text(param)
|
||||
table.insert(params, text[1])
|
||||
end
|
||||
end
|
||||
|
||||
local rec = {
|
||||
["string"] = '""',
|
||||
["int"] = "0",
|
||||
["uint"] = "0",
|
||||
["error"] = "err",
|
||||
["bool"] = "false",
|
||||
}
|
||||
|
||||
local size = vim.tbl_count(params)
|
||||
|
||||
if size == 0 then
|
||||
return sn(nil, { i(1) })
|
||||
end
|
||||
|
||||
local x = { t("return ") }
|
||||
for index, param in ipairs(params) do
|
||||
local replace = rec[param]
|
||||
if replace ~= nil then
|
||||
table.insert(x, i(index, replace))
|
||||
else
|
||||
table.insert(x, i(index, param))
|
||||
end
|
||||
|
||||
if index < size then
|
||||
table.insert(x, t(", "))
|
||||
end
|
||||
end
|
||||
|
||||
return sn(nil, x)
|
||||
end, {}),
|
||||
},
|
||||
{
|
||||
delimiters = "<>",
|
||||
}
|
||||
)
|
||||
),
|
||||
})
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
local formatting = require("daniil.formatting")
|
||||
|
||||
vim.api.nvim_create_user_command("FormattingEnable", formatting.enable, {})
|
||||
vim.api.nvim_create_user_command("FormattingDisable", formatting.disable, {})
|
||||
vim.api.nvim_create_user_command("FormattingToggle", formatting.toggle, {})
|
||||
vim.api.nvim_create_user_command("FormattingStatus", formatting.status, {})
|
||||
@@ -28,3 +28,5 @@ vim.keymap.set("n", "<leader>gb", function()
|
||||
show_remote_tracking_branches = false,
|
||||
})
|
||||
end)
|
||||
|
||||
vim.api.nvim_set_hl(0, "GitSignsCurrentLineBlame", { fg = "#888888" })
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
local ts = require("telescope.builtin")
|
||||
local null_ls = require("null-ls")
|
||||
local formatting = require("daniil.formatting")
|
||||
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
@@ -25,10 +24,6 @@ null_ls.setup({
|
||||
pattern = "*",
|
||||
group = group,
|
||||
callback = function()
|
||||
if not formatting.is_enabled() then
|
||||
return
|
||||
end
|
||||
|
||||
vim.lsp.buf.format({
|
||||
filter = function(client)
|
||||
return not vim.tbl_contains(servers_with_annoying_formatters, client.name)
|
||||
|
||||
@@ -118,7 +118,7 @@ vim.lsp.config.emmet_ls = {
|
||||
"typescript",
|
||||
"typescript.tsx",
|
||||
"typescriptreact",
|
||||
"svelte"
|
||||
"svelte",
|
||||
},
|
||||
root_markers = { "package.json", ".git", vim.uv.cwd() },
|
||||
}
|
||||
|
||||
@@ -34,10 +34,11 @@ local function on_attach(bufnr)
|
||||
end
|
||||
|
||||
require("nvim-tree").setup({
|
||||
on_attach = on_attach,
|
||||
disable_netrw = true,
|
||||
hijack_netrw = true,
|
||||
hijack_cursor = true,
|
||||
open_on_tab = false,
|
||||
open_on_tab = true,
|
||||
update_cwd = true,
|
||||
auto_reload_on_write = true,
|
||||
reload_on_bufenter = true,
|
||||
@@ -97,7 +98,6 @@ require("nvim-tree").setup({
|
||||
show_on_dirs = true,
|
||||
icons = { hint = "", info = "", warning = "", error = "" },
|
||||
},
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader><leader>", vim.cmd.NvimTreeToggle)
|
||||
|
||||
@@ -41,5 +41,3 @@ vim.opt.listchars = { multispace = "·", tab = ">~", leadmultispace = "┊ " }
|
||||
vim.opt.spelllang = "en_us,ru"
|
||||
|
||||
vim.cmd.colorscheme("retrobox")
|
||||
|
||||
vim.api.nvim_set_hl(0, "GitSignsCurrentLineBlame", { fg = "#888888" })
|
||||
|
||||
@@ -16,5 +16,3 @@ vim.keymap.set("n", "tn", ":tabnew<CR>")
|
||||
vim.keymap.set("n", "tN", ":-tabnew<CR>")
|
||||
vim.keymap.set("n", "H", ":tabprev<CR>")
|
||||
vim.keymap.set("n", "L", ":tabnext<CR>")
|
||||
|
||||
vim.keymap.set("n", "<leader>gl", require("daniil.gitblame").open_blame_window)
|
||||
|
||||
Reference in New Issue
Block a user