Updates :)

This commit is contained in:
Blake Ridgway 2023-02-02 22:27:10 -06:00
parent d10e30beec
commit 3228cc2d74
20 changed files with 987 additions and 9 deletions

16
nvim/init.lua Normal file
View file

@ -0,0 +1,16 @@
require("blakeridgway.plugins-setup")
require("blakeridgway.core.options")
require("blakeridgway.core.keymaps")
require("blakeridgway.core.colorscheme")
require("blakeridgway.plugins.comment")
require("blakeridgway.plugins.nvim-tree")
require("blakeridgway.plugins.lualine")
require("blakeridgway.plugins.telescope")
require("blakeridgway.plugins.nvim-cmp")
require("blakeridgway.plugins.lsp.mason")
require("blakeridgway.plugins.lsp.lspconfig")
require("blakeridgway.plugins.lsp.null-ls")
require("blakeridgway.plugins.autopairs")
require("blakeridgway.plugins.treesitter")
require("blakeridgway.plugins.gitsigns")
require("blakeridgway.plugins.discord")

View file

@ -0,0 +1,7 @@
-- set colorscheme to nightfly with protected call
-- in case it isn't installed
local status, _ = pcall(vim.cmd, "colorscheme nightfly")
if not status then
print("Colorscheme not found!") -- print error if colorscheme not installed
return
end

View file

@ -0,0 +1,55 @@
-- set leader key to space
vim.g.mapleader = " "
local keymap = vim.keymap -- for conciseness
---------------------
-- General Keymaps
---------------------
-- use jk to exit insert mode
keymap.set("i", "jk", "<ESC>")
-- clear search highlights
keymap.set("n", "<leader>nh", ":nohl<CR>")
-- delete single character without copying into register
keymap.set("n", "x", '"_x')
-- increment/decrement numbers
keymap.set("n", "<leader>+", "<C-a>") -- increment
keymap.set("n", "<leader>-", "<C-x>") -- decrement
-- window management
keymap.set("n", "<leader>sv", "<C-w>v") -- split window vertically
keymap.set("n", "<leader>sh", "<C-w>s") -- split window horizontally
keymap.set("n", "<leader>se", "<C-w>=") -- make split windows equal width & height
keymap.set("n", "<leader>sx", ":close<CR>") -- close current split window
keymap.set("n", "<leader>to", ":tabnew<CR>") -- open new tab
keymap.set("n", "<leader>tx", ":tabclose<CR>") -- close current tab
keymap.set("n", "<leader>tn", ":tabn<CR>") -- go to next tab
keymap.set("n", "<leader>tp", ":tabp<CR>") -- go to previous tab
----------------------
-- Plugin Keybinds
----------------------
-- vim-maximizer
keymap.set("n", "<leader>sm", ":MaximizerToggle<CR>") -- toggle split window maximization
-- nvim-tree
keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>") -- toggle file explorer
-- telescope
keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>") -- find files within current working directory, respects .gitignore
keymap.set("n", "<leader>fs", "<cmd>Telescope live_grep<cr>") -- find string in current working directory as you type
keymap.set("n", "<leader>fc", "<cmd>Telescope grep_string<cr>") -- find string under cursor in current working directory
keymap.set("n", "<leader>fb", "<cmd>Telescope buffers<cr>") -- list open buffers in current neovim instance
keymap.set("n", "<leader>fh", "<cmd>Telescope help_tags<cr>") -- list available help tags
-- telescope git commands
keymap.set("n", "<leader>gc", "<cmd>Telescope git_commits<cr>") -- list all git commits (use <cr> to checkout) ["gc" for git commits]
keymap.set("n", "<leader>gfc", "<cmd>Telescope git_bcommits<cr>") -- list git commits for current file/buffer (use <cr> to checkout) ["gfc" for git file commits]
keymap.set("n", "<leader>gb", "<cmd>Telescope git_branches<cr>") -- list git branches (use <cr> to checkout) ["gb" for git branch]
keymap.set("n", "<leader>gs", "<cmd>Telescope git_status<cr>") -- list current changes per file with diff preview ["gs" for git status]

