diff --git a/init.lua b/init.lua index d8fd174..6a5f1a5 100644 --- a/init.lua +++ b/init.lua @@ -14,7 +14,7 @@ vim.cmd("set textwidth=0") vim.cmd("set wrapmargin=0") vim.cmd("set linebreak") -- vim.cmd("set colorcolumn=85") --- vim.cmd("set conceallevel=0") -- DONT hide characters in MD +vim.cmd("set conceallevel=0") -- DONT hide characters in MD vim.cmd("set tabstop=4") vim.cmd("set shiftwidth=4") vim.cmd("set noexpandtab") -- expandtab to use spaces instead of tabs diff --git a/lazy-lock.json b/lazy-lock.json index 0b79cdb..456fbea 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -25,7 +25,7 @@ "nvim-colorizer.lua": { "branch": "master", "commit": "72a05f62c52241bc7441c820eb53946f92b2e6a4" }, "nvim-lint": { "branch": "master", "commit": "3d55c8f67c6ae5c15e1042571e107c7a3d5c5f4e" }, "nvim-scrollbar": { "branch": "main", "commit": "f8e87b96cd6362ef8579be456afee3b38fd7e2a8" }, - "nvim-treesitter": { "branch": "master", "commit": "cf12346a3414fa1b06af75c79faebe7f76df080a" }, + "nvim-treesitter": { "branch": "main", "commit": "8b98b4470eb326f1c7b50dae79f8c963568e5720" }, "nvim-treesitter-context": { "branch": "master", "commit": "f3061339b8eaf9fda873600bc425b8d2d8502533" }, "nvim-ts-autotag": { "branch": "main", "commit": "88c1453db4ba7dd24131086fe51fdf74e587d275" }, "nvim-web-devicons": { "branch": "master", "commit": "2ae6958df7ced50baac5035cec0c15799eedfbf7" }, diff --git a/lua/plugins/code-utils.lua b/lua/plugins/code-utils.lua index 31f1a58..b526ece 100644 --- a/lua/plugins/code-utils.lua +++ b/lua/plugins/code-utils.lua @@ -5,11 +5,13 @@ return { -- │ Code parse │ { "nvim-treesitter/nvim-treesitter", + branch = "main", + build = ":TSUpdate", opts = function() return require("plugins.opts.treesitter") end, config = function(_, opts) - require("nvim-treesitter.configs").setup(opts) + require("nvim-treesitter.config").setup(opts) end, }, diff --git a/lua/plugins/opts/lualine.lua b/lua/plugins/opts/lualine.lua index 14213e1..73767d9 100644 --- a/lua/plugins/opts/lualine.lua +++ b/lua/plugins/opts/lualine.lua @@ -35,7 +35,7 @@ local options = { lualine_a = { "mode" }, lualine_b = { "branch", "diff" }, lualine_c = { "filename", "diagnostics" }, - lualine_x = { "searchcount", "filetype", "encoding", "fileformat" }, + lualine_x = { "lsp_status", "searchcount", "filetype", "encoding" }, lualine_y = { "progress" }, lualine_z = { "location" }, }, diff --git a/lua/plugins/opts/noice.lua b/lua/plugins/opts/noice.lua index 85af31a..d5e8eb8 100644 --- a/lua/plugins/opts/noice.lua +++ b/lua/plugins/opts/noice.lua @@ -1,81 +1,84 @@ local config = { - views = { - cmdline_popup = { - position = { - row = 3, - col = "50%", - }, - size = { - width = 60, - height = "auto", - }, - }, - cmdline_popupmenu = { - position = { - row = 6, - col = "50%", - }, - size = { - width = 60, - height = "auto", - }, - }, - }, - cmdline = { - enabled = true, - view = "cmdline", -- cmdline, cmdline_popup - opts = {}, - ---@type table - format = { - cmdline = { pattern = "^:", icon = "λ", lang = "vim", title = "" }, - search_down = { kind = "search", pattern = "^/", icon = " ", lang = "regex" }, - search_up = { kind = "search", pattern = "^%?", icon = " ", lang = "regex" }, - filter = { pattern = "^:%s*!", icon = "$", lang = "bash" }, - lua = { - pattern = { "^:%s*lua%s+", "^:%s*lua%s*=%s*", "^:%s*=%s*" }, - icon = "", - lang = "lua", - }, - help = { pattern = "^:%s*he?l?p?%s+", icon = "" }, - input = {}, -- Used by input() - -- lua = false, -- to disable a format, set to `false` - }, - }, - notify = { - -- Noice can be used as `vim.notify` so you can route any notification like other messages - -- Notification messages have their level and other properties set. - -- event is always "notify" and kind can be any log level as a string - -- The default routes will forward notifications to nvim-notify - -- Benefit of using Noice for this is the routing and consistent history view - enabled = false, - view = "notify", - }, - lsp = { - -- override markdown rendering so that **cmp** and other plugins use **Treesitter** - override = { - ["vim.lsp.util.convert_input_to_markdown_lines"] = true, - ["vim.lsp.util.stylize_markdown"] = true, - ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp - }, - }, - presets = { - bottom_search = true, -- use a classic bottom cmdline for search - command_palette = true, -- position the cmdline and popupmenu together - long_message_to_split = true, -- long messages will be sent to a split - inc_rename = false, -- enables an input dialog for inc-rename.nvim - lsp_doc_border = false, -- add a border to hover docs and signature help - }, - routes = { - { view = "cmdline", filter = { event = "msg_showmode" } }, - { - filter = { - event = "msg_show", - kind = "", - find = "written", - }, - opts = { skip = true }, - }, - }, + views = { + cmdline_popup = { + position = { + row = 3, + col = "50%", + }, + size = { + width = 60, + height = "auto", + }, + }, + cmdline_popupmenu = { + position = { + row = 6, + col = "50%", + }, + size = { + width = 60, + height = "auto", + }, + }, + }, + cmdline = { + enabled = true, + view = "cmdline", -- cmdline, cmdline_popup + opts = {}, + ---@type table + format = { + cmdline = { pattern = "^:", icon = "λ", lang = "vim", title = "" }, + search_down = { kind = "search", pattern = "^/", icon = " ", lang = "regex" }, + search_up = { kind = "search", pattern = "^%?", icon = " ", lang = "regex" }, + filter = { pattern = "^:%s*!", icon = "$", lang = "bash" }, + lua = { + pattern = { "^:%s*lua%s+", "^:%s*lua%s*=%s*", "^:%s*=%s*" }, + icon = "", + lang = "lua", + }, + help = { pattern = "^:%s*he?l?p?%s+", icon = "" }, + input = {}, -- Used by input() + -- lua = false, -- to disable a format, set to `false` + }, + }, + notify = { + enabled = false, + view = "notify", + }, + lsp = { + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + }, + -- Bottom right notifications with the lsp executions + progress = { + enabled = false, + --- @type NoiceFormat|string + format = "lsp_progress", + --- @type NoiceFormat|string + format_done = "lsp_progress_done", + throttle = 1000 / 30, -- frequency to update lsp progress message + view = "mini", + }, + }, + presets = { + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = true, -- position the cmdline and popupmenu together + long_message_to_split = true, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = false, -- add a border to hover docs and signature help + }, + routes = { + { view = "cmdline", filter = { event = "msg_showmode" } }, + { + filter = { + event = "msg_show", + kind = "", + find = "written", + }, + opts = { skip = true }, + }, + }, } return config diff --git a/lua/plugins/search.lua b/lua/plugins/search.lua index 34ed15d..03dc80c 100644 --- a/lua/plugins/search.lua +++ b/lua/plugins/search.lua @@ -27,6 +27,7 @@ return { for _, ext in ipairs(opts.extensions_list) do telescope.load_extension(ext) end + require("plugins.utils.telescope").setup() end, }, { "mbbill/undotree" }, diff --git a/lua/plugins/utils/telescope.lua b/lua/plugins/utils/telescope.lua new file mode 100644 index 0000000..86f5433 --- /dev/null +++ b/lua/plugins/utils/telescope.lua @@ -0,0 +1,55 @@ +local pickers = require("telescope.pickers") +local finders = require("telescope.finders") +local make_entry = require("telescope.make_entry") +local conf = require("telescope.config").values + +local M = {} + +local live_multigrep = function(opts) + opts = opts or {} + opts.cwd = opts.cwd or vim.uv.cwd() + + local finder = finders.new_async_job({ + command_generator = function(prompt) + if not prompt or prompt == "" then + return nil + end + + local pieces = vim.split(prompt, " ") + local args = { "rg" } + if pieces[1] then + table.insert(args, "-e") + table.insert(args, pieces[1]) + end + + if pieces[2] then + table.insert(args, "-g") + table.insert(args, pieces[2]) + end + + ---@diagnostic disable-next-line: deprecated + return vim.tbl_flatten({ + args, + { "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", "--smart-case" }, + }) + end, + entry_maker = make_entry.gen_from_vimgrep(opts), + cwd = opts.cwd, + }) + + pickers + .new(opts, { + debounce = 100, + prompt_title = "Multi Grep", + finder = finder, + previewer = conf.grep_previewer(opts), + sorter = require("telescope.sorters").empty(), + }) + :find() +end + +M.setup = function() + vim.keymap.set("n", "fW", live_multigrep) +end + +return M