commit 1c7bc59b003226a4265ed03a3c14e9c6ed37edc8 Author: serxoz Date: Tue Nov 1 18:09:46 2022 +0100 primeiro diff --git a/README.md b/README.md new file mode 100644 index 0000000..41327b3 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# NeoVim +Configuración para neovim + +## Pre-requisitos +- Packer: +```sh +git clone --depth 1 https://github.com/wbthomason/packer.nvim\ + ~/.local/share/nvim/site/pack/packer/start/packer.nvim +``` + +## Instalar +```sh +git clone https://git.tr4ck.net/serxoz/nvim-config.git ~/.config/nvim +``` + +Dentro do nvim: :PackerSync diff --git a/after/plugin/colors.lua b/after/plugin/colors.lua new file mode 100644 index 0000000..bce92bc --- /dev/null +++ b/after/plugin/colors.lua @@ -0,0 +1,52 @@ +-- vim.g.serxoz_colorscheme = "tokyonight" +-- vim.g.serxoz_colorscheme = "gruvbox" +-- vim.g.serxoz_colorscheme = "catppuccin" +-- vim.g.serxoz_colorscheme = "rose-pine" +vim.g.serxoz_colorscheme = "nord" + +require("catppuccin").setup({ + transparent_background = false, +}); + +function ColorMyPencils() + vim.g.gruvbox_contrast_dark = 'hard' + vim.g.tokyonight_transparent_sidebar = true + vim.g.tokyonight_transparent = true + vim.g.gruvbox_invert_selection = '0' + vim.opt.background = "dark" + + vim.cmd("colorscheme " .. vim.g.serxoz_colorscheme) + + local hl = function(thing, opts) + vim.api.nvim_set_hl(0, thing, opts) + end + + hl("SignColumn", { + bg = "none", + }) + + hl("ColorColumn", { + ctermbg = 0, + bg = "#272727", + }) + + hl("CursorLineNR", { + bg = "None" + }) + + hl("Normal", { + bg = "none" + }) + + -- hl("LineNr", { + -- -- fg = "#98971a" --gruvbox + -- fg = "#5eacd3" + -- }) + -- + -- hl("netrwDir", { + -- -- fg = "#98971a" --gruvbox + -- fg = "#5eacd3" + -- }) + +end +ColorMyPencils() diff --git a/after/plugin/init.lua b/after/plugin/init.lua new file mode 100644 index 0000000..2b710a4 --- /dev/null +++ b/after/plugin/init.lua @@ -0,0 +1 @@ +vim.cmd(":TSInstall all"); diff --git a/after/plugin/keymap/harpoon.lua b/after/plugin/keymap/harpoon.lua new file mode 100644 index 0000000..e6269b5 --- /dev/null +++ b/after/plugin/keymap/harpoon.lua @@ -0,0 +1,16 @@ +local nnoremap = require("serxoz.keymap").nnoremap + +local silent = { silent = true } + +-- Terminal commands +-- ueoa is first through fourth finger left hand home row. +-- This just means I can crush, with opposite hand, the 4 terminal positions +-- +-- These functions are stored in harpoon. A plugn that I am developing +nnoremap("a", function() require("harpoon.mark").add_file() end, silent) +nnoremap("", function() require("harpoon.ui").toggle_quick_menu() end, silent) + +nnoremap("", function() require("harpoon.ui").nav_file(1) end, silent) +nnoremap("", function() require("harpoon.ui").nav_file(2) end, silent) +nnoremap("", function() require("harpoon.ui").nav_file(3) end, silent) +nnoremap("", function() require("harpoon.ui").nav_file(4) end, silent) diff --git a/after/plugin/keymap/init.lua b/after/plugin/keymap/init.lua new file mode 100644 index 0000000..fecaf98 --- /dev/null +++ b/after/plugin/keymap/init.lua @@ -0,0 +1,55 @@ +local Remap = require("serxoz.keymap") +local nnoremap = Remap.nnoremap +local vnoremap = Remap.vnoremap +local inoremap = Remap.inoremap +local xnoremap = Remap.xnoremap +local nmap = Remap.nmap + +nnoremap("pv", ":Ex") +nnoremap("u", ":UndotreeShow") + +vnoremap("J", ":m '>+1gv=gv") +vnoremap("K", ":m '<-2gv=gv") + +nnoremap("Y", "yg$") +nnoremap("n", "nzzzv") +nnoremap("N", "Nzzzv") +nnoremap("J", "mzJ`z") +nnoremap("", "zz") +nnoremap("", "zz") +nnoremap("vwm", function() + require("vim-with-me").StartVimWithMe() +end) +nnoremap("svwm", function() + require("vim-with-me").StopVimWithMe() +end) + +-- greatest remap ever +xnoremap("p", "\"_dP") + +-- next greatest remap ever : asbjornHaland +nnoremap("y", "\"+y") +vnoremap("y", "\"+y") +nmap("Y", "\"+Y") + +nnoremap("d", "\"_d") +vnoremap("d", "\"_d") + +vnoremap("d", "\"_d") + +-- This is going to get me cancelled +inoremap("", "") + +nnoremap("Q", "") + +nnoremap("", "cnextzz") +nnoremap("", "cprevzz") +nnoremap("k", "lnextzz") +nnoremap("j", "lprevzz") + +nnoremap("s", ":%s/\\<\\>//gI") + +-- Buffers +nnoremap("", ":bnext") +nnoremap("", ":bprevious") +nnoremap("x", ":bdelete") diff --git a/after/plugin/keymap/telescope.lua b/after/plugin/keymap/telescope.lua new file mode 100644 index 0000000..828cb62 --- /dev/null +++ b/after/plugin/keymap/telescope.lua @@ -0,0 +1,26 @@ +local Remap = require("serxoz.keymap") +local nnoremap = Remap.nnoremap + +nnoremap("", ":Telescope") +nnoremap("ps", function() + require('telescope.builtin').grep_string({ search = vim.fn.input("Grep For > ")}) +end) +nnoremap("", function() + require('telescope.builtin').git_files() +end) +nnoremap("ff", function() + require('telescope.builtin').find_files() +end) +nnoremap("fg", function() + require('telescope.builtin').live_grep() +end) + +nnoremap("fw", function() + require('telescope.builtin').grep_string { search = vim.fn.expand("") } +end) +nnoremap("fb", function() + require('telescope.builtin').buffers() +end) +nnoremap("fh", function() + require('telescope.builtin').help_tags() +end) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua new file mode 100644 index 0000000..fb07c2b --- /dev/null +++ b/after/plugin/lsp.lua @@ -0,0 +1,189 @@ +local Remap = require("serxoz.keymap") +local nnoremap = Remap.nnoremap +local inoremap = Remap.inoremap + +-- local sumneko_root_path = "/home/mpaulson/personal/sumneko" +-- local sumneko_binary = sumneko_root_path .. "/bin/lua-language-server" + +-- Setup nvim-cmp. +local cmp = require("cmp") +local source_mapping = { + buffer = "[Buffer]", + nvim_lsp = "[LSP]", + nvim_lua = "[Lua]", + path = "[Path]", +} +local lspkind = require("lspkind") + +cmp.setup({ + snippet = { + expand = function(args) + -- For `vsnip` user. + -- vim.fn["vsnip#anonymous"](args.body) + + -- For `luasnip` user. + require("luasnip").lsp_expand(args.body) + + -- For `ultisnips` user. + -- vim.fn["UltiSnips#Anon"](args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + }), + + formatting = { + format = function(entry, vim_item) + vim_item.kind = lspkind.presets.default[vim_item.kind] + local menu = source_mapping[entry.source.name] + vim_item.menu = menu + return vim_item + end, + }, + + sources = { + { name = "nvim_lsp" }, + + -- For vsnip user. + -- { name = 'vsnip' }, + + -- For luasnip user. + { name = "luasnip" }, + + -- For ultisnips user. + -- { name = 'ultisnips' }, + + { name = "buffer" }, + }, +}) + +local function config(_config) + return vim.tbl_deep_extend("force", { + on_attach = function() + nnoremap("gd", function() vim.lsp.buf.definition() end) + nnoremap("K", function() vim.lsp.buf.hover() end) + nnoremap("vws", function() vim.lsp.buf.workspace_symbol() end) + nnoremap("vd", function() vim.diagnostic.open_float() end) + nnoremap("[d", function() vim.diagnostic.goto_next() end) + nnoremap("]d", function() vim.diagnostic.goto_prev() end) + nnoremap("vca", function() vim.lsp.buf.code_action() end) + nnoremap("vco", function() vim.lsp.buf.code_action({ + filter = function(code_action) + if not code_action or not code_action.data then + return false + end + + local data = code_action.data.id + return string.sub(data, #data - 1, #data) == ":0" + end, + apply = true + }) end) + nnoremap("vrr", function() vim.lsp.buf.references() end) + nnoremap("vrn", function() vim.lsp.buf.rename() end) + inoremap("", function() vim.lsp.buf.signature_help() end) + end, + }, _config or {}) +end + +require("lspconfig").zls.setup(config()) + +require("lspconfig").tsserver.setup(config()) + +require("lspconfig").ccls.setup(config()) + +require("lspconfig").jedi_language_server.setup(config()) + +require("lspconfig").svelte.setup(config()) + +require("lspconfig").solang.setup(config()) + +require("lspconfig").cssls.setup(config()) + +require("lspconfig").gopls.setup(config({ + cmd = { "gopls", "serve" }, + settings = { + gopls = { + analyses = { + unusedparams = true, + }, + staticcheck = true, + }, + }, +})) + +-- who even uses this? +require("lspconfig").rust_analyzer.setup(config({ + -- cmd = { "rustup", "run", "rust-analyzer" }, + --[[ + settings = { + rust = { + unstable_features = true, + build_on_save = false, + all_features = true, + }, + } + --]] +})) + +--require("lspconfig").sumneko_lua.setup(config({ +-- cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" }, +-- settings = { +-- Lua = { +-- runtime = { +-- -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) +-- version = "LuaJIT", +-- -- Setup your lua path +-- path = vim.split(package.path, ";"), +-- }, +-- diagnostics = { +-- -- Get the language server to recognize the `vim` global +-- globals = { "vim" }, +-- }, +-- workspace = { +-- -- Make the server aware of Neovim runtime files +-- library = { +-- [vim.fn.expand("$VIMRUNTIME/lua")] = true, +-- [vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true, +-- }, +-- }, +-- }, +-- }, +--})) + +local opts = { + -- whether to highlight the currently hovered symbol + -- disable if your cpu usage is higher than you want it + -- or you just hate the highlight + -- default: true + highlight_hovered_item = true, + + -- whether to show outline guides + -- default: true + show_guides = true, +} + +require("symbols-outline").setup(opts) + +local snippets_paths = function() + local plugins = { "friendly-snippets" } + local paths = {} + local path + local root_path = vim.env.HOME .. "/.vim/plugged/" + for _, plug in ipairs(plugins) do + path = root_path .. plug + if vim.fn.isdirectory(path) ~= 0 then + table.insert(paths, path) + end + end + return paths +end + +require("luasnip.loaders.from_vscode").lazy_load({ + paths = snippets_paths(), + include = nil, -- Load all languages + exclude = {}, +}) + diff --git a/after/plugin/statusline.lua b/after/plugin/statusline.lua new file mode 100644 index 0000000..05da193 --- /dev/null +++ b/after/plugin/statusline.lua @@ -0,0 +1,3 @@ +require('lualine').setup({ + sections = sections, +}) diff --git a/after/plugin/treesitter-context.lua b/after/plugin/treesitter-context.lua new file mode 100644 index 0000000..1f98ddc --- /dev/null +++ b/after/plugin/treesitter-context.lua @@ -0,0 +1,41 @@ +local nnoremap = require("serxoz.keymap").nnoremap + +function ContextSetup(show_all_context) + require("treesitter-context").setup({ + enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) + throttle = true, -- Throttles plugin updates (may improve performance) + max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit. + show_all_context = show_all_context, + patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries. + -- For all filetypes + -- Note that setting an entry here replaces all other patterns for this entry. + -- By setting the 'default' entry below, you can control which nodes you want to + -- appear in the context window. + default = { + "function", + "method", + "for", + "while", + "if", + "switch", + "case", + }, + + rust = { + "loop_expression", + "impl_item", + }, + + typescript = { + "class_declaration", + "abstract_class_declaration", + "else_clause", + }, + }, + }) +end + +nnoremap("cf", function() ContextSetup(true) end) +nnoremap("cp", function() ContextSetup(false) end) +ContextSetup(false) + diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua new file mode 100644 index 0000000..ddf4901 --- /dev/null +++ b/after/plugin/treesitter.lua @@ -0,0 +1,10 @@ +require'nvim-treesitter.configs'.setup { + ensure_installed = "all", + sync_install = false, + + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, +} + diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..579a44b --- /dev/null +++ b/init.lua @@ -0,0 +1 @@ +require("serxoz") diff --git a/lua/serxoz/init.lua b/lua/serxoz/init.lua new file mode 100644 index 0000000..8e5951f --- /dev/null +++ b/lua/serxoz/init.lua @@ -0,0 +1,2 @@ +require("serxoz.set") +require("serxoz.packer") diff --git a/lua/serxoz/keymap.lua b/lua/serxoz/keymap.lua new file mode 100644 index 0000000..53c5cd3 --- /dev/null +++ b/lua/serxoz/keymap.lua @@ -0,0 +1,20 @@ +local M = {} + +local function bind(op, outer_opts) + outer_opts = outer_opts or {noremap = true} + return function(lhs, rhs, opts) + opts = vim.tbl_extend("force", + outer_opts, + opts or {} + ) + vim.keymap.set(op, lhs, rhs, opts) + end +end + +M.nmap = bind("n", {noremap = false}) +M.nnoremap = bind("n") +M.vnoremap = bind("v") +M.xnoremap = bind("x") +M.inoremap = bind("i") + +return M diff --git a/lua/serxoz/packer.lua b/lua/serxoz/packer.lua new file mode 100644 index 0000000..b4947ad --- /dev/null +++ b/lua/serxoz/packer.lua @@ -0,0 +1,72 @@ +return require("packer").startup(function(use) + use("wbthomason/packer.nvim") + + -- Simple plugins can be specified as strings + use("TimUntersberger/neogit") + + -- TJ created lodash of neovim + use("nvim-lua/plenary.nvim") + use("nvim-lua/popup.nvim") + use("nvim-telescope/telescope.nvim") + + use({ + 'nvim-lualine/lualine.nvim', + requires = { 'kyazdani42/nvim-web-devicons', opt = true } + }) + + -- All the things + use("neovim/nvim-lspconfig") + use("hrsh7th/cmp-nvim-lsp") + use("hrsh7th/cmp-buffer") + use("hrsh7th/nvim-cmp") + use("onsails/lspkind-nvim") + use("nvim-lua/lsp_extensions.nvim") + use("glepnir/lspsaga.nvim") + use("simrat39/symbols-outline.nvim") + use("L3MON4D3/LuaSnip") + use("saadparwaiz1/cmp_luasnip") + + -- Primeagen doesn"t create lodash + use("ThePrimeagen/harpoon") + + use("mbbill/undotree") + + -- Colorscheme section + use("gruvbox-community/gruvbox") + use("folke/tokyonight.nvim") + use({"catppuccin/nvim", as = "catppuccin" }) + use({"rose-pine/neovim", as = "rose-pine" }) + use("shaunsingh/nord.nvim") + + use("nvim-treesitter/nvim-treesitter", { + run = ":TSUpdate" + }) + + use("nvim-treesitter/playground") + use("romgrk/nvim-treesitter-context") + + use("terrortylor/nvim-comment") + require('nvim_comment').setup() + + use {'akinsho/bufferline.nvim', tag = "v3.*", requires = 'kyazdani42/nvim-web-devicons'} + vim.opt.termguicolors = true + require("bufferline").setup{ + options = { + separator_style = "slant", + show_buffer_icons = true, + show_close_icon = false, + diagnostics = "nvim_lsp", + diagnostics_indicator = function(count, level) + local icon = level:match("error") and "" or "" + return icon .. count + end, + highlights = { + tab = { + fg = '#121212', + bg = '#120000' + } + } + } + } + +end) diff --git a/lua/serxoz/set.lua b/lua/serxoz/set.lua new file mode 100644 index 0000000..d22b84d --- /dev/null +++ b/lua/serxoz/set.lua @@ -0,0 +1,43 @@ +vim.opt.guicursor = "" + +vim.opt.nu = true +vim.opt.relativenumber = true + +vim.opt.errorbells = false + +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + +vim.opt.smartindent = true + +vim.opt.wrap = false + +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" +vim.opt.undofile = true + +vim.opt.hlsearch = false +vim.opt.incsearch = true + +vim.opt.termguicolors = true + +vim.opt.scrolloff = 8 +vim.opt.signcolumn = "yes" +vim.opt.isfname:append("@-@") + +-- Give more space for displaying messages. +vim.opt.cmdheight = 1 + +-- Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable +-- delays and poor user experience. +vim.opt.updatetime = 50 + +-- Don't pass messages to |ins-completion-menu|. +vim.opt.shortmess:append("c") + +vim.opt.colorcolumn = "80" + +vim.g.mapleader = " " diff --git a/lua/serxoz/telescope.lua b/lua/serxoz/telescope.lua new file mode 100644 index 0000000..d3b8d63 --- /dev/null +++ b/lua/serxoz/telescope.lua @@ -0,0 +1,227 @@ +local pickers = require("telescope.pickers") +local finders = require("telescope.finders") +local previewers = require("telescope.previewers") +local action_state = require("telescope.actions.state") +local conf = require("telescope.config").values +local actions = require("telescope.actions") + +require("telescope").setup({ + defaults = { + file_sorter = require("telescope.sorters").get_fzy_sorter, + prompt_prefix = " >", + color_devicons = true, + + file_previewer = require("telescope.previewers").vim_buffer_cat.new, + grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, + qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, + + mappings = { + i = { + [""] = false, + [""] = actions.send_to_qflist, + [""] = actions.select_default, + }, + }, + }, + --[[ + extensions = { + fzy_native = { + override_generic_sorter = false, + override_file_sorter = true, + }, + }, + ]] +}) + +require("telescope").load_extension("git_worktree") +-- require("telescope").load_extension("fzy_native") + +local M = {} + +function M.reload_modules() + -- Because TJ gave it to me. Makes me happpy. Put it next to his other + -- awesome things. + local lua_dirs = vim.fn.glob("./lua/*", 0, 1) + for _, dir in ipairs(lua_dirs) do + dir = string.gsub(dir, "./lua/", "") + require("plenary.reload").reload_module(dir) + end +end + +M.search_dotfiles = function() + require("telescope.builtin").find_files({ + prompt_title = "< VimRC >", + cwd = vim.env.DOTFILES, + hidden = true, + }) +end + +local function set_background(content) + print(content) + vim.fn.system("feh --bg-max " .. content) +end + +local function select_background(prompt_bufnr, map) + local function set_the_background(close) + local content = require("telescope.actions.state").get_selected_entry(prompt_bufnr) + set_background(content.cwd .. "/" .. content.value) + if close then + require("telescope.actions").close(prompt_bufnr) + end + end + + map("i", "", function() + set_the_background() + end) + + map("i", "", function() + set_the_background(true) + end) +end + +local function image_selector(prompt, cwd) + return function() + require("telescope.builtin").find_files({ + prompt_title = prompt, + cwd = cwd, + + attach_mappings = function(prompt_bufnr, map) + print("help me ???") + select_background(prompt_bufnr, map) + + -- Please continue mapping (attaching additional key maps): + -- Ctrl+n/p to move up and down the list. + return true + end, + }) + end +end + +M.anime_selector = image_selector("< Anime Bobs > ", "~/personal/anime") + +local function refactor(prompt_bufnr) + local content = require("telescope.actions.state").get_selected_entry(prompt_bufnr) + require("telescope.actions").close(prompt_bufnr) + require("refactoring").refactor(content.value) +end + +M.refactors = function() + require("telescope.pickers").new({}, { + prompt_title = "refactors", + finder = require("telescope.finders").new_table({ + results = require("refactoring").get_refactors(), + }), + sorter = require("telescope.config").values.generic_sorter({}), + attach_mappings = function(_, map) + map("i", "", refactor) + map("n", "", refactor) + return true + end, + }):find() +end + +M.git_branches = function() + require("telescope.builtin").git_branches({ + attach_mappings = function(_, map) + map("i", "", actions.git_delete_branch) + map("n", "", actions.git_delete_branch) + return true + end, + }) +end + +M.dev = function(opts) + opts = opts or {} + + opts.cwd = opts.cwd or vim.loop.fs_realpath(vim.loop.cwd()) + print("HEY BAE", opts.cwd) + + local possible_files = vim.api.nvim_get_runtime_file("/lua/**/dev.lua", true) + local local_files = {} + for _, raw_f in ipairs(possible_files) do + local real_f = vim.loop.fs_realpath(raw_f) + + if string.find(real_f, opts.cwd, 1, true) then + table.insert(local_files, real_f) + end + end + + local dev = local_files[1] + local loaded = loadfile(dev) + local ok, mod = pcall(loaded) + if not ok then + print("===================================================") + print("HEY PRIME. YOUR CODE DOESNT WORK. THIS IS NOT ON ME") + print("===================================================") + return + end + + -- P(mod) + local objs = {} + for k, v in pairs(mod) do + local debug_info = debug.getinfo(v) + table.insert(objs, { + filename = string.sub(debug_info.source, 2), + text = k, + }) + end + + local mod_name = vim.split(dev, "/lua/") + if #mod_name ~= 2 then + print("===================================================") + print("HEY PRIME. I DO NOT KNOW HOW TO FIND THIS FILE:") + print(dev) + print("===================================================") + end + mod_name = string.gsub(mod_name[2], ".lua$", "") + mod_name = string.gsub(mod_name, "/", ".") + + pickers.new({ + finder = finders.new_table({ + results = objs, + entry_maker = function(entry) + return { + value = entry, + text = entry.text, + display = entry.text, + ordinal = entry.text, + filename = entry.filename, + } + end, + }), + sorter = conf.generic_sorter(opts), + previewer = previewers.builtin.new(opts), + attach_mappings = function(_, map) + actions.select_default:replace(function(...) + -- print("SELECTED", vim.inspect(action_state.get_selected_entry())) + local entry = action_state.get_selected_entry() + actions.close(...) + + mod[entry.value.text]() + end) + + map("i", "", function(...) + local entry = action_state.get_selected_entry() + actions.close(...) + + vim.schedule(function() + -- vim.cmd(string.format([[normal!]], entry.value.text)) + vim.api.nvim_feedkeys( + vim.api.nvim_replace_termcodes( + string.format(":lua require('%s').%s()", mod_name, entry.value.text), + true, + false, + true + ), + "n", + true + ) + end) + end) + + return true + end, + }):find() +end + +return M diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua new file mode 100644 index 0000000..779ba17 --- /dev/null +++ b/plugin/packer_compiled.lua @@ -0,0 +1,240 @@ +-- 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() + +_G._packer = _G._packer or {} +_G._packer.inside_compile = true + +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 + if threshold then + table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)') + end + + _G._packer.profile_output = results +end + +time([[Luarocks path setup]], true) +local package_path_str = "/home/sergio/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/sergio/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/sergio/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/sergio/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/sergio/.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 = { + LuaSnip = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/LuaSnip", + url = "https://github.com/L3MON4D3/LuaSnip" + }, + ["bufferline.nvim"] = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/bufferline.nvim", + url = "https://github.com/akinsho/bufferline.nvim" + }, + catppuccin = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/catppuccin", + url = "https://github.com/catppuccin/nvim" + }, + ["cmp-buffer"] = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/cmp-buffer", + url = "https://github.com/hrsh7th/cmp-buffer" + }, + ["cmp-nvim-lsp"] = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", + url = "https://github.com/hrsh7th/cmp-nvim-lsp" + }, + cmp_luasnip = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/cmp_luasnip", + url = "https://github.com/saadparwaiz1/cmp_luasnip" + }, + gruvbox = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/gruvbox", + url = "https://github.com/gruvbox-community/gruvbox" + }, + harpoon = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/harpoon", + url = "https://github.com/ThePrimeagen/harpoon" + }, + ["lsp_extensions.nvim"] = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/lsp_extensions.nvim", + url = "https://github.com/nvim-lua/lsp_extensions.nvim" + }, + ["lspkind-nvim"] = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/lspkind-nvim", + url = "https://github.com/onsails/lspkind-nvim" + }, + ["lspsaga.nvim"] = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/lspsaga.nvim", + url = "https://github.com/glepnir/lspsaga.nvim" + }, + ["lualine.nvim"] = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/lualine.nvim", + url = "https://github.com/nvim-lualine/lualine.nvim" + }, + neogit = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/neogit", + url = "https://github.com/TimUntersberger/neogit" + }, + ["nord.nvim"] = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/nord.nvim", + url = "https://github.com/shaunsingh/nord.nvim" + }, + ["nvim-cmp"] = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/nvim-cmp", + url = "https://github.com/hrsh7th/nvim-cmp" + }, + ["nvim-comment"] = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/nvim-comment", + url = "https://github.com/terrortylor/nvim-comment" + }, + ["nvim-lspconfig"] = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", + url = "https://github.com/neovim/nvim-lspconfig" + }, + ["nvim-treesitter"] = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/nvim-treesitter", + url = "https://github.com/nvim-treesitter/nvim-treesitter" + }, + ["nvim-treesitter-context"] = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/nvim-treesitter-context", + url = "https://github.com/romgrk/nvim-treesitter-context" + }, + ["nvim-web-devicons"] = { + loaded = false, + needs_bufread = false, + path = "/home/sergio/.local/share/nvim/site/pack/packer/opt/nvim-web-devicons", + url = "https://github.com/kyazdani42/nvim-web-devicons" + }, + ["packer.nvim"] = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/packer.nvim", + url = "https://github.com/wbthomason/packer.nvim" + }, + playground = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/playground", + url = "https://github.com/nvim-treesitter/playground" + }, + ["plenary.nvim"] = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/plenary.nvim", + url = "https://github.com/nvim-lua/plenary.nvim" + }, + ["popup.nvim"] = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/popup.nvim", + url = "https://github.com/nvim-lua/popup.nvim" + }, + ["rose-pine"] = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/rose-pine", + url = "https://github.com/rose-pine/neovim" + }, + ["symbols-outline.nvim"] = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/symbols-outline.nvim", + url = "https://github.com/simrat39/symbols-outline.nvim" + }, + ["telescope.nvim"] = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/telescope.nvim", + url = "https://github.com/nvim-telescope/telescope.nvim" + }, + ["tokyonight.nvim"] = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/tokyonight.nvim", + url = "https://github.com/folke/tokyonight.nvim" + }, + undotree = { + loaded = true, + path = "/home/sergio/.local/share/nvim/site/pack/packer/start/undotree", + url = "https://github.com/mbbill/undotree" + } +} + +time([[Defining packer_plugins]], false) + +_G._packer.inside_compile = false +if _G._packer.needs_bufread == true then + vim.cmd("doautocmd BufRead") +end +_G._packer.needs_bufread = 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