migrate to stow

This commit is contained in:
2022-03-20 00:37:41 +03:00
parent 8544e93367
commit 2ef5b95984
41 changed files with 351 additions and 93 deletions

View File

@@ -0,0 +1,3 @@
vim.bo.tabstop = 4
vim.bo.shiftwidth = 4
vim.bo.expandtab = false

View File

@@ -0,0 +1 @@
vim.cmd("setlocal spell")

View File

@@ -0,0 +1,159 @@
-- Locals
local fn = vim.fn
-- Install packer automagically
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then
PACKER_BOOTSTRAP = fn.system({
"git",
"clone",
"--depth",
"1",
"https://github.com/wbthomason/packer.nvim",
install_path,
})
end
pcall(require, "impatient")
require("packer").startup(function(use)
use({ "wbthomason/packer.nvim" })
use({ "lewis6991/impatient.nvim" })
use({ "nvim-lua/popup.nvim" })
use({ "nvim-lua/plenary.nvim" })
-- Colorschemes go here
use({ "folke/tokyonight.nvim" })
use({ "sainnhe/edge" })
-- Make commenting code great
use({ "numToStr/Comment.nvim" })
-- Icons used by many plugins
use({ "kyazdani42/nvim-web-devicons" })
-- Auto pairs plugin that automatically closes brackets and quotes
use({ "windwp/nvim-autopairs" })
-- File tree
use({ "kyazdani42/nvim-tree.lua" })
-- Treesitter for better syntax highlighting
use({
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
{
{ "JoosepAlviste/nvim-ts-context-commentstring" },
{ "nvim-treesitter/playground" },
{ "windwp/nvim-ts-autotag" },
},
})
-- Git things
use({ "lewis6991/gitsigns.nvim" })
use({ "tpope/vim-fugitive" })
-- LSP stuff
use({ "neovim/nvim-lspconfig" })
use({ "williamboman/nvim-lsp-installer" })
use({ "jose-elias-alvarez/null-ls.nvim" })
use({ "ray-x/lsp_signature.nvim" })
use({
"themaxmarchuk/tailwindcss-colors.nvim",
module = "tailwindcss-colors",
config = function()
require("tailwindcss-colors").setup()
end,
})
use({ "b0o/SchemaStore.nvim" })
-- Completion, snippets, etc
use({
"hrsh7th/nvim-cmp",
{
{ "hrsh7th/cmp-nvim-lsp" },
{ "hrsh7th/cmp-buffer" },
{ "hrsh7th/cmp-path" },
{ "hrsh7th/cmp-cmdline" },
},
})
use({ "L3MON4D3/LuaSnip", {
"saadparwaiz1/cmp_luasnip",
} })
use({ "rafamadriz/friendly-snippets" })
use({
"nvim-telescope/telescope.nvim",
{
"nvim-telescope/telescope-fzf-native.nvim",
run = "make",
},
{
"nvim-telescope/telescope-symbols.nvim",
},
})
-- Statusline
use({ "nvim-lualine/lualine.nvim" })
-- Highlight todo comments
use({
"folke/todo-comments.nvim",
config = function()
require("todo-comments").setup({
signs = false,
})
end,
})
-- Highlight colors
use({
"norcalli/nvim-colorizer.lua",
config = function()
require("colorizer").setup({ "*" })
end,
})
use({
"lukas-reineke/indent-blankline.nvim",
config = function()
require("indent_blankline").setup({
space_char_blankline = " ",
show_current_context = true,
})
end,
})
-- Markdown preview
use({ "iamcco/markdown-preview.nvim", run = "cd app && yarn install" })
if PACKER_BOOTSTRAP then
require("packer").sync()
end
end)
vim.cmd([[
hi IndentBlanklineChar guifg=#373737 guibg=none gui=none
hi IndentBlanklineContextChar guifg=#808080 guibg=none gui=none
]])
vim.g.mapleader = " "
require("user.options")
require("user.theme")
require("nvim-autopairs").setup({})
require("user.file-tree")
require("user.treesitter")
require("user.telescope")
require("user.git")
require("user.lsp")
require("user.comment")
require("user.snippets")
require("user.lualine")
require("user.remaps")
require("user.cmds")
require("user.aus")

