Skip to content

feat(other): toggle between clojure src and test files #21

@practicalli-johnny

Description

@practicalli-johnny

Use rgroli/other plugin with custom config to switch between files under the src and test trees

Add Clojure configuration for 'other', share by dominicm on Clojurians Slack.

{
    "rgroli/other.nvim",
    main = "other-nvim",
    opts = {
      mappings = {
        {
          context = "test",
          pattern = function(path)
            local match = vim.fn.matchlist(path, '\\v^(.*)/src/(.{-}_test)@!(.{-}).clj(.?)')
            if #match > 0 then
              return match
            end
          end,
          target = "%2/test/%4_test.clj%5"
        },
        {
          context = "implementation",
          pattern = "(.*)/test/(.*)_test.clj(.?)$",
          target = "%1/src/%2.clj%3",
        },
      },
    },
  },

Tasks

  • Check Astrocommunity for other plugin - not included
  • Package rgroli/other.nvim for Astrocommunity #24
  • Add localleader key binding to toggle current file (and any other key bindings that are useful
  • Add clojure specific menu (although this can be used for many other languages

Key map suggestions

  • localleader t s to switch buffer, localleader t S create split
  • leader l o sub-menu containing all :Other commands
  • AstroNvim find menu ? leader f i or as sub-menu
  • look at key map for 'project' style plugins, e.g. leader P o sub-menu with a as shortcut (alternate) - matches Emacs projectile

Metadata

Metadata

Labels

No labels
No labels

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions