add new nvim files

This commit is contained in:
KaasKop
2024-03-31 20:49:46 +02:00
parent dc79b62ecc
commit 2a3d989605
27 changed files with 871 additions and 114 deletions

View File

@@ -3,7 +3,7 @@
],
"news": {
"NEWS.md": "2850"
"NEWS.md": "3314"
},
"version": 3
}

View File

@@ -1,5 +1,6 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
if not (vim.uv or vim.loop).fs_stat(lazypath) then
-- bootstrap lazy.nvim
-- stylua: ignore
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
@@ -8,13 +9,12 @@ vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
require("lazy").setup({
spec = {
-- add LazyVim and import its plugins
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
-- import any extras modules here
-- { import = "lazyvim.plugins.extras.lang.typescript" },
-- { import = "lazyvim.plugins.extras.lang.json" },
-- { import = "lazyvim.plugins.extras.ui.mini-animate" },
-- import/override with your plugins
{ import = "lazyvim.plugins.extras.lang.typescript" },
{ import = "lazyvim.plugins.extras.lang.json" },
{ import = "lazyvim.plugins.extras.lang.yaml" },
{ import = "lazyvim.plugins.extras.lang.tailwind" },
{ import = "lazyvim.plugins.extras.lang.markdown" },
{ import = "plugins" },
},
defaults = {
@@ -26,7 +26,7 @@ require("lazy").setup({
version = false, -- always use the latest git commit
-- version = "*", -- try installing the latest stable version for plugins that support semver
},
install = { colorscheme = { "tokyonight", "habamax" } },
-- install = { colorscheme = { "tokyonight", "habamax" } },
checker = { enabled = true }, -- automatically check for plugin updates
performance = {
rtp = {

View File

@@ -1,27 +0,0 @@
return {
"lukas-reineke/headlines.nvim",
opts = function()
local opts = {}
for _, ft in ipairs({ "markdown", "norg", "rmd", "org" }) do
opts[ft] = {
headline_highlights = {},
-- disable bullets for now. See https://github.com/lukas-reineke/headlines.nvim/issues/66
bullets = {},
}
for i = 1, 6 do
local hl = "Headline" .. i
vim.api.nvim_set_hl(0, hl, { link = "Headline", default = true })
table.insert(opts[ft].headline_highlights, hl)
end
end
return opts
end,
ft = { "markdown", "norg", "rmd", "org" },
config = function(_, opts)
-- PERF: schedule to prevent headlines slowing down opening a file
vim.schedule(function()
require("headlines").setup(opts)
require("headlines").refresh()
end)
end,
}

View File

@@ -0,0 +1,12 @@
return {
-- add gruvbox
{ "ellisonleao/gruvbox.nvim" },
-- Configure LazyVim to load gruvbox
{
"LazyVim/LazyVim",
opts = {
colorscheme = "gruvbox",
},
},
}

View File

@@ -1,18 +0,0 @@
return {
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
build = function()
vim.fn["mkdp#util#install"]()
end,
keys = {
{
"<leader>cp",
ft = "markdown",
"<cmd>MarkdownPreviewToggle<cr>",
desc = "Markdown Preview",
},
},
config = function()
vim.cmd([[do FileType]])
end,
}

View File

@@ -1,16 +1,11 @@
return {
{
"williamboman/mason.nvim",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"vue-language-server",
"biome",
"ast-grep",
"sqlls",
"marksman",
"markdownlint",
"js-debug-adapter",
})
end,
},
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, {
"css-lsp",
"biome",
"vue-language-server",
})
end,
}

View File

@@ -2,49 +2,6 @@ return {
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
cmd = "Neotree",
keys = {
{
"<leader>fe",
function()
require("neo-tree.command").execute({ toggle = true, dir = LazyVim.root() })
end,
desc = "Explorer NeoTree (Root Dir)",
},
{
"<leader>fE",
function()
require("neo-tree.command").execute({ toggle = true, dir = vim.uv.cwd() })
end,
desc = "Explorer NeoTree (cwd)",
},
{ "<leader>e", "<leader>fe", desc = "Explorer NeoTree (Root Dir)", remap = true },
{ "<leader>E", "<leader>fE", desc = "Explorer NeoTree (cwd)", remap = true },
{
"<leader>ge",
function()
require("neo-tree.command").execute({ source = "git_status", toggle = true })
end,
desc = "Git Explorer",
},
{
"<leader>be",
function()
require("neo-tree.command").execute({ source = "buffers", toggle = true })
end,
desc = "Buffer Explorer",
},
},
deactivate = function()
vim.cmd([[Neotree close]])
end,
init = function()
if vim.fn.argc(-1) == 1 then
local stat = vim.uv.fs_stat(vim.fn.argv(0))
if stat and stat.type == "directory" then
require("neo-tree")
end
end
end,
opts = {
sources = { "filesystem", "buffers", "git_status", "document_symbols" },
open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" },
@@ -58,53 +15,5 @@ return {
hide_gitignored = true,
},
},
window = {
mappings = {
["<space>"] = "none",
["Y"] = {
function(state)
local node = state.tree:get_node()
local path = node:get_id()
vim.fn.setreg("+", path, "c")
end,
desc = "Copy Path to Clipboard",
},
["O"] = {
function(state)
require("lazy.util").open(state.tree:get_node().path, { system = true })
end,
desc = "Open with System Application",
},
},
},
default_component_configs = {
indent = {
with_expanders = true, -- if nil and file nesting is enabled, will enable expanders
expander_collapsed = "",
expander_expanded = "",
expander_highlight = "NeoTreeExpander",
},
},
},
config = function(_, opts)
local function on_move(data)
LazyVim.lsp.on_rename(data.source, data.destination)
end
local events = require("neo-tree.events")
opts.event_handlers = opts.event_handlers or {}
vim.list_extend(opts.event_handlers, {
{ event = events.FILE_MOVED, handler = on_move },
{ event = events.FILE_RENAMED, handler = on_move },
})
require("neo-tree").setup(opts)
vim.api.nvim_create_autocmd("TermClose", {
pattern = "*lazygit",
callback = function()
if package.loaded["neo-tree.sources.git_status"] then
require("neo-tree.sources.git_status").refresh()
end
end,
})
end,
}

View File

@@ -1,48 +0,0 @@
return {
"neovim/nvim-lspconfig",
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
pyright = {},
marksman = {},
--@type lspconfig.options.tsserver
tsserver = {
keys = {
{
"<leader>co",
function()
vim.lsp.buf.code_action({
apply = true,
context = {
only = { "source.organizeImports.ts" },
diagnostics = {},
},
})
end,
desc = "Organize Imports",
},
{
"<leader>cR",
function()
vim.lsp.buf.code_action({
apply = true,
context = {
only = { "source.removeUnused.ts" },
diagnostics = {},
},
})
end,
desc = "Remove Unused Imports",
},
},
---@diagnostic disable-next-line: missing-fields
settings = {
completions = {
completeFunctionCalls = true,
},
},
},
},
},
}

