LazyVIM and some updated configurations

This commit is contained in:
Blake Ridgway 2023-12-25 10:03:17 -06:00
parent 451c1ed56d
commit 7d50f578b1
46 changed files with 1269 additions and 969 deletions

25
nvim/lua/plugins/cmp.lua Normal file
View file

@ -0,0 +1,25 @@
return {
"hrsh7th/nvim-cmp",
event = { "InsertEnter", "CmdlineEnter" },
opts = function(_, opts)
local cmp = require("cmp")
opts.mapping = vim.tbl_extend("force", opts.mapping, {
["<C-Space>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
}),
["<CR>"] = cmp.mapping({
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
else
fallback()
end
end,
s = cmp.mapping.confirm({ select = true }),
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
}),
})
end,
}

View file

@ -0,0 +1,5 @@
return {
"smjonas/inc-rename.nvim",
cmd = "IncRename",
config = true,
}

View file

@ -0,0 +1,12 @@
return {
{
"Mofiqul/vscode.nvim",
lazy = true,
priority = 1000,
opts = function()
return {
transparent = true,
}
end,
},
}

View file

@ -0,0 +1,4 @@
return {
{ "folke/flash.nvim", enabled = false },
{ "folke/which-key.nvim", enabled = false },
}

142
nvim/lua/plugins/editor.lua Normal file
View file

@ -0,0 +1,142 @@
return {
"telescope.nvim",
dependencies = { "nvim-telescope/telescope-file-browser.nvim" },
keys = {
{
"<leader>fP",
function()
require("telescope.builtin").find_files({
cwd = require("lazy.core.config").options.root,
})
end,
desc = "Find Plugin File",
},
{
";f",
function()
local builtin = require("telescope.builtin")
builtin.find_files({
no_ignore = false,
hidden = true,
})
end,
},
{
";r",
function()
local builtin = require("telescope.builtin")
builtin.live_grep()
end,
},
{
"\\\\",
function()
local builtin = require("telescope.builtin")
builtin.buffers()
end,
},
{
";t",
function()
local builtin = require("telescope.builtin")
builtin.help_tags()
end,
},
{
";;",
function()
local builtin = require("telescope.builtin")
builtin.resume()
end,
},
{
";e",
function()
local builtin = require("telescope.builtin")
builtin.diagnostics()
end,
},
{
";s",
function()
local builtin = require("telescope.builtin")
builtin.treesitter()
end,
},
{
"fb",
function()
local telescope = require("telescope")
local function telescope_buffer_dir()
return vim.fn.expand("%:p:h")
end
telescope.extensions.file_browser.file_browser({
path = "%:p:h",
cwd = telescope_buffer_dir(),
respect_gitignore = false,
hidden = true,
grouped = true,
previewer = false,
initial_mode = "normal",
layout_config = { height = 40 },
})
end,
},
},
config = function(_, opts)
local telescope = require("telescope")
local actions = require("telescope.actions")
local fb_actions = require("telescope").extensions.file_browser.actions
opts.defaults = vim.tbl_deep_extend("force", opts.defaults, {
wrap_results = true,
layout_strategy = "horizontal",
layout_config = { prompt_position = "top" },
sorting_strategy = "ascending",
winblend = 0,
mappings = {
n = {},
},
})
opts.pickers = {
diagnostics = {
theme = "ivy",
initial_mode = "normal",
layout_config = { preview_cutoff = 9999 },
},
}
opts.extensions = {
file_browser = {
theme = "dropdown",
hijack_netrw = true,
mappings = {
["n"] = {
-- custom normal mode mappings
["a"] = fb_actions.create,
["h"] = fb_actions.goto_parent_dir,
["/"] = function()
vim.cmd("startinsert")
end,
["<C-u>"] = function(prompt_bufnr)
for i = 1, 10 do
actions.move_selection_previous(prompt_bufnr)
end
end,
["<C-d>"] = function(prompt_bufnr)
for i = 1, 10 do
actions.move_selection_next(prompt_bufnr)
end
end,
["<PageUp>"] = actions.preview_scrolling_up,
["<PageDown>"] = actions.preview_scrolling_down,
},
},
},
}
telescope.setup(opts)
require("telescope").load_extension("fzf")
require("telescope").load_extension("file_browser")
end,
}