View file

@ -0,0 +1,41 @@
local opt = vim.opt -- for conciseness
-- line numbers
opt.relativenumber = true -- show relative line numbers
opt.number = true -- shows absolute line number on cursor line (when relative number is on)
-- tabs & indentation
opt.tabstop = 2 -- 2 spaces for tabs (prettier default)
opt.shiftwidth = 2 -- 2 spaces for indent width
opt.expandtab = true -- expand tab to spaces
opt.autoindent = true -- copy indent from current line when starting new one
-- line wrapping
opt.wrap = false -- disable line wrapping
-- search settings
opt.ignorecase = true -- ignore case when searching
opt.smartcase = true -- if you include mixed case in your search, assumes you want case-sensitive
-- cursor line
opt.cursorline = true -- highlight the current cursor line
-- appearance
-- turn on termguicolors for nightfly colorscheme to work
-- (have to use iterm2 or any other true color terminal)
opt.termguicolors = true
opt.background = "dark" -- colorschemes that can be light or dark will be made dark
opt.signcolumn = "yes" -- show sign column so that text doesn't shift
-- backspace
opt.backspace = "indent,eol,start" -- allow backspace on indent, end of line or insert mode start position
-- clipboard
opt.clipboard:append("unnamedplus") -- use system clipboard as default register
-- split windows
opt.splitright = true -- split vertical window to the right
opt.splitbelow = true -- split horizontal window to the bottom
opt.iskeyword:append("-") -- consider string-string as whole word

View file

