Skip to content

Neovim Config updates and testing

Continuing to migrate to Neovim 0.12 and AstroNvim version 6. There was a brief concern about nvim-treesitter repository being archived but it seems that project will become part of Neovim 0.13 release.

Continued my cycle training for the Dragon Ride in June. Designed some more routes to build up distance and hill climbing endurance.

Unfortunately an engineering manager role I applied for did not progress. The sub-text suggests they already had a candidate they wanted whilst I was being interviewed and although they liked my experience they decided to go with the other person. Its all useful experience and they seemed a good company.

Neovimλ︎

I was never quite happy with using Markdownlint as the rules were very strict. Overriding the rules added complexity to the Neovim configuration and there wasnt much information on how to make it simpler.

Whist I still have Markdownlint as part of the CI workflow, I've switched to Marksman. The Marksman tool doesnt have strict format rules and it does provide in-page anchor links as well as links to other files.

Configure none-lsλ︎

Running Neovim with the new null-ls.lua config generated errors.

[null-ls] failed to run generator: ...share/nvim-astro6/lazy/none-ls.nvim/lua/null-ls/loop.lua:165: command markdownlint is not executable (make sure it's installed and on your $PATH)

Seems I forgot to install markdown lint, but surely mason should have installed it. Time to check.

No, not installed by Mason. I need to explicitly add it via opts.sources, as shown in the AstroNvim v6 template.

When switching to AstroNvim 6 from the migration hack, I get the following issues

  Failed (2)
     AstroNvim 0.11ms  start
        fatal: couldn't find remote ref refs/heads/v6
    ○ mason-lspconfig.nvim  LspUninstall  LspInstall  User AstroFile
        error: pathspec '^2' did not match any file(s) known to git

Markdown toolsλ︎

Practicalli used Markdownlint tool to check the syntax and formmating of markdown files.

It is a comprehensive tool and is used with Megalinter in a GitHub CI workflow when pushing updates to a Practicalli website.

Many superfluous diagnostics where showing in each markdown file when using markdownlint with Neovim. I did create a custom markdownlint.jsonc file to minimise the feedback to only issues that I valued.

The custom configuration was added via null_ls, although the AstroNvim template has changed and ideally mason would be used to configure these tools.

I was refactoring the null_ls config for the AstroNvim v6, however, I realised that Marksman provided a more relevant tool for my needs.

This means I can drop the null_ls configuration from Practicalli nvim-astro.

Marksmanλ︎

Marksman helps adding links to markdown files. # at the start of a URL will list all the in-page anchor points.

Add a .markdown.toml file to a directory that defines the root of the markdown files, assuming the root of the markdown files is not the same as the version control config, e.g. .git directory.

For Zensical (or Material for MkDocs), add a docs/.marksman.toml file.

NOTE: Restart Neovim or the LSP server after adding the .marksman.toml file for it to take effect.

Treesitterλ︎

I have been writing many bash shell scripts for Practicalli Dotfiles - Debian Post Install scripts, so I've added a treesiter parser for bash.

Without a bash parser, then the following error is shown when opening a bash script in Neovim 0.12

   Error  10:22:24 msg_show.lua_error vim.schedule callback: vim/_core/editor.lua:0: nvim_exec2()[1]..BufReadPost Autocommands for "*": Vim(append):Lua callback: /tmp/.mount_nvimeoGDiI/usr/share/nvim/runtime/filetype.lua:28: nvim_exec2()[1]..BufReadPost Autocommands for "*"..FileType Autocommands for "*": Vim(append):Lua callback: ...GDiI/usr/share/nvim/runtime/lua/vim/treesitter/query.lua:373: No parser for language "bash"
stack traceback:
    [C]: in function 'assert'
    ...GDiI/usr/share/nvim/runtime/lua/vim/treesitter/query.lua:373: in function 'fn'
    ...meoGDiI/usr/share/nvim/runtime/lua/vim/func/_memoize.lua:82: in function 'fn'
    ...meoGDiI/usr/share/nvim/runtime/lua/vim/func/_memoize.lua:82: in function 'get'
    ...e/nvim-astro/lazy/astrocore/lua/astrocore/treesitter.lua:95: in function 'has_capture'
    ...e/nvim-astro/lazy/astrocore/lua/astrocore/treesitter.lua:236: in function 'enable'
    ...e/nvim-astro/lazy/astrocore/lua/astrocore/treesitter.lua:145: in function <...e/nvim-astro/lazy/astrocore/lua/astrocore/treesitter.lua:135>
    [C]: in function 'nvim_cmd'
    /tmp/.mount_nvimeoGDiI/usr/share/nvim/runtime/filetype.lua:28: in function </tmp/.mount_nvimeoGDiI/usr/share/nvim/runtime/filetype.lua:27>
    [C]: in function 'pcall'
    vim/_core/shared.lua: in function <vim/_core/shared.lua:0>
    [C]: in function '_with'
    /tmp/.mount_nvimeoGDiI/usr/share/nvim/runtime/filetype.lua:27: in function </tmp/.mount_nvimeoGDiI/usr/share/nvim/runtime/filetype.lua:10>
    [C]: in function 'nvim_exec2'
    vim/_core/editor.lua: in function 'cmd'
    ...vim-astro/lazy/snacks.nvim/lua/snacks/picker/actions.lua:139: in function 'jump'
    ...vim-astro/lazy/snacks.nvim/lua/snacks/picker/actions.lua:42: in function <...vim-astro/lazy/snacks.nvim/lua/snacks/picker/actions.lua:41>
stack traceback:
    [C]: in function '_with'
    /tmp/.mount_nvimeoGDiI/usr/share/nvim/runtime/filetype.lua:27: in function </tmp/.mount_nvimeoGDiI/usr/share/nvim/runtime/filetype.lua:10>
    [C]: in function 'nvim_exec2'
    vim/_core/editor.lua: in function 'cmd'
    ...vim-astro/lazy/snacks.nvim/lua/snacks/picker/actions.lua:139: in function 'jump'
    ...vim-astro/lazy/snacks.nvim/lua/snacks/picker/actions.lua:42: in function <...vim-astro/lazy/snacks.nvim/lua/snacks/picker/actions.lua:41>
stack traceback:
    [C]: in function 'nvim_exec2'
    vim/_core/editor.lua: in function 'cmd'
    ...vim-astro/lazy/snacks.nvim/lua/snacks/picker/actions.lua:139: in function 'jump'
    ...vim-astro/lazy/snacks.nvim/lua/snacks/picker/actions.lua:42: in function <...vim-astro/lazy/snacks.nvim/lua/snacks/picker/actions.lua:41>

The simplest way is to add the bash treesitter parser is via the AstroCommunity Bash Language Pack

lua/plugins/community.lua
  -- Packs (code-runner, treesitter, lsp & lint/format support)
  { import = "astrocommunity.pack.bash" },
  { import = "astrocommunity.pack.clojure" },
  { import = "astrocommunity.pack.markdown" },
  { import = "astrocommunity.pack.json" },
  { import = "astrocommunity.pack.lua" },
  -- ----------------------------------------------

The bash plugin pack includes:

  • bash Treesitter parser
  • bashls language server
  • shfmt formatter
  • shellcheck linter
  • bash debugger

⚠ Also attaches to zsh files with experimental support.


Thank you.

🌐 Practical.li Website

Practical.li GitHub Org practicalli-johnny profile

@practicalli@clj.social