From 07d294425a98ee5d1e22d03e2b24ae2c76e487c0 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Sat, 23 Aug 2025 12:42:37 +0900 Subject: updates --- mac/.config/AstroNvim/.luarc.json | 3 + mac/.config/AstroNvim/.neoconf.json | 20 + mac/.config/AstroNvim/.stylua.toml | 7 + mac/.config/AstroNvim/README.md | 34 + mac/.config/AstroNvim/init.lua | 27 + mac/.config/AstroNvim/lua/community.lua | 12 + mac/.config/AstroNvim/lua/lazy_setup.lua | 32 + mac/.config/AstroNvim/lua/plugins/astrocore.lua | 85 + mac/.config/AstroNvim/lua/plugins/astrolsp.lua | 105 + mac/.config/AstroNvim/lua/plugins/astroui.lua | 39 + mac/.config/AstroNvim/lua/plugins/mason.lua | 28 + mac/.config/AstroNvim/lua/plugins/none-ls.lua | 24 + mac/.config/AstroNvim/lua/plugins/treesitter.lua | 15 + mac/.config/AstroNvim/lua/plugins/user.lua | 88 + mac/.config/AstroNvim/lua/polish.lua | 5 + mac/.config/AstroNvim/neovim.yml | 6 + mac/.config/AstroNvim/selene.toml | 8 + mac/.config/LazyVim/.gitignore | 8 + mac/.config/LazyVim/.neoconf.json | 15 + mac/.config/LazyVim/LICENSE | 201 + mac/.config/LazyVim/README.md | 4 + mac/.config/LazyVim/init.lua | 2 + mac/.config/LazyVim/lua/config/autocmds.lua | 8 + mac/.config/LazyVim/lua/config/keymaps.lua | 3 + mac/.config/LazyVim/lua/config/lazy.lua | 53 + mac/.config/LazyVim/lua/config/options.lua | 3 + mac/.config/LazyVim/lua/plugins/example.lua | 197 + mac/.config/LazyVim/stylua.toml | 3 + mac/.config/LunarVim/.gitignore | 31 + mac/.config/LunarVim/.luacheckrc | 45 + mac/.config/LunarVim/.pre-commit-config.yaml | 34 + mac/.config/LunarVim/.stylua.toml | 6 + mac/.config/LunarVim/CHANGELOG.md | 704 + mac/.config/LunarVim/CONTRIBUTING.md | 116 + mac/.config/LunarVim/LICENSE | 674 + mac/.config/LunarVim/Makefile | 42 + mac/.config/LunarVim/README.md | 68 + mac/.config/LunarVim/init.lua | 25 + mac/.config/LunarVim/lua/lvim/bootstrap.lua | 123 + .../LunarVim/lua/lvim/config/_deprecated.lua | 215 + mac/.config/LunarVim/lua/lvim/config/defaults.lua | 75 + mac/.config/LunarVim/lua/lvim/config/init.lua | 108 + mac/.config/LunarVim/lua/lvim/config/settings.lua | 120 + mac/.config/LunarVim/lua/lvim/core/alpha.lua | 85 + .../LunarVim/lua/lvim/core/alpha/dashboard.lua | 148 + .../LunarVim/lua/lvim/core/alpha/startify.lua | 45 + mac/.config/LunarVim/lua/lvim/core/autocmds.lua | 281 + mac/.config/LunarVim/lua/lvim/core/autopairs.lua | 91 + mac/.config/LunarVim/lua/lvim/core/breadcrumbs.lua | 236 + mac/.config/LunarVim/lua/lvim/core/bufferline.lua | 256 + .../LunarVim/lua/lvim/core/builtins/init.lua | 34 + mac/.config/LunarVim/lua/lvim/core/cmp.lua | 390 + mac/.config/LunarVim/lua/lvim/core/commands.lua | 99 + mac/.config/LunarVim/lua/lvim/core/comment.lua | 86 + mac/.config/LunarVim/lua/lvim/core/dap.lua | 177 + mac/.config/LunarVim/lua/lvim/core/gitsigns.lua | 83 + mac/.config/LunarVim/lua/lvim/core/illuminate.lua | 72 + mac/.config/LunarVim/lua/lvim/core/indentlines.lua | 43 + mac/.config/LunarVim/lua/lvim/core/info.lua | 222 + mac/.config/LunarVim/lua/lvim/core/lir.lua | 120 + mac/.config/LunarVim/lua/lvim/core/log.lua | 203 + .../LunarVim/lua/lvim/core/lualine/colors.lua | 16 + .../LunarVim/lua/lvim/core/lualine/components.lua | 174 + .../LunarVim/lua/lvim/core/lualine/conditions.lua | 17 + .../LunarVim/lua/lvim/core/lualine/init.lua | 57 + .../LunarVim/lua/lvim/core/lualine/styles.lua | 165 + .../LunarVim/lua/lvim/core/lualine/utils.lua | 14 + mac/.config/LunarVim/lua/lvim/core/mason.lua | 120 + mac/.config/LunarVim/lua/lvim/core/nvimtree.lua | 344 + mac/.config/LunarVim/lua/lvim/core/project.lua | 67 + mac/.config/LunarVim/lua/lvim/core/telescope.lua | 150 + .../lua/lvim/core/telescope/custom-finders.lua | 98 + mac/.config/LunarVim/lua/lvim/core/terminal.lua | 174 + mac/.config/LunarVim/lua/lvim/core/theme.lua | 96 + mac/.config/LunarVim/lua/lvim/core/treesitter.lua | 135 + mac/.config/LunarVim/lua/lvim/core/which-key.lua | 333 + mac/.config/LunarVim/lua/lvim/icons.lua | 154 + mac/.config/LunarVim/lua/lvim/interface/popup.lua | 64 + mac/.config/LunarVim/lua/lvim/interface/text.lua | 95 + mac/.config/LunarVim/lua/lvim/keymappings.lua | 177 + mac/.config/LunarVim/lua/lvim/lsp/config.lua | 164 + mac/.config/LunarVim/lua/lvim/lsp/init.lua | 128 + mac/.config/LunarVim/lua/lvim/lsp/manager.lua | 141 + .../LunarVim/lua/lvim/lsp/null-ls/code_actions.lua | 26 + .../LunarVim/lua/lvim/lsp/null-ls/formatters.lua | 33 + mac/.config/LunarVim/lua/lvim/lsp/null-ls/init.lua | 16 + .../LunarVim/lua/lvim/lsp/null-ls/linters.lua | 43 + .../LunarVim/lua/lvim/lsp/null-ls/services.lua | 104 + .../LunarVim/lua/lvim/lsp/providers/jsonls.lua | 18 + .../LunarVim/lua/lvim/lsp/providers/lua_ls.lua | 64 + .../lua/lvim/lsp/providers/tailwindcss.lua | 15 + .../LunarVim/lua/lvim/lsp/providers/vuels.lua | 26 + .../LunarVim/lua/lvim/lsp/providers/yamlls.lua | 16 + mac/.config/LunarVim/lua/lvim/lsp/templates.lua | 76 + mac/.config/LunarVim/lua/lvim/lsp/utils.lua | 185 + mac/.config/LunarVim/lua/lvim/plugin-loader.lua | 138 + mac/.config/LunarVim/lua/lvim/plugins.lua | 385 + mac/.config/LunarVim/lua/lvim/utils.lua | 132 + mac/.config/LunarVim/lua/lvim/utils/git.lua | 152 + mac/.config/LunarVim/lua/lvim/utils/hooks.lua | 76 + mac/.config/LunarVim/lua/lvim/utils/modules.lua | 122 + mac/.config/LunarVim/lua/lvim/utils/table.lua | 24 + mac/.config/LunarVim/snapshots/default.json | 131 + mac/.config/LunarVim/tests/lvim/helpers.lua | 32 + mac/.config/LunarVim/tests/minimal_init.lua | 12 + mac/.config/LunarVim/tests/minimal_lsp.lua | 112 + .../LunarVim/tests/specs/bootstrap_spec.lua | 57 + .../LunarVim/tests/specs/config_loader_spec.lua | 54 + mac/.config/LunarVim/tests/specs/lsp_spec.lua | 94 + .../LunarVim/tests/specs/plugins_load_spec.lua | 37 + mac/.config/LunarVim/utils/bin/jdtls | 62 + mac/.config/LunarVim/utils/bin/lvim.ps1 | 13 + mac/.config/LunarVim/utils/bin/lvim.template | 11 + .../LunarVim/utils/ci/generate_new_lockfile.lua | 125 + .../LunarVim/utils/ci/generate_new_lockfile.sh | 19 + mac/.config/LunarVim/utils/ci/run_commitlint.sh | 10 + mac/.config/LunarVim/utils/ci/run_test.sh | 25 + mac/.config/LunarVim/utils/ci/update_changelog.sh | 15 + mac/.config/LunarVim/utils/ci/verify_plugins.lua | 147 + mac/.config/LunarVim/utils/ci/verify_plugins.sh | 10 + mac/.config/LunarVim/utils/desktop/16x16/lvim.svg | 10 + mac/.config/LunarVim/utils/desktop/22x22/lvim.svg | 16 + mac/.config/LunarVim/utils/desktop/24x24/lvim.svg | 16 + mac/.config/LunarVim/utils/desktop/32x32/lvim.svg | 16 + mac/.config/LunarVim/utils/desktop/48x48/lvim.svg | 16 + mac/.config/LunarVim/utils/desktop/64x64/lvim.svg | 16 + mac/.config/LunarVim/utils/desktop/lvim.desktop | 13 + mac/.config/LunarVim/utils/docker/Dockerfile.local | 27 + .../LunarVim/utils/docker/Dockerfile.remote | 27 + .../LunarVim/utils/installer/config.example.lua | 5 + .../utils/installer/config_win.example.lua | 27 + .../utils/installer/install-neovim-from-release | 83 + mac/.config/LunarVim/utils/installer/install.ps1 | 305 + mac/.config/LunarVim/utils/installer/install.sh | 461 + .../LunarVim/utils/installer/install_bin.sh | 40 + .../LunarVim/utils/installer/install_stylua.sh | 63 + mac/.config/LunarVim/utils/installer/uninstall.ps1 | 63 + mac/.config/LunarVim/utils/installer/uninstall.sh | 89 + mac/.config/NvChad/.stylua.toml | 6 + mac/.config/NvChad/LICENSE | 24 + mac/.config/NvChad/README.md | 9 + mac/.config/NvChad/init.lua | 37 + mac/.config/NvChad/lua/autocmds.lua | 1 + mac/.config/NvChad/lua/chadrc.lua | 30 + mac/.config/NvChad/lua/configs/conform.lua | 15 + mac/.config/NvChad/lua/configs/lazy.lua | 47 + mac/.config/NvChad/lua/configs/lspconfig.lua | 55 + mac/.config/NvChad/lua/mappings.lua | 10 + mac/.config/NvChad/lua/options.lua | 6 + mac/.config/NvChad/lua/plugins/init.lua | 52 + .../after/queries/markdown/textobjects.scm | 3 + mac/.config/TheSiahxyz/ftplugin/markdown.lua | 501 + mac/.config/TheSiahxyz/ftplugin/quarto.lua | 6 + mac/.config/TheSiahxyz/init.lua | 1 + .../TheSiahxyz/lua/TheSiahxyz/core/autocmds.lua | 388 + .../TheSiahxyz/lua/TheSiahxyz/core/keymaps.lua | 807 + .../TheSiahxyz/lua/TheSiahxyz/core/lazy.lua | 39 + .../TheSiahxyz/lua/TheSiahxyz/core/options.lua | 48 + mac/.config/TheSiahxyz/lua/TheSiahxyz/health.lua | 60 + mac/.config/TheSiahxyz/lua/TheSiahxyz/init.lua | 15 + .../TheSiahxyz/lua/TheSiahxyz/plugins/ai.lua | 286 + .../TheSiahxyz/lua/TheSiahxyz/plugins/cloak.lua | 42 + .../TheSiahxyz/lua/TheSiahxyz/plugins/cmp.lua | 331 + .../lua/TheSiahxyz/plugins/colorizer.lua | 76 + .../lua/TheSiahxyz/plugins/colorschemes.lua | 350 + .../TheSiahxyz/lua/TheSiahxyz/plugins/comment.lua | 8 + .../TheSiahxyz/lua/TheSiahxyz/plugins/compiler.lua | 53 + .../TheSiahxyz/lua/TheSiahxyz/plugins/context.lua | 25 + .../TheSiahxyz/lua/TheSiahxyz/plugins/csv.lua | 55 + .../TheSiahxyz/lua/TheSiahxyz/plugins/dadbod.lua | 54 + .../TheSiahxyz/lua/TheSiahxyz/plugins/dap.lua | 337 + .../TheSiahxyz/lua/TheSiahxyz/plugins/docker.lua | 222 + .../TheSiahxyz/lua/TheSiahxyz/plugins/git.lua | 215 + .../TheSiahxyz/lua/TheSiahxyz/plugins/goyo.lua | 39 + .../TheSiahxyz/lua/TheSiahxyz/plugins/grug-far.lua | 31 + .../TheSiahxyz/lua/TheSiahxyz/plugins/harpoon2.lua | 124 + .../TheSiahxyz/lua/TheSiahxyz/plugins/image.lua | 210 + .../TheSiahxyz/lua/TheSiahxyz/plugins/init.lua | 87 + .../TheSiahxyz/lua/TheSiahxyz/plugins/keys.lua | 121 + .../TheSiahxyz/lua/TheSiahxyz/plugins/lf.lua | 121 + .../TheSiahxyz/lua/TheSiahxyz/plugins/lsp.lua | 681 + .../TheSiahxyz/lua/TheSiahxyz/plugins/lualine.lua | 273 + .../TheSiahxyz/lua/TheSiahxyz/plugins/macro.lua | 172 + .../TheSiahxyz/lua/TheSiahxyz/plugins/markdown.lua | 552 + .../TheSiahxyz/lua/TheSiahxyz/plugins/marks.lua | 16 + .../TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua | 1162 + .../TheSiahxyz/lua/TheSiahxyz/plugins/navic.lua | 52 + .../TheSiahxyz/lua/TheSiahxyz/plugins/neo-tree.lua | 141 + .../TheSiahxyz/lua/TheSiahxyz/plugins/obsidian.lua | 616 + .../TheSiahxyz/lua/TheSiahxyz/plugins/outline.lua | 11 + .../TheSiahxyz/lua/TheSiahxyz/plugins/project.lua | 12 + .../TheSiahxyz/lua/TheSiahxyz/plugins/python.lua | 55 + .../TheSiahxyz/lua/TheSiahxyz/plugins/quickfix.lua | 76 + .../lua/TheSiahxyz/plugins/refactoring.lua | 78 + .../TheSiahxyz/lua/TheSiahxyz/plugins/sessions.lua | 60 + .../TheSiahxyz/lua/TheSiahxyz/plugins/silicon.lua | 152 + .../TheSiahxyz/lua/TheSiahxyz/plugins/snippets.lua | 72 + .../lua/TheSiahxyz/plugins/stay-centered.lua | 29 + .../TheSiahxyz/lua/TheSiahxyz/plugins/surround.lua | 14 + .../lua/TheSiahxyz/plugins/telescope.lua | 1087 + .../lua/TheSiahxyz/plugins/textobject.lua | 140 + .../TheSiahxyz/lua/TheSiahxyz/plugins/todo.lua | 77 + .../lua/TheSiahxyz/plugins/treesitter.lua | 62 + .../TheSiahxyz/lua/TheSiahxyz/plugins/urlview.lua | 131 + .../lua/TheSiahxyz/plugins/virt-column.lua | 17 + .../TheSiahxyz/lua/TheSiahxyz/plugins/wiki.lua | 172 + .../TheSiahxyz/lua/TheSiahxyz/plugins/zenmode.lua | 46 + .../lua/TheSiahxyz/snippets/markdown.lua | 187 + .../lua/TheSiahxyz/snippets/neetcode1.lua | 103 + .../lua/TheSiahxyz/snippets/neetcode2.lua | 104 + .../TheSiahxyz/lua/TheSiahxyz/snippets/quarto.lua | 28 + .../lua/TheSiahxyz/snippets/whichkey.lua | 18 + .../TheSiahxyz/lua/TheSiahxyz/utils/cheatsheet.lua | 13 + .../lua/TheSiahxyz/utils/cheatsheet/grid.lua | 105 + .../lua/TheSiahxyz/utils/cheatsheet/init.lua | 116 + .../TheSiahxyz/lua/TheSiahxyz/utils/icons.lua | 168 + .../TheSiahxyz/lua/TheSiahxyz/utils/markdown.lua | 26 + .../TheSiahxyz/lua/TheSiahxyz/utils/snippet.lua | 38 + .../TheSiahxyz/lua/TheSiahxyz/utils/tasks.lua | 227 + .../TheSiahxyz/lua/TheSiahxyz/utils/tmux.lua | 63 + .../TheSiahxyz/lua/TheSiahxyz/utils/utils.lua | 147 + mac/.config/TheSiahxyz/spell/en.utf-8.add | 114 + mac/.config/TheSiahxyz/spell/en.utf-8.add.spl | Bin 0 -> 1376 bytes mac/.config/TheSiahxyz/spell/ko.utf-8.dic | 101599 ++++++++++++++++++ mac/.config/TheSiahxyz/spell/ko.utf-8.spl | Bin 0 -> 275220 bytes mac/.config/aerospace/aerospace.toml | 260 + mac/.config/aerospace/aerospace.toml.bak | 255 + mac/.config/aerospace/aerospace.toml.bak2 | 249 + mac/.config/atuin/config.toml | 210 + mac/.config/bash/bash_profile | 40 + mac/.config/bash/bashrc | 705 + mac/.config/bat/config | 8 + mac/.config/bat/themes/Catppuccin Frappe.tmTheme | 2059 + mac/.config/bat/themes/Catppuccin Latte.tmTheme | 2059 + .../bat/themes/Catppuccin Macchiato.tmTheme | 2059 + mac/.config/bat/themes/Catppuccin Mocha.tmTheme | 2059 + mac/.config/borders/bordersrc | 0 mac/.config/fastfetch/config.jsonc | 167 + mac/.config/firefox/chrome/userChrome.css | 106 + mac/.config/firefox/enhanceforyoutube.json | 109 + mac/.config/firefox/thesiah.js | 34 + mac/.config/firefox/vdh-settings.json | 90 + mac/.config/firefox/vimium-options.json | 32 + mac/.config/fontconfig/fonts.conf | 70 + mac/.config/git/attributes | 95 + mac/.config/git/config | 84 + mac/.config/git/gitk | 64 + mac/.config/git/ignore | 116 + mac/.config/gitmux/gitmux.conf | 86 + ...-bfce72b88109_v25.01_Glorious Engrammer v41.uf2 | Bin 0 -> 1046528 bytes ...-e1fde55550e4_v25.01_Glorious Engrammer v41.uf2 | Bin 0 -> 1046528 bytes .../glove80/moergo-glove80-keyboard-layers.pdf | Bin 0 -> 4246966 bytes .../assets/complex_modifications/1755910681.json | 32 + .../assets/complex_modifications/1755910750.json | 30 + .../automatic_backups/karabiner_20250823.json | 290 + mac/.config/karabiner/karabiner.json | 316 +- mac/.config/kickstart/.gitignore | 7 + mac/.config/kickstart/.stylua.toml | 6 + mac/.config/kickstart/LICENSE.md | 19 + mac/.config/kickstart/README.md | 241 + mac/.config/kickstart/doc/kickstart.txt | 24 + mac/.config/kickstart/init.lua | 1016 + mac/.config/kickstart/lua/custom/plugins/init.lua | 5 + mac/.config/kickstart/lua/kickstart/health.lua | 52 + .../kickstart/lua/kickstart/plugins/autopairs.lua | 8 + .../kickstart/lua/kickstart/plugins/debug.lua | 148 + .../kickstart/lua/kickstart/plugins/gitsigns.lua | 61 + .../lua/kickstart/plugins/indent_line.lua | 9 + .../kickstart/lua/kickstart/plugins/lint.lua | 60 + .../kickstart/lua/kickstart/plugins/neo-tree.lua | 25 + mac/.config/lazygit/config.yml | 15 + mac/.config/lf/cleaner | 5 + mac/.config/lf/icons | 336 + mac/.config/lf/lfrc | 617 + mac/.config/lf/rooticons | 336 + mac/.config/lf/scope | 83 + mac/.config/mpd/mpd.conf | 20 + mac/.config/mpd/playlists/entire.m3u | 890 + mac/.config/mpd/playlists/jpop.m3u | 156 + mac/.config/mpd/playlists/kpop.m3u | 113 + mac/.config/mpd/playlists/pop.m3u | 56 + mac/.config/mpv/input.conf | 123 + mac/.config/mpv/mpv.conf | 11 + mac/.config/mpv/osc.conf | 1 + mac/.config/mpv/script-modules/extended-menu.lua | 1214 + mac/.config/mpv/script-modules/gallery.lua | 581 + mac/.config/mpv/script-modules/input-console.lua | 935 + mac/.config/mpv/script-modules/mpvSockets.lua | 36 + mac/.config/mpv/script-modules/scroll-list.lua | 293 + mac/.config/mpv/script-modules/sha1.lua | 334 + .../mpv/script-modules/user-input-module.lua | 126 + mac/.config/mpv/script-modules/utf8/LICENSE | 21 + mac/.config/mpv/script-modules/utf8/README.md | 93 + .../utf8/begins/compiletime/parser.lua | 17 + .../utf8/begins/compiletime/vanilla.lua | 60 + .../utf8/charclass/compiletime/builder.lua | 128 + .../utf8/charclass/compiletime/parser.lua | 21 + .../utf8/charclass/compiletime/range.lua | 44 + .../utf8/charclass/compiletime/stub.lua | 9 + .../utf8/charclass/compiletime/vanilla.lua | 131 + .../script-modules/utf8/charclass/runtime/base.lua | 184 + .../utf8/charclass/runtime/dummy.lua | 41 + .../script-modules/utf8/charclass/runtime/init.lua | 22 + .../utf8/charclass/runtime/native.lua | 47 + .../script-modules/utf8/context/compiletime.lua | 18 + .../mpv/script-modules/utf8/context/runtime.lua | 112 + .../utf8/ends/compiletime/parser.lua | 17 + .../utf8/ends/compiletime/vanilla.lua | 46 + .../mpv/script-modules/utf8/functions/lua53.lua | 152 + mac/.config/mpv/script-modules/utf8/init.lua | 71 + .../utf8/modifier/compiletime/frontier.lua | 50 + .../utf8/modifier/compiletime/parser.lua | 20 + .../utf8/modifier/compiletime/simple.lua | 23 + .../utf8/modifier/compiletime/stub.lua | 28 + .../utf8/modifier/compiletime/vanilla.lua | 270 + .../mpv/script-modules/utf8/primitives/dummy.lua | 555 + .../mpv/script-modules/utf8/primitives/init.lua | 23 + .../mpv/script-modules/utf8/primitives/native.lua | 57 + .../script-modules/utf8/primitives/tarantool.lua | 13 + .../mpv/script-modules/utf8/regex_parser.lua | 80 + mac/.config/mpv/script-modules/utf8/test.sh | 23 + .../utf8/test/charclass_compiletime.lua | 165 + .../script-modules/utf8/test/charclass_runtime.lua | 116 + .../script-modules/utf8/test/context_runtime.lua | 82 + .../mpv/script-modules/utf8/test/strict.lua | 42 + mac/.config/mpv/script-modules/utf8/test/test.lua | 205 + .../mpv/script-modules/utf8/test/test_compat.lua | 109 + .../mpv/script-modules/utf8/test/test_pm.lua | 392 + .../mpv/script-modules/utf8/test/test_utf8data.lua | 15 + mac/.config/mpv/script-modules/utf8/test/util.lua | 75 + mac/.config/mpv/script-modules/utf8/util.lua | 64 + mac/.config/mpv/script-modules/utf8_data.lua | 1865 + mac/.config/mpv/script-opts/SimpleBookmark.conf | 311 + mac/.config/mpv/script-opts/SmartCopyPaste_II.conf | 343 + mac/.config/mpv/script-opts/SmartSkip.conf | 221 + mac/.config/mpv/script-opts/blur_edges.conf | 26 + mac/.config/mpv/script-opts/command_palette.conf | 19 + mac/.config/mpv/script-opts/gallery_worker.conf | 18 + mac/.config/mpv/script-opts/mdmenu.conf | 13 + mac/.config/mpv/script-opts/mpv_crop_script.conf | 5 + mac/.config/mpv/script-opts/playlist_view.conf | 123 + mac/.config/mpv/script-opts/thumbfast.conf | 41 + mac/.config/mpv/scripts/Rename.lua | 99 + mac/.config/mpv/scripts/SimpleBookmark.lua | 2907 + mac/.config/mpv/scripts/SmartCopyPaste_II.lua | 3797 + mac/.config/mpv/scripts/SmartSkip.lua | 1936 + mac/.config/mpv/scripts/UndoRedo.lua | 212 + mac/.config/mpv/scripts/blackout.lua | 73 + mac/.config/mpv/scripts/blur-edges.lua | 174 + mac/.config/mpv/scripts/change-OSD-media-title.lua | 30 + mac/.config/mpv/scripts/command_palette.lua | 1229 + mac/.config/mpv/scripts/cycle-video-rotate.lua | 36 + mac/.config/mpv/scripts/delete_current_file.lua | 168 + mac/.config/mpv/scripts/fuzzydir.lua | 278 + mac/.config/mpv/scripts/gallery-thumbgen.lua | 342 + mac/.config/mpv/scripts/history.lua | 138 + mac/.config/mpv/scripts/mdmenu.lua | 285 + mac/.config/mpv/scripts/misc.lua | 594 + mac/.config/mpv/scripts/modules.lua | 5 + mac/.config/mpv/scripts/mpv_crop_script.lua | 3438 + mac/.config/mpv/scripts/navigator.lua | 605 + mac/.config/mpv/scripts/osc-show-hide.lua | 40 + mac/.config/mpv/scripts/osc.lua | 3109 + mac/.config/mpv/scripts/playlist-view.lua | 925 + mac/.config/mpv/scripts/playlistmanager.lua | 1755 + mac/.config/mpv/scripts/reload.lua | 19 + mac/.config/mpv/scripts/sponsorblock_minimal.lua | 141 + mac/.config/mpv/scripts/subtitle-search.lua | 682 + mac/.config/mpv/scripts/thumbfast.lua | 951 + mac/.config/mpv/scripts/user-input.lua | 890 + mac/.config/mpv/scripts/xscreensaver.lua | 24 + mac/.config/mpv/scripts/youtube-search.lua | 419 + mac/.config/mpv/scripts/ytdl-preload.lua | 433 + mac/.config/mpv/unused_scipts/xrandr.lua | 382 + mac/.config/mutt/README.md | 414 + mac/.config/ncmpcpp/bindings | 468 + mac/.config/ncmpcpp/config | 628 + mac/.config/neofetch/config.conf | 863 - mac/.config/newsboat/config | 70 + mac/.config/newsboat/urls | 42 + mac/.config/npm/.npmrc | 2 + mac/.config/openvpn/thesiah.ovpn | 78 + mac/.config/pam-gnupg | 2 - mac/.config/pass-git-helper/git-pass-mapping.ini | 2 + mac/.config/pipe-viewer/pipe-viewer.conf | 143 + mac/.config/python/pythonrc | 2 + mac/.config/qutebrowser/config.py | 2661 + mac/.config/qutebrowser/greasemonkey/0x0.css.js | 29 + .../qutebrowser/greasemonkey/arstechnica.css.js | 21 + .../qutebrowser/greasemonkey/cnn-lite.css.js | 31 + .../qutebrowser/greasemonkey/csmonitor-text.css.js | 43 + mac/.config/qutebrowser/greasemonkey/dienet.css.js | 67 + mac/.config/qutebrowser/greasemonkey/dir.css.js | 72 + mac/.config/qutebrowser/greasemonkey/fandom.css.js | 27 + .../qutebrowser/greasemonkey/git-scm.css.js | 38 + mac/.config/qutebrowser/greasemonkey/google.css.js | 12 + mac/.config/qutebrowser/greasemonkey/imdb.css.js | 12 + .../qutebrowser/greasemonkey/leadertelegram.css.js | 18 + .../qutebrowser/greasemonkey/manpages.css.js | 75 + .../qutebrowser/greasemonkey/npr-text.css.js | 33 + .../qutebrowser/greasemonkey/opengroup.css.js | 50 + mac/.config/qutebrowser/greasemonkey/rarbg.css.js | 12 + mac/.config/qutebrowser/greasemonkey/reddit.css.js | 41 + .../qutebrowser/greasemonkey/smbc-comics.css.js | 31 + .../qutebrowser/greasemonkey/stackexchange.css.js | 44 + .../qutebrowser/greasemonkey/termbin.css.js | 32 + mac/.config/qutebrowser/greasemonkey/wiki.css.js | 33 + mac/.config/qutebrowser/greasemonkey/xkcd.css.js | 44 + .../qutebrowser/greasemonkey/ycombinator.css.js | 74 + .../qutebrowser/greasemonkey/youtube-ads.js | 23 + .../qutebrowser/greasemonkey/youtube.css.js | 31 + .../qutebrowser/themes/base16-brogrammer.config.py | 302 + .../themes/base16-catppuccin-frappe.config.py | 302 + .../themes/base16-catppuccin-latte.config.py | 302 + .../themes/base16-catppuccin-macchiato.config.py | 302 + .../themes/base16-catppuccin-mocha.config.py | 302 + .../qutebrowser/themes/base16-catppuccin.config.py | 302 + .../qutebrowser/themes/base16-dracula.config.py | 302 + .../themes/base16-everforest-dark-hard.config.py | 302 + .../themes/base16-everforest-dark-soft.config.py | 302 + .../qutebrowser/themes/base16-everforest.config.py | 302 + .../themes/base16-github-dark.config.py | 302 + .../qutebrowser/themes/base16-github.config.py | 302 + .../themes/base16-gruvbox-dark-hard.config.py | 302 + .../themes/base16-gruvbox-dark-medium.config.py | 302 + .../themes/base16-gruvbox-dark-pale.config.py | 302 + .../themes/base16-gruvbox-dark-soft.config.py | 302 + .../themes/base16-gruvbox-dark.config.py | 302 + .../themes/base16-material-darker.config.py | 302 + .../themes/base16-material-palenight.config.py | 302 + .../qutebrowser/themes/base16-monokai.config.py | 302 + .../qutebrowser/themes/base16-nord-light.config.py | 302 + .../qutebrowser/themes/base16-nord.config.py | 302 + .../themes/base16-oceanicnext.config.py | 302 + .../themes/base16-onedark-dark.config.py | 302 + .../qutebrowser/themes/base16-onedark.config.py | 302 + .../themes/base16-rose-pine-dawn.config.py | 302 + .../themes/base16-rose-pine-moon.config.py | 302 + .../qutebrowser/themes/base16-rose-pine.config.py | 302 + .../themes/base16-solarized-dark.config.py | 302 + .../themes/base16-solarized-light.config.py | 302 + .../themes/base16-tokyo-night-dark.config.py | 302 + .../themes/base16-tokyo-night-light.config.py | 302 + .../themes/base16-tokyo-night-moon.config.py | 302 + .../themes/base16-tokyo-night-storm.config.py | 302 + .../base16-tokyo-night-terminal-dark.config.py | 302 + .../base16-tokyo-night-terminal-light.config.py | 302 + .../base16-tokyo-night-terminal-storm.config.py | 302 + mac/.config/qutebrowser/themes/catppuccin.py | 342 + mac/.config/qutebrowser/themes/dracula.py | 286 + mac/.config/qutebrowser/themes/gruvbox.py | 334 + mac/.config/qutebrowser/themes/solarized-dark.py | 517 + mac/.config/qutebrowser/themes/solarized-light.py | 517 + mac/.config/qutebrowser/themes/xresources.py | 276 + .../userscripts/add-nextcloud-bookmarks | 173 + .../qutebrowser/userscripts/add-nextcloud-cookbook | 131 + mac/.config/qutebrowser/userscripts/code_select | 64 + mac/.config/qutebrowser/userscripts/gitclone | 74 + mac/.config/qutebrowser/userscripts/qr | 8 + mac/.config/qutebrowser/userscripts/qute-pass | 415 + mac/.config/qutebrowser/userscripts/substiqute | 61 + mac/.config/qutebrowser/userscripts/tab-manager | 529 + mac/.config/qutebrowser/userscripts/translate | 116 + mac/.config/qutebrowser/userscripts/usage.txt | 99 + mac/.config/sc-im/scimrc | 6 + mac/.config/sesh/sesh.toml | 54 + mac/.config/shell/aliasrc | 486 + mac/.config/shell/bm-dirs | 110 + mac/.config/shell/bm-files | 52 + mac/.config/shell/git-aliasrc | 415 + mac/.config/shell/inputrc | 31 + mac/.config/shell/profile | 218 + mac/.config/sketchybar.allapp/colors.sh | 49 + mac/.config/sketchybar.allapp/helper/cpu.h | 122 + mac/.config/sketchybar.allapp/helper/helper | Bin 0 -> 34872 bytes mac/.config/sketchybar.allapp/helper/helper.c | 31 + mac/.config/sketchybar.allapp/helper/makefile | 3 + mac/.config/sketchybar.allapp/helper/sketchybar.h | 209 + .../helpers/event_providers/cpu_load/bin/cpu_load | Bin 0 -> 34424 bytes .../event_providers/network_load/bin/network_load | Bin 0 -> 50992 bytes .../sketchybar.allapp/helpers/menus/bin/menus | Bin 0 -> 36920 bytes mac/.config/sketchybar.allapp/icons.sh | 57 + mac/.config/sketchybar.allapp/items/apple.sh | 44 + mac/.config/sketchybar.allapp/items/battery.sh | 16 + mac/.config/sketchybar.allapp/items/calendar.sh | 16 + mac/.config/sketchybar.allapp/items/cpu.sh | 53 + mac/.config/sketchybar.allapp/items/front_app.sh | 13 + .../sketchybar.allapp/items/input_source.sh | 10 + mac/.config/sketchybar.allapp/items/spaces.sh | 81 + mac/.config/sketchybar.allapp/items/volume.sh | 43 + mac/.config/sketchybar.allapp/items/weather.sh | 9 + mac/.config/sketchybar.allapp/plugins/aerospace.sh | 47 + mac/.config/sketchybar.allapp/plugins/apple.sh | 44 + mac/.config/sketchybar.allapp/plugins/battery.sh | 42 + mac/.config/sketchybar.allapp/plugins/calendar.sh | 4 + .../sketchybar.allapp/plugins/change_windows.sh | 3 + mac/.config/sketchybar.allapp/plugins/clock.sh | 9 + mac/.config/sketchybar.allapp/plugins/cpu.sh | 10 + mac/.config/sketchybar.allapp/plugins/front_app.sh | 26 + .../sketchybar.allapp/plugins/get_input_source.sh | 13 + mac/.config/sketchybar.allapp/plugins/icon_map.sh | 637 + mac/.config/sketchybar.allapp/plugins/space.sh | 58 + .../sketchybar.allapp/plugins/space_windows.sh | 87 + mac/.config/sketchybar.allapp/plugins/volume.sh | 47 + .../sketchybar.allapp/plugins/volume_click.sh | 48 + mac/.config/sketchybar.allapp/plugins/weather.sh | 25 + mac/.config/sketchybar.allapp/plugins/wifi.sh | 7 + mac/.config/sketchybar.allapp/plugins/zen.sh | 43 + mac/.config/sketchybar.allapp/reference.md | 3 + mac/.config/sketchybar.allapp/sketchybarrc | 105 + mac/.config/sketchybar.mon/colors.sh | 104 + mac/.config/sketchybar.mon/globalstyles.sh | 132 + mac/.config/sketchybar.mon/helper/cpu.h | 122 + mac/.config/sketchybar.mon/helper/helper | Bin 0 -> 34872 bytes mac/.config/sketchybar.mon/helper/helper.c | 31 + mac/.config/sketchybar.mon/helper/makefile | 3 + mac/.config/sketchybar.mon/helper/sketchybar.h | 209 + mac/.config/sketchybar.mon/icons.sh | 70 + mac/.config/sketchybar.mon/items/apple.sh | 44 + mac/.config/sketchybar.mon/items/battery.sh | 23 + mac/.config/sketchybar.mon/items/brew.sh | 39 + mac/.config/sketchybar.mon/items/cpu.sh | 74 + mac/.config/sketchybar.mon/items/datetime.sh | 37 + mac/.config/sketchybar.mon/items/disk.sh | 18 + mac/.config/sketchybar.mon/items/dnd.sh | 9 + mac/.config/sketchybar.mon/items/front_app.sh | 13 + mac/.config/sketchybar.mon/items/github.sh | 37 + mac/.config/sketchybar.mon/items/kakaotalk.sh | 18 + mac/.config/sketchybar.mon/items/keyboard.sh | 14 + mac/.config/sketchybar.mon/items/mail.sh | 19 + mac/.config/sketchybar.mon/items/memory.sh | 20 + mac/.config/sketchybar.mon/items/messages.sh | 13 + mac/.config/sketchybar.mon/items/mic.sh | 5 + mac/.config/sketchybar.mon/items/music.sh | 36 + mac/.config/sketchybar.mon/items/network.sh | 40 + .../sketchybar.mon/items/package_monitor.sh | 19 + .../sketchybar.mon/items/separator_right.sh | 13 + mac/.config/sketchybar.mon/items/spaces.sh | 56 + mac/.config/sketchybar.mon/items/spotify.sh | 201 + mac/.config/sketchybar.mon/items/svim.sh | 14 + mac/.config/sketchybar.mon/items/system.sh | 53 + mac/.config/sketchybar.mon/items/thunderbird.sh | 20 + mac/.config/sketchybar.mon/items/toggle_stats.sh | 11 + mac/.config/sketchybar.mon/items/volume.sh | 35 + mac/.config/sketchybar.mon/items/weather.sh | 23 + mac/.config/sketchybar.mon/items/wifi.sh | 39 + mac/.config/sketchybar.mon/items/yabai.sh | 21 + mac/.config/sketchybar.mon/plugins/battery.sh | 85 + mac/.config/sketchybar.mon/plugins/brew.sh | 104 + mac/.config/sketchybar.mon/plugins/disk.sh | 29 + mac/.config/sketchybar.mon/plugins/dnd.sh | 33 + mac/.config/sketchybar.mon/plugins/dndindicator.sh | 24 + mac/.config/sketchybar.mon/plugins/front_app.sh | 8 + mac/.config/sketchybar.mon/plugins/github.sh | 108 + mac/.config/sketchybar.mon/plugins/icon_map.sh | 486 + mac/.config/sketchybar.mon/plugins/kakaotalk.sh | 9 + mac/.config/sketchybar.mon/plugins/keyboard.sh | 13 + mac/.config/sketchybar.mon/plugins/mail.sh | 9 + mac/.config/sketchybar.mon/plugins/memory.sh | 49 + mac/.config/sketchybar.mon/plugins/messages.sh | 7 + mac/.config/sketchybar.mon/plugins/mic.sh | 9 + mac/.config/sketchybar.mon/plugins/mic_click.sh | 11 + mac/.config/sketchybar.mon/plugins/music.sh | 92 + .../sketchybar.mon/plugins/music/Cover-Default.png | Bin 0 -> 79352 bytes .../plugins/music/Get-Artwork.applescript | 65 + mac/.config/sketchybar.mon/plugins/network.sh | 25 + .../sketchybar.mon/plugins/nextevent.applescript | 19 + mac/.config/sketchybar.mon/plugins/nextevent.sh | 55 + mac/.config/sketchybar.mon/plugins/space.py | 199 + mac/.config/sketchybar.mon/plugins/space.sh | 62 + .../sketchybar.mon/plugins/space_windows.sh | 20 + mac/.config/sketchybar.mon/plugins/spotify.sh | 147 + mac/.config/sketchybar.mon/plugins/svim.sh | 30 + mac/.config/sketchybar.mon/plugins/thunderbird.sh | 9 + mac/.config/sketchybar.mon/plugins/toggle_stats.sh | 63 + mac/.config/sketchybar.mon/plugins/volume.sh | 43 + mac/.config/sketchybar.mon/plugins/volume_click.sh | 57 + mac/.config/sketchybar.mon/plugins/weather.sh | 191 + mac/.config/sketchybar.mon/plugins/wifi.sh | 104 + mac/.config/sketchybar.mon/plugins/yabai.sh | 141 + mac/.config/sketchybar.mon/plugins/zen.sh | 43 + .../.aerospace.toml" | 256 + mac/.config/sketchybar.mon/sketchybar/LICENSE | 21 + mac/.config/sketchybar.mon/sketchybar/colors.sh | 44 + mac/.config/sketchybar.mon/sketchybar/helper/cpu.h | 122 + .../sketchybar.mon/sketchybar/helper/helper | Bin 0 -> 34872 bytes .../sketchybar.mon/sketchybar/helper/helper.c | 31 + .../sketchybar.mon/sketchybar/helper/makefile | 3 + .../sketchybar.mon/sketchybar/helper/sketchybar.h | 209 + mac/.config/sketchybar.mon/sketchybar/icons.sh | 57 + .../sketchybar.mon/sketchybar/items/apple.sh | 44 + .../sketchybar.mon/sketchybar/items/battery.sh | 16 + .../sketchybar.mon/sketchybar/items/calendar.sh | 16 + mac/.config/sketchybar.mon/sketchybar/items/cpu.sh | 53 + .../sketchybar.mon/sketchybar/items/front_app.sh | 13 + .../sketchybar/items/input_source.sh | 10 + .../sketchybar.mon/sketchybar/items/spaces.sh | 81 + .../sketchybar.mon/sketchybar/items/volume.sh | 43 + .../sketchybar.mon/sketchybar/items/weather.sh | 8 + .../sketchybar.mon/sketchybar/plugins/aerospace.sh | 117 + .../sketchybar/plugins/aerospace_display.sh | 185 + .../sketchybar.mon/sketchybar/plugins/apple.sh | 38 + .../sketchybar.mon/sketchybar/plugins/battery.sh | 48 + .../sketchybar.mon/sketchybar/plugins/bluetooth.sh | 93 + .../sketchybar.mon/sketchybar/plugins/calendar.sh | 117 + .../sketchybar/plugins/change_windows.sh | 3 + .../sketchybar.mon/sketchybar/plugins/clock.sh | 19 + .../sketchybar/plugins/clock_click.sh | 43 + .../sketchybar.mon/sketchybar/plugins/cpu.sh | 37 + .../sketchybar.mon/sketchybar/plugins/front_app.sh | 104 + .../sketchybar/plugins/get_input_source.sh | 13 + .../sketchybar.mon/sketchybar/plugins/icon_map.sh | 637 + .../sketchybar/plugins/monitor_watcher.sh | 25 + .../sketchybar/plugins/now_playing.sh | 77 + .../sketchybar.mon/sketchybar/plugins/space.sh | 7 + .../sketchybar/plugins/space_windows.sh | 87 + .../sketchybar/plugins/test_click.sh | 3 + .../sketchybar.mon/sketchybar/plugins/volume.sh | 77 + .../sketchybar/plugins/volume_click.sh | 82 + .../sketchybar.mon/sketchybar/plugins/weather.sh | 52 + .../sketchybar.mon/sketchybar/plugins/wifi.sh | 53 + .../sketchybar.mon/sketchybar/plugins/zen.sh | 43 + mac/.config/sketchybar.mon/sketchybar/reference.md | 3 + mac/.config/sketchybar.mon/sketchybar/restart.sh | 19 + mac/.config/sketchybar.mon/sketchybar/sketchybarrc | 287 + mac/.config/sketchybar.mon/sketchybarrc | 56 + mac/.config/sketchybar.yabai/colors.sh | 104 + mac/.config/sketchybar.yabai/globalstyles.sh | 132 + mac/.config/sketchybar.yabai/helper/cpu.h | 122 + mac/.config/sketchybar.yabai/helper/helper | Bin 0 -> 34872 bytes mac/.config/sketchybar.yabai/helper/helper.c | 31 + mac/.config/sketchybar.yabai/helper/makefile | 3 + mac/.config/sketchybar.yabai/helper/sketchybar.h | 209 + mac/.config/sketchybar.yabai/icons.sh | 70 + mac/.config/sketchybar.yabai/items/apple.sh | 44 + mac/.config/sketchybar.yabai/items/battery.sh | 23 + mac/.config/sketchybar.yabai/items/brew.sh | 39 + mac/.config/sketchybar.yabai/items/cpu.sh | 74 + mac/.config/sketchybar.yabai/items/datetime.sh | 37 + mac/.config/sketchybar.yabai/items/disk.sh | 18 + mac/.config/sketchybar.yabai/items/dnd.sh | 9 + mac/.config/sketchybar.yabai/items/front_app.sh | 13 + mac/.config/sketchybar.yabai/items/github.sh | 37 + mac/.config/sketchybar.yabai/items/kakaotalk.sh | 18 + mac/.config/sketchybar.yabai/items/keyboard.sh | 14 + mac/.config/sketchybar.yabai/items/mail.sh | 19 + mac/.config/sketchybar.yabai/items/memory.sh | 20 + mac/.config/sketchybar.yabai/items/messages.sh | 13 + mac/.config/sketchybar.yabai/items/mic.sh | 5 + mac/.config/sketchybar.yabai/items/music.sh | 36 + mac/.config/sketchybar.yabai/items/network.sh | 40 + .../sketchybar.yabai/items/package_monitor.sh | 19 + .../sketchybar.yabai/items/separator_right.sh | 13 + mac/.config/sketchybar.yabai/items/spaces.sh | 56 + mac/.config/sketchybar.yabai/items/spotify.sh | 201 + mac/.config/sketchybar.yabai/items/svim.sh | 14 + mac/.config/sketchybar.yabai/items/system.sh | 53 + mac/.config/sketchybar.yabai/items/thunderbird.sh | 20 + mac/.config/sketchybar.yabai/items/toggle_stats.sh | 11 + mac/.config/sketchybar.yabai/items/volume.sh | 35 + mac/.config/sketchybar.yabai/items/weather.sh | 23 + mac/.config/sketchybar.yabai/items/wifi.sh | 39 + mac/.config/sketchybar.yabai/items/yabai.sh | 21 + mac/.config/sketchybar.yabai/plugins/battery.sh | 85 + mac/.config/sketchybar.yabai/plugins/brew.sh | 104 + mac/.config/sketchybar.yabai/plugins/disk.sh | 29 + mac/.config/sketchybar.yabai/plugins/dnd.sh | 33 + .../sketchybar.yabai/plugins/dndindicator.sh | 24 + mac/.config/sketchybar.yabai/plugins/front_app.sh | 8 + mac/.config/sketchybar.yabai/plugins/github.sh | 108 + mac/.config/sketchybar.yabai/plugins/icon_map.sh | 486 + mac/.config/sketchybar.yabai/plugins/kakaotalk.sh | 9 + mac/.config/sketchybar.yabai/plugins/keyboard.sh | 13 + mac/.config/sketchybar.yabai/plugins/mail.sh | 9 + mac/.config/sketchybar.yabai/plugins/memory.sh | 49 + mac/.config/sketchybar.yabai/plugins/messages.sh | 7 + mac/.config/sketchybar.yabai/plugins/mic.sh | 9 + mac/.config/sketchybar.yabai/plugins/mic_click.sh | 11 + mac/.config/sketchybar.yabai/plugins/music.sh | 92 + .../plugins/music/Cover-Default.png | Bin 0 -> 79352 bytes .../plugins/music/Get-Artwork.applescript | 65 + mac/.config/sketchybar.yabai/plugins/network.sh | 25 + .../sketchybar.yabai/plugins/nextevent.applescript | 19 + mac/.config/sketchybar.yabai/plugins/nextevent.sh | 55 + mac/.config/sketchybar.yabai/plugins/space.py | 199 + mac/.config/sketchybar.yabai/plugins/space.sh | 62 + .../sketchybar.yabai/plugins/space_windows.sh | 20 + mac/.config/sketchybar.yabai/plugins/spotify.sh | 147 + mac/.config/sketchybar.yabai/plugins/svim.sh | 30 + .../sketchybar.yabai/plugins/thunderbird.sh | 9 + .../sketchybar.yabai/plugins/toggle_stats.sh | 63 + mac/.config/sketchybar.yabai/plugins/volume.sh | 43 + .../sketchybar.yabai/plugins/volume_click.sh | 57 + mac/.config/sketchybar.yabai/plugins/weather.sh | 191 + mac/.config/sketchybar.yabai/plugins/wifi.sh | 104 + mac/.config/sketchybar.yabai/plugins/yabai.sh | 141 + mac/.config/sketchybar.yabai/plugins/zen.sh | 43 + mac/.config/sketchybar.yabai/sketchybarrc | 56 + mac/.config/sketchybar/colors.sh | 104 - mac/.config/sketchybar/globalstyles.sh | 132 - mac/.config/sketchybar/helper/cpu.h | 122 - mac/.config/sketchybar/helper/helper | Bin 34872 -> 0 bytes mac/.config/sketchybar/helper/helper.c | 31 - mac/.config/sketchybar/helper/makefile | 3 - mac/.config/sketchybar/helper/sketchybar.h | 209 - mac/.config/sketchybar/icons.sh | 70 - mac/.config/sketchybar/items/apple.sh | 44 - mac/.config/sketchybar/items/battery.sh | 23 - mac/.config/sketchybar/items/brew.sh | 39 - mac/.config/sketchybar/items/cpu.sh | 74 - mac/.config/sketchybar/items/datetime.sh | 37 - mac/.config/sketchybar/items/disk.sh | 18 - mac/.config/sketchybar/items/dnd.sh | 9 - mac/.config/sketchybar/items/front_app.sh | 13 - mac/.config/sketchybar/items/github.sh | 37 - mac/.config/sketchybar/items/kakaotalk.sh | 18 - mac/.config/sketchybar/items/keyboard.sh | 14 - mac/.config/sketchybar/items/mail.sh | 19 - mac/.config/sketchybar/items/memory.sh | 20 - mac/.config/sketchybar/items/messages.sh | 13 - mac/.config/sketchybar/items/mic.sh | 5 - mac/.config/sketchybar/items/music.sh | 36 - mac/.config/sketchybar/items/network.sh | 40 - mac/.config/sketchybar/items/package_monitor.sh | 19 - mac/.config/sketchybar/items/separator_right.sh | 13 - mac/.config/sketchybar/items/spaces.sh | 56 - mac/.config/sketchybar/items/spotify.sh | 201 - mac/.config/sketchybar/items/svim.sh | 14 - mac/.config/sketchybar/items/system.sh | 53 - mac/.config/sketchybar/items/thunderbird.sh | 20 - mac/.config/sketchybar/items/toggle_stats.sh | 11 - mac/.config/sketchybar/items/volume.sh | 35 - mac/.config/sketchybar/items/weather.sh | 23 - mac/.config/sketchybar/items/wifi.sh | 39 - mac/.config/sketchybar/items/yabai.sh | 21 - mac/.config/sketchybar/plugins/battery.sh | 85 - mac/.config/sketchybar/plugins/brew.sh | 104 - mac/.config/sketchybar/plugins/disk.sh | 29 - mac/.config/sketchybar/plugins/dnd.sh | 33 - mac/.config/sketchybar/plugins/dndindicator.sh | 24 - mac/.config/sketchybar/plugins/front_app.sh | 8 - mac/.config/sketchybar/plugins/github.sh | 108 - mac/.config/sketchybar/plugins/icon_map.sh | 486 - mac/.config/sketchybar/plugins/kakaotalk.sh | 9 - mac/.config/sketchybar/plugins/keyboard.sh | 13 - mac/.config/sketchybar/plugins/mail.sh | 9 - mac/.config/sketchybar/plugins/memory.sh | 49 - mac/.config/sketchybar/plugins/messages.sh | 7 - mac/.config/sketchybar/plugins/mic.sh | 9 - mac/.config/sketchybar/plugins/mic_click.sh | 11 - mac/.config/sketchybar/plugins/music.sh | 92 - .../sketchybar/plugins/music/Cover-Default.png | Bin 79352 -> 0 bytes .../plugins/music/Get-Artwork.applescript | 65 - mac/.config/sketchybar/plugins/network.sh | 25 - .../sketchybar/plugins/nextevent.applescript | 19 - mac/.config/sketchybar/plugins/nextevent.sh | 55 - mac/.config/sketchybar/plugins/space.py | 199 - mac/.config/sketchybar/plugins/space.sh | 62 - mac/.config/sketchybar/plugins/space_windows.sh | 20 - mac/.config/sketchybar/plugins/spotify.sh | 147 - mac/.config/sketchybar/plugins/svim.sh | 30 - mac/.config/sketchybar/plugins/thunderbird.sh | 9 - mac/.config/sketchybar/plugins/toggle_stats.sh | 63 - mac/.config/sketchybar/plugins/volume.sh | 43 - mac/.config/sketchybar/plugins/volume_click.sh | 57 - mac/.config/sketchybar/plugins/weather.sh | 191 - mac/.config/sketchybar/plugins/wifi.sh | 104 - mac/.config/sketchybar/plugins/yabai.sh | 141 - mac/.config/sketchybar/plugins/zen.sh | 43 - mac/.config/sketchybar/sketchybarrc | 56 - mac/.config/starship/starship.toml | 204 + mac/.config/task/taskrc | 192 + mac/.config/taskopen/taskopenrc | 30 + mac/.config/tmux/tmux.conf | 341 + mac/.config/transmission-daemon/settings.json | 83 + mac/.config/vim/UltiSnips/all.snippets | 30 + mac/.config/vim/init.vim | 438 + mac/.config/vim/plugins.vim | 42 + mac/.config/vim/vimrc | 580 + mac/.config/vscode/argv.json | 20 - mac/.config/wget/wgetrc | 1 + mac/.config/yabai/yabairc | 0 mac/.config/zsh/.zshrc | 125 + mac/.config/zsh/autocomplete.zsh | 70 + mac/.config/zsh/git.zsh | 7 + mac/.config/zsh/keymaps.zsh | 340 + mac/.config/zsh/p10k.zsh | 1721 + mac/.config/zsh/packages.zsh | 23 + mac/.config/zsh/plugins.zsh | 101 + mac/.config/zsh/scripts.zsh | 865 + 790 files changed, 219429 insertions(+), 5202 deletions(-) create mode 100644 mac/.config/AstroNvim/.luarc.json create mode 100644 mac/.config/AstroNvim/.neoconf.json create mode 100644 mac/.config/AstroNvim/.stylua.toml create mode 100644 mac/.config/AstroNvim/README.md create mode 100644 mac/.config/AstroNvim/init.lua create mode 100644 mac/.config/AstroNvim/lua/community.lua create mode 100644 mac/.config/AstroNvim/lua/lazy_setup.lua create mode 100644 mac/.config/AstroNvim/lua/plugins/astrocore.lua create mode 100644 mac/.config/AstroNvim/lua/plugins/astrolsp.lua create mode 100644 mac/.config/AstroNvim/lua/plugins/astroui.lua create mode 100644 mac/.config/AstroNvim/lua/plugins/mason.lua create mode 100644 mac/.config/AstroNvim/lua/plugins/none-ls.lua create mode 100644 mac/.config/AstroNvim/lua/plugins/treesitter.lua create mode 100644 mac/.config/AstroNvim/lua/plugins/user.lua create mode 100644 mac/.config/AstroNvim/lua/polish.lua create mode 100644 mac/.config/AstroNvim/neovim.yml create mode 100644 mac/.config/AstroNvim/selene.toml create mode 100644 mac/.config/LazyVim/.gitignore create mode 100644 mac/.config/LazyVim/.neoconf.json create mode 100644 mac/.config/LazyVim/LICENSE create mode 100644 mac/.config/LazyVim/README.md create mode 100644 mac/.config/LazyVim/init.lua create mode 100644 mac/.config/LazyVim/lua/config/autocmds.lua create mode 100644 mac/.config/LazyVim/lua/config/keymaps.lua create mode 100644 mac/.config/LazyVim/lua/config/lazy.lua create mode 100644 mac/.config/LazyVim/lua/config/options.lua create mode 100644 mac/.config/LazyVim/lua/plugins/example.lua create mode 100644 mac/.config/LazyVim/stylua.toml create mode 100644 mac/.config/LunarVim/.gitignore create mode 100644 mac/.config/LunarVim/.luacheckrc create mode 100644 mac/.config/LunarVim/.pre-commit-config.yaml create mode 100644 mac/.config/LunarVim/.stylua.toml create mode 100644 mac/.config/LunarVim/CHANGELOG.md create mode 100644 mac/.config/LunarVim/CONTRIBUTING.md create mode 100644 mac/.config/LunarVim/LICENSE create mode 100644 mac/.config/LunarVim/Makefile create mode 100644 mac/.config/LunarVim/README.md create mode 100644 mac/.config/LunarVim/init.lua create mode 100644 mac/.config/LunarVim/lua/lvim/bootstrap.lua create mode 100644 mac/.config/LunarVim/lua/lvim/config/_deprecated.lua create mode 100644 mac/.config/LunarVim/lua/lvim/config/defaults.lua create mode 100644 mac/.config/LunarVim/lua/lvim/config/init.lua create mode 100644 mac/.config/LunarVim/lua/lvim/config/settings.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/alpha.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/alpha/dashboard.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/alpha/startify.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/autocmds.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/autopairs.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/breadcrumbs.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/bufferline.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/builtins/init.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/cmp.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/commands.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/comment.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/dap.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/gitsigns.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/illuminate.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/indentlines.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/info.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/lir.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/log.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/lualine/colors.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/lualine/components.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/lualine/conditions.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/lualine/init.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/lualine/styles.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/lualine/utils.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/mason.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/nvimtree.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/project.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/telescope.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/telescope/custom-finders.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/terminal.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/theme.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/treesitter.lua create mode 100644 mac/.config/LunarVim/lua/lvim/core/which-key.lua create mode 100644 mac/.config/LunarVim/lua/lvim/icons.lua create mode 100644 mac/.config/LunarVim/lua/lvim/interface/popup.lua create mode 100644 mac/.config/LunarVim/lua/lvim/interface/text.lua create mode 100644 mac/.config/LunarVim/lua/lvim/keymappings.lua create mode 100644 mac/.config/LunarVim/lua/lvim/lsp/config.lua create mode 100644 mac/.config/LunarVim/lua/lvim/lsp/init.lua create mode 100644 mac/.config/LunarVim/lua/lvim/lsp/manager.lua create mode 100644 mac/.config/LunarVim/lua/lvim/lsp/null-ls/code_actions.lua create mode 100644 mac/.config/LunarVim/lua/lvim/lsp/null-ls/formatters.lua create mode 100644 mac/.config/LunarVim/lua/lvim/lsp/null-ls/init.lua create mode 100644 mac/.config/LunarVim/lua/lvim/lsp/null-ls/linters.lua create mode 100644 mac/.config/LunarVim/lua/lvim/lsp/null-ls/services.lua create mode 100644 mac/.config/LunarVim/lua/lvim/lsp/providers/jsonls.lua create mode 100644 mac/.config/LunarVim/lua/lvim/lsp/providers/lua_ls.lua create mode 100644 mac/.config/LunarVim/lua/lvim/lsp/providers/tailwindcss.lua create mode 100644 mac/.config/LunarVim/lua/lvim/lsp/providers/vuels.lua create mode 100644 mac/.config/LunarVim/lua/lvim/lsp/providers/yamlls.lua create mode 100644 mac/.config/LunarVim/lua/lvim/lsp/templates.lua create mode 100644 mac/.config/LunarVim/lua/lvim/lsp/utils.lua create mode 100644 mac/.config/LunarVim/lua/lvim/plugin-loader.lua create mode 100644 mac/.config/LunarVim/lua/lvim/plugins.lua create mode 100644 mac/.config/LunarVim/lua/lvim/utils.lua create mode 100644 mac/.config/LunarVim/lua/lvim/utils/git.lua create mode 100644 mac/.config/LunarVim/lua/lvim/utils/hooks.lua create mode 100644 mac/.config/LunarVim/lua/lvim/utils/modules.lua create mode 100644 mac/.config/LunarVim/lua/lvim/utils/table.lua create mode 100644 mac/.config/LunarVim/snapshots/default.json create mode 100644 mac/.config/LunarVim/tests/lvim/helpers.lua create mode 100644 mac/.config/LunarVim/tests/minimal_init.lua create mode 100644 mac/.config/LunarVim/tests/minimal_lsp.lua create mode 100644 mac/.config/LunarVim/tests/specs/bootstrap_spec.lua create mode 100644 mac/.config/LunarVim/tests/specs/config_loader_spec.lua create mode 100644 mac/.config/LunarVim/tests/specs/lsp_spec.lua create mode 100644 mac/.config/LunarVim/tests/specs/plugins_load_spec.lua create mode 100755 mac/.config/LunarVim/utils/bin/jdtls create mode 100644 mac/.config/LunarVim/utils/bin/lvim.ps1 create mode 100644 mac/.config/LunarVim/utils/bin/lvim.template create mode 100644 mac/.config/LunarVim/utils/ci/generate_new_lockfile.lua create mode 100644 mac/.config/LunarVim/utils/ci/generate_new_lockfile.sh create mode 100644 mac/.config/LunarVim/utils/ci/run_commitlint.sh create mode 100644 mac/.config/LunarVim/utils/ci/run_test.sh create mode 100644 mac/.config/LunarVim/utils/ci/update_changelog.sh create mode 100644 mac/.config/LunarVim/utils/ci/verify_plugins.lua create mode 100644 mac/.config/LunarVim/utils/ci/verify_plugins.sh create mode 100644 mac/.config/LunarVim/utils/desktop/16x16/lvim.svg create mode 100644 mac/.config/LunarVim/utils/desktop/22x22/lvim.svg create mode 100644 mac/.config/LunarVim/utils/desktop/24x24/lvim.svg create mode 100644 mac/.config/LunarVim/utils/desktop/32x32/lvim.svg create mode 100644 mac/.config/LunarVim/utils/desktop/48x48/lvim.svg create mode 100644 mac/.config/LunarVim/utils/desktop/64x64/lvim.svg create mode 100644 mac/.config/LunarVim/utils/desktop/lvim.desktop create mode 100644 mac/.config/LunarVim/utils/docker/Dockerfile.local create mode 100644 mac/.config/LunarVim/utils/docker/Dockerfile.remote create mode 100644 mac/.config/LunarVim/utils/installer/config.example.lua create mode 100644 mac/.config/LunarVim/utils/installer/config_win.example.lua create mode 100755 mac/.config/LunarVim/utils/installer/install-neovim-from-release create mode 100644 mac/.config/LunarVim/utils/installer/install.ps1 create mode 100755 mac/.config/LunarVim/utils/installer/install.sh create mode 100755 mac/.config/LunarVim/utils/installer/install_bin.sh create mode 100755 mac/.config/LunarVim/utils/installer/install_stylua.sh create mode 100644 mac/.config/LunarVim/utils/installer/uninstall.ps1 create mode 100755 mac/.config/LunarVim/utils/installer/uninstall.sh create mode 100644 mac/.config/NvChad/.stylua.toml create mode 100644 mac/.config/NvChad/LICENSE create mode 100644 mac/.config/NvChad/README.md create mode 100644 mac/.config/NvChad/init.lua create mode 100644 mac/.config/NvChad/lua/autocmds.lua create mode 100644 mac/.config/NvChad/lua/chadrc.lua create mode 100644 mac/.config/NvChad/lua/configs/conform.lua create mode 100644 mac/.config/NvChad/lua/configs/lazy.lua create mode 100644 mac/.config/NvChad/lua/configs/lspconfig.lua create mode 100644 mac/.config/NvChad/lua/mappings.lua create mode 100644 mac/.config/NvChad/lua/options.lua create mode 100644 mac/.config/NvChad/lua/plugins/init.lua create mode 100644 mac/.config/TheSiahxyz/after/queries/markdown/textobjects.scm create mode 100644 mac/.config/TheSiahxyz/ftplugin/markdown.lua create mode 100644 mac/.config/TheSiahxyz/ftplugin/quarto.lua create mode 100644 mac/.config/TheSiahxyz/init.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/core/autocmds.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/core/keymaps.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/core/lazy.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/core/options.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/health.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/init.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ai.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/cloak.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/cmp.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/colorizer.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/colorschemes.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/comment.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/compiler.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/context.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/csv.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/dadbod.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/dap.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/docker.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/git.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/goyo.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/grug-far.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/harpoon2.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/image.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/init.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/keys.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lf.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lsp.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lualine.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/macro.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/markdown.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/marks.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/navic.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/neo-tree.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/obsidian.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/outline.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/project.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/python.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/quickfix.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/refactoring.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/sessions.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/silicon.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/snippets.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/stay-centered.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/surround.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/telescope.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/textobject.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/todo.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/treesitter.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/urlview.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/virt-column.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/wiki.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/zenmode.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/markdown.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/neetcode1.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/neetcode2.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/quarto.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/whichkey.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/utils/cheatsheet.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/utils/cheatsheet/grid.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/utils/cheatsheet/init.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/utils/icons.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/utils/markdown.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/utils/snippet.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/utils/tasks.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/utils/tmux.lua create mode 100644 mac/.config/TheSiahxyz/lua/TheSiahxyz/utils/utils.lua create mode 100644 mac/.config/TheSiahxyz/spell/en.utf-8.add create mode 100644 mac/.config/TheSiahxyz/spell/en.utf-8.add.spl create mode 100644 mac/.config/TheSiahxyz/spell/ko.utf-8.dic create mode 100644 mac/.config/TheSiahxyz/spell/ko.utf-8.spl create mode 100644 mac/.config/aerospace/aerospace.toml create mode 100644 mac/.config/aerospace/aerospace.toml.bak create mode 100644 mac/.config/aerospace/aerospace.toml.bak2 create mode 100644 mac/.config/atuin/config.toml create mode 100644 mac/.config/bash/bash_profile create mode 100644 mac/.config/bash/bashrc create mode 100644 mac/.config/bat/config create mode 100644 mac/.config/bat/themes/Catppuccin Frappe.tmTheme create mode 100644 mac/.config/bat/themes/Catppuccin Latte.tmTheme create mode 100644 mac/.config/bat/themes/Catppuccin Macchiato.tmTheme create mode 100644 mac/.config/bat/themes/Catppuccin Mocha.tmTheme mode change 100644 => 100755 mac/.config/borders/bordersrc create mode 100644 mac/.config/fastfetch/config.jsonc create mode 100644 mac/.config/firefox/chrome/userChrome.css create mode 100644 mac/.config/firefox/enhanceforyoutube.json create mode 100644 mac/.config/firefox/thesiah.js create mode 100644 mac/.config/firefox/vdh-settings.json create mode 100644 mac/.config/firefox/vimium-options.json create mode 100644 mac/.config/fontconfig/fonts.conf create mode 100644 mac/.config/git/attributes create mode 100644 mac/.config/git/config create mode 100644 mac/.config/git/gitk create mode 100644 mac/.config/git/ignore create mode 100644 mac/.config/gitmux/gitmux.conf create mode 100644 mac/.config/glove80/04d0bf0b-a700-4292-98bd-bfce72b88109_v25.01_Glorious Engrammer v41.uf2 create mode 100644 mac/.config/glove80/9a7b1fa3-1a4f-4b8a-80bc-e1fde55550e4_v25.01_Glorious Engrammer v41.uf2 create mode 100644 mac/.config/glove80/moergo-glove80-keyboard-layers.pdf create mode 100644 mac/.config/karabiner/assets/complex_modifications/1755910681.json create mode 100644 mac/.config/karabiner/assets/complex_modifications/1755910750.json create mode 100644 mac/.config/karabiner/automatic_backups/karabiner_20250823.json create mode 100644 mac/.config/kickstart/.gitignore create mode 100644 mac/.config/kickstart/.stylua.toml create mode 100644 mac/.config/kickstart/LICENSE.md create mode 100644 mac/.config/kickstart/README.md create mode 100644 mac/.config/kickstart/doc/kickstart.txt create mode 100644 mac/.config/kickstart/init.lua create mode 100644 mac/.config/kickstart/lua/custom/plugins/init.lua create mode 100644 mac/.config/kickstart/lua/kickstart/health.lua create mode 100644 mac/.config/kickstart/lua/kickstart/plugins/autopairs.lua create mode 100644 mac/.config/kickstart/lua/kickstart/plugins/debug.lua create mode 100644 mac/.config/kickstart/lua/kickstart/plugins/gitsigns.lua create mode 100644 mac/.config/kickstart/lua/kickstart/plugins/indent_line.lua create mode 100644 mac/.config/kickstart/lua/kickstart/plugins/lint.lua create mode 100644 mac/.config/kickstart/lua/kickstart/plugins/neo-tree.lua create mode 100644 mac/.config/lazygit/config.yml create mode 100755 mac/.config/lf/cleaner create mode 100644 mac/.config/lf/icons create mode 100644 mac/.config/lf/lfrc create mode 100644 mac/.config/lf/rooticons create mode 100755 mac/.config/lf/scope create mode 100644 mac/.config/mpd/mpd.conf create mode 100644 mac/.config/mpd/playlists/entire.m3u create mode 100644 mac/.config/mpd/playlists/jpop.m3u create mode 100644 mac/.config/mpd/playlists/kpop.m3u create mode 100644 mac/.config/mpd/playlists/pop.m3u create mode 100644 mac/.config/mpv/input.conf create mode 100644 mac/.config/mpv/mpv.conf create mode 100644 mac/.config/mpv/osc.conf create mode 100644 mac/.config/mpv/script-modules/extended-menu.lua create mode 100644 mac/.config/mpv/script-modules/gallery.lua create mode 100644 mac/.config/mpv/script-modules/input-console.lua create mode 100644 mac/.config/mpv/script-modules/mpvSockets.lua create mode 100644 mac/.config/mpv/script-modules/scroll-list.lua create mode 100644 mac/.config/mpv/script-modules/sha1.lua create mode 100644 mac/.config/mpv/script-modules/user-input-module.lua create mode 100644 mac/.config/mpv/script-modules/utf8/LICENSE create mode 100644 mac/.config/mpv/script-modules/utf8/README.md create mode 100644 mac/.config/mpv/script-modules/utf8/begins/compiletime/parser.lua create mode 100644 mac/.config/mpv/script-modules/utf8/begins/compiletime/vanilla.lua create mode 100644 mac/.config/mpv/script-modules/utf8/charclass/compiletime/builder.lua create mode 100644 mac/.config/mpv/script-modules/utf8/charclass/compiletime/parser.lua create mode 100644 mac/.config/mpv/script-modules/utf8/charclass/compiletime/range.lua create mode 100644 mac/.config/mpv/script-modules/utf8/charclass/compiletime/stub.lua create mode 100644 mac/.config/mpv/script-modules/utf8/charclass/compiletime/vanilla.lua create mode 100644 mac/.config/mpv/script-modules/utf8/charclass/runtime/base.lua create mode 100644 mac/.config/mpv/script-modules/utf8/charclass/runtime/dummy.lua create mode 100644 mac/.config/mpv/script-modules/utf8/charclass/runtime/init.lua create mode 100644 mac/.config/mpv/script-modules/utf8/charclass/runtime/native.lua create mode 100644 mac/.config/mpv/script-modules/utf8/context/compiletime.lua create mode 100644 mac/.config/mpv/script-modules/utf8/context/runtime.lua create mode 100644 mac/.config/mpv/script-modules/utf8/ends/compiletime/parser.lua create mode 100644 mac/.config/mpv/script-modules/utf8/ends/compiletime/vanilla.lua create mode 100644 mac/.config/mpv/script-modules/utf8/functions/lua53.lua create mode 100644 mac/.config/mpv/script-modules/utf8/init.lua create mode 100644 mac/.config/mpv/script-modules/utf8/modifier/compiletime/frontier.lua create mode 100644 mac/.config/mpv/script-modules/utf8/modifier/compiletime/parser.lua create mode 100644 mac/.config/mpv/script-modules/utf8/modifier/compiletime/simple.lua create mode 100644 mac/.config/mpv/script-modules/utf8/modifier/compiletime/stub.lua create mode 100644 mac/.config/mpv/script-modules/utf8/modifier/compiletime/vanilla.lua create mode 100644 mac/.config/mpv/script-modules/utf8/primitives/dummy.lua create mode 100644 mac/.config/mpv/script-modules/utf8/primitives/init.lua create mode 100644 mac/.config/mpv/script-modules/utf8/primitives/native.lua create mode 100644 mac/.config/mpv/script-modules/utf8/primitives/tarantool.lua create mode 100644 mac/.config/mpv/script-modules/utf8/regex_parser.lua create mode 100755 mac/.config/mpv/script-modules/utf8/test.sh create mode 100644 mac/.config/mpv/script-modules/utf8/test/charclass_compiletime.lua create mode 100644 mac/.config/mpv/script-modules/utf8/test/charclass_runtime.lua create mode 100644 mac/.config/mpv/script-modules/utf8/test/context_runtime.lua create mode 100644 mac/.config/mpv/script-modules/utf8/test/strict.lua create mode 100644 mac/.config/mpv/script-modules/utf8/test/test.lua create mode 100644 mac/.config/mpv/script-modules/utf8/test/test_compat.lua create mode 100644 mac/.config/mpv/script-modules/utf8/test/test_pm.lua create mode 100644 mac/.config/mpv/script-modules/utf8/test/test_utf8data.lua create mode 100644 mac/.config/mpv/script-modules/utf8/test/util.lua create mode 100644 mac/.config/mpv/script-modules/utf8/util.lua create mode 100644 mac/.config/mpv/script-modules/utf8_data.lua create mode 100644 mac/.config/mpv/script-opts/SimpleBookmark.conf create mode 100644 mac/.config/mpv/script-opts/SmartCopyPaste_II.conf create mode 100644 mac/.config/mpv/script-opts/SmartSkip.conf create mode 100644 mac/.config/mpv/script-opts/blur_edges.conf create mode 100644 mac/.config/mpv/script-opts/command_palette.conf create mode 100644 mac/.config/mpv/script-opts/gallery_worker.conf create mode 100644 mac/.config/mpv/script-opts/mdmenu.conf create mode 100644 mac/.config/mpv/script-opts/mpv_crop_script.conf create mode 100644 mac/.config/mpv/script-opts/playlist_view.conf create mode 100644 mac/.config/mpv/script-opts/thumbfast.conf create mode 100644 mac/.config/mpv/scripts/Rename.lua create mode 100644 mac/.config/mpv/scripts/SimpleBookmark.lua create mode 100644 mac/.config/mpv/scripts/SmartCopyPaste_II.lua create mode 100644 mac/.config/mpv/scripts/SmartSkip.lua create mode 100644 mac/.config/mpv/scripts/UndoRedo.lua create mode 100644 mac/.config/mpv/scripts/blackout.lua create mode 100644 mac/.config/mpv/scripts/blur-edges.lua create mode 100644 mac/.config/mpv/scripts/change-OSD-media-title.lua create mode 100644 mac/.config/mpv/scripts/command_palette.lua create mode 100644 mac/.config/mpv/scripts/cycle-video-rotate.lua create mode 100644 mac/.config/mpv/scripts/delete_current_file.lua create mode 100644 mac/.config/mpv/scripts/fuzzydir.lua create mode 100644 mac/.config/mpv/scripts/gallery-thumbgen.lua create mode 100644 mac/.config/mpv/scripts/history.lua create mode 100644 mac/.config/mpv/scripts/mdmenu.lua create mode 100644 mac/.config/mpv/scripts/misc.lua create mode 100644 mac/.config/mpv/scripts/modules.lua create mode 100644 mac/.config/mpv/scripts/mpv_crop_script.lua create mode 100644 mac/.config/mpv/scripts/navigator.lua create mode 100644 mac/.config/mpv/scripts/osc-show-hide.lua create mode 100644 mac/.config/mpv/scripts/osc.lua create mode 100644 mac/.config/mpv/scripts/playlist-view.lua create mode 100644 mac/.config/mpv/scripts/playlistmanager.lua create mode 100644 mac/.config/mpv/scripts/reload.lua create mode 100644 mac/.config/mpv/scripts/sponsorblock_minimal.lua create mode 100644 mac/.config/mpv/scripts/subtitle-search.lua create mode 100644 mac/.config/mpv/scripts/thumbfast.lua create mode 100644 mac/.config/mpv/scripts/user-input.lua create mode 100644 mac/.config/mpv/scripts/xscreensaver.lua create mode 100644 mac/.config/mpv/scripts/youtube-search.lua create mode 100644 mac/.config/mpv/scripts/ytdl-preload.lua create mode 100644 mac/.config/mpv/unused_scipts/xrandr.lua create mode 100644 mac/.config/mutt/README.md create mode 100644 mac/.config/ncmpcpp/bindings create mode 100644 mac/.config/ncmpcpp/config delete mode 100644 mac/.config/neofetch/config.conf create mode 100644 mac/.config/newsboat/config create mode 100644 mac/.config/newsboat/urls create mode 100644 mac/.config/npm/.npmrc create mode 100644 mac/.config/openvpn/thesiah.ovpn delete mode 100644 mac/.config/pam-gnupg create mode 100644 mac/.config/pass-git-helper/git-pass-mapping.ini create mode 100644 mac/.config/pipe-viewer/pipe-viewer.conf create mode 100644 mac/.config/python/pythonrc create mode 100644 mac/.config/qutebrowser/config.py create mode 100644 mac/.config/qutebrowser/greasemonkey/0x0.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/arstechnica.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/cnn-lite.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/csmonitor-text.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/dienet.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/dir.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/fandom.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/git-scm.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/google.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/imdb.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/leadertelegram.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/manpages.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/npr-text.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/opengroup.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/rarbg.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/reddit.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/smbc-comics.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/stackexchange.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/termbin.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/wiki.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/xkcd.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/ycombinator.css.js create mode 100644 mac/.config/qutebrowser/greasemonkey/youtube-ads.js create mode 100644 mac/.config/qutebrowser/greasemonkey/youtube.css.js create mode 100644 mac/.config/qutebrowser/themes/base16-brogrammer.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-catppuccin-frappe.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-catppuccin-latte.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-catppuccin-macchiato.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-catppuccin-mocha.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-catppuccin.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-dracula.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-everforest-dark-hard.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-everforest-dark-soft.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-everforest.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-github-dark.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-github.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-gruvbox-dark-hard.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-gruvbox-dark-medium.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-gruvbox-dark-pale.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-gruvbox-dark-soft.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-gruvbox-dark.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-material-darker.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-material-palenight.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-monokai.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-nord-light.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-nord.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-oceanicnext.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-onedark-dark.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-onedark.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-rose-pine-dawn.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-rose-pine-moon.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-rose-pine.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-solarized-dark.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-solarized-light.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-tokyo-night-dark.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-tokyo-night-light.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-tokyo-night-moon.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-tokyo-night-storm.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-tokyo-night-terminal-dark.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-tokyo-night-terminal-light.config.py create mode 100644 mac/.config/qutebrowser/themes/base16-tokyo-night-terminal-storm.config.py create mode 100644 mac/.config/qutebrowser/themes/catppuccin.py create mode 100644 mac/.config/qutebrowser/themes/dracula.py create mode 100644 mac/.config/qutebrowser/themes/gruvbox.py create mode 100644 mac/.config/qutebrowser/themes/solarized-dark.py create mode 100644 mac/.config/qutebrowser/themes/solarized-light.py create mode 100644 mac/.config/qutebrowser/themes/xresources.py create mode 100755 mac/.config/qutebrowser/userscripts/add-nextcloud-bookmarks create mode 100755 mac/.config/qutebrowser/userscripts/add-nextcloud-cookbook create mode 100755 mac/.config/qutebrowser/userscripts/code_select create mode 100755 mac/.config/qutebrowser/userscripts/gitclone create mode 100755 mac/.config/qutebrowser/userscripts/qr create mode 100755 mac/.config/qutebrowser/userscripts/qute-pass create mode 100755 mac/.config/qutebrowser/userscripts/substiqute create mode 100755 mac/.config/qutebrowser/userscripts/tab-manager create mode 100755 mac/.config/qutebrowser/userscripts/translate create mode 100644 mac/.config/qutebrowser/userscripts/usage.txt create mode 100644 mac/.config/sc-im/scimrc create mode 100644 mac/.config/sesh/sesh.toml create mode 100644 mac/.config/shell/aliasrc create mode 100644 mac/.config/shell/bm-dirs create mode 100644 mac/.config/shell/bm-files create mode 100644 mac/.config/shell/git-aliasrc create mode 100644 mac/.config/shell/inputrc create mode 100644 mac/.config/shell/profile create mode 100755 mac/.config/sketchybar.allapp/colors.sh create mode 100644 mac/.config/sketchybar.allapp/helper/cpu.h create mode 100755 mac/.config/sketchybar.allapp/helper/helper create mode 100644 mac/.config/sketchybar.allapp/helper/helper.c create mode 100644 mac/.config/sketchybar.allapp/helper/makefile create mode 100644 mac/.config/sketchybar.allapp/helper/sketchybar.h create mode 100755 mac/.config/sketchybar.allapp/helpers/event_providers/cpu_load/bin/cpu_load create mode 100755 mac/.config/sketchybar.allapp/helpers/event_providers/network_load/bin/network_load create mode 100755 mac/.config/sketchybar.allapp/helpers/menus/bin/menus create mode 100755 mac/.config/sketchybar.allapp/icons.sh create mode 100755 mac/.config/sketchybar.allapp/items/apple.sh create mode 100755 mac/.config/sketchybar.allapp/items/battery.sh create mode 100755 mac/.config/sketchybar.allapp/items/calendar.sh create mode 100755 mac/.config/sketchybar.allapp/items/cpu.sh create mode 100755 mac/.config/sketchybar.allapp/items/front_app.sh create mode 100755 mac/.config/sketchybar.allapp/items/input_source.sh create mode 100755 mac/.config/sketchybar.allapp/items/spaces.sh create mode 100755 mac/.config/sketchybar.allapp/items/volume.sh create mode 100755 mac/.config/sketchybar.allapp/items/weather.sh create mode 100755 mac/.config/sketchybar.allapp/plugins/aerospace.sh create mode 100755 mac/.config/sketchybar.allapp/plugins/apple.sh create mode 100755 mac/.config/sketchybar.allapp/plugins/battery.sh create mode 100755 mac/.config/sketchybar.allapp/plugins/calendar.sh create mode 100755 mac/.config/sketchybar.allapp/plugins/change_windows.sh create mode 100755 mac/.config/sketchybar.allapp/plugins/clock.sh create mode 100755 mac/.config/sketchybar.allapp/plugins/cpu.sh create mode 100755 mac/.config/sketchybar.allapp/plugins/front_app.sh create mode 100755 mac/.config/sketchybar.allapp/plugins/get_input_source.sh create mode 100755 mac/.config/sketchybar.allapp/plugins/icon_map.sh create mode 100755 mac/.config/sketchybar.allapp/plugins/space.sh create mode 100755 mac/.config/sketchybar.allapp/plugins/space_windows.sh create mode 100755 mac/.config/sketchybar.allapp/plugins/volume.sh create mode 100755 mac/.config/sketchybar.allapp/plugins/volume_click.sh create mode 100755 mac/.config/sketchybar.allapp/plugins/weather.sh create mode 100755 mac/.config/sketchybar.allapp/plugins/wifi.sh create mode 100755 mac/.config/sketchybar.allapp/plugins/zen.sh create mode 100644 mac/.config/sketchybar.allapp/reference.md create mode 100755 mac/.config/sketchybar.allapp/sketchybarrc create mode 100755 mac/.config/sketchybar.mon/colors.sh create mode 100755 mac/.config/sketchybar.mon/globalstyles.sh create mode 100644 mac/.config/sketchybar.mon/helper/cpu.h create mode 100755 mac/.config/sketchybar.mon/helper/helper create mode 100644 mac/.config/sketchybar.mon/helper/helper.c create mode 100644 mac/.config/sketchybar.mon/helper/makefile create mode 100644 mac/.config/sketchybar.mon/helper/sketchybar.h create mode 100755 mac/.config/sketchybar.mon/icons.sh create mode 100755 mac/.config/sketchybar.mon/items/apple.sh create mode 100755 mac/.config/sketchybar.mon/items/battery.sh create mode 100755 mac/.config/sketchybar.mon/items/brew.sh create mode 100755 mac/.config/sketchybar.mon/items/cpu.sh create mode 100755 mac/.config/sketchybar.mon/items/datetime.sh create mode 100755 mac/.config/sketchybar.mon/items/disk.sh create mode 100755 mac/.config/sketchybar.mon/items/dnd.sh create mode 100755 mac/.config/sketchybar.mon/items/front_app.sh create mode 100755 mac/.config/sketchybar.mon/items/github.sh create mode 100755 mac/.config/sketchybar.mon/items/kakaotalk.sh create mode 100755 mac/.config/sketchybar.mon/items/keyboard.sh create mode 100755 mac/.config/sketchybar.mon/items/mail.sh create mode 100755 mac/.config/sketchybar.mon/items/memory.sh create mode 100755 mac/.config/sketchybar.mon/items/messages.sh create mode 100755 mac/.config/sketchybar.mon/items/mic.sh create mode 100755 mac/.config/sketchybar.mon/items/music.sh create mode 100755 mac/.config/sketchybar.mon/items/network.sh create mode 100755 mac/.config/sketchybar.mon/items/package_monitor.sh create mode 100755 mac/.config/sketchybar.mon/items/separator_right.sh create mode 100755 mac/.config/sketchybar.mon/items/spaces.sh create mode 100755 mac/.config/sketchybar.mon/items/spotify.sh create mode 100755 mac/.config/sketchybar.mon/items/svim.sh create mode 100755 mac/.config/sketchybar.mon/items/system.sh create mode 100755 mac/.config/sketchybar.mon/items/thunderbird.sh create mode 100755 mac/.config/sketchybar.mon/items/toggle_stats.sh create mode 100755 mac/.config/sketchybar.mon/items/volume.sh create mode 100755 mac/.config/sketchybar.mon/items/weather.sh create mode 100755 mac/.config/sketchybar.mon/items/wifi.sh create mode 100755 mac/.config/sketchybar.mon/items/yabai.sh create mode 100755 mac/.config/sketchybar.mon/plugins/battery.sh create mode 100755 mac/.config/sketchybar.mon/plugins/brew.sh create mode 100755 mac/.config/sketchybar.mon/plugins/disk.sh create mode 100755 mac/.config/sketchybar.mon/plugins/dnd.sh create mode 100755 mac/.config/sketchybar.mon/plugins/dndindicator.sh create mode 100755 mac/.config/sketchybar.mon/plugins/front_app.sh create mode 100755 mac/.config/sketchybar.mon/plugins/github.sh create mode 100755 mac/.config/sketchybar.mon/plugins/icon_map.sh create mode 100755 mac/.config/sketchybar.mon/plugins/kakaotalk.sh create mode 100755 mac/.config/sketchybar.mon/plugins/keyboard.sh create mode 100755 mac/.config/sketchybar.mon/plugins/mail.sh create mode 100755 mac/.config/sketchybar.mon/plugins/memory.sh create mode 100755 mac/.config/sketchybar.mon/plugins/messages.sh create mode 100755 mac/.config/sketchybar.mon/plugins/mic.sh create mode 100755 mac/.config/sketchybar.mon/plugins/mic_click.sh create mode 100755 mac/.config/sketchybar.mon/plugins/music.sh create mode 100644 mac/.config/sketchybar.mon/plugins/music/Cover-Default.png create mode 100644 mac/.config/sketchybar.mon/plugins/music/Get-Artwork.applescript create mode 100755 mac/.config/sketchybar.mon/plugins/network.sh create mode 100755 mac/.config/sketchybar.mon/plugins/nextevent.applescript create mode 100755 mac/.config/sketchybar.mon/plugins/nextevent.sh create mode 100755 mac/.config/sketchybar.mon/plugins/space.py create mode 100755 mac/.config/sketchybar.mon/plugins/space.sh create mode 100755 mac/.config/sketchybar.mon/plugins/space_windows.sh create mode 100755 mac/.config/sketchybar.mon/plugins/spotify.sh create mode 100755 mac/.config/sketchybar.mon/plugins/svim.sh create mode 100755 mac/.config/sketchybar.mon/plugins/thunderbird.sh create mode 100755 mac/.config/sketchybar.mon/plugins/toggle_stats.sh create mode 100755 mac/.config/sketchybar.mon/plugins/volume.sh create mode 100755 mac/.config/sketchybar.mon/plugins/volume_click.sh create mode 100755 mac/.config/sketchybar.mon/plugins/weather.sh create mode 100755 mac/.config/sketchybar.mon/plugins/wifi.sh create mode 100755 mac/.config/sketchybar.mon/plugins/yabai.sh create mode 100755 mac/.config/sketchybar.mon/plugins/zen.sh create mode 100644 "mac/.config/sketchybar.mon/sketchybar/ \360\237\221\275 aerospace-config/.aerospace.toml" create mode 100644 mac/.config/sketchybar.mon/sketchybar/LICENSE create mode 100755 mac/.config/sketchybar.mon/sketchybar/colors.sh create mode 100644 mac/.config/sketchybar.mon/sketchybar/helper/cpu.h create mode 100755 mac/.config/sketchybar.mon/sketchybar/helper/helper create mode 100644 mac/.config/sketchybar.mon/sketchybar/helper/helper.c create mode 100644 mac/.config/sketchybar.mon/sketchybar/helper/makefile create mode 100644 mac/.config/sketchybar.mon/sketchybar/helper/sketchybar.h create mode 100755 mac/.config/sketchybar.mon/sketchybar/icons.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/items/apple.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/items/battery.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/items/calendar.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/items/cpu.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/items/front_app.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/items/input_source.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/items/spaces.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/items/volume.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/items/weather.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/aerospace.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/aerospace_display.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/apple.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/battery.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/bluetooth.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/calendar.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/change_windows.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/clock.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/clock_click.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/cpu.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/front_app.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/get_input_source.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/icon_map.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/monitor_watcher.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/now_playing.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/space.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/space_windows.sh create mode 100644 mac/.config/sketchybar.mon/sketchybar/plugins/test_click.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/volume.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/volume_click.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/weather.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/wifi.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/plugins/zen.sh create mode 100644 mac/.config/sketchybar.mon/sketchybar/reference.md create mode 100755 mac/.config/sketchybar.mon/sketchybar/restart.sh create mode 100755 mac/.config/sketchybar.mon/sketchybar/sketchybarrc create mode 100755 mac/.config/sketchybar.mon/sketchybarrc create mode 100755 mac/.config/sketchybar.yabai/colors.sh create mode 100755 mac/.config/sketchybar.yabai/globalstyles.sh create mode 100644 mac/.config/sketchybar.yabai/helper/cpu.h create mode 100755 mac/.config/sketchybar.yabai/helper/helper create mode 100644 mac/.config/sketchybar.yabai/helper/helper.c create mode 100644 mac/.config/sketchybar.yabai/helper/makefile create mode 100644 mac/.config/sketchybar.yabai/helper/sketchybar.h create mode 100755 mac/.config/sketchybar.yabai/icons.sh create mode 100755 mac/.config/sketchybar.yabai/items/apple.sh create mode 100755 mac/.config/sketchybar.yabai/items/battery.sh create mode 100755 mac/.config/sketchybar.yabai/items/brew.sh create mode 100755 mac/.config/sketchybar.yabai/items/cpu.sh create mode 100755 mac/.config/sketchybar.yabai/items/datetime.sh create mode 100755 mac/.config/sketchybar.yabai/items/disk.sh create mode 100755 mac/.config/sketchybar.yabai/items/dnd.sh create mode 100755 mac/.config/sketchybar.yabai/items/front_app.sh create mode 100755 mac/.config/sketchybar.yabai/items/github.sh create mode 100755 mac/.config/sketchybar.yabai/items/kakaotalk.sh create mode 100755 mac/.config/sketchybar.yabai/items/keyboard.sh create mode 100755 mac/.config/sketchybar.yabai/items/mail.sh create mode 100755 mac/.config/sketchybar.yabai/items/memory.sh create mode 100755 mac/.config/sketchybar.yabai/items/messages.sh create mode 100755 mac/.config/sketchybar.yabai/items/mic.sh create mode 100755 mac/.config/sketchybar.yabai/items/music.sh create mode 100755 mac/.config/sketchybar.yabai/items/network.sh create mode 100755 mac/.config/sketchybar.yabai/items/package_monitor.sh create mode 100755 mac/.config/sketchybar.yabai/items/separator_right.sh create mode 100755 mac/.config/sketchybar.yabai/items/spaces.sh create mode 100755 mac/.config/sketchybar.yabai/items/spotify.sh create mode 100755 mac/.config/sketchybar.yabai/items/svim.sh create mode 100755 mac/.config/sketchybar.yabai/items/system.sh create mode 100755 mac/.config/sketchybar.yabai/items/thunderbird.sh create mode 100755 mac/.config/sketchybar.yabai/items/toggle_stats.sh create mode 100755 mac/.config/sketchybar.yabai/items/volume.sh create mode 100755 mac/.config/sketchybar.yabai/items/weather.sh create mode 100755 mac/.config/sketchybar.yabai/items/wifi.sh create mode 100755 mac/.config/sketchybar.yabai/items/yabai.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/battery.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/brew.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/disk.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/dnd.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/dndindicator.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/front_app.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/github.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/icon_map.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/kakaotalk.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/keyboard.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/mail.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/memory.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/messages.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/mic.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/mic_click.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/music.sh create mode 100644 mac/.config/sketchybar.yabai/plugins/music/Cover-Default.png create mode 100644 mac/.config/sketchybar.yabai/plugins/music/Get-Artwork.applescript create mode 100755 mac/.config/sketchybar.yabai/plugins/network.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/nextevent.applescript create mode 100755 mac/.config/sketchybar.yabai/plugins/nextevent.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/space.py create mode 100755 mac/.config/sketchybar.yabai/plugins/space.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/space_windows.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/spotify.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/svim.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/thunderbird.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/toggle_stats.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/volume.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/volume_click.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/weather.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/wifi.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/yabai.sh create mode 100755 mac/.config/sketchybar.yabai/plugins/zen.sh create mode 100755 mac/.config/sketchybar.yabai/sketchybarrc delete mode 100644 mac/.config/sketchybar/colors.sh delete mode 100644 mac/.config/sketchybar/globalstyles.sh delete mode 100644 mac/.config/sketchybar/helper/cpu.h delete mode 100644 mac/.config/sketchybar/helper/helper delete mode 100644 mac/.config/sketchybar/helper/helper.c delete mode 100644 mac/.config/sketchybar/helper/makefile delete mode 100644 mac/.config/sketchybar/helper/sketchybar.h delete mode 100644 mac/.config/sketchybar/icons.sh delete mode 100644 mac/.config/sketchybar/items/apple.sh delete mode 100644 mac/.config/sketchybar/items/battery.sh delete mode 100644 mac/.config/sketchybar/items/brew.sh delete mode 100644 mac/.config/sketchybar/items/cpu.sh delete mode 100644 mac/.config/sketchybar/items/datetime.sh delete mode 100644 mac/.config/sketchybar/items/disk.sh delete mode 100644 mac/.config/sketchybar/items/dnd.sh delete mode 100644 mac/.config/sketchybar/items/front_app.sh delete mode 100644 mac/.config/sketchybar/items/github.sh delete mode 100644 mac/.config/sketchybar/items/kakaotalk.sh delete mode 100644 mac/.config/sketchybar/items/keyboard.sh delete mode 100644 mac/.config/sketchybar/items/mail.sh delete mode 100644 mac/.config/sketchybar/items/memory.sh delete mode 100644 mac/.config/sketchybar/items/messages.sh delete mode 100644 mac/.config/sketchybar/items/mic.sh delete mode 100644 mac/.config/sketchybar/items/music.sh delete mode 100644 mac/.config/sketchybar/items/network.sh delete mode 100644 mac/.config/sketchybar/items/package_monitor.sh delete mode 100644 mac/.config/sketchybar/items/separator_right.sh delete mode 100644 mac/.config/sketchybar/items/spaces.sh delete mode 100644 mac/.config/sketchybar/items/spotify.sh delete mode 100644 mac/.config/sketchybar/items/svim.sh delete mode 100644 mac/.config/sketchybar/items/system.sh delete mode 100644 mac/.config/sketchybar/items/thunderbird.sh delete mode 100644 mac/.config/sketchybar/items/toggle_stats.sh delete mode 100644 mac/.config/sketchybar/items/volume.sh delete mode 100644 mac/.config/sketchybar/items/weather.sh delete mode 100644 mac/.config/sketchybar/items/wifi.sh delete mode 100644 mac/.config/sketchybar/items/yabai.sh delete mode 100644 mac/.config/sketchybar/plugins/battery.sh delete mode 100644 mac/.config/sketchybar/plugins/brew.sh delete mode 100644 mac/.config/sketchybar/plugins/disk.sh delete mode 100644 mac/.config/sketchybar/plugins/dnd.sh delete mode 100644 mac/.config/sketchybar/plugins/dndindicator.sh delete mode 100644 mac/.config/sketchybar/plugins/front_app.sh delete mode 100644 mac/.config/sketchybar/plugins/github.sh delete mode 100644 mac/.config/sketchybar/plugins/icon_map.sh delete mode 100644 mac/.config/sketchybar/plugins/kakaotalk.sh delete mode 100644 mac/.config/sketchybar/plugins/keyboard.sh delete mode 100644 mac/.config/sketchybar/plugins/mail.sh delete mode 100644 mac/.config/sketchybar/plugins/memory.sh delete mode 100644 mac/.config/sketchybar/plugins/messages.sh delete mode 100644 mac/.config/sketchybar/plugins/mic.sh delete mode 100644 mac/.config/sketchybar/plugins/mic_click.sh delete mode 100644 mac/.config/sketchybar/plugins/music.sh delete mode 100644 mac/.config/sketchybar/plugins/music/Cover-Default.png delete mode 100644 mac/.config/sketchybar/plugins/music/Get-Artwork.applescript delete mode 100644 mac/.config/sketchybar/plugins/network.sh delete mode 100644 mac/.config/sketchybar/plugins/nextevent.applescript delete mode 100644 mac/.config/sketchybar/plugins/nextevent.sh delete mode 100644 mac/.config/sketchybar/plugins/space.py delete mode 100644 mac/.config/sketchybar/plugins/space.sh delete mode 100644 mac/.config/sketchybar/plugins/space_windows.sh delete mode 100644 mac/.config/sketchybar/plugins/spotify.sh delete mode 100644 mac/.config/sketchybar/plugins/svim.sh delete mode 100644 mac/.config/sketchybar/plugins/thunderbird.sh delete mode 100644 mac/.config/sketchybar/plugins/toggle_stats.sh delete mode 100644 mac/.config/sketchybar/plugins/volume.sh delete mode 100644 mac/.config/sketchybar/plugins/volume_click.sh delete mode 100644 mac/.config/sketchybar/plugins/weather.sh delete mode 100644 mac/.config/sketchybar/plugins/wifi.sh delete mode 100644 mac/.config/sketchybar/plugins/yabai.sh delete mode 100644 mac/.config/sketchybar/plugins/zen.sh delete mode 100644 mac/.config/sketchybar/sketchybarrc create mode 100644 mac/.config/starship/starship.toml create mode 100644 mac/.config/task/taskrc create mode 100644 mac/.config/taskopen/taskopenrc create mode 100644 mac/.config/tmux/tmux.conf create mode 100644 mac/.config/transmission-daemon/settings.json create mode 100644 mac/.config/vim/UltiSnips/all.snippets create mode 100644 mac/.config/vim/init.vim create mode 100644 mac/.config/vim/plugins.vim create mode 100644 mac/.config/vim/vimrc delete mode 100644 mac/.config/vscode/argv.json create mode 100644 mac/.config/wget/wgetrc mode change 100644 => 100755 mac/.config/yabai/yabairc create mode 100644 mac/.config/zsh/.zshrc create mode 100644 mac/.config/zsh/autocomplete.zsh create mode 100644 mac/.config/zsh/git.zsh create mode 100644 mac/.config/zsh/keymaps.zsh create mode 100644 mac/.config/zsh/p10k.zsh create mode 100644 mac/.config/zsh/packages.zsh create mode 100644 mac/.config/zsh/plugins.zsh create mode 100644 mac/.config/zsh/scripts.zsh (limited to 'mac') diff --git a/mac/.config/AstroNvim/.luarc.json b/mac/.config/AstroNvim/.luarc.json new file mode 100644 index 0000000..8415579 --- /dev/null +++ b/mac/.config/AstroNvim/.luarc.json @@ -0,0 +1,3 @@ +{ + "format.enable": false +} diff --git a/mac/.config/AstroNvim/.neoconf.json b/mac/.config/AstroNvim/.neoconf.json new file mode 100644 index 0000000..2d7a81f --- /dev/null +++ b/mac/.config/AstroNvim/.neoconf.json @@ -0,0 +1,20 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + }, + "lspconfig": { + "lua_ls": { + "Lua.format.enable": false + } + } +} diff --git a/mac/.config/AstroNvim/.stylua.toml b/mac/.config/AstroNvim/.stylua.toml new file mode 100644 index 0000000..bfcffff --- /dev/null +++ b/mac/.config/AstroNvim/.stylua.toml @@ -0,0 +1,7 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "None" +collapse_simple_statement = "Always" diff --git a/mac/.config/AstroNvim/README.md b/mac/.config/AstroNvim/README.md new file mode 100644 index 0000000..71d48de --- /dev/null +++ b/mac/.config/AstroNvim/README.md @@ -0,0 +1,34 @@ +# AstroNvim Template + +**NOTE:** This is for AstroNvim v5+ + +A template for getting started with [AstroNvim](https://github.com/AstroNvim/AstroNvim) + +## 🛠️ Installation + +#### Make a backup of your current nvim and shared folder + +```shell +mv ~/.config/nvim ~/.config/nvim.bak +mv ~/.local/share/nvim ~/.local/share/nvim.bak +mv ~/.local/state/nvim ~/.local/state/nvim.bak +mv ~/.cache/nvim ~/.cache/nvim.bak +``` + +#### Create a new user repository from this template + +Press the "Use this template" button above to create a new repository to store your user configuration. + +You can also just clone this repository directly if you do not want to track your user configuration in GitHub. + +#### Clone the repository + +```shell +git clone https://github.com// ~/.config/nvim +``` + +#### Start Neovim + +```shell +nvim +``` diff --git a/mac/.config/AstroNvim/init.lua b/mac/.config/AstroNvim/init.lua new file mode 100644 index 0000000..424e48d --- /dev/null +++ b/mac/.config/AstroNvim/init.lua @@ -0,0 +1,27 @@ +-- This file simply bootstraps the installation of Lazy.nvim and then calls other files for execution +-- This file doesn't necessarily need to be touched, BE CAUTIOUS editing this file and proceed at your own risk. +local lazypath = vim.env.LAZY or vim.fn.stdpath "data" .. "/lazy/lazy.nvim" + +if not (vim.env.LAZY or (vim.uv or vim.loop).fs_stat(lazypath)) then + -- stylua: ignore + local result = vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) + if vim.v.shell_error ~= 0 then + -- stylua: ignore + vim.api.nvim_echo({ { ("Error cloning lazy.nvim:\n%s\n"):format(result), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {}) + vim.fn.getchar() + vim.cmd.quit() + end +end + +vim.opt.rtp:prepend(lazypath) + +-- validate that lazy is available +if not pcall(require, "lazy") then + -- stylua: ignore + vim.api.nvim_echo({ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {}) + vim.fn.getchar() + vim.cmd.quit() +end + +require "lazy_setup" +require "polish" diff --git a/mac/.config/AstroNvim/lua/community.lua b/mac/.config/AstroNvim/lua/community.lua new file mode 100644 index 0000000..c842899 --- /dev/null +++ b/mac/.config/AstroNvim/lua/community.lua @@ -0,0 +1,12 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- AstroCommunity: import any community modules here +-- We import this file in `lazy_setup.lua` before the `plugins/` folder. +-- This guarantees that the specs are processed before any user plugins. + +---@type LazySpec +return { + "AstroNvim/astrocommunity", + { import = "astrocommunity.pack.lua" }, + -- import/override with your plugins folder +} diff --git a/mac/.config/AstroNvim/lua/lazy_setup.lua b/mac/.config/AstroNvim/lua/lazy_setup.lua new file mode 100644 index 0000000..4d9552f --- /dev/null +++ b/mac/.config/AstroNvim/lua/lazy_setup.lua @@ -0,0 +1,32 @@ +require("lazy").setup({ + { + "AstroNvim/AstroNvim", + version = "^5", -- Remove version tracking to elect for nightly AstroNvim + import = "astronvim.plugins", + opts = { -- AstroNvim options must be set here with the `import` key + mapleader = " ", -- This ensures the leader key must be configured before Lazy is set up + maplocalleader = ",", -- This ensures the localleader key must be configured before Lazy is set up + icons_enabled = true, -- Set to false to disable icons (if no Nerd Font is available) + pin_plugins = nil, -- Default will pin plugins when tracking `version` of AstroNvim, set to true/false to override + update_notifications = true, -- Enable/disable notification about running `:Lazy update` twice to update pinned plugins + }, + }, + { import = "community" }, + { import = "plugins" }, +} --[[@as LazySpec]], { + -- Configure any other `lazy.nvim` configuration options here + install = { colorscheme = { "astrotheme", "habamax" } }, + ui = { backdrop = 100 }, + performance = { + rtp = { + -- disable some rtp plugins, add more to your liking + disabled_plugins = { + "gzip", + "netrwPlugin", + "tarPlugin", + "tohtml", + "zipPlugin", + }, + }, + }, +} --[[@as LazyConfig]]) diff --git a/mac/.config/AstroNvim/lua/plugins/astrocore.lua b/mac/.config/AstroNvim/lua/plugins/astrocore.lua new file mode 100644 index 0000000..03d7441 --- /dev/null +++ b/mac/.config/AstroNvim/lua/plugins/astrocore.lua @@ -0,0 +1,85 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- AstroCore provides a central place to modify mappings, vim options, autocommands, and more! +-- Configuration documentation can be found with `:h astrocore` +-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) +-- as this provides autocomplete and documentation while editing + +---@type LazySpec +return { + "AstroNvim/astrocore", + ---@type AstroCoreOpts + opts = { + -- Configure core features of AstroNvim + features = { + large_buf = { size = 1024 * 256, lines = 10000 }, -- set global limits for large files for disabling features like treesitter + autopairs = true, -- enable autopairs at start + cmp = true, -- enable completion at start + diagnostics = { virtual_text = true, virtual_lines = false }, -- diagnostic settings on startup + highlighturl = true, -- highlight URLs at start + notifications = true, -- enable notifications at start + }, + -- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on + diagnostics = { + virtual_text = true, + underline = true, + }, + -- passed to `vim.filetype.add` + filetypes = { + -- see `:h vim.filetype.add` for usage + extension = { + foo = "fooscript", + }, + filename = { + [".foorc"] = "fooscript", + }, + pattern = { + [".*/etc/foo/.*"] = "fooscript", + }, + }, + -- vim options can be configured here + options = { + opt = { -- vim.opt. + relativenumber = true, -- sets vim.opt.relativenumber + number = true, -- sets vim.opt.number + spell = false, -- sets vim.opt.spell + signcolumn = "yes", -- sets vim.opt.signcolumn to yes + wrap = false, -- sets vim.opt.wrap + }, + g = { -- vim.g. + -- configure global vim variables (vim.g) + -- NOTE: `mapleader` and `maplocalleader` must be set in the AstroNvim opts or before `lazy.setup` + -- This can be found in the `lua/lazy_setup.lua` file + }, + }, + -- Mappings can be configured through AstroCore as well. + -- NOTE: keycodes follow the casing in the vimdocs. For example, `` must be capitalized + mappings = { + -- first key is the mode + n = { + -- second key is the lefthand side of the map + + -- navigate buffer tabs + ["]b"] = { function() require("astrocore.buffer").nav(vim.v.count1) end, desc = "Next buffer" }, + ["[b"] = { function() require("astrocore.buffer").nav(-vim.v.count1) end, desc = "Previous buffer" }, + + -- mappings seen under group name "Buffer" + ["bd"] = { + function() + require("astroui.status.heirline").buffer_picker( + function(bufnr) require("astrocore.buffer").close(bufnr) end + ) + end, + desc = "Close buffer from tabline", + }, + + -- tables with just a `desc` key will be registered with which-key if it's installed + -- this is useful for naming menus + -- ["b"] = { desc = "Buffers" }, + + -- setting a mapping to false will disable it + -- [""] = false, + }, + }, + }, +} diff --git a/mac/.config/AstroNvim/lua/plugins/astrolsp.lua b/mac/.config/AstroNvim/lua/plugins/astrolsp.lua new file mode 100644 index 0000000..720b9d3 --- /dev/null +++ b/mac/.config/AstroNvim/lua/plugins/astrolsp.lua @@ -0,0 +1,105 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- AstroLSP allows you to customize the features in AstroNvim's LSP configuration engine +-- Configuration documentation can be found with `:h astrolsp` +-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) +-- as this provides autocomplete and documentation while editing + +---@type LazySpec +return { + "AstroNvim/astrolsp", + ---@type AstroLSPOpts + opts = { + -- Configuration table of features provided by AstroLSP + features = { + codelens = true, -- enable/disable codelens refresh on start + inlay_hints = false, -- enable/disable inlay hints on start + semantic_tokens = true, -- enable/disable semantic token highlighting + }, + -- customize lsp formatting options + formatting = { + -- control auto formatting on save + format_on_save = { + enabled = true, -- enable or disable format on save globally + allow_filetypes = { -- enable format on save for specified filetypes only + -- "go", + }, + ignore_filetypes = { -- disable format on save for specified filetypes + -- "python", + }, + }, + disabled = { -- disable formatting capabilities for the listed language servers + -- disable lua_ls formatting capability if you want to use StyLua to format your lua code + -- "lua_ls", + }, + timeout_ms = 1000, -- default format timeout + -- filter = function(client) -- fully override the default formatting function + -- return true + -- end + }, + -- enable servers that you already have installed without mason + servers = { + -- "pyright" + }, + -- customize language server configuration options passed to `lspconfig` + ---@diagnostic disable: missing-fields + config = { + -- clangd = { capabilities = { offsetEncoding = "utf-8" } }, + }, + -- customize how language servers are attached + handlers = { + -- a function without a key is simply the default handler, functions take two parameters, the server name and the configured options table for that server + -- function(server, opts) require("lspconfig")[server].setup(opts) end + + -- the key is the server that is being setup with `lspconfig` + -- rust_analyzer = false, -- setting a handler to false will disable the set up of that language server + -- pyright = function(_, opts) require("lspconfig").pyright.setup(opts) end -- or a custom handler function can be passed + }, + -- Configure buffer local auto commands to add when attaching a language server + autocmds = { + -- first key is the `augroup` to add the auto commands to (:h augroup) + lsp_codelens_refresh = { + -- Optional condition to create/delete auto command group + -- can either be a string of a client capability or a function of `fun(client, bufnr): boolean` + -- condition will be resolved for each client on each execution and if it ever fails for all clients, + -- the auto commands will be deleted for that buffer + cond = "textDocument/codeLens", + -- cond = function(client, bufnr) return client.name == "lua_ls" end, + -- list of auto commands to set + { + -- events to trigger + event = { "InsertLeave", "BufEnter" }, + -- the rest of the autocmd options (:h nvim_create_autocmd) + desc = "Refresh codelens (buffer)", + callback = function(args) + if require("astrolsp").config.features.codelens then vim.lsp.codelens.refresh { bufnr = args.buf } end + end, + }, + }, + }, + -- mappings to be set up on attaching of a language server + mappings = { + n = { + -- a `cond` key can provided as the string of a server capability to be required to attach, or a function with `client` and `bufnr` parameters from the `on_attach` that returns a boolean + gD = { + function() vim.lsp.buf.declaration() end, + desc = "Declaration of current symbol", + cond = "textDocument/declaration", + }, + ["uY"] = { + function() require("astrolsp.toggles").buffer_semantic_tokens() end, + desc = "Toggle LSP semantic highlight (buffer)", + cond = function(client) + return client.supports_method "textDocument/semanticTokens/full" and vim.lsp.semantic_tokens ~= nil + end, + }, + }, + }, + -- A custom `on_attach` function to be run after the default `on_attach` function + -- takes two parameters `client` and `bufnr` (`:h lspconfig-setup`) + on_attach = function(client, bufnr) + -- this would disable semanticTokensProvider for all clients + -- client.server_capabilities.semanticTokensProvider = nil + end, + }, +} diff --git a/mac/.config/AstroNvim/lua/plugins/astroui.lua b/mac/.config/AstroNvim/lua/plugins/astroui.lua new file mode 100644 index 0000000..737a2fb --- /dev/null +++ b/mac/.config/AstroNvim/lua/plugins/astroui.lua @@ -0,0 +1,39 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- AstroUI provides the basis for configuring the AstroNvim User Interface +-- Configuration documentation can be found with `:h astroui` +-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) +-- as this provides autocomplete and documentation while editing + +---@type LazySpec +return { + "AstroNvim/astroui", + ---@type AstroUIOpts + opts = { + -- change colorscheme + colorscheme = "astrodark", + -- AstroUI allows you to easily modify highlight groups easily for any and all colorschemes + highlights = { + init = { -- this table overrides highlights in all themes + -- Normal = { bg = "#000000" }, + }, + astrodark = { -- a table of overrides/changes when applying the astrotheme theme + -- Normal = { bg = "#000000" }, + }, + }, + -- Icons can be configured throughout the interface + icons = { + -- configure the loading of the lsp in the status line + LSPLoading1 = "⠋", + LSPLoading2 = "⠙", + LSPLoading3 = "⠹", + LSPLoading4 = "⠸", + LSPLoading5 = "⠼", + LSPLoading6 = "⠴", + LSPLoading7 = "⠦", + LSPLoading8 = "⠧", + LSPLoading9 = "⠇", + LSPLoading10 = "⠏", + }, + }, +} diff --git a/mac/.config/AstroNvim/lua/plugins/mason.lua b/mac/.config/AstroNvim/lua/plugins/mason.lua new file mode 100644 index 0000000..2d79b5f --- /dev/null +++ b/mac/.config/AstroNvim/lua/plugins/mason.lua @@ -0,0 +1,28 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- Customize Mason + +---@type LazySpec +return { + -- use mason-tool-installer for automatically installing Mason packages + { + "WhoIsSethDaniel/mason-tool-installer.nvim", + -- overrides `require("mason-tool-installer").setup(...)` + opts = { + -- Make sure to use the names found in `:Mason` + ensure_installed = { + -- install language servers + "lua-language-server", + + -- install formatters + "stylua", + + -- install debuggers + "debugpy", + + -- install any other package + "tree-sitter-cli", + }, + }, + }, +} diff --git a/mac/.config/AstroNvim/lua/plugins/none-ls.lua b/mac/.config/AstroNvim/lua/plugins/none-ls.lua new file mode 100644 index 0000000..2b0ed18 --- /dev/null +++ b/mac/.config/AstroNvim/lua/plugins/none-ls.lua @@ -0,0 +1,24 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- Customize None-ls sources + +---@type LazySpec +return { + "nvimtools/none-ls.nvim", + opts = function(_, opts) + -- opts variable is the default configuration table for the setup function call + -- local null_ls = require "null-ls" + + -- Check supported formatters and linters + -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting + -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics + + -- Only insert new sources, do not replace the existing ones + -- (If you wish to replace, use `opts.sources = {}` instead of the `list_insert_unique` function) + opts.sources = require("astrocore").list_insert_unique(opts.sources, { + -- Set a formatter + -- null_ls.builtins.formatting.stylua, + -- null_ls.builtins.formatting.prettier, + }) + end, +} diff --git a/mac/.config/AstroNvim/lua/plugins/treesitter.lua b/mac/.config/AstroNvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..94436aa --- /dev/null +++ b/mac/.config/AstroNvim/lua/plugins/treesitter.lua @@ -0,0 +1,15 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- Customize Treesitter + +---@type LazySpec +return { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "lua", + "vim", + -- add more arguments for adding more treesitter parsers + }, + }, +} diff --git a/mac/.config/AstroNvim/lua/plugins/user.lua b/mac/.config/AstroNvim/lua/plugins/user.lua new file mode 100644 index 0000000..b7de6df --- /dev/null +++ b/mac/.config/AstroNvim/lua/plugins/user.lua @@ -0,0 +1,88 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- You can also add or configure plugins by creating files in this `plugins/` folder +-- PLEASE REMOVE THE EXAMPLES YOU HAVE NO INTEREST IN BEFORE ENABLING THIS FILE +-- Here are some examples: + +---@type LazySpec +return { + + -- == Examples of Adding Plugins == + + "andweeb/presence.nvim", + { + "ray-x/lsp_signature.nvim", + event = "BufRead", + config = function() require("lsp_signature").setup() end, + }, + + -- == Examples of Overriding Plugins == + + -- customize dashboard options + { + "folke/snacks.nvim", + opts = { + dashboard = { + preset = { + header = table.concat({ + " █████ ███████ ████████ ██████ ██████ ", + "██ ██ ██ ██ ██ ██ ██ ██", + "███████ ███████ ██ ██████ ██ ██", + "██ ██ ██ ██ ██ ██ ██ ██", + "██ ██ ███████ ██ ██ ██ ██████ ", + "", + "███  ██ ██  ██ ██ ███  ███", + "████  ██ ██  ██ ██ ████  ████", + "██ ██  ██ ██  ██ ██ ██ ████ ██", + "██  ██ ██  ██  ██  ██ ██  ██  ██", + "██   ████   ████   ██ ██      ██", + }, "\n"), + }, + }, + }, + }, + + -- You can disable default plugins as follows: + { "max397574/better-escape.nvim", enabled = false }, + + -- You can also easily customize additional setup of plugins that is outside of the plugin's setup call + { + "L3MON4D3/LuaSnip", + config = function(plugin, opts) + require "astronvim.plugins.configs.luasnip"(plugin, opts) -- include the default astronvim config that calls the setup call + -- add more custom luasnip configuration such as filetype extend or custom snippets + local luasnip = require "luasnip" + luasnip.filetype_extend("javascript", { "javascriptreact" }) + end, + }, + + { + "windwp/nvim-autopairs", + config = function(plugin, opts) + require "astronvim.plugins.configs.nvim-autopairs"(plugin, opts) -- include the default astronvim config that calls the setup call + -- add more custom autopairs configuration such as custom rules + local npairs = require "nvim-autopairs" + local Rule = require "nvim-autopairs.rule" + local cond = require "nvim-autopairs.conds" + npairs.add_rules( + { + Rule("$", "$", { "tex", "latex" }) + -- don't add a pair if the next character is % + :with_pair(cond.not_after_regex "%%") + -- don't add a pair if the previous character is xxx + :with_pair( + cond.not_before_regex("xxx", 3) + ) + -- don't move right when repeat character + :with_move(cond.none()) + -- don't delete if the next character is xx + :with_del(cond.not_after_regex "xx") + -- disable adding a newline when you press + :with_cr(cond.none()), + }, + -- disable for .vim files, but it work for another filetypes + Rule("a", "a", "-vim") + ) + end, + }, +} diff --git a/mac/.config/AstroNvim/lua/polish.lua b/mac/.config/AstroNvim/lua/polish.lua new file mode 100644 index 0000000..642719f --- /dev/null +++ b/mac/.config/AstroNvim/lua/polish.lua @@ -0,0 +1,5 @@ +if true then return end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- This will run last in the setup process. +-- This is just pure lua so anything that doesn't +-- fit in the normal config locations above can go here diff --git a/mac/.config/AstroNvim/neovim.yml b/mac/.config/AstroNvim/neovim.yml new file mode 100644 index 0000000..b9235ab --- /dev/null +++ b/mac/.config/AstroNvim/neovim.yml @@ -0,0 +1,6 @@ +--- +base: lua51 + +globals: + vim: + any: true diff --git a/mac/.config/AstroNvim/selene.toml b/mac/.config/AstroNvim/selene.toml new file mode 100644 index 0000000..e7005c3 --- /dev/null +++ b/mac/.config/AstroNvim/selene.toml @@ -0,0 +1,8 @@ +std = "neovim" + +[rules] +global_usage = "allow" +if_same_then_else = "allow" +incorrect_standard_library_use = "allow" +mixed_table = "allow" +multiple_statements = "allow" diff --git a/mac/.config/LazyVim/.gitignore b/mac/.config/LazyVim/.gitignore new file mode 100644 index 0000000..cc5457a --- /dev/null +++ b/mac/.config/LazyVim/.gitignore @@ -0,0 +1,8 @@ +tt.* +.tests +doc/tags +debug +.repro +foo.* +*.log +data diff --git a/mac/.config/LazyVim/.neoconf.json b/mac/.config/LazyVim/.neoconf.json new file mode 100644 index 0000000..7c48087 --- /dev/null +++ b/mac/.config/LazyVim/.neoconf.json @@ -0,0 +1,15 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + } +} diff --git a/mac/.config/LazyVim/LICENSE b/mac/.config/LazyVim/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/mac/.config/LazyVim/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/mac/.config/LazyVim/README.md b/mac/.config/LazyVim/README.md new file mode 100644 index 0000000..185280b --- /dev/null +++ b/mac/.config/LazyVim/README.md @@ -0,0 +1,4 @@ +# 💤 LazyVim + +A starter template for [LazyVim](https://github.com/LazyVim/LazyVim). +Refer to the [documentation](https://lazyvim.github.io/installation) to get started. diff --git a/mac/.config/LazyVim/init.lua b/mac/.config/LazyVim/init.lua new file mode 100644 index 0000000..2514f9e --- /dev/null +++ b/mac/.config/LazyVim/init.lua @@ -0,0 +1,2 @@ +-- bootstrap lazy.nvim, LazyVim and your plugins +require("config.lazy") diff --git a/mac/.config/LazyVim/lua/config/autocmds.lua b/mac/.config/LazyVim/lua/config/autocmds.lua new file mode 100644 index 0000000..4221e75 --- /dev/null +++ b/mac/.config/LazyVim/lua/config/autocmds.lua @@ -0,0 +1,8 @@ +-- Autocmds are automatically loaded on the VeryLazy event +-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua +-- +-- Add any additional autocmds here +-- with `vim.api.nvim_create_autocmd` +-- +-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults) +-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell") diff --git a/mac/.config/LazyVim/lua/config/keymaps.lua b/mac/.config/LazyVim/lua/config/keymaps.lua new file mode 100644 index 0000000..2c134f7 --- /dev/null +++ b/mac/.config/LazyVim/lua/config/keymaps.lua @@ -0,0 +1,3 @@ +-- Keymaps are automatically loaded on the VeryLazy event +-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua +-- Add any additional keymaps here diff --git a/mac/.config/LazyVim/lua/config/lazy.lua b/mac/.config/LazyVim/lua/config/lazy.lua new file mode 100644 index 0000000..d73bfa1 --- /dev/null +++ b/mac/.config/LazyVim/lua/config/lazy.lua @@ -0,0 +1,53 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + spec = { + -- add LazyVim and import its plugins + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- import/override with your plugins + { import = "plugins" }, + }, + defaults = { + -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. + -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. + lazy = false, + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = false, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + }, + install = { colorscheme = { "tokyonight", "habamax" } }, + checker = { + enabled = true, -- check for plugin updates periodically + notify = false, -- notify on update + }, -- automatically check for plugin updates + performance = { + rtp = { + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + -- "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/mac/.config/LazyVim/lua/config/options.lua b/mac/.config/LazyVim/lua/config/options.lua new file mode 100644 index 0000000..3ea1454 --- /dev/null +++ b/mac/.config/LazyVim/lua/config/options.lua @@ -0,0 +1,3 @@ +-- Options are automatically loaded before lazy.nvim startup +-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua +-- Add any additional options here diff --git a/mac/.config/LazyVim/lua/plugins/example.lua b/mac/.config/LazyVim/lua/plugins/example.lua new file mode 100644 index 0000000..17f53d6 --- /dev/null +++ b/mac/.config/LazyVim/lua/plugins/example.lua @@ -0,0 +1,197 @@ +-- since this is just an example spec, don't actually load anything here and return an empty spec +-- stylua: ignore +if true then return {} end + +-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim +-- +-- In your plugin files, you can: +-- * add extra plugins +-- * disable/enabled LazyVim plugins +-- * override the configuration of LazyVim plugins +return { + -- add gruvbox + { "ellisonleao/gruvbox.nvim" }, + + -- Configure LazyVim to load gruvbox + { + "LazyVim/LazyVim", + opts = { + colorscheme = "gruvbox", + }, + }, + + -- change trouble config + { + "folke/trouble.nvim", + -- opts will be merged with the parent spec + opts = { use_diagnostic_signs = true }, + }, + + -- disable trouble + { "folke/trouble.nvim", enabled = false }, + + -- override nvim-cmp and add cmp-emoji + { + "hrsh7th/nvim-cmp", + dependencies = { "hrsh7th/cmp-emoji" }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + table.insert(opts.sources, { name = "emoji" }) + end, + }, + + -- change some telescope options and a keymap to browse plugin files + { + "nvim-telescope/telescope.nvim", + keys = { + -- add a keymap to browse plugin files + -- stylua: ignore + { + "fp", + function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end, + desc = "Find Plugin File", + }, + }, + -- change some options + opts = { + defaults = { + layout_strategy = "horizontal", + layout_config = { prompt_position = "top" }, + sorting_strategy = "ascending", + winblend = 0, + }, + }, + }, + + -- add pyright to lspconfig + { + "neovim/nvim-lspconfig", + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- pyright will be automatically installed with mason and loaded with lspconfig + pyright = {}, + }, + }, + }, + + -- add tsserver and setup with typescript.nvim instead of lspconfig + { + "neovim/nvim-lspconfig", + dependencies = { + "jose-elias-alvarez/typescript.nvim", + init = function() + require("lazyvim.util").lsp.on_attach(function(_, buffer) + -- stylua: ignore + vim.keymap.set( "n", "co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" }) + vim.keymap.set("n", "cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer }) + end) + end, + }, + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- tsserver will be automatically installed with mason and loaded with lspconfig + tsserver = {}, + }, + -- you can do any additional lsp server setup here + -- return true if you don't want this server to be setup with lspconfig + ---@type table + setup = { + -- example to setup with typescript.nvim + tsserver = function(_, opts) + require("typescript").setup({ server = opts }) + return true + end, + -- Specify * to use this function as a fallback for any server + -- ["*"] = function(server, opts) end, + }, + }, + }, + + -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, + -- treesitter, mason and typescript.nvim. So instead of the above, you can use: + { import = "lazyvim.plugins.extras.lang.typescript" }, + + -- add more treesitter parsers + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "bash", + "html", + "javascript", + "json", + "lua", + "markdown", + "markdown_inline", + "python", + "query", + "regex", + "tsx", + "typescript", + "vim", + "yaml", + }, + }, + }, + + -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above + -- would overwrite `ensure_installed` with the new value. + -- If you'd rather extend the default config, use the code below instead: + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + -- add tsx and treesitter + vim.list_extend(opts.ensure_installed, { + "tsx", + "typescript", + }) + end, + }, + + -- the opts function can also be used to change the default opts: + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function(_, opts) + table.insert(opts.sections.lualine_x, { + function() + return "😄" + end, + }) + end, + }, + + -- or you can return new options to override all the defaults + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function() + return { + --[[add your custom lualine config here]] + } + end, + }, + + -- use mini.starter instead of alpha + { import = "lazyvim.plugins.extras.ui.mini-starter" }, + + -- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc + { import = "lazyvim.plugins.extras.lang.json" }, + + -- add any tools you want to have installed below + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "stylua", + "shellcheck", + "shfmt", + "flake8", + }, + }, + }, +} diff --git a/mac/.config/LazyVim/stylua.toml b/mac/.config/LazyVim/stylua.toml new file mode 100644 index 0000000..5d6c50d --- /dev/null +++ b/mac/.config/LazyVim/stylua.toml @@ -0,0 +1,3 @@ +indent_type = "Spaces" +indent_width = 2 +column_width = 120 \ No newline at end of file diff --git a/mac/.config/LunarVim/.gitignore b/mac/.config/LunarVim/.gitignore new file mode 100644 index 0000000..4a0cb4c --- /dev/null +++ b/mac/.config/LunarVim/.gitignore @@ -0,0 +1,31 @@ +dein +tags* +.netrwhist +pythonpath.vim +nodepath.vim +autoload/plugged/* +vimspector-config/gadgets/* +paths.vim +session +wiki/ +pack/ +utils/java/* +lv-config.lua +lua-language-server/ +eclipse.jdt.ls/ +.language-servers/ +.debuggers/ +spell/ +nv-settings.lua +lv-settings.lua +lua/lv-user/ +lua/lv-user-config/ + +*.tmp +*.temp +*.bak +*.backup +*.old + +.luarc.json +.luacheckcache diff --git a/mac/.config/LunarVim/.luacheckrc b/mac/.config/LunarVim/.luacheckrc new file mode 100644 index 0000000..5330708 --- /dev/null +++ b/mac/.config/LunarVim/.luacheckrc @@ -0,0 +1,45 @@ +---@diagnostic disable +-- vim: ft=lua tw=80 + +stds.nvim = { + globals = { + "lvim", + "reload", + vim = { fields = { "g" } }, + "TERMINAL", + "USER", + "C", + "Config", + "WORKSPACE_PATH", + "JAVA_LS_EXECUTABLE", + "MUtils", + "USER_CONFIG_PATH", + os = { fields = { "capture" } }, + }, + read_globals = { + "jit", + "os", + "vim", + "join_paths", + "get_runtime_dir", + "get_config_dir", + "get_cache_dir", + "get_lvim_base_dir", + "require_clean", + }, +} +std = "lua51+nvim" + +files["tests/*_spec.lua"].std = "lua51+nvim+busted" +files["lua/lvim/impatient*"].ignore = {"121"} + +-- Don't report unused self arguments of methods. +self = false + +-- Rerun tests only if their modification time changed. +cache = true + +ignore = { + "631", -- max_line_length + "212/_.*", -- unused argument, for vars with "_" prefix +} diff --git a/mac/.config/LunarVim/.pre-commit-config.yaml b/mac/.config/LunarVim/.pre-commit-config.yaml new file mode 100644 index 0000000..2c4921e --- /dev/null +++ b/mac/.config/LunarVim/.pre-commit-config.yaml @@ -0,0 +1,34 @@ +repos: + - repo: local + hooks: + - id: shfmt + name: shfmt + minimum_pre_commit_version: 2.4.0 + language: system + types: [shell] + entry: bash + args: [-c, make lint-sh] + - id: shellcheck + name: shellcheck + language: system + types: [shell] + entry: bash + args: [-c, make style-sh] + - id: stylua + name: StyLua + language: rust + entry: stylua + types: [lua] + args: ["-"] + - id: luacheck + name: luacheck + language: system + entry: luacheck + types: [lua] + args: [.] + - id: commitlint + name: commitlint + language: system + entry: bash + args: [./utils/ci/run_commitlint.sh] + stages: [commit-msg] diff --git a/mac/.config/LunarVim/.stylua.toml b/mac/.config/LunarVim/.stylua.toml new file mode 100644 index 0000000..df96b7b --- /dev/null +++ b/mac/.config/LunarVim/.stylua.toml @@ -0,0 +1,6 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +no_call_parentheses = true diff --git a/mac/.config/LunarVim/CHANGELOG.md b/mac/.config/LunarVim/CHANGELOG.md new file mode 100644 index 0000000..48180c7 --- /dev/null +++ b/mac/.config/LunarVim/CHANGELOG.md @@ -0,0 +1,704 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +## [1.4.0] + +### Features + +- _(installer)_ added bun as a js package manager ([#4362](https://github.com/lunarvim/lunarvim/pull/4362)) +- _(lspconfig)_ add rounded borders to :LspInfo window ([#4208](https://github.com/lunarvim/lunarvim/pull/4208)) +- _(nvimtree)_ centralize selection ([#4160](https://github.com/lunarvim/lunarvim/pull/4160)) +- _(plugins)_ migrate from `null-ls` to `none-ls` ([#4392](https://github.com/lunarvim/lunarvim/pull/4392)) +- simplify example config, add links for user instead ([#4128](https://github.com/lunarvim/lunarvim/pull/4128)) +- don't move config on install ([#4129](https://github.com/lunarvim/lunarvim/pull/4129)) +- rounded border for hover and signatureHelp ([#4131](https://github.com/lunarvim/lunarvim/pull/4131)) +- lock new installations to nvim 0.9+ ([#3858](https://github.com/lunarvim/lunarvim/pull/3858)) +- use code chevrons ([#4184](https://github.com/lunarvim/lunarvim/pull/4184)) +- ignore missing keys for whichkey ([#4185](https://github.com/lunarvim/lunarvim/pull/4185)) +- [**breaking**] use prompts similar to `:confirm` in `buf_kill` ([#4186](https://github.com/lunarvim/lunarvim/pull/4186)) +- add starter.lvim link to config.example.lua ([#4200](https://github.com/lunarvim/lunarvim/pull/4200)) +- add example to the packer deprecation message ([#4201](https://github.com/lunarvim/lunarvim/pull/4201)) + +### Bugfix + +- _(alpha)_ account for different icon byte sizes ([#4130](https://github.com/lunarvim/lunarvim/pull/4130)) +- _(dap)_ ui opens when debugging ([#4116](https://github.com/lunarvim/lunarvim/pull/4116)) +- _(default-options)_ remove invalid guifont option ([#4447](https://github.com/lunarvim/lunarvim/pull/4447)) +- _(deprecation)_ only deprecate `tag == "*"` in lvim.plugins ([#4297](https://github.com/lunarvim/lunarvim/pull/4297)) +- _(icons)_ add some whitespace to the boolean icon ([#4163](https://github.com/lunarvim/lunarvim/pull/4163)) +- _(install)_ add newline after setup message ([#4533](https://github.com/lunarvim/lunarvim/pull/4533)) +- _(installer)_ dependency installation for Windows ([#4486](https://github.com/lunarvim/lunarvim/pull/4486)) +- _(lsp)_ add luv library by default to lua_ls ([#4067](https://github.com/lunarvim/lunarvim/pull/4067)) +- _(lsp)_ diagnostic codes already show by default ([#4070](https://github.com/lunarvim/lunarvim/pull/4070)) +- [**breaking**] _(lsp)_ switch to csharp_ls to avoid startup errors ([#4079](https://github.com/lunarvim/lunarvim/pull/4079)) +- _(lsp)_ lazy load mason on FileOpened ([#4100](https://github.com/lunarvim/lunarvim/pull/4100)) +- _(lsp)_ skip auto config server even if it's ensure installed ([#4243](https://github.com/lunarvim/lunarvim/pull/4243)) +- _(lsp)_ restore float border ([#4274](https://github.com/lunarvim/lunarvim/pull/4274)) +- _(lsp)_ adapt recent changes in `nvim-lspconfig` ([#4348](https://github.com/lunarvim/lunarvim/pull/4348)) +- _(lualine)_ use get_active_clients instead of deprecated function ([#4136](https://github.com/lunarvim/lunarvim/pull/4136)) +- _(nvim-tree)_ use local buffer keymaps ([#4090](https://github.com/lunarvim/lunarvim/pull/4090)) +- _(terminal)_ show lazygit bottom line ([#4548](https://github.com/lunarvim/lunarvim/pull/4548)) +- _(tests)_ set up lazy.nvim in the lsp test ([#4088](https://github.com/lunarvim/lunarvim/pull/4088)) +- _(treesitter)_ add a few parsers to `ensure_installed` ([#4121](https://github.com/lunarvim/lunarvim/pull/4121)) +- _(typo)_ `form` to `from` ([#4295](https://github.com/lunarvim/lunarvim/pull/4295)) +- _(user_command)_ update url in `LvimDocs` command ([#4081](https://github.com/lunarvim/lunarvim/pull/4081)) +- _(win)_ remove '-NoLogo' from vim.opt.shell ([#4232](https://github.com/lunarvim/lunarvim/pull/4232)) +- add missing LF to install script ([#4075](https://github.com/lunarvim/lunarvim/pull/4075)) +- replace obsolete icons ([#4111](https://github.com/lunarvim/lunarvim/pull/4111)) +- correct runtimepath order ([#4124](https://github.com/lunarvim/lunarvim/pull/4124)) +- support text if marksman lang server ([#4144](https://github.com/lunarvim/lunarvim/pull/4144)) +- circle icons was being cut off for some fonts +- handle context-commentstring setup ([#4451](https://github.com/lunarvim/lunarvim/pull/4451)) + +### Refactor + +- [**breaking**] _(lsp)_ deprecate `lvim.lsp.diagnostics` ([#3916](https://github.com/lunarvim/lunarvim/pull/3916)) +- _(lualine)_ use `string.format` to return unique names ([#4193](https://github.com/lunarvim/lunarvim/pull/4193)) + +### Documentation + +- add code_actions to example config ([#4029](https://github.com/lunarvim/lunarvim/pull/4029)) +- update broken links in example configs ([#4097](https://github.com/lunarvim/lunarvim/pull/4097)) +- use `master` instead of `rolling` in contributing.md ([#4115](https://github.com/lunarvim/lunarvim/pull/4115)) +- use `master` instead of `rolling` in contributing.md ([#4115](https://github.com/lunarvim/lunarvim/pull/4115)) + +### Performance + +- _(installer)_ use a shallow clone of lunarvim ([#4197](https://github.com/lunarvim/lunarvim/pull/4197)) + +## [1.3.0] + +### Features + +- _(alpha)_ allow configuring highlight groups ([#3532](https://github.com/lunarvim/lunarvim/pull/3532)) +- _(alpha)_ add quit button to dashboard ([#3767](https://github.com/lunarvim/lunarvim/pull/3767)) +- _(autocmds)_ add `NvimTreeNormalNC` to transparent mode ([#3850](https://github.com/lunarvim/lunarvim/pull/3850)) +- _(cmp)_ add on_config_done callback ([#3589](https://github.com/lunarvim/lunarvim/pull/3589)) +- _(dap)_ update dap ui to resize when toggled ([#3606](https://github.com/lunarvim/lunarvim/pull/3606)) +- _(dap-ui)_ update setup table ([#3724](https://github.com/lunarvim/lunarvim/pull/3724)) +- _(installer)_ list dependencies that will be installed ([#3523](https://github.com/lunarvim/lunarvim/pull/3523)) +- _(installer)_ allow customizing NVIM_APPNAME ([#3896](https://github.com/lunarvim/lunarvim/pull/3896)) +- _(keybindings)_ operator pending mode ([#3626](https://github.com/lunarvim/lunarvim/pull/3626)) +- _(keybindings)_ add code action to visual mode ([#4022](https://github.com/lunarvim/lunarvim/pull/4022)) +- _(lang)_ yaml use schemastore ([#3953](https://github.com/lunarvim/lunarvim/pull/3953)) +- _(lazy)_ lazy.nvim settings can be customized ([#4010](https://github.com/lunarvim/lunarvim/pull/4010)) +- _(lsp)_ focusable line diagnostics ([#3622](https://github.com/lunarvim/lunarvim/pull/3622)) +- _(mason)_ add support for mason-registry ([#3994](https://github.com/lunarvim/lunarvim/pull/3994)) +- _(mason)_ add on_config_done option to lvim.builtin.mason ([#3991](https://github.com/lunarvim/lunarvim/pull/3991)) +- _(reload)_ add all conf files to aupat ([#3644](https://github.com/lunarvim/lunarvim/pull/3644)) +- _(tailwind)_ add .ts options to tailwind.config root_pattern ([#4016](https://github.com/lunarvim/lunarvim/pull/4016)) +- _(telescope)_ add `lvim.builtin.telescope.theme` ([#3548](https://github.com/lunarvim/lunarvim/pull/3548)) +- _(ts)_ enable indent for c and cpp ([#3783](https://github.com/lunarvim/lunarvim/pull/3783)) +- _(which-key)_ keybind for `:Telescope resume` ([#3826](https://github.com/lunarvim/lunarvim/pull/3826)) +- _(wich-key)_ binding to save without formatting ([#3165](https://github.com/lunarvim/lunarvim/pull/3165)) +- add command & keybind to view docs ([#3426](https://github.com/lunarvim/lunarvim/pull/3426)) +- configure dap logging ([#3454](https://github.com/lunarvim/lunarvim/pull/3454)) +- support 'hrsh7th/cmp-cmdline' by default ([#3545](https://github.com/lunarvim/lunarvim/pull/3545)) +- don't prompt smart quit when buffer open in another window ([#3636](https://github.com/lunarvim/lunarvim/pull/3636)) +- use codicons that are available for nerdfonts now ([#3646](https://github.com/lunarvim/lunarvim/pull/3646)) +- update setup tables ([#3693](https://github.com/lunarvim/lunarvim/pull/3693)) +- enable auto preview colorscheme by default ([#3701](https://github.com/lunarvim/lunarvim/pull/3701)) +- cmdline config option enables cmp-cmdline plugin ([#3719](https://github.com/lunarvim/lunarvim/pull/3719)) +- add crystal filetype ([#3762](https://github.com/lunarvim/lunarvim/pull/3762)) +- include git status in LvimVersion ([#3774](https://github.com/lunarvim/lunarvim/pull/3774)) +- regenerate lsp templates after LvimUpdate ([#3864](https://github.com/lunarvim/lunarvim/pull/3864)) + +### Bugfix + +- _(alpha)_ make dashboard responsive ([#3505](https://github.com/lunarvim/lunarvim/pull/3505)) +- _(alpha)_ check height of the aplha window ([#3585](https://github.com/lunarvim/lunarvim/pull/3585)) +- _(alpha)_ rollback to older commit ([#3832](https://github.com/lunarvim/lunarvim/pull/3832)) +- _(autocmds)_ add separate autoreload config group ([#3436](https://github.com/lunarvim/lunarvim/pull/3436)) +- _(autocmds)_ remove spell autocmd ([#3487](https://github.com/lunarvim/lunarvim/pull/3487)) +- _(autopairs)_ attach confirm_done only once ([#3430](https://github.com/lunarvim/lunarvim/pull/3430)) +- _(bootstrap)_ delay lsp setup until LazyDone ([#4041](https://github.com/lunarvim/lunarvim/pull/4041)) +- _(breadcrumbs)_ `E36 Not enough space` when using dap-ui `Eval` ([#3533](https://github.com/lunarvim/lunarvim/pull/3533)) +- _(breadcrumbs)_ use hlgroup from web devicons in breadcrumbs ([#3342](https://github.com/lunarvim/lunarvim/pull/3342)) +- _(breadcrumbs)_ refresh on TabEnter ([#3727](https://github.com/lunarvim/lunarvim/pull/3727)) +- _(breadcrumbs)_ disable for neotest ([#3921](https://github.com/lunarvim/lunarvim/pull/3921)) +- _(bufferline)_ fallback to empty table if `buf_nums` is nil ([#3473](https://github.com/lunarvim/lunarvim/pull/3473)) +- _(bufkill)_ wrap around correctly ([#3461](https://github.com/lunarvim/lunarvim/pull/3461)) +- _(bufkill)_ wait for user's input ([#3535](https://github.com/lunarvim/lunarvim/pull/3535)) +- _(cmp)_ handle deprecated tree-sitter api ([#3853](https://github.com/lunarvim/lunarvim/pull/3853)) +- _(config)_ use a minimal bootstrap for mason ([#3427](https://github.com/lunarvim/lunarvim/pull/3427)) +- _(config)_ fix typo in example configs ([#3611](https://github.com/lunarvim/lunarvim/pull/3611)) +- _(config)_ copy the correct example config ([#3722](https://github.com/lunarvim/lunarvim/pull/3722)) +- _(config-loader)_ defer invalid configuration warning ([#3869](https://github.com/lunarvim/lunarvim/pull/3869)) +- _(dap)_ invalid border value ([#3951](https://github.com/lunarvim/lunarvim/pull/3951)) +- _(dashboard)_ remove feedkeys ([#3558](https://github.com/lunarvim/lunarvim/pull/3558)) +- _(icons)_ make devicons optional ([#3616](https://github.com/lunarvim/lunarvim/pull/3616)) +- _(indentlines)_ set indent_char to LineLeft ([#3741](https://github.com/lunarvim/lunarvim/pull/3741)) +- _(indentlines)_ typo ([#3743](https://github.com/lunarvim/lunarvim/pull/3743)) +- _(installer)_ fix syntax error with powershell installer ([#2875](https://github.com/lunarvim/lunarvim/pull/2875)) +- _(installer)_ only install treesitter-cli if it's missing ([#3740](https://github.com/lunarvim/lunarvim/pull/3740)) +- _(installer)_ validation step was failing on windows ([#4008](https://github.com/lunarvim/lunarvim/pull/4008)) +- _(lir)_ nil check, simpler logic ([#3725](https://github.com/lunarvim/lunarvim/pull/3725)) +- _(logger)_ fix errors with older structlog versions ([#3755](https://github.com/lunarvim/lunarvim/pull/3755)) +- _(lsp)_ disable annoying popup for sumneko-lua ([#3445](https://github.com/lunarvim/lunarvim/pull/3445)) +- _(lsp)_ some servers have dynamic commands ([#3471](https://github.com/lunarvim/lunarvim/pull/3471)) +- _(lsp)_ sumneko-lua library scanning ([#3484](https://github.com/lunarvim/lunarvim/pull/3484)) +- _(lsp)_ add neocmake to skipped_servers ([#3597](https://github.com/lunarvim/lunarvim/pull/3597)) +- _(lsp)_ don't remove mason-lspconfig's hook ([#3739](https://github.com/lunarvim/lunarvim/pull/3739)) +- _(lsp)_ info diagnostic icon not showing ([#3756](https://github.com/lunarvim/lunarvim/pull/3756)) +- _(lsp)_ lazy loading ([#3824](https://github.com/lunarvim/lunarvim/pull/3824)) +- _(lsp)_ template generation for filetypes with dots ([#3833](https://github.com/lunarvim/lunarvim/pull/3833)) +- _(lsp)_ incorrect `g` goto capitalization ([#3950](https://github.com/lunarvim/lunarvim/pull/3950)) +- _(lsp)_ add luv library by default to lua_ls ([#4067](https://github.com/lunarvim/lunarvim/pull/4067)) +- _(nvim-tree)_ remove deprecated option (nvim-tree/nvim-tree.lua#2122) ([#4033](https://github.com/lunarvim/lunarvim/pull/4033)) +- _(nvimtree)_ avoid hard-coded mapping ([#3492](https://github.com/lunarvim/lunarvim/pull/3492)) +- _(nvimtree)_ don't overwrite update_focused_file.ignore_list ([#3986](https://github.com/lunarvim/lunarvim/pull/3986)) +- _(packer)_ increase clone timeout in headless ([#3470](https://github.com/lunarvim/lunarvim/pull/3470)) +- _(plugin-loader)_ don't clean lazy.nvim in sync_core_plugins ([#3731](https://github.com/lunarvim/lunarvim/pull/3731)) +- _(plugin-loader)_ don't clean plugins on LvimUpdate ([#3747](https://github.com/lunarvim/lunarvim/pull/3747)) +- _(plugin-loader)_ support older git versions ([#3769](https://github.com/lunarvim/lunarvim/pull/3769)) +- _(snapshots)_ correct tokyonight commit sha ([#3620](https://github.com/lunarvim/lunarvim/pull/3620)) +- _(telescope)_ backwards compability ([#3596](https://github.com/lunarvim/lunarvim/pull/3596)) +- _(terminal)_ use user's shell in execs ([#3531](https://github.com/lunarvim/lunarvim/pull/3531)) +- _(terminal)_ don't set the shell by default ([#3867](https://github.com/lunarvim/lunarvim/pull/3867)) +- _(tree-sitter)_ force update bundled parsers ([#3475](https://github.com/lunarvim/lunarvim/pull/3475)) +- _(treesitter)_ prepend to rtp ([#3708](https://github.com/lunarvim/lunarvim/pull/3708)) +- _(ts)_ disable indent for c and cpp ([#3687](https://github.com/lunarvim/lunarvim/pull/3687)) +- _(uninstaller)_ add separate flag to remove user config ([#3508](https://github.com/lunarvim/lunarvim/pull/3508)) +- _(uninstaller)_ correct a sentence in help ([#3511](https://github.com/lunarvim/lunarvim/pull/3511)) +- _(which-key)_ typo ([#3963](https://github.com/lunarvim/lunarvim/pull/3963)) +- add dap-ui config to lvim.builtin.dap ([#3386](https://github.com/lunarvim/lunarvim/pull/3386)) +- cmp will behave closer to how people expect +- discard invalid choice when closing buffers ([#3488](https://github.com/lunarvim/lunarvim/pull/3488)) +- startify theme button bugfix ([#3557](https://github.com/lunarvim/lunarvim/pull/3557)) +- only call theme's setup if it's selected ([#3586](https://github.com/lunarvim/lunarvim/pull/3586)) +- bash installer errors ([#3686](https://github.com/lunarvim/lunarvim/pull/3686)) +- remove deprecated nvim-tree options ([#3810](https://github.com/lunarvim/lunarvim/pull/3810)) +- win installer syntax error ([#3635](https://github.com/lunarvim/lunarvim/pull/3635)) +- lazy cache ([#3892](https://github.com/lunarvim/lunarvim/pull/3892)) +- copilot indent reset ([#3343](https://github.com/lunarvim/lunarvim/pull/3343)) ([#3960](https://github.com/lunarvim/lunarvim/pull/3960)) +- typo ([#4023](https://github.com/lunarvim/lunarvim/pull/4023)) +- use `require` instead of `reload` in pcalls ([#4038](https://github.com/lunarvim/lunarvim/pull/4038)) +- make FileOpened autocmd work with quickfix ([#4040](https://github.com/lunarvim/lunarvim/pull/4040)) + +### Refactor + +- _(alpha)_ remove laststatus and tabline autocmds ([#3809](https://github.com/lunarvim/lunarvim/pull/3809)) +- _(autocmds)_ clean up filetype detection rules ([#3625](https://github.com/lunarvim/lunarvim/pull/3625)) +- _(logger)_ adapt to new changes upstream ([#3695](https://github.com/lunarvim/lunarvim/pull/3695)) +- [**breaking**] _(quit)_ use native quit confirm ([#3721](https://github.com/lunarvim/lunarvim/pull/3721)) +- [**breaking**] _(treesitter)_ use auto-install by default ([#3677](https://github.com/lunarvim/lunarvim/pull/3677)) +- move dap keybindings to which key ([#3459](https://github.com/lunarvim/lunarvim/pull/3459)) +- simplify example config ([#3519](https://github.com/lunarvim/lunarvim/pull/3519)) +- use lir fork in the org ([#3694](https://github.com/lunarvim/lunarvim/pull/3694)) +- move to upstream lir ([#3711](https://github.com/lunarvim/lunarvim/pull/3711)) +- [**breaking**] remove `%` and `$` autopairs rules ([#3759](https://github.com/lunarvim/lunarvim/pull/3759)) + +### Documentation + +- _(contributing)_ make it clear how to title PRs ([#3463](https://github.com/lunarvim/lunarvim/pull/3463)) +- _(ts)_ add hint about `ensure_installed` ([#3827](https://github.com/lunarvim/lunarvim/pull/3827)) +- github pull request template update ([#3512](https://github.com/lunarvim/lunarvim/pull/3512)) + +### Performance + +- _(toggleterm)_ on-demand lazy load ([#3811](https://github.com/lunarvim/lunarvim/pull/3811)) +- handle big files better ([#3449](https://github.com/lunarvim/lunarvim/pull/3449)) +- lazy load most plugins ([#3750](https://github.com/lunarvim/lunarvim/pull/3750)) + +## [1.2.0] + +### Features + +- _(autocmds)_ make sure all autocmds are modifiable ([#3087](https://github.com/lunarvim/lunarvim/pull/3087)) +- _(cmp)_ add configs for cmp.setup.cmdline ([#3180](https://github.com/lunarvim/lunarvim/pull/3180)) +- _(config)_ allow disabling reload-on-save ([#3261](https://github.com/lunarvim/lunarvim/pull/3261)) +- _(dap)_ red bugs and other highlight improvements +- _(dap)_ buffernames for elements, icons, hide dap-repl by default ([#3156](https://github.com/lunarvim/lunarvim/pull/3156)) +- _(document highlight)_ use illuminate rather than autocommand to avoid flashing ([#3029](https://github.com/lunarvim/lunarvim/pull/3029)) +- _(indentblankline)_ show first indent level +- _(installer)_ handle INSTALL_PREFIX not on PATH ([#2912](https://github.com/lunarvim/lunarvim/pull/2912)) +- _(installer)_ desktop entry ([#3187](https://github.com/lunarvim/lunarvim/pull/3187)) +- _(logger)_ hot-reload logger level ([#3159](https://github.com/lunarvim/lunarvim/pull/3159)) +- _(lualine)_ update statusline +- _(lualine)_ improvements +- _(lvim/lsp)_ enable tailwindcss by default ([#2870](https://github.com/lunarvim/lunarvim/pull/2870)) +- _(telecope)_ set show_untracked by default ([#2984](https://github.com/lunarvim/lunarvim/pull/2984)) +- _(terminal)_ better mappings ([#3104](https://github.com/lunarvim/lunarvim/pull/3104)) +- _(uninstaller)_ desktop entry +- _(whichkey)_ add default keybindings to cycle to next buffer ([#2873](https://github.com/lunarvim/lunarvim/pull/2873)) +- add lir.nvim ([#3031](https://github.com/lunarvim/lunarvim/pull/3031)) +- add lir.nvim again ([#3038](https://github.com/lunarvim/lunarvim/pull/3038)) +- new colorscheme tokyonight ([#3041](https://github.com/lunarvim/lunarvim/pull/3041)) +- a less noisy tree ([#3042](https://github.com/lunarvim/lunarvim/pull/3042)) +- breadcrumbs ([#3043](https://github.com/lunarvim/lunarvim/pull/3043)) +- use a shorter dashboard banner when needed ([#3047](https://github.com/lunarvim/lunarvim/pull/3047)) +- illuminate works again +- breadcrumbs work again +- new dashboard logo +- set options to remove some noise +- laststatus=3 global statusline +- better telescopic experience ([#3052](https://github.com/lunarvim/lunarvim/pull/3052)) +- pickers ([#3053](https://github.com/lunarvim/lunarvim/pull/3053)) +- add indentlines ([#3056](https://github.com/lunarvim/lunarvim/pull/3056)) +- only show reloaded config on debug log level to decrease noise +- add border for mason ([#3080](https://github.com/lunarvim/lunarvim/pull/3080)) +- colorscheme tweaks +- reload and lir color update ([#3123](https://github.com/lunarvim/lunarvim/pull/3123)) +- now, when you're hovering over a require('a.b.c'), you can type gf, and go to the 'c.lua' file ([#3122](https://github.com/lunarvim/lunarvim/pull/3122)) +- move icons to a single icons file ([#3115](https://github.com/lunarvim/lunarvim/pull/3115)) +- add some more reloads ([#3126](https://github.com/lunarvim/lunarvim/pull/3126)) +- add space after breadcrumb icons ([#3128](https://github.com/lunarvim/lunarvim/pull/3128)) +- add missing nvimtree setting ([#3138](https://github.com/lunarvim/lunarvim/pull/3138)) +- added dap ui and relative config ([#3131](https://github.com/lunarvim/lunarvim/pull/3131)) +- terminal, dap, and notify active by default +- all features active by default ([#3157](https://github.com/lunarvim/lunarvim/pull/3157)) +- lock new installations to nvim 0.8+ ([#3111](https://github.com/lunarvim/lunarvim/pull/3111)) +- enable global installation ([#3161](https://github.com/lunarvim/lunarvim/pull/3161)) +- add new copilot and other sources ([#3171](https://github.com/lunarvim/lunarvim/pull/3171)) +- use icon for copilot in statusline ([#3173](https://github.com/lunarvim/lunarvim/pull/3173)) +- buffer cmp for search, and path for command mode ([#3147](https://github.com/lunarvim/lunarvim/pull/3147)) +- reduce noise from LSP text comes from buffer source anyway +- warn user when setting un-installed colorscheme ([#2982](https://github.com/lunarvim/lunarvim/pull/2982)) +- latest impatient updates from upstream ([#3236](https://github.com/lunarvim/lunarvim/pull/3236)) +- dynamic or fixed toggle terminal size ([#3110](https://github.com/lunarvim/lunarvim/pull/3110)) +- toggle cmp active ([#3398](https://github.com/lunarvim/lunarvim/pull/3398)) +- breadcrumbs autocommand only runs when active ([#3399](https://github.com/lunarvim/lunarvim/pull/3399)) +- Add chevron to breadcrumbs (with matching highlight group) ([#3380](https://github.com/lunarvim/lunarvim/pull/3380)) +- use our own colorscheme, decouple from tokyonight ([#3378](https://github.com/lunarvim/lunarvim/pull/3378)) +- only use orange branch for lunar colorscheme + +### Bugfix + +- _(alpha)_ can't set button hl without doing this +- _(alpha)_ check alpha module ([#3233](https://github.com/lunarvim/lunarvim/pull/3233)) +- _(alpha)_ make startify sections always appear ([#3371](https://github.com/lunarvim/lunarvim/pull/3371)) +- _(autocmds)_ remove _format_options group ([#3278](https://github.com/lunarvim/lunarvim/pull/3278)) +- _(breadcrumbs)_ make sure winbar_filetype_exclude is customizable ([#3221](https://github.com/lunarvim/lunarvim/pull/3221)) +- _(bufferline)_ use buf kill on close ([#3422](https://github.com/lunarvim/lunarvim/pull/3422)) +- _(ci)_ resolve stylua ci rare error ([#3065](https://github.com/lunarvim/lunarvim/pull/3065)) +- _(cmp)_ do not mutate the original confirm_opts on CR ([#2979](https://github.com/lunarvim/lunarvim/pull/2979)) +- _(cmp)_ fix cmp select on CR ([#2980](https://github.com/lunarvim/lunarvim/pull/2980)) +- _(config)_ more comprehensive cache reset ([#3416](https://github.com/lunarvim/lunarvim/pull/3416)) +- _(core/autocmds)_ do not check for existence on clear_augroup ([#2963](https://github.com/lunarvim/lunarvim/pull/2963)) +- _(dashboard)_ add missing space ([#3063](https://github.com/lunarvim/lunarvim/pull/3063)) +- _(defaults)_ don't use smartindent ([#3363](https://github.com/lunarvim/lunarvim/pull/3363)) +- _(example config)_ fix config for treesitter ([#3016](https://github.com/lunarvim/lunarvim/pull/3016)) +- _(finders)_ use lunarvim basedir ([#3332](https://github.com/lunarvim/lunarvim/pull/3332)) +- _(icons)_ do not reload `nvim-web-devicons` module ([#3344](https://github.com/lunarvim/lunarvim/pull/3344)) +- _(indentblankline)_ make sure to use the new syntax for all options ([#3058](https://github.com/lunarvim/lunarvim/pull/3058)) +- _(installer)_ create profile.ps1 if nonexistent ([#2810](https://github.com/lunarvim/lunarvim/pull/2810)) +- _(installer)_ small fix in help message of install.sh ([#3032](https://github.com/lunarvim/lunarvim/pull/3032)) +- _(installer)_ don't overwrite previous config ([#3154](https://github.com/lunarvim/lunarvim/pull/3154)) +- _(installer)_ don't set log level +- _(installer)_ Use master in windows installer ([#3421](https://github.com/lunarvim/lunarvim/pull/3421)) +- _(installer)_ use quotes in set-alias ([#3408](https://github.com/lunarvim/lunarvim/pull/3408)) +- _(log)_ correct add_entry code documentation ([#3081](https://github.com/lunarvim/lunarvim/pull/3081)) +- _(logger)_ set console logging to sync ([#3379](https://github.com/lunarvim/lunarvim/pull/3379)) +- _(lsp)_ return the actual resolved mason-config ([#2889](https://github.com/lunarvim/lunarvim/pull/2889)) +- _(lsp)_ pass name arg to should_auto_install ([#2958](https://github.com/lunarvim/lunarvim/pull/2958)) +- _(lsp)_ enforce lvim completion for lua-server ([#3035](https://github.com/lunarvim/lunarvim/pull/3035)) +- _(lsp)_ don't start servers multiple times ([#3347](https://github.com/lunarvim/lunarvim/pull/3347)) +- _(lsp)_ do a nil check before string matching autocmd desc ([#3354](https://github.com/lunarvim/lunarvim/pull/3354)) +- _(lsp)_ only launch installed servers ([#3366](https://github.com/lunarvim/lunarvim/pull/3366)) +- _(lsp/utils)_ do not register duplicate autocommands ([#3004](https://github.com/lunarvim/lunarvim/pull/3004)) +- _(lua-dev)_ make sure we are loading the correct types ([#3208](https://github.com/lunarvim/lunarvim/pull/3208)) +- _(luadev)_ this plugin has been renamed ([#3235](https://github.com/lunarvim/lunarvim/pull/3235)) +- _(lualine)_ set icon color according to the status of treesitter ([#2754](https://github.com/lunarvim/lunarvim/pull/2754)) +- _(lualine)_ little more padding +- _(lualine)_ guard setup on install ([#3185](https://github.com/lunarvim/lunarvim/pull/3185)) +- _(lualine)_ globalstatus=true by default +- _(nvim-cmp-lsp)_ update_capabilities has been deprecated ([#3245](https://github.com/lunarvim/lunarvim/pull/3245)) +- _(nvimtree)_ remove view height +- _(plugins)_ bring back original folke repos ([#2992](https://github.com/lunarvim/lunarvim/pull/2992)) +- _(plugins)_ handle deprecated options ([#3014](https://github.com/lunarvim/lunarvim/pull/3014)) +- _(plugins)_ set max jobs to 50 on mac +- _(statusline)_ display null-ls linters properly ([#2921](https://github.com/lunarvim/lunarvim/pull/2921)) +- _(terminal)_ slightly bigger vertical terminal +- _(theme)_ do not fallback to tokyonight if no user's theme found ([#3327](https://github.com/lunarvim/lunarvim/pull/3327)) +- _(ts_context_commentstring)_ block comment match new api ([#2948](https://github.com/lunarvim/lunarvim/pull/2948)) +- _(typo)_ fix language server name typo in config example ([#3176](https://github.com/lunarvim/lunarvim/pull/3176)) +- _(typo)_ fix language server name typo in config example #3176 ([#3183](https://github.com/lunarvim/lunarvim/pull/3183)) +- handle deprecated telescope.builtin.internal ([#2885](https://github.com/lunarvim/lunarvim/pull/2885)) +- update key bindings for comment.nvim to use new api ([#2926](https://github.com/lunarvim/lunarvim/pull/2926)) +- remove warning message +- make sure latest plugins are customizable ([#3044](https://github.com/lunarvim/lunarvim/pull/3044)) +- quick and dirty fix for global statusline +- add branch export for rolling installation ([#3054](https://github.com/lunarvim/lunarvim/pull/3054)) +- lag in space when in terminal insert +- fixing laststatus harder +- make sure to use global in lualine +- more consistent dashboard description ([#3055](https://github.com/lunarvim/lunarvim/pull/3055)) +- always load base theme +- plain tokyonight +- lualine filetype padding +- lualine git signs padding +- improve lualine inactive +- lualine slightly better +- use columns instead of winwidth +- lualine laststatus nuclear option +- pcall for dashboard +- small fixes on telescope pickers & breadcrumbs ([#3060](https://github.com/lunarvim/lunarvim/pull/3060)) +- supertab should tab if menu is not available ([#3079](https://github.com/lunarvim/lunarvim/pull/3079)) +- update minimal_lsp.lua ([#3090](https://github.com/lunarvim/lunarvim/pull/3090)) +- set `lua-dev.nvim` to a valid commit version ([#3096](https://github.com/lunarvim/lunarvim/pull/3096)) +- add lunarvim/lvim/after to rtp +- correct typos ([#3117](https://github.com/lunarvim/lunarvim/pull/3117)) +- idk why it has an issue here but we can't use reload in the plugins file for now +- don't ignore plugin this way ([#3125](https://github.com/lunarvim/lunarvim/pull/3125)) +- esc exit autocommand +- always use border for lsp hover ([#3160](https://github.com/lunarvim/lunarvim/pull/3160)) +- nvim_dap has an issue with setting winbar for dapui_console filetype +- formatting +- telescope delete_buffer binds correct scope +- move telescope.actions pcall to the top +- use function for pickers +- Remove J and K key mappings for move ([#3206](https://github.com/lunarvim/lunarvim/pull/3206)) +- typo in git.lua +- name treesitter source in cmp ([#3223](https://github.com/lunarvim/lunarvim/pull/3223)) +- don't install desktop file w/o xdg-desktop-menu ([#3229](https://github.com/lunarvim/lunarvim/pull/3229)) +- disable gitsigns hunk navigation message ([#3244](https://github.com/lunarvim/lunarvim/pull/3244)) +- copilot background should matcha statusline +- disable unsupported asian characters spellchecking ([#3259](https://github.com/lunarvim/lunarvim/pull/3259)) +- nil table in breadcrumbs in autocommand ([#3267](https://github.com/lunarvim/lunarvim/pull/3267)) +- Remove notify which key mapping ([#3335](https://github.com/lunarvim/lunarvim/pull/3335)) +- call proper log function in notify override ([#3337](https://github.com/lunarvim/lunarvim/pull/3337)) +- statusline and breadcrumbs hls reload with config reload ([#3376](https://github.com/lunarvim/lunarvim/pull/3376)) +- revert ColorScheme autocmd execution ([#3397](https://github.com/lunarvim/lunarvim/pull/3397)) +- don't complete in prompt ft +- rollback plugin loader changes ([#3402](https://github.com/lunarvim/lunarvim/pull/3402)) + +### Refactor + +- [**breaking**] _(cmp)_ adapt new recommendations ([#2913](https://github.com/lunarvim/lunarvim/pull/2913)) +- _(config)_ better deprecation handling ([#3419](https://github.com/lunarvim/lunarvim/pull/3419)) +- _(hooks)_ use colorscheme event after reload ([#3375](https://github.com/lunarvim/lunarvim/pull/3375)) +- _(installer)_ skip unstable headless update ([#3338](https://github.com/lunarvim/lunarvim/pull/3338)) +- [**breaking**] _(keymaps)_ don't hijack H/L by default ([#2874](https://github.com/lunarvim/lunarvim/pull/2874)) +- [**breaking**] _(plugins)_ remove nvim-notify from core ([#3300](https://github.com/lunarvim/lunarvim/pull/3300)) +- [**breaking**] _(theme)_ decouple tokyonight options ([#3384](https://github.com/lunarvim/lunarvim/pull/3384)) +- [**breaking**] migrate to mason.nvim ([#2880](https://github.com/lunarvim/lunarvim/pull/2880)) +- small improvements ([#3021](https://github.com/lunarvim/lunarvim/pull/3021)) +- smaller timeout for packer ([#2910](https://github.com/lunarvim/lunarvim/pull/2910)) +- more deliberate reload ([#3133](https://github.com/lunarvim/lunarvim/pull/3133)) +- clean up test env paths ([#3318](https://github.com/lunarvim/lunarvim/pull/3318)) + +### Documentation + +- _(lsp)_ fix the way of removing items from skipped_servers ([#2887](https://github.com/lunarvim/lunarvim/pull/2887)) +- _(readme)_ recommend rolling for 0.8, remove old breaking changes ([#3028](https://github.com/lunarvim/lunarvim/pull/3028)) +- _(windows)_ update example config for nvim-tree ([#2766](https://github.com/lunarvim/lunarvim/pull/2766)) +- _(windows)_ update example config ([#2919](https://github.com/lunarvim/lunarvim/pull/2919)) +- fix some typos and enhance readability ([#2917](https://github.com/lunarvim/lunarvim/pull/2917)) +- fix automatic_servers_installation example ([#2918](https://github.com/lunarvim/lunarvim/pull/2918)) +- update images +- Replace Tree-sitter `maintained` with `all` in README ([#3088](https://github.com/lunarvim/lunarvim/pull/3088)) +- Update contributing readme with new url for install docs. ([#3254](https://github.com/lunarvim/lunarvim/pull/3254)) +- Update Readme ([#3282](https://github.com/lunarvim/lunarvim/pull/3282)) +- remove and reorganize images ([#3302](https://github.com/lunarvim/lunarvim/pull/3302)) +- update readme ([#3303](https://github.com/lunarvim/lunarvim/pull/3303)) +- update colors for links in readme + +### Revert + +- remove incomplete lir integration ([#3030](https://github.com/lunarvim/lunarvim/pull/3030)) +- lir.nvim is still broken ([#3036](https://github.com/lunarvim/lunarvim/pull/3036)) +- fix Packer instead of hard-coding config ([#3049](https://github.com/lunarvim/lunarvim/pull/3049)) + +### Performance + +- _(plugins)_ move assert `vim.env.LVIM_DEV_MODE` logic ([#3238](https://github.com/lunarvim/lunarvim/pull/3238)) +- _(treesitter)_ disable in big files ([#3268](https://github.com/lunarvim/lunarvim/pull/3268)) + +## [1.1.4] + +### Features + +- _(cmp)_ documentation is deprecated in favor of window.documentation ([#2461](https://github.com/lunarvim/lunarvim/pull/2461)) +- _(cmp)_ add option to disable friendly-snippets ([#2660](https://github.com/lunarvim/lunarvim/pull/2660)) +- _(codelens)_ cursorhold is too much intrusive for codelens ([#2600](https://github.com/lunarvim/lunarvim/pull/2600)) +- _(icons)_ make it possible to disable icons ([#2529](https://github.com/lunarvim/lunarvim/pull/2529)) +- _(installer)_ ensure correct responses when prompting user ([#2506](https://github.com/lunarvim/lunarvim/pull/2506)) +- _(installer)_ add verify-plugins hook ([#2751](https://github.com/lunarvim/lunarvim/pull/2751)) +- _(lsp)_ add option to override default `nvim-lsp-installer` settings ([#2698](https://github.com/lunarvim/lunarvim/pull/2698)) +- _(lsp)_ add option to override nlsp-settings ([#2769](https://github.com/lunarvim/lunarvim/pull/2769)) +- _(lsp)_ bind formatexpr and omnifunc by default ([#2865](https://github.com/lunarvim/lunarvim/pull/2865)) +- _(lua-dev)_ use the newer lua-dev branch till folke comes back ([#2538](https://github.com/lunarvim/lunarvim/pull/2538)) +- _(neovim)_ neovim 0.8 compatibility ([#2544](https://github.com/lunarvim/lunarvim/pull/2544)) +- _(peek)_ make sure max width and height are customizable ([#2492](https://github.com/lunarvim/lunarvim/pull/2492)) +- _(plugins)_ add support for packer snapshots ([#2351](https://github.com/lunarvim/lunarvim/pull/2351)) +- _(quit)_ make sure to ask before discarding changes ([#2554](https://github.com/lunarvim/lunarvim/pull/2554)) +- _(which-key)_ added search command for colour highlights ([#2693](https://github.com/lunarvim/lunarvim/pull/2693)) +- lock nvim <0.7 to a specific tag ([#2491](https://github.com/lunarvim/lunarvim/pull/2491)) +- gitsigns yadm support ([#2535](https://github.com/lunarvim/lunarvim/pull/2535)) +- add cmp-tmux to the list of sources ([#2542](https://github.com/lunarvim/lunarvim/pull/2542)) +- prompt when closing modified/term buffers ([#2658](https://github.com/lunarvim/lunarvim/pull/2658)) +- fix a couple of issues ([#2750](https://github.com/lunarvim/lunarvim/pull/2750)) +- add commands to open/edit lvim logs ([#2709](https://github.com/lunarvim/lunarvim/pull/2709)) + +### Bugfix + +- _(autocmd)_ actually use the format wrapper ([#2560](https://github.com/lunarvim/lunarvim/pull/2560)) +- _(autocmds)_ make sure we are using codelens correctly ([#2576](https://github.com/lunarvim/lunarvim/pull/2576)) +- _(autocmds)_ disable commentstring_calc on cursor-hold ([#2581](https://github.com/lunarvim/lunarvim/pull/2581)) +- _(autocmds)_ toggle format-on-save properly ([#2659](https://github.com/lunarvim/lunarvim/pull/2659)) +- _(cmp)_ update nvim-cmp to the latest version ([#2467](https://github.com/lunarvim/lunarvim/pull/2467)) +- _(cmp)_ hotfix nvim-cmp version +- _(cmp)_ bring back default keybindings ([#2470](https://github.com/lunarvim/lunarvim/pull/2470)) +- _(cmp)_ update nvim-cmp to the latest version ([#2467](https://github.com/lunarvim/lunarvim/pull/2467)) ([#2469](https://github.com/lunarvim/lunarvim/pull/2469)) +- _(core.comment)_ fix default extra mappings ([#2768](https://github.com/lunarvim/lunarvim/pull/2768)) +- _(dap)_ temporarily use dap-buddy dev branch which has older code ([#2567](https://github.com/lunarvim/lunarvim/pull/2567)) +- _(dap)_ pause key binding commmand ([#2573](https://github.com/lunarvim/lunarvim/pull/2573)) +- _(impatient)_ avoid get_options in fast handler ([#2451](https://github.com/lunarvim/lunarvim/pull/2451)) +- _(installer)_ latest and specified release version for neovim have different urls ([#2484](https://github.com/lunarvim/lunarvim/pull/2484)) +- _(installer)_ use full path to verify_plugins.lua ([#2755](https://github.com/lunarvim/lunarvim/pull/2755)) +- _(installer)_ always use check shallow clones ([#2763](https://github.com/lunarvim/lunarvim/pull/2763)) +- _(installer/pwsh)_ fixes some details on installer and uninstaller ([#2404](https://github.com/lunarvim/lunarvim/pull/2404)) +- _(log)_ add date to the timestamp of logs ([#2669](https://github.com/lunarvim/lunarvim/pull/2669)) +- _(lsp)_ undo stdpath overload to avoid datarace ([#2540](https://github.com/lunarvim/lunarvim/pull/2540)) +- _(lsp)_ update format filter for nightly ([#2773](https://github.com/lunarvim/lunarvim/pull/2773)) +- _(lualine)_ color theme gaps in some components ([#2465](https://github.com/lunarvim/lunarvim/pull/2465)) +- _(lualine)_ unique buf client names ([#2683](https://github.com/lunarvim/lunarvim/pull/2683)) +- _(luasnip)_ make sure all snippets are loaded ([#2447](https://github.com/lunarvim/lunarvim/pull/2447)) +- _(luasnip)_ only use user snippets if the folder exists ([#2481](https://github.com/lunarvim/lunarvim/pull/2481)) +- _(lvim/lsp/manager)_ make client_is_configured more reliable ([#2851](https://github.com/lunarvim/lunarvim/pull/2851)) +- _(nvimtree)_ escape the dot character in custom filter ([#2493](https://github.com/lunarvim/lunarvim/pull/2493)) +- _(nvimtree)_ make sure on_config_done is using the correct require ([#2509](https://github.com/lunarvim/lunarvim/pull/2509)) +- _(nvimtree)_ add latest changes from nvimtree ([#2537](https://github.com/lunarvim/lunarvim/pull/2537)) +- _(nvimtree)_ update nvim-tree setup ([#2681](https://github.com/lunarvim/lunarvim/pull/2681)) +- _(nvimtree)_ remove `indent_markers` icons trailing space ([#2854](https://github.com/lunarvim/lunarvim/pull/2854)) +- _(packer)_ add max_jobs = 40 ([#2781](https://github.com/lunarvim/lunarvim/pull/2781)) +- _(readme)_ update lsp server ignore syntax +- _(readme)_ remove black as linter ([#2510](https://github.com/lunarvim/lunarvim/pull/2510)) +- _(telescope)_ set binding to actions.select_default only ([#2395](https://github.com/lunarvim/lunarvim/pull/2395)) +- _(theme)_ make sure the new theme is fully loaded ([#2392](https://github.com/lunarvim/lunarvim/pull/2392)) +- _(windows)_ specify required powershell version for the installation script ([#2376](https://github.com/lunarvim/lunarvim/pull/2376)) +- update deprecated methods in example configuration for trouble.nvim ([#2416](https://github.com/lunarvim/lunarvim/pull/2416)) +- use correct cache path ([#2593](https://github.com/lunarvim/lunarvim/pull/2593)) +- load notify's telescope extension properly ([#2586](https://github.com/lunarvim/lunarvim/pull/2586)) +- skip calling nvim-tree.setup() more than once ([#2707](https://github.com/lunarvim/lunarvim/pull/2707)) +- typo in utils/installer/install.sh ([#2776](https://github.com/lunarvim/lunarvim/pull/2776)) +- use pcall for setting up project.nvim ([#2762](https://github.com/lunarvim/lunarvim/pull/2762)) + +### Refactor + +- _(lsp)_ replace deprecated ocamllsp with ocamlls ([#2402](https://github.com/lunarvim/lunarvim/pull/2402)) +- _(lsp)_ cleanup servers' override configuration ([#2243](https://github.com/lunarvim/lunarvim/pull/2243)) +- _(lsp)_ decouple the installer setup-hook ([#2536](https://github.com/lunarvim/lunarvim/pull/2536)) +- _(telescope)_ don't overwrite default cmd to show hidden files +- _(whichkey)_ use vim.keymap.set directly ([#2786](https://github.com/lunarvim/lunarvim/pull/2786)) +- re-enable packer.sync() in LvimReload ([#2410](https://github.com/lunarvim/lunarvim/pull/2410)) +- update impatient ([#2477](https://github.com/lunarvim/lunarvim/pull/2477)) +- lock new installations to nvim v0.7+ ([#2526](https://github.com/lunarvim/lunarvim/pull/2526)) +- use api-autocmds for lsp functions ([#2549](https://github.com/lunarvim/lunarvim/pull/2549)) +- [**breaking**] load the default options once ([#2592](https://github.com/lunarvim/lunarvim/pull/2592)) +- remove redundant ftdetects ([#2651](https://github.com/lunarvim/lunarvim/pull/2651)) + +### Documentation + +- _(README)_ change forgotten breaking change in example ([#2377](https://github.com/lunarvim/lunarvim/pull/2377)) +- _(windows)_ use alpha in config_win.example.lua ([#2452](https://github.com/lunarvim/lunarvim/pull/2452)) + +### Revert + +- do not run packer.sync() on every reload ([#2548](https://github.com/lunarvim/lunarvim/pull/2548)) + +### Performance + +- _(cmp)_ remove redundant check for emmet-ls ([#2830](https://github.com/lunarvim/lunarvim/pull/2830)) + +## [1.1.3] + +### Features + +- add alpha.nvim integration (#1906) + +### Bugfix + +- _(alpha)_ globalstatus after openning files from dashboard (#2366) +- _(bufferline)_ add an additional space before diagnostics (#2367) +- _(lualine)_ conditional theme loading (#2363) +- _(peek)_ make sure popup_options are positive (#2373) +- _(peek)_ print error if lsp is unable to get file contents (#2379) +- _(terminal)_ whichkey -> which-key (#2380) +- _(terminal)_ weird lazygit commit message bug (#2382) +- _(windows)_ use correct validation for the alias (#2371) +- nvim-tree taking half the window on open (#2357) +- correct typo in backup function (#2358) +- automatically set colorscheme (#2370) + +### Refactor + +- load onedarker theme externally (#2359) + +### Documentation + +- update demo images on the main readme (#2386) + +## [1.1.2] + +### Features + +- _(installer)_ Use pnpm to install nodejs dependencies(#2279) (#2280) +- _(windows)_ Add custom config_win.example.lua (#2330) +- Add option to automatically answer 'yes' for sh install script (#2306) +- Enable nlsp-settings schemas (#2322) + +### Bugfix + +- _(nlsp-settings)_ Cross platform issue (#2335) +- _(timeoutlen)_ This has caused way too many issues in the past (#2287) +- Disable the default intro message (#2340) + +### Refactor + +- _(nvim-tree)_ Update settings structure (#2304) + +### Documentation + +- _(readme)_ Fix typo in example config (#2333) + +## [1.1.1] + +### Bugfix + +- Add tsx to treesitter ensure_installed list (#2268) +- Correct a path to bufferline module (#2270) + +## [1.1.0] + +### Features + +- _(vue)_ Set volar as default language server instead of vuels (#2230) +- Use schemastore.nvim to provide extended json schema support (#2239) +- Use bufferline instead of barbar (#2254) +- Add a minimal implementation of bbye (#2267) + +### Bugfix + +- _(autopairs)_ Remove weird tex rules from autopairs (#2206) +- _(diag)_ Show lsp-diag code in open_float (#2180) +- _(installer)_ Usernames can contain @ symbol (#2167) +- _(installer)_ Universal bash (#2241) +- _(logging)_ Disable insane amount of logging inside lvim.log (#2205) +- _(lsp)_ No need to stop clients on LvimReload (#2160) +- _(lsp)_ Use temporary fork of lua-dev (#2187) +- _(lsp)_ Avoid accessing undefined user_data (#2216) +- _(lualine)_ Add space to diff components (#1897) +- _(lualine)_ Compacter size for treesitter icon (#2247) +- _(lualine)_ Use 1-char width symbol for changed (#2246) +- _(which-key)_ The PR has been merged to the original repo (#2172) +- _(zsh)_ Don't set filetype to sh (#2035) +- Added -ScriptBlock to run commands ```install.ps1``` (#2188) + +### Refactor + +- _(nvim-tree)_ Cleanup and update settings (#2182) +- _(nvim-tree)_ Remove unused code (#2266) +- Remove unused outdated files (#2184) + +### Documentation + +- _(readme)_ Add powershell installer script for Windows (#2208) + +## [1.0.0] + +### Features + +- _(info)_ Display overridden servers for filetype (#2155) +- _(luadev)_ Better vim api completion (#2043) +- Add lualine config for darkplus +- Last updates before 1.0.0 (#1953) +- Use Telescope's git_files with fallback (#2089) +- Plugin version bump (#2120) +- Lazyload notify's configuration (#1855) +- Plugin version bump (#2131) + +### Bugfix + +- _(gitsigns)_ Rounded border (#2142) +- _(install)_ Avoid data-races for `on_packer_complete` (#2157) +- _(installer)_ Backup linked files with rsync (#2081) +- _(installer)_ Check if npm-prefix is writable (#2091) +- _(installer)_ More robust yarn validation (#2113) +- _(lsp)_ Set the handlers opts for v0.6 as well (#2109) +- _(lsp)_ Formatter now use new null-ls api function (#2135) +- _(lsp)_ Formatter now use new null-ls api function (#2135) +- _(null-ls)_ Avoid sending invalid opts.args (#2154) +- _(which-key)_ Temporary solution for which-key (#2150) +- Remove autopairs cmp completion (#2083) +- Remove "error" message from git tag (#2141) + +### Refactor + +- _(bootstrap)_ More robust git module (#2127) +- _(info)_ Use new null-ls api for sources (#2125) +- _(install.sh)_ Fix typo in node error message (#2107) +- _(null-ls)_ Allow passing full list of options for sources (#2137) +- _(settings)_ Add headless-mode settings (#2134) +- _(term)_ Leave the first few ids unassigned (#2156) +- _(test)_ Cleanup test utilities (#2132) +- Deprecate lvim.lang.FOO (#1913) (#1914) +- Remove unused old language configs (#2094) +- Uplift neovim's minimum version requirement to 0.6.0 (#2093) +- Avoid running ts.setup in headless (#2119) +- More consistent autocmds (#2133) +- Use a static lvim binary template (#1444) + +## [1.0.0-rc] + +### Features + +- _(installer)_ Nicer rsync output (#2067) +- _(terminal)_ Lazygit can now be toggled (#2039) +- Add lualine config for darkplus +- Last updates before 1.0.0 (#1953) +- Support new null-ls (#1955) +- Empty for empty buffers instead of Buffer <#> +- Improved LSP grouping in lualine +- Decrease hide in width limit for lualine +- Add support for fsharp (#2021) +- Add some messages in uninstall.sh (#1945) +- Null-ls code_actions interface (#2008) +- Full compatibility with neovim v0.6 (#2037) +- Multiple enhancements to lvim-reload (#2054) +- Bump plugin versions (#2064) +- Update lsp-installer and lspconfig hashes to enable solidity_ls language server (#2072) + +### Bugfix + +- _(autopairs)_ Add missing configuration entries (#2030) +- _(bootstrap)_ Remove hard-coded spellfile option (#2061) +- _(cmp)_ Revert broken sequential loading (#2002) +- _(installer)_ Better handling of existing files (#2066) +- _(lsp)_ Avoid installing an overridden server (#1981) +- _(lsp)_ Prevent repeated setup call (#2048) +- _(lsp)_ Correct client_id parsing in lvim-info (#2071) +- _(lsp)_ Allow overriding servers with custom providers (#2070) +- _(lualine)_ Change `fg` of section `a` in onedarker (#1909) +- _(null-ls)_ Allow the same linter and formatter (#1968) +- _(nvimtree)_ Update settings (#2001) +- _(nvimtree)_ Restore default mappings + make them customizable (#2007) +- _(nvimtree)_ Handle paths containing spaces (#2027) +- _(plugins)_ Typo of pin commit of `treesitter` (#2046) +- _(terminal)_ Allow disabling the open binding for toggleterm +- _(windows)_ Autocmd requires forward slashes (#1967) +- _(windows)_ Remove redundant `resolve` call (#1974) +- Bump nvim-tree version +- Formatting +- Remove duplicate lint messages +- Allow LunarVim changelog to work outside the lvim directory (#1952) +- Use an indepdent shadafile from neovim (#1910) +- Packersync issue when you have large number of plugins (#1922) +- No idea why this breaks barbar +- Lsp root can get very annoying when working with multiple languages. User is still able to turn it on. +- Update jdtls script +- Correct order for cmp's setup (#1999) +- Dont close if next char is a close pair and no pairs in same line (#2017) +- More accessible changelog (#2019) +- Better default, ignore `.git` in `live_grep` (#2020) +- No restart required when changing colorscheme (#2026) +- No longer treat lazygit missing as an error (#2051) + +### Refactor + +- Deprecate lvim.lang.FOO (#1913) (#1914) +- More configurable format-on-save (#1937) +- Load the default keymaps once (#1965) + + diff --git a/mac/.config/LunarVim/CONTRIBUTING.md b/mac/.config/LunarVim/CONTRIBUTING.md new file mode 100644 index 0000000..d7ab961 --- /dev/null +++ b/mac/.config/LunarVim/CONTRIBUTING.md @@ -0,0 +1,116 @@ +# Contributing to LunarVim + +Welcome to the LunarVim contributing guide. We are excited about the prospect of you joining our [community](https://github.com/lunarvim/LunarVim/graphs/contributors)! + +There are many opportunities to contributing to the project at any level. Every contribution is highly valued and no contribution is too small. + +You do not need to write code to contribute to this project. Documentation, demos, and feature design advancements are a key part of this project's growth. + +One of the best ways to begin contributing in a meaningful way is by helping find bugs and filing issues for them. + +## Getting Started + +1. Follow the [Installation](https://www.lunarvim.org/docs/installation) guide +2. Link your fork with the repository `git remote add upstream https://github.com/lunarvim/LunarVim.git`, or use `gh fork` +3. That's it! You can now `git fetch upstream` and `git rebase [-i] upstream/master` to update your branches with the latest contributions. + +
+ +## Setting up development tools + +### For editing Lua files + +1. Formatter: [stylua](https://github.com/johnnymorganz/stylua#installation). +2. Linter: [luacheck](https://github.com/luarocks/luacheck). + +### For editing shell scripts + +1. Formatter: [shfmt](https://github.com/mvdan/sh#shfmt). +2. Linter: [shellcheck](https://github.com/koalaman/shellcheck). + +### (Optional) + +Install [pre-commit](https://github.com/pre-commit/pre-commit) which will run all linters and formatters for you as a pre-commit-hook. + +
+ +## Code Conventions + +All lua code is formatted with [Stylua](https://github.com/JohnnyMorganz/StyLua). +```bash +# configurations are already stored in .stylua.toml +stylua -c . +``` + +All shell code is formatted according to [Google Shell Style Guide](https://google.github.io/styleguide/shellguide.html) +* use two spaces instead of tabs +```bash +shfmt -i 2 -ci -bn -l -d . +``` + +
+ +## Pull Requests (PRs) + +- To avoid duplicate work, create a draft pull request. +- Your PR must pass all the [automated-ci-tests](https://github.com/neovim/neovim/actions). +- Use a [git-feature-branch](https://www.atlassian.com/git/tutorials/comparing-workflows) instead of the master/rolling branch. +- Use a [rebase-workflow](http://git-scm.com/book/en/v2/Git-Branching-Rebasing). +- Title the PR the same way as commit headers + +### Commit Messages +* Commit header is limited to 72 characters. +* Commit body and footer is limited to 100 characters per line. + +**Commit header format:** +``` +(?): + │ │ │ + │ │ └─> Present tense. 'add something...'(O) vs 'added something...'(X) + │ │ Imperative mood. 'move cursor to...'(O) vs 'moves cursor to...'(X) + │ │ Not capitalized. + │ │ No period at the end. + │ │ + │ └─> Commit Scope is optional, but strongly recommended. + │ Use lower case. + │ 'plugin', 'file', or 'directory' name is suggested, but not limited. + │ + └─> Commit Type: build|ci|docs|feat|fix|perf|refactor|test +``` + +##### Commit Type Guideline + +* **build**: changes that affect the build system or external dependencies (example scopes: npm, pip, rg) +* **ci**: changes to CI configuration files and scripts (example scopes: format, lint, issue_templates) +* **docs**: changes to the documentation only +* **feat**: new feature for the user +* **fix**: bug fix +* **perf**: performance improvement +* **refactor**: code change that neither fixes a bug nor adds a feature +* **test**: adding missing tests or correcting existing tests +* **chore**: all the rest, including version bump for plugins + +**Real world examples:** +``` +feat(quickfix): add 'q' binding to quit quickfix window when focused +``` +``` +fix(installer): add missing "HOME" variable +``` + + +### Branch Naming + +Name your branches meaningfully. + +ex) +```(feature|bugfix|hotfix)/what-my-pr-does``` + +
+ +## Communication + +Members of the community have multiple ways to collaborate on the project. +We encourage you to join the community: +- [Discord server](https://discord.gg/Xb9B4Ny) +- [Matrix server](https://matrix.to/#/#atmachine-neovim:matrix.org) diff --git a/mac/.config/LunarVim/LICENSE b/mac/.config/LunarVim/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/mac/.config/LunarVim/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/mac/.config/LunarVim/Makefile b/mac/.config/LunarVim/Makefile new file mode 100644 index 0000000..1f6844c --- /dev/null +++ b/mac/.config/LunarVim/Makefile @@ -0,0 +1,42 @@ +SHELL := /usr/bin/env bash + +install: + @echo starting LunarVim installer + bash ./utils/installer/install.sh + +install-bin: + @echo starting LunarVim bin-installer + bash ./utils/installer/install_bin.sh + +install-neovim-binary: + @echo installing Neovim from github releases + bash ./utils/installer/install-neovim-from-release + +uninstall: + @echo starting LunarVim uninstaller + bash ./utils/installer/uninstall.sh + +generate_new_lockfile: + @echo generating core-plugins latest lockfile + bash ./utils/ci/generate_new_lockfile.sh + +lint: lint-lua lint-sh + +lint-lua: + luacheck *.lua lua/* tests/* + +lint-sh: + shfmt -f . | grep -v jdtls | xargs shellcheck + +style: style-lua style-sh + +style-lua: + stylua --config-path .stylua.toml --check . + +style-sh: + shfmt -f . | grep -v jdtls | xargs shfmt -i 2 -ci -bn -l -d + +test: + bash ./utils/ci/run_test.sh "$(TEST)" + +.PHONY: install install-neovim-binary uninstall lint style test diff --git a/mac/.config/LunarVim/README.md b/mac/.config/LunarVim/README.md new file mode 100644 index 0000000..28992d4 --- /dev/null +++ b/mac/.config/LunarVim/README.md @@ -0,0 +1,68 @@ +![lunarvim_logo_dark](https://user-images.githubusercontent.com/59826753/159940098-54284f26-f1da-4481-8b03-1deb34c57533.png) + +

+ + Latest release + + + Last commit + + + License + + + Stars + + + Issues + + + Repo Size + + + Patreon donate button + + + follow on Twitter + + +

+ +

+ +An IDE layer for Neovim with sane defaults. Completely free and community driven. + +--- + +**[
 Install 
][Install]**  +**[
 Configure 
][Configure]**  +**[
 Troubleshooting 
][Troubleshoot]**  +**[
 Contribute 
][Contribute]** + +--- + +## Showcase + +![demo3](https://user-images.githubusercontent.com/29136904/191626246-ce0cc0c5-4b41-49e3-9cb7-4b1867ab0dcb.png) +![info](https://user-images.githubusercontent.com/29136904/191624942-3d75ef87-35cf-434d-850e-3e7cd5ce2ad0.png) + + + +## Socials + +

+Github Logo Discord Logo Twitter Logo Reddit Logo +

+ +[Contribute]: https://github.com/LunarVim/LunarVim/blob/master/CONTRIBUTING.md +[Install]: https://www.lunarvim.org/docs/installation +[Troubleshoot]: https://www.lunarvim.org/docs/troubleshooting +[Configure]: https://www.lunarvim.org/docs/configuration + +## Thanks to all contributors + + + + + +
diff --git a/mac/.config/LunarVim/init.lua b/mac/.config/LunarVim/init.lua new file mode 100644 index 0000000..f794b16 --- /dev/null +++ b/mac/.config/LunarVim/init.lua @@ -0,0 +1,25 @@ +local base_dir = vim.env.LUNARVIM_BASE_DIR + or (function() + local init_path = debug.getinfo(1, "S").source + return init_path:sub(2):match("(.*[/\\])"):sub(1, -2) + end)() + +if not vim.tbl_contains(vim.opt.rtp:get(), base_dir) then + vim.opt.rtp:prepend(base_dir) +end + +require("lvim.bootstrap"):init(base_dir) + +require("lvim.config"):load() + +local plugins = require "lvim.plugins" + +require("lvim.plugin-loader").load { plugins, lvim.plugins } + +require("lvim.core.theme").setup() + +local Log = require "lvim.core.log" +Log:debug "Starting LunarVim" + +local commands = require "lvim.core.commands" +commands.load(commands.defaults) diff --git a/mac/.config/LunarVim/lua/lvim/bootstrap.lua b/mac/.config/LunarVim/lua/lvim/bootstrap.lua new file mode 100644 index 0000000..2a2ac1d --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/bootstrap.lua @@ -0,0 +1,123 @@ +local M = {} + +if vim.fn.has "nvim-0.10" ~= 1 then + vim.notify("Please upgrade your Neovim base installation. Lunarvim requires v0.10+", vim.log.levels.WARN) + vim.wait(5000, function() + ---@diagnostic disable-next-line: redundant-return-value + return false + end) + vim.cmd "cquit" +end + +local uv = vim.loop +local path_sep = uv.os_uname().version:match "Windows" and "\\" or "/" + +---Join path segments that were passed as input +---@return string +function _G.join_paths(...) + local result = table.concat({ ... }, path_sep) + return result +end + +_G.require_clean = require("lvim.utils.modules").require_clean +_G.require_safe = require("lvim.utils.modules").require_safe +_G.reload = require("lvim.utils.modules").reload + +---Get the full path to `$LUNARVIM_RUNTIME_DIR` +---@return string|nil +function _G.get_runtime_dir() + local lvim_runtime_dir = os.getenv "LUNARVIM_RUNTIME_DIR" + if not lvim_runtime_dir then + -- when nvim is used directly + return vim.call("stdpath", "data") + end + return lvim_runtime_dir +end + +---Get the full path to `$LUNARVIM_CONFIG_DIR` +---@return string|nil +function _G.get_config_dir() + local lvim_config_dir = os.getenv "LUNARVIM_CONFIG_DIR" + if not lvim_config_dir then + return vim.call("stdpath", "config") + end + return lvim_config_dir +end + +---Get the full path to `$LUNARVIM_CACHE_DIR` +---@return string|nil +function _G.get_cache_dir() + local lvim_cache_dir = os.getenv "LUNARVIM_CACHE_DIR" + if not lvim_cache_dir then + return vim.call("stdpath", "cache") + end + return lvim_cache_dir +end + +---Initialize the `&runtimepath` variables and prepare for startup +---@return table +function M:init(base_dir) + self.runtime_dir = get_runtime_dir() + self.config_dir = get_config_dir() + self.cache_dir = get_cache_dir() + self.pack_dir = join_paths(self.runtime_dir, "site", "pack") + self.lazy_install_dir = join_paths(self.pack_dir, "lazy", "opt", "lazy.nvim") + + ---@meta overridden to use LUNARVIM_CACHE_DIR instead, since a lot of plugins call this function internally + ---NOTE: changes to "data" are currently unstable, see #2507 + ---@diagnostic disable-next-line: duplicate-set-field + vim.fn.stdpath = function(what) + if what == "cache" then + return _G.get_cache_dir() + end + return vim.call("stdpath", what) + end + + ---Get the full path to LunarVim's base directory + ---@return string + function _G.get_lvim_base_dir() + return base_dir + end + + if os.getenv "LUNARVIM_RUNTIME_DIR" then + vim.opt.rtp:remove(join_paths(vim.call("stdpath", "data"), "site")) + vim.opt.rtp:remove(join_paths(vim.call("stdpath", "data"), "site", "after")) + -- vim.opt.rtp:prepend(join_paths(self.runtime_dir, "site")) + vim.opt.rtp:append(join_paths(self.runtime_dir, "lvim", "after")) + vim.opt.rtp:append(join_paths(self.runtime_dir, "site", "after")) + + vim.opt.rtp:remove(vim.call("stdpath", "config")) + vim.opt.rtp:remove(join_paths(vim.call("stdpath", "config"), "after")) + vim.opt.rtp:prepend(self.config_dir) + vim.opt.rtp:append(join_paths(self.config_dir, "after")) + + vim.opt.packpath = vim.opt.rtp:get() + end + + require("lvim.plugin-loader").init { + package_root = self.pack_dir, + install_path = self.lazy_install_dir, + } + + require("lvim.config"):init() + + require("lvim.core.mason").bootstrap() + + return self +end + +---Update LunarVim +---pulls the latest changes from github and, resets the startup cache +function M:update() + require("lvim.core.log"):info "Trying to update LunarVim..." + + vim.schedule(function() + reload("lvim.utils.hooks").run_pre_update() + local ret = reload("lvim.utils.git").update_base_lvim() + if ret then + reload("lvim.utils.hooks").run_post_update() + end + end) +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/config/_deprecated.lua b/mac/.config/LunarVim/lua/lvim/config/_deprecated.lua new file mode 100644 index 0000000..ebcdbe9 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/config/_deprecated.lua @@ -0,0 +1,215 @@ +---@diagnostic disable: deprecated +local M = {} + +local function deprecate(name, alternative) + local in_headless = #vim.api.nvim_list_uis() == 0 + if in_headless then + return + end + + alternative = alternative or "See https://github.com/LunarVim/LunarVim#breaking-changes" + + local trace = debug.getinfo(3, "Sl") + local shorter_src = trace.short_src + local t = shorter_src .. ":" .. (trace.currentline or trace.lastlinedefined) + vim.schedule(function() + vim.notify_once(string.format("%s: `%s` is deprecated.\n %s.", t, name, alternative), vim.log.levels.WARN) + end) +end + +function M.handle() + local mt = { + __newindex = function(_, k, _) + deprecate(k) + end, + } + + ---@deprecated + lvim.builtin.theme.options = {} + setmetatable(lvim.builtin.theme.options, { + __newindex = function(_, k, v) + deprecate("lvim.builtin.theme.options." .. k, "Use `lvim.builtin.theme..options` instead") + lvim.builtin.theme.tokyonight.options[k] = v + end, + }) + + ---@deprecated + lvim.builtin.notify = {} + setmetatable(lvim.builtin.notify, { + __newindex = function(_, k, _) + deprecate("lvim.builtin.notify." .. k, "See LunarVim#3294") + end, + }) + + ---@deprecated + lvim.builtin.dashboard = {} + setmetatable(lvim.builtin.dashboard, { + __newindex = function(_, k, _) + deprecate("lvim.builtin.dashboard." .. k, "Use `lvim.builtin.alpha` instead. See LunarVim#1906") + end, + }) + + ---@deprecated + lvim.lsp.popup_border = {} + setmetatable(lvim.lsp.popup_border, mt) + + ---@deprecated + lvim.lsp.float = {} + setmetatable(lvim.lsp.float, { + __newindex = function(_, k, _) + deprecate("lvim.lsp.float." .. k, "Use options provided by the handler instead") + end, + }) + + ---@deprecated + lvim.lsp.diagnostics = {} + setmetatable(lvim.lsp.diagnostics, { + __newindex = function(table, k, v) + deprecate("lvim.lsp.diagnostics." .. k, string.format("Use `vim.diagnostic.config({ %s = %s })` instead", k, v)) + rawset(table, k, v) + end, + }) + + ---@deprecated + lvim.lang = {} + setmetatable(lvim.lang, mt) +end + +function M.post_load() + if lvim.lsp.diagnostics and not vim.tbl_isempty(lvim.lsp.diagnostics) then + vim.diagnostic.config(lvim.lsp.diagnostics) + end + + if lvim.lsp.override and not vim.tbl_isempty(lvim.lsp.override) then + deprecate("lvim.lsp.override", "Use `lvim.lsp.automatic_configuration.skipped_servers` instead") + vim.tbl_map(function(c) + if not vim.tbl_contains(lvim.lsp.automatic_configuration.skipped_servers, c) then + table.insert(lvim.lsp.automatic_configuration.skipped_servers, c) + end + end, lvim.lsp.override) + end + + if lvim.autocommands.custom_groups then + deprecate( + "lvim.autocommands.custom_groups", + "Use vim.api.nvim_create_autocmd instead or check LunarVim#2592 to learn about the new syntax" + ) + end + + if lvim.lsp.automatic_servers_installation then + deprecate( + "lvim.lsp.automatic_servers_installation", + "Use `lvim.lsp.installer.setup.automatic_installation` instead" + ) + end + + local function convert_spec_to_lazy(spec) + local alternatives = { + setup = "init", + as = "name", + opt = "lazy", + run = "build", + lock = "pin", + requires = "dependencies", + } + + alternatives.tag = function() + if spec.tag == "*" then + spec.version = "*" + return [[version = "*"]] + end + end + + alternatives.disable = function() + if type(spec.disabled) == "function" then + spec.enabled = function() + return not spec.disabled() + end + else + spec.enabled = not spec.disabled + end + return "enabled = " .. vim.inspect(spec.enabled) + end + + alternatives.wants = function() + return "dependencies = [value]" + end + alternatives.needs = alternatives.wants + + alternatives.module = function() + spec.lazy = true + return "lazy = true" + end + + for old_key, alternative in pairs(alternatives) do + if spec[old_key] ~= nil then + local message + local old_value = vim.inspect(spec[old_key]) or "value" + + if type(alternative) == "function" then + message = alternative() + else + spec[alternative] = spec[old_key] + end + + -- not every function in alternatives returns a message (e.g. tag) + if type(alternative) ~= "function" or message then + spec[old_key] = nil + + local new_value = vim.inspect(spec[alternative] or "[value]") + message = message or string.format("%s = %s", alternative, new_value) + vim.schedule(function() + vim.notify_once( + string.format( + [[`%s = %s` in `lvim.plugins` has been deprecated since the migration to lazy.nvim. Use `%s` instead. +Example: +`lvim.plugins = {... {... %s = %s ...} ...}` +-> +`lvim.plugins = {... {... %s ...} ...}` +See https://github.com/folke/lazy.nvim#-migration-guide"]], + old_key, + old_value, + message, + old_key, + old_value, + message + ), + vim.log.levels.WARN + ) + end) + end + end + end + + if spec[1] and spec[1]:match "^http" then + spec.url = spec[1] + spec[1] = nil + + vim.schedule(function() + vim.notify_once( + + string.format( + [[`"http..."` in `lvim.plugins` has been deprecated since the migration to lazy.nvim. Use `url = "http..."` instead. +Example: +`lvim.plugins = {... { "%s" ...} ...}` +-> +`lvim.plugins = {... { url = "%s" ...} ...}` +See https://github.com/folke/lazy.nvim#-migration-guide"]], + spec.url, + spec.url + ), + + vim.log.levels.WARN + ) + end) + end + end + + for _, plugin in ipairs(lvim.plugins) do + if type(plugin) == "table" then + convert_spec_to_lazy(plugin) + end + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/config/defaults.lua b/mac/.config/LunarVim/lua/lvim/config/defaults.lua new file mode 100644 index 0000000..5fa8a91 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/config/defaults.lua @@ -0,0 +1,75 @@ +return { + leader = "space", + reload_config_on_save = true, + colorscheme = "lunar", + transparent_window = false, + format_on_save = { + ---@usage boolean: format on save (Default: false) + enabled = false, + ---@usage pattern string pattern used for the autocommand (Default: '*') + pattern = "*", + ---@usage timeout number timeout in ms for the format request (Default: 1000) + timeout = 1000, + ---@usage filter func to select client + filter = require("lvim.lsp.utils").format_filter, + }, + keys = {}, + + use_icons = true, + icons = require "lvim.icons", + + builtin = {}, + + plugins = { + -- use config.lua for this not put here + }, + + lazy = { + opts = { + install = { + missing = true, + colorscheme = { "lunar", "habamax" }, + }, + ui = { + border = "rounded", + }, + root = require("lvim.utils").join_paths(get_runtime_dir(), "site", "pack", "lazy", "opt"), + git = { + timeout = 120, + }, + lockfile = require("lvim.utils").join_paths(get_config_dir(), "lazy-lock.json"), + performance = { + rtp = { + reset = false, + }, + }, + defaults = { + lazy = false, + version = nil, + }, + readme = { + root = require("lvim.utils").join_paths(get_runtime_dir(), "lazy", "readme"), + }, + }, + }, + + autocommands = {}, + lang = {}, + log = { + ---@usage can be { "trace", "debug", "info", "warn", "error", "fatal" }, + level = "info", + viewer = { + ---@usage this will fallback on "less +F" if not found + cmd = "lnav", + layout_config = { + ---@usage direction = 'vertical' | 'horizontal' | 'window' | 'float', + direction = "horizontal", + open_mapping = "", + size = 40, + float_opts = {}, + }, + }, + -- currently disabled due to instabilities + override_notify = false, + }, +} diff --git a/mac/.config/LunarVim/lua/lvim/config/init.lua b/mac/.config/LunarVim/lua/lvim/config/init.lua new file mode 100644 index 0000000..90c1788 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/config/init.lua @@ -0,0 +1,108 @@ +local utils = require "lvim.utils" +local Log = require "lvim.core.log" + +local M = {} +local user_config_dir = get_config_dir() +local user_config_file = utils.join_paths(user_config_dir, "config.lua") + +---Get the full path to the user configuration file +---@return string +function M:get_user_config_path() + return user_config_file +end + +--- Initialize lvim default configuration and variables +function M:init() + lvim = vim.deepcopy(require "lvim.config.defaults") + + require("lvim.keymappings").load_defaults() + + local builtins = require "lvim.core.builtins" + builtins.config { user_config_file = user_config_file } + + local settings = require "lvim.config.settings" + settings.load_defaults() + + local autocmds = require "lvim.core.autocmds" + autocmds.load_defaults() + + local lvim_lsp_config = require "lvim.lsp.config" + lvim.lsp = vim.deepcopy(lvim_lsp_config) + + lvim.builtin.luasnip = { + sources = { + friendly_snippets = true, + }, + } + + lvim.builtin.bigfile = { + active = true, + config = {}, + } + + require("lvim.config._deprecated").handle() +end + +--- Override the configuration with a user provided one +-- @param config_path The path to the configuration overrides +function M:load(config_path) + local autocmds = reload "lvim.core.autocmds" + config_path = config_path or self:get_user_config_path() + local ok, err = pcall(dofile, config_path) + if not ok then + if utils.is_file(user_config_file) then + vim.schedule(function() + Log:warn("Invalid configuration: " .. err) + end) + else + vim.schedule(function() + vim.notify_once( + string.format("User-configuration not found. Creating an example configuration in %s", config_path) + ) + end) + local config_name = vim.loop.os_uname().version:match "Windows" and "config_win" or "config" + local example_config = join_paths(get_lvim_base_dir(), "utils", "installer", config_name .. ".example.lua") + vim.fn.mkdir(user_config_dir, "p") + vim.loop.fs_copyfile(example_config, config_path) + end + end + + Log:set_level(lvim.log.level) + + require("lvim.config._deprecated").post_load() + + autocmds.define_autocmds(lvim.autocommands) + + vim.g.mapleader = (lvim.leader == "space" and " ") or lvim.leader + + reload("lvim.keymappings").load(lvim.keys) + + if lvim.transparent_window then + autocmds.enable_transparent_mode() + end + + if lvim.reload_config_on_save then + autocmds.enable_reload_config_on_save() + end +end + +--- Override the configuration with a user provided one +-- @param config_path The path to the configuration overrides +function M:reload() + vim.schedule(function() + reload("lvim.utils.hooks").run_pre_reload() + + M:load() + + reload("lvim.core.autocmds").configure_format_on_save() + + local plugins = reload "lvim.plugins" + local plugin_loader = reload "lvim.plugin-loader" + + plugin_loader.reload { plugins, lvim.plugins } + reload("lvim.core.theme").setup() + reload("lvim.utils.hooks").run_post_reload() + end) +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/config/settings.lua b/mac/.config/LunarVim/lua/lvim/config/settings.lua new file mode 100644 index 0000000..2492f1d --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/config/settings.lua @@ -0,0 +1,120 @@ +local M = {} + +M.load_default_options = function() + local utils = require "lvim.utils" + local join_paths = utils.join_paths + + local undodir = join_paths(get_cache_dir(), "undo") + + if not utils.is_directory(undodir) then + vim.fn.mkdir(undodir, "p") + end + + local default_options = { + backup = false, -- creates a backup file + clipboard = "unnamedplus", -- allows neovim to access the system clipboard + cmdheight = 1, -- more space in the neovim command line for displaying messages + completeopt = { "menuone", "noselect" }, + conceallevel = 0, -- so that `` is visible in markdown files + fileencoding = "utf-8", -- the encoding written to a file + foldmethod = "manual", -- folding, set to "expr" for treesitter based folding + foldexpr = "", -- set to "nvim_treesitter#foldexpr()" for treesitter based folding + hidden = true, -- required to keep multiple buffers and open multiple buffers + hlsearch = true, -- highlight all matches on previous search pattern + ignorecase = true, -- ignore case in search patterns + mouse = "a", -- allow the mouse to be used in neovim + pumheight = 10, -- pop up menu height + showmode = false, -- we don't need to see things like -- INSERT -- anymore + smartcase = true, -- smart case + splitbelow = true, -- force all horizontal splits to go below current window + splitright = true, -- force all vertical splits to go to the right of current window + swapfile = false, -- creates a swapfile + termguicolors = true, -- set term gui colors (most terminals support this) + timeoutlen = 1000, -- time to wait for a mapped sequence to complete (in milliseconds) + title = true, -- set the title of window to the value of the titlestring + -- opt.titlestring = "%<%F%=%l/%L - nvim" -- what the title of the window will be set to + undodir = undodir, -- set an undo directory + undofile = true, -- enable persistent undo + updatetime = 100, -- faster completion + writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited + expandtab = true, -- convert tabs to spaces + shiftwidth = 2, -- the number of spaces inserted for each indentation + tabstop = 2, -- insert 2 spaces for a tab + cursorline = true, -- highlight the current line + number = true, -- set numbered lines + numberwidth = 4, -- set number column width to 2 {default 4} + signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time + wrap = false, -- display lines as one long line + shadafile = join_paths(get_cache_dir(), "lvim.shada"), + scrolloff = 8, -- minimal number of screen lines to keep above and below the cursor. + sidescrolloff = 8, -- minimal number of screen lines to keep left and right of the cursor. + showcmd = false, + ruler = false, + laststatus = 3, + } + + --- SETTINGS --- + vim.opt.spelllang:append "cjk" -- disable spellchecking for asian characters (VIM algorithm does not support it) + vim.opt.shortmess:append "c" -- don't show redundant messages from ins-completion-menu + vim.opt.shortmess:append "I" -- don't show the default intro message + vim.opt.whichwrap:append "<,>,[,],h,l" + + for k, v in pairs(default_options) do + vim.opt[k] = v + end + + vim.filetype.add { + extension = { + tex = "tex", + zir = "zir", + cr = "crystal", + }, + pattern = { + ["[jt]sconfig.*.json"] = "jsonc", + }, + } + + local default_diagnostic_config = { + signs = { + active = true, + values = { + { name = "DiagnosticSignError", text = lvim.icons.diagnostics.Error }, + { name = "DiagnosticSignWarn", text = lvim.icons.diagnostics.Warning }, + { name = "DiagnosticSignHint", text = lvim.icons.diagnostics.Hint }, + { name = "DiagnosticSignInfo", text = lvim.icons.diagnostics.Information }, + }, + }, + virtual_text = true, + update_in_insert = false, + underline = true, + severity_sort = true, + float = { + focusable = true, + style = "minimal", + border = "rounded", + source = "always", + header = "", + prefix = "", + }, + } + + vim.diagnostic.config(default_diagnostic_config) +end + +M.load_headless_options = function() + vim.opt.shortmess = "" -- try to prevent echom from cutting messages off or prompting + vim.opt.more = false -- don't pause listing when screen is filled + vim.opt.cmdheight = 9999 -- helps avoiding |hit-enter| prompts. + vim.opt.columns = 9999 -- set the widest screen possible + vim.opt.swapfile = false -- don't use a swap file +end + +M.load_defaults = function() + if #vim.api.nvim_list_uis() == 0 then + M.load_headless_options() + return + end + M.load_default_options() +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/alpha.lua b/mac/.config/LunarVim/lua/lvim/core/alpha.lua new file mode 100644 index 0000000..13642c2 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/alpha.lua @@ -0,0 +1,85 @@ +local M = {} + +function M.config() + local lvim_dashboard = require "lvim.core.alpha.dashboard" + local lvim_startify = require "lvim.core.alpha.startify" + lvim.builtin.alpha = { + dashboard = { + config = {}, + section = lvim_dashboard.get_sections(), + opts = { autostart = true }, + }, + startify = { + config = {}, + section = lvim_startify.get_sections(), + opts = { autostart = true }, + }, + active = true, + mode = "dashboard", + } +end + +local function resolve_buttons(theme_name, button_section) + if button_section.val and #button_section.val > 0 then + return button_section.val + end + + local selected_theme = require("alpha.themes." .. theme_name) + local val = {} + for _, entry in pairs(button_section.entries) do + local on_press = function() + local sc_ = entry[1]:gsub("%s", ""):gsub("SPC", "") + local key = vim.api.nvim_replace_termcodes(sc_, true, false, true) + vim.api.nvim_feedkeys(key, "normal", false) + end + local button_element = selected_theme.button(entry[1], entry[2], entry[3]) + -- this became necessary after recent changes in alpha.nvim (06ade3a20ca9e79a7038b98d05a23d7b6c016174) + button_element.on_press = on_press + + button_element.opts = vim.tbl_extend("force", button_element.opts, entry[4] or button_section.opts or {}) + + table.insert(val, button_element) + end + return val +end + +local function resolve_config(theme_name) + local selected_theme = require("alpha.themes." .. theme_name) + local resolved_section = selected_theme.section + local section = lvim.builtin.alpha[theme_name].section + + for name, el in pairs(section) do + for k, v in pairs(el) do + if name:match "buttons" and k == "entries" then + resolved_section[name].val = resolve_buttons(theme_name, el) + elseif v then + resolved_section[name][k] = v + end + end + + resolved_section[name].opts = el.opts or {} + end + + local opts = lvim.builtin.alpha[theme_name].opts or {} + selected_theme.config.opts = vim.tbl_extend("force", selected_theme.config.opts, opts) + + return selected_theme.config +end + +function M.setup() + local status_ok, alpha = pcall(require, "alpha") + if not status_ok then + return + end + local mode = lvim.builtin.alpha.mode + local config = lvim.builtin.alpha[mode].config + + -- this makes it easier to use a completely custom configuration + if vim.tbl_isempty(config) then + config = resolve_config(mode) + end + + alpha.setup(config) +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/alpha/dashboard.lua b/mac/.config/LunarVim/lua/lvim/core/alpha/dashboard.lua new file mode 100644 index 0000000..07a5ecc --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/alpha/dashboard.lua @@ -0,0 +1,148 @@ +local M = {} + +local banner = { + " ⢀⣀⣤⣤⣤⣶⣶⣶⣶⣶⣶⣤⣤⣤⣀⡀ ", + " ⣀⣤⣶⣿⠿⠟⠛⠉⠉⠉⠁⠈⠉⠉⠉⠛⠛⠿⣿⣷⣦⣀ ", + " ⢀⣤⣾⡿⠛⠉ ⠉⠛⢿⣷⣤⡀ ", + " ⣴⣿⡿⠃ ⠙⠻⣿⣦ ", + " ⢀⣠⣤⣤⣤⣤⣤⣾⣿⣉⣀⡀ ⠙⢻⣷⡄ ", + "⣼⠋⠁ ⢠⣿⡟ ⠉⠉⠉⠛⠛⠶⠶⣤⣄⣀ ⣀⣀ ⢠⣤⣤⡄ ⢻⣿⣆ ", + "⢻⡄ ⢰⣿⡟ ⢠⣿⣿⣿⠉⠛⠲⣾⣿⣿⣷ ⢀⣾⣿⣿⠁ ⢻⣿⡆ ", + " ⠹⣦⡀ ⣿⣿⠁ ⢸⣿⣿⡇ ⠻⣿⣿⠟⠳⠶⣤⣀⣸⣿⣿⠇ ⣿⣷ ", + " ⠙⢷⣿⡇ ⣸⣿⣿⠃ ⢸⣿⣿⢷⣤⡀ ⢸⣿⡆ ", + " ⢸⣿⠇ ⣿⣿⣿ ⣿⣿⣷ ⢠⣿⣿⡏ ⠈⠙⠳⢦⣄ ⠈⣿⡇ ", + " ⢸⣿⡆ ⢸⣿⣿⡇ ⣿⣿⣿ ⢀⣿⣿⡟ ⠈⠙⠷⣤⣿⡇ ", + " ⠘⣿⡇ ⣼⣿⣿⠁ ⣿⣿⣿ ⣼⣿⣿⠃ ⢸⣿⠷⣄⡀ ", + " ⣿⣿ ⣿⣿⡿ ⣿⣿⣿⢸⣿⣿⠃ ⣾⡿ ⠈⠻⣆ ", + " ⠸⣿⣧ ⢸⣿⣿⣇⣀⣀⣀⣀⣀⣀⣸⣿⣿⣿⣿⠇ ⣼⣿⠇ ⠘⣧", + " ⠹⣿⣧ ⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏ ⣼⣿⠏ ⣠⡿", + " ⠘⢿⣷⣄ ⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉ ⢠⣼⡿⠛⠛⠛⠛⠛⠛⠉ ", + " ⠻⣿⣦⣄ ⣀⣴⣿⠟ ", + " ⠈⠛⢿⣶⣤⣀ ⣀⣤⣶⡿⠛⠁ ", + " ⠉⠻⢿⣿⣶⣤⣤⣀⣀⡀ ⢀⣀⣀⣠⣤⣶⣿⡿⠟⠋ ", + " ⠈⠉⠙⠛⠻⠿⠿⠿⠿⠿⠿⠟⠛⠋⠉⠁ ", +} + +M.banner_small = { + " ⢀⣀ ⣰⣶ ⢀⣤⣄ ", + " ⢸⣿ ⣀⡀ ⣰⣿⠏ ⠘⠿⠟ ", + " ⣿⡟ ⣤⡄ ⣠⣤ ⢠⣤⣀⣤⣤⣤⡀ ⢀⣤⣤⣤⣤⡀ ⢠⣤⢀⣤⣤⣄ ⣿⣿ ⢰⣿⠏ ⣶⣶⣶⣶⡦ ⢠⣶⣦⣴⣦⣠⣴⣦⡀ ", + " ⢠⣿⡇ ⢠⣿⠇ ⣿⡇ ⣿⡿⠉ ⠈⣿⣧ ⠰⠿⠋ ⢹⣿ ⣿⡿⠋ ⠹⠿ ⢻⣿⡇⢠⣿⡟ ⠈⠉⢹⣿⡇ ⢸⣿⡏⢹⣿⡏⢹⣿⡇ ", + " ⢸⣿ ⢸⣿ ⢰⣿⠃ ⢠⣿⡇ ⣿⡇ ⣠⣴⡶⠶⠶⣿⣿ ⢠⣿⡇ ⢸⣿⣇⣿⡿ ⣿⣿⠁ ⣿⣿ ⣾⣿ ⣾⣿⠁ ", + " ⣿⣟ ⢻⣿⡀ ⢀⣼⣿ ⢸⣿ ⢰⣿⠇ ⢰⣿⣇ ⣠⣿⡏ ⢸⣿ ⢸⣿⣿⣿⠁ ⣀⣀⣠⣿⣿⣀⡀ ⢠⣿⡟⢠⣿⡟⢀⣿⡿ ", + " ⠛⠛⠛⠛⠛⠛⠁ ⠈⠛⠿⠟⠋⠛⠃ ⠛⠛ ⠘⠛ ⠙⠿⠿⠛⠙⠛⠃ ⠚⠛ ⠘⠿⠿⠃ ⠿⠿⠿⠿⠿⠿⠿ ⠸⠿⠇⠸⠿⠇⠸⠿⠇ ", +} + +M.banner_alt_1 = { + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⣤⣶⣶⣶⣶⣶⣶⣶⣦⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣴⣾⣿⠿⠛⠛⠉⠉⠉⠉⠉⠉⠉⠙⠛⠻⢿⣿⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⠿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠻⢿⣷⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠒⠈⠉⠉⠉⠉⠉⣹⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⡀⠀⠀⠀⠀⠀⠀⣰⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⠀⠀⠀⠀⢰⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⡀⠀⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢺⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⠉⠑⠢⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡇⠀⠀⠀⠈⠑⠢⠄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠢⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣇⠀⠀⠀⠀⠀⠀⠀⠀⠉⠐⠢⠄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⡟⠀⠈⠑⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⢀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⠒⠠⠤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⠁⠀⠀⢀⣼⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠁⠒⠂⠤⠤⠀⣀⡀⠀⠀⠀⣼⣿⠇⠀⠀⢀⣸⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⣿⡟⠀⠀⠀⠀⠀⠀⣤⡄⠀⠀⠀⣠⣤⠀⠀⢠⣭⣀⣤⣤⣤⡀⠀⠀⠀⢀⣤⣤⣤⣤⡀⠀⠀⠀⢠⣤⢀⣤⣤⣄⠀⠀⣿⣿⠀⠉⣹⣿⠏⠉⠉⢱⣶⣶⣶⡦⠀⠀⠀⢠⣶⣦⣴⣦⣠⣴⣦⡀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⢠⣿⡇⠀⠀⠀⠀⠀⢠⣿⠇⠀⠀⠀⣿⡇⠀⠀⣿⡿⠉⠀⠈⣿⣧⠀⠀⠰⠿⠋⠀⠀⢹⣿⠀⠀⠀⣿⡿⠋⠀⠹⠿⠀⠀⢻⣿⡇⢠⣿⡟⠀⠀⠀⠈⠉⢹⣿⡇⠀⠀⠀⢸⣿⡏⢹⣿⡏⢹⣿⡇⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⢰⣿⠃⠀⢠⣿⡇⠀⠀⠀⣿⡇⠀⠀⣠⣴⡶⠶⠶⣿⣿⠀⠀⢠⣿⡇⠀⠀⠀⠀⠀⠀⢸⣿⣇⣿⡿⠀⠀⠀⠀⠀⠀⣿⣿⠁⠀⠀⠀⣿⣿⠀⣾⣿⠀⣾⣿⠁⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⣿⣟⠀⠀⠀⠀⠀⠀⢻⣿⡀⠀⢀⣼⣿⠀⠀⢸⣿⠀⠀⠀⢰⣿⠇⠀⢰⣿⣇⠀⠀⣠⣿⡏⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⠁⠀⠀⠀⣀⣀⣠⣿⣿⣀⡀⠀⢠⣿⡟⢠⣿⡟⢀⣿⡿⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠛⠛⠛⠛⠛⠛⠁⠀⠈⠛⠿⠟⠋⠛⠃⠀⠀⠛⠛⠀⠀⠀⠘⠛⠀⠀⠀⠙⠿⠿⠛⠙⠛⠃⠀⠀⠚⠛⠀⠀⠀⠀⠀⠀⠀⠘⠿⠿⠃⠀⠀⠀⠀⠿⠿⠿⠿⠿⠿⠿⠀⠸⠿⠇⠸⠿⠇⠸⠿⠇⠀⠀⠀⠀⠀", + " ", +} + +M.banner_alt_2 = { + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠟⠛⠛⠉⠉⠉⠉⠉⠉⠛⠛⠻⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠉⠀⣀⣤⣴⣶⣶⣾⣿⣿⣷⣶⣶⣦⣤⣀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠁⢀⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⡀⠈⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⠿⠟⠛⠛⠛⠛⠛⠁⠀⠾⠿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡀⠈⢻⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⠁⣴⣾⣿⣿⣿⡟⠀⣰⣿⣶⣶⣶⣤⣤⣉⣉⠛⠛⠿⠿⣿⣿⡿⠿⠿⣿⣿⣿⣿⣿⣿⡟⠛⠛⢛⣿⣿⣿⣆⠀⢻⣿⣿⣿⣿⣿⣿⣿", + "⣿⡄⠻⣿⣿⣿⡟⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠀⣦⣤⡈⠀⠀⠀⠈⣿⣿⣿⣿⡿⠁⠀⠀⣾⣿⣿⣿⣿⡄⠀⢻⣿⣿⣿⣿⣿⣿", + "⣿⣿⣄⠙⠿⣿⠁⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣄⠀⠀⣠⣄⣉⠛⠻⠃⠀⠀⣼⣿⣿⣿⣿⣿⣿⡀⠈⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣷⣦⡈⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠆⠀⠀⡀⠛⠿⣿⣿⣿⣿⣿⡇⠀⢻⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⡇⠀⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⢀⣿⣿⣿⣿⡇⠀⠀⠘⣿⣿⡟⠀⠀⢰⣿⣷⣦⣌⡙⠻⢿⣿⣷⠀⢸⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⡇⠀⢿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⠀⠀⠀⣿⡿⠀⠀⢀⣿⣿⣿⣿⣿⣿⣷⣤⣈⠛⠀⢸⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣧⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⠁⠀⠀⣾⣿⣿⣿⣿⣿⠀⠀⠀⣿⠁⠀⠀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⡈⠻⢿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⡀⠈⣿⣿⣿⣿⣿⣿⣿⡿⠀⠀⢀⣿⣿⣿⣿⣿⣿⠀⠀⠀⠃⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠁⢀⣿⣶⣄⠙⣿⣿", + "⣿⣿⣿⣿⣿⣿⣧⠀⠘⣿⣿⣿⣿⣿⣿⡇⠀⠀⠸⠿⠿⠿⠿⠿⠿⠇⠀⠀⠀⠀⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⣼⣿⣿⣿⣦⠘⣿", + "⣿⣿⣿⣿⣿⣿⣿⣧⠀⠹⣿⣿⣿⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⣼⣿⣿⣿⡿⠟⢀⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠈⢿⣿⣿⣿⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⢀⣤⣤⣤⣤⣤⣴⣶⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⠀⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⡀⠈⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠁⢀⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⣀⠀⠉⠛⠻⠿⠿⢿⣿⣿⡿⠿⠿⠟⠛⠉⠀⣀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣦⣤⣤⣀⣀⣀⣀⣀⣀⣤⣤⣴⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", +} + +function M.get_sections() + local header = { + type = "text", + val = function() + local alpha_wins = vim.tbl_filter(function(win) + local buf = vim.api.nvim_win_get_buf(win) + return vim.api.nvim_get_option_value("filetype", { buf = buf }) == "alpha" + end, vim.api.nvim_list_wins()) + + if vim.api.nvim_win_get_height(alpha_wins[#alpha_wins]) < 36 then + return M.banner_small + end + return banner + end, + opts = { + position = "center", + hl = "Label", + }, + } + + local text = require "lvim.interface.text" + local lvim_version = require("lvim.utils.git").get_lvim_version() + + local footer = { + type = "text", + val = text.align_center({ width = 0 }, { + "", + "lunarvim.org", + lvim_version, + }, 0.5), + opts = { + position = "center", + hl = "Number", + }, + } + + local buttons = { + opts = { + hl_shortcut = "Include", + spacing = 1, + }, + entries = { + { "f", lvim.icons.ui.FindFile .. " Find File", "Telescope find_files" }, + { "n", lvim.icons.ui.NewFile .. " New File", "ene!" }, + { "p", lvim.icons.ui.Project .. " Projects ", "Telescope projects" }, + { "r", lvim.icons.ui.History .. " Recent files", ":Telescope oldfiles " }, + { "t", lvim.icons.ui.FindText .. " Find Text", "Telescope live_grep" }, + { + "c", + lvim.icons.ui.Gear .. " Configuration", + "edit " .. require("lvim.config"):get_user_config_path() .. " ", + }, + { "q", lvim.icons.ui.Close .. " Quit", "quit" }, + }, + } + return { + header = header, + buttons = buttons, + footer = footer, + } +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/alpha/startify.lua b/mac/.config/LunarVim/lua/lvim/core/alpha/startify.lua new file mode 100644 index 0000000..e9d10a0 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/alpha/startify.lua @@ -0,0 +1,45 @@ +local M = {} + +function M.get_sections() + local header = { + type = "text", + val = { + [[ __ _ ___ ]], + [[ / / __ ______ ____ _____| | / (_)___ ___ ]], + [[ / / / / / / __ \/ __ `/ ___/ | / / / __ `__ \]], + [[ / /___/ /_/ / / / / /_/ / / | |/ / / / / / / /]], + [[/_____/\__,_/_/ /_/\__,_/_/ |___/_/_/ /_/ /_/ ]], + }, + opts = { + hl = "Label", + shrink_margin = false, + -- wrap = "overflow"; + }, + } + + local top_buttons = { + entries = { + { "e", lvim.icons.ui.NewFile .. " New File", "ene!" }, + }, + } + + local bottom_buttons = { + entries = { + { "q", "Quit", "quit" }, + }, + } + + local footer = { + type = "group", + } + + return { + header = header, + top_buttons = top_buttons, + bottom_buttons = bottom_buttons, + -- this is probably broken + footer = footer, + } +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/autocmds.lua b/mac/.config/LunarVim/lua/lvim/core/autocmds.lua new file mode 100644 index 0000000..f7ec7eb --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/autocmds.lua @@ -0,0 +1,281 @@ +local M = {} +local Log = require "lvim.core.log" + +--- Load the default set of autogroups and autocommands. +function M.load_defaults() + local definitions = { + { + "TextYankPost", + { + group = "_general_settings", + pattern = "*", + desc = "Highlight text on yank", + callback = function() + vim.highlight.on_yank { higroup = "Search", timeout = 100 } + end, + }, + }, + { + "FileType", + { + group = "_hide_dap_repl", + pattern = "dap-repl", + command = "set nobuflisted", + }, + }, + { + "FileType", + { + group = "_filetype_settings", + pattern = { "lua" }, + desc = "fix gf functionality inside .lua files", + callback = function() + ---@diagnostic disable: assign-type-mismatch + -- credit: https://github.com/sam4llis/nvim-lua-gf + vim.opt_local.include = [[\v<((do|load)file|require|reload)[^''"]*[''"]\zs[^''"]+]] + vim.opt_local.includeexpr = "substitute(v:fname,'\\.','/','g')" + vim.opt_local.suffixesadd:prepend ".lua" + vim.opt_local.suffixesadd:prepend "init.lua" + + for _, path in pairs(vim.api.nvim_list_runtime_paths()) do + vim.opt_local.path:append(path .. "/lua") + end + end, + }, + }, + { + "FileType", + { + group = "_buffer_mappings", + pattern = { + "qf", + "help", + "man", + "floaterm", + "lspinfo", + "lir", + "lsp-installer", + "null-ls-info", + "tsplayground", + "DressingSelect", + "Jaq", + }, + callback = function() + vim.keymap.set("n", "q", "close", { buffer = true }) + vim.opt_local.buflisted = false + end, + }, + }, + { + "VimResized", + { + group = "_auto_resize", + pattern = "*", + command = [[ + let _auto_resize_current_tab = tabpagenr() + tabdo wincmd = + execute 'tabnext' _auto_resize_current_tab + ]], + }, + }, + { + "FileType", + { + group = "_filetype_settings", + pattern = "alpha", + callback = function() + vim.cmd [[ + set nobuflisted + ]] + end, + }, + }, + { + "FileType", + { + group = "_filetype_settings", + pattern = "lir", + callback = function() + vim.opt_local.number = false + vim.opt_local.relativenumber = false + end, + }, + }, + { + "ColorScheme", + { + group = "_lvim_colorscheme", + callback = function() + if lvim.builtin.breadcrumbs.active then + require("lvim.core.breadcrumbs").get_winbar() + end + local statusline_hl = vim.api.nvim_get_hl(0, { name = "StatusLine" }) + local cursorline_hl = vim.api.nvim_get_hl(0, { name = "CursorLine" }) + local normal_hl = vim.api.nvim_get_hl(0, { name = "Normal" }) + vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#6CC644" }) + vim.api.nvim_set_hl(0, "CmpItemKindTabnine", { fg = "#CA42F0" }) + vim.api.nvim_set_hl(0, "CmpItemKindCrate", { fg = "#F64D00" }) + vim.api.nvim_set_hl(0, "CmpItemKindEmoji", { fg = "#FDE030" }) + vim.api.nvim_set_hl(0, "SLCopilot", { fg = "#6CC644", bg = statusline_hl.bg }) + vim.api.nvim_set_hl(0, "SLGitIcon", { fg = "#E8AB53", bg = cursorline_hl.bg }) + vim.api.nvim_set_hl(0, "SLBranchName", { fg = normal_hl.fg, bg = cursorline_hl.bg }) + vim.api.nvim_set_hl(0, "SLSeparator", { fg = cursorline_hl.fg, bg = statusline_hl.bg }) + end, + }, + }, + { -- taken from AstroNvim + "BufEnter", + { + group = "_dir_opened", + nested = true, + callback = function(args) + local bufname = vim.api.nvim_buf_get_name(args.buf) + if require("lvim.utils").is_directory(bufname) then + vim.api.nvim_del_augroup_by_name "_dir_opened" + vim.cmd "do User DirOpened" + vim.api.nvim_exec_autocmds(args.event, { buffer = args.buf, data = args.data }) + end + end, + }, + }, + { -- taken from AstroNvim + { "BufRead", "BufWinEnter", "BufNewFile" }, + { + group = "_file_opened", + nested = true, + callback = function(args) + local buftype = vim.api.nvim_get_option_value("buftype", { buf = args.buf }) + if not (vim.fn.expand "%" == "" or buftype == "nofile") then + vim.api.nvim_del_augroup_by_name "_file_opened" + vim.api.nvim_exec_autocmds("User", { pattern = "FileOpened" }) + require("lvim.lsp").setup() + end + end, + }, + }, + } + + M.define_autocmds(definitions) +end + +local get_format_on_save_opts = function() + local defaults = require("lvim.config.defaults").format_on_save + -- accept a basic boolean `lvim.format_on_save=true` + if type(lvim.format_on_save) ~= "table" then + return defaults + end + + return { + pattern = lvim.format_on_save.pattern or defaults.pattern, + timeout = lvim.format_on_save.timeout or defaults.timeout, + } +end + +function M.enable_format_on_save() + local opts = get_format_on_save_opts() + vim.api.nvim_create_augroup("lsp_format_on_save", {}) + vim.api.nvim_create_autocmd("BufWritePre", { + group = "lsp_format_on_save", + pattern = opts.pattern, + callback = function() + require("lvim.lsp.utils").format { timeout_ms = opts.timeout, filter = opts.filter } + end, + }) + Log:debug "enabled format-on-save" +end + +function M.disable_format_on_save() + M.clear_augroup "lsp_format_on_save" + Log:debug "disabled format-on-save" +end + +function M.configure_format_on_save() + if type(lvim.format_on_save) == "table" and lvim.format_on_save.enabled then + M.enable_format_on_save() + elseif lvim.format_on_save == true then + M.enable_format_on_save() + else + M.disable_format_on_save() + end +end + +function M.toggle_format_on_save() + local exists, autocmds = pcall(vim.api.nvim_get_autocmds, { + group = "lsp_format_on_save", + event = "BufWritePre", + }) + if not exists or #autocmds == 0 then + M.enable_format_on_save() + else + M.disable_format_on_save() + end +end + +function M.enable_reload_config_on_save() + -- autocmds require forward slashes (even on windows) + local pattern = get_config_dir():gsub("\\", "/") .. "/*.lua" + + vim.api.nvim_create_augroup("lvim_reload_config_on_save", {}) + vim.api.nvim_create_autocmd("BufWritePost", { + group = "lvim_reload_config_on_save", + pattern = pattern, + desc = "Trigger LvimReload on saving config.lua", + callback = function() + require("lvim.config"):reload() + end, + }) +end + +function M.enable_transparent_mode() + vim.api.nvim_create_autocmd("ColorScheme", { + pattern = "*", + callback = function() + local hl_groups = { + "Normal", + "SignColumn", + "NormalNC", + "TelescopeBorder", + "NvimTreeNormal", + "NvimTreeNormalNC", + "EndOfBuffer", + "MsgArea", + } + for _, name in ipairs(hl_groups) do + vim.cmd(string.format("highlight %s ctermbg=none guibg=none", name)) + end + end, + }) + vim.opt.fillchars = "eob: " +end + +--- Clean autocommand in a group if it exists +--- This is safer than trying to delete the augroup itself +---@param name string the augroup name +function M.clear_augroup(name) + -- defer the function in case the autocommand is still in-use + Log:debug("request to clear autocmds " .. name) + vim.schedule(function() + pcall(function() + vim.api.nvim_clear_autocmds { group = name } + end) + end) +end + +--- Create autocommand groups based on the passed definitions +--- Also creates the augroup automatically if it doesn't exist +---@param definitions table contains a tuple of event, opts, see `:h nvim_create_autocmd` +function M.define_autocmds(definitions) + for _, entry in ipairs(definitions) do + local event = entry[1] + local opts = entry[2] + if type(opts.group) == "string" and opts.group ~= "" then + local exists, _ = pcall(vim.api.nvim_get_autocmds, { group = opts.group }) + if not exists then + vim.api.nvim_create_augroup(opts.group, {}) + end + end + vim.api.nvim_create_autocmd(event, opts) + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/autopairs.lua b/mac/.config/LunarVim/lua/lvim/core/autopairs.lua new file mode 100644 index 0000000..439de09 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/autopairs.lua @@ -0,0 +1,91 @@ +local M = {} + +function M.config() + lvim.builtin.autopairs = { + active = true, + on_config_done = nil, + ---@usage modifies the function or method delimiter by filetypes + map_char = { + all = "(", + tex = "{", + }, + ---@usage check bracket in same line + enable_check_bracket_line = false, + ---@usage check treesitter + check_ts = true, + ts_config = { + lua = { "string", "source" }, + javascript = { "string", "template_string" }, + java = false, + }, + disable_filetype = { "TelescopePrompt", "spectre_panel" }, + ---@usage disable when recording or executing a macro + disable_in_macro = false, + ---@usage disable when insert after visual block mode + disable_in_visualblock = false, + disable_in_replace_mode = true, + ignored_next_char = string.gsub([[ [%w%%%'%[%"%.] ]], "%s+", ""), + enable_moveright = true, + ---@usage add bracket pairs after quote + enable_afterquote = true, + ---@usage trigger abbreviation + enable_abbr = false, + ---@usage switch for basic rule break undo sequence + break_undo = true, + map_cr = true, + ---@usage map the key + map_bs = true, + ---@usage map to delete a pair if possible + map_c_w = false, + ---@usage Map the key to delete a pair + map_c_h = false, + ---@usage change default fast_wrap + fast_wrap = { + map = "", + chars = { "{", "[", "(", '"', "'" }, + pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), + offset = 0, -- Offset from pattern match + end_key = "$", + keys = "qwertyuiopzxcvbnmasdfghjkl", + check_comma = true, + highlight = "Search", + highlight_grey = "Comment", + }, + } +end + +M.setup = function() + local status_ok, autopairs = pcall(require, "nvim-autopairs") + if not status_ok then + return + end + + autopairs.setup { + check_ts = lvim.builtin.autopairs.check_ts, + enable_check_bracket_line = lvim.builtin.autopairs.enable_check_bracket_line, + ts_config = lvim.builtin.autopairs.ts_config, + disable_filetype = lvim.builtin.autopairs.disable_filetype, + disable_in_macro = lvim.builtin.autopairs.disable_in_macro, + ignored_next_char = lvim.builtin.autopairs.ignored_next_char, + enable_moveright = lvim.builtin.autopairs.enable_moveright, + enable_afterquote = lvim.builtin.autopairs.enable_afterquote, + map_c_w = lvim.builtin.autopairs.map_c_w, + map_bs = lvim.builtin.autopairs.map_bs, + disable_in_visualblock = lvim.builtin.autopairs.disable_in_visualblock, + fast_wrap = lvim.builtin.autopairs.fast_wrap, + } + + if lvim.builtin.autopairs.on_config_done then + lvim.builtin.autopairs.on_config_done(autopairs) + end + + pcall(function() + local function on_confirm_done(...) + require("nvim-autopairs.completion.cmp").on_confirm_done()(...) + end + require("cmp").event:off("confirm_done", on_confirm_done) + require("cmp").event:on("confirm_done", on_confirm_done) + end) +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/breadcrumbs.lua b/mac/.config/LunarVim/lua/lvim/core/breadcrumbs.lua new file mode 100644 index 0000000..485458f --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/breadcrumbs.lua @@ -0,0 +1,236 @@ +local M = {} + +-- local Log = require "lvim.core.log" +local icons = lvim.icons.kind + +M.config = function() + lvim.builtin.breadcrumbs = { + active = true, + on_config_done = nil, + winbar_filetype_exclude = { + "help", + "startify", + "dashboard", + "lazy", + "neo-tree", + "neogitstatus", + "NvimTree", + "Trouble", + "alpha", + "lir", + "Outline", + "spectre_panel", + "toggleterm", + "DressingSelect", + "Jaq", + "harpoon", + "dap-repl", + "dap-terminal", + "dapui_console", + "dapui_hover", + "lab", + "notify", + "noice", + "neotest-summary", + "", + }, + options = { + icons = { + Array = icons.Array .. " ", + Boolean = icons.Boolean .. " ", + Class = icons.Class .. " ", + Color = icons.Color .. " ", + Constant = icons.Constant .. " ", + Constructor = icons.Constructor .. " ", + Enum = icons.Enum .. " ", + EnumMember = icons.EnumMember .. " ", + Event = icons.Event .. " ", + Field = icons.Field .. " ", + File = icons.File .. " ", + Folder = icons.Folder .. " ", + Function = icons.Function .. " ", + Interface = icons.Interface .. " ", + Key = icons.Key .. " ", + Keyword = icons.Keyword .. " ", + Method = icons.Method .. " ", + Module = icons.Module .. " ", + Namespace = icons.Namespace .. " ", + Null = icons.Null .. " ", + Number = icons.Number .. " ", + Object = icons.Object .. " ", + Operator = icons.Operator .. " ", + Package = icons.Package .. " ", + Property = icons.Property .. " ", + Reference = icons.Reference .. " ", + Snippet = icons.Snippet .. " ", + String = icons.String .. " ", + Struct = icons.Struct .. " ", + Text = icons.Text .. " ", + TypeParameter = icons.TypeParameter .. " ", + Unit = icons.Unit .. " ", + Value = icons.Value .. " ", + Variable = icons.Variable .. " ", + }, + highlight = true, + separator = " " .. lvim.icons.ui.ChevronRight .. " ", + depth_limit = 0, + depth_limit_indicator = "..", + }, + } +end + +M.setup = function() + local status_ok, navic = pcall(require, "nvim-navic") + if not status_ok then + return + end + + M.create_winbar() + navic.setup(lvim.builtin.breadcrumbs.options) + + if lvim.builtin.breadcrumbs.on_config_done then + lvim.builtin.breadcrumbs.on_config_done() + end +end + +local function isempty(s) + return s == nil or s == "" +end + +M.get_filename = function() + local filename = vim.fn.expand "%:t" + local extension = vim.fn.expand "%:e" + + if not isempty(filename) then + local file_icon, hl_group + local devicons_ok, devicons = pcall(require, "nvim-web-devicons") + if lvim.use_icons and devicons_ok then + file_icon, hl_group = devicons.get_icon(filename, extension, { default = true }) + + if isempty(file_icon) then + file_icon = lvim.icons.kind.File + end + else + file_icon = "" + hl_group = "Normal" + end + + local buf_ft = vim.bo.filetype + + if buf_ft == "dapui_breakpoints" then + file_icon = lvim.icons.ui.Bug + end + + if buf_ft == "dapui_stacks" then + file_icon = lvim.icons.ui.Stacks + end + + if buf_ft == "dapui_scopes" then + file_icon = lvim.icons.ui.Scopes + end + + if buf_ft == "dapui_watches" then + file_icon = lvim.icons.ui.Watches + end + + -- if buf_ft == "dapui_console" then + -- file_icon = lvim.icons.ui.DebugConsole + -- end + + local navic_text_hl = vim.api.nvim_get_hl(0, { name = "Normal" }) + vim.api.nvim_set_hl(0, "Winbar", { fg = navic_text_hl.fg }) + + return " " .. "%#" .. hl_group .. "#" .. file_icon .. "%*" .. " " .. "%#Winbar#" .. filename .. "%*" + end +end + +local get_gps = function() + local status_gps_ok, gps = pcall(require, "nvim-navic") + if not status_gps_ok then + return "" + end + + local status_ok, gps_location = pcall(gps.get_location, {}) + if not status_ok then + return "" + end + + if not gps.is_available() or gps_location == "error" then + return "" + end + + if not isempty(gps_location) then + return "%#NavicSeparator#" .. lvim.icons.ui.ChevronRight .. "%* " .. gps_location + else + return "" + end +end + +local excludes = function() + return vim.tbl_contains(lvim.builtin.breadcrumbs.winbar_filetype_exclude or {}, vim.bo.filetype) +end + +M.get_winbar = function() + if excludes() then + return + end + local value = M.get_filename() + + local gps_added = false + if not isempty(value) then + local gps_value = get_gps() + value = value .. " " .. gps_value + if not isempty(gps_value) then + gps_added = true + end + end + + if not isempty(value) and vim.api.nvim_get_option_value("mod", { buf = 0 }) then + -- TODO: replace with circle + local mod = "%#LspCodeLens#" .. lvim.icons.ui.Circle .. "%*" + if gps_added then + value = value .. " " .. mod + else + value = value .. mod + end + end + + local num_tabs = #vim.api.nvim_list_tabpages() + + if num_tabs > 1 and not isempty(value) then + local tabpage_number = tostring(vim.api.nvim_tabpage_get_number(0)) + value = value .. "%=" .. tabpage_number .. "/" .. tostring(num_tabs) + end + + local status_ok, _ = pcall(vim.api.nvim_set_option_value, "winbar", value, { scope = "local" }) + if not status_ok then + return + end +end + +M.create_winbar = function() + vim.api.nvim_create_augroup("_winbar", {}) + vim.api.nvim_create_autocmd({ + "CursorHoldI", + "CursorHold", + "BufWinEnter", + "BufFilePost", + "InsertEnter", + "BufWritePost", + "TabClosed", + "TabEnter", + }, { + group = "_winbar", + callback = function() + if lvim.builtin.breadcrumbs.active then + local status_ok, _ = pcall(vim.api.nvim_buf_get_var, 0, "lsp_floating_window") + if not status_ok then + -- TODO: + require("lvim.core.breadcrumbs").get_winbar() + end + end + end, + }) +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/bufferline.lua b/mac/.config/LunarVim/lua/lvim/core/bufferline.lua new file mode 100644 index 0000000..057e7ca --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/bufferline.lua @@ -0,0 +1,256 @@ +local M = {} + +local function is_ft(b, ft) + return vim.bo[b].filetype == ft +end + +local function diagnostics_indicator(num, _, diagnostics, _) + local result = {} + local symbols = { + error = lvim.icons.diagnostics.Error, + warning = lvim.icons.diagnostics.Warning, + info = lvim.icons.diagnostics.Information, + } + if not lvim.use_icons then + return "(" .. num .. ")" + end + for name, count in pairs(diagnostics) do + if symbols[name] and count > 0 then + table.insert(result, symbols[name] .. " " .. count) + end + end + result = table.concat(result, " ") + return #result > 0 and result or "" +end + +local function custom_filter(buf, buf_nums) + local logs = vim.tbl_filter(function(b) + return is_ft(b, "log") + end, buf_nums or {}) + if vim.tbl_isempty(logs) then + return true + end + local tab_num = vim.fn.tabpagenr() + local last_tab = vim.fn.tabpagenr "$" + local is_log = is_ft(buf, "log") + if last_tab == 1 then + return true + end + -- only show log buffers in secondary tabs + return (tab_num == last_tab and is_log) or (tab_num ~= last_tab and not is_log) +end + +M.config = function() + lvim.builtin.bufferline = { + active = true, + on_config_done = nil, + keymap = { + normal_mode = {}, + }, + highlights = { + background = { + italic = true, + }, + buffer_selected = { + bold = true, + }, + }, + options = { + themable = true, -- whether or not bufferline highlights can be overridden externally + -- style_preset = preset, + get_element_icon = nil, + show_duplicate_prefix = true, + duplicates_across_groups = true, + auto_toggle_bufferline = true, + move_wraps_at_ends = false, + groups = { items = {}, options = { toggle_hidden_on_enter = true } }, + mode = "buffers", -- set to "tabs" to only show tabpages instead + numbers = "none", -- can be "none" | "ordinal" | "buffer_id" | "both" | function + close_command = function(bufnr) -- can be a string | function, see "Mouse actions" + M.buf_kill("bd", bufnr, false) + end, + right_mouse_command = "vert sbuffer %d", -- can be a string | function, see "Mouse actions" + left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions" + middle_mouse_command = nil, -- can be a string | function, see "Mouse actions" + indicator = { + icon = lvim.icons.ui.BoldLineLeft, -- this should be omitted if indicator style is not 'icon' + style = "icon", -- can also be 'underline'|'none', + }, + buffer_close_icon = lvim.icons.ui.Close, + modified_icon = lvim.icons.ui.Circle, + close_icon = lvim.icons.ui.BoldClose, + left_trunc_marker = lvim.icons.ui.ArrowCircleLeft, + right_trunc_marker = lvim.icons.ui.ArrowCircleRight, + --- name_formatter can be used to change the buffer's label in the bufferline. + --- Please note some names can/will break the + --- bufferline so use this at your discretion knowing that it has + --- some limitations that will *NOT* be fixed. + name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr" + -- remove extension from markdown files for example + if buf.name:match "%.md" then + return vim.fn.fnamemodify(buf.name, ":t:r") + end + end, + max_name_length = 18, + max_prefix_length = 15, -- prefix used when a buffer is de-duplicated + truncate_names = true, -- whether or not tab names should be truncated + tab_size = 18, + diagnostics = "nvim_lsp", + diagnostics_update_in_insert = false, + diagnostics_indicator = diagnostics_indicator, + -- NOTE: this will be called a lot so don't do any heavy processing here + custom_filter = custom_filter, + offsets = { + { + filetype = "undotree", + text = "Undotree", + highlight = "PanelHeading", + padding = 1, + }, + { + filetype = "NvimTree", + text = "Explorer", + highlight = "PanelHeading", + padding = 1, + }, + { + filetype = "DiffviewFiles", + text = "Diff View", + highlight = "PanelHeading", + padding = 1, + }, + { + filetype = "flutterToolsOutline", + text = "Flutter Outline", + highlight = "PanelHeading", + }, + { + filetype = "lazy", + text = "Lazy", + highlight = "PanelHeading", + padding = 1, + }, + }, + color_icons = true, -- whether or not to add the filetype icon highlights + show_buffer_icons = lvim.use_icons, -- disable filetype icons for buffers + show_buffer_close_icons = lvim.use_icons, + show_close_icon = false, + show_tab_indicators = true, + persist_buffer_sort = true, -- whether or not custom sorted buffers should persist + -- can also be a table containing 2 custom separators + -- [focused and unfocused]. eg: { '|', '|' } + separator_style = "thin", + enforce_regular_tabs = false, + always_show_bufferline = false, + hover = { + enabled = false, -- requires nvim 0.8+ + delay = 200, + reveal = { "close" }, + }, + sort_by = "id", + debug = { logging = false }, + }, + } +end + +M.setup = function() + require("lvim.keymappings").load(lvim.builtin.bufferline.keymap) + + local status_ok, bufferline = pcall(require, "bufferline") + if not status_ok then + return + end + + -- can't be set in settings.lua because default tabline would flash before bufferline is loaded + vim.opt.showtabline = 2 + + bufferline.setup { + options = lvim.builtin.bufferline.options, + highlights = lvim.builtin.bufferline.highlights, + } + + if lvim.builtin.bufferline.on_config_done then + lvim.builtin.bufferline.on_config_done() + end +end + +--stylua: ignore + +-- Common kill function for bdelete and bwipeout +-- credits: based on bbye and nvim-bufdel +---@param kill_command? string defaults to "bd" +---@param bufnr? number defaults to the current buffer +---@param force? boolean defaults to false +function M.buf_kill(kill_command, bufnr, force) + kill_command = kill_command or "bd" + + local bo = vim.bo + local api = vim.api + local fmt = string.format + local fn = vim.fn + + if bufnr == 0 or bufnr == nil then + bufnr = api.nvim_get_current_buf() + end + + local bufname = api.nvim_buf_get_name(bufnr) + + if not force then + local choice + if bo[bufnr].modified then + choice = fn.confirm(fmt([[Save changes to "%s"?]], bufname), "&Yes\n&No\n&Cancel") + if choice == 1 then + vim.api.nvim_buf_call(bufnr, function() + vim.cmd("w") + end) + elseif choice == 2 then + force = true + else return + end + elseif api.nvim_get_option_value("buftype", { buf = 0 }) == "terminal" then + choice = fn.confirm(fmt([[Close "%s"?]], bufname), "&Yes\n&No\n&Cancel") + if choice == 1 then + force = true + else + return + end + end + end + + -- Get list of windows IDs with the buffer to close + local windows = vim.tbl_filter(function(win) + return api.nvim_win_get_buf(win) == bufnr + end, api.nvim_list_wins()) + + if force then + kill_command = kill_command .. "!" + end + + -- Get list of active buffers + local buffers = vim.tbl_filter(function(buf) + return api.nvim_buf_is_valid(buf) and bo[buf].buflisted + end, api.nvim_list_bufs()) + + -- If there is only one buffer (which has to be the current one), vim will + -- create a new buffer on :bd. + -- For more than one buffer, pick the previous buffer (wrapping around if necessary) + if #buffers > 1 and #windows > 0 then + for i, v in ipairs(buffers) do + if v == bufnr then + local prev_buf_idx = i == 1 and #buffers or (i - 1) + local prev_buffer = buffers[prev_buf_idx] + for _, win in ipairs(windows) do + api.nvim_win_set_buf(win, prev_buffer) + end + end + end + end + + -- Check if buffer still exists, to ensure the target buffer wasn't killed + -- due to options like bufhidden=wipe. + if api.nvim_buf_is_valid(bufnr) and bo[bufnr].buflisted then + vim.cmd(string.format("%s %d", kill_command, bufnr)) + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/builtins/init.lua b/mac/.config/LunarVim/lua/lvim/core/builtins/init.lua new file mode 100644 index 0000000..4764ff7 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/builtins/init.lua @@ -0,0 +1,34 @@ +local M = {} + +local builtins = { + "lvim.core.theme", + "lvim.core.which-key", + "lvim.core.gitsigns", + "lvim.core.cmp", + "lvim.core.dap", + "lvim.core.terminal", + "lvim.core.telescope", + "lvim.core.treesitter", + "lvim.core.nvimtree", + "lvim.core.lir", + "lvim.core.illuminate", + "lvim.core.indentlines", + "lvim.core.breadcrumbs", + "lvim.core.project", + "lvim.core.bufferline", + "lvim.core.autopairs", + "lvim.core.comment", + "lvim.core.lualine", + "lvim.core.alpha", + "lvim.core.mason", +} + +function M.config(config) + for _, builtin_path in ipairs(builtins) do + local builtin = reload(builtin_path) + + builtin.config(config) + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/cmp.lua b/mac/.config/LunarVim/lua/lvim/core/cmp.lua new file mode 100644 index 0000000..38da87a --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/cmp.lua @@ -0,0 +1,390 @@ +local M = {} +M.methods = {} + +local has_words_before = function() + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil +end +M.methods.has_words_before = has_words_before + +---@deprecated use M.methods.has_words_before instead +M.methods.check_backspace = function() + return not has_words_before() +end + +local T = function(str) + return vim.api.nvim_replace_termcodes(str, true, true, true) +end + +local function feedkeys(key, mode) + vim.api.nvim_feedkeys(T(key), mode, true) +end + +M.methods.feedkeys = feedkeys + +---when inside a snippet, seeks to the nearest luasnip field if possible, and checks if it is jumpable +---@param dir number 1 for forward, -1 for backward; defaults to 1 +---@return boolean true if a jumpable luasnip field is found while inside a snippet +local function jumpable(dir) + local luasnip_ok, luasnip = pcall(require, "luasnip") + if not luasnip_ok then + return false + end + + local win_get_cursor = vim.api.nvim_win_get_cursor + local get_current_buf = vim.api.nvim_get_current_buf + + ---sets the current buffer's luasnip to the one nearest the cursor + ---@return boolean true if a node is found, false otherwise + local function seek_luasnip_cursor_node() + -- TODO(kylo252): upstream this + -- for outdated versions of luasnip + if not luasnip.session.current_nodes then + return false + end + + local node = luasnip.session.current_nodes[get_current_buf()] + if not node then + return false + end + + local snippet = node.parent.snippet + local exit_node = snippet.insert_nodes[0] + + local pos = win_get_cursor(0) + pos[1] = pos[1] - 1 + + -- exit early if we're past the exit node + if exit_node then + local exit_pos_end = exit_node.mark:pos_end() + if (pos[1] > exit_pos_end[1]) or (pos[1] == exit_pos_end[1] and pos[2] > exit_pos_end[2]) then + snippet:remove_from_jumplist() + luasnip.session.current_nodes[get_current_buf()] = nil + + return false + end + end + + node = snippet.inner_first:jump_into(1, true) + while node ~= nil and node.next ~= nil and node ~= snippet do + local n_next = node.next + local next_pos = n_next and n_next.mark:pos_begin() + local candidate = n_next ~= snippet and next_pos and (pos[1] < next_pos[1]) + or (pos[1] == next_pos[1] and pos[2] < next_pos[2]) + + -- Past unmarked exit node, exit early + if n_next == nil or n_next == snippet.next then + snippet:remove_from_jumplist() + luasnip.session.current_nodes[get_current_buf()] = nil + + return false + end + + if candidate then + luasnip.session.current_nodes[get_current_buf()] = node + return true + end + + local ok + ok, node = pcall(node.jump_from, node, 1, true) -- no_move until last stop + if not ok then + snippet:remove_from_jumplist() + luasnip.session.current_nodes[get_current_buf()] = nil + + return false + end + end + + -- No candidate, but have an exit node + if exit_node then + -- to jump to the exit node, seek to snippet + luasnip.session.current_nodes[get_current_buf()] = snippet + return true + end + + -- No exit node, exit from snippet + snippet:remove_from_jumplist() + luasnip.session.current_nodes[get_current_buf()] = nil + return false + end + + if dir == -1 then + return luasnip.in_snippet() and luasnip.jumpable(-1) + else + return luasnip.in_snippet() and seek_luasnip_cursor_node() and luasnip.jumpable(1) + end +end + +M.methods.jumpable = jumpable + +M.config = function() + local status_cmp_ok, cmp_types = pcall(require, "cmp.types.cmp") + if not status_cmp_ok then + return + end + local ConfirmBehavior = cmp_types.ConfirmBehavior + local SelectBehavior = cmp_types.SelectBehavior + + local cmp = require("lvim.utils.modules").require_on_index "cmp" + local luasnip = require("lvim.utils.modules").require_on_index "luasnip" + local cmp_window = require "cmp.config.window" + local cmp_mapping = require "cmp.config.mapping" + + lvim.builtin.cmp = { + active = true, + on_config_done = nil, + enabled = function() + local buftype = vim.api.nvim_get_option_value("buftype", { buf = 0 }) + if buftype == "prompt" then + return false + end + return lvim.builtin.cmp.active + end, + confirm_opts = { + behavior = ConfirmBehavior.Replace, + select = false, + }, + completion = { + ---@usage The minimum length of a word to complete on. + keyword_length = 1, + }, + experimental = { + ghost_text = false, + native_menu = false, + }, + formatting = { + fields = { "kind", "abbr", "menu" }, + max_width = 0, + kind_icons = lvim.icons.kind, + source_names = { + nvim_lsp = "(LSP)", + emoji = "(Emoji)", + path = "(Path)", + calc = "(Calc)", + cmp_tabnine = "(Tabnine)", + vsnip = "(Snippet)", + luasnip = "(Snippet)", + buffer = "(Buffer)", + tmux = "(TMUX)", + copilot = "(Copilot)", + codeium = "(Codeium)", + treesitter = "(TreeSitter)", + }, + duplicates = { + buffer = 1, + path = 1, + nvim_lsp = 0, + luasnip = 1, + }, + duplicates_default = 0, + format = function(entry, vim_item) + local max_width = lvim.builtin.cmp.formatting.max_width + if max_width ~= 0 and #vim_item.abbr > max_width then + vim_item.abbr = string.sub(vim_item.abbr, 1, max_width - 1) .. lvim.icons.ui.Ellipsis + end + if lvim.use_icons then + vim_item.kind = lvim.builtin.cmp.formatting.kind_icons[vim_item.kind] + + if entry.source.name == "copilot" then + vim_item.kind = lvim.icons.git.Octoface + vim_item.kind_hl_group = "CmpItemKindCopilot" + end + + if entry.source.name == "codeium" then + vim_item.kind = lvim.icons.misc.Watch + vim_item.kind_hl_group = "CmpItemKindCopilot" + end + + if entry.source.name == "cmp_tabnine" then + vim_item.kind = lvim.icons.misc.Robot + vim_item.kind_hl_group = "CmpItemKindTabnine" + end + + if entry.source.name == "crates" then + vim_item.kind = lvim.icons.misc.Package + vim_item.kind_hl_group = "CmpItemKindCrate" + end + + if entry.source.name == "lab.quick_data" then + vim_item.kind = lvim.icons.misc.CircuitBoard + vim_item.kind_hl_group = "CmpItemKindConstant" + end + + if entry.source.name == "emoji" then + vim_item.kind = lvim.icons.misc.Smiley + vim_item.kind_hl_group = "CmpItemKindEmoji" + end + end + vim_item.menu = lvim.builtin.cmp.formatting.source_names[entry.source.name] + vim_item.dup = lvim.builtin.cmp.formatting.duplicates[entry.source.name] + or lvim.builtin.cmp.formatting.duplicates_default + return vim_item + end, + }, + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + window = { + completion = cmp_window.bordered(), + documentation = cmp_window.bordered(), + }, + sources = { + { + name = "copilot", + -- keyword_length = 0, + max_item_count = 3, + trigger_characters = { + { + ".", + ":", + "(", + "'", + '"', + "[", + ",", + "#", + "*", + "@", + "|", + "=", + "-", + "{", + "/", + "\\", + "+", + "?", + " ", + -- "\t", + -- "\n", + }, + }, + }, + { + name = "nvim_lsp", + entry_filter = function(entry, ctx) + local kind = require("cmp.types.lsp").CompletionItemKind[entry:get_kind()] + if kind == "Snippet" and ctx.prev_context.filetype == "java" then + return false + end + return true + end, + }, + + { name = "codeium" }, -- for codeium completion + { name = "path" }, + { name = "luasnip" }, + { name = "cmp_tabnine" }, + { name = "nvim_lua" }, + { name = "buffer" }, + { name = "calc" }, + { name = "emoji" }, + { name = "treesitter" }, + { name = "crates" }, + { name = "tmux" }, + }, + mapping = cmp_mapping.preset.insert { + [""] = cmp_mapping(cmp_mapping.select_prev_item(), { "i", "c" }), + [""] = cmp_mapping(cmp_mapping.select_next_item(), { "i", "c" }), + [""] = cmp_mapping(cmp_mapping.select_next_item { behavior = SelectBehavior.Select }, { "i" }), + [""] = cmp_mapping(cmp_mapping.select_prev_item { behavior = SelectBehavior.Select }, { "i" }), + [""] = cmp_mapping.scroll_docs(-4), + [""] = cmp_mapping.scroll_docs(4), + [""] = cmp_mapping { + i = cmp_mapping.confirm { behavior = ConfirmBehavior.Replace, select = false }, + c = function(fallback) + if cmp.visible() then + cmp.confirm { behavior = ConfirmBehavior.Replace, select = false } + else + fallback() + end + end, + }, + [""] = cmp_mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + elseif jumpable(1) then + luasnip.jump(1) + elseif has_words_before() then + -- cmp.complete() + 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.complete(), + [""] = cmp_mapping.abort(), + [""] = cmp_mapping(function(fallback) + if cmp.visible() then + local confirm_opts = vim.deepcopy(lvim.builtin.cmp.confirm_opts) -- avoid mutating the original opts below + local is_insert_mode = function() + return vim.api.nvim_get_mode().mode:sub(1, 1) == "i" + end + if is_insert_mode() then -- prevent overwriting brackets + confirm_opts.behavior = ConfirmBehavior.Insert + end + local entry = cmp.get_selected_entry() + local is_copilot = entry and entry.source.name == "copilot" + if is_copilot then + confirm_opts.behavior = ConfirmBehavior.Replace + confirm_opts.select = true + end + if cmp.confirm(confirm_opts) then + return -- success, exit early + end + end + fallback() -- if not exited early, always fallback + end), + }, + cmdline = { + enable = false, + options = { + { + type = ":", + sources = { + { name = "path" }, + { name = "cmdline" }, + }, + }, + { + type = { "/", "?" }, + sources = { + { name = "buffer" }, + }, + }, + }, + }, + } +end + +function M.setup() + local cmp = require "cmp" + cmp.setup(lvim.builtin.cmp) + + if lvim.builtin.cmp.cmdline.enable then + for _, option in ipairs(lvim.builtin.cmp.cmdline.options) do + cmp.setup.cmdline(option.type, { + mapping = cmp.mapping.preset.cmdline(), + sources = option.sources, + }) + end + end + + if lvim.builtin.cmp.on_config_done then + lvim.builtin.cmp.on_config_done(cmp) + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/commands.lua b/mac/.config/LunarVim/lua/lvim/core/commands.lua new file mode 100644 index 0000000..9f5d004 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/commands.lua @@ -0,0 +1,99 @@ +local M = {} + +vim.cmd [[ + function! QuickFixToggle() + if empty(filter(getwininfo(), 'v:val.quickfix')) + copen + else + cclose + endif + endfunction +]] + +M.defaults = { + { + name = "BufferKill", + fn = function() + require("lvim.core.bufferline").buf_kill "bd" + end, + }, + { + name = "LvimToggleFormatOnSave", + fn = function() + require("lvim.core.autocmds").toggle_format_on_save() + end, + }, + { + name = "LvimInfo", + fn = function() + require("lvim.core.info").toggle_popup(vim.bo.filetype) + end, + }, + { + name = "LvimDocs", + fn = function() + local documentation_url = "https://www.lunarvim.org/docs/beginners-guide" + if vim.fn.has "mac" == 1 or vim.fn.has "macunix" == 1 then + vim.fn.execute("!open " .. documentation_url) + elseif vim.fn.has "win32" == 1 or vim.fn.has "win64" == 1 then + vim.fn.execute("!start " .. documentation_url) + elseif vim.fn.has "unix" == 1 then + vim.fn.execute("!xdg-open " .. documentation_url) + else + vim.notify "Opening docs in a browser is not supported on your OS" + end + end, + }, + { + name = "LvimCacheReset", + fn = function() + require("lvim.utils.hooks").reset_cache() + end, + }, + { + name = "LvimReload", + fn = function() + require("lvim.config"):reload() + end, + }, + { + name = "LvimUpdate", + fn = function() + require("lvim.bootstrap"):update() + end, + }, + { + name = "LvimSyncCorePlugins", + fn = function() + require("lvim.plugin-loader").sync_core_plugins() + end, + }, + { + name = "LvimChangelog", + fn = function() + require("lvim.core.telescope.custom-finders").view_lunarvim_changelog() + end, + }, + { + name = "LvimVersion", + fn = function() + print(require("lvim.utils.git").get_lvim_version()) + end, + }, + { + name = "LvimOpenlog", + fn = function() + vim.fn.execute("edit " .. require("lvim.core.log").get_path()) + end, + }, +} + +function M.load(collection) + local common_opts = { force = true } + for _, cmd in pairs(collection) do + local opts = vim.tbl_deep_extend("force", common_opts, cmd.opts or {}) + vim.api.nvim_create_user_command(cmd.name, cmd.fn, opts) + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/comment.lua b/mac/.config/LunarVim/lua/lvim/core/comment.lua new file mode 100644 index 0000000..f07929c --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/comment.lua @@ -0,0 +1,86 @@ +local M = {} + +function M.config() + lvim.builtin.comment = { + active = true, + on_config_done = nil, + ---Add a space b/w comment and the line + ---@type boolean + padding = true, + + ---Whether cursor should stay at the + ---same position. Only works in NORMAL + ---mode mappings + sticky = true, + + ---Lines to be ignored while comment/uncomment. + ---Could be a regex string or a function that returns a regex string. + ---Example: Use '^$' to ignore empty lines + ---@type string|function + ignore = "^$", + + ---Whether to create basic (operator-pending) and extra mappings for NORMAL/VISUAL mode + ---@type table + mappings = { + ---operator-pending mapping + ---Includes `gcc`, `gcb`, `gc[count]{motion}` and `gb[count]{motion}` + basic = true, + ---Extra mapping + ---Includes `gco`, `gcO`, `gcA` + extra = true, + }, + + ---LHS of line and block comment toggle mapping in NORMAL/VISUAL mode + ---@type table + toggler = { + ---line-comment toggle + line = "gcc", + ---block-comment toggle + block = "gbc", + }, + + ---LHS of line and block comment operator-mode mapping in NORMAL/VISUAL mode + ---@type table + opleader = { + ---line-comment opfunc mapping + line = "gc", + ---block-comment opfunc mapping + block = "gb", + }, + + ---LHS of extra mappings + ---@type table + extra = { + ---Add comment on the line above + above = "gcO", + ---Add comment on the line below + below = "gco", + ---Add comment at the end of line + eol = "gcA", + }, + + ---Pre-hook, called before commenting the line + ---@type function|nil + pre_hook = function(...) + local loaded, ts_comment = pcall(require, "ts_context_commentstring.integrations.comment_nvim") + if loaded and ts_comment then + return ts_comment.create_pre_hook()(...) + end + end, + + ---Post-hook, called after commenting is done + ---@type function|nil + post_hook = nil, + } +end + +function M.setup() + local nvim_comment = require "Comment" + + nvim_comment.setup(lvim.builtin.comment) + if lvim.builtin.comment.on_config_done then + lvim.builtin.comment.on_config_done(nvim_comment) + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/dap.lua b/mac/.config/LunarVim/lua/lvim/core/dap.lua new file mode 100644 index 0000000..1c563e3 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/dap.lua @@ -0,0 +1,177 @@ +local M = {} + +M.config = function() + lvim.builtin.dap = { + active = true, + on_config_done = nil, + breakpoint = { + text = lvim.icons.ui.Bug, + texthl = "DiagnosticSignError", + linehl = "", + numhl = "", + }, + breakpoint_rejected = { + text = lvim.icons.ui.Bug, + texthl = "DiagnosticSignError", + linehl = "", + numhl = "", + }, + stopped = { + text = lvim.icons.ui.BoldArrowRight, + texthl = "DiagnosticSignWarn", + linehl = "Visual", + numhl = "DiagnosticSignWarn", + }, + log = { + level = "info", + }, + ui = { + auto_open = true, + notify = { + threshold = vim.log.levels.INFO, + }, + config = { + icons = { expanded = "", collapsed = "", circular = "" }, + mappings = { + -- Use a table to apply multiple mappings + expand = { "", "<2-LeftMouse>" }, + open = "o", + remove = "d", + edit = "e", + repl = "r", + toggle = "t", + }, + -- Use this to override mappings for specific elements + element_mappings = {}, + expand_lines = true, + layouts = { + { + elements = { + { id = "scopes", size = 0.33 }, + { id = "breakpoints", size = 0.17 }, + { id = "stacks", size = 0.25 }, + { id = "watches", size = 0.25 }, + }, + size = 0.33, + position = "right", + }, + { + elements = { + { id = "repl", size = 0.45 }, + { id = "console", size = 0.55 }, + }, + size = 0.27, + position = "bottom", + }, + }, + controls = { + enabled = true, + -- Display controls in this element + element = "repl", + icons = { + pause = "", + play = "", + step_into = "", + step_over = "", + step_out = "", + step_back = "", + run_last = "", + terminate = "", + }, + }, + floating = { + max_height = 0.9, + max_width = 0.5, -- Floats will be treated as percentage of your screen. + border = "rounded", + mappings = { + close = { "q", "" }, + }, + }, + windows = { indent = 1 }, + render = { + max_type_length = nil, -- Can be integer or nil. + max_value_lines = 100, -- Can be integer or nil. + }, + }, + }, + } +end + +M.setup = function() + local status_ok, dap = pcall(require, "dap") + if not status_ok then + return + end + + if lvim.use_icons then + vim.fn.sign_define("DapBreakpoint", lvim.builtin.dap.breakpoint) + vim.fn.sign_define("DapBreakpointRejected", lvim.builtin.dap.breakpoint_rejected) + vim.fn.sign_define("DapStopped", lvim.builtin.dap.stopped) + end + + dap.set_log_level(lvim.builtin.dap.log.level) + + if lvim.builtin.dap.on_config_done then + lvim.builtin.dap.on_config_done(dap) + end +end + +M.setup_ui = function() + local status_ok, dap = pcall(require, "dap") + if not status_ok then + return + end + local dapui = require "dapui" + dapui.setup(lvim.builtin.dap.ui.config) + + if lvim.builtin.dap.ui.auto_open then + dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open() + end + -- dap.listeners.before.event_terminated["dapui_config"] = function() + -- dapui.close() + -- end + -- dap.listeners.before.event_exited["dapui_config"] = function() + -- dapui.close() + -- end + end + + local Log = require "lvim.core.log" + + -- until rcarriga/nvim-dap-ui#164 is fixed + local function notify_handler(msg, level, opts) + if level >= lvim.builtin.dap.ui.notify.threshold then + return vim.notify(msg, level, opts) + end + + opts = vim.tbl_extend("keep", opts or {}, { + title = "dap-ui", + icon = "", + on_open = function(win) + vim.api.nvim_set_option_value("filetype", "markdown", { buf = vim.api.nvim_win_get_buf(win) }) + end, + }) + + -- vim_log_level can be omitted + if level == nil then + level = Log.levels["INFO"] + elseif type(level) == "string" then + level = Log.levels[(level):upper()] or Log.levels["INFO"] + else + -- https://github.com/neovim/neovim/blob/685cf398130c61c158401b992a1893c2405cd7d2/runtime/lua/vim/lsp/log.lua#L5 + level = level + 1 + end + + msg = string.format("%s: %s", opts.title, msg) + Log:add_entry(level, msg) + end + + local dapui_ok, _ = xpcall(function() + require("dapui.util").notify = notify_handler + end, debug.traceback) + if not dapui_ok then + Log:debug "Unable to override dap-ui logging level" + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/gitsigns.lua b/mac/.config/LunarVim/lua/lvim/core/gitsigns.lua new file mode 100644 index 0000000..1c8619c --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/gitsigns.lua @@ -0,0 +1,83 @@ +local M = {} + +M.config = function() + lvim.builtin.gitsigns = { + active = true, + on_config_done = nil, + opts = { + signs = { + add = { + hl = "GitSignsAdd", + text = lvim.icons.ui.BoldLineLeft, + numhl = "GitSignsAddNr", + linehl = "GitSignsAddLn", + }, + change = { + hl = "GitSignsChange", + text = lvim.icons.ui.BoldLineLeft, + numhl = "GitSignsChangeNr", + linehl = "GitSignsChangeLn", + }, + delete = { + hl = "GitSignsDelete", + text = lvim.icons.ui.Triangle, + numhl = "GitSignsDeleteNr", + linehl = "GitSignsDeleteLn", + }, + topdelete = { + hl = "GitSignsDelete", + text = lvim.icons.ui.Triangle, + numhl = "GitSignsDeleteNr", + linehl = "GitSignsDeleteLn", + }, + changedelete = { + hl = "GitSignsChange", + text = lvim.icons.ui.BoldLineLeft, + numhl = "GitSignsChangeNr", + linehl = "GitSignsChangeLn", + }, + }, + signcolumn = true, + numhl = false, + linehl = false, + word_diff = false, + watch_gitdir = { + interval = 1000, + follow_files = true, + }, + attach_to_untracked = true, + current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' + delay = 1000, + ignore_whitespace = false, + }, + current_line_blame_formatter = ", - ", + sign_priority = 6, + status_formatter = nil, -- Use default + update_debounce = 200, + max_file_length = 40000, + preview_config = { + -- Options passed to nvim_open_win + border = "rounded", + style = "minimal", + relative = "cursor", + row = 0, + col = 1, + }, + yadm = { enable = false }, + }, + } +end + +M.setup = function() + local gitsigns = reload "gitsigns" + + gitsigns.setup(lvim.builtin.gitsigns.opts) + if lvim.builtin.gitsigns.on_config_done then + lvim.builtin.gitsigns.on_config_done(gitsigns) + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/illuminate.lua b/mac/.config/LunarVim/lua/lvim/core/illuminate.lua new file mode 100644 index 0000000..7264710 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/illuminate.lua @@ -0,0 +1,72 @@ +local M = {} + +M.config = function() + lvim.builtin.illuminate = { + active = true, + on_config_done = nil, + options = { + -- providers: provider used to get references in the buffer, ordered by priority + providers = { + "lsp", + "treesitter", + "regex", + }, + -- delay: delay in milliseconds + delay = 120, + -- filetype_overrides: filetype specific overrides. + -- The keys are strings to represent the filetype while the values are tables that + -- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist + filetype_overrides = {}, + -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist + filetypes_denylist = { + "dirvish", + "fugitive", + "alpha", + "NvimTree", + "lazy", + "neogitstatus", + "Trouble", + "lir", + "Outline", + "spectre_panel", + "toggleterm", + "DressingSelect", + "TelescopePrompt", + }, + -- filetypes_allowlist: filetypes to illuminate, this is overridden by filetypes_denylist + filetypes_allowlist = {}, + -- modes_denylist: modes to not illuminate, this overrides modes_allowlist + modes_denylist = {}, + -- modes_allowlist: modes to illuminate, this is overridden by modes_denylist + modes_allowlist = {}, + -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_denylist = {}, + -- providers_regex_syntax_allowlist: syntax to illuminate, this is overridden by providers_regex_syntax_denylist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_allowlist = {}, + -- under_cursor: whether or not to illuminate under the cursor + under_cursor = true, + }, + } +end + +M.setup = function() + local status_ok, illuminate = pcall(require, "illuminate") + if not status_ok then + return + end + + local config_ok, _ = pcall(illuminate.configure, lvim.builtin.illuminate.options) + if not config_ok then + return + end + + if lvim.builtin.illuminate.on_config_done then + lvim.builtin.illuminate.on_config_done() + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/indentlines.lua b/mac/.config/LunarVim/lua/lvim/core/indentlines.lua new file mode 100644 index 0000000..ad82753 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/indentlines.lua @@ -0,0 +1,43 @@ +local M = {} + +M.config = function() + lvim.builtin.indentlines = { + active = true, + on_config_done = nil, + options = { + enabled = true, + buftype_exclude = { "terminal", "nofile" }, + filetype_exclude = { + "help", + "startify", + "dashboard", + "lazy", + "neogitstatus", + "NvimTree", + "Trouble", + "text", + }, + char = lvim.icons.ui.LineLeft, + context_char = lvim.icons.ui.LineLeft, + show_trailing_blankline_indent = false, + show_first_indent_level = true, + use_treesitter = true, + show_current_context = true, + }, + } +end + +M.setup = function() + local status_ok, indent_blankline = pcall(require, "indent_blankline") + if not status_ok then + return + end + + indent_blankline.setup(lvim.builtin.indentlines.options) + + if lvim.builtin.indentlines.on_config_done then + lvim.builtin.indentlines.on_config_done() + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/info.lua b/mac/.config/LunarVim/lua/lvim/core/info.lua new file mode 100644 index 0000000..c12edc3 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/info.lua @@ -0,0 +1,222 @@ +local M = { + banner = { + "", + [[ __ _ ___ ]], + [[ / / __ ______ ____ _____| | / (_)___ ___ ]], + [[ / / / / / / __ \/ __ `/ ___/ | / / / __ `__ \]], + [[ / /___/ /_/ / / / / /_/ / / | |/ / / / / / / /]], + [[/_____/\__,_/_/ /_/\__,_/_/ |___/_/_/ /_/ /_/ ]], + }, +} + +local fmt = string.format +local text = require "lvim.interface.text" +local lsp_utils = require "lvim.lsp.utils" + +local function str_list(list) + return #list == 1 and list[1] or fmt("[%s]", table.concat(list, ", ")) +end + +local function make_formatters_info(ft) + local null_formatters = require "lvim.lsp.null-ls.formatters" + local registered_formatters = null_formatters.list_registered(ft) + local supported_formatters = null_formatters.list_supported(ft) + local section = { + "Formatters info", + fmt( + "* Active: %s%s", + table.concat(registered_formatters, " " .. lvim.icons.ui.BoxChecked .. " , "), + vim.tbl_count(registered_formatters) > 0 and " " .. lvim.icons.ui.BoxChecked .. " " or "" + ), + fmt("* Supported: %s", str_list(supported_formatters)), + } + + return section +end + +local function make_code_actions_info(ft) + local null_actions = require "lvim.lsp.null-ls.code_actions" + local registered_actions = null_actions.list_registered(ft) + local section = { + "Code actions info", + fmt( + "* Active: %s%s", + table.concat(registered_actions, " " .. lvim.icons.ui.BoxChecked .. " , "), + vim.tbl_count(registered_actions) > 0 and " " .. lvim.icons.ui.BoxChecked .. " " or "" + ), + } + + return section +end + +local function make_linters_info(ft) + local null_linters = require "lvim.lsp.null-ls.linters" + local supported_linters = null_linters.list_supported(ft) + local registered_linters = null_linters.list_registered(ft) + local section = { + "Linters info", + fmt( + "* Active: %s%s", + table.concat(registered_linters, " " .. lvim.icons.ui.BoxChecked .. " , "), + vim.tbl_count(registered_linters) > 0 and " " .. lvim.icons.ui.BoxChecked .. " " or "" + ), + fmt("* Supported: %s", str_list(supported_linters)), + } + + return section +end + +local function tbl_set_highlight(terms, highlight_group) + for _, v in pairs(terms) do + vim.cmd('let m=matchadd("' .. highlight_group .. '", "' .. v .. "[ ,│']\")") + vim.cmd('let m=matchadd("' .. highlight_group .. '", ", ' .. v .. '")') + end +end + +local function make_client_info(client) + if client.name == "null-ls" then + return + end + local client_enabled_caps = lsp_utils.get_client_capabilities(client.id) + local name = client.name + local id = client.id + local filetypes = lsp_utils.get_supported_filetypes(name) + local attached_buffers_list = str_list(vim.lsp.get_buffers_by_client_id(client.id)) + local client_info = { + fmt("* name: %s", name), + fmt("* id: %s", tostring(id)), + fmt("* supported filetype(s): %s", str_list(filetypes)), + fmt("* attached buffers: %s", tostring(attached_buffers_list)), + fmt("* root_dir pattern: %s", tostring(attached_buffers_list)), + } + if not vim.tbl_isempty(client_enabled_caps) then + local caps_text = "* capabilities: " + local caps_text_len = caps_text:len() + local enabled_caps = text.format_table(client_enabled_caps, 3, " | ") + enabled_caps = text.shift_right(enabled_caps, caps_text_len) + enabled_caps[1] = fmt("%s%s", caps_text, enabled_caps[1]:sub(caps_text_len + 1)) + vim.list_extend(client_info, enabled_caps) + end + + return client_info +end + +local function make_auto_lsp_info(ft) + local skipped_filetypes = lvim.lsp.automatic_configuration.skipped_filetypes + local skipped_servers = lvim.lsp.automatic_configuration.skipped_servers + local info_lines = { "Automatic LSP info" } + + if vim.tbl_contains(skipped_filetypes, ft) then + vim.list_extend(info_lines, { "* Status: disabled for " .. ft }) + return info_lines + end + + local supported = lsp_utils.get_supported_servers(ft) + local skipped = vim.tbl_filter(function(name) + return vim.tbl_contains(supported, name) + end, skipped_servers) + + if #skipped == 0 then + return { "" } + end + + vim.list_extend(info_lines, { fmt("* Skipped servers: %s", str_list(skipped)) }) + + return info_lines +end + +function M.toggle_popup(ft) + local clients = vim.lsp.get_clients() + local client_names = {} + local bufnr = vim.api.nvim_get_current_buf() + local ts_active_buffers = vim.tbl_keys(vim.treesitter.highlighter.active) + local is_treesitter_active = function() + local status = "inactive" + if vim.tbl_contains(ts_active_buffers, bufnr) then + status = "active" + end + return status + end + local header = { + "Buffer info", + fmt("* filetype: %s", ft), + fmt("* bufnr: %s", bufnr), + fmt("* treesitter status: %s", is_treesitter_active()), + } + + local lsp_info = { + "Active client(s)", + } + + for _, client in pairs(clients) do + local client_info = make_client_info(client) + if client_info then + vim.list_extend(lsp_info, client_info) + end + table.insert(client_names, client.name) + end + + local auto_lsp_info = make_auto_lsp_info(ft) + + local formatters_info = make_formatters_info(ft) + + local linters_info = make_linters_info(ft) + + local code_actions_info = make_code_actions_info(ft) + + local content_provider = function(popup) + local content = {} + + for _, section in ipairs { + M.banner, + { "" }, + { "" }, + header, + { "" }, + lsp_info, + { "" }, + auto_lsp_info, + { "" }, + formatters_info, + { "" }, + linters_info, + { "" }, + code_actions_info, + } do + vim.list_extend(content, section) + end + + return text.align_left(popup, content, 0.5) + end + + local function set_syntax_hl() + vim.cmd [[highlight LvimInfoIdentifier gui=bold]] + vim.cmd [[highlight link LvimInfoHeader Type]] + vim.fn.matchadd("LvimInfoHeader", "Buffer info") + vim.fn.matchadd("LvimInfoHeader", "Active client(s)") + vim.fn.matchadd("LvimInfoHeader", fmt("Overridden %s server(s)", ft)) + vim.fn.matchadd("LvimInfoHeader", "Formatters info") + vim.fn.matchadd("LvimInfoHeader", "Linters info") + vim.fn.matchadd("LvimInfoHeader", "Code actions info") + vim.fn.matchadd("LvimInfoHeader", "Automatic LSP info") + vim.fn.matchadd("LvimInfoIdentifier", " " .. ft .. "$") + vim.fn.matchadd("string", "true") + vim.fn.matchadd("string", "active") + vim.fn.matchadd("string", lvim.icons.ui.BoxChecked) + vim.fn.matchadd("boolean", "inactive") + vim.fn.matchadd("error", "false") + tbl_set_highlight(require("lvim.lsp.null-ls.formatters").list_registered(ft), "LvimInfoIdentifier") + tbl_set_highlight(require("lvim.lsp.null-ls.linters").list_registered(ft), "LvimInfoIdentifier") + tbl_set_highlight(require("lvim.lsp.null-ls.code_actions").list_registered(ft), "LvimInfoIdentifier") + end + + local Popup = require("lvim.interface.popup"):new { + win_opts = { number = false }, + buf_opts = { modifiable = false, filetype = "lspinfo" }, + } + Popup:display(content_provider) + set_syntax_hl() + + return Popup +end +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/lir.lua b/mac/.config/LunarVim/lua/lvim/core/lir.lua new file mode 100644 index 0000000..a8ed42c --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/lir.lua @@ -0,0 +1,120 @@ +local M = {} + +M.config = function() + local utils = require "lvim.utils.modules" + local actions = utils.require_on_exported_call "lir.actions" + local clipboard_actions = utils.require_on_exported_call "lir.clipboard.actions" + + lvim.builtin.lir = { + active = true, + on_config_done = nil, + icon = "", + show_hidden_files = false, + ignore = {}, -- { ".DS_Store" "node_modules" } etc. + devicons = { + enable = true, + highlight_dirname = true, + }, + mappings = { + ["l"] = actions.edit, + [""] = actions.edit, + [""] = actions.split, + ["v"] = actions.vsplit, + [""] = actions.tabedit, + + ["h"] = actions.up, + ["q"] = actions.quit, + + ["A"] = actions.mkdir, + ["a"] = actions.newfile, + ["r"] = actions.rename, + ["@"] = actions.cd, + ["Y"] = actions.yank_path, + ["i"] = actions.toggle_show_hidden, + ["d"] = actions.delete, + + ["J"] = function() + require("lir.mark.actions").toggle_mark() + vim.cmd "normal! j" + end, + ["c"] = clipboard_actions.copy, + ["x"] = clipboard_actions.cut, + ["p"] = clipboard_actions.paste, + }, + float = { + winblend = 0, + curdir_window = { + enable = false, + highlight_dirname = true, + }, + + -- You can define a function that returns a table to be passed as the third + -- argument of nvim_open_win(). + win_opts = function() + local width = math.floor(vim.o.columns * 0.7) + local height = math.floor(vim.o.lines * 0.7) + return { + border = "rounded", + width = width, + height = height, + } + end, + }, + hide_cursor = false, + on_init = function() + -- use visual mode + vim.api.nvim_buf_set_keymap( + 0, + "x", + "J", + ':lua require"lir.mark.actions".toggle_mark("v")', + { noremap = true, silent = true } + ) + end, + } +end + +function M.icon_setup() + local devicons_ok, devicons = pcall(require, "nvim-web-devicons") + if not devicons_ok then + return + end + + local function get_hl_by_name(name) + local ret = vim.api.nvim_get_hl(0, { name = name.group }) + return string.format("#%06x", ret[name.property]) + end + + local found, icon_color = pcall(get_hl_by_name, { group = "NvimTreeFolderIcon", property = "fg" }) + if not found then + icon_color = "#42A5F5" + end + + devicons.set_icon { + lir_folder_icon = { + icon = lvim.builtin.lir.icon, + color = icon_color, + name = "LirFolderNode", + }, + } +end + +function M.setup() + local status_ok, lir = pcall(require, "lir") + if not status_ok then + return + end + + if not lvim.use_icons then + lvim.builtin.lir.devicons.enable = false + end + + lir.setup(lvim.builtin.lir) + M.icon_setup() + + if lvim.builtin.lir.on_config_done then + lvim.builtin.lir.on_config_done(lir) + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/log.lua b/mac/.config/LunarVim/lua/lvim/core/log.lua new file mode 100644 index 0000000..ba92462 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/log.lua @@ -0,0 +1,203 @@ +local Log = {} + +Log.levels = { + TRACE = 1, + DEBUG = 2, + INFO = 3, + WARN = 4, + ERROR = 5, +} + +local notify_opts = {} +local log_notify_as_notification = false + +function Log:set_level(level) + if + not pcall(function() + local logger_ok, logger = pcall(function() + return require("structlog").get_logger "lvim" + end) + local log_level = Log.levels[level:upper()] + if logger_ok and logger and log_level then + for _, pipeline in ipairs(logger.pipelines) do + pipeline.level = log_level + end + end + end) + then + vim.notify "structlog version too old, run `:Lazy sync`" + end +end + +function Log:init() + local status_ok, structlog = pcall(require, "structlog") + if not status_ok then + return nil + end + + local log_level = Log.levels[(lvim.log.level):upper() or "WARN"] + structlog.configure { + lvim = { + pipelines = { + { + level = log_level, + processors = { + structlog.processors.StackWriter({ "line", "file" }, { max_parents = 0, stack_level = 2 }), + structlog.processors.Timestamper "%H:%M:%S", + }, + formatter = structlog.formatters.FormatColorizer( + "%s [%-5s] %s: %-30s", + { "timestamp", "level", "logger_name", "msg" }, + { level = structlog.formatters.FormatColorizer.color_level() } + ), + sink = structlog.sinks.Console(false), -- async=false + }, + { + level = log_level, + processors = { + structlog.processors.StackWriter({ "line", "file" }, { max_parents = 3, stack_level = 2 }), + structlog.processors.Timestamper "%F %H:%M:%S", + }, + formatter = structlog.formatters.Format( + "%s [%-5s] %s: %-30s", + { "timestamp", "level", "logger_name", "msg" } + ), + sink = structlog.sinks.File(self:get_path()), + }, + }, + }, + } + + local logger = structlog.get_logger "lvim" + + -- Overwrite `vim.notify` to use the logger + if lvim.log.override_notify then + vim.notify = function(msg, vim_log_level, opts) + notify_opts = opts or {} + + -- vim_log_level can be omitted + if vim_log_level == nil then + vim_log_level = Log.levels["INFO"] + elseif type(vim_log_level) == "string" then + vim_log_level = Log.levels[(vim_log_level):upper()] or Log.levels["INFO"] + else + -- https://github.com/neovim/neovim/blob/685cf398130c61c158401b992a1893c2405cd7d2/runtime/lua/vim/lsp/log.lua#L5 + vim_log_level = vim_log_level + 1 + end + + self:add_entry(vim_log_level, msg) + end + end + + return logger +end + +--- Configure the sink in charge of logging notifications +---@param nvim_notify table The nvim-notify instance +function Log:configure_notifications(nvim_notify) + local status_ok, structlog = pcall(require, "structlog") + if not status_ok then + return + end + + local function log_writer(log) + local opts = { title = log.logger_name } + opts = vim.tbl_deep_extend("force", opts, notify_opts) + notify_opts = {} + + if log_notify_as_notification then + nvim_notify(log.msg, log.level, opts) + end + end + + local notif_pipeline = structlog.Pipeline( + structlog.level.INFO, + {}, + structlog.formatters.Format("%s", { "msg" }, { blacklist_all = true }), + structlog.sinks.Adapter(log_writer) + ) + self.__handle:add_pipeline(notif_pipeline) +end + +--- Adds a log entry using Plenary.log +---@param level integer [same as vim.log.levels] +---@param msg any +---@param event any +function Log:add_entry(level, msg, event) + if + not pcall(function() + local logger = self:get_logger() + if not logger then + return + end + logger:log(level, vim.inspect(msg), event) + end) + then + vim.notify "structlog version too old, run `:Lazy sync`" + end +end + +---Retrieves the handle of the logger object +---@return table|nil logger handle if found +function Log:get_logger() + local logger_ok, logger = pcall(function() + return require("structlog").get_logger "lvim" + end) + if logger_ok and logger then + return logger + end + + logger = self:init() + + if not logger then + return + end + + self.__handle = logger + return logger +end + +---Retrieves the path of the logfile +---@return string path of the logfile +function Log:get_path() + return string.format("%s/%s.log", get_cache_dir(), "lvim") +end + +---Add a log entry at TRACE level +---@param msg any +---@param event any +function Log:trace(msg, event) + self:add_entry(self.levels.TRACE, msg, event) +end + +---Add a log entry at DEBUG level +---@param msg any +---@param event any +function Log:debug(msg, event) + self:add_entry(self.levels.DEBUG, msg, event) +end + +---Add a log entry at INFO level +---@param msg any +---@param event any +function Log:info(msg, event) + self:add_entry(self.levels.INFO, msg, event) +end + +---Add a log entry at WARN level +---@param msg any +---@param event any +function Log:warn(msg, event) + self:add_entry(self.levels.WARN, msg, event) +end + +---Add a log entry at ERROR level +---@param msg any +---@param event any +function Log:error(msg, event) + self:add_entry(self.levels.ERROR, msg, event) +end + +setmetatable({}, Log) + +return Log diff --git a/mac/.config/LunarVim/lua/lvim/core/lualine/colors.lua b/mac/.config/LunarVim/lua/lvim/core/lualine/colors.lua new file mode 100644 index 0000000..4984cd1 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/lualine/colors.lua @@ -0,0 +1,16 @@ +local colors = { + bg = "#202328", + fg = "#bbc2cf", + yellow = "#ECBE7B", + cyan = "#008080", + darkblue = "#081633", + green = "#98be65", + orange = "#FF8800", + violet = "#a9a1e1", + magenta = "#c678dd", + purple = "#c678dd", + blue = "#51afef", + red = "#ec5f67", +} + +return colors diff --git a/mac/.config/LunarVim/lua/lvim/core/lualine/components.lua b/mac/.config/LunarVim/lua/lvim/core/lualine/components.lua new file mode 100644 index 0000000..afcce6b --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/lualine/components.lua @@ -0,0 +1,174 @@ +local conditions = require "lvim.core.lualine.conditions" +local colors = require "lvim.core.lualine.colors" + +local function diff_source() + local gitsigns = vim.b.gitsigns_status_dict + if gitsigns then + return { + added = gitsigns.added, + modified = gitsigns.changed, + removed = gitsigns.removed, + } + end +end + +local branch = lvim.icons.git.Branch + +if lvim.colorscheme == "lunar" then + branch = "%#SLGitIcon#" .. lvim.icons.git.Branch .. "%*" .. "%#SLBranchName#" +end + +return { + mode = { + function() + return " " .. lvim.icons.ui.Target .. " " + end, + padding = { left = 0, right = 0 }, + color = {}, + cond = nil, + }, + branch = { + "b:gitsigns_head", + icon = branch, + color = { gui = "bold" }, + }, + filename = { + "filename", + color = {}, + cond = nil, + }, + diff = { + "diff", + source = diff_source, + symbols = { + added = lvim.icons.git.LineAdded .. " ", + modified = lvim.icons.git.LineModified .. " ", + removed = lvim.icons.git.LineRemoved .. " ", + }, + padding = { left = 2, right = 1 }, + diff_color = { + added = { fg = colors.green }, + modified = { fg = colors.yellow }, + removed = { fg = colors.red }, + }, + cond = nil, + }, + python_env = { + function() + local utils = require "lvim.core.lualine.utils" + if vim.bo.filetype == "python" then + local venv = os.getenv "CONDA_DEFAULT_ENV" or os.getenv "VIRTUAL_ENV" + if venv then + local icons = require "nvim-web-devicons" + local py_icon, _ = icons.get_icon ".py" + return string.format(" " .. py_icon .. " (%s)", utils.env_cleanup(venv)) + end + end + return "" + end, + color = { fg = colors.green }, + cond = conditions.hide_in_width, + }, + diagnostics = { + "diagnostics", + sources = { "nvim_diagnostic" }, + symbols = { + error = lvim.icons.diagnostics.BoldError .. " ", + warn = lvim.icons.diagnostics.BoldWarning .. " ", + info = lvim.icons.diagnostics.BoldInformation .. " ", + hint = lvim.icons.diagnostics.BoldHint .. " ", + }, + -- cond = conditions.hide_in_width, + }, + treesitter = { + function() + return lvim.icons.ui.Tree + end, + color = function() + local buf = vim.api.nvim_get_current_buf() + local ts = vim.treesitter.highlighter.active[buf] + return { fg = ts and not vim.tbl_isempty(ts) and colors.green or colors.red } + end, + cond = conditions.hide_in_width, + }, + lsp = { + function() + local buf_clients = vim.lsp.get_clients { bufnr = 0 } + if #buf_clients == 0 then + return "LSP Inactive" + end + + local buf_ft = vim.bo.filetype + local buf_client_names = {} + local copilot_active = false + + -- add client + for _, client in pairs(buf_clients) do + if client.name ~= "null-ls" and client.name ~= "copilot" then + table.insert(buf_client_names, client.name) + end + + if client.name == "copilot" then + copilot_active = true + end + end + + -- add formatter + local formatters = require "lvim.lsp.null-ls.formatters" + local supported_formatters = formatters.list_registered(buf_ft) + vim.list_extend(buf_client_names, supported_formatters) + + -- add linter + local linters = require "lvim.lsp.null-ls.linters" + local supported_linters = linters.list_registered(buf_ft) + vim.list_extend(buf_client_names, supported_linters) + + local unique_client_names = table.concat(buf_client_names, ", ") + local language_servers = string.format("[%s]", unique_client_names) + + if copilot_active then + language_servers = language_servers .. "%#SLCopilot#" .. " " .. lvim.icons.git.Octoface .. "%*" + end + + return language_servers + end, + color = { gui = "bold" }, + cond = conditions.hide_in_width, + }, + location = { "location" }, + progress = { + "progress", + fmt = function() + return "%P/%L" + end, + color = {}, + }, + + spaces = { + function() + local shiftwidth = vim.api.nvim_get_option_value("shiftwidth", { buf = 0 }) + return lvim.icons.ui.Tab .. " " .. shiftwidth + end, + padding = 1, + }, + encoding = { + "o:encoding", + fmt = string.upper, + color = {}, + cond = conditions.hide_in_width, + }, + filetype = { "filetype", cond = nil, padding = { left = 1, right = 1 } }, + scrollbar = { + function() + local current_line = vim.fn.line "." + local total_lines = vim.fn.line "$" + local chars = { "__", "▁▁", "▂▂", "▃▃", "▄▄", "▅▅", "▆▆", "▇▇", "██" } + local line_ratio = current_line / total_lines + local index = math.ceil(line_ratio * #chars) + return chars[index] + end, + padding = { left = 0, right = 0 }, + color = "SLProgress", + cond = nil, + }, +} diff --git a/mac/.config/LunarVim/lua/lvim/core/lualine/conditions.lua b/mac/.config/LunarVim/lua/lvim/core/lualine/conditions.lua new file mode 100644 index 0000000..42d52a8 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/lualine/conditions.lua @@ -0,0 +1,17 @@ +local window_width_limit = 100 + +local conditions = { + buffer_not_empty = function() + return vim.fn.empty(vim.fn.expand "%:t") ~= 1 + end, + hide_in_width = function() + return vim.o.columns > window_width_limit + end, + -- check_git_workspace = function() + -- local filepath = vim.fn.expand "%:p:h" + -- local gitdir = vim.fn.finddir(".git", filepath .. ";") + -- return gitdir and #gitdir > 0 and #gitdir < #filepath + -- end, +} + +return conditions diff --git a/mac/.config/LunarVim/lua/lvim/core/lualine/init.lua b/mac/.config/LunarVim/lua/lvim/core/lualine/init.lua new file mode 100644 index 0000000..fa4cf82 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/lualine/init.lua @@ -0,0 +1,57 @@ +local M = {} +M.config = function() + lvim.builtin.lualine = { + active = true, + style = "lvim", + options = { + icons_enabled = nil, + component_separators = nil, + section_separators = nil, + theme = nil, + disabled_filetypes = { statusline = { "alpha" } }, + globalstatus = true, + }, + sections = { + lualine_a = nil, + lualine_b = nil, + lualine_c = nil, + lualine_x = nil, + lualine_y = nil, + lualine_z = nil, + }, + inactive_sections = { + lualine_a = nil, + lualine_b = nil, + lualine_c = nil, + lualine_x = nil, + lualine_y = nil, + lualine_z = nil, + }, + tabline = nil, + extensions = nil, + on_config_done = nil, + } +end + +M.setup = function() + if #vim.api.nvim_list_uis() == 0 then + local Log = require "lvim.core.log" + Log:debug "headless mode detected, skipping running setup for lualine" + return + end + + local status_ok, lualine = pcall(require, "lualine") + if not status_ok then + return + end + + require("lvim.core.lualine.styles").update() + + lualine.setup(lvim.builtin.lualine) + + if lvim.builtin.lualine.on_config_done then + lvim.builtin.lualine.on_config_done(lualine) + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/lualine/styles.lua b/mac/.config/LunarVim/lua/lvim/core/lualine/styles.lua new file mode 100644 index 0000000..81dbbab --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/lualine/styles.lua @@ -0,0 +1,165 @@ +local M = {} +local components = require "lvim.core.lualine.components" + +local styles = { + lvim = nil, + default = nil, + none = nil, +} + +styles.none = { + style = "none", + options = { + theme = "auto", + globalstatus = true, + icons_enabled = lvim.use_icons, + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, + disabled_filetypes = {}, + }, + sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {}, + lualine_x = {}, + lualine_y = {}, + lualine_z = {}, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {}, + lualine_x = {}, + lualine_y = {}, + lualine_z = {}, + }, + tabline = {}, + extensions = {}, +} + +styles.default = { + style = "default", + options = { + theme = "auto", + globalstatus = true, + icons_enabled = lvim.use_icons, + component_separators = { + left = lvim.icons.ui.DividerRight, + right = lvim.icons.ui.DividerLeft, + }, + section_separators = { + left = lvim.icons.ui.BoldDividerRight, + right = lvim.icons.ui.BoldDividerLeft, + }, + disabled_filetypes = {}, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch" }, + lualine_c = { "filename" }, + lualine_x = { "encoding", "fileformat", "filetype" }, + lualine_y = { "progress" }, + lualine_z = { "location" }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { "filename" }, + lualine_x = { "location" }, + lualine_y = {}, + lualine_z = {}, + }, + tabline = {}, + extensions = {}, +} + +styles.lvim = { + style = "lvim", + options = { + theme = "auto", + globalstatus = true, + icons_enabled = lvim.use_icons, + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, + disabled_filetypes = { "alpha" }, + }, + sections = { + lualine_a = { + components.mode, + }, + lualine_b = { + components.branch, + }, + lualine_c = { + components.diff, + components.python_env, + }, + lualine_x = { + components.diagnostics, + components.lsp, + components.spaces, + components.filetype, + }, + lualine_y = { components.location }, + lualine_z = { + components.progress, + }, + }, + inactive_sections = { + lualine_a = { + components.mode, + }, + lualine_b = { + components.branch, + }, + lualine_c = { + components.diff, + components.python_env, + }, + lualine_x = { + components.diagnostics, + components.lsp, + components.spaces, + components.filetype, + }, + lualine_y = { components.location }, + lualine_z = { + components.progress, + }, + }, + tabline = {}, + extensions = {}, +} + +function M.get_style(style) + local style_keys = vim.tbl_keys(styles) + if not vim.tbl_contains(style_keys, style) then + local Log = require "lvim.core.log" + Log:error( + "Invalid lualine style" + .. string.format('"%s"', style) + .. "options are: " + .. string.format('"%s"', table.concat(style_keys, '", "')) + ) + Log:debug '"lvim" style is applied.' + style = "lvim" + end + + return vim.deepcopy(styles[style]) +end + +function M.update() + local style = M.get_style(lvim.builtin.lualine.style) + + lvim.builtin.lualine = vim.tbl_deep_extend("keep", lvim.builtin.lualine, style) + + local color_template = vim.g.colors_name or lvim.colorscheme + local theme_supported, template = pcall(function() + require("lualine.utils.loader").load_theme(color_template) + end) + if theme_supported and template then + lvim.builtin.lualine.options.theme = color_template + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/lualine/utils.lua b/mac/.config/LunarVim/lua/lvim/core/lualine/utils.lua new file mode 100644 index 0000000..3fd3c2d --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/lualine/utils.lua @@ -0,0 +1,14 @@ +local M = {} + +function M.env_cleanup(venv) + if string.find(venv, "/") then + local final_venv = venv + for w in venv:gmatch "([^/]+)" do + final_venv = w + end + venv = final_venv + end + return venv +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/mason.lua b/mac/.config/LunarVim/lua/lvim/core/mason.lua new file mode 100644 index 0000000..a8816a3 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/mason.lua @@ -0,0 +1,120 @@ +local M = {} + +local join_paths = require("lvim.utils").join_paths + +function M.config() + lvim.builtin.mason = { + ui = { + check_outdated_packages_on_open = true, + width = 0.8, + height = 0.9, + border = "rounded", + keymaps = { + toggle_package_expand = "", + install_package = "i", + update_package = "u", + check_package_version = "c", + update_all_packages = "U", + check_outdated_packages = "C", + uninstall_package = "X", + cancel_installation = "", + apply_language_filter = "", + }, + }, + + icons = { + package_installed = "◍", + package_pending = "◍", + package_uninstalled = "◍", + }, + + -- NOTE: should be available in $PATH + install_root_dir = join_paths(vim.fn.stdpath "data", "mason"), + + -- NOTE: already handled in the bootstrap stage + PATH = "skip", + + pip = { + upgrade_pip = false, + -- These args will be added to `pip install` calls. Note that setting extra args might impact intended behavior + -- and is not recommended. + -- + -- Example: { "--proxy", "https://proxyserver" } + install_args = {}, + }, + + -- Controls to which degree logs are written to the log file. It's useful to set this to vim.log.levels.DEBUG when + -- debugging issues with package installations. + log_level = vim.log.levels.INFO, + + -- Limit for the maximum amount of packages to be installed at the same time. Once this limit is reached, any further + -- packages that are requested to be installed will be put in a queue. + max_concurrent_installers = 4, + + -- [Advanced setting] + -- The registries to source packages from. Accepts multiple entries. Should a package with the same name exist in + -- multiple registries, the registry listed first will be used. + registries = { + "lua:mason-registry.index", + "github:mason-org/mason-registry", + }, + + -- The provider implementations to use for resolving supplementary package metadata (e.g., all available versions). + -- Accepts multiple entries, where later entries will be used as fallback should prior providers fail. + providers = { + "mason.providers.registry-api", + "mason.providers.client", + }, + + github = { + -- The template URL to use when downloading assets from GitHub. + -- The placeholders are the following (in order): + -- 1. The repository (e.g. "rust-lang/rust-analyzer") + -- 2. The release version (e.g. "v0.3.0") + -- 3. The asset name (e.g. "rust-analyzer-v0.3.0-x86_64-unknown-linux-gnu.tar.gz") + download_url_template = "https://github.com/%s/releases/download/%s/%s", + }, + + on_config_done = nil, + } +end + +function M.get_prefix() + local default_prefix = join_paths(vim.fn.stdpath "data", "mason") + return vim.tbl_get(lvim.builtin, "mason", "install_root_dir") or default_prefix +end + +---@param append boolean|nil whether to append to prepend to PATH +local function add_to_path(append) + local p = join_paths(M.get_prefix(), "bin") + if vim.env.PATH:match(p) then + return + end + local string_separator = vim.loop.os_uname().version:match "Windows" and ";" or ":" + if append then + vim.env.PATH = vim.env.PATH .. string_separator .. p + else + vim.env.PATH = p .. string_separator .. vim.env.PATH + end +end + +function M.bootstrap() + add_to_path() +end + +function M.setup() + local status_ok, mason = pcall(require, "mason") + if not status_ok then + return + end + + add_to_path(lvim.builtin.mason.PATH == "append") + + mason.setup(lvim.builtin.mason) + + if lvim.builtin.mason.on_config_done then + lvim.builtin.mason.on_config_done(mason) + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/nvimtree.lua b/mac/.config/LunarVim/lua/lvim/core/nvimtree.lua new file mode 100644 index 0000000..d1aaff4 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/nvimtree.lua @@ -0,0 +1,344 @@ +local M = {} +local Log = require "lvim.core.log" + +function M.config() + lvim.builtin.nvimtree = { + active = true, + on_config_done = nil, + setup = { + experimental = {}, + auto_reload_on_write = false, + disable_netrw = false, + hijack_cursor = false, + hijack_netrw = true, + hijack_unnamed_buffer_when_opening = false, + sort = { + sorter = "name", + folders_first = true, + files_first = false, + }, + root_dirs = {}, + prefer_startup_root = false, + sync_root_with_cwd = true, + reload_on_bufenter = false, + respect_buf_cwd = false, + on_attach = "default", + select_prompts = false, + view = { + adaptive_size = false, + centralize_selection = true, + width = 30, + cursorline = true, + debounce_delay = 15, + side = "left", + preserve_window_proportions = false, + number = false, + relativenumber = false, + signcolumn = "yes", + float = { + enable = false, + quit_on_focus_loss = true, + open_win_config = { + relative = "editor", + border = "rounded", + width = 30, + height = 30, + row = 1, + col = 1, + }, + }, + }, + renderer = { + add_trailing = false, + group_empty = false, + highlight_git = "name", + highlight_opened_files = "none", + root_folder_label = ":t", + full_name = false, + indent_width = 2, + special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md" }, + symlink_destination = true, + highlight_diagnostics = "none", + highlight_modified = "none", + highlight_bookmarks = "none", + highlight_clipboard = "name", + indent_markers = { + enable = false, + inline_arrows = true, + icons = { + corner = "└", + edge = "│", + item = "│", + bottom = "─", + none = " ", + }, + }, + icons = { + webdev_colors = lvim.use_icons, + + web_devicons = { + file = { + enable = lvim.use_icons, + color = lvim.use_icons, + }, + folder = { + enable = false, + color = lvim.use_icons, + }, + }, + git_placement = "before", + padding = " ", + symlink_arrow = " ➛ ", + modified_placement = "after", + diagnostics_placement = "signcolumn", + bookmarks_placement = "signcolumn", + show = { + file = lvim.use_icons, + folder = lvim.use_icons, + folder_arrow = lvim.use_icons, + git = lvim.use_icons, + modified = lvim.use_icons, + diagnostics = lvim.use_icons, + bookmarks = lvim.use_icons, + }, + glyphs = { + default = lvim.icons.ui.Text, + symlink = lvim.icons.ui.FileSymlink, + bookmark = lvim.icons.ui.BookMark, + modified = lvim.icons.ui.Circle, + folder = { + arrow_closed = lvim.icons.ui.TriangleShortArrowRight, + arrow_open = lvim.icons.ui.TriangleShortArrowDown, + default = lvim.icons.ui.Folder, + open = lvim.icons.ui.FolderOpen, + empty = lvim.icons.ui.EmptyFolder, + empty_open = lvim.icons.ui.EmptyFolderOpen, + symlink = lvim.icons.ui.FolderSymlink, + symlink_open = lvim.icons.ui.FolderOpen, + }, + git = { + unstaged = lvim.icons.git.FileUnstaged, + staged = lvim.icons.git.FileStaged, + unmerged = lvim.icons.git.FileUnmerged, + renamed = lvim.icons.git.FileRenamed, + untracked = lvim.icons.git.FileUntracked, + deleted = lvim.icons.git.FileDeleted, + ignored = lvim.icons.git.FileIgnored, + }, + }, + }, + }, + hijack_directories = { + enable = false, + auto_open = true, + }, + update_focused_file = { + enable = true, + update_root = { + enable = true, + ignore_list = {}, + }, + exclude = false, + }, + diagnostics = { + enable = lvim.use_icons, + show_on_dirs = false, + show_on_open_dirs = true, + debounce_delay = 50, + severity = { + min = vim.diagnostic.severity.HINT, + max = vim.diagnostic.severity.ERROR, + }, + icons = { + hint = lvim.icons.diagnostics.BoldHint, + info = lvim.icons.diagnostics.BoldInformation, + warning = lvim.icons.diagnostics.BoldWarning, + error = lvim.icons.diagnostics.BoldError, + }, + }, + filters = { + enable = true, + dotfiles = false, + git_clean = false, + git_ignored = false, + no_bookmark = false, + no_buffer = false, + custom = { "node_modules", "\\.cache" }, + exclude = {}, + }, + filesystem_watchers = { + enable = true, + debounce_delay = 50, + ignore_dirs = {}, + }, + git = { + enable = true, + show_on_dirs = true, + show_on_open_dirs = true, + disable_for_dirs = {}, + timeout = 400, + cygwin_support = false, + }, + actions = { + use_system_clipboard = true, + change_dir = { + enable = true, + global = false, + restrict_above_cwd = false, + }, + expand_all = { + max_folder_discovery = 300, + exclude = {}, + }, + file_popup = { + open_win_config = { + col = 1, + row = 1, + relative = "cursor", + border = "shadow", + style = "minimal", + }, + }, + open_file = { + quit_on_open = false, + eject = true, + resize_window = false, + window_picker = { + enable = true, + picker = "default", + chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", + exclude = { + filetype = { "notify", "lazy", "qf", "diff", "fugitive", "fugitiveblame" }, + buftype = { "nofile", "terminal", "help" }, + }, + }, + }, + remove_file = { + close_window = true, + }, + }, + trash = { + cmd = "gio trash", + }, + live_filter = { + prefix = "[FILTER]: ", + always_show_folders = true, + }, + tab = { + sync = { + open = false, + close = false, + ignore = {}, + }, + }, + notify = { + threshold = vim.log.levels.INFO, + absolute_path = true, + }, + ui = { + confirm = { + remove = true, + trash = true, + default_yes = false, + }, + }, + modified = { + enable = false, + show_on_dirs = true, + show_on_open_dirs = true, + }, + help = { + sort_by = "key", + }, + log = { + enable = false, + truncate = false, + types = { + all = false, + config = false, + copy_paste = false, + dev = false, + diagnostics = false, + git = false, + profile = false, + watcher = false, + }, + }, + system_open = { + cmd = nil, + args = {}, + }, + }, + } +end + +function M.start_telescope(telescope_mode) + local node = require("nvim-tree.lib").get_node_at_cursor() + local abspath = node.link_to or node.absolute_path + local is_folder = node.open ~= nil + local basedir = is_folder and abspath or vim.fn.fnamemodify(abspath, ":h") + require("telescope.builtin")[telescope_mode] { + cwd = basedir, + } +end + +local function on_attach(bufnr) + local api = require "nvim-tree.api" + + local function telescope_find_files(_) + require("lvim.core.nvimtree").start_telescope "find_files" + end + + local function telescope_live_grep(_) + require("lvim.core.nvimtree").start_telescope "live_grep" + end + + local function opts(desc) + return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } + end + + api.config.mappings.default_on_attach(bufnr) + + local useful_keys = { + ["l"] = { api.node.open.edit, opts "Open" }, + ["o"] = { api.node.open.edit, opts "Open" }, + [""] = { api.node.open.edit, opts "Open" }, + ["v"] = { api.node.open.vertical, opts "Open: Vertical Split" }, + ["h"] = { api.node.navigate.parent_close, opts "Close Directory" }, + ["C"] = { api.tree.change_root_to_node, opts "CD" }, + ["gtg"] = { telescope_live_grep, opts "Telescope Live Grep" }, + ["gtf"] = { telescope_find_files, opts "Telescope Find File" }, + } + + require("lvim.keymappings").load_mode("n", useful_keys) +end + +function M.setup() + local status_ok, nvim_tree = pcall(require, "nvim-tree") + + if not status_ok then + Log:error "Failed to load nvim-tree" + return + end + + -- Implicitly update nvim-tree when project module is active + if lvim.builtin.project.active then + lvim.builtin.nvimtree.setup.respect_buf_cwd = true + lvim.builtin.nvimtree.setup.update_cwd = true + lvim.builtin.nvimtree.setup.update_focused_file.enable = true + lvim.builtin.nvimtree.setup.update_focused_file.update_cwd = true + end + + -- Add useful keymaps + if lvim.builtin.nvimtree.setup.on_attach == "default" then + lvim.builtin.nvimtree.setup.on_attach = on_attach + end + + nvim_tree.setup(lvim.builtin.nvimtree.setup) + + if lvim.builtin.nvimtree.on_config_done then + lvim.builtin.nvimtree.on_config_done(nvim_tree) + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/project.lua b/mac/.config/LunarVim/lua/lvim/core/project.lua new file mode 100644 index 0000000..17473c5 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/project.lua @@ -0,0 +1,67 @@ +local M = {} + +function M.config() + lvim.builtin.project = { + ---@usage set to false to disable project.nvim. + --- This is on by default since it's currently the expected behavior. + active = true, + + on_config_done = nil, + + ---@usage set to true to disable setting the current-woriking directory + --- Manual mode doesn't automatically change your root directory, so you have + --- the option to manually do so using `:ProjectRoot` command. + manual_mode = false, + + ---@usage Methods of detecting the root directory + --- Allowed values: **"lsp"** uses the native neovim lsp + --- **"pattern"** uses vim-rooter like glob pattern matching. Here + --- order matters: if one is not detected, the other is used as fallback. You + --- can also delete or rearangne the detection methods. + -- detection_methods = { "lsp", "pattern" }, -- NOTE: lsp detection will get annoying with multiple langs in one project + detection_methods = { "pattern" }, + + -- All the patterns used to detect root dir, when **"pattern"** is in + -- detection_methods + patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json", "pom.xml" }, + + -- Table of lsp clients to ignore by name + -- eg: { "efm", ... } + ignore_lsp = {}, + + -- Don't calculate root dir on specific directories + -- Ex: { "~/.cargo/*", ... } + exclude_dirs = {}, + + -- Show hidden files in telescope + show_hidden = false, + + -- When set to false, you will get a message when project.nvim changes your + -- directory. + silent_chdir = true, + + -- What scope to change the directory, valid options are + -- * global (default) + -- * tab + -- * win + scope_chdir = "global", + + ---@type string + ---@usage path to store the project history for use in telescope + datapath = get_cache_dir(), + } +end + +function M.setup() + local status_ok, project = pcall(require, "project_nvim") + if not status_ok then + return + end + + project.setup(lvim.builtin.project) + if lvim.builtin.project.on_config_done then + lvim.builtin.project.on_config_done(project) + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/telescope.lua b/mac/.config/LunarVim/lua/lvim/core/telescope.lua new file mode 100644 index 0000000..b701f7e --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/telescope.lua @@ -0,0 +1,150 @@ +local M = {} + +---@alias telescope_themes +---| "cursor" # see `telescope.themes.get_cursor()` +---| "dropdown" # see `telescope.themes.get_dropdown()` +---| "ivy" # see `telescope.themes.get_ivy()` +---| "center" # retain the default telescope theme + +function M.config() + local actions = require("lvim.utils.modules").require_on_exported_call "telescope.actions" + lvim.builtin.telescope = { + ---@usage disable telescope completely [not recommended] + active = true, + on_config_done = nil, + theme = "dropdown", ---@type telescope_themes + defaults = { + prompt_prefix = lvim.icons.ui.Telescope .. " ", + selection_caret = lvim.icons.ui.Forward .. " ", + entry_prefix = " ", + initial_mode = "insert", + selection_strategy = "reset", + sorting_strategy = nil, + layout_strategy = nil, + layout_config = {}, + vimgrep_arguments = { + "rg", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--smart-case", + "--hidden", + "--glob=!.git/", + }, + ---@usage Mappings are fully customizable. Many familiar mapping patterns are setup as defaults. + mappings = { + i = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + [""] = actions.close, + [""] = actions.cycle_history_next, + [""] = actions.cycle_history_prev, + [""] = function(...) + actions.smart_send_to_qflist(...) + actions.open_qflist(...) + end, + [""] = actions.select_default, + }, + n = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + [""] = function(...) + actions.smart_send_to_qflist(...) + actions.open_qflist(...) + end, + }, + }, + file_ignore_patterns = {}, + path_display = { "smart" }, + winblend = 0, + border = {}, + borderchars = nil, + color_devicons = true, + set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil, + }, + pickers = { + find_files = { + hidden = true, + }, + live_grep = { + --@usage don't include the filename in the search results + only_sort_text = true, + }, + grep_string = { + only_sort_text = true, + }, + buffers = { + initial_mode = "normal", + mappings = { + i = { + [""] = actions.delete_buffer, + }, + n = { + ["dd"] = actions.delete_buffer, + }, + }, + }, + planets = { + show_pluto = true, + show_moon = true, + }, + git_files = { + hidden = true, + show_untracked = true, + }, + colorscheme = { + enable_preview = true, + }, + }, + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + case_mode = "smart_case", -- or "ignore_case" or "respect_case" + }, + }, + } +end + +function M.setup() + local previewers = require "telescope.previewers" + local sorters = require "telescope.sorters" + + lvim.builtin.telescope = vim.tbl_extend("keep", { + file_previewer = previewers.vim_buffer_cat.new, + grep_previewer = previewers.vim_buffer_vimgrep.new, + qflist_previewer = previewers.vim_buffer_qflist.new, + file_sorter = sorters.get_fuzzy_file, + generic_sorter = sorters.get_generic_fuzzy_sorter, + }, lvim.builtin.telescope) + + local telescope = require "telescope" + + local theme = require("telescope.themes")["get_" .. (lvim.builtin.telescope.theme or "")] + if theme then + lvim.builtin.telescope.defaults = theme(lvim.builtin.telescope.defaults) + end + + telescope.setup(lvim.builtin.telescope) + + if lvim.builtin.project.active then + pcall(function() + require("telescope").load_extension "projects" + end) + end + + if lvim.builtin.telescope.on_config_done then + lvim.builtin.telescope.on_config_done(telescope) + end + + if lvim.builtin.telescope.extensions and lvim.builtin.telescope.extensions.fzf then + pcall(function() + require("telescope").load_extension "fzf" + end) + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/telescope/custom-finders.lua b/mac/.config/LunarVim/lua/lvim/core/telescope/custom-finders.lua new file mode 100644 index 0000000..f433f35 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/telescope/custom-finders.lua @@ -0,0 +1,98 @@ +local M = {} + +local _, builtin = pcall(require, "telescope.builtin") +local _, finders = pcall(require, "telescope.finders") +local _, pickers = pcall(require, "telescope.pickers") +local _, sorters = pcall(require, "telescope.sorters") +local _, themes = pcall(require, "telescope.themes") +local _, actions = pcall(require, "telescope.actions") +local _, previewers = pcall(require, "telescope.previewers") +local _, make_entry = pcall(require, "telescope.make_entry") + +function M.find_lunarvim_files(opts) + opts = opts or {} + local theme_opts = themes.get_ivy { + sorting_strategy = "ascending", + layout_strategy = "bottom_pane", + prompt_prefix = ">> ", + prompt_title = "~ LunarVim files ~", + cwd = get_runtime_dir(), + search_dirs = { get_lvim_base_dir(), lvim.lsp.templates_dir }, + } + opts = vim.tbl_deep_extend("force", theme_opts, opts) + builtin.find_files(opts) +end + +function M.grep_lunarvim_files(opts) + opts = opts or {} + local theme_opts = themes.get_ivy { + sorting_strategy = "ascending", + layout_strategy = "bottom_pane", + prompt_prefix = ">> ", + prompt_title = "~ search LunarVim ~", + cwd = get_runtime_dir(), + search_dirs = { get_lvim_base_dir(), lvim.lsp.templates_dir }, + } + opts = vim.tbl_deep_extend("force", theme_opts, opts) + builtin.live_grep(opts) +end + +local copy_to_clipboard_action = function(prompt_bufnr) + local _, action_state = pcall(require, "telescope.actions.state") + local entry = action_state.get_selected_entry() + local version = entry.value + vim.fn.setreg("+", version) + vim.fn.setreg('"', version) + vim.notify("Copied " .. version .. " to clipboard", vim.log.levels.INFO) + actions.close(prompt_bufnr) +end + +function M.view_lunarvim_changelog() + local opts = themes.get_ivy { + cwd = get_lvim_base_dir(), + } + opts.entry_maker = make_entry.gen_from_git_commits(opts) + + pickers + .new(opts, { + prompt_title = "~ LunarVim Changelog ~", + + finder = finders.new_oneshot_job( + vim.tbl_flatten { + "git", + "log", + "--pretty=oneline", + "--abbrev-commit", + }, + opts + ), + previewer = { + previewers.git_commit_diff_as_was.new(opts), + }, + + --TODO: consider opening a diff view when pressing enter + attach_mappings = function(_, map) + map("i", "", copy_to_clipboard_action) + map("n", "", copy_to_clipboard_action) + map("i", "", actions.close) + map("n", "", actions.close) + map("n", "q", actions.close) + return true + end, + sorter = sorters.generic_sorter, + }) + :find() +end + +-- Smartly opens either git_files or find_files, depending on whether the working directory is +-- contained in a Git repo. +function M.find_project_files(opts) + opts = opts or {} + local ok = pcall(builtin.git_files, opts) + + if not ok then + builtin.find_files(opts) + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/terminal.lua b/mac/.config/LunarVim/lua/lvim/core/terminal.lua new file mode 100644 index 0000000..5270dda --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/terminal.lua @@ -0,0 +1,174 @@ +local M = {} +local Log = require "lvim.core.log" + +M.config = function() + lvim.builtin["terminal"] = { + active = true, + on_config_done = nil, + -- size can be a number or function which is passed the current terminal + size = 20, + open_mapping = [[]], + hide_numbers = true, -- hide the number column in toggleterm buffers + shade_filetypes = {}, + shade_terminals = true, + shading_factor = 2, -- the degree by which to darken to terminal colour, default: 1 for dark backgrounds, 3 for light + start_in_insert = true, + insert_mappings = true, -- whether or not the open mapping applies in insert mode + persist_size = false, + -- direction = 'vertical' | 'horizontal' | 'window' | 'float', + direction = "float", + close_on_exit = true, -- close the terminal window when the process exits + auto_scroll = true, -- automatically scroll to the bottom on terminal output + shell = nil, -- change the default shell + -- This field is only relevant if direction is set to 'float' + float_opts = { + -- The border key is *almost* the same as 'nvim_win_open' + -- see :h nvim_win_open for details on borders however + -- the 'curved' border is a custom border type + -- not natively supported but implemented in this plugin. + -- border = 'single' | 'double' | 'shadow' | 'curved' | ... other options supported by win open + border = "curved", + -- width = , + -- height = , + winblend = 0, + highlights = { + border = "Normal", + background = "Normal", + }, + }, + winbar = { + enabled = false, + }, + -- Add executables on the config.lua + -- { cmd, keymap, description, direction, size } + -- lvim.builtin.terminal.execs = {...} to overwrite + -- lvim.builtin.terminal.execs[#lvim.builtin.terminal.execs+1] = {"gdb", "tg", "GNU Debugger"} + -- TODO: pls add mappings in which key and refactor this + execs = { + { nil, "", "Horizontal Terminal", "horizontal", 0.3 }, + { nil, "", "Vertical Terminal", "vertical", 0.4 }, + { nil, "", "Float Terminal", "float", nil }, + }, + } +end + +--- Get current buffer size +---@return {width: number, height: number} +local function get_buf_size() + local cbuf = vim.api.nvim_get_current_buf() + local bufinfo = vim.tbl_filter(function(buf) + return buf.bufnr == cbuf + end, vim.fn.getwininfo(vim.api.nvim_get_current_win()))[1] + if bufinfo == nil then + return { width = -1, height = -1 } + end + return { width = bufinfo.width, height = bufinfo.height } +end + +--- Get the dynamic terminal size in cells +---@param direction number +---@param size number +---@return integer +local function get_dynamic_terminal_size(direction, size) + size = size or lvim.builtin.terminal.size + if direction ~= "float" and tostring(size):find(".", 1, true) then + size = math.min(size, 1.0) + local buf_sizes = get_buf_size() + local buf_size = direction == "horizontal" and buf_sizes.height or buf_sizes.width + return buf_size * size + else + return size + end +end + +M.init = function() + for i, exec in pairs(lvim.builtin.terminal.execs) do + local direction = exec[4] or lvim.builtin.terminal.direction + + local opts = { + cmd = exec[1] or lvim.builtin.terminal.shell or vim.o.shell, + keymap = exec[2], + label = exec[3], + -- NOTE: unable to consistently bind id/count <= 9, see #2146 + count = i + 100, + direction = direction, + size = function() + return get_dynamic_terminal_size(direction, exec[5]) + end, + } + + M.add_exec(opts) + end +end + +M.setup = function() + local terminal = require "toggleterm" + terminal.setup(lvim.builtin.terminal) + if lvim.builtin.terminal.on_config_done then + lvim.builtin.terminal.on_config_done(terminal) + end +end + +M.add_exec = function(opts) + local binary = opts.cmd:match "(%S+)" + if vim.fn.executable(binary) ~= 1 then + Log:debug("Skipping configuring executable " .. binary .. ". Please make sure it is installed properly.") + return + end + + vim.keymap.set({ "n", "t" }, opts.keymap, function() + M._exec_toggle { cmd = opts.cmd, count = opts.count, direction = opts.direction, size = opts.size() } + end, { desc = opts.label, noremap = true, silent = true }) +end + +M._exec_toggle = function(opts) + local Terminal = require("toggleterm.terminal").Terminal + local term = Terminal:new { cmd = opts.cmd, count = opts.count, direction = opts.direction } + term:toggle(opts.size, opts.direction) +end + +---Toggles a log viewer according to log.viewer.layout_config +---@param logfile string the fullpath to the logfile +M.toggle_log_view = function(logfile) + local log_viewer = lvim.log.viewer.cmd + if vim.fn.executable(log_viewer) ~= 1 then + log_viewer = "less +F" + end + Log:debug("attempting to open: " .. logfile) + log_viewer = log_viewer .. " " .. logfile + local term_opts = vim.tbl_deep_extend("force", lvim.builtin.terminal, { + cmd = log_viewer, + open_mapping = lvim.log.viewer.layout_config.open_mapping, + direction = lvim.log.viewer.layout_config.direction, + -- TODO: this might not be working as expected + size = lvim.log.viewer.layout_config.size, + float_opts = lvim.log.viewer.layout_config.float_opts, + }) + + local Terminal = require("toggleterm.terminal").Terminal + local log_view = Terminal:new(term_opts) + log_view:toggle() +end + +M.lazygit_toggle = function() + local Terminal = require("toggleterm.terminal").Terminal + local lazygit = Terminal:new { + cmd = "lazygit", + hidden = true, + direction = "float", + float_opts = { + border = "none", + width = 100000, + height = 100000, + zindex = 200, + }, + on_open = function(_) + vim.cmd "startinsert!" + end, + on_close = function(_) end, + count = 99, + } + lazygit:toggle() +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/theme.lua b/mac/.config/LunarVim/lua/lvim/core/theme.lua new file mode 100644 index 0000000..5a39f04 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/theme.lua @@ -0,0 +1,96 @@ +local Log = require "lvim.core.log" + +local M = {} + +M.config = function() + lvim.builtin.theme = { + name = "lunar", + lunar = { + options = { -- currently unused + }, + }, + tokyonight = { + options = { + on_highlights = function(hl, c) + hl.IndentBlanklineContextChar = { + fg = c.dark5, + } + hl.TSConstructor = { + fg = c.blue1, + } + hl.TSTagDelimiter = { + fg = c.dark5, + } + end, + style = "night", -- The theme comes in three styles, `storm`, a darker variant `night` and `day` + transparent = lvim.transparent_window, -- Enable this to disable setting the background color + terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim + styles = { + -- Style to be applied to different syntax groups + -- Value is any valid attr-list value for `:help nvim_set_hl` + comments = { italic = true }, + keywords = { italic = true }, + functions = {}, + variables = {}, + -- Background styles. Can be "dark", "transparent" or "normal" + sidebars = "dark", -- style for sidebars, see below + floats = "dark", -- style for floating windows + }, + -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]` + sidebars = { + "qf", + "vista_kind", + "terminal", + "packer", + "spectre_panel", + "NeogitStatus", + "help", + }, + day_brightness = 0.3, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors + hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**. + dim_inactive = false, -- dims inactive windows + lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold + use_background = true, -- can be light/dark/auto. When auto, background will be set to vim.o.background + }, + }, + } +end + +M.setup = function() + -- avoid running in headless mode since it's harder to detect failures + if #vim.api.nvim_list_uis() == 0 then + Log:debug "headless mode detected, skipping running setup for lualine" + return + end + + local selected_theme = lvim.builtin.theme.name + + if vim.startswith(lvim.colorscheme, selected_theme) then + local status_ok, plugin = pcall(require, selected_theme) + if not status_ok then + return + end + pcall(function() + plugin.setup(lvim.builtin.theme[selected_theme].options) + end) + end + + -- ref: https://github.com/neovim/neovim/issues/18201#issuecomment-1104754564 + local colors = vim.api.nvim_get_runtime_file(("colors/%s.*"):format(lvim.colorscheme), false) + if #colors == 0 then + Log:debug(string.format("Could not find '%s' colorscheme", lvim.colorscheme)) + return + end + + vim.g.colors_name = lvim.colorscheme + vim.cmd("colorscheme " .. lvim.colorscheme) + + if package.loaded.lualine then + require("lvim.core.lualine").setup() + end + if package.loaded.lir then + require("lvim.core.lir").icon_setup() + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/treesitter.lua b/mac/.config/LunarVim/lua/lvim/core/treesitter.lua new file mode 100644 index 0000000..bdb127c --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/treesitter.lua @@ -0,0 +1,135 @@ +local M = {} +local Log = require "lvim.core.log" + +function M.config() + lvim.builtin.treesitter = { + on_config_done = nil, + + -- A list of parser names, or "all" + ensure_installed = { "comment", "markdown_inline", "regex" }, + + -- List of parsers to ignore installing (for "all") + ignore_install = {}, + + -- A directory to install the parsers into. + -- By default parsers are installed to either the package dir, or the "site" dir. + -- If a custom path is used (not nil) it must be added to the runtimepath. + parser_install_dir = nil, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + auto_install = true, + + matchup = { + enable = false, -- mandatory, false will disable the whole extension + -- disable = { "c", "ruby" }, -- optional, list of language that will be disabled + }, + highlight = { + enable = true, -- false will disable the whole extension + additional_vim_regex_highlighting = false, + disable = function(lang, buf) + if vim.tbl_contains({ "latex" }, lang) then + return true + end + + local status_ok, big_file_detected = pcall(vim.api.nvim_buf_get_var, buf, "bigfile_disable_treesitter") + return status_ok and big_file_detected + end, + }, + context_commentstring = { + enable = true, + enable_autocmd = false, + config = { + -- Languages that have a single comment style + typescript = "// %s", + css = "/* %s */", + scss = "/* %s */", + html = "", + svelte = "", + vue = "", + json = "", + }, + }, + indent = { enable = true, disable = { "yaml", "python" } }, + autotag = { enable = false }, + textobjects = { + swap = { + enable = false, + -- swap_next = textobj_swap_keymaps, + }, + -- move = textobj_move_keymaps, + select = { + enable = false, + -- keymaps = textobj_sel_keymaps, + }, + }, + textsubjects = { + enable = false, + keymaps = { ["."] = "textsubjects-smart", [";"] = "textsubjects-big" }, + }, + playground = { + enable = false, + disable = {}, + updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code + persist_queries = false, -- Whether the query persists across vim sessions + keybindings = { + toggle_query_editor = "o", + toggle_hl_groups = "i", + toggle_injected_languages = "t", + toggle_anonymous_nodes = "a", + toggle_language_display = "I", + focus_language = "f", + unfocus_language = "F", + update = "R", + goto_node = "", + show_help = "?", + }, + }, + rainbow = { + enable = false, + extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean + max_file_lines = 1000, -- Do not enable for files with more than 1000 lines, int + }, + } +end + +function M.setup() + -- avoid running in headless mode since it's harder to detect failures + if #vim.api.nvim_list_uis() == 0 then + Log:debug "headless mode detected, skipping running setup for treesitter" + return + end + + local ts_status_ok, treesitter_configs = pcall(require, "nvim-treesitter.configs") + if not ts_status_ok then + Log:error "Failed to load nvim-treesitter.configs" + return + end + + local status_ok, ts_context_commentstring = pcall(require, "ts_context_commentstring") + if not status_ok then + Log:error "Failed to load ts_context_commentstring" + return + end + + local opts = vim.deepcopy(lvim.builtin.treesitter) + + -- handle deprecated API, https://github.com/JoosepAlviste/nvim-ts-context-commentstring/issues/82 + ts_context_commentstring.setup(opts.context_commentstring) + opts.context_commentstring = nil + + treesitter_configs.setup(opts) + + if lvim.builtin.treesitter.on_config_done then + lvim.builtin.treesitter.on_config_done(treesitter_configs) + end + + -- handle deprecated API, https://github.com/windwp/nvim-autopairs/pull/324 + local ts_utils = require "nvim-treesitter.ts_utils" + ts_utils.is_in_node_range = vim.treesitter.is_in_node_range + ts_utils.get_node_range = vim.treesitter.get_node_range +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/core/which-key.lua b/mac/.config/LunarVim/lua/lvim/core/which-key.lua new file mode 100644 index 0000000..ab548d9 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/core/which-key.lua @@ -0,0 +1,333 @@ +local M = {} +M.config = function() + lvim.builtin.which_key = { + ---@usage disable which-key completely [not recommended] + active = true, + on_config_done = nil, + setup = { + plugins = { + marks = false, -- shows a list of your marks on ' and ` + registers = false, -- shows your registers on " in NORMAL or in INSERT mode + spelling = { + enabled = true, + suggestions = 20, + }, -- use which-key for spelling hints + -- the presets plugin, adds help for a bunch of default keybindings in Neovim + -- No actual key bindings are created + presets = { + operators = false, -- adds help for operators like d, y, ... + motions = false, -- adds help for motions + text_objects = false, -- help for text objects triggered after entering an operator + windows = false, -- default bindings on + nav = false, -- misc bindings to work with windows + z = false, -- bindings for folds, spelling and others prefixed with z + g = false, -- bindings for prefixed with g + }, + }, + -- add operators that will trigger motion and text object completion + -- to enable all native operators, set the preset / operators plugin above + operators = { gc = "Comments" }, + key_labels = { + -- override the label used to display some keys. It doesn't effect WK in any other way. + -- For example: + -- [""] = "SPC", + -- [""] = "RET", + -- [""] = "TAB", + }, + icons = { + breadcrumb = lvim.icons.ui.DoubleChevronRight, -- symbol used in the command line area that shows your active key combo + separator = lvim.icons.ui.BoldArrowRight, -- symbol used between a key and it's label + group = lvim.icons.ui.Plus, -- symbol prepended to a group + }, + popup_mappings = { + scroll_down = "", -- binding to scroll down inside the popup + scroll_up = "", -- binding to scroll up inside the popup + }, + window = { + border = "single", -- none, single, double, shadow + position = "bottom", -- bottom, top + margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left] + padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left] + winblend = 0, + }, + layout = { + height = { min = 4, max = 25 }, -- min and max height of the columns + width = { min = 20, max = 50 }, -- min and max width of the columns + spacing = 3, -- spacing between columns + align = "left", -- align columns left, center or right + }, + ignore_missing = true, -- enable this to hide mappings for which you didn't specify a label + hidden = { "", "", "", "", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate + show_help = true, -- show help message on the command line when the popup is visible + show_keys = true, -- show the currently pressed key and its label as a message in the command line + triggers = "auto", -- automatically setup triggers + -- triggers = {""} -- or specify a list manually + triggers_blacklist = { + -- list of mode / prefixes that should never be hooked by WhichKey + -- this is mostly relevant for key maps that start with a native binding + -- most people should not need to change this + i = { "j", "k" }, + v = { "j", "k" }, + }, + -- disable the WhichKey popup for certain buf types and file types. + -- Disabled by default for Telescope + disable = { + buftypes = {}, + filetypes = { "TelescopePrompt" }, + }, + }, + + opts = { + mode = "n", -- NORMAL mode + prefix = "", + buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings + silent = true, -- use `silent` when creating keymaps + noremap = true, -- use `noremap` when creating keymaps + nowait = true, -- use `nowait` when creating keymaps + }, + vopts = { + mode = "v", -- VISUAL mode + prefix = "", + buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings + silent = true, -- use `silent` when creating keymaps + noremap = true, -- use `noremap` when creating keymaps + nowait = true, -- use `nowait` when creating keymaps + }, + -- NOTE: Prefer using : over as the latter avoids going back in normal-mode. + -- see https://neovim.io/doc/user/map.html#:map-cmd + vmappings = { + ["/"] = { "(comment_toggle_linewise_visual)", "Comment toggle linewise (visual)" }, + l = { + name = "LSP", + a = { "lua vim.lsp.buf.code_action()", "Code Action" }, + }, + g = { + name = "Git", + r = { "Gitsigns reset_hunk", "Reset Hunk" }, + s = { "Gitsigns stage_hunk", "Stage Hunk" }, + }, + }, + mappings = { + [";"] = { "Alpha", "Dashboard" }, + ["w"] = { "w!", "Save" }, + ["q"] = { "confirm q", "Quit" }, + ["/"] = { "(comment_toggle_linewise_current)", "Comment toggle current line" }, + ["c"] = { "BufferKill", "Close Buffer" }, + ["f"] = { + function() + require("lvim.core.telescope.custom-finders").find_project_files { previewer = false } + end, + "Find File", + }, + ["h"] = { "nohlsearch", "No Highlight" }, + ["e"] = { "NvimTreeToggle", "Explorer" }, + b = { + name = "Buffers", + j = { "BufferLinePick", "Jump" }, + f = { "Telescope buffers previewer=false", "Find" }, + b = { "BufferLineCyclePrev", "Previous" }, + n = { "BufferLineCycleNext", "Next" }, + W = { "noautocmd w", "Save without formatting (noautocmd)" }, + -- w = { "BufferWipeout", "Wipeout" }, -- TODO: implement this for bufferline + e = { + "BufferLinePickClose", + "Pick which buffer to close", + }, + h = { "BufferLineCloseLeft", "Close all to the left" }, + l = { + "BufferLineCloseRight", + "Close all to the right", + }, + D = { + "BufferLineSortByDirectory", + "Sort by directory", + }, + L = { + "BufferLineSortByExtension", + "Sort by language", + }, + }, + d = { + name = "Debug", + t = { "lua require'dap'.toggle_breakpoint()", "Toggle Breakpoint" }, + b = { "lua require'dap'.step_back()", "Step Back" }, + c = { "lua require'dap'.continue()", "Continue" }, + C = { "lua require'dap'.run_to_cursor()", "Run To Cursor" }, + d = { "lua require'dap'.disconnect()", "Disconnect" }, + g = { "lua require'dap'.session()", "Get Session" }, + i = { "lua require'dap'.step_into()", "Step Into" }, + o = { "lua require'dap'.step_over()", "Step Over" }, + u = { "lua require'dap'.step_out()", "Step Out" }, + p = { "lua require'dap'.pause()", "Pause" }, + r = { "lua require'dap'.repl.toggle()", "Toggle Repl" }, + s = { "lua require'dap'.continue()", "Start" }, + q = { "lua require'dap'.close()", "Quit" }, + U = { "lua require'dapui'.toggle({reset = true})", "Toggle UI" }, + }, + p = { + name = "Plugins", + i = { "Lazy install", "Install" }, + s = { "Lazy sync", "Sync" }, + S = { "Lazy clear", "Status" }, + c = { "Lazy clean", "Clean" }, + u = { "Lazy update", "Update" }, + p = { "Lazy profile", "Profile" }, + l = { "Lazy log", "Log" }, + d = { "Lazy debug", "Debug" }, + }, + + -- " Available Debug Adapters: + -- " https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/ + -- " Adapter configuration and installation instructions: + -- " https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation + -- " Debug Adapter protocol: + -- " https://microsoft.github.io/debug-adapter-protocol/ + -- " Debugging + g = { + name = "Git", + g = { "lua require 'lvim.core.terminal'.lazygit_toggle()", "Lazygit" }, + j = { "lua require 'gitsigns'.nav_hunk('next', {navigation_message = false})", "Next Hunk" }, + k = { "lua require 'gitsigns'.nav_hunk('prev', {navigation_message = false})", "Prev Hunk" }, + l = { "lua require 'gitsigns'.blame_line()", "Blame" }, + L = { "lua require 'gitsigns'.blame_line({full=true})", "Blame Line (full)" }, + p = { "lua require 'gitsigns'.preview_hunk()", "Preview Hunk" }, + r = { "lua require 'gitsigns'.reset_hunk()", "Reset Hunk" }, + R = { "lua require 'gitsigns'.reset_buffer()", "Reset Buffer" }, + s = { "lua require 'gitsigns'.stage_hunk()", "Stage Hunk" }, + u = { + "lua require 'gitsigns'.undo_stage_hunk()", + "Undo Stage Hunk", + }, + o = { "Telescope git_status", "Open changed file" }, + b = { "Telescope git_branches", "Checkout branch" }, + c = { "Telescope git_commits", "Checkout commit" }, + C = { + "Telescope git_bcommits", + "Checkout commit(for current file)", + }, + d = { + "Gitsigns diffthis HEAD", + "Git Diff", + }, + }, + l = { + name = "LSP", + a = { "lua vim.lsp.buf.code_action()", "Code Action" }, + d = { "Telescope diagnostics bufnr=0 theme=get_ivy", "Buffer Diagnostics" }, + w = { "Telescope diagnostics", "Diagnostics" }, + f = { "lua require('lvim.lsp.utils').format()", "Format" }, + i = { "LspInfo", "Info" }, + I = { "Mason", "Mason Info" }, + j = { + "lua vim.diagnostic.goto_next()", + "Next Diagnostic", + }, + k = { + "lua vim.diagnostic.goto_prev()", + "Prev Diagnostic", + }, + l = { "lua vim.lsp.codelens.run()", "CodeLens Action" }, + q = { "lua vim.diagnostic.setloclist()", "Quickfix" }, + r = { "lua vim.lsp.buf.rename()", "Rename" }, + s = { "Telescope lsp_document_symbols", "Document Symbols" }, + S = { + "Telescope lsp_dynamic_workspace_symbols", + "Workspace Symbols", + }, + e = { "Telescope quickfix", "Telescope Quickfix" }, + }, + L = { + name = "+LunarVim", + c = { + "edit " .. get_config_dir() .. "/config.lua", + "Edit config.lua", + }, + d = { "LvimDocs", "View LunarVim's docs" }, + f = { + "lua require('lvim.core.telescope.custom-finders').find_lunarvim_files()", + "Find LunarVim files", + }, + g = { + "lua require('lvim.core.telescope.custom-finders').grep_lunarvim_files()", + "Grep LunarVim files", + }, + k = { "Telescope keymaps", "View LunarVim's keymappings" }, + i = { + "lua require('lvim.core.info').toggle_popup(vim.bo.filetype)", + "Toggle LunarVim Info", + }, + I = { + "lua require('lvim.core.telescope.custom-finders').view_lunarvim_changelog()", + "View LunarVim's changelog", + }, + l = { + name = "+logs", + d = { + "lua require('lvim.core.terminal').toggle_log_view(require('lvim.core.log').get_path())", + "view default log", + }, + D = { + "lua vim.fn.execute('edit ' .. require('lvim.core.log').get_path())", + "Open the default logfile", + }, + l = { + "lua require('lvim.core.terminal').toggle_log_view(vim.lsp.get_log_path())", + "view lsp log", + }, + L = { "lua vim.fn.execute('edit ' .. vim.lsp.get_log_path())", "Open the LSP logfile" }, + n = { + "lua require('lvim.core.terminal').toggle_log_view(os.getenv('NVIM_LOG_FILE'))", + "view neovim log", + }, + N = { "edit $NVIM_LOG_FILE", "Open the Neovim logfile" }, + }, + r = { "LvimReload", "Reload LunarVim's configuration" }, + u = { "LvimUpdate", "Update LunarVim" }, + }, + s = { + name = "Search", + b = { "Telescope git_branches", "Checkout branch" }, + c = { "Telescope colorscheme", "Colorscheme" }, + f = { "Telescope find_files", "Find File" }, + h = { "Telescope help_tags", "Find Help" }, + H = { "Telescope highlights", "Find highlight groups" }, + M = { "Telescope man_pages", "Man Pages" }, + r = { "Telescope oldfiles", "Open Recent File" }, + R = { "Telescope registers", "Registers" }, + t = { "Telescope live_grep", "Text" }, + k = { "Telescope keymaps", "Keymaps" }, + C = { "Telescope commands", "Commands" }, + l = { "Telescope resume", "Resume last search" }, + p = { + "lua require('telescope.builtin').colorscheme({enable_preview = true})", + "Colorscheme with Preview", + }, + }, + T = { + name = "Treesitter", + i = { ":TSConfigInfo", "Info" }, + }, + }, + } +end + +M.setup = function() + local which_key = require "which-key" + + which_key.setup(lvim.builtin.which_key.setup) + + local opts = lvim.builtin.which_key.opts + local vopts = lvim.builtin.which_key.vopts + + local mappings = lvim.builtin.which_key.mappings + local vmappings = lvim.builtin.which_key.vmappings + + which_key.register(mappings, opts) + which_key.register(vmappings, vopts) + + if lvim.builtin.which_key.on_config_done then + lvim.builtin.which_key.on_config_done(which_key) + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/icons.lua b/mac/.config/LunarVim/lua/lvim/icons.lua new file mode 100644 index 0000000..d9fb4cd --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/icons.lua @@ -0,0 +1,154 @@ +return { + kind = { + Array = "", + Boolean = "", + Class = "", + Color = "", + Constant = "", + Constructor = "", + Enum = "", + EnumMember = "", + Event = "", + Field = "", + File = "", + Folder = "󰉋", + Function = "", + Interface = "", + Key = "", + Keyword = "", + Method = "", + Module = "", + Namespace = "", + Null = "󰟢", + Number = "", + Object = "", + Operator = "", + Package = "", + Property = "", + Reference = "", + Snippet = "", + String = "", + Struct = "", + Text = "", + TypeParameter = "", + Unit = "", + Value = "", + Variable = "", + }, + git = { + LineAdded = "", + LineModified = "", + LineRemoved = "", + FileDeleted = "", + FileIgnored = "◌", + FileRenamed = "", + FileStaged = "S", + FileUnmerged = "", + FileUnstaged = "", + FileUntracked = "U", + Diff = "", + Repo = "", + Octoface = "", + Branch = "", + }, + ui = { + ArrowCircleDown = "", + ArrowCircleLeft = "", + ArrowCircleRight = "", + ArrowCircleUp = "", + BoldArrowDown = "", + BoldArrowLeft = "", + BoldArrowRight = "", + BoldArrowUp = "", + BoldClose = "", + BoldDividerLeft = "", + BoldDividerRight = "", + BoldLineLeft = "▎", + BookMark = "", + BoxChecked = "", + Bug = "", + Stacks = "", + Scopes = "", + Watches = "󰂥", + DebugConsole = "", + Calendar = "", + Check = "", + ChevronRight = "", + ChevronShortDown = "", + ChevronShortLeft = "", + ChevronShortRight = "", + ChevronShortUp = "", + Circle = " ", + Close = "󰅖", + CloudDownload = "", + Code = "", + Comment = "", + Dashboard = "", + DividerLeft = "", + DividerRight = "", + DoubleChevronRight = "»", + Ellipsis = "", + EmptyFolder = "", + EmptyFolderOpen = "", + File = "", + FileSymlink = "", + Files = "", + FindFile = "󰈞", + FindText = "󰊄", + Fire = "", + Folder = "󰉋", + FolderOpen = "", + FolderSymlink = "", + Forward = "", + Gear = "", + History = "", + Lightbulb = "", + LineLeft = "▏", + LineMiddle = "│", + List = "", + Lock = "", + NewFile = "", + Note = "", + Package = "", + Pencil = "󰏫", + Plus = "", + Project = "", + Search = "", + SignIn = "", + SignOut = "", + Tab = "󰌒", + Table = "", + Target = "󰀘", + Telescope = "", + Text = "", + Tree = "", + Triangle = "󰐊", + TriangleShortArrowDown = "", + TriangleShortArrowLeft = "", + TriangleShortArrowRight = "", + TriangleShortArrowUp = "", + }, + diagnostics = { + BoldError = "", + Error = "", + BoldWarning = "", + Warning = "", + BoldInformation = "", + Information = "", + BoldQuestion = "", + Question = "", + BoldHint = "", + Hint = "󰌶", + Debug = "", + Trace = "✎", + }, + misc = { + Robot = "󰚩", + Squirrel = "", + Tag = "", + Watch = "", + Smiley = "", + Package = "", + CircuitBoard = "", + }, +} diff --git a/mac/.config/LunarVim/lua/lvim/interface/popup.lua b/mac/.config/LunarVim/lua/lvim/interface/popup.lua new file mode 100644 index 0000000..84a27e1 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/interface/popup.lua @@ -0,0 +1,64 @@ +local Popup = {} + +--- Create a new floating window +-- @param config The configuration passed to vim.api.nvim_open_win +-- @param win_opts The options registered with vim.api.nvim_win_set_option +-- @param buf_opts The options registered with vim.api.nvim_buf_set_option +-- @return A new popup +function Popup:new(opts) + opts = opts or {} + opts.layout = opts.layout or {} + opts.win_opts = opts.win_opts or {} + opts.buf_opts = opts.buf_opts or {} + + Popup.__index = Popup + + local editor_layout = { + height = vim.o.lines - vim.o.cmdheight - 2, -- Add margin for status and buffer line + width = vim.o.columns, + } + local popup_layout = { + relative = "editor", + height = math.floor(editor_layout.height * 0.9), + width = math.floor(editor_layout.width * 0.8), + style = "minimal", + border = "rounded", + } + popup_layout.row = math.floor((editor_layout.height - popup_layout.height) / 2) + popup_layout.col = math.floor((editor_layout.width - popup_layout.width) / 2) + + local obj = { + buffer = vim.api.nvim_create_buf(false, true), + layout = vim.tbl_deep_extend("force", popup_layout, opts.layout), + win_opts = opts.win_opts, + buf_opts = opts.buf_opts, + } + + setmetatable(obj, Popup) + + return obj +end + +--- Display the popup with the provided content +-- @param content_provider A function accepting the popup's layout and returning the content to display +function Popup:display(content_provider) + self.win_id = vim.api.nvim_open_win(self.buffer, true, self.layout) + vim.api.nvim_command( + string.format("autocmd BufHidden,BufLeave ++once lua pcall(vim.api.nvim_win_close, %d, true)", self.win_id) + ) + + local lines = content_provider(self.layout) + vim.api.nvim_buf_set_lines(self.bufnr or 0, 0, -1, false, lines) + + -- window options + for key, value in pairs(self.win_opts) do + vim.api.nvim_set_option_value(key, value, { win = self.win_id or 0, scope = "local" }) + end + + -- buffer options + for key, value in pairs(self.buf_opts) do + vim.api.nvim_set_option_value(key, value, { buf = self.buffer }) + end +end + +return Popup diff --git a/mac/.config/LunarVim/lua/lvim/interface/text.lua b/mac/.config/LunarVim/lua/lvim/interface/text.lua new file mode 100644 index 0000000..0266d52 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/interface/text.lua @@ -0,0 +1,95 @@ +local M = {} + +local function max_len_line(lines) + local max_len = 0 + + for _, line in ipairs(lines) do + local line_len = line:len() + if line_len > max_len then + max_len = line_len + end + end + + return max_len +end + +--- Left align lines relatively to the parent container +-- @param container The container where lines will be displayed +-- @param lines The text to align +-- @param alignment The alignment value, range: [0-1] +function M.align_left(container, lines, alignment) + local max_len = max_len_line(lines) + local indent_amount = math.ceil(math.max(container.width - max_len, 0) * alignment) + return M.shift_right(lines, indent_amount) +end + +--- Center align lines relatively to the parent container +-- @param container The container where lines will be displayed +-- @param lines The text to align +-- @param alignment The alignment value, range: [0-1] +function M.align_center(container, lines, alignment) + local output = {} + local max_len = max_len_line(lines) + + for _, line in ipairs(lines) do + local padding = string.rep(" ", (math.max(container.width, max_len) - line:len()) * alignment) + table.insert(output, padding .. line) + end + + return output +end + +--- Shift lines by a given amount +-- @params lines The lines the shift +-- @param amount The amount of spaces to add +function M.shift_right(lines, amount) + local output = {} + local padding = string.rep(" ", amount) + + for _, line in ipairs(lines) do + table.insert(output, padding .. line) + end + + return output +end + +--- Pretty format tables +-- @param entries The table to format +-- @param col_count The number of column to span the table on +-- @param col_sep The separator between each column, default: " " +function M.format_table(entries, col_count, col_sep) + col_sep = col_sep or " " + + local col_rows = math.ceil(vim.tbl_count(entries) / col_count) + local cols = {} + local count = 0 + + for i, entry in ipairs(entries) do + if ((i - 1) % col_rows) == 0 then + table.insert(cols, {}) + count = count + 1 + end + table.insert(cols[count], entry) + end + + local col_max_len = {} + for _, col in ipairs(cols) do + table.insert(col_max_len, max_len_line(col)) + end + + local output = {} + for i, col in ipairs(cols) do + for j, entry in ipairs(col) do + if not output[j] then + output[j] = entry + else + local padding = string.rep(" ", col_max_len[i - 1] - cols[i - 1][j]:len()) + output[j] = output[j] .. padding .. col_sep .. entry + end + end + end + + return output +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/keymappings.lua b/mac/.config/LunarVim/lua/lvim/keymappings.lua new file mode 100644 index 0000000..e7010a3 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/keymappings.lua @@ -0,0 +1,177 @@ +local M = {} +local Log = require "lvim.core.log" + +local generic_opts_any = { noremap = true, silent = true } + +local generic_opts = { + insert_mode = generic_opts_any, + normal_mode = generic_opts_any, + visual_mode = generic_opts_any, + visual_block_mode = generic_opts_any, + command_mode = generic_opts_any, + operator_pending_mode = generic_opts_any, + term_mode = { silent = true }, +} + +local mode_adapters = { + insert_mode = "i", + normal_mode = "n", + term_mode = "t", + visual_mode = "v", + visual_block_mode = "x", + command_mode = "c", + operator_pending_mode = "o", +} + +---@class Keys +---@field insert_mode table +---@field normal_mode table +---@field terminal_mode table +---@field visual_mode table +---@field visual_block_mode table +---@field command_mode table +---@field operator_pending_mode table + +local defaults = { + insert_mode = { + -- Move current line / block with Alt-j/k ala vscode. + [""] = ":m .+1==gi", + -- Move current line / block with Alt-j/k ala vscode. + [""] = ":m .-2==gi", + -- navigation + [""] = "k", + [""] = "j", + [""] = "h", + [""] = "l", + }, + + normal_mode = { + -- Better window movement + [""] = "h", + [""] = "j", + [""] = "k", + [""] = "l", + + -- Resize with arrows + [""] = ":resize -2", + [""] = ":resize +2", + [""] = ":vertical resize -2", + [""] = ":vertical resize +2", + + -- Move current line / block with Alt-j/k a la vscode. + [""] = ":m .+1==", + [""] = ":m .-2==", + + -- QuickFix + ["]q"] = ":cnext", + ["[q"] = ":cprev", + [""] = ":call QuickFixToggle()", + }, + + term_mode = { + -- Terminal window navigation + [""] = "h", + [""] = "j", + [""] = "k", + [""] = "l", + }, + + visual_mode = { + -- Better indenting + ["<"] = ""] = ">gv", + + -- ["p"] = '"0p', + -- ["P"] = '"0P', + }, + + visual_block_mode = { + -- Move current line / block with Alt-j/k ala vscode. + [""] = ":m '>+1gv-gv", + [""] = ":m '<-2gv-gv", + }, + + command_mode = { + -- navigate tab completion with and + -- runs conditionally + [""] = { 'pumvisible() ? "\\" : "\\"', { expr = true, noremap = true } }, + [""] = { 'pumvisible() ? "\\" : "\\"', { expr = true, noremap = true } }, + }, +} + +if vim.fn.has "mac" == 1 then + defaults.normal_mode[""] = defaults.normal_mode[""] + defaults.normal_mode[""] = defaults.normal_mode[""] + defaults.normal_mode[""] = defaults.normal_mode[""] + defaults.normal_mode[""] = defaults.normal_mode[""] + Log:debug "Activated mac keymappings" +end + +-- Unsets all keybindings defined in keymaps +-- @param keymaps The table of key mappings containing a list per mode (normal_mode, insert_mode, ..) +function M.clear(keymaps) + local default = M.get_defaults() + for mode, mappings in pairs(keymaps) do + local translated_mode = mode_adapters[mode] and mode_adapters[mode] or mode + for key, _ in pairs(mappings) do + -- some plugins may override default bindings that the user hasn't manually overriden + if default[mode][key] ~= nil or (default[translated_mode] ~= nil and default[translated_mode][key] ~= nil) then + pcall(vim.api.nvim_del_keymap, translated_mode, key) + end + end + end +end + +-- Set key mappings individually +-- @param mode The keymap mode, can be one of the keys of mode_adapters +-- @param key The key of keymap +-- @param val Can be form as a mapping or tuple of mapping and user defined opt +function M.set_keymaps(mode, key, val) + local opt = generic_opts[mode] or generic_opts_any + if type(val) == "table" then + opt = val[2] + val = val[1] + end + if val then + vim.keymap.set(mode, key, val, opt) + else + pcall(vim.api.nvim_del_keymap, mode, key) + end +end + +-- Load key mappings for a given mode +-- @param mode The keymap mode, can be one of the keys of mode_adapters +-- @param keymaps The list of key mappings +function M.load_mode(mode, keymaps) + mode = mode_adapters[mode] or mode + for k, v in pairs(keymaps) do + M.set_keymaps(mode, k, v) + end +end + +-- Load key mappings for all provided modes +-- @param keymaps A list of key mappings for each mode +function M.load(keymaps) + keymaps = keymaps or {} + for mode, mapping in pairs(keymaps) do + M.load_mode(mode, mapping) + end +end + +-- Load the default keymappings +function M.load_defaults() + M.load(M.get_defaults()) + lvim.keys = lvim.keys or {} + for idx, _ in pairs(defaults) do + if not lvim.keys[idx] then + lvim.keys[idx] = {} + end + end +end + +-- Get the default keymappings +function M.get_defaults() + return defaults +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/lsp/config.lua b/mac/.config/LunarVim/lua/lvim/lsp/config.lua new file mode 100644 index 0000000..55f7d64 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/lsp/config.lua @@ -0,0 +1,164 @@ +local skipped_servers = { + "angularls", + "ansiblels", + "antlersls", + "ast_grep", + "azure_pipelines_ls", + "basedpyright", + "biome", + "bzl", + "ccls", + "css_variables", + "cssmodules_ls", + "custom_elements_ls", + "denols", + "docker_compose_language_service", + "dprint", + "elp", + "ember", + "emmet_language_server", + "emmet_ls", + "eslint", + "eslintls", + "fennel_language_server", + "gitlab_ci_ls", + "glint", + "glslls", + "golangci_lint_ls", + "gradle_ls", + "graphql", + "harper_ls", + "hdl_checker", + "hydra_lsp", + "htmx", + "java_language_server", + "jedi_language_server", + "lexical", + "ltex", + "lwc_ls", + "mdx_analyzer", + "neocmake", + "nim_langserver", + "ocamlls", + "omnisharp", + "phpactor", + "psalm", + "pylsp", + "pylyzer", + "pyre", + "quick_lint_js", + "reason_ls", + "rnix", + "rome", + "rubocop", + "ruby_ls", + "ruby_lsp", + "ruff_lsp", + "scry", + "snyk_ls", + "solang", + "solc", + "solidity_ls", + "solidity_ls_nomicfoundation", + "sorbet", + "sourcekit", + "somesass_ls", + "sourcery", + "spectral", + "sqlls", + "sqls", + "standardrb", + "stimulus_ls", + "stylelint_lsp", + "svlangserver", + "swift_mesonls", + "templ", + "tflint", + "tinymist", + "unocss", + "vale_ls", + "vacuum", + "verible", + "v_analyzer", + "vtsls", + "vuels", +} + +local skipped_filetypes = { "markdown", "rst", "plaintext", "toml", "proto" } + +local join_paths = require("lvim.utils").join_paths + +return { + templates_dir = join_paths(get_runtime_dir(), "site", "after", "ftplugin"), + ---@deprecated use vim.diagnostic.config({ ... }) instead + diagnostics = {}, + document_highlight = false, + code_lens_refresh = true, + on_attach_callback = nil, + on_init_callback = nil, + automatic_configuration = { + ---@usage list of servers that the automatic installer will skip + skipped_servers = skipped_servers, + ---@usage list of filetypes that the automatic installer will skip + skipped_filetypes = skipped_filetypes, + }, + buffer_mappings = { + normal_mode = { + ["K"] = { "lua vim.lsp.buf.hover()", "Show hover" }, + ["gd"] = { "lua vim.lsp.buf.definition()", "Goto definition" }, + ["gD"] = { "lua vim.lsp.buf.declaration()", "Goto Declaration" }, + ["gr"] = { "lua vim.lsp.buf.references()", "Goto references" }, + ["gI"] = { "lua vim.lsp.buf.implementation()", "Goto Implementation" }, + ["gs"] = { "lua vim.lsp.buf.signature_help()", "show signature help" }, + ["gl"] = { + function() + local float = vim.diagnostic.config().float + + if float then + local config = type(float) == "table" and float or {} + config.scope = "line" + + vim.diagnostic.open_float(config) + end + end, + "Show line diagnostics", + }, + }, + insert_mode = {}, + visual_mode = {}, + }, + buffer_options = { + --- enable completion triggered by + omnifunc = "v:lua.vim.lsp.omnifunc", + --- use gq for formatting + formatexpr = "v:lua.vim.lsp.formatexpr(#{timeout_ms:500})", + }, + ---@usage list of settings of nvim-lsp-installer + installer = { + setup = { + ensure_installed = {}, + automatic_installation = { + exclude = {}, + }, + }, + }, + nlsp_settings = { + setup = { + config_home = join_paths(get_config_dir(), "lsp-settings"), + -- set to false to overwrite schemastore.nvim + append_default_schemas = true, + ignored_servers = {}, + loader = "json", + }, + }, + null_ls = { + setup = { + debug = false, + }, + config = {}, + }, + ---@deprecated use lvim.lsp.automatic_configuration.skipped_servers instead + override = {}, + ---@deprecated use lvim.lsp.installer.setup.automatic_installation instead + automatic_servers_installation = nil, +} diff --git a/mac/.config/LunarVim/lua/lvim/lsp/init.lua b/mac/.config/LunarVim/lua/lvim/lsp/init.lua new file mode 100644 index 0000000..d59b29a --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/lsp/init.lua @@ -0,0 +1,128 @@ +local M = {} +local Log = require "lvim.core.log" +local utils = require "lvim.utils" +local autocmds = require "lvim.core.autocmds" + +local function add_lsp_buffer_options(bufnr) + for k, v in pairs(lvim.lsp.buffer_options) do + vim.api.nvim_set_option_value(k, v, { buf = bufnr }) + end +end + +local function add_lsp_buffer_keybindings(bufnr) + local mappings = { + normal_mode = "n", + insert_mode = "i", + visual_mode = "v", + } + + for mode_name, mode_char in pairs(mappings) do + for key, remap in pairs(lvim.lsp.buffer_mappings[mode_name]) do + local opts = { buffer = bufnr, desc = remap[2], noremap = true, silent = true } + vim.keymap.set(mode_char, key, remap[1], opts) + end + end +end + +function M.common_capabilities() + local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") + if status_ok then + return cmp_nvim_lsp.default_capabilities() + end + + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities.textDocument.completion.completionItem.snippetSupport = true + capabilities.textDocument.completion.completionItem.resolveSupport = { + properties = { + "documentation", + "detail", + "additionalTextEdits", + }, + } + + return capabilities +end + +function M.common_on_exit(_, _) + if lvim.lsp.document_highlight then + autocmds.clear_augroup "lsp_document_highlight" + end + if lvim.lsp.code_lens_refresh then + autocmds.clear_augroup "lsp_code_lens_refresh" + end +end + +function M.common_on_init(client, bufnr) + if lvim.lsp.on_init_callback then + lvim.lsp.on_init_callback(client, bufnr) + Log:debug "Called lsp.on_init_callback" + return + end +end + +function M.common_on_attach(client, bufnr) + if lvim.lsp.on_attach_callback then + lvim.lsp.on_attach_callback(client, bufnr) + Log:debug "Called lsp.on_attach_callback" + end + local lu = require "lvim.lsp.utils" + if lvim.lsp.document_highlight then + lu.setup_document_highlight(client, bufnr) + end + if lvim.lsp.code_lens_refresh then + lu.setup_codelens_refresh(client, bufnr) + end + add_lsp_buffer_keybindings(bufnr) + add_lsp_buffer_options(bufnr) + lu.setup_document_symbols(client, bufnr) +end + +function M.get_common_opts() + return { + on_attach = M.common_on_attach, + on_init = M.common_on_init, + on_exit = M.common_on_exit, + capabilities = M.common_capabilities(), + } +end + +function M.setup() + Log:debug "Setting up LSP support" + + local lsp_status_ok, _ = pcall(require, "lspconfig") + if not lsp_status_ok then + return + end + + if lvim.use_icons then + for _, sign in ipairs(vim.tbl_get(vim.diagnostic.config(), "signs", "values") or {}) do + vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = sign.name }) + end + end + + if not utils.is_directory(lvim.lsp.templates_dir) then + require("lvim.lsp.templates").generate_templates() + end + + pcall(function() + require("nlspsettings").setup(lvim.lsp.nlsp_settings.setup) + end) + + require("lvim.lsp.null-ls").setup() + + autocmds.configure_format_on_save() + + local function set_handler_opts_if_not_set(name, handler, opts) + if debug.getinfo(vim.lsp.handlers[name], "S").source:find(vim.env.VIMRUNTIME, 1, true) then + vim.lsp.handlers[name] = vim.lsp.with(handler, opts) + end + end + + set_handler_opts_if_not_set("textDocument/hover", vim.lsp.handlers.hover, { border = "rounded" }) + set_handler_opts_if_not_set("textDocument/signatureHelp", vim.lsp.handlers.signature_help, { border = "rounded" }) + + -- Enable rounded borders in :LspInfo window. + require("lspconfig.ui.windows").default_options.border = "rounded" +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/lsp/manager.lua b/mac/.config/LunarVim/lua/lvim/lsp/manager.lua new file mode 100644 index 0000000..5e695ec --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/lsp/manager.lua @@ -0,0 +1,141 @@ +local M = {} + +local Log = require "lvim.core.log" +local fmt = string.format +local lvim_lsp_utils = require "lvim.lsp.utils" +local is_windows = vim.loop.os_uname().version:match "Windows" + +local function resolve_mason_config(server_name) + local found, mason_config = pcall(require, "mason-lspconfig.server_configurations." .. server_name) + if not found then + Log:debug(fmt("mason configuration not found for %s", server_name)) + return {} + end + local server_mapping = require "mason-lspconfig.mappings.server" + local path = require "mason-core.path" + local pkg_name = server_mapping.lspconfig_to_package[server_name] + local install_dir = path.package_prefix(pkg_name) + local conf = mason_config(install_dir) + if is_windows and conf.cmd and conf.cmd[1] then + local exepath = vim.fn.exepath(conf.cmd[1]) + if exepath ~= "" then + conf.cmd[1] = exepath + end + end + Log:debug(fmt("resolved mason configuration for %s, got %s", server_name, vim.inspect(conf))) + return conf or {} +end + +---Resolve the configuration for a server by merging with the default config +---@param server_name string +---@vararg any config table [optional] +---@return table +local function resolve_config(server_name, ...) + local defaults = { + on_attach = require("lvim.lsp").common_on_attach, + on_init = require("lvim.lsp").common_on_init, + on_exit = require("lvim.lsp").common_on_exit, + capabilities = require("lvim.lsp").common_capabilities(), + } + + local has_custom_provider, custom_config = pcall(require, "lvim/lsp/providers/" .. server_name) + if has_custom_provider then + Log:debug("Using custom configuration for requested server: " .. server_name) + defaults = vim.tbl_deep_extend("force", defaults, custom_config) + end + + defaults = vim.tbl_deep_extend("force", defaults, ...) + + return defaults +end + +-- manually start the server and don't wait for the usual filetype trigger from lspconfig +local function buf_try_add(server_name, bufnr) + bufnr = bufnr or vim.api.nvim_get_current_buf() + require("lspconfig")[server_name].manager:try_add_wrapper(bufnr) +end + +-- check if the manager autocomd has already been configured since some servers can take a while to initialize +-- this helps guarding against a data-race condition where a server can get configured twice +-- which seems to occur only when attaching to single-files +local function client_is_configured(server_name, ft) + ft = ft or vim.bo.filetype + local active_autocmds = vim.api.nvim_get_autocmds { event = "FileType", pattern = ft } + for _, result in ipairs(active_autocmds) do + if result.desc ~= nil and result.desc:match("server " .. server_name .. " ") then + Log:debug(string.format("[%q] is already configured", server_name)) + return true + end + end + return false +end + +local function launch_server(server_name, config) + pcall(function() + local command = config.cmd + or (function() + local default_config = require("lspconfig.server_configurations." .. server_name).default_config + return default_config.cmd + end)() + -- some servers have dynamic commands defined with on_new_config + if type(command) == "table" and type(command[1]) == "string" and vim.fn.executable(command[1]) ~= 1 then + Log:debug(string.format("[%q] is either not installed, missing from PATH, or not executable.", server_name)) + return + end + require("lspconfig")[server_name].setup(config) + buf_try_add(server_name) + end) +end + +---Setup a language server by providing a name +---@param server_name string name of the language server +---@param user_config table? when available it will take predence over any default configurations +function M.setup(server_name, user_config) + vim.validate { name = { server_name, "string" } } + user_config = user_config or {} + + if lvim_lsp_utils.is_client_active(server_name) or client_is_configured(server_name) then + return + end + + local server_mapping = require "mason-lspconfig.mappings.server" + local registry = require "mason-registry" + + local pkg_name = server_mapping.lspconfig_to_package[server_name] + if not pkg_name then + local config = resolve_config(server_name, user_config) + launch_server(server_name, config) + return + end + + local should_auto_install = function(name) + local installer_settings = lvim.lsp.installer.setup + return installer_settings.automatic_installation + and not vim.tbl_contains(installer_settings.automatic_installation.exclude, name) + end + + if not registry.is_installed(pkg_name) then + if should_auto_install(server_name) then + Log:debug "Automatic server installation detected" + vim.notify_once(string.format("Installation in progress for [%s]", server_name), vim.log.levels.INFO) + local pkg = registry.get_package(pkg_name) + pkg:install():once("closed", function() + if pkg:is_installed() then + vim.schedule(function() + vim.notify_once(string.format("Installation complete for [%s]", server_name), vim.log.levels.INFO) + -- mason config is only available once the server has been installed + local config = resolve_config(server_name, resolve_mason_config(server_name), user_config) + launch_server(server_name, config) + end) + end + end) + else + Log:debug(server_name .. " is not managed by the automatic installer") + end + end + + local config = resolve_config(server_name, resolve_mason_config(server_name), user_config) + launch_server(server_name, config) +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/lsp/null-ls/code_actions.lua b/mac/.config/LunarVim/lua/lvim/lsp/null-ls/code_actions.lua new file mode 100644 index 0000000..50f4cfb --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/lsp/null-ls/code_actions.lua @@ -0,0 +1,26 @@ +local M = {} + +local Log = require "lvim.core.log" + +local null_ls = require "null-ls" +local services = require "lvim.lsp.null-ls.services" +local method = null_ls.methods.CODE_ACTION + +function M.list_registered(filetype) + local registered_providers = services.list_registered_providers_names(filetype) + return registered_providers[method] or {} +end + +function M.setup(actions_configs) + if vim.tbl_isempty(actions_configs) then + return + end + + local registered = services.register_sources(actions_configs, method) + + if #registered > 0 then + Log:debug("Registered the following action-handlers: " .. unpack(registered)) + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/lsp/null-ls/formatters.lua b/mac/.config/LunarVim/lua/lvim/lsp/null-ls/formatters.lua new file mode 100644 index 0000000..b4fb2f3 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/lsp/null-ls/formatters.lua @@ -0,0 +1,33 @@ +local M = {} + +local Log = require "lvim.core.log" + +local null_ls = require "null-ls" +local services = require "lvim.lsp.null-ls.services" +local method = null_ls.methods.FORMATTING + +function M.list_registered(filetype) + local registered_providers = services.list_registered_providers_names(filetype) + return registered_providers[method] or {} +end + +function M.list_supported(filetype) + local s = require "null-ls.sources" + local supported_formatters = s.get_supported(filetype, "formatting") + table.sort(supported_formatters) + return supported_formatters +end + +function M.setup(formatter_configs) + if vim.tbl_isempty(formatter_configs) then + return + end + + local registered = services.register_sources(formatter_configs, method) + + if #registered > 0 then + Log:debug("Registered the following formatters: " .. unpack(registered)) + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/lsp/null-ls/init.lua b/mac/.config/LunarVim/lua/lvim/lsp/null-ls/init.lua new file mode 100644 index 0000000..51a200f --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/lsp/null-ls/init.lua @@ -0,0 +1,16 @@ +local M = {} + +local Log = require "lvim.core.log" + +function M.setup() + local status_ok, null_ls = pcall(require, "null-ls") + if not status_ok then + Log:error "Missing null-ls dependency" + return + end + + local default_opts = require("lvim.lsp").get_common_opts() + null_ls.setup(vim.tbl_deep_extend("force", default_opts, lvim.lsp.null_ls.setup)) +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/lsp/null-ls/linters.lua b/mac/.config/LunarVim/lua/lvim/lsp/null-ls/linters.lua new file mode 100644 index 0000000..ba7670d --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/lsp/null-ls/linters.lua @@ -0,0 +1,43 @@ +local M = {} + +local Log = require "lvim.core.log" + +local null_ls = require "null-ls" +local services = require "lvim.lsp.null-ls.services" +local method = null_ls.methods.DIAGNOSTICS + +local alternative_methods = { + null_ls.methods.DIAGNOSTICS, + null_ls.methods.DIAGNOSTICS_ON_OPEN, + null_ls.methods.DIAGNOSTICS_ON_SAVE, +} + +function M.list_registered(filetype) + local registered_providers = services.list_registered_providers_names(filetype) + local providers_for_methods = vim.tbl_flatten(vim.tbl_map(function(m) + return registered_providers[m] or {} + end, alternative_methods)) + + return providers_for_methods +end + +function M.list_supported(filetype) + local s = require "null-ls.sources" + local supported_linters = s.get_supported(filetype, "diagnostics") + table.sort(supported_linters) + return supported_linters +end + +function M.setup(linter_configs) + if vim.tbl_isempty(linter_configs) then + return + end + + local registered = services.register_sources(linter_configs, method) + + if #registered > 0 then + Log:debug("Registered the following linters: " .. unpack(registered)) + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/lsp/null-ls/services.lua b/mac/.config/LunarVim/lua/lvim/lsp/null-ls/services.lua new file mode 100644 index 0000000..7dc0bb6 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/lsp/null-ls/services.lua @@ -0,0 +1,104 @@ +local M = {} + +local Log = require "lvim.core.log" + +local function find_root_dir() + local util = require "lspconfig/util" + local lsp_utils = require "lvim.lsp.utils" + + local ts_client = lsp_utils.is_client_active "typescript" + if ts_client then + return ts_client.config.root_dir + end + local dirname = vim.fn.expand "%:p:h" + return util.root_pattern "package.json"(dirname) +end + +local function from_node_modules(command) + local root_dir = find_root_dir() + + if not root_dir then + return nil + end + + local join_paths = require("lvim.utils").join_paths + return join_paths(root_dir, "node_modules", ".bin", command) +end + +local local_providers = { + prettier = { find = from_node_modules }, + prettierd = { find = from_node_modules }, + prettier_d_slim = { find = from_node_modules }, + eslint_d = { find = from_node_modules }, + eslint = { find = from_node_modules }, + stylelint = { find = from_node_modules }, +} + +function M.find_command(command) + if local_providers[command] then + local local_command = local_providers[command].find(command) + if local_command and vim.fn.executable(local_command) == 1 then + return local_command + end + end + + if command and vim.fn.executable(command) == 1 then + return command + end + return nil +end + +function M.list_registered_providers_names(filetype) + local s = require "null-ls.sources" + local available_sources = s.get_available(filetype) + local registered = {} + for _, source in ipairs(available_sources) do + for method in pairs(source.methods) do + registered[method] = registered[method] or {} + table.insert(registered[method], source.name) + end + end + return registered +end + +function M.register_sources(configs, method) + local null_ls = require "null-ls" + local is_registered = require("null-ls.sources").is_registered + + local sources, registered_names = {}, {} + + for _, config in ipairs(configs) do + local cmd = config.exe or config.command + local name = config.name or cmd:gsub("-", "_") + local type = method == null_ls.methods.CODE_ACTION and "code_actions" or null_ls.methods[method]:lower() + local source = type and null_ls.builtins[type][name] + Log:debug(string.format("Received request to register [%s] as a %s source", name, type)) + if not source then + Log:error("Not a valid source: " .. name) + elseif is_registered { name = source.name or name, method = method } then + Log:trace(string.format("Skipping registering [%s] more than once", name)) + else + local command = M.find_command(source._opts.command) or source._opts.command + + -- treat `args` as `extra_args` for backwards compatibility. Can otherwise use `generator_opts.args` + local compat_opts = vim.deepcopy(config) + if config.args then + compat_opts.extra_args = config.args or config.extra_args + compat_opts.args = nil + end + + local opts = vim.tbl_deep_extend("keep", { command = command }, compat_opts) + Log:debug("Registering source " .. name) + Log:trace(vim.inspect(opts)) + table.insert(sources, source.with(opts)) + vim.list_extend(registered_names, { source.name }) + end + end + + if #sources > 0 then + null_ls.register { sources = sources } + end + return registered_names +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/lsp/providers/jsonls.lua b/mac/.config/LunarVim/lua/lvim/lsp/providers/jsonls.lua new file mode 100644 index 0000000..76aea25 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/lsp/providers/jsonls.lua @@ -0,0 +1,18 @@ +local opts = { + settings = { + json = { + schemas = require("schemastore").json.schemas(), + }, + }, + setup = { + commands = { + Format = { + function() + vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 }) + end, + }, + }, + }, +} + +return opts diff --git a/mac/.config/LunarVim/lua/lvim/lsp/providers/lua_ls.lua b/mac/.config/LunarVim/lua/lvim/lsp/providers/lua_ls.lua new file mode 100644 index 0000000..952e04d --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/lsp/providers/lua_ls.lua @@ -0,0 +1,64 @@ +local default_workspace = { + library = { + vim.fn.expand "$VIMRUNTIME", + get_lvim_base_dir(), + require("neodev.config").types(), + "${3rd}/busted/library", + "${3rd}/luassert/library", + "${3rd}/luv/library", + }, + + maxPreload = 5000, + preloadFileSize = 10000, +} + +local add_packages_to_workspace = function(packages, config) + -- config.settings.Lua = config.settings.Lua or { workspace = default_workspace } + local runtimedirs = vim.api.nvim__get_runtime({ "lua" }, true, { is_lua = true }) + local workspace = config.settings.Lua.workspace + for _, v in pairs(runtimedirs) do + for _, pack in ipairs(packages) do + if v:match(pack) and not vim.tbl_contains(workspace.library, v) then + table.insert(workspace.library, v) + end + end + end +end + +local lspconfig = require "lspconfig" + +local make_on_new_config = function(on_new_config, _) + return lspconfig.util.add_hook_before(on_new_config, function(new_config, _) + local server_name = new_config.name + + if server_name ~= "lua_ls" then + return + end + local plugins = { "plenary.nvim", "telescope.nvim", "nvim-treesitter", "LuaSnip" } + add_packages_to_workspace(plugins, new_config) + end) +end + +lspconfig.util.default_config = vim.tbl_extend("force", lspconfig.util.default_config, { + on_new_config = make_on_new_config(lspconfig.util.default_config.on_new_config), +}) + +local opts = { + settings = { + Lua = { + telemetry = { enable = false }, + runtime = { + version = "LuaJIT", + special = { + reload = "require", + }, + }, + diagnostics = { + globals = { "vim", "lvim", "reload" }, + }, + workspace = default_workspace, + }, + }, +} + +return opts diff --git a/mac/.config/LunarVim/lua/lvim/lsp/providers/tailwindcss.lua b/mac/.config/LunarVim/lua/lvim/lsp/providers/tailwindcss.lua new file mode 100644 index 0000000..ebf0a1c --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/lsp/providers/tailwindcss.lua @@ -0,0 +1,15 @@ +local opts = { + root_dir = function(fname) + local util = require "lspconfig/util" + return util.root_pattern( + "tailwind.config.js", + "tailwind.config.ts", + "tailwind.config.cjs", + "tailwind.js", + "tailwind.ts", + "tailwind.cjs" + )(fname) + end, +} + +return opts diff --git a/mac/.config/LunarVim/lua/lvim/lsp/providers/vuels.lua b/mac/.config/LunarVim/lua/lvim/lsp/providers/vuels.lua new file mode 100644 index 0000000..326363f --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/lsp/providers/vuels.lua @@ -0,0 +1,26 @@ +local opts = { + setup = { + root_dir = function(fname) + local util = require "lvim.lspconfig/util" + return util.root_pattern "package.json"(fname) or util.root_pattern "vue.config.js"(fname) or vim.fn.getcwd() + end, + init_options = { + config = { + vetur = { + completion = { + autoImport = true, + tagCasing = "kebab", + useScaffoldSnippets = true, + }, + useWorkspaceDependencies = true, + validation = { + script = true, + style = true, + template = true, + }, + }, + }, + }, + }, +} +return opts diff --git a/mac/.config/LunarVim/lua/lvim/lsp/providers/yamlls.lua b/mac/.config/LunarVim/lua/lvim/lsp/providers/yamlls.lua new file mode 100644 index 0000000..c9764fc --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/lsp/providers/yamlls.lua @@ -0,0 +1,16 @@ +local opts = { + settings = { + yaml = { + hover = true, + completion = true, + validate = true, + schemaStore = { + enable = true, + url = "https://www.schemastore.org/api/json/catalog.json", + }, + schemas = require("schemastore").yaml.schemas(), + }, + }, +} + +return opts diff --git a/mac/.config/LunarVim/lua/lvim/lsp/templates.lua b/mac/.config/LunarVim/lua/lvim/lsp/templates.lua new file mode 100644 index 0000000..4a65fac --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/lsp/templates.lua @@ -0,0 +1,76 @@ +local M = {} + +local Log = require "lvim.core.log" +local utils = require "lvim.utils" +local lvim_lsp_utils = require "lvim.lsp.utils" + +local ftplugin_dir = lvim.lsp.templates_dir + +local join_paths = _G.join_paths + +function M.remove_template_files() + -- remove any outdated files + for _, file in ipairs(vim.fn.glob(ftplugin_dir .. "/*.lua", 1, 1)) do + vim.fn.delete(file) + vim.wait(10) + end +end + +local skipped_filetypes = lvim.lsp.automatic_configuration.skipped_filetypes +local skipped_servers = lvim.lsp.automatic_configuration.skipped_servers + +---Check if we should skip generating an ftplugin file based on the server_name +---@param server_name string name of a valid language server +local function should_skip(server_name) + return vim.tbl_contains(skipped_servers, server_name) +end + +---Generates an ftplugin file based on the server_name in the selected directory +---@param server_name string name of a valid language server, e.g. pyright, gopls, tsserver, etc. +---@param dir string the full path to the desired directory +function M.generate_ftplugin(server_name, dir) + if should_skip(server_name) then + return + end + + -- get the supported filetypes and remove any ignored ones + local filetypes = vim.tbl_filter(function(ft) + return not vim.tbl_contains(skipped_filetypes, ft) + end, lvim_lsp_utils.get_supported_filetypes(server_name) or {}) + + if not filetypes then + return + end + + for _, filetype in ipairs(filetypes) do + filetype = filetype:match "%.([^.]*)$" or filetype + local filename = join_paths(dir, filetype .. ".lua") + local setup_cmd = string.format([[require("lvim.lsp.manager").setup(%q)]], server_name) + -- print("using setup_cmd: " .. setup_cmd) + -- overwrite the file completely + utils.write_file(filename, setup_cmd .. "\n", "a") + end +end + +---Generates ftplugin files based on a list of server_names +---The files are generated to a runtimepath: "$LUNARVIM_RUNTIME_DIR/site/after/ftplugin/template.lua" +---@param servers_names? table list of servers to be enabled. Will add all by default +function M.generate_templates(servers_names) + servers_names = servers_names or lvim_lsp_utils.get_supported_servers() + + Log:debug "Templates installation in progress" + + M.remove_template_files() + + -- create the directory if it didn't exist + if not utils.is_directory(lvim.lsp.templates_dir) then + vim.fn.mkdir(ftplugin_dir, "p") + end + + for _, server in ipairs(servers_names) do + M.generate_ftplugin(server, ftplugin_dir) + end + Log:debug "Templates installation is complete" +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/lsp/utils.lua b/mac/.config/LunarVim/lua/lvim/lsp/utils.lua new file mode 100644 index 0000000..0d9bcd7 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/lsp/utils.lua @@ -0,0 +1,185 @@ +local M = {} + +local tbl = require "lvim.utils.table" +local Log = require "lvim.core.log" + +function M.is_client_active(name) + local clients = vim.lsp.get_clients() + return tbl.find_first(clients, function(client) + return client.name == name + end) +end + +function M.get_active_clients_by_ft(filetype) + local matches = {} + local clients = vim.lsp.get_clients() + for _, client in pairs(clients) do + local supported_filetypes = client.config.filetypes or {} + if client.name ~= "null-ls" and vim.tbl_contains(supported_filetypes, filetype) then + table.insert(matches, client) + end + end + return matches +end + +function M.get_client_capabilities(client_id) + local client = vim.lsp.get_client_by_id(tonumber(client_id)) + if not client then + Log:warn("Unable to determine client from client_id: " .. client_id) + return + end + + local enabled_caps = {} + for capability, status in pairs(client.server_capabilities) do + if status == true then + table.insert(enabled_caps, capability) + end + end + + return enabled_caps +end + +---Get supported filetypes per server +---@param server_name string can be any server supported by nvim-lsp-installer +---@return string[] supported filestypes as a list of strings +function M.get_supported_filetypes(server_name) + local status_ok, config = pcall(require, ("lspconfig.server_configurations.%s"):format(server_name)) + if not status_ok then + return {} + end + + return config.default_config.filetypes or {} +end + +---Get supported servers per filetype +---@param filter { filetype: string | string[] }?: (optional) Used to filter the list of server names. +---@return string[] list of names of supported servers +function M.get_supported_servers(filter) + -- force synchronous mode, see: |mason-registry.refresh()| + require("mason-registry").refresh() + require("mason-registry").get_all_packages() + + local _, supported_servers = pcall(function() + return require("mason-lspconfig").get_available_servers(filter) + end) + return supported_servers or {} +end + +---Get all supported filetypes by nvim-lsp-installer +---@return string[] supported filestypes as a list of strings +function M.get_all_supported_filetypes() + local status_ok, filetype_server_map = pcall(require, "mason-lspconfig.mappings.filetype") + if not status_ok then + return {} + end + return vim.tbl_keys(filetype_server_map or {}) +end + +function M.setup_document_highlight(client, bufnr) + if lvim.builtin.illuminate.active then + Log:debug "skipping setup for document_highlight, illuminate already active" + return + end + local status_ok, highlight_supported = pcall(function() + return client.supports_method "textDocument/documentHighlight" + end) + if not status_ok or not highlight_supported then + return + end + local group = "lsp_document_highlight" + local hl_events = { "CursorHold", "CursorHoldI" } + + local ok, hl_autocmds = pcall(vim.api.nvim_get_autocmds, { + group = group, + buffer = bufnr, + event = hl_events, + }) + + if ok and #hl_autocmds > 0 then + return + end + + vim.api.nvim_create_augroup(group, { clear = false }) + vim.api.nvim_create_autocmd(hl_events, { + group = group, + buffer = bufnr, + callback = vim.lsp.buf.document_highlight, + }) + vim.api.nvim_create_autocmd("CursorMoved", { + group = group, + buffer = bufnr, + callback = vim.lsp.buf.clear_references, + }) +end + +function M.setup_document_symbols(client, bufnr) + vim.g.navic_silence = false -- can be set to true to suppress error + local symbols_supported = client.supports_method "textDocument/documentSymbol" + if not symbols_supported then + Log:debug("skipping setup for document_symbols, method not supported by " .. client.name) + return + end + local status_ok, navic = pcall(require, "nvim-navic") + if status_ok then + navic.attach(client, bufnr) + end +end + +function M.setup_codelens_refresh(client, bufnr) + local status_ok, codelens_supported = pcall(function() + return client.supports_method "textDocument/codeLens" + end) + if not status_ok or not codelens_supported then + return + end + local group = "lsp_code_lens_refresh" + local cl_events = { "BufEnter", "InsertLeave" } + local ok, cl_autocmds = pcall(vim.api.nvim_get_autocmds, { + group = group, + buffer = bufnr, + event = cl_events, + }) + + if ok and #cl_autocmds > 0 then + return + end + vim.api.nvim_create_augroup(group, { clear = false }) + vim.api.nvim_create_autocmd(cl_events, { + group = group, + buffer = bufnr, + callback = function() + vim.lsp.codelens.refresh { bufnr = bufnr } + end, + }) +end + +---filter passed to vim.lsp.buf.format +---always selects null-ls if it's available and caches the value per buffer +---@param client table client attached to a buffer +---@return boolean if client matches +function M.format_filter(client) + local filetype = vim.bo.filetype + local n = require "null-ls" + local s = require "null-ls.sources" + local method = n.methods.FORMATTING + local available_formatters = s.get_available(filetype, method) + + if #available_formatters > 0 then + return client.name == "null-ls" + elseif client.supports_method "textDocument/formatting" then + return true + else + return false + end +end + +---Simple wrapper for vim.lsp.buf.format() to provide defaults +---@param opts table|nil +function M.format(opts) + opts = opts or {} + opts.filter = opts.filter or M.format_filter + + return vim.lsp.buf.format(opts) +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/plugin-loader.lua b/mac/.config/LunarVim/lua/lvim/plugin-loader.lua new file mode 100644 index 0000000..485b8b3 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/plugin-loader.lua @@ -0,0 +1,138 @@ +local plugin_loader = {} + +local utils = require "lvim.utils" +local Log = require "lvim.core.log" +local join_paths = utils.join_paths + +local plugins_dir = join_paths(get_runtime_dir(), "site", "pack", "lazy", "opt") + +function plugin_loader.init(opts) + opts = opts or {} + + local lazy_install_dir = opts.install_path + or join_paths(vim.fn.stdpath "data", "site", "pack", "lazy", "opt", "lazy.nvim") + + if not utils.is_directory(lazy_install_dir) then + print "Initializing first time setup" + local core_plugins_dir = join_paths(get_lvim_base_dir(), "plugins") + if utils.is_directory(core_plugins_dir) then + vim.fn.mkdir(plugins_dir, "p") + vim.fn.delete(plugins_dir, "rf") + require("lvim.utils").fs_copy(core_plugins_dir, plugins_dir) + else + vim.fn.system { + "git", + "clone", + "--branch=stable", + "https://github.com/folke/lazy.nvim.git", + lazy_install_dir, + } + + local default_snapshot_path = join_paths(get_lvim_base_dir(), "snapshots", "default.json") + local snapshot = assert(vim.fn.json_decode(vim.fn.readfile(default_snapshot_path))) + vim.fn.system { + "git", + "-C", + lazy_install_dir, + "checkout", + snapshot["lazy.nvim"].commit, + } + end + + vim.api.nvim_create_autocmd("User", { pattern = "LazyDone", callback = require("lvim.lsp").setup }) + end + + local rtp = vim.opt.rtp:get() + local base_dir = (vim.env.LUNARVIM_BASE_DIR or get_runtime_dir() .. "/lvim"):gsub("\\", "/") + local idx_base = #rtp + 1 + for i, path in ipairs(rtp) do + path = path:gsub("\\", "/") + if path == base_dir then + idx_base = i + 1 + break + end + end + table.insert(rtp, idx_base, lazy_install_dir) + table.insert(rtp, idx_base + 1, join_paths(plugins_dir, "*")) + vim.opt.rtp = rtp + + pcall(function() + -- set a custom path for lazy's cache + local lazy_cache = require "lazy.core.cache" + lazy_cache.path = join_paths(get_cache_dir(), "lazy", "luac") + end) +end + +function plugin_loader.reload(spec) + local Config = require "lazy.core.config" + local lazy = require "lazy" + + -- TODO: reset cache? and unload plugins? + + Config.spec = spec + + require("lazy.core.plugin").load(true) + require("lazy.core.plugin").update_state() + + local not_installed_plugins = vim.tbl_filter(function(plugin) + return not plugin._.installed + end, Config.plugins) + + require("lazy.manage").clear() + + if #not_installed_plugins > 0 then + lazy.install { wait = true } + end + + if #Config.to_clean > 0 then + -- TODO: set show to true when lazy shows something useful on clean + lazy.clean { wait = true, show = false } + end +end + +function plugin_loader.load(configurations) + Log:debug "loading plugins configuration" + local lazy_available, lazy = pcall(require, "lazy") + if not lazy_available then + Log:warn "skipping loading plugins until lazy.nvim is installed" + return + end + + -- remove plugins from rtp before loading lazy, so that all plugins won't be loaded on startup + vim.opt.runtimepath:remove(join_paths(plugins_dir, "*")) + + local status_ok = xpcall(function() + table.insert(lvim.lazy.opts.install.colorscheme, 1, lvim.colorscheme) + lazy.setup(configurations, lvim.lazy.opts) + end, debug.traceback) + + if not status_ok then + Log:warn "problems detected while loading plugins' configurations" + Log:trace(debug.traceback()) + end +end + +function plugin_loader.get_core_plugins() + local names = {} + local plugins = require "lvim.plugins" + local get_name = require("lazy.core.plugin").Spec.get_name + for _, spec in pairs(plugins) do + if spec.enabled == true or spec.enabled == nil then + table.insert(names, get_name(spec[1])) + end + end + return names +end + +function plugin_loader.sync_core_plugins() + local core_plugins = plugin_loader.get_core_plugins() + Log:trace(string.format("Syncing core plugins: [%q]", table.concat(core_plugins, ", "))) + require("lazy").update { wait = true, plugins = core_plugins } +end + +function plugin_loader.ensure_plugins() + Log:debug "calling lazy.install()" + require("lazy").install { wait = true } +end + +return plugin_loader diff --git a/mac/.config/LunarVim/lua/lvim/plugins.lua b/mac/.config/LunarVim/lua/lvim/plugins.lua new file mode 100644 index 0000000..4f76399 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/plugins.lua @@ -0,0 +1,385 @@ +-- local require = require("lvim.utils.require").require +local core_plugins = { + { "folke/lazy.nvim", tag = "stable" }, + { + "neovim/nvim-lspconfig", + lazy = true, + dependencies = { "mason-lspconfig.nvim", "nlsp-settings.nvim" }, + }, + { + "williamboman/mason-lspconfig.nvim", + cmd = { "LspInstall", "LspUninstall" }, + config = function() + require("mason-lspconfig").setup(lvim.lsp.installer.setup) + + -- automatic_installation is handled by lsp-manager + local settings = require "mason-lspconfig.settings" + settings.current.automatic_installation = false + end, + lazy = true, + event = "User FileOpened", + dependencies = "mason.nvim", + }, + { "tamago324/nlsp-settings.nvim", cmd = "LspSettings", lazy = true }, + { "nvimtools/none-ls.nvim", lazy = true }, + { + "williamboman/mason.nvim", + config = function() + require("lvim.core.mason").setup() + end, + cmd = { "Mason", "MasonInstall", "MasonUninstall", "MasonUninstallAll", "MasonLog" }, + build = function() + pcall(function() + require("mason-registry").refresh() + end) + end, + event = "User FileOpened", + lazy = true, + }, + { + "folke/tokyonight.nvim", + lazy = not vim.startswith(lvim.colorscheme, "tokyonight"), + }, + { + "lunarvim/lunar.nvim", + lazy = lvim.colorscheme ~= "lunar", + }, + { "Tastyep/structlog.nvim", lazy = true }, + { "nvim-lua/plenary.nvim", cmd = { "PlenaryBustedFile", "PlenaryBustedDirectory" }, lazy = true }, + -- Telescope + { + "nvim-telescope/telescope.nvim", + branch = "0.1.x", + config = function() + require("lvim.core.telescope").setup() + end, + dependencies = { "telescope-fzf-native.nvim" }, + lazy = true, + cmd = "Telescope", + enabled = lvim.builtin.telescope.active, + }, + { "nvim-telescope/telescope-fzf-native.nvim", build = "make", lazy = true, enabled = lvim.builtin.telescope.active }, + -- Install nvim-cmp, and buffer source as a dependency + { + "hrsh7th/nvim-cmp", + config = function() + if lvim.builtin.cmp then + require("lvim.core.cmp").setup() + end + end, + event = { "InsertEnter", "CmdlineEnter" }, + dependencies = { + "cmp-nvim-lsp", + "cmp_luasnip", + "cmp-buffer", + "cmp-path", + "cmp-cmdline", + }, + }, + { "hrsh7th/cmp-nvim-lsp", lazy = true }, + { "saadparwaiz1/cmp_luasnip", lazy = true }, + { "hrsh7th/cmp-buffer", lazy = true }, + { "hrsh7th/cmp-path", lazy = true }, + { + "hrsh7th/cmp-cmdline", + lazy = true, + enabled = lvim.builtin.cmp and lvim.builtin.cmp.cmdline.enable or false, + }, + { + "L3MON4D3/LuaSnip", + config = function() + local utils = require "lvim.utils" + local paths = {} + if lvim.builtin.luasnip.sources.friendly_snippets then + paths[#paths + 1] = utils.join_paths(get_runtime_dir(), "site", "pack", "lazy", "opt", "friendly-snippets") + end + local user_snippets = utils.join_paths(get_config_dir(), "snippets") + if utils.is_directory(user_snippets) then + paths[#paths + 1] = user_snippets + end + require("luasnip.loaders.from_lua").lazy_load() + require("luasnip.loaders.from_vscode").lazy_load { + paths = paths, + } + require("luasnip.loaders.from_snipmate").lazy_load() + end, + event = "InsertEnter", + dependencies = { + "friendly-snippets", + }, + }, + { "rafamadriz/friendly-snippets", lazy = true, cond = lvim.builtin.luasnip.sources.friendly_snippets }, + { + "folke/neodev.nvim", + lazy = true, + }, + + -- Autopairs + { + "windwp/nvim-autopairs", + event = "InsertEnter", + config = function() + require("lvim.core.autopairs").setup() + end, + enabled = lvim.builtin.autopairs.active, + dependencies = { "nvim-treesitter/nvim-treesitter", "hrsh7th/nvim-cmp" }, + }, + + -- Treesitter + { + "nvim-treesitter/nvim-treesitter", + -- run = ":TSUpdate", + config = function() + local utils = require "lvim.utils" + local path = utils.join_paths(get_runtime_dir(), "site", "pack", "lazy", "opt", "nvim-treesitter") + vim.opt.rtp:prepend(path) -- treesitter needs to be before nvim's runtime in rtp + require("lvim.core.treesitter").setup() + end, + cmd = { + "TSInstall", + "TSUninstall", + "TSUpdate", + "TSUpdateSync", + "TSInstallInfo", + "TSInstallSync", + "TSInstallFromGrammar", + }, + event = "User FileOpened", + }, + { + -- Lazy loaded by Comment.nvim pre_hook + "JoosepAlviste/nvim-ts-context-commentstring", + lazy = true, + }, + + -- NvimTree + { + "nvim-tree/nvim-tree.lua", + config = function() + require("lvim.core.nvimtree").setup() + end, + enabled = lvim.builtin.nvimtree.active, + cmd = { "NvimTreeToggle", "NvimTreeOpen", "NvimTreeFocus", "NvimTreeFindFileToggle" }, + event = "User DirOpened", + }, + -- Lir + { + "tamago324/lir.nvim", + config = function() + require("lvim.core.lir").setup() + end, + enabled = lvim.builtin.lir.active, + event = "User DirOpened", + }, + { + "lewis6991/gitsigns.nvim", + config = function() + require("lvim.core.gitsigns").setup() + end, + event = "User FileOpened", + cmd = "Gitsigns", + enabled = lvim.builtin.gitsigns.active, + }, + + -- Whichkey + { + "folke/which-key.nvim", + config = function() + require("lvim.core.which-key").setup() + end, + cmd = "WhichKey", + event = "VeryLazy", + enabled = lvim.builtin.which_key.active, + }, + + -- Comments + { + "numToStr/Comment.nvim", + config = function() + require("lvim.core.comment").setup() + end, + keys = { { "gc", mode = { "n", "v" } }, { "gb", mode = { "n", "v" } } }, + event = "User FileOpened", + enabled = lvim.builtin.comment.active, + }, + + -- project.nvim + { + "ahmedkhalf/project.nvim", + config = function() + require("lvim.core.project").setup() + end, + enabled = lvim.builtin.project.active, + event = "VimEnter", + cmd = "Telescope projects", + }, + + -- Icons + { + "nvim-tree/nvim-web-devicons", + enabled = lvim.use_icons, + lazy = true, + }, + + -- Status Line and Bufferline + { + -- "hoob3rt/lualine.nvim", + "nvim-lualine/lualine.nvim", + -- "Lunarvim/lualine.nvim", + config = function() + require("lvim.core.lualine").setup() + end, + event = "VimEnter", + enabled = lvim.builtin.lualine.active, + }, + + -- breadcrumbs + { + "SmiteshP/nvim-navic", + config = function() + require("lvim.core.breadcrumbs").setup() + end, + event = "User FileOpened", + enabled = lvim.builtin.breadcrumbs.active, + }, + + { + "akinsho/bufferline.nvim", + config = function() + require("lvim.core.bufferline").setup() + end, + branch = "main", + event = "User FileOpened", + enabled = lvim.builtin.bufferline.active, + }, + + -- Debugging + { + "mfussenegger/nvim-dap", + config = function() + require("lvim.core.dap").setup() + end, + lazy = true, + dependencies = { + "rcarriga/nvim-dap-ui", + }, + enabled = lvim.builtin.dap.active, + }, + + -- Debugger user interface + { + "rcarriga/nvim-dap-ui", + config = function() + require("lvim.core.dap").setup_ui() + end, + lazy = true, + enabled = lvim.builtin.dap.active, + }, + + -- alpha + { + "goolord/alpha-nvim", + config = function() + require("lvim.core.alpha").setup() + end, + enabled = lvim.builtin.alpha.active, + event = "VimEnter", + }, + + -- Terminal + { + "akinsho/toggleterm.nvim", + branch = "main", + init = function() + require("lvim.core.terminal").init() + end, + config = function() + require("lvim.core.terminal").setup() + end, + cmd = { + "ToggleTerm", + "TermExec", + "ToggleTermToggleAll", + "ToggleTermSendCurrentLine", + "ToggleTermSendVisualLines", + "ToggleTermSendVisualSelection", + }, + keys = lvim.builtin.terminal.open_mapping, + enabled = lvim.builtin.terminal.active, + }, + + -- SchemaStore + { + "b0o/schemastore.nvim", + lazy = true, + }, + + { + "RRethy/vim-illuminate", + config = function() + require("lvim.core.illuminate").setup() + end, + event = "User FileOpened", + enabled = lvim.builtin.illuminate.active, + }, + + { + "lukas-reineke/indent-blankline.nvim", + config = function() + require("lvim.core.indentlines").setup() + end, + event = "User FileOpened", + enabled = lvim.builtin.indentlines.active, + }, + + { + "lunarvim/onedarker.nvim", + branch = "freeze", + config = function() + pcall(function() + if lvim and lvim.colorscheme == "onedarker" then + require("onedarker").setup() + lvim.builtin.lualine.options.theme = "onedarker" + end + end) + end, + lazy = lvim.colorscheme ~= "onedarker", + }, + + { + "lunarvim/bigfile.nvim", + config = function() + pcall(function() + require("bigfile").setup(lvim.builtin.bigfile.config) + end) + end, + enabled = lvim.builtin.bigfile.active, + dependencies = { "nvim-treesitter/nvim-treesitter" }, + event = { "FileReadPre", "BufReadPre", "User FileOpened" }, + }, +} + +local default_snapshot_path = join_paths(get_lvim_base_dir(), "snapshots", "default.json") +local content = vim.fn.readfile(default_snapshot_path) +local default_sha1 = assert(vim.fn.json_decode(content)) + +-- taken from +local get_short_name = function(long_name) + local name = long_name:sub(-4) == ".git" and long_name:sub(1, -5) or long_name + local slash = name:reverse():find("/", 1, true) --[[@as number?]] + return slash and name:sub(#name - slash + 2) or long_name:gsub("%W+", "_") +end + +local get_default_sha1 = function(spec) + local short_name = get_short_name(spec[1]) + return default_sha1[short_name] and default_sha1[short_name].commit +end + +if not vim.env.LVIM_DEV_MODE then + -- Manually lock the commit hashes of core plugins + for _, spec in ipairs(core_plugins) do + spec["commit"] = get_default_sha1(spec) + end +end + +return core_plugins diff --git a/mac/.config/LunarVim/lua/lvim/utils.lua b/mac/.config/LunarVim/lua/lvim/utils.lua new file mode 100644 index 0000000..5e49906 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/utils.lua @@ -0,0 +1,132 @@ +local M = {} +local uv = vim.loop + +-- recursive Print (structure, limit, separator) +local function r_inspect_settings(structure, limit, separator) + limit = limit or 100 -- default item limit + separator = separator or "." -- indent string + if limit < 1 then + print "ERROR: Item limit reached." + return limit - 1 + end + if structure == nil then + io.write("-- O", separator:sub(2), " = nil\n") + return limit - 1 + end + local ts = type(structure) + + if ts == "table" then + for k, v in pairs(structure) do + -- replace non alpha keys with ["key"] + if tostring(k):match "[^%a_]" then + k = '["' .. tostring(k) .. '"]' + end + limit = r_inspect_settings(v, limit, separator .. "." .. tostring(k)) + if limit < 0 then + break + end + end + return limit + end + + if ts == "string" then + -- escape sequences + structure = string.format("%q", structure) + end + separator = separator:gsub("%.%[", "%[") + if type(structure) == "function" then + -- don't print functions + io.write("-- lvim", separator:sub(2), " = function ()\n") + else + io.write("lvim", separator:sub(2), " = ", tostring(structure), "\n") + end + return limit - 1 +end + +function M.generate_settings() + -- Opens a file in append mode + local file = io.open("lv-settings.lua", "w") + + -- sets the default output file as test.lua + io.output(file) + + -- write all `lvim` related settings to `lv-settings.lua` file + r_inspect_settings(lvim, 10000, ".") + + -- closes the open file + io.close(file) +end + +--- Returns a table with the default values that are missing. +--- either parameter can be empty. +--@param config (table) table containing entries that take priority over defaults +--@param default_config (table) table contatining default values if found +function M.apply_defaults(config, default_config) + config = config or {} + default_config = default_config or {} + local new_config = vim.tbl_deep_extend("keep", vim.empty_dict(), config) + new_config = vim.tbl_deep_extend("keep", new_config, default_config) + return new_config +end + +--- Checks whether a given path exists and is a file. +--@param path (string) path to check +--@returns (bool) +function M.is_file(path) + local stat = uv.fs_stat(path) + return stat and stat.type == "file" or false +end + +--- Checks whether a given path exists and is a directory +--@param path (string) path to check +--@returns (bool) +function M.is_directory(path) + local stat = uv.fs_stat(path) + return stat and stat.type == "directory" or false +end + +M.join_paths = _G.join_paths + +---Write data to a file +---@param path string can be full or relative to `cwd` +---@param txt string|table text to be written, uses `vim.inspect` internally for tables +---@param flag string used to determine access mode, common flags: "w" for `overwrite` or "a" for `append` +function M.write_file(path, txt, flag) + local data = type(txt) == "string" and txt or vim.inspect(txt) + uv.fs_open(path, flag, 438, function(open_err, fd) + assert(not open_err, open_err) + uv.fs_write(fd, data, -1, function(write_err) + assert(not write_err, write_err) + uv.fs_close(fd, function(close_err) + assert(not close_err, close_err) + end) + end) + end) +end + +---Copies a file or directory recursively +---@param source string +---@param destination string +function M.fs_copy(source, destination) + local source_stats = assert(vim.loop.fs_stat(source)) + + if source_stats.type == "file" then + assert(vim.loop.fs_copyfile(source, destination)) + return + elseif source_stats.type == "directory" then + local handle = assert(vim.loop.fs_scandir(source)) + + assert(vim.loop.fs_mkdir(destination, source_stats.mode)) + + while true do + local name = vim.loop.fs_scandir_next(handle) + if not name then + break + end + + M.fs_copy(M.join_paths(source, name), M.join_paths(destination, name)) + end + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/utils/git.lua b/mac/.config/LunarVim/lua/lvim/utils/git.lua new file mode 100644 index 0000000..d5f1d92 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/utils/git.lua @@ -0,0 +1,152 @@ +local M = {} + +local Log = require "lvim.core.log" +local fmt = string.format +local if_nil = vim.F.if_nil + +local function git_cmd(opts) + local plenary_loaded, Job = pcall(require, "plenary.job") + if not plenary_loaded then + return 1, { "" } + end + + opts = opts or {} + opts.cwd = opts.cwd or get_lvim_base_dir() + + local stderr = {} + local stdout, ret = Job:new({ + command = "git", + args = opts.args, + cwd = opts.cwd, + on_stderr = function(_, data) + table.insert(stderr, data) + end, + }):sync(10000) + + if not vim.tbl_isempty(stderr) then + Log:debug(stderr) + end + + if not vim.tbl_isempty(stdout) then + Log:debug(stdout) + end + + return ret, stdout, stderr +end + +local function safe_deep_fetch() + local ret, result, error = git_cmd { args = { "rev-parse", "--is-shallow-repository" } } + if ret ~= 0 then + Log:error(vim.inspect(error)) + return + end + -- git fetch --unshallow will cause an error on a complete clone + local fetch_mode = result[1] == "true" and "--unshallow" or "--all" + ret = git_cmd { args = { "fetch", fetch_mode } } + if ret ~= 0 then + Log:error(fmt "Git fetch %s failed! Please pull the changes manually in %s", fetch_mode, get_lvim_base_dir()) + return + end + if fetch_mode == "--unshallow" then + ret = git_cmd { args = { "remote", "set-branches", "origin", "*" } } + if ret ~= 0 then + Log:error(fmt "Git fetch %s failed! Please pull the changes manually in %s", fetch_mode, get_lvim_base_dir()) + return + end + end + return true +end + +---pulls the latest changes from github +function M.update_base_lvim() + Log:info "Checking for updates" + + if not vim.loop.fs_access(get_lvim_base_dir(), "w") then + Log:warn(fmt("Lunarvim update aborted! cannot write to %s", get_lvim_base_dir())) + return + end + + if not safe_deep_fetch() then + return + end + + local ret + + ret = git_cmd { args = { "diff", "--quiet", "@{upstream}" } } + if ret == 0 then + Log:info "LunarVim is already up-to-date" + return + end + + ret = git_cmd { args = { "merge", "--ff-only", "--progress" } } + if ret ~= 0 then + Log:error("Update failed! Please pull the changes manually in " .. get_lvim_base_dir()) + return + end + + return true +end + +---Switch Lunarvim to the specified development branch +---@param branch string +function M.switch_lvim_branch(branch) + if not safe_deep_fetch() then + return + end + local args = { "switch", branch } + + if branch:match "^[0-9]" then + -- avoids producing an error for tags + vim.list_extend(args, { "--detach" }) + end + + local ret = git_cmd { args = args } + if ret ~= 0 then + Log:error "Unable to switch branches! Check the log for further information" + return + end + return true +end + +---Get the current Lunarvim development branch +---@return string|nil +function M.get_lvim_branch() + local _, results = git_cmd { args = { "rev-parse", "--abbrev-ref", "HEAD" } } + local branch = if_nil(results[1], "") + return branch +end + +---Get currently checked-out tag of Lunarvim +---@return string +function M.get_lvim_tag() + local args = { "describe", "--tags", "--abbrev=0" } + + local _, results = git_cmd { args = args } + local tag = if_nil(results[1], "") + return tag +end + +---Get the description of currently checked-out commit of Lunarvim +---@return string|nil +function M.get_lvim_description() + local _, results = git_cmd { args = { "describe", "--dirty", "--always" } } + + local description = if_nil(results[1], M.get_lvim_branch()) + return description +end + +---Get currently running version of Lunarvim +---@return string +function M.get_lvim_version() + local current_branch = M.get_lvim_branch() + + local lvim_version + if current_branch ~= "HEAD" or "" then + lvim_version = current_branch .. "-" .. M.get_lvim_description() + else + lvim_version = "v" .. M.get_lvim_tag() + end + return lvim_version +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/utils/hooks.lua b/mac/.config/LunarVim/lua/lvim/utils/hooks.lua new file mode 100644 index 0000000..2bf2ff0 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/utils/hooks.lua @@ -0,0 +1,76 @@ +local M = {} + +local Log = require "lvim.core.log" +local in_headless = #vim.api.nvim_list_uis() == 0 +local plugin_loader = require "lvim.plugin-loader" + +function M.run_pre_update() + Log:debug "Starting pre-update hook" +end + +function M.run_pre_reload() + Log:debug "Starting pre-reload hook" +end + +-- TODO: convert to lazy.nvim +-- function M.run_on_packer_complete() +-- -- FIXME(kylo252): nvim-tree.lua/lua/nvim-tree/view.lua:442: Invalid window id +-- vim.g.colors_name = lvim.colorscheme +-- pcall(vim.cmd.colorscheme, lvim.colorscheme) +-- end + +function M.run_post_reload() + Log:debug "Starting post-reload hook" +end + +---Reset any startup cache files used by lazy.nvim +---It also forces regenerating any template ftplugin files +---Tip: Useful for clearing any outdated settings +function M.reset_cache() + local lvim_modules = {} + for module, _ in pairs(package.loaded) do + if module:match "lvim.core" or module:match "lvim.lsp" then + package.loaded[module] = nil + table.insert(lvim_modules, module) + end + end + Log:trace(string.format("Cache invalidated for core modules: { %s }", table.concat(lvim_modules, ", "))) + require("lvim.lsp.templates").generate_templates() +end + +function M.run_post_update() + Log:debug "Starting post-update hook" + + if vim.fn.has "nvim-0.9" ~= 1 then + local compat_tag = "1.2.0" + vim.notify( + "Please upgrade your Neovim base installation. Newer version of Lunarvim requires v0.9+", + vim.log.levels.WARN + ) + vim.wait(1000) + local ret = reload("lvim.utils.git").switch_lvim_branch(compat_tag) + if ret then + vim.notify("Reverted to the last known compatible version: " .. compat_tag, vim.log.levels.WARN) + end + return + end + + M.reset_cache() + + Log:debug "Syncing core plugins" + plugin_loader.reload { reload "lvim.plugins", lvim.plugins } + plugin_loader.sync_core_plugins() + M.reset_cache() -- force cache clear and templates regen once more + + if not in_headless then + vim.schedule(function() + if package.loaded["nvim-treesitter"] then + vim.cmd [[ TSUpdateSync ]] + end + -- TODO: add a changelog + vim.notify("Update complete", vim.log.levels.INFO) + end) + end +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/utils/modules.lua b/mac/.config/LunarVim/lua/lvim/utils/modules.lua new file mode 100644 index 0000000..45cacfa --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/utils/modules.lua @@ -0,0 +1,122 @@ +local M = {} + +local Log = require "lvim.core.log" +-- revisit this +-- function prequire(package) +-- local status, lib = pcall(require, package) +-- if status then +-- return lib +-- else +-- vim.notify("Failed to require '" .. package .. "' from " .. debug.getinfo(2).source) +-- return nil +-- end +-- end + +local function _assign(old, new, k) + local otype = type(old[k]) + local ntype = type(new[k]) + -- print("hi") + if (otype == "thread" or otype == "userdata") or (ntype == "thread" or ntype == "userdata") then + vim.notify(string.format("warning: old or new attr %s type be thread or userdata", k)) + end + old[k] = new[k] +end + +local function _replace(old, new, repeat_tbl) + if repeat_tbl[old] then + return + end + repeat_tbl[old] = true + + local dellist = {} + for k, _ in pairs(old) do + if not new[k] then + table.insert(dellist, k) + end + end + for _, v in ipairs(dellist) do + old[v] = nil + end + + for k, _ in pairs(new) do + if not old[k] then + old[k] = new[k] + else + if type(old[k]) ~= type(new[k]) then + Log:debug( + string.format("Reloader: mismatch between old [%s] and new [%s] type for [%s]", type(old[k]), type(new[k]), k) + ) + _assign(old, new, k) + else + if type(old[k]) == "table" then + _replace(old[k], new[k], repeat_tbl) + else + _assign(old, new, k) + end + end + end + end +end + +M.require_clean = function(m) + package.loaded[m] = nil + _G[m] = nil + local _, module = pcall(require, m) + return module +end + +M.require_safe = function(mod) + local status_ok, module = pcall(require, mod) + if not status_ok then + local trace = debug.getinfo(2, "SL") + local shorter_src = trace.short_src + local lineinfo = shorter_src .. ":" .. (trace.currentline or trace.linedefined) + local msg = string.format("%s : skipped loading [%s]", lineinfo, mod) + Log:debug(msg) + end + return module +end + +M.reload = function(mod) + if not package.loaded[mod] then + return M.require_safe(mod) + end + + local old = package.loaded[mod] + package.loaded[mod] = nil + local new = M.require_safe(mod) + + if type(old) == "table" and type(new) == "table" then + local repeat_tbl = {} + _replace(old, new, repeat_tbl) + end + + package.loaded[mod] = old + return old +end + +-- code from +function M.require_on_index(require_path) + return setmetatable({}, { + __index = function(_, key) + return require(require_path)[key] + end, + + __newindex = function(_, key, value) + require(require_path)[key] = value + end, + }) +end + +-- code from +function M.require_on_exported_call(require_path) + return setmetatable({}, { + __index = function(_, k) + return function(...) + return require(require_path)[k](...) + end + end, + }) +end + +return M diff --git a/mac/.config/LunarVim/lua/lvim/utils/table.lua b/mac/.config/LunarVim/lua/lvim/utils/table.lua new file mode 100644 index 0000000..1ac5949 --- /dev/null +++ b/mac/.config/LunarVim/lua/lvim/utils/table.lua @@ -0,0 +1,24 @@ +local Table = {} + +--- Find the first entry for which the predicate returns true. +-- @param t The table +-- @param predicate The function called for each entry of t +-- @return The entry for which the predicate returned True or nil +function Table.find_first(t, predicate) + for _, entry in pairs(t) do + if predicate(entry) then + return entry + end + end + return nil +end + +--- Check if the predicate returns True for at least one entry of the table. +-- @param t The table +-- @param predicate The function called for each entry of t +-- @return True if predicate returned True at least once, false otherwise +function Table.contains(t, predicate) + return Table.find_first(t, predicate) ~= nil +end + +return Table diff --git a/mac/.config/LunarVim/snapshots/default.json b/mac/.config/LunarVim/snapshots/default.json new file mode 100644 index 0000000..381d6e2 --- /dev/null +++ b/mac/.config/LunarVim/snapshots/default.json @@ -0,0 +1,131 @@ +{ + "Comment.nvim": { + "commit": "0236521" + }, + "LuaSnip": { + "commit": "1def353" + }, + "alpha-nvim": { + "commit": "29074ee" + }, + "bigfile.nvim": { + "commit": "33eb067" + }, + "bufferline.nvim": { + "commit": "73edc1f" + }, + "cmp-buffer": { + "commit": "3022dbc" + }, + "cmp-cmdline": { + "commit": "d250c63" + }, + "cmp-nvim-lsp": { + "commit": "39e2eda" + }, + "cmp-path": { + "commit": "91ff86c" + }, + "cmp_luasnip": { + "commit": "05a9ab2" + }, + "friendly-snippets": { + "commit": "dd2fd12" + }, + "gitsigns.nvim": { + "commit": "805610a" + }, + "indent-blankline.nvim": { + "commit": "9637670" + }, + "lazy.nvim": { + "commit": "8f19915" + }, + "lir.nvim": { + "commit": "7a9d45d" + }, + "lualine.nvim": { + "commit": "0a5a668" + }, + "lunar.nvim": { + "commit": "08bbc93" + }, + "mason-lspconfig.nvim": { + "commit": "a4caa0d" + }, + "mason.nvim": { + "commit": "49ff59a" + }, + "neodev.nvim": { + "commit": "ce9a2e8" + }, + "nlsp-settings.nvim": { + "commit": "d92035e" + }, + "none-ls.nvim": { + "commit": "3a48266" + }, + "nvim-autopairs": { + "commit": "c15de7e" + }, + "nvim-cmp": { + "commit": "5260e5e" + }, + "nvim-dap": { + "commit": "5a2f712" + }, + "nvim-dap-ui": { + "commit": "34160a7" + }, + "nvim-lspconfig": { + "commit": "eadcee1" + }, + "nvim-navic": { + "commit": "8649f69" + }, + "nvim-tree.lua": { + "commit": "2bc725a" + }, + "nvim-treesitter": { + "commit": "30de5e7" + }, + "nvim-ts-context-commentstring": { + "commit": "cb06438" + }, + "nvim-web-devicons": { + "commit": "e37bb1f" + }, + "onedarker.nvim": { + "commit": "b00dd21" + }, + "plenary.nvim": { + "commit": "a3e3bc8" + }, + "project.nvim": { + "commit": "8c6bad7" + }, + "schemastore.nvim": { + "commit": "9a5992a" + }, + "structlog.nvim": { + "commit": "45b26a2" + }, + "telescope-fzf-native.nvim": { + "commit": "9ef21b2" + }, + "telescope.nvim": { + "commit": "d829aa6" + }, + "toggleterm.nvim": { + "commit": "fee58a0" + }, + "tokyonight.nvim": { + "commit": "b9b494f" + }, + "vim-illuminate": { + "commit": "5eeb795" + }, + "which-key.nvim": { + "commit": "4433e5e" + } +} diff --git a/mac/.config/LunarVim/tests/lvim/helpers.lua b/mac/.config/LunarVim/tests/lvim/helpers.lua new file mode 100644 index 0000000..83f7a1a --- /dev/null +++ b/mac/.config/LunarVim/tests/lvim/helpers.lua @@ -0,0 +1,32 @@ +local M = {} + +function M.search_file(file, args) + local Job = require "plenary.job" + local stderr = {} + local stdout, ret = Job:new({ + command = "grep", + args = { args, file }, + cwd = vim.loop.cwd(), + on_stderr = function(_, data) + table.insert(stderr, data) + end, + }):sync() + return ret, stdout, stderr +end + +function M.log_contains(query) + local logfile = require("lvim.core.log"):get_path() + local ret, stdout, stderr = M.search_file(logfile, query) + if ret == 0 then + return true + end + if not vim.tbl_isempty(stderr) then + error(vim.inspect(stderr)) + end + if not vim.tbl_isempty(stdout) then + error(vim.inspect(stdout)) + end + return false +end + +return M diff --git a/mac/.config/LunarVim/tests/minimal_init.lua b/mac/.config/LunarVim/tests/minimal_init.lua new file mode 100644 index 0000000..e9fe3d6 --- /dev/null +++ b/mac/.config/LunarVim/tests/minimal_init.lua @@ -0,0 +1,12 @@ +local path_sep = vim.loop.os_uname().version:match "Windows" and "\\" or "/" +local base_dir = vim.env.LUNARVIM_BASE_DIR +local tests_dir = base_dir .. path_sep .. "tests" + +vim.opt.rtp:append(tests_dir) +vim.opt.rtp:append(base_dir) + +require("lvim.bootstrap"):init(base_dir) + +-- NOTE: careful about name collisions +-- see https://github.com/nvim-lualine/lualine.nvim/pull/621 +require "tests.lvim.helpers" diff --git a/mac/.config/LunarVim/tests/minimal_lsp.lua b/mac/.config/LunarVim/tests/minimal_lsp.lua new file mode 100644 index 0000000..46f5c0e --- /dev/null +++ b/mac/.config/LunarVim/tests/minimal_lsp.lua @@ -0,0 +1,112 @@ +local on_windows = vim.loop.os_uname().version:match "Windows" + +local function join_paths(...) + local path_sep = on_windows and "\\" or "/" + local result = table.concat({ ... }, path_sep) + return result +end + +vim.cmd [[set runtimepath=$VIMRUNTIME]] + +local temp_dir = vim.loop.os_getenv "TEMP" or "/tmp" + +vim.cmd("set packpath=" .. join_paths(temp_dir, "nvim", "site")) + +local package_root = join_paths(temp_dir, "nvim", "site", "pack") +local plugins_dir = join_paths(package_root, "lazy", "opt") +local install_path = join_paths(package_root, "lazy.nvim") + +-- Choose whether to use the executable that's managed by mason +local use_lsp_installer = true + +local function load_plugins() + vim.opt.rtp:prepend(install_path) + require("lazy").setup({ + "neovim/nvim-lspconfig", + "williamboman/mason-lspconfig.nvim", + "williamboman/mason.nvim", + }, { + root = plugins_dir, + }) +end + +function _G.dump(...) + local objects = vim.tbl_map(vim.inspect, { ... }) + print(unpack(objects)) + return ... +end + +_G.load_config = function() + vim.lsp.set_log_level "trace" + require("vim.lsp.log").set_format_func(vim.inspect) + local nvim_lsp = require "lspconfig" + local on_attach = function(_, bufnr) + local function buf_set_option(k, v) + vim.api.nvim_set_option_value(k, v, { buf = bufnr }) + end + + buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc") + + -- Mappings. + local opts = { buffer = bufnr, noremap = true, silent = true } + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) + vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts) + vim.keymap.set("n", "", vim.lsp.buf.signature_help, opts) + vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, opts) + vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, opts) + vim.keymap.set("n", "wl", function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, opts) + vim.keymap.set("n", "lD", vim.lsp.buf.type_definition, opts) + vim.keymap.set("n", "lr", vim.lsp.buf.rename, opts) + vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) + vim.keymap.set("n", "gl", vim.diagnostic.open_float, opts) + vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) + vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts) + vim.keymap.set("n", "q", vim.diagnostic.setloclist, opts) + vim.keymap.set("n", "li", "LspInfo", opts) + vim.keymap.set("n", "lI", "Mason", opts) + end + + -- Add the server that troubles you here, e.g. "clangd", "pyright", "tsserver" + local name = "lua_ls" + + local setup_opts = { + on_attach = on_attach, + } + + if not name then + print "You have not defined a server name, please edit minimal_init.lua" + end + if not nvim_lsp[name].document_config.default_config.cmd and not setup_opts.cmd then + print [[You have not defined a server default cmd for a server + that requires it please edit minimal_init.lua]] + end + + nvim_lsp[name].setup(setup_opts) + if use_lsp_installer then + require("mason-lspconfig").setup { automatic_installation = true } + end + + print [[You can find your log at $HOME/.cache/nvim/lsp.log. Please paste in a github issue under a details tag as described in the issue template.]] +end + +if vim.fn.isdirectory(install_path) == 0 then + print "Installing lazy.nvim" + vim.fn.system { + "git", + "clone", + "--filter=blob:none", + "--single-branch", + "https://github.com/folke/lazy.nvim.git", + install_path, + } + load_plugins() + vim.cmd [[autocmd User LazyDone ++once lua load_config()]] +else + load_plugins() + require("lazy").sync() + _G.load_config() +end diff --git a/mac/.config/LunarVim/tests/specs/bootstrap_spec.lua b/mac/.config/LunarVim/tests/specs/bootstrap_spec.lua new file mode 100644 index 0000000..bb52955 --- /dev/null +++ b/mac/.config/LunarVim/tests/specs/bootstrap_spec.lua @@ -0,0 +1,57 @@ +local uv = vim.loop +local home_dir = uv.os_homedir() + +describe("initial start", function() + before_each(function() + vim.cmd [[ + let v:errmsg = "" + let v:errors = [] + ]] + end) + + after_each(function() + local errmsg = vim.fn.eval "v:errmsg" + local exception = vim.fn.eval "v:exception" + local errors = vim.fn.eval "v:errors" + assert.equal("", errmsg) + assert.equal("", exception) + assert.True(vim.tbl_isempty(errors)) + end) + + local lvim_config_path = get_config_dir() + local lvim_runtime_path = get_runtime_dir() + local lvim_cache_path = get_cache_dir() + + it("should be able to detect test environment", function() + assert.truthy(os.getenv "LVIM_TEST_ENV") + assert.falsy(package.loaded["lvim.impatient"]) + end) + + it("should be able to use lunarvim cache directory using vim.fn", function() + assert.equal(lvim_cache_path, vim.fn.stdpath "cache") + end) + + it("should be to retrieve default neovim directories", function() + local xdg_config = os.getenv "XDG_CONFIG_HOME" or join_paths(home_dir, ".config") + assert.equal(join_paths(xdg_config, "nvim"), vim.call("stdpath", "config")) + end) + + it("should be able to read lunarvim directories", function() + local rtp_list = vim.opt.rtp:get() + assert.truthy(vim.tbl_contains(rtp_list, lvim_runtime_path .. "/lvim")) + assert.truthy(vim.tbl_contains(rtp_list, lvim_config_path)) + end) + + it("should be able to run treesitter without errors", function() + assert.truthy(vim.treesitter.highlighter.active) + end) + + it("should be able to pass basic checkhealth without errors", function() + vim.cmd "set cmdheight&" + vim.cmd "silent checkhealth nvim" + local errmsg = vim.fn.eval "v:errmsg" + local exception = vim.fn.eval "v:exception" + assert.equal("", errmsg) -- v:errmsg was not updated. + assert.equal("", exception) + end) +end) diff --git a/mac/.config/LunarVim/tests/specs/config_loader_spec.lua b/mac/.config/LunarVim/tests/specs/config_loader_spec.lua new file mode 100644 index 0000000..565f1a5 --- /dev/null +++ b/mac/.config/LunarVim/tests/specs/config_loader_spec.lua @@ -0,0 +1,54 @@ +local config = require "lvim.config" +local fmt = string.format + +describe("config-loader", function() + local user_config_path = join_paths(get_config_dir(), "config.lua") + local default_config_path = join_paths(get_lvim_base_dir(), "utils", "installer", "config.example.lua") + + before_each(function() + os.execute(fmt("cp -f %s %s", default_config_path, user_config_path)) + vim.cmd [[ + let v:errmsg = "" + let v:errors = [] + ]] + end) + + after_each(function() + local errmsg = vim.fn.eval "v:errmsg" + local exception = vim.fn.eval "v:exception" + local errors = vim.fn.eval "v:errors" + assert.equal("", errmsg) + assert.equal("", exception) + assert.True(vim.tbl_isempty(errors)) + end) + + it("should be able to find user-config", function() + assert.equal(user_config_path, get_config_dir() .. "/config.lua") + end) + + it("should be able to load user-config without errors", function() + config:load(user_config_path) + end) + + it("should be able to reload user-config without errors", function() + config:load(user_config_path) + local test_path = "/tmp/lvim" + os.execute(string.format([[echo "vim.opt.undodir = '%s'" >> %s]], test_path, user_config_path)) + config:reload() + vim.schedule(function() + assert.equal(vim.opt.undodir:get()[1], test_path) + end) + end) + + it("should not get interrupted by errors in user-config", function() + local test_path = "/tmp/lunarvim" + os.execute(string.format([[echo "vim.opt.undodir = '%s'" >> %s]], test_path, user_config_path)) + config:load(user_config_path) + assert.equal(vim.opt.undodir:get()[1], test_path) + require("lvim.core.log"):set_level "error" + lvim.log.level = "error" + os.execute(string.format("echo 'ignore_me()' >> %s", user_config_path)) + config:load(user_config_path) + assert.equal(vim.opt.undodir:get()[1], test_path) + end) +end) diff --git a/mac/.config/LunarVim/tests/specs/lsp_spec.lua b/mac/.config/LunarVim/tests/specs/lsp_spec.lua new file mode 100644 index 0000000..3f81405 --- /dev/null +++ b/mac/.config/LunarVim/tests/specs/lsp_spec.lua @@ -0,0 +1,94 @@ +local utils = require "lvim.utils" +local helpers = require "tests.lvim.helpers" +local spy = require "luassert.spy" + +describe("lsp workflow", function() + before_each(function() + vim.cmd [[ + let v:errmsg = "" + let v:errors = [] + ]] + end) + + after_each(function() + local errmsg = vim.fn.eval "v:errmsg" + local exception = vim.fn.eval "v:exception" + local errors = vim.fn.eval "v:errors" + assert.equal("", errmsg) + assert.equal("", exception) + assert.True(vim.tbl_isempty(errors)) + end) + + lvim.lsp.templates_dir = join_paths(get_cache_dir(), "artifacts") + vim.go.loadplugins = true + local plugins = require "lvim.plugins" + require("lvim.plugin-loader").load { plugins, lvim.plugins } + + -- trigger loading event manually for mason + vim.api.nvim_exec_autocmds("User", { pattern = "FileOpened" }) + + it("should be able to delete ftplugin templates", function() + if utils.is_directory(lvim.lsp.templates_dir) then + vim.fn.delete(lvim.lsp.templates_dir, "rf") + vim.wait(100) + end + assert.False(utils.is_directory(lvim.lsp.templates_dir)) + end) + + it("should be able to generate ftplugin templates", function() + if utils.is_directory(lvim.lsp.templates_dir) then + vim.fn.delete(lvim.lsp.templates_dir, "rf") + vim.wait(100) + end + + require("lvim.lsp").setup() + vim.wait(500) + + local template_files = vim.fn.glob(lvim.lsp.templates_dir .. "/*.lua", 1, 1) + assert.False(vim.tbl_isempty(template_files)) + end) + + it("should not include blacklisted servers in the generated templates", function() + require("lvim.lsp").setup() + + for _, server_name in ipairs(lvim.lsp.automatic_configuration.skipped_servers) do + local setup_cmd = string.format([[require("lvim.lsp.manager").setup(%q)]], server_name) + local _, stdout, _ = helpers.search_file(lvim.lsp.templates_dir, setup_cmd) + assert.True(vim.tbl_isempty(stdout)) + end + end) + + it("should only include one server per generated template", function() + require("lvim.lsp").setup() + vim.wait(500) + + local allowed_dupes = { "tailwindcss", "ruff" } + local template_files = vim.fn.glob(lvim.lsp.templates_dir .. "/*.lua", 1, 1) + for _, file in ipairs(template_files) do + local content = {} + for entry in io.lines(file) do + local server_name = entry:match [[.*setup%("(.*)"%)]] + if not vim.tbl_contains(allowed_dupes, server_name) then + table.insert(content, server_name) + end + end + local err_msg = "" + if #content > 1 then + err_msg = string.format( + "found more than one server for [%q]: \n{\n %q \n}", + file:match "[^/]*.lua$", + table.concat(content, ", ") + ) + end + assert.equal(err_msg, "") + end + end) + + it("should not attempt to re-generate ftplugin templates", function() + local s = spy.on(require "lvim.lsp.templates", "generate_templates") + + require("lvim.lsp").setup() + assert.spy(s):was_not_called() + s:revert() + end) +end) diff --git a/mac/.config/LunarVim/tests/specs/plugins_load_spec.lua b/mac/.config/LunarVim/tests/specs/plugins_load_spec.lua new file mode 100644 index 0000000..94896d2 --- /dev/null +++ b/mac/.config/LunarVim/tests/specs/plugins_load_spec.lua @@ -0,0 +1,37 @@ +describe("plugin-loader", function() + local plugins = require "lvim.plugins" + local loader = require "lvim.plugin-loader" + + pcall(function() + lvim.log.level = "debug" + package.loaded["lvim.core.log"] = nil + end) + + it("should be able to load default packages without errors", function() + vim.go.loadplugins = true + loader.load { plugins, lvim.plugins } + + -- TODO: maybe there's a way to avoid hard-coding the names of the modules? + local startup_plugins = { + "lazy", + } + + for _, plugin in ipairs(startup_plugins) do + assert.truthy(package.loaded[plugin]) + end + end) + + it("should be able to load lsp packages without errors", function() + require("lvim.lsp").setup() + + local lsp_packages = { + "lspconfig", + "nlspsettings", + "null-ls", + } + + for _, plugin in ipairs(lsp_packages) do + assert.truthy(package.loaded[plugin]) + end + end) +end) diff --git a/mac/.config/LunarVim/utils/bin/jdtls b/mac/.config/LunarVim/utils/bin/jdtls new file mode 100755 index 0000000..a882158 --- /dev/null +++ b/mac/.config/LunarVim/utils/bin/jdtls @@ -0,0 +1,62 @@ +#!/usr/bin/env bash + +# NOTE: +# This doesn't work as is on Windows. You'll need to create an equivalent `.bat` file instead +# +# NOTE: +# If you're not using Linux you'll need to adjust the `-configuration` option +# to point to the `config_mac' or `config_win` folders depending on your system. + +case Darwin in +Linux) + CONFIG="$HOME/.local/share/nvim/lsp_servers/jdtls/config_linux" + ;; +Darwin) + CONFIG="$HOME/.local/share/nvim/lsp_servers/jdtls/config_mac" + ;; +esac + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ]; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# JAR="$HOME/.config/nvim/.language-servers/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository/plugins/org.eclipse.equinox.launcher_*.jar" +JAR="$HOME/.local/share/nvim/lsp_servers/jdtls/plugins/org.eclipse.equinox.launcher_*.jar" +GRADLE_HOME=$HOME/gradle "$JAVACMD" \ + -Declipse.application=org.eclipse.jdt.ls.core.id1 \ + -Dosgi.bundles.defaultStartLevel=4 \ + -Declipse.product=org.eclipse.jdt.ls.core.product \ + -Dlog.protocol=true \ + -Dlog.level=ALL \ + -javaagent:$HOME/.local/share/nvim/lsp_servers/jdtls/lombok.jar \ + -Xms1g \ + -Xmx2G \ + -jar $(echo "$JAR") \ + -configuration "$CONFIG" \ + -data "${1:-$HOME/workspace}" \ + --add-modules=ALL-SYSTEM \ + --add-opens java.base/java.util=ALL-UNNAMED \ + --add-opens java.base/java.lang=ALL-UNNAMED + +# for older java versions if you wanna use lombok +# -Xbootclasspath/a:/usr/local/share/lombok/lombok.jar \ + +# -javaagent:/usr/local/share/lombok/lombok.jar \ diff --git a/mac/.config/LunarVim/utils/bin/lvim.ps1 b/mac/.config/LunarVim/utils/bin/lvim.ps1 new file mode 100644 index 0000000..3ec8125 --- /dev/null +++ b/mac/.config/LunarVim/utils/bin/lvim.ps1 @@ -0,0 +1,13 @@ +#Requires -Version 7.1 +$ErrorActionPreference = "Stop" # exit when command fails + +$env:XDG_DATA_HOME = $env:XDG_DATA_HOME ?? $env:APPDATA +$env:XDG_CONFIG_HOME = $env:XDG_CONFIG_HOME ?? $env:LOCALAPPDATA +$env:XDG_CACHE_HOME = $env:XDG_CACHE_HOME ?? $env:TEMP + +$env:LUNARVIM_RUNTIME_DIR = $env:LUNARVIM_RUNTIME_DIR ?? "$env:XDG_DATA_HOME\lunarvim" +$env:LUNARVIM_CONFIG_DIR = $env:LUNARVIM_CONFIG_DIR ?? "$env:XDG_CONFIG_HOME\lvim" +$env:LUNARVIM_CACHE_DIR = $env:LUNARVIM_CACHE_DIR ?? "$env:XDG_CACHE_HOME\lvim" +$env:LUNARVIM_BASE_DIR = $env:LUNARVIM_BASE_DIR ?? "$env:LUNARVIM_RUNTIME_DIR\lvim" + +nvim -u "$env:LUNARVIM_BASE_DIR\init.lua" @args diff --git a/mac/.config/LunarVim/utils/bin/lvim.template b/mac/.config/LunarVim/utils/bin/lvim.template new file mode 100644 index 0000000..4c04b9f --- /dev/null +++ b/mac/.config/LunarVim/utils/bin/lvim.template @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +export NVIM_APPNAME="${NVIM_APPNAME:-NVIM_APPNAME_VAR}" + +export LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-RUNTIME_DIR_VAR}" +export LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-CONFIG_DIR_VAR}" +export LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-CACHE_DIR_VAR}" + +export LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-BASE_DIR_VAR}" + +exec -a "$NVIM_APPNAME" nvim -u "$LUNARVIM_BASE_DIR/init.lua" "$@" diff --git a/mac/.config/LunarVim/utils/ci/generate_new_lockfile.lua b/mac/.config/LunarVim/utils/ci/generate_new_lockfile.lua new file mode 100644 index 0000000..2677b20 --- /dev/null +++ b/mac/.config/LunarVim/utils/ci/generate_new_lockfile.lua @@ -0,0 +1,125 @@ +local sp = os.getenv "SNAPSHOT_PATH" + +local function call_proc(process, opts, cb) + local output, error_output = "", "" + local handle_stdout = function(err, chunk) + assert(not err, err) + if chunk then + output = output .. chunk + end + end + + local handle_stderr = function(err, chunk) + assert(not err, err) + if chunk then + error_output = error_output .. chunk + end + end + + local uv = vim.loop + local handle + + local stdout = uv.new_pipe(false) + local stderr = uv.new_pipe(false) + + local stdio = { nil, stdout, stderr } + + handle = uv.spawn( + process, + { args = opts.args, cwd = opts.cwd or uv.cwd(), stdio = stdio }, + vim.schedule_wrap(function(code) + if code ~= 0 then + stdout:read_stop() + stderr:read_stop() + end + + local check = uv.new_check() + check:start(function() + for _, pipe in ipairs(stdio) do + if pipe and not pipe:is_closing() then + return + end + end + check:stop() + handle:close() + cb(code, output, error_output) + end) + end) + ) + + uv.read_start(stdout, handle_stdout) + uv.read_start(stderr, handle_stderr) + + return handle +end + +local plugins_list = {} + +local completed = 0 + +local function write_lockfile(verbose) + local default_plugins = {} + local active_jobs = {} + + local core_plugins = require "lvim.plugins" + for _, plugin in pairs(core_plugins) do + local name = plugin[1]:match "/(%S*)" + local url = "https://github.com/" .. plugin[1] + local commit = "" + table.insert(default_plugins, { + name = name, + url = url, + commit = commit, + branch = plugin.branch or "HEAD", + tag = plugin.tag, + }) + end + + table.sort(default_plugins, function(a, b) + return a.name < b.name + end) + + for _, entry in pairs(default_plugins) do + local on_done = function(success, result, errors) + completed = completed + 1 + if not success then + print("error: " .. errors) + return + end + local latest_sha = result:gsub("\tHEAD\n", ""):sub(1, 7) + if entry.tag then + local dereferenced_commit = result:match("\n(.*)\trefs/tags/" .. entry.tag .. "%^{}\n") + if dereferenced_commit then + latest_sha = dereferenced_commit:sub(1, 7) + end + end + plugins_list[entry.name] = { + commit = latest_sha, + } + end + + local handle = call_proc("git", { + args = { "ls-remote", entry.url, entry.tag and entry.tag .. "*" or entry.branch }, + }, on_done) + assert(handle) + table.insert(active_jobs, handle) + end + + print("active: " .. #active_jobs) + print("plugins: " .. #default_plugins) + + vim.wait(#active_jobs * 60 * 1000, function() + return completed == #active_jobs + end) + + if verbose then + print(vim.inspect(plugins_list)) + end + + local fd = assert(io.open(sp, "w")) + fd:write(vim.json.encode(plugins_list), "\n") + fd:flush() +end + +write_lockfile() +vim.cmd "q" diff --git a/mac/.config/LunarVim/utils/ci/generate_new_lockfile.sh b/mac/.config/LunarVim/utils/ci/generate_new_lockfile.sh new file mode 100644 index 0000000..ebd71b3 --- /dev/null +++ b/mac/.config/LunarVim/utils/ci/generate_new_lockfile.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -e + +REPO_DIR=$(git rev-parse --show-toplevel) + +export SNAPSHOT_NAME="default.json" +export SNAPSHOT_DIR="${REPO_DIR}/snapshots" + +mkdir -p "${SNAPSHOT_DIR}" + +export SNAPSHOT_PATH="${REPO_DIR}/snapshots/${SNAPSHOT_NAME}" + +time lvim --headless \ + -c "source ./utils/ci/generate_new_lockfile.lua" + +temp=$(mktemp) + +jq --sort-keys . "${SNAPSHOT_PATH}" >"${temp}" +mv "${temp}" "${SNAPSHOT_PATH}" diff --git a/mac/.config/LunarVim/utils/ci/run_commitlint.sh b/mac/.config/LunarVim/utils/ci/run_commitlint.sh new file mode 100644 index 0000000..b752956 --- /dev/null +++ b/mac/.config/LunarVim/utils/ci/run_commitlint.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -eo pipefail + +REPO_DIR="$(git rev-parse --show-toplevel)" +HELP_URL="https://github.com/LunarVim/LunarVim/blob/rolling/CONTRIBUTING.md#commit-messages" +CONFIG="$REPO_DIR/.github/workflows/commitlint.config.js" + +if ! npx commitlint --edit --verbose --help-url "$HELP_URL" --config "$CONFIG"; then + exit 1 +fi diff --git a/mac/.config/LunarVim/utils/ci/run_test.sh b/mac/.config/LunarVim/utils/ci/run_test.sh new file mode 100644 index 0000000..3e1bcf1 --- /dev/null +++ b/mac/.config/LunarVim/utils/ci/run_test.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -e + +export LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$HOME/.local/share/lunarvim"}" +export LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$LUNARVIM_RUNTIME_DIR/lvim"}" + +export LVIM_TEST_ENV=true + +# we should start with an empty configuration +LUNARVIM_CONFIG_DIR="$(mktemp -d)" +LUNARVIM_CACHE_DIR="$(mktemp -d)" + +export LUNARVIM_CONFIG_DIR LUNARVIM_CACHE_DIR + +printf "cache_dir: %s\nconfig_dir: %s\n" "$LUNARVIM_CACHE_DIR" "$LUNARVIM_CONFIG_DIR" + +lvim() { + nvim -u "$LUNARVIM_BASE_DIR/tests/minimal_init.lua" --cmd "set runtimepath+=$LUNARVIM_BASE_DIR" "$@" +} + +if [ -n "$1" ]; then + lvim --headless -c "lua require('plenary.busted').run('$1')" +else + lvim --headless -c "PlenaryBustedDirectory tests/specs { minimal_init = './tests/minimal_init.lua' }" +fi diff --git a/mac/.config/LunarVim/utils/ci/update_changelog.sh b/mac/.config/LunarVim/utils/ci/update_changelog.sh new file mode 100644 index 0000000..49dae53 --- /dev/null +++ b/mac/.config/LunarVim/utils/ci/update_changelog.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -eo pipefail + +BRANCH="$(git rev-parse --abbrev-ref HEAD)" + +if [ "$BRANCH" != "master" ]; then + exit 0 +fi + +REPO_DIR="$(git rev-parse --show-toplevel)" +LATEST_TAG="$(git describe --tags --abbrev=0)" +CONFIG_FILE="$REPO_DIR/.github/workflows/cliff.toml" +CHANGELOG="$REPO_DIR/CHANGELOG.md" + +git -C "$REPO_DIR" cliff "$LATEST_TAG"..HEAD -u -c "$CONFIG_FILE" -p "$CHANGELOG" diff --git a/mac/.config/LunarVim/utils/ci/verify_plugins.lua b/mac/.config/LunarVim/utils/ci/verify_plugins.lua new file mode 100644 index 0000000..95d98a1 --- /dev/null +++ b/mac/.config/LunarVim/utils/ci/verify_plugins.lua @@ -0,0 +1,147 @@ +local completed = 0 +local collection = {} +local active_jobs = {} + +local fmt = string.format +local core_plugins = require "lvim.plugins" + +local default_snapshot_path = join_paths(get_lvim_base_dir(), "snapshots", "default.json") +local fd = io.open(default_snapshot_path, "rb") +local content +if fd then + content = fd:read "*a" +end +local default_sha1 = vim.json.decode(content) + +local get_short_name = function(spec) + return spec[1]:match "/(%S*)" +end + +local get_default_sha1 = function(spec) + local short_name, _ = get_short_name(spec) + assert(default_sha1[short_name]) + return default_sha1[short_name].commit +end + +local is_directory = require("lvim.utils").is_directory +local lazydir = join_paths(get_runtime_dir(), "site", "pack", "lazy") + +local verify_lazy = function() + if not is_directory(lazydir) then + io.write "Lazy.nvim not installed!" + os.exit(1) + end + local status_ok, lazy = pcall(require, "lazy") + if status_ok and lazy then + return + end + io.write "Lazy.nvim not installed!" + os.exit(1) +end + +local get_install_path = function(spec) + local prefix = join_paths(lazydir, "opt") + local path = join_paths(prefix, get_short_name(spec)) + return is_directory(path) and path +end + +local function call_proc(process, opts, cb) + local output, error_output = "", "" + local handle_stdout = function(err, chunk) + assert(not err, err) + if chunk then + output = output .. chunk + end + end + + local handle_stderr = function(err, chunk) + assert(not err, err) + if chunk then + error_output = error_output .. chunk + end + end + + local uv = vim.loop + local handle + + local stdout = uv.new_pipe(false) + local stderr = uv.new_pipe(false) + + local stdio = { nil, stdout, stderr } + + handle = uv.spawn( + process, + { args = opts.args, cwd = opts.cwd or uv.cwd(), stdio = stdio }, + vim.schedule_wrap(function(code) + if code ~= 0 then + ---@diagnostic disable-next-line: undefined-field + stdout:read_stop() + ---@diagnostic disable-next-line: undefined-field + stderr:read_stop() + end + + local check = uv.new_check() + check:start(function() + for _, pipe in ipairs(stdio) do + if pipe and not pipe:is_closing() then + return + end + end + check:stop() + handle:close() + cb(code, output, error_output) + end) + end) + ) + + uv.read_start(stdout, handle_stdout) + uv.read_start(stderr, handle_stderr) + + return handle +end + +local function verify_core_plugins(verbose) + for _, spec in pairs(core_plugins) do + local path = get_install_path(spec) + if spec.enabled or spec.enabled == nil and path then + table.insert(collection, { + name = get_short_name(spec), + commit = get_default_sha1(spec), + path = path, + }) + end + end + + for _, entry in pairs(collection) do + local on_done = function(code, result, errors) + completed = completed + 1 + if code ~= 0 then + io.write(errors .. "\n") + -- os.exit(code) + else + if verbose then + io.write(fmt("verified [%s]\n", entry.name)) + end + end + local current_commit = result:gsub("\n", ""):gsub([[']], [[]]):sub(1, 7) + -- just in case there are some extra qutoes or it's a longer commit hash + if current_commit ~= entry.commit then + io.write(fmt("mismatch at [%s]: expected [%s], got [%s]\n", entry.name, entry.commit, current_commit)) + os.exit(1) + end + end + + local handle = call_proc("git", { args = { "rev-parse", "--short", "HEAD" }, cwd = entry.path }, on_done) + assert(handle) + table.insert(active_jobs, handle) + end + + vim.wait(#active_jobs * 60 * 1000, function() + ---@diagnostic disable-next-line: redundant-return-value + return completed == #active_jobs + end) +end + +verify_lazy() +verify_core_plugins() +vim.cmd "q" diff --git a/mac/.config/LunarVim/utils/ci/verify_plugins.sh b/mac/.config/LunarVim/utils/ci/verify_plugins.sh new file mode 100644 index 0000000..48ed12f --- /dev/null +++ b/mac/.config/LunarVim/utils/ci/verify_plugins.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -e + +BASEDIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" +BASEDIR="$(dirname -- "$(dirname -- "$BASEDIR")")" + +LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$BASEDIR"}" + +lvim --headless \ + -c "luafile ${LUNARVIM_BASE_DIR}/utils/ci/verify_plugins.lua" diff --git a/mac/.config/LunarVim/utils/desktop/16x16/lvim.svg b/mac/.config/LunarVim/utils/desktop/16x16/lvim.svg new file mode 100644 index 0000000..6898fd0 --- /dev/null +++ b/mac/.config/LunarVim/utils/desktop/16x16/lvim.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/mac/.config/LunarVim/utils/desktop/22x22/lvim.svg b/mac/.config/LunarVim/utils/desktop/22x22/lvim.svg new file mode 100644 index 0000000..06f24f5 --- /dev/null +++ b/mac/.config/LunarVim/utils/desktop/22x22/lvim.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/mac/.config/LunarVim/utils/desktop/24x24/lvim.svg b/mac/.config/LunarVim/utils/desktop/24x24/lvim.svg new file mode 100644 index 0000000..456298d --- /dev/null +++ b/mac/.config/LunarVim/utils/desktop/24x24/lvim.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/mac/.config/LunarVim/utils/desktop/32x32/lvim.svg b/mac/.config/LunarVim/utils/desktop/32x32/lvim.svg new file mode 100644 index 0000000..13e53c2 --- /dev/null +++ b/mac/.config/LunarVim/utils/desktop/32x32/lvim.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/mac/.config/LunarVim/utils/desktop/48x48/lvim.svg b/mac/.config/LunarVim/utils/desktop/48x48/lvim.svg new file mode 100644 index 0000000..35baac2 --- /dev/null +++ b/mac/.config/LunarVim/utils/desktop/48x48/lvim.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/mac/.config/LunarVim/utils/desktop/64x64/lvim.svg b/mac/.config/LunarVim/utils/desktop/64x64/lvim.svg new file mode 100644 index 0000000..fd2a964 --- /dev/null +++ b/mac/.config/LunarVim/utils/desktop/64x64/lvim.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/mac/.config/LunarVim/utils/desktop/lvim.desktop b/mac/.config/LunarVim/utils/desktop/lvim.desktop new file mode 100644 index 0000000..cb4cb47 --- /dev/null +++ b/mac/.config/LunarVim/utils/desktop/lvim.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Name=LunarVim +GenericName=Text Editor +Comment=An IDE layer for Neovim with sane defaults. Completely free and community driven. +TryExec=lvim +Exec=lvim %F +Terminal=true +Type=Application +Keywords=Text;editor; +Icon=lvim +Categories=Utility;TextEditor; +StartupNotify=false +MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++; diff --git a/mac/.config/LunarVim/utils/docker/Dockerfile.local b/mac/.config/LunarVim/utils/docker/Dockerfile.local new file mode 100644 index 0000000..ed4a67f --- /dev/null +++ b/mac/.config/LunarVim/utils/docker/Dockerfile.local @@ -0,0 +1,27 @@ +# To run this file execute: +# docker build -f -t Lunarvim:local + +FROM ubuntu:latest + +# Set environment correctly +ENV DEBIAN_FRONTEND=noninteractive +ENV PATH="/root/.local/bin:/root/.cargo/bin:/root/.npm-global/bin${PATH}" + +# Copy in local directory +COPY --chown=root:root . /LunarVim + +# Install dependencies and LunarVim +RUN apt update && \ + apt -y install sudo curl build-essential git fzf python3-dev python3-pip cargo && \ + curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \ + apt update && \ + apt -y install nodejs && \ + apt clean && rm -rf /var/lib/apt/lists/* /tmp/* && \ + /LunarVim/utils/installer/install-neovim-from-release && \ + /LunarVim/utils/installer/install.sh --local --no-install-dependencies + +# Setup LVIM to run on startup +ENTRYPOINT ["/bin/bash"] +CMD ["lvim"] + +# vim: ft=dockerfile: diff --git a/mac/.config/LunarVim/utils/docker/Dockerfile.remote b/mac/.config/LunarVim/utils/docker/Dockerfile.remote new file mode 100644 index 0000000..e6f811e --- /dev/null +++ b/mac/.config/LunarVim/utils/docker/Dockerfile.remote @@ -0,0 +1,27 @@ +# To run this file execute: +# docker build -f Dockerfile.remote . -t Lunarvim:remote + +FROM ubuntu:latest + +# Build argument to point to correct branch on GitHub +ARG LV_BRANCH=release-1.2/neovim-0.8 + +# Set environment correctly +ENV DEBIAN_FRONTEND=noninteractive +ENV PATH="/root/.local/bin:/root/.cargo/bin:/root/.npm-global/bin${PATH}" + +# Install dependencies and LunarVim +RUN apt update && \ + apt -y install sudo curl build-essential git fzf python3-dev python3-pip cargo && \ + curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \ + apt update && \ + apt -y install nodejs && \ + apt clean && rm -rf /var/lib/apt/lists/* /tmp/* && \ + curl -LSs https://raw.githubusercontent.com/lunarvim/lunarvim/${LV_BRANCH}/utils/installer/install-neovim-from-release | bash && \ + LV_BRANCH=${LV_BRANCH} curl -LSs https://raw.githubusercontent.com/lunarvim/lunarvim/${LV_BRANCH}/utils/installer/install.sh | bash -s -- --no-install-dependencies + +# Setup LVIM to run on startup +ENTRYPOINT ["/bin/bash"] +CMD ["lvim"] + +# vim: ft=dockerfile: diff --git a/mac/.config/LunarVim/utils/installer/config.example.lua b/mac/.config/LunarVim/utils/installer/config.example.lua new file mode 100644 index 0000000..9776f64 --- /dev/null +++ b/mac/.config/LunarVim/utils/installer/config.example.lua @@ -0,0 +1,5 @@ +-- Read the docs: https://www.lunarvim.org/docs/configuration +-- Example configs: https://github.com/LunarVim/starter.lvim +-- Video Tutorials: https://www.youtube.com/watch?v=sFA9kX-Ud_c&list=PLhoH5vyxr6QqGu0i7tt_XoVK9v-KvZ3m6 +-- Forum: https://www.reddit.com/r/lunarvim/ +-- Discord: https://discord.com/invite/Xb9B4Ny diff --git a/mac/.config/LunarVim/utils/installer/config_win.example.lua b/mac/.config/LunarVim/utils/installer/config_win.example.lua new file mode 100644 index 0000000..1fccb5a --- /dev/null +++ b/mac/.config/LunarVim/utils/installer/config_win.example.lua @@ -0,0 +1,27 @@ +-- Read the docs: https://www.lunarvim.org/docs/configuration +-- Example configs: https://github.com/LunarVim/starter.lvim +-- Video Tutorials: https://www.youtube.com/watch?v=sFA9kX-Ud_c&list=PLhoH5vyxr6QqGu0i7tt_XoVK9v-KvZ3m6 +-- Forum: https://www.reddit.com/r/lunarvim/ +-- Discord: https://discord.com/invite/Xb9B4Ny + +-- Enable powershell as your default shell +vim.opt.shell = "pwsh.exe" +vim.opt.shellcmdflag = + "-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;" +vim.cmd [[ + let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode' + let &shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode' + set shellquote= shellxquote= + ]] + +-- Set a compatible clipboard manager +vim.g.clipboard = { + copy = { + ["+"] = "win32yank.exe -i --crlf", + ["*"] = "win32yank.exe -i --crlf", + }, + paste = { + ["+"] = "win32yank.exe -o --lf", + ["*"] = "win32yank.exe -o --lf", + }, +} diff --git a/mac/.config/LunarVim/utils/installer/install-neovim-from-release b/mac/.config/LunarVim/utils/installer/install-neovim-from-release new file mode 100755 index 0000000..f041f77 --- /dev/null +++ b/mac/.config/LunarVim/utils/installer/install-neovim-from-release @@ -0,0 +1,83 @@ +#!/usr/bin/env bash + +set -eu pipefall + +declare -r LV_INSTALL_PREFIX="${INSTALL_PREFIX:-"$HOME/.local"}" +declare -r RELEASE_VER="${RELEASE_VER:-latest}" # can be set to nightly + +declare ARCHIVE_NAME +declare OS + +OS="$(uname -s)" + +if [ "$OS" == "Linux" ]; then + ARCHIVE_NAME="nvim-linux64" +elif [ "$OS" == "Darwin" ]; then + ARCHIVE_NAME="nvim-macos-x86_64" +else + echo "$OS platform is not supported currently" + exit 1 +fi + +if [[ "${RELEASE_VER}" == "latest" ]]; then + declare -r RELEASE_URL="https://github.com/neovim/neovim/releases/${RELEASE_VER}/download/${ARCHIVE_NAME}.tar.gz" +else + declare -r RELEASE_URL="https://github.com/neovim/neovim/releases/download/${RELEASE_VER}/${ARCHIVE_NAME}.tar.gz" +fi +declare -r CHECKSUM_URL="$RELEASE_URL.sha256sum" + +DOWNLOAD_DIR="$(mktemp -d)" +readonly DOWNLOAD_DIR + +RELEASE_SHA="$(curl -Ls "$CHECKSUM_URL" | awk '{print $1}')" +readonly RELEASE_SHA + +function main() { + if [ ! -d "$LV_INSTALL_PREFIX" ]; then + mkdir -p "$LV_INSTALL_PREFIX" || __invalid__prefix__handler + fi + download_neovim + verify_neovim + install_neovim +} + +function download_neovim() { + echo "Downloading Neovim's binary from $RELEASE_VER release.." + if ! curl --progress-bar --fail -L "$RELEASE_URL" -o "$DOWNLOAD_DIR/$ARCHIVE_NAME.tar.gz"; then + echo "Download failed. Check that the release/filename are correct." + exit 1 + fi + echo "Download complete!" +} + +function verify_neovim() { + echo "Verifying the installation.." + DOWNLOADED_SHA="$(openssl dgst -sha256 "$DOWNLOAD_DIR/$ARCHIVE_NAME.tar.gz" | awk '{print $2}')" + + if [ "$RELEASE_SHA" != "$DOWNLOADED_SHA" ]; then + echo "Error! checksum mismatch." + echo "Expected: $RELEASE_SHA but got: $DOWNLOADED_SHA" + exit 1 + fi + echo "Verification complete!" +} + +function install_neovim() { + + echo "Installing Neovim.." + pushd "$DOWNLOAD_DIR" + tar -xzf "$DOWNLOAD_DIR/$ARCHIVE_NAME.tar.gz" + popd + # https://dev.to/ackshaey/macos-vs-linux-the-cp-command-will-trip-you-up-2p00 + cp -r "$DOWNLOAD_DIR/$ARCHIVE_NAME/." "$LV_INSTALL_PREFIX" + echo "Installation complete!" + echo "Now you can run $LV_INSTALL_PREFIX/bin/nvim" +} + +function __invalid__prefix__handler() { + echo "Error! Invalid value for LV_INSTALL_PREFIX: [$INSTALL_PREFIX]" + echo "Please verify that the folder exists and re-run the installer!" + exit 1 +} + +main "$@" diff --git a/mac/.config/LunarVim/utils/installer/install.ps1 b/mac/.config/LunarVim/utils/installer/install.ps1 new file mode 100644 index 0000000..5aef434 --- /dev/null +++ b/mac/.config/LunarVim/utils/installer/install.ps1 @@ -0,0 +1,305 @@ +#Requires -Version 7.1 +$ErrorActionPreference = "Stop" # exit when command fails +if ($PSVersionTable.PSVersion -lt 7.1) { + Write-Error "Powershell version needs to be greater than 7.1!" +} + +# set script variables +$LV_BRANCH = $LV_BRANCH ?? "master" +$LV_REMOTE = $LV_REMOTE ?? "lunarvim/lunarvim.git" +$INSTALL_PREFIX = $INSTALL_PREFIX ?? "$HOME\.local" + +$env:XDG_DATA_HOME = $env:XDG_DATA_HOME ?? $env:APPDATA +$env:XDG_CONFIG_HOME = $env:XDG_CONFIG_HOME ?? $env:LOCALAPPDATA +$env:XDG_CACHE_HOME = $env:XDG_CACHE_HOME ?? $env:TEMP + +$env:LUNARVIM_RUNTIME_DIR = $env:LUNARVIM_RUNTIME_DIR ?? "$env:XDG_DATA_HOME\lunarvim" +$env:LUNARVIM_CONFIG_DIR = $env:LUNARVIM_CONFIG_DIR ?? "$env:XDG_CONFIG_HOME\lvim" +$env:LUNARVIM_CACHE_DIR = $env:LUNARVIM_CACHE_DIR ?? "$env:XDG_CACHE_HOME\lvim" +$env:LUNARVIM_BASE_DIR = $env:LUNARVIM_BASE_DIR ?? "$env:LUNARVIM_RUNTIME_DIR\lvim" + +$__lvim_dirs = ( + $env:LUNARVIM_BASE_DIR, + $env:LUNARVIM_RUNTIME_DIR, + $env:LUNARVIM_CONFIG_DIR, + $env:LUNARVIM_CACHE_DIR +) + +function __add_separator($div_width) { + "-" * $div_width + Write-Output "" +} + +function msg($text){ + Write-Output $text + __add_separator "80" +} + +function main($cliargs) { + + print_logo + + verify_lvim_dirs + + if ($cliargs.Contains("--overwrite")) { + Write-Output "!!Warning!! -> Removing all lunarvim related config because of the --overwrite flag" + $answer = Read-Host "Would you like to continue? [y]es or [n]o " + if ("$answer" -ne "y" -and "$answer" -ne "Y") { + exit 1 + } + uninstall_lvim + } + if ($cliargs.Contains("--local") -or $cliargs.Contains("--testing")) { + msg "Using local LunarVim installation" + local_install + exit + } + + msg "Checking dependencies.." + check_system_deps + + $answer = Read-Host "Would you like to check lunarvim's NodeJS dependencies? [y]es or [n]o (default: no) " + if ("$answer" -eq "y" -or "$answer" -eq "Y") { + install_nodejs_deps + } + + $answer = Read-Host "Would you like to check lunarvim's Python dependencies? [y]es or [n]o (default: no) " + if ("$answer" -eq "y" -or "$answer" -eq "Y") { + install_python_deps + } + + + if (Test-Path "$env:LUNARVIM_BASE_DIR\init.lua" ) { + msg "Updating LunarVim" + validate_lunarvim_files + } + else { + msg "Cloning Lunarvim" + clone_lvim + setup_lvim + } +} + +function print_missing_dep_msg($dep) { + Write-Output "[ERROR]: Unable to find dependency [$dep]" + Write-Output "Please install it first and re-run the installer." +} + +$winget_package_matrix=@{"git" = "Git.Git"; "nvim" = "Neovim.Neovim"; "make" = "GnuWin32.Make"; "node" = "OpenJS.NodeJS"; "pip" = "Python.Python.3.11"} +$winget_additional_arguments_matrix=@{"git" = "--source winget --interactive"; "nvim" = "--interactive"; "make" = "--interactive"; "node" = ""; "pip" = ""} + +$scoop_package_matrix=@{"git" = "git"; "nvim" = "neovim"; "make" = "make"; "node" = "nodejs"; "pip" = "python"} + +function install_system_package($dep) { + # Make installers sometimes have a problem when adding make to path + Write-Output "WARNING: Preparing 'make' installation. The make directory ('C:\Program Files (x86)\GnuWin32\bin') might not be added to the PATH by the installer, and you might have to manually to the PATH!" + if (Get-Command -Name "winget" -ErrorAction SilentlyContinue) { + Write-Output "Attempting to install dependency [$dep] with winget" + + $command="winget" + $command_arguments = "-e --id $($winget_package_matrix[$dep]) $($winget_additional_arguments_matrix[$dep])".Trim() -split ' ' + } + elseif (Get-Command -Name "scoop" -ErrorAction SilentlyContinue) { + Write-Output "Attempting to install dependency [$dep] with scoop" + # TODO: check if it's fine to not run it with --global + $command = "scoop" + $command_arguments = "$($scoop_package_matrix[$dep])".Trim() -split ' ' + } + else { + print_missing_dep_msg "$dep" + exit 1 + } + + try { + & $command install $command_arguments + # Refresh the path after installation + $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") + } catch { + Write-Output "An error occurred: $_" + exit 1 + } +} + +function check_system_dep($dep) { + try { + Get-Command -Name $dep -ErrorAction Stop | Out-Null + } + catch { + install_system_package "$dep" + } +} + +function check_system_deps() { + check_system_dep "git" + check_system_dep "nvim" + check_system_dep "make" +} + +function install_nodejs_deps() { + $dep = "node" + try { + check_system_dep "$dep" + Invoke-Command -ScriptBlock { npm install --global neovim tree-sitter-cli } -ErrorAction Break + } + catch { + print_missing_dep_msg "$dep" + } +} + +function install_python_deps() { + $dep = "pip" + try { + check_system_dep "$dep" + Invoke-Command -ScriptBlock { python -m pip install --user pynvim } -ErrorAction Break + } + catch { + print_missing_dep_msg "$dep" + } +} + +function backup_old_config() { + $src = "$env:LUNARVIM_CONFIG_DIR" + if (Test-Path $src) { + New-Item "$src.old" -ItemType Directory -Force | Out-Null + Copy-Item -Force -Recurse "$src\*" "$src.old\." | Out-Null + } + msg "Backup operation complete" +} + + +function local_install() { + verify_lvim_dirs + $repoDir = git rev-parse --show-toplevel + $gitLocalCloneCmd = git clone --progress "$repoDir" "$env:LUNARVIM_BASE_DIR" + Invoke-Command -ErrorAction Stop -ScriptBlock { $gitLocalCloneCmd; setup_lvim } +} + +function clone_lvim() { + try { + $gitCloneCmd = git clone --progress --depth 1 --branch "$LV_BRANCH" ` + "https://github.com/$LV_REMOTE" ` + "$env:LUNARVIM_BASE_DIR" + Invoke-Command -ErrorAction Stop -ScriptBlock { $gitCloneCmd } + } + catch { + msg "Failed to clone repository. Installation failed." + exit 1 + } +} + +function setup_shim() { + if ((Test-Path "$INSTALL_PREFIX\bin") -eq $false) { + New-Item "$INSTALL_PREFIX\bin" -ItemType Directory | Out-Null + } + + Copy-Item -Force "$env:LUNARVIM_BASE_DIR\utils\bin\lvim.ps1" "$INSTALL_PREFIX\bin\lvim.ps1" +} + +function uninstall_lvim() { + foreach ($dir in $__lvim_dirs) { + if (Test-Path "$dir") { + Remove-Item -Force -Recurse "$dir" + } + } +} + +function verify_lvim_dirs() { + foreach ($dir in $__lvim_dirs) { + if ((Test-Path "$dir") -eq $false) { + New-Item "$dir" -ItemType Directory | Out-Null + } + } + backup_old_config +} + + +function setup_lvim() { + msg "Installing LunarVim shim" + setup_shim + + msg "Installing sample configuration" + + if (Test-Path "$env:LUNARVIM_CONFIG_DIR\config.lua") { + Move-Item "$env:LUNARVIM_CONFIG_DIR\config.lua" "$env:LUNARVIM_CONFIG_DIR\config.lua.old" + } + + New-Item -ItemType File -Path "$env:LUNARVIM_CONFIG_DIR\config.lua" | Out-Null + + $exampleConfig = "$env:LUNARVIM_BASE_DIR\utils\installer\config_win.example.lua" + Copy-Item -Force "$exampleConfig" "$env:LUNARVIM_CONFIG_DIR\config.lua" + + Write-Host "Make sure to run `:Lazy sync` at first launch" -ForegroundColor Green + + create_alias + + msg "Thank you for installing LunarVim!!" + + Write-Output "You can start it by running: $INSTALL_PREFIX\bin\lvim.ps1" + Write-Output "Do not forget to use a font with glyphs (icons) support [https://github.com/ryanoasis/nerd-fonts]" +} + + +function validate_lunarvim_files() { + Set-Alias lvim "$INSTALL_PREFIX\bin\lvim.ps1" + try { + $verify_version_cmd="if !empty(v:errmsg) | cquit | else | quit | endif" + Invoke-Command -ScriptBlock { lvim --headless -c 'LvimUpdate' -c "$verify_version_cmd" } -ErrorAction SilentlyContinue + } + catch { + Write-Output "Unable to guarantee data integrity while updating. Please run `:LvimUpdate` manually instead." + exit 1 + } + Write-Output "Your LunarVim installation is now up to date!" +} + +function create_alias { + try { + $answer = Read-Host $(` + "Would you like to create an alias inside your Powershell profile?`n" + ` + "(This enables you to start lvim with the command 'lvim') [y]es or [n]o (default: no)" ) + } + catch { + msg "Non-interactive mode detected. Skipping alias creation" + return + } + + if ("$answer" -ne "y" -or "$answer" -ne "Y") { + return + } + + $lvim_bin="$INSTALL_PREFIX\bin\lvim.ps1" + $lvim_alias = Get-Alias lvim -ErrorAction SilentlyContinue + + if ($lvim_alias.Definition -eq $lvim_bin) { + Write-Output "Alias is already set and will not be reset." + return + } + + try { + Get-Content $PROFILE -ErrorAction Stop + } + catch { + New-Item -Path $PROFILE -ItemType "file" -Force + } + + Add-Content -Path $PROFILE -Value $("`r`nSet-Alias lvim '$lvim_bin'") + + Write-Host 'To use the new alias in this window reload your profile with: `. $PROFILE`' -ForegroundColor Green +} + +function print_logo(){ + Write-Output " + + 88\ 88\ + 88 | \__| + 88 |88\ 88\ 888888$\ 888888\ 888888\ 88\ 88\ 88\ 888888\8888\ + 88 |88 | 88 |88 __88\ \____88\ 88 __88\\88\ 88 |88 |88 _88 _88\ + 88 |88 | 88 |88 | 88 | 888888$ |88 | \__|\88\88 / 88 |88 / 88 / 88 | + 88 |88 | 88 |88 | 88 |88 __88 |88 | \88$ / 88 |88 | 88 | 88 | + 88 |\888888 |88 | 88 |\888888$ |88 | \$ / 88 |88 | 88 | 88 | + \__| \______/ \__| \__| \_______|\__| \_/ \__|\__| \__| \__| + + " +} + +main "$args" diff --git a/mac/.config/LunarVim/utils/installer/install.sh b/mac/.config/LunarVim/utils/installer/install.sh new file mode 100755 index 0000000..0fd09bc --- /dev/null +++ b/mac/.config/LunarVim/utils/installer/install.sh @@ -0,0 +1,461 @@ +#!/usr/bin/env bash +set -eo pipefail + +OS="$(uname -s)" + +#Set branch to master unless specified by the user +declare -x LV_BRANCH="${LV_BRANCH:-"master"}" +declare -xr LV_REMOTE="${LV_REMOTE:-lunarvim/lunarvim.git}" +declare -xr INSTALL_PREFIX="${INSTALL_PREFIX:-"$HOME/.local"}" + +declare -xr XDG_DATA_HOME="${XDG_DATA_HOME:-"$HOME/.local/share"}" +declare -xr XDG_CACHE_HOME="${XDG_CACHE_HOME:-"$HOME/.cache"}" +declare -xr XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-"$HOME/.config"}" + +declare -xr NVIM_APPNAME="${NVIM_APPNAME:-"lvim"}" + +declare -xr LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvim"}" +declare -xr LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/$NVIM_APPNAME"}" +declare -xr LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-"$XDG_CACHE_HOME/$NVIM_APPNAME"}" +declare -xr LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$LUNARVIM_RUNTIME_DIR/$NVIM_APPNAME"}" + +declare -xr LUNARVIM_LOG_LEVEL="${LUNARVIM_LOG_LEVEL:-warn}" + +declare BASEDIR +BASEDIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" +BASEDIR="$(dirname -- "$(dirname -- "$BASEDIR")")" +readonly BASEDIR + +declare ARGS_LOCAL=0 +declare ARGS_OVERWRITE=0 +declare ARGS_INSTALL_DEPENDENCIES=1 +declare INTERACTIVE_MODE=1 +declare ADDITIONAL_WARNINGS="" + +declare -a __lvim_dirs=( + "$LUNARVIM_RUNTIME_DIR" + "$LUNARVIM_CACHE_DIR" + "$LUNARVIM_BASE_DIR" +) + +declare -a __npm_deps=( + "neovim" +) +# treesitter installed with brew causes conflicts #3738 +if ! command -v tree-sitter &>/dev/null; then + __npm_deps+=("tree-sitter-cli") +fi + +declare -a __rust_deps=( + "fd::fd-find" + "rg::ripgrep" +) + +function usage() { + echo "Usage: install.sh []" + echo "" + echo "Options:" + echo " -h, --help Print this help message" + echo " -l, --local Install local copy of LunarVim" + echo " -y, --yes Disable confirmation prompts (answer yes to all questions)" + echo " --overwrite Overwrite previous LunarVim configuration (a backup is always performed first)" + echo " --[no-]install-dependencies Whether to automatically install external dependencies (will prompt by default)" +} + +function parse_arguments() { + while [ "$#" -gt 0 ]; do + case "$1" in + -l | --local) + ARGS_LOCAL=1 + ;; + --overwrite) + ARGS_OVERWRITE=1 + ;; + -y | --yes) + INTERACTIVE_MODE=0 + ;; + --install-dependencies) + ARGS_INSTALL_DEPENDENCIES=1 + ;; + --no-install-dependencies) + ARGS_INSTALL_DEPENDENCIES=0 + ;; + -h | --help) + usage + exit 0 + ;; + esac + shift + done +} + +function msg() { + local text="$1" + local div_width="80" + printf "%${div_width}s\n" ' ' | tr ' ' - + printf "%s\n" "$text" +} + +function confirm() { + local question="$1" + while true; do + msg "$question" + read -p "[y]es or [n]o (default: no) : " -r answer + case "$answer" in + y | Y | yes | YES | Yes) + return 0 + ;; + n | N | no | NO | No | *[[:blank:]]* | "") + return 1 + ;; + *) + msg "Please answer [y]es or [n]o." + ;; + esac + done +} + +function stringify_array() { + echo -n "${@}" | sed 's/ /, /' +} + +function main() { + parse_arguments "$@" + + print_logo + + msg "Detecting platform for managing any additional neovim dependencies" + detect_platform + + check_system_deps + + if [ "$ARGS_INSTALL_DEPENDENCIES" -eq 1 ]; then + if [ "$INTERACTIVE_MODE" -eq 1 ]; then + if confirm "Would you like to install LunarVim's NodeJS/BunJS dependencies: $(stringify_array "${__npm_deps[@]}")?"; then + install_nodejs_deps + fi + if confirm "Would you like to install LunarVim's Rust dependencies: $(stringify_array "${__rust_deps[@]}")?"; then + install_rust_deps + fi + else + install_nodejs_deps + install_rust_deps + fi + fi + + remove_old_cache_files + + verify_lvim_dirs + + if [ "$ARGS_LOCAL" -eq 1 ]; then + link_local_lvim + else + clone_lvim + fi + + setup_lvim + + msg "$ADDITIONAL_WARNINGS" + msg "Thank you for installing LunarVim!!" + echo "You can start it by running: $INSTALL_PREFIX/bin/$NVIM_APPNAME" + echo "Do not forget to use a font with glyphs (icons) support [https://github.com/ryanoasis/nerd-fonts]" +} + +function detect_platform() { + case "$OS" in + Linux) + if [ -f "/etc/arch-release" ] || [ -f "/etc/artix-release" ]; then + RECOMMEND_INSTALL="sudo pacman -S" + elif [ -f "/etc/fedora-release" ] || [ -f "/etc/redhat-release" ]; then + RECOMMEND_INSTALL="sudo dnf install -y" + elif [ -f "/etc/gentoo-release" ]; then + RECOMMEND_INSTALL="emerge -tv" + else # assume debian based + RECOMMEND_INSTALL="sudo apt install -y" + fi + ;; + FreeBSD) + RECOMMEND_INSTALL="sudo pkg install -y" + ;; + NetBSD) + RECOMMEND_INSTALL="sudo pkgin install" + ;; + OpenBSD) + RECOMMEND_INSTALL="doas pkg_add" + ;; + Darwin) + RECOMMEND_INSTALL="brew install" + ;; + *) + echo "OS $OS is not currently supported." + exit 1 + ;; + esac +} + +function print_missing_dep_msg() { + if [ "$#" -eq 1 ]; then + echo "[ERROR]: Unable to find dependency [$1]" + echo "Please install it first and re-run the installer. Try: $RECOMMEND_INSTALL $1" + else + local cmds + cmds=$(for i in "$@"; do echo "$RECOMMEND_INSTALL $i"; done) + printf "[ERROR]: Unable to find dependencies [%s]" "$@" + printf "Please install any one of the dependencies and re-run the installer. Try: \n%s\n" "$cmds" + fi +} + +function check_neovim_min_version() { + local verify_version_cmd='if !has("nvim-0.9") | cquit | else | quit | endif' + + # exit with an error if min_version not found + if ! nvim --headless -u NONE -c "$verify_version_cmd"; then + echo "[ERROR]: LunarVim requires at least Neovim v0.9 or higher" + exit 1 + fi +} + +function verify_core_plugins() { + msg "Verifying core plugins" + if ! bash "$LUNARVIM_BASE_DIR/utils/ci/verify_plugins.sh"; then + echo "[ERROR]: Unable to verify plugins, make sure to manually run ':Lazy sync' when starting lvim for the first time." + exit 1 + fi + echo "Verification complete!" +} + +function validate_install_prefix() { + local prefix="$1" + case $PATH in + *"$prefix/bin"*) + return + ;; + esac + local profile="$HOME/.profile" + test -z "$ZSH_VERSION" && profile="$HOME/.zshenv" + ADDITIONAL_WARNINGS="[WARN] the folder $prefix/bin is not on PATH, consider adding 'export PATH=$prefix/bin:\$PATH' to your $profile" + + # avoid problems when calling any verify_* function + export PATH="$prefix/bin:$PATH" +} + +function check_system_deps() { + + validate_install_prefix "$INSTALL_PREFIX" + + if ! command -v git &>/dev/null; then + print_missing_dep_msg "git" + exit 1 + fi + if ! command -v nvim &>/dev/null; then + print_missing_dep_msg "neovim" + exit 1 + fi + check_neovim_min_version +} + +function __install_nodejs_deps_pnpm() { + echo "Installing node modules with pnpm.." + pnpm install -g "${__npm_deps[@]}" + echo "All NodeJS dependencies are successfully installed" +} + +function __install_nodejs_deps_npm() { + echo "Installing node modules with npm.." + for dep in "${__npm_deps[@]}"; do + if ! npm ls -g "$dep" &>/dev/null; then + printf "installing %s .." "$dep" + npm install -g "$dep" + fi + done + + echo "All NodeJS dependencies are successfully installed" +} + +function __install_nodejs_deps_yarn() { + echo "Installing node modules with yarn.." + yarn global add "${__npm_deps[@]}" + echo "All NodeJS dependencies are successfully installed" +} + +function __install_nodejs_deps_bun() { + echo "Installing bun modules with bun..." + bun install -g "${__npm_deps[@]}" + echo "All BunJS dependencies are successfully installed" +} + +function __validate_node_installation() { + local pkg_manager="$1" + local manager_home + + if ! command -v "$pkg_manager" &>/dev/null; then + return 1 + fi + + if [ "$pkg_manager" == "npm" ]; then + manager_home="$(npm config get prefix 2>/dev/null)" + elif [ "$pkg_manager" == "bun" ]; then + manager_home="$BUN_INSTALL" + elif [ "$pkg_manager" == "pnpm" ]; then + manager_home="$(pnpm config get prefix 2>/dev/null)" + else + manager_home="$(yarn global bin 2>/dev/null)" + fi + + if [ ! -d "$manager_home" ] || [ ! -w "$manager_home" ]; then + return 1 + fi + + return 0 +} + +function install_nodejs_deps() { + local -a pkg_managers=("pnpm" "bun" "yarn" "npm") + for pkg_manager in "${pkg_managers[@]}"; do + if __validate_node_installation "$pkg_manager"; then + eval "__install_nodejs_deps_$pkg_manager" + return + fi + done + echo "[WARN]: skipping installing optional nodejs dependencies due to insufficient permissions." + echo "check how to solve it: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally" +} + +function __attempt_to_install_with_cargo() { + if command -v cargo &>/dev/null; then + echo "Installing missing Rust dependency with cargo" + cargo install "$1" + else + echo "[WARN]: Unable to find cargo. Make sure to install it to avoid any problems" + exit 1 + fi +} + +# we try to install the missing one with cargo even though it's unlikely to be found +function install_rust_deps() { + for dep in "${__rust_deps[@]}"; do + if ! command -v "${dep%%::*}" &>/dev/null; then + __attempt_to_install_with_cargo "${dep##*::}" + fi + done + echo "All Rust dependencies are successfully installed" +} + +function __backup_dir() { + local src="$1" + if [ ! -d "$src" ]; then + return + fi + mkdir -p "$src.old" + msg "Backing up old $src to $src.old" + if command -v rsync &>/dev/null; then + rsync --archive --quiet --backup --partial --copy-links --cvs-exclude "$src"/ "$src.old" + else + case "$OS" in + Darwin) + cp -R "$src/." "$src.old/." + ;; + *) + cp -r "$src/." "$src.old/." + ;; + esac + fi +} + +function verify_lvim_dirs() { + for dir in "${__lvim_dirs[@]}"; do + if [ -d "$dir" ]; then + if [ "$ARGS_OVERWRITE" -eq 0 ]; then + __backup_dir "$dir" + fi + rm -rf "$dir" + fi + mkdir -p "$dir" + done + mkdir -p "$LUNARVIM_CONFIG_DIR" +} + +function clone_lvim() { + msg "Cloning LunarVim configuration" + if ! git clone --progress --depth 1 --branch "$LV_BRANCH" \ + "https://github.com/${LV_REMOTE}" "$LUNARVIM_BASE_DIR"; then + echo "Failed to clone repository. Installation failed." + exit 1 + fi +} + +function link_local_lvim() { + echo "Linking local LunarVim repo" + + # Detect whether it's a symlink or a folder + if [ -d "$LUNARVIM_BASE_DIR" ]; then + msg "Moving old files to ${LUNARVIM_BASE_DIR}.old" + mv "$LUNARVIM_BASE_DIR" "${LUNARVIM_BASE_DIR}".old + fi + + echo " - $BASEDIR -> $LUNARVIM_BASE_DIR" + ln -s -f "$BASEDIR" "$LUNARVIM_BASE_DIR" +} + +function setup_shim() { + make -C "$LUNARVIM_BASE_DIR" install-bin +} + +function remove_old_cache_files() { + local lazy_cache="$LUNARVIM_CACHE_DIR/lazy/cache" + if [ -e "$lazy_cache" ]; then + msg "Removing old lazy cache file" + rm -f "$lazy_cache" + fi +} + +function setup_lvim() { + + msg "Installing LunarVim shim" + + setup_shim + + create_desktop_file + + [ ! -f "$LUNARVIM_CONFIG_DIR/config.lua" ] \ + && cp "$LUNARVIM_BASE_DIR/utils/installer/config.example.lua" "$LUNARVIM_CONFIG_DIR/config.lua" + + echo "Preparing Lazy setup" + + "$INSTALL_PREFIX/bin/$NVIM_APPNAME" --headless -c 'quitall' + + printf "\nLazy setup complete\n" + + verify_core_plugins +} + +function create_desktop_file() { + # TODO: Any other OSes that use desktop files? + ([ "$OS" != "Linux" ] || ! command -v xdg-desktop-menu &>/dev/null) && return + echo "Creating desktop file" + + for d in "$LUNARVIM_BASE_DIR"/utils/desktop/*/; do + size_folder=$(basename "$d") + mkdir -p "$XDG_DATA_HOME/icons/hicolor/$size_folder/apps/" + cp "$LUNARVIM_BASE_DIR/utils/desktop/$size_folder/lvim.svg" "$XDG_DATA_HOME/icons/hicolor/$size_folder/apps" + done + + xdg-desktop-menu install --novendor "$LUNARVIM_BASE_DIR/utils/desktop/lvim.desktop" || true +} + +function print_logo() { + cat <<'EOF' + + 88\ 88\ + 88 | \__| + 88 |88\ 88\ 888888$\ 888888\ 888888\ 88\ 88\ 88\ 888888\8888\ + 88 |88 | 88 |88 __88\ \____88\ 88 __88\\88\ 88 |88 |88 _88 _88\ + 88 |88 | 88 |88 | 88 | 888888$ |88 | \__|\88\88 / 88 |88 / 88 / 88 | + 88 |88 | 88 |88 | 88 |88 __88 |88 | \88$ / 88 |88 | 88 | 88 | + 88 |\888888 |88 | 88 |\888888$ |88 | \$ / 88 |88 | 88 | 88 | + \__| \______/ \__| \__| \_______|\__| \_/ \__|\__| \__| \__| + +EOF +} + +main "$@" diff --git a/mac/.config/LunarVim/utils/installer/install_bin.sh b/mac/.config/LunarVim/utils/installer/install_bin.sh new file mode 100755 index 0000000..a25ad37 --- /dev/null +++ b/mac/.config/LunarVim/utils/installer/install_bin.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +set -eo pipefail + +INSTALL_PREFIX="${INSTALL_PREFIX:-"$HOME/.local"}" + +XDG_DATA_HOME="${XDG_DATA_HOME:-"$HOME/.local/share"}" +XDG_CACHE_HOME="${XDG_CACHE_HOME:-"$HOME/.cache"}" +XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-"$HOME/.config"}" + +NVIM_APPNAME="${NVIM_APPNAME:-lvim}" + +LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvim"}" +LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/$NVIM_APPNAME"}" +LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-"$XDG_CACHE_HOME/$NVIM_APPNAME"}" +LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$LUNARVIM_RUNTIME_DIR/$NVIM_APPNAME"}" + +function setup_shim() { + local src="$LUNARVIM_BASE_DIR/utils/bin/lvim.template" + local dst="$INSTALL_PREFIX/bin/$NVIM_APPNAME" + + [ ! -d "$INSTALL_PREFIX/bin" ] && mkdir -p "$INSTALL_PREFIX/bin" + + # remove outdated installation so that `cp` doesn't complain + rm -f "$dst" + + cp "$src" "$dst" + + sed -e s"#NVIM_APPNAME_VAR#\"${NVIM_APPNAME}\"#"g \ + -e s"#RUNTIME_DIR_VAR#\"${LUNARVIM_RUNTIME_DIR}\"#"g \ + -e s"#CONFIG_DIR_VAR#\"${LUNARVIM_CONFIG_DIR}\"#"g \ + -e s"#CACHE_DIR_VAR#\"${LUNARVIM_CACHE_DIR}\"#"g \ + -e s"#BASE_DIR_VAR#\"${LUNARVIM_BASE_DIR}\"#"g "$src" \ + | tee "$dst" >/dev/null + + chmod u+x "$dst" +} + +setup_shim "$@" + +echo "You can start LunarVim by running: $INSTALL_PREFIX/bin/$NVIM_APPNAME" diff --git a/mac/.config/LunarVim/utils/installer/install_stylua.sh b/mac/.config/LunarVim/utils/installer/install_stylua.sh new file mode 100755 index 0000000..963416e --- /dev/null +++ b/mac/.config/LunarVim/utils/installer/install_stylua.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash + +set -eu pipefall + +declare -r INSTALL_DIR="$PWD/utils" +declare -r RELEASE="0.10.0" +declare -r OS="linux" +# declare -r OS="$(uname -s)" +declare -r FILENAME="stylua-$RELEASE-$OS" + +declare -a __deps=("curl" "unzip") + +function check_deps() { + for dep in "${__deps[@]}"; do + if ! command -v "$dep" >/dev/null; then + echo "Missing depdendecy!" + echo "The \"$dep\" command was not found!. Please install and try again." + fi + done +} + +function download_stylua() { + local DOWNLOAD_DIR + local URL="https://github.com/JohnnyMorganz/StyLua/releases/download/v$RELEASE/$FILENAME.zip" + + DOWNLOAD_DIR="$(mktemp -d)" + echo "Initiating download for Stylua v$RELEASE" + if ! curl --progress-bar --fail -L "$URL" -o "$DOWNLOAD_DIR/$FILENAME.zip"; then + echo "Download failed. Check that the release/filename are correct." + exit 1 + fi + + echo "Installation in progress.." + unzip -q "$DOWNLOAD_DIR/$FILENAME.zip" -d "$DOWNLOAD_DIR" + + if [ -f "$DOWNLOAD_DIR/stylua" ]; then + mv "$DOWNLOAD_DIR/stylua" "$INSTALL_DIR/stylua" + else + mv "$DOWNLOAD_DIR/$FILENAME/stylua" "$INSTALL_DIR/." + fi + + chmod u+x "$INSTALL_DIR/stylua" +} + +function verify_install() { + echo "Verifying installation.." + local DOWNLOADED_VER + DOWNLOADED_VER="$("$INSTALL_DIR/stylua" -V | awk '{ print $2 }')" + if [ "$DOWNLOADED_VER" != "$RELEASE" ]; then + echo "Mismatched version!" + echo "Expected: v$RELEASE but got v$DOWNLOADED_VER" + exit 1 + fi + echo "Verification complete!" +} + +function main() { + check_deps + download_stylua + verify_install +} + +main "$@" diff --git a/mac/.config/LunarVim/utils/installer/uninstall.ps1 b/mac/.config/LunarVim/utils/installer/uninstall.ps1 new file mode 100644 index 0000000..dcfeb26 --- /dev/null +++ b/mac/.config/LunarVim/utils/installer/uninstall.ps1 @@ -0,0 +1,63 @@ +#Requires -Version 7.1 +$ErrorActionPreference = "Stop" # exit when command fails + +# set script variables +$LV_BRANCH = $LV_BRANCH ?? "master" +$LV_REMOTE = $LV_REMOTE ?? "lunarvim/lunarvim.git" +$INSTALL_PREFIX = $INSTALL_PREFIX ?? "$HOME\.local" + +$env:XDG_DATA_HOME = $env:XDG_DATA_HOME ?? $env:APPDATA +$env:XDG_CONFIG_HOME = $env:XDG_CONFIG_HOME ?? $env:LOCALAPPDATA +$env:XDG_CACHE_HOME = $env:XDG_CACHE_HOME ?? $env:TEMP + +$env:LUNARVIM_RUNTIME_DIR = $env:LUNARVIM_RUNTIME_DIR ?? "$env:XDG_DATA_HOME\lunarvim" +$env:LUNARVIM_CONFIG_DIR = $env:LUNARVIM_CONFIG_DIR ?? "$env:XDG_CONFIG_HOME\lvim" +$env:LUNARVIM_CACHE_DIR = $env:LUNARVIM_CACHE_DIR ?? "$env:XDG_CACHE_HOME\lvim" +$env:LUNARVIM_BASE_DIR = $env:LUNARVIM_BASE_DIR ?? "$env:LUNARVIM_RUNTIME_DIR\lvim" + +$__lvim_dirs = ( + $env:LUNARVIM_BASE_DIR, + $env:LUNARVIM_RUNTIME_DIR, + $env:LUNARVIM_CONFIG_DIR, + $env:LUNARVIM_CACHE_DIR +) + +function main($cliargs) { + Write-Output "Removing LunarVim binary..." + remove_lvim_bin + Write-Output "Removing LunarVim directories..." + $force = $false + if ($cliargs.Contains("--remove-backups")) { + $force = $true + } + remove_lvim_dirs $force + Write-Output "Uninstalled LunarVim!" +} + +function remove_lvim_bin(){ + $lvim_bin="$INSTALL_PREFIX\bin\lvim" + if (Test-Path $lvim_bin) { + Remove-Item -Force $lvim_bin + } + if (Test-Path alias:lvim) { + Write-Warning "Please make sure to remove the 'lvim' alias from your `$PROFILE`: $PROFILE" + } +} + +function remove_lvim_dirs($force) { + foreach ($dir in $__lvim_dirs) { + if (Test-Path $dir) { + Remove-Item -Force -Recurse $dir + } + if ($force -eq $true) { + if (Test-Path "$dir.bak") { + Remove-Item -Force -Recurse "$dir.bak" + } + if (Test-Path "$dir.old") { + Remove-Item -Force -Recurse "$dir.old" + } + } + } +} + +main($args) diff --git a/mac/.config/LunarVim/utils/installer/uninstall.sh b/mac/.config/LunarVim/utils/installer/uninstall.sh new file mode 100755 index 0000000..9b26263 --- /dev/null +++ b/mac/.config/LunarVim/utils/installer/uninstall.sh @@ -0,0 +1,89 @@ +#!/usr/bin/env bash +set -eo pipefail + +ARGS_REMOVE_BACKUPS=0 +ARGS_REMOVE_CONFIG=0 + +declare -r XDG_DATA_HOME="${XDG_DATA_HOME:-"$HOME/.local/share"}" +declare -r XDG_CACHE_HOME="${XDG_CACHE_HOME:-"$HOME/.cache"}" +declare -r XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-"$HOME/.config"}" + +declare -xr NVIM_APPNAME="${NVIM_APPNAME:-"lvim"}" + +declare -xr LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvim"}" +declare -xr LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/$NVIM_APPNAME"}" +declare -xr LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-"$XDG_CACHE_HOME/$NVIM_APPNAME"}" +declare -xr LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$LUNARVIM_RUNTIME_DIR/$NVIM_APPNAME"}" + +declare -a __lvim_dirs=( + "$LUNARVIM_RUNTIME_DIR" + "$LUNARVIM_CACHE_DIR" +) + +__lvim_config_dir="$LUNARVIM_CONFIG_DIR" + +function usage() { + echo "Usage: uninstall.sh []" + echo "" + echo "Options:" + echo " -h, --help Print this help message" + echo " --remove-config Remove user config files as well" + echo " --remove-backups Remove old backup folders as well" +} + +function parse_arguments() { + while [ "$#" -gt 0 ]; do + case "$1" in + --remove-backups) + ARGS_REMOVE_BACKUPS=1 + ;; + --remove-config) + ARGS_REMOVE_CONFIG=1 + ;; + -h | --help) + usage + exit 0 + ;; + esac + shift + done +} + +function remove_lvim_dirs() { + if [ "$ARGS_REMOVE_CONFIG" -eq 1 ]; then + __lvim_dirs+=("$__lvim_config_dir") + fi + for dir in "${__lvim_dirs[@]}"; do + rm -rf "$dir" + if [ "$ARGS_REMOVE_BACKUPS" -eq 1 ]; then + rm -rf "$dir.{bak,old}" + fi + done +} + +function remove_lvim_bin() { + lvim_bin="$(command -v "$NVIM_APPNAME" 2>/dev/null)" + rm -f "$lvim_bin" +} + +function remove_desktop_file() { + OS="$(uname -s)" + # TODO: Any other OSes that use desktop files? + ([ "$OS" != "Linux" ] || ! command -v xdg-desktop-menu &>/dev/null) && return + echo "Removing desktop file..." + + find "$XDG_DATA_HOME/icons/hicolor" -name "lvim.svg" -type f -delete + xdg-desktop-menu uninstall lvim.desktop +} + +function main() { + parse_arguments "$@" + echo "Removing LunarVim binary..." + remove_lvim_bin + echo "Removing LunarVim directories..." + remove_lvim_dirs + remove_desktop_file + echo "Uninstalled LunarVim!" +} + +main "$@" diff --git a/mac/.config/NvChad/.stylua.toml b/mac/.config/NvChad/.stylua.toml new file mode 100644 index 0000000..ecb6dca --- /dev/null +++ b/mac/.config/NvChad/.stylua.toml @@ -0,0 +1,6 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "None" diff --git a/mac/.config/NvChad/LICENSE b/mac/.config/NvChad/LICENSE new file mode 100644 index 0000000..fdddb29 --- /dev/null +++ b/mac/.config/NvChad/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/mac/.config/NvChad/README.md b/mac/.config/NvChad/README.md new file mode 100644 index 0000000..769fbdf --- /dev/null +++ b/mac/.config/NvChad/README.md @@ -0,0 +1,9 @@ +**This repo is supposed to be used as config by NvChad users!** + +- The main nvchad repo (NvChad/NvChad) is used as a plugin by this repo. +- So you just import its modules , like `require "nvchad.options" , require "nvchad.mappings"` +- So you can delete the .git from this repo ( when you clone it locally ) or fork it :) + +# Credits + +1) Lazyvim starter https://github.com/LazyVim/starter as nvchad's starter was inspired by Lazyvim's . It made a lot of things easier! diff --git a/mac/.config/NvChad/init.lua b/mac/.config/NvChad/init.lua new file mode 100644 index 0000000..494360c --- /dev/null +++ b/mac/.config/NvChad/init.lua @@ -0,0 +1,37 @@ +vim.g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/" +vim.g.mapleader = " " + +-- bootstrap lazy and all plugins +local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" + +if not vim.uv.fs_stat(lazypath) then + local repo = "https://github.com/folke/lazy.nvim.git" + vim.fn.system { "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath } +end + +vim.opt.rtp:prepend(lazypath) + +local lazy_config = require "configs.lazy" + +-- load plugins +require("lazy").setup({ + { + "NvChad/NvChad", + lazy = false, + branch = "v2.5", + import = "nvchad.plugins", + }, + + { import = "plugins" }, +}, lazy_config) + +-- load theme +dofile(vim.g.base46_cache .. "defaults") +dofile(vim.g.base46_cache .. "statusline") + +require "options" +require "autocmds" + +vim.schedule(function() + require "mappings" +end) diff --git a/mac/.config/NvChad/lua/autocmds.lua b/mac/.config/NvChad/lua/autocmds.lua new file mode 100644 index 0000000..d2db0bb --- /dev/null +++ b/mac/.config/NvChad/lua/autocmds.lua @@ -0,0 +1 @@ +require "nvchad.autocmds" diff --git a/mac/.config/NvChad/lua/chadrc.lua b/mac/.config/NvChad/lua/chadrc.lua new file mode 100644 index 0000000..86cccf1 --- /dev/null +++ b/mac/.config/NvChad/lua/chadrc.lua @@ -0,0 +1,30 @@ +-- This file needs to have same structure as nvconfig.lua +-- https://github.com/NvChad/ui/blob/v3.0/lua/nvconfig.lua +-- Please read that file to know all available options :( + +---@type ChadrcConfig +local M = {} + +M.base46 = { + theme = "onedark", -- default theme + hl_add = {}, + hl_override = {}, + integrations = {}, + changed_themes = {}, + transparency = false, + theme_toggle = { "onedark", "one_light" }, + + -- hl_override = { + -- Comment = { italic = true }, + -- ["@comment"] = { italic = true }, + -- }, +} + +-- M.nvdash = { load_on_startup = true } +-- M.ui = { +-- tabufline = { +-- lazyload = false +-- } +--} + +return M diff --git a/mac/.config/NvChad/lua/configs/conform.lua b/mac/.config/NvChad/lua/configs/conform.lua new file mode 100644 index 0000000..35ba6cf --- /dev/null +++ b/mac/.config/NvChad/lua/configs/conform.lua @@ -0,0 +1,15 @@ +local options = { + formatters_by_ft = { + lua = { "stylua" }, + -- css = { "prettier" }, + -- html = { "prettier" }, + }, + + -- format_on_save = { + -- -- These options will be passed to conform.format() + -- timeout_ms = 500, + -- lsp_fallback = true, + -- }, +} + +return options diff --git a/mac/.config/NvChad/lua/configs/lazy.lua b/mac/.config/NvChad/lua/configs/lazy.lua new file mode 100644 index 0000000..cd170bd --- /dev/null +++ b/mac/.config/NvChad/lua/configs/lazy.lua @@ -0,0 +1,47 @@ +return { + defaults = { lazy = true }, + install = { colorscheme = { "nvchad" } }, + + ui = { + icons = { + ft = "", + lazy = "󰂠 ", + loaded = "", + not_loaded = "", + }, + }, + + performance = { + rtp = { + disabled_plugins = { + "2html_plugin", + "tohtml", + "getscript", + "getscriptPlugin", + "gzip", + "logipat", + "netrw", + "netrwPlugin", + "netrwSettings", + "netrwFileHandlers", + "matchit", + "tar", + "tarPlugin", + "rrhelper", + "spellfile_plugin", + "vimball", + "vimballPlugin", + "zip", + "zipPlugin", + "tutor", + "rplugin", + "syntax", + "synmenu", + "optwin", + "compiler", + "bugreport", + "ftplugin", + }, + }, + }, +} diff --git a/mac/.config/NvChad/lua/configs/lspconfig.lua b/mac/.config/NvChad/lua/configs/lspconfig.lua new file mode 100644 index 0000000..7bcabca --- /dev/null +++ b/mac/.config/NvChad/lua/configs/lspconfig.lua @@ -0,0 +1,55 @@ +require("nvchad.configs.lspconfig").defaults() + +local servers = { "html", "cssls" } +vim.lsp.enable(servers) + +-- read :h vim.lsp.config for changing options of lsp servers +vim.lsp.config("lua_ls", { + on_init = function(client) + if client.workspace_folders then + local path = client.workspace_folders[1].name + if + path ~= vim.fn.stdpath "config" + and (vim.uv.fs_stat(path .. "/.luarc.json") or vim.uv.fs_stat(path .. "/.luarc.jsonc")) + then + return + end + end + + client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, { + runtime = { + -- Tell the language server which version of Lua you're using (most + -- likely LuaJIT in the case of Neovim) + version = "LuaJIT", + -- Tell the language server how to find Lua modules same way as Neovim + -- (see `:h lua-module-load`) + path = { + "lua/?.lua", + "lua/?/init.lua", + }, + }, + -- Make the server aware of Neovim runtime files + workspace = { + checkThirdParty = false, + library = { + 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 and will cause issues when working on + -- your own configuration. + -- See https://github.com/neovim/nvim-lspconfig/issues/3189 + -- library = { + -- vim.api.nvim_get_runtime_file('', true), + -- } + }, + }) + end, + settings = { + Lua = {}, + }, +}) +vim.lsp.enable "lua_ls" diff --git a/mac/.config/NvChad/lua/mappings.lua b/mac/.config/NvChad/lua/mappings.lua new file mode 100644 index 0000000..783b78f --- /dev/null +++ b/mac/.config/NvChad/lua/mappings.lua @@ -0,0 +1,10 @@ +require "nvchad.mappings" + +-- add yours here + +local map = vim.keymap.set + +map("n", ";", ":", { desc = "CMD enter command mode" }) +map("i", "jk", "") + +-- map({ "n", "i", "v" }, "", " w ") diff --git a/mac/.config/NvChad/lua/options.lua b/mac/.config/NvChad/lua/options.lua new file mode 100644 index 0000000..738f20b --- /dev/null +++ b/mac/.config/NvChad/lua/options.lua @@ -0,0 +1,6 @@ +require "nvchad.options" + +-- add yours here! + +-- local o = vim.o +-- o.cursorlineopt ='both' -- to enable cursorline! diff --git a/mac/.config/NvChad/lua/plugins/init.lua b/mac/.config/NvChad/lua/plugins/init.lua new file mode 100644 index 0000000..e67fc7e --- /dev/null +++ b/mac/.config/NvChad/lua/plugins/init.lua @@ -0,0 +1,52 @@ +return { + { + "stevearc/conform.nvim", + -- event = 'BufWritePre', -- uncomment for format on save + opts = require "configs.conform", + }, + + -- These are some examples, uncomment them if you want to see them work! + { + "neovim/nvim-lspconfig", + config = function() + require "configs.lspconfig" + end, + }, + + -- test new blink + { import = "nvchad.blink.lazyspec" }, + + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "vim", + "lua", + "vimdoc", + "html", + "css", + }, + }, + }, + + "nvim-lua/plenary.nvim", + { "nvim-tree/nvim-web-devicons", lazy = true }, + + { + "nvchad/ui", + config = function() + require "nvchad" + end, + }, + + { + "nvchad/base46", + lazy = true, + build = function() + require("base46").load_all_highlights() + end, + }, + + "nvchad/volt", -- optional, needed for theme switcher + -- or just use Telescope themes +} diff --git a/mac/.config/TheSiahxyz/after/queries/markdown/textobjects.scm b/mac/.config/TheSiahxyz/after/queries/markdown/textobjects.scm new file mode 100644 index 0000000..2882dd2 --- /dev/null +++ b/mac/.config/TheSiahxyz/after/queries/markdown/textobjects.scm @@ -0,0 +1,3 @@ +;; extends + +(fenced_code_block (code_fence_content) @code_cell.inner) @code_cell.outer diff --git a/mac/.config/TheSiahxyz/ftplugin/markdown.lua b/mac/.config/TheSiahxyz/ftplugin/markdown.lua new file mode 100644 index 0000000..e27cd21 --- /dev/null +++ b/mac/.config/TheSiahxyz/ftplugin/markdown.lua @@ -0,0 +1,501 @@ +-- Function to check if the current file is in the Obsidian repository +local function is_in_obsidian_repo() + local current_file_path = vim.fn.expand("%:p:h") + local user = os.getenv("USER") -- Get the current user's name from the environment variable + local obsidian_path = "/home/" .. user .. "/Private/repos/Obsidian/" + + return string.find(current_file_path, obsidian_path) ~= nil +end + +function BoldMe() + -- Get the start and end positions of the visual selection + local start_pos = vim.fn.getpos("'<") + local end_pos = vim.fn.getpos("'>") + local start_line, start_col = start_pos[2], start_pos[3] + local end_line, end_col = end_pos[2], end_pos[3] + local lines = vim.api.nvim_buf_get_lines(0, start_line - 1, end_line, false) + + if start_line == end_line then + lines[1] = lines[1]:sub(1, start_col - 1) + .. "**" + .. lines[1]:sub(start_col, end_col) + .. "**" + .. lines[1]:sub(end_col + 1) + else + lines[1] = lines[1]:sub(1, start_col - 1) .. "**" .. lines[1]:sub(start_col) + lines[#lines] = lines[#lines]:sub(1, end_col) .. "**" .. lines[#lines]:sub(end_col + 1) + end + vim.api.nvim_buf_set_lines(0, start_line - 1, end_line, false, lines) +end + +local function MarkdownCodeBlock(outside) + vim.cmd("call search('```', 'cb')") + vim.cmd(outside and "normal! Vo" or "normal! j0Vo") + vim.cmd("call search('```')") + if not outside then + vim.cmd("normal! k") + end +end + +-- Code block text objects +for _, mode in ipairs({ "o", "x" }) do + for _, mapping in ipairs({ + { "am", true }, + { "im", false }, + }) do + vim.keymap.set(mode, mapping[1], function() + MarkdownCodeBlock(mapping[2]) + end, { buffer = 0 }) + end +end + +-- Function to fold all headings of a specific level +local function set_foldmethod_expr() + -- These are lazyvim.org defaults but setting them just in case a file + -- doesn't have them set + if vim.fn.has("nvim-0.10") == 1 then + vim.opt.foldmethod = "expr" + vim.wo.foldexpr = "v:lua.require'TheSiahxyz.utils.markdown'.foldexpr()" + vim.opt.foldtext = "" + else + vim.opt.foldmethod = "indent" + vim.wo.foldtext = "v:lua.require'TheSiahxyz.utils.markdown'.foldexpr()" + end + vim.opt.foldlevel = 99 +end + +local function fold_headings_of_level(level) + -- Move to the top of the file + vim.cmd("normal! gg") + -- Get the total number of lines + local total_lines = vim.fn.line("$") + for line = 1, total_lines do + -- Get the content of the current line + local line_content = vim.fn.getline(line) + -- "^" -> Ensures the match is at the start of the line + -- string.rep("#", level) -> Creates a string with 'level' number of "#" characters + -- "%s" -> Matches any whitespace character after the "#" characters + -- So this will match `## `, `### `, `#### ` for example, which are markdown headings + if line_content:match("^" .. string.rep("#", level) .. "%s") then + -- Move the cursor to the current line + vim.fn.cursor(line, 1) + -- Fold the heading if it matches the level + if vim.fn.foldclosed(line) == -1 then + vim.cmd("normal! za") + end + end + end +end + +local function fold_markdown_headings(levels) + set_foldmethod_expr() + -- I save the view to know where to jump back after folding + local saved_view = vim.fn.winsaveview() + for _, level in ipairs(levels) do + fold_headings_of_level(level) + end + vim.cmd("nohlsearch") + -- Restore the view to jump to where I was + vim.fn.winrestview(saved_view) +end + +local function make_heading_content() + -- Get the total number of lines in the buffer + local total_lines = vim.api.nvim_buf_line_count(0) + + -- Iterate through all lines + for line = 1, total_lines do + -- Get the content of the current line + local line_content = vim.api.nvim_buf_get_lines(0, line - 1, line, false)[1] + -- Match headings with at least two '#' characters + local heading = line_content:match("^(##+)%s(.+)") + if heading then + -- Extract the heading text + local heading_text = line_content:match("^#+%s(.+)") + if heading_text then + -- Create the content line with markdown link syntax + local content_line = string.format("%s [%s]()", heading, heading_text) + -- Replace the current line with the modified content + vim.api.nvim_buf_set_lines(0, line - 1, line, false, { content_line }) + end + end + end + -- Notify the user that the headings have been updated + vim.notify("Headings transformed into content format", vim.log.levels.INFO) +end + +-- Generate/update a Markdown TOC +-- To generate the TOC I use the markdown-toc plugin +-- https://github.com/jonschlinkert/markdown-toc +-- And the markdown-toc plugin installed as a LazyExtra +-- Function to update the Markdown TOC with customizable headings +local function update_markdown_toc(heading2, heading3) + -- local path = vim.fn.expand("%") -- Expands the current file name to a full path + local path = vim.api.nvim_buf_get_name(0) + local bufnr = 0 -- The current buffer number, 0 references the current active buffer + -- Save the current view + -- If I don't do this, my folds are lost when I run this keymap + vim.cmd("mkview") + -- Retrieves all lines from the current buffer + local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false) + local toc_exists = false -- Flag to check if TOC marker exists + local frontmatter_end = 0 -- To store the end line number of frontmatter + -- Check for frontmatter and TOC marker + for i, line in ipairs(lines) do + if i == 1 and line:match("^---$") then + -- Frontmatter start detected, now find the end + for j = i + 1, #lines do + if lines[j]:match("^---$") then + frontmatter_end = j + break + end + end + end + -- Checks for the TOC marker + if line:match("^%s*%s*$") then + toc_exists = true + break + end + end + -- Inserts H2 and H3 headings and at the appropriate position + if not toc_exists then + local insertion_line = 1 -- Default insertion point after first line + if frontmatter_end > 0 then + -- Find H1 after frontmatter + for i = frontmatter_end + 1, #lines do + if lines[i]:match("^#%s+") then + insertion_line = i + 1 + break + end + end + else + -- Find H1 from the beginning + for i, line in ipairs(lines) do + if line:match("^#%s+") then + insertion_line = i + 1 + break + end + end + end + -- Insert the specified headings and without blank lines + -- Insert the TOC inside a H2 and H3 heading right below the main H1 at the top lamw25wmal + vim.api.nvim_buf_set_lines(bufnr, insertion_line, insertion_line, false, { heading2, heading3, "" }) + end + -- Silently save the file, in case TOC is being created for the first time + vim.cmd("silent write") + -- Silently run markdown-toc to update the TOC without displaying command output + -- vim.fn.system('markdown-toc -i "' .. path .. '"') + -- I want my bulletpoints to be created only as "-" so passing that option as + -- an argument according to the docs + -- https://github.com/jonschlinkert/markdown-toc?tab=readme-ov-file#optionsbullets + vim.fn.system('markdown-toc --bullets "-" -i "' .. path .. '"') + vim.cmd("edit!") -- Reloads the file to reflect the changes made by markdown-toc + vim.cmd("silent write") -- Silently save the file + vim.notify("TOC updated and file saved", vim.log.levels.INFO) + -- -- In case a cleanup is needed, leaving this old code here as a reference + -- -- I used this code before I implemented the frontmatter check + -- -- Moves the cursor to the top of the file + -- vim.api.nvim_win_set_cursor(bufnr, { 1, 0 }) + -- -- Deletes leading blank lines from the top of the file + -- while true do + -- -- Retrieves the first line of the buffer + -- local line = vim.api.nvim_buf_get_lines(bufnr, 0, 1, false)[1] + -- -- Checks if the line is empty + -- if line == "" then + -- -- Deletes the line if it's empty + -- vim.api.nvim_buf_set_lines(bufnr, 0, 1, false, {}) + -- else + -- -- Breaks the loop if the line is not empty, indicating content or TOC marker + -- break + -- end + -- end + -- Restore the saved view (including folds) + vim.cmd("loadview") +end + +-- Show LSP diagnostics (inlay hints) in a hover window / popup lamw26wmal +vim.api.nvim_create_autocmd("FileType", { + pattern = { "markdown", "mdx", "mdown", "mkd", "mkdn", "mdwn" }, + callback = function() + vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { + buffer = 0, + callback = function() + vim.diagnostic.open_float(nil, { + focus = false, + border = "rounded", + }) + end, + }) + end, +}) + +-- FileType autocmd for markdown files +vim.api.nvim_create_autocmd("FileType", { + pattern = { "markdown", "mdx", "mdown", "mkd", "mkdn", "mdwn" }, + callback = function() + -- Local settings + vim.bo.textwidth = is_in_obsidian_repo() and 80 or 175 + vim.opt_local.autoindent = true + vim.opt_local.conceallevel = 0 + vim.opt_local.expandtab = true + vim.opt_local.softtabstop = 4 + vim.opt_local.shiftwidth = 4 + vim.opt_local.spell = true + vim.opt_local.spelllang = { "en", "ko", "cjk" } + vim.opt_local.spellsuggest = { "best", "9" } + + local arrows = { [">>"] = "→", ["<<"] = "←", ["^^"] = "↑", ["VV"] = "↓" } + for key, val in pairs(arrows) do + vim.cmd(string.format("iabbrev %s %s", key, val)) + end + end, +}) + +-- this setting makes markdown auto-set the 80 text width limit when typing +-- vim.cmd('set fo+=a') +if is_in_obsidian_repo() then + vim.bo.textwidth = 175 -- No limit for Obsidian repository +end + +-- Makrdown.nvim settings +local markdown_settings = { + auto_insert_bullets = 0, + autowrite = 1, + conceal = 0, + conceal_code_blocks = 0, + folding_disabled = 0, + folding_level = 2, + folding_style_pythonic = 1, + follow_anchor = 1, + new_list_item_indent = 0, + no_extensions_in_markdown = 1, + no_default_key_mappings = 1, + toc_autofit = 1, +} + +for key, value in pairs(markdown_settings) do + vim.g["vim_markdown_" .. key] = value +end + +-- MarkdownPreview settings +-- Get the BROWSER environment variable +local markdown_preview_settings = { + browser = os.getenv("BROWSER") or "/usr/bin/firefox", + echo_preview_url = 0, +} + +for key, value in pairs(markdown_preview_settings) do + vim.g["mkdp_" .. key] = value +end + +-- Save the cursor position globally to access it across different mappings +_G.saved_positions = {} + +local wk = require("which-key") +wk.add({ + mode = { "n", "v", "x" }, + { "ct", group = "Copy" }, + { "i", group = "Image" }, + { "m", group = "Markdown" }, + { "mh", group = "Headings" }, +}) + +-- bold +vim.api.nvim_buf_set_keymap( + 0, + "v", + "mb", + ":lua BoldMe()", + { noremap = true, silent = true, desc = "Bold selection" } +) + +-- copy +vim.keymap.set("n", "mcd", "4wvg$y", { desc = "Copy description" }) + +-- heading +vim.keymap.set("n", "mhi", function() + -- Save the current cursor position + local cursor_pos = vim.api.nvim_win_get_cursor(0) + -- I'm using [[ ]] to escape the special characters in a command + vim.cmd([[:g/\(^$\n\s*#\+\s.*\n^$\)/ .+1 s/^#\+\s/#&/]]) + -- Restore the cursor position + vim.api.nvim_win_set_cursor(0, cursor_pos) + -- Clear search highlight + vim.cmd("nohlsearch") +end, { desc = "Increase headings without confirmation" }) + +vim.keymap.set("n", "mhd", function() + -- Save the current cursor position + local cursor_pos = vim.api.nvim_win_get_cursor(0) + -- I'm using [[ ]] to escape the special characters in a command + vim.cmd([[:g/^\s*#\{2,}\s/ s/^#\(#\+\s.*\)/\1/]]) + -- Restore the cursor position + vim.api.nvim_win_set_cursor(0, cursor_pos) + -- Clear search highlight + vim.cmd("nohlsearch") +end, { desc = "Decrease headings without confirmation" }) + +local function make_heading_content() + -- Get the total number of lines in the buffer + local total_lines = vim.api.nvim_buf_line_count(0) + + -- Iterate through all lines + for line = 1, total_lines do + -- Get the content of the current line + local line_content = vim.api.nvim_buf_get_lines(0, line - 1, line, false)[1] + -- Match headings with at least two '#' characters + local heading = line_content:match("^(##+)%s(.+)") + if heading then + -- Extract the heading text + local heading_text = line_content:match("^#+%s(.+)") + if heading_text then + -- Create the content line with markdown link syntax + local content_line = string.format("%s [%s]()", heading, heading_text) + -- Replace the current line with the modified content + vim.api.nvim_buf_set_lines(0, line - 1, line, false, { content_line }) + end + end + end + -- Notify the user that the headings have been updated + vim.notify("Headings transformed into content format", vim.log.levels.INFO) +end +vim.keymap.set("n", "mhl", make_heading_content, { desc = "Make heading content" }) + +-- line to list +vim.keymap.set( + "n", + "ml", + "^I-[]^j", + { remap = true, silent = false, desc = "Make a line into a list" } +) + +-- folding +-- Keymap for unfolding markdown headings of level 2 or above +-- Changed all the markdown folding and unfolding keymaps from mfj to +-- zj, zk, zl, z; and zu respectively lamw25wmal +vim.keymap.set("n", "zu", function() + -- vim.keymap.set("n", "mfu", function() + -- Reloads the file to reflect the changes + vim.cmd("edit!") + vim.cmd("normal! zR") -- Unfold all headings +end, { desc = "Unfold all headings level 2 or above" }) + +-- gk jummps to the markdown heading above and then folds it +-- zi by default toggles folding, but I don't need it lamw25wmal +vim.keymap.set("n", "zh", function() + -- Difference between normal and normal! + -- - `normal` executes the command and respects any mappings that might be defined. + -- - `normal!` executes the command in a "raw" mode, ignoring any mappings. + vim.cmd("normal gk") + -- This is to fold the line under the cursor + vim.cmd("normal! za") +end, { desc = "Fold the heading cursor currently on" }) + +-- Keymap for folding markdown headings of level 1 or above +vim.keymap.set("n", "zj", function() + -- vim.keymap.set("n", "mfj", function() + -- Reloads the file to refresh folds, otherwise you have to re-open neovim + vim.cmd("edit!") + -- Unfold everything first or I had issues + vim.cmd("normal! zR") + fold_markdown_headings({ 6, 5, 4, 3, 2, 1 }) +end, { desc = "Fold all headings level 1 or above" }) + +-- Keymap for folding markdown headings of level 2 or above +-- I know, it reads like "madafaka" but "k" for me means "2" +vim.keymap.set("n", "zk", function() + -- vim.keymap.set("n", "mfk", function() + -- Reloads the file to refresh folds, otherwise you have to re-open neovim + vim.cmd("edit!") + -- Unfold everything first or I had issues + vim.cmd("normal! zR") + fold_markdown_headings({ 6, 5, 4, 3, 2 }) +end, { desc = "Fold all headings level 2 or above" }) + +-- Keymap for folding markdown headings of level 3 or above +vim.keymap.set("n", "zl", function() + -- vim.keymap.set("n", "mfl", function() + -- Reloads the file to refresh folds, otherwise you have to re-open neovim + vim.cmd("edit!") + -- Unfold everything first or I had issues + vim.cmd("normal! zR") + fold_markdown_headings({ 6, 5, 4, 3 }) +end, { desc = "Fold all headings level 3 or above" }) + +-- Keymap for folding markdown headings of level 4 or above +vim.keymap.set("n", "z;", function() + -- vim.keymap.set("n", "mf;", function() + -- Reloads the file to refresh folds, otherwise you have to re-open neovim + vim.cmd("edit!") + -- Unfold everything first or I had issues + vim.cmd("normal! zR") + fold_markdown_headings({ 6, 5, 4 }) +end, { desc = "Fold all headings level 4 or above" }) + +-- link text objects for i and a +vim.keymap.set( + { "o", "x" }, + "il", + "lua require('various-textobjs').mdlink('inner')", + { buffer = true, desc = "Link" } +) +vim.keymap.set( + { "o", "x" }, + "al", + "lua require('various-textobjs').mdlink('outer')", + { buffer = true, desc = "Link" } +) + +-- preview +vim.keymap.set("n", "mp", ":MarkdownPreview", { desc = "Markdown preview" }) + +-- traversal +vim.keymap.set("n", "", "Markdown_Fold", { desc = "Tab is for moving around only" }) + +vim.keymap.set("n", "]]", "Markdown_MoveToNextHeader", { desc = "Go to next header" }) +vim.keymap.set("n", "[[", "Markdown_MoveToPreviousHeader", { desc = "Go to previous header. Contrast with ]c" }) +vim.keymap.set("n", "][", "Markdown_MoveToNextSiblingHeader", { desc = "Go to next sibling header if any" }) +vim.keymap.set( + "n", + "[]", + "Markdown_MoveToPreviousSiblingHeader", + { desc = "Go to previous sibling header if any" } +) +vim.keymap.set("n", "]c", "Markdown_MoveToCurHeader", { desc = "Go to Current header" }) +vim.keymap.set("n", "]u", "Markdown_MoveToParentHeader", { desc = "Go to parent header (Up)" }) +vim.keymap.set("n", "", "Markdown_Checkbox", { desc = "Toggle checkboxes" }) +vim.keymap.set("n", "Tab", "Markdown_Fold", { desc = "Fold headers/lists" }) +vim.keymap.set("n", "Return", "Markdown_FollowLink", { desc = "Follow links" }) +vim.keymap.set("i", "Tab", "Markdown_Jump", { desc = "Indent new bullets, jump through empty fields in links" }) +vim.keymap.set({ "i", "v" }, "", "Markdown_CreateLink", { desc = "Create new links" }) +vim.keymap.set("i", "", "Markdown_NewLineAbove", { desc = "New line above, overrides default" }) +vim.keymap.set("i", "", "Markdown_NewLineBelow", { desc = "New line below, overrides default" }) +vim.keymap.set("i", "Return", "Markdown_NewLineBelow", { desc = "New line below, overrides default" }) +-- jump to the first line of the TOC +vim.keymap.set("n", "mm", function() + -- Save the current cursor position + _G.saved_positions["toc_return"] = vim.api.nvim_win_get_cursor(0) + -- Perform a silent search for the marker and move the cursor two lines below it + vim.cmd("silent! /\\n\\n\\zs.*") + -- Clear the search highlight without showing the "search hit BOTTOM, continuing at TOP" message + vim.cmd("nohlsearch") + -- Retrieve the current cursor position (after moving to the TOC) + local cursor_pos = vim.api.nvim_win_get_cursor(0) + local row = cursor_pos[1] + -- local col = cursor_pos[2] + -- Move the cursor to column 15 (starts counting at 0) + -- I like just going down on the TOC and press gd to go to a section + vim.api.nvim_win_set_cursor(0, { row, 14 }) +end, { desc = "Jump to the first line of the TOC" }) +-- return to the previously saved cursor position +vim.keymap.set("n", "mn", function() + local pos = _G.saved_positions["toc_return"] + if pos then + vim.api.nvim_win_set_cursor(0, pos) + end +end, { desc = "Return to position before jumping" }) + +-- TOC (english) +vim.keymap.set("n", "mt", function() + update_markdown_toc("## Contents", "### Table of contents") +end, { desc = "Insert/update Markdown TOC (English)" }) diff --git a/mac/.config/TheSiahxyz/ftplugin/quarto.lua b/mac/.config/TheSiahxyz/ftplugin/quarto.lua new file mode 100644 index 0000000..92e0025 --- /dev/null +++ b/mac/.config/TheSiahxyz/ftplugin/quarto.lua @@ -0,0 +1,6 @@ +-- set some options for quarto files, but they're set on the window, so they'll apply to other +-- buffers too +vim.wo.linebreak = true +vim.wo.breakindent = true +vim.wo.showbreak = "|" +vim.wo.conceallevel = 0 diff --git a/mac/.config/TheSiahxyz/init.lua b/mac/.config/TheSiahxyz/init.lua new file mode 100644 index 0000000..c459a26 --- /dev/null +++ b/mac/.config/TheSiahxyz/init.lua @@ -0,0 +1 @@ +require("TheSiahxyz") diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/autocmds.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/autocmds.lua new file mode 100644 index 0000000..3bd702a --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/autocmds.lua @@ -0,0 +1,388 @@ +local function augroup(name) + return vim.api.nvim_create_augroup("TheSiahxyz_" .. name, { clear = true }) +end + +local autocmd = vim.api.nvim_create_autocmd +local home = os.getenv("HOME") + +-- Change the color of symlink files to distinguish between directory and symlink files +autocmd("FileType", { + group = augroup("highlight_linked_files"), + pattern = "netrw", + callback = function() + vim.cmd("highlight NetrwSymlink guifg=#689D6A ctermfg=214") + end, +}) + +-- Check if we need to reload the file when it changed +autocmd({ "FocusGained", "TermClose", "TermLeave" }, { + group = augroup("check_time"), + callback = function() + if vim.o.buftype ~= "nofile" then + vim.cmd("checktime") + end + end, +}) + +-- Highlight on yank +autocmd("TextYankPost", { + group = augroup("highlight_yank"), + callback = function() + vim.highlight.on_yank() + end, +}) + +-- Resize splits if window got resized +autocmd({ "VimResized" }, { + group = augroup("window_config"), + callback = function() + local current_tab = vim.fn.tabpagenr() + vim.cmd("tabdo wincmd =") + vim.cmd("tabnext " .. current_tab) + end, +}) + +-- Go to last loc when opening a buffer +autocmd("BufReadPost", { + group = augroup("last_loc"), + callback = function(event) + local exclude = { "gitcommit" } + local buf = event.buf + if vim.tbl_contains(exclude, vim.bo[buf].filetype) or vim.b[buf].TheSiahxyz_last_loc then + return + end + vim.b[buf].TheSiahxyz_last_loc = true + local mark = vim.api.nvim_buf_get_mark(buf, '"') + local lcount = vim.api.nvim_buf_line_count(buf) + if mark[1] > 0 and mark[1] <= lcount then + pcall(vim.api.nvim_win_set_cursor, 0, mark) + end + end, +}) + +-- Close some filetypes with +autocmd("FileType", { + group = augroup("close_with_q"), + pattern = { + "checkhealth", + "dbout", + "gitsigns-blame", + "grug-far", + "help", + "lspinfo", + "Lazy", + "neotest-output", + "neotest-output-panel", + "neotest-summary", + "notify", + "PlenaryTestPopup", + "qf", + "query", + "spectre_panel", + "startuptime", + "terminal", + "tsplayground", + }, + callback = function(event) + vim.bo[event.buf].buflisted = false + vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true }) + end, +}) +autocmd("FileType", { + group = augroup("q_as_bd"), + pattern = "netrw", + callback = function(event) + vim.bo[event.buf].buflisted = false + vim.keymap.set("n", "q", function() + vim.cmd("bd") + end, { buffer = event.buf, silent = true }) + end, +}) + +-- Make it easier to close man-files when opened inline +autocmd("FileType", { + group = augroup("man_close"), + pattern = { "man" }, + callback = function(event) + vim.bo[event.buf].buflisted = false + end, +}) + +-- Fix conceallevel for json files +autocmd({ "FileType" }, { + group = augroup("json_config"), + pattern = { "json", "jsonc", "json5" }, + callback = function() + vim.opt_local.conceallevel = 0 + end, +}) + +-- Auto create dir when saving a file, in case some intermediate directory does not exist +autocmd({ "BufWritePre" }, { + group = augroup("create_dir"), + callback = function(event) + if event.match:match("^%w%w+:[\\/][\\/]") then + return + end + local file = vim.uv.fs_realpath(event.match) or event.match + vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p") + end, +}) + +-- Automatically delete all trailing whitespace and newlines at end of file on save +local file_save = augroup("file_save") +autocmd("BufWritePre", { + group = file_save, + pattern = "*", + callback = function() + local cursor_pos = vim.api.nvim_win_get_cursor(0) + vim.cmd([[ %s/\s\+$//e ]]) -- Remove trailing spaces + vim.cmd([[ %s/\n\+\%$//e ]]) -- Remove trailing newlines + local line_count = vim.api.nvim_buf_line_count(0) + local line = math.min(cursor_pos[1], line_count) + local col = cursor_pos[2] + -- Optional: clamp column if line got shorter + local line_text = vim.api.nvim_buf_get_lines(0, line - 1, line, false)[1] or "" + col = math.min(col, #line_text) + vim.api.nvim_win_set_cursor(0, { line, col }) + end, +}) + +-- Add a trailing newline for C files +autocmd("BufWritePre", { + group = file_save, + pattern = "*.[ch]", + callback = function() + vim.cmd([[ %s/\%$/\r/e ]]) + end, +}) + +-- Go to insert mode in terminal +local win_enter = augroup("win_enter") +autocmd("WinEnter", { + group = win_enter, + callback = function() + if vim.bo.buftype == "terminal" then + vim.cmd("startinsert") + end + end, +}) + +-- Correct email signature delimiter in neomutt files +autocmd("BufWritePre", { + group = file_save, + pattern = "*neomutt*", + callback = function() + vim.cmd([[ %s/^--$/-- /e ]]) + end, +}) + +local function organize_imports() + local params = { + command = "pyright.organizeimports", + arguments = { vim.uri_from_bufnr(0) }, + } + local clients = vim.lsp.get_clients({ bufnr = 0 }) + for _, client in ipairs(clients) do + client:exec_cmd(params, { bufnr = 0 }) + end +end + +autocmd("LspAttach", { + group = augroup("lsp_attach"), + callback = function(e) + local client = vim.lsp.get_client_by_id(e.data.client_id) + if client and client.name == "pyright" then + vim.api.nvim_create_user_command( + "PyrightOrganizeImports", + organize_imports, + { desc = "Organize imports (lsp)" } + ) + end + vim.keymap.set("n", "gD", function() + vim.lsp.buf.definition() + end, { buffer = e.buf, desc = "Go to definition (lsp)" }) + vim.keymap.set("n", "K", function() + vim.lsp.buf.hover() + end, { buffer = e.buf, desc = "Go to keywords (lsp)" }) + vim.keymap.set("n", "ls", function() + vim.lsp.buf.workspace_symbol() + end, { buffer = e.buf, desc = "Workspace symbol (lsp)" }) + vim.keymap.set("n", "lo", function() + vim.diagnostic.open_float() + end, { buffer = e.buf, desc = "Open diagnostic" }) + vim.keymap.set("n", "lc", function() + vim.lsp.buf.code_action() + end, { buffer = e.buf, desc = "Code action (lsp)" }) + vim.keymap.set("n", "lr", function() + vim.lsp.buf.references() + end, { buffer = e.buf, desc = "References (lsp)" }) + vim.keymap.set("n", "ln", function() + vim.lsp.buf.rename() + end, { buffer = e.buf, desc = "Rename (lsp)" }) + vim.keymap.set("n", "lh", function() + vim.lsp.buf.signature_help() + end, { buffer = e.buf, desc = "Signature help (lsp)" }) + vim.keymap.set("n", "]d", function() + vim.diagnostic.goto_next() + end, { buffer = e.buf, desc = "Next diagnostic" }) + vim.keymap.set("n", "[d", function() + vim.diagnostic.goto_prev() + end, { buffer = e.buf, desc = "Previous diagnostic" }) + end, +}) + +-- Save file as sudo on files that require root permission +vim.api.nvim_create_user_command("SudoWrite", function() + vim.cmd([[ + write !sudo tee % 2>/dev/null + edit! + ]]) +end, {}) +vim.api.nvim_create_user_command("SudoWritequit", function() + vim.cmd([[ + write !sudo tee % 2>/dev/null + edit! + quit! + ]]) +end, {}) + +-- Markdown for specific files and directories +autocmd({ "BufRead", "BufNewFile" }, { + pattern = { "/tmp/calcurse*", "~/.calcurse/notes/*" }, + command = "set filetype=markdown", +}) + +-- Groff for specific file extensions +autocmd({ "BufRead", "BufNewFile" }, { + pattern = { "*.ms", "*.me", "*.mom", "*.man" }, + callback = function() + vim.cmd([[ + set columns=90 + set filetype=groff + set linebreak + set textwidth=0 + set wrap + set wrapmargin=0 + ]]) + end, +}) + +-- TeX for .tex files +autocmd({ "BufRead", "BufNewFile" }, { + pattern = { "*.tex" }, + command = "set filetype=tex", +}) + +-- When shortcut files are updated, renew bash and lf configs with new material: +autocmd("BufWritePost", { + group = augroup("bookmarks"), + pattern = { "bm-files", "bm-dirs" }, + callback = function() + -- Execute the 'shortcuts' shell command + local result = vim.fn.system("shortcuts") + -- Display an error message only if the 'shortcuts' command fails + if vim.v.shell_error ~= 0 then + -- Display an error message if the 'shortcuts' command fails + vim.api.nvim_echo({ { "failed to update shortcuts: " .. result, "ErrorMsg" } }, true, {}) + end + end, +}) + +-- Source lfrc if it's edited +local lf_config = augroup("lf_config") +autocmd("BufWritePost", { + group = lf_config, + pattern = { "lfrc" }, + callback = function() + vim.cmd("silent !source ~/.config/lf/lfrc") + end, +}) + +-- Set vimwiki's index filetype to vimwiki instead of markdown +local vimwiki_config = augroup("vimwiki_config") +autocmd({ "BufRead", "BufNewFile" }, { + group = vimwiki_config, + pattern = vim.fn.expand("~/.local/share/vimwiki") .. "/**/*.md", + callback = function(args) + vim.bo[args.buf].filetype = "vimwiki" + end, +}) + +-- Run xrdb whenever Xdefaults or Xresources are updated. +local x_config = augroup("x_config") +autocmd({ "BufRead", "BufNewFile" }, { + group = x_config, + pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" }, + callback = function() + vim.bo.filetype = "xdefaults" + end, +}) +autocmd("BufWritePost", { + group = x_config, + pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" }, + callback = function() + vim.cmd("silent !xrdb %") + end, +}) + +-- Recompile suckless programs on config edit. +local suckless_config = vim.api.nvim_create_augroup("suckless_config", { clear = true }) +autocmd("BufWritePost", { + group = suckless_config, + pattern = home .. "/.local/src/suckless/dmenu/config.def.h", + callback = function() + vim.cmd("silent !cd " .. home .. "/.local/src/suckless/dmenu/ && sudo make clean install && rm -f config.h") + end, +}) + +autocmd("BufWritePost", { + group = suckless_config, + pattern = home .. "/.local/src/suckless/dwmblocks/config.def.h", + callback = function() + vim.cmd( + "silent !cd " + .. home + .. "/.local/src/suckless/dwmblocks/ && sudo make clean install && rm -f config.h && { killall -q dwmblocks; setsid -f dwmblocks; }" + ) + end, +}) + +autocmd("BufWritePost", { + group = suckless_config, + pattern = home .. "/.local/src/suckless/slock/config.def.h", + callback = function() + vim.cmd("silent !cd " .. home .. "/.local/src/suckless/slock/ && sudo make clean install && rm -f config.h") + end, +}) + +local suckless_keys = augroup("suckless_keys") +autocmd("BufWritePost", { + group = suckless_keys, + pattern = { home .. "/.local/src/suckless/dwm/config.def.h", home .. "/.local/src/suckless/st/config.def.h" }, + callback = function() + local choice = vim.fn.confirm("Extract key bindings?", "&Yes\n&No", 2) + if choice == 1 then + vim.cmd("silent !" .. home .. "/.local/bin/extractkeys") + end + end, +}) + +autocmd("BufWritePost", { + group = augroup("suckless_doc"), + pattern = home .. "/.local/src/suckless/dwm/thesiah-default.mom", + callback = function() + vim.cmd("silent !cd " .. home .. "/.local/src/suckless/dwm/ && rm -f thesiah.mom") + end, +}) + +autocmd({ "BufRead", "BufEnter" }, { + pattern = { "*.c", "*.cpp", "*.h", "*.hpp" }, + callback = function() + local suckless_path = vim.fn.expand("~/.local/src/suckless"):gsub("/+$", "") + local file_path = vim.fn.expand("%:p"):gsub("/+$", "") + if file_path:sub(1, #suckless_path) == suckless_path then + vim.b.autoformat = false + end + end, +}) diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/keymaps.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/keymaps.lua new file mode 100644 index 0000000..500abf0 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/keymaps.lua @@ -0,0 +1,807 @@ +-- Ascii +vim.keymap.set("n", "a1", ":.!toilet -w 200 -f bfraktur", { desc = "Ascii art bfraktur" }) +vim.keymap.set("n", "a2", ":.!toilet -w 200 -f emboss", { desc = "Ascii art emboss" }) +vim.keymap.set("n", "a3", ":.!toilet -w 200 -f emboss2", { desc = "Ascii art emboss2" }) +vim.keymap.set("n", "a4", ":.!toilet -w 200 -f future", { desc = "Ascii art future" }) +vim.keymap.set("n", "a5", ":.!toilet -w 200 -f pagga", { desc = "Ascii art pagga" }) +vim.keymap.set("n", "a6", ":.!toilet -w 200 -f wideterm", { desc = "Ascii art wideterm" }) +vim.keymap.set("n", "a7", ":.!figlet -w 200 -f standard", { desc = "Ascii art standard" }) +vim.keymap.set("n", "a8", ":.!figlet -w 200 -f slant", { desc = "Ascii art slant" }) +vim.keymap.set("n", "a9", ":.!figlet -w 200 -f big", { desc = "Ascii art big" }) +vim.keymap.set("n", "a0", ":.!figlet -w 200 -f shadow", { desc = "Ascii art shadow" }) + +-- Buffers +vim.keymap.set({ "n", "v", "x", "t" }, "", "bd!", { desc = "Delete buffer" }) +vim.keymap.set({ "i", "n", "t" }, "", "bprevious", { desc = "Previous buffer" }) +vim.keymap.set({ "i", "n", "t" }, "", "bnext", { desc = "Next buffer" }) +vim.keymap.set("n", "", "e #", { desc = "Switch to last buffer" }) +vim.keymap.set({ "n", "v", "x", "t" }, "bd", ":bd", { desc = "Close buffer" }) +vim.keymap.set({ "n", "v", "x", "t" }, "BD", ":bd!", { desc = "Force close buffer" }) +vim.keymap.set("n", "bn", "enew", { desc = "Open new buffer" }) +vim.keymap.set({ "n", "i" }, "", function() + if not vim.bo.modified then + return + end + local choice = vim.fn.confirm("Discard changes and reload file?", "&Yes\n&No", 2) + if choice == 1 then + vim.cmd("e!") + end +end, { desc = "Confirm and reload file" }) +vim.keymap.set({ "i", "x", "n", "s" }, "", "w", { desc = "Save current buffer" }) +vim.keymap.set({ "n", "v" }, "ZZ", "wq", { desc = "Save current buffer and quit" }) +vim.keymap.set({ "n", "v" }, "ZA", "wqa", { desc = "Save all buffers and quit" }) +vim.keymap.set({ "n", "v" }, "qq", "q!", { desc = "Force quit" }) +vim.keymap.set({ "n", "v" }, "QQ", "qa!", { desc = "Force quit all" }) +vim.keymap.set("n", "rnf", function() + local current_name = vim.fn.expand("%:p") -- Get the full path of the current file + local directory = vim.fn.expand("%:p:h") -- Get the directory of the current file + local new_name = vim.fn.input("New filename: ", directory .. "/") -- Prompt for the new name + if new_name == "" or new_name == current_name then + return -- Do nothing if no input or name hasn't changed + end + vim.cmd("silent !mv " .. vim.fn.shellescape(current_name) .. " " .. vim.fn.shellescape(new_name)) + vim.cmd("edit " .. vim.fn.fnameescape(new_name)) + vim.cmd("bdelete " .. vim.fn.bufnr(current_name)) +end, { noremap = true, silent = true, desc = "Rename file" }) +vim.keymap.set("n", "ms", function() + vim.cmd("new | put=execute('messages') | setlocal buftype=nofile") + local buf = vim.api.nvim_get_current_buf() + local lines = vim.api.nvim_buf_get_lines(buf, 0, -1, false) + local filtered_lines = {} + for _, line in ipairs(lines) do + local trimmed_line = line:match("^%s*(.-)%s*$") -- Remove leading and trailing whitespace + if trimmed_line ~= "" then + table.insert(filtered_lines, trimmed_line) -- Only add non-empty lines + end + end + vim.fn.setreg('"', table.concat(filtered_lines, "\n")) + vim.api.nvim_buf_set_lines(buf, 0, -1, false, filtered_lines) + vim.keymap.set("n", "q", function() + vim.api.nvim_buf_delete(buf, { force = true }) + end, { buffer = buf, desc = "Close message buffer" }) +end, { desc = "Open messages, trim, and copy content" }) + +-- Cd +vim.keymap.set("n", "gcd", ":cd %:p:h:pwd", { desc = "Go to current file path" }) +vim.keymap.set("n", "gcD", function() + local realpath = vim.fn.systemlist("readlink -f " .. vim.fn.shellescape(vim.fn.expand("%:p")))[1] + vim.cmd("cd " .. vim.fn.fnameescape(vim.fn.fnamemodify(realpath, ":h"))) + vim.cmd("pwd") +end, { desc = "Go to real path of current file" }) +vim.keymap.set("n", "gc.", ":cd ..:pwd", { desc = "Go to current file path" }) + +-- Check health +vim.keymap.set("n", "ch", ":checkhealth", { desc = "Check neovim health" }) + +-- Clear search with +vim.keymap.set({ "i", "n" }, "", "noh", { desc = "Clear search highlights" }) + +-- Clear search / diff update / redraw +vim.keymap.set( + "n", + "R", + "nohlsearchdiffupdatenormal! ", + { desc = "Redraw / Clear hlsearch / Diff Update" } +) + +-- Copy +vim.keymap.set("n", "cp", function() + local filepath = vim.fn.expand("%") -- Get the current filepath + local filename = vim.fn.expand("%:t") -- Get the current filename + local file_root = vim.fn.expand("%:r") -- Get the file root (without extension) + local file_ext = vim.fn.expand("%:e") -- Get the file extension + local new_filename = file_root .. "_copied" -- Start with the base for new filename + local num = 1 + while vim.fn.filereadable(new_filename .. "." .. file_ext) == 1 do + new_filename = file_root .. "_copied_" .. num + num = num + 1 + end + new_filename = new_filename .. "." .. file_ext + local cmd = "cp " .. filepath .. " " .. new_filename + + -- Wrap input in pcall to handle Ctrl-c interruptions + local ok, confirm = pcall(vim.fn.input, 'Do you want to copy "' .. filename .. '"? (y/n): ') + + -- If interrupted (Ctrl-c), return silently + if not ok or confirm == nil or confirm == "" then + return + end + + -- Handle positive confirmation + if confirm:lower() == "y" or confirm:lower() == "yes" then + vim.cmd("silent !" .. cmd) + vim.cmd("silent edit " .. new_filename) + end +end, { silent = true, desc = "Copy current file" }) +vim.keymap.set( + "n", + "cP", + ':let @+ = expand("%:p"):lua print("Copied path to: " .. vim.fn.expand("%:p"))', + { desc = "Copy current file name and path" } +) + +-- Cut, Yank & Paste +vim.keymap.set({ "n", "v" }, "y", [["+y]], { desc = "Yank to clipboard" }) +vim.keymap.set("n", "Y", [["+Y]], { desc = "Yank line to clipboard" }) +vim.keymap.set({ "n", "v" }, "", ":%y", { desc = "Yank current file to clipboard" }) +vim.keymap.set({ "n", "v", "x" }, "pp", [["+p]], { desc = "Paste from clipboard after cursor" }) +vim.keymap.set({ "n", "v", "x" }, "PP", [["+P]], { desc = "Paste from clipboard before cursor" }) +vim.keymap.set({ "n", "v", "x" }, "pP", [["_dP]], { desc = "Paste over and preserve clipboard" }) +vim.keymap.set({ "n", "v" }, "dd", [["+d]], { desc = "Delete and yank to clipboard" }) +vim.keymap.set({ "n", "v" }, "DD", [["_d]], { desc = "Delete without storing in clipboard" }) +vim.keymap.set("n", "", ":%d_", { desc = "Delete all lines to black hole register" }) + +-- Diagnostic +local diagnostic_goto = function(next, severity) + local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev + severity = severity and vim.diagnostic.severity[severity] or nil + return function() + go({ severity = severity }) + end +end +-- vim.keymap.set("n", "[d", diagnostic_goto(false), { desc = "Previous diagnostic" }) +-- vim.keymap.set("n", "]d", diagnostic_goto(true), { desc = "Next diagnostic" }) +vim.keymap.set("n", "[e", diagnostic_goto(false, "ERROR"), { desc = "Previous error" }) +vim.keymap.set("n", "]e", diagnostic_goto(true, "ERROR"), { desc = "Next error" }) +vim.keymap.set("n", "[w", diagnostic_goto(false, "WARN"), { desc = "Previous warning" }) +vim.keymap.set("n", "]w", diagnostic_goto(true, "WARN"), { desc = "Next warning" }) +vim.keymap.set("n", "od", vim.diagnostic.open_float, { desc = "Open diagnostic message" }) +vim.keymap.set("n", "la", vim.diagnostic.setloclist, { desc = "Add diagnostics to location list" }) + +-- Disable +vim.keymap.set("n", "Q", "", { desc = "Disable q command" }) + +-- Explore +vim.keymap.set("n", "ex", vim.cmd.Ex, { desc = "Open explorer" }) +vim.keymap.set("n", "es", vim.cmd.Sex, { desc = "Open explorer (horizontal split)" }) +vim.keymap.set("n", "ev", vim.cmd.Vex, { desc = "Open explorer (vertical split)" }) +vim.keymap.set("n", "qe", function() + if vim.bo.filetype == "netrw" then + vim.cmd("bd") + end +end, { desc = "Close explorer (netrw)" }) + +-- Fix List & Trouble +vim.keymap.set("n", "[o", "lprevzz", { desc = "Previous location" }) +vim.keymap.set("n", "]o", "lnextzz", { desc = "Next location" }) +vim.keymap.set("n", "[q", "cprevzz", { desc = "Previous quickfix" }) +vim.keymap.set("n", "]q", "cnextzz", { desc = "Next quickfix" }) +vim.keymap.set( + "n", + "rw", + [[:%s/\<\>//gI]], + { desc = "Search and replace word under cursor" } +) +vim.keymap.set("n", "oo", "lopen", { desc = "Open location list" }) +vim.keymap.set("n", "oq", "copen", { desc = "Open quickfix list" }) + +-- Formats +vim.keymap.set("n", "cF", vim.lsp.buf.format, { desc = "Format buffer by default lsp" }) + +-- Full path +vim.keymap.set("n", "zf", function() + local word = vim.fn.expand("") -- Get full text under the cursor (handles paths with slashes) + if word:match("%$") then + local expanded_path = vim.fn.expand(word) + if expanded_path ~= word then + vim.cmd("normal! ciW" .. expanded_path) -- Replace entire word under cursor + end + end +end, { desc = "Expand and replace path under cursor" }) + +-- Git +-- create repository +vim.keymap.set("n", "gR", function() + -- Check if GitHub CLI is installed + local gh_installed = vim.fn.system("command -v gh") + if gh_installed == "" then + print("GitHub CLI is not installed. Please install it using 'brew install gh'.") + return + end + -- Get the current working directory and extract the repository name + local cwd = vim.fn.getcwd() + local repo_name = vim.fn.fnamemodify(cwd, ":t") + if repo_name == "" then + print("Failed to extract repository name from the current directory.") + return + end + -- Display the message and ask for confirmation + local confirmation = vim.fn.input('The name of the repo will be: "' .. repo_name .. '"\nType "yes" to continue: ') + if confirmation:lower() ~= "yes" then + print("Operation canceled.") + return + end + -- Check if the repository already exists on GitHub + local check_repo_command = + string.format("gh repo view %s/%s", vim.fn.system("gh api user --jq '.login'"):gsub("%s+", ""), repo_name) + local check_repo_result = vim.fn.systemlist(check_repo_command) + if not string.find(table.concat(check_repo_result), "Could not resolve to a Repository") then + print("Repository '" .. repo_name .. "' already exists on GitHub.") + return + end + -- Prompt for repository type + local repo_type = vim.fn.input("Enter the repository type (private/public): "):lower() + if repo_type ~= "private" and repo_type ~= "public" then + print("Invalid repository type. Please enter 'private' or 'public'.") + return + end + -- Set the repository type flag + local repo_type_flag = repo_type == "private" and "--private" or "--public" + -- Initialize the git repository and create the GitHub repository + local init_command = string.format("cd %s && git init", vim.fn.shellescape(cwd)) + vim.fn.system(init_command) + local create_command = + string.format("cd %s && gh repo create %s %s --source=.", vim.fn.shellescape(cwd), repo_name, repo_type_flag) + local create_result = vim.fn.system(create_command) + -- Print the result of the repository creation command + if string.find(create_result, "https://github.com") then + print("Repository '" .. repo_name .. "' created successfully.") + else + print("Failed to create the repository: " .. create_result) + end +end, { desc = "Create GitHub repository" }) +-- open repository +local function open_github_link(use_root) + -- Get the full path of the current file + local file_path = vim.fn.expand("%:p") + if file_path == "" then + print("No file is currently open") + return + end + + -- Get the Git repository root + local git_root = vim.fn.systemlist("git rev-parse --show-toplevel")[1] + if not git_root or git_root == "" then + print("Could not determine the root directory for the GitHub repository") + return + end + + -- Get the origin URL of the repository + local origin_url = vim.fn.systemlist("git config --get remote.origin.url")[1] + if not origin_url or origin_url == "" then + print("Could not determine the origin URL for the GitHub repository") + return + end + + -- Get the current branch name + local branch_name = vim.fn.systemlist("git rev-parse --abbrev-ref HEAD")[1] + if not branch_name or branch_name == "" then + print("Could not determine the current branch name") + return + end + + -- Convert the origin URL to a GitHub HTTPS URL + local repo_url = origin_url:gsub("git@github.com:", "https://github.com/"):gsub("%.git$", "") + + local github_url + if use_root then + -- Use the root repository URL + github_url = repo_url + else + -- Generate the link for the current file + local relative_path = file_path:sub(#git_root + 2) -- Extract the relative path + github_url = repo_url .. "/blob/" .. branch_name .. "/" .. relative_path + end + + -- Open the URL in the default browser + local command = "xdg-open " .. vim.fn.shellescape(github_url) + vim.fn.system(command) + + -- Print the opened URL + print("Opened GitHub link: " .. github_url) +end + +-- Keybinding for opening the current file link +vim.keymap.set("n", "go", function() + open_github_link(false) -- Use the current file link +end, { desc = "Open GitHub link for the current file" }) + +-- Keybinding for opening the repository root link +vim.keymap.set("n", "gO", function() + open_github_link(true) -- Use the root repository URL +end, { desc = "Open GitHub repository root" }) + +-- paste a github link and add it in this format +vim.keymap.set({ "n", "v", "i" }, "", function() + -- Insert the text in the desired format + vim.cmd('normal! a[](){:target="_blank"} ') + vim.cmd("normal! F(pv2F/lyF[p") + -- Leave me in normal mode or command mode + vim.cmd("stopinsert") +end, { desc = "Paste github link" }) + +-- Health +vim.keymap.set("n", "ch", ":checkhealth", { desc = "Check neovim health" }) + +-- Highlights under cursor +vim.keymap.set("n", "ip", vim.show_pos, { desc = "Inspect position" }) + +-- Keywordprg +vim.keymap.set("n", "K", "norm! K", { desc = "Look up keyword" }) + +-- Lines +-- vim.keymap.set("n", "", "m .-2==", { desc = "Move line up" }) +-- vim.keymap.set("n", "", "m .+1==", { desc = "Move line down" }) +vim.keymap.set( + "i", + "", + "m .-2==gi", + { noremap = true, silent = true, desc = "Move line up in insert mode" } +) +vim.keymap.set( + "i", + "", + "m .+1==gi", + { noremap = true, silent = true, desc = "Move line down in insert mode" } +) +vim.keymap.set("v", "", ":m '<-2gv=gv", { desc = "Move selected lines up" }) +vim.keymap.set("v", "", ":m '>+1gv=gv", { desc = "Move selected lines down" }) + +-- Markdown +vim.keymap.set({ "n", "v" }, "gk", function() + -- `?` - Start a search backwards from the current cursor position. + -- `^` - Match the beginning of a line. + -- `##` - Match 2 ## symbols + -- `\\+` - Match one or more occurrences of prev element (#) + -- `\\s` - Match exactly one whitespace character following the hashes + -- `.*` - Match any characters (except newline) following the space + -- `$` - Match extends to end of line + vim.cmd("silent! ?^##\\+\\s.*$") + -- Clear the search highlight + vim.cmd("nohlsearch") +end, { desc = "Go to previous markdown header" }) +vim.keymap.set({ "n", "v" }, "gj", function() + -- `/` - Start a search forwards from the current cursor position. + -- `^` - Match the beginning of a line. + -- `##` - Match 2 ## symbols + -- `\\+` - Match one or more occurrences of prev element (#) + -- `\\s` - Match exactly one whitespace character following the hashes + -- `.*` - Match any characters (except newline) following the space + -- `$` - Match extends to end of line + vim.cmd("silent! /^##\\+\\s.*$") + -- Clear the search highlight + vim.cmd("nohlsearch") +end, { desc = "Go to next markdown header" }) + +-- Marks +vim.keymap.set("n", "mD", function() + -- Delete all marks in the current buffer + vim.cmd("delmarks!") + print("All marks deleted.") +end, { desc = "Delete all marks" }) + +-- Ownerships +vim.keymap.set("n", "cx", "!chmod +x %", { silent = true, desc = "Make file executable" }) + +-- Remap Default +vim.keymap.set("i", "jk", "", { noremap = true, silent = true, desc = "Escape to normal mode" }) +vim.keymap.set("n", "", ":", { noremap = true, desc = "Enter command mode" }) +vim.keymap.set("n", "J", "mzJ`z", { noremap = true, desc = "Join lines and keep cursor position" }) +vim.keymap.set("n", "n", "'Nn'[v:searchforward].'zv'", { expr = true, desc = "Next search result and center" }) +vim.keymap.set("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result in visual mode" }) +vim.keymap.set("o", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result in operator-pending mode" }) +vim.keymap.set("n", "N", "'nN'[v:searchforward].'zv'", { expr = true, desc = "Previous search result and center" }) +vim.keymap.set("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Previous search result in visual mode" }) +vim.keymap.set( + "o", + "N", + "'nN'[v:searchforward]", + { expr = true, desc = "Previous search result in operator-pending mode" } +) +vim.keymap.set("n", "x", '"_x', { desc = "Delete character without yanking" }) +local scroll_percentage = 0.50 +vim.keymap.set("n", "", function() + local lines = math.floor(vim.api.nvim_win_get_height(0) * scroll_percentage) + vim.cmd("normal! " .. lines .. "jzz") +end, { noremap = true, silent = true, desc = "Scroll down and center" }) +vim.keymap.set("n", "", function() + local lines = math.floor(vim.api.nvim_win_get_height(0) * scroll_percentage) + vim.cmd("normal! " .. lines .. "kzz") +end, { noremap = true, silent = true, desc = "Scroll up and center" }) +-- vim.keymap.set("n", "", "zz", { noremap = true, silent = true, desc = "Scroll down and center" }) +-- vim.keymap.set("n", "", "zz", { noremap = true, silent = true, desc = "Scroll up and center" }) +-- vim.keymap.set("n", "", "zz", { noremap = true, silent = true, desc = "Page up and center" }) +-- vim.keymap.set("n", "", "zz", { noremap = true, silent = true, desc = "Page down and center" }) +vim.keymap.set("n", "{", "{zz", { noremap = true, silent = true, desc = "Move to previous paragraph and center" }) +vim.keymap.set("n", "}", "}zz", { noremap = true, silent = true, desc = "Move to next paragraph and center" }) +vim.keymap.set("n", "G", "Gzz", { noremap = true, silent = true, desc = "Go to bottom of file and center" }) +vim.keymap.set("n", "gg", "ggzz", { noremap = true, silent = true, desc = "Go to top of file and center" }) +vim.keymap.set("n", "gd", "gdzz", { noremap = true, silent = true, desc = "Go to definition and center" }) +vim.keymap.set("n", "", "zz", { noremap = true, silent = true, desc = "Jump forward in jumplist and center" }) +vim.keymap.set( + "n", + "", + "zz", + { noremap = true, silent = true, desc = "Jump backward in jumplist and center" } +) +vim.keymap.set( + "n", + "%", + "%zz", + { noremap = true, silent = true, desc = "Jump to matching pair (e.g. brackets) and center" } +) +vim.keymap.set( + "n", + "*", + "*zz", + { noremap = true, silent = true, desc = "Search for next occurrence of word under cursor and center" } +) +vim.keymap.set( + "n", + "#", + "#zz", + { noremap = true, silent = true, desc = "Search for previous occurrence of word under cursor and center" } +) + +vim.keymap.set( + { "n", "x" }, + "j", + "v:count == 0 ? 'gj' : 'j'", + { expr = true, silent = true, desc = "Move down (visual line)" } +) +vim.keymap.set( + { "n", "x" }, + "", + "v:count == 0 ? 'gj' : 'j'", + { expr = true, silent = true, desc = "Move down (visual line)" } +) +vim.keymap.set( + { "n", "x" }, + "k", + "v:count == 0 ? 'gk' : 'k'", + { expr = true, silent = true, desc = "Move up (visual line)" } +) +vim.keymap.set( + { "n", "x" }, + "", + "v:count == 0 ? 'gk' : 'k'", + { expr = true, silent = true, desc = "Move up (visual line)" } +) +vim.keymap.set("v", "<", "", ">gv", { desc = "Indent right and stay in visual mode" }) +vim.keymap.set("v", "J", ":m '>+1gv=gv", { desc = "Move line down in visual mode" }) +vim.keymap.set("v", "K", ":m '<-2gv=gv", { desc = "Move line up in visual mode" }) +vim.keymap.set("n", "sl", "vg_", { desc = "Select to end of line" }) +vim.keymap.set("n", "sp", "ggVGp", { desc = "Select all and paste" }) +vim.keymap.set("n", "sv", "ggVG", { desc = "Select all" }) +vim.keymap.set("n", "gp", "`[v`]", { desc = "Select pasted text" }) +vim.keymap.set("n", "ss", ":s/\\v", { desc = "Search and replace on line" }) +vim.keymap.set("n", "SS", ":%s/\\v", { desc = "Search and replace in file" }) +vim.keymap.set("v", "", ":s/\\%V", { desc = "Search only in visual selection using %V atom" }) +vim.keymap.set("v", "", '"hy:%s/\\vh//g', { desc = "Change selection" }) + +-- Remove +local function delete_current_file() + local filepath = vim.fn.expand("%:p") + local filename = vim.fn.expand("%:t") -- Get the current filename + if filepath and filepath ~= "" then + -- Check if trash utility is installed + if vim.fn.executable("trash") == 0 then + vim.api.nvim_echo({ + { "- Trash utility not installed. Make sure to install it first\n", "ErrorMsg" }, + { "- Install `trash-cli`\n", nil }, + }, false, {}) + return + end + -- Prompt for confirmation before deleting the file + vim.ui.input({ + prompt = 'Do you want to delete "' .. filename .. '"? (y/n): ', + }, function(input) + if input == nil then + return + end + + if input:lower() == "y" or input:lower() == "yes" then + -- Delete the file using trash app + local success, _ = pcall(function() + vim.fn.system({ "trash", vim.fn.fnameescape(filepath) }) + end) + if success then + vim.api.nvim_echo({ + { "File deleted from disk:\n", "Normal" }, + { filepath, "Normal" }, + }, false, {}) + -- Close the buffer after deleting the file + vim.cmd("bd!") + else + vim.api.nvim_echo({ + { "Failed to delete file:\n", "ErrorMsg" }, + { filepath, "ErrorMsg" }, + }, false, {}) + end + else + vim.api.nvim_echo({ + { "File deletion canceled.", "Normal" }, + }, false, {}) + end + end) + else + vim.api.nvim_echo({ + { "No file to delete", "WarningMsg" }, + }, false, {}) + end +end + +vim.keymap.set("n", "rm", function() + delete_current_file() +end, { desc = "Remove current file" }) + +-- Scripts +vim.keymap.set("n", "rr", function() + vim.cmd("w") + local file = vim.fn.shellescape(vim.fn.expand("%:p")) + vim.cmd("split | resize 10 | terminal compiler " .. file) +end, { noremap = true, silent = true, desc = "Run compiler interactively" }) +vim.api.nvim_set_keymap( + "n", + "RR", + ":!opout %", + { noremap = true, silent = true, desc = "Docs viewer" } +) + +-- Source +-- source nvim config +vim.keymap.set("n", "SO", function() + vim.cmd("so") +end, { desc = "Source current file" }) +-- reload zsh configuration by sourcing ~/.config/zsh/.zshrc in a separate shell +vim.keymap.set("n", "SZ", function() + -- Define the command to source zshrc + local command = "source ~/.config/zsh/.zshrc" + -- Execute the command in a new Zsh shell + local full_command = "zsh -c '" .. command .. "'" + -- Run the command and capture the output + local output = vim.fn.system(full_command) + -- Check the exit status of the command + local exit_code = vim.v.shell_error + if exit_code == 0 then + vim.api.nvim_echo({ { "Successfully sourced ~/.config/zsh/.zshrc", "NormalMsg" } }, false, {}) + else + vim.api.nvim_echo({ + { "Failed to source ~/.config/zsh/.zshrc:", "ErrorMsg" }, + { output, "ErrorMsg" }, + }, false, {}) + end +end, { desc = "Source zshrc" }) +-- source shortcuts from bm-files and bm-folders +local shortcuts_file = vim.fn.expand("~/.config/nvim/shortcuts.lua") +local file = io.open(shortcuts_file, "r") +if file then + file:close() + vim.cmd("silent! source " .. shortcuts_file) +end + +-- Spell +vim.keymap.set("n", "zp", function() + vim.opt.spelllang = { "en", "ko", "cjk" } + vim.cmd("echo 'Spell language set to English, Korean, and CJK'") +end, { desc = "Spelling language English, Korean, and CJK" }) +-- repeat the replacement done by |z=| for all matches with the replaced word in the current window. +vim.keymap.set("n", "z.", function() + vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(":spellr\n", true, false, true), "m", true) +end, { desc = "Spelling repeat" }) + +-- Sudo +vim.keymap.set("n", "SW", "SudoWrite", { silent = true, desc = "Save file with sudo" }) +vim.keymap.set("n", "SWQ", "SudoWritequit", { silent = true, desc = "Save and quit with sudo" }) + +-- Surround +vim.keymap.set("n", "sau", function() + local line = vim.api.nvim_get_current_line() + local col = vim.api.nvim_win_get_cursor(0)[2] + 1 -- Adjust for 0-index in Lua + -- This makes the `s` optional so it matches both http and https + local pattern = "https?://[^ ,;'\"<>%s)]*" + -- Find the starting and ending positions of the URL + local s, e = string.find(line, pattern) + while s and e do + if s <= col and e >= col then + -- When the cursor is within the URL + local url = string.sub(line, s, e) + -- Update the line with backticks around the URL + local new_line = string.sub(line, 1, s - 1) .. "`" .. url .. "`" .. string.sub(line, e + 1) + vim.api.nvim_set_current_line(new_line) + vim.cmd("silent write") + return + end + -- Find the next URL in the line + s, e = string.find(line, pattern, e + 1) + -- Save the file to update trouble list + end + print("No URL found under cursor") +end, { desc = "Add surrounding to URL" }) +vim.keymap.set("v", "bl", function() + -- Get the selected text range + local start_row, start_col = unpack(vim.fn.getpos("'<"), 2, 3) + local end_row, end_col = unpack(vim.fn.getpos("'>"), 2, 3) + -- Get the selected lines + local lines = vim.api.nvim_buf_get_lines(0, start_row - 1, end_row, false) + local selected_text = table.concat(lines, "\n"):sub(start_col, #lines == 1 and end_col or -1) + if selected_text:match("^%*%*.*%*%*$") then + vim.notify("Text already bold", vim.log.levels.INFO) + else + vim.cmd("normal 2gsa*") + end +end, { desc = "Bold current selection" }) +vim.keymap.set("n", "gbd", function() + local cursor_pos = vim.api.nvim_win_get_cursor(0) + local current_buffer = vim.api.nvim_get_current_buf() + local start_row = cursor_pos[1] - 1 + local col = cursor_pos[2] + -- Get the current line + local line = vim.api.nvim_buf_get_lines(current_buffer, start_row, start_row + 1, false)[1] + -- Check if the cursor is on an asterisk + if line:sub(col + 1, col + 1):match("%*") then + vim.notify("Cursor is on an asterisk, run inside the bold text", vim.log.levels.WARN) + return + end + -- Search for '**' to the left of the cursor position + local left_text = line:sub(1, col) + local bold_start = left_text:reverse():find("%*%*") + if bold_start then + bold_start = col - bold_start + end + -- Search for '**' to the right of the cursor position and in following lines + local right_text = line:sub(col + 1) + local bold_end = right_text:find("%*%*") + local end_row = start_row + while not bold_end and end_row < vim.api.nvim_buf_line_count(current_buffer) - 1 do + end_row = end_row + 1 + local next_line = vim.api.nvim_buf_get_lines(current_buffer, end_row, end_row + 1, false)[1] + if next_line == "" then + break + end + right_text = right_text .. "\n" .. next_line + bold_end = right_text:find("%*%*") + end + if bold_end then + bold_end = col + bold_end + end + -- Remove '**' markers if found, otherwise bold the word + if bold_start and bold_end then + -- Extract lines + local text_lines = vim.api.nvim_buf_get_lines(current_buffer, start_row, end_row + 1, false) + local text = table.concat(text_lines, "\n") + -- Calculate positions to correctly remove '**' + -- vim.notify("bold_start: " .. bold_start .. ", bold_end: " .. bold_end) + local new_text = text:sub(1, bold_start - 1) .. text:sub(bold_start + 2, bold_end - 1) .. text:sub(bold_end + 2) + local new_lines = vim.split(new_text, "\n") + -- Set new lines in buffer + vim.api.nvim_buf_set_lines(current_buffer, start_row, end_row + 1, false, new_lines) + -- vim.notify("Unbolded text", vim.log.levels.INFO) + else + -- Bold the word at the cursor position if no bold markers are found + local before = line:sub(1, col) + local after = line:sub(col + 1) + local inside_surround = before:match("%*%*[^%*]*$") and after:match("^[^%*]*%*%*") + if inside_surround then + vim.cmd("normal gsd*.") + else + vim.cmd("normal viw") + vim.cmd("normal 2gsa*") + end + vim.notify("Bolded current word", vim.log.levels.INFO) + end +end, { desc = "Toggle bold" }) + +-- Tab +vim.keymap.set("n", "l", "tablast", { desc = "Last Tab" }) +vim.keymap.set("n", "]]", "tablast", { desc = "Last Tab" }) +vim.keymap.set("n", "o", "tabonly", { desc = "Close Other Tabs" }) +vim.keymap.set("n", "f", "tabfirst", { desc = "First Tab" }) +vim.keymap.set("n", "[[", "tabfirst", { desc = "First Tab" }) +vim.keymap.set("n", "", "tabnew", { desc = "New Tab" }) +vim.keymap.set("n", "n", "tabnext", { desc = "Next Tab" }) +vim.keymap.set("n", "]", "tabnext", { desc = "Next Tab" }) +vim.keymap.set("n", "d", "tabclose", { desc = "Close Tab" }) +vim.keymap.set("n", "p", "tabprevious", { desc = "Previous Tab" }) +vim.keymap.set("n", "[", "tabprevious", { desc = "Previous Tab" }) + +-- Terminal +vim.keymap.set("n", "te", "term", { desc = "Open terminal" }) +vim.keymap.set("n", "t-", "sp term://zsh | startinsert", { desc = "Split terminal (horizontal)" }) +vim.keymap.set("n", "t|", "vsp term://zsh | startinsert", { desc = "Split terminal (vertical)" }) +vim.keymap.set("t", "", "", { desc = "Escape terminal mode" }) +vim.keymap.set("t", "", "wincmd h", { desc = "Move to left window" }) +vim.keymap.set("t", "", "wincmd j", { desc = "Move to window below" }) +vim.keymap.set("t", "", "wincmd k", { desc = "Move to window above" }) +vim.keymap.set("t", "", "wincmd l", { desc = "Move to right window" }) +vim.keymap.set("t", "l", "clear", { silent = true, desc = "Clear terminal" }) +vim.keymap.set("t", "", "iexit", { desc = "Close terminal" }) +vim.keymap.set("t", "", "close", { desc = "Close terminal" }) +vim.keymap.set("t", "", "close", { desc = "Close terminal" }) + +-- Tmux +if vim.env.TMUX then + vim.keymap.set( + "n", + "tm", + "silent !~/.config/tmux/plugins/tmux-fzf/scripts/session.sh", + { desc = "Find tmux session" } + ) + vim.keymap.set("n", "RS", function() + vim.fn.system("restartnvim") + end, { noremap = true, silent = true, desc = "Restart nvim (tmux)" }) +end + +-- Todo +-- detect todos and toggle between ":" and ";", or show a message if not found +-- this is to "mark them as done" +vim.keymap.set("n", "td", function() + -- Get the current line + local current_line = vim.fn.getline(".") + -- Get the current line number + local line_number = vim.fn.line(".") + if string.find(current_line, "TODO:") then + -- Replace the first occurrence of ":" with ";" + local new_line = current_line:gsub("TODO:", "TODO;") + -- Set the modified line + vim.fn.setline(line_number, new_line) + elseif string.find(current_line, "TODO;") then + -- Replace the first occurrence of ";" with ":" + local new_line = current_line:gsub("TODO;", "TODO:") + -- Set the modified line + vim.fn.setline(line_number, new_line) + else + vim.cmd("echo 'todo item not detected'") + end +end, { desc = "Toggle TODO item done or not" }) + +-- Windows +vim.keymap.set("n", "", "", { desc = "Move to left window" }) +vim.keymap.set("n", "", "", { desc = "Move to window below" }) +vim.keymap.set("n", "", "", { desc = "Move to window above" }) +vim.keymap.set("n", "", "", { desc = "Move to right window" }) +-- vim.keymap.set("n", "", "resize +2", { desc = "Increase window height" }) +-- vim.keymap.set("n", "", "resize -2", { desc = "Decrease window height" }) +-- vim.keymap.set("n", "", "vertical resize -2", { desc = "Decrease window width" }) +-- vim.keymap.set("n", "", "vertical resize +2", { desc = "Increase window width" }) + +function WordDefinition(input) + -- Function to run the dict command and return its output + local function get_output(word) + local escaped_word = vim.fn.shellescape(word) + return vim.fn.system("dict " .. escaped_word) + end + + -- Function to process the word for singular/plural handling + local function get_definition(word) + -- Attempt to derive the singular form + local singular = word + if word:sub(-2) == "es" then + singular = word:sub(1, -3) -- Remove 'es' + elseif word:sub(-1) == "s" then + singular = word:sub(1, -2) -- Remove 's' + end + + -- Fetch output for both singular and original word + local singular_output = get_output(singular) + local original_output = get_output(word) + + -- Determine which output to prioritize + if singular ~= word and not vim.startswith(singular_output, "No definitions found") then + return singular_output -- Use singular if valid and different + else + return original_output -- Otherwise, use the original word + end + end + + -- Get the definition and output for the word + local output = get_definition(input) + + -- Create a new buffer and display the result + local bufnr = vim.api.nvim_create_buf(false, true) + vim.api.nvim_set_current_buf(bufnr) + vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, vim.split(output, "\n")) +end +vim.api.nvim_set_keymap( + "n", + "k", + ":lua WordDefinition(vim.fn.expand(''))", + { noremap = true, silent = true, desc = "Word definition" } +) + +-- Lazy +vim.keymap.set("n", "L", "Lazy", { desc = "Open lazy plugin manager" }) + +-- Mason +vim.keymap.set("n", "M", "Mason", { desc = "Open mason" }) diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/lazy.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/lazy.lua new file mode 100644 index 0000000..52eff22 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/lazy.lua @@ -0,0 +1,39 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +-- vim.g.mapleader = " " +-- vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + -- highlight-start + spec = { + -- import your plugins + { import = "TheSiahxyz.plugins" }, + }, + -- highlight-end + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "catppuccin" } }, + -- automatically check for plugin updates + checker = { enabled = false }, + -- automatically check for config file changes and reload the ui + change_detection = { enabled = false }, +}) diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/options.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/options.lua new file mode 100644 index 0000000..a4b373f --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/core/options.lua @@ -0,0 +1,48 @@ +vim.g.have_nerd_font = true +-- vim.g.netrw_browse_split = 0 +-- vim.g.netrw_banner = 1 +-- vim.g.netrw_browsex_viewer = "xdg-open" +-- vim.g.netrw_liststyle = 0 +-- vim.g.netrw_list_hide = "^.git" +-- vim.g.netrw_winsize = 25 +-- vim.g.loaded_netrw = 1 +-- vim.g.loaded_netrwPlugin = 1 +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" +vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions" +vim.opt.backup = false +vim.opt.breakindent = true +vim.opt.conceallevel = 1 +vim.opt.cursorline = true +vim.opt.encoding = "utf-8" +vim.opt.expandtab = true +vim.opt.fileencoding = "utf-8" +vim.opt.hlsearch = true +vim.opt.ignorecase = true +vim.opt.inccommand = "split" +vim.opt.incsearch = true +vim.opt.isfname:append("@-@") +vim.opt.list = true +vim.opt.listchars = { tab = " ", trail = " ", nbsp = " " } +vim.opt.mouse = "a" +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.scrolloff = 8 +vim.opt.shiftwidth = 2 +vim.opt.showmode = false +vim.opt.signcolumn = "yes" +vim.opt.smartcase = true +vim.opt.smartindent = true +vim.opt.softtabstop = 2 +vim.opt.spell = false +vim.opt.spellfile = vim.fn.stdpath("config") .. "/spell/en.utf-8.add" +vim.opt.splitbelow = true +vim.opt.splitright = true +vim.opt.swapfile = false +vim.opt.tabstop = 2 +vim.opt.termguicolors = true +vim.opt.timeoutlen = 300 +vim.opt.updatetime = 300 +vim.opt.undofile = true +vim.opt.undodir = os.getenv("HOME") .. "/.local/share/history/vim_history" +vim.opt.wrap = false diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/health.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/health.lua new file mode 100644 index 0000000..b2cbba2 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/health.lua @@ -0,0 +1,60 @@ +local start = vim.health.start or vim.health.report_start +local ok = vim.health.ok or vim.health.report_ok +local warn = vim.health.warn or vim.health.report_warn +local error = vim.health.error or vim.health.report_error + +local check_version = function() + local version = vim.version() + local verstr = ("%d.%d.%d"):format(version.major, version.minor, version.patch) + + if not vim.version.cmp then + error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) + return + end + + if vim.version.cmp(vim.version(), { 0, 10, 0 }) >= 0 then + ok(string.format("Neovim version is: '%s'", verstr)) + else + error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) + end +end + +local check_external_reqs = function() + for _, cmd in ipairs({ "git", "make", "unzip", "rg", { "fd", "fdfind" }, "lazygit", "fzf", "curl" }) do + local name = type(cmd) == "string" and cmd or vim.inspect(cmd) + local commands = type(cmd) == "string" and { cmd } or cmd + ---@cast commands string[] + local found = false + + for _, c in ipairs(commands) do + if vim.fn.executable(c) == 1 then + name = c + found = true + end + end + + if found then + ok(("`%s` is installed"):format(name)) + else + warn(("`%s` is not installed"):format(name)) + end + end +end + +return { + check = function() + start("TheSiahxyz") + + vim.health.info([[NOTE: Not every warning is a 'must-fix' in `:checkhealth` + + Fix only warnings for plugins and languages you intend to use. + Mason will give warnings for languages that are not installed. + You do not need to install, unless you want to use those languages!]]) + + local uv = vim.uv or vim.loop + vim.health.info("System Information: " .. vim.inspect(uv.os_uname())) + + check_version() + check_external_reqs() + end, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/init.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/init.lua new file mode 100644 index 0000000..58a3470 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/init.lua @@ -0,0 +1,15 @@ +-- Core +require("TheSiahxyz.core.options") +require("TheSiahxyz.core.keymaps") +require("TheSiahxyz.core.autocmds") +require("TheSiahxyz.core.lazy") + +-- Custom +for _, file in ipairs(vim.fn.readdir(vim.fn.stdpath("config") .. "/lua/TheSiahxyz/utils", [[v:val =~ '\.lua$']])) do + require("TheSiahxyz.utils." .. file:gsub("%.lua$", "")) +end + +-- Plenary +function R(name) + require("plenary.reload").reload_module(name) +end diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ai.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ai.lua new file mode 100644 index 0000000..baab1f0 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/ai.lua @@ -0,0 +1,286 @@ +return { + { + "robitx/gp.nvim", + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v", "x" }, + { "G", group = "GPT" }, + { "Gg", group = "Gp" }, + { "GW", group = "Whisper" }, + }) + end, + config = function() + local function keymapOptions(desc) + return { + noremap = true, + silent = true, + nowait = true, + desc = desc, + } + end + + local conf = { + -- For customization, refer to Install > Configuration in the Documentation/Readme + -- openai_api_key = { "pass", "show", "api/chatGPT/nvim" }, + openai_api_key = { "pass", "show", "api/chatGPT/nvim" }, + providers = { + openai = { + disable = false, + endpoint = "https://api.openai.com/v1/chat/completions", + -- secret = { "pass", "show", "api/chatGPT/nvim" }, + }, + }, + hooks = { + -- GpInspectPlugin provides a detailed inspection of the plugin state + InspectPlugin = function(plugin, params) + local bufnr = vim.api.nvim_create_buf(false, true) + local copy = vim.deepcopy(plugin) + local key = copy.config.openai_api_key or "" + copy.config.openai_api_key = key:sub(1, 3) .. string.rep("*", #key - 6) .. key:sub(-3) + local plugin_info = string.format("Plugin structure:\n%s", vim.inspect(copy)) + local params_info = string.format("Command params:\n%s", vim.inspect(params)) + local lines = vim.split(plugin_info .. "\n" .. params_info, "\n") + vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines) + vim.api.nvim_win_set_buf(0, bufnr) + end, + + -- GpInspectLog for checking the log file + InspectLog = function(plugin, params) + local log_file = plugin.config.log_file + local buffer = plugin.helpers.get_buffer(log_file) + if not buffer then + vim.cmd("e " .. log_file) + else + vim.cmd("buffer " .. buffer) + end + end, + + -- GpImplement rewrites the provided selection/range based on comments in it + Implement = function(gp, params) + local template = "Having following from {{filename}}:\n\n" + .. "```{{filetype}}\n{{selection}}\n```\n\n" + .. "Please rewrite this according to the contained instructions." + .. "\n\nRespond exclusively with the snippet that should replace the selection above." + + local agent = gp.get_command_agent() + gp.logger.info("Implementing selection with agent: " .. agent.name) + + gp.Prompt( + params, + gp.Target.rewrite, + agent, + template, + nil, -- command will run directly without any prompting for user input + nil -- no predefined instructions (e.g. speech-to-text from Whisper) + ) + end, + + -- your own functions can go here, see README for more examples like + -- :GpExplain, :GpUnitTests.., :GpTranslator etc. + + -- example of making :%GpChatNew a dedicated command which + -- opens new chat with the entire current buffer as a context + BufferChatNew = function(gp, _) + -- call GpChatNew command in range mode on whole buffer + vim.api.nvim_command("%" .. gp.config.cmd_prefix .. "ChatNew") + end, + + -- example of adding command which opens new chat dedicated for translation + Translator = function(gp, params) + local chat_system_prompt = "You are a Translator, please translate between English and Korean." + gp.cmd.ChatNew(params, chat_system_prompt) + + -- -- you can also create a chat with a specific fixed agent like this: + -- local agent = gp.get_chat_agent("ChatGPT4o") + -- gp.cmd.ChatNew(params, chat_system_prompt, agent) + end, + + -- example of adding command which writes unit tests for the selected code + UnitTests = function(gp, params) + local template = "I have the following code from {{filename}}:\n\n" + .. "```{{filetype}}\n{{selection}}\n```\n\n" + .. "Please respond by writing table driven unit tests for the code above." + local agent = gp.get_command_agent() + gp.Prompt(params, gp.Target.enew, agent, template) + end, + + -- example of adding command which explains the selected code + Explain = function(gp, params) + local template = "I have the following code from {{filename}}:\n\n" + .. "```{{filetype}}\n{{selection}}\n```\n\n" + .. "Please respond by explaining the code above." + local agent = gp.get_chat_agent() + gp.Prompt(params, gp.Target.popup, agent, template) + end, + + -- example of usig enew as a function specifying type for the new buffer + CodeReview = function(gp, params) + local template = "I have the following code from {{filename}}:\n\n" + .. "```{{filetype}}\n{{selection}}\n```\n\n" + .. "Please analyze for code smells and suggest improvements." + local agent = gp.get_chat_agent() + gp.Prompt(params, gp.Target.enew("markdown"), agent, template) + end, + }, + } + require("gp").setup(conf) + + -- Setup shortcuts here (see Usage > Shortcuts in the Documentation/Readme) + vim.keymap.set("n", "Gc", "GpChatNew", keymapOptions("New chat")) + vim.keymap.set("n", "Gb", "GpBufferChatNew", keymapOptions("New buffer chat")) + vim.keymap.set("n", "Gt", "GpChatToggle", keymapOptions("Toggle chat")) + vim.keymap.set("n", "Gf", "GpChatFinder", keymapOptions("Chat finder")) + + vim.keymap.set("v", "Gc", ":'<,'>GpChatNew", keymapOptions("Chat new")) + vim.keymap.set("v", "Gb", ":'<,'>GpBufferChatNew", keymapOptions("Buffer chat new")) + vim.keymap.set("v", "Gp", ":'<,'>GpChatPaste", keymapOptions("Chat paste")) + vim.keymap.set("v", "Gt", ":'<,'>GpChatToggle", keymapOptions("Toggle chat")) + + vim.keymap.set("n", "Gh", "gpchatnew split", keymapOptions("New chat split")) + vim.keymap.set("n", "Gv", "gpchatnew vsplit", keymapOptions("New chat vsplit")) + vim.keymap.set("n", "Gn", "gpchatnew tabnew", keymapOptions("New chat tabnew")) + + vim.keymap.set("v", "Gh", ":'<,'>GpChatNew split", keymapOptions("Chat new split")) + vim.keymap.set("v", "Gv", ":'<,'>GpChatNew vsplit", keymapOptions("Chat new vsplit")) + vim.keymap.set("v", "Gn", ":'<,'>GpChatNew tabnew", keymapOptions("Chat new tabnew")) + + -- Prompt commands + vim.keymap.set("n", "Gw", "GpRewrite", keymapOptions("Inline rewrite")) + vim.keymap.set("n", "Gr", "GpCodeReview", keymapOptions("Code review")) + vim.keymap.set("n", "G]", "GpAppend", keymapOptions("Append (after)")) + vim.keymap.set("n", "G[", "GpPrepend", keymapOptions("Prepend (before)")) + + vim.keymap.set("v", "Gw", ":'<,'>GpRewrite", keymapOptions("Rewrite")) + vim.keymap.set("v", "Gr", ":'<,'>GpCodeReview", keymapOptions("Code review")) + vim.keymap.set("v", "G]", ":'<,'>GpAppend", keymapOptions("Append (after)")) + vim.keymap.set("v", "G[", ":'<,'>GpPrepend", keymapOptions("Prepend (before)")) + vim.keymap.set("v", "Gi", ":'<,'>GpImplement", keymapOptions("Implement selection")) + + vim.keymap.set("n", "Ggp", "GpPopup", keymapOptions("Popup")) + vim.keymap.set("n", "Gge", "GpEnew", keymapOptions("GpEnew")) + vim.keymap.set("n", "Ggc", "GpNew", keymapOptions("GpNew")) + vim.keymap.set("n", "Ggv", "GpVnew", keymapOptions("GpVnew")) + vim.keymap.set("n", "Ggn", "GpTabnew", keymapOptions("GpTabnew")) + + vim.keymap.set("v", "Ggp", ":'<,'>GpPopup", keymapOptions("Popup")) + vim.keymap.set("v", "Gge", ":'<,'>GpEnew", keymapOptions("GpEnew")) + vim.keymap.set("v", "Ggc", ":'<,'>GpNew", keymapOptions("GpNew")) + vim.keymap.set("v", "Ggv", ":'<,'>GpVnew", keymapOptions("GpVnew")) + vim.keymap.set("v", "Ggn", ":'<,'>GpTabnew", keymapOptions("GpTabnew")) + + vim.keymap.set("n", "Gx", "GpContext", keymapOptions("Toggle context")) + vim.keymap.set("v", "Gx", ":'<,'>GpContext", keymapOptions("Toggle context")) + + vim.keymap.set({ "n", "v", "x" }, "Ggs", "GpStop", keymapOptions("Stop")) + vim.keymap.set({ "n", "v", "x" }, "Gg]", "GpNextAgent", keymapOptions("Next agent")) + + -- optional Whisper commands with prefix w + vim.keymap.set("n", "GWw", "GpWhisper", keymapOptions("Whisper")) + vim.keymap.set("v", "GWw", ":'<,'>GpWhisper", keymapOptions("Whisper")) + + vim.keymap.set("n", "GWr", "GpWhisperRewrite", keymapOptions("Inline rewrite")) + vim.keymap.set("n", "GW]", "GpWhisperAppend", keymapOptions("Append (after)")) + vim.keymap.set("n", "GW[", "GpWhisperPrepend", keymapOptions("Prepend (before) ")) + + vim.keymap.set("v", "GWr", ":'<,'>GpWhisperRewrite", keymapOptions("Rewrite")) + vim.keymap.set("v", "GW]", ":'<,'>GpWhisperAppend", keymapOptions("Append (after)")) + vim.keymap.set("v", "GW[", ":'<,'>GpWhisperPrepend", keymapOptions("Prepend (before)")) + + vim.keymap.set("n", "GWp", "GpWhisperPopup", keymapOptions("Popup")) + vim.keymap.set("n", "GWe", "GpWhisperEnew", keymapOptions("Enew")) + vim.keymap.set("n", "GWc", "GpWhisperNew", keymapOptions("New")) + vim.keymap.set("n", "GWv", "GpWhisperVnew", keymapOptions("Vnew")) + vim.keymap.set("n", "GWn", "GpWhisperTabnew", keymapOptions("Tabnew")) + + vim.keymap.set("v", "GWp", ":'<,'>GpWhisperPopup", keymapOptions("Popup")) + vim.keymap.set("v", "GWe", ":'<,'>GpWhisperEnew", keymapOptions("Enew")) + vim.keymap.set("v", "GWc", ":'<,'>GpWhisperNew", keymapOptions("New")) + vim.keymap.set("v", "GWv", ":'<,'>GpWhisperVnew", keymapOptions("Vnew")) + vim.keymap.set("v", "GWn", ":'<,'>GpWhisperTabnew", keymapOptions("Tabnew")) + end, + }, + -- { + -- "zbirenbaum/copilot.lua", + -- cmd = "Copilot", + -- build = ":Copilot auth", + -- event = "InsertEnter", + -- dependencies = { + -- "hrsh7th/nvim-cmp", + -- { "AndreM222/copilot-lualine" }, + -- { + -- "zbirenbaum/copilot-cmp", + -- config = function() + -- require("copilot_cmp").setup() + -- end, + -- }, + -- }, + -- config = function() + -- require("copilot").setup({ + -- panel = { + -- enabled = true, + -- auto_refresh = true, + -- keymap = { + -- jump_prev = "[a", + -- jump_next = "]a", + -- accept = "", + -- refresh = "gr", + -- open = "", + -- }, + -- layout = { + -- position = "right", -- | top | left | right + -- ratio = 0.4, + -- }, + -- }, + -- suggestion = { + -- enabled = true, + -- auto_trigger = true, + -- hide_during_completion = true, + -- debounce = 75, + -- keymap = { + -- accept = "", + -- accept_word = false, + -- accept_line = false, + -- next = "", + -- prev = "", + -- dismiss = "", + -- }, + -- }, + -- filetypes = { + -- cvs = false, + -- gitcommit = false, + -- gitrebase = false, + -- help = true, + -- hgcommit = false, + -- markdown = true, + -- sh = function() + -- if string.match(vim.fs.basename(vim.api.nvim_buf_get_name(0)), "^%.env.*") then + -- -- disable for .env files + -- return false + -- end + -- return true + -- end, + -- svn = false, + -- yaml = false, + -- ["."] = false, + -- ["*"] = true, + -- }, + -- copilot_node_command = "node", -- Node.js version must be > 18.x + -- server_opts_overrides = {}, + -- }) + -- + -- local cmp = require("cmp") + -- cmp.event:on("menu_opened", function() + -- vim.b.copilot_suggestion_hidden = true + -- end) + -- + -- cmp.event:on("menu_closed", function() + -- vim.b.copilot_suggestion_hidden = false + -- end) + -- end, + -- + -- vim.keymap.set("n", "ct", function() + -- require("copilot.suggestion").toggle_auto_trigger() + -- end, { noremap = true, silent = true, desc = "Toggle copilot" }), + -- }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/cloak.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/cloak.lua new file mode 100644 index 0000000..ab26f00 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/cloak.lua @@ -0,0 +1,42 @@ +return { + "laytan/cloak.nvim", + lazy = false, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v" }, + { "c", group = "Cloak" }, + }) + end, + config = function() + require("cloak").setup({ + enabled = true, + cloak_character = "*", + -- The applied highlight group (colors) on the cloaking, see `:h highlight`. + highlight_group = "Comment", + patterns = { + { + -- Match any file starting with ".env". + -- This can be a table to match multiple file patterns. + file_pattern = { + ".env*", + "wrangler.toml", + ".dev.vars", + "address*", + "*api*", + }, + -- Match an equals sign and any character after it. + -- This can also be a table of patterns to cloak, + -- example: cloak_pattern = { ":.+", "-.+" } for yaml files. + cloak_pattern = { "=.+", ":.+", "-.+" }, + }, + }, + }) + end, + keys = { + { "ce", "CloakEnable", desc = "Enable cloak" }, + { "cd", "CloakDisable", desc = "Disable cloak" }, + { "cl", "CloakPreviewLine", desc = "Preview line cloak" }, + { "zC", "CloakToggle", desc = "Toggle cloak" }, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/cmp.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/cmp.lua new file mode 100644 index 0000000..2dd46f3 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/cmp.lua @@ -0,0 +1,331 @@ +local trigger_text = ";" + +return { + { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-buffer", -- source for text in buffer + "hrsh7th/cmp-path", -- source for file system paths + "hrsh7th/cmp-cmdline", -- source for cmd + "hrsh7th/cmp-vsnip", + "hrsh7th/vim-vsnip", + { + "L3MON4D3/LuaSnip", + version = "v2.*", -- Replace by the latest released major (first number of latest release) + build = "make install_jsregexp", + }, + "saadparwaiz1/cmp_luasnip", -- for autocompletion + "rafamadriz/friendly-snippets", -- useful snippets + "onsails/lspkind.nvim", -- vs-code like pictograms + "uga-rosa/cmp-dictionary", -- dictionary & spell + }, + config = function() + local cmp = require("cmp") + local luasnip = require("luasnip") + local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 + and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + + require("luasnip.loaders.from_vscode").lazy_load() + + cmp.setup({ + completion = { + completeopt = "menu,menuone,preview,noselect", + }, + snippet = { -- configure how nvim-cmp interacts with snippet engine + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_prev_item(), -- previous suggestion + [""] = cmp.mapping.select_next_item(), -- next suggestion + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), -- show completion suggestions + [""] = cmp.mapping.abort(), -- close completion window + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() + -- this way you will only jump inside the snippet region + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + 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" }), + }), + -- sources for autocompletion + sources = cmp.config.sources({ + { name = "buffer" }, -- text within current buffer + { name = "crates" }, + { name = "copilot" }, + { name = "dictionary", keyword_length = 2 }, + { name = "emoji" }, + { name = "luasnip" }, -- snippets + { name = "nvim_lsp" }, + { name = "nvim_lua", priority = 100 }, + { name = "path" }, -- file system paths + { name = "projects", priority = 100 }, + { name = "snippets" }, + { name = "vim-dadbod-completion" }, -- Enable dadbod completion source + { name = "vsnip" }, + }), + + -- configure lspkind for vs-code like pictograms in completion menu + formatting = { + expandable_indicator = true, + fields = { + "abbr", + "kind", + "menu", + }, + format = require("lspkind").cmp_format({ + mode = "symbol_text", + maxwidth = 50, + ellipsis_char = "...", + menu = { + buffer = "[Buffer]", + luasnip = "[LuaSnip]", + nvim_lsp = "[LSP]", + nvim_lua = "[Lua]", + projects = "[Projects]", + emoji = "[Emoji]", + vsnip = "[Snippet]", + }, + }), + }, + }) + + -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline({ "/", "?" }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" }, + }, + }) + + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), + matching = { disallow_symbol_nonprefix_matching = false }, + }) + + -- sql + cmp.setup.filetype({ "sql" }, { + sources = { + { name = "vim-dadbod-completion" }, + { name = "buffer" }, + }, + }) + + local lspkind = require("lspkind") + lspkind.init({ + symbol_map = { + Copilot = "", + }, + }) + + vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#6CC644" }) + + require("cmp_dictionary").setup({ + paths = { "/usr/share/dict/words" }, + exact_length = 2, + first_case_insensitive = true, + document = { + enable = true, + command = { "wn", "${label}", "-over" }, + }, + }) + end, + }, + -- { + -- "saghen/blink.cmp", + -- version = "*", + -- -- build = "cargo build --release", + -- opts_extend = { + -- "sources.completion.enabled_providers", + -- "sources.compat", + -- "sources.default", + -- }, + -- enabled = true, + -- dependencies = { + -- { + -- "L3MON4D3/LuaSnip", + -- version = "v2.*", + -- build = "make install_jsregexp", + -- }, + -- "rafamadriz/friendly-snippets", + -- { + -- "saghen/blink.compat", + -- optional = true, -- make optional so it's only enabled if any extras need it + -- opts = {}, + -- version = "*", + -- }, + -- "kristjanhusak/vim-dadbod-completion", + -- "giuxtaposition/blink-cmp-copilot", + -- }, + -- event = "InsertEnter", + -- opts = function(_, opts) + -- opts.sources = vim.tbl_deep_extend("force", opts.sources or {}, { + -- default = { "lsp", "path", "snippets", "buffer", "copilot", "luasnip", "dadbod" }, + -- providers = { + -- lsp = { + -- name = "lsp", + -- enabled = true, + -- module = "blink.cmp.sources.lsp", + -- fallbacks = { "snippets", "luasnip", "buffer" }, + -- score_offset = 90, -- the higher the number, the higher the priority + -- }, + -- luasnip = { + -- name = "luasnip", + -- enabled = true, + -- module = "blink.cmp.sources.luasnip", + -- min_keyword_length = 2, + -- fallbacks = { "snippets" }, + -- score_offset = 85, + -- max_items = 8, + -- }, + -- path = { + -- name = "Path", + -- module = "blink.cmp.sources.path", + -- score_offset = 3, + -- -- When typing a path, I would get snippets and text in the + -- -- suggestions, I want those to show only if there are no path + -- -- suggestions + -- fallbacks = { "snippets", "luasnip", "buffer" }, + -- opts = { + -- trailing_slash = false, + -- label_trailing_slash = true, + -- get_cwd = function(context) + -- return vim.fn.expand(("#%d:p:h"):format(context.bufnr)) + -- end, + -- show_hidden_files_by_default = true, + -- }, + -- }, + -- buffer = { + -- name = "Buffer", + -- enabled = true, + -- max_items = 3, + -- module = "blink.cmp.sources.buffer", + -- min_keyword_length = 4, + -- }, + -- snippets = { + -- name = "Snippets", + -- enabled = true, + -- max_items = 3, + -- module = "blink.cmp.sources.snippets", + -- min_keyword_length = 4, + -- score_offset = 80, -- the higher the number, the higher the priority + -- }, + -- -- Example on how to configure dadbod found in the main repo + -- -- https://github.com/kristijanhusak/vim-dadbod-completion + -- dadbod = { + -- name = "Dadbod", + -- module = "vim_dadbod_completion.blink", + -- score_offset = 85, -- the higher the number, the higher the priority + -- }, + -- -- Third class citizen mf always talking shit + -- copilot = { + -- name = "Copilot", + -- enabled = true, + -- module = "blink-cmp-copilot", + -- min_keyword_length = 6, + -- score_offset = -100, -- the higher the number, the higher the priority + -- async = true, + -- }, + -- }, + -- -- command line completion, thanks to dpetka2001 in reddit + -- -- https://www.reddit.com/r/neovim/comments/1hjjf21/comment/m37fe4d/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button + -- cmdline = function() + -- local type = vim.fn.getcmdtype() + -- if type == "/" or type == "?" then + -- return { "buffer" } + -- end + -- if type == ":" then + -- return { "cmdline" } + -- end + -- return {} + -- end, + -- }) + -- + -- -- This comes from the luasnip extra, if you don't add it, won't be able to + -- -- jump forward or backward in luasnip snippets + -- opts.snippets = { + -- expand = function(snippet) + -- require("luasnip").lsp_expand(snippet) + -- end, + -- active = function(filter) + -- if filter and filter.direction then + -- return require("luasnip").jumpable(filter.direction) + -- end + -- return require("luasnip").in_snippet() + -- end, + -- jump = function(direction) + -- require("luasnip").jump(direction) + -- end, + -- } + -- + -- opts.appearance = { + -- -- sets the fallback highlight groups to nvim-cmp's highlight groups + -- -- useful for when your theme doesn't support blink.cmp + -- -- will be removed in a future release, assuming themes add support + -- use_nvim_cmp_as_default = false, + -- -- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- -- adjusts spacing to ensure icons are aligned + -- nerd_font_variant = "mono", + -- } + -- + -- opts.completion = { + -- accept = { + -- -- experimental auto-brackets support + -- auto_brackets = { + -- enabled = true, + -- }, + -- }, + -- menu = { + -- draw = { + -- treesitter = { "lsp" }, + -- }, + -- }, + -- documentation = { + -- auto_show = true, + -- auto_show_delay_ms = 200, + -- }, + -- ghost_text = { enabled = true }, + -- } + -- + -- opts.keymap = { + -- preset = "super-tab", + -- } + -- + -- return opts + -- end, + -- }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/colorizer.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/colorizer.lua new file mode 100644 index 0000000..7356619 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/colorizer.lua @@ -0,0 +1,76 @@ +return { + "catgoose/nvim-colorizer.lua", + event = "BufReadPre", + opts = { -- set to setup table + }, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n" }, + { "zh", group = "Colorizer" }, + }) + end, + config = function() + require("colorizer").setup({ + filetypes = { "*" }, -- Filetype options. Accepts table like `user_default_options` + buftypes = {}, -- Buftype options. Accepts table like `user_default_options` + -- Boolean | List of usercommands to enable. See User commands section. + user_commands = true, -- Enable all or some usercommands + lazy_load = false, -- Lazily schedule buffer highlighting setup function + user_default_options = { + names = false, -- "Name" codes like Blue or red. Added from `vim.api.nvim_get_color_map()` + names_opts = { -- options for mutating/filtering names. + lowercase = true, -- name:lower(), highlight `blue` and `red` + camelcase = true, -- name, highlight `Blue` and `Red` + uppercase = true, -- name:upper(), highlight `BLUE` and `RED` + strip_digits = false, -- ignore names with digits, + -- highlight `blue` and `red`, but not `blue3` and `red4` + }, + -- Expects a table of color name to #RRGGBB value pairs. # is optional + -- Example: { cool = "#107dac", ["notcool"] = "#ee9240" } + -- Set to false to disable, for example when setting filetype options + names_custom = false, -- Custom names to be highlighted: table|function|false + RGB = true, -- #RGB hex codes + RGBA = true, -- #RGBA hex codes + RRGGBB = true, -- #RRGGBB hex codes + RRGGBBAA = true, -- #RRGGBBAA hex codes + AARRGGBB = false, -- 0xAARRGGBB hex codes + rgb_fn = true, -- CSS rgb() and rgba() functions + hsl_fn = true, -- CSS hsl() and hsla() functions + css = true, -- Enable all CSS *features*: + -- names, RGB, RGBA, RRGGBB, RRGGBBAA, AARRGGBB, rgb_fn, hsl_fn + css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn + -- Tailwind colors. boolean|'normal'|'lsp'|'both'. True sets to 'normal' + tailwind = true, -- Enable tailwind colors + tailwind_opts = { -- Options for highlighting tailwind names + update_names = false, -- When using tailwind = 'both', update tailwind names from LSP results. See tailwind section + }, + -- parsers can contain values used in `user_default_options` + sass = { enable = false, parsers = { "css" } }, -- Enable sass colors + -- Highlighting mode. 'background'|'foreground'|'virtualtext' + mode = "background", -- Set the display mode + -- Virtualtext character to use + virtualtext = "■", + -- Display virtualtext inline with color. boolean|'before'|'after'. True sets to 'after' + virtualtext_inline = false, + -- Virtualtext highlight mode: 'background'|'foreground' + virtualtext_mode = "foreground", + -- update color values even if buffer is not focused + -- example use: cmp_menu, cmp_docs + always_update = false, + -- hooks to invert control of colorizer + hooks = { + -- called before line parsing. Accepts boolean or function that returns boolean + -- see hooks section below + disable_line_highlight = false, + }, + }, + }) + end, + keys = { + { "zha", "ColorizerAttachToBuffer", desc = "Attach colorizer" }, + { "zhd", "ColorizerDetachFromBuffer", desc = "Detach colorizer" }, + { "zhr", "ColorizerReloadAllBuffers", desc = "Refresh colorizer" }, + { "zht", "ColorizerToggle", desc = "Toggle colorizer" }, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/colorschemes.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/colorschemes.lua new file mode 100644 index 0000000..8fce515 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/colorschemes.lua @@ -0,0 +1,350 @@ +function ColorMyPencils(color) + color = color or "catppuccin" + vim.cmd.colorscheme(color) + local set = vim.api.nvim_set_hl + set(0, "Normal", { bg = "NONE" }) + set(0, "NormalFloat", { bg = "NONE" }) + set(0, "@comment.todo", { bg = "NONE" }) + set(0, "@comment.note", { bg = "NONE" }) + set(0, "@comment.warning", { bg = "NONE" }) + set(0, "@comment.error", { bg = "NONE" }) + set(0, "@number", { bg = "NONE" }) + set(0, "@string.special.url", { bg = "NONE" }) +end + +return { + { "junegunn/seoul256.vim" }, + { + "catppuccin/nvim", + name = "catppuccin", + config = function() + require("catppuccin").setup({ + flavour = "auto", -- latte, frappe, macchiato, mocha + background = { -- :h background + light = "latte", + dark = "mocha", + }, + transparent_background = true, -- disables setting the background color. + show_end_of_buffer = false, -- shows the '~' characters after the end of buffers + term_colors = false, -- sets terminal colors (e.g. `g:terminal_color_0`) + dim_inactive = { + enabled = true, -- dims the background color of inactive window + shade = "dark", + percentage = 0.15, -- percentage of the shade to apply to the inactive window + }, + no_italic = false, -- Force no italic + no_bold = false, -- Force no bold + no_underline = false, -- Force no underline + styles = { -- Handles the styles of general hi groups (see `:h highlight-args`): + comments = { "italic" }, -- Change the style of comments + conditionals = { "italic" }, + loops = {}, + functions = {}, + keywords = {}, + strings = {}, + variables = {}, + numbers = {}, + booleans = {}, + properties = {}, + types = {}, + operators = {}, + -- miscs = {}, -- Uncomment to turn off hard-coded styles + }, + color_overrides = {}, + custom_highlights = {}, + default_integrations = true, + integrations = { + aerial = true, + alpha = true, + blink_cmp = true, + cmp = true, + dashboard = true, + flash = true, + gitsigns = true, + headlines = true, + illuminate = true, + indent_blankline = { enabled = true, scope_color = "peach", colored_indent_levels = true }, + leap = true, + lsp_trouble = true, + mason = true, + markdown = true, + mini = true, + native_lsp = { + enabled = true, + underlines = { + errors = { "undercurl" }, + hints = { "undercurl" }, + warnings = { "undercurl" }, + information = { "undercurl" }, + }, + }, + navic = { enabled = true, custom_bg = "NONE" }, + neotest = true, + neotree = true, + noice = true, + notify = true, + semantic_tokens = true, + telescope = true, + treesitter = true, + treesitter_context = true, + which_key = true, + }, + highlight_overrides = { + mocha = function(mocha) + return { + LineNr = { fg = mocha.overlay2 }, + CursorLineNr = { fg = mocha.sky }, + Normal = { bg = "NONE" }, -- normal text + NormalNC = { bg = "NONE" }, + } + end, + }, + }) + + ColorMyPencils() + end, + }, + { + "ellisonleao/gruvbox.nvim", + priority = 1000, + -- opts = ..., + config = function() + require("gruvbox").setup({ + terminal_colors = true, -- add neovim terminal colors + undercurl = true, + underline = true, + bold = true, + italic = { + strings = true, + emphasis = true, + comments = true, + operators = false, + folds = true, + }, + strikethrough = true, + invert_selection = false, + invert_signs = false, + invert_tabline = false, + invert_intend_guides = false, + inverse = true, -- invert background for search, diffs, statuslines and errors + contrast = "", -- can be "hard", "soft" or empty string + palette_overrides = { + dark1 = "NONE", + }, + overrides = {}, + dim_inactive = true, + transparent_mode = true, + }) + end, + }, + { + "rose-pine/neovim", + name = "rose-pine", + config = function() + require("rose-pine").setup({ + variant = "auto", -- auto, main, moon, or dawn + dark_variant = "main", -- main, moon, or dawn + dim_inactive_windows = false, + extend_background_behind_borders = true, + enable = { + terminal = true, + legacy_highlights = true, -- Improve compatibility for previous versions of Neovim + migrations = true, -- Handle deprecated options automatically + }, + styles = { + bold = true, + italic = false, + transparency = true, + }, + groups = { + border = "muted", + link = "iris", + panel = "surface", + + error = "love", + hint = "iris", + info = "foam", + note = "pine", + todo = "rose", + warn = "gold", + + git_add = "foam", + git_change = "rose", + git_delete = "love", + git_dirty = "rose", + git_ignore = "muted", + git_merge = "iris", + git_rename = "pine", + git_stage = "iris", + git_text = "rose", + git_untracked = "subtle", + + h1 = "iris", + h2 = "foam", + h3 = "rose", + h4 = "gold", + h5 = "pine", + h6 = "foam", + }, + palette = { + -- Override the builtin palette per variant + -- moon = { + -- base = '#18191a', + -- overlay = '#363738', + -- }, + }, + highlight_groups = { + -- Comment = { fg = "foam" }, + -- VertSplit = { fg = "muted", bg = "muted" }, + }, + before_highlight = function(group, highlight, palette) + -- Disable all undercurls + -- if highlight.undercurl then + -- highlight.undercurl = false + -- end + -- + -- Change palette colour + -- if highlight.fg == palette.pine then + -- highlight.fg = palette.foam + -- end + end, + }) + -- vim.cmd("colorscheme rose-pine") + -- vim.cmd("colorscheme rose-pine-main") + -- vim.cmd("colorscheme rose-pine-moon") + -- vim.cmd("colorscheme rose-pine-dawn") + end, + }, + { + "Mofiqul/dracula.nvim", + config = function() + local dracula = require("dracula") + dracula.setup({ + -- customize dracula color palette + colors = { + bg = "#282A36", + fg = "#F8F8F2", + selection = "#44475A", + comment = "#6272A4", + red = "#FF5555", + orange = "#FFB86C", + yellow = "#F1FA8C", + green = "#50fa7b", + purple = "#BD93F9", + cyan = "#8BE9FD", + pink = "#FF79C6", + bright_red = "#FF6E6E", + bright_green = "#69FF94", + bright_yellow = "#FFFFA5", + bright_blue = "#D6ACFF", + bright_magenta = "#FF92DF", + bright_cyan = "#A4FFFF", + bright_white = "#FFFFFF", + menu = "#21222C", + visual = "#3E4452", + gutter_fg = "#4B5263", + nontext = "#3B4048", + white = "#ABB2BF", + black = "#191A21", + }, + -- show the '~' characters after the end of buffers + show_end_of_buffer = true, -- default false + -- use transparent background + transparent_bg = true, -- default false + -- set custom lualine background color + lualine_bg_color = "#44475a", -- default nil + -- set italic comment + italic_comment = true, -- default false + -- overrides the default highlights with table see `:h synIDattr` + overrides = {}, + -- You can use overrides as table like this + -- overrides = { + -- NonText = { fg = "white" }, -- set NonText fg to white + -- NvimTreeIndentMarker = { link = "NonText" }, -- link to NonText highlight + -- Nothing = {} -- clear highlight of Nothing + -- }, + -- Or you can also use it like a function to get color from theme + -- overrides = function (colors) + -- return { + -- NonText = { fg = colors.white }, -- set NonText fg to white of theme + -- } + -- end, + }) + end, + }, + { + "neanias/everforest-nvim", + priority = 1000, -- make sure to load this before all the other start plugins + -- Optional; default configuration will be used if setup isn't called. + config = function() + require("everforest").setup({ + ---Controls the "hardness" of the background. Options are "soft", "medium" or "hard". + ---Default is "medium". + background = "hard", + ---How much of the background should be transparent. 2 will have more UI + ---components be transparent (e.g. status line background) + transparent_background_level = 2, + ---Whether italics should be used for keywords and more. + italics = false, + ---Disable italic fonts for comments. Comments are in italics by default, set + ---this to `true` to make them _not_ italic! + disable_italic_comments = false, + ---By default, the colour of the sign column background is the same as the as normal text + ---background, but you can use a grey background by setting this to `"grey"`. + sign_column_background = "none", + ---The contrast of line numbers, indent lines, etc. Options are `"high"` or + ---`"low"` (default). + ui_contrast = "low", + ---Dim inactive windows. Only works in Neovim. Can look a bit weird with Telescope. + --- + ---When this option is used in conjunction with show_eob set to `false`, the + ---end of the buffer will only be hidden inside the active window. Inside + ---inactive windows, the end of buffer filler characters will be visible in + ---dimmed symbols. This is due to the way Vim and Neovim handle `EndOfBuffer`. + dim_inactive_windows = false, + ---Some plugins support highlighting error/warning/info/hint texts, by + ---default these texts are only underlined, but you can use this option to + ---also highlight the background of them. + diagnostic_text_highlight = false, + ---Which colour the diagnostic text should be. Options are `"grey"` or `"coloured"` (default) + diagnostic_virtual_text = "coloured", + ---Some plugins support highlighting error/warning/info/hint lines, but this + ---feature is disabled by default in this colour scheme. + diagnostic_line_highlight = false, + ---By default, this color scheme won't colour the foreground of |spell|, instead + ---colored under curls will be used. If you also want to colour the foreground, + ---set this option to `true`. + spell_foreground = false, + ---Whether to show the EndOfBuffer highlight. + show_eob = true, + ---Style used to make floating windows stand out from other windows. `"bright"` + ---makes the background of these windows lighter than |hl-Normal|, whereas + ---`"dim"` makes it darker. + --- + ---Floating windows include for instance diagnostic pop-ups, scrollable + ---documentation windows from completion engines, overlay windows from + ---installers, etc. + --- + ---NB: This is only significant for dark backgrounds as the light palettes + ---have the same colour for both values in the switch. + float_style = "bright", + ---Inlay hints are special markers that are displayed inline with the code to + ---provide you with additional information. You can use this option to customize + ---the background color of inlay hints. + --- + ---Options are `"none"` or `"dimmed"`. + inlay_hints_background = "none", + ---You can override specific highlights to use other groups or a hex colour. + ---This function will be called with the highlights and colour palette tables. + ---@param highlight_groups Highlights + ---@param palette Palette + on_highlights = function(highlight_groups, palette) end, + ---You can override colours in the palette to use different hex colours. + ---This function will be called once the base and background colours have + ---been mixed on the palette. + ---@param palette Palette + colours_override = function(palette) end, + }) + end, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/comment.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/comment.lua new file mode 100644 index 0000000..eb93c01 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/comment.lua @@ -0,0 +1,8 @@ +return { + "numToStr/Comment.nvim", + lazy = false, + opts = {}, + config = function() + require("Comment").setup() + end, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/compiler.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/compiler.lua new file mode 100644 index 0000000..9dad4f8 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/compiler.lua @@ -0,0 +1,53 @@ +return { + { -- This plugin + "Zeioth/compiler.nvim", + cmd = { "CompilerOpen", "CompilerToggleResults", "CompilerRedo" }, + dependencies = { "stevearc/overseer.nvim", "nvim-telescope/telescope.nvim" }, + opts = {}, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v" }, + { "r", group = "Compiler/Refactoring" }, + }) + end, + keys = { + -- Open compiler + vim.api.nvim_set_keymap( + "n", + "ro", + "CompilerOpen", + { noremap = true, silent = true, desc = "Open compiler" } + ), + + -- Redo last selected option + vim.api.nvim_set_keymap( + "n", + "re", + "CompilerStop" -- (Optional, to dispose all tasks before redo) + .. "CompilerRedo", + { noremap = true, silent = true, desc = "Recompile" } + ), + -- Toggle compiler results + vim.api.nvim_set_keymap( + "n", + "rt", + "CompilerToggleResults", + { noremap = true, silent = true, desc = "Toggle compiler" } + ), + }, + }, + { -- The task runner we use + "stevearc/overseer.nvim", + commit = "6271cab7ccc4ca840faa93f54440ffae3a3918bd", + cmd = { "CompilerOpen", "CompilerToggleResults", "CompilerRedo" }, + opts = { + task_list = { + direction = "bottom", + min_height = 25, + max_height = 25, + default_detail = 1, + }, + }, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/context.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/context.lua new file mode 100644 index 0000000..e2d8d2b --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/context.lua @@ -0,0 +1,25 @@ +return { + "nvim-treesitter/nvim-treesitter-context", + cmd = { "TSContextEnable", "TSContextDisable", "TSContextToggle" }, + config = function() + require("treesitter-context").setup({ + enable = false, -- Enable this plugin (Can be enabled/disabled later via commands) + max_lines = 3, -- How many lines the window should span. Values <= 0 mean no limit. + min_window_height = 1, -- Minimum editor window height to enable context. Values <= 0 mean no limit. + line_numbers = true, + multiline_threshold = 20, -- Maximum number of lines to show for a single context + trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' + mode = "cursor", -- Line used to calculate context. Choices: 'cursor', 'topline' + -- Separator between context and content. Should be a single character string, like '-'. + -- When separator is set, the context will only show up when there are at least 2 lines above cursorline. + separator = nil, + zindex = 20, -- The Z-index of the context window + on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching + }) + + vim.keymap.set("n", "[t", function() + require("treesitter-context").go_to_context(vim.v.count1) + end, { silent = true, desc = "Go to context" }) + vim.keymap.set({ "n", "v" }, "zc", "TSContextToggle", { desc = "Toggle context" }) + end, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/csv.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/csv.lua new file mode 100644 index 0000000..bcf0239 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/csv.lua @@ -0,0 +1,55 @@ +return { + { + "hat0uma/csvview.nvim", + cmd = { "CsvViewEnable", "CsvViewDisable", "CsvViewToggle" }, + event = { "BufReadPre *.csv" }, -- Lazy-load the plugin when a CSV file is about to be read + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v", "x" }, + { "cs", group = "csv" }, + }) + end, + config = function() + require("csvview").setup() + + vim.api.nvim_create_autocmd("BufRead", { + pattern = "*.csv", + callback = function() + vim.cmd("CsvViewEnable") + end, + }) + + vim.api.nvim_create_autocmd("FileType", { + pattern = "csv", + callback = function() + vim.keymap.set( + "n", + "zv", + "CsvViewToggle", + { desc = "Toggle CSV view", buffer = true } + ) + end, + }) + end, + keys = { + { + "csv", + function() + local delimiter = vim.fn.input("Delimiter (e.g., ,): ") + local quote_char = vim.fn.input("Quote char (e.g., '): ") + local comment = vim.fn.input("Comment char (e.g., #): ") + local command = string.format( + ":CsvViewToggle delimiter=%s quote_char=%s comment=%s", + delimiter, + quote_char, + comment + ) + + vim.cmd(command) + end, + desc = "Toggle CSV view", + }, + }, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/dadbod.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/dadbod.lua new file mode 100644 index 0000000..ab7099a --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/dadbod.lua @@ -0,0 +1,54 @@ +return { + "kristijanhusak/vim-dadbod-ui", + dependencies = { + { "tpope/vim-dadbod", lazy = true }, + { "kristijanhusak/vim-dadbod-completion", ft = { "sql", "mysql", "plsql" }, lazy = true }, + }, + cmd = { + "DBUI", + "DBUIToggle", + "DBUIAddConnection", + "DBUIFindBuffer", + }, + init = function() + -- Your DBUI configuration + local home = vim.fn.expand("~") + vim.g.db_ui_use_nerd_fonts = 1 + vim.g.dbs = { + -- firefox = "sqlite://" .. home .. "/.mozilla/firefox/si.default/places.sqlite", + -- librewolf = "sqlite://" .. home .. "/.librewolf/si.default/places.sqlite", + mysql = "mariadb://ms:password@localhost:5432/mysql", + postsql = "postgresql://ps:password@localhost:5432/postgresql", + -- qutebrowser = "sqlite://" .. home .. "/.local/share/qutebrowser/history.sqlite", + -- sqlite = "sqlite://" .. home .. "/.local/share/db/sqlite.db", + } + local wk = require("which-key") + wk.add({ + mode = { "n" }, + { "d", group = "DB" }, + }) + end, + config = function() + local function db_completion() + require("cmp").setup.buffer({ sources = { { name = "vim-dadbod-completion" } } }) + end + vim.api.nvim_create_autocmd("FileType", { + pattern = { + "sql", + "mysql", + "plsql", + }, + callback = function() + vim.schedule(db_completion) + end, + }) + end, + keys = { + { "du", "DBUI", desc = "DB UI" }, + { "dt", "DBUIToggle", desc = "Toggle DB UI" }, + { "da", "DBUIAddConnection", desc = "Add connection" }, + { "df", "DBUIFindBuffer", desc = "Find buffer" }, + { "dr", "DBUIRenameBuffer", desc = "Rename buffer" }, + { "di", "DBUILastQueryInfo", desc = "Last query info" }, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/dap.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/dap.lua new file mode 100644 index 0000000..6a4118a --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/dap.lua @@ -0,0 +1,337 @@ +local function get_args(config) + local args = type(config.args) == "function" and (config.args() or {}) or config.args or {} + config = vim.deepcopy(config) + ---@cast args string[] + config.args = function() + local new_args = vim.fn.input("Run with args: ", table.concat(args, " ")) --[[@as string]] + return vim.split(vim.fn.expand(new_args) --[[@as string]], " ") + end + return config +end + +return { + { + "mfussenegger/nvim-dap", + recommended = true, + desc = "Debugging support. Requires language specific adapters to be configured. (see lang extras)", + dependencies = { + "rcarriga/nvim-dap-ui", + -- virtual text for the debugger + { + "theHamsta/nvim-dap-virtual-text", + opts = {}, + }, + }, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n" }, + { "db", group = "Debug" }, + { "dB", group = "Debug (Python)" }, + }) + end, + config = function() + -- load mason-nvim-dap here, after all adapters have been setup + vim.api.nvim_set_hl(0, "DapStoppedLine", { default = true, link = "Visual" }) + + local dap = require("dap") + + dap.adapters["pwa-node"] = { + type = "server", + host = "localhost", + port = "${port}", + executable = { + command = "node", + -- 💀 Make sure to update this path to point to your installation + args = { + vim.fn.stdpath("data") .. "/mason/packages/js-debug-adapter/js-debug/src/dapDebugServer.js", + "${port}", + }, + }, + } + + dap.configurations.java = { + { + type = "java", + request = "attach", + name = "Debug (Attach) - Remote", + hostName = "127.0.0.1", + port = 5005, + }, + } + + for _, language in ipairs({ "javascript", "typescript" }) do + dap.configurations[language] = { + { + type = "pwa-node", + request = "launch", + name = "Launch file", + program = "${file}", + cwd = "${workspaceFolder}", + }, + } + end + + local dap_icons = { + Stopped = { "󰁕 ", "DiagnosticWarn", "DapStoppedLine" }, + Breakpoint = " ", + BreakpointCondition = " ", + BreakpointRejected = { " ", "DiagnosticError" }, + LogPoint = ".>", + } + + for name, sign in pairs(dap_icons) do + sign = type(sign) == "table" and sign or { sign } + vim.fn.sign_define( + "Dap" .. name, + { text = sign[1], texthl = sign[2] or "DiagnosticInfo", linehl = sign[3], numhl = sign[3] } + ) + end + + -- setup dap config by VsCode launch.json file + local vscode = require("dap.ext.vscode") + local json = require("plenary.json") + vscode.json_decode = function(str) + return vim.json.decode(json.json_strip_comments(str)) + end + end, + keys = { + { + "dbB", + function() + require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: ")) + end, + desc = "Dap breakpoint condition", + }, + { + "dbb", + function() + require("dap").toggle_breakpoint() + end, + desc = "Dap toggle breakpoint", + }, + { + "dbc", + function() + require("dap").continue() + end, + desc = "Dap continue", + }, + { + "dba", + function() + require("dap").continue({ before = get_args }) + end, + desc = "Dap run with args", + }, + { + "dbC", + function() + require("dap").run_to_cursor() + end, + desc = "Dap run to cursor", + }, + { + "dbg", + function() + require("dap").goto_() + end, + desc = "Dap go to line (no execute)", + }, + { + "dbi", + function() + require("dap").step_into() + end, + desc = "Dap step into", + }, + { + "dbj", + function() + require("dap").down() + end, + desc = "Dap down", + }, + { + "dbk", + function() + require("dap").up() + end, + desc = "Dap up", + }, + { + "dbl", + function() + require("dap").run_last() + end, + desc = "Dap run last", + }, + { + "dbo", + function() + require("dap").step_out() + end, + desc = "Dap step out", + }, + { + "dbO", + function() + require("dap").step_over() + end, + desc = "Dap step over", + }, + { + "dbp", + function() + require("dap").pause() + end, + desc = "Dap pause", + }, + { + "dbr", + function() + require("dap").repl.toggle() + end, + desc = "Dap toggle repl", + }, + { + "dbs", + function() + require("dap").session() + end, + desc = "Dap session", + }, + { + "dbt", + function() + require("dap").terminate() + end, + desc = "Dap terminate", + }, + { + "dbw", + function() + require("dap.ui.widgets").hover() + end, + desc = "Dap widgets", + }, + { + "dbR", + "lua require('dapui').open({ reset = true })", + desc = "Dap UI reset", + }, + }, + }, + { + "mfussenegger/nvim-dap-python", + ft = "python", + dependencies = { "mfussenegger/nvim-dap", "rcarriga/nvim-dap-ui" }, + config = function() + local path = "~/.local/share/nvim/mason/packages/debugpy/venv/bin/python" + require("dap-python").setup(path) + end, + keys = { + { + "dBt", + function() + require("dap-python").test_method() + end, + desc = "Dap debug method", + ft = "python", + }, + { + "dBc", + function() + require("dap-python").test_class() + end, + desc = "Dap debug class", + ft = "python", + }, + }, + }, + { + "rcarriga/nvim-dap-ui", + dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" }, + config = function() + local dap = require("dap") + local dapui = require("dapui") + dapui.setup({ + icons = { expanded = "▾", collapsed = "▸", current_frame = "*" }, + controls = { + icons = { + pause = "⏸", + play = "▶", + step_into = "⏎", + step_over = "⏭", + step_out = "⏮", + step_back = "b", + run_last = "▶▶", + terminate = "⏹", + disconnect = "⏏", + }, + }, + }) + + dap.listeners.before.attach.dapui_config = function() + dapui.open() + end + dap.listeners.before.launch.dapui_config = function() + dapui.open() + end + dap.listeners.before.event_terminated.dapui_config = function() + dapui.close() + end + dap.listeners.before.event_exited.dapui_config = function() + dapui.close() + end + + dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open() + end + dap.listeners.after.event_terminated["dapui_config"] = function() + dapui.close() + end + dap.listeners.after.event_exited["dapui_config"] = function() + dapui.close() + end + end, + keys = { + { + "dbu", + function() + require("dapui").toggle() + end, + desc = "Dap UI", + }, + { + "dbe", + function() + require("dapui").eval() + end, + desc = "Dap eval", + }, + }, + }, + { + "jay-babu/mason-nvim-dap.nvim", + dependencies = "mason.nvim", + cmd = { "DapInstall", "DapUninstall" }, + opts = { + -- Makes a best effort to setup the various debuggers with + -- reasonable debug configurations + automatic_installation = true, + + -- You can provide additional configuration to the handlers, + -- see mason-nvim-dap README for more information + handlers = {}, + + -- You'll need to check that you have the required things installed + -- online, please don't ask me how to install them :) + ensure_installed = { + -- Update this to ensure that you have the debuggers for the langs you want + }, + }, + -- mason-nvim-dap is loaded when nvim-dap loads + config = function() end, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/docker.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/docker.lua new file mode 100644 index 0000000..7bc26d5 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/docker.lua @@ -0,0 +1,222 @@ +return { + "https://codeberg.org/esensar/nvim-dev-container", + dependencies = "nvim-treesitter/nvim-treesitter", + config = function() + require("devcontainer").setup({ + config_search_start = function() + -- By default this function uses vim.loop.cwd() + -- This is used to find a starting point for .devcontainer.json file search + -- Since by default, it is searched for recursively + -- That behavior can also be disabled + end, + workspace_folder_provider = function() + -- By default this function uses first workspace folder for integrated lsp if available and vim.loop.cwd() as a fallback + -- This is used to replace `${localWorkspaceFolder}` in devcontainer.json + -- Also used for creating default .devcontainer.json file + end, + terminal_handler = function(command) + -- By default this function creates a terminal in a new tab using :terminal command + -- It also removes statusline when that tab is active, to prevent double statusline + -- It can be overridden to provide custom terminal handling + end, + nvim_installation_commands_provider = function(path_binaries, version_string) + -- Returns table - list of commands to run when adding neovim to container + -- Each command can either be a string or a table (list of command parts) + -- Takes binaries available in path on current container and version_string passed to the command or current version of neovim + end, + devcontainer_json_template = function() + -- Returns table - list of lines to set when creating new devcontainer.json files + -- As a template + -- Used only when using functions from commands module or created commands + end, + -- Can be set to false to prevent generating default commands + -- Default commands are listed below + generate_commands = true, + -- By default no autocommands are generated + -- This option can be used to configure automatic starting and cleaning of containers + autocommands = { + -- can be set to true to automatically start containers when devcontainer.json is available + init = false, + -- can be set to true to automatically remove any started containers and any built images when exiting vim + clean = false, + -- can be set to true to automatically restart containers when devcontainer.json file is updated + update = false, + }, + -- can be changed to increase or decrease logging from library + log_level = "info", + -- can be set to true to disable recursive search + -- in that case only .devcontainer.json and .devcontainer/devcontainer.json files will be checked relative + -- to the directory provided by config_search_start + disable_recursive_config_search = false, + -- can be set to false to disable image caching when adding neovim + -- by default it is set to true to make attaching to containers faster after first time + cache_images = true, + -- By default all mounts are added (config, data and state) + -- This can be changed to disable mounts or change their options + -- This can be useful to mount local configuration + -- And any other mounts when attaching to containers with this plugin + attach_mounts = { + neovim_config = { + -- enables mounting local config to /root/.config/nvim in container + enabled = false, + -- makes mount readonly in container + options = { "readonly" }, + }, + neovim_data = { + -- enables mounting local data to /root/.local/share/nvim in container + enabled = false, + -- no options by default + options = {}, + }, + -- Only useful if using neovim 0.8.0+ + neovim_state = { + -- enables mounting local state to /root/.local/state/nvim in container + enabled = false, + -- no options by default + options = {}, + }, + }, + -- This takes a list of mounts (strings) that should always be added to every run container + -- This is passed directly as --mount option to docker command + -- Or multiple --mount options if there are multiple values + always_mount = {}, + -- This takes a string (usually either "podman" or "docker") representing container runtime - "devcontainer-cli" is also partially supported + -- That is the command that will be invoked for container operations + -- If it is nil, plugin will use whatever is available (trying "podman" first) + container_runtime = nil, + -- Similar to container runtime, but will be used if main runtime does not support an action - useful for "devcontainer-cli" + backup_runtime = nil, + -- This takes a string (usually either "podman-compose" or "docker-compose") representing compose command - "devcontainer-cli" is also partially supported + -- That is the command that will be invoked for compose operations + -- If it is nil, plugin will use whatever is available (trying "podman-compose" first) + compose_command = nil, + -- Similar to compose command, but will be used if main command does not support an action - useful for "devcontainer-cli" + backup_compose_command = nil, + }) + end, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n" }, + { "d", group = "Docker" }, + { "db", group = "Build (docker)" }, + { "dc", group = "Compose (docker)" }, + { "do", group = "Open (docker)" }, + { "dr", group = "Run (docker)" }, + }) + end, + keys = { + { + "dcu", + function() + require("devcontainer.commands").compose_up() + end, + desc = "Compose up (docker)", + }, + { + "dcd", + function() + require("devcontainer.commands").compose_down() + end, + desc = "Compose down (docker)", + }, + { + "dcD", + function() + require("devcontainer.commands").compose_rm() + end, + desc = "Compose remove (docker)", + }, + { + "dbb", + function() + require("devcontainer.commands").docker_build() + end, + desc = "Build (docker)", + }, + { + "dri", + function() + require("devcontainer.commands").docker_image_run() + end, + desc = "Image run (docker)", + }, + { + "dbr", + function() + require("devcontainer.commands").docker_build_and_run() + end, + desc = "Build & run (docker)", + }, + { + "dba", + function() + require("devcontainer.commands").docker_build_run_and_attach() + end, + desc = "Build & attach (docker)", + }, + { + "ds", + function() + require("devcontainer.commands").start_auto() + end, + desc = "Start (docker)", + }, + { + "da", + function() + require("devcontainer.commands").attach_auto() + end, + desc = "Attach (docker)", + }, + { + "drr", + function() + require("devcontainer.commands").exec("devcontainer", "ls", { on_success = function(result) end }) + end, + desc = "Execute (docker)", + }, + { + "dx", + function() + require("devcontainer.commands").stop_auto() + end, + desc = "Stop (docker)", + }, + { + "dX", + function() + require("devcontainer.commands").stop_all() + end, + desc = "Stop all (docker)", + }, + { + "dD", + function() + require("devcontainer.commands").remove_all() + end, + desc = "Remove all (docker)", + }, + { + "dol", + function() + require("devcontainer.commands").open_logs() + end, + desc = "Open logs (docker)", + }, + { + "doc", + function() + require("devcontainer.commands").open_nearest_devcontainer_config() + end, + desc = "Open nearest config (docker)", + }, + { + "de", + function() + require("devcontainer.commands").edit_devcontainer_config() + end, + desc = "Edit nearest config (docker)", + }, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/git.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/git.lua new file mode 100644 index 0000000..99f77bd --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/git.lua @@ -0,0 +1,215 @@ +return { + { + "moyiz/git-dev.nvim", + event = "VeryLazy", + opts = {}, + config = function() + require("git-dev").setup() + + local function copy_git_repo_url() + -- Get the Git repository root + local git_root = vim.fn.system("git rev-parse --show-toplevel"):gsub("\n", "") + if git_root == "" then + vim.notify("Not inside a Git repository", vim.log.levels.WARN) + return nil + end + + -- Get the remote URL + local remote_url = vim.fn.system("git config --get remote.origin.url"):gsub("\n", "") + if remote_url == "" then + vim.notify("No remote URL found", vim.log.levels.WARN) + return nil + end + + -- Convert SSH URL to HTTPS if needed + if remote_url:match("^git@") then + remote_url = remote_url:gsub("git@", "https://"):gsub(":", "/") + end + + -- Remove `.git` from the remote URL + remote_url = remote_url:gsub("%.git$", "") + + -- Get the relative path of the current file + local file_path = vim.fn.expand("%:~:.") + if file_path == "" then + vim.notify("No file currently open", vim.log.levels.WARN) + return nil + end + + -- Get the relative path to the repository root + local relative_path = + vim.fn.system("git ls-files --full-name " .. vim.fn.shellescape(file_path)):gsub("\n", "") + + -- Combine the remote URL with the relative file path + local full_url = remote_url .. "/" .. relative_path + + -- Copy to clipboard + vim.fn.setreg("+", full_url) + vim.notify("Copied to clipboard: " .. full_url, vim.log.levels.INFO) + + return full_url + end + + -- Keybinding to copy the Git repository URL + vim.keymap.set("n", "cg", function() + copy_git_repo_url() + end, { desc = "Copy git repository URL to clipboard" }) + + -- Function to open a repository from the clipboard + vim.keymap.set("n", "eg", function() + local url = vim.fn.getreg("+") -- Get URL from clipboard + if not url or url == "" then + vim.notify("Clipboard is empty. Copy a valid URL first.", vim.log.levels.WARN) + return + end + if url:match("^https://") then + require("git-dev").open(url) + else + vim.notify("Not a valid URL: " .. url, vim.log.levels.ERROR) + end + end, { desc = "Open Git repository from clipboard" }) + end, + }, + { + "lewis6991/gitsigns.nvim", + opts = { + signs = { + add = { text = "▎" }, + change = { text = "▎" }, + delete = { text = "" }, + topdelete = { text = "" }, + changedelete = { text = "▎" }, + untracked = { text = "▎" }, + }, + signs_staged = { + add = { text = "▎" }, + change = { text = "▎" }, + delete = { text = "" }, + topdelete = { text = "" }, + changedelete = { text = "▎" }, + }, + on_attach = function(buffer) + local gs = package.loaded.gitsigns + + local function map(mode, l, r, desc) + vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc }) + end + + -- stylua: ignore start + map("n", "]h", function() + if vim.wo.diff then + vim.cmd.normal({ "]c", bang = true }) + else + gs.nav_hunk("next") + end + end, "Next hunk") + map("n", "[h", function() + if vim.wo.diff then + vim.cmd.normal({ "[c", bang = true }) + else + gs.nav_hunk("prev") + end + end, "Previous hunk") + map("n", "]H", function() gs.nav_hunk("last") end, "Last hunk") + map("n", "[H", function() gs.nav_hunk("first") end, "First hunk") + map({ "n", "v" }, "gs", ":Gitsigns stage_hunk", "Stage hunk") + map({ "n", "v" }, "gr", ":Gitsigns reset_hunk", "Reset hunk") + map("n", "gS", gs.stage_buffer, "Stage buffer") + map("n", "gu", gs.undo_stage_hunk, "Undo stage hunk") + map("n", "gR", gs.reset_buffer, "Reset buffer") + map("n", "gpv", gs.preview_hunk_inline, "Preview hunk inline") + map("n", "gb", function() gs.blame_line({ full = true }) end, "Blame line") + map("n", "gB", function() gs.blame() end, "Blame buffer") + map("n", "gd", gs.diffthis, "Diff this") + map("n", "gD", function() gs.diffthis("~") end, "Diff this ~") + -- map("n", "gD", function() gs.diffthis("@") end, "Diff this @") + map({ "o", "x" }, "ih", ":Gitsigns select_hunk", "GitSigns select hunk") + map("n", "gtb", gs.toggle_current_line_blame, "Toggle line blame") + map("n", "gtd", gs.toggle_deleted, "Toggle delete") + end, + }, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v", "x" }, + { "g", group = "Git" }, + { "gt", group = "Toggle" }, + }) + end, + }, + { + "kdheepak/lazygit.nvim", + cmd = { + "LazyGit", + "LazyGitConfig", + "LazyGitCurrentFile", + "LazyGitFilter", + "LazyGitFilterCurrentFile", + }, + -- optional for floating window border decoration + dependencies = { + "nvim-lua/plenary.nvim", + }, + -- setting the keybinding for LazyGit with 'keys' is recommended in + -- order to load the plugin when the command is run for the first time + keys = { + { "gg", "LazyGit", desc = "Lazygit" }, + }, + }, + { + "mbbill/undotree", + config = function() + vim.keymap.set("n", "gu", vim.cmd.UndotreeToggle, { desc = "Undo tree" }) + end, + }, + { + "tpope/vim-fugitive", + config = function() + local TheSiahxyz_Fugitive = vim.api.nvim_create_augroup("TheSiahxyz_Fugitive", {}) + local autocmd = vim.api.nvim_create_autocmd + autocmd("BufWinEnter", { + group = TheSiahxyz_Fugitive, + pattern = "*", + callback = function() + if vim.bo.ft ~= "fugitive" then + return + end + + local bufnr = vim.api.nvim_get_current_buf() + vim.keymap.set("n", "P", function() + vim.cmd.Git("push") + end, { buffer = bufnr, remap = false, desc = "Git push" }) + vim.keymap.set("n", "p", function() + vim.cmd.Git({ "pull", "--rebase" }) + end, { buffer = bufnr, remap = false, desc = "Git pull" }) + vim.keymap.set( + "n", + "o", + ":Git push -u origin ", + { buffer = bufnr, remap = false, desc = "Git push origin" } + ) + vim.keymap.set( + "n", + "h", + ":Git push home ", + { buffer = bufnr, remap = false, desc = "Git push home" } + ) + end, + }) + autocmd("FileType", { + group = TheSiahxyz_Fugitive, + pattern = "fugitive", + callback = function(event) + vim.bo[event.buf].buflisted = false + vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true }) + end, + }) + end, + keys = { + { mode = "n", "g", ":Git ", desc = "Git" }, + { mode = "n", "gf", vim.cmd.Git, desc = "Git fugitive" }, + { mode = "n", "gm", "diffget //2", desc = "Git diff on my side" }, + { mode = "n", "go", "diffget //3", desc = "Git diff on their side" }, + }, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/goyo.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/goyo.lua new file mode 100644 index 0000000..86b9a03 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/goyo.lua @@ -0,0 +1,39 @@ +return { + "junegunn/goyo.vim", + dependencies = "junegunn/seoul256.vim", + config = function() + -- Enable Goyo by default for mutt writing + vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + group = vim.api.nvim_create_augroup("TheSiahxyz_goyo_config", { clear = true }), + pattern = "/tmp/neomutt*", + callback = function() + vim.g.goyo_width = 80 + vim.g.seoul256_background = 235 + vim.cmd([[ + Goyo + set bg=light + set linebreak + set wrap + set textwidth=0 + set wrapmargin=0 + set background=dark + colorscheme seoul256 + ]]) + vim.api.nvim_buf_set_keymap( + 0, + "n", + "gd", + ":Goyo|x!", + { noremap = true, silent = true, desc = "Goyo quit" } + ) + vim.api.nvim_buf_set_keymap( + 0, + "n", + "gq", + ":Goyo|q!", + { noremap = true, silent = true, desc = "Goyo abort" } + ) + end, + }) + end, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/grug-far.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/grug-far.lua new file mode 100644 index 0000000..ca0de7d --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/grug-far.lua @@ -0,0 +1,31 @@ +return { + "MagicDuck/grug-far.nvim", + --- Ensure existing keymaps and opts remain unaffected + config = function(_, opts) + require("grug-far").setup(opts) + vim.api.nvim_create_autocmd("FileType", { + pattern = "grug-far", + callback = function() + -- Map to quit after ensuring we're in normal mode + vim.keymap.set({ "i", "n" }, "", "stopinsert | bd!", { buffer = true }) + end, + }) + end, + keys = { + { + "rc", + function() + local grug = require("grug-far") + local ext = vim.bo.buftype == "" and vim.fn.expand("%:e") + grug.open({ + transient = true, + prefills = { + filesFilter = ext and ext ~= "" and "*." .. ext or nil, + }, + }) + end, + mode = { "n", "v" }, + desc = "Search and Replace", + }, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/harpoon2.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/harpoon2.lua new file mode 100644 index 0000000..1db778f --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/harpoon2.lua @@ -0,0 +1,124 @@ +return { + "ThePrimeagen/harpoon", + branch = "harpoon2", + opts = { + menu = { + width = vim.api.nvim_win_get_width(0) - 4, + }, + settings = { + save_on_toggle = true, + sync_on_ui_close = false, -- save over session + key = function() -- define how to identify list + return vim.loop.cwd() + end, + }, + }, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n" }, + { "h", group = "Harpoon" }, + { "hr", group = "Replace harpoon slot" }, + { "", group = "Harpoon list delete" }, + }) + end, + config = function(_, opts) + local harpoon = require("harpoon") + local extensions = require("harpoon.extensions") + + -- Apply the base configuration + harpoon.setup(opts) + + -- Extend functionality + harpoon:extend({ + UI_CREATE = function(cx) + vim.keymap.set("n", "", function() + harpoon.ui:select_menu_item({ vsplit = true }) + end, { buffer = cx.bufnr }) + + vim.keymap.set("n", "", function() + harpoon.ui:select_menu_item({ split = true }) + end, { buffer = cx.bufnr }) + + vim.keymap.set("n", "", function() + harpoon.ui:select_menu_item({ tabedit = true }) + end, { buffer = cx.bufnr }) + end, + }) + + -- Highlight current file + harpoon:extend(extensions.builtins.highlight_current_file()) + harpoon:extend(extensions.builtins.navigate_with_number()) + end, + keys = function() + local keys = { + { + "ha", + function() + require("harpoon"):list():add() + end, + mode = { "n", "i", "v", "x" }, + desc = "Add buffer to harpoon list", + }, + { + "ht", + function() + require("harpoon"):list():prepend() + end, + mode = { "n", "i", "v", "x" }, + desc = "Prepend buffer to harpoon list", + }, + { + "", + function() + local harpoon = require("harpoon") + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, + mode = { "n", "i" }, + desc = "Open harpoon list menu", + }, + { + "", + function() + require("harpoon"):list():prev({ ui_nav_wrap = false }) + end, + mode = { "n", "i", "v", "x" }, + desc = "Previous harpoon list", + }, + { + "", + function() + require("harpoon"):list():next({ ui_nav_wrap = false }) + end, + mode = { "n", "i", "v", "x" }, + desc = "Next harpoon list", + }, + } + + for i = 0, 9 do + table.insert(keys, { + "", + function() + require("harpoon"):list():select(i) + end, + desc = "Harpoon list " .. i, + }) + table.insert(keys, { + "h" .. i, + function() + require("harpoon"):list():select(i) + end, + desc = "Harpoon list " .. i, + }) + table.insert(keys, { + "hr" .. i, + function() + require("harpoon"):list():replace_at(i) + end, + desc = "Replace buffer at harpoon slot " .. i, + }) + end + + return keys + end, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/image.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/image.lua new file mode 100644 index 0000000..a4f126f --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/image.lua @@ -0,0 +1,210 @@ +return { + "HakonHarnes/img-clip.nvim", + event = "VeryLazy", + opts = { + -- add options here + -- or leave it empty to use the default settings + }, + config = function(_, opts) + require("img-clip").setup(opts) + + vim.keymap.set({ "n", "v", "i" }, "", function() + local pasted_image = require("img-clip").paste_image() + if pasted_image then + -- "Update" saves only if the buffer has been modified since the last save + vim.cmd("silent! update") + -- Get the current line + local line = vim.api.nvim_get_current_line() + -- Move cursor to end of line + vim.api.nvim_win_set_cursor(0, { vim.api.nvim_win_get_cursor(0)[1], #line }) + -- I reload the file, otherwise I cannot view the image after pasted + vim.cmd("edit!") + end + end, { desc = "Paste image from clipboard" }) + + vim.keymap.set("n", "oi", function() + local function get_image_path() + -- Get the current line + local line = vim.api.nvim_get_current_line() + -- Patterns to match image paths + local patterns = { + "%[.-%]%((.-)%)", -- Markdown style: ![alt text](image_path) + "%[%[(.-)%]%]", -- Double square brackets: [[image_path]] + } + + for _, pattern in ipairs(patterns) do + local _, _, image_path = string.find(line, pattern) + if image_path then + return image_path + end + end + + return nil -- Return nil if no pattern matches + end + + local function file_exists(filepath) + -- Check if the file exists + local f = io.open(filepath, "r") + if f then + f:close() + return true + end + return false + end + + -- Get the image path + local image_path = get_image_path() + if image_path then + -- Check if the image path starts with "http" or "https" + if string.sub(image_path, 1, 4) == "http" then + print("URL image, use 'gx' to open it in the default browser.") + else + -- Construct absolute image path + local current_file_path = vim.fn.expand("%:p:h") + local absolute_image_path = current_file_path .. "/" .. image_path + -- Check if the image exists in the current path + if not file_exists(absolute_image_path) then + -- If not found, search ../Screenshots/ + local fallback_path = vim.fn.fnamemodify(current_file_path, ":h") + .. "/Screenshots/" + .. image_path + if file_exists(fallback_path) then + absolute_image_path = fallback_path + else + print("Image not found in either current directory or ../Screenshots/") + return + end + end + -- Construct command to open image in Preview + local command = "nsxiv -aiop " .. vim.fn.shellescape(absolute_image_path) + -- Execute the command + local success = os.execute(command) + if success then + print("Opened image: " .. absolute_image_path) + else + print("Failed to open image: " .. absolute_image_path) + end + end + else + print("No image found under the cursor") + end + end, { desc = "Open image under cursor" }) + + vim.keymap.set("n", "di", function() + local function get_image_path() + local line = vim.api.nvim_get_current_line() + -- Patterns to match image paths + local patterns = { + "%[.-%]%((.-)%)", -- Markdown style: ![alt text](image_path) + "%[%[(.-)%]%]", -- Double square brackets: [[image_path]] + } + + for _, pattern in ipairs(patterns) do + local _, _, image_path = string.find(line, pattern) + if image_path then + return image_path + end + end + + return nil -- Return nil if no pattern matches + end + + local function file_exists(filepath) + local f = io.open(filepath, "r") + if f then + f:close() + return true + end + return false + end + + local image_path = get_image_path() + if image_path then + if string.sub(image_path, 1, 4) == "http" then + vim.api.nvim_echo({ { "URL image cannot be deleted from disk.", "WarningMsg" } }, false, {}) + return + end + + local current_file_path = vim.fn.expand("%:p:h") + local absolute_image_path = current_file_path .. "/" .. image_path + + -- Check if file exists + if not file_exists(absolute_image_path) then + -- Search fallback directory + local fallback_path = vim.fn.fnamemodify(current_file_path, ":h") .. "/Screenshots/" .. image_path + if file_exists(fallback_path) then + absolute_image_path = fallback_path + else + print("Image not found in either current directory or ../Screenshots/") + return + end + end + + -- Verify if trash utility exists + if vim.fn.executable("trash") == 0 then + vim.api.nvim_echo({ + { "- Trash utility not installed. Install `trash-cli`.\n", "ErrorMsg" }, + }, false, {}) + return + end + + vim.ui.select({ "yes", "no" }, { prompt = "Delete image file? " }, function(choice) + if choice == "yes" then + -- Attempt to delete using trash + local command = { "trash", absolute_image_path } + local success, err = pcall(vim.fn.system, command) + + -- Debug message for troubleshooting + print("Debug: Trash command -", table.concat(command, " ")) + + if success and vim.fn.filereadable(absolute_image_path) == 0 then + vim.api.nvim_echo({ + { "Image file deleted using trash:\n", "Normal" }, + { absolute_image_path, "Normal" }, + }, false, {}) + require("image").clear() + vim.cmd("edit!") + vim.cmd("normal! dd") + else + -- If trash fails, log the error + vim.api.nvim_echo({ + { "Trash deletion failed. Error:\n", "ErrorMsg" }, + { err or "Unknown error", "ErrorMsg" }, + }, false, {}) + end + else + vim.api.nvim_echo({ { "Image deletion canceled.", "Normal" } }, false, {}) + end + end) + else + print("No image found under the cursor") + end + end, { desc = "Delete image file under cursor" }) + + -- Refresh the images in the current buffer + -- Useful if you delete an actual image file and want to see the changes + -- without having to re-open neovim + vim.keymap.set("n", "ir", function() + -- First I clear the images + require("image").clear() + -- I'm using [[ ]] to escape the special characters in a command + -- vim.cmd([[lua require("image").clear()]]) + -- Reloads the file to reflect the changes + vim.cmd("edit!") + print("Images refreshed") + end, { desc = "Refresh images" }) + + -- Set up a keymap to clear all images in the current buffer + vim.keymap.set("n", "ic", function() + -- This is the command that clears the images + require("image").clear() + -- I'm using [[ ]] to escape the special characters in a command + -- vim.cmd([[lua require("image").clear()]]) + print("Images cleared") + end, { desc = "Clear images" }) + end, + keys = { + -- suggested keymap + { "pi", "PasteImage", desc = "Paste image from clipboard" }, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/init.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/init.lua new file mode 100644 index 0000000..1a533b9 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/init.lua @@ -0,0 +1,87 @@ +return { + { "nvim-lua/plenary.nvim" }, + { + "aserowy/tmux.nvim", + config = function() + require("tmux").setup({ + copy_sync = { + -- enables copy sync. by default, all registers are synchronized. + -- to control which registers are synced, see the `sync_*` options. + enable = false, + + -- ignore specific tmux buffers e.g. buffer0 = true to ignore the + -- first buffer or named_buffer_name = true to ignore a named tmux + -- buffer with name named_buffer_name :) + ignore_buffers = { empty = false }, + + -- TMUX >= 3.2: all yanks (and deletes) will get redirected to system + -- clipboard by tmux + redirect_to_clipboard = false, + + -- offset controls where register sync starts + -- e.g. offset 2 lets registers 0 and 1 untouched + register_offset = 0, + + -- overwrites vim.g.clipboard to redirect * and + to the system + -- clipboard using tmux. If you sync your system clipboard without tmux, + -- disable this option! + sync_clipboard = true, + + -- synchronizes registers *, +, unnamed, and 0 till 9 with tmux buffers. + sync_registers = true, + + -- synchronizes registers when pressing p and P. + sync_registers_keymap_put = true, + + -- synchronizes registers when pressing (C-r) and ". + sync_registers_keymap_reg = true, + + -- syncs deletes with tmux clipboard as well, it is adviced to + -- do so. Nvim does not allow syncing registers 0 and 1 without + -- overwriting the unnamed register. Thus, ddp would not be possible. + sync_deletes = true, + + -- syncs the unnamed register with the first buffer entry from tmux. + sync_unnamed = true, + }, + navigation = { + -- cycles to opposite pane while navigating into the border + cycle_navigation = false, + + -- enables default keybindings (C-hjkl) for normal mode + enable_default_keybindings = true, + + -- prevents unzoom tmux when navigating beyond vim border + persist_zoom = true, + }, + resize = { + -- enables default keybindings (A-hjkl) for normal mode + enable_default_keybindings = false, + + -- sets resize steps for x axis + resize_step_x = 2, + + -- sets resize steps for y axis + resize_step_y = 2, + }, + }) + + vim.keymap.set("i", "", "lua require('tmux').move_left()", { desc = "Move to left" }) + vim.keymap.set("i", "", "lua require('tmux').move_right()", { desc = "Move to right" }) + vim.keymap.set("i", "", "lua require('tmux').move_bottom()", { desc = "Move to bottom" }) + vim.keymap.set("i", "", "lua require('tmux').move_top()", { desc = "Move to top" }) + vim.keymap.set("n", "", function() + require("tmux").resize_left() + end, { desc = "Decrease window width" }) + vim.keymap.set("n", "", function() + require("tmux").resize_bottom() + end, { desc = "Decrease window height" }) + vim.keymap.set("n", "", function() + require("tmux").resize_top() + end, { desc = "Increase window height" }) + vim.keymap.set("n", "", function() + require("tmux").resize_right() + end, { desc = "Increase window width" }) + end, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/keys.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/keys.lua new file mode 100644 index 0000000..0f95202 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/keys.lua @@ -0,0 +1,121 @@ +return { + { + "nvzone/showkeys", + cmd = "ShowkeysToggle", + opts = {}, + keys = { + { "zk", "ShowkeysToggle", desc = "Toggle keys" }, + }, + }, + { + "folke/which-key.nvim", + event = "VeryLazy", + cmd = "WhichKey", + dependencies = { "echasnovski/mini.icons", "nvim-tree/nvim-web-devicons" }, + opts = { + preset = "classic", -- false | "classic" | "modern" | "helix" + keys = { + scroll_down = "", + scroll_up = "", + }, + }, + config = function(_, opts) + local wk = require("which-key") + wk.setup(opts) + wk.add({ + { + mode = { "n", "v" }, + { "g", group = "Goto" }, + { "g`", group = "Marks" }, + { "g'", group = "Marks" }, + { "gr", group = "Lsp buf" }, + { "gs", group = "Search/Surround" }, + { "gx", desc = "Open with system app" }, + { "s", group = "Surround/Search & replace on line" }, + { "S", group = "Surround/Search & replace in file" }, + { "z", group = "Fold" }, + { "`", group = "Marks" }, + { "'", group = "Marks" }, + { '"', group = "Registers" }, + { "]", group = "Next" }, + { "]]", group = "Next" }, + { "[", group = "Prev" }, + { "[[", group = "Prev" }, + { "=", group = "Line paste" }, + { "", group = "Windows" }, + { "", group = "Leader" }, + { "a", group = "Ascii" }, + { + "b", + group = "Buffer", + expand = function() + return require("which-key.extras").expand.buf() + end, + }, + { "B", group = "Buffer (force)" }, + { "C", group = "Goto realpath" }, + { "d", group = "Delete" }, + { "D", group = "Delete (blackhole)" }, + { "e", group = "Explorer" }, + { "i", group = "Inspect" }, + { "l", group = "Location" }, + { "L", group = "Lazy" }, + { "M", group = "Mason" }, + { "o", group = "Open" }, + { "p", group = "Paste" }, + { "P", group = "Paste" }, + { "q", group = "Quit" }, + { "rn", group = "Rename" }, + { "sk", group = "Keys" }, + { "S", group = "Save/Source" }, + { "w", group = "Which-key" }, + { "W", group = "Save all" }, + { "z", group = "Toggle" }, + { "Z", group = "All buffer" }, + { "", group = "Tabs" }, + { "", group = "Local Leader (bookmarks)" }, + { "", group = "Bookmarks (explorer)" }, + { "", group = "Bookmarks (mini)" }, + { "t", group = "Task" }, + }, + { + mode = { "n", "v", "x" }, + { "gw", desc = "Visible in window" }, + { "g%", desc = "Match backward" }, + { "g;", desc = "Last change" }, + { "Q", group = "Quit all" }, + }, + { + mode = { "i" }, + { "", desc = "Execute one command" }, + { "", desc = "Paste from registers" }, + }, + }) + end, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer local keymaps (which-key)", + }, + { + "wk", + function() + local ok, input = pcall(vim.fn.input, "WhichKey: ") + if ok and input ~= "" then + vim.cmd("WhichKey " .. input) + end + end, + desc = "Which-key query lookup", + }, + { + "wK", + "WhichKey", + mode = { "n", "v", "x" }, + desc = "Which-key all key", + }, + }, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lf.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lf.lua new file mode 100644 index 0000000..3f82222 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lf.lua @@ -0,0 +1,121 @@ +return { + "lmburns/lf.nvim", + dependencies = { + { + "akinsho/toggleterm.nvim", + version = "*", + config = function() + require("toggleterm").setup({ + open_mapping = [[]], -- or { [[]], [[]] } if you also use a Japanese keyboard. + }) + vim.keymap.set( + "n", + "", + "ToggleTerm direction=float name=Terminal", + { desc = "Toggle float terminal" } + ) + vim.keymap.set( + "n", + "", + "ToggleTermToggleAll", + { desc = "Toggle all float terminals" } + ) + vim.keymap.set("n", "", "TermSelect", { desc = "Select float terminal" }) + + local function set_opfunc(opfunc) + _G._opfunc = opfunc -- Define the function globally + vim.go.operatorfunc = "v:lua._opfunc" -- Assign the global function + end + + local trim_spaces = false + vim.keymap.set("v", "", function() + require("toggleterm").send_lines_to_terminal("single_line", trim_spaces, { args = vim.v.count }) + end, { desc = "Send line to terminal" }) + -- Replace with these for the other two options + -- require("toggleterm").send_lines_to_terminal("visual_lines", trim_spaces, { args = vim.v.count }) + -- require("toggleterm").send_lines_to_terminal("visual_selection", trim_spaces, { args = vim.v.count }) + + -- For use as an operator map: + -- Send motion to terminal + vim.keymap.set("n", "", function() + set_opfunc(function(motion_type) + require("toggleterm").send_lines_to_terminal(motion_type, false, { args = vim.v.count }) + end) + vim.api.nvim_feedkeys("g@", "n", false) + end, { desc = "Send motions to terminal" }) + -- Double the command to send line to terminal + vim.keymap.set("n", "", function() + set_opfunc(function(motion_type) + require("toggleterm").send_lines_to_terminal(motion_type, false, { args = vim.v.count }) + end) + vim.api.nvim_feedkeys("g@_", "n", false) + end, { desc = "Send double command to terminal" }) + -- Send whole file + vim.keymap.set("n", "", function() + set_opfunc(function(motion_type) + require("toggleterm").send_lines_to_terminal(motion_type, false, { args = vim.v.count }) + end) + vim.api.nvim_feedkeys("ggg@G''", "n", false) + end, { desc = "Send whole file to terminal (clipboard)" }) + end, + }, + }, + config = function() + vim.g.lf_netrw = 1 + local fn = vim.fn + + -- Defaults + require("lf").setup({ + default_action = "drop", -- Default action when `Lf` opens a file + default_actions = { + ["e"] = "tabedit", + [""] = "tab drop", + [""] = "vsplit", + [""] = "split", + }, + winblend = 0, -- Pseudotransparency level + direction = "float", -- Window type + border = "rounded", -- Border kind + height = fn.float2nr(fn.round(0.75 * vim.o.lines)), -- Height of the *floating* window + width = fn.float2nr(fn.round(0.75 * vim.o.columns)), -- Width of the *floating* window + escape_quit = true, -- Map escape to the quit command + focus_on_open = true, -- Focus the current file when opening Lf + mappings = true, -- Enable terminal buffer mapping + tmux = true, -- Tmux statusline can be disabled + disable_netrw_warning = true, -- Don't display a message when opening a directory + highlights = { + Normal = { link = "Normal" }, -- Use normal highlighting + NormalFloat = { link = "NormalFloat" }, -- Use float highlighting + FloatBorder = { link = "@constant" }, -- Use constant highlighting + }, + + -- Layout configurations + layout_mapping = "", -- Resize window with this key + views = { + { width = 0.800, height = 0.800 }, + { width = 0.600, height = 0.600 }, + { width = 0.950, height = 0.950 }, + { width = 0.500, height = 0.500, col = 0, row = 0 }, + { width = 0.500, height = 0.500, col = 0, row = 0.5 }, + { width = 0.500, height = 0.500, col = 0.5, row = 0 }, + { width = 0.500, height = 0.500, col = 0.5, row = 0.5 }, + }, + }) + + vim.keymap.set("n", "el", "Lf") + + -- Autocommand to set key mapping in terminal buffer + vim.api.nvim_create_autocmd("User", { + pattern = "LfTermEnter", + callback = function(a) + vim.api.nvim_buf_set_keymap( + a.buf, + "t", + "q", + "q", + { nowait = true, noremap = true, silent = true } + ) + end, + }) + end, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lsp.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lsp.lua new file mode 100644 index 0000000..8beb058 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lsp.lua @@ -0,0 +1,681 @@ +return { + { + "neovim/nvim-lspconfig", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "mason-org/mason.nvim", + "mason-org/mason-lspconfig.nvim", + "WhoIsSethDaniel/mason-tool-installer.nvim", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "hrsh7th/nvim-cmp", + { + "L3MON4D3/LuaSnip", + version = "v2.*", + build = "make install_jsregexp", + }, + "mfussenegger/nvim-lint", + "saadparwaiz1/cmp_luasnip", + "j-hui/fidget.nvim", + { "folke/neoconf.nvim", cmd = "Neoconf", config = false, dependencies = { "nvim-lspconfig" } }, + { + "folke/lazydev.nvim", + ft = "lua", -- only load on lua files + opts = { + library = { + -- See the configuration section for more details + -- Load luvit types when the `vim.uv` word is found + { path = "${3rd}/luv/library", words = { "vim%.uv" } }, + }, + }, + }, + "stevearc/conform.nvim", + }, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v", "x" }, + { "tf", group = "Format" }, + }) + end, + config = function() + local cmp = require("cmp") + local cmp_lsp = require("cmp_nvim_lsp") + local capabilities = vim.tbl_deep_extend( + "force", + {}, + vim.lsp.protocol.make_client_capabilities(), + cmp_lsp.default_capabilities() + ) + local lspconfig = require("lspconfig") + + require("fidget").setup({ + progress = { + poll_rate = false, -- How and when to poll for progress messages + suppress_on_insert = true, -- Suppress new messages while in insert mode + ignore_done_already = true, -- Ignore new tasks that are already complete + ignore_empty_message = true, -- Ignore new tasks that don't contain a message + clear_on_detach = function(client_id) -- Clear notification group when LSP server detaches + local client = vim.lsp.get_client_by_id(client_id) + return client and client.name or nil + end, + -- ignore = { "lua_ls" }, + }, + notification = { + window = { + normal_hl = "Comment", -- Base highlight group in the notification window + winblend = 0, -- Background color opacity in the notification window + border = "none", -- Border around the notification window + zindex = 45, -- Stacking priority of the notification window + max_width = 0, -- Maximum width of the notification window + max_height = 0, -- Maximum height of the notification window + x_padding = 1, -- Padding from right edge of window boundary + y_padding = 0, -- Padding from bottom edge of window boundary + align = "bottom", -- How to align the notification window + relative = "editor", -- What the notification window position is relative to + }, + }, + integration = { + ["nvim-tree"] = { + enable = false, -- Integrate with nvim-tree/nvim-tree.lua (if installed) + }, + }, + }) + + require("mason").setup() + require("mason-lspconfig").setup({ + ensure_installed = { + "bashls", + "dockerls", + "docker_compose_language_service", + "harper_ls", + "jdtls", + "jsonls", + "lua_ls", + "mutt_ls", + "pyright", + "ruff", + "ts_ls", + }, + automatic_installation = true, + handlers = { + function(server_name) -- default handler (optional) + require("lspconfig")[server_name].setup({ + capabilities = capabilities, + }) + end, + ["bashls"] = function() + lspconfig.bashls.setup({ + capabilities = capabilities, + }) + end, + ["dockerls"] = function() + lspconfig.dockerls.setup({ + capabilities = capabilities, + -- settings = { + -- python = { + -- disableLanguageServices = false, + -- disableOrganizeImports = false, + -- }, + -- }, + }) + end, + ["docker_compose_language_service"] = function() + lspconfig.docker_compose_language_service.setup({ + capabilities = capabilities, + -- settings = { + -- python = { + -- disableLanguageServices = false, + -- disableOrganizeImports = false, + -- }, + -- }, + }) + end, + ["harper_ls"] = function() + lspconfig.harper_ls.setup({ + capabilities = capabilities, + filetypes = { "markdown", "python" }, + settings = { + ToDoHyphen = false, + -- SentenceCapitalization = true, + -- SpellCheck = true, + isolateEnglish = true, + markdown = { + -- [ignores this part]() + -- [[ also ignores my marksman links ]] + IgnoreLinkTitle = true, + }, + }, + }) + end, + ["jdtls"] = function() + lspconfig.jdtls.setup({ + capabilities = capabilities, + }) + end, + ["jsonls"] = function() + lspconfig.jsonls.setup({ + capabilities = capabilities, + settings = { + json = { + format = { + enable = true, + }, + validate = { enable = true }, + }, + }, + }) + end, + ["lua_ls"] = function() + lspconfig.lua_ls.setup({ + capabilities = capabilities, + settings = { + Lua = { + runtime = { version = "Lua 5.4" }, + diagnostics = { + globals = { "bit", "vim", "it", "describe", "before_each", "after_each" }, + }, + }, + }, + }) + end, + ["mutt_ls"] = function() + lspconfig.mutt_ls.setup({ + capabilities = capabilities, + }) + end, + ["pyright"] = function() + lspconfig.pyright.setup({ + capabilities = capabilities, + settings = { + python = { + disableLanguageServices = false, + disableOrganizeImports = false, + }, + }, + }) + end, + ["ruff"] = function() + lspconfig.ruff.setup({ + capabilities = capabilities, + -- settings = { + -- python = { + -- disableLanguageServices = false, + -- disableOrganizeImports = false, + -- }, + -- }, + }) + end, + ["ts_ls"] = function() + lspconfig.ruff.setup({ + capabilities = capabilities, + }) + end, + }, + }) + + local lint = require("lint") + lint.linters_by_ft = { + dockerfile = { "hadolint" }, + javascript = { "eslint_d" }, + typescript = { "eslint_d" }, + javascriptreact = { "eslint_d" }, + typescriptreact = { "eslint_d" }, + svelte = { "eslint_d" }, + python = { "pylint" }, + sh = { "shellcheck" }, + } + + local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) + vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave", "TextChanged" }, { + group = lint_augroup, + callback = function() + lint.try_lint() + end, + }) + + require("mason-tool-installer").setup({ + ensure_installed = { + "beautysh", -- zsh formatter + "black", -- python formatter + "debugpy", -- python debuger + "eslint_d", -- eslint linter + "hadolint", -- docker linter + "isort", -- python formatter + "java-debug-adapter", -- java debugger + "java-test", -- java test + "js-debug-adapter", -- javascript debugger + "markdown-toc", -- markdown toc + "prettier", -- prettier formatter + "pylint", -- python linter + "ruff", -- python formatter + "shellcheck", -- bash lint + "shfmt", -- sh formatter + "stylua", -- lua formatter + }, + integrations = { + ["mason-lspconfig"] = true, + ["mason-null-ls"] = false, + ["mason-nvim-dap"] = true, + }, + }) + + local cmp_select = { behavior = cmp.SelectBehavior.Select } + local luasnip = require("luasnip") + + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), -- Up + [""] = cmp.mapping.scroll_docs(4), -- Down + [""] = cmp.mapping.select_prev_item(cmp_select), + [""] = cmp.mapping.select_next_item(cmp_select), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + 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" }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, -- For luasnip users. + { name = "buffer" }, + }), + }) + + vim.diagnostic.config({ + update_in_insert = true, + float = { + header = "", + border = "rounded", + prefix = "", + source = "if_many", + }, + }) + + require("conform").setup({ + formatters_by_ft = { + bash = { "shfmt" }, + css = { "prettier" }, + graphql = { "prettier" }, + html = { "prettier" }, + javascript = { "prettier" }, + javascriptreact = { "prettier" }, + json = { "prettier" }, + liquid = { "prettier" }, + lua = { "stylua" }, + markdown = { "prettier" }, + python = { "ruff", "isort", "black" }, + sh = { "shfmt" }, + svelte = { "prettier" }, + typescript = { "prettier" }, + typescriptreact = { "prettier" }, + vimwiki = { "prettier" }, + yaml = { "prettier" }, + zsh = { "beautysh" }, + }, + default_format_opts = {}, + format_on_save = function(bufnr) + -- Disable with a global or buffer-local variable + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + return { lsp_format = "fallback", timeout_ms = 1000, async = false } + end, + }) + + vim.api.nvim_create_user_command("FormatDisable", function(args) + if args.bang then + vim.b.disable_autoformat = true + else + vim.g.disable_autoformat = true + end + end, { + desc = "Disable autoformat-on-save", + bang = true, + }) + vim.api.nvim_create_user_command("FormatEnable", function() + vim.b.disable_autoformat = false + vim.g.disable_autoformat = false + end, { + desc = "Re-enable autoformat-on-save", + }) + end, + keys = { + { + "lf", + function() + require("conform").format({ async = true }) + end, + mode = { "n", "v" }, + desc = "Format buffer by lsp", + }, + { + "ci", + "PyrightOrganizeImports", + desc = "Organize imports", + }, + { + "bl", + function() + require("lint").try_lint() + end, + desc = "Buffer lint", + }, + { + "le", + "FormatEnable", + desc = "Enable format", + }, + { + "ld", + "FormatDisable", + desc = "Disable format", + }, + { + "lD", + "FormatDisable!", + desc = "Disable current buffer format", + }, + }, + }, + -- { + -- "neovim/nvim-lspconfig", + -- event = { "BufReadPre", "BufNewFile" }, + -- dependencies = { + -- "mason-org/mason.nvim", + -- "mason-org/mason-lspconfig.nvim", + -- "WhoIsSethDaniel/mason-tool-installer.nvim", + -- "hrsh7th/cmp-nvim-lsp", + -- "hrsh7th/cmp-buffer", + -- "hrsh7th/cmp-path", + -- "hrsh7th/cmp-cmdline", + -- { + -- "L3MON4D3/LuaSnip", + -- version = "v2.*", + -- build = "make install_jsregexp", + -- }, + -- "mfussenegger/nvim-lint", + -- "saadparwaiz1/cmp_luasnip", + -- "j-hui/fidget.nvim", + -- { "folke/neoconf.nvim", cmd = "Neoconf", config = false, dependencies = { "nvim-lspconfig" } }, + -- { + -- "folke/lazydev.nvim", + -- ft = "lua", -- only load on lua files + -- opts = { + -- library = { + -- -- See the configuration section for more details + -- -- Load luvit types when the `vim.uv` word is found + -- { path = "${3rd}/luv/library", words = { "vim%.uv" } }, + -- }, + -- }, + -- }, + -- "stevearc/conform.nvim", + -- "saghen/blink.cmp", + -- }, + -- init = function() + -- local wk = require("which-key") + -- wk.add({ + -- mode = { "n", "v", "x" }, + -- { "tf", group = "Format" }, + -- }) + -- end, + -- opts = { + -- servers = { + -- lua_ls = { + -- settings = { + -- Lua = { + -- workspace = { + -- checkThirdParty = false, + -- }, + -- codeLens = { + -- enable = true, + -- }, + -- completion = { + -- callSnippet = "Replace", + -- }, + -- doc = { + -- privateName = { "^_" }, + -- }, + -- hint = { + -- enable = true, + -- setType = false, + -- paramType = true, + -- paramName = "Disable", + -- semicolon = "Disable", + -- arrayIndex = "Disable", + -- }, + -- runtime = { version = "Lua 5.4" }, + -- diagnostics = { + -- globals = { "bit", "vim", "it", "describe", "before_each", "after_each" }, + -- }, + -- }, + -- }, + -- }, + -- pyright = { + -- settings = { + -- python = { + -- disableLanguageServices = false, + -- disableOrganizeImports = false, + -- }, + -- }, + -- }, + -- }, + -- }, + -- config = function(_, opts) + -- local cmp = require("blink.cmp") + -- local lspconfig = require("lspconfig") + -- + -- require("mason").setup() + -- + -- for server, config in pairs(opts.servers) do + -- -- passing config.capabilities to blink.cmp merges with the capabilities in your + -- -- `opts[server].capabilities, if you've defined it + -- config.capabilities = cmp.get_lsp_capabilities(config.capabilities) + -- lspconfig[server].setup(config) + -- require("mason-lspconfig").setup({ + -- ensure_installed = { server }, + -- handlers = { + -- [server] = function() + -- lspconfig[server].setup(config) + -- end, + -- }, + -- }) + -- end + -- + -- require("fidget").setup({ + -- progress = { + -- poll_rate = 0, -- How and when to poll for progress messages + -- suppress_on_insert = true, -- Suppress new messages while in insert mode + -- ignore_done_already = true, -- Ignore new tasks that are already complete + -- ignore_empty_message = true, -- Ignore new tasks that don't contain a message + -- clear_on_detach = function(client_id) -- Clear notification group when LSP server detaches + -- local client = vim.lsp.get_client_by_id(client_id) + -- return client and client.name or nil + -- end, + -- ignore = { "lua_ls" }, + -- }, + -- notification = { + -- window = { + -- normal_hl = "Comment", -- Base highlight group in the notification window + -- winblend = 0, -- Background color opacity in the notification window + -- border = "none", -- Border around the notification window + -- zindex = 45, -- Stacking priority of the notification window + -- max_width = 0, -- Maximum width of the notification window + -- max_height = 0, -- Maximum height of the notification window + -- x_padding = 1, -- Padding from right edge of window boundary + -- y_padding = 0, -- Padding from bottom edge of window boundary + -- align = "bottom", -- How to align the notification window + -- relative = "editor", -- What the notification window position is relative to + -- }, + -- }, + -- integration = { + -- ["nvim-tree"] = { + -- enable = false, -- Integrate with nvim-tree/nvim-tree.lua (if installed) + -- }, + -- }, + -- }) + -- + -- local lint = require("lint") + -- lint.linters_by_ft = { + -- javascript = { "eslint_d" }, + -- typescript = { "eslint_d" }, + -- javascriptreact = { "eslint_d" }, + -- typescriptreact = { "eslint_d" }, + -- svelte = { "eslint_d" }, + -- python = { "pylint" }, + -- sh = { "shellcheck" }, + -- } + -- + -- local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) + -- vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave", "TextChanged" }, { + -- group = lint_augroup, + -- callback = function() + -- lint.try_lint() + -- end, + -- }) + -- + -- require("mason-tool-installer").setup({ + -- ensure_installed = { + -- "beautysh", -- zsh formatter + -- "black", -- python formatter + -- "debugpy", -- python debuger + -- "eslint_d", -- eslint linter + -- "isort", -- python formatter + -- "markdown-toc", -- markdown toc + -- "prettier", -- prettier formatter + -- "pylint", -- python linter + -- "ruff", -- python formatter + -- "shellcheck", -- bash lint + -- "shfmt", -- sh formatter + -- "stylua", -- lua formatter + -- }, + -- integrations = { + -- ["mason-lspconfig"] = true, + -- ["mason-null-ls"] = false, + -- ["mason-nvim-dap"] = true, + -- }, + -- }) + -- + -- vim.diagnostic.config({ + -- -- update_in_insert = true, + -- float = { + -- focusable = false, + -- style = "minimal", + -- border = "rounded", + -- source = "always", + -- header = "", + -- prefix = "", + -- }, + -- }) + -- + -- require("conform").setup({ + -- formatters_by_ft = { + -- bash = { "shfmt" }, + -- css = { "prettier" }, + -- graphql = { "prettier" }, + -- html = { "prettier" }, + -- javascript = { "prettier" }, + -- javascriptreact = { "prettier" }, + -- json = { "prettier" }, + -- liquid = { "prettier" }, + -- lua = { "stylua" }, + -- markdown = { "prettier" }, + -- python = { "ruff", "isort", "black" }, + -- sh = { "shfmt" }, + -- svelte = { "prettier" }, + -- typescript = { "prettier" }, + -- typescriptreact = { "prettier" }, + -- yaml = { "prettier" }, + -- zsh = { "beautysh" }, + -- }, + -- default_format_opts = {}, + -- format_on_save = function(bufnr) + -- -- Disable with a global or buffer-local variable + -- if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + -- return + -- end + -- return { lsp_format = "fallback", timeout_ms = 1000, async = false } + -- end, + -- }) + -- + -- vim.api.nvim_create_user_command("FormatDisable", function(args) + -- if args.bang then + -- vim.b.disable_autoformat = true + -- else + -- vim.g.disable_autoformat = true + -- end + -- end, { + -- desc = "Disable autoformat-on-save", + -- bang = true, + -- }) + -- vim.api.nvim_create_user_command("FormatEnable", function() + -- vim.b.disable_autoformat = false + -- vim.g.disable_autoformat = false + -- end, { + -- desc = "Re-enable autoformat-on-save", + -- }) + -- end, + -- keys = { + -- { + -- mode = { "n", "v" }, + -- "lf", + -- function() + -- require("conform").format({ async = true }) + -- end, + -- desc = "Format buffer by lsp", + -- }, + -- { + -- "ci", + -- "PyrightOrganizeImports", + -- desc = "Organize imports", + -- }, + -- { + -- "bl", + -- function() + -- require("lint").try_lint() + -- end, + -- desc = "Buffer lint", + -- }, + -- { + -- "le", + -- "FormatEnable", + -- desc = "Enable format", + -- }, + -- { + -- "ld", + -- "FormatDisable", + -- desc = "Disable format", + -- }, + -- { + -- "lD", + -- "FormatDisable!", + -- desc = "Disable current buffer format", + -- }, + -- }, + -- }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lualine.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lualine.lua new file mode 100644 index 0000000..9c4f0d9 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lualine.lua @@ -0,0 +1,273 @@ +return { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + local navic = require("nvim-navic") + require("lualine").setup({ + options = { + icons_enabled = true, + theme = "auto", + section_separators = { left = "", right = "" }, + component_separators = { left = "", right = "" }, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 100, + tabline = 100, + winbar = 100, + }, + }, + sections = { + lualine_a = { + { + "mode", + fmt = function(str) + return str:sub(1, 1) + end, + }, + { + function() + local has_noice, noice = pcall(require, "noice") + if has_noice and noice.api and noice.api.status and noice.api.status.mode then + return noice.api.status.mode.get() or "" + else + return "" + end + end, + cond = function() + local has_noice, noice = pcall(require, "noice") + return has_noice + and noice.api + and noice.api.status + and noice.api.status.mode + and noice.api.status.mode.has() + end, + color = { bg = "#ff9e64" }, + }, + }, + lualine_b = { + "branch", + { + "diff", + colored = true, -- Displays a colored diff status if set to true + diff_color = { + -- Same color values as the general color option can be used here. + added = "LuaLineDiffAdd", -- Changes the diff's added color + modified = "LuaLineDiffChange", -- Changes the diff's modified color + removed = "LuaLineDiffDelete", -- Changes the diff's removed color you + }, + symbols = { added = "+", modified = "~", removed = "-" }, -- Changes the symbols used by the diff. + source = nil, -- A function that works as a data source for diff. + -- It must return a table as such: + -- { added = add_count, modified = modified_count, removed = removed_count } + -- or nil on failure. count <= 0 won't be displayed. + }, + { + "diagnostics", + -- Table of diagnostic sources, available sources are: + -- 'nvim_lsp', 'nvim_diagnostic', 'nvim_workspace_diagnostic', 'coc', 'ale', 'vim_lsp'. + -- or a function that returns a table as such: + -- { error=error_cnt, warn=warn_cnt, info=info_cnt, hint=hint_cnt } + sources = { "nvim_lsp", "nvim_diagnostic", "nvim_workspace_diagnostic", "coc" }, + + -- Displays diagnostics for the defined severity types + sections = { "error", "warn", "info", "hint" }, + + diagnostics_color = { + -- Same values as the general color option can be used here. + error = "DiagnosticError", -- Changes diagnostics' error color. + warn = "DiagnosticWarn", -- Changes diagnostics' warn color. + info = "DiagnosticInfo", -- Changes diagnostics' info color. + hint = "DiagnosticHint", -- Changes diagnostics' hint color. + }, + symbols = { + error = " ", + warn = " ", + info = " ", + hint = " ", + }, + colored = true, -- Displays diagnostics status in color if set to true. + update_in_insert = true, -- Update diagnostics in insert mode. + always_visible = false, -- Show diagnostics even if there are none. + }, + { + function() + local ok, neocomposer = pcall(require, "NeoComposer.ui") + if ok and neocomposer and neocomposer.status_recording then + return neocomposer.status_recording() + end + return "" + end, + }, + }, + lualine_c = { + { + "filename", + file_status = true, -- Displays file status (readonly status, modified status) + newfile_status = true, -- Display new file status (new file means no write after created) + path = 3, -- 0: Just the filename + -- 1: Relative path + -- 2: Absolute path + -- 3: Absolute path, with tilde as the home directory + -- 4: Filename and parent dir, with tilde as the home directory + + shorting_target = 40, -- Shortens path to leave 40 spaces in the window + -- for other components. (terrible name, any suggestions?) + symbols = { + modified = "[*]", -- Text to show when the file is modified. + readonly = "[r]", -- Text to show when the file is non-modifiable or readonly. + unnamed = "[?]", -- Text to show for unnamed buffers. + newfile = "[%%]", -- Text to show for newly created file before first write + }, + }, + }, + lualine_x = { + { + function() + local has_noice, noice = pcall(require, "noice") + if has_noice and noice.api and noice.api.status and noice.api.status.mode then + return noice.api.status.search.get() or "" + else + return "" + end + end, + cond = function() + local has_noice, noice = pcall(require, "noice") + return has_noice + and noice.api + and noice.api.status + and noice.api.status.search + and noice.api.status.search.has() + end, + color = { bg = "#ff9e64" }, + }, + "copilot", + { + function() + return require("molten.status").initialized() + end, + }, + "encoding", + "fileformat", + { + "filetype", + colored = true, -- Displays filetype icon in color if set to true + icon_only = true, -- Display only an icon for filetype + icon = { align = "right" }, -- Display filetype icon on the right hand side + -- icon = {'X', align='right'} + -- Icon string ^ in table is ignored in filetype component + }, + }, + lualine_y = { + "progress", + }, + lualine_z = { + { + function() + local is_tmux = os.getenv("TMUX") ~= nil + if is_tmux then + return "" + end + return os.date("%H:%M") + end, + }, + }, + }, + inactive_sections = {}, + tabline = { + lualine_a = { + { + "tabs", + tab_max_length = 40, -- Maximum width of each tab. The content will be shorten dynamically (example: apple/orange -> a/orange) + max_length = vim.o.columns / 3, -- Maximum width of tabs component. + -- Note: + -- It can also be a function that returns + -- the value of `max_length` dynamically. + mode = 0, -- 0: Shows tab_nr + -- 1: Shows tab_name + -- 2: Shows tab_nr + tab_name + + path = nil, -- 0: just shows the filename + -- 1: shows the relative path and shorten $HOME to ~ + -- 2: shows the full path + -- 3: shows the full path and shorten $HOME to ~ + + -- Automatically updates active tab color to match color of other components (will be overidden if buffers_color is set) + use_mode_colors = true, + + -- tabs_color = { + -- -- Same values as the general color option can be used here. + -- active = "lualine_{section}_normal", -- Color for active tab. + -- inactive = "lualine_{section}_inactive", -- Color for inactive tab. + -- }, + -- + show_modified_status = false, -- Shows a symbol next to the tab name if the file has been modified. + symbols = { + modified = "*", -- Text to show when the file is modified. + }, + + fmt = function(name, context) + -- Show + if buffer is modified in tab + local buflist = vim.fn.tabpagebuflist(context.tabnr) + local winnr = vim.fn.tabpagewinnr(context.tabnr) + local bufnr = buflist[winnr] + local mod = vim.fn.getbufvar(bufnr, "&mod") + + return name .. (mod == 1 and " +" or "") + end, + }, + }, + lualine_b = { + { + function() + local function buffer_status() + local buffers = vim.fn.getbufinfo({ buflisted = true }) + local current_buf = vim.fn.bufnr() + local current_buffer_index = 0 + local modified_symbol = vim.bo.modified and "●" or "" + for i, buf in ipairs(buffers) do + if buf.bufnr == current_buf then + current_buffer_index = i + break + end + end + return string.format("%s%d/%d", modified_symbol, current_buffer_index, #buffers) + end + return buffer_status() + end, + }, + }, + lualine_c = { + { + function() + return navic.get_location() + end, + cond = function() + return navic.is_available() + end, + }, + }, + lualine_x = {}, + lualine_y = {}, + lualine_z = {}, + }, + winbar = {}, + inactive_winbar = {}, + extensions = {}, + }) + + local lualine_hidden = true + vim.keymap.set({ "n", "v" }, "zl", function() + lualine_hidden = not lualine_hidden + require("lualine").hide({ + place = { "statusline", "tabline", "winbar" }, + unhide = lualine_hidden, + }) + end, { desc = "Toggle lualine" }) + end, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/macro.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/macro.lua new file mode 100644 index 0000000..b69d000 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/macro.lua @@ -0,0 +1,172 @@ +return { + -- { + -- "kr40/nvim-macros", + -- lazy = false, + -- cmd = { "MacroSave", "MacroYank", "MacroSelect", "MacroDelete" }, + -- opts = {}, + -- config = function() + -- require("nvim-macros").setup({ + -- json_file_path = vim.fn.expand("~/.local/share/thesiah/macros.json"), -- Location where the macros will be stored + -- default_macro_register = "q", -- Use as default register for :MacroYank and :MacroSave and :MacroSelect Raw functions + -- json_formatter = "none", -- can be "none" | "jq" | "yq" used to pretty print the json file (jq or yq must be installed!) + -- }) + -- vim.keymap.set("n", "yQ", ":MacroYank", { desc = "Yank macro" }) + -- vim.keymap.set("n", "wQ", ":MacroSave", { desc = "Save macro" }) + -- vim.keymap.set("n", "fQ", ":MacroSelect", { desc = "Search macro" }) + -- vim.keymap.set("n", "xQ", ":MacroDelete", { desc = "Delete macro" }) + -- end, + -- }, + { + "desdic/macrothis.nvim", + opts = {}, + config = function() + require("macrothis").setup({ + datafile = (function() + local path = vim.fn.expand("~/.local/share/thesiah/macros.json") + + -- Create directory if it doesn't exist + local dir = vim.fn.fnamemodify(path, ":h") + if vim.fn.isdirectory(dir) == 0 then + vim.fn.mkdir(dir, "p") + end + + -- Create file if it doesn't exist or is empty + if vim.fn.filereadable(path) == 0 or vim.fn.getfsize(path) == 0 then + local file = io.open(path, "w") + if file then + file:write("[]") + file:close() + end + end + + return path + end)(), + run_register = "Q", -- content of register z is replaced when running/editing a macro + editor = { -- Edit window + width = 100, + height = 2, + style = "minimal", + border = "rounded", + }, + clipboard_register = '"', + default_register = "q", -- Use this register when loading a macro (will never prompt for register if set) + }) + require("telescope").load_extension("macrothis") + vim.keymap.set("n", "fq", ":Telescope macrothis", { desc = "Find macro" }) + end, + keys = { + { + "dq", + function() + require("macrothis").delete() + end, + desc = "Delete macro", + }, + { + "eq", + function() + require("macrothis").edit() + end, + desc = "Edit macro", + }, + { + "lq", + function() + require("macrothis").load() + end, + desc = "Load macro", + }, + { + "rnq", + function() + require("macrothis").rename() + end, + desc = "Rename macro", + }, + { + "rQ", + function() + require("macrothis").quickfix() + end, + desc = "Run macro on all files in quickfix", + }, + { + "rq", + function() + require("macrothis").run() + end, + desc = "Run macro", + }, + { + "wq", + function() + require("macrothis").save() + end, + desc = "Save macro", + }, + { + 'e"', + function() + require("macrothis").register() + end, + desc = "Edit register", + }, + { + 'y"', + function() + require("macrothis").copy_register_printable() + end, + desc = "Copy register as printable", + }, + { + "yq", + function() + require("macrothis").copy_macro_printable() + end, + desc = "Copy macro as printable", + }, + }, + }, + -- { + -- "ecthelionvi/NeoComposer.nvim", + -- dependencies = { "kkharji/sqlite.lua" }, + -- opts = {}, + -- config = function() + -- require("NeoComposer").setup({ + -- notify = true, + -- delay_timer = 150, + -- queue_most_recent = false, + -- window = { + -- width = 80, + -- height = 10, + -- border = "rounded", + -- winhl = { + -- Normal = "ComposerNormal", + -- }, + -- }, + -- colors = { + -- bg = "NONE", + -- fg = "#ff9e64", + -- red = "#ec5f67", + -- blue = "#5fb3b3", + -- green = "#99c794", + -- }, + -- keymaps = { + -- play_macro = "Q", + -- yank_macro = "yq", + -- stop_macro = "cq", + -- toggle_record = "q", + -- cycle_next = "", + -- cycle_prev = "", + -- toggle_macro_menu = "", + -- }, + -- }) + -- + -- require("telescope").load_extension("macros") + -- + -- vim.keymap.set("n", "sm", ":Telescope macros", { desc = "Search macros" }) + -- vim.keymap.set("n", "em", ":EditMacros", { desc = "Edit macros" }) + -- vim.keymap.set("n", "xm", ":ClearNeoComposer", { desc = "Clear macros" }) + -- end, + -- }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/markdown.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/markdown.lua new file mode 100644 index 0000000..0b5fb5c --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/markdown.lua @@ -0,0 +1,552 @@ +-- Select the current cell +local function select_cell() + local bufnr = vim.api.nvim_get_current_buf() + local current_row = vim.api.nvim_win_get_cursor(0)[1] + local current_col = vim.api.nvim_win_get_cursor(0)[2] + + local start_line = nil + local end_line = nil + local line_count = vim.api.nvim_buf_line_count(bufnr) + + -- Find the start of the cell (looking for opening markers or headers) + for line = current_row, 1, -1 do + local line_content = vim.api.nvim_buf_get_lines(bufnr, line - 1, line, false)[1] + if line_content:match("^```%s*[%w_%-]+") then + start_line = line + break + end + end + + -- If no start line is found, assume start of the file + if not start_line then + start_line = 1 + end + + -- Find the end of the cell (looking for the next opening marker or header) + for line = start_line + 1, line_count do + local line_content = vim.api.nvim_buf_get_lines(bufnr, line - 1, line, false)[1] + if line_content:match("^```%s*[%w_%-]+") then + end_line = line - 1 + break + end + end + + -- If no end line is found, assume end of the file + if not end_line then + end_line = line_count + end + + return current_row, current_col, start_line, end_line +end + +-- Delete the current cell +local function delete_cell() + local _, _, start_line, end_line = select_cell() -- Use select_cell to get start and end lines of the cell + if start_line and end_line then + -- Move cursor to the start of the cell + vim.api.nvim_win_set_cursor(0, { start_line, 0 }) + + -- Enter visual line mode to select the cell + vim.cmd("normal! V") + -- Move cursor to the end of the cell to extend selection + vim.api.nvim_win_set_cursor(0, { end_line, 0 }) + + -- Delete the selected lines + vim.cmd("normal! d") + end +end + +-- Navigate to the next or previous cell +local function navigate_cell(up) + local bufnr = vim.api.nvim_get_current_buf() + local line_count = vim.api.nvim_buf_line_count(bufnr) + local _, _, start_line, end_line = select_cell() -- Get the start and end lines of the current cell + + local target_line = nil + + if up then + -- Find the previous cell start, skipping any closing markers + for line = start_line - 1, 1, -1 do + local line_content = vim.api.nvim_buf_get_lines(bufnr, line - 1, line, false)[1] + if line_content:match("^```%s*[%w_%-]+") or line_content:match("^%s*#+%s") then + target_line = line + break + end + end + else + -- Find the next cell start, skipping any closing markers + for line = end_line + 1, line_count do + local line_content = vim.api.nvim_buf_get_lines(bufnr, line - 1, line, false)[1] + if line_content:match("^```%s*[%w_%-]+") or line_content:match("^%s*#+%s") then + target_line = line + break + end + end + end + + -- Navigate to the target line if found, otherwise stay at the current position + if target_line then + -- If the target is a code block, move cursor to the line right after the opening marker + local target_line_content = vim.api.nvim_buf_get_lines(bufnr, target_line - 1, target_line, false)[1] + if target_line_content:match("^```%s*[%w_%-]+") then + vim.api.nvim_win_set_cursor(0, { target_line + 1, 0 }) -- Move inside the code block + else + vim.api.nvim_win_set_cursor(0, { target_line, 0 }) -- Move to the markdown header line + end + else + if up then + vim.api.nvim_win_set_cursor(0, { 1, 0 }) -- Move to start of file if no previous cell found + else + vim.api.nvim_win_set_cursor(0, { line_count, 0 }) -- Move to end of file if no next cell found + end + end +end + +-- Insert a new cell with specific content +local function insert_cell(content) + local _, _, _, end_line = select_cell() + local bufnr = vim.api.nvim_get_current_buf() + local line = end_line + if end_line ~= 1 then + line = end_line - 1 + vim.api.nvim_win_set_cursor(0, { end_line - 1, 0 }) + else + line = end_line + vim.api.nvim_win_set_cursor(0, { end_line, 0 }) + end + + vim.cmd("normal!2o") + vim.api.nvim_buf_set_lines(bufnr, line, line + 1, false, { content }) + vim.cmd("normal!2o") + vim.cmd("normal!k") +end + +-- Insert a new code cell +local function insert_code_cell() + insert_cell("```python") -- For regular code cells +end + +return { + { + "ixru/nvim-markdown", + config = function() + vim.g.vim_markdown_no_default_key_mappings = 1 + end, + }, + { + "MeanderingProgrammer/render-markdown.nvim", + -- dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.nvim" }, -- if you use the mini.nvim suite + dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.icons" }, -- if you use standalone mini plugins + -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons + ---@module 'render-markdown' + ---@type render.md.UserConfig + opts = {}, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v" }, + { "mr", group = "Markdown render" }, + }) + end, + config = function() + -- require("obsidian").get_client().opts.ui.enable = false + -- vim.api.nvim_buf_clear_namespace(0, vim.api.nvim_get_namespaces()["ObsidianUI"], 0, -1) + require("render-markdown").setup({ + bullet = { + -- Turn on / off list bullet rendering + enabled = false, + }, + code = { + enabled = true, -- disable code rendering for .ipynb files + sign = true, + -- Width of the code block background. + -- | block | width of the code block | + -- | full | full width of the window | + width = "block", + }, + file_types = { "markdown", "vimwiki" }, + heading = { + enabled = true, + sign = false, + icons = { "", "", "", "", "", "" }, + -- icons = { "󰎤 ", "󰎧 ", "󰎪 ", "󰎭 ", "󰎱 ", "󰎳 " }, + }, + ignore = function(bufnr) + local name = vim.api.nvim_buf_get_name(bufnr) + return name:lower():match("%.ipynb$") ~= nil + end, + }) + vim.treesitter.language.register("markdown", "vimwiki") + + local opts = { noremap = true, silent = true } + vim.keymap.set("n", "mrt", function() + require("render-markdown").buf_toggle() + end, vim.tbl_extend("force", opts, { desc = "Toggle render-markdown" })) + vim.keymap.set("n", "mre", function() + require("render-markdown").buf_enable() + end, vim.tbl_extend("force", opts, { desc = "Enable render-markdown" })) + vim.keymap.set("n", "mrx", function() + require("render-markdown").buf_disable() + end, vim.tbl_extend("force", opts, { desc = "Disable render-markdown" })) + vim.keymap.set("n", "mr+", function() + require("render-markdown").expand() + end, vim.tbl_extend("force", opts, { desc = "Expand conceal margin" })) + vim.keymap.set("n", "mr-", function() + require("render-markdown").contract() + end, vim.tbl_extend("force", opts, { desc = "Contract conceal margin" })) + vim.keymap.set("n", "mrl", function() + require("render-markdown").log() + end, vim.tbl_extend("force", opts, { desc = "Open render-markdown log" })) + vim.keymap.set("n", "mrc", function() + require("render-markdown").config() + end, vim.tbl_extend("force", opts, { desc = "Show render-markdown config diff" })) + vim.keymap.set("n", "mrd", function() + require("render-markdown").debug() + end, vim.tbl_extend("force", opts, { desc = "Debug render-markdown marks" })) + end, + }, + { + -- Install markdown preview, use npx if available. + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + ft = { "markdown" }, + build = function(plugin) + if vim.fn.executable("npx") then + vim.cmd("!cd " .. plugin.dir .. " && cd app && npx --yes yarn install") + else + vim.cmd([[Lazy load markdown-preview.nvim]]) + vim.fn["mkdp#util#install"]() + end + end, + init = function() + if vim.fn.executable("npx") then + vim.g.mkdp_filetypes = { "markdown" } + end + local wk = require("which-key") + wk.add({ + mode = { "n", "v" }, + { "m", group = "Markdown/Map" }, + }) + end, + keys = { + { "mp", "MarkdownPreview", desc = "Markdown preview" }, + { "mx", "MarkdownPreviewStop", desc = "Markdown stop" }, + { "md", "MarkdownPreviewToggle", desc = "Markdown toggle" }, + }, + }, + { + "brianhuster/live-preview.nvim", + dependencies = { + -- You can choose one of the following pickers + "nvim-telescope/telescope.nvim", + -- "ibhagwan/fzf-lua", + -- "echasnovski/mini.pick", + }, + cmd = { "LivePreview start", "LivePreview close", "LivePreview pick", "LivePreview help" }, + init = function() + if vim.fn.executable("npx") then + vim.g.mkdp_filetypes = { "markdown" } + end + local wk = require("which-key") + wk.add({ + mode = { "n", "v" }, + { "ml", group = "Markdown live" }, + }) + end, + keys = { + { "mlp", "LivePreview start", desc = "Markdown live preview" }, + { "mlx", "LivePreview close", desc = "Markdown live close" }, + { "mlc", "LivePreview pick", desc = "Markdown live pick" }, + { "mlh", "LivePreview help", desc = "Markdown live help" }, + }, + }, + { + "ellisonleao/glow.nvim", + cmd = "Glow", + config = function() + require("glow").setup({ + border = "single", -- floating window border config + style = "dark", -- filled automatically with your current editor background, you can override using glow json style + }) + end, + keys = { + { "mf", "Glow", desc = "Floating markdown preview" }, + }, + }, + { + "dhruvasagar/vim-open-url", + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v" }, + { "g", group = "Search word under curosr" }, + { "gB", group = "Open url in browser" }, + { "gG", group = "Google search word under cursor" }, + { "gW", group = "Wikipedia search word under cursor" }, + }) + end, + }, + { + "AckslD/nvim-FeMaco.lua", + config = function() + require("femaco").setup() + end, + }, + { + "goerz/jupytext.nvim", + version = "0.2.0", + lazy = false, + config = function() + require("jupytext").setup({ + jupytext = "jupytext", + format = "markdown", + update = true, + filetype = require("jupytext").get_filetype, + new_template = require("jupytext").default_new_template(), + sync_patterns = { "*.md", "*.py", "*.jl", "*.R", "*.Rmd", "*.qmd" }, + autosync = true, + handle_url_schemes = true, + }) + end, + keys = { + { "", insert_code_cell, desc = "Insert Code Cell" }, + { "", delete_cell, desc = "Delete Cell" }, + { + "", + function() + navigate_cell(true) + end, + desc = "Previous Cell", + }, + { "", navigate_cell, desc = "Next Cell" }, + }, + }, + { + "vhyrro/luarocks.nvim", + priority = 1001, -- this plugin needs to run before anything else + init = function() + package.path = package.path + .. ";" + .. vim.fn.expand("$HOME") + .. "/.config/luarocks/share/lua/5.1/magick/init.lua;" + end, + opt = { + rocks = { "magick" }, + }, + }, + { "benlubas/image-save.nvim", cmd = "SaveImage" }, + { + "3rd/image.nvim", + dependencies = { "leafo/magick", "vhyrro/luarocks.nvim" }, + config = function() + require("image").setup({ + backend = "ueberzug", -- or "kitty", whatever backend you would like to use + processor = "magick_rock", -- or "magick_cli" + integrations = { + markdown = { + enabled = true, + clear_in_insert_mode = false, + download_remote_images = false, + only_render_image_at_cursor = false, + floating_windows = false, -- if true, images will be rendered in floating markdown windows + filetypes = { "markdown", "quarto" }, -- markdown extensions (ie. quarto) can go here + }, + neorg = { + enabled = true, + filetypes = { "norg" }, + }, + typst = { + enabled = true, + filetypes = { "typst" }, + }, + html = { + enabled = false, + }, + css = { + enabled = false, + }, + }, + max_width = 100, + max_height = 8, + max_height_window_percentage = math.huge, + max_width_window_percentage = math.huge, + window_overlap_clear_enabled = true, -- toggles images when windows are overlapped + window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "fidget", "" }, + editor_only_render_when_focused = true, -- auto show/hide images when the editor gains/looses focus + tmux_show_only_in_active_window = true, -- auto show/hide images in the correct Tmux window (needs visual-activity off) + hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp", "*.avif" }, -- render image files as images when opened + }) + end, + }, + { + "quarto-dev/quarto-nvim", + dependencies = { + { + "jmbuhr/otter.nvim", + lazy = false, + dependencies = { + "nvim-treesitter/nvim-treesitter", + }, + opts = {}, + config = function() + require("otter").setup() + end, + }, + "hrsh7th/nvim-cmp", + "neovim/nvim-lspconfig", + }, + ft = { "quarto", "markdown" }, + command = "QuartoActivate", + config = function() + require("quarto").setup({ + debug = false, + closePreviewOnExit = true, + lspFeatures = { + languages = { "r", "python", "rust" }, + chunks = "all", + diagnostics = { + enabled = true, + triggers = { "BufWritePost" }, + }, + completion = { + enabled = true, + }, + }, + keymap = { + hover = "H", + definition = "gd", + rename = "rn", + references = "gr", + format = "gf", + }, + codeRunner = { + enabled = true, + default_method = "molten", + ft_runners = { + bash = "slime", + python = "molten", + }, + never_run = { "yaml" }, -- filetypes which are never sent to a code runner + }, + }) + local runner = require("quarto.runner") + vim.keymap.set("n", "jc", runner.run_cell, { silent = true, desc = "Run cell" }) + vim.keymap.set("n", "jC", runner.run_above, { silent = true, desc = "Run above cell" }) + vim.keymap.set("n", "jl", runner.run_line, { silent = true, desc = "Run line" }) + vim.keymap.set("v", "jv", runner.run_range, { silent = true, desc = "Run block" }) + vim.keymap.set("n", "ja", runner.run_all, { silent = true, desc = "Run all" }) + vim.keymap.set("n", "jA", function() + runner.run_all(true) + end, { desc = "run all cells of all languages", silent = true }) + vim.keymap.set( + "n", + "jp", + require("quarto").quartoPreview, + { noremap = true, silent = true, desc = "Preview the quarto document" } + ) + -- to create a cell in insert mode, I have the ` snippet + vim.keymap.set( + "n", + "cc", + "i```python\n```O", + { silent = true, desc = "Create a new code cell" } + ) + vim.keymap.set( + "n", + "cs", + "i```\r\r```{}", + { noremap = true, silent = true, desc = "Split code cell" } + ) + end, + }, + { + "benlubas/molten-nvim", + version = "^1.0.0", -- use version <2.0.0 to avoid breaking changes + dependencies = { "3rd/image.nvim" }, + build = ":UpdateRemotePlugins", + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v", "x" }, + { "j", group = "Molten (Jupyter)" }, + }) + + vim.g.molten_auto_image_popup = true + vim.g.molten_auto_init_behavior = "raise" + vim.g.molten_auto_open_html_in_browser = false + -- I find auto open annoying, keep in mind setting this option will require setting + -- a keybind for `:noautocmd MoltenEnterOutput` to open the output again + vim.g.molten_auto_open_output = false + vim.g.molten_cover_empty_lines = false + vim.g.molten_cover_lines_starting_with = {} + vim.g.molten_copy_output = false + vim.g.molten_enter_output_behavior = "open_then_enter" + -- this guide will be using image.nvim + -- Don't forget to setup and install the plugin if you want to view image outputs + vim.g.molten_image_provider = "image.nvim" + vim.g.molten_output_show_more = false + vim.g.molten_output_win_max_height = 30 + vim.g.molten_output_win_style = "minimal" + -- this will make it so the output shows up below the \`\`\` cell delimiter + vim.g.molten_virt_lines_off_by_1 = true + -- Output as virtual text. Allows outputs to always be shown, works with images, but can + -- be buggy with longer images + vim.g.molten_virt_text_output = true + -- optional, works for virt text and the output window + vim.g.molten_wrap_output = true + vim.g.molten_virt_text_max_lines = 20 + end, + config = function() + -- image nvim options table. Pass to `require('image').setup` + vim.keymap.set("n", "jJ", ":MoltenInit", { silent = true, desc = "Init molten" }) + vim.keymap.set("n", "j[", ":MoltenPrev", { silent = true, desc = "Go to prev code cell" }) + vim.keymap.set("n", "j]", ":MoltenNext", { silent = true, desc = "Go to next code cell" }) + vim.keymap.set( + "n", + "jo", + ":MoltenEvaluateOperator", + { silent = true, desc = "Evaluate operator" } + ) + vim.keymap.set("n", "jL", ":MoltenEvaluateLine", { silent = true, desc = "Evaluate line" }) + vim.keymap.set("n", "jr", ":MoltenReevaluateCell", { silent = true, desc = "Re-evaluate cell" }) + vim.keymap.set( + "v", + "jV", + ":MoltenEvaluateVisualgv", + { silent = true, desc = "Evaluate visual block" } + ) + vim.keymap.set("n", "jd", ":MoltenDelete", { silent = true, desc = "Delete molten" }) + vim.keymap.set("n", "js", ":MoltenShowOutput", { silent = true, desc = "Show output" }) + vim.keymap.set("n", "jh", ":MoltenHideOutput", { silent = true, desc = "Hide output" }) + vim.keymap.set( + "n", + "jm", + ":noautocmd MoltenEnterOutput", + { silent = true, desc = "Enter output" } + ) + vim.api.nvim_create_autocmd("User", { + pattern = "MoltenInitPost", + callback = function() + require("quarto").activate() + end, + }) + vim.keymap.set("n", "ji", ":MoltenImagePopup", { silent = true, desc = "Pop-up image" }) + vim.keymap.set("n", "jw", ":MoltenOpenInBrowser", { silent = true, desc = "Open in browser" }) + vim.keymap.set("n", "jj", function() + local venv_path = os.getenv("VIRTUAL_ENV") + if venv_path then + local venv_name = vim.fn.fnamemodify(venv_path, ":t") + vim.cmd(("MoltenInit %s"):format(venv_name)) + else + vim.cmd("MoltenInit python3") + end + end, { desc = "Init default molten" }) + end, + }, + { + "mipmip/vim-scimark", + config = function() + vim.keymap.set("n", "si", ":OpenInScim", { desc = "Sc-im" }) + end, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/marks.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/marks.lua new file mode 100644 index 0000000..d59d0f1 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/marks.lua @@ -0,0 +1,16 @@ +return { + "chentoast/marks.nvim", + config = function() + require("marks").setup() + end, + init = function() + local wk = require("which-key") + wk.add({ + { + mode = { "n", "v" }, + { "m", group = "Marks" }, + { "dm", desc = "Delete marks" }, + }, + }) + end, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua new file mode 100644 index 0000000..d9ea466 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/mini.lua @@ -0,0 +1,1162 @@ +-- Updated pattern to match what Echasnovski has in the documentation +-- https://github.com/echasnovski/mini.nvim/blob/c6eede272cfdb9b804e40dc43bb9bff53f38ed8a/doc/mini-files.txt#L508-L529 + +-- Define a function to update MiniJump highlight based on Search +local function update_mini_jump_highlight() + local search_hl = vim.api.nvim_get_hl(0, { name = "Search" }) + vim.api.nvim_set_hl(0, "MiniJump", { + fg = search_hl.fg, + bg = search_hl.bg, + bold = search_hl.bold or false, + }) +end + +return { + { + "echasnovski/mini.ai", + version = false, + config = function() + require("mini.ai").setup({ + -- Table with textobject id as fields, textobject specification as values. + -- Also use this to disable builtin textobjects. See |MiniAi.config|. + custom_textobjects = nil, + + -- Module mappings. Use `''` (empty string) to disable one. + mappings = { + -- Main textobject prefixes + around = "a", + inside = "i", + + -- Next/last variants + around_next = "an", + inside_next = "in", + around_last = "al", + inside_last = "il", + + -- Move cursor to corresponding edge of `a` textobject + goto_left = "g[", + goto_right = "g]", + }, + + -- Number of lines within which textobject is searched + n_lines = 50, + + -- How to search for object (first inside current line, then inside + -- neighborhood). One of 'cover', 'cover_or_next', 'cover_or_prev', + -- 'cover_or_nearest', 'next', 'previous', 'nearest'. + search_method = "cover_or_next", + + -- Whether to disable showing non-error feedback + -- This also affects (purely informational) helper messages shown after + -- idle time if user input is required. + silent = false, + }) + end, + }, + { + "echasnovski/mini.bracketed", + version = false, + config = function() + require("mini.bracketed").setup({ + buffer = { suffix = "", options = {} }, + comment = { suffix = "", options = {} }, + conflict = { suffix = "", options = {} }, + diagnostic = { suffix = "", options = {} }, + file = { suffix = "", options = {} }, + indent = { suffix = "", options = {} }, + jump = { suffix = "", options = {} }, + location = { suffix = "", options = {} }, + oldfile = { suffix = "", options = {} }, + quickfix = { suffix = "", options = {} }, + treesitter = { suffix = "", options = {} }, + undo = { suffix = "", options = {} }, + window = { suffix = "", options = {} }, + yank = { suffix = "", options = {} }, + }) + + vim.keymap.set("n", "[B", "lua MiniBracketed.buffer('first')", { desc = "Buffer first" }) + vim.keymap.set( + "n", + "[b", + "lua MiniBracketed.buffer('backward')", + { desc = "Buffer backward" } + ) + vim.keymap.set( + "n", + "]b", + "lua MiniBracketed.buffer('forward')", + { desc = "Buffer forward" } + ) + vim.keymap.set("n", "]B", "lua MiniBracketed.buffer('last')", { desc = "Buffer last" }) + vim.keymap.set("n", "[C", "lua MiniBracketed.comment('first')", { desc = "Comment first" }) + vim.keymap.set( + "n", + "[c", + "lua MiniBracketed.comment('backward')", + { desc = "Comment backward" } + ) + vim.keymap.set( + "n", + "]c", + "lua MiniBracketed.comment('forward')", + { desc = "Comment forward" } + ) + vim.keymap.set("n", "]C", "lua MiniBracketed.comment('last')", { desc = "Comment last" }) + vim.keymap.set( + "n", + "[X", + "lua MiniBracketed.conflict('first')", + { desc = "Conflict first" } + ) + vim.keymap.set( + "n", + "[x", + "lua MiniBracketed.conflict('backward')", + { desc = "Conflict backward" } + ) + vim.keymap.set( + "n", + "]x", + "lua MiniBracketed.conflict('forward')", + { desc = "Conflict forward" } + ) + vim.keymap.set("n", "]X", "lua MiniBracketed.conflict('last')", { desc = "Conflict last" }) + vim.keymap.set( + "n", + "[D", + "lua MiniBracketed.diagnostic('first')", + { desc = "Diagnostic first" } + ) + vim.keymap.set( + "n", + "[d", + "lua MiniBracketed.diagnostic('backward')", + { desc = "Diagnostic backward" } + ) + vim.keymap.set( + "n", + "]d", + "lua MiniBracketed.diagnostic('forward')", + { desc = "Diagnostic forward" } + ) + vim.keymap.set( + "n", + "]D", + "lua MiniBracketed.diagnostic('last')", + { desc = "Diagnostic last" } + ) + vim.keymap.set("n", "[F", "lua MiniBracketed.file('first')", { desc = "File first" }) + vim.keymap.set("n", "[f", "lua MiniBracketed.file('backward')", { desc = "File backward" }) + vim.keymap.set("n", "]f", "lua MiniBracketed.file('forward')", { desc = "File forward" }) + vim.keymap.set("n", "]F", "lua MiniBracketed.file('last')", { desc = "File last" }) + vim.keymap.set("n", "[I", "lua MiniBracketed.indent('first')", { desc = "Indent first" }) + vim.keymap.set( + "n", + "[i", + "lua MiniBracketed.indent('backward')", + { desc = "Indent backward" } + ) + vim.keymap.set( + "n", + "]i", + "lua MiniBracketed.indent('forward')", + { desc = "Indent forward" } + ) + vim.keymap.set("n", "]I", "lua MiniBracketed.indent('last')", { desc = "Indent last" }) + vim.keymap.set("n", "[J", "lua MiniBracketed.jump('first')", { desc = "Jump first" }) + vim.keymap.set("n", "[j", "lua MiniBracketed.jump('backward')", { desc = "Jump backward" }) + vim.keymap.set("n", "]j", "lua MiniBracketed.jump('forward')", { desc = "Jump forward" }) + vim.keymap.set("n", "]J", "lua MiniBracketed.jump('last')", { desc = "Jump last" }) + vim.keymap.set( + "n", + "[L", + "lua MiniBracketed.location('first')", + { desc = "Location first" } + ) + vim.keymap.set( + "n", + "[l", + "lua MiniBracketed.location('backward')", + { desc = "Location backward" } + ) + vim.keymap.set( + "n", + "]l", + "lua MiniBracketed.location('forward')", + { desc = "Location forward" } + ) + vim.keymap.set("n", "]L", "lua MiniBracketed.location('last')", { desc = "Location last" }) + vim.keymap.set("n", "[O", "lua MiniBracketed.oldfile('first')", { desc = "Oldfile first" }) + vim.keymap.set( + "n", + "[o", + "lua MiniBracketed.oldfile('backward')", + { desc = "Oldfile backward" } + ) + vim.keymap.set( + "n", + "]o", + "lua MiniBracketed.oldfile('forward')", + { desc = "Oldfile forward" } + ) + vim.keymap.set("n", "]O", "lua MiniBracketed.oldfile('last')", { desc = "Oldfile last" }) + vim.keymap.set( + "n", + "[Q", + "lua MiniBracketed.quickfix('first')", + { desc = "Quickfix first" } + ) + vim.keymap.set( + "n", + "[q", + "lua MiniBracketed.quickfix('backward')", + { desc = "Quickfix backward" } + ) + vim.keymap.set( + "n", + "]q", + "lua MiniBracketed.quickfix('forward')", + { desc = "Quickfix forward" } + ) + vim.keymap.set("n", "]Q", "lua MiniBracketed.quickfix('last')", { desc = "Quickfix last" }) + vim.keymap.set( + "n", + "[T", + "lua MiniBracketed.treesitter('first')", + { desc = "Treesitter first" } + ) + vim.keymap.set( + "n", + "[t", + "lua MiniBracketed.treesitter('backward')", + { desc = "Treesitter backward" } + ) + vim.keymap.set( + "n", + "]t", + "lua MiniBracketed.treesitter('forward')", + { desc = "Treesitter forward" } + ) + vim.keymap.set( + "n", + "]T", + "lua MiniBracketed.treesitter('last')", + { desc = "Treesitter last" } + ) + vim.keymap.set("n", "[U", "lua MiniBracketed.undo('first')", { desc = "Undo first" }) + vim.keymap.set("n", "[u", "lua MiniBracketed.undo('backward')", { desc = "Undo backward" }) + vim.keymap.set("n", "]u", "lua MiniBracketed.undo('forward')", { desc = "Undo forward" }) + vim.keymap.set("n", "]U", "lua MiniBracketed.undo('last')", { desc = "Undo last" }) + vim.keymap.set("n", "w0", "lua MiniBracketed.window('first')", { desc = "Window first" }) + vim.keymap.set( + "n", + "w[", + "lua MiniBracketed.window('backward')", + { desc = "Window backward" } + ) + vim.keymap.set( + "n", + "w]", + "lua MiniBracketed.window('forward')", + { desc = "Window forward" } + ) + vim.keymap.set("n", "w$", "lua MiniBracketed.window('last')", { desc = "Window last" }) + vim.keymap.set("n", "[Y", "lua MiniBracketed.yank('first')", { desc = "Yank first" }) + vim.keymap.set("n", "[y", "lua MiniBracketed.yank('backward')", { desc = "Yank backward" }) + vim.keymap.set("n", "]y", "lua MiniBracketed.yank('forward')", { desc = "Yank forward" }) + vim.keymap.set("n", "]Y", "lua MiniBracketed.yank('last')", { desc = "Yank last" }) + end, + }, + { + "echasnovski/mini.files", + opts = { + -- I didn't like the default mappings, so I modified them + -- Module mappings created only inside explorer. + -- Use `''` (empty string) to not create one. + mappings = { + close = "q", + -- Use this if you want to open several files + go_in = "l", + -- This opens the file, but quits out of mini.files (default L) + go_in_plus = "", + -- I swapped the following 2 (default go_out: h) + -- go_out_plus: when you go out, it shows you only 1 item to the right + -- go_out: shows you all the items to the right + go_out = "H", + go_out_plus = "h", + -- Default + reset = ",", + -- Default @ + reveal_cwd = ".", + show_help = "g?", + -- Default = + synchronize = "s", + trim_left = "<", + trim_right = ">", + toggle_hidden = nil, + change_cwd = nil, + go_in_horizontal = nil, + go_in_vertical = nil, + go_in_horizontal_plus = nil, + go_in_vertical_plus = nil, + }, + options = { + use_as_default_explorer = true, + permanent_delete = false, + }, + windows = { + preview = true, + width_focus = 25, + width_preview = 40, + }, + }, + keys = { + { + "ee", + function() + if not MiniFiles.close() then + require("mini.files").open(vim.api.nvim_buf_get_name(0), true) + end + end, + desc = "Open mini.files", + }, + { + "eE", + function() + require("mini.files").open(vim.uv.cwd(), true) + end, + desc = "Open mini.files (cwd)", + }, + }, + config = function(_, opts) + require("mini.files").setup(opts) + + local show_dotfiles = true + local filter_show = function(fs_entry) + return true + end + local filter_hide = function(fs_entry) + return not vim.startswith(fs_entry.name, ".") + end + + local toggle_dotfiles = function() + show_dotfiles = not show_dotfiles + local new_filter = show_dotfiles and filter_show or filter_hide + require("mini.files").refresh({ content = { filter = new_filter } }) + end + + local map_split = function(buf_id, lhs, direction, close_on_file) + local rhs = function() + local new_target_window + local cur_target_window = require("mini.files").get_explorer_state().arget_window + + if cur_target_window ~= nil then + vim.api.nvim_win_call(cur_target_window, function() + vim.cmd("belowright " .. direction .. " split") + new_target_window = vim.api.nvim_get_current_win() + end) + + require("mini.files").set_target_window(new_target_window) + require("mini.files").go_in({ close_on_file = close_on_file }) + end + end + + local desc = "Open in " .. direction .. " split" + if close_on_file then + desc = desc .. " and close" + end + vim.keymap.set("n", lhs, rhs, { buffer = buf_id, desc = desc }) + end + + local files_set_cwd = function() + local cur_entry_path = MiniFiles.get_fs_entry().path + local cur_directory = vim.fs.dirname(cur_entry_path) + if cur_directory ~= nil then + vim.fn.chdir(cur_directory) + end + end + + local mini_files = require("mini.files") + local tmux_pane_function = require("TheSiahxyz.utils.tmux").tmux_pane_function + + local open_tmux_pane = function() + local curr_entry = mini_files.get_fs_entry() + if curr_entry then + if curr_entry.fs_type == "directory" then + tmux_pane_function(curr_entry.path) + elseif curr_entry.fs_type == "file" then + local parent_dir = vim.fn.fnamemodify(curr_entry.path, ":h") + tmux_pane_function(parent_dir) + elseif curr_entry.fs_type == "link" then + local resolved_path = vim.fn.resolve(curr_entry.path) + if vim.fn.isdirectory(resolved_path) == 1 then + tmux_pane_function(resolved_path) + else + local parent_dir = vim.fn.fnamemodify(resolved_path, ":h") + tmux_pane_function(parent_dir) + end + else + vim.notify("Unsupported file system entry type", vim.log.levels.WARN) + end + else + vim.notify("No entry selected", vim.log.levels.WARN) + end + end + + local copy_to_clipboard = function() + local curr_entry = mini_files.get_fs_entry() + if curr_entry then + local path = curr_entry.path + -- Escape the path for shell command + local escaped_path = vim.fn.fnameescape(path) + local cmd = vim.fn.has("mac") == 1 + and string.format([[osascript -e 'set the clipboard to POSIX file "%s"']], escaped_path) + or string.format([[echo -n %s | xclip -selection clipboard]], escaped_path) + local result = vim.fn.system(cmd) + if vim.v.shell_error ~= 0 then + vim.notify("Copy failed: " .. result, vim.log.levels.ERROR) + else + vim.notify(vim.fn.fnamemodify(path, ":t"), vim.log.levels.INFO) + vim.notify("Copied to system clipboard", vim.log.levels.INFO) + end + else + vim.notify("No file or directory selected", vim.log.levels.WARN) + end + end + + local zip_and_copy_to_clipboard = function() + local curr_entry = require("mini.files").get_fs_entry() + if curr_entry then + local path = curr_entry.path + local name = vim.fn.fnamemodify(path, ":t") -- Extract the file or directory name + local parent_dir = vim.fn.fnamemodify(path, ":h") -- Get the parent directory + local timestamp = os.date("%y%m%d%H%M%S") -- Append timestamp to avoid duplicates + local zip_path = string.format("/tmp/%s_%s.zip", name, timestamp) -- Path in macOS's tmp directory + -- Create the zip file + local zip_cmd = string.format( + "cd %s && zip -r %s %s", + vim.fn.shellescape(parent_dir), + vim.fn.shellescape(zip_path), + vim.fn.shellescape(name) + ) + local result = vim.fn.system(zip_cmd) + if vim.v.shell_error ~= 0 then + vim.notify("Failed to create zip file: " .. result, vim.log.levels.ERROR) + return + end + -- Copy the zip file to the system clipboard + local copy_cmd = vim.fn.has("mac") == 1 + and string.format([[osascript -e 'set the clipboard to POSIX file "%s"']], zip_path) + or string.format([[echo -n %s | xclip -selection clipboard]], zip_path) + local copy_result = vim.fn.system(copy_cmd) + if vim.v.shell_error ~= 0 then + vim.notify("Failed to copy zip file to clipboard: " .. copy_result, vim.log.levels.ERROR) + return + end + vim.notify(zip_path, vim.log.levels.INFO) + vim.notify("Zipped and copied to clipboard: ", vim.log.levels.INFO) + else + vim.notify("No file or directory selected", vim.log.levels.WARN) + end + end + + local paste_from_clipboard = function() + -- vim.notify("Starting the paste operation...", vim.log.levels.INFO) + if not mini_files then + vim.notify("mini.files module not loaded.", vim.log.levels.ERROR) + return + end + local curr_entry = mini_files.get_fs_entry() -- Get the current file system entry + if not curr_entry then + vim.notify("Failed to retrieve current entry in mini.files.", vim.log.levels.ERROR) + return + end + local curr_dir = curr_entry.fs_type == "directory" and curr_entry.path + or vim.fn.fnamemodify(curr_entry.path, ":h") -- Use parent directory if entry is a file + -- vim.notify("Current directory: " .. curr_dir, vim.log.levels.INFO) + local script = [[ + tell application "System Events" + try + set theFile to the clipboard as alias + set posixPath to POSIX path of theFile + return posixPath + on error + return "error" + end try + end tell + ]] + local output = vim.fn.has("mac") == 1 and vim.fn.system("osascript -e " .. vim.fn.shellescape(script)) + or vim.fn.system("xclip -o -selection clipboard") + if vim.v.shell_error ~= 0 or output:find("error") then + vim.notify("Clipboard does not contain a valid file or directory.", vim.log.levels.WARN) + return + end + local source_path = output:gsub("%s+$", "") -- Trim whitespace from clipboard output + if source_path == "" then + vim.notify("Clipboard is empty or invalid.", vim.log.levels.WARN) + return + end + local dest_path = curr_dir .. "/" .. vim.fn.fnamemodify(source_path, ":t") -- Destination path in current directory + local copy_cmd = vim.fn.isdirectory(source_path) == 1 and { "cp", "-R", source_path, dest_path } + or { "cp", source_path, dest_path } -- Construct copy command + local result = vim.fn.system(copy_cmd) -- Execute the copy command + if vim.v.shell_error ~= 0 then + vim.notify("Paste operation failed: " .. result, vim.log.levels.ERROR) + return + end + -- vim.notify("Pasted " .. source_path .. " to " .. dest_path, vim.log.levels.INFO) + mini_files.synchronize() -- Refresh mini.files to show updated directory content + vim.notify("Pasted successfully.", vim.log.levels.INFO) + end + + local copy_path_to_clipboard = function() + -- Get the current entry (file or directory) + local curr_entry = mini_files.get_fs_entry() + if curr_entry then + -- Convert path to be relative to home directory + local home_dir = vim.fn.expand("~") + local relative_path = curr_entry.path:gsub("^" .. home_dir, "~") + vim.fn.setreg("+", relative_path) -- Copy the relative path to the clipboard register + vim.notify(vim.fn.fnamemodify(relative_path, ":t"), vim.log.levels.INFO) + vim.notify("Path copied to clipboard: ", vim.log.levels.INFO) + else + vim.notify("No file or directory selected", vim.log.levels.WARN) + end + end + + local preview_image = function() + local curr_entry = mini_files.get_fs_entry() + if curr_entry then + -- Preview the file using Quick Look + if vim.fn.has("mac") == 1 then + vim.system({ "qlmanage", "-p", curr_entry.path }, { + stdout = false, + stderr = false, + }) + vim.defer_fn(function() + vim.system({ "osascript", "-e", 'tell application "qlmanage" to activate' }) + end, 200) + else + -- TODO: add previewer for linux + vim.notify("Preview not supported on Linux.", vim.log.levels.WARN) + end + else + vim.notify("No file selected", vim.log.levels.WARN) + end + end + + local preview_image_popup = function() + -- Clear any existing images before rendering the new one + require("image").clear() + local curr_entry = mini_files.get_fs_entry() + if curr_entry and curr_entry.fs_type == "file" then + local ext = vim.fn.fnamemodify(curr_entry.path, ":e"):lower() + local supported_image_exts = { "png", "jpg", "jpeg", "gif", "bmp", "webp", "avif" } + -- Check if the file has a supported image extension + if vim.tbl_contains(supported_image_exts, ext) then + -- Save mini.files state (current path and focused entry) + local current_dir = vim.fn.fnamemodify(curr_entry.path, ":h") + local focused_entry = vim.fn.fnamemodify(curr_entry.path, ":t") -- Extract filename + -- Create a floating window for the image preview + local popup_width = math.floor(vim.o.columns * 0.6) + local popup_height = math.floor(vim.o.lines * 0.6) + local col = math.floor((vim.o.columns - popup_width) / 2) + local row = math.floor((vim.o.lines - popup_height) / 2) + local buf = vim.api.nvim_create_buf(false, true) -- Create a scratch buffer + local win = vim.api.nvim_open_win(buf, true, { + relative = "editor", + row = row, + col = col, + width = popup_width, + height = popup_height, + style = "minimal", + border = "rounded", + }) + -- Declare img_width and img_height at the top + local img_width, img_height + -- Get image dimensions using ImageMagick's identify command + local dimensions = vim.fn.systemlist( + string.format("identify -format '%%w %%h' %s", vim.fn.shellescape(curr_entry.path)) + ) + if #dimensions > 0 then + img_width, img_height = dimensions[1]:match("(%d+) (%d+)") + img_width = tonumber(img_width) + img_height = tonumber(img_height) + end + -- Calculate image display size while maintaining aspect ratio + local display_width = popup_width + local display_height = popup_height + if img_width and img_height then + local aspect_ratio = img_width / img_height + if aspect_ratio > (popup_width / popup_height) then + -- Image is wider than the popup window + display_height = math.floor(popup_width / aspect_ratio) + else + -- Image is taller than the popup window + display_width = math.floor(popup_height * aspect_ratio) + end + end + -- Center the image within the popup window + local image_x = math.floor((popup_width - display_width) / 2) + local image_y = math.floor((popup_height - display_height) / 2) + -- Use image.nvim to render the image + local img = require("image").from_file(curr_entry.path, { + id = curr_entry.path, -- Unique ID + window = win, -- Bind the image to the popup window + buffer = buf, -- Bind the image to the popup buffer + x = image_x, + y = image_y, + width = display_width, + height = display_height, + with_virtual_padding = true, + }) + -- Render the image + if img ~= nil then + img:render() + end + -- Use `stat` or `ls` to get the file size in bytes + local file_size_bytes = "" + if vim.fn.has("mac") == 1 or vim.fn.has("unix") == 1 then + -- For macOS or Linux systems + local handle = io.popen( + "stat -f%z " + .. vim.fn.shellescape(curr_entry.path) + .. " || ls -l " + .. vim.fn.shellescape(curr_entry.path) + .. " | awk '{print $5}'" + ) + if handle then + file_size_bytes = handle:read("*a"):gsub("%s+$", "") -- Trim trailing whitespace + handle:close() + end + else + -- Fallback message if the command isn't available + file_size_bytes = "0" + end + -- Convert the size to MB (if valid) + local file_size_mb = tonumber(file_size_bytes) and tonumber(file_size_bytes) / (1024 * 1024) + or 0 + local file_size_mb_str = string.format("%.2f", file_size_mb) -- Format to 2 decimal places as a string + -- Add image information (filename, size, resolution) + local image_info = {} + table.insert(image_info, "Image File: " .. focused_entry) -- Add only the filename + if tonumber(file_size_bytes) > 0 then + table.insert(image_info, "Size: " .. file_size_mb_str .. " MB") -- Use the formatted string + else + table.insert(image_info, "Size: Unable to detect") -- Fallback if size isn't found + end + if img_width and img_height then + table.insert(image_info, "Resolution: " .. img_width .. " x " .. img_height) + else + table.insert(image_info, "Resolution: Unable to detect") + end + -- Append the image information after the image + local line_count = vim.api.nvim_buf_line_count(buf) + vim.api.nvim_buf_set_lines(buf, line_count, -1, false, { "", "", "" }) -- Add 3 empty lines + vim.api.nvim_buf_set_lines(buf, -1, -1, false, image_info) + -- Keymap for closing the popup and reopening mini.files + local function reopen_mini_files() + if img ~= nil then + img:clear() + end + vim.api.nvim_win_close(win, true) + -- Reopen mini.files in the same directory + require("mini.files").open(current_dir, true) + vim.defer_fn(function() + -- Simulate navigation to the file by searching for the line matching the file + local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false) -- Get all lines in the buffer + for i, line in ipairs(lines) do + if line:match(focused_entry) then + vim.api.nvim_win_set_cursor(0, { i, 0 }) -- Move cursor to the matching line + break + end + end + end, 50) -- Small delay to ensure mini.files is initialized + end + vim.keymap.set("n", "", reopen_mini_files, { buffer = buf, noremap = true, silent = true }) + else + vim.notify("Not an image file.", vim.log.levels.WARN) + end + else + vim.notify("No file selected or not a file.", vim.log.levels.WARN) + end + end + + local follow_symlink = function() + local curr_entry = mini_files.get_fs_entry() + if curr_entry and curr_entry.fs_type == "file" then + local resolved_path = vim.fn.resolve(curr_entry.path) -- Resolve symlink to original file + if resolved_path ~= curr_entry.path then + vim.notify("Following symlink to: " .. resolved_path, vim.log.levels.INFO) + mini_files.open(resolved_path, true) -- Open the original file in mini.files + else + vim.notify("The file is not a symlink.", vim.log.levels.WARN) + end + else + vim.notify("No file selected or not a valid file.", vim.log.levels.WARN) + end + end + + vim.api.nvim_create_autocmd("User", { + pattern = "MiniFilesBufferCreate", + callback = function() + local buf_id = vim.api.nvim_get_current_buf() + + vim.keymap.set( + "n", + opts.mappings and opts.mappings.toggle_hidden or "g.", + toggle_dotfiles, + { buffer = buf_id, desc = "Toggle hidden files" } + ) + + vim.keymap.set( + "n", + opts.mappings and opts.mappings.change_cwd or "gc", + files_set_cwd, + { buffer = buf_id, desc = "Set cwd" } + ) + + map_split(buf_id, opts.mappings and opts.mappings.go_in_horizontal or "s", "horizontal", false) + map_split(buf_id, opts.mappings and opts.mappings.go_in_vertical or "v", "vertical", false) + map_split( + buf_id, + opts.mappings and opts.mappings.go_in_horizontal_plus or "S", + "horizontal", + true + ) + map_split(buf_id, opts.mappings and opts.mappings.go_in_vertical_plus or "V", "vertical", true) + + vim.keymap.set( + "n", + "zt", + open_tmux_pane, + { buffer = buf_id, noremap = true, silent = true, desc = "Open tmux pane" } + ) + vim.keymap.set( + "n", + "zy", + copy_to_clipboard, + { buffer = buf_id, noremap = true, silent = true, desc = "Copy to clipboard" } + ) + vim.keymap.set( + "n", + "zY", + copy_path_to_clipboard, + { buffer = buf_id, desc = "Copy path to clipboard" } + ) + vim.keymap.set( + "n", + "zc", + zip_and_copy_to_clipboard, + { buffer = buf_id, noremap = true, silent = true, desc = "Zip and copy" } + ) + vim.keymap.set( + "n", + "zp", + paste_from_clipboard, + { buffer = buf_id, noremap = true, silent = true, desc = "Paste from clipboard" } + ) + vim.keymap.set( + "n", + "zi", + preview_image, + { buffer = buf_id, noremap = true, silent = true, desc = "Preview image" } + ) + vim.keymap.set( + "n", + "zI", + preview_image_popup, + { buffer = buf_id, noremap = true, silent = true, desc = "Pop-up preview image" } + ) + vim.keymap.set( + "n", + "gl", + follow_symlink, + { buffer = buf_id, noremap = true, silent = true, desc = "Follow link" } + ) + end, + }) + + -- Git status + local nsMiniFiles = vim.api.nvim_create_namespace("mini_files_git") + local autocmd = vim.api.nvim_create_autocmd + local _, MiniFiles = pcall(require, "mini.files") + + -- Cache for git status + local gitStatusCache = {} + local cacheTimeout = 2000 -- Cache timeout in milliseconds + + ---@type table + ---@param status string + ---@return string symbol, string hlGroup + local function mapSymbols(status) + local statusMap = { + -- stylua: ignore start + [" M"] = { symbol = "•", hlGroup = "GitSignsChange"}, -- Modified in the working directory + ["M "] = { symbol = "✹", hlGroup = "GitSignsChange"}, -- modified in index + ["MM"] = { symbol = "≠", hlGroup = "GitSignsChange"}, -- modified in both working tree and index + ["A "] = { symbol = "+", hlGroup = "GitSignsAdd" }, -- Added to the staging area, new file + ["AA"] = { symbol = "≈", hlGroup = "GitSignsAdd" }, -- file is added in both working tree and index + ["D "] = { symbol = "-", hlGroup = "GitSignsDelete"}, -- Deleted from the staging area + ["AM"] = { symbol = "⊕", hlGroup = "GitSignsChange"}, -- added in working tree, modified in index + ["AD"] = { symbol = "-•", hlGroup = "GitSignsChange"}, -- Added in the index and deleted in the working directory + ["R "] = { symbol = "→", hlGroup = "GitSignsChange"}, -- Renamed in the index + ["U "] = { symbol = "‖", hlGroup = "GitSignsChange"}, -- Unmerged path + ["UU"] = { symbol = "⇄", hlGroup = "GitSignsAdd" }, -- file is unmerged + ["UA"] = { symbol = "⊕", hlGroup = "GitSignsAdd" }, -- file is unmerged and added in working tree + ["??"] = { symbol = "?", hlGroup = "GitSignsDelete"}, -- Untracked files + ["!!"] = { symbol = "!", hlGroup = "GitSignsChange"}, -- Ignored files + -- stylua: ignore end + } + + local result = statusMap[status] or { symbol = "?", hlGroup = "NonText" } + return result.symbol, result.hlGroup + end + + ---@param cwd string + ---@param callback function + ---@return nil + local function fetchGitStatus(cwd, callback) + local function on_exit(content) + if content.code == 0 then + callback(content.stdout) + vim.g.content = content.stdout + end + end + vim.system({ "git", "status", "--ignored", "--porcelain" }, { text = true, cwd = cwd }, on_exit) + end + + ---@param str string? + local function escapePattern(str) + return str:gsub("([%^%$%(%)%%%.%[%]%*%+%-%?])", "%%%1") + end + + ---@param buf_id integer + ---@param gitStatusMap table + ---@return nil + local function updateMiniWithGit(buf_id, gitStatusMap) + vim.schedule(function() + local nlines = vim.api.nvim_buf_line_count(buf_id) + local cwd = vim.fs.root(buf_id, ".git") + local escapedcwd = escapePattern(cwd) + if vim.fn.has("win32") == 1 then + escapedcwd = escapedcwd:gsub("\\", "/") + end + + for i = 1, nlines do + local entry = MiniFiles.get_fs_entry(buf_id, i) + if not entry then + break + end + local relativePath = entry.path:gsub("^" .. escapedcwd .. "/", "") + local status = gitStatusMap[relativePath] + + if status then + local symbol, hlGroup = mapSymbols(status) + vim.api.nvim_buf_set_extmark(buf_id, nsMiniFiles, i - 1, 0, { + -- NOTE: if you want the signs on the right uncomment those and comment + -- the 3 lines after + -- virt_text = { { symbol, hlGroup } }, + -- virt_text_pos = "right_align", + sign_text = symbol, + sign_hl_group = hlGroup, + priority = 2, + }) + else + end + end + end) + end + + -- Thanks for the idea of gettings https://github.com/refractalize/oil-git-status.nvim signs for dirs + ---@param content string + ---@return table + local function parseGitStatus(content) + local gitStatusMap = {} + -- lua match is faster than vim.split (in my experience ) + for line in content:gmatch("[^\r\n]+") do + local status, filePath = string.match(line, "^(..)%s+(.*)") + -- Split the file path into parts + local parts = {} + for part in filePath:gmatch("[^/]+") do + table.insert(parts, part) + end + -- Start with the root directory + local currentKey = "" + for i, part in ipairs(parts) do + if i > 1 then + -- Concatenate parts with a separator to create a unique key + currentKey = currentKey .. "/" .. part + else + currentKey = part + end + -- If it's the last part, it's a file, so add it with its status + if i == #parts then + gitStatusMap[currentKey] = status + else + -- If it's not the last part, it's a directory. Check if it exists, if not, add it. + if not gitStatusMap[currentKey] then + gitStatusMap[currentKey] = status + end + end + end + end + return gitStatusMap + end + + ---@param buf_id integer + ---@return nil + local function updateGitStatus(buf_id) + if not vim.fs.root(vim.uv.cwd(), ".git") then + return + end + + local cwd = vim.fn.expand("%:p:h") + local currentTime = os.time() + if gitStatusCache[cwd] and currentTime - gitStatusCache[cwd].time < cacheTimeout then + updateMiniWithGit(buf_id, gitStatusCache[cwd].statusMap) + else + fetchGitStatus(cwd, function(content) + local gitStatusMap = parseGitStatus(content) + gitStatusCache[cwd] = { + time = currentTime, + statusMap = gitStatusMap, + } + updateMiniWithGit(buf_id, gitStatusMap) + end) + end + end + + ---@return nil + local function clearCache() + gitStatusCache = {} + end + + local function augroup(name) + return vim.api.nvim_create_augroup("MiniFiles_" .. name, { clear = true }) + end + + autocmd("User", { + group = augroup("start"), + pattern = "MiniFilesExplorerOpen", + callback = function() + local bufnr = vim.api.nvim_get_current_buf() + local path = vim.api.nvim_buf_get_name(bufnr) + if path:match("^minifiles://") then + return + end + updateGitStatus(bufnr) + end, + }) + + autocmd("User", { + group = augroup("close"), + pattern = "MiniFilesExplorerClose", + callback = function() + clearCache() + end, + }) + + autocmd("User", { + group = augroup("update"), + pattern = "MiniFilesBufferUpdate", + callback = function(sii) + local bufnr = sii.data.buf_id + local cwd = vim.fn.expand("%:p:h") + if gitStatusCache[cwd] then + updateMiniWithGit(bufnr, gitStatusCache[cwd].statusMap) + end + end, + }) + end, + }, + { + "echasnovski/mini.indentscope", + version = false, -- wait till new 0.7.0 release to put it back on semver + event = "VeryLazy", + opts = { + mappings = { + -- Textobjects + object_scope = "i-", + object_scope_with_border = "a-", + + -- Motions (jump to respective border line; if not present - body line) + goto_top = "g,", + goto_bottom = "g;", + }, + draw = { + animation = function() + return 0 + end, + }, + options = { try_as_border = true }, + symbol = "│", + }, + init = function() + vim.api.nvim_create_autocmd("FileType", { + pattern = { + "help", + "Trouble", + "trouble", + "lazy", + "mason", + }, + callback = function() + vim.b.miniindentscope_disable = true + end, + }) + end, + }, + { + "echasnovski/mini.map", + version = false, + config = function() + require("mini.map").setup( + -- No need to copy this inside `setup()`. Will be used automatically. + { + -- Highlight integrations (none by default) + integrations = nil, + + -- Symbols used to display data + symbols = { + -- Encode symbols. See `:h MiniMap.config` for specification and + -- `:h MiniMap.gen_encode_symbols` for pre-built ones. + -- Default: solid blocks with 3x2 resolution. + encode = nil, + + -- Scrollbar parts for view and line. Use empty string to disable any. + scroll_line = "█", + scroll_view = "┃", + }, + + -- Window options + window = { + -- Whether window is focusable in normal way (with `wincmd` or mouse) + focusable = true, + + -- Side to stick ('left' or 'right') + side = "right", + + -- Whether to show count of multiple integration highlights + show_integration_count = true, + + -- Total width + width = 10, + + -- Value of 'winblend' option + winblend = 25, + + -- Z-index + zindex = 10, + }, + } + ) + end, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v" }, + { "m", group = "Markdown/Map" }, + { "mt", group = "Toggle" }, + }) + end, + keys = { + { "mo", "lua MiniMap.open()", desc = "Open map" }, + { "mm", "lua MiniMap.refresh()", desc = "Refresh map" }, + { "mc", "lua MiniMap.close()", desc = "Close map" }, + { "mtm", "lua MiniMap.toggle()", desc = "Toggle map" }, + { "mts", "lua MiniMap.toggle_side()", desc = "Toggle side map" }, + }, + }, + { + "echasnovski/mini.move", + version = false, + config = function() + -- No need to copy this inside `setup()`. Will be used automatically. + require("mini.move").setup({ + -- Module mappings. Use `''` (empty string) to disable one. + mappings = { + -- Move visual selection in Visual mode. Defaults are Alt (Meta) + hjkl. + left = "", + right = "", + down = "", + up = "", + + -- Move current line in Normal mode + line_left = "", + line_right = "", + line_down = "", + line_up = "", + }, + + -- Options which control moving behavior + options = { + -- Automatically reindent selection during linewise vertical move + reindent_linewise = true, + }, + }) + end, + }, + { + "echasnovski/mini.pairs", + version = false, + event = "VeryLazy", + config = function() + require("mini.pairs").setup() + end, + keys = { + { + "zp", + function() + vim.g.minipairs_disable = not vim.g.minipairs_disable + end, + desc = "Toggle auto pairs", + }, + }, + }, + { + "echasnovski/mini.splitjoin", + version = false, + config = function() + require("mini.splitjoin").setup() + + vim.keymap.set( + "n", + "zj", + ":lua MiniSplitjoin.toggle()", + { noremap = true, silent = true, desc = "Toggle split-join" } + ) + vim.keymap.set( + "n", + "J", + ":lua MiniSplitjoin.join()", + { noremap = true, silent = true, desc = "Join" } + ) + vim.keymap.set( + "n", + "", + ":lua MiniSplitjoin.split()", + { noremap = true, silent = true, desc = "Split" } + ) + end, + }, + { + "echasnovski/mini.trailspace", + version = false, + config = function() + require("mini.trailspace").setup() + vim.keymap.set( + "n", + "zt", + ":lua MiniTrailspace.trim()", + { noremap = true, silent = true, desc = "Trim trailing whitespace" } + ) + vim.keymap.set( + "n", + "zl", + ":lua MiniTrailspace.trim_last_lines()", + { noremap = true, silent = true, desc = "Trim trailing empty lines" } + ) + end, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/navic.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/navic.lua new file mode 100644 index 0000000..89cfa81 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/navic.lua @@ -0,0 +1,52 @@ +return { + "SmiteshP/nvim-navic", + dependencies = { + "neovim/nvim-lspconfig", + }, + config = function() + require("nvim-navic").setup({ + icons = { + File = "󰈙 ", + Module = " ", + Namespace = "󰌗 ", + Package = " ", + Class = "󰌗 ", + Method = "󰆧 ", + Property = " ", + Field = " ", + Constructor = " ", + Enum = "󰕘", + Interface = "󰕘", + Function = "󰊕 ", + Variable = "󰆧 ", + Constant = "󰏿 ", + String = "󰀬 ", + Number = "󰎠 ", + Boolean = "◩ ", + Array = "󰅪 ", + Object = "󰅩 ", + Key = "󰌋 ", + Null = "󰟢 ", + EnumMember = " ", + Struct = "󰌗 ", + Event = " ", + Operator = "󰆕 ", + TypeParameter = "󰊄 ", + }, + lsp = { + auto_attach = true, + preference = nil, + }, + highlight = true, + separator = " > ", + depth_limit = 5, + depth_limit_indicator = "..", + safe_output = true, + lazy_update_context = false, + click = true, + format_text = function(text) + return text + end, + }) + end, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/neo-tree.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/neo-tree.lua new file mode 100644 index 0000000..6666f2d --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/neo-tree.lua @@ -0,0 +1,141 @@ +return { + -- { + -- "nvim-neo-tree/neo-tree.nvim", + -- branch = "v3.x", + -- dependencies = { + -- "nvim-lua/plenary.nvim", + -- "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + -- "MunifTanjim/nui.nvim", + -- { + -- "s1n7ax/nvim-window-picker", -- for open_with_window_picker keymaps + -- version = "2.*", + -- config = function() + -- require("window-picker").setup({ + -- filter_rules = { + -- include_current_win = false, + -- autoselect_one = true, + -- -- filter using buffer options + -- bo = { + -- -- if the file type is one of following, the window will be ignored + -- filetype = { "neo-tree", "neo-tree-popup", "notify" }, + -- -- if the buffer type is one of following, the window will be ignored + -- buftype = { "terminal", "quickfix" }, + -- }, + -- }, + -- }) + -- end, + -- }, + -- { "3rd/image.nvim", opts = {} }, -- Optional image support in preview window: See `# Preview Mode` for more information + -- }, + -- lazy = false, -- neo-tree will lazily load itself + -- ---@module "neo-tree" + -- ---@type neotree.Config? + -- opts = { + -- hijack_netrw_behavior = "disabled", -- netrw disabled, opening a directory opens neo-tree + -- filesystem = { + -- follow_current_file = { enabled = false }, + -- commands = { + -- -- over write default 'delete' command to 'trash'. + -- delete = function(state) + -- if vim.fn.executable("trash") == 0 then + -- vim.api.nvim_echo({ + -- { "- Trash utility not installed. Make sure to install it first\n", nil }, + -- { "- In macOS run `brew install trash`\n", nil }, + -- { "- Or delete the `custom delete command` section in neo-tree", nil }, + -- }, false, {}) + -- return + -- end + -- local inputs = require("neo-tree.ui.inputs") + -- local path = state.tree:get_node().path + -- local msg = "Are you sure you want to trash " .. path + -- inputs.confirm(msg, function(confirmed) + -- if not confirmed then + -- return + -- end + -- + -- vim.fn.system({ "trash", vim.fn.fnameescape(path) }) + -- require("neo-tree.sources.manager").refresh(state.name) + -- end) + -- end, + -- -- Overwrite default 'delete_visual' command to 'trash' x n. + -- delete_visual = function(state, selected_nodes) + -- if vim.fn.executable("trash") == 0 then + -- vim.api.nvim_echo({ + -- { "- Trash utility not installed. Make sure to install it first\n", nil }, + -- { "- In macOS run `brew install trash`\n", nil }, + -- { "- Or delete the `custom delete command` section in neo-tree", nil }, + -- }, false, {}) + -- return + -- end + -- local inputs = require("neo-tree.ui.inputs") + -- + -- -- Function to get the count of items in a table + -- local function GetTableLen(tbl) + -- local len = 0 + -- for _ in pairs(tbl) do + -- len = len + 1 + -- end + -- return len + -- end + -- + -- local count = GetTableLen(selected_nodes) + -- local msg = "Are you sure you want to trash " .. count .. " files?" + -- inputs.confirm(msg, function(confirmed) + -- if not confirmed then + -- return + -- end + -- for _, node in ipairs(selected_nodes) do + -- vim.fn.system({ "trash", vim.fn.fnameescape(node.path) }) + -- end + -- require("neo-tree.sources.manager").refresh(state.name) + -- end) + -- end, + -- }, + -- }, + -- }, + -- keys = { + -- { "e", false }, + -- { "E", false }, + -- { + -- "en", + -- function() + -- local buf_name = vim.api.nvim_buf_get_name(0) + -- -- Function to check if NeoTree is open in any window + -- local function is_neo_tree_open() + -- for _, win in ipairs(vim.api.nvim_list_wins()) do + -- local buf = vim.api.nvim_win_get_buf(win) + -- if vim.bo[buf].filetype == "neo-tree" then + -- return true + -- end + -- end + -- return false + -- end + -- -- Check if the current file exists + -- if + -- vim.fn.filereadable(buf_name) == 1 + -- or vim.fn.isdirectory(vim.fn.fnamemodify(buf_name, ":p:h")) == 1 + -- then + -- if is_neo_tree_open() then + -- -- Close NeoTree if it's open + -- vim.cmd("Neotree close") + -- else + -- -- Open NeoTree and reveal the current file + -- vim.cmd("Neotree reveal") + -- end + -- else + -- -- If the file doesn't exist, execute the logic for R + -- require("neo-tree.command").execute({ toggle = true, dir = vim.uv.cwd() }) + -- end + -- end, + -- desc = "Open neo-tree", + -- }, + -- { + -- "eN", + -- function() + -- require("neo-tree.command").execute({ toggle = true, dir = vim.uv.cwd() }) + -- end, + -- desc = "Open neo-tree (cwd)", + -- }, + -- }, + -- }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/obsidian.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/obsidian.lua new file mode 100644 index 0000000..c5f3a59 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/obsidian.lua @@ -0,0 +1,616 @@ +return { + "epwalsh/obsidian.nvim", + version = "*", -- recommended, use latest release instead of latest commit + lazy = true, + ft = "markdown", + -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault: + -- event = { + -- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'. + -- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md" + -- -- refer to `:h file-pattern` for more examples + -- "BufReadPre path/to/my-vault/*.md", + -- "BufNewFile path/to/my-vault/*.md", + -- }, + dependencies = { + -- Required. + "nvim-lua/plenary.nvim", + -- see below for full list of optional dependencies 👇 + "hrsh7th/nvim-cmp", + "nvim-telescope/telescope.nvim", + "nvim-treesitter/nvim-treesitter", + { + "epwalsh/pomo.nvim", + dependencies = "nvim-lualine/lualine.nvim", + config = function() + require("lualine").setup({ + sections = { + lualine_x = { + function() + local ok, pomo = pcall(require, "pomo") + if not ok then + return "" + end + + local timer = pomo.get_first_to_finish() + if timer == nil then + return "" + end + + return "󰄉 " .. tostring(timer) + end, + "encoding", + "fileformat", + "filetype", + }, + }, + }) + + require("telescope").load_extension("pomodori") + + vim.keymap.set("n", "mp", function() + require("telescope").extensions.pomodori.timers() + end, { desc = "Manage pomodori" }) + end, + }, + }, + cmd = { + "ObsidianOpen", + "ObsidianNew", + "ObsidianQuickSwitch", + "ObsidianFollowLink", + "ObsidianBacklinks", + "ObsidianTags", + "ObsidianToday", + "ObsidianYesterday", + "ObsidianTomorrow", + "ObsidianDailies", + "ObsidianTemplate", + "ObsidianSearch", + "ObsidianLink", + "ObsidianLinkNew", + "ObsidianExtractNote", + "ObsidianWorkspace", + "ObsidianPasteImg", + "ObsidianRename", + "ObsidianToggleCheckbox", + "ObsidianNewFromTemplate", + "ObsidianTOC", + }, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v", "x" }, + { "o", group = "Open/Obsidian" }, + { "of", group = "Find files (Obsidian)" }, + { "on", group = "Notes (Obsidian)" }, + { "op", group = "Paste (Obsidian)" }, + { "ot", group = "Templates (Obsidian)" }, + }) + end, + config = function() + require("obsidian").setup({ + -- A list of workspace names, paths, and configuration overrides. + -- If you use the Obsidian app, the 'path' of a workspace should generally be + -- your vault root (where the `.obsidian` folder is located). + -- When obsidian.nvim is loaded by your plugin manager, it will automatically set + -- the workspace to the first workspace in the list whose `path` is a parent of the + -- current markdown file being edited. + workspaces = { + { + name = "personal", + path = "~/Private/repos/Obsidian/SI", + -- Optional, override certain settings. + overrides = { + notes_subdir = "", + }, + }, + }, + + -- Alternatively - and for backwards compatibility - you can set 'dir' to a single path instead of + -- 'workspaces'. For example: + -- dir = "~/vaults/work", + + -- Optional, if you keep notes in a specific subdirectory of your vault. + notes_subdir = "", + + -- Optional, set the log level for obsidian.nvim. This is an integer corresponding to one of the log + -- levels defined by "vim.log.levels.*". + log_level = vim.log.levels.INFO, + + daily_notes = { + -- Optional, if you keep daily notes in a separate directory. + folder = "Area/Notes", + -- Optional, if you want to change the date format for the ID of daily notes. + date_format = "%Y-%m-%d", + -- Optional, if you want to change the date format of the default alias of daily notes. + alias_format = "%B %-d, %Y", + -- Optional, default tags to add to each new daily note created. + default_tags = { "daily-notes" }, + -- Optional, if you want to automatically insert a template from your template directory like 'daily.md' + template = nil, + }, + + -- Optional, completion of wiki links, local markdown links, and tags using nvim-cmp. + completion = { + -- Set to false to disable completion. + nvim_cmp = true, + -- Trigger completion at 2 chars. + min_chars = 2, + }, + + -- Optional, configure key mappings. These are the defaults. If you don't want to set any keymappings this + -- way then set 'mappings = {}'. + mappings = { + -- Smart action depending on context, either follow link or toggle checkbox. + [""] = { + action = function() + return require("obsidian").util.smart_action() + end, + opts = { buffer = true, expr = true }, + }, + }, + + -- Where to put new notes. Valid options are + -- * "current_dir" - put new notes in same directory as the current buffer. + -- * "notes_subdir" - put new notes in the default notes subdirectory. + new_notes_location = "current_dir", + + -- Optional, customize how note IDs are generated given an optional title. + ---@param title string|? + ---@return string + note_id_func = function(title) + -- Create note IDs in a Zettelkasten format with a timestamp and a suffix. + -- In this case a note with the title 'My new note' will be given an ID that looks + -- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md' + local suffix = "" + if title ~= nil then + -- If title is given, transform it into valid file name. + suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower() + else + -- If title is nil, just add 4 random uppercase letters to the suffix. + for _ = 1, 4 do + suffix = suffix .. string.char(math.random(65, 90)) + end + end + return suffix + end, + + -- Optional, customize how note file names are generated given the ID, target directory, and title. + ---@param spec { id: string, dir: obsidian.Path, title: string|? } + ---@return string|obsidian.Path The full path to the new note. + note_path_func = function(spec) + -- This is equivalent to the default behavior. + local path = spec.dir / "Contents" / tostring(spec.title) + return path:with_suffix(".md") + end, + + -- Optional, customize how wiki links are formatted. You can set this to one of: + -- * "use_alias_only", e.g. '[[Foo Bar]]' + -- * "prepend_note_id", e.g. '[[foo-bar|Foo Bar]]' + -- * "prepend_note_path", e.g. '[[foo-bar.md|Foo Bar]]' + -- * "use_path_only", e.g. '[[foo-bar.md]]' + -- Or you can set it to a function that takes a table of options and returns a string, like this: + wiki_link_func = function(opts) + return require("obsidian.util").wiki_link_path_prefix(opts) + end, + + -- Optional, customize how markdown links are formatted. + markdown_link_func = function(opts) + return require("obsidian.util").markdown_link(opts) + end, + + -- Either 'wiki' or 'markdown'. + preferred_link_style = "wiki", + + -- Optional, boolean or a function that takes a filename and returns a boolean. + -- `true` indicates that you don't want obsidian.nvim to manage frontmatter. + disable_frontmatter = false, + + -- -- Optional, alternatively you can customize the frontmatter data. + -- ---@return table + -- note_frontmatter_func = function(note) + -- -- Add the title of the note as an alias. + -- if note.title then + -- note:add_alias(note.title) + -- end + -- + -- local out = { id = note.id, aliases = note.aliases, tags = note.tags } + -- + -- -- `note.metadata` contains any manually added fields in the frontmatter. + -- -- So here we just make sure those fields are kept in the frontmatter. + -- if note.metadata ~= nil and not vim.tbl_isempty(note.metadata) then + -- for k, v in pairs(note.metadata) do + -- out[k] = v + -- end + -- end + -- + -- return out + -- end, + + -- Optional, for templates (see below). + templates = { + folder = "Resource/Templates", + date_format = "%Y-%m-%d", + time_format = "%H:%M", + -- A map for custom variables, the key should be the variable and the value a function + substitutions = {}, + }, + + -- Optional, by default when you use `:ObsidianFollowLink` on a link to an external + -- URL it will be ignored but you can customize this behavior here. + ---@param url string + follow_url_func = function(url) + -- Open the URL in the default web browser. + -- vim.fn.jobstart({ "open", url }) -- Mac OS + vim.fn.jobstart({ "xdg-open", url }) -- linux + -- vim.cmd(':silent exec "!start ' .. url .. '"') -- Windows + -- vim.ui.open(url) -- need Neovim 0.10.0+ + end, + + -- Optional, by default when you use `:ObsidianFollowLink` on a link to an image + -- file it will be ignored but you can customize this behavior here. + ---@param img string + follow_img_func = function(img) + -- vim.fn.jobstart({ "qlmanage", "-p", img }) -- Mac OS quick look preview + vim.fn.jobstart({ "nsxiv", "-aiop", img }) -- linux + -- vim.cmd(':silent exec "!start ' .. url .. '"') -- Windows + end, + + -- Optional, set to true if you use the Obsidian Advanced URI plugin. + -- https://github.com/Vinzent03/obsidian-advanced-uri + use_advanced_uri = false, + + -- Optional, set to true to force ':ObsidianOpen' to bring the app to the foreground. + open_app_foreground = false, + + picker = { + -- Set your preferred picker. Can be one of 'telescope.nvim', 'fzf-lua', or 'mini.pick'. + name = "telescope.nvim", + -- Optional, configure key mappings for the picker. These are the defaults. + -- Not all pickers support all mappings. + note_mappings = { + -- Create a new note from your query. + new = "", + -- Insert a link to the selected note. + insert_link = "", + }, + tag_mappings = { + -- Add tag(s) to current note. + tag_note = "", + -- Insert a tag at the current location. + insert_tag = "", + }, + }, + + -- Optional, sort search results by "path", "modified", "accessed", or "created". + -- The recommend value is "modified" and `true` for `sort_reversed`, which means, for example, + -- that `:ObsidianQuickSwitch` will show the notes sorted by latest modified time + sort_by = "modified", + sort_reversed = true, + + -- Set the maximum number of lines to read from notes on disk when performing certain searches. + search_max_lines = 1000, + + -- Optional, determines how certain commands open notes. The valid options are: + -- 1. "current" (the default) - to always open in the current window + -- 2. "vsplit" - to open in a vertical split if there's not already a vertical split + -- 3. "hsplit" - to open in a horizontal split if there's not already a horizontal split + open_notes_in = "current", + + -- Optional, define your own callbacks to further customize behavior. + callbacks = { + -- Runs at the end of `require("obsidian").setup()`. + ---@param client obsidian.Client + post_setup = function(client) end, + + -- Runs anytime you enter the buffer for a note. + ---@param client obsidian.Client + ---@param note obsidian.Note + enter_note = function(client, note) end, + + -- Runs anytime you leave the buffer for a note. + ---@param client obsidian.Client + ---@param note obsidian.Note + leave_note = function(client, note) end, + + -- Runs right before writing the buffer for a note. + ---@param client obsidian.Client + ---@param note obsidian.Note + pre_write_note = function(client, note) end, + + -- Runs anytime the workspace is set/changed. + ---@param client obsidian.Client + ---@param workspace obsidian.Workspace + post_set_workspace = function(client, workspace) end, + }, + + -- Optional, configure additional syntax highlighting / extmarks. + -- This requires you have `conceallevel` set to 1 or 2. See `:help conceallevel` for more details. + ui = { + enable = false, -- set to false to disable all additional syntax features + update_debounce = 200, -- update delay after a text change (in milliseconds) + max_file_length = 5000, -- disable UI features for files with more than this many lines + -- Define how various check-boxes are displayed + checkboxes = { + -- NOTE: the 'char' value has to be a single character, and the highlight groups are defined below. + [" "] = { char = "󰄱", hl_group = "ObsidianTodo" }, + ["x"] = { char = "", hl_group = "ObsidianDone" }, + [">"] = { char = "", hl_group = "ObsidianRightArrow" }, + ["~"] = { char = "󰰱", hl_group = "ObsidianTilde" }, + ["!"] = { char = "", hl_group = "ObsidianImportant" }, + -- Replace the above with this if you don't have a patched font: + -- [" "] = { char = "☐", hl_group = "ObsidianTodo" }, + -- ["x"] = { char = "✔", hl_group = "ObsidianDone" }, + + -- You can also add more custom ones... + }, + -- Use bullet marks for non-checkbox lists. + bullets = { char = "•", hl_group = "ObsidianBullet" }, + external_link_icon = { char = "", hl_group = "ObsidianExtLinkIcon" }, + -- Replace the above with this if you don't have a patched font: + -- external_link_icon = { char = "", hl_group = "ObsidianExtLinkIcon" }, + reference_text = { hl_group = "ObsidianRefText" }, + highlight_text = { hl_group = "ObsidianHighlightText" }, + tags = { hl_group = "ObsidianTag" }, + block_ids = { hl_group = "ObsidianBlockID" }, + hl_groups = { + -- The options are passed directly to `vim.api.nvim_set_hl()`. See `:help nvim_set_hl`. + ObsidianTodo = { bold = true, fg = "#f78c6c" }, + ObsidianDone = { bold = true, fg = "#89ddff" }, + ObsidianRightArrow = { bold = true, fg = "#f78c6c" }, + ObsidianTilde = { bold = true, fg = "#ff5370" }, + ObsidianImportant = { bold = true, fg = "#d73128" }, + ObsidianBullet = { bold = true, fg = "#89ddff" }, + ObsidianRefText = { underline = true, fg = "#c792ea" }, + ObsidianExtLinkIcon = { fg = "#c792ea" }, + ObsidianTag = { italic = true, fg = "#89ddff" }, + ObsidianBlockID = { italic = true, fg = "#89ddff" }, + ObsidianHighlightText = { bg = "#75662e" }, + }, + }, + + -- Specify how to handle attachments. + attachments = { + -- The default folder to place images in via `:ObsidianPasteImg`. + -- If this is a relative path it will be interpreted as relative to the vault root. + -- You can always override this per image by passing a full path to the command instead of just a filename. + img_folder = "assets/imgs", -- This is the default + + -- Optional, customize the default name or prefix when pasting images via `:ObsidianPasteImg`. + ---@return string + img_name_func = function() + -- Prefix image names with timestamp. + return string.format("%s-", os.time()) + end, + + -- A function that determines the text to insert in the note when pasting an image. + -- It takes two arguments, the `obsidian.Client` and an `obsidian.Path` to the image file. + -- This is the default implementation. + ---@param client obsidian.Client + ---@param path obsidian.Path the absolute path to the image file + ---@return string + img_text_func = function(client, path) + path = client:vault_relative_path(path) or path + return string.format("![%s](%s)", path.name, path) + end, + }, + }) + + vim.api.nvim_create_autocmd("FileType", { + pattern = "markdown", + callback = function() + vim.keymap.set("n", "gl", function() + if require("obsidian").util.cursor_on_markdown_link() then + return "ObsidianFollowLink" + else + return "gl" + end + end, { noremap = false, expr = true, desc = "Follow link (Obsidian)" }) + end, + }) + end, + keys = { + { + "zb", + function() + return require("obsidian").util.toggle_checkbox() + end, + buffer = true, + ft = "markdown", + desc = "Toggle check box (Obsidian)", + }, + { + "ob", + function() + local query = vim.fn.input("Enter query: ") + if query and #query > 0 then + vim.cmd("ObsidianOpen " .. query) + end + end, + ft = "markdown", + desc = "Open note (Obsidian)", + }, + { + "onn", + function() + local title = vim.fn.input("Enter title: ") + if title and #title > 0 then + vim.cmd("ObsidianNew " .. title) + end + end, + ft = "markdown", + desc = "New note (Obsidian)", + }, + { + "os", + "ObsidianQuickSwitch", + ft = "markdown", + desc = "Quick switch (Obsidian)", + }, + { + "oL", + "ObsidianFollowLink", + ft = "markdown", + desc = "Follow link (Obsidian)", + }, + { + "oH", + "ObsidianBacklinks", + ft = "markdown", + desc = "Back link (Obsidian)", + }, + { + "oft", + function() + local tags = vim.fn.input("Enter tag: ") + if tags and #tags > 0 then + vim.cmd("ObsidianTags " .. tags) + end + end, + ft = "markdown", + desc = "Search tag notes (Obsidian)", + }, + { + "ont", + function() + local offset = vim.fn.input("Enter offset: ") + if offset and #offset > 0 then + vim.cmd("ObsidianToday " .. offset) + else + vim.cmd("ObsidianToday") + end + end, + ft = "markdown", + desc = "Today note (Obsidian)", + }, + { + "ony", + "ObsidianYesterday", + ft = "markdown", + desc = "Yesterday note (Obsidian)", + }, + { + "ont", + "ObsidianTomorrow", + ft = "markdown", + desc = "Tomorrow note (Obsidian)", + }, + { + "ond", + function() + local offset = vim.fn.input("Enter offset: ") + if offset and #offset > 0 then + vim.cmd("ObsidianDailies " .. offset) + else + vim.cmd("ObsidianDailies") + end + end, + ft = "markdown", + desc = "Daily notes (Obsidian)", + }, + { + "oti", + "ObsidianTemplate", + ft = "markdown", + desc = "Insert templates (Obsidian)", + }, + { + "ofn", + function() + local note = vim.fn.input("Enter note: ") + if note and #note > 0 then + vim.cmd("ObsidianSearch " .. note) + end + end, + ft = "markdown", + desc = "Search note (Obsidian)", + }, + { + "ow", + function() + local name = vim.fn.input("Enter name: ") + if name and #name > 0 then + vim.cmd("ObsidianWorkspace " .. name) + end + end, + ft = "markdown", + desc = "Workspace name (Obsidian)", + }, + { + "opi", + function() + local image = vim.fn.input("Enter image: ") + if image and #image > 0 then + vim.cmd("ObsidianPasteImg " .. image) + end + end, + ft = "markdown", + desc = "Paste image (Obsidian)", + }, + { + "onr", + function() + local name = vim.fn.input("Enter name: ") + if name and #name > 0 then + vim.cmd("ObsidianRename " .. name) + end + end, + ft = "markdown", + desc = "Rename note (Obsidian)", + }, + { + mode = "v", + "ol", + function() + local query = vim.fn.input("Enter query: ") + if query and #query > 0 then + vim.cmd("ObsidianLink " .. query) + else + vim.cmd("ObsidianLink") + end + end, + ft = "markdown", + desc = "Link query (Obsidian)", + }, + { + mode = "v", + "onl", + function() + local note = vim.fn.input("Enter note: ") + if note and #note > 0 then + vim.cmd("ObsidianLinkNew " .. note) + else + vim.cmd("ObsidianLinkNew") + end + end, + ft = "markdown", + desc = "New link note (Obsidian)", + }, + { + mode = "v", + "ox", + function() + local note = vim.fn.input("Enter note: ") + if note and #note > 0 then + vim.cmd("ObsidianExtractNote " .. note) + else + vim.cmd("ObsidianExtractNote") + end + end, + ft = "markdown", + desc = "New extract text (Obsidian)", + }, + { + "otn", + "ObsidianNewFromTemplate", + ft = "markdown", + desc = "Open new note with template (Obsidian)", + }, + { + "oc", + "ObsidianTOC", + ft = "markdown", + desc = "Open contents (Obsidian)", + }, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/outline.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/outline.lua new file mode 100644 index 0000000..5d28f7d --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/outline.lua @@ -0,0 +1,11 @@ +return { + "hedyhli/outline.nvim", + lazy = true, + cmd = { "Outline", "OutlineOpen" }, + keys = { -- Example mapping to toggle outline + { "zo", "Outline", desc = "Toggle outline" }, + }, + opts = { + -- Your setup opts here + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/project.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/project.lua new file mode 100644 index 0000000..13ee82b --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/project.lua @@ -0,0 +1,12 @@ +return { + "Zeioth/project.nvim", + dependencies = "nvim-telescope/telescope.nvim", + config = function() + require("project_nvim").setup() + require("telescope").load_extension("projects") + + vim.keymap.set("n", "fpj", function() + require("telescope").extensions.projects.projects() + end, { desc = "Find projects" }) + end, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/python.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/python.lua new file mode 100644 index 0000000..bacdd9b --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/python.lua @@ -0,0 +1,55 @@ +return { + -- { + -- "bps/vim-textobj-python", + -- dependencies = { "kana/vim-textobj-user" }, + -- }, + { + "nvim-neotest/neotest", + optional = true, + dependencies = { + "nvim-neotest/neotest-python", + }, + opts = { + adapters = { + ["neotest-python"] = { + -- Here you can specify the settings for the adapter, i.e. + -- runner = "pytest", + -- python = ".venv/bin/python", + }, + }, + }, + }, + { + "linux-cultist/venv-selector.nvim", + dependencies = { + "neovim/nvim-lspconfig", + "mfussenegger/nvim-dap", + "mfussenegger/nvim-dap-python", --optional + { "nvim-telescope/telescope.nvim", branch = "0.1.x", dependencies = { "nvim-lua/plenary.nvim" } }, + }, + lazy = false, + branch = "regexp", -- This is the regexp branch, use this for the new version + ft = "python", + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v" }, + { "v", group = "Virtual envs" }, + }) + end, + config = function() + require("venv-selector").setup({ + notify_user_on_activate = true, + search = { + venvs = { + command = "fd /bin/python$ ~/.local/share/venvs --full-path", + }, + }, + }) + end, + keys = { + { "vs", "VenvSelect", desc = "Select virtual env", ft = "python" }, + { "vc", "VenvSelectCached", desc = "Select venv (cache)", ft = "python" }, + }, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/quickfix.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/quickfix.lua new file mode 100644 index 0000000..f586310 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/quickfix.lua @@ -0,0 +1,76 @@ +return { + { + "folke/trouble.nvim", + cmd = { "Trouble" }, + opts = { + modes = { + lsp = { + win = { position = "right" }, + }, + preview_float = { + mode = "diagnostics", + preview = { + type = "float", + relative = "editor", + border = "rounded", + title = "Preview", + title_pos = "center", + position = { 0, -2 }, + size = { width = 0.3, height = 0.3 }, + zindex = 200, + }, + }, + }, + }, + config = function(_, opts) + require("trouble").setup(opts) + end, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v", "x" }, + { "x", group = "Quickfix (trouble)" }, + }) + end, + keys = { + { "xd", "Trouble diagnostics toggle", desc = "Toggle diagnostics (Trouble)" }, + { + "xD", + "Trouble diagnostics toggle filter.buf=0", + desc = "Toggle buffer Diagnostics (Trouble)", + }, + { "xs", "Trouble symbols toggle", desc = "Toggle symbols (Trouble)" }, + { "xS", "Trouble lsp toggle", desc = "Toggle LSP def/ref/... (Trouble)" }, + { "xl", "Trouble loclist toggle", desc = "Toggle location List (Trouble)" }, + { "xq", "Trouble qflist toggle", desc = "Toggle quickfix List (Trouble)" }, + { + "[x", + function() + if require("trouble").is_open() then + require("trouble").prev({ skip_groups = true, jump = true }) + else + local ok, err = pcall(vim.cmd.cprev) + if not ok then + vim.notify(err, vim.log.levels.ERROR) + end + end + end, + desc = "Previous quickfix (trouble)", + }, + { + "]x", + function() + if require("trouble").is_open() then + require("trouble").next({ skip_groups = true, jump = true }) + else + local ok, err = pcall(vim.cmd.cnext) + if not ok then + vim.notify(err, vim.log.levels.ERROR) + end + end + end, + desc = "Next quickfix (trouble)", + }, + }, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/refactoring.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/refactoring.lua new file mode 100644 index 0000000..8bcf274 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/refactoring.lua @@ -0,0 +1,78 @@ +return { + "ThePrimeagen/refactoring.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + }, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v", "x" }, + { "r", group = "Compiler/Refactoring" }, + { "rb", group = "Extract block" }, + }) + end, + lazy = false, + config = function() + require("refactoring").setup({ + prompt_func_return_type = { + c = true, + cpp = true, + cxx = true, + go = true, + h = true, + hpp = true, + java = true, + lua = true, + python = true, + }, + prompt_func_param_type = { + c = true, + cpp = true, + cxx = true, + go = true, + h = true, + hpp = true, + java = true, + lua = true, + python = true, + }, + printf_statements = {}, + print_var_statements = {}, + show_success_message = false, + }) + vim.keymap.set({ "n", "x" }, "re", function() + return require("refactoring").refactor("Extract Function") + end, { expr = true, desc = "Extract" }) + vim.keymap.set({ "n", "x" }, "rf", function() + return require("refactoring").refactor("Extract Function To File") + end, { expr = true, desc = "Extract to file" }) + vim.keymap.set({ "n", "x" }, "rv", function() + return require("refactoring").refactor("Extract Variable") + end, { expr = true, desc = "Extract variable" }) + vim.keymap.set({ "n", "x" }, "rI", function() + return require("refactoring").refactor("Inline Function") + end, { expr = true, desc = "Refactor inline function" }) + vim.keymap.set({ "n", "x" }, "ri", function() + return require("refactoring").refactor("Inline Variable") + end, { expr = true, desc = "Refactor inline variable" }) + + vim.keymap.set({ "n", "x" }, "rbb", function() + return require("refactoring").refactor("Extract Block") + end, { expr = true, desc = "Extract block" }) + vim.keymap.set({ "n", "x" }, "rbf", function() + return require("refactoring").refactor("Extract Block To File") + end, { expr = true, desc = "Extract block to file" }) + + -- prompt for a refactor to apply when the remap is triggered + vim.keymap.set({ "n", "x" }, "rs", function() + require("refactoring").select_refactor({ prefer_ex_cmd = true }) + end, { desc = "Refactor selection" }) + -- Note that not all refactor support both normal and visual mode + -- load refactoring Telescope extension + require("telescope").load_extension("refactoring") + vim.keymap.set({ "n", "x" }, "rf", function() + require("telescope").extensions.refactoring.refactors() + end, { desc = "Open refactor" }) + end, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/sessions.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/sessions.lua new file mode 100644 index 0000000..3a644c1 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/sessions.lua @@ -0,0 +1,60 @@ +return { + "rmagatti/auto-session", + lazy = false, + config = function() + require("auto-session").setup({ + enabled = true, -- Enables/disables auto creating, saving and restoring + root_dir = vim.fn.stdpath("data") .. "/sessions/", -- Root dir where sessions will be stored + auto_save = true, -- Enables/disables auto saving session on exit + auto_restore = false, -- Enables/disables auto restoring session on start + auto_create = true, -- Enables/disables auto creating new session files. Can take a function that should return true/false if a new session file should be created or not + suppressed_dirs = nil, -- Suppress session restore/create in certain directories + allowed_dirs = nil, -- Allow session restore/create in certain directories + auto_restore_last_session = false, -- On startup, loads the last saved session if session for cwd does not exist + git_use_branch_name = true, -- Include git branch name in session name + git_auto_restore_on_branch_change = true, -- Should we auto-restore the session when the git branch changes. Requires git_use_branch_name + lazy_support = true, -- Automatically detect if Lazy.nvim is being used and wait until Lazy is done to make sure session is restored correctly. Does nothing if Lazy isn't being used. Can be disabled if a problem is suspected or for debugging + bypass_save_filetypes = nil, -- List of filetypes to bypass auto save when the only buffer open is one of the file types listed, useful to ignore dashboards + close_unsupported_windows = true, -- Close windows that aren't backed by normal file before autosaving a session + args_allow_single_directory = true, -- Follow normal sesion save/load logic if launched with a single directory as the only argument + args_allow_files_auto_save = false, -- Allow saving a session even when launched with a file argument (or multiple files/dirs). It does not load any existing session first. While you can just set this to true, you probably want to set it to a function that decides when to save a session when launched with file args. See documentation for more detail + continue_restore_on_error = true, -- Keep loading the session even if there's an error + show_auto_restore_notif = false, -- Whether to show a notification when auto-restoring + cwd_change_handling = false, -- Follow cwd changes, saving a session before change and restoring after + lsp_stop_on_restore = false, -- Should language servers be stopped when restoring a session. Can also be a function that will be called if set. Not called on autorestore from startup + restore_error_handler = nil, -- Called when there's an error restoring. By default, it ignores fold errors otherwise it displays the error and returns false to disable auto_save + purge_after_minutes = nil, -- Sessions older than purge_after_minutes will be deleted asynchronously on startup, e.g. set to 14400 to delete sessions that haven't been accessed for more than 10 days, defaults to off (no purging), requires >= nvim 0.10 + log_level = "error", -- Sets the log level of the plugin (debug, info, warn, error). + + session_lens = { + load_on_setup = true, -- Initialize on startup (requires Telescope) + theme_conf = { -- Pass through for Telescope theme options + layout_config = { -- As one example, can change width/height of picker + -- width = 0.8, -- percent of window + -- height = 0.5, + }, + }, + previewer = false, -- File preview for session picker + + mappings = { + -- Mode can be a string or a table, e.g. {"i", "n"} for both insert and normal mode + delete_session = { "i", "" }, + alternate_session = { "i", "" }, + copy_session = { "i", "" }, + }, + + session_control = { + control_dir = vim.fn.stdpath("data") .. "/auto_session/", -- Auto session control dir, for control files, like alternating between two sessions with session-lens + control_filename = "session_control.json", -- File name of the session control file + }, + }, + }) + end, + keys = { + { "fs", "SessionSearch", desc = "Session search" }, + { "ws", "SessionSave", desc = "Save session" }, + { "wx", "SessionDisableAutoSave", desc = "Disable autosave" }, + { "wp", "SessionPurgeOrphaned", desc = "Purge autosave" }, + { "wa", "SessionToggleAutoSave", desc = "Toggle autosave" }, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/silicon.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/silicon.lua new file mode 100644 index 0000000..b708e60 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/silicon.lua @@ -0,0 +1,152 @@ +return { + "michaelrommel/nvim-silicon", + lazy = true, + cmd = "Silicon", + main = "nvim-silicon", + opts = { + -- Configuration here, or leave empty to use defaults + -- disable_defaults will disable all builtin default settings apart + -- from the base arguments, that are needed to call silicon at all, see + -- mandatory_options below, also those options can be overridden + -- all of the settings could be overridden in the lua setup call, + -- but this clashes with the use of an external silicon --config=file, + -- see issue #9 + disable_defaults = false, + -- turn on debug messages + debug = false, + -- most of them could be overridden with other + -- the font settings with size and fallback font + -- Example: font = "VictorMono NF=34;Noto Emoji", + font = nil, + -- the theme to use, depends on themes available to silicon + theme = "gruvbox-dark", + -- the background color outside the rendered os window + -- (in hexcode string e.g "#076678") + background = nil, + -- a path to a background image + background_image = nil, + -- the paddings to either side + pad_horiz = 100, + pad_vert = 80, + -- whether to have the os window rendered with rounded corners + no_round_corner = false, + -- whether to put the close, minimize, maximise traffic light + -- controls on the border + no_window_controls = false, + -- whether to turn off the line numbers + no_line_number = false, + -- with which number the line numbering shall start + line_offset = 1, + -- here a function is used to return the actual source code line number + -- line_offset = function(args) + -- return args.line1 + -- end, + + -- the distance between lines of code + line_pad = 0, + -- the rendering of tab characters as so many space characters + tab_width = 4, + -- with which language the syntax highlighting shall be done, should be + -- a function that returns either a language name or an extension like "js" + -- it is set to nil, so you can override it, if you do not set it, we try the + -- filetype first, and if that fails, the extension + language = nil, + -- language = function() + -- return vim.bo.filetype + -- end, + -- language = function() + -- return vim.fn.fnamemodify( + -- vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()), + -- ":e" + -- ) + -- end, + + -- if the shadow below the os window should have be blurred + shadow_blur_radius = 16, + -- the offset of the shadow in x and y directions + shadow_offset_x = 8, + shadow_offset_y = 8, + -- the color of the shadow (in hexcode string e.g "#100808") + shadow_color = nil, + -- whether to strip of superfluous leading whitespace + gobble = true, + -- a string to pad each line with after gobbling removed larger indents, + num_separator = nil, + -- here a bar glyph is used to draw a vertial line and some space + -- num_separator = "\u{258f} ", + + -- whether to put the image onto the clipboard, may produce an error, + -- if run on WSL2 + to_clipboard = false, + -- a string or function returning a string that defines the title + -- showing in the image, only works in silicon versions greater than v0.5.1 + window_title = nil, + -- here a function is used to get the name of the current buffer + -- window_title = function() + -- return vim.fn.fnamemodify( + -- vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()), + -- ":t" + -- ) + -- end, + + -- how to deal with the clipboard on WSL2 + -- possible values are: never, always, auto + wslclipboard = nil, + -- what to do with the temporary screenshot image file when using the Windows + -- clipboard from WSL2, possible values are: keep, delete + wslclipboardcopy = nil, + -- the silicon command, put an absolute location here, if the + -- command is not in your ${PATH} + command = "silicon", + -- a string or function that defines the path to the output image + -- output = nil, + -- here a function is used to create a file in the current directory + output = function() + local home_dir = vim.fn.expand("~") -- Get home directory + local timestamp = os.date("!%Y-%m-%d_%H-%M-%S") -- Get timestamp + local file_name = vim.fn.expand("%:t:r") -- Get the file name without extension + local file_extension = vim.fn.expand("%:e") + return home_dir + .. "/Pictures/screenshots" + .. timestamp + .. "_" + .. file_name + .. "_" + .. file_extension + .. ".png" + end, + }, + keys = { + { + "sc", + function() + require("nvim-silicon").clip() + end, + mode = "v", + desc = "Copy code screenshot to clipboard", + }, + { + "sf", + function() + require("nvim-silicon").file() + end, + mode = "v", + desc = "Save code screenshot as file", + }, + { + "ss", + function() + require("nvim-silicon").shoot() + end, + mode = "v", + desc = "Create code screenshot", + }, + }, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "v" }, + { "s", group = "Snapshot" }, + }) + end, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/snippets.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/snippets.lua new file mode 100644 index 0000000..96c52a7 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/snippets.lua @@ -0,0 +1,72 @@ +return { + { + "L3MON4D3/LuaSnip", + version = "v2.*", + build = "make install_jsregexp", + dependencies = { + "rafamadriz/friendly-snippets", + config = function() + require("luasnip.loaders.from_vscode").lazy_load() + end, + }, + config = function() + local ls = require("luasnip") + ls.setup({ + link_children = true, + link_roots = false, + keep_roots = false, + update_events = { "TextChanged", "TextChangedI" }, + }) + local c = ls.choice_node + ls.choice_node = function(pos, choices, opts) + if opts then + opts.restore_cursor = true + else + opts = { restore_cursor = true } + end + return c(pos, choices, opts) + end + + require("luasnip.loaders.from_vscode").lazy_load({ + paths = { '"' .. vim.fn.stdpath("config") .. '/lua/TheSiahxyz/snippets"' }, + }) + + vim.cmd.runtime({ args = { "lua/TheSiahxyz/snippets/*.lua" }, bang = true }) -- load custom snippets + + vim.keymap.set({ "i", "x" }, "", function() + if ls.expand_or_jumpable() then + ls.expand_or_jump() + end + end, { silent = true, desc = "Expand snippet or jump to the next snippet node" }) + + vim.keymap.set({ "i", "x" }, "", function() + if ls.jumpable(-1) then + ls.jump(-1) + end + end, { silent = true, desc = "Previous spot in the snippet" }) + + vim.keymap.set({ "i", "x" }, "", function() + if ls.choice_active() then + ls.change_choice(1) + end + end, { silent = true, desc = "Next snippet choice" }) + + vim.keymap.set({ "i", "x" }, "", function() + if ls.choice_active() then + ls.change_choice(-1) + end + end, { silent = true, desc = "Previous snippet choice" }) + end, + keys = { + vim.keymap.set("i", "", function() + return require("luasnip").jumpable(1) and "luasnip-jump-next" or "" + end, { expr = true, silent = true, desc = "Jump to next snippet" }), + vim.keymap.set("s", "", function() + require("luasnip").jump(1) + end, { desc = "Jump to next snippet" }), + vim.keymap.set({ "i", "s" }, "", function() + require("luasnip").jump(-1) + end, { desc = "Jump to Previous Snippet" }), + }, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/stay-centered.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/stay-centered.lua new file mode 100644 index 0000000..a2d5aa2 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/stay-centered.lua @@ -0,0 +1,29 @@ +return { + "arnamak/stay-centered.nvim", + lazy = false, + ft = { "markdown", "ipynb" }, + config = function() + require("stay-centered").setup({ + -- The filetype is determined by the vim filetype, not the file extension. In order to get the filetype, open a file and run the command: + -- :lua print(vim.bo.filetype) + skip_filetypes = {}, + -- Set to false to disable by default + enabled = true, + -- allows scrolling to move the cursor without centering, default recommended + allow_scroll_move = true, + -- temporarily disables plugin on left-mouse down, allows natural mouse selection + -- try disabling if plugin causes lag, function uses vim.on_key + disable_on_mouse = false, + }) + end, + keys = { + { + "zs", + function() + require("stay-centered").toggle() + end, + mode = { "n", "v" }, + desc = "Toggle stay center", + }, + }, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/surround.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/surround.lua new file mode 100644 index 0000000..f3e0174 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/surround.lua @@ -0,0 +1,14 @@ +return { + "echasnovski/mini.surround", + version = "*", + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v" }, + { "s", group = "Surround/Search & replace on line" }, + }) + end, + config = function() + require("mini.surround").setup() + end, +} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/telescope.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/telescope.lua new file mode 100644 index 0000000..9460187 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/telescope.lua @@ -0,0 +1,1087 @@ +local have_make = vim.fn.executable("make") == 1 +local have_cmake = vim.fn.executable("cmake") == 1 + +function vim.live_grep_from_project_git_root() + local function get_git_toplevel() + local path = vim.fn.system("git rev-parse --show-toplevel") + if vim.v.shell_error then + return nil + end + return path + end + + local opts = { cwd = get_git_toplevel() } + + require("telescope.builtin").live_grep(opts) +end + +local function find_nvim_plugin_files(prompt_bufnr) + local actions = require("telescope.actions") + local action_state = require("telescope.actions.state") + + actions.close(prompt_bufnr) + + local selection = action_state.get_selected_entry() + if selection and selection.value then + -- Construct the full path + local base_path = vim.fn.stdpath("data") + local full_path = vim.fn.resolve(base_path .. "/" .. selection.value) + + require("mini.files").open(full_path, true) + end +end + +return { + { + "nvim-telescope/telescope-file-browser.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope.nvim", + }, + -- init = function() + -- vim.api.nvim_create_autocmd("VimEnter", { + -- group = vim.api.nvim_create_augroup("TelescopeFileBrowserStartDirectory", { clear = true }), + -- desc = "Start telescope-file-browser with directory", + -- once = true, + -- callback = function() + -- if package.loaded["telescope-file-browser.nvim"] then + -- return + -- else + -- local stats = vim.uv.fs_stat(vim.fn.argv(0)) + -- if stats and stats.type == "directory" then + -- require("telescope").extensions.file_browser.file_browser() + -- end + -- end + -- end, + -- }) + -- end, + config = function() + local fb_actions = require("telescope._extensions.file_browser.actions") + + require("telescope").setup({ + extensions = { + file_browser = { + path = vim.uv.cwd(), + cwd = vim.uv.cwd(), + cwd_to_path = false, + grouped = true, + files = true, + add_dirs = true, + depth = 1, + auto_depth = true, + select_buffer = true, + hidden = { file_browser = false, folder_browser = false }, + respect_gitignore = vim.fn.executable("fd") == 1, + no_ignore = true, + follow_symlinks = true, + browse_files = require("telescope._extensions.file_browser.finders").browse_files, + browse_folders = require("telescope._extensions.file_browser.finders").browse_folders, + hide_parent_dir = false, + collapse_dirs = true, + prompt_path = true, + quiet = true, + dir_icon = "", + dir_icon_hl = "Default", + display_stat = { date = true, size = true, mode = true }, + hijack_netrw = false, + use_fd = true, + git_status = true, + mappings = { + ["i"] = { + [""] = fb_actions.create, + [""] = fb_actions.create_from_prompt, + [""] = fb_actions.rename, + [""] = fb_actions.move, + [""] = fb_actions.copy, + [""] = fb_actions.remove, + [""] = fb_actions.open, + [""] = fb_actions.goto_parent_dir, + [""] = fb_actions.goto_home_dir, + [""] = fb_actions.goto_cwd, + [""] = fb_actions.change_cwd, + [""] = fb_actions.toggle_browser, + [""] = fb_actions.toggle_hidden, + [""] = fb_actions.toggle_all, + [""] = fb_actions.backspace, + }, + ["n"] = { + ["a"] = fb_actions.create, + ["n"] = fb_actions.create_from_prompt, + ["r"] = fb_actions.rename, + ["d"] = fb_actions.move, + ["y"] = fb_actions.copy, + ["Del"] = fb_actions.remove, + ["o"] = fb_actions.open, + ["h"] = fb_actions.goto_parent_dir, + ["gh"] = fb_actions.goto_home_dir, + [""] = fb_actions.goto_cwd, + [""] = fb_actions.change_cwd, + ["f"] = fb_actions.toggle_browser, + ["/"] = fb_actions.toggle_hidden, + ["t"] = fb_actions.toggle_all, + }, + }, + results_title = vim.fn.fnamemodify(vim.uv.cwd(), ":~"), + }, + }, + }) + + require("telescope").load_extension("file_browser") + + vim.keymap.set( + "n", + "et", + ":Telescope file_browser path=%:p:h select_buffer=true", + { desc = "File browser (cwd)" } + ) + vim.keymap.set("n", "eT", ":Telescope file_browser", { desc = "File browser" }) + end, + }, + { + "nvim-telescope/telescope.nvim", + branch = "master", + dependencies = { + { "nvim-lua/plenary.nvim" }, + { + "nvim-telescope/telescope-fzf-native.nvim", + build = have_make and "make" + or "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build", + enabled = have_make or have_cmake, + config = function() + require("telescope").load_extension("fzf") + end, + }, + { + "nvim-telescope/telescope-github.nvim", + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n" }, + { "gh", group = "gh" }, + }) + end, + config = function() + require("telescope").load_extension("gh") + vim.keymap.set({ "n", "v" }, "gi", ":Telescope gh issues ", { desc = "Find gh issues" }) + vim.keymap.set( + { "n", "v" }, + "gp", + ":Telescope gh pull_request ", + { desc = "Find gh pull request" } + ) + vim.keymap.set({ "n", "v" }, "ght", ":Telescope gh gist ", { desc = "Find gh gist" }) + vim.keymap.set({ "n", "v" }, "ghr", ":Telescope gh run ", { desc = "Find gh run" }) + end, + }, + { + "nvim-telescope/telescope-ui-select.nvim", + config = function() + require("telescope").setup({ + extensions = { + ["ui-select"] = { + require("telescope.themes").get_dropdown({ + -- even more opts + }), + + -- pseudo code / specification for writing custom displays, like the one + -- for "codeactions" + -- specific_opts = { + -- make_indexed = function(items) -> indexed_items, width, + -- [kind] = { + -- make_displayer = function(widths) -> displayer + -- make_display = function(displayer) -> function(e) + -- make_ordinal = function(e) -> string + -- }, + -- -- for example to disable the custom builtin "codeactions" display + -- do the following + -- codeactions = false, + -- } + }, + }, + }) + require("telescope").load_extension("ui-select") + end, + }, + { + "jvgrootveld/telescope-zoxide", + dependencies = { "nvim-lua/popup.nvim" }, + config = function() + require("telescope").setup({ + extensions = { + zoxide = { + prompt_title = "[ TheSiahxyz ]", + mappings = { + default = { + action = function(selection) + vim.cmd.cd(selection.path) + end, + after_action = function(selection) + print("Update to (" .. selection.z_score .. ") " .. selection.path) + end, + }, + [""] = { + action = require("telescope._extensions.zoxide.utils").create_basic_command( + "split" + ), + opts = { desc = "split" }, + }, + [""] = { + action = require("telescope._extensions.zoxide.utils").create_basic_command( + "vsplit" + ), + }, + [""] = { + action = require("telescope._extensions.zoxide.utils").create_basic_command( + "edit" + ), + }, + [""] = { + keepinsert = true, + action = function(selection) + require("telescope").extensions.file_browser.file_browser({ + cwd = selection.path, + }) + end, + }, + }, + }, + }, + }) + require("telescope").load_extension("zoxide") + + vim.keymap.set("n", "fz", function() + require("telescope").extensions.zoxide.list() + end, { desc = "Find files (zoxide)" }) + end, + }, + { + "nvim-telescope/telescope-live-grep-args.nvim", + -- This will not install any breaking changes. + -- For major updates, this must be adjusted manually. + version = "^1.0.0", + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n", "v" }, + { "f", group = "Find" }, + { "fl", group = "Live grep" }, + }) + end, + config = function() + local lga_actions = require("telescope-live-grep-args.actions") + local actions = require("telescope.actions") + + require("telescope").setup({ + extensions = { + live_grep_args = { + auto_quoting = true, -- enable/disable auto-quoting + -- define mappings, e.g. + mappings = { -- extend mappings + i = { + [""] = lga_actions.quote_prompt(), + [""] = lga_actions.quote_prompt({ postfix = " --iglob " }), + -- freeze the current list and start a fuzzy search in the frozen list + [""] = actions.to_fuzzy_refine, + }, + }, + vimgrep_arguments = { + "rg", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--smart-case", + "--follow", + "--hidden", + "--no-ignore", + }, + -- ... also accepts theme settings, for example: + -- theme = "dropdown", -- use dropdown theme + -- theme = { }, -- use own theme spec + -- layout_config = { mirror=true }, -- mirror preview pane + }, + }, + }) + require("telescope").load_extension("live_grep_args") + vim.keymap.set("n", "flf", function() + require("telescope").extensions.live_grep_args.live_grep_args() + end, { desc = "Find live grep args" }) + + local live_grep_args_shortcuts = require("telescope-live-grep-args.shortcuts") + vim.keymap.set( + "n", + "ss", + live_grep_args_shortcuts.grep_word_under_cursor, + { desc = "Search shortcuts (Live grep)" } + ) + + local function search_git(visual) + -- Retrieve the git root path + local handle = io.popen("git rev-parse --show-toplevel") + if not handle then + print("Error: Unable to open git handle") + return + end + + local git_root_path = handle:read("*a"):gsub("%s+", "") + handle:close() + + if not git_root_path or git_root_path == "" then + print("Error: Unable to retrieve git root path") + return + end + + local opts = { + prompt_title = visual and ("Visual-Grep in " .. git_root_path) + or ("Live-Grep in " .. git_root_path), + shorten_path = false, + cwd = git_root_path, + file_ignore_patterns = { ".git", ".png", "tags" }, + initial_mode = "insert", + selection_strategy = "reset", + theme = require("telescope.themes").get_dropdown({}), + } + + if visual then + -- Capture the selected text in visual mode + vim.cmd('normal! "vy') + local visual_selection = vim.fn.getreg("v") + opts.search = visual_selection + require("telescope.builtin").grep_string(opts) + else + require("telescope.builtin").live_grep(opts) + end + end + + vim.keymap.set("n", "flg", function() + search_git(false) + end, { remap = true, silent = false, desc = "Live grep in the git root folder" }) + + vim.keymap.set("v", "flg", function() + search_git(true) + end, { remap = true, silent = false, desc = "Grep in the git root folder" }) + -- Retrieve the current tmux session path + -- This will not change when we navigate to a different pane + local function search_tmux(visual) + local handle = io.popen("tmux display-message -p '#{session_path}'") + if not handle then + print("Error: Unable to open tmux handle") + return + end + + local tmux_session_path = handle:read("*a"):gsub("%s+", "") + handle:close() + + if not tmux_session_path or tmux_session_path == "" then + print("Error: Unable to retrieve tmux session path") + return + end + + local opts = { + prompt_title = visual and ("Visual-Grep in " .. tmux_session_path) + or ("Live-Grep in " .. tmux_session_path), + shorten_path = false, + cwd = tmux_session_path, + file_ignore_patterns = { ".git", ".png", "tags" }, + initial_mode = "insert", + selection_strategy = "reset", + theme = require("telescope.themes").get_dropdown({}), + } + + if visual then + require("telescope.builtin").grep_string(opts) + else + require("telescope.builtin").live_grep(opts) + end + end + + vim.keymap.set("n", "flt", function() + search_tmux(false) + end, { remap = true, silent = false, desc = "Live grep in the current tmux session folder" }) + + vim.keymap.set("v", "flt", function() + search_tmux(true) + end, { remap = true, silent = false, desc = "Grep string in the current tmux session folder" }) + vim.api.nvim_set_keymap( + "v", + "fls", + 'y:Telescope live_grep default_text=0 search_dirs={"$PWD"}', + { noremap = true, silent = true, desc = "Live grep default text" } + ) + vim.keymap.set("n", "f/", function() + require("telescope.builtin").current_buffer_fuzzy_find( + require("telescope.themes").get_dropdown({ + winblend = 10, + previewer = false, + relative = "editor", + }) + ) + end, { desc = "Find in current buffer" }) + end, + }, + { + "xiyaowong/telescope-emoji.nvim", + config = function() + require("telescope").setup({ + extensions = { + emoji = { + action = function(emoji) + -- argument emoji is a table. + -- {name="", value="", cagegory="", description=""} + + vim.fn.setreg("*", emoji.value) + print([[Press p or "*p to paste this emoji]] .. emoji.value) + + -- insert emoji when picked + -- vim.api.nvim_put({ emoji.value }, 'c', false, true) + end, + }, + }, + }) + require("telescope").load_extension("emoji") + end, + keys = { + { "se", ":Telescope emoji", desc = "Search emoji" }, + }, + }, + { + "nvim-telescope/telescope-bibtex.nvim", + requires = { + { "nvim-telescope/telescope.nvim" }, + }, + config = function() + local bibtex_actions = require("telescope-bibtex.actions") + require("telescope").setup({ + extensions = { + bibtex = { + -- Use context awareness + context = true, + -- Use non-contextual behavior if no context found + -- This setting has no effect if context = false + context_fallback = true, + mappings = { + i = { + [""] = bibtex_actions.key_append("%s"), -- format is determined by filetype if the user has not set it explictly + [""] = bibtex_actions.entry_append, + [""] = bibtex_actions.citation_append("{{author}} ({{year}}), {{title}}."), + }, + }, + }, + }, + }) + require("telescope").load_extension("bibtex") + end, + keys = { + { + "sB", + function() + require("telescope").extensions.bibtex.bibtex() + end, + desc = "Search bibtex", + }, + }, + }, + { + "mzlogin/vim-markdown-toc", + keys = { + { "tg", "GenTocGFM", desc = "Generate ToC to GFM" }, + { "tr", "GenTocRedcarpet", desc = "Generate ToC to Redcarpet" }, + { "tl", "GenTocGitLab", desc = "Generate ToC to Gitlab" }, + { "tm", "GenTocMarked", desc = "Generate ToC to Marked" }, + }, + }, + { + "ThePrimeagen/harpoon", + branch = "harpoon2", + dependencies = { "nvim-lua/plenary.nvim" }, + }, + { + "folke/trouble.nvim", + }, + }, + init = function() + local wk = require("which-key") + wk.add({ + mode = { "n" }, + { "f", group = "Find" }, + { "fp", group = "Private/Public" }, + { "s", group = "Search" }, + { "sb", group = "Buffer" }, + }) + end, + config = function() + local actions = require("telescope.actions") + local actions_state = require("telescope.actions.state") + local actions_layout = require("telescope.actions.layout") + local open_with_trouble = require("trouble.sources.telescope").open + local add_to_trouble = require("trouble.sources.telescope").add + + require("telescope").setup({ + defaults = { + mappings = { + i = { + [""] = add_to_trouble, + [""] = actions.complete_tag, + [""] = function(prompt_bufnr) + local selection = actions_state.get_selected_entry() + local dir = vim.fn.fnamemodify(selection.path, ":p:h") + actions.close(prompt_bufnr) + -- Depending on what you want put `cd`, `lcd`, `tcd` + vim.cmd(string.format("silent lcd %s", dir)) + end, + [""] = actions.nop, + [""] = actions.nop, + [""] = actions.nop, + [""] = actions_layout.toggle_preview, + [""] = actions.preview_scrolling_down, + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_left, + [""] = actions.preview_scrolling_right, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + [""] = open_with_trouble, + [""] = actions.select_horizontal, + [""] = { "", type = "command" }, + [""] = actions.insert_original_cword, + [""] = actions.insert_original_cWORD, + [""] = actions.insert_original_cfile, + [""] = actions.insert_original_cline, + [""] = actions.nop, + [""] = actions.nop, + }, + n = { + ["q"] = actions.close, + [""] = add_to_trouble, + [""] = actions.close, + [""] = actions.nop, + [""] = actions.nop, + [""] = actions_layout.toggle_preview, + [""] = actions.nop, + [""] = actions.complete_tag, + [""] = { + function(prompt_bufnr) + local selection = actions_state.get_selected_entry() + local dir = vim.fn.fnamemodify(selection.path, ":p:h") + actions.close(prompt_bufnr) + -- Depending on what you want put `cd`, `lcd`, `tcd` + vim.cmd(string.format("silent lcd %s", dir)) + end, + opts = { desc = "Change directory" }, + }, + [""] = actions.preview_scrolling_down, + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_left, + [""] = actions.preview_scrolling_right, + [""] = actions.send_to_qflist + actions.open_qflist, + [""] = actions.send_selected_to_qflist + actions.open_qflist, + [""] = open_with_trouble, + [""] = actions.select_horizontal, + ["