@ -0,0 +1,109 @@
-- auto install packer if not installed
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
vim.cmd([[packadd packer.nvim]])
return true
end
return false
end
local packer_bootstrap = ensure_packer() -- true if packer was just installed
-- autocommand that reloads neovim and installs/updates/removes plugins
-- when file is saved
vim.cmd([[
augroup packer_user_config
autocmd!
autocmd BufWritePost plugins-setup.lua source <afile> | PackerSync
augroup end
]])
-- import packer safely
local status, packer = pcall(require, "packer")
if not status then
return
end
-- add list of plugins to install
return packer.startup(function(use)
-- packer can manage itself
use("wbthomason/packer.nvim")
use("nvim-lua/plenary.nvim") -- lua functions that many plugins use
use("bluz71/vim-nightfly-guicolors") -- preferred colorscheme
use("christoomey/vim-tmux-navigator") -- tmux & split window navigation
use("szw/vim-maximizer") -- maximizes and restores current window
-- essential plugins
use("tpope/vim-surround") -- add, delete, change surroundings (it's awesome)
use("inkarkat/vim-ReplaceWithRegister") -- replace with register contents using motion (gr + motion)
-- commenting with gc
use("numToStr/Comment.nvim")
-- file explorer
use("nvim-tree/nvim-tree.lua")
-- vs-code like icons
use("nvim-tree/nvim-web-devicons")
-- statusline
use("nvim-lualine/lualine.nvim")
-- fuzzy finding w/ telescope
use({ "nvim-telescope/telescope-fzf-native.nvim", run = "make" }) -- dependency for better sorting performance
use({ "nvim-telescope/telescope.nvim", tag = "0.1.0" }) -- fuzzy finder
-- autocompletion
use("hrsh7th/nvim-cmp") -- completion plugin
use("hrsh7th/cmp-buffer") -- source for text in buffer
use("hrsh7th/cmp-path") -- source for file system paths
-- snippets
use("L3MON4D3/LuaSnip") -- snippet engine
use("saadparwaiz1/cmp_luasnip") -- for autocompletion
use("rafamadriz/friendly-snippets") -- useful snippets
-- managing & installing lsp servers, linters & formatters
use("williamboman/mason.nvim") -- in charge of managing lsp servers, linters & formatters
use("williamboman/mason-lspconfig.nvim") -- bridges gap b/w mason & lspconfig
-- configuring lsp servers
use("neovim/nvim-lspconfig") -- easily configure language servers
use("hrsh7th/cmp-nvim-lsp") -- for autocompletion
use({ "glepnir/lspsaga.nvim", branch = "main" }) -- enhanced lsp uis
use("jose-elias-alvarez/typescript.nvim") -- additional functionality for typescript server (e.g. rename file & update imports)
use("onsails/lspkind.nvim") -- vs-code like icons for autocompletion
-- formatting & linting
use("jose-elias-alvarez/null-ls.nvim") -- configure formatters & linters
use("jayp0521/mason-null-ls.nvim") -- bridges gap b/w mason & null-ls
-- treesitter configuration
use({
"nvim-treesitter/nvim-treesitter",
run = function()
local ts_update = require("nvim-treesitter.install").update({ with_sync = true })
ts_update()
end,
})
-- auto closing
use("windwp/nvim-autopairs") -- autoclose parens, brackets, quotes, etc...
use({ "windwp/nvim-ts-autotag", after = "nvim-treesitter" }) -- autoclose tags
-- git integration
use("lewis6991/gitsigns.nvim") -- show line modifications on left hand side
-- discord rpc
use("andweeb/presence.nvim")
if packer_bootstrap then
require("packer").sync()
end
end)

View file

@ -0,0 +1,29 @@
local autopairs_setup, autopairs = pcall(require, "nvim-autopairs")
if not autopairs_setup then
return
end
-- configure autopairs
autopairs.setup({
check_ts = true, -- enable treesitter
ts_config = {
lua = { "string" }, -- don't add pairs in lua string treesitter nodes
javascript = { "template_string" }, -- don't add pairs in javscript template_string treesitter nodes
java = false, -- don't check treesitter on java
},
})
-- import nvim-autopairs completion functionality safely
local cmp_autopairs_setup, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp")
if not cmp_autopairs_setup then
return
end
-- import nvim-cmp plugin safely (completions plugin)
local cmp_setup, cmp = pcall(require, "cmp")
if not cmp_setup then
return
end
-- make autopairs and completion work together
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())

View file

@ -0,0 +1,8 @@
-- import comment
local setup, comment = pcall(require, "Comment")
if not setup then
return
end
-- enable comment
comment.setup()

View file