View File

@@ -23,6 +23,8 @@ return {
"vue",
"xml",
"csv",
"css",
"scss",
},
},
}

View File

@@ -0,0 +1,121 @@
return {
{
"ThePrimeagen/refactoring.nvim",
event = "BufRead",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
},
keys = {
{
"<leader>rs",
function()
require("telescope").extensions.refactoring.refactors()
end,
mode = "v",
desc = "Refactor",
},
{
"<leader>ri",
function()
require("refactoring").refactor("Inline Variable")
end,
mode = { "n", "v" },
desc = "Inline Variable",
},
{
"<leader>rb",
function()
require("refactoring").refactor("Extract Block")
end,
desc = "Extract Block",
},
{
"<leader>rf",
function()
require("refactoring").refactor("Extract Block To File")
end,
desc = "Extract Block To File",
},
{
"<leader>rP",
function()
require("refactoring").debug.printf({ below = false })
end,
desc = "Debug Print",
},
{
"<leader>rp",
function()
require("refactoring").debug.print_var({ normal = true })
end,
desc = "Debug Print Variable",
},
{
"<leader>rc",
function()
require("refactoring").debug.cleanup({})
end,
desc = "Debug Cleanup",
},
{
"<leader>rf",
function()
require("refactoring").refactor("Extract Function")
end,
mode = "v",
desc = "Extract Function",
},
{
"<leader>rF",
function()
require("refactoring").refactor("Extract Function To File")
end,
mode = "v",
desc = "Extract Function To File",
},
{
"<leader>rx",
function()
require("refactoring").refactor("Extract Variable")
end,
mode = "v",
desc = "Extract Variable",
},
{
"<leader>rp",
function()
require("refactoring").debug.print_var()
end,
mode = "v",
desc = "Debug Print Variable",
},
},
-- opts = {
-- prompt_func_return_type = {
-- go = false,
-- java = false,
-- cpp = false,
-- c = false,
-- h = false,
-- hpp = false,
-- cxx = false,
-- },
-- prompt_func_param_type = {
-- go = false,
-- java = false,
-- cpp = false,
-- c = false,
-- h = false,
-- hpp = false,
-- cxx = false,
-- },
-- printf_statements = {},
-- print_var_statements = {},
-- },
config = function(_, options)
require("refactoring").setup(options)
require("telescope").load_extension("refactoring")
end,
},
}