absvim/lua/plugins.lua
2023-07-10 20:43:47 -07:00

516 lines
12 KiB
Lua

return {
-- https://github.com/tpope/vim-obsession
"tpope/vim-obsession",
-- https://github.com/svermeulen/vimpeccable
"svermeulen/vimpeccable",
-- https://github.com/kien/ctrlp.vim
"ctrlpvim/ctrlp.vim",
-- https://github.com/lervag/vimtex#installation
"lervag/vimtex",
-- https://github.com/iamcco/markdown-preview.nvim
{
"iamcco/markdown-preview.nvim",
run = function()
vim.fn["mkdp#util#install"]()
end,
config = function()
vim.g.mkdp_filetypes = { "markdown" }
vim.g.mkdp_markdown_css = os.getenv("XDG_CONFIG_HOME") .. "/nvim/static/custom.css"
vim.g.mkdp_highlight_css = os.getenv("XDG_CACHE_HOME") .. "/wal/colors.css"
vim.g.mkdp_browser = "rose"
vim.g.mkdp_echo_preview_url = 1
end,
ft = { "markdown" },
},
{
"windwp/nvim-spectre",
dependencies = { "nvim-lua/plenary.nvim" },
},
{
"sbdchd/neoformat",
},
{
"simrat39/rust-tools.nvim",
config = function()
local rt = require("rust-tools")
rt.setup({
server = {
on_attach = function(_, bufnr)
-- Hover actions
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
-- Code action groups
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
end,
},
})
end,
},
{
"ray-x/web-tools.nvim",
config = function()
require("web-tools").setup({
keymaps = {
rename = nil, -- by default use same setup of lspconfig
repeat_rename = ".", -- . to repeat
},
hurl = {
-- hurl default
show_headers = false, -- do not show http headers
floating = false, -- use floating windows (need guihua.lua)
formatters = {
-- format the result by filetype
json = { "jq" },
html = { "prettier", "--parser", "html" },
},
},
})
end,
},
-- https://github.com/fatih/vim-go
{
"fatih/vim-go",
config = function()
vim.g.go_fmt_command = "gofumpt"
vim.g.go_fmt_fail_silently = 1
vim.g.go_highlight_types = 1
vim.g.go_highlight_fields = 1
vim.g.go_highlight_functions = 1
vim.g.go_highlight_function_calls = 1
vim.g.go_highlight_operators = 1
vim.g.go_highlight_extra_types = 1
vim.g.go_highlight_build_constraints = 1
vim.g.go_metalinter_command = "golangci-lint"
end,
},
-- https://github.com/norcalli/nvim-colorizer.lua
{
"norcalli/nvim-colorizer.lua",
config = function()
require("colorizer").setup()
end,
},
-- https://github.com/numToStr/Comment.nvim
{
"numToStr/Comment.nvim",
config = function()
require("Comment").setup()
end,
},
{
"ahmedkhalf/project.nvim",
config = function()
require("project_nvim").setup({})
end,
},
-- https://github.com/ellisonleao/glow.nvim
{
"ellisonleao/glow.nvim",
cmd = "Glow",
config = function()
require("glow").setup({})
end,
ft = { "markdown" },
},
-- https://github.com/windwp/nvim-autopairs
{
"windwp/nvim-autopairs",
config = function()
require("nvim-autopairs").setup({})
end,
},
-- https://github.com/lewis6991/gitsigns.nvim
{
"lewis6991/gitsigns.nvim",
config = function()
require("gitsigns").setup({
current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align'
delay = 100,
ignore_whitespace = false,
},
yadm = {
enable = true,
},
})
end,
},
-- https://github.com/nvim-telescope/telescope.nvim
{
"nvim-telescope/telescope.nvim",
cmd = "Telescope",
branch = "0.1.x",
dependencies = {
{
"nvim-lua/plenary.nvim",
lazy = true,
},
},
config = function()
require("telescope").load_extension("projects")
end,
},
-- https://github.com/SmiteshP/nvim-navic
{
"SmiteshP/nvim-navic",
dependencies = "neovim/nvim-lspconfig",
config = function()
require("nvim-navic").setup({
icons = {
File = "",
Module = "",
Namespace = "",
Package = "",
Class = "",
Method = "",
Property = "",
Field = "",
Constructor = "",
Enum = "",
Interface = "",
Function = "",
Variable = "",
Constant = "",
String = "",
Number = "",
Boolean = "",
Array = "",
Object = "",
Key = "",
Null = "",
EnumMember = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
},
highlight = false,
separator = " > ",
depth_limit = 0,
depth_limit_indicator = "..",
safe_output = true,
})
end,
},
-- https://github.com/nvim-tree/nvim-tree.lua
{
"nvim-tree/nvim-tree.lua",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
config = function()
require("nvim-tree").setup({
sync_root_with_cwd = true,
respect_buf_cwd = true,
update_focused_file = {
enable = true,
update_root = true,
},
sort_by = "case_sensitive",
view = {
adaptive_size = true,
},
renderer = {
group_empty = true,
},
filters = {
dotfiles = true,
},
live_filter = {
always_show_folders = false,
},
})
end,
},
-- https://github.com/kylechui/nvim-surround
{
"kylechui/nvim-surround",
config = function()
require("nvim-surround").setup({
-- Configuration here, or leave empty to use defaults
})
end,
},
-- https://github.com/ethanholz/nvim-lastplace
{
"ethanholz/nvim-lastplace",
config = function()
require("nvim-lastplace").setup({
lastplace_open_folds = true,
})
end,
},
-- https://github.com/mg979/vim-visual-multi
"mg979/vim-visual-multi",
-- https://github.com/FooSoft/vim-argwrap
{
"FooSoft/vim-argwrap",
},
-- https://github.com/kylechui/nvim-surround
{
"kylechui/nvim-surround",
config = function()
require("nvim-surround").setup()
end,
},
-- https://github.com/neovim/nvim-lspconfig
"neovim/nvim-lspconfig",
-- https://github.com/williamboman/mason-lspconfig.nvim
"williamboman/mason-lspconfig",
-- https://github.com/williamboman/mason.nvim
"williamboman/mason.nvim",
-- https://github.com/hrsh7th/nvim-cmp
{
"hrsh7th/nvim-cmp",
dependencies = {
{ "hrsh7th/cmp-nvim-lsp" },
{ "hrsh7th/cmp-nvim-lua" },
{ "hrsh7th/cmp-buffer" },
{ "hrsh7th/cmp-path" },
{ "hrsh7th/cmp-cmdline" },
{ "L3MON4D3/LuaSnip" },
{ "saadparwaiz1/cmp_luasnip" },
{ "rafamadriz/friendly-snippets" },
{ "onsails/lspkind.nvim" },
},
config = function()
local lspkind = require("lspkind")
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0
and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local cmp = require("cmp")
local luasnip = require("luasnip")
cmp.setup({
experimental = {
ghost_text = true,
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
formatting = {
format = lspkind.cmp_format({
mode = "symbol",
maxwidth = 50,
ellipsis_char = "...",
before = function(entry, vim_item)
return vim_item
end,
}),
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = false }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- they way you will only jump inside the snippet region
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "nvim_lua" },
{ name = "path" },
{ name = "luasnip" },
{ name = "neorg" },
}, {
{ name = "buffer" },
}),
})
cmp.setup.filetype("gitcommit", {
sources = cmp.config.sources({
{ name = "cmp_git" },
}, {
{ name = "buffer" },
}),
})
cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
},
})
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{ name = "cmdline" },
}),
})
require("luasnip.loaders.from_vscode").lazy_load()
end,
},
-- https://github.com/AlphaTechnolog/pywal.nvim
{
"AlphaTechnolog/pywal.nvim",
priority = 1000,
name = "pywal",
config = function()
local pywal = require("pywal")
pywal.setup()
end,
},
-- https://github.com/nvim-lualine/lualine.nvim
{
"hoob3rt/lualine.nvim",
dependencies = { { "nvim-tree/nvim-web-devicons" } },
config = function()
local navic = require("nvim-navic")
require("lualine").setup({
sections = {
lualine_c = {
{ navic.get_location, cond = navic.is_available },
},
},
options = {
theme = "pywal-nvim",
},
})
end,
},
-- https://github.com/romgrk/barbar.nvim
{
"romgrk/barbar.nvim",
dependencies = "nvim-tree/nvim-web-devicons",
config = function()
require("bufferline").setup({
animation = true,
closable = true,
clickable = true,
icons = {
seperator = {
left = " ",
},
incactive = {
seperator = {
left = " ",
},
},
},
})
end,
},
-- https://github.com/rktjmp/fwatch.nvim
{
"rktjmp/fwatch.nvim",
config = function()
require("fwatch").watch(os.getenv("XDG_CACHE_HOME") .. "/wal/colors", {
on_event = function()
vim.defer_fn(function()
vim.cmd("colorscheme pywal")
end, 100)
end,
})
end,
},
-- https://github.com/goolord/alpha-nvim
{
"goolord/alpha-nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = {
[[ ▄▄▄ ▄▄▄▄ ██████ ███▄ █ ▄▄▄█████▓]],
[[▒████▄ ▓█████▄ ▒██ ▒ ██ ▀█ █ ▓ ██▒ ▓▒]],
[[▒██ ▀█▄ ▒██▒ ▄██░ ▓██▄ ▓██ ▀█ ██▒▒ ▓██░ ▒░]],
[[░██▄▄▄▄██ ▒██░█▀ ▒ ██▒▓██▒ ▐▌██▒░ ▓██▓ ░ ]],
[[ ▓█ ▓██▒░▓█ ▀█▓▒██████▒▒▒██░ ▓██░ ▒██▒ ░ ]],
[[ ▒▒ ▓▒█░░▒▓███▀▒▒ ▒▓▒ ▒ ░░ ▒░ ▒ ▒ ▒ ░░ ]],
[[ ▒ ▒▒ ░▒░▒ ░ ░ ░▒ ░ ░░ ░░ ░ ▒░ ░ ]],
[[ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░ ]],
[[ ░ ░ ░ ░ ░ ]],
[[ ░ ]],
}
dashboard.section.buttons.val = {
dashboard.button("e", " New file", ":ene <BAR> startinsert <CR>"),
dashboard.button("r", " Recently used files", ":Telescope oldfiles<CR>"),
dashboard.button("p", " Find project", ":Telescope projects<CR>"),
dashboard.button("f", " Find file", ":Telescope find_files<CR>"),
dashboard.button("t", " Find text", ":Telescope live_grep <CR>"),
dashboard.button(
"s",
" Settings",
":e $HOME/.config/nvim/init.lua | :cd %:p:h | split . | wincmd k | pwd<CR>"
),
dashboard.button("q", " Quit NVIM", ":qa<CR>"),
}
dashboard.section.footer.val = require("alpha.fortune")
dashboard.section.header.opts.hl = "Title"
dashboard.section.buttons.opts.hl = "Debug"
dashboard.section.footer.opts.hl = "Conceal"
dashboard.config.opts.noautocmd = true
dashboard.config.opts.setup = function()
vim.b.lnstatus = "nonumber"
end
alpha.setup(dashboard.opts)
end,
},
}