Replace multiple plugins with mini.nvim

This commit is contained in:
CronyAkatsuki 2024-01-11 15:46:01 +01:00
parent 92511131d1
commit c2e9b1ae51
7 changed files with 164 additions and 162 deletions

View File

@ -1,15 +0,0 @@
{
"runtime.version": "LuaJIT",
"runtime.path": [
"lua/?.lua",
"lua/?/init.lua"
],
"diagnostics.globals": [
"vim"
],
"workspace.checkThirdParty": false,
"workspace.library": [
"$VIMRUNTIME",
"./lua"
]
}

View File

@ -0,0 +1,5 @@
vim.keymap.set("n", "md", "<cmd>HeaderDemote<cr>", { desc = "Demote markdown header" })
vim.keymap.set("n", "mp", "<cmd>HeaderPromote<cr>", { desc = "Promote markdown header" })
vim.keymap.set("n", "mt", "<cmd>ToDoToggle<cr>", { desc = "Toggle Existing Todo Item" })

View File

@ -1,27 +0,0 @@
vim.keymap.set("n", "<leader>gs", vim.cmd.Git, { desc = "Git status" })
local Crony_Fugitive = vim.api.nvim_create_augroup("Crony_Fugitive", {})
local autocmd = vim.api.nvim_create_autocmd
autocmd("BufWinEnter", {
group = Crony_Fugitive,
pattern = "*",
callback = function()
if vim.bo.ft ~= "fugitive" then
return
end
local bufnr = vim.api.nvim_get_current_buf()
local opts = { buffer = bufnr, remap = false }
vim.keymap.set("n", "<leader>p", function()
vim.cmd.Git("push")
end, opts)
-- rebase always
vim.keymap.set("n", "<leader>P", function()
vim.cmd.Git({ "pull", "--rebase" })
end, opts)
vim.keymap.set("n", "<leader>t", ":Git push -u origin ", opts)
end,
})

View File

