more stuff
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
require("helpers").set_tab(2)
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
require("base")
|
require("base")
|
||||||
require("specifics")
|
|
||||||
require("plugins")
|
if not vim.g.vscode then
|
||||||
require("buffer_tools").init()
|
require("specifics")
|
||||||
|
require("plugins")
|
||||||
|
require("buffer_tools").init()
|
||||||
|
end
|
||||||
|
|||||||
@@ -1,7 +1,15 @@
|
|||||||
-- SHOULD NOT CONTAIN ANY SETTINGS RELATED TO EXTERNAL PLUGINS
|
-- SHOULD NOT CONTAIN ANY SETTINGS RELATED TO EXTERNAL PLUGINS
|
||||||
-- OR CUSTOM CODE YOU YOURSELF WROTE.
|
-- 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 opt = vim.opt
|
||||||
local g = vim.g
|
local g = vim.g
|
||||||
|
|
||||||
@@ -95,8 +103,6 @@ silent_map("n", "<S-Tab>", ":lua require('dynamic_tab').shift_tab()<CR>")
|
|||||||
|
|
||||||
opt.autoindent = true
|
opt.autoindent = true
|
||||||
opt.autoread = true
|
opt.autoread = true
|
||||||
opt.cursorcolumn = true
|
|
||||||
opt.cursorline = true
|
|
||||||
opt.expandtab = true
|
opt.expandtab = true
|
||||||
opt.hlsearch = true
|
opt.hlsearch = true
|
||||||
opt.ignorecase = true
|
opt.ignorecase = true
|
||||||
@@ -131,10 +137,16 @@ opt.foldlevelstart = 10
|
|||||||
|
|
||||||
opt.mouse = ""
|
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 .env.* set filetype=sh]])
|
||||||
vim.cmd([[au BufRead,BufNewFile Dockerfile.* set filetype=dockerfile]])
|
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
|
-- redo folds on write
|
||||||
vim.cmd([[au BufWrite * normal zx]])
|
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()
|
function M.nvim_treesitter()
|
||||||
local highlight_disable = {
|
local highlight_disable = {
|
||||||
cpp = true,
|
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)
|
local too_many_lines = function(bufnr)
|
||||||
return vim.api.nvim_buf_line_count(bufnr) > 5000
|
return vim.api.nvim_buf_line_count(bufnr) > 5000
|
||||||
@@ -211,22 +204,14 @@ function M.nvim_treesitter()
|
|||||||
"css",
|
"css",
|
||||||
"html",
|
"html",
|
||||||
"query",
|
"query",
|
||||||
|
"bash",
|
||||||
},
|
},
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
disable = function(lang, bufnr)
|
disable = function(lang, bufnr)
|
||||||
return highlight_disable[lang] or too_many_lines(bufnr)
|
return highlight_disable[lang] or too_many_lines(bufnr)
|
||||||
end,
|
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 = {
|
indent = {
|
||||||
enable = true,
|
enable = true,
|
||||||
},
|
},
|
||||||
@@ -241,37 +226,20 @@ function M.nvim_treesitter()
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
local version = vim.version()
|
if vim.version().api_level ~= 9 then
|
||||||
if version.api_level ~= 9 then
|
|
||||||
vim.opt.foldmethod = "expr"
|
vim.opt.foldmethod = "expr"
|
||||||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||||
end
|
end
|
||||||
|
|
||||||
--local htmldjango_path = "/home/guy/code/treesitter/tree-sitter-htmldjango-myown"
|
-- potentially load .so from this repo
|
||||||
--if vim.fn.filereadable(htmldjango_path .. "/src/parser.c") then
|
--print(debug.getinfo(2, "S").source:sub(2))
|
||||||
-- -- old
|
--vim.fn.getchar()
|
||||||
-- --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
|
--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", {
|
-- vim.treesitter.language.add("htmldjango", {
|
||||||
-- install_info = {
|
-- path = shared_lib,
|
||||||
-- url = htmldjango_path,
|
|
||||||
-- files = { "src/parser.c" },
|
|
||||||
-- requires_generate_from_grammar = true,
|
|
||||||
-- },
|
|
||||||
-- filetype = "html",
|
|
||||||
-- })
|
-- })
|
||||||
-- vim.treesitter.language.register("htmldjango", "html")
|
|
||||||
--end
|
--end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -328,6 +296,12 @@ function M.null_ls()
|
|||||||
-- elixir
|
-- elixir
|
||||||
null_ls.builtins.diagnostics.credo,
|
null_ls.builtins.diagnostics.credo,
|
||||||
null_ls.builtins.formatting.mix,
|
null_ls.builtins.formatting.mix,
|
||||||
|
|
||||||
|
-- zig
|
||||||
|
null_ls.builtins.formatting.zigfmt,
|
||||||
|
|
||||||
|
-- c_sharp
|
||||||
|
null_ls.builtins.formatting.csharpier,
|
||||||
}
|
}
|
||||||
null_ls.setup({
|
null_ls.setup({
|
||||||
sources = sources,
|
sources = sources,
|
||||||
@@ -433,6 +407,18 @@ function M.lsp_zero()
|
|||||||
root_dir = lsp_config_defaults().root_dir,
|
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
|
-- (Optional) Configure lua language server for neovim
|
||||||
lsp.nvim_workspace()
|
lsp.nvim_workspace()
|
||||||
|
|
||||||
@@ -443,4 +429,8 @@ function M.undotree()
|
|||||||
nmap("<Leader>u", ":UndotreeToggle<CR>")
|
nmap("<Leader>u", ":UndotreeToggle<CR>")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.luasnip()
|
||||||
|
require("luasnip").filetype_extend("htmldjango", { "html" })
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ config.nvim_treesitter()
|
|||||||
config.rnvimr()
|
config.rnvimr()
|
||||||
config.tokyonight()
|
config.tokyonight()
|
||||||
config.gitsigns()
|
config.gitsigns()
|
||||||
|
config.luasnip()
|
||||||
config.lsp_zero()
|
config.lsp_zero()
|
||||||
config.null_ls()
|
config.null_ls()
|
||||||
config.undotree()
|
config.undotree()
|
||||||
|
|||||||
@@ -10,26 +10,30 @@
|
|||||||
"}}"
|
"}}"
|
||||||
] @comment
|
] @comment
|
||||||
|
|
||||||
|
(django_empty_comment) @comment
|
||||||
(string) @string
|
(string) @string
|
||||||
|
|
||||||
(integer) @number
|
(integer) @number
|
||||||
(float) @float
|
(float) @float
|
||||||
|
|
||||||
(true) @boolean
|
(true) @boolean
|
||||||
(false) @boolean
|
(false) @boolean
|
||||||
(none) @boolean
|
(none) @boolean
|
||||||
|
|
||||||
(identifier) @variable
|
(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:
|
(tag_statement tag_argument:
|
||||||
(keyword_argument keyword_name:
|
(keyword_argument keyword_name:
|
||||||
((identifier) @parameter)))
|
((identifier) @parameter)))
|
||||||
|
|
||||||
(filter filter_name: ((identifier) @function))
|
(filter filter_name:
|
||||||
|
((identifier) @function))
|
||||||
|
|
||||||
[
|
[
|
||||||
"for"
|
"for"
|
||||||
@@ -39,6 +43,8 @@
|
|||||||
"and"
|
"and"
|
||||||
"is"
|
"is"
|
||||||
"as"
|
"as"
|
||||||
|
"endfor"
|
||||||
|
"endif"
|
||||||
|
"else"
|
||||||
|
"empty"
|
||||||
] @keyword
|
] @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 (string (string_content) @python))
|
||||||
|
|
||||||
|
(type (subscript (string (string_content) @python)))
|
||||||
|
|
||||||
((assignment
|
((assignment
|
||||||
(type
|
(type (identifier) @_type)
|
||||||
(identifier) @_type)
|
(string (string_content) @python))
|
||||||
(string
|
|
||||||
(string_content) @python))
|
|
||||||
(#eq? @_type "TypeAlias"))
|
(#eq? @_type "TypeAlias"))
|
||||||
|
|
||||||
((assignment
|
((assignment
|
||||||
(type
|
(type (string (string_content) @_type))
|
||||||
(string
|
(string (string_content) @python))
|
||||||
(string_content) @_type))
|
|
||||||
(string
|
|
||||||
(string_content) @python))
|
|
||||||
(#eq? @_type "TypeAlias"))
|
(#eq? @_type "TypeAlias"))
|
||||||
|
|
||||||
(class_definition
|
(class_definition
|
||||||
@@ -23,3 +20,18 @@
|
|||||||
|
|
||||||
(((string (string_content) @python) @_str)
|
(((string (string_content) @python) @_str)
|
||||||
(#match? @_str "^r.*$"))
|
(#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