View File

@@ -0,0 +1,3 @@
vim.cmd([[
au TextYankPost * silent! lua vim.highlight.on_yank({timeout = 200})
]])

View File

View File

@@ -0,0 +1,24 @@
require("Comment").setup({
pre_hook = function(ctx)
-- Only calculate commentstring for tsx filetypes
if vim.bo.filetype == "typescriptreact" or vim.bo.filetype == "javascriptreact" then
local U = require("Comment.utils")
-- Detemine whether to use linewise or blockwise commentstring
local type = ctx.ctype == U.ctype.line and "__default" or "__multiline"
-- Determine the location where to calculate commentstring from
local location = nil
if ctx.ctype == U.ctype.block then
location = require("ts_context_commentstring.utils").get_cursor_location()
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
location = require("ts_context_commentstring.utils").get_visual_start_location()
end
return require("ts_context_commentstring.internal").calculate_commentstring({
key = type,
location = location,
})
end
end,
})

View File

@@ -0,0 +1,74 @@
vim.g.nvim_tree_show_icons = {
git = 1,
files = 1,
folders = 1,
}
vim.g.nvim_tree_icons = {
default = "",
symlink = "",
git = {
unstaged = "U",
staged = "S",
unmerged = "M",
renamed = "R",
untracked = "N",
deleted = "D",
},
}
vim.g.nvim_tree_git_hl = 1
vim.g.nvim_tree_add_trailing = 1
vim.g.nvim_tree_indent_markers = 1
vim.g.nvim_tree_group_empty = 1
local function git_stage(node)
local cwd = vim.loop.cwd()
local relative_path = string.gsub(node.absolute_path, cwd .. "/", "")
local f = io.popen("git add " .. relative_path, "r")
f:close()
end
local function git_reset(node)
local cwd = vim.loop.cwd()
local relative_path = string.gsub(node.absolute_path, cwd .. "/", "")
local f = io.popen("git reset " .. relative_path, "r")
f:close()
end
-- TODO: add here keymap for git diff window
require("nvim-tree").setup({
disable_netrw = true,
hijack_netrw = true,
open_on_setup = true,
hijack_cursor = true,
open_on_tab = false,
update_cwd = true,
update_focused_file = {
enable = true,
},
view = {
width = 30,
side = "left",
auto_resize = true,
mappings = {
list = {
{ key = "tn", action = "tabnew" },
{ key = "gs", action = "git_stage", action_cb = git_stage },
{ key = "gr", action = "git_reset", action_cb = git_reset },
{ key = "l", action = "edit" },
{ key = "@", action = "cd" },
},
},
},
filters = {
custom = { ".git" },
},
git = {
ignore = true,
},
diagnostics = {
enable = true,
show_on_dirs = true,
icons = { hint = "", info = "", warning = "", error = "" },
},
})

View File

@@ -0,0 +1,26 @@
local nmap = require("user.utils").nmap
local vmap = require("user.utils").vmap
require("gitsigns").setup({
signcolumn = true,
attach_to_untracked = false,
current_line_blame = true,
current_line_blame_opts = {
delay = 1000,
},
current_line_blame_formatter_opts = {
relative_time = true,
},
on_attach = function(bufnr)
nmap("<leader>gs", ":Gitsigns stage_hunk<CR>")
nmap("<leader>gu", ":Gitsigns undo_stage_hunk<CR>")
nmap("<leader>gr", ":Gitsigns reset_hunk<CR>")
nmap("<leader>gp", ":Gitsigns preview_hunk<CR>")
nmap("<leader>gn", ":Gitsigns next_hunk<CR>")
nmap("<leader>gN", ":Gitsigns prev_hunk<CR>")
vmap("gs", ":Gitsigns stage_hunk<CR>")
vmap("gu", ":Gitsigns undo_stage_hunk<CR>")
vmap("gr", ":Gitsigns reset_hunk<CR>")
end,
})

View File

