My neovim config

This commit is contained in:
Allann Cintra 2024-09-17 15:02:57 -03:00
commit 5e25828335
37 changed files with 1712 additions and 0 deletions

20
.neoconf.json Normal file
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
}
}
}

7
.stylua.toml Normal file
View File

@ -0,0 +1,7 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferDouble"
call_parentheses = "None"
collapse_simple_statement = "Always"

34
README.md Normal file
View File

@ -0,0 +1,34 @@
# AstroNvim Template
**NOTE:** This is for AstroNvim v4+
A template for getting started with [AstroNvim](https://github.com/AstroNvim/AstroNvim)
## 🛠️ Installation
#### Make a backup of your current nvim and shared folder
```shell
mv ~/.config/nvim ~/.config/nvim.bak
mv ~/.local/share/nvim ~/.local/share/nvim.bak
mv ~/.local/state/nvim ~/.local/state/nvim.bak
mv ~/.cache/nvim ~/.cache/nvim.bak
```
#### Create a new user repository from this template
Press the "Use this template" button above to create a new repository to store your user configuration.
You can also just clone this repository directly if you do not want to track your user configuration in GitHub.
#### Clone the repository
```shell
git clone https://github.com/<your_user>/<your_repository> ~/.config/nvim
```
#### Start Neovim
```shell
nvim
```

19
init.lua Normal file
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"

99
lazy-lock.json Normal file
View File

@ -0,0 +1,99 @@
{
"AstroNvim": { "branch": "main", "commit": "d771094986abced8c3ceae29a5a55585ecb0523a" },
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
"aerial.nvim": { "branch": "master", "commit": "b59e01e4380932b375ecff165b48a9400c4af929" },
"alpha-nvim": { "branch": "main", "commit": "b6f4129302db197a7249e67a90de3f2b676de13e" },
"arshlib.nvim": { "branch": "master", "commit": "111fd439268adda206a24b133096893869a50764" },
"astrocommunity": { "branch": "main", "commit": "b6f8a518e527d5372e42cec767d211bb969fb6a6" },
"astrocore": { "branch": "main", "commit": "cf5823e2b59aa9666445e3f3531296ad8f417b7c" },
"astrolsp": { "branch": "main", "commit": "5d92b868586c4b79298003b307e8dc3e9a357816" },
"astrotheme": { "branch": "main", "commit": "037c3dbd161d6744d274243dd71314b2964753b2" },
"astroui": { "branch": "main", "commit": "7adeb60d76939d3cd66c9852e0e8621bd42014dd" },
"better-escape.nvim": { "branch": "master", "commit": "f45b52f8f87792e8659526f23261ffe278a54be5" },
"catppuccin": { "branch": "main", "commit": "4fd72a9ab64b393c2c22b168508fd244877fec96" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-dap": { "branch": "master", "commit": "ea92773e84c0ad3288c3bc5e452ac91559669087" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"competitest.nvim": { "branch": "master", "commit": "c3cb0e2b0916a879c4d3dcb5737e6c046dd0afc5" },
"compiler.nvim": { "branch": "main", "commit": "e889774c7f2fefad60f8e6638d324223b07d2624" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"dressing.nvim": { "branch": "master", "commit": "71349f24c6e07b39f33600985843c289ca735308" },
"friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" },
"gitsigns.nvim": { "branch": "main", "commit": "0b04035bb7b3c83e999b9676e2fb46fd0aa9f910" },
"glow.nvim": { "branch": "main", "commit": "238070a686c1da3bccccf1079700eb4b5e19aea4" },
"guess-indent.nvim": { "branch": "main", "commit": "6cd61f7a600bb756e558627cd2e740302c58e32d" },
"headlines.nvim": { "branch": "master", "commit": "7671eec1065982cdf2ba4136beb1600fe1279431" },
"heirline.nvim": { "branch": "master", "commit": "0d797435e54645a5f98bad7ad6046aac1ef95c1e" },
"hologram.nvim": { "branch": "main", "commit": "f5194f71ec1578d91b2e3119ff08e574e2eab542" },
"indent-blankline.nvim": { "branch": "master", "commit": "18603eb949eba08300799f64027af11ef922283f" },
"indent-tools.nvim": { "branch": "master", "commit": "31b839d65aa04b568fabe5e100a63cc44ef3f5d5" },
"info.vim": { "branch": "master", "commit": "b1acda75344f36b91d9c51a33201eada38cf33e9" },
"jupyter-vim": { "branch": "master", "commit": "91eef96d0f26ce37db241833341d08d11c8e5215" },
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
"lazydev.nvim": { "branch": "main", "commit": "491452cf1ca6f029e90ad0d0368848fac717c6d2" },
"lsp_signature.nvim": { "branch": "master", "commit": "a38da0a61c172bb59e34befc12efe48359884793" },
"lspkind.nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" },
"luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "62360f061d45177dda8afc1b0fd1327328540301" },
"mason-null-ls.nvim": { "branch": "main", "commit": "2b8433f76598397fcc97318d410e0c4f7a4bea6a" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" },
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
"mini.bufremove": { "branch": "main", "commit": "e6044aa28e61d4dd9ec86194d6f81743eced0c1c" },
"mini.indentscope": { "branch": "main", "commit": "da9af64649e114aa79480c238fd23f6524bc0903" },
"mini.move": { "branch": "main", "commit": "4caa1c212f5ca3d1633d21cfb184808090ed74b1" },
"mini.surround": { "branch": "main", "commit": "0e67c4bc147f2a15cee94e7c94dcc0e115b9f55e" },
"neo-tree.nvim": { "branch": "main", "commit": "8c75e8a2949cd6cd35525799200a8d34471ee9eb" },
"neoclip": { "branch": "master", "commit": "adfb1430c7308f0b3036f89b037509b3d0b4610a" },
"neoconf.nvim": { "branch": "main", "commit": "8ee287dccee562857b0abe9fe3acd6ad147f8a70" },
"neogen": { "branch": "main", "commit": "e932ba918b56723436b77aa3efb844a11b2851ab" },
"noice.nvim": { "branch": "main", "commit": "448bb9c524a7601035449210838e374a30153172" },
"none-ls.nvim": { "branch": "main", "commit": "9b98991e15dce8fc502993e23caac2528b8b667f" },
"nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" },
"nvim-bqf": { "branch": "main", "commit": "1b24dc6050c34e8cd377b6b4cd6abe40509e0187" },
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
"nvim-colorizer.lua": { "branch": "master", "commit": "194ec600488f7c7229668d0e80bd197f3a2b84ff" },
"nvim-dap": { "branch": "master", "commit": "20a4859ebde1c9bc8e96f8cc11a20667e7fdd516" },
"nvim-dap-ui": { "branch": "master", "commit": "1c351e4e417d4691da12948b6ecf966936a56d28" },
"nvim-lspconfig": { "branch": "master", "commit": "0ef64599b8aa0187ee5f6d92cb39c951f348f041" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
"nvim-send-to-term": { "branch": "master", "commit": "e0aa448d417a553d19cba8c78d91993387f1ff2d" },
"nvim-spectre": { "branch": "master", "commit": "ba7fb777edff6c1fbbeffd343e113af64c04e90a" },
"nvim-treesitter": { "branch": "master", "commit": "00f128dd73086aa578dc3d9142de06c633b7c685" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "fe3deb7f67ce0cc4ebfe2ea6c1c7ae1c7a939d73" },
"nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "375c2d86cee6674afd75b4f727ce3a80065552f7" },
"nvim-ufo": { "branch": "main", "commit": "a5390706f510d39951dd581f6d2a972741b3fa26" },
"nvim-web-devicons": { "branch": "master", "commit": "9793801f974bba70e4ac5d7eae6c4f5659993d8e" },
"nvim-window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" },
"overseer.nvim": { "branch": "master", "commit": "236e60cdac6410dd95ea5cecafdb801a304d6a41" },
"pets.nvim": { "branch": "main", "commit": "8a443e2eae804e5abe21b5d00ceaef4041f882e4" },
"plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" },
"project_nvim": { "branch": "main", "commit": "4317ce951459a53ba45ffed2495ac6752211364b" },
"promise-async": { "branch": "main", "commit": "38a4575da9497326badd3995e768b4ccf0bb153e" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "5f73b24aeb94f5274c218955573153c69ce4d1ee" },
"resession.nvim": { "branch": "master", "commit": "cc819b0489938d03e4f3532a583354f0287c015b" },
"smart-splits.nvim": { "branch": "master", "commit": "1a2b268a7ec7aeef879cdd15973339010ec134f7" },
"telescope-bibtex.nvim": { "branch": "master", "commit": "289a6f86ebec06e8ae1590533b732b9981d84900" },
"telescope-file-browser.nvim": { "branch": "master", "commit": "c5a14e0550699a7db575805cdb9ddc969ba0f1f5" },
"telescope-fzy-native.nvim": { "branch": "master", "commit": "282f069504515eec762ab6d6c89903377252bf5b" },
"telescope-hop.nvim": { "branch": "master", "commit": "337a1e9f08f972ebf7a7d26251577812ebaadc78" },
"telescope-live-grep-args.nvim": { "branch": "master", "commit": "649b662a8f476fd2c0289570764459e95ebaa3f3" },
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"todo-comments.nvim": { "branch": "main", "commit": "313b04e5b02d29ab9275c9295ff5e2b73921b0eb" },
"toggleterm.nvim": { "branch": "main", "commit": "48be57eaba817f038d61bbf64d2c597f578c0827" },
"trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" },
"twilight.nvim": { "branch": "main", "commit": "1584c0b0a979b71fd86b18d302ba84e9aba85b1b" },
"ultimate-autopair.nvim": { "branch": "v0.6", "commit": "53ed7c65e466963c916251f9ce6df7dd3685dc36" },
"vim-easy-align": { "branch": "master", "commit": "9815a55dbcd817784458df7a18acacc6f82b1241" },
"vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },
"vim-s-asm": { "branch": "master", "commit": "a43fc9a86d9978c449609fcff4cc324e6615421b" },
"vim-sandwich": { "branch": "master", "commit": "74cf93d58ccc567d8e2310a69860f1b93af19403" },
"which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" },
"wiki.vim": { "branch": "master", "commit": "ba630e2e174f9fe963c4bce17024a4adbcb09624" },
"zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" }
}

