diff --git a/after/ftplugin/gdscript.lua b/after/ftplugin/gdscript.lua new file mode 100644 index 0000000..ad929a7 --- /dev/null +++ b/after/ftplugin/gdscript.lua @@ -0,0 +1,12 @@ +local port = tonumber(os.getenv("GDScript_Port")) or 6005 +local cmd = vim.lsp.rpc.connect("127.0.0.1", port) +local pipe = "/tmp/godot.pipe" -- I use /tmp/godot.pipe + +vim.lsp.start({ + name = "Godot", + cmd = cmd, + root_dir = vim.fs.dirname(vim.fs.find({ "project.godot", ".git" }, { upward = true })[1]), + on_attach = function(client, bufnr) + vim.api.nvim_command('echo serverstart("' .. pipe .. '")') + end, +}) diff --git a/after/ftplugin/norg.lua b/after/ftplugin/norg.lua new file mode 100644 index 0000000..7017f63 --- /dev/null +++ b/after/ftplugin/norg.lua @@ -0,0 +1,3 @@ +vim.opt.conceallevel = 2 +vim.opt.concealcursor = "nc" +vim.opt.foldlevel = 99 diff --git a/after/ftplugin/qml.lua b/after/ftplugin/qml.lua new file mode 100644 index 0000000..5f5d95e --- /dev/null +++ b/after/ftplugin/qml.lua @@ -0,0 +1,4 @@ +local conf = vim.lsp.config.qmlls +conf.root_markers = { ".qmlls.ini" } +vim.lsp.config("qmlls", conf) +vim.lsp.enable("qmlls") diff --git a/after/ftplugin/zig.lua b/after/ftplugin/zig.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/config/autocmd.lua b/lua/config/autocmd.lua index e69de29..6328d2c 100644 --- a/lua/config/autocmd.lua +++ b/lua/config/autocmd.lua @@ -0,0 +1,12 @@ +-- put this in your init.lua +vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { + pattern = { "*.yuck" }, + callback = function(event) + print(string.format("starting yuck;s for %s", vim.inspect(event))) + vim.lsp.start({ + name = "YuckLs", + cmd = { "yuckls" }, -- if installed from aur + root_dir = vim.fn.getcwd(), + }) + end, +}) diff --git a/lua/config/general.lua b/lua/config/general.lua index c0a412b..5b892b8 100644 --- a/lua/config/general.lua +++ b/lua/config/general.lua @@ -2,6 +2,7 @@ vim.opt.tabstop = 4 vim.opt.softtabstop = 0 vim.opt.shiftwidth = 0 vim.opt.shell = "/bin/bash" +vim.opt.linebreak = true vim.cmd("set wrap smoothscroll") vim.opt.rnu = true diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua new file mode 100644 index 0000000..374d1e0 --- /dev/null +++ b/lua/config/lsp.lua @@ -0,0 +1,2 @@ +-- lsp that are not on mason/beta branch lsp +vim.lsp.enable("zls") diff --git a/lua/plugins/boo.lua b/lua/plugins/boo.lua new file mode 100644 index 0000000..39abddb --- /dev/null +++ b/lua/plugins/boo.lua @@ -0,0 +1,4 @@ +return { + "LukasPietzschmann/boo.nvim", + opts = {}, +} diff --git a/lua/plugins/conformer.lua b/lua/plugins/conformer.lua index b2acafc..6007628 100644 --- a/lua/plugins/conformer.lua +++ b/lua/plugins/conformer.lua @@ -1,15 +1,15 @@ return { "stevearc/conform.nvim", + dependencies = { "frostplexx/mason-bridge.nvim" }, event = { "BufWritePre" }, cmd = { "ConformInfo" }, init = function() - require "conform".setup( - { - format_on_save = function(bufnr) - require("conform").formatters_by_ft = require "mason-bridge".get_formatters() - return { timeout_ms = 200, lsp_fallback = true }, on_format - end, - formatters_by_ft = require("mason-bridge").get_formatters(), --[[ = { + require("conform").setup({ + format_on_save = function(bufnr) + require("conform").formatters_by_ft = require("mason-bridge").get_formatters() + return { timeout_ms = 200, lsp_fallback = true }, on_format + end, + formatters_by_ft = require("mason-bridge").get_formatters(), --[[ = { lua = { "stylua" }, javascript = { "prettier" }, html = { "prettier" }, @@ -23,26 +23,26 @@ return { json = { "jq" }, }, ]] -- - -- This will provide type hinting with LuaLS - ---@module "conform" - ---@type conform.setupOpts - formatters = { - prettier = { - prepend_args = { "--use-tabs", "true" }, - }, - jq = { - prepend_args = { "--tab" }, - }, - ["clang-format"] = { - prepend_args = function(self, ctx) - return { "-style=file:/home/Dario48/.config/.clang-format" } - end, - }, - default_format_opts = { - lsp_format = "fallback", - }, + -- This will provide type hinting with LuaLS + ---@module "conform" + ---@type conform.setupOpts + formatters = { + prettier = { + prepend_args = { "--use-tabs", "true" }, }, - }) + jq = { + prepend_args = { "--tab" }, + }, + ["clang-format"] = { + prepend_args = function(self, ctx) + return { "-style=file:/home/Dario48/.config/.clang-format" } + end, + }, + default_format_opts = { + lsp_format = "fallback", + }, + }, + }) -- If you want the formatexpr, here is the place to set it vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" vim.g.arduino_recommended_style = 0 diff --git a/lua/plugins/darioline.lua b/lua/plugins/darioline.lua index 0f32fc7..73de90c 100644 --- a/lua/plugins/darioline.lua +++ b/lua/plugins/darioline.lua @@ -1,4 +1,4 @@ return { - url = "https://codeberg.org/Dario48/darioline.git", - config = true + url = "https://dario48.site/git/Dario48/darioline.git", + config = true, } diff --git a/lua/plugins/diagram.lua b/lua/plugins/diagram.lua new file mode 100644 index 0000000..18c857d --- /dev/null +++ b/lua/plugins/diagram.lua @@ -0,0 +1,40 @@ +return { + "3rd/diagram.nvim", + dependencies = { + { "3rd/image.nvim" }, -- you'd probably want to configure image.nvim manually instead of doing this + }, + opts = { -- you can just pass {}, defaults below + events = { + render_buffer = { "InsertLeave", "BufWinEnter", "TextChanged" }, + clear_buffer = { "BufLeave" }, + }, + renderer_options = { + mermaid = { + background = nil, -- nil | "transparent" | "white" | "#hex" + theme = nil, -- nil | "default" | "dark" | "forest" | "neutral" + scale = 1, -- nil | 1 (default) | 2 | 3 | ... + width = nil, -- nil | 800 | 400 | ... + height = nil, -- nil | 600 | 300 | ... + cli_args = nil, -- nil | { "--no-sandbox" } | { "-p", "/path/to/puppeteer" } | ... + }, + plantuml = { + charset = nil, + cli_args = nil, -- nil | { "-Djava.awt.headless=true" } | ... + }, + d2 = { + theme_id = nil, + dark_theme_id = nil, + scale = nil, + layout = nil, + sketch = nil, + cli_args = nil, -- nil | { "--pad", "0" } | ... + }, + gnuplot = { + size = nil, -- nil | "800,600" | ... + font = nil, -- nil | "Arial,12" | ... + theme = nil, -- nil | "light" | "dark" | custom theme string + cli_args = nil, -- nil | { "-p" } | { "-c", "config.plt" } | ... + }, + }, + }, +} diff --git a/lua/plugins/fuzzyfind.lua b/lua/plugins/fuzzyfind.lua new file mode 100644 index 0000000..445374c --- /dev/null +++ b/lua/plugins/fuzzyfind.lua @@ -0,0 +1,11 @@ +return { + "nvim-telescope/telescope.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + + keys = { + { "ff", require("telescope.builtin").find_files, desc = "Telescope find files" }, + { "fg", require("telescope.builtin").live_grep, desc = "Telescope live grep" }, + { "fb", require("telescope.builtin").buffers, desc = "Telescope buffers" }, + { "fh", require("telescope.builtin").help_tags, desc = "Telescope help tags" }, + }, +} diff --git a/lua/plugins/kmonad.lua b/lua/plugins/kmonad.lua new file mode 100644 index 0000000..4bfe392 --- /dev/null +++ b/lua/plugins/kmonad.lua @@ -0,0 +1,3 @@ +return { + "kmonad/kmonad-vim", +} diff --git a/lua/plugins/mason.lua b/lua/plugins/mason.lua index 1a6ba51..2f05d54 100644 --- a/lua/plugins/mason.lua +++ b/lua/plugins/mason.lua @@ -2,62 +2,72 @@ return { { "williamboman/mason.nvim", - dependencies = { "williamboman/mason-lspconfig.nvim" }, - keys = { { "m", ":Mason ", desc = "open mason" }, }, config = true, + opts = { + PATH = "append", + }, }, { "williamboman/mason-lspconfig.nvim", + dependencies = { "williamboman/mason.nvim" }, opts = { -- Replace the language servers listed here -- with the ones you want to install - ensure_installed = { "lua_ls", "clangd", "hyprls", "lua_ls" }, + ensure_installed = { "lua_ls", "clangd", "hyprls" }, handlers = { function(server_name) - require("lspconfig")[server_name].setup({ - }) + vim.lsp.enable(server_name) end, ["lua_ls"] = function() - require 'lspconfig'.lua_ls.setup { - on_init = function(client) - local path = client.workspace_folders[1].name - if vim.loop.fs_stat(path .. '/.luarc.json') or vim.loop.fs_stat(path .. '/.luarc.jsonc') then - return - end - - client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, { + vim.lsp.config("lua_ls", { + settings = { + Lua = { runtime = { -- Tell the language server which version of Lua you're using -- (most likely LuaJIT in the case of Neovim) - version = 'LuaJIT' + version = "LuaJIT", }, -- Make the server aware of Neovim runtime files workspace = { checkThirdParty = false, library = { - vim.env.VIMRUNTIME + vim.env.VIMRUNTIME, -- Depending on the usage, you might want to add additional paths here. -- "${3rd}/luv/library" -- "${3rd}/busted/library", - } + }, -- or pull in all of 'runtimepath'. NOTE: this is a lot slower -- library = vim.api.nvim_get_runtime_file("", true) - } - }) - end, - settings = { - Lua = {} - } - } - end + completion = { + callSnippet = "Replace", + }, + doc = { + privateName = { "^_" }, + }, + hint = { + enable = true, + setType = false, + paramType = true, + paramName = "Disable", + semicolon = "Disable", + arrayIndex = "Disable", + }, + }, + }, + }, + }) + vim.lsp.enable("lua_ls") + end, }, }, }, { "frostplexx/mason-bridge.nvim", + dependencies = { "williamboman/mason.nvim" }, + config = true, }, } diff --git a/lua/plugins/minuet-ai.lua b/lua/plugins/minuet-ai.lua new file mode 100644 index 0000000..45ab289 --- /dev/null +++ b/lua/plugins/minuet-ai.lua @@ -0,0 +1,52 @@ +return { + dependencies = { "nvim-lua/plenary.nvim" }, + "milanglacier/minuet-ai.nvim", + config = function() + require("minuet").setup({ + provider = "openai_fim_compatible", + n_completions = 1, -- recommend for local model for resource saving + context_window = 512, + provider_options = { + openai_fim_compatible = { + -- For Windows users, TERM may not be present in environment variables. + -- Consider using APPDATA instead. + api_key = "TERM", + name = "LLama.cpp", + end_point = "http://localhost:8012/v1/completions", + model = "PLACEHOLDER", + optional = { + max_tokens = 56, + top_p = 0.9, + }, + template = { + prompt = function(context_before_cursor, context_after_cursor, _) + return "<|fim_prefix|>" + .. context_before_cursor + .. "<|fim_suffix|>" + .. context_after_cursor + .. "<|fim_middle|>" + end, + suffix = false, + }, + }, + }, + virtualtext = { + auto_trigger_ft = {}, + keymap = { + -- accept whole completion + accept = "", + -- accept one line + accept_line = "", + -- accept n lines (prompts for number) + -- e.g. "A-z 2 CR" will accept 2 lines + accept_n_lines = "", + -- Cycle to prev completion item, or manually invoke completion + prev = "", + -- Cycle to next completion item, or manually invoke completion + next = "", + dismiss = "", + }, + }, + }) + end, +} diff --git a/lua/plugins/neorg.lua b/lua/plugins/neorg.lua index ed48bf5..1a2ac6f 100644 --- a/lua/plugins/neorg.lua +++ b/lua/plugins/neorg.lua @@ -1,6 +1,6 @@ return { "nvim-neorg/neorg", - lazy = true, -- Disable lazy loading as some `lazy.nvim` distributions set `lazy = true` by default + lazy = false, -- Disable lazy loading as some `lazy.nvim` distributions set `lazy = true` by default dependencies = { { "juniorsundar/neorg-extras", @@ -8,6 +8,7 @@ return { }, "nvim-telescope/telescope.nvim", -- Required for the Neorg-Roam features "nvim-lua/plenary.nvim", -- Required as part of Telescope installation + "nvim-treesitter/nvim-treesitter", }, opts = { load = { @@ -15,23 +16,28 @@ return { config = { metadata_fold = true, -- If want @data property ... @end to fold code_fold = true, -- If want @code ... @end to fold - } + }, }, ["core.defaults"] = {}, - ["core.concealer"] = { config = { folds = false } }, + ["core.concealer"] = {}, ["core.dirman"] = { config = { workspaces = { school = "~/Documents/school", notes = "~/Documents/notes", + uni = "~/Documents/uni", }, default_workspace = "notes", }, }, ["core.completion"] = { config = { engine = "nvim-cmp" } }, + ["core.integrations.treesitter"] = {}, + ["core.clipboard.code-blocks"] = {}, + ["core.esupports.indent"] = {}, }, }, ft = "norg", cmd = "Neorg", config = true, + version = "*", } diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua index ba47702..a66dc38 100644 --- a/lua/plugins/nvim-cmp.lua +++ b/lua/plugins/nvim-cmp.lua @@ -1,59 +1,79 @@ return { - "hrsh7th/nvim-cmp", - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", - "hrsh7th/cmp-nvim-lua", - "neovim/nvim-lspconfig", - "mtoohey31/cmp-fish", - "petertriho/cmp-git", - }, - config = function() - local cmp = require("cmp") + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "hrsh7th/cmp-nvim-lua", + "neovim/nvim-lspconfig", + "mtoohey31/cmp-fish", + "petertriho/cmp-git", + }, + config = function() + local cmp = require("cmp") - cmp.setup({ - sources = { - { name = "nvim_lua" }, - { - name = "nvim_lsp", - entry_filter = function(entry, ctx) - local kind = require("cmp.types").lsp.CompletionItemKind[entry:get_kind()] + cmp.setup({ + sources = { + { + name = "lazydev", + group_index = 0, -- set group index to 0 to skip loading LuaLS completions + }, + { name = "nvim_lua" }, + { + name = "nvim_lsp", + entry_filter = function(entry, ctx) + local kind = require("cmp.types").lsp.CompletionItemKind[entry:get_kind()] - if kind == "Text" then - return false - end - return true + if kind == "Text" then + return false + end + return true + end, + }, + { name = "neorg" }, + { name = "fish" }, + }, + snippet = { + expand = function(args) + -- You need Neovim v0.10 to use vim.snippet + vim.snippet.expand(args.body) end, }, - { name = "neorg" }, - { name = "fish" }, - }, - snippet = { - expand = function(args) - -- You need Neovim v0.10 to use vim.snippet - vim.snippet.expand(args.body) - end, - }, - cmp.setup.filetype("gitcommit", { - sources = cmp.config.sources({ - { name = "git" }, - }, { - { name = "buffer" }, + cmp.setup.filetype("gitcommit", { + sources = cmp.config.sources({ + { name = "git" }, + }, { + { name = "buffer" }, + }), }), - }), - require("cmp_git").setup(), + require("cmp_git").setup({}), - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(-4), - [" "] = cmp.mapping.confirm(), - }), - }) - end, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(-4), + [" "] = cmp.mapping.confirm(), + }), + }) + end, + }, + { + "folke/lazydev.nvim", + ft = "lua", -- only load on lua files + config = function() + local lazydev = require("lazydev") + require("lazydev").setup() + vim.lsp.enable("lua_ls") + vim.lsp.config("lua_ls", { + root_dir = function(bufnr, on_dir) + on_dir(lazydev.find_workspace(bufnr)) + end, + }) + end, + }, } diff --git a/lua/plugins/sniprun.lua b/lua/plugins/sniprun.lua new file mode 100644 index 0000000..4a62a6d --- /dev/null +++ b/lua/plugins/sniprun.lua @@ -0,0 +1,33 @@ +return { + "michaelb/sniprun", + branch = "master", + + build = "sh install.sh", + -- do 'sh install.sh 1' if you want to force compile locally + -- (instead of fetching a binary from the github release). Requires Rust >= 1.65 + + opts = { + repl_enable = { "Mathematica_original" }, + interpreter_options = { + Lua_nvim = { + use_on_filetypes = { "lua" }, + }, + Mathematica_original = { + use_javagraphics_if_contains = { "Plot" }, -- a pattern that need <r", "SnipRun", desc = "run snipper", silent = true }, + { "R", "SnipLive", desc = "run snipper in REPL mode", silent = true }, + { "r", "SnipRun", mode = "v", desc = "run snipper", silent = true }, + }, + + lazy = false, + + config = true, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 54f4ec6..443229e 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -2,38 +2,23 @@ return { "nvim-treesitter/nvim-treesitter", opts = { -- A list of parser names, or "all" (the listed parsers MUST always be installed) - ensure_installed = { "c", "lua", "norg"}, + ensure_installed = { "c", "lua", "vim", "vimdoc", "query" }, -- Install parsers synchronously (only applied to `ensure_installed`) sync_install = true, -- Automatically install missing parsers when entering buffer -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally - auto_install = true, + auto_install = false, -- List of parsers to ignore installing (or "all") ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")! - - highlight = { - enable = true, - - -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to - -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is - -- the name of the parser) - -- list of language that will be disabled - -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, - indent = { - enable = true, - disable = {"norg"} - }, + highlight = { enable = true }, }, - config = true, + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) + end, + version = "*", } diff --git a/lua/plugins/venn.lua b/lua/plugins/venn.lua new file mode 100644 index 0000000..36a00c7 --- /dev/null +++ b/lua/plugins/venn.lua @@ -0,0 +1,18 @@ +return { + "jbyuki/venn.nvim", + + config = function() + vim.b.ve = "all" + end, + + keys = { + { "J", "j:VBox", mode = "n", noremap = true }, + { "K", "k:VBox", mode = "n", noremap = true }, + { "L", "l:VBox", mode = "n", noremap = true }, + { "H", "h:VBox", mode = "n", noremap = true }, + -- draw a box by pressing "f" with visual selection, + { "f", ":VBox", mode = "v", noremap = true }, + }, + + lazy = true, +} diff --git a/lua/plugins/vim-table-mode.lua b/lua/plugins/vim-table-mode.lua new file mode 100644 index 0000000..d68e78d --- /dev/null +++ b/lua/plugins/vim-table-mode.lua @@ -0,0 +1,17 @@ +return { + "dhruvasagar/vim-table-mode", + config = function() + vim.g.table_mode_corner = "+" + end, + keys = { + { "tm", "TableModeToggle", desc = "toggla table mode" }, + { "tt", "Tableize", desc = "transform CVS to table" }, + { + "T", + function() + vim.api.nvim_command("Tableize/" .. vim.fn.input("what separator to use? ")) + end, + desc = "transform CVS to table", + }, + }, +}