htmldjango highlight changes, ruff args, lsp zero config

This commit is contained in:
2023-02-06 07:07:52 -06:00
parent 167589deb1
commit da374365c8
7 changed files with 462 additions and 475 deletions
+1 -1
View File
@@ -126,7 +126,7 @@ opt.mouse = ""
vim.cmd([[hi CursorLine cterm=NONE ctermbg=darkgray ctermfg=white]]) 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]])
+409 -384
View File
@@ -3,472 +3,497 @@ local map = helpers.map
local lsp_config_defaults = helpers.lsp_config_defaults local lsp_config_defaults = helpers.lsp_config_defaults
local function nmap(...) local function nmap(...)
map("n", ...) map("n", ...)
end end
local M = {} local M = {}
function M.hop() function M.hop()
require("hop").setup({ keys = "etovxqpdygfblzhckisuran" }) require("hop").setup({ keys = "etovxqpdygfblzhckisuran" })
local hop_opts = "{ create_hl_autocmd = true }" local hop_opts = "{ create_hl_autocmd = true }"
local hopword = [[<cmd>lua require'hop'.hint_words(]] .. hop_opts .. [[)<cr>]] local hopword = [[<cmd>lua require'hop'.hint_words(]] .. hop_opts .. [[)<cr>]]
local hopline = [[<cmd>lua require'hop'.hint_lines_skip_whitespace(]] .. hop_opts .. [[)<cr>]] local hopline = [[<cmd>lua require'hop'.hint_lines_skip_whitespace(]] .. hop_opts .. [[)<cr>]]
map("n", "W", hopline, { silent = true }) map("n", "W", hopline, { silent = true })
map("v", "W", hopline, { silent = true }) map("v", "W", hopline, { silent = true })
map("n", "w", hopword, { silent = true }) map("n", "w", hopword, { silent = true })
map("v", "w", hopword, { silent = true }) map("v", "w", hopword, { silent = true })
end end
function M.onedark() function M.onedark()
require("onedark").setup({ require("onedark").setup({
style = "darker", style = "darker",
toggle_style_key = "<nop>", toggle_style_key = "<nop>",
}) })
require("onedark").load() require("onedark").load()
end end
function M.fzf() function M.fzf()
map("n", "<Leader>o", ":Files<CR>") map("n", "<Leader>o", ":Files<CR>")
map("n", "<Leader>O", ":Files ~/<CR>") map("n", "<Leader>O", ":Files ~/<CR>")
map("n", "<Leader>p", ":Buffers<CR>") map("n", "<Leader>p", ":Buffers<CR>")
map("n", "<Leader>h", ":Helptags<CR>") map("n", "<Leader>h", ":Helptags<CR>")
map("n", "<Leader>;", ":History:<CR>") map("n", "<Leader>;", ":History:<CR>")
map("n", "<Leader>c", ":Commands<CR>") map("n", "<Leader>c", ":Commands<CR>")
map("n", "<Leader>r", ":Rg <C-R><C-W><CR>") map("n", "<Leader>r", ":Rg <C-R><C-W><CR>")
map("n", "<Leader>R", ":Rg<CR>") map("n", "<Leader>R", ":Rg<CR>")
map("n", "<Leader>s", ":BLines<CR>") map("n", "<Leader>s", ":BLines<CR>")
map("n", "<Leader>gl", ":GFiles<CR>") map("n", "<Leader>gl", ":GFiles<CR>")
map("n", "<Leader>gs", ":GFiles?<CR>") map("n", "<Leader>gs", ":GFiles?<CR>")
map("n", "<Leader>gc", ":Commits<CR>") map("n", "<Leader>gc", ":Commits<CR>")
map("n", "<Leader>l", ":lua require('fzf_funcs').cwd()<CR>") map("n", "<Leader>l", ":lua require('fzf_funcs').cwd()<CR>")
end end
function M.fzf_checkout() function M.fzf_checkout()
map("n", "<Leader>gb", ":GBranches<CR>") map("n", "<Leader>gb", ":GBranches<CR>")
end end
function M.rnvimr() function M.rnvimr()
map("n", "<Leader>f", [[:RnvimrToggle<CR>]]) map("n", "<Leader>f", [[:RnvimrToggle<CR>]])
end end
function M.nvim_fzf() function M.nvim_fzf()
require("fzf").default_options = { require("fzf").default_options = {
fzf_cli_args = " --height 100% --preview='[[ -n \"$(command -v bat)\" ]] && bat --color=always --style=header,grid --line-range :300 {} || strings {+}' ", fzf_cli_args = " --height 100% --preview='[[ -n \"$(command -v bat)\" ]] && bat --color=always --style=header,grid --line-range :300 {} || strings {+}' ",
} }
end end
function M.harpoon() function M.harpoon()
require("harpoon").setup({ require("harpoon").setup({
global_settings = { global_settings = {
save_on_toggle = false, save_on_toggle = false,
save_on_change = true, save_on_change = true,
enter_on_sendcmd = false, enter_on_sendcmd = false,
tmux_autoclose_windows = false, tmux_autoclose_windows = false,
excluded_filetypes = { "harpoon" }, excluded_filetypes = { "harpoon" },
}, },
}) })
nmap("<Leader>a", ":lua require('harpoon.mark').add_file()<CR>") nmap("<Leader>a", ":lua require('harpoon.mark').add_file()<CR>")
nmap("<Leader>m", ":lua require('harpoon.ui').toggle_quick_menu()<CR>") nmap("<Leader>m", ":lua require('harpoon.ui').toggle_quick_menu()<CR>")
end end
function M.auto_session() function M.auto_session()
require("auto-session").setup({ require("auto-session").setup({
log_level = "info", log_level = "info",
auto_session_suppress_dirs = { "~/", "~/Projects" }, auto_session_suppress_dirs = { "~/", "~/Projects" },
auto_session_use_git_branch = true, auto_session_use_git_branch = true,
}) })
end end
function M.indent_blankline() function M.indent_blankline()
vim.opt.list = true vim.opt.list = true
require("indent_blankline").setup({ require("indent_blankline").setup({
space_char_blankline = " ", space_char_blankline = " ",
show_current_context = true, show_current_context = true,
show_current_context_start = true, show_current_context_start = true,
}) })
end end
function M.lualine() function M.lualine()
-- Out of 6 total columns -- Out of 6 total columns
local function columns(num) local function columns(num)
return vim.o.columns * num / 6 return vim.o.columns * num / 6
end end
-- config options -- config options
local function buffer_window(type, cond) local function buffer_window(type, cond)
return { return {
type, type,
cond = cond, cond = cond,
show_filename_only = true, show_filename_only = true,
show_modified_status = true, show_modified_status = true,
max_length = function() max_length = function()
return columns(5) return columns(5)
end, end,
filetype_names = { filetype_names = {
TelescopePrompt = "Telescope", TelescopePrompt = "Telescope",
dashboard = "Dashboard", dashboard = "Dashboard",
packer = "Packer", packer = "Packer",
fzf = "FZF", fzf = "FZF",
alpha = "Alpha", alpha = "Alpha",
["lsp-installer"] = "LSP Installer", ["lsp-installer"] = "LSP Installer",
}, },
} }
end end
require("lualine").setup({ require("lualine").setup({
--options = { theme = "onedark", icons_enabled = true }, --options = { theme = "onedark", icons_enabled = true },
options = { theme = "tokyonight", icons_enabled = true }, options = { theme = "tokyonight", icons_enabled = true },
sections = { sections = {
lualine_a = { "mode" }, lualine_a = { "mode" },
lualine_b = { lualine_b = {
"FugitiveHead", "FugitiveHead",
}, },
lualine_c = { "filename" }, lualine_c = { "filename" },
lualine_x = { lualine_x = {
"encoding", "encoding",
"fileformat", "fileformat",
"filetype", "filetype",
[[string.format("%d Lines", vim.fn.line('$'))]], [[string.format("%d Lines", vim.fn.line('$'))]],
{ {
"diagnostics", "diagnostics",
sources = { "nvim_diagnostic", "ale" }, sources = { "nvim_diagnostic", "ale" },
}, },
}, },
lualine_y = { lualine_y = {
"progress", "progress",
}, },
lualine_z = { "location" }, lualine_z = { "location" },
}, },
inactive_sections = { inactive_sections = {
lualine_a = {}, lualine_a = {},
lualine_b = {}, lualine_b = {},
lualine_c = { "filename" }, lualine_c = { "filename" },
lualine_x = { "location" }, lualine_x = { "location" },
lualine_y = {}, lualine_y = {},
lualine_z = {}, lualine_z = {},
}, },
tabline = { tabline = {
lualine_a = { lualine_a = {
{ {
"tabs", "tabs",
max_length = function() max_length = function()
return columns(1) return columns(1)
end, end,
}, },
}, },
lualine_b = { lualine_b = {
buffer_window("windows", function() buffer_window("windows", function()
return require("dynamic_tab").window_mode() return require("dynamic_tab").window_mode()
end), end),
buffer_window("buffers", function() buffer_window("buffers", function()
return not require("dynamic_tab").window_mode() return not require("dynamic_tab").window_mode()
end), end),
}, },
lualine_c = {}, lualine_c = {},
lualine_x = {}, lualine_x = {},
lualine_y = {}, lualine_y = {},
lualine_z = {}, lualine_z = {},
}, },
extensions = {}, extensions = {},
}) })
end end
function M.nvim_treesitter() function M.nvim_treesitter()
local highlight_disable = { local highlight_disable = {
--typescript = true, --typescript = true,
--javascript = true, --javascript = true,
tsx = true, tsx = true,
cpp = true, cpp = true,
} }
local rainbow_disable = vim.tbl_extend("force", highlight_disable, { local rainbow_disable = vim.tbl_extend("force", highlight_disable, {
svelte = true, svelte = true,
html = true, html = true,
query = true, query = 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
end end
require("nvim-treesitter.configs").setup({ require("nvim-treesitter.configs").setup({
ensure_installed = { ensure_installed = {
"python", "python",
--"htmldjango", --"htmldjango",
"lua", "lua",
"javascript", "javascript",
"typescript", "typescript",
"tsx", "tsx",
"json", "json",
"svelte", "svelte",
"zig", "zig",
"vim", "vim",
"css", "css",
"scheme", "scheme",
}, },
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" }, --additional_vim_regex_highlighting = { "htmldjango", "html" },
}, },
rainbow = { rainbow = {
enable = true, enable = true,
disable = function(lang, bufnr) disable = function(lang, bufnr)
return rainbow_disable[lang] or too_many_lines(bufnr) return rainbow_disable[lang] or too_many_lines(bufnr)
end, end,
extended_mode = false, extended_mode = false,
max_file_lines = nil, max_file_lines = nil,
}, },
indent = { indent = {
enable = false, enable = true,
}, },
}) })
local version = vim.version() local version = vim.version()
if 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" 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() local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.htmldjango = { parser_config.htmldjango = {
install_info = { install_info = {
url = htmldjango_path, -- local path or git repo url = htmldjango_path,
files = { "src/parser.c" }, files = { "src/parser.c" },
-- optional entries: requires_generate_from_grammar = true,
--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 filetype = "html",
requires_generate_from_grammar = true, -- if folder contains pre-generated src/parser.c }
},
filetype = "html", -- if filetype does not match the parser name local ft_to_parser = require("nvim-treesitter.parsers").filetype_to_parsername
} ft_to_parser.html = "htmldjango"
end end
end end
function M.nvim_lspconfig() function M.nvim_lspconfig()
vim.diagnostic.config({ vim.diagnostic.config({
virtual_text = true, virtual_text = true,
signs = true, signs = true,
update_in_insert = false, update_in_insert = false,
}) })
local lspconfig = require("lspconfig")
lspconfig.tailwindcss.setup({
init_options = {
userLanguages = {
htmldjango = "html",
},
},
})
end end
function M.nvim_lsp_installer() function M.nvim_lsp_installer()
local config = lsp_config_defaults() local config = lsp_config_defaults()
local on_attach_tsserver = function(client, bufnr) local on_attach_tsserver = function(client, bufnr)
local ts_utils = require("nvim-lsp-ts-utils") local ts_utils = require("nvim-lsp-ts-utils")
ts_utils.setup({ ts_utils.setup({
eslint_bin = "eslint_d", eslint_bin = "eslint_d",
eslint_enable_diagnostics = true, eslint_enable_diagnostics = true,
eslint_enable_code_actions = true, eslint_enable_code_actions = true,
enable_import_on_completion = true, enable_import_on_completion = true,
filter_out_diagnostics_by_severity = { filter_out_diagnostics_by_severity = {
"information", "information",
"hint", "hint",
--"warning", --"warning",
--"error", --"error",
}, },
}) })
ts_utils.setup_client(client) ts_utils.setup_client(client)
-- no default maps, so you may want to define some here -- no default maps, so you may want to define some here
local o = { silent = true } local o = { silent = true }
vim.api.nvim_buf_set_keymap(bufnr, "n", "gs", ":TSLspOrganize<CR>", o) vim.api.nvim_buf_set_keymap(bufnr, "n", "gs", ":TSLspOrganize<CR>", o)
vim.api.nvim_buf_set_keymap(bufnr, "n", "rN", ":TSLspRenameFile<CR>", o) vim.api.nvim_buf_set_keymap(bufnr, "n", "rN", ":TSLspRenameFile<CR>", o)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gI", ":TSLspImportAll<CR>", o) vim.api.nvim_buf_set_keymap(bufnr, "n", "gI", ":TSLspImportAll<CR>", o)
end end
require("nvim-lsp-installer").on_server_ready(function(server) require("nvim-lsp-installer").on_server_ready(function(server)
--Enable (broadcasting) snippet capability for completion --Enable (broadcasting) snippet capability for completion
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true capabilities.textDocument.completion.completionItem.snippetSupport = true
local disable_diag = { local disable_diag = {
["textDocument/publishDiagnostics"] = function() end, ["textDocument/publishDiagnostics"] = function() end,
} }
local on_attach_generic = function(client, bufnr) local on_attach_generic = function(client, bufnr)
-- Disables document formatting by lsp -- Disables document formatting by lsp
client.server_capabilities.document_formatting = false client.server_capabilities.document_formatting = false
client.server_capabilities.document_range_formatting = false client.server_capabilities.document_range_formatting = false
config.on_attach(client, bufnr) config.on_attach(client, bufnr)
end end
local opts = { local opts = {
on_attach = on_attach_generic, on_attach = on_attach_generic,
capabilities = capabilities, capabilities = capabilities,
flags = { flags = {
debounce_text_changes = 150, debounce_text_changes = 150,
}, },
settings = { settings = {
format = { enable = true }, format = { enable = true },
}, },
root_dir = config.root_dir, root_dir = config.root_dir,
} }
if server.name == "tsserver" then if server.name == "tsserver" then
opts.on_attach = function(...) opts.on_attach = function(...)
on_attach_tsserver(...) on_attach_tsserver(...)
on_attach_generic(...) on_attach_generic(...)
end end
elseif server.name == "sumneko_lua" then elseif server.name == "sumneko_lua" then
opts.settings.Lua = { opts.settings.Lua = {
diagnostics = { diagnostics = {
globals = { globals = {
"vim", "vim",
"awesome", "awesome",
"client", "client",
}, },
}, },
} }
elseif server.name == "html" then elseif server.name == "html" then
opts.filetypes = { "html", "htmldjango" } opts.filetypes = { "html", "htmldjango" }
elseif server.name == "tailwindcss" then elseif server.name == "tailwindcss" then
opts.init_options = { opts.init_options = {
userLanguages = { userLanguages = {
htmldjango = "html", htmldjango = "html",
}, },
} }
elseif server.name == "ccls" then elseif server.name == "ccls" then
opts.capabilities.offsetEncoding = { "utf-32" } opts.capabilities.offsetEncoding = { "utf-32" }
end end
server:setup(opts) server:setup(opts)
vim.cmd([[do User LspAttachBuffers]]) vim.cmd([[do User LspAttachBuffers]])
end) end)
local lsp_installer_servers = require("nvim-lsp-installer.servers") local lsp_installer_servers = require("nvim-lsp-installer.servers")
local auto_servers = { local auto_servers = {
"sumneko_lua", "sumneko_lua",
"tsserver", "tsserver",
"bashls", "bashls",
"vimls", "vimls",
"rust_analyzer", "rust_analyzer",
"html", "html",
"cssls", "cssls",
"jsonls", "jsonls",
"jedi_language_server", "jedi_language_server",
--"pylsp", --"pylsp",
"svelte", "svelte",
"tailwindcss", "tailwindcss",
"zls", "zls",
"emmet_ls", "emmet_ls",
} }
for _, s in ipairs(auto_servers) do for _, s in ipairs(auto_servers) do
local ok, server = lsp_installer_servers.get_server(s) local ok, server = lsp_installer_servers.get_server(s)
if ok and not server:is_installed() then if ok and not server:is_installed() then
server:install() server:install()
end end
end end
end end
function M.null_ls() function M.null_ls()
local null_ls = require("null-ls") local null_ls = require("null-ls")
local config = lsp_config_defaults() local config = lsp_config_defaults()
-- ORDER IN TABLE DETERMINES EXECUTION ORDER -- ORDER IN TABLE DETERMINES EXECUTION ORDER
local sources = { local sources = {
-- python -- python
--null_ls.builtins.diagnostics.flake8, null_ls.builtins.diagnostics.mypy,
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, extra_args = { "--extend-select", "I001", "--unfixable", "F841,F842,F401" },
--null_ls.builtins.formatting.isort, }),
--null_ls.builtins.diagnostics.djlint, --null_ls.builtins.formatting.isort,
--null_ls.builtins.diagnostics.flake8,
--null_ls.builtins.diagnostics.djlint,
-- js -- js
null_ls.builtins.diagnostics.eslint, null_ls.builtins.diagnostics.eslint,
null_ls.builtins.code_actions.eslint, null_ls.builtins.code_actions.eslint,
null_ls.builtins.formatting.prettier.with({ null_ls.builtins.formatting.prettier.with({
extra_filetypes = { "svelte" }, extra_filetypes = { "svelte" },
}), }),
-- lua
null_ls.builtins.formatting.stylua, -- lua
-- bash null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.shfmt,
null_ls.builtins.diagnostics.shellcheck, -- bash
null_ls.builtins.code_actions.shellcheck, null_ls.builtins.formatting.shfmt,
-- cpp null_ls.builtins.diagnostics.shellcheck,
null_ls.builtins.formatting.clang_format, null_ls.builtins.code_actions.shellcheck,
}
null_ls.setup({ -- cpp
sources = sources, null_ls.builtins.formatting.clang_format,
on_attach = config.on_attach, }
root_dir = config.root_dir, null_ls.setup({
-- removed error "warning: multiple different client offset_encodings detected for buffer, this is not supported yet" sources = sources,
--on_init = function(client, _) on_attach = config.on_attach,
-- client.offset_encoding = "utf-32" root_dir = config.root_dir,
--end, })
})
end end
function M.nvim_autopairs() function M.nvim_autopairs()
require("nvim-autopairs").setup({ check_ts = true }) require("nvim-autopairs").setup({ check_ts = false, enable_moveright = false })
end end
function M.nvim_cmp() function M.nvim_cmp()
vim.opt.completeopt = "menuone,noselect" vim.opt.completeopt = "menuone,noselect"
local cmp_autopairs = require("nvim-autopairs.completion.cmp") local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local cmp = require("cmp") local cmp = require("cmp")
-- CMP NVIM ULTISNIP -- CMP NVIM ULTISNIP
local cmp_ultisnips_mappings = require("cmp_nvim_ultisnips.mappings") local cmp_ultisnips_mappings = require("cmp_nvim_ultisnips.mappings")
local ultisnip = { local ultisnip = {
expand = function(args) expand = function(args)
vim.fn["UltiSnips#Anon"](args.body) vim.fn["UltiSnips#Anon"](args.body)
end, end,
tab = cmp.mapping(function(fallback) tab = cmp.mapping(function(fallback)
cmp_ultisnips_mappings.compose({ "select_next_item" })(fallback) cmp_ultisnips_mappings.compose({ "select_next_item" })(fallback)
end, { "i", "s" }), end, { "i", "s" }),
shift_tab = cmp.mapping(function(fallback) shift_tab = cmp.mapping(function(fallback)
cmp_ultisnips_mappings.compose({ "select_prev_item" })(fallback) cmp_ultisnips_mappings.compose({ "select_prev_item" })(fallback)
end, { "i", "s" }), end, { "i", "s" }),
} }
cmp.setup({ cmp.setup({
snippet = { snippet = {
expand = ultisnip.expand, expand = ultisnip.expand,
}, },
mapping = { mapping = {
["<C-p>"] = cmp.mapping.select_prev_item(), ["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(), ["<C-n>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4), ["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4), ["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), ["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(), ["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm({ ["<CR>"] = cmp.mapping.confirm({
select = true, select = true,
}), }),
["<Tab>"] = ultisnip.tab, ["<Tab>"] = ultisnip.tab,
["<S-Tab>"] = ultisnip.shift_tab, ["<S-Tab>"] = ultisnip.shift_tab,
}, },
sources = { sources = {
{ name = "nvim_lsp" }, { name = "nvim_lsp" },
{ name = "ultisnips" }, { name = "ultisnips" },
}, },
}) })
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } })) cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
end end
function M.tokyonight() function M.tokyonight()
require("tokyonight").setup() require("tokyonight").setup()
vim.cmd([[colorscheme tokyonight-night]]) vim.cmd([[colorscheme tokyonight-night]])
end end
function M.gitsigns() function M.gitsigns()
require("gitsigns").setup() 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 end
return M return M
+5 -4
View File
@@ -10,14 +10,15 @@ config.harpoon()
config.hop() config.hop()
config.indent_blankline() config.indent_blankline()
config.lualine() config.lualine()
config.null_ls()
config.nvim_autopairs() config.nvim_autopairs()
config.nvim_cmp() --config.nvim_cmp()
config.nvim_fzf() config.nvim_fzf()
config.nvim_lsp_installer() --config.nvim_lsp_installer()
config.nvim_lspconfig()
config.nvim_treesitter() config.nvim_treesitter()
--config.onedark() --config.onedark()
config.rnvimr() config.rnvimr()
config.tokyonight() config.tokyonight()
config.gitsigns() config.gitsigns()
--config.nvim_lspconfig()
config.lsp_zero()
config.null_ls()
+33 -9
View File
@@ -17,6 +17,7 @@ require("packer").startup(function(use)
-- SESSION -- SESSION
use("ThePrimeagen/harpoon") use("ThePrimeagen/harpoon")
use("nvim-lua/plenary.nvim")
use("rmagatti/auto-session") use("rmagatti/auto-session")
use("mbbill/undotree") use("mbbill/undotree")
@@ -33,8 +34,8 @@ require("packer").startup(function(use)
}) })
-- SNIPPETS -- SNIPPETS
use("SirVer/ultisnips") --use("SirVer/ultisnips")
use("honza/vim-snippets") --use("honza/vim-snippets")
--use("L3MON4D3/LuaSnip") -- Snippets plugin --use("L3MON4D3/LuaSnip") -- Snippets plugin
-- LSP -- LSP
@@ -45,17 +46,40 @@ require("packer").startup(function(use)
}) })
use("nvim-treesitter/nvim-treesitter-context") use("nvim-treesitter/nvim-treesitter-context")
use("nvim-treesitter/playground") 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("jose-elias-alvarez/null-ls.nvim")
use("windwp/nvim-autopairs") 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({ use({
"hrsh7th/cmp-nvim-lsp", "VonHeikemen/lsp-zero.nvim",
requires = "quangnguyen30192/cmp-nvim-ultisnips", 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 -- JS
use("HerringtonDarkholme/yats.vim") use("HerringtonDarkholme/yats.vim")
+5 -70
View File
@@ -3,77 +3,16 @@
;[ ;[
; "<" ; "<"
; "/>"
; ">" ; ">"
; "</" ; "</"
; "/>"
;] @punctuation.bracket ;] @punctuation.bracket
;] @constant
(doctype) @comment (doctype) @comment
((tag_name) @type (#match? @type "^(head|body)$")) ((attribute_name) @parameter
(#lua-match? @parameter "^up[-]%l+$"))
((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 ((attribute_name) @parameter
(#lua-match? @parameter "^x[-]%l+$")) (#lua-match? @parameter "^x[-]%l+$"))
@@ -81,6 +20,7 @@
((attribute_name) @parameter ((attribute_name) @parameter
(#lua-match? @parameter "^[@:]%l+.-$")) (#lua-match? @parameter "^[@:]%l+.-$"))
; colors regular variables in strings with tokyonight theme
((attribute ((attribute
(attribute_name) @_alpine (attribute_name) @_alpine
(quoted_attribute_value (attribute_value) @operator)) (quoted_attribute_value (attribute_value) @operator))
@@ -90,8 +30,3 @@
(attribute_name) @_alpine (attribute_name) @_alpine
(quoted_attribute_value (attribute_value) @operator)) (quoted_attribute_value (attribute_value) @operator))
(#lua-match? @_alpine "^x[-]%l+$")) (#lua-match? @_alpine "^x[-]%l+$"))
[
"endfor"
"endif"
] @keyword
+7 -7
View File
@@ -11,11 +11,11 @@
(script_element (script_element
(raw_text) @javascript) (raw_text) @javascript)
((text) @htmldjango (#lua-match? @htmldjango "^{%p%s+%l+.-%s+%p}$")) ;((text) @htmldjango (#lua-match? @htmldjango "^{%p%s+%l+.-%s+%p}$"))
;
((text) @htmldjango (#lua-match? @htmldjango "^{{%s+.-%s+}}$")) ;((text) @htmldjango (#lua-match? @htmldjango "^{{%s+.-%s+}}$"))
;
((attribute ;((attribute
(quoted_attribute_value (attribute_value) @htmldjango)) ; (quoted_attribute_value (attribute_value) @htmldjango))
(#lua-match? @htmldjango "^{{%s+.-%s+}}$")) ; (#lua-match? @htmldjango "^{{%s+.-%s+}}$"))
+2
View File
@@ -40,3 +40,5 @@
"is" "is"
"as" "as"
] @keyword ] @keyword
(content) @html