47
lua/community.lua Normal file
View File

@ -0,0 +1,47 @@
return {
"AstroNvim/astrocommunity",
{ import = "astrocommunity.colorscheme.catppuccin" },
-- {
-- "catppuccin",
-- opts = {
-- integrations = {
-- ts_rainbow2 = true,
-- treesitter = true,
-- }
-- },
-- config = function()
-- vim.api.nvim_set_hl(0, "LspInlayHint", { bg = "#1e1e2f" })
-- end
-- },
-- { import = "astrocommunity.pack.cpp" },
{ import = "astrocommunity.code-runner.compiler-nvim" },
-- { import = "astrocommunity.code-runner.sniprun" },
{ import = "astrocommunity.color.twilight-nvim" },
{ import = "astrocommunity.quickfix.nvim-bqf" },
-- { import = "astrocommunity.diagnostics.lsp_lines-nvim" },
-- { import = "astrocommunity.diagnostics.trouble-nvim" },
{ import = "astrocommunity.editing-support.rainbow-delimiters-nvim" },
{ import = "astrocommunity.editing-support.ultimate-autopair-nvim" },
{ import = "astrocommunity.indent.mini-indentscope" },
{ import = "astrocommunity.media.pets-nvim" },
{ import = "astrocommunity.markdown-and-latex.markdown-preview-nvim" },
{ import = "astrocommunity.markdown-and-latex.glow-nvim" },
{ import = "astrocommunity.lsp.lsp-signature-nvim" },
{ import = "astrocommunity.syntax.vim-sandwich" }
}

94
lua/init.lua Normal file
View File

@ -0,0 +1,94 @@
return {
-- Configure AstroNvim updates
updater = {
remote = "origin", -- remote to use
channel = "stable", -- "stable" or "nightly"
version = "latest", -- "latest", tag name, or regex search like "v1.*" to only do updates before v2 (STABLE ONLY)
branch = "nightly", -- branch name (NIGHTLY ONLY)
commit = nil, -- commit hash (NIGHTLY ONLY)
pin_plugins = nil, -- nil, true, false (nil will pin plugins on stable only)
skip_prompts = false, -- skip prompts about breaking changes
show_changelog = true, -- show the changelog after performing an update
auto_quit = false, -- automatically quit the current session after a successful update
remotes = { -- easily add new remotes to track
-- ["remote_name"] = "https://remote_url.come/repo.git", -- full remote url
-- ["remote2"] = "github_user/repo", -- GitHub user/repo shortcut,
-- ["remote3"] = "github_user", -- GitHub user assume AstroNvim fork
},
},
-- Configure require("lazy").setup() options
lazy = {
defaults = { lazy = true },
performance = {
rtp = {
-- customize default disabled vim plugins
disabled_plugins = { "tohtml", "gzip", "matchit", "zipPlugin", "netrwPlugin", "tarPlugin" },
},
},
},
-- This function is run last and is a good place to configuring
-- augroups/autocommands and custom filetypes also this just pure lua so
-- anything that doesn't fit in the normal config locations above can go here
polish = function()
-- Set up custom filetypes
-- vim.filetype.add {
-- extension = {
-- foo = "fooscript",
-- },
-- filename = {
-- ["Foofile"] = "fooscript",
-- },
-- pattern = {
-- ["~/%.config/foo/.*"] = "fooscript",
-- },
-- }
vim.filetype.add {
extension = {
asm = "nasm",
},
}
require("catppuccin").compile()
vim.api.nvim_create_autocmd({ "VimEnter" }, {
command = [[ let $SHELL="/bin/fish" ]]
})
vim.api.nvim_create_autocmd({ "FileType", "BufRead", "BufNewFile" }, {
pattern = "*.s",
callback = function()
local indentation = 8
vim.opt_local.expandtab = true
vim.opt_local.tabstop = indentation
vim.opt_local.shiftwidth = indentation
vim.opt_local.filetype = "s-asm"
vim.opt_local.syntax = "s-asm"
vim.opt_local.formatoptions = vim.opt_local.formatoptions + "r"
end,
})
vim.api.nvim_create_autocmd({ "FileType", "BufRead", "BufNewFile" }, {
pattern = "*.hdl",
callback = function()
local indentation = 4
vim.opt_local.expandtab = true
vim.opt_local.tabstop = indentation
vim.opt_local.shiftwidth = indentation
vim.opt_local.formatoptions = vim.opt_local.formatoptions + "r"
end,
})
vim.api.nvim_create_autocmd({ "FileType", "BufRead", "BufNewFile" }, {
pattern = "*.lua",
callback = function()
local indentation = 4
vim.opt_local.expandtab = true
vim.opt_local.tabstop = indentation
vim.opt_local.shiftwidth = indentation
end,
})
end,
}

