diff --git a/lua/base.lua b/lua/base.lua index 60988b7..d1797e0 100644 --- a/lua/base.lua +++ b/lua/base.lua @@ -74,12 +74,12 @@ silent_map("i", "", "g") silent_map("i", "", "g") -- half page movement -silent_map("n", "", "zz") -silent_map("n", "", "zz") -silent_map("v", "", "zz") -silent_map("v", "", "zz") -silent_map("i", "", "zz") -silent_map("i", "", "zz") +silent_map("n", "", "M") +silent_map("n", "", "M") +silent_map("v", "", "M") +silent_map("v", "", "M") +silent_map("i", "", "M") +silent_map("i", "", "M") -- dynamic tab silent_map("n", "", ":lua require('dynamic_tab').tab()") diff --git a/lua/plugins/config.lua b/lua/plugins/config.lua index 92ba8ba..fa2bd95 100644 --- a/lua/plugins/config.lua +++ b/lua/plugins/config.lua @@ -119,7 +119,8 @@ function M.lualine() end require("lualine").setup({ - options = { theme = "onedark", icons_enabled = true }, + --options = { theme = "onedark", icons_enabled = true }, + options = { theme = "tokyonight", icons_enabled = true }, sections = { lualine_a = { "mode" }, lualine_b = { @@ -183,7 +184,7 @@ function M.nvim_treesitter() javascript = true, cpp = true, } - local rainbow_disable = vim.tbl_extend("force", highlight_disable, { svelte = true, html = true }) + local rainbow_disable = vim.tbl_extend("force", highlight_disable, { svelte = true, html = true, query = true }) local too_many_lines = function(bufnr) return vim.api.nvim_buf_line_count(bufnr) > 5000 @@ -191,11 +192,13 @@ function M.nvim_treesitter() require("nvim-treesitter.configs").setup({ ensure_installed = "all", + ignore_install = { "html" }, highlight = { enable = true, disable = function(lang, bufnr) return highlight_disable[lang] or too_many_lines(bufnr) end, + additional_vim_regex_highlighting = { "htmldjango", "html" }, }, rainbow = { enable = true, @@ -207,6 +210,9 @@ function M.nvim_treesitter() --colors = {}, -- table of hex strings --termcolors = {}, }, + indent = { + enable = false, + } }) local version = vim.version() @@ -218,14 +224,14 @@ function M.nvim_treesitter() local parser_config = require("nvim-treesitter.parsers").get_parser_configs() parser_config.htmldjango = { install_info = { - url = "~/code/treesitter/tree-sitter-htmldjango", -- local path or git repo + url = "/home/guy/code/treesitter/tree-sitter-htmldjango-myown", -- local path or git repo files = { "src/parser.c" }, -- optional entries: - branch = "main", -- 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 = false, -- if folder contains pre-generated src/parser.c + --branch = "main", -- 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 }, - filetype = "htmldjango", -- if filetype does not match the parser name + filetype = "html", -- if filetype does not match the parser name } end @@ -436,4 +442,9 @@ function M.nvim_cmp() cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } })) end +function M.tokyonight() + require("tokyonight").setup() + vim.cmd([[colorscheme tokyonight-night]]) +end + return M diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index f7e575d..2300a50 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -17,5 +17,6 @@ config.nvim_fzf() config.nvim_lsp_installer() config.nvim_lspconfig() config.nvim_treesitter() -config.onedark() +--config.onedark() config.rnvimr() +config.tokyonight() diff --git a/lua/plugins/startup.lua b/lua/plugins/startup.lua index 25b76df..1663cdf 100644 --- a/lua/plugins/startup.lua +++ b/lua/plugins/startup.lua @@ -5,7 +5,8 @@ require("packer").startup(function(use) use("phaazon/hop.nvim") -- VIM THEMING - use("navarasu/onedark.nvim") + --use("navarasu/onedark.nvim") + use("folke/tokyonight.nvim") -- FILE MANAGEMENT use("junegunn/fzf") diff --git a/queries/html/highlights.scm b/queries/html/highlights.scm index a5145a6..670694a 100644 --- a/queries/html/highlights.scm +++ b/queries/html/highlights.scm @@ -1,13 +1,12 @@ ; inherits: html -(attribute_name) @keyword -[ - "<" - ">" - "" -] @punctuation.bracket +;[ +; "<" +; ">" +; "" +;] @punctuation.bracket (doctype) @comment @@ -15,41 +14,80 @@ ((tag_name) @comment (#eq? @comment "html")) -(element - (start_tag - ((tag_name) @function) - (attribute (attribute_name) @_alpine)) - (#lua-match? @_alpine "^[@:]%l+.-$")) +;(element (start_tag ((tag_name) @function) (#eq? @function "template"))) +;(element (end_tag ((tag_name) @function) (#eq? @function "template"))) -(element - (start_tag - (attribute (attribute_name) @_alpine)) - (end_tag ((tag_name) @function)) - (#lua-match? @_alpine "^[@:]%l+.-$")) +;(attribute_name) @constant -(element - (start_tag - ((tag_name) @function) - (attribute (attribute_name) @_alpine)) - (#lua-match? @_alpine "^x[-]%l+$")) +;(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+$")) -(element - (start_tag - (attribute (attribute_name) @_alpine)) - (end_tag ((tag_name) @function)) - (#lua-match? @_alpine "^x[-]%l+$")) +((attribute_name) @parameter + (#lua-match? @parameter "^x[-]%l+$")) -(element - (self_closing_tag - ((tag_name) @function) - (attribute (attribute_name) @_alpine)) - (#lua-match? @_alpine "^[@:]%l+.-$")) +((attribute_name) @parameter + (#lua-match? @parameter "^[@:]%l+.-$")) -(element - (self_closing_tag - ((tag_name) @function) - (attribute (attribute_name) @_alpine)) - (#lua-match? @_alpine "^x[-]%l+$")) +((attribute + (attribute_name) @_alpine + (quoted_attribute_value (attribute_value) @operator)) + (#lua-match? @_alpine "^[@:]%l+.-$")) + +((attribute + (attribute_name) @_alpine + (quoted_attribute_value (attribute_value) @operator)) + (#lua-match? @_alpine "^x[-]%l+$")) -(element (start_tag ((tag_name) @function) (#eq? @function "template"))) -(element (end_tag ((tag_name) @function) (#eq? @function "template"))) diff --git a/queries/html/injections.scm b/queries/html/injections.scm index 6143cb3..c7819ae 100644 --- a/queries/html/injections.scm +++ b/queries/html/injections.scm @@ -11,11 +11,11 @@ (script_element (raw_text) @javascript) -((text) @python (#lua-match? @python "^{%p%s+%l+%s+.-%s+%p}$")) +((text) @htmldjango (#lua-match? @htmldjango "^{%p%s+%l+.-%s+%p}$")) -((text) @python (#lua-match? @python "^{{%s+.-%s+}}$")) +((text) @htmldjango (#lua-match? @htmldjango "^{{%s+.-%s+}}$")) ((attribute - (attribute_name) @_hyperscript - (quoted_attribute_value (attribute_value) @python)) - (#eq? @_hyperscript "_")) + (quoted_attribute_value (attribute_value) @htmldjango)) + (#lua-match? @htmldjango "^{{%s+.-%s+}}$")) + diff --git a/queries/htmldjango/highlights.scm b/queries/htmldjango/highlights.scm new file mode 100644 index 0000000..17718b1 --- /dev/null +++ b/queries/htmldjango/highlights.scm @@ -0,0 +1,42 @@ +[ + "|" + ":" +] @punctuation + +[ + "{%" + "%}" + "{{" + "}}" +] @comment + +(string) @string + +(integer) @number +(float) @float + +(true) @boolean +(false) @boolean +(none) @boolean + +(identifier) @variable +(attribute object: (primary_expression) @variable) +(attribute attribute: (identifier) @property) + +(tag_statement tag_name: (identifier) @keyword) + +(tag_statement tag_argument: + (keyword_argument keyword_name: + ((identifier) @parameter))) + +(filter filter_name: ((identifier) @function)) + +[ + "for" + "if" + "not" + "in" + "and" + "is" + "as" +] @keyword