refactor!: restructure and document configuration
This commit is contained in:
parent
4a02e072a7
commit
f87f9995be
126 changed files with 957 additions and 590 deletions
43
modules/neovim/README.md
Normal file
43
modules/neovim/README.md
Normal file
|
@ -0,0 +1,43 @@
|
|||
This module generates dotfiles for [neovim].
|
||||
|
||||
The module extends `programs.neovim`.
|
||||
|
||||
## Module options
|
||||
|
||||
### programs.neovim.nixd.hostname
|
||||
|
||||
By default [nixd] is enabled, you **need** to pass the current machine's
|
||||
hostname that is used to generate your system.
|
||||
|
||||
### programs.neovim.nixd.location
|
||||
|
||||
The location of your system's flake, [nixd] will execute an expression defined in the LSP's configuration that reads
|
||||
the flake's contents to evaluate [NixOS] and [Home Manager] options.
|
||||
|
||||
### programs.neovim.ollama.enable
|
||||
|
||||
Whether to add an [ollama] package to be used with [ollama.nvim](https://github.com/nomnivore/ollama.nvim).
|
||||
|
||||
### programs.neovim.ollama.type
|
||||
|
||||
The type of [ollama] package to be added, valid options are: `amd`, `nvidia` or `cpu`.
|
||||
|
||||
## My neovim failed because of package X not existing
|
||||
|
||||
My configuration is based off of `nixos-unstable` so sometimes your package may not exist or have a different name, I
|
||||
apologise for that but I don't plan on maintaining backwards compatibility. :(
|
||||
|
||||
## How it looks
|
||||
|
||||
Here's some screenshots of how it currently looks like:
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
The theme I'm using is [catppuccin](https://github.com/catppuccin) in case you're curious.
|
||||
|
||||
[neovim]: https://neovim.io/
|
||||
[Home Manager]: https://github.com/nix-community/home-manager
|
||||
[nixd]: https://github.com/nix-community/nixd/
|
||||
[ollama]: https://ollama.com/
|
167
modules/neovim/default.nix
Normal file
167
modules/neovim/default.nix
Normal file
|
@ -0,0 +1,167 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (lib)
|
||||
types
|
||||
mkOption
|
||||
mkIf
|
||||
mkEnableOption
|
||||
;
|
||||
|
||||
ollamaPackage = mkIf config.programs.neovim.ollama.enable (
|
||||
if config.programs.neovim.ollama.type == "amd" then
|
||||
pkgs.ollama-rocm
|
||||
else if config.programs.neovim.ollama.type == "nvidia" then
|
||||
pkgs.ollama-cuda
|
||||
else
|
||||
pkgs.ollama
|
||||
);
|
||||
in
|
||||
{
|
||||
options.programs.neovim = {
|
||||
nixd = {
|
||||
hostname = mkOption {
|
||||
default = "wizdesk";
|
||||
description = "Your NixOS hostname, needed for nixd lsp.";
|
||||
example = "nixos";
|
||||
type = types.str;
|
||||
};
|
||||
|
||||
location = mkOption {
|
||||
default = "git+file:///home/wizardlink/.system";
|
||||
description = "Path to your flake location, prepend 'file:///' to it and 'git+' before that if using git.";
|
||||
example = "git+file:///home/wizardlink/.system";
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
ollama = {
|
||||
enable = mkEnableOption "enable";
|
||||
type = mkOption {
|
||||
default = "amd";
|
||||
description = "The type of ollama package to install, AMD GPU accelerated or NVIDIA GPU accelerated.";
|
||||
example = "amd";
|
||||
type = types.enum [
|
||||
"amd"
|
||||
"nvidia"
|
||||
"cpu"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
home.sessionVariables = {
|
||||
EDITOR = "nvim";
|
||||
MANPAGER = "nvim +Man!";
|
||||
};
|
||||
|
||||
programs.neovim = {
|
||||
withNodeJs = true;
|
||||
withPython3 = true;
|
||||
|
||||
extraLuaConfig = builtins.readFile ./init.lua;
|
||||
|
||||
extraPackages =
|
||||
with pkgs;
|
||||
[
|
||||
# Needed by LuaSnip
|
||||
luajitPackages.jsregexp
|
||||
|
||||
# Treesitter
|
||||
gcc # For compiling languages
|
||||
|
||||
# CMAKE
|
||||
neocmakelsp
|
||||
|
||||
# C/C++
|
||||
clang-tools
|
||||
vscode-extensions.ms-vscode.cpptools
|
||||
|
||||
# C#
|
||||
#csharp-ls Testing roslyn.nvim
|
||||
roslyn-ls
|
||||
rzls
|
||||
csharpier
|
||||
netcoredbg
|
||||
|
||||
# HTML/CSS/JSON
|
||||
emmet-ls
|
||||
vscode-langservers-extracted
|
||||
|
||||
# LUA
|
||||
lua-language-server
|
||||
stylua
|
||||
|
||||
# Markdown
|
||||
markdownlint-cli
|
||||
marksman
|
||||
|
||||
# Nix
|
||||
deadnix
|
||||
nixd
|
||||
nixfmt-rfc-style
|
||||
statix
|
||||
|
||||
# Python
|
||||
basedpyright
|
||||
python312Packages.flake8
|
||||
ruff
|
||||
|
||||
# TypeScript/JavaScript
|
||||
vtsls
|
||||
deno
|
||||
vscode-js-debug
|
||||
|
||||
# Rust
|
||||
rust-analyzer
|
||||
cargo # Needed by blink-cmp
|
||||
taplo
|
||||
vscode-extensions.vadimcn.vscode-lldb
|
||||
|
||||
# Vue
|
||||
prettierd
|
||||
vue-language-server
|
||||
|
||||
# Svelte
|
||||
nodePackages.svelte-language-server
|
||||
|
||||
# YAML
|
||||
yaml-language-server
|
||||
]
|
||||
++ pkgs.lib.optionals config.programs.neovim.ollama.enable [
|
||||
# Needed by ollama.nvim
|
||||
curl
|
||||
ollamaPackage
|
||||
];
|
||||
};
|
||||
|
||||
xdg.configFile."nvim/lua" = {
|
||||
recursive = true;
|
||||
source = ./lua;
|
||||
};
|
||||
|
||||
xdg.configFile."nvim/queries" = {
|
||||
recursive = true;
|
||||
source = ./queries;
|
||||
};
|
||||
|
||||
xdg.configFile."nvim/ftplugin" = {
|
||||
recursive = true;
|
||||
source = ./ftplugin;
|
||||
};
|
||||
|
||||
xdg.configFile."nvim/lua/plugins/astrolsp.lua".source = pkgs.runCommand "astrolsp.lua" { } ''
|
||||
cp ${./lsp.lua} $out
|
||||
|
||||
substituteInPlace $out \
|
||||
--replace-fail "{hostname}" "${config.programs.neovim.nixd.hostname}" \
|
||||
--replace-fail "{location}" "${config.programs.neovim.nixd.location}"
|
||||
'';
|
||||
};
|
||||
}
|
153
modules/neovim/ftplugin/cs.lua
Normal file
153
modules/neovim/ftplugin/cs.lua
Normal file
|
@ -0,0 +1,153 @@
|
|||
---@class CSFTPlugin.Project
|
||||
---@field dll_path string
|
||||
---@field name string
|
||||
---@field target_framework string
|
||||
|
||||
---@class CSFTPlugin
|
||||
---@field dotnet_cmd string?
|
||||
---@field projects CSFTPlugin.Project[]
|
||||
local M = {
|
||||
dotnet_cmd = vim.fn.exepath "dotnet",
|
||||
projects = {},
|
||||
}
|
||||
|
||||
---@param command string The shell command to execute
|
||||
---@return string[]
|
||||
function M.cmd(command)
|
||||
-- execute command
|
||||
local exec_return = vim.fn.execute("!" .. command)
|
||||
|
||||
-- get the output by line
|
||||
local output = vim.tbl_filter(
|
||||
---@param item string
|
||||
---@return boolean
|
||||
function(item)
|
||||
if item == "" then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
end
|
||||
end,
|
||||
vim.split(exec_return, "[\n]")
|
||||
)
|
||||
|
||||
-- remove echo line (":!<command>")
|
||||
table.remove(output, 1)
|
||||
|
||||
return output
|
||||
end
|
||||
|
||||
---@return CSFTPlugin.Project[]
|
||||
function M.find_projects()
|
||||
local projects = {}
|
||||
|
||||
local csproj_extension = ".csproj"
|
||||
|
||||
local csproj_files = M.cmd("find . -name '*" .. csproj_extension .. "'")
|
||||
|
||||
for _, file_path in ipairs(csproj_files) do
|
||||
local sub_start, sub_end = string.find(file_path, "%w+%" .. csproj_extension)
|
||||
|
||||
local project_name = string.sub(file_path, sub_start or 1, sub_end - #csproj_extension)
|
||||
local project_location = string.sub(file_path, 1, sub_start - 1)
|
||||
|
||||
local target_framework = M.cmd("rg -e 'TargetFramework>(.*)<' -r '$1' -o " .. file_path)[1]
|
||||
|
||||
projects[#projects + 1] = {
|
||||
dll_path = project_location .. "bin/Debug/" .. target_framework .. "/" .. project_name .. ".dll",
|
||||
name = project_name,
|
||||
target_framework = target_framework,
|
||||
}
|
||||
end
|
||||
|
||||
return projects
|
||||
end
|
||||
|
||||
---@param command string The dotnet CLI command to run
|
||||
---@return string[]
|
||||
function M:run(command)
|
||||
return M.cmd(self.dotnet_cmd .. " " .. command)
|
||||
end
|
||||
|
||||
---@return boolean
|
||||
function M:check_version()
|
||||
local cmd_output = self:run "--version"
|
||||
|
||||
local sub_start = string.find(cmd_output[1], "%d+%.%d+%.%d+")
|
||||
if not sub_start then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
---@return thread
|
||||
function M:choose_dll()
|
||||
self.projects = self.find_projects()
|
||||
|
||||
local dap = require "dap"
|
||||
|
||||
return coroutine.create(function(search_coroutine)
|
||||
vim.ui.select(
|
||||
self.projects,
|
||||
{
|
||||
prompt = "Select project to debug:",
|
||||
---@param item CSFTPlugin.Project
|
||||
---@return string
|
||||
format_item = function(item)
|
||||
return item.name
|
||||
end,
|
||||
},
|
||||
---@param item CSFTPlugin.Project
|
||||
function(item)
|
||||
local path = item and item.dll_path or dap.ABORT
|
||||
|
||||
if path ~= dap.ABORT then
|
||||
self:run "build"
|
||||
end
|
||||
|
||||
coroutine.resume(search_coroutine, path)
|
||||
end
|
||||
)
|
||||
end)
|
||||
end
|
||||
|
||||
function M:start()
|
||||
local has_dotnet = self:check_version()
|
||||
|
||||
if not has_dotnet then
|
||||
vim.notify_once("dotnet executable not present of malfunctioning", vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
|
||||
vim.fn.setenv("DOTNET_ENVIRONMENT", "Development")
|
||||
|
||||
local debugger_path = vim.fn.get_nix_store "netcoredbg" .. "/bin/netcoredbg"
|
||||
|
||||
local dap = require "dap"
|
||||
|
||||
---@type dap.ExecutableAdapter
|
||||
dap.adapters.netcoredbg = {
|
||||
type = "executable",
|
||||
command = debugger_path,
|
||||
args = { "--interpreter=vscode" },
|
||||
}
|
||||
|
||||
---@type dap.Configuration[]
|
||||
dap.configurations.cs = {
|
||||
{
|
||||
type = "netcoredbg",
|
||||
name = "Launch project DLL",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return self:choose_dll()
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
vim.g.loaded_csftplugin = true
|
||||
end
|
||||
|
||||
if not vim.g.loaded_csftplugin then
|
||||
M:start()
|
||||
end
|
23
modules/neovim/init.lua
Normal file
23
modules/neovim/init.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
-- This file simply bootstraps the installation of Lazy.nvim and then calls other files for execution
|
||||
-- This file doesn't necessarily need to be touched, BE CAUTIOUS editing this file and proceed at your own risk.
|
||||
local lazypath = vim.env.LAZY or vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
|
||||
if not (vim.env.LAZY or (vim.uv or vim.loop).fs_stat(lazypath)) then
|
||||
-- stylua: ignore
|
||||
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable",
|
||||
lazypath })
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- validate that lazy is available
|
||||
if not pcall(require, "lazy") then
|
||||
-- stylua: ignore
|
||||
vim.api.nvim_echo(
|
||||
{ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } },
|
||||
true, {})
|
||||
vim.fn.getchar()
|
||||
vim.cmd.quit()
|
||||
end
|
||||
|
||||
require "util"
|
||||
require "lazy_setup"
|
||||
require "polish"
|
210
modules/neovim/lsp.lua
Normal file
210
modules/neovim/lsp.lua
Normal file
|
@ -0,0 +1,210 @@
|
|||
-- AstroLSP allows you to customize the features in AstroNvim's LSP configuration engine
|
||||
-- Configuration documentation can be found with `:h astrolsp`
|
||||
-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`)
|
||||
-- as this provides autocomplete and documentation while editing
|
||||
|
||||
---@type LazySpec
|
||||
return {
|
||||
"AstroNvim/astrolsp",
|
||||
---@param opts AstroLSPOpts
|
||||
---@return AstroLSPOpts
|
||||
opts = function(_, opts)
|
||||
---@type AstroLSPOpts
|
||||
local lsp_options = {
|
||||
-- Configuration table of features provided by AstroLSP
|
||||
features = {
|
||||
autoformat = true, -- enable or disable auto formatting on start
|
||||
codelens = true, -- enable/disable codelens refresh on start
|
||||
inlay_hints = false, -- enable/disable inlay hints on start
|
||||
semantic_tokens = true, -- enable/disable semantic token highlighting
|
||||
},
|
||||
-- customize lsp formatting options
|
||||
formatting = {
|
||||
-- control auto formatting on save
|
||||
format_on_save = {
|
||||
enabled = true, -- enable or disable format on save globally
|
||||
allow_filetypes = { -- enable format on save for specified filetypes only
|
||||
-- "go",
|
||||
"c",
|
||||
"cpp",
|
||||
"cs",
|
||||
"gdscript",
|
||||
"h",
|
||||
"javascript",
|
||||
"jsx",
|
||||
"lua",
|
||||
"nix",
|
||||
"rust",
|
||||
"svelte",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vue",
|
||||
},
|
||||
ignore_filetypes = { -- disable format on save for specified filetypes
|
||||
-- "python",
|
||||
},
|
||||
},
|
||||
disabled = { -- disable formatting capabilities for the listed language servers
|
||||
-- disable lua_ls formatting capability if you want to use StyLua to format your lua code
|
||||
-- "lua_ls",
|
||||
},
|
||||
timeout_ms = 1000, -- default format timeout
|
||||
-- filter = function(client) -- fully override the default formatting function
|
||||
-- return true
|
||||
-- end
|
||||
},
|
||||
-- enable servers that you already have installed without mason
|
||||
servers = {
|
||||
"basedpyright",
|
||||
"clangd",
|
||||
"cmake",
|
||||
--"csharp_ls", Testing roslyn.nvim
|
||||
"cssls",
|
||||
"denols",
|
||||
"eslint",
|
||||
"gdscript",
|
||||
"html",
|
||||
"jsonls",
|
||||
"lua_ls",
|
||||
"marksman",
|
||||
"nixd",
|
||||
"rust_analyzer",
|
||||
"svelte",
|
||||
"taplo",
|
||||
"volar",
|
||||
"vtsls",
|
||||
"yamlls",
|
||||
},
|
||||
-- customize language server configuration options passed to `lspconfig`
|
||||
---@diagnostic disable: missing-fields
|
||||
config = {
|
||||
-- clangd = { capabilities = { offsetEncoding = "utf-8" } },
|
||||
---@type lspconfig.Config
|
||||
nixd = {
|
||||
settings = {
|
||||
nixd = {
|
||||
nixpkgs = {
|
||||
expr = "import (builtins.getFlake ({location})).inputs.nixpkgs { }",
|
||||
},
|
||||
options = {
|
||||
nixos = {
|
||||
expr = '(builtins.getFlake ("{location}")).nixosConfigurations.{hostname}.options',
|
||||
},
|
||||
home_manager = {
|
||||
expr =
|
||||
'(builtins.getFlake ("{location}")).nixosConfigurations.{hostname}.options.home-manager.users.type.getSubOptions []',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
---@type lspconfig.Config
|
||||
vtsls = {
|
||||
filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue" },
|
||||
settings = {
|
||||
vtsls = {
|
||||
tsserver = {
|
||||
globalPlugins = {
|
||||
{
|
||||
name = "@vue/typescript-plugin",
|
||||
location = vim.fn.get_nix_store "vue-language-server"
|
||||
.. "/lib/node_modules/@vue/language-server",
|
||||
languages = { "vue" },
|
||||
configNamespace = "typescript",
|
||||
enableForWorkspaceTypeScriptVersions = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
---@type lspconfig.Config
|
||||
rust_analyzer = {
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
cargo = {
|
||||
extraEnv = { CARGO_PROFILE_RUST_ANALYZER_INHERITS = "dev" },
|
||||
extraArgs = { "--profile", "rust-analyzer" },
|
||||
},
|
||||
check = { command = "check", extraArgs = {} },
|
||||
},
|
||||
},
|
||||
},
|
||||
---@type lspconfig.Config
|
||||
html = {
|
||||
filetypes = { "html", "templ", "razor" },
|
||||
},
|
||||
},
|
||||
-- customize how language servers are attached
|
||||
handlers = {
|
||||
-- a function without a key is simply the default handler, functions take two parameters, the server name and the configured options table for that server
|
||||
-- function(server, opts) require("lspconfig")[server].setup(opts) end
|
||||
|
||||
-- the key is the server that is being setup with `lspconfig`
|
||||
-- rust_analyzer = false, -- setting a handler to false will disable the set up of that language server
|
||||
-- pyright = function(_, opts) require("lspconfig").pyright.setup(opts) end -- or a custom handler function can be passed
|
||||
},
|
||||
-- Configure buffer local auto commands to add when attaching a language server
|
||||
autocmds = {
|
||||
-- first key is the `augroup` to add the auto commands to (:h augroup)
|
||||
lsp_document_highlight = {
|
||||
-- Optional condition to create/delete auto command group
|
||||
-- can either be a string of a client capability or a function of `fun(client, bufnr): boolean`
|
||||
-- condition will be resolved for each client on each execution and if it ever fails for all clients,
|
||||
-- the auto commands will be deleted for that buffer
|
||||
cond = "textDocument/documentHighlight",
|
||||
-- cond = function(client, bufnr) return client.name == "lua_ls" end,
|
||||
-- list of auto commands to set
|
||||
{
|
||||
-- events to trigger
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
-- the rest of the autocmd options (:h nvim_create_autocmd)
|
||||
desc = "Document Highlighting",
|
||||
callback = function()
|
||||
vim.lsp.buf.document_highlight()
|
||||
end,
|
||||
},
|
||||
{
|
||||
event = { "CursorMoved", "CursorMovedI", "BufLeave" },
|
||||
desc = "Document Highlighting Clear",
|
||||
callback = function()
|
||||
vim.lsp.buf.clear_references()
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- mappings to be set up on attaching of a language server
|
||||
mappings = {
|
||||
n = {
|
||||
gl = {
|
||||
function()
|
||||
vim.diagnostic.open_float()
|
||||
end,
|
||||
desc = "Hover diagnostics",
|
||||
},
|
||||
-- a `cond` key can provided as the string of a server capability to be required to attach, or a function with `client` and `bufnr` parameters from the `on_attach` that returns a boolean
|
||||
-- gD = {
|
||||
-- function() vim.lsp.buf.declaration() end,
|
||||
-- desc = "Declaration of current symbol",
|
||||
-- cond = "textDocument/declaration",
|
||||
-- },
|
||||
-- ["<Leader>uY"] = {
|
||||
-- function() require("astrolsp.toggles").buffer_semantic_tokens() end,
|
||||
-- desc = "Toggle LSP semantic highlight (buffer)",
|
||||
-- cond = function(client) return client.server_capabilities.semanticTokensProvider and vim.lsp.semantic_tokens end,
|
||||
-- },
|
||||
},
|
||||
},
|
||||
-- A custom `on_attach` function to be run after the default `on_attach` function
|
||||
-- takes two parameters `client` and `bufnr` (`:h lspconfig-setup`)
|
||||
on_attach = function(client, bufnr)
|
||||
-- this would disable semanticTokensProvider for all clients
|
||||
-- client.server_capabilities.semanticTokensProvider = nil
|
||||
end,
|
||||
}
|
||||
|
||||
opts = vim.tbl_deep_extend("force", opts, lsp_options)
|
||||
|
||||
return opts
|
||||
end,
|
||||
}
|
36
modules/neovim/lua/community.lua
Normal file
36
modules/neovim/lua/community.lua
Normal file
|
@ -0,0 +1,36 @@
|
|||
-- AstroCommunity: import any community modules here
|
||||
-- We import this file in `lazy_setup.lua` before the `plugins/` folder.
|
||||
-- This guarantees that the specs are processed before any user plugins.
|
||||
|
||||
---@type LazySpec
|
||||
return {
|
||||
"AstroNvim/astrocommunity",
|
||||
{ import = "astrocommunity.colorscheme.catppuccin" },
|
||||
|
||||
{ import = "astrocommunity.media.vim-wakatime" },
|
||||
|
||||
{ import = "astrocommunity.editing-support.todo-comments-nvim" },
|
||||
{ import = "astrocommunity.editing-support.zen-mode-nvim" },
|
||||
|
||||
{ import = "astrocommunity.motion.flash-nvim" },
|
||||
{ import = "astrocommunity.motion.flit-nvim" },
|
||||
{ import = "astrocommunity.motion.leap-nvim" },
|
||||
{ import = "astrocommunity.motion.mini-ai" },
|
||||
{ import = "astrocommunity.motion.mini-surround" },
|
||||
|
||||
{ import = "astrocommunity.test.neotest" },
|
||||
|
||||
{ import = "astrocommunity.pack.cmake" },
|
||||
{ import = "astrocommunity.pack.cpp" },
|
||||
-- { import = "astrocommunity.pack.cs" }, Trying out roslyn.nvim
|
||||
{ import = "astrocommunity.pack.godot" },
|
||||
{ import = "astrocommunity.pack.html-css" },
|
||||
{ import = "astrocommunity.pack.json" },
|
||||
{ import = "astrocommunity.pack.lua" },
|
||||
{ import = "astrocommunity.pack.markdown" },
|
||||
{ import = "astrocommunity.pack.rust" },
|
||||
{ import = "astrocommunity.pack.toml" },
|
||||
{ import = "astrocommunity.pack.typescript-all-in-one" },
|
||||
{ import = "astrocommunity.pack.vue" },
|
||||
{ import = "astrocommunity.pack.yaml" },
|
||||
}
|
38
modules/neovim/lua/lazy_setup.lua
Normal file
38
modules/neovim/lua/lazy_setup.lua
Normal file
|
@ -0,0 +1,38 @@
|
|||
require("lazy").setup({
|
||||
{
|
||||
"AstroNvim/AstroNvim",
|
||||
--version = "^4", -- Remove version tracking to elect for nighly AstroNvim
|
||||
import = "astronvim.plugins",
|
||||
opts = { -- AstroNvim options must be set here with the `import` key
|
||||
mapleader = " ", -- This ensures the leader key must be configured before Lazy is set up
|
||||
maplocalleader = ",", -- This ensures the localleader key must be configured before Lazy is set up
|
||||
icons_enabled = true, -- Set to false to disable icons (if no Nerd Font is available)
|
||||
pin_plugins = nil, -- Default will pin plugins when tracking `version` of AstroNvim, set to true/false to override
|
||||
},
|
||||
},
|
||||
{ import = "community" },
|
||||
{ import = "plugins" },
|
||||
} --[[@as LazySpec]], {
|
||||
-- Configure any other `lazy.nvim` configuration options here
|
||||
install = { colorscheme = { "astrodark", "habamax" } },
|
||||
ui = { backdrop = 100 },
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins, add more to your liking
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
"netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
dev = {
|
||||
path = "/mnt/internal/repos",
|
||||
patterns = {
|
||||
"nvim-ufo",
|
||||
"nix-store.nvim",
|
||||
},
|
||||
},
|
||||
} --[[@as LazyConfig]])
|
84
modules/neovim/lua/plugins/astrocore.lua
Normal file
84
modules/neovim/lua/plugins/astrocore.lua
Normal file
|
@ -0,0 +1,84 @@
|
|||
-- AstroCore provides a central place to modify mappings, vim options, autocommands, and more!
|
||||
-- Configuration documentation can be found with `:h astrocore`
|
||||
-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`)
|
||||
-- as this provides autocomplete and documentation while editing
|
||||
|
||||
---@type LazySpec
|
||||
return {
|
||||
"AstroNvim/astrocore",
|
||||
---@type AstroCoreOpts
|
||||
opts = {
|
||||
-- Configure core features of AstroNvim
|
||||
features = {
|
||||
large_buf = { size = 1024 * 500, lines = 10000 }, -- set global limits for large files for disabling features like treesitter
|
||||
autopairs = true, -- enable autopairs at start
|
||||
cmp = true, -- enable completion at start
|
||||
diagnostics_mode = 3, -- diagnostic mode on start (0 = off, 1 = no signs/virtual text, 2 = no virtual text, 3 = on)
|
||||
highlighturl = true, -- highlight URLs at start
|
||||
notifications = true, -- enable notifications at start
|
||||
},
|
||||
-- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on
|
||||
diagnostics = {
|
||||
virtual_text = true,
|
||||
underline = true,
|
||||
},
|
||||
-- vim options can be configured here
|
||||
options = {
|
||||
opt = { -- vim.opt.<key>
|
||||
autoindent = true, -- indents automatically based on context
|
||||
expandtab = true, -- use spaces instead of tabs
|
||||
grepprg = "rg --vimgrep", -- use ripgrep on grep actions
|
||||
number = true, -- sets vim.opt.number
|
||||
relativenumber = true, -- sets vim.opt.relativenumber
|
||||
shiftwidth = 2, -- how many spaces after indentation
|
||||
signcolumn = "auto", -- sets vim.opt.signcolumn to auto
|
||||
smartindent = true, -- smartly indent
|
||||
spell = false, -- sets vim.opt.spell
|
||||
tabstop = 2, -- how many spaces to indent when pressing tab
|
||||
wrap = false, -- sets vim.opt.wrap
|
||||
},
|
||||
g = { -- vim.g.<key>
|
||||
-- configure global vim variables (vim.g)
|
||||
-- NOTE: `mapleader` and `maplocalleader` must be set in the AstroNvim opts or before `lazy.setup`
|
||||
-- This can be found in the `lua/lazy_setup.lua` file
|
||||
},
|
||||
},
|
||||
-- Mappings can be configured through AstroCore as well.
|
||||
-- NOTE: keycodes follow the casing in the vimdocs. For example, `<Leader>` must be capitalized
|
||||
mappings = {
|
||||
-- first key is the mode
|
||||
n = {
|
||||
-- second key is the lefthand side of the map
|
||||
|
||||
-- navigate buffer tabs with `H` and `L`
|
||||
-- L = {
|
||||
-- function() require("astrocore.buffer").nav(vim.v.count > 0 and vim.v.count or 1) end,
|
||||
-- desc = "Next buffer",
|
||||
-- },
|
||||
-- H = {
|
||||
-- function() require("astrocore.buffer").nav(-(vim.v.count > 0 and vim.v.count or 1)) end,
|
||||
-- desc = "Previous buffer",
|
||||
-- },
|
||||
|
||||
-- mappings seen under group name "Buffer"
|
||||
["<Leader>bD"] = {
|
||||
function()
|
||||
require("astroui.status.heirline").buffer_picker(function(bufnr)
|
||||
require("astrocore.buffer").close(bufnr)
|
||||
end)
|
||||
end,
|
||||
desc = "Pick to close",
|
||||
},
|
||||
-- tables with just a `desc` key will be registered with which-key if it's installed
|
||||
-- this is useful for naming menus
|
||||
["<Leader>b"] = { desc = "Buffers" },
|
||||
-- quick save
|
||||
-- ["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
|
||||
},
|
||||
t = {
|
||||
-- setting a mapping to false will disable it
|
||||
-- ["<esc>"] = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
37
modules/neovim/lua/plugins/astroui.lua
Normal file
37
modules/neovim/lua/plugins/astroui.lua
Normal file
|
@ -0,0 +1,37 @@
|
|||
-- AstroUI provides the basis for configuring the AstroNvim User Interface
|
||||
-- Configuration documentation can be found with `:h astroui`
|
||||
-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`)
|
||||
-- as this provides autocomplete and documentation while editing
|
||||
|
||||
---@type LazySpec
|
||||
return {
|
||||
"AstroNvim/astroui",
|
||||
---@type AstroUIOpts
|
||||
opts = {
|
||||
-- change colorscheme
|
||||
colorscheme = "catppuccin-frappe",
|
||||
-- AstroUI allows you to easily modify highlight groups easily for any and all colorschemes
|
||||
highlights = {
|
||||
init = { -- this table overrides highlights in all themes
|
||||
-- Normal = { bg = "#000000" },
|
||||
},
|
||||
astrotheme = { -- a table of overrides/changes when applying the astrotheme theme
|
||||
-- Normal = { bg = "#000000" },
|
||||
},
|
||||
},
|
||||
-- Icons can be configured throughout the interface
|
||||
icons = {
|
||||
-- configure the loading of the lsp in the status line
|
||||
LSPLoading1 = "⠋",
|
||||
LSPLoading2 = "⠙",
|
||||
LSPLoading3 = "⠹",
|
||||
LSPLoading4 = "⠸",
|
||||
LSPLoading5 = "⠼",
|
||||
LSPLoading6 = "⠴",
|
||||
LSPLoading7 = "⠦",
|
||||
LSPLoading8 = "⠧",
|
||||
LSPLoading9 = "⠇",
|
||||
LSPLoading10 = "⠏",
|
||||
},
|
||||
},
|
||||
}
|
15
modules/neovim/lua/plugins/luasnip.lua
Normal file
15
modules/neovim/lua/plugins/luasnip.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
"L3MON4D3/LuaSnip",
|
||||
config = function(plugin, opts)
|
||||
-- include the default astronvim config that calls the setup call
|
||||
require "astronvim.plugins.configs.luasnip" (plugin, opts)
|
||||
|
||||
-- load snippets paths
|
||||
require("luasnip.loaders.from_lua").lazy_load {
|
||||
paths = { vim.fn.stdpath "config" .. "/snippets" },
|
||||
}
|
||||
|
||||
-- extend 'razor' files with html snippets
|
||||
require("luasnip").filetype_extend("razor", { "html" })
|
||||
end,
|
||||
}
|
31
modules/neovim/lua/plugins/mason.lua
Normal file
31
modules/neovim/lua/plugins/mason.lua
Normal file
|
@ -0,0 +1,31 @@
|
|||
-- Customize Mason plugins
|
||||
|
||||
---@type LazySpec
|
||||
return {
|
||||
-- use mason-lspconfig to configure LSP installations
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
-- overrides `require("mason-lspconfig").setup(...)`
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = nil
|
||||
opts.automatic_installation = false
|
||||
end,
|
||||
},
|
||||
-- use mason-null-ls to configure Formatters/Linter installation for null-ls sources
|
||||
{
|
||||
"jay-babu/mason-null-ls.nvim",
|
||||
-- overrides `require("mason-null-ls").setup(...)`
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = nil
|
||||
opts.automatic_installation = false
|
||||
end,
|
||||
},
|
||||
{
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
-- overrides `require("mason-nvim-dap").setup(...)`
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = nil
|
||||
opts.automatic_installation = false
|
||||
end,
|
||||
},
|
||||
}
|
9
modules/neovim/lua/plugins/nix-store.lua
Normal file
9
modules/neovim/lua/plugins/nix-store.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
---@type LazySpec
|
||||
return {
|
||||
"wizardlink/nix-store.nvim",
|
||||
priority = 999999,
|
||||
lazy = false,
|
||||
opts = {
|
||||
allow_unfree = true,
|
||||
},
|
||||
}
|
64
modules/neovim/lua/plugins/none-ls.lua
Normal file
64
modules/neovim/lua/plugins/none-ls.lua
Normal file
|
@ -0,0 +1,64 @@
|
|||
-- Customize None-ls sources
|
||||
|
||||
---@type LazySpec
|
||||
return {
|
||||
"nvimtools/none-ls.nvim",
|
||||
dependencies = {
|
||||
"nvimtools/none-ls-extras.nvim",
|
||||
},
|
||||
opts = function(_, config)
|
||||
-- config variable is the default configuration table for the setup function call
|
||||
local null_ls = require "null-ls"
|
||||
local helpers = require "null-ls.helpers"
|
||||
|
||||
-- local deno_fmt = helpers.make_builtin({
|
||||
-- name = "deno_fmt",
|
||||
-- filetypes = {
|
||||
-- "angular",
|
||||
-- "astro",
|
||||
-- "css",
|
||||
-- "html",
|
||||
-- "javascript",
|
||||
-- "json",
|
||||
-- "jsonc",
|
||||
-- "less",
|
||||
-- "markdown",
|
||||
-- "sass",
|
||||
-- "scss",
|
||||
-- "svelte",
|
||||
-- "typescript",
|
||||
-- "vue",
|
||||
-- "yaml",
|
||||
-- },
|
||||
-- method = { null_ls.methods.FORMATTING },
|
||||
-- generator_opts = {
|
||||
-- command = "deno",
|
||||
-- args = { "fmt", "--unstable-component", "-" },
|
||||
-- to_stdin = true,
|
||||
-- },
|
||||
-- factory = helpers.formatter_factory,
|
||||
-- })
|
||||
|
||||
-- Check supported formatters and linters
|
||||
-- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting
|
||||
-- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
|
||||
config.sources = require("astrocore").list_insert_unique(config.sources, {
|
||||
-- Set a formatter
|
||||
require "none-ls.diagnostics.flake8",
|
||||
require "none-ls.formatting.ruff",
|
||||
null_ls.builtins.formatting.clang_format.with {
|
||||
disabled_filetypes = { "cs" },
|
||||
},
|
||||
null_ls.builtins.formatting.csharpier,
|
||||
null_ls.builtins.formatting.nixfmt,
|
||||
null_ls.builtins.formatting.stylua,
|
||||
--deno_fmt,
|
||||
null_ls.builtins.formatting.prettierd,
|
||||
|
||||
null_ls.builtins.code_actions.statix,
|
||||
|
||||
null_ls.builtins.diagnostics.deadnix,
|
||||
})
|
||||
return config -- return final config table
|
||||
end,
|
||||
}
|
84
modules/neovim/lua/plugins/nvim-dap.lua
Normal file
84
modules/neovim/lua/plugins/nvim-dap.lua
Normal file
|
@ -0,0 +1,84 @@
|
|||
---@type LazySpec
|
||||
return {
|
||||
"mfussenegger/nvim-dap",
|
||||
config = function()
|
||||
local dap = require "dap"
|
||||
|
||||
---@type dap.Adapter
|
||||
dap.adapters.codelldb = {
|
||||
port = "${port}",
|
||||
type = "server",
|
||||
executable = {
|
||||
command = "codelldb",
|
||||
args = { "--port", "${port}" },
|
||||
},
|
||||
}
|
||||
|
||||
---@type dap.Configuration[]
|
||||
dap.configurations.rust = {
|
||||
{
|
||||
name = "Launch file",
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
stopOnEntry = false,
|
||||
},
|
||||
}
|
||||
|
||||
---@type dap.Adapter
|
||||
dap.adapters.cppdbg = {
|
||||
id = "cppdbg",
|
||||
type = "executable",
|
||||
command = vim.fn.get_nix_store "vscode-extensions.ms-vscode.cpptools"
|
||||
.. "/share/vscode/extensions/ms-vscode.cpptools/debugAdapters/bin/OpenDebugAD7",
|
||||
}
|
||||
|
||||
---@type dap.Configuration[]
|
||||
dap.configurations.cpp = {
|
||||
{
|
||||
name = "Launch file",
|
||||
type = "cppdbg",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
stopAtEntry = true,
|
||||
},
|
||||
{
|
||||
name = "Attach to gdbserver :1234",
|
||||
type = "cppdbg",
|
||||
request = "launch",
|
||||
MIMode = "gdb",
|
||||
miDebuggerServerAddress = "localhost:1234",
|
||||
miDebuggerPath = "/usr/bin/gdb",
|
||||
cwd = "${workspaceFolder}",
|
||||
program = function()
|
||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||
end,
|
||||
},
|
||||
}
|
||||
dap.configurations.c = dap.configurations.cpp
|
||||
|
||||
---@type dap.Adapter
|
||||
dap.adapters.godot = {
|
||||
type = "server",
|
||||
host = "127.0.0.1",
|
||||
port = 6006,
|
||||
}
|
||||
|
||||
---@type dap.Configuration[]
|
||||
dap.configurations.gdscript = {
|
||||
{
|
||||
name = "Launch scene",
|
||||
type = "godot",
|
||||
request = "launch",
|
||||
project = "${workspaceFolder}",
|
||||
scene = "current",
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
11
modules/neovim/lua/plugins/nvim-lint.lua
Normal file
11
modules/neovim/lua/plugins/nvim-lint.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
return {
|
||||
{
|
||||
"mfussenegger/nvim-lint",
|
||||
optional = true,
|
||||
opts = {
|
||||
linters_by_ft = {
|
||||
nix = { "statix", "deadnix" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
32
modules/neovim/lua/plugins/nvim-ufo.lua
Normal file
32
modules/neovim/lua/plugins/nvim-ufo.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
---@type LazySpec
|
||||
return {
|
||||
"kevinhwang91/nvim-ufo",
|
||||
opts = {
|
||||
provider_selector = function(_, filetype, _)
|
||||
---@type table<string, UfoProviderEnum | UfoProviderEnum[]>
|
||||
local ftDefaults = {
|
||||
cs = "treesitter",
|
||||
}
|
||||
|
||||
local function handleFallbackException(bufnr, err, providerName)
|
||||
if type(err) == "string" and err:match "UfoFallbackException" then
|
||||
return require("ufo").getFolds(bufnr, providerName)
|
||||
else
|
||||
return require("promise").reject(err)
|
||||
end
|
||||
end
|
||||
|
||||
return ftDefaults[filetype]
|
||||
or function(bufnr)
|
||||
return require("ufo")
|
||||
.getFolds(bufnr, "lsp")
|
||||
:catch(function(err)
|
||||
return handleFallbackException(bufnr, err, "treesitter")
|
||||
end)
|
||||
:catch(function(err)
|
||||
return handleFallbackException(bufnr, err, "indent")
|
||||
end)
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
137
modules/neovim/lua/plugins/roslyn-nvim.lua
Normal file
137
modules/neovim/lua/plugins/roslyn-nvim.lua
Normal file
|
@ -0,0 +1,137 @@
|
|||
---@type LazySpec
|
||||
return {
|
||||
{
|
||||
"seblyng/roslyn.nvim",
|
||||
ft = { "cs", "razor" },
|
||||
lazy = true,
|
||||
dependencies = {
|
||||
{
|
||||
"tris203/rzls.nvim",
|
||||
opts = function(_, opts)
|
||||
opts = {
|
||||
capabilities = vim.lsp.protocol.make_client_capabilities(),
|
||||
path = vim.fn.get_nix_store "rzls" .. "/bin/rzls",
|
||||
}
|
||||
|
||||
return opts
|
||||
end,
|
||||
},
|
||||
},
|
||||
opts = function(_, opts)
|
||||
local rzlspath = vim.fn.get_nix_store "rzls"
|
||||
require("roslyn.config").get()
|
||||
|
||||
opts = {
|
||||
exe = "Microsoft.CodeAnalysis.LanguageServer",
|
||||
args = {
|
||||
"--stdio",
|
||||
"--logLevel=Information",
|
||||
"--extensionLogDirectory=" .. vim.fs.dirname(vim.lsp.get_log_path()),
|
||||
"--razorSourceGenerator=" .. rzlspath .. "/lib/rzls/Microsoft.CodeAnalysis.Razor.Compiler.dll",
|
||||
"--razorDesignTimePath="
|
||||
.. rzlspath
|
||||
.. "/lib/rzls/Targets/Microsoft.NET.Sdk.Razor.DesignTime.targets",
|
||||
},
|
||||
---@type vim.lsp.ClientConfig
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
config = {
|
||||
handlers = require "rzls.roslyn_handlers",
|
||||
settings = {
|
||||
["csharp|inlay_hints"] = {
|
||||
csharp_enable_inlay_hints_for_implicit_object_creation = true,
|
||||
csharp_enable_inlay_hints_for_implicit_variable_types = true,
|
||||
|
||||
csharp_enable_inlay_hints_for_lambda_parameter_types = true,
|
||||
csharp_enable_inlay_hints_for_types = true,
|
||||
dotnet_enable_inlay_hints_for_indexer_parameters = true,
|
||||
dotnet_enable_inlay_hints_for_literal_parameters = true,
|
||||
dotnet_enable_inlay_hints_for_object_creation_parameters = true,
|
||||
dotnet_enable_inlay_hints_for_other_parameters = true,
|
||||
dotnet_enable_inlay_hints_for_parameters = true,
|
||||
dotnet_suppress_inlay_hints_for_parameters_that_differ_only_by_suffix = true,
|
||||
dotnet_suppress_inlay_hints_for_parameters_that_match_argument_name = true,
|
||||
dotnet_suppress_inlay_hints_for_parameters_that_match_method_intent = true,
|
||||
},
|
||||
["csharp|code_lens"] = {
|
||||
dotnet_enable_references_code_lens = true,
|
||||
},
|
||||
},
|
||||
---@class RoslynPatchedClient: vim.lsp.Client
|
||||
---@field patched boolean?
|
||||
|
||||
---@param client RoslynPatchedClient
|
||||
---@param bufnr integer
|
||||
on_attach = function(client, bufnr)
|
||||
-- Call AstroLSP's on_attach so it registers mappings, formatting, etc.
|
||||
require("astrolsp").on_attach(client, bufnr)
|
||||
|
||||
-- HACK: Patch out the `roslyn-ls` LSP client to have proper
|
||||
-- semantic tokens.
|
||||
-- This is a snippet of code taken and modified from:
|
||||
-- https://github.com/seblyng/roslyn.nvim/wiki#semantic-tokens
|
||||
if client.patched then
|
||||
return
|
||||
else
|
||||
client.patched = true
|
||||
end
|
||||
|
||||
-- let the runtime know the server can do semanticTokens/full now
|
||||
client.server_capabilities = vim.tbl_deep_extend("force", client.server_capabilities, {
|
||||
semanticTokensProvider = {
|
||||
full = true,
|
||||
},
|
||||
})
|
||||
|
||||
local lsp_request = client.request
|
||||
|
||||
client.request = function(method, params, handler, req_bufnr)
|
||||
if method ~= vim.lsp.protocol.Methods.textDocument_semanticTokens_full then
|
||||
return lsp_request(method, params, handler, req_bufnr)
|
||||
end
|
||||
|
||||
local target_bufnr = vim.uri_to_bufnr(params.textDocument.uri)
|
||||
local line_count = vim.api.nvim_buf_line_count(target_bufnr)
|
||||
local last_line =
|
||||
vim.api.nvim_buf_get_lines(target_bufnr, line_count - 1, line_count, true)[1]
|
||||
|
||||
local returnvalue = lsp_request("textDocument/semanticTokens/range", {
|
||||
textDocument = params.textDocument,
|
||||
range = {
|
||||
["start"] = {
|
||||
line = 0,
|
||||
character = 0,
|
||||
},
|
||||
["end"] = {
|
||||
line = line_count - 1,
|
||||
character = string.len(last_line) - 1,
|
||||
},
|
||||
},
|
||||
}, handler, req_bufnr)
|
||||
return returnvalue
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
return opts
|
||||
end,
|
||||
init = function()
|
||||
vim.filetype.add {
|
||||
extension = {
|
||||
razor = "razor",
|
||||
cshtml = "razor",
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-neotest/neotest",
|
||||
dependencies = { "Issafalcon/neotest-dotnet", config = function() end },
|
||||
opts = function(_, opts)
|
||||
if not opts.adapters then
|
||||
opts.adapters = {}
|
||||
end
|
||||
table.insert(opts.adapters, require "neotest-dotnet" (require("astrocore").plugin_opts "neotest-dotnet"))
|
||||
end,
|
||||
},
|
||||
}
|
58
modules/neovim/lua/plugins/treesitter.lua
Normal file
58
modules/neovim/lua/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,58 @@
|
|||
-- Customize Treesitter
|
||||
|
||||
---@type LazySpec
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
---@param _ LazyPlugin
|
||||
---@param opts TSConfig
|
||||
opts = function(_, opts)
|
||||
-- disable automatically installing parsers
|
||||
opts.auto_install = false
|
||||
|
||||
-- add more things to the ensure_installed table protecting against community packs modifying it
|
||||
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed --[[@as string[]], {
|
||||
-- Programming
|
||||
"c",
|
||||
"c_sharp",
|
||||
"cmake",
|
||||
"cpp",
|
||||
"css",
|
||||
"gdscript",
|
||||
"godot_resource",
|
||||
"html",
|
||||
"hyprlang",
|
||||
"javascript",
|
||||
"jsdoc",
|
||||
"lua",
|
||||
"nim",
|
||||
"nim_format_string",
|
||||
"objc",
|
||||
"proto",
|
||||
"python",
|
||||
"razor",
|
||||
"svelte",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vue",
|
||||
-- Scripting
|
||||
"bash",
|
||||
"fish",
|
||||
"glsl",
|
||||
-- Configuring
|
||||
"dockerfile",
|
||||
"json",
|
||||
"jsonc",
|
||||
"nix",
|
||||
"vhs",
|
||||
"yaml",
|
||||
-- Misc
|
||||
"cuda",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"query",
|
||||
-- VIM
|
||||
"vim",
|
||||
"vimdoc",
|
||||
})
|
||||
end,
|
||||
}
|
211
modules/neovim/lua/plugins/user.lua
Normal file
211
modules/neovim/lua/plugins/user.lua
Normal file
|
@ -0,0 +1,211 @@
|
|||
-- You can also add or configure plugins by creating files in this `plugins/` folder
|
||||
-- Here are some examples:
|
||||
|
||||
---@type LazySpec
|
||||
return {
|
||||
-- Customize alpha options
|
||||
{
|
||||
"goolord/alpha-nvim",
|
||||
opts = function(_, opts)
|
||||
-- customize the dashboard header
|
||||
opts.section.header.val = {
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣠⣤⣶⣶⣾⣿⣿⣿⣿⣷⣶⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣶⣾⣿⣿⣿⣿⣷⣶⣶⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⢀⣠⡴⠾⠟⠋⠉⠉⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠉⠉⠙⠛⠷⢦⣄⡀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠘⠋⠁⠀⠀⢀⣀⣤⣶⣖⣒⣒⡲⠶⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⠶⢖⣒⣒⣲⣶⣤⣀⡀⠀⠀⠈⠙⠂⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⣠⢖⣫⣷⣿⣿⣿⣿⣿⣿⣶⣤⡙⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⢋⣤⣾⣿⣿⣿⣿⣿⣿⣾⣝⡲⣄⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⣄⣀⣠⢿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠻⢿⣿⣿⣦⣳⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣟⣴⣿⣿⡿⠟⠻⢿⣿⣿⣿⣿⣿⣿⣿⡻⣄⣀⣤⠀⠀⠀",
|
||||
"⠀⠀⠀⠈⠟⣿⣿⣿⡿⢻⣿⣿⣿⠃⠀⠀⠀⠀⠙⣿⣿⣿⠓⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠚⣿⣿⣿⠋⠀⠀⠀⠀⠘⣿⣿⣿⡟⢿⣿⣿⣟⠻⠁⠀⠀⠀",
|
||||
"⠤⣤⣶⣶⣿⣿⣿⡟⠀⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⢻⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⡏⠀⠀⠀⠀⠀⠀⣹⣿⣿⣷⠈⢻⣿⣿⣿⣶⣦⣤⠤",
|
||||
"⠀⠀⠀⠀⠀⢻⣟⠀⠀⣿⣿⣿⣿⡀⠀⠀⠀⠀⢀⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢻⣿⣿⡀⠀⠀⠀⠀⢀⣿⣿⣿⣿⠀⠀⣿⡟⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠻⣆⠀⢹⣿⠟⢿⣿⣦⣤⣤⣴⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡿⢷⣤⣤⣤⣴⣿⣿⣿⣿⡇⠀⣰⠟⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠙⠂⠀⠙⢀⣀⣿⣿⣿⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⠁⠀⣻⣿⣿⣿⣿⣿⣿⠏⠀⠘⠃⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡈⠻⠿⣿⣿⣿⡿⠟⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠻⢿⣿⣿⣿⠿⠛⢁⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠚⠛⣶⣦⣤⣤⣤⡤⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠰⢤⣤⣤⣤⣶⣾⠛⠓⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
}
|
||||
return opts
|
||||
end,
|
||||
},
|
||||
|
||||
-- Add the catppuccin colorscheme
|
||||
{
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
priority = 1000,
|
||||
---@type CatppuccinOptions
|
||||
opts = {
|
||||
integrations = {
|
||||
aerial = true,
|
||||
alpha = true,
|
||||
cmp = true,
|
||||
dap = true,
|
||||
dap_ui = true,
|
||||
gitsigns = true,
|
||||
illuminate = true,
|
||||
indent_blankline = true,
|
||||
markdown = true,
|
||||
mason = true,
|
||||
native_lsp = { enabled = true },
|
||||
neotree = true,
|
||||
notify = true,
|
||||
semantic_tokens = true,
|
||||
symbols_outline = true,
|
||||
telescope = true,
|
||||
treesitter = true,
|
||||
ts_rainbow = false,
|
||||
ufo = true,
|
||||
which_key = true,
|
||||
window_picker = true,
|
||||
colorful_winsep = { enabled = true, color = "lavender" },
|
||||
},
|
||||
},
|
||||
specs = {
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
return require("astrocore").extend_tbl(opts, {
|
||||
highlights = require("catppuccin.groups.integrations.bufferline").get(),
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Makes most if not all groups have a transparent background.
|
||||
{
|
||||
"xiyaowong/transparent.nvim",
|
||||
opts = function(_, opts)
|
||||
local transparent = require "transparent"
|
||||
|
||||
opts.groups = {
|
||||
"Comment",
|
||||
"Conditional",
|
||||
"Constant",
|
||||
"CursorLine",
|
||||
"CursorLineNr",
|
||||
"EndOfBuffer",
|
||||
"Function",
|
||||
"Identifier",
|
||||
"LineNr",
|
||||
"NonText",
|
||||
"Normal",
|
||||
"NormalNC",
|
||||
"Operator",
|
||||
"PreProc",
|
||||
"Repeat",
|
||||
"SignColumn",
|
||||
"Special",
|
||||
"Statement",
|
||||
-- "StatusLine",
|
||||
-- "StatusLineNC",
|
||||
"String",
|
||||
"Structure",
|
||||
"Todo",
|
||||
"Type",
|
||||
"Underlined",
|
||||
}
|
||||
|
||||
opts.extra_groups = {
|
||||
"CursorColumn",
|
||||
"CursorLineFold",
|
||||
"CursorLineSign",
|
||||
"FloatBorder",
|
||||
"FoldColumn",
|
||||
"Folded",
|
||||
"GitSignsAdd",
|
||||
"GitSignsChange",
|
||||
"GitSignsDelete",
|
||||
"LineNr",
|
||||
"LineNrAbove",
|
||||
"LineNrBelow",
|
||||
"LineNrBelow",
|
||||
"NeoTreeFloatingBorder",
|
||||
"NeoTreeMessage",
|
||||
"NeoTreeNormal",
|
||||
"NeoTreeTabSeparatorActive",
|
||||
"NeoTreeTabSeparatorInactive",
|
||||
"NeoTreeVertSplit",
|
||||
"NeoTreeWinSeparator",
|
||||
"NeoTreeNormalNC",
|
||||
"NeoTreeTabActive",
|
||||
"NeoTreeStatusLine",
|
||||
"NeoTreeStatusLineNC",
|
||||
"NeoTreeTabInactive",
|
||||
"NormalFloat",
|
||||
"TabLine",
|
||||
"TabLineFill",
|
||||
"VertSplit",
|
||||
"WinBar",
|
||||
"WinBarNC",
|
||||
"WinSeparator",
|
||||
}
|
||||
|
||||
transparent.clear_prefix "BufferLine"
|
||||
transparent.clear_prefix "Diagnostic"
|
||||
transparent.clear_prefix "NvimTree"
|
||||
end,
|
||||
},
|
||||
|
||||
-- Adds highlighting and lsp features for embedded code in documents.
|
||||
{
|
||||
"jmbuhr/otter.nvim",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
opts = {},
|
||||
},
|
||||
|
||||
-- Adds highlighting and custom commands for ledger files
|
||||
{
|
||||
"ledger/vim-ledger",
|
||||
},
|
||||
|
||||
-- Better UI hooks
|
||||
{
|
||||
"stevearc/dressing.nvim",
|
||||
},
|
||||
|
||||
-- Add Ollama support in-editor
|
||||
{
|
||||
"nomnivore/ollama.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
|
||||
-- All the user commands added by the plugin
|
||||
cmd = { "Ollama", "OllamaModel", "OllamaServe", "OllamaServeStop" },
|
||||
|
||||
keys = {
|
||||
-- Sample keybind for prompt menu. Note that the <c-u> is important for selections to work properly.
|
||||
{
|
||||
"<leader>oo",
|
||||
":<c-u>lua require('ollama').prompt()<cr>",
|
||||
desc = "ollama prompt",
|
||||
mode = { "n", "v" },
|
||||
},
|
||||
|
||||
-- Sample keybind for direct prompting. Note that the <c-u> is important for selections to work properly.
|
||||
{
|
||||
"<leader>oG",
|
||||
":<c-u>lua require('ollama').prompt('Generate_Code')<cr>",
|
||||
desc = "ollama Generate Code",
|
||||
mode = { "n", "v" },
|
||||
},
|
||||
},
|
||||
|
||||
---@type Ollama.Config
|
||||
opts = {
|
||||
-- your configuration overrides
|
||||
},
|
||||
},
|
||||
}
|
16
modules/neovim/lua/polish.lua
Normal file
16
modules/neovim/lua/polish.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
-- This will run last in the setup process and is a good place to configure
|
||||
-- things like custom filetypes. This just pure lua so anything that doesn't
|
||||
-- fit in the normal config locations above can go here
|
||||
|
||||
-- Set up custom filetypes
|
||||
vim.filetype.add {
|
||||
extension = {
|
||||
foo = "fooscript",
|
||||
},
|
||||
filename = {
|
||||
["Foofile"] = "fooscript",
|
||||
},
|
||||
pattern = {
|
||||
["~/%.config/foo/.*"] = "fooscript",
|
||||
},
|
||||
}
|
31
modules/neovim/lua/util.lua
Normal file
31
modules/neovim/lua/util.lua
Normal file
|
@ -0,0 +1,31 @@
|
|||
--- Helper function to allow me to run commands grabbed
|
||||
--- by the current selection.
|
||||
--- @param isLua boolean
|
||||
--- @return string
|
||||
vim.fn.runcmdonmark = function(isLua)
|
||||
local beginRow, beginCol = unpack(vim.api.nvim_buf_get_mark(0, "<"))
|
||||
local endRow, endCol = unpack(vim.api.nvim_buf_get_mark(0, ">"))
|
||||
|
||||
if beginRow == nil or beginCol == nil or endRow == nil or endCol == nil then
|
||||
return ""
|
||||
end
|
||||
|
||||
local text = table.concat(
|
||||
vim.tbl_map(function(incoming)
|
||||
return vim.trim(incoming)
|
||||
end, vim.api.nvim_buf_get_text(0, beginRow - 1, beginCol, endRow - 1, endCol + 1, {})),
|
||||
" "
|
||||
)
|
||||
|
||||
vim.notify("Running expression: " .. text, vim.log.levels.INFO)
|
||||
|
||||
return vim.api.nvim_cmd(
|
||||
vim.api.nvim_parse_cmd((isLua == true and ":lua " or "") .. text, {}) --[[@as vim.api.keyset.cmd]],
|
||||
{}
|
||||
)
|
||||
end
|
||||
|
||||
--- Register the function as a command as well, to facilitate things.
|
||||
vim.api.nvim_create_user_command("RunCmdOnMark", function(opts)
|
||||
vim.fn.runcmdonmark((opts.args == "v:false" or opts.args == "false") and false or true)
|
||||
end, { range = true, nargs = "?" })
|
16
modules/neovim/queries/c_sharp/folds.scm
Normal file
16
modules/neovim/queries/c_sharp/folds.scm
Normal file
|
@ -0,0 +1,16 @@
|
|||
;; extends
|
||||
|
||||
; Capture entire regions for folding
|
||||
(
|
||||
(preproc_region) @region_begin
|
||||
.
|
||||
[
|
||||
(comment)
|
||||
(declaration)
|
||||
(statement)
|
||||
(type_declaration)
|
||||
]*
|
||||
.
|
||||
(preproc_endregion) @region_end (#offset! @region_end 0 0 -1 0)
|
||||
(#make-range! "fold" @region_begin @region_end)
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue