highlighting for python string annotations
This commit is contained in:
+14
-14
@@ -58,20 +58,20 @@ map("n", [[<Leader>\]], ":" .. term_command .. "<CR>")
|
|||||||
map("n", [[<Leader>|]], ":v" .. term_command .. "<CR>")
|
map("n", [[<Leader>|]], ":v" .. term_command .. "<CR>")
|
||||||
|
|
||||||
-- line-break movement
|
-- line-break movement
|
||||||
silent_map("n", "<Up>", "gk")
|
--silent_map("n", "<Up>", "gk")
|
||||||
silent_map("n", "<Down>", "gj")
|
--silent_map("n", "<Down>", "gj")
|
||||||
silent_map("n", "<Home>", "g<Home>")
|
--silent_map("n", "<Home>", "g<Home>")
|
||||||
silent_map("n", "<End>", "g<End>")
|
--silent_map("n", "<End>", "g<End>")
|
||||||
|
--
|
||||||
silent_map("v", "<Up>", "gk")
|
--silent_map("v", "<Up>", "gk")
|
||||||
silent_map("v", "<Down>", "gj")
|
--silent_map("v", "<Down>", "gj")
|
||||||
silent_map("v", "<Home>", "g<Home>")
|
--silent_map("v", "<Home>", "g<Home>")
|
||||||
silent_map("v", "<End>", "g<End>")
|
--silent_map("v", "<End>", "g<End>")
|
||||||
|
--
|
||||||
silent_map("i", "<Up>", "<C-o>gk")
|
--silent_map("i", "<Up>", "<C-o>gk")
|
||||||
silent_map("i", "<Down>", "<C-o>gj")
|
--silent_map("i", "<Down>", "<C-o>gj")
|
||||||
silent_map("i", "<Home>", "<C-o>g<Home>")
|
--silent_map("i", "<Home>", "<C-o>g<Home>")
|
||||||
silent_map("i", "<End>", "<C-o>g<End>")
|
--silent_map("i", "<End>", "<C-o>g<End>")
|
||||||
|
|
||||||
-- half page movement
|
-- half page movement
|
||||||
--silent_map("n", "<PageDown>", "M<C-d>")
|
--silent_map("n", "<PageDown>", "M<C-d>")
|
||||||
|
|||||||
+22
-7
@@ -230,18 +230,29 @@ function M.nvim_treesitter()
|
|||||||
local htmldjango_path = "/home/guy/code/treesitter/tree-sitter-htmldjango-myown"
|
local htmldjango_path = "/home/guy/code/treesitter/tree-sitter-htmldjango-myown"
|
||||||
|
|
||||||
if vim.fn.filereadable(htmldjango_path .. "/src/parser.c") then
|
if vim.fn.filereadable(htmldjango_path .. "/src/parser.c") then
|
||||||
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
|
-- old
|
||||||
parser_config.htmldjango = {
|
--local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
|
||||||
|
--parser_config.htmldjango = {
|
||||||
|
-- install_info = {
|
||||||
|
-- url = htmldjango_path,
|
||||||
|
-- files = { "src/parser.c" },
|
||||||
|
-- requires_generate_from_grammar = true,
|
||||||
|
-- },
|
||||||
|
-- filetype = "html",
|
||||||
|
--}
|
||||||
|
--local ft_to_parser = require("nvim-treesitter.parsers").filetype_to_parsername
|
||||||
|
--ft_to_parser.html = "htmldjango"
|
||||||
|
|
||||||
|
-- new
|
||||||
|
vim.treesitter.language.add("htmldjango", {
|
||||||
install_info = {
|
install_info = {
|
||||||
url = htmldjango_path,
|
url = htmldjango_path,
|
||||||
files = { "src/parser.c" },
|
files = { "src/parser.c" },
|
||||||
requires_generate_from_grammar = true,
|
requires_generate_from_grammar = true,
|
||||||
},
|
},
|
||||||
filetype = "html",
|
filetype = "html",
|
||||||
}
|
})
|
||||||
|
vim.treesitter.language.register("htmldjango", "html")
|
||||||
local ft_to_parser = require("nvim-treesitter.parsers").filetype_to_parsername
|
|
||||||
ft_to_parser.html = "htmldjango"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -380,7 +391,6 @@ function M.null_ls()
|
|||||||
-- ORDER IN TABLE DETERMINES EXECUTION ORDER
|
-- ORDER IN TABLE DETERMINES EXECUTION ORDER
|
||||||
local sources = {
|
local sources = {
|
||||||
-- python
|
-- python
|
||||||
null_ls.builtins.diagnostics.mypy,
|
|
||||||
null_ls.builtins.diagnostics.ruff,
|
null_ls.builtins.diagnostics.ruff,
|
||||||
null_ls.builtins.formatting.black,
|
null_ls.builtins.formatting.black,
|
||||||
null_ls.builtins.formatting.ruff.with({
|
null_ls.builtins.formatting.ruff.with({
|
||||||
@@ -389,6 +399,7 @@ function M.null_ls()
|
|||||||
--null_ls.builtins.formatting.isort,
|
--null_ls.builtins.formatting.isort,
|
||||||
--null_ls.builtins.diagnostics.flake8,
|
--null_ls.builtins.diagnostics.flake8,
|
||||||
--null_ls.builtins.diagnostics.djlint,
|
--null_ls.builtins.diagnostics.djlint,
|
||||||
|
--null_ls.builtins.diagnostics.mypy,
|
||||||
|
|
||||||
-- js
|
-- js
|
||||||
null_ls.builtins.diagnostics.eslint,
|
null_ls.builtins.diagnostics.eslint,
|
||||||
@@ -482,6 +493,10 @@ function M.lsp_zero()
|
|||||||
local lsp = require("lsp-zero")
|
local lsp = require("lsp-zero")
|
||||||
lsp.preset("recommended")
|
lsp.preset("recommended")
|
||||||
|
|
||||||
|
lsp.configure("pyright", {
|
||||||
|
root_dir = lsp_config_defaults().root_dir,
|
||||||
|
})
|
||||||
|
|
||||||
-- (Optional) Configure lua language server for neovim
|
-- (Optional) Configure lua language server for neovim
|
||||||
lsp.nvim_workspace()
|
lsp.nvim_workspace()
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
(type (string (string_content) @python))
|
||||||
|
|
||||||
|
((assignment
|
||||||
|
(type (identifier) @_type)
|
||||||
|
(string (string_content) @python))
|
||||||
|
(#eq? @_type "TypeAlias"))
|
||||||
|
|
||||||
|
((assignment
|
||||||
|
(type (string (string_content) @_type))
|
||||||
|
(string (string_content) @python))
|
||||||
|
(#eq? @_type "TypeAlias"))
|
||||||
Reference in New Issue
Block a user