From 79089250f69f5005aade0a1df492f4d4c1a3977d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sofus=20Albert=20H=C3=B8gsbro=20Rose?= Date: Thu, 13 Feb 2025 08:58:49 +0100 Subject: [PATCH] fix: fixes for laptop install --- .stylua.toml | 12 + README.md | 5 + lazy-lock.json | 1 + lsp/lua-language-server.lua | 3 + lua/autocmds/lsp.lua | 8 +- lua/plugins.lua | 24 +- lua/plugins/editing/conform-nvim.lua | 7 +- lua/plugins/editing/treesitter.lua | 369 +++++++++--------- lua/plugins/langs/md_quarto/mdmath.lua | 13 +- lua/plugins/langs/md_quarto/molten-nvim.lua | 6 +- lua/plugins/langs/md_quarto/quarto-nvim.lua | 2 +- .../langs/md_quarto/render-markdown-nvim.lua | 2 + lua/plugins/libs/image-nvim.lua | 3 +- 13 files changed, 250 insertions(+), 205 deletions(-) create mode 100644 .stylua.toml diff --git a/.stylua.toml b/.stylua.toml new file mode 100644 index 0000000..b059355 --- /dev/null +++ b/.stylua.toml @@ -0,0 +1,12 @@ +syntax = "All" +column_width = 120 +line_endings = "Unix" +indent_type = "Tabs" +indent_width = 4 +quote_style = "AutoPreferSingle" +call_parentheses = "Always" +collapse_simple_statement = "Never" +space_after_function_names = "Never" + +[sort_requires] +enabled = false diff --git a/README.md b/README.md index 59972da..0cb1f8b 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ cargo install --force fd-find cargo install --force bat cargo install --force git-delta cargo install --force skim +cargo install --force stylua # Python ## - FIRST, install uv @@ -52,3 +53,7 @@ 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 ``` + + +INSTALLATION EXPERIENCES: +- need libreadline-dev and libmagickwand-dev diff --git a/lazy-lock.json b/lazy-lock.json index 09df737..3f807e7 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -8,6 +8,7 @@ "fzf-lua": { "branch": "main", "commit": "e3fefd97875827e47dc4bbf1074ee464b2d8e6a8" }, "fzf-lua-projections.nvim": { "branch": "main", "commit": "411672ab6f7c38d3a4a51916fda1a01c1618ae04" }, "gitsigns.nvim": { "branch": "main", "commit": "9b36d497495436c135659902054ee637e0ba6021" }, + "hererocks": { "branch": "master", "commit": "c9c5444dea1e07e005484014a8231aa667be30b6" }, "image.nvim": { "branch": "master", "commit": "7704e1d03d952393774dc7d00a98d8e127086ba4" }, "img-clip.nvim": { "branch": "main", "commit": "5ded6f468d633ccfb315905fe8901d6c95ae8f29" }, "lazy.nvim": { "branch": "main", "commit": "f15a93907ddad3d9139aea465ae18336d87f5ce6" }, diff --git a/lsp/lua-language-server.lua b/lsp/lua-language-server.lua index 292cb54..cac9369 100644 --- a/lsp/lua-language-server.lua +++ b/lsp/lua-language-server.lua @@ -4,6 +4,9 @@ return { root_markers = { '.luarc.json', '.luarc.jsonc' }, settings = { Lua = { + format = { + enable = false, + }, runtime = { version = 'LuaJIT', }, diff --git a/lua/autocmds/lsp.lua b/lua/autocmds/lsp.lua index f01e9d5..c2528dc 100644 --- a/lua/autocmds/lsp.lua +++ b/lua/autocmds/lsp.lua @@ -6,6 +6,10 @@ vim.keymap.del('n', 'gri') vim.keymap.del('n', 'gO') vim.keymap.del('i', '') +local startswith = function(text, prefix) + return text:find(prefix, 1, true) == 1 +end + vim.api.nvim_create_autocmd('LspAttach', { callback = function(args) -- See: https://neovim.io/doc/user/lsp.html#lsp-defaults @@ -44,7 +48,7 @@ vim.api.nvim_create_autocmd('LspAttach', { end -- LSP Action: Formatting - if lsp_client:supports_method('textDocument/formatting') or lsp_client.name == 'otter-ls[1]' then + if lsp_client:supports_method('textDocument/formatting') or startswith(lsp_client.name, 'otter-ls') then vim.keymap.set( 'n', 'lf', @@ -75,7 +79,7 @@ vim.api.nvim_create_autocmd('LspAttach', { -- 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 + if lsp_client:supports_method('textDocument/inlayHint') and not startswith(lsp_client.name, 'otter-ls') then vim.lsp.inlay_hint.enable(true, { bufnr = buf }) vim.keymap.set( diff --git a/lua/plugins.lua b/lua/plugins.lua index 225d4f1..746302a 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,17 +1,17 @@ -- 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_repo = 'https://github.com/folke/lazy.nvim.git' +local lazy_tag = 'v11.16.2' -local lazy_path = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +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", + 'git', + 'clone', + '--filter=blob:none', lazy_repo, - "https://github.com/folke/lazy.nvim.git", - "--branch=" .. lazy_tag, + 'https://github.com/folke/lazy.nvim.git', + '--branch=' .. lazy_tag, lazy_path, }) end @@ -31,7 +31,7 @@ require('lazy').setup({ require('plugins/libs/nvim-nio'), --require('plugins/libs/nui'), --require('plugins/libs/nvim-notify'), - require('plugins/libs/image-nvim'), + --require('plugins/libs/image-nvim'), -- TODO: Some kind of image display library. -- Search: telescope (for now) @@ -75,7 +75,6 @@ require('lazy').setup({ require('plugins/ux/flatten'), -- Workflow - --require('plugins/workflow/neovim-project'), require('plugins/workflow/projections'), require('plugins/workflow/mini-files'), --require('plugins/workflow/git-dev'), @@ -92,11 +91,11 @@ require('lazy').setup({ 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/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'), + --require('plugins/langs/md_quarto/render-markdown-nvim'), -- Lang: Python --require('plugins/langs/python/f-string-toggle'), @@ -152,7 +151,6 @@ require('lazy').setup({ lazy = '💤 ', }, }, -}, { rocks = { hererocks = true, }, diff --git a/lua/plugins/editing/conform-nvim.lua b/lua/plugins/editing/conform-nvim.lua index ef65e78..44f6b78 100644 --- a/lua/plugins/editing/conform-nvim.lua +++ b/lua/plugins/editing/conform-nvim.lua @@ -1,17 +1,18 @@ return { 'stevearc/conform.nvim', - commit = "363243c03102a531a8203311d4f2ae704c620d9b", + commit = '363243c03102a531a8203311d4f2ae704c620d9b', lazy = true, - cmd = { "ConformInfo" }, + cmd = { 'ConformInfo' }, init = function() - vim.treesitter.language.register("markdown", { "quarto", "rmd" }) + vim.treesitter.language.register('markdown', { 'quarto', 'rmd' }) end, opts = { formatters_by_ft = { python = { 'ruff_format', 'ruff_organize_imports' }, + lua = { 'stylua' }, --python = { 'ruff_format' }, quarto = { 'injected' }, }, diff --git a/lua/plugins/editing/treesitter.lua b/lua/plugins/editing/treesitter.lua index 34ff110..fb6583b 100644 --- a/lua/plugins/editing/treesitter.lua +++ b/lua/plugins/editing/treesitter.lua @@ -18,30 +18,30 @@ return { }, }, - build = ':TSUpdate all', -- Update lang parsers unconditionally on build + 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", + '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") + require('lazy.core.loader').add_to_rtp(plugin) + require('nvim-treesitter.query_predicates') end, opts = { -- Grammer-Aware Syntax Highlighting highlight = { - enable = true + enable = true, }, -- Grammer-Aware Indentation @@ -54,193 +54,193 @@ return { lookahead = false, keymaps = { -- You can use the capture groups defined in textobjects.scm - ["af"] = { - query = "@function.outer", - desc = "Select [A]round [F]unction", + ['af'] = { + query = '@function.outer', + desc = 'Select [A]round [F]unction', }, - ["if"] = { - query = "@function.inner", - desc = "Select [I]nside [F]unction", + ['if'] = { + query = '@function.inner', + desc = 'Select [I]nside [F]unction', }, - ["al"] = { - query = "@class.outer", - desc = "Select [A]round C[L]ass", + ['al'] = { + query = '@class.outer', + desc = 'Select [A]round C[L]ass', }, - ["il"] = { - query = "@class.outer", - desc = "Select [I]nside C[L]ass", + ['il'] = { + query = '@class.outer', + desc = 'Select [I]nside C[L]ass', }, - ["ac"] = { - query = "@cell.outer", - desc = "Select [A]round [C]ell", + ['ac'] = { + query = '@cell.outer', + desc = 'Select [A]round [C]ell', }, - ["ic"] = { - query = "@cell.inner", - desc = "Select [I]nside [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", + '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) @@ -249,5 +249,16 @@ return { -- Use Treesitter as the Folding Method --vim.opt.foldmethod = "expr" --vim.opt.foldexpr = "nvim_treesitter#foldexpr()" + -- + require('vim.treesitter.query').set( + 'markdown', + 'highlights', + [[ + ;From MDeiml/tree-sitter-markdown + [ + (fenced_code_block_delimiter) + ] @punctuation.delimiter + ]] + ) end, } diff --git a/lua/plugins/langs/md_quarto/mdmath.lua b/lua/plugins/langs/md_quarto/mdmath.lua index abd417a..402e225 100644 --- a/lua/plugins/langs/md_quarto/mdmath.lua +++ b/lua/plugins/langs/md_quarto/mdmath.lua @@ -1,11 +1,8 @@ return { 'Thiago4532/mdmath.nvim', commit = '699acb27fd34bfdf92a43ce0abdd17f0c7a948fe', - opts = { - filetypes = { 'markdown', 'quarto' }, - dynamic = true, - dynamic_scale = 0.75, - }, + + enabled = not vim.g.neovide, cmd = { 'MdMath', @@ -29,4 +26,10 @@ return { desc = 'Disable [U]I [E]quations', }, }, + + opts = { + filetypes = { 'markdown', 'quarto' }, + dynamic = true, + dynamic_scale = 0.75, + }, } diff --git a/lua/plugins/langs/md_quarto/molten-nvim.lua b/lua/plugins/langs/md_quarto/molten-nvim.lua index 6330045..be1e182 100644 --- a/lua/plugins/langs/md_quarto/molten-nvim.lua +++ b/lua/plugins/langs/md_quarto/molten-nvim.lua @@ -61,7 +61,11 @@ return { init = function() -- Configuration - vim.g.molten_image_provider = "image.nvim" + if vim.g.neovide then + vim.g.molten_image_provider = "image.nvim" + else + vim.g.molten_image_provider = "none" + end vim.g.molten_output_win_max_height = 12 --vim.g.molten_auto_open_output = false vim.g.molten_auto_init_behavior = 'raise' diff --git a/lua/plugins/langs/md_quarto/quarto-nvim.lua b/lua/plugins/langs/md_quarto/quarto-nvim.lua index 3ed03c2..8ac4c7a 100644 --- a/lua/plugins/langs/md_quarto/quarto-nvim.lua +++ b/lua/plugins/langs/md_quarto/quarto-nvim.lua @@ -1,7 +1,7 @@ return { --"quarto-dev/quarto-nvim", dir = vim.env.HOME .. '/comps/neovim/quarto-nvim', - commit = "f98937b5be953b27757088e392ce6ccdb16898e5", + commit = "bfc191b2c9f973fd405e703bd0dfe11fb327a149", lazy = true, cmd = { diff --git a/lua/plugins/langs/md_quarto/render-markdown-nvim.lua b/lua/plugins/langs/md_quarto/render-markdown-nvim.lua index cea2e9a..c88cc25 100644 --- a/lua/plugins/langs/md_quarto/render-markdown-nvim.lua +++ b/lua/plugins/langs/md_quarto/render-markdown-nvim.lua @@ -2,6 +2,8 @@ return { 'MeanderingProgrammer/render-markdown.nvim', commit = '17a77463f945c4b9e4f371c752efd90e3e1bf604', + enabled = false, + ft = { 'markdown', 'quarto' }, opts = { diff --git a/lua/plugins/libs/image-nvim.lua b/lua/plugins/libs/image-nvim.lua index ddc0709..ddd0af9 100644 --- a/lua/plugins/libs/image-nvim.lua +++ b/lua/plugins/libs/image-nvim.lua @@ -1,9 +1,10 @@ return { "3rd/image.nvim", commit = "7704e1d03d952393774dc7d00a98d8e127086ba4", - --commit = "301de7919b2c0378cb7a782663f67abbcb198b17", lazy = false, + enabled = not vim.g.neovide, + cmd = { 'ImageReport', },