@@ -0,0 +1,225 @@
local lsp_installer = require("nvim-lsp-installer")
local cmp = require("cmp")
local null_ls = require("null-ls")
local list_includes_item = require("user.utils").list_includes_item
local kind_icons = {
Text = "",
Method = "",
Function = "",
Constructor = "",
Field = "",
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
}
local formatting = null_ls.builtins.formatting
local diagnostics = null_ls.builtins.diagnostics
null_ls.setup({
sources = {
formatting.prettierd,
formatting.stylua,
formatting.black,
formatting.gofmt,
formatting.goimports,
formatting.shfmt,
},
on_attach = function()
vim.cmd([[
augroup LspFormatting
autocmd! * <buffer>
autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()
augroup END
]])
end,
})
-- Other formats that work weird with null_ls
vim.cmd([[autocmd BufWritePre *.svelte lua vim.lsp.buf.formatting_sync(nil, 1000)]])
local completion_trigger = "<C-space>"
if vim.fn.has("win32") == 1 then
completion_trigger = "<C-y>"
end
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = {
["<C-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
[completion_trigger] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.close()
else
cmp.complete()
end
end),
["<TAB>"] = cmp.mapping.confirm({
select = true,
behavior = cmp.SelectBehavior.Insert,
}),
},
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
}, {
{ name = "path" },
{ name = "buffer" },
}),
completion = {
completeopt = "menu,menuone,noselect,noinsert,preview",
},
experimental = {
ghost_text = true,
},
sorting = {
comparators = {
cmp.config.compare.score,
cmp.config.compare.sort_text,
cmp.config.compare.kind,
},
},
documentation = {
border = { "", "", "", "", "", "", "", "" },
zindex = 999,
format = { "markdown" },
},
formatting = {
format = function(entry, vim_item)
vim_item.kind = string.format("%s %s", kind_icons[vim_item.kind], vim_item.kind)
vim_item.menu = ({
buffer = "[Buffer]",
luasnip = "[Snippet]",
nvim_lua = "[Lua]",
path = "[File]",
})[entry.source.name]
return vim_item
end,
},
})
cmp.setup.cmdline("/", {
sources = {
{ name = "cmdline" },
},
})
cmp.setup.cmdline(":", {
sources = {
{ name = "cmdline" },
},
})
local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
capabilities.textDocument.completion.completionItem.snippetSupport = true
local lsps_with_disabled_formatting = { "tsserver", "gopls", "jsonls", "html" }
local on_attach = function(client, bufnr)
if list_includes_item(lsps_with_disabled_formatting, client.name) then
client.resolved_capabilities.document_formatting = false
client.resolved_capabilities.document_range_formatting = false
end
if client.resolved_capabilities.document_highlight then
vim.cmd([[
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
]])
end
if client.name == "tailwindcss" then
require("tailwindcss-colors").buf_attach(bufnr)
end
require("lsp_signature").on_attach({
bind = true,
hint_enable = false,
}, bufnr)
end
lsp_installer.on_server_ready(function(server)
local opts = {
capabilities = capabilities,
on_attach = on_attach,
}
if server.name == "sumneko_lua" then
local runtime_path = vim.split(package.path, ";")
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init/lua")
opts.settings = {
Lua = {
runtime = {
version = "LuaJIT",
path = runtime_path,
},
diagnostics = {
library = vim.api.nvim_get_runtime_file("", true),
globals = { "vim" },
},
telemetry = {
enable = false,
},
},
}
end
if server.name == "jsonls" then
opts.settings = {
json = {
schemas = require("schemastore").json.schemas({
select = {
".eslintrc",
"package.json",
"tsconfig.json",
"prettierrc.json",
},
}),
},
}
end
server:setup(opts)
end)
-- Populate local quickfix list with diagnostics from lsp
-- Thanks to ThePrimeagen
-- https://www.youtube.com/watch?v=IoyW8XYGqjM
vim.cmd([[
augroup PopulateLocalListWithLsp
autocmd!
autocmd! BufWritePre,BufEnter,InsertLeave * :lua vim.diagnostic.setloclist({ open = false })
augroup END
]])
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
update_in_insert = false,
signs = false,
})

