1
0

Migrate to lazy plugin manager

This commit is contained in:
Patrick Auernig 2023-09-01 21:48:42 +02:00
parent 0312cd06ae
commit 344cbe1f95
29 changed files with 560 additions and 613 deletions

1
.gitignore vendored
View File

@ -1,2 +1 @@
.netrwhist
plugin/packer_compiled.lua

View File

@ -1,3 +1,23 @@
require("valeth.options")
require("valeth.keymaps")
require("valeth.packer")
local function lazy_setup()
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup("valeth.plugins")
end
lazy_setup()

41
lazy-lock.json Normal file
View File

@ -0,0 +1,41 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"LuaSnip": { "branch": "master", "commit": "ea7d7ea510c641c4f15042becd27f35b3e5b3c2b" },
"ayu-nvim": { "branch": "main", "commit": "4418a0c07d45026b05cfd948fd11644d3adb8ac6" },
"cloak.nvim": { "branch": "main", "commit": "ff5e746e787de14675396beb642bf5010b8bc96d" },
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"crates.nvim": { "branch": "main", "commit": "1dffccc0a95f656ebe00cacb4de282473430c5a1" },
"formatter.nvim": { "branch": "master", "commit": "44c89f09dcc220dc2a9b056e93c3a87c86e79804" },
"friendly-snippets": { "branch": "main", "commit": "00e191fea2cfbbdd378243f35b5953296537a116" },
"gitsigns.nvim": { "branch": "main", "commit": "44adf808ace6cb65a3353bd61fa585a2d8fe0db3" },
"harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" },
"indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" },
"lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" },
"lsp-zero.nvim": { "branch": "v2.x", "commit": "f084f4a6a716f55bf9c4026e73027bb24a0325a3" },
"lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "dfdd771b792fbb4bad8e057d72558255695aa1a7" },
"mason.nvim": { "branch": "main", "commit": "0942198fb9a998b6ccee36fb8dd7495eb8ba659c" },
"neogit": { "branch": "master", "commit": "08d23c7ae1e7c3c66802990d5aa16269bdd996a7" },
"nvim-autopairs": { "branch": "master", "commit": "ae5b41ce880a6d850055e262d6dfebd362bb276e" },
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
"nvim-lspconfig": { "branch": "master", "commit": "a27356f1ef9c11e1f459cc96a3fcac5c265e72d6" },
"nvim-nu": { "branch": "main", "commit": "f45f36a97fb0ea6e39f08cc2fac7a2fb3dc3999b" },
"nvim-tree.lua": { "branch": "master", "commit": "00741206c2df9c4b538055def19b99790f0c95c8" },
"nvim-treesitter": { "branch": "master", "commit": "63260da18bf273c76b8e2ea0db84eb901cab49ce" },
"nvim-treesitter-context": { "branch": "master", "commit": "31692b26d76ff1f7c6e0ab51814dd55e7417e96c" },
"nvim-treesitter-endwise": { "branch": "master", "commit": "9298b3ac8fd6d0d8f9e321194c6d3fd37e417cf9" },
"nvim-ufo": { "branch": "main", "commit": "890b94870f052773d77175d07a51f2e083210632" },
"nvim-web-devicons": { "branch": "master", "commit": "cfc8824cc1db316a276b36517f093baccb8e799a" },
"overseer.nvim": { "branch": "master", "commit": "d8c5be15ff0f7ccecbaa8f3612a6764b22fc07ff" },
"plenary.nvim": { "branch": "master", "commit": "0dbe561ae023f02c2fb772b879e905055b939ce3" },
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
"promise-async": { "branch": "main", "commit": "e94f35161b8c5d4a4ca3b6ff93dd073eb9214c0e" },
"rainbow_csv.nvim": { "branch": "main", "commit": "763994066877cebae2d5159a46f8b423c50f82da" },
"resession.nvim": { "branch": "master", "commit": "635e83a204b6800ec501a80f867a524a14cfce51" },
"telescope.nvim": { "branch": "0.1.x", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" },
"undotree": { "branch": "main", "commit": "2685ce282702ab0b79c65916f352db2265b245dd" },
"vim-wakatime": { "branch": "master", "commit": "0d2efa2daff34b27b0d227d4c3b136811c93db93" }
}