View file

@ -0,0 +1,276 @@
-- since this is just an example spec, don't actually load anything here and return an empty spec
-- stylua: ignore
if true then return {} end
-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim
--
-- In your plugin files, you can:
-- * add extra plugins
-- * disable/enabled LazyVim plugins
-- * override the configuration of LazyVim plugins
return {
-- add gruvbox
{ "ellisonleao/gruvbox.nvim" },
-- Configure LazyVim to load gruvbox
{
"LazyVim/LazyVim",
opts = {
colorscheme = "gruvbox",
},
},
-- change trouble config
{
"folke/trouble.nvim",
-- opts will be merged with the parent spec
opts = { use_diagnostic_signs = true },
},
-- disable trouble
{ "folke/trouble.nvim", enabled = false },
-- add symbols-outline
{
"simrat39/symbols-outline.nvim",
cmd = "SymbolsOutline",
keys = { { "<leader>cs", "<cmd>SymbolsOutline<cr>", desc = "Symbols Outline" } },
config = true,
},
-- override nvim-cmp and add cmp-emoji
{
"hrsh7th/nvim-cmp",
dependencies = { "hrsh7th/cmp-emoji" },
---@param opts cmp.ConfigSchema
opts = function(_, opts)
table.insert(opts.sources, { name = "emoji" })
end,
},
-- change some telescope options and a keymap to browse plugin files
{
"nvim-telescope/telescope.nvim",
keys = {
-- add a keymap to browse plugin files
-- stylua: ignore
{
"<leader>fp",
function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
desc = "Find Plugin File",
},
},
-- change some options
opts = {
defaults = {
layout_strategy = "horizontal",
layout_config = { prompt_position = "top" },
sorting_strategy = "ascending",
winblend = 0,
},
},
},
-- add telescope-fzf-native
{
"telescope.nvim",
dependencies = {
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
config = function()
require("telescope").load_extension("fzf")
end,
},
},
-- add pyright to lspconfig
{
"neovim/nvim-lspconfig",
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
-- pyright will be automatically installed with mason and loaded with lspconfig
pyright = {},
},
},
},
-- add tsserver and setup with typescript.nvim instead of lspconfig
{
"neovim/nvim-lspconfig",
dependencies = {
"jose-elias-alvarez/typescript.nvim",
init = function()
require("lazyvim.util").on_attach(function(_, buffer)
-- stylua: ignore
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
end)
end,
},
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
-- tsserver will be automatically installed with mason and loaded with lspconfig
tsserver = {},
},
-- you can do any additional lsp server setup here
-- return true if you don't want this server to be setup with lspconfig
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
setup = {
-- example to setup with typescript.nvim
tsserver = function(_, opts)
require("typescript").setup({ server = opts })
return true
end,
-- Specify * to use this function as a fallback for any server
-- ["*"] = function(server, opts) end,
},
},
},
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
{ import = "lazyvim.plugins.extras.lang.typescript" },
-- add more treesitter parsers
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"bash",
"html",
"javascript",
"json",
"lua",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"tsx",
"typescript",
"vim",
"yaml",
},
},
},
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
-- would overwrite `ensure_installed` with the new value.
-- If you'd rather extend the default config, use the code below instead:
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
-- add tsx and treesitter
vim.list_extend(opts.ensure_installed, {
"tsx",
"typescript",
})
end,
},
-- the opts function can also be used to change the default opts:
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function(_, opts)
table.insert(opts.sections.lualine_x, "😄")
end,
},
-- or you can return new options to override all the defaults
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function()
return {
--[[add your custom lualine config here]]
}
end,
},
-- use mini.starter instead of alpha
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
-- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
{ import = "lazyvim.plugins.extras.lang.json" },
-- add any tools you want to have installed below
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"stylua",
"shellcheck",
"shfmt",
"flake8",
},
},
},
-- Use <tab> for completion and snippets (supertab)
-- first: disable default <tab> and <s-tab> behavior in LuaSnip
{
"L3MON4D3/LuaSnip",
keys = function()
return {}
end,
},
-- then: setup supertab in cmp
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-emoji",
},
---@param opts cmp.ConfigSchema
opts = function(_, opts)
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 luasnip = require("luasnip")
local cmp = require("cmp")
opts.mapping = vim.tbl_extend("force", opts.mapping, {
["<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()
-- this 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" }),
["<CR>"] = cmp.mapping({
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
else
fallback()
end
end,
s = cmp.mapping.confirm({ select = true }),
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
}),
})
end,
},
}

