Update markdown highlighting for tree-sitter
diff --git a/modules/neovim/tree-sitter/default.nix b/modules/neovim/tree-sitter/default.nix
index d7d7f2e..b6d3a41 100644
--- a/modules/neovim/tree-sitter/default.nix
+++ b/modules/neovim/tree-sitter/default.nix
@@ -10,6 +10,7 @@
];
in
{
+ home.file.".config/nvim/after/queries/markdown/highlights.scm".source = ./highlights.scm;
programs.neovim = {
plugins = with pkgs.vimPlugins; [
(nvim-treesitter.withPlugins (plugins:
@@ -24,12 +25,14 @@
])
++ (with pkgs.vimPlugins; [
nvim-ts-rainbow
+ nvim-ts-context-commentstring
nixpkgs-minion.legacyPackages.${system}.tree-sitter-grammars.tree-sitter-astro
])))
nvim-treesitter-context
+ playground
];
extraConfig = ''
source ${./setup.lua}
- '';
+ '' + builtins.readFile ./highlights.vim;
};
}
diff --git a/modules/neovim/tree-sitter/highlights.scm b/modules/neovim/tree-sitter/highlights.scm
new file mode 100644
index 0000000..a5abd85
--- /dev/null
+++ b/modules/neovim/tree-sitter/highlights.scm
@@ -0,0 +1,27 @@
+;; extends
+
+[
+ (atx_h1_marker)
+ (atx_h2_marker)
+ (atx_h3_marker)
+ (atx_h4_marker)
+ (atx_h5_marker)
+ (atx_h6_marker)
+ (setext_h1_underline)
+ (setext_h2_underline)
+] @punctuation.special.header
+
+[
+ (list_marker_plus)
+ (list_marker_minus)
+ (list_marker_star)
+ (list_marker_dot)
+ (list_marker_parenthesis)
+] @punctuation.special.list
+
+(thematic_break) @punctuation.special.thematic_break
+
+[
+ (block_continuation)
+ (block_quote_marker)
+] @punctuation.special.block_quote
diff --git a/modules/neovim/tree-sitter/highlights.vim b/modules/neovim/tree-sitter/highlights.vim
new file mode 100644
index 0000000..958ae9a
--- /dev/null
+++ b/modules/neovim/tree-sitter/highlights.vim
@@ -0,0 +1,22 @@
+call g:Highlight("TreesitterContext", g:statusline, g:transparent)
+
+au ColorScheme onehalfdark hi! link @text.title Title
+
+call g:Highlight("@text.literal", g:purple, g:transparent)
+
+au ColorScheme onehalfdark hi! link @punctuation.delimiter @comment
+
+call g:Highlight("@text.uri", g:blue, g:transparent)
+
+au ColorScheme onehalfdark hi @text.reference cterm=italic gui=italic
+
+au ColorScheme onehalfdark hi! link @string.escape @text.reference
+
+call g:Highlight("@punctuation.special", g:lightgrey, g:transparent)
+call g:Highlight("@punctuation.special.list", g:red, g:transparent)
+call g:Highlight("@punctuation.special.header", g:lightgrey, g:transparent)
+call g:Highlight("@punctuation.special.thematic_break", g:red, g:transparent)
+call g:Highlight("@string.escape", g:transparent, g:lightgrey)
+
+au ColorScheme onehalfdark hi! @text.strong cterm=bold gui=bold
+au ColorScheme onehalfdark hi! @text.emphasis cterm=italic gui=italic
diff --git a/modules/neovim/tree-sitter/setup.lua b/modules/neovim/tree-sitter/setup.lua
index 1b5efbe..85cd84e 100644
--- a/modules/neovim/tree-sitter/setup.lua
+++ b/modules/neovim/tree-sitter/setup.lua
@@ -2,7 +2,7 @@
highlight = {
enable = true,
additional_vim_regex_highlighting = {'org'},
- disable = {'sql', 'markdown'},
+ disable = {'sql', 'lua', 'sh', 'bash'},
},
rainbow = {
enable = true,
@@ -34,17 +34,35 @@
scope_incremental = "grc",
node_decremental = "grm",
},
- disable = {'sql', 'markdown'},
+ disable = {'sql'},
},
indent = {
enable = true,
- disable = {'sql', 'markdown'},
+ disable = {'sql'},
+ },
+ context_commentstring = {
+ enable = true
+ },
+ playground = {
+ enable = true,
+ keybindings = {
+ toggle_query_editor = 'o',
+ toggle_hl_groups = 'i',
+ toggle_injected_languages = 't',
+ toggle_anonymous_nodes = 'a',
+ toggle_language_display = 'I',
+ focus_language = 'f',
+ unfocus_language = 'F',
+ update = 'R',
+ goto_node = '<cr>',
+ show_help = '?',
+ },
},
}
require('treesitter-context').setup{
enable = true,
- disable = {'sql', 'markdown'},
+ disable = {'sql'},
trim_scope = 'outer',
patterns = {
default = {
@@ -60,5 +78,3 @@
},
mode = 'topline'
}
-
-vim.cmd[[hi! TreesitterContext guibg=#313640 ctermbg=237]]