View File

@ -1,304 +0,0 @@
local function install_packer(path)
vim.fn.system({
"git", "clone", "--depth", "1",
"https://github.com/wbthomason/packer.nvim",
path
})
vim.cmd [[packadd packer.nvim]]
end
local function ensure_packer()
local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
if vim.fn.isdirectory(install_path) == 0 then
install_packer(install_path)
return true
end
return false
end
local packer_bootstrap = ensure_packer()
-- Plugins
local function spec(use)
use "wbthomason/packer.nvim"
use {
"nvim-treesitter/nvim-treesitter",
requires = {
{ "nvim-treesitter/nvim-treesitter-context" }
},
run = function()
require("valeth.packer.treesitter")
end
}
use {
"wakatime/vim-wakatime",
cond = function()
return not (os.getenv("WAKATIME_HOME") == nil)
end
}
-- Currently doesn't seem to have an option to make it off by default easily
use {
"andweeb/presence.nvim",
config = function()
require("valeth.packer.presence")
end
}
use {
"stevearc/resession.nvim",
config = function()
require("valeth.packer.session")
end
}
---- Language Specific Stuff
use {
"saecki/crates.nvim",
tag = "v0.3.0",
requires = {
{ "nvim-lua/plenary.nvim" },
{ "hrsh7th/nvim-cmp" },
},
config = function()
require("valeth.packer.crates")
end
}
use {
"LhKipp/nvim-nu"
}
use {
"cameron-wags/rainbow_csv.nvim",
config = function()
require("rainbow_csv").setup()
end
}
---- LSP Stuff
use {
"VonHeikemen/lsp-zero.nvim",
branch = "v2.x",
requires = {
{ "neovim/nvim-lspconfig" },
-- completion
{ "hrsh7th/nvim-cmp" },
{ "hrsh7th/cmp-nvim-lsp" },
{ "hrsh7th/cmp-path" },
{ "onsails/lspkind.nvim" },
-- formatting
{ "mhartington/formatter.nvim" },
-- snippets
{ "saadparwaiz1/cmp_luasnip" },
{ "L3MON4D3/LuaSnip" },
{ "rafamadriz/friendly-snippets" },
-- lsp manager
{ "williamboman/mason.nvim" },
{ "williamboman/mason-lspconfig.nvim" },
-- code folding
{ "kevinhwang91/nvim-ufo" },
{ "kevinhwang91/promise-async" },
},
config = function()
require("valeth.packer.lsp")
end
}
---- Just Visual Stuff
use {
"CantoroMC/ayu-nvim",
config = function()
vim.g.ayu_mirage = true
vim.cmd.colorscheme("ayu")
end
}
use "nvim-tree/nvim-web-devicons"
use {
"lewis6991/gitsigns.nvim",
config = function()
require("gitsigns").setup()
end
}
use {
"nvim-lualine/lualine.nvim",
requires = {
{ "nvim-tree/nvim-web-devicons" },
{ "stevearc/overseer.nvim" },
},
config = function()
require("valeth.packer.lualine")
end
}
use {
"lukas-reineke/indent-blankline.nvim",
config = function()
require("indent_blankline").setup {
space_char_blankline = " ",
show_current_context = true,
show_current_context_start = false,
}
end
}
use {
"laytan/cloak.nvim",
config = function()
require("cloak").setup({
cloak_length = 5,
patterns = {
{ file_pattern = "*.env*", cloak_pattern = "=.+" }
}
})
end
}
---- Shortcuts
use {
"numToStr/Comment.nvim",
config = function()
require("Comment").setup()
end
}
use {
"windwp/nvim-autopairs",
config = function()
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local cmp = require("cmp")
require("nvim-autopairs").setup()
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
end
}
use {
"RRethy/nvim-treesitter-endwise",
requires = {
{ "nvim-treesitter/nvim-treesitter" },
}
}
use {
"NeogitOrg/neogit",
requires = {
{ "nvim-lua/plenary.nvim" },
},
config = function ()
require("valeth.packer.neogit")
end
}
---- Navigation
use {
"nvim-telescope/telescope.nvim",
tag = "0.1.1",
requires = {
{ "nvim-lua/plenary.nvim" },
{ "nvim-treesitter/nvim-treesitter" },
},
config = function()
require("valeth.packer.telescope")
end
}
use {
"prichrd/netrw.nvim",
disable = true,
config = function()
require("netrw").setup()
end
}
use {
"ThePrimeagen/harpoon",
requires = {
{ "nvim-lua/plenary.nvim" },
}
}
use {
"jiaoshijie/undotree",
requires = {
"nvim-lua/plenary.nvim"
},
config = function()
require("valeth.packer.undotree")
end
}
use {
"nvim-tree/nvim-tree.lua",
requires = {
{ "nvim-tree/nvim-web-devicons" },
},
config = function()
require("valeth.packer.nvim-tree")
end
}
use {
"stevearc/overseer.nvim",
config = function()
require('overseer').setup()
end
}
if packer_bootstrap then
require("packer").sync()
end
end
-- Automatically reload packer configuration on write
vim.api.nvim_create_autocmd("BufWritePost", {
group = vim.api.nvim_create_augroup("PackerUserConfig", { clear = true }),
pattern = { "packer.lua", vim.fn.stdpath("config") .. "/lua/valeth/packer/*.lua" },
callback = function(_)
local source_file = vim.fn.stdpath("config") .. "/lua/valeth/packer.lua"
vim.cmd("source " .. source_file)
require("packer").compile()
end
})
return require("packer").startup {
spec,
config = {
display = {
open_fn = function()
return require("packer.util").float({
border = {
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
},
})
end
}
}
}

