feat(home/base/tui/editors/neovim): upgrade astronvim to v4

This commit is contained in:
Ryan Yin
2024-04-13 00:11:32 +08:00
parent a593435947
commit c5dcc7e24d
41 changed files with 1081 additions and 663 deletions

View File

@@ -9,4 +9,5 @@ binary = false
extend-ignore-re = [
"iterm2",
"iHgEIBYKACAWIQSizQe9ljFEyyclWmtVhZllwnQrSwUCZZ1T9wIdAAAKCRBVhZll", # crypto keys
"noice", # noice.nvim
]

View File

@@ -1,2 +0,0 @@
.clj-kondo/
.nrepl-port

View File

@@ -1 +0,0 @@
{:source-file-patterns ["*.fnl" "**/*.fnl"]}

View File

@@ -1,579 +0,0 @@
return {
colorscheme = "catppuccin",
options = {
opt = {
relativenumber = true, -- Show relative numberline
signcolumn = "auto", -- Show sign column when used only
spell = false, -- Spell checking
swapfile = false, -- Swapfile
smartindent = false, -- fix https://github.com/ryan4yin/nix-config/issues/4
title = true, -- Set the title of window to `filename [+=-] (path) - NVIM`
-- The percentage of 'columns' to use for the title
-- When the title is longer, only the end of the path name is shown.
titlelen = 20,
},
},
plugins = {
"AstroNvim/astrocommunity",
-- Motion
{ import = "astrocommunity.motion.mini-surround" },
-- https://github.com/echasnovski/mini.ai
{ import = "astrocommunity.motion.mini-ai" },
{ import = "astrocommunity.motion.flash-nvim" },
-- disable toggleterm.nvim, zellij's terminal is far better than neovim's one
{ "akinsho/toggleterm.nvim", enabled = false },
{ "folke/flash.nvim", vscode = false },
-- Highly experimental plugin that completely replaces
-- the UI for messages, cmdline and the popupmenu.
-- { import = "astrocommunity.utility.noice-nvim" },
-- Fully featured & enhanced replacement for copilot.vim
-- <Tab> work with both auto completion in cmp and copilot
{ import = "astrocommunity.media.vim-wakatime" },
{ import = "astrocommunity.motion.leap-nvim" },
{ import = "astrocommunity.motion.flit-nvim" },
{ import = "astrocommunity.scrolling.nvim-scrollbar" },
{ import = "astrocommunity.editing-support.todo-comments-nvim" },
-- Language Support
---- Frontend & NodeJS
{ import = "astrocommunity.pack.typescript-all-in-one" },
{ import = "astrocommunity.pack.tailwindcss" },
{ import = "astrocommunity.pack.html-css" },
{ import = "astrocommunity.pack.prisma" },
{ import = "astrocommunity.pack.vue" },
---- Configuration Language
{ import = "astrocommunity.pack.markdown" },
{ import = "astrocommunity.pack.json" },
{ import = "astrocommunity.pack.yaml" },
{ import = "astrocommunity.pack.toml" },
---- Backend / System
{ import = "astrocommunity.pack.lua" },
{ import = "astrocommunity.pack.go" },
{ import = "astrocommunity.pack.rust" },
{ import = "astrocommunity.pack.python" },
{ import = "astrocommunity.pack.java" },
{ import = "astrocommunity.pack.cmake" },
{ import = "astrocommunity.pack.cpp" },
-- { import = "astrocommunity.pack.nix" }, -- manually add config for nix, comment this one.
{ import = "astrocommunity.pack.proto" },
---- Operation & Cloud Native
{ import = "astrocommunity.pack.terraform" },
{ import = "astrocommunity.pack.bash" },
{ import = "astrocommunity.pack.docker" },
{ import = "astrocommunity.pack.helm" },
-- colorscheme
{ import = "astrocommunity.colorscheme.catppuccin" },
{
"catppuccin/nvim",
name = "catppuccin",
opts = function(_, opts)
opts.flavour = "mocha" -- latte, frappe, macchiato, mocha
opts.transparent_background = true -- setting the background color.
end,
},
-- Language Parser for syntax highlighting / indentation / folding / Incremental selection
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
local utils = require("astronvim.utils")
opts.incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>", -- Ctrl + Space
node_incremental = "<C-space>",
scope_incremental = "<A-space>", -- Alt + Space
node_decremental = "<bs>", -- Backspace
},
}
opts.ignore_install = { "gotmpl" }
opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, {
-- neovim
"vim",
"lua",
-- operation & cloud native
"dockerfile",
"hcl",
"jsonnet",
"regex",
"terraform",
"nix",
"csv",
-- other programming language
"diff",
"gitignore",
"gitcommit",
"latex",
"sql",
-- Lisp like
"fennel",
"clojure",
"commonlisp",
-- customized languages:
"scheme",
})
-- add support for scheme
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.scheme = {
install_info = {
url = "https://github.com/6cdh/tree-sitter-scheme", -- local path or git repo
files = { "src/parser.c" },
-- optional entries:
branch = "main", -- default branch in case of git repo if different from master
generate_requires_npm = false, -- if stand-alone parser without npm dependencies
requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c
},
}
-- use scheme parser for filetypes: scm
vim.treesitter.language.register("scheme", "scm")
end,
},
{
"eraserhd/parinfer-rust",
build = "cargo build --release",
ft = { "scm", "scheme" },
},
{ "Olical/nfnl", ft = "fennel" },
{
"Olical/conjure",
ft = { "clojure", "fennel", "python", "scheme" }, -- etc
-- [Optional] cmp-conjure for cmp
dependencies = {
{
"PaterJason/cmp-conjure",
config = function()
local cmp = require("cmp")
local config = cmp.get_config()
table.insert(config.sources, {
name = "buffer",
option = {
sources = {
{ name = "conjure" },
},
},
})
cmp.setup(config)
end,
},
},
config = function(_, opts)
require("conjure.main").main()
require("conjure.mapping")["on-filetype"]()
end,
init = function()
-- Set configuration options here
vim.g["conjure#debug"] = true
end,
},
{
"nvim-orgmode/orgmode",
dependencies = {
{ "nvim-treesitter/nvim-treesitter", lazy = true },
},
event = "VeryLazy",
config = function()
-- Load treesitter grammar for org
require("orgmode").setup_ts_grammar()
-- Setup treesitter
require("nvim-treesitter.configs").setup({
highlight = {
enable = true,
additional_vim_regex_highlighting = { "org" },
},
ensure_installed = { "org" },
})
-- Setup orgmode
require("orgmode").setup({
org_agenda_files = "~/org/**/*",
org_default_notes_file = "~/org/refile.org",
})
end,
},
-- Lua implementation of CamelCaseMotion, with extra consideration of punctuation.
{ import = "astrocommunity.motion.nvim-spider" },
-- AI Assistant
{ import = "astrocommunity.completion.copilot-lua-cmp" },
-- Custom copilot-lua to enable filetypes: markdown
{
"zbirenbaum/copilot.lua",
opts = function(_, opts)
opts.filetypes = {
yaml = true,
markdown = true,
}
end,
},
{
"0x00-ketsu/autosave.nvim",
-- lazy-loading on events
event = { "InsertLeave", "TextChanged" },
opts = function(_, opts)
opts.prompt_style = "stdout" -- notify or stdout
end,
},
-- markdown preview
{
"0x00-ketsu/markdown-preview.nvim",
ft = { "md", "markdown", "mkd", "mkdn", "mdwn", "mdown", "mdtxt", "mdtext", "rmd", "wiki" },
config = function()
require("markdown-preview").setup({
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the setup section below
})
end,
},
-- clipboard manager
{
"gbprod/yanky.nvim",
opts = function()
local mapping = require("yanky.telescope.mapping")
local mappings = mapping.get_defaults()
mappings.i["<c-p>"] = nil
return {
highlight = { timer = 200 },
picker = {
telescope = {
use_default_mappings = false,
mappings = mappings,
},
},
}
end,
keys = {
{
"y",
"<Plug>(YankyYank)",
mode = { "n", "x" },
desc = "Yank text",
},
{
"p",
"<Plug>(YankyPutAfter)",
mode = { "n", "x" },
desc = "Put yanked text after cursor",
},
{
"P",
"<Plug>(YankyPutBefore)",
mode = { "n", "x" },
desc = "Put yanked text before cursor",
},
{
"gp",
"<Plug>(YankyGPutAfter)",
mode = { "n", "x" },
desc = "Put yanked text after selection",
},
{
"gP",
"<Plug>(YankyGPutBefore)",
mode = { "n", "x" },
desc = "Put yanked text before selection",
},
{ "[y", "<Plug>(YankyCycleForward)", desc = "Cycle forward through yank history" },
{ "]y", "<Plug>(YankyCycleBackward)", desc = "Cycle backward through yank history" },
{ "]p", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" },
{ "[p", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" },
{ "]P", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" },
{ "[P", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" },
{ ">p", "<Plug>(YankyPutIndentAfterShiftRight)", desc = "Put and indent right" },
{ "<p", "<Plug>(YankyPutIndentAfterShiftLeft)", desc = "Put and indent left" },
{ ">P", "<Plug>(YankyPutIndentBeforeShiftRight)", desc = "Put before and indent right" },
{ "<P", "<Plug>(YankyPutIndentBeforeShiftLeft)", desc = "Put before and indent left" },
{ "=p", "<Plug>(YankyPutAfterFilter)", desc = "Put after applying a filter" },
{ "=P", "<Plug>(YankyPutBeforeFilter)", desc = "Put before applying a filter" },
},
},
-- Enhanced matchparen.vim plugin for Neovim to highlight the outer pair.
{
"utilyre/sentiment.nvim",
version = "*",
event = "VeryLazy", -- keep for lazy loading
opts = {
-- config
},
init = function()
-- `matchparen.vim` needs to be disabled manually in case of lazy loading
vim.g.loaded_matchparen = 1
end,
},
-- joining blocks of code into oneline, or splitting one line into multiple lines.
{
"Wansmer/treesj",
keys = { "<space>m", "<space>j", "<space>s" },
dependencies = { "nvim-treesitter/nvim-treesitter" },
config = function()
require("treesj").setup({ --[[ your config ]]
})
end,
},
-- File explorer(Custom configs)
{
"nvim-neo-tree/neo-tree.nvim",
opts = {
filesystem = {
filtered_items = {
visible = true, -- visible by default
hide_dotfiles = false,
hide_gitignored = false,
},
},
},
},
-- The plugin offers the alibity to refactor code.
{
"ThePrimeagen/refactoring.nvim",
dependencies = {
{ "nvim-lua/plenary.nvim" },
{ "nvim-treesitter/nvim-treesitter" },
},
},
-- The plugin offers the abilibty to search and replace.
{
"nvim-pack/nvim-spectre",
dependencies = {
{ "nvim-lua/plenary.nvim" },
},
},
-- full signature help, docs and completion for the nvim lua API.
{ "folke/neodev.nvim", opts = {} },
-- automatically highlighting other uses of the word under the cursor using either LSP, Tree-sitter, or regex matching.
{ "RRethy/vim-illuminate", config = function() end },
-- implementation/definition preview
{
"rmagatti/goto-preview",
config = function()
require("goto-preview").setup({})
end,
},
-- Undo tree
{ "debugloop/telescope-undo.nvim" },
-- Install lsp, formmatter and others via home manager instead of Mason.nvim
-- LSP installations
{
"williamboman/mason-lspconfig.nvim",
-- mason is unusable on NixOS, disable it.
-- ensure_installed nothing
opts = function(_, opts)
opts.ensure_installed = nil
opts.automatic_installation = false
end,
},
-- Formatters/Linter installation
{
"jay-babu/mason-null-ls.nvim",
-- mason is unusable on NixOS, disable it.
-- ensure_installed nothing
opts = function(_, opts)
opts.ensure_installed = nil
opts.automatic_installation = false
end,
},
-- Debugger installation
{
"jay-babu/mason-nvim-dap.nvim",
-- mason is unusable on NixOS, disable it.
-- ensure_installed nothing
opts = function(_, opts)
opts.ensure_installed = nil
opts.automatic_installation = false
end,
},
{
"jose-elias-alvarez/null-ls.nvim",
opts = function(_, opts)
local null_ls = require("null-ls")
local code_actions = null_ls.builtins.code_actions
local diagnostics = null_ls.builtins.diagnostics
local formatting = null_ls.builtins.formatting
local hover = null_ls.builtins.hover
local completion = null_ls.builtins.completion
-- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md
if type(opts.sources) == "table" then
vim.list_extend(opts.sources, {
-- Common Code Actions
code_actions.gitsigns,
-- common refactoring actions based off the Refactoring book by Martin Fowler
code_actions.refactoring,
code_actions.gomodifytags, -- Go - modify struct field tags
code_actions.impl, -- Go - generate interface method stubs
code_actions.shellcheck,
code_actions.proselint, -- English prose linter
code_actions.statix, -- Lints and suggestions for Nix.
-- Diagnostic
diagnostics.actionlint, -- GitHub Actions workflow syntax checking
diagnostics.buf, -- check text in current buffer
diagnostics.checkmake, -- check Makefiles
diagnostics.deadnix, -- Scan Nix files for dead code.
-- Formatting
formatting.prettier, -- js/ts/vue/css/html/json/... formatter
diagnostics.hadolint, -- Dockerfile linter
formatting.black, -- Python formatter
formatting.ruff, -- extremely fast Python linter
formatting.goimports, -- Go formatter
formatting.shfmt, -- Shell formatter
formatting.rustfmt, -- Rust formatter
formatting.taplo, -- TOML formatteautoindentr
formatting.terraform_fmt, -- Terraform formatter
formatting.stylua, -- Lua formatter
formatting.alejandra, -- Nix formatter
formatting.sqlfluff.with({ -- SQL formatter
extra_args = { "--dialect", "postgres" }, -- change to your dialect
}),
formatting.nginx_beautifier, -- Nginx formatter
formatting.verible_verilog_format, -- Verilog formatter
formatting.emacs_scheme_mode, -- using emacs in batch mode to format scheme files.
formatting.fnlfmt, -- Format Fennel code
})
end
end,
},
{
"nvim-telescope/telescope.nvim",
branch = "0.1.x",
dependencies = { "nvim-lua/plenary.nvim" },
init = function()
-- 1. Disable highlighting for certain filetypes
-- 2. Ignore files larger than a certain filesize
local previewers = require("telescope.previewers")
local _bad = { ".*%.csv", ".*%.min.js" } -- Put all filetypes that slow you down in this array
local filesize_threshold = 300 * 1024 -- 300KB
local bad_files = function(filepath)
for _, v in ipairs(_bad) do
if filepath:match(v) then
return false
end
end
return true
end
local new_maker = function(filepath, bufnr, opts)
opts = opts or {}
if opts.use_ft_detect == nil then
opts.use_ft_detect = true
end
-- 1. Check if the file is in the bad_files array, and if so, don't highlight it
opts.use_ft_detect = opts.use_ft_detect == false and false or bad_files(filepath)
-- 2. Check the file size, and ignore it if it's too big(preview nothing).
filepath = vim.fn.expand(filepath)
vim.loop.fs_stat(filepath, function(_, stat)
if not stat then
return
end
if stat.size > filesize_threshold then
return
else
previewers.buffer_previewer_maker(filepath, bufnr, opts)
end
end)
end
require("telescope").setup({
defaults = {
buffer_previewer_maker = new_maker,
},
})
end,
},
},
-- Configure require("lazy").setup() options
lazy = {
defaults = { lazy = true },
performance = {
rtp = {
-- customize default disabled vim plugins
disabled_plugins = {},
},
},
},
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
lsp = {
config = {
-- the offset_encoding of clangd will confilicts whit null-ls
-- so we need to manually set it to utf-8
clangd = {
capabilities = {
offsetEncoding = "utf-8",
},
},
scheme_langserver = {
filetypes = { "scheme", "scm" },
single_file_support = true,
},
},
-- enable servers that installed by home-manager instead of mason
servers = {
---- Frontend & NodeJS
"tsserver", -- typescript/javascript language server
"tailwindcss", -- tailwindcss language server
"html", -- html language server
"cssls", -- css language server
"prismals", -- prisma language server
"volar", -- vue language server
---- Configuration Language
"marksman", -- markdown ls
"jsonls", -- json language server
"yamlls", -- yaml language server
"taplo", -- toml language server
---- Backend
"lua_ls", -- lua
"gopls", -- go
"rust_analyzer", -- rust
"pyright", -- python
"ruff_lsp", -- extremely fast Python linter and code transformation
"jdtls", -- java
"nil_ls", -- nix language server
"bufls", -- protocol buffer language server
"zls", -- zig language server
---- HDL
"verible", -- verilog language server
---- Operation & Cloud Nativautoindente
"bashls", -- bash
"cmake", -- cmake language server
"clangd", -- c/c++
"dockerls", -- dockerfile
"jsonnet_ls", -- jsonnet language server
"terraformls", -- terraform hcl
"nushell", -- nushell language server
"scheme_langserver", -- scheme language server
},
formatting = {
disabled = {},
format_on_save = {
enabled = true,
allow_filetypes = {
"go",
"jsonnet",
"rust",
"terraform",
"nu",
},
},
},
},
}

View File

@@ -1,66 +0,0 @@
-- Mapping data with "desc" stored directly by vim.keymap.set().
--
-- Please use this mappings table to set keyboard mapping since this is the
-- lower level configuration and more robust one. (which-key will
-- automatically pick-up stored data by this setting.)
local utils = require "astronvim.utils"
require("telescope").load_extension("refactoring")
require("telescope").load_extension("yank_history")
require("telescope").load_extension("undo")
return {
-- normal mode
n = {
-- second key is the lefthand side of the map
-- mappings seen under group name "Buffer"
["<leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" },
-- quick save
["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
-- Terminal
-- NOTE: https://neovim.io/doc/user/builtin.html#jobstart()
-- 1. If {cmd} is a List it runs directly (no 'shell')
-- 2. If {cmd} is a String it runs in the 'shell'
-- search and replace globally
['<leader>ss'] = {'<cmd>lua require("spectre").toggle()<CR>', desc = "Toggle Spectre" },
['<leader>sw'] = {'<cmd>lua require("spectre").open_visual({select_word=true})<CR>', desc = "Search current word" },
['<leader>sp'] ={'<cmd>lua require("spectre").open_file_search({select_word=true})<CR>', desc = "Search on current file" },
-- refactoring
["<leader>ri"] = { function() require('refactoring').refactor('Inline Variable') end, desc = "Inverse of extract variable" },
["<leader>rb"] = { function() require('refactoring').refactor('Extract Block') end, desc = "Extract Block" },
["<leader>rbf"] = { function() require('refactoring').refactor('Extract Block To File') end, desc = "Extract Block To File" },
["<leader>rr"] = { function() require('telescope').extensions.refactoring.refactors() end, desc = "Prompt for a refactor to apply" },
["<leader>rp"] = { function() require('refactoring').debug.printf({below = false}) end, desc = "Insert print statement to mark the calling of a function" },
["<leader>rv"] = { function() require('refactoring').debug.print_var() end, desc = "Insert print statement to print a variable" },
["<leader>rc"] = { function() require('refactoring').debug.cleanup({}) end, desc = "Cleanup of all generated print statements" },
-- yank_history
["<leader>yh"] = { function() require("telescope").extensions.yank_history.yank_history() end, desc = "Preview Yank History" },
-- undo history
["<leader>uh"] = {"<cmd>Telescope undo<cr>", desc="Telescope undo" },
-- implementation/definition preview
["gpd"] = { "<cmd>lua require('goto-preview').goto_preview_definition()<CR>", desc="goto_preview_definition" },
["gpt"] = { "<cmd>lua require('goto-preview').goto_preview_type_definition()<CR>", desc="goto_preview_type_definition" },
["gpi"] = { "<cmd>lua require('goto-preview').goto_preview_implementation()<CR>", desc="goto_preview_implementation" },
["gP" ] = { "<cmd>lua require('goto-preview').close_all_win()<CR>", desc="close_all_win" },
["gpr"] = { "<cmd>lua require('goto-preview').goto_preview_references()<CR>", desc="goto_preview_references" },
},
-- Visual mode
v = {
-- search and replace globally
['<leader>sw'] = {'<esc><cmd>lua require("spectre").open_visual()<CR>', desc = "Search current word" },
},
-- visual mode(what's the difference between v and x???)
x = {
-- refactoring
["<leader>ri"] = { function() require('refactoring').refactor('Inline Variable') end, desc = "Inverse of extract variable" },
["<leader>re"] = { function() require('refactoring').refactor('Extract Function') end, desc = "Extracts the selected code to a separate function" },
["<leader>rf"] = { function() require('refactoring').refactor('Extract Function To File') end, desc = "Extract Function To File" },
["<leader>rv"] = { function() require('refactoring').refactor('Extract Variable') end, desc = "Extracts occurrences of a selected expression to its own variable" },
["<leader>rr"] = { function() require('telescope').extensions.refactoring.refactors() end, desc = "Prompt for a refactor to apply" },
},
}

View File

@@ -1,6 +1,7 @@
{
config,
lib,
pkgs,
astronvim,
...
}:
###############################################################################
@@ -14,20 +15,9 @@ let
vdiff = "nvim -d";
};
in {
xdg.configFile = {
# astronvim's config
"nvim" = {
source = astronvim;
force = true;
};
# my custom astronvim config, astronvim will load it after base config
# https://github.com/AstroNvim/AstroNvim/blob/v3.32.0/lua/astronvim/bootstrap.lua#L15-L16
"astronvim/lua/user" = {
source = ./astronvim_user;
force = true;
};
};
home.activation.installAstroNvim = lib.hm.dag.entryAfter ["writeBoundary"] ''
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F744 ${./nvim}/ ${config.xdg.configHome}/nvim/
'';
home.shellAliases = shellAliases;
programs.nushell.shellAliases = shellAliases;

View File

@@ -0,0 +1,20 @@
{
"neodev": {
"library": {
"enabled": true,
"plugins": true
}
},
"neoconf": {
"plugins": {
"lua_ls": {
"enabled": true
}
}
},
"lspconfig": {
"lua_ls": {
"Lua.format.enable": false
}
}
}

View File

@@ -0,0 +1,19 @@
-- 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 "lazy_setup"
require "polish"

View File

@@ -0,0 +1,61 @@
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
-- 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",
-- Motion
{ import = "astrocommunity.motion.mini-surround" },
-- https://github.com/echasnovski/mini.ai
{ import = "astrocommunity.motion.mini-ai" },
{ import = "astrocommunity.motion.flash-nvim" },
-- Highly experimental plugin that completely replaces
-- the UI for messages, cmdline and the popupmenu.
-- { import = "astrocommunity.utility.noice-nvim" },
-- Fully featured & enhanced replacement for copilot.vim
-- <Tab> work with both auto completion in cmp and copilot
{ import = "astrocommunity.media.vim-wakatime" },
{ import = "astrocommunity.motion.leap-nvim" },
{ import = "astrocommunity.motion.flit-nvim" },
{ import = "astrocommunity.scrolling.nvim-scrollbar" },
{ import = "astrocommunity.editing-support.todo-comments-nvim" },
-- Language Support
---- Frontend & NodeJS
{ import = "astrocommunity.pack.typescript-all-in-one" },
{ import = "astrocommunity.pack.tailwindcss" },
{ import = "astrocommunity.pack.html-css" },
{ import = "astrocommunity.pack.prisma" },
{ import = "astrocommunity.pack.vue" },
---- Configuration Language
{ import = "astrocommunity.pack.markdown" },
{ import = "astrocommunity.pack.json" },
{ import = "astrocommunity.pack.yaml" },
{ import = "astrocommunity.pack.toml" },
---- Backend / System
{ import = "astrocommunity.pack.lua" },
{ import = "astrocommunity.pack.go" },
{ import = "astrocommunity.pack.rust" },
{ import = "astrocommunity.pack.python" },
{ import = "astrocommunity.pack.java" },
{ import = "astrocommunity.pack.cmake" },
{ import = "astrocommunity.pack.cpp" },
-- { import = "astrocommunity.pack.nix" }, -- manually add config for nix, comment this one.
{ import = "astrocommunity.pack.proto" },
---- Operation & Cloud Native
{ import = "astrocommunity.pack.terraform" },
{ import = "astrocommunity.pack.bash" },
{ import = "astrocommunity.pack.docker" },
{ import = "astrocommunity.pack.helm" },
-- colorscheme
{ import = "astrocommunity.colorscheme.catppuccin" },
-- Lua implementation of CamelCaseMotion, with extra consideration of punctuation.
{ import = "astrocommunity.motion.nvim-spider" },
-- AI Assistant
{ import = "astrocommunity.completion.copilot-lua-cmp" },
}

View File

@@ -0,0 +1,31 @@
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 = { "catppuccin"}, },
ui = { backdrop = 100 },
performance = {
rtp = {
-- disable some rtp plugins, add more to your liking
disabled_plugins = {
"gzip",
"netrwPlugin",
"tarPlugin",
"tohtml",
"zipPlugin",
},
},
},
} --[[@as LazyConfig]])

