From 0ec71045f485693a379ef7b22faadc58971a8c63 Mon Sep 17 00:00:00 2001 From: long Date: Wed, 1 May 2024 20:11:35 -0500 Subject: [PATCH] Changes - cleaned up plugin files - htmldjango snippets and highlight fix --- lua/base/init.lua | 1 + lua/plugins/config.lua | 10 ++- lua/plugins/init.lua | 7 +- lua/plugins/install_packer.lua | 8 --- lua/plugins/setup.lua | 109 ++++++++++++++++++++++++++++++ lua/plugins/startup.lua | 107 ----------------------------- queries/htmldjango/highlights.scm | 2 +- snippets/htmldjango.snippets | 16 +++++ 8 files changed, 139 insertions(+), 121 deletions(-) delete mode 100644 lua/plugins/install_packer.lua create mode 100644 lua/plugins/setup.lua delete mode 100644 lua/plugins/startup.lua create mode 100644 snippets/htmldjango.snippets diff --git a/lua/base/init.lua b/lua/base/init.lua index f230d57..80d56d0 100644 --- a/lua/base/init.lua +++ b/lua/base/init.lua @@ -140,6 +140,7 @@ opt.mouse = "" 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.filetype.add({ extension = { templ = "templ" } }) -- redo folds on write vim.cmd([[au BufWrite * normal zx]]) diff --git a/lua/plugins/config.lua b/lua/plugins/config.lua index b333fac..ebeebed 100644 --- a/lua/plugins/config.lua +++ b/lua/plugins/config.lua @@ -392,7 +392,7 @@ function M.lsp_zero() "pyright", "lua_ls", "bashls", - --"gopls", + "gopls", -- js web shit "html", @@ -401,6 +401,8 @@ function M.lsp_zero() "svelte", "angularls", "tailwindcss", + "templ", + "htmx", }) lsp.configure("pyright", { @@ -416,7 +418,11 @@ function M.lsp_zero() }) lsp.configure("html", { - filetypes = { "html", "htmldjango" }, + filetypes = { "html", "htmldjango", "templ" }, + }) + + lsp.configure("htmx", { + filetypes = { "html", "htmldjango", "templ" }, }) lsp.on_attach(function(client, bufnr) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 031c92d..f03bb1c 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,8 +1,9 @@ -require("plugins.install_packer") -require("plugins.startup") - +local setup = require("plugins.setup") local config = require("plugins.config") +setup.install_packer() +setup.install_plugins() + config.auto_session() config.fzf() config.fzf_checkout() diff --git a/lua/plugins/install_packer.lua b/lua/plugins/install_packer.lua deleted file mode 100644 index 10327de..0000000 --- a/lua/plugins/install_packer.lua +++ /dev/null @@ -1,8 +0,0 @@ -local fn = vim.fn -local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" - -if fn.empty(fn.glob(install_path)) > 0 then - fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path }) - vim.cmd("packadd packer.nvim") - vim.cmd(":PackerSync") -end diff --git a/lua/plugins/setup.lua b/lua/plugins/setup.lua new file mode 100644 index 0000000..3527a40 --- /dev/null +++ b/lua/plugins/setup.lua @@ -0,0 +1,109 @@ +local M = {} + +function M.install_packer() + local fn = vim.fn + local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" + + if fn.empty(fn.glob(install_path)) > 0 then + fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path }) + vim.cmd("packadd packer.nvim") + vim.cmd(":PackerSync") + end +end + +function M.install_plugins() + require("packer").startup(function(use) + use("wbthomason/packer.nvim") + + -- NAVIGATION + use("phaazon/hop.nvim") + + -- VIM THEMING + use("folke/tokyonight.nvim") + + -- FILE MANAGEMENT + use("junegunn/fzf") + use("junegunn/fzf.vim") + use("kevinhwang91/rnvimr") + use("vijaymarupudi/nvim-fzf") + use("vijaymarupudi/nvim-fzf-commands") + + -- SESSION + use("ThePrimeagen/harpoon") + use("nvim-lua/plenary.nvim") + use({ + "rmagatti/auto-session", + config = function() + require("auto-session").setup({ + log_level = "error", + auto_session_suppress_dirs = { "~/", "~/Projects", "~/Downloads", "/" }, + }) + end, + }) + use("mbbill/undotree") + + -- GIT + use("tpope/vim-fugitive") + use("stsewd/fzf-checkout.vim") + use("lewis6991/gitsigns.nvim") + + -- EDITOR + use("lukas-reineke/indent-blankline.nvim") + use({ + "nvim-lualine/lualine.nvim", + requires = { "kyazdani42/nvim-web-devicons", opt = true }, + }) + + -- LSP + --use("p00f/nvim-ts-rainbow") + --use("nvimtools/none-ls.nvim") + use({ + "nvim-treesitter/nvim-treesitter", + run = ":TSUpdate", + }) + use("nvim-treesitter/nvim-treesitter-context") + use("nvim-treesitter/playground") + use("jose-elias-alvarez/null-ls.nvim") + use("windwp/nvim-autopairs") + + use({ + "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 + }, + }) + + -- JS + use("HerringtonDarkholme/yats.vim") + use("chemzqm/vim-jsx-improve") + use("yuezk/vim-js") -- js + use("maxmellon/vim-jsx-pretty") -- react/tsx syntax highlight & indent + + -- HTML/CSS + use("mattn/emmet-vim") + + -- ZIG + use("ziglang/zig.vim") + + -- C# + use("jlcrochet/vim-razor") + end) +end + +return M diff --git a/lua/plugins/startup.lua b/lua/plugins/startup.lua deleted file mode 100644 index b32835f..0000000 --- a/lua/plugins/startup.lua +++ /dev/null @@ -1,107 +0,0 @@ -require("packer").startup(function(use) - use("wbthomason/packer.nvim") - - -- NAVIGATION - use("phaazon/hop.nvim") - - -- VIM THEMING - --use("navarasu/onedark.nvim") - use("folke/tokyonight.nvim") - - -- FILE MANAGEMENT - use("junegunn/fzf") - use("junegunn/fzf.vim") - use("kevinhwang91/rnvimr") - use("vijaymarupudi/nvim-fzf") - use("vijaymarupudi/nvim-fzf-commands") - - -- SESSION - use("ThePrimeagen/harpoon") - use("nvim-lua/plenary.nvim") - use({ - "rmagatti/auto-session", - config = function() - require("auto-session").setup({ - log_level = "error", - auto_session_suppress_dirs = { "~/", "~/Projects", "~/Downloads", "/" }, - }) - end, - }) - use("mbbill/undotree") - - -- GIT - use("tpope/vim-fugitive") - use("stsewd/fzf-checkout.vim") - use("lewis6991/gitsigns.nvim") - - -- EDITOR - use("lukas-reineke/indent-blankline.nvim") - use({ - "nvim-lualine/lualine.nvim", - requires = { "kyazdani42/nvim-web-devicons", opt = true }, - }) - - -- SNIPPETS - --use("SirVer/ultisnips") - --use("honza/vim-snippets") - --use("L3MON4D3/LuaSnip") -- Snippets plugin - - -- LSP - --use("p00f/nvim-ts-rainbow") - use({ - "nvim-treesitter/nvim-treesitter", - run = ":TSUpdate", - }) - use("nvim-treesitter/nvim-treesitter-context") - use("nvim-treesitter/playground") - use("jose-elias-alvarez/null-ls.nvim") - --use("nvimtools/none-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({ - "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 - }, - }) - - -- JS - use("HerringtonDarkholme/yats.vim") - use("chemzqm/vim-jsx-improve") - use("yuezk/vim-js") -- js - use("maxmellon/vim-jsx-pretty") -- react/tsx syntax highlight & indent - - -- HTML/CSS - use("mattn/emmet-vim") - - -- ZIG - use("ziglang/zig.vim") - - -- C# - use("jlcrochet/vim-razor") -end) diff --git a/queries/htmldjango/highlights.scm b/queries/htmldjango/highlights.scm index 6136aa7..5de90ec 100644 --- a/queries/htmldjango/highlights.scm +++ b/queries/htmldjango/highlights.scm @@ -30,7 +30,7 @@ (tag_statement tag_argument: (keyword_argument keyword_name: - ((identifier) @parameter))) + ((identifier) @variable.parameter))) (filter filter_name: ((identifier) @function)) diff --git a/snippets/htmldjango.snippets b/snippets/htmldjango.snippets new file mode 100644 index 0000000..9c05154 --- /dev/null +++ b/snippets/htmldjango.snippets @@ -0,0 +1,16 @@ +snippet pa + {% partial $0 %} + +snippet pd + {% partialdef $0 %} + {% endpartialdef %} + +snippet tt + {% $0 %} + +snippet ttt + {% $1 $2 %} + {% end$1 %} + +snippet vv + {{ $0 }}