View File

@ -1,10 +0,0 @@
require("crates").setup()
local cmp = require("cmp")
vim.api.nvim_create_autocmd("BufRead", {
group = vim.api.nvim_create_augroup("CmpSourceCargo", { clear = true }),
pattern = "Cargo.toml",
callback = function()
cmp.setup.buffer({ sources = { { name = "crates" } } })
end,
})

View File

@ -1,88 +0,0 @@
local lsp_zero = require("lsp-zero").preset({})
local ufo = require("ufo")
local tsb = require("telescope.builtin")
lsp_zero.ensure_installed {
"lua_ls",
"rust_analyzer",
}
lsp_zero.on_attach(function(_, buffnr)
local opts = { buffer = buffnr, remap = false }
ufo.attach(buffnr)
vim.keymap.set("n", "gd", tsb.lsp_definitions, opts)
vim.keymap.set("n", "gr", tsb.lsp_references, opts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "<Leader>ca", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "<Leader>ci", vim.diagnostic.open_float, opts)
vim.keymap.set("n", "<Leader>re", vim.lsp.buf.rename, opts)
vim.keymap.set({ "n", "i" }, "<C-h>", vim.lsp.buf.signature_help, opts)
vim.keymap.set("n", "<Leader>fmt", function()
vim.lsp.buf.format({ async = false, timeout_ms = 5000 })
end)
end)
-- NOTE: Format on save does not support async formatting
lsp_zero.format_on_save({
servers = {
["rust_analyzer"] = { "rust" }
}
})
local lsp_config = require("lspconfig")
lsp_config.lua_ls.setup(lsp_zero.nvim_lua_ls())
lsp_config.rust_analyzer.setup {
settings = {
["rust-analyzer"] = {
cargo = {
features = "all"
},
rustfmt = {
-- needs to use nightly channel to use unstable options
extraArgs = { "+nightly" }
}
}
}
}
ufo.setup {
close_fold_kinds = {"comment", "imports"},
}
lsp_zero.setup()
local cmp = require("cmp")
local lspk = require("lspkind")
local cmp_select = { behavior = cmp.SelectBehavior.Select }
cmp.setup {
formatting = {
format = lspk.cmp_format({}),
},
mapping = {
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<C-p>"] = cmp.mapping.select_prev_item(cmp_select),
["<C-n>"] = cmp.mapping.select_next_item(cmp_select),
["<C-Space>"] = cmp.mapping.complete(),
["<Tab>"] = nil,
["<S-Tab>"] = nil,
}
}
vim.diagnostic.config({
virtual_text = false,
})
-- Gimme pretty icons
lsp_zero.set_sign_icons({
error = '',
warn = '',
hint = '',
info = '»'
})

View File

@ -1,31 +0,0 @@
local overseer = require("overseer")
local task_status = {
"overseer",
colored = true,
symbols = {
[overseer.STATUS.FAILURE] = "",
[overseer.STATUS.CANCELED] = "o ",
[overseer.STATUS.SUCCESS] = "",
[overseer.STATUS.RUNNING] = "",
},
}
require("lualine").setup({
sections = {
lualine_b = {
"branch",
"diff",
{
"diagnostics",
symbols = { error = "E:", warn = "W:", info = "I:", hint = "H:" }
},
},
lualine_x = {
task_status,
"encoding",
{ "fileformat", icons_enabled = false },
"filetype"
}
},
})

View File

@ -1,14 +0,0 @@
local neogit = require("neogit")
local function git_status()
neogit.open()
end
local function git_commit()
neogit.open({ "commit" })
end
vim.keymap.set("n", "<Leader>vs", git_status)
vim.keymap.set("n", "<Leader>vc", git_commit)
neogit.setup()

View File

@ -1,29 +0,0 @@
local nvim_tree = require("nvim-tree")
local nvim_tree_api = require("nvim-tree.api")
vim.keymap.set("n", "<Leader>ft", nvim_tree_api.tree.open)
local function kmap_opts(bufnr, desc)
return {
desc = "nvim-tree: " .. desc,
buffer = bufnr,
noremap = true,
silent = true,
nowait = true
}
end
local function on_attach(bufnr)
nvim_tree_api.config.mappings.default_on_attach(bufnr)
vim.keymap.set("n", "<ESC>", nvim_tree_api.tree.close, kmap_opts(bufnr, "Close"))
end
nvim_tree.setup({
view = {
float = {
enable = true
}
},
on_attach = on_attach,
})

View File

@ -1,43 +0,0 @@
local presence = require("presence")
local presence_disabled = true
local presence_augroup = vim.api.nvim_create_augroup("PresenceEvents", { clear = true })
local presence_autocmds = {
{ "FocusGained", "handle_focus_gained" },
{ "TextChanged", "handle_text_changed" },
{ "VimLeavePre", "handle_vim_leave_pre" },
{ "WinEnter", "handle_win_enter" },
{ "WinLeave", "handle_win_leave" },
{ "BufEnter", "handle_buf_enter" },
{ "BufAdd", "handle_buf_add" },
}
for _, item in ipairs(presence_autocmds) do
local event = item[1]
local callback_fn = item[2]
vim.api.nvim_create_autocmd(event, {
group = presence_augroup,
callback = function()
if not presence_disabled then
presence[callback_fn](presence)
end
end
})
end
vim.api.nvim_create_user_command("DiscordToggle",
function()
if presence_disabled then
presence_disabled = false
presence:handle_win_enter()
else
presence_disabled = true
presence:cancel()
end
end,
{ nargs = 0 }
)
presence.setup({
auto_update = false,
show_time = false,
})

View File

@ -1,34 +0,0 @@
local resession = require("resession")
local function session_name()
local working_dir = vim.fn.getcwd()
local git_branch = vim.fn.system("git branch --show-current")
if vim.v.shell_error == 0 then
return working_dir .. git_branch
else
return working_dir
end
end
local function started_without_args()
return vim.fn.argc(-1) == 0
end
-- Only restore and save session if NeoVim was started without any arguments
vim.api.nvim_create_autocmd("VimEnter", {
callback = function()
if started_without_args() then
resession.load(session_name(), { dir = "dirsession", silence_errors = true })
end
end
})
vim.api.nvim_create_autocmd("VimLeavePre", {
callback = function()
if started_without_args() then
resession.save(session_name(), { dir = "dirsession", notify = false })
end
end
})
resession.setup()

View File

@ -1,37 +0,0 @@
local telescope = require("telescope")
local actions = require("telescope.actions")
telescope.load_extension("harpoon")
telescope.setup {
defaults = {
initial_mode = "insert"
},
pickers = {
buffers = {
mappings = {
i = {
["<C-d>"] = actions.delete_buffer + actions.move_to_top,
},
n = {
["dd"] = actions.delete_buffer,
}
}
},
}
}
local telescope_builtin = require("telescope.builtin")
vim.keymap.set("n", "<Leader>ff", telescope_builtin.find_files)
vim.keymap.set("n", "<Leader>fb", telescope_builtin.buffers)
vim.keymap.set("n", "<Leader>fg", telescope_builtin.live_grep)
local telescope_ext = require("telescope").extensions
local harpoon_mark = require("harpoon.mark")
local harpoon_ui = require("harpoon.ui")
vim.keymap.set("n", "<Leader>fh", telescope_ext.harpoon.marks)
vim.keymap.set("n", "<Leader>am", harpoon_mark.add_file)
vim.keymap.set("n", "<Leader>gn", harpoon_ui.nav_next)
vim.keymap.set("n", "<Leader>gp", harpoon_ui.nav_prev)