View File

@@ -0,0 +1,179 @@
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
-- 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
require("telescope").load_extension "refactoring"
require("telescope").load_extension "yank_history"
require("telescope").load_extension "undo"
---@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>
relativenumber = true, -- Show relative numberline
signcolumn = "auto", -- Show sign column when used only
spell = false, -- Spell checking
swapfile = false, -- Swapfile
smartindent = false, -- fix https://github.com/ryan4yin/nix-config/issues/4
title = true, -- Set the title of window to `filename [+=-] (path) - NVIM`
-- The percentage of 'columns' to use for the title
-- When the title is longer, only the end of the path name is shown.
titlelen = 20,
},
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.count1) end, desc = "Next buffer" },
H = { function() require("astrocore.buffer").nav(-vim.v.count1) 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" },
-- second key is the lefthand side of the map
-- mappings seen under group name "Buffer"
["<leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" },
-- quick save
["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
-- Terminal
-- NOTE: https://neovim.io/doc/user/builtin.html#jobstart()
-- 1. If {cmd} is a List it runs directly (no 'shell')
-- 2. If {cmd} is a String it runs in the 'shell'
-- search and replace globally
["<leader>ss"] = { '<cmd>lua require("spectre").toggle()<CR>', desc = "Toggle Spectre" },
["<leader>sw"] = {
'<cmd>lua require("spectre").open_visual({select_word=true})<CR>',
desc = "Search current word",
},
["<leader>sp"] = {
'<cmd>lua require("spectre").open_file_search({select_word=true})<CR>',
desc = "Search on current file",
},
-- refactoring
["<leader>ri"] = {
function() require("refactoring").refactor "Inline Variable" end,
desc = "Inverse of extract variable",
},
["<leader>rb"] = { function() require("refactoring").refactor "Extract Block" end, desc = "Extract Block" },
["<leader>rbf"] = {
function() require("refactoring").refactor "Extract Block To File" end,
desc = "Extract Block To File",
},
["<leader>rr"] = {
function() require("telescope").extensions.refactoring.refactors() end,
desc = "Prompt for a refactor to apply",
},
["<leader>rp"] = {
function() require("refactoring").debug.printf { below = false } end,
desc = "Insert print statement to mark the calling of a function",
},
["<leader>rv"] = {
function() require("refactoring").debug.print_var() end,
desc = "Insert print statement to print a variable",
},
["<leader>rc"] = {
function() require("refactoring").debug.cleanup {} end,
desc = "Cleanup of all generated print statements",
},
-- yank_history
["<leader>yh"] = {
function() require("telescope").extensions.yank_history.yank_history() end,
desc = "Preview Yank History",
},
-- undo history
["<leader>uh"] = { "<cmd>Telescope undo<cr>", desc = "Telescope undo" },
-- implementation/definition preview
["gpd"] = { "<cmd>lua require('goto-preview').goto_preview_definition()<CR>", desc = "goto_preview_definition" },
["gpt"] = {
"<cmd>lua require('goto-preview').goto_preview_type_definition()<CR>",
desc = "goto_preview_type_definition",
},
["gpi"] = {
"<cmd>lua require('goto-preview').goto_preview_implementation()<CR>",
desc = "goto_preview_implementation",
},
["gP"] = { "<cmd>lua require('goto-preview').close_all_win()<CR>", desc = "close_all_win" },
["gpr"] = { "<cmd>lua require('goto-preview').goto_preview_references()<CR>", desc = "goto_preview_references" },
},
t = {
-- setting a mapping to false will disable it
-- ["<esc>"] = false,
},
-- Visual mode
v = {
-- search and replace globally
["<leader>sw"] = { '<esc><cmd>lua require("spectre").open_visual()<CR>', desc = "Search current word" },
},
-- visual mode(what's the difference between v and x???)
x = {
-- refactoring
["<leader>ri"] = {
function() require("refactoring").refactor "Inline Variable" end,
desc = "Inverse of extract variable",
},
["<leader>re"] = {
function() require("refactoring").refactor "Extract Function" end,
desc = "Extracts the selected code to a separate function",
},
["<leader>rf"] = {
function() require("refactoring").refactor "Extract Function To File" end,
desc = "Extract Function To File",
},
["<leader>rv"] = {
function() require("refactoring").refactor "Extract Variable" end,
desc = "Extracts occurrences of a selected expression to its own variable",
},
["<leader>rr"] = {
function() require("telescope").extensions.refactoring.refactors() end,
desc = "Prompt for a refactor to apply",
},
},
},
},
}

