This aims to make project-specific keymappings for make targets trivial
by means of parsing them from comments affixed to make targets in your
Makefile.
There is also a telescope extension to run make targets from a picker.
Annotate your Makefile with comments containing nvim_map(...):
# nvim_map(l)
lint:
echo linting stuff...
test: # nvim_map(t)
echo running tests...
no_mapping: # this target doesn't get an automatic keymap
echo I am harder to run from neovimThen the following normal-mode keymaps are automatically created:
<leader>ml -> `make lint`
<leader>mt -> `make test`
use('olidacombe/makemapper')require("makemapper").setup()To register the makemapper telescope extension, load it as follows:
-- Make `:Telescope makemapper` available
require('telescope').load_extension('makemapper')You can override settings in setup:
require("makemapper").setup({
prefix = "<leader>m", -- the prefix applied to all keymaps generated from annotations
})which-key users may wish to add a description to the prefix:
require("which-key").add({
{ "<leader>m", group = "make" },
})- Document requirement for
maketreesitter parser to be installed - Document (and test thoroughly) the "deep Makefiles" feature
- Other configurable run strategies, not just terminal in a vertical split!
- Provide an option to change the annotation from
nvim_map(.*)to something user-defined. - Filter out "special" targets like
.PHONY - Try to support Windows?