A fork of icedman/nvim-textmate to work on Mac OS.
A textmate-based syntax highlighter to nvim - Uses VS code syntax themes/syntax extensions.
This plugin uses a native module and must first be compiled.
Note
If you use the lazy.nvim example below, this will all be done for you.
Warning
Run these commands in the installed location of your plugin.
For example with lazy.nvim as your plugin manager: ~/share/nvim/lazy/nvim-textmate-macos
Firstly, ensure you have python
, luajit
, cmake
& pkg-config
installed:
brew install luajit cmake pkg-config python
Next, make sure homebrew libraries are available to pkg-config:
export PKG_CONFIG_PATH="$(brew --prefix)"/lib/pkg-config:$PKG_CONFIG_PATH"
Now we're ready to build:
make
You can make sure the build output is in the right place with:
stat ./lua/nvim-textmate-macos/textmate.dylib
return {
"jakenvac/nvim-textmate-macos",
-- these are the default options
-- when using a different plugin manager use the setup function outlined below
opts = {
quick_load = false,
theme_name = "Monokai",
override_colorscheme = false,
debug_scopes = false,
custom_scope_map = nil,
extension_paths = {
"~/.vscode/extensions/",
"~/.editor/extensions/",
}
},
build = {
"brew install luajit cmake pkg-config",
'export PKG_CONFIG_PATH="$(brew --prefix)"/lib/pkg-config:$PKG_CONFIG_PATH',
"make"
"stat ./lua/nvim-textmate-macos/textmate.dylib"
},
-- It is recommended to only load for required file types due to potential slowdown
ft = {
"d2",
"lua"
}
}
require('nvim-textmate').setup({
quick_load = true,
-- ...
})
- quick_load - defers loading of grammar and theme at the opening of a buffer
- theme_name - select a textmate format or vscode compatible theme
- override_colorscheme - apply colorscheme from textmate theme
- custom_scope_map - add more scope to namespace mapping (see colormap.lua)
- extension_paths - set vscode extension search path
- debug_scopes - print scope name under cursor
Copy vscode theme and grammar extensions to any of these directories:
~/.config/nvim/lua/nvim-textmate/
~/.editor/extensions/
~/.vscode/extensions/
- TxMtEnable
- TxMtDisable
- TxMtToggle
- TxMtTheme
- TxMtDebugScopes
- a colorscheme must be loaded prior to running nvim-textmate
- cpp - Some grammars take a bit of time to load. cpp, the largest grammar file causes a visible lag on first load; hence the quick_load option is available.
- markdown - Other grammars - like markdown will load other grammar languages for inline code and will re-render after the other languages are loaded.
- scrolling and text editing - syntax highlighting is currently done at these events as a debounced (defer_fn) function.
- This plugin is just a proof of concept - from a novice lua coder, and much worse - from a non neovim user (not yet at least)