View File

@@ -0,0 +1,154 @@
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
-- 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",
---@type AstroLSPOpts
opts = {
-- 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",
"jsonnet",
"rust",
"terraform",
"nu",
},
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 = {
---- Frontend & NodeJS
"tsserver", -- typescript/javascript language server
"tailwindcss", -- tailwindcss language server
"html", -- html language server
"cssls", -- css language server
"prismals", -- prisma language server
"volar", -- vue language server
---- Configuration Language
"marksman", -- markdown ls
"jsonls", -- json language server
"yamlls", -- yaml language server
"taplo", -- toml language server
---- Backend
"lua_ls", -- lua
"gopls", -- go
"rust_analyzer", -- rust
"pyright", -- python
"ruff_lsp", -- extremely fast Python linter and code transformation
"jdtls", -- java
"nil_ls", -- nix language server
"bufls", -- protocol buffer language server
"zls", -- zig language server
---- HDL
"verible", -- verilog language server
---- Operation & Cloud Nativautoindente
"bashls", -- bash
"cmake", -- cmake language server
"clangd", -- c/c++
"dockerls", -- dockerfile
"jsonnet_ls", -- jsonnet language server
"terraformls", -- terraform hcl
"nushell", -- nushell language server
"scheme_langserver", -- scheme language server
},
-- customize language server configuration options passed to `lspconfig`
---@diagnostic disable: missing-fields
config = {
-- the offset_encoding of clangd will confilicts whit null-ls
-- so we need to manually set it to utf-8
clangd = {
capabilities = {
offsetEncoding = "utf-8",
},
},
scheme_langserver = {
filetypes = { "scheme", "scm" },
single_file_support = true,
},
},
-- 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,
},
}