32
lua/lazy_setup.lua Normal file
View File

@ -0,0 +1,32 @@
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
update_notifications = true, -- Enable/disable notification about running `:Lazy update` twice to update pinned plugins
},
},
{ 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",
},
},
},
} --[[@as LazyConfig]])

308
lua/plugins/astrocore.lua Normal file
View File

@ -0,0 +1,308 @@
-- 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
local utils = require "utils"
local astro_utils = require "astrocore"
---@type LazySpec
return {
"AstroNvim/astrocore",
---@type AstroCoreOpts
opts = {
sessions = {
autosave = {
last = true,
cwd = true,
},
ignore = {
dirs = { "wiki" },
},
},
-- 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, -- sets vim.opt.relativenumber
number = true, -- sets vim.opt.number
spell = false, -- sets vim.opt.spell
signcolumn = "auto", -- sets vim.opt.signcolumn to auto
wrap = false, -- sets vim.opt.wrap
expandtab = false,
tabstop = 8,
shiftwidth = 8,
showtabline = 8,
vim.opt.rtp:append("/usr/share/vim/vimfiles"),
vim.opt.cinoptions:append("(0");
},
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
mapleader = " ", -- sets vim.g.mapleader
autoformat_enabled = false, -- enable or disable auto formatting at start (lsp.formatting.format_on_save must be enabled)
cmp_enabled = true, -- enable completion at start
autopairs_enabled = true, -- enable autopairs at start
diagnostics_mode = 3, -- set the visibility of diagnostics in the UI (0=off, 1=only show in status line, 2=virtual text off, 3=all on)
icons_enabled = true, -- disable icons in the UI (disable if no nerd font is available, requires :PackerSync after changing)
ui_notifications_enabled = true, -- disable notifications when toggling UI elements
c_syntax_for_h = 1,
wiki_root = '~/Documentos/Wiki',
wiki_journal = {
name = "journal",
frequency = "daily",
date_format = {
daily = "%Y/%m/%d",
},
},
wiki_viewer = {
png = "feh",
jpg = "feh",
jpeg = "feh",
},
infoprg = '/usr/bin/info'
},
},
-- 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" },
-- quick save
-- disable default bindings
["<C-Down>"] = false,
["<C-Left>"] = false,
["<C-Right>"] = false,
["<C-Up>"] = false,
["<C-h>"] = false,
["<C-j>"] = false,
["<C-k>"] = false,
["<C-l>"] = false,
["<C-q>"] = false,
["<C-s>"] = false,
["<C-r>"] = false,
-- Competitest
["<C-o>"] = { "<cmd>CompetiTest receive problem<cr>", desc = "Open problem" },
["<C-r>"] = { "<cmd>CompetiTest run<cr>", desc = "Run problem" },
["q:"] = ":",
-- second key is the lefthand side of the map
-- mappings seen under group name "Buffer"
["<Leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" },
["<Leader>bD"] = {
function()
require("astroui.status").heirline.buffer_picker(function(bufnr) require("astrocore.buffer").close(bufnr) end)
end,
desc = "Pick to close",
},
["<Leader>bb"] = { "<cmd>tabnew<cr>", desc = "New tab" },
["<Leader>bc"] = { "<cmd>BufferLinePickClose<cr>", desc = "Pick to close" },
["<Leader>bj"] = { "<cmd>BufferLinePick<cr>", desc = "Pick to jump" },
["<Leader>bt"] = { "<cmd>BufferLineSortByTabs<cr>", desc = "Sort by tabs" },
["<Leader>lp"] = { "<cmd>ClangdToggleInlayHints<cr>", desc = "Toggle inlay hints" },
["<Leader>lH"] = { "<cmd>ClangdSwitchSourceHeader<cr>", desc = "Switch between source and header" },
["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",
},
["<F2>"] = { function() vim.lsp.buf.rename() end, desc = "Rename current symbol" },
["<F8>"] = {"<cmd>2TermExec cmd=\"%:p:r\"<cr>", desc = "Execute file"},
["et"] = {"<cmd>term %:p:r<cr>"},
["<C-'>"] = {"<cmd>ToggleTerm<cr>", desc = "Toggle terminal"},
["<C-n>"] = { "<cmd>Neotree toggle<cr>", desc = "Toggle Explorer" },
-- tables with the `name` 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
n = { utils.better_search "n", desc = "Next search" },
N = { utils.better_search "N", desc = "Previous search" },
["<Up>"] = { function() require("smart-splits").resize_up(2) end, desc = "Resize split up" },
["<Down>"] = { function() require("smart-splits").resize_down(2) end, desc = "Resize split down" },
["<Left>"] = { function() require("smart-splits").resize_left(2) end, desc = "Resize split left" },
["<Right>"] = { function() require("smart-splits").resize_right(2) end, desc = "Resize split right" },
["<Tab>"] = {
function()
if #vim.t.bufs > 1 then
require("telescope.builtin").buffers { sort_mru = true, ignore_current_buffer = true }
else
astro_utils.notify "No other buffers open"
end
end,
desc = "Switch Buffers",
},
["<Leader>N"] = { "<cmd>tabnew<cr>", desc = "New Tab" },
["<Leader><cr>"] = { '<esc>/<++><cr>"_c4l', desc = "Next Template" },
["<Leader>."] = { "<cmd>cd %:p:h<cr>", desc = "Set CWD" },
-- neogen
["<Leader>a"] = { desc = "󰏫 Annotate" },
["<Leader>a<cr>"] = { function() require("neogen").generate() end, desc = "Current" },
["<Leader>ac"] = { function() require("neogen").generate { type = "class" } end, desc = "Class" },
["<Leader>af"] = { function() require("neogen").generate { type = "func" } end, desc = "Function" },
["<Leader>at"] = { function() require("neogen").generate { type = "type" } end, desc = "Type" },
["<Leader>aF"] = { function() require("neogen").generate { type = "file" } end, desc = "File" },
-- telescope plugin mappings
["<Leader>fx"] = {
function() require("telescope").extensions.live_grep_args.live_grep_args() end,
desc = "Find words (args)",
},
["<Leader>fB"] = { "<cmd>Telescope bibtex<cr>", desc = "Find BibTeX" },
["<Leader>fe"] = { "<cmd>Telescope file_browser<cr>", desc = "File explorer" },
["<Leader>fp"] = { function() require("telescope").extensions.projects.projects {} end, desc = "Find projects" },
["<Leader>fT"] = { "<cmd>TodoTelescope<cr>", desc = "Find TODOs" },
-- compiler
["<Leader>m"] = { desc = "󱁤 Compiler" },
["<Leader>mk"] = {
function()
vim.cmd "silent! write"
local filename = vim.fn.expand "%:t"
utils.async_run({ "compiler", vim.fn.expand "%:p" }, function() astro_utils.notify("Compiled " .. filename) end)
end,
desc = "Compile",
},
["<Leader>ma"] = {
function()
vim.notify "Autocompile Started"
utils.async_run({ "autocomp", vim.fn.expand "%:p" }, function() astro_utils.notify "Autocompile stopped" end)
end,
desc = "Auto Compile",
},
["<Leader>mv"] = {
function() vim.fn.jobstart { "opout", vim.fn.expand "%:p" } end,
desc = "View Output",
},
["<Leader>mb"] = {
function()
local filename = vim.fn.expand "%:t"
utils.async_run({
"pandoc",
vim.fn.expand "%",
"--pdf-engine=xelatex",
"--variable",
"urlcolor=blue",
"-t",
"beamer",
"-o",
vim.fn.expand "%:r" .. ".pdf",
}, function() astro_utils.notify("Compiled " .. filename) end)
end,
desc = "Compile Beamer",
},
["<Leader>mp"] = {
function()
local pdf_path = vim.fn.expand "%:r" .. ".pdf"
if vim.fn.filereadable(pdf_path) == 1 then vim.fn.jobstart { "pdfpc", pdf_path } end
end,
desc = "Present Output",
},
["<Leader>ml"] = { function() utils.toggle_qf() end, desc = "Logs" },
["<Leader>mt"] = { "<cmd>TexlabBuild<cr>", desc = "LaTeX" },
["<Leader>mf"] = { "<cmd>TexlabForward<cr>", desc = "Forward Search" },
["<Leader>r"] = { desc = " REPL" },
["<Leader>rr"] = { "<Plug>Send", desc = "Send to REPL" },
["<Leader>rl"] = { "<Plug>SendLine", desc = "Send line to REPL" },
["<Leader>r<cr>"] = { "<cmd>SendHere<cr>", desc = "Set REPL" },
["<Leader>z"] = { "<cmd>ZenMode<cr>", desc = "Zen Mode" },
["<Leader>s"] = { desc = "󰛔 Search/Replace" },
["<Leader>ss"] = { function() require("spectre").toggle() end, desc = "Toggle Spectre" },
["<Leader>sf"] = { function() require("spectre").open_file_search() end, desc = "Spectre (current file)" },
["<Leader>sw"] = {
function() require("spectre").open_visual { select_word = true } end,
desc = "Spectre (current word)",
},
["<Leader>x"] = { desc = "󰒡 Trouble" },
["<Leader>xx"] = { "<cmd>TroubleToggle document_diagnostics<cr>", desc = "Document Diagnostics (Trouble)" },
["<Leader>xX"] = { "<cmd>TroubleToggle workspace_diagnostics<cr>", desc = "Workspace Diagnostics (Trouble)" },
["<Leader>xl"] = { "<cmd>TroubleToggle loclist<cr>", desc = "Location List (Trouble)" },
["<Leader>xq"] = { "<cmd>TroubleToggle quickfix<cr>", desc = "Quickfix List (Trouble)" },
["<Leader>xT"] = { "<cmd>TodoTrouble<cr>", desc = "TODOs (Trouble)" },
-- Wiki mappings
["<Leader>w"] = { desc = "󰖬 Wiki" },
["<Leader>wn"] = { "<Plug>(wiki-open)", desc = "Open/create wiki page" },
["<Leader>ww"] = { "<Plug>(wiki-index)", desc = "Open wiki index" },
["<Leader>wx"] = { "<Plug>(wiki-reload)", desc = "Reload wiki" },
["<Leader>wp"] = { "<Plug>(wiki-pages)", desc = "Open wiki page" },
["<Leader>wt"] = { "<Plug>(wiki-tags)", desc = "Open wiki from tags" },
["<Leader>wd"] = { "<Plug>(wiki-page-delete)", desc = "Delete wiki page" },
["<Leader>wf"] = { "<Plug>(wiki-link-transform)", desc = "Transform link" },
["<Leader>wr"] = { "<Plug>(wiki-page-rename)", desc = "Rename wiki page" },
["<Leader>wT"] = { "<Plug>(wiki-toc-generate-local)", desc = "Create local table" },
["<Leader>wg"] = { desc = "Graphs" },
["<Leader>wgb"] = { "<Plug>(wiki-graph-find-backlinks)", desc = "Find backlinks" },
["<Leader>wbC"] = { "<Plug>(wiki-graph-check-links-g)", desc = "Check wiki for broken links" },
["<Leader>wbc"] = { "<Plug>(wiki-graph-check-links)", desc = "Check page for broken links" },
["<Leader>wbi"] = { "<Plug>(wiki-graph-in)", desc = "Show link graph in to page" },
["<Leader>wbo"] = { "<Plug>(wiki-graph-out)", desc = "Show link graph out of page" },
["<Leader>wbO"] = { "<Plug>(wiki-graph-check-orphans)", desc = "Check wiki for orphan pages" },
["<Leader>wbr"] = { "<Plug>(wiki-graph-related)", desc = "Open page link relations" },
["<Leader>wl"] = { desc = "Links" },
["<Leader>wlh"] = { "<Plug>(wiki-link-extract-header)", desc = "Set link titles from first header" },
["<Leader>wli"] = { "<Plug>(wiki-link-incoming-toggle)", desc = "Toggle incoming links" },
["<Leader>wlI"] = { "<Plug>(wiki-link-incoming-hover)", desc = "Show incoming links" },
["<Leader>wll"] = { "<Plug>(wiki-link-show)", desc = "Show link info" },
["<Leader>ws"] = { desc = "Tags" },
["<Leader>wsl"] = { "<Plug>(wiki-tag-list)", desc = "List all tags" },
["<Leader>wsn"] = { "<Plug>(wiki-tag-rename)", desc = "Rename tag" },
["<Leader>wsr"] = { "<Plug>(wiki-tag-reload)", desc = "Reload tags" },
["<Leader>wss"] = { "<Plug>(wiki-tag-search)", desc = "List pages with tag" },
["<Leader>w<space>"] = { desc = "Journal" },
-- ["<Leader>w<space>w"] = { "<Plug>(wiki-journal)Go<enter><esc>!!date +\\%R<cr>I# <C-o>o<enter>", desc = "Open wiki journal" },
["<Leader>w<space>w"] = { "<cmd>TermExec cmd='fish -c journal;exit'<cr>", desc = "Open journal" },
["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
["<C-l>"] = { function() require("luasnip").jump(1) end, desc = "Jump to next snippet" },
},
v = {
["<Leader>s"] = { function() require("spectre").open_visual() end, desc = "Spectre" },
},
t = {
-- setting a mapping to false will disable it
-- ["<esc>"] = false,
},
x = {
-- better increment/decrement
["+"] = { "g<C-a>", desc = "Increment number" },
["-"] = { "g<C-x>", desc = "Descrement number" },
-- Easy-Align
ga = { "<Plug>(EasyAlign)", desc = "Easy Align" },
},
o = {
-- line text-objects
["il"] = { ":normal vil<cr>", desc = "Inside line text object" },
["al"] = { ":normal val<cr>", desc = "Around line text object" },
},
},
},
}

