Vim's map side (lhs and rhs) grammar for tree-sitter
Project description
tree-sitter-vim-map-side
Vim's map side (lhs and rhs)
grammar for tree-sitter.
Primaryly intended to be used within lua, but also supports vim mappings
with rhs that starts with : (not supported at the moment).
[!IMPORTANT] ABI version:
15
Supported rhs expressions
printf()variable-scope:g:,l:,v:
[!NOTE] More expressions will be supported in the future if requested.
Parser requirements
lua: injection tolshandrhsof keymap functions of neovimprintf(optional): injection to first argument ofprintf()expression.vim(optional): injection torhswhen it starts with:and tocommandnodes of this grammar.
Usage in Editors
Neovim
- vim-map-side.nvim: plugin
that integrates this grammar to your
Neovimconfiguration.
Helix
WIP
Emacs
WIP
Injections
[!NOTE] If you are using Neovim, you can use
lua-match?andnot-lua-match?predicates instead ofmatch?andnot-match?. Be sure to use%sinstead of\sand%Sinstead of\Sin the regexes.
lua parser
For vim.keymap.set(), vim.api.nvim_set_keymap() and
vim.api.nvim_buf_set_keymap() functions of neovim:
; NOTE: for lhs and rhs
(function_call
name: (_) @_fn
arguments: [
; format-ignore
(arguments
. (_) ; -- mode --
.
(string
(string_content) @injection.content))
; format-ignore
(arguments
. (_) ; -- mode --
. (_) ; -- lhs --
(string
(string_content) @injection.content))
]
(#any-of? @_fn "vim.keymap.set" "vim.api.nvim_set_keymap")
(#match? @injection.content "<\S+>")
(#set! injection.language "vim_map_side"))
(function_call
name: (_) @_fn
arguments: [
; format-ignore
(arguments
. (_) ; -- buffer --
. (_) ; -- mode --
.
(string
(string_content) @injeciton.content))
; format-ignore
(arguments
. (_) ; -- buffer --
. (_) ; -- mode --
. (_) ; -- lhs --
.
(string
(string_content) @injeciton.content))
]
(#eq? @_fn "vim.api.nvim_buf_set_keymap")
(#match? @injeciton.content "<\S+>")
(#set! injection.language "vim_map_side"))
; NOTE: for expressions as rhs
(function_call
name: (_) @_fn
; format-ignore
arguments: (arguments
. (_) ; -- mode --
. (_) ; -- lhs --
.
(string
(string_content) @injection.content)
.
(table_constructor) @_options)
(#any-of? @_fn "vim.keymap.set" "vim.api.nvim_set_keymap")
; NOTE: to avoid double injection
(#not-match? @injection.content "<\S+>")
(#match? @_options "expr\s*=\s*true")
(#set! injection.language "vim_map_side"))
(function_call
name: (_) @_fn
; format-ignore
arguments: (arguments
. (_) ; -- buffer --
. (_) ; -- mode --
. (_) ; -- lhs --
.
(string
(string_content) @injection.content)
.
(table_constructor) @_options)
(#eq? @_fn "vim.api.nvim_buf_set_keymap")
; NOTE: to avoid double injection
(#not-match? @injection.content "<\S+>")
(#match? @_options "expr\s*=\s*true")
(#set! injection.language "vim_map_side"))
vim parser
(map_statement
rhs: (map_side) @injection.content
(#match? @injection.content "^:")
(#set! injection.include-children)
(#set! injection.language "vim_map_side"))
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tree_sitter_vim_map_side-0.1.3.tar.gz.
File metadata
- Download URL: tree_sitter_vim_map_side-0.1.3.tar.gz
- Upload date:
- Size: 17.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eaf7bb91db78b2ff73950809c471f2bdc28762b3d6d6c1f73c0c8bfcbc58e828
|
|
| MD5 |
797f0713cf1a4773f68be0d3e7b375fc
|
|
| BLAKE2b-256 |
101345bda6f7fd6d4867f40f158cc7ba3b49f1b08411b452716a5913f0fea5bf
|
File details
Details for the file tree_sitter_vim_map_side-0.1.3-cp310-abi3-win_arm64.whl.
File metadata
- Download URL: tree_sitter_vim_map_side-0.1.3-cp310-abi3-win_arm64.whl
- Upload date:
- Size: 14.1 kB
- Tags: CPython 3.10+, Windows ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0dc94093ac06ffa42e9844a297ca382f245ce7e827f0b4b040c151bc6ccaeda2
|
|
| MD5 |
a808f89241b4df847ccaa6ace8f5c333
|
|
| BLAKE2b-256 |
bc100e2cf7141540532c78afa16551523ecde48e9affa077faaf722954af66a0
|
File details
Details for the file tree_sitter_vim_map_side-0.1.3-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: tree_sitter_vim_map_side-0.1.3-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 15.2 kB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1381a1b4b4630d5394ad83e8c2d48db83acd45e932ba7fbab2238837f2097f3c
|
|
| MD5 |
d4ec68d692111742ceb0d3c20ea59022
|
|
| BLAKE2b-256 |
7b01d424895938c5c2789cd06125bacfe93a8e972d476f03b0e70f3b6852963a
|
File details
Details for the file tree_sitter_vim_map_side-0.1.3-cp310-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: tree_sitter_vim_map_side-0.1.3-cp310-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 22.4 kB
- Tags: CPython 3.10+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8445b089cbfd65289db20b8a2692b995c5b54d551911ac22f6e255c45e9940f
|
|
| MD5 |
47d4a17605bd084f4329079994a9d3a5
|
|
| BLAKE2b-256 |
d3c1e2b94900d356e751d0323f1e27e872dcac2d7250317c581cd67a0e9e4fbc
|
File details
Details for the file tree_sitter_vim_map_side-0.1.3-cp310-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: tree_sitter_vim_map_side-0.1.3-cp310-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 22.6 kB
- Tags: CPython 3.10+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0ba70d10b3e65d2f52ec5766ab73530b789c1ff5455dc8250dab71d58fd6d14
|
|
| MD5 |
b9b865c00d8ab5f4b7649a8e816c950d
|
|
| BLAKE2b-256 |
27fb76d8d3194694525c9f4da7d05c168a7dfdbb9e0dbf5677f49887075a161f
|
File details
Details for the file tree_sitter_vim_map_side-0.1.3-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: tree_sitter_vim_map_side-0.1.3-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 23.4 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b07eeb17588adfb37be9ebbea736347b2ea7e3c9eebb82516b338c8ea14903e0
|
|
| MD5 |
ae773906bc2a367707e4ca33ef0ff1c2
|
|
| BLAKE2b-256 |
c039d322f136031364aa51370f297bc703fd1d1235ce4a999a3e6bd8d5ddf4c3
|
File details
Details for the file tree_sitter_vim_map_side-0.1.3-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.
File metadata
- Download URL: tree_sitter_vim_map_side-0.1.3-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
- Upload date:
- Size: 22.6 kB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcbc31eee809f8c23b75b79365d8f95d4b46f41fd01dda65369f7a9f84db9583
|
|
| MD5 |
2797b0ea109aad3f7067ebbe94c4ee65
|
|
| BLAKE2b-256 |
975fdaf33b972ba5dcfb09e2d01f275b58876933f4d083be2f45075fa1517171
|
File details
Details for the file tree_sitter_vim_map_side-0.1.3-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: tree_sitter_vim_map_side-0.1.3-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 13.2 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a320915a5f592814a68c70a8b38ae921ee931df4a7a9179a7288f0de9e405fb
|
|
| MD5 |
0914aa836181514a9100b0c6b090d70c
|
|
| BLAKE2b-256 |
7becb54f4964da41bd677ac44e8b3212e8cb5d2ac5e467a5c8386f019dd9c5ca
|
File details
Details for the file tree_sitter_vim_map_side-0.1.3-cp310-abi3-macosx_10_9_x86_64.whl.
File metadata
- Download URL: tree_sitter_vim_map_side-0.1.3-cp310-abi3-macosx_10_9_x86_64.whl
- Upload date:
- Size: 12.8 kB
- Tags: CPython 3.10+, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1d53150935d9b94b48f6c3785b216ef0d675b21dd3b864e5676769b26c38f0d
|
|
| MD5 |
ef49a829b181e35e58237e7f8cb4f266
|
|
| BLAKE2b-256 |
879583926068c932d66b6e615cb4f6b0bf07875ddd12ecbc7122d27025b144a5
|