View File

@@ -0,0 +1,39 @@
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
-- 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 = "astrodark",
-- 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 = "",
},
},
}

View File

@@ -0,0 +1,8 @@
return {
"0x00-ketsu/autosave.nvim",
-- lazy-loading on events
event = { "InsertLeave", "TextChanged" },
opts = function(_, opts)
opts.prompt_style = "stdout" -- notify or stdout
end,
}

View File

@@ -0,0 +1,8 @@
return {
"catppuccin/nvim",
name = "catppuccin",
opts = function(_, opts)
opts.flavour = "mocha" -- latte, frappe, macchiato, mocha
opts.transparent_background = true -- setting the background color.
end,
}

View File

@@ -0,0 +1,31 @@
return {
"Olical/conjure",
ft = { "clojure", "fennel", "python", "scheme" }, -- etc
-- [Optional] cmp-conjure for cmp
dependencies = {
{
"PaterJason/cmp-conjure",
config = function()
local cmp = require "cmp"
local config = cmp.get_config()
table.insert(config.sources, {
name = "buffer",
option = {
sources = {
{ name = "conjure" },
},
},
})
cmp.setup(config)
end,
},
},
config = function(_, opts)
require("conjure.main").main()
require("conjure.mapping")["on-filetype"]()
end,
init = function()
-- Set configuration options here
vim.g["conjure#debug"] = true
end,
}