124
lua/plugins/astrolsp.lua Normal file
View File

@ -0,0 +1,124 @@
-- 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 = true, -- 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 = false, -- enable or disable format on save globally
allow_filetypes = { -- enable format on save for specified filetypes only
-- "go",
},
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 = {
-- "pyright"
"clangd",
},
-- customize language server configuration options passed to `lspconfig`
---@diagnostic disable: missing-fields
config = {
-- clangd = { capabilities = { offsetEncoding = "utf-8" } },
clangd = {
cmd = {
"clangd",
"--background-index",
"--malloc-trim",
"--clang-tidy",
"--all-scopes-completion",
"--limit-references=100",
"--limit-results=20",
"--query-driver=/usr/bin/*gcc",
"--function-arg-placeholders=0",
},
capabilities = {
offsetEncoding = "utf-8",
}
}
},
-- 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
-- clangd = function(_, opts) require("clangd_extensions").setup { server = opts } end,
},
-- 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,
},
}

41
lua/plugins/astroui.lua Normal file
View File

@ -0,0 +1,41 @@
-- 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",
-- 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" },
},
["catppuccin-mocha"]= {
-- ["@string.escape"] = { fg = "#55ffff" },
LspInlayHint = { bg = "NONE", fg = "#585b70" },
},
},
-- 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,17 @@
return {
-- {
-- "p00f/clangd_extensions.nvim",
-- name = "clangd_extensions",
-- lazy = false,
-- -- config = function()
-- -- require("clangd_extensions").setup {
-- -- server = astronvim.lsp.config "clangd",
-- -- cmd = {
-- -- "clangd",
-- -- "--malloc-trim",
-- -- "--query-driver='/usr/bin/*gcc'",
-- -- },
-- -- }
-- -- end
-- }
}

