From 78cd0d1374a54f31af073fcaeeb56f4ece7bb942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sofus=20Albert=20H=C3=B8gsbro=20Rose?= Date: Wed, 12 Feb 2025 11:49:02 +0100 Subject: [PATCH] feat: boostrap neovim configuration --- .editorconfig | 16 ++ .gitignore | 4 + .luarc.json | 0 README.md | 54 ++++ TODO.md | 124 +++++++++ after/queries/markdown/highlights.scm | 1 + after/queries/markdown/textobjects.scm | 5 + after/queries/markdown_inline/highlights.scm | 5 + after/queries/python/highlights.scm | 11 + after/queries/python/textobjects.scm | 6 + init.lua | 36 +++ lazy-lock.json | 33 +++ lsp/basedpyright.lua | 15 ++ lsp/lua-language-server.lua | 19 ++ lsp/ruff.lua | 5 + lsp/rust_analyzer.lua | 5 + lua/autocmds.lua | 5 + lua/autocmds/lsp.lua | 145 ++++++++++ lua/autocmds/yank_hl.lua | 9 + lua/guis.lua | 6 + lua/guis/neovide.lua | 15 ++ lua/keymaps.lua | 5 + lua/keymaps/float_diag.lua | 61 +++++ lua/keymaps/search_hl.lua | 3 + lua/keymaps/split_nav.lua | 6 + lua/lsp.lua | 6 + lua/options.lua | 67 +++++ lua/plugins.lua | 159 +++++++++++ lua/plugins/catppuccin.lua | 16 ++ lua/plugins/completion/blink.lua | 88 ++++++ lua/plugins/completion/friendly-snippets.lua | 5 + lua/plugins/completion/minuet-ai.lua | 0 lua/plugins/debugging/nvim-dap-ui.lua | 0 .../debugging/nvim-dap-virtual-text.lua | 0 lua/plugins/debugging/nvim-dap.lua | 30 +++ lua/plugins/editing/Comment.lua | 0 lua/plugins/editing/conform-nvim.lua | 45 ++++ lua/plugins/editing/gen.lua | 0 lua/plugins/editing/neogen.lua | 0 lua/plugins/editing/nvim-surround.lua | 0 lua/plugins/editing/surround-ui.lua | 0 lua/plugins/editing/todo-comments.lua | 0 lua/plugins/editing/treesitter.lua | 253 ++++++++++++++++++ lua/plugins/editing/treesj.lua | 0 lua/plugins/fun/cellular-automation.lua | 40 +++ lua/plugins/langs/csv/csvview.lua | 0 lua/plugins/langs/md_quarto/easytables.lua | 0 lua/plugins/langs/md_quarto/img-clip.lua | 26 ++ lua/plugins/langs/md_quarto/mdmath.lua | 32 +++ lua/plugins/langs/md_quarto/mkdnflow.lua | 0 lua/plugins/langs/md_quarto/molten-nvim.lua | 74 +++++ lua/plugins/langs/md_quarto/nabla.lua | 16 ++ lua/plugins/langs/md_quarto/otter.lua | 12 + lua/plugins/langs/md_quarto/quarto-nvim.lua | 140 ++++++++++ .../langs/md_quarto/render-markdown-nvim.lua | 27 ++ lua/plugins/langs/python/f-string-toggle.lua | 0 lua/plugins/langs/rust/rustaceanvim.lua | 0 lua/plugins/libs/image-nvim.lua | 28 ++ lua/plugins/libs/nui.lua | 5 + lua/plugins/libs/nvim-nio.lua | 5 + lua/plugins/libs/nvim-notify.lua | 5 + lua/plugins/libs/nvim-web-devicons.lua | 12 + lua/plugins/libs/plenary.lua | 7 + lua/plugins/lsp/lsp-lines.lua | 44 +++ lua/plugins/lsp/tiny-code-action.lua | 9 + lua/plugins/motion/flash.lua | 0 lua/plugins/motion/gx.lua | 0 lua/plugins/org/due.lua | 0 lua/plugins/search/fzf-lua.lua | 145 ++++++++++ lua/plugins/snacks.lua | 68 +++++ lua/plugins/testing/neotest-python.lua | 5 + lua/plugins/testing/nvim-neotest.lua | 29 ++ lua/plugins/ux/dropbar.lua | 0 lua/plugins/ux/flatten.lua | 13 + lua/plugins/ux/noice.lua | 30 +++ lua/plugins/ux/tabby.lua | 0 lua/plugins/ux/toggleterm.lua | 0 lua/plugins/ux/vim-sleuth.lua | 4 + lua/plugins/ux/which-key.lua | 8 + lua/plugins/vcs/diffview.lua | 0 lua/plugins/vcs/gitlinker.lua | 0 lua/plugins/vcs/gitsigns.lua | 111 ++++++++ lua/plugins/workflow/git-dev.lua | 0 lua/plugins/workflow/mini-files.lua | 29 ++ lua/plugins/workflow/neovim-project.lua | 30 +++ lua/plugins/workflow/projections.lua | 124 +++++++++ lua/plugins/workflow/sad.lua | 0 lua/usercmds.lua | 2 + nvim.version | 1 + 89 files changed, 2344 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 .luarc.json create mode 100644 README.md create mode 100644 TODO.md create mode 100644 after/queries/markdown/highlights.scm create mode 100644 after/queries/markdown/textobjects.scm create mode 100644 after/queries/markdown_inline/highlights.scm create mode 100644 after/queries/python/highlights.scm create mode 100644 after/queries/python/textobjects.scm create mode 100644 init.lua create mode 100644 lazy-lock.json create mode 100644 lsp/basedpyright.lua create mode 100644 lsp/lua-language-server.lua create mode 100644 lsp/ruff.lua create mode 100644 lsp/rust_analyzer.lua create mode 100644 lua/autocmds.lua create mode 100644 lua/autocmds/lsp.lua create mode 100644 lua/autocmds/yank_hl.lua create mode 100644 lua/guis.lua create mode 100644 lua/guis/neovide.lua create mode 100644 lua/keymaps.lua create mode 100644 lua/keymaps/float_diag.lua create mode 100644 lua/keymaps/search_hl.lua create mode 100644 lua/keymaps/split_nav.lua create mode 100644 lua/lsp.lua create mode 100644 lua/options.lua create mode 100644 lua/plugins.lua create mode 100644 lua/plugins/catppuccin.lua create mode 100644 lua/plugins/completion/blink.lua create mode 100644 lua/plugins/completion/friendly-snippets.lua create mode 100644 lua/plugins/completion/minuet-ai.lua create mode 100644 lua/plugins/debugging/nvim-dap-ui.lua create mode 100644 lua/plugins/debugging/nvim-dap-virtual-text.lua create mode 100644 lua/plugins/debugging/nvim-dap.lua create mode 100644 lua/plugins/editing/Comment.lua create mode 100644 lua/plugins/editing/conform-nvim.lua create mode 100644 lua/plugins/editing/gen.lua create mode 100644 lua/plugins/editing/neogen.lua create mode 100644 lua/plugins/editing/nvim-surround.lua create mode 100644 lua/plugins/editing/surround-ui.lua create mode 100644 lua/plugins/editing/todo-comments.lua create mode 100644 lua/plugins/editing/treesitter.lua create mode 100644 lua/plugins/editing/treesj.lua create mode 100644 lua/plugins/fun/cellular-automation.lua create mode 100644 lua/plugins/langs/csv/csvview.lua create mode 100644 lua/plugins/langs/md_quarto/easytables.lua create mode 100644 lua/plugins/langs/md_quarto/img-clip.lua create mode 100644 lua/plugins/langs/md_quarto/mdmath.lua create mode 100644 lua/plugins/langs/md_quarto/mkdnflow.lua create mode 100644 lua/plugins/langs/md_quarto/molten-nvim.lua create mode 100644 lua/plugins/langs/md_quarto/nabla.lua create mode 100644 lua/plugins/langs/md_quarto/otter.lua create mode 100644 lua/plugins/langs/md_quarto/quarto-nvim.lua create mode 100644 lua/plugins/langs/md_quarto/render-markdown-nvim.lua create mode 100644 lua/plugins/langs/python/f-string-toggle.lua create mode 100644 lua/plugins/langs/rust/rustaceanvim.lua create mode 100644 lua/plugins/libs/image-nvim.lua create mode 100644 lua/plugins/libs/nui.lua create mode 100644 lua/plugins/libs/nvim-nio.lua create mode 100644 lua/plugins/libs/nvim-notify.lua create mode 100644 lua/plugins/libs/nvim-web-devicons.lua create mode 100644 lua/plugins/libs/plenary.lua create mode 100644 lua/plugins/lsp/lsp-lines.lua create mode 100644 lua/plugins/lsp/tiny-code-action.lua create mode 100644 lua/plugins/motion/flash.lua create mode 100644 lua/plugins/motion/gx.lua create mode 100644 lua/plugins/org/due.lua create mode 100644 lua/plugins/search/fzf-lua.lua create mode 100644 lua/plugins/snacks.lua create mode 100644 lua/plugins/testing/neotest-python.lua create mode 100644 lua/plugins/testing/nvim-neotest.lua create mode 100644 lua/plugins/ux/dropbar.lua create mode 100644 lua/plugins/ux/flatten.lua create mode 100644 lua/plugins/ux/noice.lua create mode 100644 lua/plugins/ux/tabby.lua create mode 100644 lua/plugins/ux/toggleterm.lua create mode 100644 lua/plugins/ux/vim-sleuth.lua create mode 100644 lua/plugins/ux/which-key.lua create mode 100644 lua/plugins/vcs/diffview.lua create mode 100644 lua/plugins/vcs/gitlinker.lua create mode 100644 lua/plugins/vcs/gitsigns.lua create mode 100644 lua/plugins/workflow/git-dev.lua create mode 100644 lua/plugins/workflow/mini-files.lua create mode 100644 lua/plugins/workflow/neovim-project.lua create mode 100644 lua/plugins/workflow/projections.lua create mode 100644 lua/plugins/workflow/sad.lua create mode 100644 lua/usercmds.lua create mode 100644 nvim.version diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..bdf1073 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 + +indent_style = tab +indent_size = 4 +trim_trailing_whitespace = false + +[*.yml] +indent_style = space +indent_size = 2 + +[*.yaml] +indent_style = space +indent_size = 2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e2ffe72 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +#################### +# - Standard Ignores +#################### +.dev diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md new file mode 100644 index 0000000..59972da --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +# NVIM Config + +Need to install the following: +```bash +# Package Manager +sudo apt install chafa +sudo apt install libmagickwand-dev +sudo apt install librsvg2-bin +sudo apt install imagemagick +sudo apt install texlive-extra-utils +sudo apt install xclip # OR wl-clipboard + +# Rust +## - FIRST, install rustup +## - https://www.rust-lang.org/ +rustup component add rust-analyzer +cargo install --force bob-nvim +cargo install --force rscls +cargo install --force ripgrep +cargo install --force rust-script +cargo install --force tree-sitter-cli +cargo install --force fd-find +cargo install --force bat +cargo install --force git-delta +cargo install --force skim + +# Python +## - FIRST, install uv +## - https://docs.astral.sh/uv/ +uv tool install --upgrade mypy +uv tool install --upgrade ruff +uv tool install --upgrade basepyright +uv tool install --upgrade cairosvg + +# Haskell +## - FIRST, install "stack". +## - https://docs.haskellstack.org/en/stable/ +stack update +stack install ShellCheck + +# GO +## - FIRST, install "g". +## - https://github.com/stefanmaric/g +## - REMEMBER to 'export GOPATH=$HOME/.go-path' before installing +go install mvdan.cc/sh/v3/cmd/shfmt@latest +go install lazygit + +# remote-python +## Used by plugins that run external to neovim, written in Python +cd $HOME/comps/neovim +uv init --no-readme --python 3.12 remote-python +cd remote-python +uv add pynvim jupyter_client requests websocket-client plotly kaleido==0.2.1 +``` diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..fd91cce --- /dev/null +++ b/TODO.md @@ -0,0 +1,124 @@ +Neovim Version Manager: https://github.com/MordechaiHadad/bob + + +Search: telescope.nvim? + +Version Control: +- [ ] sindrets/diffview.nvim: Reviewing changes seems like an ideal thing. +- [ ] gitsigns: Some more configuration. + - For more crazy git stuff, just toggleterm into lazygit. + +LSP +- What do we think of `l` for LSP stuff? We already have `t` for test stuff and `d` for debug stuff, right? +- [ ] Formatters don't always behave. Consider stevearc/conform.nvim. +- [ ] Finish config incl. reconsider keymaps. See https://neovim.io/doc/user/lsp.html#_quickstart. +- [ ] Finish getting and configuring a bunch of LSPs. See https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/ruff.lua +- [ ] folke/trouble.nvim: Configure it as a kind of universal "what's up" sidebar. + - Consider keyboard shortcuts to manage a "permanant" right-hand-side buffer, which should support mindful trouble info and diagnostics, ongoing neotest harnesses, and running DAP processes. + +Editing: +- Tutorial: https://martinlwx.github.io/en/learn-to-use-text-objects-in-vim/ +- [ ] folke/todo-comments.nvim: Honestly such a crazy neat thing. +- [ ] lukas-reineke/headlines.nvim +- [ ] kylechui/nvim-surround: For managing stuff wrapped in other stuff. +- [ ] nvim-treesitter/nvim-treesitter-textobjects: Syntax aware text objects. +- [ ] roobert/surround-ui.nvim: For pretty and learning. +- [ ] numToStr/Comment.nvim: Honestly, we do a lot of commenting overall. +- [ ] danymat/neogen: No excuse not to write documentation now :) +- [ ] hat0uma/csvview.nvim: Handle CSV files directly and sanely. + +Motion: +- [ ] folke/flash.nvim: Fast motions. +- [ ] chrishrb/gx.nvim: Better implementation of `gx`. + +UX: +- For the editing overview, use the toggleable filetree. +- [ ] matbme/JABS.nvim: OH HELLO! A tiny little buffer switcher boi! +- [ ] kazhala/close-buffers.nvim: Maybe not exactly this, but some sort of principled way of keeping buffers under control and not outside of my object permanance. + - Like this: ChuufMaster/buffer-vacuum +- [ ] nanozuki/tabby.nvim: Don't use the tabs as a bufferline. + - Use it as a buffer multiplexer. +- [ ] akinsho/toggleterm.nvim: Don't mess around with tmux. +- [ ] Consider breadcrumbs? See: Bekaboo/dropbar.nvim +- [ ] 3rd/image.nvim: Support images. Mainly for other plugins. + +Workflow: +- Need solution for the following: + - `nvim file.txt` without any hubub, incl. use of LSPs and such. Doesn't need to be recoverable. + - Opening any file within a project should cd to that project's root. + - Special project should be daily-note taking, w/sync across platforms. + - Turning notes into other stuff ex. calendar events, tasks, projects, notes within projects. + - Projects in predictable places should be quick to navigate to. + - Having many projects open w/different layouts, all sessions under the project's namespace. + - Automatic session saving and recovery, including buffer layouts and terminals. +- [ ] gnikdroy/projections.nvim: It has its frustrations, but it + - [ ] Consider coffebar/neovim-project as alternative. + - Consider the multi-branch sessions workflows. Ideally, reuse the LSP rootdir. Ensure correct CWD is set. + - We might just have to DIY this... +- [ ] nvim-tree/nvim-tree: Finish configuring properly. The floating window is nice. Relies only on correct CWD. + - Or oil.nvim? +- [ ] moyiz/git-dev.nvim: Easy shallow clones. + +Completion: +- [ ] nvim-cmp + +AI: +- [ ] David-Kunz/gen.nvim + - Combine with a mindful way of starting ollama. + +Quarto: +- [ ] jmbuhr/otter.nvim: Embedding langs within other langs. + - See the `injected` formatter for stevearc/conform.nvim. Ex: https://github.com/jmbuhr/quarto-nvim-kickstarter/blob/382b050e13eada7180ad048842386be37e820660/lua/plugins/editing.lua#L29-L81 +- [ ] benlubas/molten-nvim: Running code cells. +- [ ] HakonHarnes/img-clip.nvim: Paste images directly from clipboard. +- [ ] jbyuki/nabla.nvim: Preview LaTeX. +- jakewvincent/mkdnflow.nvim: Consider this little plugin. +- [ ] lukas-reineke/headlines.nvim: This one too! + - Or this? MeanderingProgrammer/render-markdown.nvim +- [ ] Myzel394/easytables.nvim: Make markdown tables awesome. +- [ ] nvim-telescope/telescope-bibtex.nvim + +Workflows: +- There exists this: b0o/blender.nvim. Can we do better with `blext`? +- mrcjkb/rustaceanvim: Superpowered Rust. +- roobert/tailwindcss-colorizer-cmp.nvim and luckasRanarison/tailwind-tools.nvim: For TailwindCSS + + + +Organization: +- Zeioth/markmap.nvim: Mindmap from markdown. +- richardbizik/nvim-toc: A little niche, but isn't it interesting? +- [ ] nfrid/due.nvim: Extremely clever use of virtual text. +- Some sort of "scratchpad" that doesn't just get deleted by default. + +Annoyances: +- roobert/f-string-toggle.nvim: Fucking finally! +- [ ] nfrid/markdown-togglecheck: Toggle Markdown checkboxes! Kinda hype, to be honest. +- nkakouros-original/numbers.nvim: Slightly smarter relative line numbers. +- Saecki/crates.nvim: This is nice. Makes crate management maybe a bit easier. +- linrongbin16/gitlinker.nvim: Generate permalinks to lines in git. +- Something to help navigate between many open windows. yorickpeterse/nvim-window? +- Wansmer/treesj: Yay! + +Big Projects: +- ray-x/sad.nvim: Large scale refactoring with `sad`. + +Niche: +- Julian/lean.nvim: Lean theorem prover w/interactivity. +- niuiic/typst-preview.nvim: typst does look quite interesting. +- theKnightsOfRohan/hexer.nvim: Converting between binary representations. +- Willem-J-an/visidata.nvim: Exploring pandas (polars too?) data in a terminal. +- sachinsenal0x64/hot.nvim: Seems interesting but unsure how exactly. +- notomo/gesture.nvim: Unironically interesting for touchscreens. +- azratul/live-share.nvim: Pair programming. +- m4xshen/hardtime.nvim: Bad habits die hard. +- krady21/compiler-explorer.nvim: I love it, but I want it local... + +Testing: nvim-neotest +- [ ] Python +- [ ] Rust +- [ ] C++ + +Debugging: nvim-dap +- [ ] Python: debugpy +- [ ] C++: codelldb diff --git a/after/queries/markdown/highlights.scm b/after/queries/markdown/highlights.scm new file mode 100644 index 0000000..972e429 --- /dev/null +++ b/after/queries/markdown/highlights.scm @@ -0,0 +1 @@ +;extends diff --git a/after/queries/markdown/textobjects.scm b/after/queries/markdown/textobjects.scm new file mode 100644 index 0000000..d5b2df5 --- /dev/null +++ b/after/queries/markdown/textobjects.scm @@ -0,0 +1,5 @@ +;extends + +(fenced_code_block (code_fence_content) @cell.inner) @cell.outer + +(paragraph) @function.outer @function.inner diff --git a/after/queries/markdown_inline/highlights.scm b/after/queries/markdown_inline/highlights.scm new file mode 100644 index 0000000..f339552 --- /dev/null +++ b/after/queries/markdown_inline/highlights.scm @@ -0,0 +1,5 @@ +;extends + +[ + (shortcut_link) +] @nospell diff --git a/after/queries/python/highlights.scm b/after/queries/python/highlights.scm new file mode 100644 index 0000000..a63fadb --- /dev/null +++ b/after/queries/python/highlights.scm @@ -0,0 +1,11 @@ +;extends +( +(comment) @comment +(#match? @comment "^\\#\\|") +) @text.literal + + +( +(comment) @content +(#match? @content "^\\# ?\\%\\%") +) @cell.outer @text.literal diff --git a/after/queries/python/textobjects.scm b/after/queries/python/textobjects.scm new file mode 100644 index 0000000..ad884ef --- /dev/null +++ b/after/queries/python/textobjects.scm @@ -0,0 +1,6 @@ +;extends + +( +(comment) @content1 +(#match? @content1 "^\\# ?\\%\\%") +) @cell.inner diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..0515cc6 --- /dev/null +++ b/init.lua @@ -0,0 +1,36 @@ +-- [[ Config Loading ]] +--vim.loader.enable() -- Cached Module Loader + +-- [[ Leader Config ]] +--- See `:help mapleader` +--- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +-- [[ NERD Font Declaration ]] +vim.g.have_nerd_font = true + +-- [[ Remote Python ]] +local remote_python_path = vim.env.HOME .. '/comps/neovim/remote-python' +vim.g.python3_host_prog = remote_python_path .. '/.venv/bin/python' + +-- [[ Vim Options ]] +require('options') + +-- [[ Global Keymaps ]] +require('keymaps') + +-- [[ Global Autocmds ]] +require('autocmds') + +-- [[ User Commands ]] +require('usercmds') + +-- [[ GUI Config ]] +require('guis') + +-- [[ Plugins ]] +require('plugins') + +-- [[ LSP Configuration ]] +require('lsp') diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..09df737 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,33 @@ +{ + "blink.cmp": { "branch": "main", "commit": "b6f11a0aa33e601c469a126e3ed6e35208fe3ea3" }, + "catppuccin": { "branch": "main", "commit": "5e36ca599f4aa41bdd87fbf2c5aae4397ac55074" }, + "cellular-automaton.nvim": { "branch": "main", "commit": "11aea08aa084f9d523b0142c2cd9441b8ede09ed" }, + "conform.nvim": { "branch": "master", "commit": "363243c03102a531a8203311d4f2ae704c620d9b" }, + "flatten.nvim": { "branch": "main", "commit": "b17a3e65c2e4e2ecd1345a2d08435e80f982c4a6" }, + "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, + "fzf-lua": { "branch": "main", "commit": "e3fefd97875827e47dc4bbf1074ee464b2d8e6a8" }, + "fzf-lua-projections.nvim": { "branch": "main", "commit": "411672ab6f7c38d3a4a51916fda1a01c1618ae04" }, + "gitsigns.nvim": { "branch": "main", "commit": "9b36d497495436c135659902054ee637e0ba6021" }, + "image.nvim": { "branch": "master", "commit": "7704e1d03d952393774dc7d00a98d8e127086ba4" }, + "img-clip.nvim": { "branch": "main", "commit": "5ded6f468d633ccfb315905fe8901d6c95ae8f29" }, + "lazy.nvim": { "branch": "main", "commit": "f15a93907ddad3d9139aea465ae18336d87f5ce6" }, + "lsp_lines.nvim": { "branch": "main", "commit": "a92c755f182b89ea91bd8a6a2227208026f27b4d" }, + "mdmath.nvim": { "branch": "main", "commit": "699acb27fd34bfdf92a43ce0abdd17f0c7a948fe" }, + "mini.files": { "branch": "main", "commit": "0db8f49088bcefff23c5cb8498a6c94e46a45a8e" }, + "molten-nvim": { "branch": "main", "commit": "a286aa914d9a154bc359131aab788b5a077a5a99" }, + "nabla.nvim": { "branch": "master", "commit": "27a6ea9ed7452bb9e0b19eb0942b5bcf7d051b2f" }, + "neotest": { "branch": "master", "commit": "d66cf4e05a116957f0d3a7755a24291c7d1e1f72" }, + "neotest-python": { "branch": "master", "commit": "a2861ab3c9a0bf75a56b11835c2bfc8270f5be7e" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-treesitter": { "branch": "master", "commit": "cfc6f2c117aaaa82f19bcce44deec2c194d900ab" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" }, + "nvim-web-devicons": { "branch": "master", "commit": "5740b7382429d20b6ed0bbdb0694185af9507d44" }, + "otter.nvim": { "branch": "main", "commit": "0e42fa795c35c7190935e3beda3791189c41bb72" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "projections.nvim": { "branch": "main", "commit": "889914169fa1f5c00fb8659653b5a8330fb223e6" }, + "render-markdown.nvim": { "branch": "main", "commit": "17a77463f945c4b9e4f371c752efd90e3e1bf604" }, + "snacks.nvim": { "branch": "main", "commit": "b773368f8aa6e84a68e979f0e335d23de71f405a" }, + "tiny-code-action.nvim": { "branch": "main", "commit": "34d8a0053a833dbc51b2eecc1170bd35aa18baa4" }, + "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, + "which-key.nvim": { "branch": "main", "commit": "0e76a87ac51772569aec678dc74baa8e2a86100c" } +} diff --git a/lsp/basedpyright.lua b/lsp/basedpyright.lua new file mode 100644 index 0000000..59cdbad --- /dev/null +++ b/lsp/basedpyright.lua @@ -0,0 +1,15 @@ +return { + cmd = { 'basedpyright-langserver', '--stdio' }, + filetypes = { 'python' }, + root_markers = { "pyproject.toml" }, + settings = { + basedpyright = { + disableOrganizeImports = true, + analysis = { + autoSearchPaths = true, + useLibraryCodeForTypes = true, + diagnosticMode = 'openFilesOnly', + }, + }, + }, +} diff --git a/lsp/lua-language-server.lua b/lsp/lua-language-server.lua new file mode 100644 index 0000000..292cb54 --- /dev/null +++ b/lsp/lua-language-server.lua @@ -0,0 +1,19 @@ +return { + cmd = { 'lua-language-server' }, + filetypes = { 'lua' }, + root_markers = { '.luarc.json', '.luarc.jsonc' }, + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + }, + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME, + }, + }, + telemetry = {enable = false}, + }, + }, +} diff --git a/lsp/ruff.lua b/lsp/ruff.lua new file mode 100644 index 0000000..a6e3fdd --- /dev/null +++ b/lsp/ruff.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'ruff', 'server' }, + filetypes = { 'python' }, + root_markers = { "pyproject.toml" }, +} diff --git a/lsp/rust_analyzer.lua b/lsp/rust_analyzer.lua new file mode 100644 index 0000000..722a341 --- /dev/null +++ b/lsp/rust_analyzer.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'rust-analyzer' }, + filetypes = { 'rust' }, + root_markers = { "Cargo.toml" }, +} diff --git a/lua/autocmds.lua b/lua/autocmds.lua new file mode 100644 index 0000000..a87f72d --- /dev/null +++ b/lua/autocmds.lua @@ -0,0 +1,5 @@ +-- [[ Autocommands ]] +-- See `:help lua-guide-autocommands` + +require 'autocmds/lsp' +require 'autocmds/yank_hl' diff --git a/lua/autocmds/lsp.lua b/lua/autocmds/lsp.lua new file mode 100644 index 0000000..f01e9d5 --- /dev/null +++ b/lua/autocmds/lsp.lua @@ -0,0 +1,145 @@ +-- See: https://neovim.io/doc/user/lsp.html#lsp-defaults +vim.keymap.del('n', 'grn') +vim.keymap.del({ 'n', 'v' }, 'gra') +vim.keymap.del('n', 'grr') +vim.keymap.del('n', 'gri') +vim.keymap.del('n', 'gO') +vim.keymap.del('i', '') + +vim.api.nvim_create_autocmd('LspAttach', { + callback = function(args) + -- See: https://neovim.io/doc/user/lsp.html#lsp-defaults + vim.lsp.config('*', require('blink.cmp').get_lsp_capabilities({}, false)) + + -- Retrieve Dependencies + local lsp_client = vim.lsp.get_client_by_id(args.data.client_id) + local buf = args.buf + + -- LSP: Code Completion + if lsp_client:supports_method('textDocument/completion') then + vim.lsp.completion.enable( + true, + lsp_client.id, + buf, + { autotrigger = false } + ) + end + + -- LSP: Diagnostics + if lsp_client:supports_method('textDocument/diagnostic') then + vim.keymap.set( + 'n', + 'le', + require('fzf-lua').diagnostics_document, + { buffer = buf, desc = '[L]SP [E]rrors' }) + end + + -- LSP: Diagnostics + if lsp_client:supports_method('textDocument/signatureHelp') then + vim.keymap.set( + 'i', + '', + vim.lsp.buf.signature_help, + { buffer = buf, desc = 'LSP Signature Help' }) + end + + -- LSP Action: Formatting + if lsp_client:supports_method('textDocument/formatting') or lsp_client.name == 'otter-ls[1]' then + vim.keymap.set( + 'n', + 'lf', + function() + require('conform').format({ + async = true, + bufnr = buf, + id = lsp_client.id, + }) + end, + { buffer = buf, desc = '[L]SP [F]ormat' } + ) + + -- Format the current buffer on save + --- TODO: Only on filetypes w/fast formatters? + --vim.api.nvim_create_autocmd('BufWritePre', { + -- buffer = buf, + -- callback = function() + -- require('conform').format({ + -- async = true, + -- bufnr = buf, + -- id = lsp_client.id, + -- }) + -- --vim.lsp.buf.format({ bufnr = buf, id = lsp_client.id }) + -- end + --}) + end + + -- LSP Action: Inlay Hint + --- WORKAROUND: otter-ls seems to crash with inlayHint. + if lsp_client:supports_method('textDocument/inlayHint') and not lsp_client.name == 'otter-ls[1]' then + vim.lsp.inlay_hint.enable(true, { bufnr = buf }) + + vim.keymap.set( + 'n', + 'lh', + function() + if vim.lsp.inlay_hint.is_enabled({ bufnr = buf }) then + vim.lsp.inlay_hint.enable(false, { bufnr = buf }) + else + vim.lsp.inlay_hint.enable(true, { bufnr = buf }) + end + end, + { desc = '[L]SP Toggle Inlay [H]ints' } + ) + end + + -- LSP Action: Code Actions + if lsp_client:supports_method('textDocument/codeAction') then + vim.keymap.set( + 'n', + 'li', + require('fzf-lua').lsp_code_actions, + { buffer = buf, desc = '[L]SP F[I]xes' } + ) + end + + -- LSP Action: Rename + if lsp_client:supports_method('textDocument/rename') then + vim.keymap.set( + 'n', + 'lr', + vim.lsp.buf.rename, + { buffer = buf, desc = '[L]SP [R]ename' } + ) + end + + -- LSP Action: "Hover" + if lsp_client:supports_method('textDocument/hover') then + vim.keymap.set( + 'n', + 'K', + vim.lsp.buf.hover, + { buffer = buf, desc = '[L]SP Hover' } + ) + end + + -- LSP Action: References + if ( + lsp_client:supports_method('textDocument/references') + or lsp_client:supports_method('textDocument/typeDefinition') + or lsp_client:supports_method('textDocument/definition') + ) then + vim.keymap.set( + 'n', + 'ld', + require('fzf-lua').lsp_finder, + { buffer = buf, desc = '[L]SP Fin[D]er' } + ) + end + + -- LSP Action: List Buffer Symbols + if lsp_client:supports_method('textDocument/documentSymbol') then + vim.keymap.set('n', 'ls', require('fzf-lua').lsp_document_symbols, + { buffer = buf, desc = '[L]SP [S]ymbols' }) + end + end +}) diff --git a/lua/autocmds/yank_hl.lua b/lua/autocmds/yank_hl.lua new file mode 100644 index 0000000..9072ebf --- /dev/null +++ b/lua/autocmds/yank_hl.lua @@ -0,0 +1,9 @@ +-- Highlight when yanking (copying) text +vim.api.nvim_create_autocmd('TextYankPost', { + desc = 'Highlight when yanking (copying) text', + group = vim.api.nvim_create_augroup('user-highlight-yank', { clear = true }), + callback = function() + vim.highlight.on_yank() + end, +}) +--- See `:help vim.highlight.on_yank()` diff --git a/lua/guis.lua b/lua/guis.lua new file mode 100644 index 0000000..63fa390 --- /dev/null +++ b/lua/guis.lua @@ -0,0 +1,6 @@ +-- [[ GUI Config ]] + +-- Neovide +if vim.g.neovide then + require 'guis/neovide' +end diff --git a/lua/guis/neovide.lua b/lua/guis/neovide.lua new file mode 100644 index 0000000..7978d84 --- /dev/null +++ b/lua/guis/neovide.lua @@ -0,0 +1,15 @@ +-- See https://neovide.dev/configuration.html +vim.o.guifont = 'Hack Nerd Font Mono FC Ligatured:h14' +vim.g.neovide_theme = 'auto' +vim.g.neovide_transparency = 0.93 +vim.g.neovide_scroll_animation_length = 0.1 +vim.g.neovide_scroll_animation_far_lines = 1 +vim.g.neovide_hide_mouse_when_typing = true + +vim.g.neovide_cursor_animation_length = 0.08 +vim.g.neovide_cursor_vfx_mode = 'wireframe' +vim.g.neovide_cursor_trail_size = 0.15 + +--vim.g.neovide_unlink_border_highlights = true +--vim.g.neovide_refresh_rate = 40 +--vim.g.neovide_refresh_rate_idle = 5 --Doesn't seem to have wayland support diff --git a/lua/keymaps.lua b/lua/keymaps.lua new file mode 100644 index 0000000..19e17bc --- /dev/null +++ b/lua/keymaps.lua @@ -0,0 +1,5 @@ +-- [[ Basic Keymaps ]] +--- See `:help vim.keymap.set()` +require 'keymaps/search_hl' +require 'keymaps/split_nav' +require 'keymaps/float_diag' diff --git a/lua/keymaps/float_diag.lua b/lua/keymaps/float_diag.lua new file mode 100644 index 0000000..bcaed11 --- /dev/null +++ b/lua/keymaps/float_diag.lua @@ -0,0 +1,61 @@ +vim.keymap.set( + 'n', + 'ds', + function() + vim.diagnostic.open_float() + end, + { desc = '[D]ebug Float', silent = true } +) + + +vim.keymap.set( + 'n', + '[d', + function() + vim.diagnostic.jump({ + count = -1, + float = not vim.diagnostic.config().virtual_lines, + wrap = false, + }) + end, + { desc = 'Prev [D]iagnoatic', silent = true } +) +vim.keymap.set( + 'n', + ']d', + function() + vim.diagnostic.jump({ + count = 1, + float = not vim.diagnostic.config().virtual_lines, + wrap = false, + }) + end, + { desc = 'Next [D]iagnostic', silent = true } +) + +vim.keymap.set( + 'n', + '[e', + function() + vim.diagnostic.jump({ + count = -1, + float = not vim.diagnostic.config().virtual_lines, + wrap = false, + severity = vim.diagnostic.severity.ERROR, + }) + end, + { desc = 'Prev [E]rror', silent = true } +) +vim.keymap.set( + 'n', + ']e', + function() + vim.diagnostic.jump({ + count = 1, + float = not vim.diagnostic.config().virtual_lines, + wrap = false, + severity = vim.diagnostic.severity.ERROR, + }) + end, + { desc = 'Next [E]rror', silent = true } +) diff --git a/lua/keymaps/search_hl.lua b/lua/keymaps/search_hl.lua new file mode 100644 index 0000000..2404766 --- /dev/null +++ b/lua/keymaps/search_hl.lua @@ -0,0 +1,3 @@ +-- Set Highlight on Search +vim.opt.hlsearch = true +vim.keymap.set('n', '', 'nohlsearch') diff --git a/lua/keymaps/split_nav.lua b/lua/keymaps/split_nav.lua new file mode 100644 index 0000000..2180d4d --- /dev/null +++ b/lua/keymaps/split_nav.lua @@ -0,0 +1,6 @@ +-- Split Window Keymaps +vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +--- See `:help wincmd` for a list of all window commands diff --git a/lua/lsp.lua b/lua/lsp.lua new file mode 100644 index 0000000..ec89cd9 --- /dev/null +++ b/lua/lsp.lua @@ -0,0 +1,6 @@ +vim.lsp.enable({ + 'ruff', + 'basedpyright', + 'rust_analyzer', + 'lua-language-server', +}) diff --git a/lua/options.lua b/lua/options.lua new file mode 100644 index 0000000..a287606 --- /dev/null +++ b/lua/options.lua @@ -0,0 +1,67 @@ +-- [[ Setting options ]] +--- See `:help vim.opt` +--- For more options, see `:help option-list` + +-- Show Line Numbers +vim.opt.number = true +vim.opt.relativenumber = true +--- Use relative line numbers (normal would be vim.opt.number = true) + +-- Default Tabbing +vim.opt.tabstop = 4 +vim.opt.shiftwidth = 4 + +-- Line Breaking +vim.opt.linebreak = true + +-- Enable Mouse Mode +vim.opt.mouse = 'a' +--- Can be useful for resizing splits for example! + +-- Don't Show Mode +vim.opt.showmode = false +--- It's already in the status line + +-- Sync Clipboard btwn OS and Neovim +vim.opt.clipboard = 'unnamedplus' +--- See `:help 'clipboard'` + +-- "Indent" Decision Trigger on Break +vim.opt.breakindent = true + +-- Save Undo History +vim.opt.undofile = true + +-- Search Case +vim.opt.ignorecase = true +vim.opt.smartcase = true +--- Ignore case... +--- ...UNLESS \C or capital letter in search + +-- Keep Signcolumn On +vim.opt.signcolumn = 'yes' + +-- Decrease Update Time +vim.opt.updatetime = 250 +vim.opt.timeoutlen = 300 + +-- Configure New Split Behavior +vim.opt.splitright = true +vim.opt.splitbelow = true +--- Splits will appear below to the right, which feels natural + +-- Configure Whitespace Character Representations +vim.opt.list = true +vim.opt.listchars = { tab = 'ยป ', trail = 'ยท', nbsp = 'โฃ' } +--- See `:help 'list'`... +--- ...and `:help 'listchars'` + +-- Preview Potential Substitutions Live +vim.opt.inccommand = 'split' +--- Shows what would be auto-completed + +-- Highlight Current Line (containing Cursor) +vim.opt.cursorline = true + +-- Minimal # Screen Lines Above/Below Cursor +vim.opt.scrolloff = 10 diff --git a/lua/plugins.lua b/lua/plugins.lua new file mode 100644 index 0000000..225d4f1 --- /dev/null +++ b/lua/plugins.lua @@ -0,0 +1,159 @@ +-- Install Lazy +--- Update Lazy.nvim by manually deleting 'lazy_path' and restarting nvim +local lazy_repo = "https://github.com/folke/lazy.nvim.git" +local lazy_tag = "v11.16.2" + +local lazy_path = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazy_path) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + lazy_repo, + "https://github.com/folke/lazy.nvim.git", + "--branch=" .. lazy_tag, + lazy_path, + }) +end +vim.opt.rtp:prepend(lazy_path) + +-- Install / Setup Plugins +--- See :Lazy for more +require('lazy').setup({ + --#################### + --# - General Plugins + --#################### + require('plugins/snacks'), + + -- Libraries + require('plugins/libs/plenary'), + require('plugins/libs/nvim-web-devicons'), + require('plugins/libs/nvim-nio'), + --require('plugins/libs/nui'), + --require('plugins/libs/nvim-notify'), + require('plugins/libs/image-nvim'), + -- TODO: Some kind of image display library. + + -- Search: telescope (for now) + --- Keys: s + require('plugins/search/fzf-lua'), + + -- Version Control: git + ---- Keys: g + require('plugins/vcs/gitsigns'), + --require('plugins/vcs/gitlinker') + + -- LSP: native + --- Keys: l + require('plugins/lsp/lsp-lines'), + require('plugins/lsp/tiny-code-action'), + + -- Editing: treesitter + require('plugins/editing/treesitter'), + --require('plugins/editing/todo-comments'), + --require('plugins/editing/nvim-surround') + --require('plugins/editing/surround-ui') + --require('plugins/editing/Comment') + --require('plugins/editing/neogen') + --require('plugins/editing/gen') + --require('plugins/editing/treesj') + require('plugins/editing/conform-nvim'), + + -- Motion + --require('plugins/motion/flash') + --require('plugins/motion/gx') + + -- UX + --- u for UI/UX Effects + --require('plugins/ux/noice'), + require('plugins/ux/vim-sleuth'), + require('plugins/ux/which-key'), + -- TODO: A buffer management solution of some kind. + --require('plugins/ux/tabby'), + --require('plugins/ux/toggleterm'), + --require('plugins/ux/dropbar'), + require('plugins/ux/flatten'), + + -- Workflow + --require('plugins/workflow/neovim-project'), + require('plugins/workflow/projections'), + require('plugins/workflow/mini-files'), + --require('plugins/workflow/git-dev'), + --require('plugins/workflow/sad'), + + -- Organization + --require('plugins/org/due') + + --#################### + --# - Language Plugins + --#################### + -- Lang: Markdown / Quarto + require('plugins/langs/md_quarto/molten-nvim'), + require('plugins/langs/md_quarto/otter'), + require('plugins/langs/md_quarto/quarto-nvim'), + require('plugins/langs/md_quarto/img-clip'), + require('plugins/langs/md_quarto/mdmath'), + require('plugins/langs/md_quarto/nabla'), + --require('plugins/langs/md_quarto/mkdnflow') + --require('plugins/langs/md_quarto/easytables'), + require('plugins/langs/md_quarto/render-markdown-nvim'), + + -- Lang: Python + --require('plugins/langs/python/f-string-toggle'), + + -- Lang: Rust + --require('plugins/langs/rust/rustaceanvim'), + + -- Lang: CSV + --require('plugins/langs/csv/csvview'), + + --#################### + --# - Adaptor-Based Plugins + --#################### + -- Completion: blink-cmp + require('plugins/completion/friendly-snippets'), + --require('plugins/completion/minuet-ai'), + require('plugins/completion/blink'), + + -- Debugging: nvim-dap + --- Keys: d + --require('plugins/debugging/nvim-dap-ui'), + --require('plugins/debugging/nvim-dap-virtual-text'), + --require('plugins/debugging'), + + -- Testing: nvim-neotest + --- Keys: t + require('plugins/testing/neotest-python'), + require('plugins/testing/nvim-neotest'), + + --#################### + --# - Fun and Style + --#################### + -- Fun + require('plugins/fun/cellular-automation'), + + -- Style + require('plugins/catppuccin'), +}, { + ui = { + icons = vim.g.have_nerd_font and {} or { + cmd = 'โŒ˜', + config = '๐Ÿ› ', + event = '๐Ÿ“…', + ft = '๐Ÿ“‚', + init = 'โš™', + keys = '๐Ÿ—', + plugin = '๐Ÿ”Œ', + runtime = '๐Ÿ’ป', + require = '๐ŸŒ™', + source = '๐Ÿ“„', + start = '๐Ÿš€', + task = '๐Ÿ“Œ', + lazy = '๐Ÿ’ค ', + }, + }, +}, { + rocks = { + hererocks = true, + }, +}) diff --git a/lua/plugins/catppuccin.lua b/lua/plugins/catppuccin.lua new file mode 100644 index 0000000..dfb32d3 --- /dev/null +++ b/lua/plugins/catppuccin.lua @@ -0,0 +1,16 @@ +-- Catppuccin Theme +--- A soothing pastel theme for neovim. +return { + "catppuccin/nvim", + tag = 'v1.6.0', + + name = "catppuccin", + + lazy = false, + priority = 1000, + -- Colorschemes should force-load at high priority. + + config = function() + vim.cmd('colorscheme catppuccin') + end +} diff --git a/lua/plugins/completion/blink.lua b/lua/plugins/completion/blink.lua new file mode 100644 index 0000000..767048b --- /dev/null +++ b/lua/plugins/completion/blink.lua @@ -0,0 +1,88 @@ +return { + 'saghen/blink.cmp', + version = 'v0.11.0', + lazy = false, + + priority = 1002, + + opts = { + completion = { + trigger = { + show_in_snippet = false, + }, + list = { + selection = { + preselect = true, + auto_insert = false, + }, + }, + menu = { + auto_show = false, + }, + documentation = { + auto_show = true, + auto_show_delay_ms = 0, + }, + ghost_text = { + enabled = true, + }, + }, + sources = { + default = { 'lsp', 'path', 'buffer' }, + }, + signature = { enabled = true }, + keymap = { + preset = 'none', + + [''] = { + 'snippet_backward', + 'cancel', + }, + [''] = { + function(cmp) + if vim.snippet.active() then + cmp.accept() + vim.snippet.stop() + return 1 -- Something non-nil prevents cmp.show() + end + end, + function(cmp) cmp.show({ providers = { 'snippets' } }) end, + }, + [''] = { + 'select_next', + }, + [''] = { + 'show', + 'select_prev', + }, + [''] = { + 'snippet_forward', + 'select_and_accept', + }, + + --[''] = { 'accept', 'fallback' }, + + [''] = { 'scroll_documentation_down' }, + [''] = { 'scroll_documentation_up' }, + + [''] = { 'fallback' }, + [''] = { 'fallback' }, + + --[''] = { 'hide' }, + --[''] = { 'select_and_accept' }, + + --[''] = { 'select_prev', 'fallback' }, + --[''] = { 'select_next', 'fallback' }, + --[''] = { 'select_prev', 'fallback' }, + --[''] = { 'select_next', 'fallback' }, + + --[''] = { 'scroll_documentation_up', 'fallback' }, + --[''] = { 'scroll_documentation_down', 'fallback' }, + + --[''] = { 'snippet_forward', 'fallback' }, + --[''] = { 'snippet_backward', 'fallback' }, + + --[''] = { 'show_signature', 'hide_signature', 'fallback' }, + }, + }, +} diff --git a/lua/plugins/completion/friendly-snippets.lua b/lua/plugins/completion/friendly-snippets.lua new file mode 100644 index 0000000..9658e28 --- /dev/null +++ b/lua/plugins/completion/friendly-snippets.lua @@ -0,0 +1,5 @@ +return { + "rafamadriz/friendly-snippets", + commit = "efff286dd74c22f731cdec26a70b46e5b203c619", + lazy = false, +} diff --git a/lua/plugins/completion/minuet-ai.lua b/lua/plugins/completion/minuet-ai.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/debugging/nvim-dap-ui.lua b/lua/plugins/debugging/nvim-dap-ui.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/debugging/nvim-dap-virtual-text.lua b/lua/plugins/debugging/nvim-dap-virtual-text.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/debugging/nvim-dap.lua b/lua/plugins/debugging/nvim-dap.lua new file mode 100644 index 0000000..49220f3 --- /dev/null +++ b/lua/plugins/debugging/nvim-dap.lua @@ -0,0 +1,30 @@ +return { + "mfussenegger/nvim-dap", + commit = "b4f27d451c187de912fa8d3229025a952917eb9e", + lazy = true, + + --dependencies = { + -- { "rcarriga/nvim-dap-ui", opts = {} }, + -- { "theHamsta/nvim-dap-virtual-text", opts = {} }, + --}, + + keys = { + { "dB", function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = "Breakpoint Condition" }, + { "db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" }, + { "dc", function() require("dap").continue() end, desc = "Run/Continue" }, + { "da", function() require("dap").continue({ before = get_args }) end, desc = "Run with Args" }, + { "dC", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" }, + { "dg", function() require("dap").goto_() end, desc = "Go to Line (No Execute)" }, + { "di", function() require("dap").step_into() end, desc = "Step Into" }, + { "dj", function() require("dap").down() end, desc = "Down" }, + { "dk", function() require("dap").up() end, desc = "Up" }, + { "dl", function() require("dap").run_last() end, desc = "Run Last" }, + { "do", function() require("dap").step_out() end, desc = "Step Out" }, + { "dO", function() require("dap").step_over() end, desc = "Step Over" }, + { "dP", function() require("dap").pause() end, desc = "Pause" }, + { "dr", function() require("dap").repl.toggle() end, desc = "Toggle REPL" }, + { "ds", function() require("dap").session() end, desc = "Session" }, + { "dt", function() require("dap").terminate() end, desc = "Terminate" }, + { "dw", function() require("dap.ui.widgets").hover() end, desc = "Widgets" }, + }, +} diff --git a/lua/plugins/editing/Comment.lua b/lua/plugins/editing/Comment.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/editing/conform-nvim.lua b/lua/plugins/editing/conform-nvim.lua new file mode 100644 index 0000000..ef65e78 --- /dev/null +++ b/lua/plugins/editing/conform-nvim.lua @@ -0,0 +1,45 @@ +return { + 'stevearc/conform.nvim', + commit = "363243c03102a531a8203311d4f2ae704c620d9b", + lazy = true, + + cmd = { "ConformInfo" }, + + init = function() + vim.treesitter.language.register("markdown", { "quarto", "rmd" }) + end, + + opts = { + formatters_by_ft = { + python = { 'ruff_format', 'ruff_organize_imports' }, + --python = { 'ruff_format' }, + quarto = { 'injected' }, + }, + default_format_opts = { + lsp_format = 'fallback', + }, + formatters = { + injected = { + options = { + ignore_errors = false, + lang_to_ext = { + bash = 'sh', + c_sharp = 'cs', + elixir = 'exs', + javascript = 'js', + julia = 'jl', + latex = 'tex', + markdown = 'md', + python = 'py', + ruby = 'rb', + rust = 'rs', + teal = 'tl', + r = 'r', + typescript = 'ts', + }, + lang_to_formatters = {}, + }, + }, + }, + }, +} diff --git a/lua/plugins/editing/gen.lua b/lua/plugins/editing/gen.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/editing/neogen.lua b/lua/plugins/editing/neogen.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/editing/nvim-surround.lua b/lua/plugins/editing/nvim-surround.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/editing/surround-ui.lua b/lua/plugins/editing/surround-ui.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/editing/todo-comments.lua b/lua/plugins/editing/todo-comments.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/editing/treesitter.lua b/lua/plugins/editing/treesitter.lua new file mode 100644 index 0000000..34ff110 --- /dev/null +++ b/lua/plugins/editing/treesitter.lua @@ -0,0 +1,253 @@ +-- nvim-treesitter +--- Interface to the AST-level parser generator 'tree-sitter', enabling operations on source code that intelligently understand the syntax. +--- Out of the box, grammer-aware code highlighting, indentation, etc. . +--- Base for a lot of other plugins that rely on these kinds of features. + +--- TODO: Look into extensions for: +--- * Text Objects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects +--- As always, consult + +return { + 'nvim-treesitter/nvim-treesitter', + commit = 'cfc6f2c117aaaa82f19bcce44deec2c194d900ab', + + dependencies = { + { + 'nvim-treesitter/nvim-treesitter-textobjects', + commit = 'ad8f0a472148c3e0ae9851e26a722ee4e29b1595', + }, + }, + + build = ':TSUpdate all', -- Update lang parsers unconditionally on build + + lazy = vim.fn.argc(-1) == 0, -- Load early only when opening file w/cmdline + event = { + 'VeryLazy', + }, + cmd = { + "TSUpdateSync", + "TSUpdate", + "TSInstall", + }, + init = function(plugin) + --- Many plugins apparently no longer require("nvim-treesitter"). + --- This messes with the lazy-loading logic. + --- However, such plugins only otherwise use custom queries (seems to be called "RTP"). + --- We therefore register treesitter w/RTP, so such queries will load treesitter. + require("lazy.core.loader").add_to_rtp(plugin) + require("nvim-treesitter.query_predicates") + end, + + opts = { + -- Grammer-Aware Syntax Highlighting + highlight = { + enable = true + }, + + -- Grammer-Aware Indentation + --- TODO: EXPERIMENTAL - CAREFUL! + --indent = { enable = true }, + + textobjects = { + select = { + enable = true, + lookahead = false, + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ["af"] = { + query = "@function.outer", + desc = "Select [A]round [F]unction", + }, + ["if"] = { + query = "@function.inner", + desc = "Select [I]nside [F]unction", + }, + ["al"] = { + query = "@class.outer", + desc = "Select [A]round C[L]ass", + }, + ["il"] = { + query = "@class.outer", + desc = "Select [I]nside C[L]ass", + }, + ["ac"] = { + query = "@cell.outer", + desc = "Select [A]round [C]ell", + }, + ["ic"] = { + query = "@cell.inner", + desc = "Select [I]nside [C]ell", + }, + }, + }, + move = { + enable = true, + set_jumps = true, + } + }, + + -- Always Install Parsers for Languages + ensure_installed = { + "ada", + "arduino", + "asm", + "awk", + "bash", + "bibtex", + "c", + "c_sharp", + "clojure", + "cmake", + "comment", + "commonlisp", + "cpp", + "css", + "csv", + "cuda", + "d", + "dart", + "diff", + "disassembly", + "dockerfile", + "dot", + "doxygen", + "dtd", + "editorconfig", + "eex", + "elixir", + "elm", + "erlang", + "fennel", + "fish", + "forth", + "fortran", + "fsh", + "fsharp", + "gap", + "gdscript", + "gdshader", + "git_config", + "git_rebase", + "gitattributes", + "gitcommit", + "gitignore", + "gleam", + "glsl", + "gnuplot", + "go", + "gpg", + "graphql", + "haskell", + "hcl", + "hlsl", + "hlsplaylist", + "html", + "htmldjango", + "hyprlang", + "ini", + "java", + "javascript", + "jq", + "jsdoc", + "json", + "json5", + "jsonc", + "jsonnet", + "julia", + "just", + "kconfig", + "kdl", + "latex", + "llvm", + "lua", + "luadoc", + "luap", + "luau", + "m68k", + "make", + "markdown", + "markdown_inline", + "matlab", + "meson", + "mlir", + "nasm", + "nginx", + "nix", + "objc", + "objdump", + "ocaml", + "pascal", + "pem", + "perl", + "php", + "phpdoc", + "po", + "pod", + "powershell", + "printf", + "prisma", + "prolog", + "promql", + "proto", + "puppet", + "pymanifest", + "python", + "qmldir", + "qmljs", + "r", + "readline", + "regex", + "requirements", + "robots", + "rst", + "ruby", + "rust", + "scala", + "scss", + "sflog", + "smithy", + "sql", + "ssh_config", + "starlark", + "strace", + "svelte", + "swift", + "t32", + "tablegen", + "tcl", + "teal", + "terraform", + "tmux", + "todotxt", + "toml", + "tsv", + "tsx", + "turtle", + "typescript", + "typespec", + "typst", + "udev", + "unison", + "usd", + "vala", + "verilog", + "vim", + "vimdoc", + "vue", + "wgsl", + "wgsl_bevy", + "xml", + "xresources", + "yaml", + "zathurarc", + "zig", + }, + }, + config = function(_, opts) + require('nvim-treesitter.configs').setup(opts) + + -- Use Treesitter as the Folding Method + --vim.opt.foldmethod = "expr" + --vim.opt.foldexpr = "nvim_treesitter#foldexpr()" + end, +} diff --git a/lua/plugins/editing/treesj.lua b/lua/plugins/editing/treesj.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/fun/cellular-automation.lua b/lua/plugins/fun/cellular-automation.lua new file mode 100644 index 0000000..537355f --- /dev/null +++ b/lua/plugins/fun/cellular-automation.lua @@ -0,0 +1,40 @@ +-- cellular-automaton.nvim +--- Purely fun little plugin that animates the buffer text. + +--- TODO: I think bufferline is conflicting (looks all flashy n shit) +return { + 'eandrju/cellular-automaton.nvim', + commit = '11aea08aa084f9d523b0142c2cd9441b8ede09ed', + + lazy = true, + keys = { + { + "fml", + function() + require('cellular-automaton').start_animation('make_it_rain') + end, + "n", + }, + { + "fuck", + function() + require('cellular-automaton').start_animation('scramble') + end, + "n", + }, + { + "fuck", + function() + require('cellular-automaton').start_animation('game_of_life') + end, + "n", + }, + { + "FUCK", + function() + require('cellular-automaton').start_animation('game_of_life') + end, + "n", + }, + }, +} diff --git a/lua/plugins/langs/csv/csvview.lua b/lua/plugins/langs/csv/csvview.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/langs/md_quarto/easytables.lua b/lua/plugins/langs/md_quarto/easytables.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/langs/md_quarto/img-clip.lua b/lua/plugins/langs/md_quarto/img-clip.lua new file mode 100644 index 0000000..43f3287 --- /dev/null +++ b/lua/plugins/langs/md_quarto/img-clip.lua @@ -0,0 +1,26 @@ +return { + "HakonHarnes/img-clip.nvim", + commit = '5ded6f468d633ccfb315905fe8901d6c95ae8f29', + event = 'VeryLazy', + + cmd = { + 'PasteImage', + 'ImgClipDebug', + 'ImgClipConfig', + }, + + keys = { + -- Pasting + { + 'pi', + function() + require('img-clip').paste_image() + end, + desc = '[P]aste [I]mage', + }, + }, + + opts = { + dir_path = 'img', + }, +} diff --git a/lua/plugins/langs/md_quarto/mdmath.lua b/lua/plugins/langs/md_quarto/mdmath.lua new file mode 100644 index 0000000..abd417a --- /dev/null +++ b/lua/plugins/langs/md_quarto/mdmath.lua @@ -0,0 +1,32 @@ +return { + 'Thiago4532/mdmath.nvim', + commit = '699acb27fd34bfdf92a43ce0abdd17f0c7a948fe', + opts = { + filetypes = { 'markdown', 'quarto' }, + dynamic = true, + dynamic_scale = 0.75, + }, + + cmd = { + 'MdMath', + }, + + keys = { + { + 'ue', + function() + require('mdmath').enable() + end, + 'n', + desc = 'Enable [U]I [E]quations', + }, + { + 'uE', + function() + require('mdmath').disable() + end, + 'n', + desc = 'Disable [U]I [E]quations', + }, + }, +} diff --git a/lua/plugins/langs/md_quarto/mkdnflow.lua b/lua/plugins/langs/md_quarto/mkdnflow.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/langs/md_quarto/molten-nvim.lua b/lua/plugins/langs/md_quarto/molten-nvim.lua new file mode 100644 index 0000000..6330045 --- /dev/null +++ b/lua/plugins/langs/md_quarto/molten-nvim.lua @@ -0,0 +1,74 @@ +return { + 'benlubas/molten-nvim', + commit = "a286aa914d9a154bc359131aab788b5a077a5a99", + build = ":UpdateRemotePlugins", + lazy = false, + + --cmd = { + -- 'MoltenInfo', + -- 'MoltenInit', + -- 'MoltenDeinit', + -- 'MoltenGoto', + -- 'MoltenNext', + -- 'MoltenPrev', + -- 'MoltenEvaluateLine', + -- 'MoltenEvaluateVisual', + -- 'MoltenEvaluateOperator', + -- 'MoltenEvaluateArgument', + -- 'MoltenReevaluateCell', + -- 'MoltenDelete', + -- 'MoltenShowOutput', + -- 'MoltenHideOutput', + -- 'MoltenEnterOutput', + -- 'MoltenInterrupt', + -- 'MoltenOpenInBrowser', + -- 'MoltenImagePopup', + -- 'MoltenRestart', + -- 'MoltenSave', + -- 'MoltenLoad', + -- 'MoltenExportOutput', + -- 'MoltenImportOutput', + --}, + + keys = { + { + 'ji', + function() + vim.ui.input({ + prompt = 'Enter Jupyter Server URL:' + }, function(input) + if input then + vim.cmd(':MoltenInit ' .. input) + end + end) + end, + desc = "[J]upyter [I]nitialize", + }, + { + 'jo', + ':noautocmd MoltenEnterOutput', + silent = true, + desc = "[J]upyter [I]nitialize" + }, + { + 'jO', + ':MoltenOpenInBrowser', + silent = true, + desc = "[J]upyter [I]nitialize" + }, + + }, + + init = function() + -- Configuration + vim.g.molten_image_provider = "image.nvim" + vim.g.molten_output_win_max_height = 12 + --vim.g.molten_auto_open_output = false + vim.g.molten_auto_init_behavior = 'raise' + vim.g.molten_virt_text_output = true + vim.g.molten_image_location = 'float' + --vim.g.molten_output_show_more = true + vim.g.molten_output_virt_lines = false + vim.g.molten_use_border_highlights = true + end, +} diff --git a/lua/plugins/langs/md_quarto/nabla.lua b/lua/plugins/langs/md_quarto/nabla.lua new file mode 100644 index 0000000..5022f99 --- /dev/null +++ b/lua/plugins/langs/md_quarto/nabla.lua @@ -0,0 +1,16 @@ +return { + 'jbyuki/nabla.nvim', + commit = '27a6ea9ed7452bb9e0b19eb0942b5bcf7d051b2f', + lazy = true, + + keys = { + { + '', + function() + require('nabla').popup({ close_events = { 'InsertLeave' } }) + end, + mode = { 'i' }, + desc = 'Toggle [U]I [E]quations', + }, + } +} diff --git a/lua/plugins/langs/md_quarto/otter.lua b/lua/plugins/langs/md_quarto/otter.lua new file mode 100644 index 0000000..029e2d5 --- /dev/null +++ b/lua/plugins/langs/md_quarto/otter.lua @@ -0,0 +1,12 @@ +return { + 'jmbuhr/otter.nvim', + commit = "0e42fa795c35c7190935e3beda3791189c41bb72", + lazy = true, + + opts = { + buffers = { + set_filetype = true, + write_to_disk = true, + }, + }, +} diff --git a/lua/plugins/langs/md_quarto/quarto-nvim.lua b/lua/plugins/langs/md_quarto/quarto-nvim.lua new file mode 100644 index 0000000..3ed03c2 --- /dev/null +++ b/lua/plugins/langs/md_quarto/quarto-nvim.lua @@ -0,0 +1,140 @@ +return { + --"quarto-dev/quarto-nvim", + dir = vim.env.HOME .. '/comps/neovim/quarto-nvim', + commit = "f98937b5be953b27757088e392ce6ccdb16898e5", + lazy = true, + + cmd = { + 'QuartoPreview', + 'QuartoPreviewNoWatch', + 'QuartoUpdatePreview', + 'QuartoClosePreview', + 'QuartoActivate', + 'QuartoHelp', + 'QuartoSend', + 'QuartoSendAbove', + 'QuartoSendBelow', + 'QuartoSendAll', + 'QuartoSendRange', + 'QuartoSendLine', + }, + + keys = { + { + ']c', + function() + require('nvim-treesitter.textobjects.move').goto_next_start( + '@cell.inner', + 'textobjects' + ) + end, + desc = "Goto Next [C]ell Start" + }, + { + '[c', + function() + require('nvim-treesitter.textobjects.move').goto_previous_start( + '@cell.inner', + 'textobjects' + ) + end, + desc = "Goto Prev [C]ell Start" + }, + { + ']C', + function() + require('nvim-treesitter.textobjects.move').goto_next_end( + '@cell.outer', + 'textobjects' + ) + end, + desc = "Goto Next [C]ell End" + }, + { + '[C', + function() + require('nvim-treesitter.textobjects.move').goto_previous_end( + '@cell.outer', + 'textobjects' + ) + end, + desc = "Goto Prev [C]ell End" + }, + -- Jupyter / Notebooks + --- j + { + 'jl', + function() + require('quarto.runner').run_cell() + --vim.cmd(':noautocmd MoltenEnterOutput') + end, + desc = "[J]upyter Run Ce[L]l", + silent = true, + }, + { + 'jL', + function() + require('quarto.runner').run_cell() + vim.cmd(':MoltenOpenInBrowser') + end, + desc = "[J]upyter Run Ce[L]l" + }, + { + 'j;', + function() + require('quarto.runner').run_cell() + require('nvim-treesitter.textobjects.move').goto_next_start( + '@cell.inner', + 'textobjects' + ) + end, + desc = "[J]upyter Run Cell and Skip" + }, + { + 'jk', + function() require('quarto.runner').run_above() end, + desc = "[J]upyter Run Cell Above" + }, + { + 'jA', + function() require('quarto.runner').run_all() end, + desc = "[J]upyter Run Cell Below" + }, + { + 'j,', + function() require('quarto.runner').run_line() end, + desc = "[J]upyter Run L[I]ne" + }, + { + 'jp', + function() require('quarto').quartoPreview() end, + desc = "[J]upyter Start [P]review" + }, + { + 'jP', + function() require('quarto').quartoStopPreview() end, + desc = "[J]upyter Stop [P]review" + }, + + }, + + init = function() + vim.treesitter.language.register("markdown", { "quarto", "rmd" }) + + vim.api.nvim_create_autocmd('FileType', { + pattern = { 'quarto' }, + callback = function(ev) + require('quarto').activate() + end + }) + end, + + opts = { + venv = { + enabled = true, + }, + codeRunner = { + default_method = 'molten', + }, + }, +} diff --git a/lua/plugins/langs/md_quarto/render-markdown-nvim.lua b/lua/plugins/langs/md_quarto/render-markdown-nvim.lua new file mode 100644 index 0000000..cea2e9a --- /dev/null +++ b/lua/plugins/langs/md_quarto/render-markdown-nvim.lua @@ -0,0 +1,27 @@ +return { + 'MeanderingProgrammer/render-markdown.nvim', + commit = '17a77463f945c4b9e4f371c752efd90e3e1bf604', + + ft = { 'markdown', 'quarto' }, + + opts = { + file_types = { 'markdown', 'quarto' }, + latex = { enabled = false }, + win_options = { conceallevel = { rendered = 2 } }, + heading = { + }, + code = { + position = 'right', + width = 'block', + min_width = 25, + + border = 'none', + }, + --on = { + -- attach = function() + -- require('nabla').enable_virt({ autogen = true }) + -- vim.o.wrap = true + -- end, + --}, + }, +} diff --git a/lua/plugins/langs/python/f-string-toggle.lua b/lua/plugins/langs/python/f-string-toggle.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/langs/rust/rustaceanvim.lua b/lua/plugins/langs/rust/rustaceanvim.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/libs/image-nvim.lua b/lua/plugins/libs/image-nvim.lua new file mode 100644 index 0000000..ddc0709 --- /dev/null +++ b/lua/plugins/libs/image-nvim.lua @@ -0,0 +1,28 @@ +return { + "3rd/image.nvim", + commit = "7704e1d03d952393774dc7d00a98d8e127086ba4", + --commit = "301de7919b2c0378cb7a782663f67abbcb198b17", + lazy = false, + + cmd = { + 'ImageReport', + }, + + opts = { + backend = "kitty", + processor = "magick_rock", + integrations = { + markdown = { + only_render_image_at_cursor = true, + --floating_windows = true, + filetypes = { "markdown", "quarto" }, + }, + }, + max_width = 100, + max_height = 12, + max_height_window_percentage = math.huge, + max_width_window_percentage = math.huge, + window_overlap_clear_enabled = true, + window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "" }, + } +} diff --git a/lua/plugins/libs/nui.lua b/lua/plugins/libs/nui.lua new file mode 100644 index 0000000..b6d9dac --- /dev/null +++ b/lua/plugins/libs/nui.lua @@ -0,0 +1,5 @@ +return { + 'MunifTanjim/nui.nvim', + commit = "53e907ffe5eedebdca1cd503b00aa8692068ca46", + lazy = true, +} diff --git a/lua/plugins/libs/nvim-nio.lua b/lua/plugins/libs/nvim-nio.lua new file mode 100644 index 0000000..3fe6de4 --- /dev/null +++ b/lua/plugins/libs/nvim-nio.lua @@ -0,0 +1,5 @@ +return { + "nvim-neotest/nvim-nio", + commit = "21f5324bfac14e22ba26553caf69ec76ae8a7662", + lazy = true, +} diff --git a/lua/plugins/libs/nvim-notify.lua b/lua/plugins/libs/nvim-notify.lua new file mode 100644 index 0000000..122b9f3 --- /dev/null +++ b/lua/plugins/libs/nvim-notify.lua @@ -0,0 +1,5 @@ +return { + 'rcarriga/nvim-notify', + commit = '22f29093eae7785773ee9d543f8750348b1a195c', + lazy = true, +} diff --git a/lua/plugins/libs/nvim-web-devicons.lua b/lua/plugins/libs/nvim-web-devicons.lua new file mode 100644 index 0000000..a8df6be --- /dev/null +++ b/lua/plugins/libs/nvim-web-devicons.lua @@ -0,0 +1,12 @@ +-- nvim-web-devicons +-- NERD fonts for neovim plugins. +return { + 'nvim-tree/nvim-web-devicons', + commit = '5740b7382429d20b6ed0bbdb0694185af9507d44', + lazy = false, + priority = 1001, + + -- REQ: telescope + + enabled = vim.g.have_nerd_font, +} diff --git a/lua/plugins/libs/plenary.lua b/lua/plugins/libs/plenary.lua new file mode 100644 index 0000000..6263ff4 --- /dev/null +++ b/lua/plugins/libs/plenary.lua @@ -0,0 +1,7 @@ +-- plenary.nvim +--- Essentially, a collection of "lua functions the author didn't want to write twice". +return { + 'nvim-lua/plenary.nvim', + commit = '2d9b06177a975543726ce5c73fca176cedbffe9d', + lazy = true, +} diff --git a/lua/plugins/lsp/lsp-lines.lua b/lua/plugins/lsp/lsp-lines.lua new file mode 100644 index 0000000..2be57cc --- /dev/null +++ b/lua/plugins/lsp/lsp-lines.lua @@ -0,0 +1,44 @@ +local function close_floats() + for _, win in ipairs(vim.api.nvim_list_wins()) do + if vim.api.nvim_win_get_config(win).relative == "win" then + vim.api.nvim_win_close(win, false) + end + end +end + +return { + "https://git.sr.ht/~whynothugo/lsp_lines.nvim", + commit = 'a92c755f182b89ea91bd8a6a2227208026f27b4d', + lazy = false, + + keys = { + { + 'df', + function() + require("lsp_lines").toggle() + + if vim.diagnostic.config().virtual_lines then + close_floats() + else + vim.diagnostic.open_float() + end + end, + desc = 'Toggle [D]ebug [L]ines', + }, + { + '', + function() + close_floats() + end, + desc = 'Close [F]loats', + }, + }, + + init = function() + vim.diagnostic.config({ virtual_text = false }) + --vim.diagnostic.config({ virtual_text = false, virtual_lines = { only_current_line = true } }) + --vim.diagnostic.config({ virtual_text = false, virtual_lines = { only_current_line = true }, }) + end, + + opts = {} +} diff --git a/lua/plugins/lsp/tiny-code-action.lua b/lua/plugins/lsp/tiny-code-action.lua new file mode 100644 index 0000000..31a1a1b --- /dev/null +++ b/lua/plugins/lsp/tiny-code-action.lua @@ -0,0 +1,9 @@ +-- tiny-code-action +--- Simple code-action visualization with telescope +return { + "rachartier/tiny-code-action.nvim", + lazy = true, + opts = { + backend = "vim", + }, +} diff --git a/lua/plugins/motion/flash.lua b/lua/plugins/motion/flash.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/motion/gx.lua b/lua/plugins/motion/gx.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/org/due.lua b/lua/plugins/org/due.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/search/fzf-lua.lua b/lua/plugins/search/fzf-lua.lua new file mode 100644 index 0000000..8f1da16 --- /dev/null +++ b/lua/plugins/search/fzf-lua.lua @@ -0,0 +1,145 @@ +-- fzf-lua.nvim +--- Configurable fuzzy finder w/UI. +--- See for commands. + +-- REQ[sys]: fd-find +-- REQ[sys]: ripgrep +-- REQ[sys]: bat +-- REQ[sys]: git-delta + +return { + 'ibhagwan/fzf-lua', + commit = 'e3fefd97875827e47dc4bbf1074ee464b2d8e6a8', + lazy = true, + + cmd = { + "Telescope", + }, + + keys = { + -- Accessibility + { + 's?', + function() require('fzf-lua').builtin() end, + 'n', + desc = '[S]earch Search-Commands', + }, + { + 'sh', + function() require('fzf-lua').helptags() end, + 'n', + desc = '[S]earch [H]elp Tags', + }, + { + 'sk', + function() require('fzf-lua').keymaps() end, + 'n', + desc = '[S]earch [K]eymaps', + }, + { + 'sc', + function() require('fzf-lua').commands() end, + 'n', + desc = '[S]earch [C]ommands', + }, + { + 'sm', + function() require('fzf-lua').manpages() end, + 'n', + desc = '[S]earch [M]anpages', + }, + + -- Grep + { + 'sg', + function() require('fzf-lua').live_grep() end, + 'n', + desc = '[S]earch w/[G]rep', + }, + + -- Buffer / File Search + { + 'sb', + function() require('fzf-lua').buffers() end, + 'n', + desc = '[S]earch [B]uffers', + }, + { + 'sf', + function() require('fzf-lua').files() end, + 'n', + desc = '[S]earch [F]iles', + }, + + -- Git: "VCS" -> "v" + { + 'sgc', + function() require('fzf-lua').git_commits() end, + 'n', + desc = '[S]earch Git [C]ommits', + }, + { + 'sgs', + function() require('fzf-lua').git_status() end, + 'n', + desc = '[S]earch Git [S]tatus', + }, + + -- Debug + { + "sd", + function() require('fzf-lua').diagnostics_document() end, + 'n', + desc = '[S]earch [D]iagnostics', + }, + + -- Vim + { + "s'", + function() require('fzf-lua').registers() end, + 'n', + desc = '[S]earch Vim Registers', + }, + }, + + opts = { + fzf_bin = 'sk', + keymap = { + builtin = { + [""] = "preview-page-up", + [""] = "preview-page-down", + }, + fzf = { + ["ctrl-u"] = "half-page-up", + ["ctrl-d"] = "half-page-down", + ["ctrl-b"] = "preview-page-up", + ["ctrl-f"] = "preview-page-down", + }, + }, + previewers = { + builtin = { + extensions = { + ["png"] = { "chafa", "{file}" }, + ["jpg"] = { "chafa", "{file}" }, + ["jpeg"] = { "chafa", "{file}" }, + ["gif"] = { "chafa", "{file}" }, + ["svg"] = { "chafa", "{file}" }, + ["webp"] = { "chafa", "{file}" }, + }, + }, + }, + winopts = { + width = 0.8, + height = 0.8, + row = 0.5, + col = 0.5, + preview = { + scrollchars = { "โ”ƒ", "" }, + }, + }, + fzf_colors = true, + fzf_opts = { + ["--no-scrollbar"] = true, + }, + }, +} diff --git a/lua/plugins/snacks.lua b/lua/plugins/snacks.lua new file mode 100644 index 0000000..60c4b03 --- /dev/null +++ b/lua/plugins/snacks.lua @@ -0,0 +1,68 @@ +return { + "folke/snacks.nvim", + commit = "b773368f8aa6e84a68e979f0e335d23de71f405a", + lazy = false, + priority = 1000, + + keys = { + { + "d", + function() require('snacks').bufdelete() end, + desc = "Delete Current Buffer", + }, + + -- UX + --- u + { + "ud", + function() require('snacks').dim() end, + desc = "[U]I [D]imming", + }, + { + "us", + function() require('snacks').dim.disable() end, + desc = "Disable [U]I Dimming", + }, + { + "uz", + function() require('snacks').zen() end, + desc = "[U]I [Z]en Mode", + }, + }, + + opts = { + -- Big Files: Disable LSPs for Very Big Files + bigfile = {}, + + -- Dashboard: Pretty Startup + dashboard = {}, + + -- Dim: Focus on the Active Scope + dim = {}, + + -- Indent: Indentation Guides + indent = { + animate = { + enabled = false, + } + }, + + -- Input: Better vim.ui.input + input = { enabled = true }, + + -- TODO: git (for the blame line) + -- TODO: gitbrowse + -- TODO: lazygit + + -- Notifier: Prettier notifications + --notifier = { enabled = true }, + + -- Quickfile: Load files first (aka fast) when doing 'nvim file.txt' + quickfile = { enabled = true }, + + -- TODO: 'rename' w/nvim-tree integration + + -- "Zen Mode" + zen = { enabled = true }, + }, +} diff --git a/lua/plugins/testing/neotest-python.lua b/lua/plugins/testing/neotest-python.lua new file mode 100644 index 0000000..ef74fc5 --- /dev/null +++ b/lua/plugins/testing/neotest-python.lua @@ -0,0 +1,5 @@ +return { + "nvim-neotest/neotest-python", + commit = "a2861ab3c9a0bf75a56b11835c2bfc8270f5be7e", + lazy = true, +} diff --git a/lua/plugins/testing/nvim-neotest.lua b/lua/plugins/testing/nvim-neotest.lua new file mode 100644 index 0000000..78983e0 --- /dev/null +++ b/lua/plugins/testing/nvim-neotest.lua @@ -0,0 +1,29 @@ +return { + "nvim-neotest/neotest", + commit = "d66cf4e05a116957f0d3a7755a24291c7d1e1f72", + lazy = true, + + opts = function(_, _) + return { + adapters = { + require("neotest-python") + }, + } + end, + keys = { + { + "t", + "", + desc = "+test" + }, + { "tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File (Neotest)" }, + { "tT", function() require("neotest").run.run(vim.uv.cwd()) end, desc = "Run All Test Files (Neotest)" }, + { "tr", function() require("neotest").run.run() end, desc = "Run Nearest (Neotest)" }, + { "tl", function() require("neotest").run.run_last() end, desc = "Run Last (Neotest)" }, + { "ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary (Neotest)" }, + { "to", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output (Neotest)" }, + { "tO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel (Neotest)" }, + { "tS", function() require("neotest").run.stop() end, desc = "Stop (Neotest)" }, + { "tw", function() require("neotest").watch.toggle(vim.fn.expand("%")) end, desc = "Toggle Watch (Neotest)" }, + }, +} diff --git a/lua/plugins/ux/dropbar.lua b/lua/plugins/ux/dropbar.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/ux/flatten.lua b/lua/plugins/ux/flatten.lua new file mode 100644 index 0000000..8da5e14 --- /dev/null +++ b/lua/plugins/ux/flatten.lua @@ -0,0 +1,13 @@ +-- willothy/flatten.nvim +--- Makes nvim's embedded terminal play nice with nvim. +--- Seriously awesome. Ex. pipe anything into | nvim to open in a new buffer. +--- See https://github.com/willothy/flatten.nvim +return { + "willothy/flatten.nvim", + commit = "b17a3e65c2e4e2ecd1345a2d08435e80f982c4a6", + lazy = false, + priority = 1001, + + opts = {}, + -- TODO: Rethink which buffer is used for opening / piping. +} diff --git a/lua/plugins/ux/noice.lua b/lua/plugins/ux/noice.lua new file mode 100644 index 0000000..e6a4146 --- /dev/null +++ b/lua/plugins/ux/noice.lua @@ -0,0 +1,30 @@ +return { + "folke/noice.nvim", + event = "VeryLazy", + opts = { + cmdline = { enabled = false }, + messages = { enabled = false }, + popupmenu = { enabled = false }, + redirect = { enabled = false }, + notify = { enabled = false }, + lsp = { + progress = { enabled = false }, + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + }, + hover = { enabled = true }, + signature = { enabled = true }, + message = { enabled = false }, + }, + --presets = { + -- command_palette = true, + --}, + --cmdline = { + -- format = { + -- --cmdline = { pattern = "^:", icon = "๏”", lang = "vim" }, + -- cmdline = { pattern = "^:", icon = ":", lang = "vim" }, + -- }, + --}, + }, +} diff --git a/lua/plugins/ux/tabby.lua b/lua/plugins/ux/tabby.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/ux/toggleterm.lua b/lua/plugins/ux/toggleterm.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/ux/vim-sleuth.lua b/lua/plugins/ux/vim-sleuth.lua new file mode 100644 index 0000000..74363cc --- /dev/null +++ b/lua/plugins/ux/vim-sleuth.lua @@ -0,0 +1,4 @@ +-- Vim Sleuth +--- Detect tabstop and shiftwidth automatically + +return 'tpope/vim-sleuth' diff --git a/lua/plugins/ux/which-key.lua b/lua/plugins/ux/which-key.lua new file mode 100644 index 0000000..f178724 --- /dev/null +++ b/lua/plugins/ux/which-key.lua @@ -0,0 +1,8 @@ +-- which-key.nvim +--- Whenever a key is pressed, display possible key bindings of what is being typed. +--- Automatically reads the desc attribute of custom key bindings. +return { + "folke/which-key.nvim", + commit = '0e76a87ac51772569aec678dc74baa8e2a86100c', + event = 'VeryLazy', +} diff --git a/lua/plugins/vcs/diffview.lua b/lua/plugins/vcs/diffview.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/vcs/gitlinker.lua b/lua/plugins/vcs/gitlinker.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/vcs/gitsigns.lua b/lua/plugins/vcs/gitsigns.lua new file mode 100644 index 0000000..f447f23 --- /dev/null +++ b/lua/plugins/vcs/gitsigns.lua @@ -0,0 +1,111 @@ +-- gitsigns.nvim +--- Displays git changes in the sidebar, configurably and efficiently. +--- See `:help gitsigns` +return { + 'lewis6991/gitsigns.nvim', + commit = '9b36d497495436c135659902054ee637e0ba6021', + event = 'VeryLazy', + lazy = false, + -- See: https://github.com/lewis6991/gitsigns.nvim/issues/796 + + opts = { + numhl = true, + + on_attach = function(buf) + -- Hunk Navigation + vim.keymap.set( + 'n', + ']g', + function() + if vim.wo.diff then + vim.cmd.normal({ ']c', bang = true }) + else + require('gitsigns').nav_hunk('next') + end + end, + { buffer = buf, desc = 'Next [G]it Change' } + ) + vim.keymap.set( + 'n', + '[g', + function() + if vim.wo.diff then + vim.cmd.normal({ '[c', bang = true }) + else + require('gitsigns').nav_hunk('prev') + end + end, + { buffer = buf, desc = 'Prev [G]it Change' } + ) + + -- Hunk Preview + vim.keymap.set( + 'n', + 'gp', + function() require('gitsigns').preview_hunk() end, + { buffer = buf, desc = '[G]it [P]review Hunk' } + ) + + -- Buffer Staging / Unstaging + vim.keymap.set( + 'n', + 'gs', + function() require('gitsigns').stage_buffer() end, + { buffer = buf, desc = '[G]it [S]tage Buffer' } + ) + vim.keymap.set( + 'n', + 'gS', + function() require('gitsigns').reset_buffer_index() end, + { buffer = buf, desc = '[G]it Unstage Buffer' } + ) + + -- Hunk Staging + vim.keymap.set( + 'n', + 'gh', + function() require('gitsigns').stage_hunk() end, + { buffer = buf, desc = '[G]it Hunk [S]tage Toggle' } + ) + + -- Restoration + vim.keymap.set( + 'n', + 'gr', + function() + require('gitsigns').reset_hunk() + end, + { buffer = buf, desc = '[G]it [R]estore Hunk' } + ) + vim.keymap.set( + 'n', + 'gR', + function() + local choice = vim.fn.confirm( + "Delete all unstaged changes in this buffer?", + "&Yes\n&No", + 2 + ) + if choice == 1 then + require('gitsigns').reset_buffer() + end + end, + { buffer = buf, desc = '[G]it [R]estore Buffer' } + ) + + vim.keymap.set( + 'n', + 'ga', + function() + require('gitsigns').toggle_linehl() + require('gitsigns').toggle_word_diff() + end, + { buffer = buf, desc = '[G]it [A]nalysis Toggle' } + ) + + + -- TODO: Shortcut for opening lazygit in a new :term. + --- Perhaps even in a new tab? + end, + } +} diff --git a/lua/plugins/workflow/git-dev.lua b/lua/plugins/workflow/git-dev.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/workflow/mini-files.lua b/lua/plugins/workflow/mini-files.lua new file mode 100644 index 0000000..69dc14b --- /dev/null +++ b/lua/plugins/workflow/mini-files.lua @@ -0,0 +1,29 @@ +return { + 'echasnovski/mini.files', + commit = '0db8f49088bcefff23c5cb8498a6c94e46a45a8e', + lazy = true, + + keys = { + { + 'fd', + function() + if not require('mini.files').close() then + require('mini.files').open() + end + end, + 'n', + desc = '[F]ile Browser' + }, + }, + + opts = { + mapping = { + close = { 'q', 'fd' }, + go_in_plus = '', + go_out_plus = '', + }, + windows = { + preview = false, + }, + }, +} diff --git a/lua/plugins/workflow/neovim-project.lua b/lua/plugins/workflow/neovim-project.lua new file mode 100644 index 0000000..a95f07f --- /dev/null +++ b/lua/plugins/workflow/neovim-project.lua @@ -0,0 +1,30 @@ +-- neovim-project +--- Lightweight workspace, project and session manager. + +-- Utilities +return { + "coffebar/neovim-project", + opts = { + projects = { -- define project roots + "~/src/*", + "~/.config/*", + }, + picker = { + type = "telescope", -- or "fzf-lua" + } + }, + init = function() + -- enable saving the state of plugins in the session + vim.opt.sessionoptions:append("globals") -- save global variables that start with an uppercase letter and contain at least one lowercase letter. + end, + dependencies = { + { "nvim-lua/plenary.nvim" }, + -- optional picker + { "nvim-telescope/telescope.nvim", tag = "0.1.4" }, + -- optional picker + { "ibhagwan/fzf-lua" }, + { "Shatur/neovim-session-manager" }, + }, + lazy = false, + priority = 100, +} diff --git a/lua/plugins/workflow/projections.lua b/lua/plugins/workflow/projections.lua new file mode 100644 index 0000000..0651509 --- /dev/null +++ b/lua/plugins/workflow/projections.lua @@ -0,0 +1,124 @@ +-- projections.nvim +--- Lightweight workspace, project and session manager. + +local startswith = function(text, prefix) + return text:find(prefix, 1, true) == 1 +end + +local function store_session() + local cwd = vim.loop.cwd() + if cwd and require('projections.session').info(cwd) then + require('projections.session').store(cwd) + end +end + +-- Plugin +return { + 'gnikdroy/projections.nvim', + commit = '889914169fa1f5c00fb8659653b5a8330fb223e6', + lazy = true, + + dependencies = { + { + 'nyngwang/fzf-lua-projections.nvim', + commit = '411672ab6f7c38d3a4a51916fda1a01c1618ae04', + }, + }, + + keys = { + { + "sp", + function() + require('fzf-lua-p').projects() + end, + "n", + }, + }, + + init = function() + vim.opt.sessionoptions = 'blank,buffers,folds,globals,help,localoptions,resize,tabpages,terminal' + + --#################### + --# - Store Session on Close Vim + --#################### + vim.api.nvim_create_autocmd({ 'VimLeavePre' }, { + callback = store_session, + }) + + --#################### + --# - Store Session on Timer + --#################### + vim.api.nvim_create_autocmd({ 'BufWritePre' }, { + callback = store_session, + }) + --local timer = vim.uv.new_timer() + --timer:start(1000, 1000, vim.schedule_wrap(store_session)) + + --#################### + --# - Restore Session on Open Vim + --#################### + vim.api.nvim_create_autocmd({ 'VimEnter' }, { + callback = function() + local workspaces = require("projections.workspace").get_workspaces() + + local cwd = vim.loop.cwd() + if not cwd then return end + + -- If Currently Within a Project, CD to that Project + for _, ws in ipairs(workspaces) do + for _, project in ipairs(ws:projects()) do + local path_project = project:path().path + if startswith(cwd, path_project) then + vim.cmd('cd ' .. path_project) + end + end + end + if not cwd then return end + + -- If Path was Opened: Retrieve That Path + local path_opened_file = nil + if next(vim.fn.argv()) then + path_opened_file = vim.fn.argv(0) + end + + -- If CWD is a Project: Restore Project Session + cwd = vim.loop.cwd() + local session_info = require('projections.session').info(cwd) + if session_info ~= nil then + require('projections.session').restore(cwd) + end + + -- If Originally Opened w/File, Open it Now + --- This makes sure that, although we restored the session... + --- ...the file requested to edit will still be opened for editing. + if path_opened_file ~= nil then + vim.cmd('e ' .. path_opened_file) + end + -- TODO: Perhaps we need to question the user a little more about what they want. + end + }) + end, + + opts = { + -- Default Workspaces + --- Any folder with a '.git' within a workspace is a 'project'. + workspaces = { + -- General + { '~/src', { '.git' } }, + -- Specific + --- Blender + { '~/src/blender', { '.git' } }, + --- College + { '~/src/college/bsc', { ".active_course" } }, + { '~/src/college/msc', { ".active_course" } }, + --- Infrastructures + { '~/src/infras/clusters', { '.git' } }, + --- Photonics + { '~/src/photonics/books', { '.git' } }, + { '~/src/photonics/packages', { '.git' } }, + --- Neovim + { "~/comps/neovim", { '.git' } }, + { "~/.config", { 'nvim.version' } }, + }, + }, +} diff --git a/lua/plugins/workflow/sad.lua b/lua/plugins/workflow/sad.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/usercmds.lua b/lua/usercmds.lua new file mode 100644 index 0000000..447238f --- /dev/null +++ b/lua/usercmds.lua @@ -0,0 +1,2 @@ +-- [[ User Commands ]] +-- See `:help lua-guide-autocommands` diff --git a/nvim.version b/nvim.version new file mode 100644 index 0000000..4419732 --- /dev/null +++ b/nvim.version @@ -0,0 +1 @@ +e4a58a7ca03457668492f8f41189ea2f23700172 \ No newline at end of file