View File

@@ -0,0 +1,10 @@
-- Custom copilot-lua to enable filetypes: markdown
return {
"zbirenbaum/copilot.lua",
opts = function(_, opts)
opts.filetypes = {
yaml = true,
markdown = true,
}
end,
}

View File

@@ -0,0 +1 @@
return { "folke/flash.nvim", vscode = false }

View File

@@ -0,0 +1,5 @@
-- implementation/definition preview
return {
"rmagatti/goto-preview",
config = function() require("goto-preview").setup {} end,
}

View File

@@ -0,0 +1,12 @@
-- markdown preview
return {
"0x00-ketsu/markdown-preview.nvim",
ft = { "md", "markdown", "mkd", "mkdn", "mdwn", "mdown", "mdtxt", "mdtext", "rmd", "wiki" },
config = function()
require("markdown-preview").setup {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the setup section below
}
end,
}

View File

@@ -0,0 +1,64 @@
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
-- Customize Mason plugins
---@type LazySpec
return {
-- use mason-lspconfig to configure LSP installations
{
"williamboman/mason-lspconfig.nvim",
-- mason is unusable on NixOS, disable it.
-- ensure_installed nothing
opts = function(_, opts)
opts.ensure_installed = nil
opts.automatic_installation = false
end,
-- overrides `require("mason-lspconfig").setup(...)`
-- opts = function(_, opts)
-- -- 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, {
-- "lua_ls",
-- -- add more arguments for adding more language servers
-- })
-- end,
},
-- use mason-null-ls to configure Formatters/Linter installation for null-ls sources
{
"jay-babu/mason-null-ls.nvim",
-- mason is unusable on NixOS, disable it.
-- ensure_installed nothing
opts = function(_, opts)
opts.ensure_installed = nil
opts.automatic_installation = false
end,
-- -- overrides `require("mason-null-ls").setup(...)`
-- opts = function(_, opts)
-- -- 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, {
-- "prettier",
-- "stylua",
-- -- add more arguments for adding more null-ls sources
-- })
-- end,
},
{
"jay-babu/mason-nvim-dap.nvim",
-- mason is unusable on NixOS, disable it.
-- ensure_installed nothing
opts = function(_, opts)
opts.ensure_installed = nil
opts.automatic_installation = false
end,
-- overrides `require("mason-nvim-dap").setup(...)`
-- opts = function(_, opts)
-- -- 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, {
-- "python",
-- -- add more arguments for adding more debuggers
-- })
-- end,
},
}

