From b58786f5b4d74f560fa93d4b0dce0b0f1d9fb402 Mon Sep 17 00:00:00 2001 From: "RingOfStorms (Joshua Bell)" Date: Wed, 5 Jul 2023 14:02:11 -0500 Subject: [PATCH] fixed damn treesitter they ahve custom setup function --- lazy-lock.json | 25 ++++-- lua/keymaps.lua | 6 +- lua/plugins/http_rest.lua | 2 +- lua/plugins/lsp.lua | 30 ++++++- lua/plugins/markdown_glow.lua | 2 +- lua/plugins/null-ls.lua | 2 +- lua/plugins/rust-tools.lua | 2 +- lua/plugins/telescope.lua | 8 ++ lua/plugins/text-case.lua | 12 +++ lua/plugins/treesitter.lua | 149 ++++++++++++++++++---------------- 10 files changed, 146 insertions(+), 92 deletions(-) create mode 100644 lua/plugins/text-case.lua diff --git a/lazy-lock.json b/lazy-lock.json index ded2599..c0e91d1 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,32 +1,39 @@ { - "LuaSnip": { "branch": "master", "commit": "105b5f7f72c13e682a3aa5d29eac2408ae513b22" }, + "LuaSnip": { "branch": "master", "commit": "a658ae2906344a1d2b9c507738e585cf68e685c7" }, "auto-save.nvim": { "branch": "main", "commit": "979b6c82f60cfa80f4cf437d77446d0ded0addf0" }, "ccc.nvim": { "branch": "main", "commit": "4a0ddaf787cc82796e84ab8a7f70d086f250aeb6" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, "glow.nvim": { "branch": "advanced_window", "commit": "f1157d4cb7e46e830c72004e7e1adb81a1f9b04c" }, - "indent-blankline.nvim": { "branch": "master", "commit": "7075d7861f7a6bbf0de0298c83f8a13195e6ec01" }, - "lazy.nvim": { "branch": "main", "commit": "4c8b625bc873ca76b76eee0c28c98f1f7148f17f" }, + "indent-blankline.nvim": { "branch": "master", "commit": "b7aa0aed55887edfaece23f7b46ab22232fc8741" }, + "lazy.nvim": { "branch": "main", "commit": "f8611632d0f9c6818e8eb54f9bcd1dad122b5a7f" }, "lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "4f1c72767bec31397d59554f84096909b2887195" }, - "mason-null-ls.nvim": { "branch": "main", "commit": "73c68abdf65279e41526eb152876511a8ae84ea2" }, - "mason.nvim": { "branch": "main", "commit": "b68d3be4b664671002221d43c82e74a0f1006b26" }, - "material.nvim": { "branch": "main", "commit": "f3783f2a8e55904887d3ea7cae8d7ab57d7f3e8e" }, + "mason-null-ls.nvim": { "branch": "main", "commit": "ae0c5fa57468ac65617f1bf821ba0c3a1e251f0c" }, + "mason.nvim": { "branch": "main", "commit": "5ad3e113b0c3fde3caba8630599373046f6197e8" }, + "material.nvim": { "branch": "main", "commit": "5a1880bb98b6844b9e9722b2a6128733d19ed20f" }, "neo-tree.nvim": { "branch": "v2.x", "commit": "20c2f2f5ba083bbb1e37b8bc3d590621434f31e9" }, "neodev.nvim": { "branch": "main", "commit": "a2b1d8fb9fa4daa35d3fd9123bccccccbd4a3520" }, "nerdcommenter": { "branch": "master", "commit": "ab2ae4d502a26bc591db78a8548823ddd04bbc9c" }, "nui.nvim": { "branch": "main", "commit": "d146966a423e60699b084eeb28489fe3b6427599" }, - "null-ls.nvim": { "branch": "main", "commit": "aac27a1fa550de3d0b2c651168167cc0d5366a9a" }, + "null-ls.nvim": { "branch": "main", "commit": "07897774c3b2f14d71b2ca51f3014d1055da9657" }, "nvim-cmp": { "branch": "main", "commit": "2743dd989e9b932e1b4813a4927d7b84272a14e2" }, - "nvim-lspconfig": { "branch": "master", "commit": "0011c435282f043a018e23393cae06ed926c3f4a" }, - "nvim-treesitter": { "branch": "master", "commit": "0522bbe90d6f9bb7080621fe70f8ab565e072b98" }, + "nvim-lspconfig": { "branch": "master", "commit": "2187f222c37cb5fd7cf96f242e5c8a4a340f2596" }, + "nvim-treesitter": { "branch": "master", "commit": "0b81ed9f18333949a74586a1ea0497ae4cbb7cd4" }, + "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "7f625207f225eea97ef7a6abe7611e556c396d2f" }, "nvim-web-devicons": { "branch": "master", "commit": "9ab9b0b894b2388a9dbcdee5f00ce72e25d85bf9" }, "openingh.nvim": { "branch": "main", "commit": "2719e5759ecf4b9a2d492fbf52d03d2e6fc6126a" }, "playground": { "branch": "master", "commit": "2b81a018a49f8e476341dfcb228b7b808baba68b" }, "plenary.nvim": { "branch": "master", "commit": "102c02903c74b93c705406bf362049383abc87c8" }, "rest.nvim": { "branch": "main", "commit": "aea7c64bdff1073beed9bd7fddb60cce7796d7ff" }, "rust-tools.nvim": { "branch": "master", "commit": "71d2cf67b5ed120a0e31b2c8adb210dd2834242f" }, + "sqlite.lua": { "branch": "master", "commit": "b7e28c8463254c46a8e61c52d27d6a2040492fc3" }, + "telescope-frecency.nvim": { "branch": "master", "commit": "62d3381a32ae541233b03a129ece0aeced30ad5e" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" }, "telescope.nvim": { "branch": "master", "commit": "c1a2af0af69e80e14e6b226d3957a064cd080805" }, + "text-case.nvim": { "branch": "main", "commit": "cd7cc65a412beb713e68f3b84e45990a939b7b6b" }, "undotree": { "branch": "master", "commit": "485f01efde4e22cb1ce547b9e8c9238f36566f21" } } \ No newline at end of file diff --git a/lua/keymaps.lua b/lua/keymaps.lua index e9dad76..63df688 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -3,7 +3,7 @@ vim.keymap.set("", "", "", { silent = true }) vim.g.mapleader = " " vim.g.maplocalleader = " " --- Modes +-- Modes test -- normal_mode = "n", -- insert_mode = "i", -- visual_mode = "v", @@ -55,12 +55,12 @@ require("util").keymaps({ desc = "Show diagnostic list", }, ["lz"] = { ":LspRestart", desc = "Restart LSP Server" }, + [",uu"] = { ':let @u = trim(tolower(system("uuidgen")))au', desc = "Generate and insert UUID" }, }, v = { - ["y"] = { '"*y', desc = "Copy to system clipboard" }, - ["p"] = { '"*p', desc = "Paste from system clipboard" }, ["J"] = { ":m '>+1gv=gv", desc = "Visually move block down" }, ["K"] = { ":m '<-2gv=gv", desc = "Visually move block up" }, + [",uu"] = { 'd:let @u = trim(tolower(system("uuidgen")))iu', desc = "Generate and replace UUID" }, }, i = { [""] = { "", desc = "Up" }, diff --git a/lua/plugins/http_rest.lua b/lua/plugins/http_rest.lua index 04a68b8..e4a0abd 100644 --- a/lua/plugins/http_rest.lua +++ b/lua/plugins/http_rest.lua @@ -1,7 +1,7 @@ return { "rest-nvim/rest.nvim", event = "BufEnter *.http", - requires = { "nvim-lua/plenary.nvim" }, + dependencies = { "nvim-lua/plenary.nvim" }, keys = { { "r", diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 7f57373..e7d4eed 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -71,7 +71,13 @@ return { { -- Autocompletion "hrsh7th/nvim-cmp", - dependencies = { "hrsh7th/cmp-nvim-lsp", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip" }, + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + }, }, { "williamboman/mason.nvim", @@ -93,7 +99,7 @@ return { { "folke/neodev.nvim", opts = {} }, { "neovim/nvim-lspconfig", - after = { "nvim-telescope/telescope.nvim" }, + dependencies = { "nvim-telescope/telescope.nvim" }, config = function() local config = require("lspconfig") local util = require("lspconfig/util") @@ -197,8 +203,24 @@ return { end, { "i", "s" }), }), sources = { - { name = "nvim_lsp" }, - { name = "luasnip" }, + { name = "nvim_lsp", priority = 8 }, + { nane = "buffer", priority = 7 }, + { name = "luasnip", priority = 6 }, + { name = "path" }, + }, + sorting = { + priority_weight = 1, + comparators = { + cmp.config.compare.locality, + cmp.config.compare.recently_used, + cmp.config.compare.score, + cmp.config.compare.offset, + cmp.config.compare.order, + }, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), }, }) end, diff --git a/lua/plugins/markdown_glow.lua b/lua/plugins/markdown_glow.lua index 0d3b225..dba754c 100644 --- a/lua/plugins/markdown_glow.lua +++ b/lua/plugins/markdown_glow.lua @@ -1,7 +1,7 @@ return { "lnc3l0t/glow.nvim", branch = "advanced_window", - config = { + opts = { default_type = "keep", }, cmd = "Glow", diff --git a/lua/plugins/null-ls.lua b/lua/plugins/null-ls.lua index 5effa45..e476c4c 100644 --- a/lua/plugins/null-ls.lua +++ b/lua/plugins/null-ls.lua @@ -17,7 +17,7 @@ end return { { "jose-elias-alvarez/null-ls.nvim", - after = { "williamboman/mason.nvim" }, + dependencies = { "williamboman/mason.nvim" }, opts = function(_, config) -- config variable is the default definitions table for the setup function call local null_ls = require("null-ls") diff --git a/lua/plugins/rust-tools.lua b/lua/plugins/rust-tools.lua index 2b5d3a1..614c82d 100644 --- a/lua/plugins/rust-tools.lua +++ b/lua/plugins/rust-tools.lua @@ -1,5 +1,5 @@ return { "simrat39/rust-tools.nvim", event = "BufEnter *.rs", - after = { "mason-lspconfig.nvim", "inlay-hints." }, + dependencies = { "mason-lspconfig.nvim", "inlay-hints." }, } diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 9f20fc8..5b6d40f 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -52,6 +52,14 @@ return { }, }, opts = { + pickers = { + buffers = { + sort_lastused = true, + }, + find_files = { + sort_lastused = true, + } + }, defaults = { vimgrep_arguments = { "rg", diff --git a/lua/plugins/text-case.lua b/lua/plugins/text-case.lua new file mode 100644 index 0000000..ca133ad --- /dev/null +++ b/lua/plugins/text-case.lua @@ -0,0 +1,12 @@ +return { + "johmsalas/text-case.nvim", + dependencies = "nvim-telescope/telescope.nvim", + event = "BufEnter", + config = function() + require("textcase").setup() + require("telescope").load_extension("textcase") + end, + keys = { + { ",c", "TextCaseOpenTelescope", desc = "Change case of selection", mode = {"n", "v"} }, + }, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 8d7c33f..1972a5d 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -8,80 +8,85 @@ if output == nil or output == "" then end return { - "nvim-treesitter/nvim-treesitter", - dependencies = { "windwp/nvim-ts-autotag", "JoosepAlviste/nvim-ts-context-commentstring" }, - build = ":TSUpdate", - event = "BufRead", - cmd = { - "TSBufDisable", - "TSBufEnable", - "TSBufToggle", - "TSDisable", - "TSEnable", - "TSToggle", - "TSInstall", - "TSInstallInfo", - "TSInstallSync", - "TSModuleInfo", - "TSUninstall", - "TSUpdate", - "TSUpdateSync", - }, - opts = { - -- ensure_installed = 'all', - ensure_installed = { - "lua", - "http", - "json", - "bash", - "css", - "diff", - "dockerfile", - "dot", - "git_rebase", - "gitattributes", - "html", - "java", - "javascript", - "jq", - "jsdoc", - "json5", - "kotlin", - "latex", - "make", - "markdown", - "markdown_inline", - "nix", - "python", - "regex", - "rst", - "rust", - "scss", - "sql", - "terraform", - "toml", - "tsx", - "jsx", - "typescript", - "vue", - "yaml", + { + "nvim-treesitter/nvim-treesitter", + dependencies = { "windwp/nvim-ts-autotag", "JoosepAlviste/nvim-ts-context-commentstring" }, + build = ":TSUpdate", + event = "BufRead", + cmd = { + "TSBufDisable", + "TSBufEnable", + "TSBufToggle", + "TSDisable", + "TSEnable", + "TSToggle", + "TSInstall", + "TSInstallInfo", + "TSInstallSync", + "TSModuleInfo", + "TSUninstall", + "TSUpdate", + "TSUpdateSync", }, - auto_install = auto, - highlight = { - enable = true, - use_languagetree = true, - -- disable = function(_, bufnr) return vim.api.nvim_buf_line_count(bufnr) > 10000 end, - additional_vim_regex_highlighting = false, - }, - incremental_selection = { enable = true }, - ident = { enable = true }, - autotag = { enable = true }, - context_commentstring = { enable = true, enable_autocmd = false }, - rainbow = { - enable = true, - extended_mode = true, - max_file_lines = nil, + opts = { + -- https://github.com/nvim-treesitter/nvim-treesitter#supported-languages + --ensure_installed = "all", + ensure_installed = { + "lua", + "http", + "json", + "bash", + "css", + "diff", + "dockerfile", + "dot", + "git_rebase", + "gitattributes", + "html", + "java", + "javascript", + "jq", + "jsdoc", + "json5", + "kotlin", + "latex", + "make", + "markdown", + "markdown_inline", + "nix", + "python", + "regex", + "rst", + "rust", + "scss", + "sql", + "terraform", + "toml", + "tsx", + "typescript", + "vue", + "yaml", + }, + auto_install = auto, + highlight = { + enable = true, + use_languagetree = true, + -- disable = function(_, bufnr) return vim.api.nvim_buf_line_count(bufnr) > 10000 end, + -- additional_vim_regex_highlighting = false, + }, + incremental_selection = { enable = true }, + ident = { enable = true }, + autotag = { enable = true }, + context_commentstring = { enable = true, enable_autocmd = false }, + rainbow = { + enable = true, + extended_mode = true, + max_file_lines = nil, + }, }, + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) + end, }, "nvim-treesitter/playground", }