diff --git a/configs/nvim/ftplugin/symboltree.lua b/configs/nvim/ftplugin/symboltree.lua new file mode 100644 index 0000000..db01a74 --- /dev/null +++ b/configs/nvim/ftplugin/symboltree.lua @@ -0,0 +1 @@ +vim.api.nvim_set_keymap("n", "I", "zo", { noremap = true, silent = true }) diff --git a/configs/nvim/init.lua b/configs/nvim/init.lua index e06cd2e..14524b1 100644 --- a/configs/nvim/init.lua +++ b/configs/nvim/init.lua @@ -1,16 +1,12 @@ vim.opt.termguicolors = true -require("core.bootstrap") -require("core.plugins") +require("max.core.bootstrap") +require("max.core.plugins") -require("core.options") -require("core.autocommands") -require("core.keymappings") +require("max.core.options") +require("max.core.autocommands") +require("max.core.keymappings") -require("configs.dashboard") -require("configs.lsp") -require("configs.dap") +require("max.theme.catpuccin") -require("theme.catpuccin") - -require("overlays") +require("max.overlays") diff --git a/configs/nvim/lazy-lock.json b/configs/nvim/lazy-lock.json index 360933f..f2408f7 100644 --- a/configs/nvim/lazy-lock.json +++ b/configs/nvim/lazy-lock.json @@ -1,10 +1,11 @@ { - "ChatGPT.nvim": { "branch": "main", "commit": "d656818c6968b25b68db94bd4abbd37330cbd3f0" }, - "Comment.nvim": { "branch": "master", "commit": "45dc21a71ad1450606f5e98261badb28db59d74c" }, + "ChatGPT.nvim": { "branch": "main", "commit": "6c7e326add8fbb8c6662d92dd6bd9e1eb15f7c5a" }, + "Comment.nvim": { "branch": "master", "commit": "7bb563ff2d811a63b207e9de63e3e9c0877cb6d5" }, "LuaSnip": { "branch": "master", "commit": "5570fd797eae0790affb54ea669a150cad76db5d" }, "alpha-nvim": { "branch": "main", "commit": "21a0f2520ad3a7c32c0822f943368dc063a569fb" }, - "autolist.nvim": { "branch": "main", "commit": "f600383a7ad97de236e7d968a74a4c4f847ae03d" }, + "autolist.nvim": { "branch": "main", "commit": "5002ebc078f90dd9615869c38d9e12f9fd288ccf" }, "boole.nvim": { "branch": "main", "commit": "d059fd7da634aaaabddbb280709f92effd9f2dba" }, + "bufferline.nvim": { "branch": "main", "commit": "c7492a76ce8218e3335f027af44930576b561013" }, "catppuccin": { "branch": "main", "commit": "3020af75aae098a77737d91ee37c7147c8450d99" }, "cmp-calc": { "branch": "main", "commit": "50792f34a628ea6eb31d2c90e8df174671e4e7a0" }, "cmp-cmdline": { "branch": "main", "commit": "23c51b2a3c00f6abc4e922dbd7c3b9aca6992063" }, @@ -18,37 +19,40 @@ "editorconfig-vim": { "branch": "master", "commit": "30ddc057f71287c3ac2beca876e7ae6d5abe26a0" }, "friendly-snippets": { "branch": "main", "commit": "1a6a02350568d6830bcfa167c72f9b6e75e454ae" }, "fwatch.nvim": { "branch": "main", "commit": "a691f7349dc66285cd75a1a698dd28bca45f2bf8" }, - "fzf": { "branch": "master", "commit": "44b63363729adfc6f477bedcfb4c7b6a379b948b" }, - "git-conflict.nvim": { "branch": "main", "commit": "77faa75c09a6af88e7b54d8d456327e06611f7ea" }, + "fzf": { "branch": "master", "commit": "51ef0b7f661e8df853f8c3e93fc9d52ba12c7f27" }, + "git-conflict.nvim": { "branch": "main", "commit": "cbefa7075b67903ca27f6eefdc9c1bf0c4881017" }, "gitsigns.nvim": { "branch": "main", "commit": "2ab3bdf0a40bab53033048c6be75bda86316b55d" }, - "lazy.nvim": { "branch": "main", "commit": "dc03fa1ae57c3949874c9cae50074a83232c4eed" }, + "lazy.nvim": { "branch": "main", "commit": "06db1ec3c6baa9460e42ef8ed4d2cc2613b194cb" }, "leap.nvim": { "branch": "main", "commit": "e0145906c5f004b23eb6ec876fad55ffd3382ec9" }, + "litee-calltree.nvim": { "branch": "main", "commit": "e2dffec35740032258fee3a3c7f30123226f2271" }, + "litee-symboltree.nvim": { "branch": "main", "commit": "488a660afcfd54644e6b755256907d3c7d8cf8d0" }, + "litee.nvim": { "branch": "main", "commit": "bf366a1414fd0f9401631ac8884f2f9fa4bf18d2" }, "lsp_lines.nvim": { "branch": "main", "commit": "ec98b45c8280e5ef8c84028d4f38aa447276c002" }, "lspkind.nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" }, "lspsaga.nvim": { "branch": "main", "commit": "b7b4777369b441341b2dcd45c738ea4167c11c9e" }, "lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" }, "lualine.nvim": { "branch": "master", "commit": "32a7382a75a52e8ad05f4cec7eeb8bbfbe80d461" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "31d8ed0dd3daf6cc64e35d710a190b64080bdc86" }, - "mason.nvim": { "branch": "main", "commit": "c4738030830594591228c4fe42d78802cf940e13" }, - "neotest": { "branch": "master", "commit": "de2f68fb13a05c361e0c096e167f7f79712f3a5c" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "aa25b4153d2f2636c3b3a8c8360349d2b29e7ae3" }, + "mason.nvim": { "branch": "main", "commit": "b8c3fceed16d29a166cf73ce55358f13c9f6cfcc" }, + "neotest": { "branch": "master", "commit": "414b43f99da0a827c3ce897161fc67c3bb6a5d83" }, "nui.nvim": { "branch": "main", "commit": "4939282919885e1c83aff68ecb35b3cadf6015a9" }, - "null-ls.nvim": { "branch": "main", "commit": "eaacba0b93c416252894f8bdc68e6b50b4e4c3b4" }, + "null-ls.nvim": { "branch": "main", "commit": "d09d7d82cc26d63673cef85cb62895dd68aab6d8" }, "nvim-autopairs": { "branch": "master", "commit": "03580d758231956d33c8dd91e2be195106a79fa4" }, - "nvim-cmp": { "branch": "main", "commit": "e55033fce468c9c578b946948807f2ac48a6ee08" }, - "nvim-dap": { "branch": "master", "commit": "6f2ea9e33b48a51849ec93c6c38148a5372018e4" }, + "nvim-cmp": { "branch": "main", "commit": "c49ad26e894e137e401b1d294948c46327877eaf" }, + "nvim-dap": { "branch": "master", "commit": "69b7c684cd42e60b48875c580e616a70bccfdbe7" }, "nvim-dap-ui": { "branch": "master", "commit": "54365d2eb4cb9cfab0371306c6a76c913c5a67e3" }, "nvim-dap-vscode-js": { "branch": "main", "commit": "e7c05495934a658c8aa10afd995dacd796f76091" }, - "nvim-lspconfig": { "branch": "master", "commit": "432935081337dbbbc80f4d0531868509624505df" }, + "nvim-lspconfig": { "branch": "master", "commit": "6b43ce561d97412cc512b569db6938e44529293e" }, "nvim-notify": { "branch": "master", "commit": "b005821516f1f37801a73067afd1cef2dbc4dfe8" }, - "nvim-scrollbar": { "branch": "main", "commit": "f45aecbba9c402282dfc99721e0ad4c08710907c" }, + "nvim-scrollbar": { "branch": "main", "commit": "89ac2e4ad5add610fc2d65493139c89c066b56a4" }, "nvim-toggleterm.lua": { "branch": "main", "commit": "b02a1674bd0010d7982b056fd3df4f717ff8a57a" }, - "nvim-tree.lua": { "branch": "master", "commit": "9e4c39572f631bb60ee15cb9d46e1daa9927a45e" }, - "nvim-treesitter": { "branch": "master", "commit": "fb36ed4c9e962d9fbfa608cd4a5d9313b1e8a8b1" }, + "nvim-tree.lua": { "branch": "master", "commit": "951b6e7e55da8aee9566cc0b17c11f9451cec349" }, + "nvim-treesitter": { "branch": "master", "commit": "12e95e160d7d45b76a36bca6303dd8447ab77490" }, "nvim-web-devicons": { "branch": "master", "commit": "05e1072f63f6c194ac6e867b567e6b437d3d4622" }, "persisted.nvim": { "branch": "main", "commit": "558fc4b9f48e16008782240521cb72455d93b835" }, "plenary.nvim": { "branch": "master", "commit": "4b7e52044bbb84242158d977a50c4cbcd85070c7" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, - "sniprun": { "branch": "master", "commit": "dccb34d01f30cc0120f0890d599dc42505d463cd" }, + "sniprun": { "branch": "master", "commit": "79806dad094770a1563ac0227c9692f7592df744" }, "telescope.nvim": { "branch": "master", "commit": "a606bd10c79ec5989c76c49cc6f736e88b63f0da" }, "translate.nvim": { "branch": "main", "commit": "7b2fd50c21ecfe536d572d62dcd3fa83acad3743" }, "trouble.nvim": { "branch": "main", "commit": "897542f90050c3230856bc6e45de58b94c700bbf" }, @@ -56,5 +60,6 @@ "vim-dadbod": { "branch": "master", "commit": "a09e40664e9cd30cd2b3f8866b796598302070f6" }, "vim-dadbod-completion": { "branch": "master", "commit": "e71eb6140556c5ced80de6299a1fdfe22bd3c1b1" }, "vim-dadbod-ui": { "branch": "master", "commit": "ecf07480687a13fe1bd3899270a6c9c99de51f4b" }, - "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" } + "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, + "which-key.nvim": { "branch": "main", "commit": "8682d3003595017cd8ffb4c860a07576647cc6f8" } } \ No newline at end of file diff --git a/configs/nvim/lua/configs/autocomplete.lua b/configs/nvim/lua/configs/autocomplete.lua deleted file mode 100644 index b8cf411..0000000 --- a/configs/nvim/lua/configs/autocomplete.lua +++ /dev/null @@ -1,92 +0,0 @@ --- luasnip setup -local luasnip = require("luasnip") - -local lspkind = require("lspkind") -local cmp = require("cmp") -local cmp_autopairs = require("nvim-autopairs.completion.cmp") - -local capabilities = require("cmp_nvim_lsp").default_capabilities() -require("lspconfig").html.setup({ - capabilities = capabilities, -}) - -require("nvim-autopairs").setup() -require("copilot").setup() -require("copilot_cmp").setup({ - clear_after_cursor = true, -}) - -cmp.setup({ - window = { - documentation = cmp.config.window.bordered(), - }, - experimental = { - ghost_text = true, - }, - completion = { - completeopt = "menu,menuone,noselect", - }, - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = { - [""] = cmp.mapping.complete({}), - [""] = function(fallback) - if cmp.visible() then - cmp.select_next_item() - else - fallback() - end - end, - [""] = function(fallback) - if cmp.visible() then - cmp.select_prev_item() - else - fallback() - end - end, - [""] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }), - }, - formatting = { - format = lspkind.cmp_format({ - mode = "symbol_text", - max_width = 50, - symbol_map = { Copilot = "" }, - }), - }, - sources = { - { name = "copilot" }, - { name = "vim-dadbod-completion", filetype = "sql" }, - { name = "nvim_lua" }, - { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "emoji" }, - { name = "path" }, - { name = "buffer" }, - { name = "buffer" }, - { name = "calc" }, - }, -}) - --- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline("/", { - sources = { - { name = "buffer" }, - }, -}) - --- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline(":", { - sources = cmp.config.sources({ - { name = "path" }, - }, { - { name = "cmdline" }, - }), -}) - -cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } })) diff --git a/configs/nvim/lua/configs/dashboard.lua b/configs/nvim/lua/configs/dashboard.lua deleted file mode 100644 index 736fe65..0000000 --- a/configs/nvim/lua/configs/dashboard.lua +++ /dev/null @@ -1,83 +0,0 @@ ------------------------------------ --- Welcome Screen Configuration -- ------------------------------------ - --- Call Alpha With A pcall -local status_ok, alpha = pcall(require, "alpha") -if not status_ok then - return -end - --- Enable Alpha Dashboard -local dashboard = require("alpha.themes.dashboard") - --- Remove These ~ ~ ~ -vim.opt.fillchars:append({ eob = " " }) - --- Disable Status Line so that alpha dashboard look nice --- vim.cmd [[ au User AlphaReady if winnr('$') == 1 | set laststatus=1 ]] - --- Custom Footer -dashboard.section.footer.val = { - "Write Programs That Do One Thing And Do It Well.", -} - --- Custom Section -dashboard.section.buttons.val = { - dashboard.button("n", " Create New file", ":set laststatus=3 | :ene startinsert "), - dashboard.button("e", " Open File Manager", ":set laststatus=3 | :NvimTreeOpen "), - dashboard.button("s", "Δ Search Sessions", ":Telescope persisted"), - dashboard.button("v", " Neovim Settings ", ":set laststatus=3 | e ~/.config/nvim/init.lua "), - dashboard.button("b", "⟳ Recent Files", ":Telescope oldfiles"), - -- dashboard.button("s", " Shell Configuration", ":set laststatus=3 | e ~/.config/zsh/.zshrc "), - dashboard.button("u", " Update Nvim Plugins", ":Lazy update "), - dashboard.button("q", " Quit Neovim", ":qa"), -} - --- LuaVim Ascii Art -dashboard.section.header.val = { - [[███╗ ███╗ █████╗ ██╗ ██╗ ███╗ ██╗ ██╗ ██╗██╗███╗ ███╗]], - [[████╗ ████║██╔══██╗╚██╗██╔╝ ████╗ ██║ ██║ ██║██║████╗ ████║]], - [[██╔████╔██║███████║ ╚███╔╝ ██╔██╗ ██║ ██║ ██║██║██╔████╔██║]], - [[██║╚██╔╝██║██╔══██║ ██╔██╗ ██║╚██╗██║ ╚██╗ ██╔╝██║██║╚██╔╝██║]], - [[██║ ╚═╝ ██║██║ ██║██╔╝ ██╗ ██║ ╚████║ ╚████╔╝ ██║██║ ╚═╝ ██║]], - [[╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═══╝ ╚═══╝ ╚═╝╚═╝ ╚═╝]], -} - -dashboard.section.header.val = { - [[ __ ]], - [[ /\ \ ]], - [[ / /\ \ ]], - [[/ /__\ \ ]], - [[\/____\/ ]], -} - --- dashboard.section.header.val = { --- [[ ____]], --- [[ /\ \]], --- [[ / \ \]], --- [[ / \ \]], --- [[ / \ \]], --- [[ / /\ \ \]], --- [[ / / \ \ \]], --- [[ / / \ \ \]], --- [[ / / / \ \ \]], --- [[ / / / \ \ \]], --- [[ / / /---------' \]], --- [[/ / /_______________\]], --- [[\ / /]], --- [[ \/_____________________/ ]], --- } - - --- Layout For Luavim ascii art -dashboard.config.layout = { - { type = "padding", val = 5 }, - dashboard.section.header, - { type = "padding", val = 2 }, - dashboard.section.buttons, - { type = "padding", val = 1 }, - dashboard.section.footer, -} - -alpha.setup(dashboard.opts) diff --git a/configs/nvim/lua/configs/lsp.lua b/configs/nvim/lua/configs/lsp.lua deleted file mode 100644 index 59fcb9e..0000000 --- a/configs/nvim/lua/configs/lsp.lua +++ /dev/null @@ -1,241 +0,0 @@ -local mason = require("mason") -local mason_lsp = require("mason-lspconfig") -local lsp = require("lspconfig") - -require("null-ls").setup({ - sources = { - require("null-ls").builtins.formatting.stylua, - require("null-ls").builtins.diagnostics.eslint, - require("null-ls").builtins.code_actions.eslint_d, - -- require("null-ls").builtins.completion.spell, - }, -}) - -mason.setup() - -mason_lsp.setup({ - ensure_installed = { "sumneko_lua", "jsonls", "tsserver", "svelte", "cssls" }, -}) - -local runtime_path = vim.split(package.path, ";") -table.insert(runtime_path, "lua/?.lua") -table.insert(runtime_path, "lua/?/init.lua") - -local function on_attach(client, bufnr) - local cap = client.server_capabilities - - if cap.documentFormattingProvider then - vim.api.nvim_create_autocmd("BufWritePre", { - buffer = bufnr, - callback = function() - vim.lsp.buf.format() - - if client.name == "tsserver" or client.name == "svelte" then - -- params for the request - local params = { - command = "_typescript.organizeImports", - arguments = { vim.api.nvim_buf_get_name(bufnr) }, - title = "", - } - - -- perform a syncronous request - -- 500ms timeout depending on the size of file a bigger timeout may be needed - vim.lsp.buf_request_sync(bufnr, "workspace/executeCommand", params, 500) - end - end, - }) - else - -- vim.notify("Lsp (" .. client.name .. ") doesnt support format") - end -end - -lsp.sumneko_lua.setup({ - on_attach = on_attach, - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) - version = "LuaJIT", - -- Setup your lua path - path = runtime_path, - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = { "vim" }, - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file("", true), - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { - enable = false, - }, - }, - }, -}) - -local capabilities = require("cmp_nvim_lsp").default_capabilities() - -capabilities.textDocument.completion.completionItem.snippetSupport = true - -lsp.prismals.setup({ - capabilities = capabilities, - on_attach = on_attach, -}) - -lsp.emmet_ls.setup({ - capabilities = capabilities, - on_attach = on_attach, -}) - -lsp.solargraph.setup({ - filetypes = { "ruby" }, - on_attach = on_attach, -}) - -lsp.elixirls.setup({ - on_attach = on_attach, -}) - -lsp.jsonls.setup({ - capabilities = capabilities, - on_attach = on_attach, - settings = { - provideFormatter = false, - json = { - schemas = { - { - description = "TypeScript compiler configuration file", - fileMatch = { "tsconfig.json", "tsconfig.*.json" }, - url = "http://json.schemastore.org/tsconfig", - }, - { - description = "ESLint config", - fileMatch = { ".eslintrc.json", ".eslintrc" }, - url = "http://json.schemastore.org/eslintrc", - }, - { - description = "Prettier config", - fileMatch = { ".prettierrc", ".prettierrc.json", "prettier.config.json" }, - url = "http://json.schemastore.org/prettierrc", - }, - }, - }, - }, -}) - -lsp.svelte.setup({ - capabilities = capabilities, - on_attach = on_attach, -}) -lsp.tsserver.setup({ - capabilities = capabilities, - on_attach = on_attach, -}) -lsp.html.setup({ - capabilities = capabilities, - on_attach = on_attach, -}) -lsp.phpactor.setup({ - capabilities = capabilities, - on_attach = on_attach, -}) -lsp.intelephense.setup({ - capabilities = capabilities, - on_attach = on_attach, - settings = { - intelephense = { - stubs = { - "wordpress", - "woocommerce", - "wordpress-globals", - "wp-cli", - }, - environment = { - includePaths = "/home/max/.composer/vendor/php-stubs/", -- this line forces the composer path for the stubs in case inteliphense don't find it... - }, - files = { - maxSize = 5000000, - }, - }, - }, -}) -lsp.cssls.setup({ - capabilities = capabilities, - on_attach = on_attach, -}) - -lsp.zls.setup({ - capabilities = capabilities, - on_attach = on_attach, -}) - -lsp.bashls.setup({ - capabilities = capabilities, - filetypes = { "sh", "bash" }, - on_attach = on_attach, -}) - -lsp.rust_analyzer.setup({ - on_attach = on_attach, - settings = { - ["rust-analyzer"] = { - imports = { - granularity = { - group = "module", - }, - prefix = "self", - }, - cargo = { - buildScripts = { - enable = true, - }, - }, - procMacro = { - enable = true, - }, - }, - }, -}) - -lsp.gopls.setup({ - capabilities = capabilities, - on_attach = on_attach, -}) - -lsp.yamlls.setup({ - capabilities = capabilities, - on_attach = on_attach, - settings = { - yaml = { - schemas = { - ["https://raw.githubusercontent.com/quantumblacklabs/kedro/develop/static/jsonschema/kedro-catalog-0.17.json"] = "conf/**/*catalog*", - ["https://json.schemastore.org/github-workflow.json"] = "/.github/workflows/*", - ["https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/traefik-v2-file-provider.json"] = "rules.yml", - ["https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/traefik-v2.json"] = "traefik.yml", - }, - }, - }, -}) - -lsp.glslls.setup(require("configs.lsp-glsl")) - -lsp.ltex.setup({ - capabilities = capabilities, - on_attach = on_attach, - settings = { - ltex = { - language = "de", - disabledRules = { ["en-US"] = { "PROFANITY" } }, - dictionary = { - ["en-US"] = { "perf", "ci", "neovim" }, - }, - hiddenFalsePositives = { - "neovim", - "Neovim", - "waybar", - }, - }, - }, -}) diff --git a/configs/nvim/lua/configs/sessions.lua b/configs/nvim/lua/configs/sessions.lua deleted file mode 100644 index a50af88..0000000 --- a/configs/nvim/lua/configs/sessions.lua +++ /dev/null @@ -1,13 +0,0 @@ -require("persistence").setup({ - autoload = true, - use_git_branch = false, - before_save = function() - pcall(vim.cmd, ":NvimTreeClose") - end, - after_source = function() - -- Reload the LSP servers - vim.lsp.stop_client(vim.lsp.get_active_clients()) - pcall(vim.cmd, ":NvimTreeOpen"); - end, - dir = vim.fn.stdpath('data') .. '/sessions/' -}) diff --git a/configs/nvim/lua/configs/translate/init.lua b/configs/nvim/lua/configs/translate/init.lua deleted file mode 100644 index bbd7cde..0000000 --- a/configs/nvim/lua/configs/translate/init.lua +++ /dev/null @@ -1,58 +0,0 @@ -local languages = require "configs.translate.languages"; -local pickers = require 'telescope.pickers' -local finders = require 'telescope.finders' -local actions = require 'telescope.actions' -local action_state = require 'telescope.actions.state' -local conf = require('telescope.config').values - -return function() - - -- This active_buf and active selection because telescope clears everything (i think) - local active_buf = vim.api.nvim_get_current_buf(); - local mode = vim.api.nvim_get_mode().mode; - vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("", true, false, true), 'x!', true) - local start_mark = vim.api.nvim_buf_get_mark(active_buf, "<") - local end_mark = vim.api.nvim_buf_get_mark(active_buf, ">") - - pickers - .new({}, { - prompt_title = 'Translate', - finder = finders.new_table { - results = languages, - entry_maker = function(entry) - return { - value = entry[2], - ordinal = entry[1] .. " " .. entry[2], - display = entry[3] .. entry[1], - } - end, - }, - sorter = conf.generic_sorter {}, - attach_mappings = function(prompt_bufnr) - actions.select_default:replace(function() - actions.close(prompt_bufnr) - - local selection = action_state.get_selected_entry() - - vim.api.nvim_set_current_buf(active_buf) - - vim.api.nvim_win_set_cursor(0, start_mark); - vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(mode, true, false, true), 'x!', true) - vim.api.nvim_win_set_cursor(0, end_mark); - - local timer = vim.loop.new_timer() - timer:start(500, 0, vim.schedule_wrap(function() - if mode == "v" or mode == "V" then - vim.cmd("'<,'>Translate " .. selection.value) - else - vim.cmd("Translate " .. selection.value) - end - end)) - end) - return true - end, - previewer = nil - }) - :find() - -end diff --git a/configs/nvim/lua/core/autocommands.lua b/configs/nvim/lua/core/autocommands.lua deleted file mode 100644 index c18328c..0000000 --- a/configs/nvim/lua/core/autocommands.lua +++ /dev/null @@ -1,29 +0,0 @@ -local config_group = vim.api.nvim_create_augroup("Config", {}) - -vim.api.nvim_create_autocmd({ "TextYankPost" }, { - group = config_group, - callback = function() - vim.highlight.on_yank() - end, -}) - --- local rememberFoldsGroup = vim.api.nvim_create_augroup('RememberFolds', { clear = true }) --- --- vim.api.nvim_create_autocmd({ 'BufWinLeave', 'BufLeave' }, { --- pattern = "*", --- group = rememberFoldsGroup, --- command = 'mkview' --- }) --- --- vim.api.nvim_create_autocmd('BufWinEnter', { --- pattern = "*", --- group = rememberFoldsGroup, --- command = 'silent! loadview' --- }) - -vim.cmd([[ -augroup filetypedetect - au BufNewFile,BufRead *.frag setl ft=glsl - au BufNewFile,BufRead *.vert setl ft=glsl -augroup END -]]) diff --git a/configs/nvim/lua/core/keymappings.lua b/configs/nvim/lua/core/keymappings.lua deleted file mode 100644 index 35c08a6..0000000 --- a/configs/nvim/lua/core/keymappings.lua +++ /dev/null @@ -1,129 +0,0 @@ --- local map = vim.api.nvim_set_keymap -local map = vim.keymap.set -local g = vim.g -local translate = require("configs.translate") - -local saga = require("lspsaga") -saga.init_lsp_saga() - -local options = { noremap = true, silent = true } -local remap = { noremap = true } - -g.mapleader = " " - --- Allows to easily exit terminal mode --- map('t', '', [[]], remap) - -map("n", "", ":Telescope find_files preview={timeout=1000}", options) -map("n", "", ":lua require'telescope.builtin'.live_grep{ cwd = vim.fn.getcwd() }", options) --- map("n", "", ":Telescope command_center", options) -map("n", "", "za", remap) - --- LSP Functionality -map("n", "n", ":lua vim.diagnostic.goto_next()", options) -map("n", "p", ":lua vim.diagnostic.goto_prev()", options) -map("n", "gD", "lua vim.lsp.buf.declaration()", options) -map("n", "gd", "lua vim.lsp.buf.definition()", options) -map("n", "gi", "lua vim.lsp.buf.implementation()", options) - -map("n", "K", "Lspsaga hover_doc", { silent = true }) --- map("n", "o", "LSoutlineToggle", { silent = true }) -map("n", "e", "lua vim.lsp.buf.hover()", { silent = true }) -map("n", "rn", "lua vim.lsp.buf.rename()", options) -map({ "n", "v" }, "c", "Lspsaga code_action", { silent = true }) -map({ "n", "v" }, "gr", "Lspsaga lsp_finder", options) -map("n", "", ":UndotreeToggle", options) - -map("n", "t", ":TroubleToggle", remap) - -map({ "n", "v" }, "t", translate, remap) - --- DAP Functionality -map("n", "b", ":lua require('dap').toggle_breakpoint()", options) - --- Test Functionality -map("n", "tt", ":lua require('neotest').run.run()", options) -map("n", "to", ":lua require('neotest').summary.open()", options) - -map({ "n", "v" }, "+", ":Boole increment", options) -map({ "n", "v" }, "-", ":Boole decrement", options) - --- Navigate Buffers -map("n", "", "h", options) -map("n", "", "j", options) -map("n", "", "k", options) -map("n", "", "l", options) - -map("n", "1", "1gt", options) -map("n", "2", "2gt", options) -map("n", "3", "3gt", options) -map("n", "4", "4gt", options) -map("n", "0", ":tablast", options) - -map("n", "m", ":lua require('harpoon.mark').add_file()", options) --- Navigate Files -map("n", "", ":Telescope harpoon marks", options) - --- Handling Splits -map("n", "h", ":sp", remap) -- horizontal -map("n", "v", ":vs", remap) -- vertical - --- Browser like next/previous -map("n", "", ":bprevious", options) -map("n", "", ":bnext", options) - --- Backspace Delete like Browser -map("i", "", "dbxi", options) - --- Copy visual selection to keyboard -map("v", "Y", '"+y', options) -map("n", "k", "{", options) -map("n", "j", "}", options) - --- I dont use macros at the moment, can disable this if i want to --- map('v', 'Q', 'q', {}) --- map('v', 'Q', 'q', {}) --- map('n', 'q', '', {}) --- map('n', 'q', '', {}) - --- Move lines vscode style -map("n", "", "move +1", options) -map("n", "", "move -2", options) -map("i", "", "move +1", options) -map("i", "", "move -2", options) -map("v", "", ":m '>+1gv=gv", options) -map("v", "", ":m '<-2gv=gv", options) -map("n", "", "YP", options) -map("n", "", "Yp", options) - --- Faster git merge -map("n", "gd", ":Gvdiffsplit!", options) -map("n", "gdl", ":diffget //3", options) -map("n", "gdh", ":diffget //2", options) - --- Find file in NvimTree -map("n", "f", ":NvimTreeFindFile", options) - -map("n", "", ":vsplit", options) -map("n", "", ":split", options) - --- I aint no weak boy -map("n", "", ":echo 'No Left for you'", options) -map("n", "", ":echo 'No Right for you'", options) -map("n", "", ":echo 'No Up for you'", options) -map("n", "", ":echo 'No Down for you'", options) - --- Run Requests -map("n", "r", ":SnipRun", options) -map("v", "r", ":'<,'>SnipRun", options) - --- Close on q -map("n", "q", ":q", options) -map("n", "", ":qall", options) - --- Open Nerdtree -map("n", "", ":NvimTreeToggle", options) - --- Make ctrl+s work -map("n", "", ":w", options) -map("i", "", ":wi", options) diff --git a/configs/nvim/lua/max/configs/autocomplete.lua b/configs/nvim/lua/max/configs/autocomplete.lua new file mode 100644 index 0000000..3c9cdcb --- /dev/null +++ b/configs/nvim/lua/max/configs/autocomplete.lua @@ -0,0 +1,113 @@ +-- luasnip setup +local luasnip = require("luasnip") + +require("luasnip/loaders/from_vscode").lazy_load() + +local lspkind = require("lspkind") +local cmp = require("cmp") +local cmp_autopairs = require("nvim-autopairs.completion.cmp") + +local capabilities = require("cmp_nvim_lsp").default_capabilities() +require("lspconfig").html.setup({ + capabilities = capabilities, +}) + +require("nvim-autopairs").setup() +require("copilot").setup() +require("copilot_cmp").setup({ + clear_after_cursor = true, +}) + +local check_backspace = function() + local col = vim.fn.col(".") - 1 + return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") +end + +cmp.setup({ + window = { + documentation = cmp.config.window.bordered(), + }, + experimental = { + ghost_text = true, + }, + completion = { + completeopt = "menuone,noselect", + }, + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = { + [""] = cmp.mapping.complete({}), + [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif check_backspace() then + fallback() + else + fallback() + end + end, { + "i", + "s", + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { + "i", + "s", + }), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + }, + formatting = { + format = lspkind.cmp_format({ + mode = "symbol_text", + max_width = 50, + symbol_map = { Copilot = "" }, + }), + }, + sources = { + { name = "copilot" }, + { name = "vim-dadbod-completion", filetype = "sql" }, + { name = "nvim_lua" }, + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "emoji" }, + { name = "path" }, + { name = "buffer" }, + { name = "calc" }, + }, +}) + +-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline("/", { + sources = { + { name = "buffer" }, + }, +}) + +-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline(":", { + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), +}) + +cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } })) diff --git a/configs/nvim/lua/configs/command-center.lua b/configs/nvim/lua/max/configs/command-center.lua similarity index 100% rename from configs/nvim/lua/configs/command-center.lua rename to configs/nvim/lua/max/configs/command-center.lua diff --git a/configs/nvim/lua/configs/dap.lua b/configs/nvim/lua/max/configs/dap.lua similarity index 100% rename from configs/nvim/lua/configs/dap.lua rename to configs/nvim/lua/max/configs/dap.lua diff --git a/configs/nvim/lua/max/configs/dashboard.lua b/configs/nvim/lua/max/configs/dashboard.lua new file mode 100644 index 0000000..cbe5a01 --- /dev/null +++ b/configs/nvim/lua/max/configs/dashboard.lua @@ -0,0 +1,82 @@ +----------------------------------- +-- Welcome Screen Configuration -- +----------------------------------- + +-- Call Alpha With A pcall +local status_ok, alpha = pcall(require, "alpha") +if not status_ok then + return +end + +-- Enable Alpha Dashboard +local dashboard = require("alpha.themes.dashboard") + +-- Remove These ~ ~ ~ +vim.opt.fillchars:append({ eob = " " }) + +-- Disable Status Line so that alpha dashboard look nice +-- vim.cmd [[ au User AlphaReady if winnr('$') == 1 | set laststatus=1 ]] + +-- Custom Footer +dashboard.section.footer.val = { + "Write Programs That Do One Thing And Do It Well.", +} + +-- Custom Section +dashboard.section.buttons.val = { + dashboard.button("n", " Create New file", ":set laststatus=3 | :ene startinsert "), + dashboard.button("e", " Open File Manager", ":set laststatus=3 | :NvimTreeOpen "), + dashboard.button("s", "Δ Search Sessions", ":Telescope persisted"), + dashboard.button("v", " Neovim Settings ", ":set laststatus=3 | e ~/.config/nvim/init.lua "), + dashboard.button("b", "⟳ Recent Files", ":Telescope oldfiles"), + -- dashboard.button("s", " Shell Configuration", ":set laststatus=3 | e ~/.config/zsh/.zshrc "), + dashboard.button("u", " Update Nvim Plugins", ":Lazy update "), + dashboard.button("q", " Quit Neovim", ":qa"), +} + +-- LuaVim Ascii Art +dashboard.section.header.val = { + [[███╗ ███╗ █████╗ ██╗ ██╗ ███╗ ██╗ ██╗ ██╗██╗███╗ ███╗]], + [[████╗ ████║██╔══██╗╚██╗██╔╝ ████╗ ██║ ██║ ██║██║████╗ ████║]], + [[██╔████╔██║███████║ ╚███╔╝ ██╔██╗ ██║ ██║ ██║██║██╔████╔██║]], + [[██║╚██╔╝██║██╔══██║ ██╔██╗ ██║╚██╗██║ ╚██╗ ██╔╝██║██║╚██╔╝██║]], + [[██║ ╚═╝ ██║██║ ██║██╔╝ ██╗ ██║ ╚████║ ╚████╔╝ ██║██║ ╚═╝ ██║]], + [[╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═══╝ ╚═══╝ ╚═╝╚═╝ ╚═╝]], +} + +dashboard.section.header.val = { + [[ __ ]], + [[ /\ \ ]], + [[ / /\ \ ]], + [[/ /__\ \ ]], + [[\/____\/ ]], +} + +-- dashboard.section.header.val = { +-- [[ ____]], +-- [[ /\ \]], +-- [[ / \ \]], +-- [[ / \ \]], +-- [[ / \ \]], +-- [[ / /\ \ \]], +-- [[ / / \ \ \]], +-- [[ / / \ \ \]], +-- [[ / / / \ \ \]], +-- [[ / / / \ \ \]], +-- [[ / / /---------' \]], +-- [[/ / /_______________\]], +-- [[\ / /]], +-- [[ \/_____________________/ ]], +-- } + +-- Layout For Luavim ascii art +dashboard.config.layout = { + { type = "padding", val = 5 }, + dashboard.section.header, + { type = "padding", val = 2 }, + dashboard.section.buttons, + { type = "padding", val = 1 }, + dashboard.section.footer, +} + +alpha.setup(dashboard.opts) diff --git a/configs/nvim/lua/max/configs/litee.lua b/configs/nvim/lua/max/configs/litee.lua new file mode 100644 index 0000000..55b6263 --- /dev/null +++ b/configs/nvim/lua/max/configs/litee.lua @@ -0,0 +1,15 @@ +require("litee.lib").setup({ + tree = { + icon_set = "codicons", + }, + panel = { + orientation = "right", + panel_size = 30, + }, +}) +require("litee.symboltree").setup({ + icon_set = "codicons", +}) +require("litee.calltree").setup({ + icon_set = "codicons", +}) diff --git a/configs/nvim/lua/configs/lsp-glsl.lua b/configs/nvim/lua/max/configs/lsp-glsl.lua similarity index 100% rename from configs/nvim/lua/configs/lsp-glsl.lua rename to configs/nvim/lua/max/configs/lsp-glsl.lua diff --git a/configs/nvim/lua/max/configs/lsp.lua b/configs/nvim/lua/max/configs/lsp.lua new file mode 100644 index 0000000..725901b --- /dev/null +++ b/configs/nvim/lua/max/configs/lsp.lua @@ -0,0 +1,251 @@ +local mason = require("mason") +local mason_lsp = require("mason-lspconfig") +local lsp = require("lspconfig") + +require("null-ls").setup({ + sources = { + require("null-ls").builtins.formatting.stylua, + require("null-ls").builtins.diagnostics.eslint, + require("null-ls").builtins.code_actions.eslint_d, + -- require("null-ls").builtins.completion.spell, + }, +}) + +mason.setup() + +mason_lsp.setup({ + ensure_installed = { "sumneko_lua", "jsonls", "tsserver", "svelte", "cssls" }, +}) + +local runtime_path = vim.split(package.path, ";") +table.insert(runtime_path, "lua/?.lua") +table.insert(runtime_path, "lua/?/init.lua") + +local function on_attach(client, bufnr) + if client.supports_method("textDocument/formatting") then + vim.api.nvim_create_autocmd("BufWritePre", { + buffer = bufnr, + callback = function() + vim.lsp.buf.format() + + if client.name == "tsserver" or client.name == "svelte" then + -- params for the request + local params = { + command = "_typescript.organizeImports", + arguments = { vim.api.nvim_buf_get_name(bufnr) }, + title = "", + } + + -- perform a syncronous request + -- 500ms timeout depending on the size of file a bigger timeout may be needed + vim.lsp.buf_request_sync(bufnr, "workspace/executeCommand", params, 500) + end + end, + }) + else + -- vim.notify("Lsp (" .. client.name .. ") doesnt support format") + end +end + +lsp.sumneko_lua.setup({ + on_attach = on_attach, + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = "LuaJIT", + -- Setup your lua path + path = runtime_path, + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { "vim" }, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false, + }, + }, + }, +}) + +local capabilities = require("cmp_nvim_lsp").default_capabilities() + +capabilities.textDocument.completion.completionItem.snippetSupport = true + +lsp.prismals.setup({ + capabilities = capabilities, + on_attach = on_attach, +}) + +lsp.emmet_ls.setup({ + capabilities = capabilities, + on_attach = on_attach, +}) + +lsp.solargraph.setup({ + filetypes = { "ruby" }, + on_attach = on_attach, +}) + +lsp.elixirls.setup({ + on_attach = on_attach, +}) + +lsp.jsonls.setup({ + capabilities = capabilities, + on_attach = on_attach, + settings = { + provideFormatter = false, + json = { + schemas = { + { + description = "TypeScript compiler configuration file", + fileMatch = { "tsconfig.json", "tsconfig.*.json" }, + url = "http://json.schemastore.org/tsconfig", + }, + { + description = "ESLint config", + fileMatch = { ".eslintrc.json", ".eslintrc" }, + url = "http://json.schemastore.org/eslintrc", + }, + { + description = "Prettier config", + fileMatch = { ".prettierrc", ".prettierrc.json", "prettier.config.json" }, + url = "http://json.schemastore.org/prettierrc", + }, + { + description = "JSON schema for Import Maps files", + fileMatch = { "importmap.json", "import_map.json", "import-map.json" }, + name = "importmap.json", + url = "https://json.schemastore.org/importmap.json", + }, + { + description = "NPM configuration file", + fileMatch = { "package.json" }, + name = "package.json", + url = "https://json.schemastore.org/package.json", + }, + }, + }, + }, +}) + +lsp.svelte.setup({ + capabilities = capabilities, + on_attach = on_attach, +}) +lsp.tsserver.setup({ + capabilities = capabilities, + on_attach = on_attach, +}) +lsp.html.setup({ + capabilities = capabilities, + on_attach = on_attach, +}) +lsp.phpactor.setup({ + capabilities = capabilities, + on_attach = on_attach, +}) +lsp.intelephense.setup({ + capabilities = capabilities, + on_attach = on_attach, + settings = { + intelephense = { + stubs = { + "wordpress", + "woocommerce", + "wordpress-globals", + "wp-cli", + }, + environment = { + includePaths = "/home/max/.composer/vendor/php-stubs/", -- this line forces the composer path for the stubs in case inteliphense don't find it... + }, + files = { + maxSize = 5000000, + }, + }, + }, +}) +lsp.cssls.setup({ + capabilities = capabilities, + on_attach = on_attach, +}) + +lsp.zls.setup({ + capabilities = capabilities, + on_attach = on_attach, +}) + +lsp.bashls.setup({ + capabilities = capabilities, + filetypes = { "sh", "bash" }, + on_attach = on_attach, +}) + +lsp.rust_analyzer.setup({ + on_attach = on_attach, + settings = { + ["rust-analyzer"] = { + imports = { + granularity = { + group = "module", + }, + prefix = "self", + }, + cargo = { + buildScripts = { + enable = true, + }, + }, + procMacro = { + enable = true, + }, + }, + }, +}) + +lsp.gopls.setup({ + capabilities = capabilities, + on_attach = on_attach, +}) + +lsp.yamlls.setup({ + capabilities = capabilities, + on_attach = on_attach, + settings = { + yaml = { + schemas = { + ["https://raw.githubusercontent.com/quantumblacklabs/kedro/develop/static/jsonschema/kedro-catalog-0.17.json"] = "conf/**/*catalog*", + ["https://json.schemastore.org/github-workflow.json"] = "/.github/workflows/*", + ["https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/traefik-v2-file-provider.json"] = "rules.yml", + ["https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/traefik-v2.json"] = "traefik.yml", + }, + }, + }, +}) + +lsp.glslls.setup(require("max.configs.lsp-glsl")) + +lsp.ltex.setup({ + capabilities = capabilities, + on_attach = on_attach, + settings = { + ltex = { + language = "de", + disabledRules = { ["en-US"] = { "PROFANITY" } }, + dictionary = { + ["en-US"] = { "perf", "ci", "neovim" }, + }, + hiddenFalsePositives = { + "neovim", + "Neovim", + "waybar", + }, + }, + }, +}) diff --git a/configs/nvim/lua/configs/lualine.lua b/configs/nvim/lua/max/configs/lualine.lua similarity index 99% rename from configs/nvim/lua/configs/lualine.lua rename to configs/nvim/lua/max/configs/lualine.lua index 754aec9..f16d61b 100644 --- a/configs/nvim/lua/configs/lualine.lua +++ b/configs/nvim/lua/max/configs/lualine.lua @@ -92,7 +92,7 @@ end ins_left({ -- mode component function() - return "" + return "◬" end, color = function() -- auto change color according to neovims mode diff --git a/configs/nvim/lua/configs/neotest.lua b/configs/nvim/lua/max/configs/neotest.lua similarity index 100% rename from configs/nvim/lua/configs/neotest.lua rename to configs/nvim/lua/max/configs/neotest.lua diff --git a/configs/nvim/lua/configs/notify.lua b/configs/nvim/lua/max/configs/notify.lua similarity index 100% rename from configs/nvim/lua/configs/notify.lua rename to configs/nvim/lua/max/configs/notify.lua diff --git a/configs/nvim/lua/configs/scrollbar.lua b/configs/nvim/lua/max/configs/scrollbar.lua similarity index 100% rename from configs/nvim/lua/configs/scrollbar.lua rename to configs/nvim/lua/max/configs/scrollbar.lua diff --git a/configs/nvim/lua/max/configs/session.lua b/configs/nvim/lua/max/configs/session.lua new file mode 100644 index 0000000..ac5de50 --- /dev/null +++ b/configs/nvim/lua/max/configs/session.lua @@ -0,0 +1,17 @@ +require("persisted").setup({ + autoload = true, + before_save = function() + local tree = pcall(require, "nvim-tree") + if tree then + vim.cmd("NvimTreeClose") + end + end, + after_save = function() + vim.cmd("NvimTreeOpen") + end, + after_source = function() + vim.lsp.stop_client(vim.lsp.get_active_clients()) + vim.cmd("filetype detect") + end, +}) +require("telescope").load_extension("persisted") -- To load the telescope extension diff --git a/configs/nvim/lua/configs/snippets.lua b/configs/nvim/lua/max/configs/snippets.lua similarity index 100% rename from configs/nvim/lua/configs/snippets.lua rename to configs/nvim/lua/max/configs/snippets.lua diff --git a/configs/nvim/lua/configs/sniprun.lua b/configs/nvim/lua/max/configs/sniprun.lua similarity index 100% rename from configs/nvim/lua/configs/sniprun.lua rename to configs/nvim/lua/max/configs/sniprun.lua diff --git a/configs/nvim/lua/configs/telescope.lua b/configs/nvim/lua/max/configs/telescope.lua similarity index 100% rename from configs/nvim/lua/configs/telescope.lua rename to configs/nvim/lua/max/configs/telescope.lua diff --git a/configs/nvim/lua/max/configs/translate/init.lua b/configs/nvim/lua/max/configs/translate/init.lua new file mode 100644 index 0000000..18fe875 --- /dev/null +++ b/configs/nvim/lua/max/configs/translate/init.lua @@ -0,0 +1,60 @@ +local languages = require("max.configs.translate.languages") +local pickers = require("telescope.pickers") +local finders = require("telescope.finders") +local actions = require("telescope.actions") +local action_state = require("telescope.actions.state") +local conf = require("telescope.config").values + +return function() + -- This active_buf and active selection because telescope clears everything (i think) + local active_buf = vim.api.nvim_get_current_buf() + local mode = vim.api.nvim_get_mode().mode + vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("", true, false, true), "x!", true) + local start_mark = vim.api.nvim_buf_get_mark(active_buf, "<") + local end_mark = vim.api.nvim_buf_get_mark(active_buf, ">") + + pickers + .new({}, { + prompt_title = "Translate", + finder = finders.new_table({ + results = languages, + entry_maker = function(entry) + return { + value = entry[2], + ordinal = entry[1] .. " " .. entry[2], + display = entry[3] .. entry[1], + } + end, + }), + sorter = conf.generic_sorter({}), + attach_mappings = function(prompt_bufnr) + actions.select_default:replace(function() + actions.close(prompt_bufnr) + + local selection = action_state.get_selected_entry() + + vim.api.nvim_set_current_buf(active_buf) + + vim.api.nvim_win_set_cursor(0, start_mark) + vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(mode, true, false, true), "x!", true) + vim.api.nvim_win_set_cursor(0, end_mark) + + local timer = vim.loop.new_timer() + timer:start( + 500, + 0, + vim.schedule_wrap(function() + if mode == "v" or mode == "V" then + vim.cmd("'<,'>Translate " .. selection.value) + else + vim.cmd("Translate " .. selection.value) + end + end) + ) + end) + return true + end, + previewer = nil, + }) + :find() +end diff --git a/configs/nvim/lua/configs/translate/languages.lua b/configs/nvim/lua/max/configs/translate/languages.lua similarity index 100% rename from configs/nvim/lua/configs/translate/languages.lua rename to configs/nvim/lua/max/configs/translate/languages.lua diff --git a/configs/nvim/lua/configs/tree.lua b/configs/nvim/lua/max/configs/tree.lua similarity index 96% rename from configs/nvim/lua/configs/tree.lua rename to configs/nvim/lua/max/configs/tree.lua index 6c3e649..ff5e900 100644 --- a/configs/nvim/lua/configs/tree.lua +++ b/configs/nvim/lua/max/configs/tree.lua @@ -37,3 +37,5 @@ require("nvim-tree").setup({ }, }, }) + +vim.cmd("NvimTreeOpen") diff --git a/configs/nvim/lua/configs/treesitter.lua b/configs/nvim/lua/max/configs/treesitter.lua similarity index 100% rename from configs/nvim/lua/configs/treesitter.lua rename to configs/nvim/lua/max/configs/treesitter.lua diff --git a/configs/nvim/lua/max/core/autocommands.lua b/configs/nvim/lua/max/core/autocommands.lua new file mode 100644 index 0000000..1891652 --- /dev/null +++ b/configs/nvim/lua/max/core/autocommands.lua @@ -0,0 +1,35 @@ +local config_group = vim.api.nvim_create_augroup("Config", {}) + +vim.api.nvim_create_autocmd({ "TextYankPost" }, { + group = config_group, + callback = function() + vim.highlight.on_yank() + end, +}) + +local rememberFoldsGroup = vim.api.nvim_create_augroup("RememberFolds", { clear = true }) + +vim.api.nvim_create_autocmd({ "BufWinLeave", "BufLeave" }, { + pattern = "*", + group = rememberFoldsGroup, + command = "mkview", +}) + +vim.api.nvim_create_autocmd("BufWinEnter", { + pattern = "*", + group = rememberFoldsGroup, + command = "silent! loadview", +}) + +vim.cmd([[ +augroup filetypedetect + au BufNewFile,BufRead *.frag setl ft=glsl + au BufNewFile,BufRead *.vert setl ft=glsl +augroup END +]]) + +vim.api.nvim_create_autocmd({ "BufReadPost" }, { + pattern = "*", + group = config_group, + command = "filetype detect", +}) diff --git a/configs/nvim/lua/core/bootstrap.lua b/configs/nvim/lua/max/core/bootstrap.lua similarity index 100% rename from configs/nvim/lua/core/bootstrap.lua rename to configs/nvim/lua/max/core/bootstrap.lua diff --git a/configs/nvim/lua/max/core/keymappings.lua b/configs/nvim/lua/max/core/keymappings.lua new file mode 100644 index 0000000..37a73b9 --- /dev/null +++ b/configs/nvim/lua/max/core/keymappings.lua @@ -0,0 +1,119 @@ +-- local map = vim.api.nvim_set_keymap +local map = vim.keymap.set +local opts = { noremap = true, silent = true } + +local translate = require("max.configs.translate") +local saga = require("lspsaga") +saga.init_lsp_saga() + +-- Set Leader key +vim.g.mapleader = " " + +map("n", "", ":Telescope find_files preview={timeout=1000}", opts) +map("n", "", ":lua require'telescope.builtin'.live_grep{ cwd = vim.fn.getcwd() }", opts) +map("n", "", "za", opts) + +map("n", "is", "lua require('litee.lib.lsp.wrappers').buf_document_symbol()", opts) +map("n", "io", "LSoutlineToggle", opts) + +map("v", ">", ">gv", opts) +map("v", "<", "n", ":lua vim.diagnostic.goto_next()", opts) +map("n", "p", ":lua vim.diagnostic.goto_prev()", opts) +map("n", "gD", "lua vim.lsp.buf.declaration()", opts) +map("n", "gd", "lua vim.lsp.buf.definition()", opts) +map("n", "gi", "lua vim.lsp.buf.implementation()", opts) + +map("n", "K", "Lspsaga hover_doc", { silent = true }) +map("n", "e", "lua vim.lsp.buf.hover()", { silent = true }) +map("n", "rn", "lua vim.lsp.buf.rename()", opts) +map({ "n", "v" }, "c", "Lspsaga code_action", { silent = true }) +map({ "n", "v" }, "gr", "Lspsaga lsp_finder", opts) +map("n", "", ":UndotreeToggle", opts) + +map("n", "ip", ":TroubleToggle", opts) +map({ "n", "v" }, "t", translate, opts) + +-- DAP Functionality +map("n", "b", ":lua require('dap').toggle_breakpoint()", opts) + +-- Test Functionality +map("n", "tt", ":lua require('neotest').run.run()", opts) +map("n", "to", ":lua require('neotest').summary.open()", opts) + +map({ "n", "v" }, "+", ":Boole increment", opts) +map({ "n", "v" }, "-", ":Boole decrement", opts) + +-- Navigate Buffers +map("n", "", "h", opts) +map("n", "", "j", opts) +map("n", "", "k", opts) +map("n", "", "l", opts) + +map("n", "1", "1gt", opts) +map("n", "2", "2gt", opts) +map("n", "3", "3gt", opts) +map("n", "4", "4gt", opts) +map("n", "0", ":tablast", opts) + +-- Browser like next/previous +map("n", "", ":bprevious", opts) +map("n", "", ":bnext", opts) + +-- Backspace Delete like Browser +-- map("i", "", "dbxi", opts) + +-- Copy visual selection to keyboard +map("v", "Y", '"+y', opts) +map("n", "k", "{", opts) +map("n", "j", "}", opts) + +-- I dont use macros at the moment, can disable this if i want to +-- map('v', 'Q', 'q', {}) +-- map('v', 'Q', 'q', {}) +-- map('n', 'q', '', {}) +-- map('n', 'q', '', {}) + +-- Move lines vscode style +map("n", "", "move +1", opts) +map("n", "", "move -2", opts) +map("i", "", "move +1", opts) +map("i", "", "move -2", opts) +map("v", "", ":m '>+1gv=gv", opts) +map("v", "", ":m '<-2gv=gv", opts) + +map("v", "p", '"_dP', opts) + +-- Faster git merge +map("n", "gd", ":Gvdiffsplit!", opts) +map("n", "gdl", ":diffget //3", opts) +map("n", "gdh", ":diffget //2", opts) + +-- Find file in NvimTree +map("n", "e", ":NvimTreeToggle", opts) +map("n", "f", ":NvimTreeFindFile", opts) + +-- I aint no weak boy +map("n", "", ":echo 'No Left for you'", opts) +map("n", "", ":echo 'No Right for you'", opts) +map("n", "", ":echo 'No Up for you'", opts) +map("n", "", ":echo 'No Down for you'", opts) + +-- Run Requests +map("n", "r", ":SnipRun", opts) +map("v", "r", ":'<,'>SnipRun", opts) + +-- Close on q +local function closeAll() + vim.cmd("SessionSave") + vim.cmd("qall") +end + +map("n", "q", ":q", opts) +map("n", "", closeAll, opts) + +-- Make ctrl+s work +map("n", "", ":w", opts) +map("i", "", ":wi", opts) diff --git a/configs/nvim/lua/core/options.lua b/configs/nvim/lua/max/core/options.lua similarity index 92% rename from configs/nvim/lua/core/options.lua rename to configs/nvim/lua/max/core/options.lua index c4851a8..9ae8708 100644 --- a/configs/nvim/lua/core/options.lua +++ b/configs/nvim/lua/max/core/options.lua @@ -3,10 +3,9 @@ ------------- local set = vim.opt local g = vim.g + set.swapfile = false -- Don't use swapfile set.updatetime = 0 -- Faster completion -set.encoding = "utf-8" -- The encoding displayed -set.fileencoding = "utf-8" -- The encoding written to file set.smartindent = true -- Makes indenting smart set.iskeyword:append("-") -- treat dash separated words as a word text object" set.clipboard = "unnamedplus" -- Copy paste between vim and everything else @@ -15,15 +14,15 @@ set.expandtab = true -- Converts tabs to spaces set.autoindent = true -- Good auto indent set.autochdir = false -- Your working directory will always be the same as your working directory set.incsearch = true -- sets incremental search -set.undofile = true; -set.undodir = vim.fn.stdpath('data') .. '/undo' +set.undofile = true +set.undodir = vim.fn.stdpath("data") .. "/undo" set.shell = "/bin/zsh" -- Set your shell to bash or zsh set.shortmess:append("sI") -- Disable nvim intro vim.cmd([[set nobackup]]) -- creates a backup file vim.cmd([[set nowritebackup]]) -- creates a backup file i guess vim.cmd([[set formatoptions-=cro]]) -- Stop newline continution of comments vim.cmd([[set complete+=kspell]]) -- auto complete with spellcheck -vim.cmd([[set completeopt=menuone,longest]]) -- auto complete menu (It's pretty great) +vim.cmd([[set completeopt=menuone,noselect]]) -- auto complete menu (It's pretty great) vim.cmd([[set nocompatible]]) -- Disable compatibility to old-time vi set.mouse = "a" -- Enable mouse support set.foldmethod = "expr" @@ -67,7 +66,7 @@ vim.cmd([[syntax enable]]) -- Enables syntax highlighing vim.cmd([[set t_Co=256]]) -- Support 256 colors -- vim.cmd "set whichwrap+=<,>,[,],h,l" -- Breaks Space-Time Continuum vim.diagnostic.config({ - virtual_text = false, + virtual_text = false, }) ----------------- diff --git a/configs/nvim/lua/core/plugins.lua b/configs/nvim/lua/max/core/plugins.lua similarity index 75% rename from configs/nvim/lua/core/plugins.lua rename to configs/nvim/lua/max/core/plugins.lua index f3dafb9..e31bddf 100644 --- a/configs/nvim/lua/core/plugins.lua +++ b/configs/nvim/lua/max/core/plugins.lua @@ -8,16 +8,39 @@ local plugins = { "rktjmp/fwatch.nvim", -- d to check dark/light theme { "catppuccin/nvim", name = "catppuccin" }, - "nvim-lualine/lualine.nvim", + { + "nvim-lualine/lualine.nvim", + config = function() + require("max.configs.lualine") + end, + }, -------------------- -- Layout Plugins -- -------------------- + { + "folke/which-key.nvim", + event = "VimEnter", + config = function() + require("which-key").setup({}) + end, + }, + { + "ldelossa/litee.nvim", + event = "BufRead", + dependencies = { + "ldelossa/litee-symboltree.nvim", + "ldelossa/litee-calltree.nvim", + }, + config = function() + require("max.configs.litee") + end, + }, { "mbbill/undotree", lazy = false }, { "petertriho/nvim-scrollbar", config = function() - require("configs.scrollbar") + require("max.configs.scrollbar") end, }, { @@ -30,26 +53,32 @@ local plugins = { { "akinsho/git-conflict.nvim", config = function() - -- require("git-conflict").setup() + require("git-conflict").setup() end, }, { "rcarriga/nvim-notify", config = function() - require("configs.notify") + require("max.configs.notify") end, event = "VimEnter", }, { "kyazdani42/nvim-tree.lua", - cmd = "NvimTreeToggle", + event = "VimEnter", + -- lazy = false, dependencies = { "kyazdani42/nvim-web-devicons" }, config = function() - require("configs.tree") + require("max.configs.tree") end, }, "nvim-lua/popup.nvim", - "goolord/alpha-nvim", -- startup screen + { + "goolord/alpha-nvim", + config = function() + require("max.configs.dashboard") + end, + }, -- startup screen { "numToStr/Comment.nvim", event = "BufReadPre", @@ -73,7 +102,7 @@ local plugins = { { "nvim-telescope/telescope.nvim", config = function() - require("configs.telescope") + require("max.configs.telescope") end, }, -- "ThePrimeagen/harpoon", @@ -81,11 +110,16 @@ local plugins = { -- Lsp Setup -- --------------- "arkav/lualine-lsp-progress", - "neovim/nvim-lspconfig", + { + "neovim/nvim-lspconfig", + lazy = false, + config = function() + require("max.configs.lsp") + end, + }, "williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim", "jose-elias-alvarez/null-ls.nvim", - -- "folke/lsp-colors.nvim", { "folke/trouble.nvim", event = "BufRead", @@ -105,7 +139,7 @@ local plugins = { ------------------- -- Autocomplete -- ------------------- - "tpope/vim-surround", + { "tpope/vim-surround", event = "InsertEnter" }, { "hrsh7th/nvim-cmp", dependencies = { @@ -127,8 +161,8 @@ local plugins = { event = "InsertEnter", config = function() vim.schedule(function() - require("configs.autocomplete") - require("configs.snippets") + require("max.configs.autocomplete") + require("max.configs.snippets") end) end, }, @@ -156,7 +190,7 @@ local plugins = { "nvim-treesitter/nvim-treesitter-textobjects", }, config = function() - require("configs.treesitter") + require("max.configs.treesitter") end, run = ":TSUpdate", }, @@ -179,20 +213,26 @@ local plugins = { "olimorris/persisted.nvim", lazy = false, config = function() - require("persisted").setup() - require("telescope").load_extension("persisted") -- To load the telescope extension + require("max.configs.session") end, }, -- Dap Debugger -- Have not yet been able to set this up - "mfussenegger/nvim-dap", - "rcarriga/nvim-dap-ui", - { "mxsdev/nvim-dap-vscode-js", requires = { "mfussenegger/nvim-dap" } }, + { + "mfussenegger/nvim-dap", + dependencies = { + "rcarriga/nvim-dap-ui", + "mxsdev/nvim-dap-vscode-js", + }, + config = function() + require("max.configs.dap") + end, + }, "editorconfig/editorconfig-vim", { "michaelb/sniprun", - event = "BufReadPost", + command = "SnipRun", config = function() - require("configs.sniprun") + require("max.configs.sniprun") end, run = "bash ./install.sh", }, @@ -207,7 +247,7 @@ local plugins = { "nvim-neotest/neotest", cmd = "NeoTest", config = function() - require("configs.neotest") + require("max.configs.neotest") end, requires = { "haydenmeade/neotest-jest", diff --git a/configs/nvim/lua/overlays.lua b/configs/nvim/lua/max/overlays.lua similarity index 59% rename from configs/nvim/lua/overlays.lua rename to configs/nvim/lua/max/overlays.lua index a44655e..e4f0e6a 100644 --- a/configs/nvim/lua/overlays.lua +++ b/configs/nvim/lua/max/overlays.lua @@ -1,47 +1,47 @@ local Terminal = require("toggleterm.terminal").Terminal local lazygit = Terminal:new({ - cmd = "lazygit", - dir = "git_dir", - direction = "float", - float_opts = { - winblend = 0, - border = "shadow", - }, - on_close = function() - Terminal:close() - end, + cmd = "lazygit", + dir = "git_dir", + direction = "float", + float_opts = { + winblend = 0, + border = "shadow", + }, + on_close = function() + Terminal:close() + end, }) function _Lazygit_toggle() - lazygit:toggle() + lazygit:toggle() end vim.api.nvim_set_keymap("n", "", "lua _Lazygit_toggle()", { noremap = true, silent = true }) local pnpm = Terminal:new({ - cmd = "pnpm dev", - dir = "git_dir", - size = 5, - direction = "vertical", + cmd = "pnpm dev", + dir = "git_dir", + size = 5, + direction = "vertical", }) function _Pnpm_toggle() - pnpm:toggle() + pnpm:toggle() end vim.api.nvim_set_keymap("n", "d", "lua _Pnpm_toggle()", { noremap = true, silent = true }) local chtConfig = Terminal:new({ - cmd = "cht", - direction = "float", + cmd = "cht", + direction = "float", }) function _ChtConfig_toggle() - chtConfig:toggle() + chtConfig:toggle() end vim.api.nvim_set_keymap("n", "", "lua _ChtConfig_toggle()", { noremap = true, silent = true }) require("toggleterm").setup({ - shade_terminals = true, + shade_terminals = true, }) diff --git a/configs/nvim/lua/theme/catpuccin.lua b/configs/nvim/lua/max/theme/catpuccin.lua similarity index 93% rename from configs/nvim/lua/theme/catpuccin.lua rename to configs/nvim/lua/max/theme/catpuccin.lua index 15c286f..6f6500e 100644 --- a/configs/nvim/lua/theme/catpuccin.lua +++ b/configs/nvim/lua/max/theme/catpuccin.lua @@ -39,6 +39,3 @@ cat.setup({ }) vim.cmd("colorscheme catppuccin") - -require("utils.theme-reloader") -require("configs.lualine") diff --git a/configs/nvim/lua/theme/tokyo.lua b/configs/nvim/lua/max/theme/tokyo.lua similarity index 100% rename from configs/nvim/lua/theme/tokyo.lua rename to configs/nvim/lua/max/theme/tokyo.lua diff --git a/configs/nvim/lua/theme/tundra.lua b/configs/nvim/lua/max/theme/tundra.lua similarity index 100% rename from configs/nvim/lua/theme/tundra.lua rename to configs/nvim/lua/max/theme/tundra.lua diff --git a/configs/nvim/lua/utils/init.lua b/configs/nvim/lua/max/utils/init.lua similarity index 100% rename from configs/nvim/lua/utils/init.lua rename to configs/nvim/lua/max/utils/init.lua diff --git a/configs/nvim/lua/utils/inspect.lua b/configs/nvim/lua/max/utils/inspect.lua similarity index 100% rename from configs/nvim/lua/utils/inspect.lua rename to configs/nvim/lua/max/utils/inspect.lua diff --git a/configs/nvim/lua/utils/install-packer.lua b/configs/nvim/lua/max/utils/install-packer.lua similarity index 100% rename from configs/nvim/lua/utils/install-packer.lua rename to configs/nvim/lua/max/utils/install-packer.lua diff --git a/configs/nvim/lua/utils/theme-reloader.lua b/configs/nvim/lua/max/utils/theme-reloader.lua similarity index 100% rename from configs/nvim/lua/utils/theme-reloader.lua rename to configs/nvim/lua/max/utils/theme-reloader.lua diff --git a/configs/sway/config b/configs/sway/config index 71598e5..c457479 100644 --- a/configs/sway/config +++ b/configs/sway/config @@ -1,5 +1,4 @@ # vim: ft=config - # Default config for sway # # Copy this to ~/.config/sway/config and edit it to your liking. diff --git a/configs/sway/scripts/nohup.out b/configs/sway/scripts/nohup.out new file mode 100644 index 0000000..a9c382e --- /dev/null +++ b/configs/sway/scripts/nohup.out @@ -0,0 +1,6 @@ +[2023-01-02 18:22:40.854] [info] Using configuration file /home/max/.config/waybar/config +[2023-01-02 18:22:40.854] [info] Using CSS file /home/max/.config/waybar/style.css +[2023-01-02 18:22:40.861] [info] config update for bar-0: id bar-0, mode hide, hidden_state hide +[2023-01-02 18:22:40.862] [warning] As using a timezone, some format args may be missing as the date library haven't got a release since 2018. +[2023-01-02 18:22:40.920] [warning] Requested height: 20 is less than the minimum height: 44 required by the modules +[2023-01-02 18:22:40.920] [info] Bar configured (width: 1920, height: 44) for output: eDP-1 diff --git a/configs/wofi/scripts/select-emoji b/configs/wofi/scripts/select-emoji index 1882ce6..f0c2b93 100755 --- a/configs/wofi/scripts/select-emoji +++ b/configs/wofi/scripts/select-emoji @@ -2106,4 +2106,58 @@ exit 🏴󠁧󠁢󠁥󠁮󠁧󠁿 flag: England 🏴󠁧󠁢󠁳󠁣󠁴󠁿 flag: Scotland 🏴󠁧󠁢󠁷󠁬󠁳󠁿 flag: Wales - +▲ Black Up-pointing Triangle +△ White Up-pointing Triangle +▴ Black Up-pointing Small Triangle +▵ White Up-pointing Small Triangle +▶ Black Right-pointing Triangle +▷ White Right-pointing Triangle +▸ Black Right-pointing Small Triangle +▹ White Right-pointing Small Triangle +▼ Black Down-pointing Triangle +▽ White Down-pointing Triangle +▾ Black Down-pointing Small Triangle +▿ White Down-pointing Small Triangle +◀ Black Left-pointing Triangle +◁ White Left-pointing Triangle +◂ Black Left-pointing Small Triangle +◃ White Left-pointing Small Triangle +◢ Black Lower Right Triangle +◣ Black Lower Left Triangle +◤ Black Upper Left Triangle +◥ Black Upper Right Triangle +◬ White Up-pointing Triangle With Dot +◭ Up-pointing Triangle With Left Half Black +◮ Up-pointing Triangle With Right Half Black +◸ Upper Left Triangle +◹ Upper Right Triangle +◺ Lower Left Triangle +◿ Lower Right Triangle +⛛ Heavy White Down-pointing Triangle +⟁ White Triangle Containing Small White Triangle +⧊ Triangle With Dot Above +⧋ Triangle With Underbar +⧌ S In Triangle +⧍ Triangle With Serifs At Bottom +⧎ Right Triangle Above Left Triangle +⧏ Left Triangle Beside Vertical Bar +⧐ Vertical Bar Beside Right Triangle +⧨ Down-pointing Triangle With Left Half Black +⧩ Down-pointing Triangle With Right Half Black +⨞ Large Left Triangle Operator +⨨ Plus Sign With Black Triangle +⨹ Plus Sign In Triangle +⨺ Minus Sign In Triangle +⨻ Multiplication Sign In Triangle +▲ Black Up-pointing Triangle red +▲ Black Up-pointing Triangle orange +▲ Black Up-pointing Triangle pink +▲ Black Up-pointing Triangle green +▲ Black Up-pointing Triangle royal blue +▲ Black Up-pointing Triangle purple +△ White Up-pointing Triangle red +△ White Up-pointing Triangle orange +△ White Up-pointing Triangle pink +△ White Up-pointing Triangle green +△ White Up-pointing Triangle royal blue +△ White Up-pointing Triangle purple