View File

@@ -0,0 +1,13 @@
-- File explorer(Custom configs)
return {
"nvim-neo-tree/neo-tree.nvim",
opts = {
filesystem = {
filtered_items = {
visible = true, -- visible by default
hide_dotfiles = false,
hide_gitignored = false,
},
},
},
}

View File

@@ -0,0 +1,2 @@
-- full signature help, docs and completion for the nvim lua API.
return { "folke/neodev.nvim", opts = {} }

View File

@@ -0,0 +1 @@
return { "Olical/nfnl", ft = "fennel" }

View File

@@ -0,0 +1,59 @@
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
-- Customize None-ls sources
---@type LazySpec
return {
"nvimtools/none-ls.nvim",
opts = function(_, config)
-- config variable is the default configuration table for the setup function call
local null_ls = require "null-ls"
local code_actions = null_ls.builtins.code_actions
local diagnostics = null_ls.builtins.diagnostics
local formatting = null_ls.builtins.formatting
local hover = null_ls.builtins.hover
local completion = null_ls.builtins.completion
-- 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 = {
-- Common Code Actions
code_actions.gitsigns,
-- common refactoring actions based off the Refactoring book by Martin Fowler
code_actions.refactoring,
code_actions.gomodifytags, -- Go - modify struct field tags
code_actions.impl, -- Go - generate interface method stubs
code_actions.shellcheck,
code_actions.proselint, -- English prose linter
code_actions.statix, -- Lints and suggestions for Nix.
-- Diagnostic
diagnostics.actionlint, -- GitHub Actions workflow syntax checking
diagnostics.buf, -- check text in current buffer
diagnostics.checkmake, -- check Makefiles
diagnostics.deadnix, -- Scan Nix files for dead code.
-- Formatting
formatting.prettier, -- js/ts/vue/css/html/json/... formatter
diagnostics.hadolint, -- Dockerfile linter
formatting.black, -- Python formatter
formatting.ruff, -- extremely fast Python linter
formatting.goimports, -- Go formatter
formatting.shfmt, -- Shell formatter
formatting.rustfmt, -- Rust formatter
formatting.taplo, -- TOML formatteautoindentr
formatting.terraform_fmt, -- Terraform formatter
formatting.stylua, -- Lua formatter
formatting.alejandra, -- Nix formatter
formatting.sqlfluff.with { -- SQL formatter
extra_args = { "--dialect", "postgres" }, -- change to your dialect
},
formatting.nginx_beautifier, -- Nginx formatter
formatting.verible_verilog_format, -- Verilog formatter
formatting.emacs_scheme_mode, -- using emacs in batch mode to format scheme files.
formatting.fnlfmt, -- Format Fennel code
}
return config -- return final config table
end,
}

