diff --git a/.luarc.json b/.luarc.json deleted file mode 100644 index 03e738a..0000000 --- a/.luarc.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "runtime.version": "LuaJIT", - "runtime.path": [ - "lua/?.lua", - "lua/?/init.lua" - ], - "diagnostics.globals": [ - "vim" - ], - "workspace.checkThirdParty": false, - "workspace.library": [ - "$VIMRUNTIME", - "./lua" - ] -} diff --git a/after/ftplugin/markdown.lua b/after/ftplugin/markdown.lua new file mode 100644 index 0000000..01c7f2d --- /dev/null +++ b/after/ftplugin/markdown.lua @@ -0,0 +1,5 @@ +vim.keymap.set("n", "md", "HeaderDemote", { desc = "Demote markdown header" }) + +vim.keymap.set("n", "mp", "HeaderPromote", { desc = "Promote markdown header" }) + +vim.keymap.set("n", "mt", "ToDoToggle", { desc = "Toggle Existing Todo Item" }) diff --git a/after/plugin/fugitive.lua b/after/plugin/fugitive.lua deleted file mode 100644 index 88f2f1a..0000000 --- a/after/plugin/fugitive.lua +++ /dev/null @@ -1,27 +0,0 @@ -vim.keymap.set("n", "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", "p", function() - vim.cmd.Git("push") - end, opts) - - -- rebase always - vim.keymap.set("n", "P", function() - vim.cmd.Git({ "pull", "--rebase" }) - end, opts) - - vim.keymap.set("n", "t", ":Git push -u origin ", opts) - end, -}) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 39b2b94..252c1e1 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -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() -local cmp = require("cmp") - -cmp.setup({ - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping.complete(), - [""] = nil, - [""] = nil, - }), - sources = { - { name = "nvim_lsp" }, - { name = "buffer" }, - { name = "path" }, - { name = "nvim_lua" }, - { name = "luasnip" }, - }, -}) - -lsp.set_sign_icons({ - error = "E", - warn = "W", - hint = "H", - info = "I", -}) - -lsp.extend_lspconfig() - -lsp.on_attach(function(client, bufnr) - local opts = { buffer = bufnr, remap = false } - - vim.keymap.set("n", "gd", function() - vim.lsp.buf.definition() - end, opts) - vim.keymap.set("n", "K", function() - vim.lsp.buf.hover() - end, opts) - vim.keymap.set("n", "vws", function() - vim.lsp.buf.workspace_symbol() - end, opts) - vim.keymap.set("n", "vd", function() - vim.diagnostic.open_float() - end, opts) - vim.keymap.set("n", "[d", function() - vim.diagnostic.goto_next() - end, opts) - vim.keymap.set("n", "]d", function() - vim.diagnostic.goto_prev() - end, opts) - vim.keymap.set("n", "vca", function() - vim.lsp.buf.code_action() - end, opts) - vim.keymap.set("n", "vrr", function() - vim.lsp.buf.references() - end, opts) - vim.keymap.set("n", "vrn", function() - vim.lsp.buf.rename() - end, opts) - vim.keymap.set("i", "", function() - vim.lsp.buf.signature_help() - end, opts) -end) +sign_define({ name = "DiagnosticSignError", text = "E" }) +sign_define({ name = "DiagnosticSignWarn", text = "W" }) +sign_define({ name = "DiagnosticSignHint", text = "H" }) +sign_define({ name = "DiagnosticSignInfo", text = "I" }) +-- enable diagnostics virtual text vim.diagnostic.config({ virtual_text = true, }) +-- diagnostic's aren't lsp dependent +vim.keymap.set("n", "vd", function() + vim.diagnostic.open_float() +end) +vim.keymap.set("n", "[d", function() + vim.diagnostic.goto_next() +end) +vim.keymap.set("n", "]d", function() + vim.diagnostic.goto_prev() +end) + +-- lsp related bindings +vim.api.nvim_create_autocmd("LspAttach", { + desc = "LSP Actions", + callback = function(event) + local opts = { buffer = event.buf } + vim.keymap.set("n", "K", function() + vim.lsp.buf.hover() + end, opts) + vim.keymap.set("n", "gd", function() + vim.lsp.buf.definition() + end, opts) + vim.keymap.set("n", "gD", function() + vim.lsp.buf.declaration() + end, opts) + vim.keymap.set("n", "gi", function() + vim.lsp.buf.implementation() + end, opts) + vim.keymap.set("n", "lca", function() + vim.lsp.buf.code_action() + end, opts) + vim.keymap.set("n", "lrn", function() + vim.lsp.buf.rename() + end, opts) + vim.keymap.set("i", "", function() + vim.lsp.buf.signature_help() + end, opts) + end, +}) + +-- setup mason and automatically install some language server's require("mason").setup({}) require("mason-lspconfig").setup({ - ensure_installed = { "lua_ls", "jsonls", "bashls", "pyright", "marksman", "gopls" }, - handlers = { - lsp.default_setup, - }, + ensure_installed = { "lua_ls", "jsonls", "bashls", "pyright", "marksman", "gopls", "clangd" }, }) + +-- 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 = "", +}) + +-- bind ctrl j and k to move beetwen completion items +vim.keymap.set("i", "", [[pumvisible() ? "\" : "\"]], { expr = true }) +vim.keymap.set("i", "", [[pumvisible() ? "\" : "\"]], { expr = true }) diff --git a/after/plugin/mini.lua b/after/plugin/mini.lua new file mode 100644 index 0000000..3a9eb07 --- /dev/null +++ b/after/plugin/mini.lua @@ -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({}) diff --git a/after/plugin/mkdnflow.lua b/after/plugin/mkdnflow.lua new file mode 100644 index 0000000..f3e0499 --- /dev/null +++ b/after/plugin/mkdnflow.lua @@ -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", "i" }, + MkdnDecreaseHeading = { "n", "d" }, + -- normal ctrl+space is my thux binding + MkdnToggleToDo = { "n", "t" }, + }, +}) diff --git a/lua/crony/lazy.lua b/lua/crony/lazy.lua index 740a1f8..79c66d8 100644 --- a/lua/crony/lazy.lua +++ b/lua/crony/lazy.lua @@ -14,41 +14,27 @@ vim.opt.rtp:prepend(lazypath) -- plugins installation and configuration require("lazy").setup({ - -- Git plugins - "tpope/vim-fugitive", + -- LSP Support + { "neovim/nvim-lspconfig" }, + { "williamboman/mason.nvim" }, + { "williamboman/mason-lspconfig.nvim" }, + + -- Adds git related signs to the gutter, as well as utilities for managing changes + "lewis6991/gitsigns.nvim", { - "VonHeikemen/lsp-zero.nvim", - branch = "v3.x", - dependencies = { - -- LSP Support - { "neovim/nvim-lspconfig" }, - { "williamboman/mason.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 = {}, + "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, }, }, - { - -- Adds git related signs to the gutter, as well as utilities for managing changes - "lewis6991/gitsigns.nvim", - }, - { -- Catppuccin, the best pastell color scheme "catppuccin/nvim", @@ -56,9 +42,6 @@ require("lazy").setup({ priority = 1000, }, - -- "gc" to comment visual regions/lines - { "numToStr/Comment.nvim", opts = {}}, - -- Fuzzy Finder (files, lsp, etc) { "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 "stevearc/conform.nvim", @@ -116,12 +91,11 @@ require("lazy").setup({ -- mason autoinstaller for formatter's and linter's "WhoIsSethDaniel/mason-tool-installer.nvim", - { - -- vim teacher hard core - "m4xshen/hardtime.nvim", - dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" }, - opts = {}, - }, + -- Trying out writting plugins + { dir = "~/repos/neovim/plugins/md-tools.nvim" }, + + -- Minimal neovim modules for a lot of things + { "echasnovski/mini.nvim" }, }, { install = { colorscheme = { "catppuccin" },