View File

@@ -0,0 +1,62 @@
local lualine = require("lualine")
local mode = {
"mode",
}
local branch = {
"branch",
icons_enabled = true,
icon = "",
}
local diagnostics = {
"diagnostics",
sections = { "error", "warn", "info", "hint" },
always_visible = true,
}
local filename = {
function()
local filename = vim.fn.expand("%:t")
local fileext = vim.fn.expand("%:e")
local icon = require("nvim-web-devicons").get_icon(filename, fileext)
return icon .. " " .. filename
end,
}
local fileformat = {
function()
return "[" .. vim.bo.fileformat .. "]"
end,
}
local tabstop = {
function()
local tabstop = vim.bo.tabstop
local expandtab = vim.bo.expandtab
local method = expandtab == true and "spaces" or "tabs"
local format = tabstop .. " " .. method
return format
end,
}
lualine.setup({
options = {
disabled_filetypes = { "NvimTree" },
component_separators = "",
section_separators = "",
globalstatus = true,
},
sections = {
lualine_a = { mode },
lualine_b = { branch },
lualine_c = { diagnostics },
lualine_x = { tabstop, fileformat },
lualine_y = { filename },
lualine_z = {},
},
})

View File

@@ -0,0 +1,46 @@
local opt = vim.opt
-- 2 tabs converted to spaces + autoindentation
opt.tabstop = 2
opt.shiftwidth = 2
opt.expandtab = true
opt.autoindent = true
-- What the **** is this
opt.shortmess = "filnxtToOFc"
-- Create splits like a normal human being
opt.splitbelow = true
opt.splitright = true
-- Other settings
opt.termguicolors = true
opt.number = true
opt.relativenumber = true
opt.wrap = true
opt.swapfile = false
opt.hidden = true
opt.writebackup = false
opt.encoding = "utf-8"
opt.updatetime = 300
opt.mouse = "a"
opt.cursorline = true
opt.clipboard = "unnamedplus"
opt.signcolumn = "yes"
opt.fillchars:append({ eob = " " })
opt.showtabline = 2
opt.showcmd = false
opt.guicursor = "a:block,i:ver25"
opt.fileformat = "unix"
opt.fileformats = { "unix", "dos", "mac" }
opt.laststatus = 3
-- if vim.fn.has("win32") == 1 then
-- opt.shell = "powershell.exe"
-- end
-- Settings for folds
-- wo.foldmethod = "expr"
-- wo.foldexpr = "nvim_treesitter#foldexpr()"
-- wo.foldcolumn = "3"
-- wo.foldenable = false

View File