View File

@@ -0,0 +1,7 @@
-- The plugin offers the abilibty to search and replace.
return {
"nvim-pack/nvim-spectre",
dependencies = {
{ "nvim-lua/plenary.nvim" },
},
}

View File

@@ -0,0 +1,26 @@
return {
"nvim-orgmode/orgmode",
dependencies = {
{ "nvim-treesitter/nvim-treesitter", lazy = true },
},
event = "VeryLazy",
config = function()
-- Load treesitter grammar for org
require("orgmode").setup_ts_grammar()
-- Setup treesitter
require("nvim-treesitter.configs").setup {
highlight = {
enable = true,
additional_vim_regex_highlighting = { "org" },
},
ensure_installed = { "org" },
}
-- Setup orgmode
require("orgmode").setup {
org_agenda_files = "~/org/**/*",
org_default_notes_file = "~/org/refile.org",
}
end,
}

View File

@@ -0,0 +1,5 @@
return {
"eraserhd/parinfer-rust",
build = "cargo build --release",
ft = { "scm", "scheme" },
}

View File

@@ -0,0 +1,8 @@
-- The plugin offers the alibity to refactor code.
return {
"ThePrimeagen/refactoring.nvim",
dependencies = {
{ "nvim-lua/plenary.nvim" },
{ "nvim-treesitter/nvim-treesitter" },
},
}

View File

@@ -0,0 +1,13 @@
-- Enhanced matchparen.vim plugin for Neovim to highlight the outer pair.
return {
"utilyre/sentiment.nvim",
version = "*",
event = "VeryLazy", -- keep for lazy loading
opts = {
-- config
},
init = function()
-- `matchparen.vim` needs to be disabled manually in case of lazy loading
vim.g.loaded_matchparen = 1
end,
}

View File

@@ -0,0 +1,44 @@
return {
"nvim-telescope/telescope.nvim",
branch = "0.1.x",
dependencies = { "nvim-lua/plenary.nvim" },
init = function()
-- 1. Disable highlighting for certain filetypes
-- 2. Ignore files larger than a certain filesize
local previewers = require "telescope.previewers"
local _bad = { ".*%.csv", ".*%.min.js" } -- Put all filetypes that slow you down in this array
local filesize_threshold = 300 * 1024 -- 300KB
local bad_files = function(filepath)
for _, v in ipairs(_bad) do
if filepath:match(v) then return false end
end
return true
end
local new_maker = function(filepath, bufnr, opts)
opts = opts or {}
if opts.use_ft_detect == nil then opts.use_ft_detect = true end
-- 1. Check if the file is in the bad_files array, and if so, don't highlight it
opts.use_ft_detect = opts.use_ft_detect == false and false or bad_files(filepath)
-- 2. Check the file size, and ignore it if it's too big(preview nothing).
filepath = vim.fn.expand(filepath)
vim.loop.fs_stat(filepath, function(_, stat)
if not stat then return end
if stat.size > filesize_threshold then
return
else
previewers.buffer_previewer_maker(filepath, bufnr, opts)
end
end)
end
require("telescope").setup {
defaults = {
buffer_previewer_maker = new_maker,
},
}
end,
}

View File

@@ -0,0 +1,2 @@
-- disable toggleterm.nvim, zellij's terminal is far better than neovim's one
return { "akinsho/toggleterm.nvim", enabled = false }

View File

@@ -0,0 +1,62 @@
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
-- Customize Treesitter
---@type LazySpec
return {
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>", -- Ctrl + Space
node_incremental = "<C-space>",
scope_incremental = "<A-space>", -- Alt + Space
node_decremental = "<bs>", -- Backspace
},
}
opts.ignore_install = { "gotmpl" }
-- 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, {
-- neovim
"vim",
"lua",
-- operation & cloud native
"dockerfile",
"hcl",
"jsonnet",
"regex",
"terraform",
"nix",
"csv",
-- other programming language
"diff",
"gitignore",
"gitcommit",
"latex",
"sql",
-- Lisp like
"fennel",
"clojure",
"commonlisp",
-- customized languages:
"scheme",
})
-- add support for scheme
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.scheme = {
install_info = {
url = "https://github.com/6cdh/tree-sitter-scheme", -- local path or git repo
files = { "src/parser.c" },
-- optional entries:
branch = "main", -- default branch in case of git repo if different from master
generate_requires_npm = false, -- if stand-alone parser without npm dependencies
requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c
},
}
-- use scheme parser for filetypes: scm
vim.treesitter.language.register("scheme", "scm")
end,
}