@ -1,82 +1,86 @@
local lsp = require("lsp-zero") -- settings erro signs
local function sign_define(args)
vim.fn.sign_define(args.name, {
texthl = args.name,
text = args.text,
numhl = "",
})
end
lsp.extend_cmp() sign_define({ name = "DiagnosticSignError", text = "E" })
local cmp = require("cmp") sign_define({ name = "DiagnosticSignWarn", text = "W" })
sign_define({ name = "DiagnosticSignHint", text = "H" })
sign_define({ name = "DiagnosticSignInfo", text = "I" })
cmp.setup({ -- enable diagnostics virtual text
window = { vim.diagnostic.config({
completion = cmp.config.window.bordered(), virtual_text = true,
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<C-k>"] = cmp.mapping.select_prev_item(),
["<C-j>"] = cmp.mapping.select_next_item(),
["<C-l>"] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete(),
["<Tab>"] = nil,
["<S-Tab>"] = nil,
}),
sources = {
{ name = "nvim_lsp" },
{ name = "buffer" },
{ name = "path" },
{ name = "nvim_lua" },
{ name = "luasnip" },
},
}) })
lsp.set_sign_icons({ -- diagnostic's aren't lsp dependent
error = "E", vim.keymap.set("n", "<leader>vd", function()
warn = "W", vim.diagnostic.open_float()
hint = "H", end)
info = "I", vim.keymap.set("n", "[d", function()
}) vim.diagnostic.goto_next()
end)
vim.keymap.set("n", "]d", function()
vim.diagnostic.goto_prev()
end)
lsp.extend_lspconfig() -- lsp related bindings
vim.api.nvim_create_autocmd("LspAttach", {
lsp.on_attach(function(client, bufnr) desc = "LSP Actions",
local opts = { buffer = bufnr, remap = false } callback = function(event)
local opts = { buffer = event.buf }
vim.keymap.set("n", "gd", function()
vim.lsp.buf.definition()
end, opts)
vim.keymap.set("n", "K", function() vim.keymap.set("n", "K", function()
vim.lsp.buf.hover() vim.lsp.buf.hover()
end, opts) end, opts)
vim.keymap.set("n", "<leader>vws", function() vim.keymap.set("n", "gd", function()
vim.lsp.buf.workspace_symbol() vim.lsp.buf.definition()
end, opts) end, opts)
vim.keymap.set("n", "<leader>vd", function() vim.keymap.set("n", "gD", function()
vim.diagnostic.open_float() vim.lsp.buf.declaration()
end, opts) end, opts)
vim.keymap.set("n", "[d", function() vim.keymap.set("n", "gi", function()
vim.diagnostic.goto_next() vim.lsp.buf.implementation()
end, opts) end, opts)
vim.keymap.set("n", "]d", function() vim.keymap.set("n", "<leader>lca", function()
vim.diagnostic.goto_prev()
end, opts)
vim.keymap.set("n", "<leader>vca", function()
vim.lsp.buf.code_action() vim.lsp.buf.code_action()
end, opts) end, opts)
vim.keymap.set("n", "<leader>vrr", function() vim.keymap.set("n", "<leader>lrn", function()
vim.lsp.buf.references()
end, opts)
vim.keymap.set("n", "<leader>vrn", function()
vim.lsp.buf.rename() vim.lsp.buf.rename()
end, opts) end, opts)
vim.keymap.set("i", "<C-h>", function() vim.keymap.set("i", "<C-h>", function()
vim.lsp.buf.signature_help() vim.lsp.buf.signature_help()
end, opts) end, opts)
end) end,
vim.diagnostic.config({
virtual_text = true,
}) })
-- setup mason and automatically install some language server's
require("mason").setup({}) require("mason").setup({})
require("mason-lspconfig").setup({ require("mason-lspconfig").setup({
ensure_installed = { "lua_ls", "jsonls", "bashls", "pyright", "marksman", "gopls" }, ensure_installed = { "lua_ls", "jsonls", "bashls", "pyright", "marksman", "gopls", "clangd" },
handlers = {
lsp.default_setup,
},
}) })
-- automatically setup already installed lsp's
require("mason-lspconfig").setup_handlers({
function(server_name)
require("lspconfig")[server_name].setup({})
end,
})
-- setup haskell language server manually cause it doesn't work with mason for xmonad
require("lspconfig").hls.setup({})
-- autocompletion using mini.completion
require("mini.completion").setup({
lsp_completion = {
source_func = "omnifunc",
},
fallback_action = "<C-x><C-n>",
})
-- bind ctrl j and k to move beetwen completion items
vim.keymap.set("i", "<C-j>", [[pumvisible() ? "\<C-n>" : "\<C-j>"]], { expr = true })
vim.keymap.set("i", "<C-k>", [[pumvisible() ? "\<C-p>" : "\<C-k>"]], { expr = true })

22
after/plugin/mini.lua Normal file
View File

@ -0,0 +1,22 @@
-- Setup my mini.nvim settings
-- mini.nvim is amazing because it add's a lot of functionality while keeping itself as minimal as possible
-- because of it's modular nature and fact it has a lot of functionality it lower the amount of needed plugins even for advanced features
-- mini.nvim statusline module
require("mini.statusline").setup({
set_vim_options = false,
})
-- mini.nvim commeting module
require("mini.comment").setup({})
-- mini.nvim notification module
require("mini.notify").setup({})
-- make it default notification engine
vim.notify = require("mini.notify").make_notify()
-- mini.nvim surround module
require("mini.surround").setup({})
-- mini.nvim file management module
require("mini.files").setup({})

39
after/plugin/mkdnflow.lua Normal file
View File

@ -0,0 +1,39 @@
require("mkdnflow").setup({
modules = {
bib = false,
buffers = false,
links = false,
paths = false,
folds = false,
},
links = {
style = "wiki",
name_is_source = true,
conceal = true,
},
mappings = {
-- disabling mapping's I don't need, because there are
-- already built in neovim keybindings that do this,
-- or I don't need their functionality
-- (A lot of these become obsolete when using a lsp like marksman)
MkdnEnter = false,
MkdnGoBack = false,
MkdnGoForward = false,
MkdnCreateLinkFromClipboard = false,
MkdnDestroyLink = false,
MkdnMoveSource = false,
MkdnYankAnchorLink = false,
MkdnYankFileAnchorLink = false,
-- I hate plugins hijacking my tab in insert mode
MkdnTableNextCell = false,
MkdnTablePrevCell = false,
-- neovim has built in markdown folding now
MkdnFoldSection = false,
MkdnUnfoldSection = false,
-- this just seems nicer
MkdnIncreaseHeading = { "n", "<localleader>i" },
MkdnDecreaseHeading = { "n", "<localleader>d" },
-- normal ctrl+space is my thux binding
MkdnToggleToDo = { "n", "<localleader>t" },
},
})

View File

@ -14,39 +14,25 @@ vim.opt.rtp:prepend(lazypath)
-- plugins installation and configuration -- plugins installation and configuration
require("lazy").setup({ require("lazy").setup({
-- Git plugins
"tpope/vim-fugitive",
{
"VonHeikemen/lsp-zero.nvim",
branch = "v3.x",
dependencies = {
-- LSP Support -- LSP Support
{ "neovim/nvim-lspconfig" }, { "neovim/nvim-lspconfig" },
{ "williamboman/mason.nvim" }, { "williamboman/mason.nvim" },
{ "williamboman/mason-lspconfig.nvim" }, { "williamboman/mason-lspconfig.nvim" },
-- Autocompletion
{ "hrsh7th/nvim-cmp" },
{ "hrsh7th/cmp-buffer" },
{ "hrsh7th/cmp-path" },
{ "saadparwaiz1/cmp_luasnip" },
{ "hrsh7th/cmp-nvim-lsp" },
{ "hrsh7th/cmp-nvim-lua" },
-- Snippets
{ "L3MON4D3/LuaSnip" },
{ "rafamadriz/friendly-snippets" },
-- Additional neovim docs
"folke/neodev.nvim",
opts = {},
},
},
{
-- Adds git related signs to the gutter, as well as utilities for managing changes -- Adds git related signs to the gutter, as well as utilities for managing changes
"lewis6991/gitsigns.nvim", "lewis6991/gitsigns.nvim",
{
"folke/neodev.nvim",
opts = {
override = function(rood_dir, library)
-- Make sure neodev load's in directory where I'm making my own plugins
if rood_dir:find(os.getenv("HOME") .. "/repos/neovim/plugins/", 1, true) == 1 then
library.enabled = true
library.plugins = true
end
end,
},
}, },
{ {
@ -56,9 +42,6 @@ require("lazy").setup({
priority = 1000, priority = 1000,
}, },
-- "gc" to comment visual regions/lines
{ "numToStr/Comment.nvim", opts = {}},
-- Fuzzy Finder (files, lsp, etc) -- Fuzzy Finder (files, lsp, etc)
{ {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
@ -99,14 +82,6 @@ require("lazy").setup({
}, },
}, },
{
-- nicer notification's
"rcarriga/nvim-notify",
config = function()
vim.notify = require("notify")
end,
},
-- additional formater support -- additional formater support
"stevearc/conform.nvim", "stevearc/conform.nvim",
@ -116,12 +91,11 @@ require("lazy").setup({
-- mason autoinstaller for formatter's and linter's -- mason autoinstaller for formatter's and linter's
"WhoIsSethDaniel/mason-tool-installer.nvim", "WhoIsSethDaniel/mason-tool-installer.nvim",
{ -- Trying out writting plugins
-- vim teacher hard core { dir = "~/repos/neovim/plugins/md-tools.nvim" },
"m4xshen/hardtime.nvim",
dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" }, -- Minimal neovim modules for a lot of things
opts = {}, { "echasnovski/mini.nvim" },
},
}, { }, {
install = { install = {
colorscheme = { "catppuccin" }, colorscheme = { "catppuccin" },