View File

@ -1,16 +0,0 @@
require("nvim-treesitter.configs").setup {
ensure_installed = { "rust", "lua", "javascript", "typescript" },
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
endwise = { enable = true }
}
require("treesitter-context").setup()
require("nvim-treesitter.install").update({ with_sync = true })()

View File

@ -1,5 +0,0 @@
local undotree = require("undotree")
vim.keymap.set("n", "<Leader>u", undotree.toggle, { noremap = true, silent = true })
undotree.setup()

View File

@ -0,0 +1,14 @@
local spec = {
"windwp/nvim-autopairs",
}
spec.config = function()
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local cmp = require("cmp")
require("nvim-autopairs").setup()
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
end
return spec

View File

@ -0,0 +1,9 @@
return {
"laytan/cloak.nvim",
opts = {
cloak_length = 5,
patterns = {
{ file_pattern = "*.env*", cloak_pattern = "=.+" }
}
}
}

View File

@ -0,0 +1,25 @@
local spec = {
"saecki/crates.nvim",
tag = "v0.3.0",
}
spec.dependencies = {
"nvim-lua/plenary.nvim",
"hrsh7th/nvim-cmp",
}
spec.config = function()
require("crates").setup()
local cmp = require("cmp")
vim.api.nvim_create_autocmd("BufRead", {
group = vim.api.nvim_create_augroup("CmpSourceCargo", { clear = true }),
pattern = "Cargo.toml",
callback = function()
cmp.setup.buffer({ sources = { { name = "crates" } } })
end,
})
end
return spec

View File

@ -0,0 +1,21 @@
return {
{
"CantoroMC/ayu-nvim",
priority = 1000, -- make sure this is loaded first
config = function()
vim.g.ayu_mirage = true
vim.cmd.colorscheme("ayu")
end
},
{
"lukas-reineke/indent-blankline.nvim",
opts = {
space_char_blankline = " ",
show_current_context = true,
show_current_context_start = false,
}
},
"lewis6991/gitsigns.nvim",
}

View File

@ -0,0 +1,6 @@
return {
"cameron-wags/rainbow_csv.nvim",
"LhKipp/nvim-nu",
"stevearc/overseer.nvim",
"numToStr/Comment.nvim",
}

118
lua/valeth/plugins/lsp.lua Normal file
View File

@ -0,0 +1,118 @@
local spec = {
"VonHeikemen/lsp-zero.nvim",
branch = "v2.x",
}
spec.dependencies = {
"neovim/nvim-lspconfig",
-- completion
"hrsh7th/nvim-cmp",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
"onsails/lspkind.nvim",
-- formatting
"mhartington/formatter.nvim",
-- snippets
"saadparwaiz1/cmp_luasnip",
"L3MON4D3/LuaSnip",
"rafamadriz/friendly-snippets",
-- lsp manager
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
-- code folding
"kevinhwang91/nvim-ufo",
"kevinhwang91/promise-async",
}
spec.config = function()
local lsp_zero = require("lsp-zero").preset({})
local ufo = require("ufo")
local tsb = require("telescope.builtin")
lsp_zero.ensure_installed {
"lua_ls",
"rust_analyzer",
}
lsp_zero.on_attach(function(_, buffnr)
local opts = { buffer = buffnr, remap = false }
ufo.attach(buffnr)
vim.keymap.set("n", "gd", tsb.lsp_definitions, opts)
vim.keymap.set("n", "gr", tsb.lsp_references, opts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "<Leader>ca", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "<Leader>ci", vim.diagnostic.open_float, opts)
vim.keymap.set("n", "<Leader>re", vim.lsp.buf.rename, opts)
vim.keymap.set({ "n", "i" }, "<C-h>", vim.lsp.buf.signature_help, opts)
vim.keymap.set("n", "<Leader>fmt", function()
vim.lsp.buf.format({ async = false, timeout_ms = 5000 })
end)
end)
-- NOTE: Format on save does not support async formatting
lsp_zero.format_on_save({
servers = {
["rust_analyzer"] = { "rust" }
}
})
local lsp_config = require("lspconfig")
lsp_config.lua_ls.setup(lsp_zero.nvim_lua_ls())
lsp_config.rust_analyzer.setup {
settings = {
["rust-analyzer"] = {
cargo = {
features = "all"
},
rustfmt = {
-- needs to use nightly channel to use unstable options
extraArgs = { "+nightly" }
}
}
}
}
ufo.setup {
close_fold_kinds = {"comment", "imports"},
}
lsp_zero.setup()
local cmp = require("cmp")
local lspk = require("lspkind")
local cmp_select = { behavior = cmp.SelectBehavior.Select }
cmp.setup {
formatting = {
format = lspk.cmp_format({}),
},
mapping = {
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<C-p>"] = cmp.mapping.select_prev_item(cmp_select),
["<C-n>"] = cmp.mapping.select_next_item(cmp_select),
["<C-Space>"] = cmp.mapping.complete(),
["<Tab>"] = nil,
["<S-Tab>"] = nil,
}
}
vim.diagnostic.config({
virtual_text = false,
})
-- Gimme pretty icons
lsp_zero.set_sign_icons({
error = '',
warn = '',
hint = '',
info = '»'
})
end
return spec

View File

@ -0,0 +1,44 @@
local spec = {
"nvim-lualine/lualine.nvim",
}
spec.dependencies = {
"nvim-tree/nvim-web-devicons",
"stevearc/overseer.nvim",
}
spec.config = function()
local overseer = require("overseer")
local task_status = {
"overseer",
colored = true,
symbols = {
[overseer.STATUS.FAILURE] = "",
[overseer.STATUS.CANCELED] = "o ",
[overseer.STATUS.SUCCESS] = "",
[overseer.STATUS.RUNNING] = "",
},
}
require("lualine").setup({
sections = {
lualine_b = {
"branch",
"diff",
{
"diagnostics",
symbols = { error = "E:", warn = "W:", info = "I:", hint = "H:" }
},
},
lualine_x = {
task_status,
"encoding",
{ "fileformat", icons_enabled = false },
"filetype"
}
},
})
end
return spec

View File

@ -0,0 +1,26 @@
local spec = {
"NeogitOrg/neogit",
}
spec.dependencies = {
"nvim-lua/plenary.nvim",
}
spec.config = function()
local neogit = require("neogit")
local function git_status()
neogit.open()
end
local function git_commit()
neogit.open({ "commit" })
end
vim.keymap.set("n", "<Leader>vs", git_status)
vim.keymap.set("n", "<Leader>vc", git_commit)
neogit.setup()
end
return spec

View File

@ -0,0 +1,41 @@
local spec = {
"nvim-tree/nvim-tree.lua",
}
spec.dependencies = {
"nvim-tree/nvim-web-devicons"
}
spec.config = function()
local nvim_tree = require("nvim-tree")
local nvim_tree_api = require("nvim-tree.api")
vim.keymap.set("n", "<Leader>ft", nvim_tree_api.tree.open)
local function kmap_opts(bufnr, desc)
return {
desc = "nvim-tree: " .. desc,
buffer = bufnr,
noremap = true,
silent = true,
nowait = true
}
end
local function on_attach(bufnr)
nvim_tree_api.config.mappings.default_on_attach(bufnr)
vim.keymap.set("n", "<ESC>", nvim_tree_api.tree.close, kmap_opts(bufnr, "Close"))
end
nvim_tree.setup({
view = {
float = {
enable = true
}
},
on_attach = on_attach,
})
end
return spec

View File