View File

@ -0,0 +1,15 @@
return {
'xeluxee/competitest.nvim',
requires = "MunifTanjim/nui.nvim",
config = function() require("competitest").setup{
-- template_file = {
-- cpp = "~/.config/nvim/templates/template.cpp",
-- c = "~/.config/nvim/templates/template.c"
-- }
template_file = "~/.config/nvim/templates/template.$(FEXT)",
compile_command = {
c = { exec = "gcc", args = { "-Wall", "-g", "-DDEBUG", "-fsanitize=address", "$(FNAME)", "-o", "$(FNOEXT)" } },
cpp = { exec = "g++", args = { "-Wall", "-g", "-DDEBUG", "-fsanitize=address", "$(FNAME)", "-o", "$(FNOEXT)" } },
},
} end
}

77
lua/plugins/core.lua Normal file
View File

@ -0,0 +1,77 @@
return {
-- 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 "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 "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,
-- },
-- By adding to the which-key config and using our helper function you can add more which-key registered bindings
-- {
-- "folke/which-key.nvim",
-- config = function(plugin, opts)
-- require "plugins.configs.which-key"(plugin, opts) -- include the default astronvim config that calls the setup call
-- -- Add bindings which show up as group name
-- local wk = require "which-key"
-- wk.register({
-- b = { name = "Buffer" },
-- }, { mode = "n", prefix = "<leader>" })
-- end,
-- },
}

123
lua/plugins/diffview.lua Normal file
View File