@ -0,0 +1,23 @@
require("presence"):setup({
-- General options
auto_update = true, -- Update activity based on autocmd events (if `false`, map or manually execute `:lua package.loaded.presence:update()`)
neovim_image_text = "The One True Text Editor", -- Text displayed when hovered over the Neovim image
main_image = "neovim", -- Main image display (either "neovim" or "file")
client_id = "793271441293967371", -- Use your own Discord application client id (not recommended)
log_level = nil, -- Log messages at or above this level (one of the following: "debug", "info", "warn", "error")
debounce_timeout = 10, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(<filename>, true)`)
enable_line_number = false, -- Displays the current line number instead of the current project
blacklist = {}, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches
buttons = true, -- Configure Rich Presence button(s), either a boolean to enable/disable, a static table (`{{ label = "<label>", url = "<url>" }, ...}`, or a function(buffer: string, repo_url: string|nil): table)
file_assets = {}, -- Custom file asset definitions keyed by file names and extensions (see default config at `lua/presence/file_assets.lua` for reference)
show_time = true, -- Show the timer
-- Rich Presence text options
editing_text = "Editing %s", -- Format string rendered when an editable file is loaded in the buffer (either string or function(filename: string): string)
file_explorer_text = "Browsing %s", -- Format string rendered when browsing a file explorer (either string or function(file_explorer_name: string): string)
git_commit_text = "Committing changes", -- Format string rendered when committing changes in git (either string or function(filename: string): string)
plugin_manager_text = "Managing plugins", -- Format string rendered when managing plugins (either string or function(plugin_manager_name: string): string)
reading_text = "Reading %s", -- Format string rendered when a read-only or unmodifiable file is loaded in the buffer (either string or function(filename: string): string)
workspace_text = "Working on %s", -- Format string rendered when in a git repository (either string or function(project_name: string|nil, filename: string): string)
line_number_text = "Line %s out of %s", -- Format string rendered when `enable_line_number` is set to true (either string or function(line_number: number, line_count: number): string)
})

View file

@ -0,0 +1,8 @@
-- import gitsigns plugin safely
local setup, gitsigns = pcall(require, "gitsigns")
if not setup then
return
end
-- configure/enable gitsigns
gitsigns.setup()

View file

@ -0,0 +1,111 @@
-- import lspconfig plugin safely
local lspconfig_status, lspconfig = pcall(require, "lspconfig")
if not lspconfig_status then
return
end
-- import cmp-nvim-lsp plugin safely
local cmp_nvim_lsp_status, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
if not cmp_nvim_lsp_status then
return
end
-- import typescript plugin safely
local typescript_setup, typescript = pcall(require, "typescript")
if not typescript_setup then
return
end
local keymap = vim.keymap -- for conciseness
-- enable keybinds only for when lsp server available
local on_attach = function(client, bufnr)
-- keybind options
local opts = { noremap = true, silent = true, buffer = bufnr }
-- set keybinds
keymap.set("n", "gf", "<cmd>Lspsaga lsp_finder<CR>", opts) -- show definition, references
keymap.set("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts) -- got to declaration
keymap.set("n", "gd", "<cmd>Lspsaga peek_definition<CR>", opts) -- see definition and make edits in window
keymap.set("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts) -- go to implementation
keymap.set("n", "<leader>ca", "<cmd>Lspsaga code_action<CR>", opts) -- see available code actions
keymap.set("n", "<leader>rn", "<cmd>Lspsaga rename<CR>", opts) -- smart rename
keymap.set("n", "<leader>D", "<cmd>Lspsaga show_line_diagnostics<CR>", opts) -- show diagnostics for line
keymap.set("n", "<leader>d", "<cmd>Lspsaga show_cursor_diagnostics<CR>", opts) -- show diagnostics for cursor
keymap.set("n", "[d", "<cmd>Lspsaga diagnostic_jump_prev<CR>", opts) -- jump to previous diagnostic in buffer
keymap.set("n", "]d", "<cmd>Lspsaga diagnostic_jump_next<CR>", opts) -- jump to next diagnostic in buffer
keymap.set("n", "K", "<cmd>Lspsaga hover_doc<CR>", opts) -- show documentation for what is under cursor
keymap.set("n", "<leader>o", "<cmd>LSoutlineToggle<CR>", opts) -- see outline on right hand side
-- typescript specific keymaps (e.g. rename file and update imports)
if client.name == "tsserver" then
keymap.set("n", "<leader>rf", ":TypescriptRenameFile<CR>") -- rename file and update imports
keymap.set("n", "<leader>oi", ":TypescriptOrganizeImports<CR>") -- organize imports (not in youtube nvim video)
keymap.set("n", "<leader>ru", ":TypescriptRemoveUnused<CR>") -- remove unused variables (not in youtube nvim video)
end
end
-- used to enable autocompletion (assign to every lsp server config)
local capabilities = cmp_nvim_lsp.default_capabilities()
-- Change the Diagnostic symbols in the sign column (gutter)
-- (not in youtube nvim video)
local signs = { Error = "", Warn = "", Hint = "", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
end
-- configure html server
lspconfig["html"].setup({
capabilities = capabilities,
on_attach = on_attach,
})
-- configure typescript server with plugin
typescript.setup({
server = {
capabilities = capabilities,
on_attach = on_attach,
},
})
-- configure css server
lspconfig["cssls"].setup({
capabilities = capabilities,
on_attach = on_attach,
})
-- configure tailwindcss server
lspconfig["tailwindcss"].setup({
capabilities = capabilities,
on_attach = on_attach,
})
-- configure emmet language server
lspconfig["emmet_ls"].setup({
capabilities = capabilities,
on_attach = on_attach,
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
})
-- configure lua server (with special settings)
lspconfig["sumneko_lua"].setup({
capabilities = capabilities,
on_attach = on_attach,
settings = { -- custom settings for lua
Lua = {
-- make the language server recognize "vim" global
diagnostics = {
globals = { "vim" },
},
workspace = {
-- make language server aware of runtime files
library = {
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
[vim.fn.stdpath("config") .. "/lua"] = true,
},
},
},
},
})

View file

@ -0,0 +1,45 @@
-- import mason plugin safely
local mason_status, mason = pcall(require, "mason")
if not mason_status then
return
end
-- import mason-lspconfig plugin safely
local mason_lspconfig_status, mason_lspconfig = pcall(require, "mason-lspconfig")
if not mason_lspconfig_status then
return
end
-- import mason-null-ls plugin safely
local mason_null_ls_status, mason_null_ls = pcall(require, "mason-null-ls")
if not mason_null_ls_status then
return
end
-- enable mason
mason.setup()
mason_lspconfig.setup({
-- list of servers for mason to install
ensure_installed = {
"tsserver",
"html",
"cssls",
"tailwindcss",
"sumneko_lua",
"emmet_ls",
},
-- auto-install configured servers (with lspconfig)
automatic_installation = true, -- not the same as ensure_installed
})
mason_null_ls.setup({
-- list of formatters & linters for mason to install
ensure_installed = {
"prettier", -- ts/js formatter
"stylua", -- lua formatter
"eslint_d", -- ts/js linter
},
-- auto-install configured formatters & linters (with null-ls)
automatic_installation = true,
})

View file

@ -0,0 +1,48 @@
-- import null-ls plugin safely
local setup, null_ls = pcall(require, "null-ls")
if not setup then
return
end
-- for conciseness
local formatting = null_ls.builtins.formatting -- to setup formatters
local diagnostics = null_ls.builtins.diagnostics -- to setup linters
-- to setup format on save
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
-- configure null_ls
null_ls.setup({
-- setup formatters & linters
sources = {
-- to disable file types use
-- "formatting.prettier.with({disabled_filetypes: {}})" (see null-ls docs)
formatting.prettier, -- js/ts formatter
formatting.stylua, -- lua formatter
diagnostics.eslint_d.with({ -- js/ts linter
-- only enable eslint if root has .eslintrc.js (not in youtube nvim video)
condition = function(utils)
return utils.root_has_file(".eslintrc.js") -- change file extension if you use something else
end,
}),
},
-- configure format on save
on_attach = function(current_client, bufnr)
if current_client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({
filter = function(client)
-- only use null-ls for formatting instead of lsp server
return client.name == "null-ls"
end,
bufnr = bufnr,
})
end,
})
end
end,
})

View file

@ -0,0 +1,36 @@
-- import lualine plugin safely
local status, lualine = pcall(require, "lualine")
if not status then
return
end
-- get lualine nightfly theme
local lualine_nightfly = require("lualine.themes.nightfly")
-- new colors for theme
local new_colors = {
blue = "#65D1FF",
green = "#3EFFDC",
violet = "#FF61EF",
yellow = "#FFDA7B",
black = "#000000",
}
-- change nightlfy theme colors
lualine_nightfly.normal.a.bg = new_colors.blue
lualine_nightfly.insert.a.bg = new_colors.green
lualine_nightfly.visual.a.bg = new_colors.violet
lualine_nightfly.command = {
a = {
gui = "bold",
bg = new_colors.yellow,
fg = new_colors.black, -- black
},
}
-- configure lualine with modified theme
lualine.setup({
options = {
theme = lualine_nightfly,
},
})

View file

@ -0,0 +1,53 @@
-- import nvim-cmp plugin safely
local cmp_status, cmp = pcall(require, "cmp")
if not cmp_status then
return
end
-- import luasnip plugin safely
local luasnip_status, luasnip = pcall(require, "luasnip")
if not luasnip_status then
return
end
-- import lspkind plugin safely
local lspkind_status, lspkind = pcall(require, "lspkind")
if not lspkind_status then
return
end
-- load vs-code like snippets from plugins (e.g. friendly-snippets)
require("luasnip/loaders/from_vscode").lazy_load()
vim.opt.completeopt = "menu,menuone,noselect"
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
["<C-e>"] = cmp.mapping.abort(), -- close completion window
["<CR>"] = cmp.mapping.confirm({ select = false }),
}),
-- sources for autocompletion
sources = cmp.config.sources({
{ name = "nvim_lsp" }, -- lsp
{ name = "luasnip" }, -- snippets
{ name = "buffer" }, -- text within current buffer
{ name = "path" }, -- file system paths
}),
-- configure lspkind for vs-code like icons
formatting = {
format = lspkind.cmp_format({
maxwidth = 50,
ellipsis_char = "...",
}),
},
})

View file

@ -0,0 +1,35 @@
-- import nvim-tree plugin safely
local setup, nvimtree = pcall(require, "nvim-tree")
if not setup then
return
end
-- settings passed of nvim-tree documentation
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- colorscheme for arrows in tree to a light blue
vim.cmd([[ highlight NvimTreeIndentMarker guifg=#3FC5FF ]])
-- config nvim-tree
nvimtree.setup({
-- folder arrow icons
renderer = {
icons = {
glyphs = {
folder = {
arrow_closed = " ",
arrow_open = " ",
},
},
},
},
-- no window_picker for explorer
actions = {
open_file = {
window_picker = {
enable = false,
},
},
},
})

View file

@ -0,0 +1,26 @@
-- import telescope
local telescope_setup, telescope = pcall(require, "telescope")
if not telescope_setup then
return
end
-- import teleport actions
local actions_setup, actions = pcall(require, "telescope.actions")
if not actions_setup then
return
end
-- config
telescope.setup({
defaults = {
mappings = {
i = {
["<C-k>"] = actions.move_selection_previous,
["<C-j>"] = actions.move_selection_next,
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
},
},
},
})
telescope.load_extension("fzf")

View file

@ -0,0 +1,37 @@
-- import nvim-treesitter plugin safely
local status, treesitter = pcall(require, "nvim-treesitter.configs")
if not status then
return
end
-- configure treesitter
treesitter.setup({
-- enable syntax highlighting
highlight = {
enable = true,
},
-- enable indentation
indent = { enable = true },
-- enable autotagging (w/ nvim-ts-autotag plugin)
autotag = { enable = true },
-- ensure these language parsers are installed
ensure_installed = {
"json",
"javascript",
"typescript",
"tsx",
"yaml",
"html",
"css",
"markdown",
"svelte",
"graphql",
"bash",
"lua",
"vim",
"dockerfile",
"gitignore",
},
-- auto install above language parsers
auto_install = true,
})

View file

@ -0,0 +1,266 @@
-- 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/bridgway/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/bridgway/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/bridgway/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/bridgway/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/home/bridgway/.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/bridgway/.local/share/nvim/site/pack/packer/start/Comment.nvim",
url = "https://github.com/numToStr/Comment.nvim"
},
LuaSnip = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/LuaSnip",
url = "https://github.com/L3MON4D3/LuaSnip"
},
["cmp-buffer"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/cmp-buffer",
url = "https://github.com/hrsh7th/cmp-buffer"
},
["cmp-nvim-lsp"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
},
["cmp-path"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/cmp-path",
url = "https://github.com/hrsh7th/cmp-path"
},
cmp_luasnip = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
url = "https://github.com/saadparwaiz1/cmp_luasnip"
},
["friendly-snippets"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/friendly-snippets",
url = "https://github.com/rafamadriz/friendly-snippets"
},
["gitsigns.nvim"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
url = "https://github.com/lewis6991/gitsigns.nvim"
},
["lspkind.nvim"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/lspkind.nvim",
url = "https://github.com/onsails/lspkind.nvim"
},
["lspsaga.nvim"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/lspsaga.nvim",
url = "https://github.com/glepnir/lspsaga.nvim"
},
["lualine.nvim"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/lualine.nvim",
url = "https://github.com/nvim-lualine/lualine.nvim"
},
["mason-lspconfig.nvim"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
url = "https://github.com/williamboman/mason-lspconfig.nvim"
},
["mason-null-ls.nvim"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/mason-null-ls.nvim",
url = "https://github.com/jayp0521/mason-null-ls.nvim"
},
["mason.nvim"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/mason.nvim",
url = "https://github.com/williamboman/mason.nvim"
},
["null-ls.nvim"] = {
loaded = true,
path = "/home/bridgway/.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/bridgway/.local/share/nvim/site/pack/packer/start/nvim-autopairs",
url = "https://github.com/windwp/nvim-autopairs"
},
["nvim-cmp"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/nvim-cmp",
url = "https://github.com/hrsh7th/nvim-cmp"
},
["nvim-lspconfig"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
url = "https://github.com/neovim/nvim-lspconfig"
},
["nvim-tree.lua"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
url = "https://github.com/nvim-tree/nvim-tree.lua"
},
["nvim-treesitter"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
url = "https://github.com/nvim-treesitter/nvim-treesitter"
},
["nvim-ts-autotag"] = {
load_after = {},
loaded = true,
needs_bufread = false,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/opt/nvim-ts-autotag",
url = "https://github.com/windwp/nvim-ts-autotag"
},
["nvim-web-devicons"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
url = "https://github.com/nvim-tree/nvim-web-devicons"
},
["packer.nvim"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/packer.nvim",
url = "https://github.com/wbthomason/packer.nvim"
},
["plenary.nvim"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/plenary.nvim",
url = "https://github.com/nvim-lua/plenary.nvim"
},
["presence.nvim"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/presence.nvim",
url = "https://github.com/andweeb/presence.nvim"
},
["telescope-fzf-native.nvim"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/telescope-fzf-native.nvim",
url = "https://github.com/nvim-telescope/telescope-fzf-native.nvim"
},
["telescope.nvim"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/telescope.nvim",
url = "https://github.com/nvim-telescope/telescope.nvim"
},
["typescript.nvim"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/typescript.nvim",
url = "https://github.com/jose-elias-alvarez/typescript.nvim"
},
["vim-ReplaceWithRegister"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/vim-ReplaceWithRegister",
url = "https://github.com/inkarkat/vim-ReplaceWithRegister"
},
["vim-maximizer"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/vim-maximizer",
url = "https://github.com/szw/vim-maximizer"
},
["vim-nightfly-guicolors"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/vim-nightfly-guicolors",
url = "https://github.com/bluz71/vim-nightfly-guicolors"
},
["vim-surround"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/vim-surround",
url = "https://github.com/tpope/vim-surround"
},
["vim-tmux-navigator"] = {
loaded = true,
path = "/home/bridgway/.local/share/nvim/site/pack/packer/start/vim-tmux-navigator",
url = "https://github.com/christoomey/vim-tmux-navigator"
}
}
time([[Defining packer_plugins]], false)
-- Load plugins in order defined by `after`
time([[Sequenced loading]], true)
vim.cmd [[ packadd nvim-treesitter ]]
vim.cmd [[ packadd nvim-ts-autotag ]]
time([[Sequenced loading]], 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