Share your setups #36
Replies: 24 comments 69 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.
-
Over the past month, I've migrated from LazyVim to a mini-based configuration. It's been a positive experience thanks to the amazing work of @echasnovski and his excellent documentation. I love Link to my full configuration. |
Beta Was this translation helpful? Give feedback.
-
here's my a lot of trial, error and playing ChatGPT and Perplexity against each other to fix errors with every source / load. I've tried dozens of NeoVim distros, plus hopping around different editors emacs (for about 30 minutes) DOOM emacs, helix, kakoune -it got me to use visual mode before arbitrarily even tried org, neorg, fountain, LaTeX (do not recommend unless your book is finished… probably not even then), txt. whatever filetype Final Draft and Scrivner use. anywho, my last hurrah was kickstarter to figure out this Lua nonsense and sort my plugins per group vs a large headache inducing init trying to figure out what plugin does what I need and do I really need that dependency? apparently so. So now I'm under 40 plugins, nowhere near the 12 I had with vimscript, but it's a saner and easier to work with prose writing environment… if only I could get snippets to work |
Beta Was this translation helpful? Give feedback.
-
I've been seeking to minimize the number of plugins I use for some time, and mini.nvim has been essential for that, as my setup is mostly based on it now. I use a fair bit of tweaks for my personal workflow here and there, so hopefully this can be helpful! Here's the mini.nvim portion of my init.lualocal function more_than_one_buffer()
local seen_first_buf = false
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
if vim.bo[buf].buflisted then
if seen_first_buf then return true else seen_first_buf = true end
end
end
return false
end
local mini_path = vim.fn.stdpath('data') .. '/site/pack/deps/start/mini.nvim'
if vim.fn.isdirectory(mini_path) == 0 then
local cmd = { 'git', 'clone', '--filter=blob:none', 'https://github.com/echasnovski/mini.nvim', mini_path }
vim.system(cmd):wait()
vim.opt.runtimepath:append(mini_path)
end
require('mini.deps').setup()
MiniDeps.later(function() require('mini.bracketed').setup() end)
MiniDeps.later(function() require('mini.completion').setup() end)
MiniDeps.later(function()
require('mini.hipatterns').setup({
highlighters = { hex_color = require('mini.hipatterns').gen_highlighter.hex_color() },
delay = { text_change = 0 },
})
end)
MiniDeps.later(function()
require('mini.indentscope').setup({
draw = { delay = 0, animation = require('mini.indentscope').gen_animation.none() },
options = { border = 'top' },
symbol = '│',
})
end)
MiniDeps.later(function() require('mini.operators').setup() end)
MiniDeps.later(function()
local function no_icons(buf, items, query) MiniPick.default_show(buf, items, query, { show_icons = false }) end
require('mini.pick').setup({ source = { show = no_icons } })
end)
MiniDeps.now(function()
require('mini.base16').setup({
palette = {
base00 = '#080808', -- default bg
base01 = '#121212', -- line number bg
base02 = '#444444', -- statusline bg, selection bg
base03 = '#767676', -- line number fg, comments
base04 = '#eeeeee', -- statusline fg
base05 = '#eeeeee', -- default fg
base06 = '#eeeeee', -- light fg (not often used)
base07 = '#eeeeee', -- light bg (not often used)
base08 = '#ffd7ff', -- statements, identifiers
base09 = '#d7afff', -- integers, booleans, constants
base0A = '#ffffd7', -- classes, search highlights
base0B = '#afd787', -- strings
base0C = '#afd7ff', -- builtins
base0D = '#d7ffff', -- functions
base0E = '#afffaf', -- keywords
base0F = '#8a8a8a', -- punctuation, regex, indentscope
}
})
vim.api.nvim_set_hl(0, 'ColorColumn', { link = 'StatusLine' })
end)
MiniDeps.now(function()
vim.opt.cursorline = false
vim.opt.foldcolumn = '1'
vim.opt.splitkeep = 'cursor'
require('mini.basics').setup({ silent = true })
end)
MiniDeps.now(function()
require('mini.misc').setup()
MiniMisc.setup_auto_root()
MiniMisc.setup_restore_cursor()
ProjectName = function()
local root = MiniMisc.find_root()
return root and vim.fn.fnamemodify(root, ':h:t') .. ' | ' or ''
end
vim.opt.statusline = '%{%v:lua.ProjectName()%}' .. vim.o.statusline
end)
MiniDeps.now(function()
require('mini.sessions').setup()
local function percent_name(path) return path and path:gsub('/', '%%'):gsub('%%$', '') or nil end
local command = vim.api.nvim_create_user_command
command('Sw', function() MiniSessions.write(percent_name(MiniMisc.find_root())) end, {})
command('Sd', function() MiniSessions.delete(nil, { force = true }) end, {})
local function autowrite() return vim.v.this_session ~= '' and MiniSessions.write() end
local function autoread()
-- return if something is shown
if vim.fn.argc() > 0 then return end
if more_than_one_buffer() then return end
if vim.bo.filetype ~= '' then return end
if vim.api.nvim_buf_line_count(0) > 1 then return end
if vim.api.nvim_buf_get_lines(0, 0, 1, true)[1]:len() > 0 then return end
local session = percent_name(vim.fn.getcwd())
if vim.tbl_contains(vim.tbl_keys(MiniSessions.detected), session) then MiniSessions.read(session) end
end
vim.api.nvim_create_autocmd('VimEnter', { nested = true, once = true, callback = autoread })
vim.api.nvim_create_autocmd('VimLeavePre', { callback = autowrite })
end)
MiniDeps.now(function()
local add_sep = require('mini.splitjoin').gen_hook.add_trailing_separator()
local del_sep = require('mini.splitjoin').gen_hook.del_trailing_separator()
require('mini.splitjoin').setup({ split = { hooks_post = { add_sep } }, join = { hooks_post = { del_sep } } })
vim.api.nvim_create_autocmd('FileType', {
pattern = 'lua',
callback = function()
local pad_curly = MiniSplitjoin.gen_hook.pad_brackets({ brackets = { '%b{}' } })
vim.b.minisplitjoin_config = { join = { hooks_post = { del_sep, pad_curly } } }
end
})
end)
MiniDeps.now(function()
local function format_with_buf_id(buf_id, label) return string.format('%d %s', buf_id, label) end
require('mini.tabline').setup({ show_icons = false, set_vim_settings = false, format = format_with_buf_id })
local function set_showtabline() vim.opt.showtabline = more_than_one_buffer() and 2 or 0 end
vim.api.nvim_create_autocmd('BufEnter', { callback = set_showtabline })
vim.api.nvim_create_autocmd('SessionLoadPost', { callback = set_showtabline })
end) |
Beta Was this translation helpful? Give feedback.
-
https://github.com/lyonelzd/.dotfiles/tree/homeyairm1/nvim/.config/nvim Spent the last few days redoing my nvim dots to center around mini.nvim. It's been fun! Definitely unnecessary for me to separate every plugin/module into its own little file since most of the mini modules just have one line for calling the .setup() but It's a nice way to see which modules I'm actually using and if I ever wanna add something to the setup I can just go right to the file and modify it. |
Beta Was this translation helpful? Give feedback.
-
I've been having a blast tinkering with init.luavim.loader.enable()
vim.g.loaded_gzip = 1
vim.g.loaded_tar = 1
vim.g.loaded_tarPlugin = 1
vim.g.loaded_zip = 1
vim.g.loaded_zipPlugin = 1
vim.g.loaded_getscript = 1
vim.g.loaded_getscriptPlugin = 1
vim.g.loaded_vimball = 1
vim.g.loaded_vimballPlugin = 1
vim.g.loaded_matchit = 1
vim.g.loaded_matchparen = 1
vim.g.loaded_spellfile_plugin = 1
vim.g.loaded_2html_plugin = 1
vim.g.loaded_logiPat = 1
vim.g.loaded_rrhelper = 1
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.g.loaded_netrwSettings = 1
vim.g.loaded_netrwFileHandlers = 1
vim.g.loaded_tutor_mode_plugin = 1
local path_package = vim.fn.stdpath('data') .. '/site/'
local deps_path = path_package .. 'pack/deps/start/mini.deps'
if not vim.uv.fs_stat(deps_path) then
if vim.fn.executable('git') == 0 then
vim.api.nvim_echo({
{ 'git is not installed\n', 'ErrorMsg' },
{ 'Press any key to exit...', 'MoreMsg' },
}, true, {})
vim.fn.getchar()
vim.cmd('quit')
end
vim.api.nvim_echo({ { 'Installing `mini.deps`', 'WarningMsg' } }, true, {})
vim
.system({
'git',
'clone',
'--filter=blob:none',
'--single-branch',
'https://github.com/echasnovski/mini.deps',
deps_path,
})
:wait()
vim.cmd('packadd mini.deps')
vim.cmd('helptags ALL')
vim.api.nvim_echo({ { 'Installed `mini.deps`', 'MoreMsg' } }, true, {})
end
local ok, MiniDeps = pcall(require, 'mini.deps')
if not ok then
vim.api.nvim_echo({
{ ('Unable to load `mini.deps` from: %s\n'):format(deps_path), 'ErrorMsg' },
{ 'Press any key to exit...', 'MoreMsg' },
}, true, {})
vim.fn.getchar()
vim.cmd('quit')
end
MiniDeps.setup({ path = { package = path_package } })
vim.g.border = 'single'
local now = MiniDeps.now
for f in vim.fs.dir(vim.fn.stdpath('config') .. '/lua/config') do
now(function() require('config.' .. vim.fn.fnamemodify(f, ':r')) end)
end
for f in vim.fs.dir(vim.fn.stdpath('config') .. '/lua/plugin') do
require('plugin.' .. vim.fn.fnamemodify(f, ':r'))
end
Now adding or removing a plugin is just a matter of adding/removing a file in Also, I was surprised that loading all the 50+ plugins at the (basically) startup instead of loading a third of them and the rest at specific events (like I did with folke's 'lazy.nvim') did not increase startup time. At least I do not notice that. Bonus, a helper function to notify when building a plugin post-installation starts and ends (and how it ends): build_package()---@param cmd string[]
---@param spec {path:string,name:string,source:string}
M.build_package = function(cmd, spec)
local levels = vim.log.levels
vim.notify(('(mini.deps) Building `%s`'):format(spec.name), levels.INFO)
vim.system(cmd, { text = true }, function(obj)
local msg = ''
local lvl = levels.INFO
if obj.code ~= 0 then
lvl = levels.ERROR
msg = ('\nCode %d\n%s'):format(obj.code, obj.stderr)
end
vim.schedule(
function() vim.notify(('(mini.deps) Finished building `%s`%s'):format(spec.name, msg), lvl) end
)
end)
end All in all, |
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.
-
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