feat: noice and lua line config + multigrep search + markdown fix on treesitter
This commit is contained in:
2
init.lua
2
init.lua
@@ -14,7 +14,7 @@ vim.cmd("set textwidth=0")
|
|||||||
vim.cmd("set wrapmargin=0")
|
vim.cmd("set wrapmargin=0")
|
||||||
vim.cmd("set linebreak")
|
vim.cmd("set linebreak")
|
||||||
-- vim.cmd("set colorcolumn=85")
|
-- 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 tabstop=4")
|
||||||
vim.cmd("set shiftwidth=4")
|
vim.cmd("set shiftwidth=4")
|
||||||
vim.cmd("set noexpandtab") -- expandtab to use spaces instead of tabs
|
vim.cmd("set noexpandtab") -- expandtab to use spaces instead of tabs
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
"nvim-colorizer.lua": { "branch": "master", "commit": "72a05f62c52241bc7441c820eb53946f92b2e6a4" },
|
"nvim-colorizer.lua": { "branch": "master", "commit": "72a05f62c52241bc7441c820eb53946f92b2e6a4" },
|
||||||
"nvim-lint": { "branch": "master", "commit": "3d55c8f67c6ae5c15e1042571e107c7a3d5c5f4e" },
|
"nvim-lint": { "branch": "master", "commit": "3d55c8f67c6ae5c15e1042571e107c7a3d5c5f4e" },
|
||||||
"nvim-scrollbar": { "branch": "main", "commit": "f8e87b96cd6362ef8579be456afee3b38fd7e2a8" },
|
"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-treesitter-context": { "branch": "master", "commit": "f3061339b8eaf9fda873600bc425b8d2d8502533" },
|
||||||
"nvim-ts-autotag": { "branch": "main", "commit": "88c1453db4ba7dd24131086fe51fdf74e587d275" },
|
"nvim-ts-autotag": { "branch": "main", "commit": "88c1453db4ba7dd24131086fe51fdf74e587d275" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "2ae6958df7ced50baac5035cec0c15799eedfbf7" },
|
"nvim-web-devicons": { "branch": "master", "commit": "2ae6958df7ced50baac5035cec0c15799eedfbf7" },
|
||||||
|
|||||||
@@ -5,11 +5,13 @@ return {
|
|||||||
-- │ Code parse │
|
-- │ Code parse │
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
branch = "main",
|
||||||
|
build = ":TSUpdate",
|
||||||
opts = function()
|
opts = function()
|
||||||
return require("plugins.opts.treesitter")
|
return require("plugins.opts.treesitter")
|
||||||
end,
|
end,
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
require("nvim-treesitter.configs").setup(opts)
|
require("nvim-treesitter.config").setup(opts)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ local options = {
|
|||||||
lualine_a = { "mode" },
|
lualine_a = { "mode" },
|
||||||
lualine_b = { "branch", "diff" },
|
lualine_b = { "branch", "diff" },
|
||||||
lualine_c = { "filename", "diagnostics" },
|
lualine_c = { "filename", "diagnostics" },
|
||||||
lualine_x = { "searchcount", "filetype", "encoding", "fileformat" },
|
lualine_x = { "lsp_status", "searchcount", "filetype", "encoding" },
|
||||||
lualine_y = { "progress" },
|
lualine_y = { "progress" },
|
||||||
lualine_z = { "location" },
|
lualine_z = { "location" },
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,81 +1,84 @@
|
|||||||
local config = {
|
local config = {
|
||||||
views = {
|
views = {
|
||||||
cmdline_popup = {
|
cmdline_popup = {
|
||||||
position = {
|
position = {
|
||||||
row = 3,
|
row = 3,
|
||||||
col = "50%",
|
col = "50%",
|
||||||
},
|
},
|
||||||
size = {
|
size = {
|
||||||
width = 60,
|
width = 60,
|
||||||
height = "auto",
|
height = "auto",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
cmdline_popupmenu = {
|
cmdline_popupmenu = {
|
||||||
position = {
|
position = {
|
||||||
row = 6,
|
row = 6,
|
||||||
col = "50%",
|
col = "50%",
|
||||||
},
|
},
|
||||||
size = {
|
size = {
|
||||||
width = 60,
|
width = 60,
|
||||||
height = "auto",
|
height = "auto",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
cmdline = {
|
cmdline = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
view = "cmdline", -- cmdline, cmdline_popup
|
view = "cmdline", -- cmdline, cmdline_popup
|
||||||
opts = {},
|
opts = {},
|
||||||
---@type table<string, CmdlineFormat>
|
---@type table<string, CmdlineFormat>
|
||||||
format = {
|
format = {
|
||||||
cmdline = { pattern = "^:", icon = "λ", lang = "vim", title = "" },
|
cmdline = { pattern = "^:", icon = "λ", lang = "vim", title = "" },
|
||||||
search_down = { kind = "search", pattern = "^/", icon = " ", lang = "regex" },
|
search_down = { kind = "search", pattern = "^/", icon = " ", lang = "regex" },
|
||||||
search_up = { kind = "search", pattern = "^%?", icon = " ", lang = "regex" },
|
search_up = { kind = "search", pattern = "^%?", icon = " ", lang = "regex" },
|
||||||
filter = { pattern = "^:%s*!", icon = "$", lang = "bash" },
|
filter = { pattern = "^:%s*!", icon = "$", lang = "bash" },
|
||||||
lua = {
|
lua = {
|
||||||
pattern = { "^:%s*lua%s+", "^:%s*lua%s*=%s*", "^:%s*=%s*" },
|
pattern = { "^:%s*lua%s+", "^:%s*lua%s*=%s*", "^:%s*=%s*" },
|
||||||
icon = "",
|
icon = "",
|
||||||
lang = "lua",
|
lang = "lua",
|
||||||
},
|
},
|
||||||
help = { pattern = "^:%s*he?l?p?%s+", icon = "" },
|
help = { pattern = "^:%s*he?l?p?%s+", icon = "" },
|
||||||
input = {}, -- Used by input()
|
input = {}, -- Used by input()
|
||||||
-- lua = false, -- to disable a format, set to `false`
|
-- lua = false, -- to disable a format, set to `false`
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
notify = {
|
notify = {
|
||||||
-- Noice can be used as `vim.notify` so you can route any notification like other messages
|
enabled = false,
|
||||||
-- Notification messages have their level and other properties set.
|
view = "notify",
|
||||||
-- event is always "notify" and kind can be any log level as a string
|
},
|
||||||
-- The default routes will forward notifications to nvim-notify
|
lsp = {
|
||||||
-- Benefit of using Noice for this is the routing and consistent history view
|
override = {
|
||||||
enabled = false,
|
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||||
view = "notify",
|
["vim.lsp.util.stylize_markdown"] = true,
|
||||||
},
|
},
|
||||||
lsp = {
|
-- Bottom right notifications with the lsp executions
|
||||||
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
progress = {
|
||||||
override = {
|
enabled = false,
|
||||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
--- @type NoiceFormat|string
|
||||||
["vim.lsp.util.stylize_markdown"] = true,
|
format = "lsp_progress",
|
||||||
["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp
|
--- @type NoiceFormat|string
|
||||||
},
|
format_done = "lsp_progress_done",
|
||||||
},
|
throttle = 1000 / 30, -- frequency to update lsp progress message
|
||||||
presets = {
|
view = "mini",
|
||||||
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
|
presets = {
|
||||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
bottom_search = true, -- use a classic bottom cmdline for search
|
||||||
lsp_doc_border = false, -- add a border to hover docs and signature help
|
command_palette = true, -- position the cmdline and popupmenu together
|
||||||
},
|
long_message_to_split = true, -- long messages will be sent to a split
|
||||||
routes = {
|
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||||
{ view = "cmdline", filter = { event = "msg_showmode" } },
|
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||||
{
|
},
|
||||||
filter = {
|
routes = {
|
||||||
event = "msg_show",
|
{ view = "cmdline", filter = { event = "msg_showmode" } },
|
||||||
kind = "",
|
{
|
||||||
find = "written",
|
filter = {
|
||||||
},
|
event = "msg_show",
|
||||||
opts = { skip = true },
|
kind = "",
|
||||||
},
|
find = "written",
|
||||||
},
|
},
|
||||||
|
opts = { skip = true },
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ return {
|
|||||||
for _, ext in ipairs(opts.extensions_list) do
|
for _, ext in ipairs(opts.extensions_list) do
|
||||||
telescope.load_extension(ext)
|
telescope.load_extension(ext)
|
||||||
end
|
end
|
||||||
|
require("plugins.utils.telescope").setup()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ "mbbill/undotree" },
|
{ "mbbill/undotree" },
|
||||||
|
|||||||
55
lua/plugins/utils/telescope.lua
Normal file
55
lua/plugins/utils/telescope.lua
Normal file
@@ -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", "<leader>fW", live_multigrep)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
Reference in New Issue
Block a user