htmldjango highlight changes, ruff args, lsp zero config
This commit is contained in:
+1
-1
@@ -126,7 +126,7 @@ opt.mouse = ""
|
||||
vim.cmd([[hi CursorLine cterm=NONE ctermbg=darkgray ctermfg=white]])
|
||||
vim.cmd([[au BufRead,BufNewFile .env.* set filetype=sh]])
|
||||
vim.cmd([[au BufRead,BufNewFile Dockerfile.* set filetype=dockerfile]])
|
||||
--vim.cmd([[au BufRead,BufNewFile *.html set filetype=html]])
|
||||
vim.cmd([[au BufRead,BufNewFile *.html set filetype=html]])
|
||||
|
||||
-- redo folds on write
|
||||
vim.cmd([[au BufWrite * normal zx]])
|
||||
|
||||
+40
-15
@@ -213,7 +213,7 @@ function M.nvim_treesitter()
|
||||
disable = function(lang, bufnr)
|
||||
return highlight_disable[lang] or too_many_lines(bufnr)
|
||||
end,
|
||||
additional_vim_regex_highlighting = { "htmldjango" },
|
||||
--additional_vim_regex_highlighting = { "htmldjango", "html" },
|
||||
},
|
||||
rainbow = {
|
||||
enable = true,
|
||||
@@ -224,7 +224,7 @@ function M.nvim_treesitter()
|
||||
max_file_lines = nil,
|
||||
},
|
||||
indent = {
|
||||
enable = false,
|
||||
enable = true,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -240,15 +240,15 @@ function M.nvim_treesitter()
|
||||
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
|
||||
parser_config.htmldjango = {
|
||||
install_info = {
|
||||
url = htmldjango_path, -- local path or git repo
|
||||
url = htmldjango_path,
|
||||
files = { "src/parser.c" },
|
||||
-- optional entries:
|
||||
--branch = "paired-tags", -- default branch in case of git repo if different from master
|
||||
--generate_requires_npm = false, -- if stand-alone parser without npm dependencies
|
||||
requires_generate_from_grammar = true, -- if folder contains pre-generated src/parser.c
|
||||
requires_generate_from_grammar = true,
|
||||
},
|
||||
filetype = "html", -- if filetype does not match the parser name
|
||||
filetype = "html",
|
||||
}
|
||||
|
||||
local ft_to_parser = require("nvim-treesitter.parsers").filetype_to_parsername
|
||||
ft_to_parser.html = "htmldjango"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -258,6 +258,15 @@ function M.nvim_lspconfig()
|
||||
signs = true,
|
||||
update_in_insert = false,
|
||||
})
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
lspconfig.tailwindcss.setup({
|
||||
init_options = {
|
||||
userLanguages = {
|
||||
htmldjango = "html",
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
function M.nvim_lsp_installer()
|
||||
@@ -378,12 +387,14 @@ function M.null_ls()
|
||||
-- ORDER IN TABLE DETERMINES EXECUTION ORDER
|
||||
local sources = {
|
||||
-- python
|
||||
--null_ls.builtins.diagnostics.flake8,
|
||||
null_ls.builtins.diagnostics.mypy,
|
||||
null_ls.builtins.diagnostics.ruff,
|
||||
null_ls.builtins.formatting.black,
|
||||
null_ls.builtins.formatting.ruff,
|
||||
null_ls.builtins.formatting.ruff.with({
|
||||
extra_args = { "--extend-select", "I001", "--unfixable", "F841,F842,F401" },
|
||||
}),
|
||||
--null_ls.builtins.formatting.isort,
|
||||
--null_ls.builtins.diagnostics.flake8,
|
||||
--null_ls.builtins.diagnostics.djlint,
|
||||
|
||||
-- js
|
||||
@@ -392,12 +403,15 @@ function M.null_ls()
|
||||
null_ls.builtins.formatting.prettier.with({
|
||||
extra_filetypes = { "svelte" },
|
||||
}),
|
||||
|
||||
-- lua
|
||||
null_ls.builtins.formatting.stylua,
|
||||
|
||||
-- bash
|
||||
null_ls.builtins.formatting.shfmt,
|
||||
null_ls.builtins.diagnostics.shellcheck,
|
||||
null_ls.builtins.code_actions.shellcheck,
|
||||
|
||||
-- cpp
|
||||
null_ls.builtins.formatting.clang_format,
|
||||
}
|
||||
@@ -405,15 +419,11 @@ function M.null_ls()
|
||||
sources = sources,
|
||||
on_attach = config.on_attach,
|
||||
root_dir = config.root_dir,
|
||||
-- removed error "warning: multiple different client offset_encodings detected for buffer, this is not supported yet"
|
||||
--on_init = function(client, _)
|
||||
-- client.offset_encoding = "utf-32"
|
||||
--end,
|
||||
})
|
||||
end
|
||||
|
||||
function M.nvim_autopairs()
|
||||
require("nvim-autopairs").setup({ check_ts = true })
|
||||
require("nvim-autopairs").setup({ check_ts = false, enable_moveright = false })
|
||||
end
|
||||
|
||||
function M.nvim_cmp()
|
||||
@@ -471,4 +481,19 @@ function M.gitsigns()
|
||||
require("gitsigns").setup()
|
||||
end
|
||||
|
||||
function M.lsp_zero()
|
||||
--
|
||||
-- https://github.com/VonHeikemen/lsp-zero.nvim
|
||||
--
|
||||
-- Learn the keybindings, see :help lsp-zero-keybindings
|
||||
-- Learn to configure LSP servers, see :help lsp-zero-api-showcase
|
||||
local lsp = require("lsp-zero")
|
||||
lsp.preset("recommended")
|
||||
|
||||
-- (Optional) Configure lua language server for neovim
|
||||
lsp.nvim_workspace()
|
||||
|
||||
lsp.setup()
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@@ -10,14 +10,15 @@ config.harpoon()
|
||||
config.hop()
|
||||
config.indent_blankline()
|
||||
config.lualine()
|
||||
config.null_ls()
|
||||
config.nvim_autopairs()
|
||||
config.nvim_cmp()
|
||||
--config.nvim_cmp()
|
||||
config.nvim_fzf()
|
||||
config.nvim_lsp_installer()
|
||||
config.nvim_lspconfig()
|
||||
--config.nvim_lsp_installer()
|
||||
config.nvim_treesitter()
|
||||
--config.onedark()
|
||||
config.rnvimr()
|
||||
config.tokyonight()
|
||||
config.gitsigns()
|
||||
--config.nvim_lspconfig()
|
||||
config.lsp_zero()
|
||||
config.null_ls()
|
||||
|
||||
+33
-9
@@ -17,6 +17,7 @@ require("packer").startup(function(use)
|
||||
|
||||
-- SESSION
|
||||
use("ThePrimeagen/harpoon")
|
||||
use("nvim-lua/plenary.nvim")
|
||||
use("rmagatti/auto-session")
|
||||
use("mbbill/undotree")
|
||||
|
||||
@@ -33,8 +34,8 @@ require("packer").startup(function(use)
|
||||
})
|
||||
|
||||
-- SNIPPETS
|
||||
use("SirVer/ultisnips")
|
||||
use("honza/vim-snippets")
|
||||
--use("SirVer/ultisnips")
|
||||
--use("honza/vim-snippets")
|
||||
--use("L3MON4D3/LuaSnip") -- Snippets plugin
|
||||
|
||||
-- LSP
|
||||
@@ -45,17 +46,40 @@ require("packer").startup(function(use)
|
||||
})
|
||||
use("nvim-treesitter/nvim-treesitter-context")
|
||||
use("nvim-treesitter/playground")
|
||||
use("neovim/nvim-lspconfig")
|
||||
use("williamboman/nvim-lsp-installer")
|
||||
use("nvim-lua/plenary.nvim")
|
||||
use("jose-elias-alvarez/nvim-lsp-ts-utils")
|
||||
use("jose-elias-alvarez/null-ls.nvim")
|
||||
use("windwp/nvim-autopairs")
|
||||
|
||||
--use("neovim/nvim-lspconfig")
|
||||
--use("williamboman/nvim-lsp-installer")
|
||||
--use("jose-elias-alvarez/nvim-lsp-ts-utils")
|
||||
--use({
|
||||
-- "hrsh7th/cmp-nvim-lsp",
|
||||
-- requires = "quangnguyen30192/cmp-nvim-ultisnips",
|
||||
--})
|
||||
--use("hrsh7th/nvim-cmp")
|
||||
|
||||
use({
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
requires = "quangnguyen30192/cmp-nvim-ultisnips",
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
branch = "v1.x",
|
||||
requires = {
|
||||
-- LSP Support
|
||||
{ "neovim/nvim-lspconfig" }, -- Required
|
||||
{ "williamboman/mason.nvim" }, -- Optional
|
||||
{ "williamboman/mason-lspconfig.nvim" }, -- Optional
|
||||
|
||||
-- Autocompletion
|
||||
{ "hrsh7th/nvim-cmp" }, -- Required
|
||||
{ "hrsh7th/cmp-nvim-lsp" }, -- Required
|
||||
{ "hrsh7th/cmp-buffer" }, -- Optional
|
||||
{ "hrsh7th/cmp-path" }, -- Optional
|
||||
{ "saadparwaiz1/cmp_luasnip" }, -- Optional
|
||||
{ "hrsh7th/cmp-nvim-lua" }, -- Optional
|
||||
|
||||
-- Snippets
|
||||
{ "L3MON4D3/LuaSnip" }, -- Required
|
||||
{ "rafamadriz/friendly-snippets" }, -- Optional
|
||||
},
|
||||
})
|
||||
use("hrsh7th/nvim-cmp")
|
||||
|
||||
-- JS
|
||||
use("HerringtonDarkholme/yats.vim")
|
||||
|
||||
@@ -3,77 +3,16 @@
|
||||
|
||||
;[
|
||||
; "<"
|
||||
; "/>"
|
||||
; ">"
|
||||
; "</"
|
||||
; "/>"
|
||||
;] @punctuation.bracket
|
||||
;] @constant
|
||||
|
||||
(doctype) @comment
|
||||
|
||||
((tag_name) @type (#match? @type "^(head|body)$"))
|
||||
|
||||
((tag_name) @comment (#eq? @comment "html"))
|
||||
|
||||
;(element (start_tag ((tag_name) @function) (#eq? @function "template")))
|
||||
;(element (end_tag ((tag_name) @function) (#eq? @function "template")))
|
||||
|
||||
;(attribute_name) @constant
|
||||
|
||||
;(element
|
||||
; (start_tag
|
||||
; ((tag_name) @function)
|
||||
; (attribute (attribute_name) @_alpine))
|
||||
; (#lua-match? @_alpine "^[@:]%l+.-$"))
|
||||
;
|
||||
;(element
|
||||
; (start_tag
|
||||
; (attribute (attribute_name) @_alpine))
|
||||
; (end_tag ((tag_name) @function))
|
||||
; (#lua-match? @_alpine "^[@:]%l+.-$"))
|
||||
;
|
||||
;(element
|
||||
; (start_tag
|
||||
; ((tag_name) @function)
|
||||
; (attribute (attribute_name) @_alpine))
|
||||
; (#lua-match? @_alpine "^x[-]%l+$"))
|
||||
;
|
||||
;(element
|
||||
; (start_tag
|
||||
; (attribute (attribute_name) @_alpine))
|
||||
; (end_tag ((tag_name) @function))
|
||||
; (#lua-match? @_alpine "^x[-]%l+$"))
|
||||
;
|
||||
;(element
|
||||
; (self_closing_tag
|
||||
; ((tag_name) @function)
|
||||
; (attribute (attribute_name) @_alpine))
|
||||
; (#lua-match? @_alpine "^[@:]%l+.-$"))
|
||||
;
|
||||
;(element
|
||||
; (self_closing_tag
|
||||
; ((tag_name) @function)
|
||||
; (attribute (attribute_name) @_alpine))
|
||||
; (#lua-match? @_alpine "^x[-]%l+$"))
|
||||
;
|
||||
;(element
|
||||
; (start_tag
|
||||
; (attribute (attribute_name) @parameter))
|
||||
; (#lua-match? @parameter "^[@:]%l+.-$"))
|
||||
;
|
||||
;(element
|
||||
; (start_tag
|
||||
; (attribute (attribute_name) @parameter))
|
||||
; (#lua-match? @parameter "^x[-]%l+$"))
|
||||
;
|
||||
;(element
|
||||
; (self_closing_tag
|
||||
; (attribute (attribute_name) @parameter))
|
||||
; (#lua-match? @parameter "^[@:]%l+.-$"))
|
||||
;
|
||||
;(element
|
||||
; (self_closing_tag
|
||||
; (attribute (attribute_name) @parameter))
|
||||
; (#lua-match? @parameter "^x[-]%l+$"))
|
||||
((attribute_name) @parameter
|
||||
(#lua-match? @parameter "^up[-]%l+$"))
|
||||
|
||||
((attribute_name) @parameter
|
||||
(#lua-match? @parameter "^x[-]%l+$"))
|
||||
@@ -81,6 +20,7 @@
|
||||
((attribute_name) @parameter
|
||||
(#lua-match? @parameter "^[@:]%l+.-$"))
|
||||
|
||||
; colors regular variables in strings with tokyonight theme
|
||||
((attribute
|
||||
(attribute_name) @_alpine
|
||||
(quoted_attribute_value (attribute_value) @operator))
|
||||
@@ -90,8 +30,3 @@
|
||||
(attribute_name) @_alpine
|
||||
(quoted_attribute_value (attribute_value) @operator))
|
||||
(#lua-match? @_alpine "^x[-]%l+$"))
|
||||
|
||||
[
|
||||
"endfor"
|
||||
"endif"
|
||||
] @keyword
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
(script_element
|
||||
(raw_text) @javascript)
|
||||
|
||||
((text) @htmldjango (#lua-match? @htmldjango "^{%p%s+%l+.-%s+%p}$"))
|
||||
|
||||
((text) @htmldjango (#lua-match? @htmldjango "^{{%s+.-%s+}}$"))
|
||||
|
||||
((attribute
|
||||
(quoted_attribute_value (attribute_value) @htmldjango))
|
||||
(#lua-match? @htmldjango "^{{%s+.-%s+}}$"))
|
||||
;((text) @htmldjango (#lua-match? @htmldjango "^{%p%s+%l+.-%s+%p}$"))
|
||||
;
|
||||
;((text) @htmldjango (#lua-match? @htmldjango "^{{%s+.-%s+}}$"))
|
||||
;
|
||||
;((attribute
|
||||
; (quoted_attribute_value (attribute_value) @htmldjango))
|
||||
; (#lua-match? @htmldjango "^{{%s+.-%s+}}$"))
|
||||
|
||||
|
||||
@@ -40,3 +40,5 @@
|
||||
"is"
|
||||
"as"
|
||||
] @keyword
|
||||
|
||||
(content) @html
|
||||
|
||||
Reference in New Issue
Block a user