View file

@ -0,0 +1,6 @@
return {
"lewis6991/gitsigns.nvim",
opts = {
_extmark_signs = false,
},
}

19
nvim/lua/plugins/lsp.lua Normal file
View file

@ -0,0 +1,19 @@
return {
{
"williamboman/mason.nvim",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"stylua",
"selene",
"luacheck",
"shellcheck",
"shfmt",
"tailwindcss-language-server",
"typescript-language-server",
"css-lsp",
"solargraph",
"gopls",
})
end,
},
}

View file

@ -0,0 +1,8 @@
return {
"rcarriga/nvim-notify",
config = function(_, opts)
require("notify").setup(vim.tbl_extend("keep", {
background_colour = "#000000",
}, opts))
end,
}

View file

@ -0,0 +1,11 @@
return {
"ThePrimeagen/refactoring.nvim",
lazy_load = true,
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
},
config = function()
require("refactoring").setup()
end,
}

View file

@ -0,0 +1,34 @@
return {
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"astro",
"cmake",
"cpp",
"css",
"fish",
"gitignore",
"go",
"graphql",
"http",
"java",
"php",
"rust",
"scss",
"sql",
"svelte",
},
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
vim.filetype.add({
extension = {
mdx = "markdown",
},
})
vim.treesitter.language.register("markdown", "mdx")
end,
},
}

View file

@ -0,0 +1,8 @@
return {
"folke/twilight.nvim",
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
},
}

85
nvim/lua/plugins/ui.lua Normal file
View file

@ -0,0 +1,85 @@
return {
{
"folke/noice.nvim",
opts = function(_, opts)
table.insert(opts.routes, {
filter = {
event = "notify",
find = "No information available",
},
skip = true,
})
opts.presets.lsp_doc_border = true
end,
},
-- animations
{
"echasnovski/mini.animate",
event = "VeryLazy",
opts = function(_, opts)
opts.scroll = {
enable = false,
}
end,
},
-- statusline
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = {
options = {
-- globalstatus = false,
theme = "vscode",
},
},
},
-- filename
{
"b0o/incline.nvim",
dependencies = { "craftzdog/solarized-osaka.nvim" },
event = "BufReadPre",
priority = 1200,
config = function()
local colors = require("solarized-osaka.colors").setup()
require("incline").setup({
highlight = {
groups = {
InclineNormal = { guibg = colors.violet700, guifg = colors.base04 },
InclineNormalNC = { guifg = colors.violet500, guibg = colors.base03 },
},
},
window = { margin = { vertical = 0, horizontal = 1 } },
hide = {
cursorline = true,
},
render = function(props)
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
if vim.bo[props.buf].modified then
filename = "[+] " .. filename
end
local icon, color = require("nvim-web-devicons").get_icon_color(filename)
return { { icon, guifg = color }, { " " }, { filename } }
end,
})
end,
},
{
"nvimdev/dashboard-nvim",
event = "VimEnter",
opts = function(_, opts)
local logo = [[
]]
logo = string.rep("\n", 8) .. logo .. "\n\n"
opts.config.header = vim.split(logo, "\n")
end,
},
}

8
nvim/lua/plugins/zen.lua Normal file
View file

@ -0,0 +1,8 @@
return {
"folke/zen-mode.nvim",
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
},
}