From 8f1ebc54d94351d9006ea70f536f94ce9bdc2bd5 Mon Sep 17 00:00:00 2001 From: talentestors Date: Sat, 30 Nov 2024 20:15:06 +0800 Subject: [PATCH] first commit: Packer --- README.md | 14 ++ ginit.vim | 3 + init.vim | 47 +++++++ lua/colorscheme.lua | 50 +++++++ lua/conf/bufferline.lua | 14 ++ lua/conf/nvim-tree.lua | 18 +++ lua/conf/nvim-treesitter-context.lua | 14 ++ lua/conf/nvim-treesitter.lua | 62 +++++++++ lua/conf/toggleterm.lua | 8 ++ lua/keymaps.lua | 86 ++++++++++++ lua/lsp/config/lua.lua | 52 +++++++ lua/lsp/config/markdown.lua | 16 +++ lua/lsp/config/pyright.lua | 21 +++ lua/lsp/nvim-cmp.lua | 61 ++++++++ lua/lsp/setup.lua | 60 ++++++++ lua/options.lua | 1 + lua/plugins.lua | 36 +++++ plugin/packer_compiled.lua | 199 +++++++++++++++++++++++++++ 18 files changed, 762 insertions(+) create mode 100644 README.md create mode 100644 ginit.vim create mode 100644 init.vim create mode 100644 lua/colorscheme.lua create mode 100644 lua/conf/bufferline.lua create mode 100644 lua/conf/nvim-tree.lua create mode 100644 lua/conf/nvim-treesitter-context.lua create mode 100644 lua/conf/nvim-treesitter.lua create mode 100644 lua/conf/toggleterm.lua create mode 100644 lua/keymaps.lua create mode 100644 lua/lsp/config/lua.lua create mode 100644 lua/lsp/config/markdown.lua create mode 100644 lua/lsp/config/pyright.lua create mode 100644 lua/lsp/nvim-cmp.lua create mode 100644 lua/lsp/setup.lua create mode 100644 lua/options.lua create mode 100644 lua/plugins.lua create mode 100644 plugin/packer_compiled.lua diff --git a/README.md b/README.md new file mode 100644 index 0000000..147f2d0 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +## install packer + +> Unix, Linux Installation + +```shell +git clone --depth 1 https://github.com/wbthomason/packer.nvim\ + ~/.local/share/nvim/site/pack/packer/start/packer.nvim +``` + +> Windows Powershell Installation + +```shell +git clone --depth 1 https://github.com/wbthomason/packer.nvim "$env:LOCALAPPDATA\nvim-data\site\pack\packer\start\packer.nvim" +``` \ No newline at end of file diff --git a/ginit.vim b/ginit.vim new file mode 100644 index 0000000..bfcca8c --- /dev/null +++ b/ginit.vim @@ -0,0 +1,3 @@ +if exists(':GuiFont') + GuiFont! JetBrainsMono\ Nerd\ Font:h11 +endif diff --git a/init.vim b/init.vim new file mode 100644 index 0000000..22d3c5e --- /dev/null +++ b/init.vim @@ -0,0 +1,47 @@ +" Packer 插件管理 +lua require('plugins') +lua require('conf/nvim-treesitter-context') +lua require('conf/nvim-treesitter') +lua require('conf/nvim-tree') +lua require('conf/bufferline') +lua require('conf/toggleterm') + +" lua neovim 配置 +lua require('options') +lua require('keymaps') +lua require('colorscheme') + +" lsp +lua require('lsp/setup') +lua require('lsp/nvim-cmp') + +" 语法高亮 +" syntax on + +" 显示行号 +" set rnu +" set number +set number relativenumber + +set encoding=utf-8 +set termencoding=utf-8 +set fileencoding=utf-8 +set fileencodings=ucs-bom,utf-8,chinese,cp936 +set mouse=a " 启用鼠标 + +" 退出vim重置光标 +:autocmd VimLeave * set guicursor= | call chansend(v:stderr, "\x1b[ q") + +set guifont=JetBrainsMono\ Nerd\ Font:h12 + +" 回车自动换行 +" nnoremap i + +" add tab space +set ts=4 " tabstop +set softtabstop=4 " 在编辑模式的时候按退格键的时候退回缩进的长度 +set shiftwidth=4 " 每一级缩进的长度 +" expandtab 缩进用空格来表示,noexpandtab 则是用制表符表示一个缩进。 +set expandtab +set autoindent " 自动缩进 + diff --git a/lua/colorscheme.lua b/lua/colorscheme.lua new file mode 100644 index 0000000..544cc91 --- /dev/null +++ b/lua/colorscheme.lua @@ -0,0 +1,50 @@ +-- colorscheme.lua for theme + +-- Default options +require('nightfox').setup({ + options = { + -- Compiled file's destination location + compile_path = vim.fn.stdpath("cache") .. "/nightfox", + compile_file_suffix = "_compiled", -- Compiled file suffix + transparent = true, -- Disable setting background + terminal_colors = true, -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal` + dim_inactive = false, -- Non focused panes set to alternative background + module_default = true, -- Default enable value for modules + colorblind = { + enable = false, -- Enable colorblind support + simulate_only = false, -- Only show simulated colorblind colors and not diff shifted + severity = { + protan = 0, -- Severity [0,1] for protan (red) + deutan = 0, -- Severity [0,1] for deutan (green) + tritan = 0, -- Severity [0,1] for tritan (blue) + }, + }, + styles = { -- Style to be applied to different syntax groups + comments = "NONE", -- Value is any valid attr-list value `:help attr-list` + conditionals = "NONE", + constants = "NONE", + functions = "NONE", + keywords = "NONE", + numbers = "NONE", + operators = "NONE", + strings = "NONE", + types = "NONE", + variables = "NONE", + }, + inverse = { -- Inverse highlight for different types + match_paren = false, + visual = false, + search = false, + }, + modules = { -- List of various plugins and additional options + -- ... + }, + }, + palettes = {}, + specs = {}, + groups = {}, + }) + + -- setup must be called before loading + vim.cmd("colorscheme nightfox") + diff --git a/lua/conf/bufferline.lua b/lua/conf/bufferline.lua new file mode 100644 index 0000000..f946266 --- /dev/null +++ b/lua/conf/bufferline.lua @@ -0,0 +1,14 @@ +vim.opt.termguicolors = true +require("bufferline").setup { + options = { + -- 使用 nvim 内置lsp + diagnostics = "nvim_lsp", + -- 左侧让出 nvim-tree 的位置 + offsets = {{ + filetype = "NvimTree", + text = "File Explorer", + highlight = "Directory", + text_align = "left" + }} + } +} diff --git a/lua/conf/nvim-tree.lua b/lua/conf/nvim-tree.lua new file mode 100644 index 0000000..886d0eb --- /dev/null +++ b/lua/conf/nvim-tree.lua @@ -0,0 +1,18 @@ +require'nvim-tree'.setup { + sort = { + sorter = "case_sensitive", + }, + view = { + width = 27, + }, + renderer = { + group_empty = true, + }, + filters = { + dotfiles = true, + }, + -- 不显示 git 状态图标 + git = { + enable = false + } +} diff --git a/lua/conf/nvim-treesitter-context.lua b/lua/conf/nvim-treesitter-context.lua new file mode 100644 index 0000000..69c53c1 --- /dev/null +++ b/lua/conf/nvim-treesitter-context.lua @@ -0,0 +1,14 @@ +require'treesitter-context'.setup{ + enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) + max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit. + min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit. + line_numbers = true, + multiline_threshold = 20, -- Maximum number of lines to show for a single context + trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' + mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline' + -- Separator between context and content. Should be a single character string, like '-'. + -- When separator is set, the context will only show up when there are at least 2 lines above cursorline. + separator = nil, + zindex = 20, -- The Z-index of the context window + on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching +} \ No newline at end of file diff --git a/lua/conf/nvim-treesitter.lua b/lua/conf/nvim-treesitter.lua new file mode 100644 index 0000000..2c71261 --- /dev/null +++ b/lua/conf/nvim-treesitter.lua @@ -0,0 +1,62 @@ +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { "c", "lua", "vim", "vimdoc", "query","cpp", "python", "rust"}, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + -- List of parsers to ignore installing (or "all") + ignore_install = { "javascript" }, + + ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) + -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")! + + highlight = { + enable = true, + + -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to + -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is + -- the name of the parser) + -- list of language that will be disabled + disable = { }, + -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files + disable = function(lang, buf) + local max_filesize = 100 * 1024 -- 100 KB + local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + if ok and stats and stats.size > max_filesize then + return true + end + end, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, + -- 启用增量选择 + incremental_selection = { + enable = true, + keymaps = { + init_selection = '', + node_incremental = '', + node_decremental = '', + scope_incremental = '', + } + }, + -- 启用基于Treesitter的代码格式化(=) . NOTE: This is an experimental feature. + indent = { + enable = true + } +} +-- 开启 Folding +vim.wo.foldmethod = 'expr' +vim.wo.foldexpr = 'nvim_treesitter#foldexpr()' +-- 默认不要折叠 +-- https://stackoverflow.com/questions/8316139/how-to-set-the-default-to-unfolded-when-you-open-a-file +vim.wo.foldlevel = 99 + diff --git a/lua/conf/toggleterm.lua b/lua/conf/toggleterm.lua new file mode 100644 index 0000000..3289c73 --- /dev/null +++ b/lua/conf/toggleterm.lua @@ -0,0 +1,8 @@ +-- termainl +local opt = require("toggleterm").setup({ + open_mapping = [[]], + -- 打开新终端后自动进入插入模式 + start_in_insert = true, + -- 在当前buffer的下方打开新终端 + direction = 'horizontal' +}) \ No newline at end of file diff --git a/lua/keymaps.lua b/lua/keymaps.lua new file mode 100644 index 0000000..e91bd92 --- /dev/null +++ b/lua/keymaps.lua @@ -0,0 +1,86 @@ +-- keymaps.lua for keymap + +-- Modes +-- normal_mode = "n", +-- insert_mode = "i", +-- visual_mode = "v", +-- visual_block_mode = "x", +-- term_mode = "t", +-- command_mode = "c", + +-- leader key 为空 +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +local opt = { + noremap = true, + silent = true, +} + +-- 本地变量 +local map = vim.api.nvim_set_keymap +-- nvimTree +map('n', '', ':NvimTreeToggle', opt) +map('n', '', ':NvimTreeFocus', opt) +map('n', '', ':NvimTreeRefresh', opt) +-- bufferline 左右Tab切换 +map("n", "", ":BufferLineCyclePrev", opt) +map("n", "", ":BufferLineCycleNext", opt) + +-- +local pluginKeys = {} +-- nvim-cmp 自动补全 +pluginKeys.cmp = function(cmp) + return { + -- 上一个 + [''] = cmp.mapping.select_prev_item(), + -- 下一个 + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_next_item(), + -- 出现补全 + [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), + -- 取消 + [''] = cmp.mapping({ + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }), + -- 确认 + -- Accept currently selected item. If none selected, `select` first item. + -- Set `select` to `false` to only confirm explicitly selected items. + [''] = cmp.mapping.confirm({ + select = true , + behavior = cmp.ConfirmBehavior.Replace + }), + -- [''] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. + [''] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), + [''] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), + } +end + +-- lsp 回调函数快捷键设置 +pluginKeys.maplsp = function(mapbuf) + -- rename + mapbuf('n', 'rn', 'lua vim.lsp.buf.rename()', opt) + -- code action + mapbuf('n', 'ca', 'lua vim.lsp.buf.code_action()', opt) + -- go xx + mapbuf('n', 'gd', 'lua vim.lsp.buf.definition()', opt) + mapbuf('n', 'gh', 'lua vim.lsp.buf.hover()', opt) + mapbuf('n', 'gD', 'lua vim.lsp.buf.declaration()', opt) + mapbuf('n', 'gi', 'lua vim.lsp.buf.implementation()', opt) + mapbuf('n', 'gr', 'lua vim.lsp.buf.references()', opt) + -- diagnostic + mapbuf('n', 'go', 'lua vim.diagnostic.open_float()', opt) + mapbuf('n', 'gp', 'lua vim.diagnostic.goto_prev()', opt) + mapbuf('n', 'gn', 'lua vim.diagnostic.goto_next()', opt) + -- mapbuf('n', 'q', 'lua vim.diagnostic.setloclist()', opt) + -- leader + = + mapbuf('n', '=', 'lua vim.lsp.buf.formatting()', opt) + -- mapbuf('n', '', 'lua vim.lsp.buf.signature_help()', opt) + -- mapbuf('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opt) + -- mapbuf('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opt) + -- mapbuf('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opt) + -- mapbuf('n', 'D', 'lua vim.lsp.buf.type_definition()', opt) +end + +return pluginKeys diff --git a/lua/lsp/config/lua.lua b/lua/lsp/config/lua.lua new file mode 100644 index 0000000..162dce0 --- /dev/null +++ b/lua/lsp/config/lua.lua @@ -0,0 +1,52 @@ +require'lspconfig'.lua_ls.setup { + settings = { + Lua = { + runtime = { + -- Tell the language server which version of lua you're using + -- (most likely LuaJIT in the case of Neovim) + version = 'LuaJIT', + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + global = { + 'vim', + 'require' + }, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false, + }, + } + }, + on_init = function(client) + local path = client.workspace_folders[1].name + if vim.loop.fs_stat(path..'/.luarc.json') or vim.loop.fs_stat(path..'/.luarc.jsonc') then + return + end + + client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, { + runtime = { + -- Tell the language server which version of Lua you're using + -- (most likely LuaJIT in the case of Neovim) + version = 'LuaJIT' + }, + -- Make the server aware of Neovim runtime files + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME + -- Depending on the usage, you might want to add additional paths here. + -- "${3rd}/luv/library" + -- "${3rd}/busted/library", + } + -- or pull in all of 'runtimepath'. NOTE: this is a lot slower + -- library = vim.api.nvim_get_runtime_file("", true) + } + }) + end +} diff --git a/lua/lsp/config/markdown.lua b/lua/lsp/config/markdown.lua new file mode 100644 index 0000000..5d2ea4f --- /dev/null +++ b/lua/lsp/config/markdown.lua @@ -0,0 +1,16 @@ +local opts = { + flags = { + debounce_text_changes = 150, + }, + on_attach = function(client, bufnr) + local function buf_set_keymap(...) + vim.api.nvim_buf_set_keymap(bufnr, ...) + end + require("keybindings").mapLSP(buf_set_keymap) + end, +} +return { + on_setup = function(server) + server.setup(opts) + end, +} diff --git a/lua/lsp/config/pyright.lua b/lua/lsp/config/pyright.lua new file mode 100644 index 0000000..e4c387e --- /dev/null +++ b/lua/lsp/config/pyright.lua @@ -0,0 +1,21 @@ +return { + on_setup = function(server) + server.setup({ + flags = { + debounce_text_changes = 150, + }, + on_attach = function(client, bufnr) + -- 禁用格式化功能,交给专门插件插件处理 + client.resolved_capabilities.document_formatting = false + client.resolved_capabilities.document_range_formatting = false + + local function buf_set_keymap(...) + vim.api.nvim_buf_set_keymap(bufnr, ...) + end + -- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end + -- 绑定快捷键 + require("keybindings").mapLSP(buf_set_keymap) + end, + }) + end, +} diff --git a/lua/lsp/nvim-cmp.lua b/lua/lsp/nvim-cmp.lua new file mode 100644 index 0000000..8a9ddc8 --- /dev/null +++ b/lua/lsp/nvim-cmp.lua @@ -0,0 +1,61 @@ +-- https://github.com/neovim/nvim-lspconfig/wiki/Autocompletion +-- https://github.com/hrsh7th/nvim-cmp +-- https://github.com/onsails/lspkind-nvim + +--local lspkind = require("lspkind") +local cmp = require("cmp") + +cmp.setup({ + -- 指定 snippet 引擎 + snippet = { + expand = function(args) + -- For `vsnip` users. + vim.fn["vsnip#anonymous"](args.body) + + -- For `luasnip` users. + -- require('luasnip').lsp_expand(args.body) + + -- For `ultisnips` users. + -- vim.fn["UltiSnips#Anon"](args.body) + + -- For `snippy` users. + -- require'snippy'.expand_snippet(args.body) + end, + }, + -- 来源 + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "nvim_lsp_signature_help" }, + -- For vsnip users. + { name = "vsnip" }, + { name = "buffer" }, + -- For luasnip users. + -- { name = 'luasnip' }, + --For ultisnips users. + -- { name = 'ultisnips' }, + -- -- For snippy users. + -- { name = 'snippy' }, + }, { { name = "path" } }), + + -- 快捷键 + mapping = require("keymaps").cmp(cmp), + -- 使用lspkind-nvim显示类型图标 + -- formatting = require("lsp.ui").formatting, +}) + +-- Use buffer source for `/`. +cmp.setup.cmdline("/", { + sources = { + { name = "buffer" }, + }, +}) + +-- Use cmdline & path source for ':'. +cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), +}) diff --git a/lua/lsp/setup.lua b/lua/lsp/setup.lua new file mode 100644 index 0000000..dad384d --- /dev/null +++ b/lua/lsp/setup.lua @@ -0,0 +1,60 @@ +-- :h mason-default-settings +require("mason").setup({ + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + }, + }, +}) + +-- mason-lspconfig uses the `lspconfig` server names in the APIs it exposes - not `mason.nvim` package names +-- https://github.com/williamboman/mason-lspconfig.nvim/blob/main/doc/server-mapping.md +require("mason-lspconfig").setup({ + -- 确保安装,根据需要填写 + ensure_installed = { + "ts_ls", + "tailwindcss", + "bashls", + "cssls", + "dockerls", + "emmet_ls", + "html", + "jsonls", + "pyright", + "rust_analyzer", + "taplo", + "yamlls", + }, +}) + +local lspconfig = require("lspconfig") + +-- 安装列表 +-- { key: 服务器名, value: 配置文件 } +-- key 必须为下列网址列出的 server name,不可以随便写 +-- https://github.com/williamboman/nvim-lsp-installer#available-lsps +local servers = { + lua_ls = require("lsp.config.lua"), -- lua/lsp/config/lua.lua +-- bashls = require("lsp.config.bash"), +-- pyright = require("lsp.config.pyright"), +-- html = require("lsp.config.html"), +-- cssls = require("lsp.config.css"), +-- emmet_ls = require("lsp.config.emmet"), +-- jsonls = require("lsp.config.json"), +-- tsserver = require("lsp.config.ts"), +-- rust_analyzer = require("lsp.config.rust"), +-- yamlls = require("lsp.config.yamlls"), + -- remark_ls = require("lsp.config.markdown"), +} + +for name, config in pairs(servers) do + if config ~= nil and type(config) == "table" then + -- 自定义初始化配置文件必须实现on_setup 方法 + config.on_setup(lspconfig[name]) + else + -- 使用默认参数 + lspconfig[name].setup({}) + end +end diff --git a/lua/options.lua b/lua/options.lua new file mode 100644 index 0000000..9402b8b --- /dev/null +++ b/lua/options.lua @@ -0,0 +1 @@ +-- options.lua for option of neovim diff --git a/lua/plugins.lua b/lua/plugins.lua new file mode 100644 index 0000000..41c0382 --- /dev/null +++ b/lua/plugins.lua @@ -0,0 +1,36 @@ +return require('packer').startup(function(use) + -- Packer can manage itself + use 'wbthomason/packer.nvim' + -- theme + use 'EdenEast/nightfox.nvim' + -- nvim-treesitter + use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'} + use 'nvim-treesitter/nvim-treesitter-context' + -- toggleterm + use {"akinsho/toggleterm.nvim", tag = '*', config = function() + require("toggleterm").setup() + end} + -- nvim-tree + use {'nvim-tree/nvim-tree.lua', requires = 'nvim-tree/nvim-web-devicons'} + -- bufferline + use {'akinsho/bufferline.nvim', requires = 'kyazdani42/nvim-web-devicons'} + -- lspconfig + use { + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + "neovim/nvim-lspconfig", + } +-- 补全引擎 + use("hrsh7th/nvim-cmp") + -- Snippet 引擎 + use("hrsh7th/vim-vsnip") + -- 补全源 + use("hrsh7th/cmp-vsnip") + use("hrsh7th/cmp-nvim-lsp") -- { name = nvim_lsp } + use("hrsh7th/cmp-buffer") -- { name = 'buffer' }, + use("hrsh7th/cmp-path") -- { name = 'path' } + use("hrsh7th/cmp-cmdline") -- { name = 'cmdline' } + use("hrsh7th/cmp-nvim-lsp-signature-help") -- { name = 'nvim_lsp_signature_help' } + -- 常见编程语言代码段 + use("rafamadriz/friendly-snippets") +end) diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua new file mode 100644 index 0000000..4aceb4d --- /dev/null +++ b/plugin/packer_compiled.lua @@ -0,0 +1,199 @@ +-- 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 = "C:\\Users\\talentestors\\scoop\\apps\\msys2\\2024-11-16\\tmp\\nvim\\packer_hererocks\\2.1.1713484068\\share\\lua\\5.1\\?.lua;C:\\Users\\talentestors\\scoop\\apps\\msys2\\2024-11-16\\tmp\\nvim\\packer_hererocks\\2.1.1713484068\\share\\lua\\5.1\\?\\init.lua;C:\\Users\\talentestors\\scoop\\apps\\msys2\\2024-11-16\\tmp\\nvim\\packer_hererocks\\2.1.1713484068\\lib\\luarocks\\rocks-5.1\\?.lua;C:\\Users\\talentestors\\scoop\\apps\\msys2\\2024-11-16\\tmp\\nvim\\packer_hererocks\\2.1.1713484068\\lib\\luarocks\\rocks-5.1\\?\\init.lua" +local install_cpath_pattern = "C:\\Users\\talentestors\\scoop\\apps\\msys2\\2024-11-16\\tmp\\nvim\\packer_hererocks\\2.1.1713484068\\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 = { + ["bufferline.nvim"] = { + loaded = true, + path = "C:\\Users\\talentestors\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\bufferline.nvim", + url = "https://github.com/akinsho/bufferline.nvim" + }, + ["cmp-buffer"] = { + loaded = true, + path = "C:\\Users\\talentestors\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\cmp-buffer", + url = "https://github.com/hrsh7th/cmp-buffer" + }, + ["cmp-cmdline"] = { + loaded = true, + path = "C:\\Users\\talentestors\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\cmp-cmdline", + url = "https://github.com/hrsh7th/cmp-cmdline" + }, + ["cmp-nvim-lsp"] = { + loaded = true, + path = "C:\\Users\\talentestors\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\cmp-nvim-lsp", + url = "https://github.com/hrsh7th/cmp-nvim-lsp" + }, + ["cmp-nvim-lsp-signature-help"] = { + loaded = true, + path = "C:\\Users\\talentestors\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\cmp-nvim-lsp-signature-help", + url = "https://github.com/hrsh7th/cmp-nvim-lsp-signature-help" + }, + ["cmp-path"] = { + loaded = true, + path = "C:\\Users\\talentestors\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\cmp-path", + url = "https://github.com/hrsh7th/cmp-path" + }, + ["cmp-vsnip"] = { + loaded = true, + path = "C:\\Users\\talentestors\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\cmp-vsnip", + url = "https://github.com/hrsh7th/cmp-vsnip" + }, + ["friendly-snippets"] = { + loaded = true, + path = "C:\\Users\\talentestors\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\friendly-snippets", + url = "https://github.com/rafamadriz/friendly-snippets" + }, + ["mason-lspconfig.nvim"] = { + loaded = true, + path = "C:\\Users\\talentestors\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\mason-lspconfig.nvim", + url = "https://github.com/williamboman/mason-lspconfig.nvim" + }, + ["mason.nvim"] = { + loaded = true, + path = "C:\\Users\\talentestors\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\mason.nvim", + url = "https://github.com/williamboman/mason.nvim" + }, + ["nightfox.nvim"] = { + loaded = true, + path = "C:\\Users\\talentestors\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\nightfox.nvim", + url = "https://github.com/EdenEast/nightfox.nvim" + }, + ["nvim-cmp"] = { + loaded = true, + path = "C:\\Users\\talentestors\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\nvim-cmp", + url = "https://github.com/hrsh7th/nvim-cmp" + }, + ["nvim-lspconfig"] = { + loaded = true, + path = "C:\\Users\\talentestors\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\nvim-lspconfig", + url = "https://github.com/neovim/nvim-lspconfig" + }, + ["nvim-tree.lua"] = { + loaded = true, + path = "C:\\Users\\talentestors\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\nvim-tree.lua", + url = "https://github.com/nvim-tree/nvim-tree.lua" + }, + ["nvim-treesitter"] = { + loaded = true, + path = "C:\\Users\\talentestors\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\nvim-treesitter", + url = "https://github.com/nvim-treesitter/nvim-treesitter" + }, + ["nvim-treesitter-context"] = { + loaded = true, + path = "C:\\Users\\talentestors\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\nvim-treesitter-context", + url = "https://github.com/nvim-treesitter/nvim-treesitter-context" + }, + ["nvim-web-devicons"] = { + loaded = true, + path = "C:\\Users\\talentestors\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\nvim-web-devicons", + url = "https://github.com/nvim-tree/nvim-web-devicons" + }, + ["packer.nvim"] = { + loaded = true, + path = "C:\\Users\\talentestors\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\packer.nvim", + url = "https://github.com/wbthomason/packer.nvim" + }, + ["toggleterm.nvim"] = { + config = { "\27LJ\2\n8\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\15toggleterm\frequire\0" }, + loaded = true, + path = "C:\\Users\\talentestors\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\toggleterm.nvim", + url = "https://github.com/akinsho/toggleterm.nvim" + }, + ["vim-vsnip"] = { + loaded = true, + path = "C:\\Users\\talentestors\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\vim-vsnip", + url = "https://github.com/hrsh7th/vim-vsnip" + } +} + +time([[Defining packer_plugins]], false) +-- Config for: toggleterm.nvim +time([[Config for toggleterm.nvim]], true) +try_loadstring("\27LJ\2\n8\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\15toggleterm\frequire\0", "config", "toggleterm.nvim") +time([[Config for toggleterm.nvim]], 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