@ -0,0 +1,51 @@
local spec = {
"andweeb/presence.nvim",
}
spec.config = function()
local presence = require("presence")
local presence_disabled = true
local presence_augroup = vim.api.nvim_create_augroup("PresenceEvents", { clear = true })
local presence_autocmds = {
{ "FocusGained", "handle_focus_gained" },
{ "TextChanged", "handle_text_changed" },
{ "VimLeavePre", "handle_vim_leave_pre" },
{ "WinEnter", "handle_win_enter" },
{ "WinLeave", "handle_win_leave" },
{ "BufEnter", "handle_buf_enter" },
{ "BufAdd", "handle_buf_add" },
}
for _, item in ipairs(presence_autocmds) do
local event = item[1]
local callback_fn = item[2]
vim.api.nvim_create_autocmd(event, {
group = presence_augroup,
callback = function()
if not presence_disabled then
presence[callback_fn](presence)
end
end
})
end
vim.api.nvim_create_user_command("DiscordToggle",
function()
if presence_disabled then
presence_disabled = false
presence:handle_win_enter()
else
presence_disabled = true
presence:cancel()
end
end,
{ nargs = 0 }
)
presence.setup({
auto_update = false,
show_time = false,
})
end
return spec

View File

@ -0,0 +1,42 @@
local spec = {
"stevearc/resession.nvim",
}
spec.config = function()
local resession = require("resession")
local function session_name()
local working_dir = vim.fn.getcwd()
local git_branch = vim.fn.system("git branch --show-current")
if vim.v.shell_error == 0 then
return working_dir .. git_branch
else
return working_dir
end
end
local function started_without_args()
return vim.fn.argc(-1) == 0
end
-- Only restore and save session if NeoVim was started without any arguments
vim.api.nvim_create_autocmd("VimEnter", {
callback = function()
if started_without_args() then
resession.load(session_name(), { dir = "dirsession", silence_errors = true })
end
end
})
vim.api.nvim_create_autocmd("VimLeavePre", {
callback = function()
if started_without_args() then
resession.save(session_name(), { dir = "dirsession", notify = false })
end
end
})
resession.setup()
end
return spec

View File

@ -0,0 +1,52 @@
local spec = {
"nvim-telescope/telescope.nvim",
branch = "0.1.x",
}
spec.dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"ThePrimeagen/harpoon",
}
spec.config = function()
local telescope = require("telescope")
local actions = require("telescope.actions")
telescope.load_extension("harpoon")
telescope.setup {
defaults = {
initial_mode = "insert"
},
pickers = {
buffers = {
mappings = {
i = {
["<C-d>"] = actions.delete_buffer + actions.move_to_top,
},
n = {
["dd"] = actions.delete_buffer,
}
}
},
}
}
local telescope_builtin = require("telescope.builtin")
vim.keymap.set("n", "<Leader>ff", telescope_builtin.find_files)
vim.keymap.set("n", "<Leader>fb", telescope_builtin.buffers)
vim.keymap.set("n", "<Leader>fg", telescope_builtin.live_grep)
local telescope_ext = require("telescope").extensions
local harpoon_mark = require("harpoon.mark")
local harpoon_ui = require("harpoon.ui")
vim.keymap.set("n", "<Leader>fh", telescope_ext.harpoon.marks)
vim.keymap.set("n", "<Leader>am", harpoon_mark.add_file)
vim.keymap.set("n", "<Leader>gn", harpoon_ui.nav_next)
vim.keymap.set("n", "<Leader>gp", harpoon_ui.nav_prev)
end
return spec

View File

@ -0,0 +1,30 @@
local spec = {
"nvim-treesitter/nvim-treesitter",
tag = "v0.9.1",
}
spec.dependencies = {
"nvim-treesitter/nvim-treesitter-context",
"RRethy/nvim-treesitter-endwise",
}
spec.config = function()
require("nvim-treesitter.configs").setup {
ensure_installed = { "rust", "lua", "javascript", "typescript" },
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
endwise = { enable = true }
}
require("treesitter-context").setup()
require("nvim-treesitter.install").update({ with_sync = true })()
end
return spec

View File

@ -0,0 +1,13 @@
local spec = {
"jiaoshijie/undotree",
}
spec.config = function()
local undotree = require("undotree")
vim.keymap.set("n", "<Leader>u", undotree.toggle, { noremap = true, silent = true })
undotree.setup()
end
return spec

View File

@ -0,0 +1,6 @@
return {
"wakatime/vim-wakatime",
cond = function()
return not (os.getenv("WAKATIME_HOME") == nil)
end
}