more stuff
This commit is contained in:
@@ -0,0 +1 @@
|
||||
require("helpers").set_tab(2)
|
||||
@@ -1,4 +1,7 @@
|
||||
require("base")
|
||||
|
||||
if not vim.g.vscode then
|
||||
require("specifics")
|
||||
require("plugins")
|
||||
require("buffer_tools").init()
|
||||
end
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
-- SHOULD NOT CONTAIN ANY SETTINGS RELATED TO EXTERNAL PLUGINS
|
||||
-- OR CUSTOM CODE YOU YOURSELF WROTE.
|
||||
|
||||
local map = require("helpers").map
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
local default_opts = { noremap = true }
|
||||
if opts then
|
||||
default_opts = vim.tbl_extend("force", default_opts, opts)
|
||||
end
|
||||
--vim.api.nvim_set_keymap(mode, lhs, rhs, default_opts)
|
||||
vim.keymap.set(mode, lhs, rhs, default_opts)
|
||||
end
|
||||
|
||||
local opt = vim.opt
|
||||
local g = vim.g
|
||||
|
||||
@@ -95,8 +103,6 @@ silent_map("n", "<S-Tab>", ":lua require('dynamic_tab').shift_tab()<CR>")
|
||||
|
||||
opt.autoindent = true
|
||||
opt.autoread = true
|
||||
opt.cursorcolumn = true
|
||||
opt.cursorline = true
|
||||
opt.expandtab = true
|
||||
opt.hlsearch = true
|
||||
opt.ignorecase = true
|
||||
@@ -131,10 +137,16 @@ opt.foldlevelstart = 10
|
||||
|
||||
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]])
|
||||
|
||||
-- vscode doesn't like cursorline stuff
|
||||
if not vim.g.vscode then
|
||||
vim.cmd([[hi CursorLine cterm=NONE ctermbg=darkgray ctermfg=white]])
|
||||
opt.cursorcolumn = true
|
||||
opt.cursorline = true
|
||||
end
|
||||
+30
-40
@@ -185,14 +185,7 @@ end
|
||||
function M.nvim_treesitter()
|
||||
local highlight_disable = {
|
||||
cpp = true,
|
||||
--javascript = true,
|
||||
}
|
||||
--local rainbow_disable = vim.tbl_extend("force", highlight_disable, {
|
||||
-- html = true,
|
||||
-- typescript = true,
|
||||
-- tsx = true,
|
||||
-- svelte = true,
|
||||
--})
|
||||
|
||||
local too_many_lines = function(bufnr)
|
||||
return vim.api.nvim_buf_line_count(bufnr) > 5000
|
||||
@@ -211,22 +204,14 @@ function M.nvim_treesitter()
|
||||
"css",
|
||||
"html",
|
||||
"query",
|
||||
"bash",
|
||||
},
|
||||
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,
|
||||
-- disable = function(lang, bufnr)
|
||||
-- return rainbow_disable[lang] or too_many_lines(bufnr)
|
||||
-- end,
|
||||
-- extended_mode = false,
|
||||
-- max_file_lines = nil,
|
||||
--},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
@@ -241,37 +226,20 @@ function M.nvim_treesitter()
|
||||
},
|
||||
})
|
||||
|
||||
local version = vim.version()
|
||||
if version.api_level ~= 9 then
|
||||
if vim.version().api_level ~= 9 then
|
||||
vim.opt.foldmethod = "expr"
|
||||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
end
|
||||
|
||||
--local htmldjango_path = "/home/guy/code/treesitter/tree-sitter-htmldjango-myown"
|
||||
--if vim.fn.filereadable(htmldjango_path .. "/src/parser.c") then
|
||||
-- -- old
|
||||
-- --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"
|
||||
-- potentially load .so from this repo
|
||||
--print(debug.getinfo(2, "S").source:sub(2))
|
||||
--vim.fn.getchar()
|
||||
|
||||
-- -- new
|
||||
--local shared_lib = "/home/guy/code/treesitter/tree-sitter-htmldjango-myown/src/parser.so"
|
||||
--if vim.fn.filereadable(shared_lib) == 1 then
|
||||
-- vim.treesitter.language.add("htmldjango", {
|
||||
-- install_info = {
|
||||
-- url = htmldjango_path,
|
||||
-- files = { "src/parser.c" },
|
||||
-- requires_generate_from_grammar = true,
|
||||
-- },
|
||||
-- filetype = "html",
|
||||
-- path = shared_lib,
|
||||
-- })
|
||||
-- vim.treesitter.language.register("htmldjango", "html")
|
||||
--end
|
||||
end
|
||||
|
||||
@@ -328,6 +296,12 @@ function M.null_ls()
|
||||
-- elixir
|
||||
null_ls.builtins.diagnostics.credo,
|
||||
null_ls.builtins.formatting.mix,
|
||||
|
||||
-- zig
|
||||
null_ls.builtins.formatting.zigfmt,
|
||||
|
||||
-- c_sharp
|
||||
null_ls.builtins.formatting.csharpier,
|
||||
}
|
||||
null_ls.setup({
|
||||
sources = sources,
|
||||
@@ -433,6 +407,18 @@ function M.lsp_zero()
|
||||
root_dir = lsp_config_defaults().root_dir,
|
||||
})
|
||||
|
||||
lsp.configure("tsserver", {
|
||||
settings = {
|
||||
implicitProjectConfiguration = {
|
||||
checkJs = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
lsp.configure("html", {
|
||||
filetypes = { "html", "htmldjango" },
|
||||
})
|
||||
|
||||
-- (Optional) Configure lua language server for neovim
|
||||
lsp.nvim_workspace()
|
||||
|
||||
@@ -443,4 +429,8 @@ function M.undotree()
|
||||
nmap("<Leader>u", ":UndotreeToggle<CR>")
|
||||
end
|
||||
|
||||
function M.luasnip()
|
||||
require("luasnip").filetype_extend("htmldjango", { "html" })
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@@ -16,6 +16,7 @@ config.nvim_treesitter()
|
||||
config.rnvimr()
|
||||
config.tokyonight()
|
||||
config.gitsigns()
|
||||
config.luasnip()
|
||||
config.lsp_zero()
|
||||
config.null_ls()
|
||||
config.undotree()
|
||||
|
||||
@@ -10,26 +10,30 @@
|
||||
"}}"
|
||||
] @comment
|
||||
|
||||
(django_empty_comment) @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)
|
||||
(attribute object:
|
||||
(primary_expression) @variable)
|
||||
|
||||
(attribute attribute:
|
||||
(identifier) @property)
|
||||
|
||||
(tag_statement tag_name:
|
||||
(identifier) @function)
|
||||
|
||||
(tag_statement tag_argument:
|
||||
(keyword_argument keyword_name:
|
||||
((identifier) @parameter)))
|
||||
|
||||
(filter filter_name: ((identifier) @function))
|
||||
(filter filter_name:
|
||||
((identifier) @function))
|
||||
|
||||
[
|
||||
"for"
|
||||
@@ -39,6 +43,8 @@
|
||||
"and"
|
||||
"is"
|
||||
"as"
|
||||
"endfor"
|
||||
"endif"
|
||||
"else"
|
||||
"empty"
|
||||
] @keyword
|
||||
|
||||
;(content) @html
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
((content) @injection.content
|
||||
(#set! injection.language "html")
|
||||
(#set! injection.combined))
|
||||
@@ -1,18 +1,15 @@
|
||||
(type (string (string_content) @python))
|
||||
|
||||
(type (subscript (string (string_content) @python)))
|
||||
|
||||
((assignment
|
||||
(type
|
||||
(identifier) @_type)
|
||||
(string
|
||||
(string_content) @python))
|
||||
(type (identifier) @_type)
|
||||
(string (string_content) @python))
|
||||
(#eq? @_type "TypeAlias"))
|
||||
|
||||
((assignment
|
||||
(type
|
||||
(string
|
||||
(string_content) @_type))
|
||||
(string
|
||||
(string_content) @python))
|
||||
(type (string (string_content) @_type))
|
||||
(string (string_content) @python))
|
||||
(#eq? @_type "TypeAlias"))
|
||||
|
||||
(class_definition
|
||||
@@ -23,3 +20,18 @@
|
||||
|
||||
(((string (string_content) @python) @_str)
|
||||
(#match? @_str "^r.*$"))
|
||||
|
||||
((call
|
||||
(identifier) @_function
|
||||
(argument_list
|
||||
(string
|
||||
(string_content) @python)))
|
||||
(#any-of? @_function "cast" "NewType" "TypeVar" "TypedDict"))
|
||||
|
||||
; Too slow
|
||||
;((call
|
||||
; (identifier) @_function
|
||||
; (argument_list
|
||||
; (string
|
||||
; (string_content) @htmldjango)))
|
||||
;(#eq? @_function "Template"))
|
||||
|
||||
Reference in New Issue
Block a user