View File

@@ -0,0 +1,10 @@
-- joining blocks of code into oneline, or splitting one line into multiple lines.
return {
"Wansmer/treesj",
keys = { "<space>m", "<space>j", "<space>s" },
dependencies = { "nvim-treesitter/nvim-treesitter" },
config = function()
require("treesj").setup { --[[ your config ]]
}
end,
}

View File

@@ -0,0 +1,2 @@
-- Undo tree
return { "debugloop/telescope-undo.nvim" }

View File

@@ -0,0 +1,85 @@
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
-- You can also add or configure plugins by creating files in this `plugins/` folder
-- Here are some examples:
---@type LazySpec
return {
-- == Examples of Adding Plugins ==
"andweeb/presence.nvim",
{
"ray-x/lsp_signature.nvim",
event = "BufRead",
config = function() require("lsp_signature").setup() end,
},
-- == Examples of Overriding Plugins ==
-- customize alpha options
{
"goolord/alpha-nvim",
opts = function(_, opts)
-- customize the dashboard header
opts.section.header.val = {
" █████ ███████ ████████ ██████ ██████",
"██ ██ ██ ██ ██ ██ ██ ██",
"███████ ███████ ██ ██████ ██ ██",
"██ ██ ██ ██ ██ ██ ██ ██",
"██ ██ ███████ ██ ██ ██ ██████",
" ",
" ███  ██ ██  ██ ██ ███  ███",
" ████  ██ ██  ██ ██ ████  ████",
" ██ ██  ██ ██  ██ ██ ██ ████ ██",
" ██  ██ ██  ██  ██  ██ ██  ██  ██",
" ██   ████   ████   ██ ██  ██",
}
return opts
end,
},
-- You can disable default plugins as follows:
{ "max397574/better-escape.nvim", enabled = false },
-- You can also easily customize additional setup of plugins that is outside of the plugin's setup call
{
"L3MON4D3/LuaSnip",
config = function(plugin, opts)
require "astronvim.plugins.configs.luasnip"(plugin, opts) -- include the default astronvim config that calls the setup call
-- add more custom luasnip configuration such as filetype extend or custom snippets
local luasnip = require "luasnip"
luasnip.filetype_extend("javascript", { "javascriptreact" })
end,
},
{
"windwp/nvim-autopairs",
config = function(plugin, opts)
require "astronvim.plugins.configs.nvim-autopairs"(plugin, opts) -- include the default astronvim config that calls the setup call
-- add more custom autopairs configuration such as custom rules
local npairs = require "nvim-autopairs"
local Rule = require "nvim-autopairs.rule"
local cond = require "nvim-autopairs.conds"
npairs.add_rules(
{
Rule("$", "$", { "tex", "latex" })
-- don't add a pair if the next character is %
:with_pair(cond.not_after_regex "%%")
-- don't add a pair if the previous character is xxx
:with_pair(
cond.not_before_regex("xxx", 3)
)
-- don't move right when repeat character
:with_move(cond.none())
-- don't delete if the next character is xx
:with_del(cond.not_after_regex "xx")
-- disable adding a newline when you press <cr>
:with_cr(cond.none()),
},
-- disable for .vim files, but it work for another filetypes
Rule("a", "a", "-vim")
)
end,
},
}

View File

@@ -0,0 +1,62 @@
-- clipboard manager
return {
"gbprod/yanky.nvim",
opts = function()
local mapping = require "yanky.telescope.mapping"
local mappings = mapping.get_defaults()
mappings.i["<c-p>"] = nil
return {
highlight = { timer = 200 },
picker = {
telescope = {
use_default_mappings = false,
mappings = mappings,
},
},
}
end,
keys = {
{
"y",
"<Plug>(YankyYank)",
mode = { "n", "x" },
desc = "Yank text",
},
{
"p",
"<Plug>(YankyPutAfter)",
mode = { "n", "x" },
desc = "Put yanked text after cursor",
},
{
"P",
"<Plug>(YankyPutBefore)",
mode = { "n", "x" },
desc = "Put yanked text before cursor",
},
{
"gp",
"<Plug>(YankyGPutAfter)",
mode = { "n", "x" },
desc = "Put yanked text after selection",
},
{
"gP",
"<Plug>(YankyGPutBefore)",
mode = { "n", "x" },
desc = "Put yanked text before selection",
},
{ "[y", "<Plug>(YankyCycleForward)", desc = "Cycle forward through yank history" },
{ "]y", "<Plug>(YankyCycleBackward)", desc = "Cycle backward through yank history" },
{ "]p", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" },
{ "[p", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" },
{ "]P", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" },
{ "[P", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" },
{ ">p", "<Plug>(YankyPutIndentAfterShiftRight)", desc = "Put and indent right" },
{ "<p", "<Plug>(YankyPutIndentAfterShiftLeft)", desc = "Put and indent left" },
{ ">P", "<Plug>(YankyPutIndentBeforeShiftRight)", desc = "Put before and indent right" },
{ "<P", "<Plug>(YankyPutIndentBeforeShiftLeft)", desc = "Put before and indent left" },
{ "=p", "<Plug>(YankyPutAfterFilter)", desc = "Put after applying a filter" },
{ "=P", "<Plug>(YankyPutBeforeFilter)", desc = "Put before applying a filter" },
},
}

View File

@@ -0,0 +1,18 @@
if true then return end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
-- 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",
},
}

View File

@@ -0,0 +1,6 @@
---
base: lua51
globals:
vim:
any: true

View File

@@ -0,0 +1,8 @@
std = "neovim"
[rules]
global_usage = "allow"
if_same_then_else = "allow"
incorrect_standard_library_use = "allow"
mixed_table = "allow"
multiple_statements = "allow"