@@ -0,0 +1,83 @@
local utils = require("user.utils")
local nmap = utils.nmap
local vmap = utils.vmap
local tmap = utils.tmap
local imap = utils.imap
-- General keymaps
nmap("<C-c>", ":nohl<CR>")
-- Disable PageUp and PageDown keys
nmap("<PageDown>", "<nop>")
imap("<PageDown>", "<nop>")
vmap("<PageDown>", "<nop>")
nmap("<PageUp>", "<nop>")
imap("<PageUp>", "<nop>")
vmap("<PageUp>", "<nop>")
-- Move focus between splits
nmap("<leader>h", "<C-w>h")
nmap("<leader>l", "<C-w>l")
nmap("<leader>j", "<C-w>j")
nmap("<leader>k", "<C-w>k")
-- Resize splits
nmap("<C-j>", ":resize -2<CR>")
nmap("<C-k>", ":resize +2<CR>")
nmap("<C-h>", ":vert resize -5<CR>")
nmap("<C-l>", ":vert resize +5<CR>")
-- Open splits
nmap("<leader>sv", ":vs<CR>")
nmap("<leader>sh", ":split<CR>")
-- Move lines easily
nmap("<A-k>", ":m .-2<CR>==")
nmap("<A-j>", ":m .+1<CR>==")
vmap("K", ":m '<-2<CR>gv=gv")
vmap("J", ":m '>+1<CR>gv=gv")
-- Leave selection when moving code left and right
vmap("<", "<gv")
vmap(">", ">gv")
-- Terminal
tmap("<ESC>", "<C-\\><C-n>")
nmap("Th", ":split | :term<CR>")
nmap("Tv", ":vs | :term<CR>")
-- Tabs
nmap("H", ":tabprev<CR>")
nmap("L", ":tabnext<CR>")
nmap("tn", ":tabnew<CR>")
nmap("tN", ":-tabnew<CR>")
nmap("tc", ":lua require('user.tabs').close_tab()<CR>")
nmap("tr", ":lua require('user.tabs').restore_tab()<CR>")
nmap("<A-h>", ":-tabmove<CR>")
nmap("<A-l>", ":+tabmove<CR>")
-- Nvim Tree
nmap("<leader><leader>", ":lua require('nvim-tree').toggle(true, false)<CR>")
-- Telescope
nmap("<leader>ff", ":Telescope find_files<CR>")
nmap("<leader>fo", ":Telescope lsp_document_symbols<CR>")
nmap("<leader>p", ":Telescope<CR>")
-- LSP
nmap("gd", ":lua vim.lsp.buf.definition()<CR>")
nmap("gr", ":lua vim.lsp.buf.references()<CR>")
nmap("K", ":lua vim.lsp.buf.hover()<CR>")
nmap("<F2>", ":lua vim.lsp.buf.rename()<CR>")
nmap("<leader>.", ":lua vim.lsp.buf.code_action()<CR>")
vmap("<leader>.", ":lua vim.lsp.buf.range_code_action()<CR>")
-- Diagnostics
nmap("<leader>dd", ':lua vim.diagnostic.open_float(nil, {focus = false, scope = "cursor"})<CR>')
nmap("<leader>dy", ":lua require('user.utils').copy_diagnostic_message()<CR>")
nmap("<leader>dn", ":lua vim.diagnostic.goto_next({ float = false })<CR>")
nmap("<leader>dp", ":lua vim.diagnostic.goto_prev({ float = false })<CR>")
nmap("<leader>do", ":lopen<CR>")
-- Git
nmap("<leader>gg", ":G<CR>")

View File

@@ -0,0 +1,27 @@
local ls = require("luasnip")
local s, i = ls.s, ls.insert_node
local fmt = require("luasnip.extras.fmt").fmt
local clg_snippet = s(
"clg",
fmt([[console.log({});]], {
i(0),
})
)
ls.snippets = {
javascript = {
clg_snippet,
},
typescript = {
clg_snippet,
},
javascriptreact = {
clg_snippet,
},
typescriptreact = {
clg_snippet,
},
}
require("luasnip.loaders.from_vscode").load()

View File

@@ -0,0 +1,37 @@
local M = {
history = {},
}
M.close_tab = function()
local wins = vim.api.nvim_tabpage_list_wins(0)
for _, win in ipairs(wins) do
local bufnr = vim.api.nvim_win_get_buf(win)
local is_modified = vim.api.nvim_buf_get_option(bufnr, "modified")
if is_modified then
local bufname = vim.fn.bufname(bufnr)
print(bufname .. " is not saved")
return
end
end
table.insert(M.history, vim.fn.bufnr("%"))
vim.cmd("tabclose")
end
M.restore_tab = function()
local buflen = #M.history
if buflen == 0 then
print("No buffers remaining")
return
end
local buf = M.history[buflen]
vim.cmd("tabnew +" .. tostring(buf) .. "buf")
table.remove(M.history, buflen)
end
return M

View File

@@ -0,0 +1,20 @@
local telescope = require("telescope")
telescope.setup({
defaults = {
sorting_strategy = "ascending",
file_ignore_patterns = { ".git/", "node_modules/" },
},
extensions = {
fzf = {
fuzzy = true,
override_generic_sorter = true,
override_file_sorter = true,
case_mode = "smart_case",
},
},
})
if vim.fn.has("win32") == 0 then
require("telescope").load_extension("fzf")
end

View File

@@ -0,0 +1,7 @@
vim.g.edge_diagnostic_virtual_text = "colored"
vim.g.edge_better_performance = 1
vim.cmd([[
colorscheme edge
hi SpellBad guifg=red
]])

View File

@@ -0,0 +1,12 @@
require("nvim-treesitter.configs").setup({
ensure_installed = "maintained",
highlight = {
enable = true,
},
context_commentstring = {
enable = true,
},
autotag = {
enable = true,
},
})

View File

@@ -0,0 +1,127 @@
local M = {}
local function map(mode, shortcut, command, additional_opts)
local opts = { noremap = true, silent = true }
if opts then
opts = vim.tbl_extend("force", opts, additional_opts)
end
vim.api.nvim_set_keymap(mode, shortcut, command, opts)
end
M.nmap = function(shortcut, command, opts)
opts = opts or {}
map("n", shortcut, command, opts)
end
M.vmap = function(shortcut, command, opts)
opts = opts or {}
map("v", shortcut, command, opts)
end
M.tmap = function(shortcut, command, opts)
opts = opts or {}
map("t", shortcut, command, opts)
end
M.imap = function(shortcut, command, opts)
opts = opts or {}
map("i", shortcut, command, opts)
end
M.list_includes_item = function(list, item)
for _, value in pairs(list) do
if value == item then
return true
end
end
return false
end
M.yank = function(message)
if vim.fn.has("win32") == 1 then
os.execute("echo '" .. message .. "' | win32yank -i")
else
-- i use wayland, so there is no xclip for X11
os.execute("echo -n '" .. message .. "' | wl-copy")
end
end
M.copy_diagnostic_message = function()
local diagnostics = vim.lsp.diagnostic.get_line_diagnostics()
if #diagnostics == 0 then
print("No diagnostics to yank")
return
end
local message = ""
if #diagnostics == 1 then
message = diagnostics[1].message
elseif #diagnostics > 1 then
local d = {}
for _, diagnostic in ipairs(diagnostics) do
table.insert(d, diagnostic.message)
end
vim.ui.select(d, { prompt = "Pick a diagnostic to yank" }, function(item)
message = item
end)
end
M.yank(message)
print("Diagnostic message was yanked")
end
M.get_definitions = function()
local params = vim.lsp.util.make_position_params()
local resp = vim.lsp.buf_request_sync(0, "textDocument/definition", params, 1000)
local result = {}
for _, v in pairs(resp) do
table.insert(result, v)
end
result = result[1].result
return result
end
M.goto_local_definition = function()
local definitions = M.get_definitions()
local local_definition = unpack(definitions)
local target = local_definition.targetSelectionRange
local startLine = target.start.line + 1
local startCol = target.start.character
vim.api.nvim_win_set_cursor(0, { startLine, startCol })
end
M.goto_global_definition = function()
local definitions = M.get_definitions()
local global_definition = definitions[#definitions]
local target = global_definition.targetSelectionRange
local startLine = target.start.line + 1
local startCol = target.start.character
local fileuri = global_definition.targetUri
local filepath = string.gsub(fileuri, "file://", "")
vim.cmd("tabnew")
vim.cmd("e " .. filepath)
vim.api.nvim_win_set_cursor(0, { startLine, startCol })
end
return M

View File

@@ -0,0 +1,318 @@
-- Automatically generated packer.nvim plugin loader code
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
return
end
vim.api.nvim_command('packadd packer.nvim')
local no_errors, error_msg = pcall(function()
local time
local profile_info
local should_profile = false
if should_profile then
local hrtime = vim.loop.hrtime
profile_info = {}
time = function(chunk, start)
if start then
profile_info[chunk] = hrtime()
else
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
end
end
else
time = function(chunk, start) end
end
local function save_profiles(threshold)
local sorted_times = {}
for chunk_name, time_taken in pairs(profile_info) do
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
end
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
local results = {}
for i, elem in ipairs(sorted_times) do
if not threshold or threshold and elem[2] > threshold then
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
end
end
_G._packer = _G._packer or {}
_G._packer.profile_output = results
end
time([[Luarocks path setup]], true)
local package_path_str = "/home/daniil/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/daniil/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/daniil/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/daniil/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/home/daniil/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then
package.path = package.path .. ';' .. package_path_str
end
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
package.cpath = package.cpath .. ';' .. install_cpath_pattern
end
time([[Luarocks path setup]], false)
time([[try_loadstring definition]], true)
local function try_loadstring(s, component, name)
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
if not success then
vim.schedule(function()
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
end)
end
return result
end
time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
["Comment.nvim"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/Comment.nvim",
url = "https://github.com/numToStr/Comment.nvim"
},
LuaSnip = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/LuaSnip",
url = "https://github.com/L3MON4D3/LuaSnip"
},
["SchemaStore.nvim"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/SchemaStore.nvim",
url = "https://github.com/b0o/SchemaStore.nvim"
},
["cmp-buffer"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/cmp-buffer",
url = "https://github.com/hrsh7th/cmp-buffer"
},
["cmp-cmdline"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/cmp-cmdline",
url = "https://github.com/hrsh7th/cmp-cmdline"
},
["cmp-nvim-lsp"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
},
["cmp-path"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/cmp-path",
url = "https://github.com/hrsh7th/cmp-path"
},
cmp_luasnip = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
url = "https://github.com/saadparwaiz1/cmp_luasnip"
},
edge = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/edge",
url = "https://github.com/sainnhe/edge"
},
["friendly-snippets"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/friendly-snippets",
url = "https://github.com/rafamadriz/friendly-snippets"
},
["gitsigns.nvim"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
url = "https://github.com/lewis6991/gitsigns.nvim"
},
["impatient.nvim"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/impatient.nvim",
url = "https://github.com/lewis6991/impatient.nvim"
},
["indent-blankline.nvim"] = {
config = { "\27LJ\2\nr\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0B\0\2\1K\0\1\0\1\0\2\25space_char_blankline\6 \25show_current_context\2\nsetup\21indent_blankline\frequire\0" },
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim",
url = "https://github.com/lukas-reineke/indent-blankline.nvim"
},
["lsp_signature.nvim"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/lsp_signature.nvim",
url = "https://github.com/ray-x/lsp_signature.nvim"
},
["lualine.nvim"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/lualine.nvim",
url = "https://github.com/nvim-lualine/lualine.nvim"
},
["markdown-preview.nvim"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/markdown-preview.nvim",
url = "https://github.com/iamcco/markdown-preview.nvim"
},
["null-ls.nvim"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/null-ls.nvim",
url = "https://github.com/jose-elias-alvarez/null-ls.nvim"
},
["nvim-autopairs"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/nvim-autopairs",
url = "https://github.com/windwp/nvim-autopairs"
},
["nvim-cmp"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/nvim-cmp",
url = "https://github.com/hrsh7th/nvim-cmp"
},
["nvim-colorizer.lua"] = {
config = { "\27LJ\2\nA\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0B\0\2\1K\0\1\0\1\2\0\0\6*\nsetup\14colorizer\frequire\0" },
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua",
url = "https://github.com/norcalli/nvim-colorizer.lua"
},
["nvim-lsp-installer"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/nvim-lsp-installer",
url = "https://github.com/williamboman/nvim-lsp-installer"
},
["nvim-lspconfig"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
url = "https://github.com/neovim/nvim-lspconfig"
},
["nvim-tree.lua"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
url = "https://github.com/kyazdani42/nvim-tree.lua"
},
["nvim-treesitter"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
url = "https://github.com/nvim-treesitter/nvim-treesitter"
},
["nvim-ts-autotag"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/nvim-ts-autotag",
url = "https://github.com/windwp/nvim-ts-autotag"
},
["nvim-ts-context-commentstring"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/nvim-ts-context-commentstring",
url = "https://github.com/JoosepAlviste/nvim-ts-context-commentstring"
},
["nvim-web-devicons"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
url = "https://github.com/kyazdani42/nvim-web-devicons"
},
["packer.nvim"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/packer.nvim",
url = "https://github.com/wbthomason/packer.nvim"
},
playground = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/playground",
url = "https://github.com/nvim-treesitter/playground"
},
["plenary.nvim"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/plenary.nvim",
url = "https://github.com/nvim-lua/plenary.nvim"
},
["popup.nvim"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/popup.nvim",
url = "https://github.com/nvim-lua/popup.nvim"
},
["tailwindcss-colors.nvim"] = {
config = { "\27LJ\2\n@\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\23tailwindcss-colors\frequire\0" },
loaded = false,
needs_bufread = false,
only_cond = false,
path = "/home/daniil/.local/share/nvim/site/pack/packer/opt/tailwindcss-colors.nvim",
url = "https://github.com/themaxmarchuk/tailwindcss-colors.nvim"
},
["telescope-fzf-native.nvim"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/telescope-fzf-native.nvim",
url = "https://github.com/nvim-telescope/telescope-fzf-native.nvim"
},
["telescope-symbols.nvim"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/telescope-symbols.nvim",
url = "https://github.com/nvim-telescope/telescope-symbols.nvim"
},
["telescope.nvim"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/telescope.nvim",
url = "https://github.com/nvim-telescope/telescope.nvim"
},
["todo-comments.nvim"] = {
config = { "\27LJ\2\nI\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0B\0\2\1K\0\1\0\1\0\1\nsigns\1\nsetup\18todo-comments\frequire\0" },
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/todo-comments.nvim",
url = "https://github.com/folke/todo-comments.nvim"
},
["tokyonight.nvim"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/tokyonight.nvim",
url = "https://github.com/folke/tokyonight.nvim"
},
["vim-fugitive"] = {
loaded = true,
path = "/home/daniil/.local/share/nvim/site/pack/packer/start/vim-fugitive",
url = "https://github.com/tpope/vim-fugitive"
}
}
time([[Defining packer_plugins]], false)
local module_lazy_loads = {
["^tailwindcss%-colors"] = "tailwindcss-colors.nvim"
}
local lazy_load_called = {['packer.load'] = true}
local function lazy_load_module(module_name)
local to_load = {}
if lazy_load_called[module_name] then return nil end
lazy_load_called[module_name] = true
for module_pat, plugin_name in pairs(module_lazy_loads) do
if not _G.packer_plugins[plugin_name].loaded and string.match(module_name, module_pat) then
to_load[#to_load + 1] = plugin_name
end
end
if #to_load > 0 then
require('packer.load')(to_load, {module = module_name}, _G.packer_plugins)
local loaded_mod = package.loaded[module_name]
if loaded_mod then
return function(modname) return loaded_mod end
end
end
end
if not vim.g.packer_custom_loader_enabled then
table.insert(package.loaders, 1, lazy_load_module)
vim.g.packer_custom_loader_enabled = true
end
-- Config for: nvim-colorizer.lua
time([[Config for nvim-colorizer.lua]], true)
try_loadstring("\27LJ\2\nA\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0B\0\2\1K\0\1\0\1\2\0\0\6*\nsetup\14colorizer\frequire\0", "config", "nvim-colorizer.lua")
time([[Config for nvim-colorizer.lua]], false)
-- Config for: indent-blankline.nvim
time([[Config for indent-blankline.nvim]], true)
try_loadstring("\27LJ\2\nr\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0B\0\2\1K\0\1\0\1\0\2\25space_char_blankline\6 \25show_current_context\2\nsetup\21indent_blankline\frequire\0", "config", "indent-blankline.nvim")
time([[Config for indent-blankline.nvim]], false)
-- Config for: todo-comments.nvim
time([[Config for todo-comments.nvim]], true)
try_loadstring("\27LJ\2\nI\0\0\3\0\4\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\3\0B\0\2\1K\0\1\0\1\0\1\nsigns\1\nsetup\18todo-comments\frequire\0", "config", "todo-comments.nvim")
time([[Config for todo-comments.nvim]], false)
if should_profile then save_profiles() end
end)
if not no_errors then
error_msg = error_msg:gsub('"', '\\"')
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
end