@ -0,0 +1,123 @@
return {
"sindrets/diffview.nvim",
event = "User AstroGitFile",
opts = function()
local actions = require "diffview.actions"
local utils = require "astrocore" -- astronvim utils
local prefix = "<leader>D"
utils.set_mappings {
n = {
[prefix] = { name = " Diff View" },
[prefix .. "<cr>"] = { "<cmd>DiffviewOpen<cr>", desc = "Open DiffView" },
[prefix .. "h"] = { "<cmd>DiffviewFileHistory %<cr>", desc = "Open DiffView File History" },
[prefix .. "H"] = { "<cmd>DiffviewFileHistory<cr>", desc = "Open DiffView Branch History" },
},
}
local build_keymaps = function(maps)
local out = {}
local i = 1
for lhs, def in
pairs(utils.extend_tbl(maps, {
[prefix .. "q"] = { "<cmd>DiffviewClose<cr>", desc = "Quit Diffview" }, -- Toggle the file panel.
["]D"] = { actions.select_next_entry, desc = "Next Difference" }, -- Open the diff for the next file
["[D"] = { actions.select_prev_entry, desc = "Previous Difference" }, -- Open the diff for the previous file
["[C"] = { actions.prev_conflict, desc = "Next Conflict" }, -- In the merge_tool: jump to the previous conflict
["]C"] = { actions.next_conflict, desc = "Previous Conflict" }, -- In the merge_tool: jump to the next conflict
["Cl"] = { actions.cycle_layout, desc = "Cycle Diff Layout" }, -- Cycle through available layouts.
["Ct"] = { actions.listing_style, desc = "Cycle Tree Style" }, -- Cycle through available layouts.
["<leader>e"] = { actions.toggle_files, desc = "Toggle Explorer" }, -- Toggle the file panel.
["<leader>o"] = { actions.focus_files, desc = "Focus Explorer" }, -- Bring focus to the file panel
}))
do
local opts
local rhs = def
local mode = { "n" }
if type(def) == "table" then
if def.mode then mode = def.mode end
rhs = def[1]
def[1] = nil
def.mode = nil
opts = def
end
out[i] = { mode, lhs, rhs, opts }
i = i + 1
end
return out
end
return {
enhanced_diff_hl = true,
view = {
merge_tool = { layout = "diff3_mixed" },
},
hooks = { diff_buf_read = function(bufnr) vim.b[bufnr].view_activated = false end },
keymaps = {
disable_defaults = true,
view = build_keymaps {
[prefix .. "o"] = { actions.conflict_choose "ours", desc = "Take Ours" }, -- Choose the OURS version of a conflict
[prefix .. "t"] = { actions.conflict_choose "theirs", desc = "Take Theirs" }, -- Choose the THEIRS version of a conflict
[prefix .. "b"] = { actions.conflict_choose "base", desc = "Take Base" }, -- Choose the BASE version of a conflict
[prefix .. "a"] = { actions.conflict_choose "all", desc = "Take All" }, -- Choose all the versions of a conflict
[prefix .. "0"] = { actions.conflict_choose "none", desc = "Take None" }, -- Delete the conflict region
},
diff3 = build_keymaps {
[prefix .. "O"] = { actions.diffget "ours", mode = { "n", "x" }, desc = "Get Our Diff" }, -- Obtain the diff hunk from the OURS version of the file
[prefix .. "T"] = { actions.diffget "theirs", mode = { "n", "x" }, desc = "Get Their Diff" }, -- Obtain the diff hunk from the THEIRS version of the file
},
diff4 = build_keymaps {
[prefix .. "B"] = { actions.diffget "base", mode = { "n", "x" }, desc = "Get Base Diff" }, -- Obtain the diff hunk from the OURS version of the file
[prefix .. "O"] = { actions.diffget "ours", mode = { "n", "x" }, desc = "Get Our Diff" }, -- Obtain the diff hunk from the OURS version of the file
[prefix .. "T"] = { actions.diffget "theirs", mode = { "n", "x" }, desc = "Get Their Diff" }, -- Obtain the diff hunk from the THEIRS version of the file
},
file_panel = build_keymaps {
j = actions.next_entry, -- Bring the cursor to the next file entry
k = actions.prev_entry, -- Bring the cursor to the previous file entry.
o = actions.select_entry,
S = actions.stage_all, -- Stage all entries.
U = actions.unstage_all, -- Unstage all entries.
X = actions.restore_entry, -- Restore entry to the state on the left side.
L = actions.open_commit_log, -- Open the commit log panel.
Cf = { actions.toggle_flatten_dirs, desc = "Flatten" }, -- Flatten empty subdirectories in tree listing style.
R = actions.refresh_files, -- Update stats and entries in the file list.
["-"] = actions.toggle_stage_entry, -- Stage / unstage the selected entry.
["<down>"] = actions.next_entry,
["<up>"] = actions.prev_entry,
["<cr>"] = actions.select_entry, -- Open the diff for the selected entry.
["<2-LeftMouse>"] = actions.select_entry,
["<c-b>"] = actions.scroll_view(-0.25), -- Scroll the view up
["<c-f>"] = actions.scroll_view(0.25), -- Scroll the view down
["<tab>"] = actions.select_next_entry,
["<s-tab>"] = actions.select_prev_entry,
},
file_history_panel = build_keymaps {
j = actions.next_entry,
k = actions.prev_entry,
o = actions.select_entry,
y = actions.copy_hash, -- Copy the commit hash of the entry under the cursor
L = actions.open_commit_log,
zR = { actions.open_all_folds, desc = "Open all folds" },
zM = { actions.close_all_folds, desc = "Close all folds" },
["?"] = { actions.options, desc = "Options" }, -- Open the option panel
["<down>"] = actions.next_entry,
["<up>"] = actions.prev_entry,
["<cr>"] = actions.select_entry,
["<2-LeftMouse>"] = actions.select_entry,
["<C-A-d>"] = actions.open_in_diffview, -- Open the entry under the cursor in a diffview
["<c-b>"] = actions.scroll_view(-0.25),
["<c-f>"] = actions.scroll_view(0.25),
["<tab>"] = actions.select_next_entry,
["<s-tab>"] = actions.select_prev_entry,
},
option_panel = {
q = actions.close,
o = actions.select_entry,
["<cr>"] = actions.select_entry,
["<2-LeftMouse"] = actions.select_entry,
},
},
}
end,
}

138
lua/plugins/editor.lua Normal file
View File

@ -0,0 +1,138 @@
return {
{
"folke/zen-mode.nvim",
cmd = "ZenMode",
opts = {
window = {
backdrop = 1,
width = function() return math.min(120, vim.o.columns * 0.75) end,
height = 0.9,
options = {
number = false,
relativenumber = false,
foldcolumn = "0",
list = false,
showbreak = "NONE",
signcolumn = "no",
},
},
plugins = {
options = {
cmdheight = 1,
laststatus = 0,
},
},
on_open = function() -- disable diagnostics, indent blankline, and winbar
vim.g.diagnostics_mode_old = vim.g.diagnostics_mode
vim.g.indent_blankline_enabled_old = vim.g.indent_blankline_enabled
vim.g.winbar_old = vim.wo.winbar
vim.g.diagnostics_mode = 0
vim.g.indent_blankline_enabled = false
vim.wo.winbar = nil
vim.diagnostic.config(require("astrolsp").diagnostics[vim.g.diagnostics_mode])
end,
on_close = function() -- restore diagnostics, indent blankline, and winbar
vim.g.diagnostics_mode = vim.g.diagnostics_mode_old
vim.g.indent_blankline_enabled = vim.g.indent_blankline_enabled_old
vim.wo.winbar = vim.g.winbar_old
vim.diagnostic.config(require("astrolsp").diagnostics[vim.g.diagnostics_mode])
end,
},
},
{
"echasnovski/mini.move",
keys = {
{ "<C-l>", mode = { "n", "v" } },
{ "<C-k>", mode = { "n", "v" } },
{ "<C-j>", mode = { "n", "v" } },
{ "<C-h>", mode = { "n", "v" } },
},
opts = {
mappings = {
left = '<C-h>',
right = '<C-l>',
down = '<C-j>',
up = '<C-k>',
line_down = '<C-j>',
line_left = '<C-h>',
line_right = '<C-l>',
line_up = '<C-k>',
}
},
},
{
"arsham/indent-tools.nvim",
dependencies = { "arsham/arshlib.nvim" },
event = "User AstroFile",
config = function() require("indent-tools").config {} end,
},
{
"danymat/neogen",
cmd = "Neogen",
opts = {
snippet_engine = "luasnip",
languages = {
lua = { template = { annotation_convention = "emmylua" } },
typescript = { template = { annotation_convention = "tsdoc" } },
typescriptreact = { template = { annotation_convention = "tsdoc" } },
},
},
},
{
"lukas-reineke/headlines.nvim",
dependencies = "nvim-treesitter/nvim-treesitter",
ft = "markdown",
opts = {},
},
{
"folke/todo-comments.nvim",
event = "User AstroFile",
cmd = { "TodoTrouble", "TodoTelescope", "TodoLocList", "TodoQuickFix" },
opts = {},
},
{
"folke/trouble.nvim",
cmd = { "TroubleToggle", "Trouble" },
opts = {
use_diagnostic_signs = true,
action_keys = {
close = { "q", "<esc>" },
cancel = "<c-e>",
},
},
},
{
"nvim-pack/nvim-spectre",
cmd = "Spectre",
opts = function()
local prefix = "<leader>s"
return {
open_cmd = "new",
mapping = {
send_to_qf = { map = prefix .. "q" },
replace_cmd = { map = prefix .. "c" },
show_option_menu = { map = prefix .. "o" },
run_current_replace = { map = prefix .. "C" },
run_replace = { map = prefix .. "R" },
change_view_mode = { map = prefix .. "v" },
resume_last_search = { map = prefix .. "l" },
},
}
end,
},
{ "junegunn/vim-easy-align", event = "User AstroFile" },
{
"echasnovski/mini.surround",
keys = {
{ "sa", desc = "Add surrounding", mode = { "n", "v" } },
{ "sd", desc = "Delete surrounding" },
{ "sf", desc = "Find right surrounding" },
{ "sF", desc = "Find left surrounding" },
{ "sh", desc = "Highlight surrounding" },
{ "sr", desc = "Replace surrounding" },
{ "sn", desc = "Update `MiniSurround.config.n_lines`" },
},
opts = { n_lines = 200 },
},
}

27
lua/plugins/heirline.lua Normal file
View File

@ -0,0 +1,27 @@
return {
"rebelot/heirline.nvim",
opts = function(_, opts)
local status = require "astroui.status"
opts.statusline[3] = status.component.file_info { filetype = {}, filename = false }
opts.winbar[1][1] = status.component.separated_path { path_func = status.provider.filename { modify = ":.:h" } }
opts.winbar[2] = {
status.component.separated_path { path_func = status.provider.filename { modify = ":.:h" } },
status.component.file_info { -- add file_info to breadcrumbs
file_icon = { hl = status.hl.filetype_color, padding = { left = 0 } },
file_modified = false,
file_read_only = false,
hl = status.hl.get_attributes("winbar", true),
surround = false,
update = "BufEnter",
},
status.component.breadcrumbs {
icon = { hl = true },
hl = status.hl.get_attributes("winbar", true),
prefix = true,
padding = { left = 0 },
},
}
return opts
end,
}

4
lua/plugins/info.lua Normal file
View File

@ -0,0 +1,4 @@
return {
"HiPhish/info.vim",
lazy = false,
}

37
lua/plugins/mason.lua Normal file
View File

@ -0,0 +1,37 @@
-- customize mason plugins
return {
-- use mason-lspconfig to configure LSP installations
{
"williamboman/mason-lspconfig.nvim",
-- 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",
})
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)
-- 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",
})
end,
},
{
"jay-babu/mason-nvim-dap.nvim",
-- 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",
"cppdbg",
})
end,
},
}

5
lua/plugins/neo-tree.lua Normal file
View File

@ -0,0 +1,5 @@
return {
"nvim-neo-tree/neo-tree.nvim",
dependencies = "nvim-lua/plenary.nvim",
lazy = false,
}

7
lua/plugins/neoclip.lua Normal file
View File

@ -0,0 +1,7 @@
return {
"matveyt/neoclip",
lazy = false,
config = function(plugin, opts)
require("neoclip"):setup()
end,
}

35
lua/plugins/noice.lua Normal file
View File

@ -0,0 +1,35 @@
return {
{ "rcarriga/nvim-notify", init = false, config = true },
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if opts.ensure_installed ~= "all" then
opts.ensure_installed = require("astrocore").list_insert_unique(
opts.ensure_installed,
{ "bash", "markdown", "markdown_inline", "regex", "vim" }
)
end
end,
},
{
"folke/noice.nvim",
event = "VeryLazy",
opts = {
cmdline = { view = "cmdline" },
messages = { view_search = false },
lsp = {
progress = { enabled = false },
hover = { enabled = false },
signature = { enabled = false },
},
routes = {
{ filter = { event = "msg_show", min_height = 20 }, view = "messages" }, -- send long messages to split
{ filter = { event = "msg_show", find = "%d+L,%s%d+B" }, opts = { skip = true } }, -- skip save notifications
{ filter = { event = "msg_show", find = "^%d+ more lines$" }, opts = { skip = true } }, -- skip paste notifications
{ filter = { event = "msg_show", find = "^%d+ fewer lines$" }, opts = { skip = true } }, -- skip delete notifications
{ filter = { event = "msg_show", find = "^%d+ lines yanked$" }, opts = { skip = true } }, -- skip yank notifications
},
},
},
lazy = false,
}

22
lua/plugins/none-ls.lua Normal file
View File

@ -0,0 +1,22 @@
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"
-- 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 = {
-- Set a formatter
-- null_ls.builtins.formatting.stylua,
-- null_ls.builtins.formatting.prettier,
}
return config -- return final config table
end,
}

15
lua/plugins/nvim-cmp.lua Normal file
View File

@ -0,0 +1,15 @@
return {
"hrsh7th/nvim-cmp",
config = function(plugin, opts)
local cmp = require "cmp"
cmp.setup(opts)
cmp.setup {
experimental = {
ghost_text = true
}
}
end
}

23
lua/plugins/repl.lua Normal file
View File

@ -0,0 +1,23 @@
return {
{
"jupyter-vim/jupyter-vim",
ft = { "pyhon", "julia" },
config = function()
require("astrocore").set_mappings {
n = {
["<leader>J"] = { "<cmd>JupyterConnect<cr>", desc = "Connect to Jupyter" },
["<leader>j"] = { "<Plug>JupyterRunTextObj", desc = "Send to Jupyter" },
},
v = {
["<leader>j"] = { "<Plug>JupyterRunVisual", desc = "Send to Jupyter" },
},
}
end,
},
{
"mtikekar/nvim-send-to-term",
init = function() vim.g.send_disable_mapping = true end,
keys = { "<Plug>Send", "<Plug>SendLine" },
cmd = "SendHere",
},
}

107
lua/plugins/telescope.lua Normal file
View File

@ -0,0 +1,107 @@
return {
"nvim-telescope/telescope.nvim",
dependencies = {
{ "nvim-telescope/telescope-fzf-native.nvim", enabled = false },
"nvim-telescope/telescope-fzy-native.nvim",
"nvim-telescope/telescope-live-grep-args.nvim",
"nvim-telescope/telescope-hop.nvim",
"nvim-telescope/telescope-bibtex.nvim",
"nvim-telescope/telescope-file-browser.nvim",
{
"jay-babu/project.nvim",
name = "project_nvim",
event = "VeryLazy",
opts = { ignore_lsp = { "lua_ls", "julials" } },
},
},
opts = function(_, opts)
local telescope = require "telescope"
local actions = require "telescope.actions"
local fb_actions = require("telescope").extensions.file_browser.actions
local lga_actions = require "telescope-live-grep-args.actions"
local hop = telescope.extensions.hop
return require("astrocore").extend_tbl(opts, {
defaults = {
results_title = "",
selection_caret = " ",
layout_config = {
width = 0.90,
height = 0.85,
preview_cutoff = 120,
horizontal = {
preview_width = 0.6,
},
vertical = {
width = 0.9,
height = 0.95,
preview_height = 0.5,
},
flex = {
horizontal = {
preview_width = 0.9,
},
},
},
mappings = {
i = {
["<C-h>"] = hop.hop,
["<C-space>"] = function(prompt_bufnr)
hop._hop_loop(
prompt_bufnr,
{ callback = actions.toggle_selection, loop_callback = actions.send_selected_to_qflist }
)
end,
},
},
},
extensions = {
bibtex = { context = true, context_fallback = false },
file_browser = {
mappings = {
i = {
["<C-z>"] = fb_actions.toggle_hidden,
},
n = {
z = fb_actions.toggle_hidden,
},
},
},
live_grep_args = {
auto_quoting = true, -- enable/disable auto-quoting
mappings = { -- extend mappings
i = {
["<C-a>"] = lga_actions.quote_prompt(),
["<C-f>"] = lga_actions.quote_prompt { postfix = " --iglob " },
},
},
},
},
pickers = {
find_files = {
hidden = true,
find_command = function(cfg)
local find_command = { "rg", "--files", "--color", "never" }
if not cfg.no_ignore then vim.list_extend(find_command, { "--glob", "!**/.git/**" }) end
return find_command
end,
},
buffers = {
path_display = { "smart" },
mappings = {
i = { ["<c-d>"] = actions.delete_buffer },
n = { ["d"] = actions.delete_buffer },
},
},
},
})
end,
config = function(...)
-- require "plugins.configs.telescope"(...)
local telescope = require "telescope"
telescope.load_extension "fzy_native"
telescope.load_extension "live_grep_args"
telescope.load_extension "bibtex"
telescope.load_extension "file_browser"
telescope.load_extension "projects"
end,
}

View File

@ -0,0 +1,6 @@
return {
"akinsho/toggleterm.nvim",
opts = {
open_mapping = [[<C-'>]],
},
}

View File

@ -0,0 +1,25 @@
return {
{
"nvim-treesitter/nvim-treesitter",
lazy = false,
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"
})
end,
config = function()
require("nvim-treesitter.configs").setup {
highlight = {
enable = true,
},
autotag = {
enable = true,
enable_rename = true,
enable_close = true,
enable_close_on_slash = true,
}
}
end
}
}

12
lua/plugins/user.lua Normal file
View File

@ -0,0 +1,12 @@
return {
-- You can also add new plugins here as well:
-- Add plugins, the lazy syntax
-- "andweeb/presence.nvim",
-- {
-- "ray-x/lsp_signature.nvim",
-- event = "BufRead",
-- config = function()
-- require("lsp_signature").setup()
-- end,
-- },
}

View File

@ -0,0 +1,7 @@
return {
{
"akielaries/vim-s-asm",
lazy = false,
name = "vim-s-asm",
}
}

4
lua/plugins/wiki.lua Normal file
View File

@ -0,0 +1,4 @@
return {
"lervag/wiki.vim",
lazy = false,
}

18
lua/polish.lua Normal file
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",
},
}

60
lua/utils.lua Normal file
View File

@ -0,0 +1,60 @@
local M = {}
function M.vim_opt_toggle(opt, on, off, name)
if on == nil then on = true end
if off == nil then off = false end
if not name then name = opt end
local is_off = vim.opt[opt]:get() == off
vim.opt[opt] = is_off and on or off
require("astrocore").notify(name .. " " .. (is_off and "Enabled" or "Disabled"))
end
function M.async_run(cmd, on_finish)
local lines = { "" }
local function on_event(_, data, event)
if (event == "stdout" or event == "stderr") and data then vim.list_extend(lines, data) end
if event == "exit" then
vim.fn.setqflist({}, " ", {
title = table.concat(cmd, " "),
lines = lines,
efm = "%f:%l:%c: %t%n %m",
})
if on_finish then on_finish() end
end
end
vim.fn.jobstart(cmd, {
on_stdout = on_event,
on_stderr = on_event,
on_exit = on_event,
stdout_buffered = true,
stderr_buffered = true,
})
end
function M.toggle_qf()
local qf_exists = false
for _, win in pairs(vim.fn.getwininfo()) do
if win["quickfix"] == 1 then
qf_exists = true
break
end
end
if qf_exists then
vim.cmd.cclose()
elseif not vim.tbl_isempty(vim.fn.getqflist()) then
vim.cmd.copen()
end
end
function M.better_search(key)
return function()
local searched, error =
pcall(vim.cmd.normal, { args = { (vim.v.count > 0 and vim.v.count or "") .. key }, bang = true })
if not searched and type(error) == "string" then require("astrocore").notify(error, vim.log.levels.ERROR) end
end
end
return M

6
neovim.yml Normal file
View File

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

8
selene.toml Normal file
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"

13
templates/template.c Normal file
View File

@ -0,0 +1,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define ll long long
#define rep(i, lim) for (size_t i; i < lim; i++)
int main()
{
return 0;
}

76
templates/template.cpp Normal file
View File

@ -0,0 +1,76 @@
#include <bits/stdc++.h>
using namespace std;
#define V vector
#define rmin(a, b) a = min(a, b)
#define rmax(a, b) a = max(a, b)
#define rep(i, lim) for (size_t i = 0; i < (lim); i++)
#define nrep(i, s, lim) for (size_t i = s; i < (lim); i++)
#define repv(i, v) for (auto &i : (v))
#define fillv(v) for (auto &itr_ : (v)) { cin >> itr_; }
#define sortv(v) sort(v.begin(), v.end())
#define all(v) (v).begin(), (v).end()
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vvvvi = vector<vvvi>;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vvvvl = vector<vvvl>;
template<class v>
auto operator<<(ostream &os, const vector<v> &vec)->ostream& {
os << vec[0];
for (size_t i = 1; i < vec.size(); i++) {
os << ' ' << vec[i];
}
os << '\n';
return os;
}
template<class v>
auto operator>>(istream &is, vector<v> &vec)->istream& {
for (auto &i : vec) {
is >> i;
}
return is;
}
template<class v>
auto operator<<(ostream &os, const vector<vector<v>> &vec)->ostream& {
for (auto &i : vec) {
os << i[0];
for (size_t j = 1; j < i.size(); j++) {
os << ' ' << i[j];
}
os << '\n';
}
return os;
}
template<class v>
auto operator>>(istream &is, vector<vector<v>> &vec)->istream& {
for (auto &i : vec) {
for (auto &j : i) {
is >> j;
}
}
return is;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
}