Share your setups #36
Replies: 35 comments 105 replies
-
Hi, my config https://github.com/axpira/dotfiles/blob/main/nvim/init.lua |
Beta Was this translation helpful? Give feedback.
-
require("mini.base16").setup {
palette = {
base00 = "#000000",
base01 = "#111111",
base02 = "#333333",
base03 = "#bbbbbb",
base04 = "#dddddd",
base05 = "#ffffff",
base06 = "#ffffff",
base07 = "#ffffff",
base09 = "#ff2222",
base08 = "#ff9922",
base0A = "#ff22ff",
base0B = "#22ff22",
base0C = "#4444ff",
base0D = "#22ffff",
base0E = "#ffff22",
base0F = "#999999",
},
use_cterm = false,
}
require("mini.comment").setup {}
require("mini.completion").setup {}
require("mini.jump").setup {
mappings = {
repeat_jump = "",
},
highlight_delay = 0,
}
require("mini.pairs").setup {}
require("mini.sessions").setup {
directory = vim.fn.stdpath "config" .. "/sessions",
}
require("mini.starter").setup {
evaluate_single = true,
}
require("mini.statusline").setup {}
require("mini.surround").setup {
n_lines = 100,
mappings = {
add = "S",
delete = "ds",
find_left = "[s",
find = "]s",
highlight = "",
replace = "cs",
update_n_lines = "",
},
}
require("mini.tabline").setup {} |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I had a go at getting mini.ai to work with treesitter text objects. It seems to work alright with the little testing I've done, but I'm sure there are some edge cases that will break this. Credit for most of the work goes to the nvim-treesitter-textobjects plugin, the One other thing I added is the ability to use a table of queries instead of just one. Most of the logic was already there, it should just find the best match of any of the given queries. I'm 99% sure this is more complicated than it needs to be, as I've just kinda smooshed the two things together. UpdateThanks to the amazing update to the api (seriously, thanks so much @echasnovski), I have massively simplified this to the below function. My approach does come with the dependency on the nvim-treesitter plugin, but it supports multiple queries in one object and should have full support for all queries defined by nvim-treesitter-textobjects. local queries = require "nvim-treesitter.query"
local miniAiTreesitter = function(ai_type, _, _, query_list)
ai_type = ai_type == "a" and ".outer" or ".inner"
query_list = vim.tbl_map(function(query) return query .. ai_type end, query_list)
local matches = {}
for _, query in pairs(query_list) do
vim.list_extend(matches, queries.get_capture_matches_recursively(0, query, "textobjects"))
end
matches = vim.tbl_map(function(match)
local from_line, from_col, to_line, to_col = match.node:range()
return {
from = { line = from_line + 1, col = from_col + 1 },
to = { line = to_line + 1, col = to_col + 1 }
}
end, matches)
return matches
end
local miniAiTreeWrapper = function(query_list)
if type(query_list) ~= "table" then
query_list = { query_list }
end
return function(ai_type, _, opts)
return miniAiTreesitter(ai_type, _, opts, query_list)
end
end
require("mini.ai").setup({
custom_textobjects = {
o = miniAiTreeWrapper({"@block", "@conditional", "@loop"}),
s = miniAiTreeWrapper({"@function", "@class"}),
c = miniAiTreeWrapper("@comment"),
},
}) If I make any further changes to this you should be able to find them here |
Beta Was this translation helpful? Give feedback.
-
mini.nvim is beautifull one set plugin, here is my setup |
Beta Was this translation helpful? Give feedback.
-
This is my config It's still a work in progress (I started a couple of days ago, switching from vscode after I decided, finally, to go 100% neovim). So mini is currently 90% of my plugins, if not more. 🤣 This is amazing, I said in reddit and I need to say that again: thank you for this impressive work. |
Beta Was this translation helpful? Give feedback.
-
An idea that maybe could be of interest of more people: https://www.reddit.com/r/neovim/comments/x0hf25/nicer_jupyter_notebook_workflow_with_neovim/ |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
Very nice. (Minimap scrolls to the sides - not necessary.) |
Beta Was this translation helpful? Give feedback.
-
Mini is my favourite plugin. My neovim setup is minimal, so I really enjoy that I can setup all my mini modules of choice without setting any preferences, because the defaults are just so solid for me. The proof is that I can just loop an array to initialise them. |
Beta Was this translation helpful? Give feedback.
-
You can look at mine in here |
Beta Was this translation helpful? Give feedback.
-
Here is my setup: The border colors for the notify window seem to be both fore- and background to be the same: |
Beta Was this translation helpful? Give feedback.
-
Here is how { -- Split parameters, simpler version of treesj.lua
url = 'https://github.com/echasnovski/mini.splitjoin',
version = '*',
opts = {
mappings = {}, -- Configured in treesj => treesitter.lua
detect = {
separator = '[,;]'
}
}
},
{ -- Split/Join, integrated with mini.splitjoin
url = 'https://github.com/Wansmer/treesj',
dependencies = { 'https://github.com/nvim-treesitter/nvim-treesitter/' },
keys = {
{ '<leader>m', mode = { 'n', 'v' }, desc = 'Toggle split' }
},
config = function()
local tsj = require('treesj')
tsj.setup({
use_default_keymaps = false,
max_join_length = 512,
})
local function get_pos_lang(node)
local c = vim.api.nvim_win_get_cursor(0)
local range = { c[1] - 1, c[2], c[1] - 1, c[2] }
local buf = vim.api.nvim_get_current_buf()
local ok, parser = pcall(
vim.treesitter.get_parser,
buf,
vim.treesitter.language.get_lang(vim.bo[buf].ft)
)
if not ok then
return ""
end
local current_tree = parser:language_for_range(range)
return current_tree:lang()
end
vim.keymap.set({ 'n', 'v' }, "<leader>m", function()
local tsj_langs = require("treesj.langs")["presets"]
local lang = get_pos_lang()
if lang ~= "" and tsj_langs[lang] then
require("treesj").toggle()
else
require("mini.splitjoin").toggle()
end
end)
end
} |
Beta Was this translation helpful? Give feedback.
-
I spent this morning tweaking the look of my mini.statusline: My changes from the default:
I spent a couple hours (yes, sadly), experimenting with lots of other variations:
I love I love I also enabled The only packages I've tried thus far that I did not care for were With regards to Overall, love all the hard work you've put into the mini packages. Simply amazing! |
Beta Was this translation helpful? Give feedback.
-
Recently migrated to Highlights: Lazy stats (startup time). Currently updated via auto command due to stats not being available when `mini.starter` starts. -- Set starter footer and refresh after `startuptime` is available
vim.api.nvim_create_autocmd("User", {
pattern = "MiniStarterOpened",
callback = function()
vim.api.nvim_create_autocmd("User", {
pattern = "LazyVimStarted",
callback = function()
local starter = require "mini.starter"
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
starter.config.footer = function()
return "⚡ Loaded plugins: "
.. stats.loaded
.. "/"
.. stats.count
.. "\n⚡ Startup time: "
.. ms
.. " ms"
end
starter.refresh()
end,
})
end,
}) A dedicated section for workspaces from `workspaces.nvim`. local workspace_items = function()
local workspaces = require "workspaces"
local items = {}
for _, w in pairs(workspaces.get()) do
table.insert(items, {
name = w.name .. " " .. vim.fn.fnamemodify(w.path, ":~:."),
action = "WorkspacesOpen " .. w.name,
section = "Workspaces",
})
end
return items
end A workaround for centralizing header and justifying select sections. -- A workaround to centralize everything.
-- `aligning("center", "center")` will centralize the longest line in
-- `content`, then left align other items to its beginning.
-- It causes the header to not be truly centralized and have a variable
-- shift to the left.
-- This function will use `aligning` and pad the header accordingly.
-- It also goes over `justified_sections`, goes over all their items names
-- and justifies them by padding existing space in them.
-- Since `item_bullet` are separated from the items themselves, their
-- width is measured separately and deducted from the padding.
local centralize = function(justified_sections, centralize_header)
return function(content, buf_id)
-- Get max line width, same as in `aligning`
local max_line_width = math.max(unpack(vim.tbl_map(function(l)
return vim.fn.strdisplaywidth(l)
end, starter.content_to_lines(content))))
-- Align
content = starter.gen_hook.aligning("center", "center")(content, buf_id)
-- Iterate over header items and pad with relative missing spaces
if centralize_header == true then
local coords = starter.content_coords(content, "header")
for _, c in ipairs(coords) do
local unit = content[c.line][c.unit]
local pad = (max_line_width - vim.fn.strdisplaywidth(unit.string))
/ 2
if unit.string ~= "" then
unit.string = string.rep(" ", pad) .. unit.string
end
end
end
-- Justify recent files and workspaces
if justified_sections ~= nil and #justified_sections > 0 then
-- Check if `adding_bullet` has mutated the `content`
local coords = starter.content_coords(content, "item_bullet")
local bullet_len = 0
if coords ~= nil then
-- Bullet items are defined, compensate for bullet prefix width
bullet_len = vim.fn.strdisplaywidth(
content[coords[1].line][coords[1].unit].string
)
end
coords = starter.content_coords(content, "item")
for _, c in ipairs(coords) do
local unit = content[c.line][c.unit]
if vim.tbl_contains(justified_sections, unit.item.section) then
local one, two = unpack(vim.split(unit.string, " "))
unit.string = one
.. string.rep(
" ",
max_line_width
- vim.fn.strdisplaywidth(unit.string)
- bullet_len
+ 1
)
.. two
end
end
end
return content
end
end How it is used in `MiniStarter.setup`. starter.setup {
-- evaluate_single = true,
header = "███████████████████████████\n"
.. "███████▀▀▀░░░░░░░▀▀▀███████\n"
.. "████▀░░░░░░░░░░░░░░░░░▀████\n"
.. "███│░░░░░░░░░░░░░░░░░░░│███\n"
.. "██▌│░░░░░░░░░░░░░░░░░░░│▐██\n"
.. "██░└┐░░░░░░░░░░░░░░░░░┌┘░██\n"
.. "██░░└┐░░░░░░░░░░░░░░░┌┘░░██\n"
.. "██░░┌┘▄▄▄▄▄░░░░░▄▄▄▄▄└┐░░██\n"
.. "██▌░│██████▌░░░▐██████│░▐██\n"
.. "███░│▐███▀▀░░▄░░▀▀███▌│░███\n"
.. "██▀─┘░░░░░░░▐█▌░░░░░░░└─▀██\n"
.. "██▄░░░▄▄▄▓░░▀█▀░░▓▄▄▄░░░▄██\n"
.. "████▄─┘██▌░░░░░░░▐██└─▄████\n"
.. "█████░░▐█─┬┬┬┬┬┬┬─█▌░░█████\n"
.. "████▌░░░▀┬┼┼┼┼┼┼┼┬▀░░░▐████\n"
.. "█████▄░░░└┴┴┴┴┴┴┴┘░░░▄█████\n"
.. "███████▄░░░░░░░░░░░▄███████\n"
.. "██████████▄▄▄▄▄▄▄██████████\n"
.. "pwd: "
.. vim.fn.fnamemodify(vim.fn.getcwd(), ":~:."),
items = {
workspace_items,
starter.sections.recent_files(10, false, function(path)
-- Bring back trailing slash after `dirname`
return " " .. vim.fn.fnamemodify(path, ":~:.:h") .. "/"
end),
{ section = "Tools", name = "Lazy", action = "Lazy" },
{ section = "Tools", name = "Telescope", action = "Telescope" },
starter.sections.builtin_actions(),
},
content_hooks = {
-- starter.gen_hook.adding_bullet(),
centralize({ "Recent files", "Workspaces" }, true),
},
}
workspaces.nvim |
Beta Was this translation helpful? Give feedback.
-
I thought I’d share mine now. It’s a bit rough around the edges, but it has grown organically, and I’ve become really comfortable with it. The current structure makes it easy for me to add new plugins and see if they fit into my workflow. Overall, it’s nothing fancy—just pretty basic. One cool thing (though still a work in progress) is the Emacs <-> Neovim integration for Magit, which also integrates with RandomHue on the fly. https://github.com/wroyca/dotfiles/tree/main/dot_config/nvim |
Beta Was this translation helpful? Give feedback.
-
I already posted parts of my config in the "show and tell" section. Recently I finished all "todos" and refactored a few hacks into proper solutions. Thanks for creating https://github.com/abeldekat/nvim_pde Most of the plugins are now from |
Beta Was this translation helpful? Give feedback.
-
Hi everyone. I just created a webpage in my personal website showcasing my neovim configuration and explaining how I migrated all the way from vim to neovim and switched most of the stuff to mini.nvim. Please do check it out and let me know how do you feel about it. Below is the link for the webpage. https://231tr0n.github.io/blog/config Below is the link for my neovim configuration. |
Beta Was this translation helpful? Give feedback.
-
https://github.com/masroof-maindak/nvim I would love some feedback on this (particularly if there's a better way to handle certain things like my base16 & statusline setups... |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Here's a configuration I cooked up after playing around with |
Beta Was this translation helpful? Give feedback.
-
This is what I've got so far, still WIP: https://gist.github.com/luisdavim/b985e141310567969d90114d9cbd15b8 |
Beta Was this translation helpful? Give feedback.
-
Hi I just found this discussion and here is my swahpy/mvim. Looking forward to your feedback! |
Beta Was this translation helpful? Give feedback.
-
Hello, I would also like to share and get feedback from my configuration: |
Beta Was this translation helpful? Give feedback.
-
My entire nvim dots are in one file and is great for java development right now. I had a version with lazy a while back with 30 plugins and now I have around 10 and some can be removed. Mini.nvim made life so much easier here is the repo: https://github.com/DarthMooMancer/MacOS-Dots |
Beta Was this translation helpful? Give feedback.
-
Here is my config: https://github.com/aorith/dotfiles/tree/master/topics/neovim/nvim I really like the consistency of |
Beta Was this translation helpful? Give feedback.
-
Hope I'm not late to the party. I read through mini files and IN LOVE with the bookmarks function. Perf for navigation in large projects. However, I'd prefer to have that in per project approach rather than in-memory solution where the bookmarks is lost when closing neovim. So I took the liberty to fork and modify it a little bit to store the data to 'mini.files' setupreturn {
"liketoeatcheese/mini.files",
branch = "main",
dependencies = {},
config = function()
require("mini.files").setup( -- No need to copy this inside `setup()`. Will be used automatically.
{
-- Customization of shown content
content = {
-- Predicate for which file system entries to show
filter = nil,
-- What prefix to show to the left of file system entry
prefix = nil,
-- In which order to show file system entries
sort = nil,
},
-- Module mappings created only inside explorer.
-- Use `''` (empty string) to not create one.
mappings = {
close = "<space>q",
go_in_plus = "L",
--[[ go_in_plus = "L", ]]
go_in = "",
go_out = "H",
mark_goto = "'",
mark_set = "m",
reset = "<BS>",
reveal_cwd = "@",
show_help = "g?",
synchronize = "=",
trim_left = "<",
trim_right = ">",
},
-- General options
options = {
-- Whether to delete permanently or move into module-specific trash
permanent_delete = true,
-- Whether to use for editing directories
use_as_default_explorer = true,
},
-- Customization of explorer windows
windows = {
-- Maximum number of windows to show side by side
max_number = math.huge,
-- Whether to show preview of file/directory under cursor
preview = true,
-- Width of focused window
width_focus = 30,
-- Width of non-focused window
width_nofocus = 35,
-- Width of preview window
width_preview = 55,
},
}
)
vim.api.nvim_create_autocmd("User", {
pattern = "MiniFilesWindowUpdate",
callback = function(args)
vim.cmd([[
setlocal relativenumber
]])
local config = vim.api.nvim_win_get_config(args.data.win_id)
-- Ensure fixed height
config.height = vim.o.lines - 2
--[[ config.height = 10 ]]
-- Ensure title padding
if config.title[#config.title][1] ~= " " then
table.insert(config.title, { " ", "NormalFloat" })
end
if config.title[1][1] ~= " " then
table.insert(config.title, 1, { " ", "NormalFloat" })
end
vim.api.nvim_win_set_config(args.data.win_id, config)
end,
})
local mini_utils = {}
-- Copy just the filename
function mini_utils.copy_filename()
local entry = MiniFiles.get_fs_entry()
if not entry then
return
end
local filename = vim.fs.basename(entry.path)
if vim.fn.has("wsl") == 1 then
vim.fn.setreg("+", filename)
vim.fn.system("wslcopy", vim.fn.getreg("+"))
else
vim.fn.setreg("+", filename)
end
vim.notify("Copied: " .. filename)
end
-- Copy the full path in Windows format (for WSL)
function mini_utils.copy_windows_path()
local entry = MiniFiles.get_fs_entry()
if not entry then
return
end
local filepath = entry.path
-- Convert WSL path to Windows drive letter format
local win_path = filepath:gsub("^/mnt/(%w)", function(drive)
return string.upper(drive) .. ":/"
end)
win_path = win_path:gsub("/", "\\")
if vim.fn.has("wsl") == 1 then
vim.fn.setreg("+", win_path)
vim.fn.system("wslcopy", vim.fn.getreg("+"))
else
vim.fn.setreg("+", win_path)
end
vim.notify("Copied: " .. win_path)
end
-- Copy the full path
function mini_utils.copy_filepath()
local entry = MiniFiles.get_fs_entry()
if not entry then
return
end
local filepath = entry.path
--[[ filepath = filepath:gsub("/", "\\") ]]
if vim.fn.has("wsl") == 1 then
vim.fn.setreg("+", filepath)
vim.fn.system("wslcopy", vim.fn.getreg("+"))
else
vim.fn.setreg("+", filepath)
end
vim.notify("Copied: " .. filepath)
end
-- Copy relative path from current working directory
function mini_utils.copy_relative_path_forward_slash()
local entry = MiniFiles.get_fs_entry()
if not entry then
return
end
local filepath = entry.path
-- Get the current working directory
local cwd = vim.fn.getcwd()
-- Convert both paths to absolute paths
local abs_filepath = vim.fn.fnamemodify(filepath, ":p")
local abs_cwd = vim.fn.fnamemodify(cwd, ":p")
-- Get the relative path
local relative_path = vim.fn.fnamemodify(abs_filepath, ":." .. abs_cwd .. ":~")
-- Remove leading './' if present
relative_path = relative_path:gsub("^%./", "")
relative_path = relative_path:gsub("\\", "/")
if vim.fn.has("wsl") == 1 then
vim.fn.setreg("+", relative_path)
vim.fn.system("wslcopy", vim.fn.getreg("+"))
else
vim.fn.setreg("+", relative_path)
end
vim.notify("Copied: " .. relative_path)
end
-- Copy relative path from current working directory
function mini_utils.copy_relative_path()
local entry = MiniFiles.get_fs_entry()
if not entry then
return
end
local filepath = entry.path
-- Get the current working directory
local cwd = vim.fn.getcwd()
-- Convert both paths to absolute paths
local abs_filepath = vim.fn.fnamemodify(filepath, ":p")
local abs_cwd = vim.fn.fnamemodify(cwd, ":p")
-- Get the relative path
local relative_path = vim.fn.fnamemodify(abs_filepath, ":." .. abs_cwd .. ":~")
-- Remove leading './' if present
relative_path = relative_path:gsub("^%./", "")
if vim.fn.has("wsl") == 1 then
vim.fn.setreg("+", relative_path)
vim.fn.system("wslcopy", vim.fn.getreg("+"))
else
vim.fn.setreg("+", relative_path)
end
vim.notify("Copied: " .. relative_path)
end
-- Set root directory to current directory (equivalent to Neotree's set_root)
function mini_utils.set_root()
-- Works only if cursor is on the valid file system entry
local cur_entry_path = MiniFiles.get_fs_entry().path
local cur_directory = vim.fs.dirname(cur_entry_path)
vim.fn.chdir(cur_directory)
vim.api.nvim_set_current_dir(cur_directory)
MiniFiles.trim_left()
end
local go_in_plus = function()
for _ = 1, vim.v.count1 do
MiniFiles.go_in({ close_on_file = true })
end
end
vim.api.nvim_create_autocmd("User", {
pattern = "MiniFilesBufferCreate",
callback = function(args)
local map_buf = function(lhs, rhs)
vim.keymap.set("n", lhs, rhs, { buffer = args.data.buf_id })
end
map_buf("<Esc>", MiniFiles.close)
map_buf("q", MiniFiles.close)
map_buf("<c-h>", MiniFiles.go_out)
map_buf("<c-l>", go_in_plus)
vim.keymap.set("n", ".", mini_utils.set_root, { buffer = args.data.buf_id })
vim.keymap.set("n", "a", "o", { buffer = args.data.buf_id })
--[[ vim.keymap.set("n", "y", mini_utils.copy_filename, { buffer = args.data.buf_id }) ]]
vim.keymap.set("n", "gm", mini_utils.copy_relative_path_forward_slash, { buffer = args.data.buf_id })
vim.keymap.set("n", "gy", mini_utils.copy_filepath, { buffer = args.data.buf_id })
vim.keymap.set("n", "<s-y>", mini_utils.copy_relative_path, { buffer = args.data.buf_id })
end,
})
local go_in_plus = function()
for _ = 1, vim.v.count1 do
MiniFiles.go_in({ close_on_file = true })
end
end
local map_split = function(buf_id, lhs, direction)
local rhs = function()
-- Make new window and set it as target
local cur_target = MiniFiles.get_explorer_state().target_window
local new_target = vim.api.nvim_win_call(cur_target, function()
vim.cmd(direction .. " split")
return vim.api.nvim_get_current_win()
end)
MiniFiles.set_target_window(new_target)
go_in_plus()
-- This intentionally doesn't act on file under cursor in favor of
-- explicit "go in" action (`l` / `L`). To immediately open file,
-- add appropriate `MiniFiles.go_in()` call instead of this comment.
end
-- Adding `desc` will result into `show_help` entries
local desc = "Split " .. direction
vim.keymap.set("n", lhs, rhs, { buffer = buf_id, desc = desc })
end
vim.api.nvim_create_autocmd("User", {
pattern = "MiniFilesBufferCreate",
callback = function(args)
local buf_id = args.data.buf_id
-- Tweak keys to your liking
vim.keymap.set("n", "<C-A-v>", "<C-v>", { noremap = true, desc = "Enter visual block mode" })
map_split(buf_id, "<C-v>", "vertical")
end,
})
end,
} For the bonus. This is not really related to mini at all. I wrote this since I use search and replace a lot and there's no plugin out there that do this (Not that I know off at least). This basically allows you to visually select the text you one and escape all special characters that sed needs snap it into :%s/ or do the same for the word that you are on, and some other nuggets of searching within buffer, within the project, etc...: search_and_replace.lualocal M = {}
-- Escape special characters in the string
local function escape(str)
return str:gsub("([~\\^$.*\\/%[%]])", "\\%1"):gsub("\n", "\\n")
end
-- Escape special characters in the string
local function escapeFzf(str)
--[[ return str:gsub('([~\\^$*\\/%[%]\'\\])"', "\\%1") ]]
return str:gsub("([\\'])", "\\%1"):gsub("\n", "\\n")
end
local function get_visual_selection()
local start_pos = vim.fn.getpos("'<")
local end_pos = vim.fn.getpos("'>")
-- Adjust for Lua's 1-indexing
local start_col = start_pos[3]
local end_col = end_pos[3]
-- If selection is within a single line
if start_pos[2] == end_pos[2] then
return vim.fn.getline(start_pos[2]):sub(start_col, end_col)
end
local lines = vim.fn.getline(start_pos[2], end_pos[2])
if #lines == 0 then
return ""
end
-- Adjust first and last line of the selection
lines[1] = lines[1]:sub(start_col)
lines[#lines] = lines[#lines]:sub(1, end_col)
return table.concat(lines, "\n")
end
-- Function to be called from Neovim command
function M.SaveWithHighlight()
-- Get the current visual selection
local text = get_visual_selection()
text = escape(text) -- Escape the text for regex
-- Put the text into the command line
vim.fn.setreg("h", text)
end
-- Function to be called from Neovim command
function M.SubstituteWithPreviousHightlightHighlightMakeGroup()
-- Get the current visual selection
local content = vim.fn.getreg("h")
-- Put the text into the command line
local cmd = ":'<,'>s/\\(" .. content .. "\\)/"
vim.fn.feedkeys(vim.api.nvim_replace_termcodes(cmd, true, false, false))
end
-- Function to be called from Neovim command
function M.SubstituteWithHighlightMakeGroup()
-- Get the current visual selection
local text = get_visual_selection()
text = escape(text) -- Escape the text for regex
-- Put the text into the command line
local cmd = ":%s/\\(" .. text .. "\\)/"
vim.fn.feedkeys(vim.api.nvim_replace_termcodes(cmd, true, false, false))
end
-- Function to substitute with the word under the cursor
function M.SubstituteWithWord()
local word = vim.fn.expand("<cword>")
word = escape(word)
local cmd = ":%s/\\(" .. word .. "\\)/"
vim.fn.feedkeys(vim.api.nvim_replace_termcodes(cmd, true, false, true))
end
-- Function to substitute with the word under the cursor
function M.SearchWithWord()
local word = vim.fn.expand("<cword>")
word = escape(word)
local cmd = "/" .. word .. "<cr>"
vim.fn.feedkeys(vim.api.nvim_replace_termcodes(cmd, true, false, true))
end
-- Function to substitute with the word under the cursor
function M.SearchWithWORD()
local word = vim.fn.expand("<cWORD>")
word = escape(word)
local cmd = "/" .. word .. "<cr>"
vim.fn.feedkeys(vim.api.nvim_replace_termcodes(cmd, true, false, true))
end
-- Function to be called from Neovim command
function M.SearchWithHighlight()
-- Get the current visual selection
local text = get_visual_selection()
text = escape(text) -- Escape the text for regex
-- Put the text into the command line
local cmd = "/" .. text
vim.fn.feedkeys(vim.api.nvim_replace_termcodes(cmd, true, false, false))
end
-- Function to be called from Neovim command
function M.SearchWorkSpaceWithHighlight()
-- Get the current visual selection
local text = get_visual_selection()
text = escapeFzf(text) -- Escape the text for regex
-- Put the text into the command line
local cmd = ":lua require('fzf-lua').live_grep_native({multiprocess=true,search = '" .. text .. "'})<CR>"
vim.fn.feedkeys(vim.api.nvim_replace_termcodes(cmd, true, false, true))
end
return M Mappingskeymap("v", "<Leader>rp", ':lua require"utils.search_and_replace".SubstituteWithHighlightMakeGroup()<CR>', opts)
keymap("v", "<Leader>rs", ':lua require"utils.search_and_replace".SaveWithHighlight()<CR>', opts)
keymap(
"v",
"<Leader>rh",
':lua require"utils.search_and_replace".SubstituteWithPreviousHightlightHighlightMakeGroup()<CR>',
opts
)
keymap("n", "<Leader>rp", ':lua require"utils.search_and_replace".SubstituteWithWord()<CR>', opts)
keymap("v", "<Leader>lh", ':lua require"utils.search_and_replace".SearchWithHighlight()<CR>', opts)
keymap("v", "<Leader>lf", ':lua require"utils.search_and_replace".SearchWithHighlight()<CR>', opts)
keymap("n", "<Leader>lw", ':lua require"utils.search_and_replace".SearchWithWord()<CR>', opts)
keymap("n", "<Leader>lW", ':lua require"utils.search_and_replace".SearchWithWORD()<CR>', opts)
keymap("v", "<Leader>lw", ':lua require"utils.search_and_replace".SearchWorkSpaceWithHighlight()<CR>', opts) |
Beta Was this translation helpful? Give feedback.
-
Loving mini so far, honestly no complaints :) |
Beta Was this translation helpful? Give feedback.
-
Hey! I wanted to share a small experience I had while configuring MiniStarter in Neovim. I customized the header colors and tweaked every detail to better match the overall colorscheme. MiniStarter:local header = require("config/header")
MiniStarter.setup({
evaluate_single = true,
header = table.concat(header.header.val, "\n"),
footer = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
return "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms"
end,
items = {
MiniStarter.sections.pick(),
},
content_hooks = {
-- MiniStarter.gen_hook.adding_bullet(""),
},
})
vim.api.nvim_create_autocmd("User", {
pattern = "MiniStarterOpened",
callback = function(ev)
local ns = vim.api.nvim_create_namespace("MiniStarterOpenedHeader")
if vim.bo.filetype == "ministarter" then
for i, x in ipairs(header.header.opts.hl) do
for _, z in ipairs(x) do
vim.api.nvim_buf_set_extmark(ev.buf, ns, i - 1, z[2], { end_col = z[3] - 1, hl_group = z[1] })
end
end
return
end
vim.api.nvim_buf_clear_namespace(ev.buf, ns, 0, -1)
end,
})
|
Beta Was this translation helpful? Give feedback.
-
Heya, it's actually my first time switching from vscode to neovim and i were told to use some IDE distro such as NvimChad and lazynvim but i stumbled on this godsend while browsing through lazy's plugin dependencies. And i'm loving it so far 💕 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Seeing how other people use
mini.nvim
is a very helpful feedback for me. It helps me reason about which modules are used the most and whatconfig
values are used. This might influence my future decisions in design and default values. And also might other people new ideas.Feel free to share a link to specific part of dotfiles (might be a good idea to pin to specific commit), code or screenshot (if too big, please hide under spoiler).
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions