Compare commits

..
5 Commits
Author SHA1 Message Date
romanzy313 c71d6ae982 improve mini.diff 2026-09-18 02:43:20 +02:00
romanzy313 7c24bf6c94 declutter statusline 2026-09-18 02:19:00 +02:00
romanzy313 da7f9d0bdb mini.cmdline 2026-09-18 02:05:31 +02:00
romanzy313 83561baf1f adhoc better completions 2026-09-18 01:50:34 +02:00
romanzy313 5b7df5dfb4 fix wrapping!!! 2026-09-18 01:09:58 +02:00
5 changed files with 83 additions and 42 deletions
+10 -8
View File
@@ -45,12 +45,8 @@ Git shortcuts:
- `<leader>lg` open LazyGit - `<leader>lg` open LazyGit
- `<leader>dv` open Diffview - `<leader>dv` open Diffview
- `<leader>dc` close Diffview - `<leader>dc` close Diffview
- `[h`, `]h`, `[H`, `]H` jump to hunks
Toggle shortcuts: - `<leader>th` — toggle the expanded hunk view
- `<leader>tw` toggle soft wrap
- `<leader>ti` toggle inline diagnostics
- `<leader>tv` toggle virtual diagnostics
Refresh shortcuts (oil and buffers): Refresh shortcuts (oil and buffers):
@@ -66,6 +62,13 @@ Oil usage:
- `<C-p>` previews the selected entry - `<C-p>` previews the selected entry
- `gx` opens the file in external viewer - `gx` opens the file in external viewer
Toggle shortcuts:
- `<leader>tw` toggle soft wrap
- `<leader>ti` toggle inline diagnostics
- `<leader>tv` toggle virtual diagnostics
- `<leader>th` — toggle the expanded hunk view
## Terminal ## Terminal
Two options to leave terminal mode and return to normal mode: Two options to leave terminal mode and return to normal mode:
@@ -102,8 +105,7 @@ Diagnostics:
- `g.` open diagnostic float - `g.` open diagnostic float
- `gl` send diagnostics to the location list - `gl` send diagnostics to the location list
- `gld` display diagnostic information - `gld` display diagnostic information
- `]g` jump to next warning or error - `]g`, `[g` jump to warning or error
- `[g` jump to previous warning or error
- `<leader>ti` toggle inline diagnostics - `<leader>ti` toggle inline diagnostics
- `<leader>tv` toggle virtual diagnostics - `<leader>tv` toggle virtual diagnostics
- `<leader>xx` toggle project warnings and errors - `<leader>xx` toggle project warnings and errors
+10 -10
View File
@@ -1,18 +1,18 @@
local M = {} local M = {}
--- Toggle wrapping, or force it to the provided state. --- Toggle wrapping, or force it to the provided state.
--- This plugin is buggy, so it does nothing
--- @param enabled? boolean --- @param enabled? boolean
function M.toggle(enabled) function M.toggle(enabled)
-- if enabled == nil then if enabled == nil then
-- enabled = not vim.wo.wrap enabled = not vim.wo.wrap
-- end end
--
-- vim.wo.wrap = enabled vim.wo.wrap = enabled
-- vim.wo.linebreak = enabled vim.wo.linebreak = enabled
-- vim.wo.breakindent = enabled vim.wo.breakindent = enabled
-- vim.bo.textwidth = enabled and 80 or 0 vim.wo.colorcolumn = enabled and "" or "80"
-- vim.bo.wrapmargin = 0 vim.bo.textwidth = enabled and 0 or 80
vim.bo.wrapmargin = 0
end end
return M return M
@@ -29,6 +29,9 @@ map("n", "<leader>lg", "<Cmd>LazyGit<CR>", { desc = "open lazygit" })
map("n", "<leader>dv", "<Cmd>DiffviewOpen<CR>", { desc = "open diffview" }) map("n", "<leader>dv", "<Cmd>DiffviewOpen<CR>", { desc = "open diffview" })
map("n", "<leader>dc", "<Cmd>DiffviewClose<CR>", { desc = "close diffview" }) map("n", "<leader>dc", "<Cmd>DiffviewClose<CR>", { desc = "close diffview" })
map("n", "<leader>tw", require("romanzy.custom.wrap").toggle, { desc = "toggle soft wrap" }) map("n", "<leader>tw", require("romanzy.custom.wrap").toggle, { desc = "toggle soft wrap" })
map("n", "<leader>th", function()
MiniDiff.toggle_overlay()
end, { desc = "toggle hunk view" })
map("n", "<leader>sv", "<Cmd>vs<CR>", { desc = "split vertical" }) map("n", "<leader>sv", "<Cmd>vs<CR>", { desc = "split vertical" })
map("n", "<leader>sh", "<Cmd>sp<CR>", { desc = "split horizontal" }) map("n", "<leader>sh", "<Cmd>sp<CR>", { desc = "split horizontal" })
+3 -3
View File
@@ -1,6 +1,5 @@
local g = vim.g local g = vim.g
local o = vim.opt local o = vim.opt
g.mapleader = " " -- Uses space as the global leader key. g.mapleader = " " -- Uses space as the global leader key.
g.maplocalleader = " " -- Uses space as the local leader key. g.maplocalleader = " " -- Uses space as the local leader key.
g.clipboard = "osc52" -- Routes the + and * registers through OSC52 in terminal Neovim. g.clipboard = "osc52" -- Routes the + and * registers through OSC52 in terminal Neovim.
@@ -11,7 +10,8 @@ o.cursorline = true -- Highlights the line under the cursor.
o.textwidth = 80 -- Wraps inserted text after 80 columns when formatting is active. o.textwidth = 80 -- Wraps inserted text after 80 columns when formatting is active.
o.scrolloff = 8 -- Keeps context lines visible around the cursor. o.scrolloff = 8 -- Keeps context lines visible around the cursor.
o.signcolumn = "yes" -- Always reserves space for signs in the gutter. o.signcolumn = "yes" -- Always reserves space for signs in the gutter.
o.colorcolumn = "+1" -- Highlights the preferred maximum line width. o.colorcolumn = "80" -- Highlights the preferred maximum line width.
o.wrap = false -- Prevents long lines from wrapping on screen.
o.list = true -- Displays whitespace characters using listchars. o.list = true -- Displays whitespace characters using listchars.
o.listchars = { o.listchars = {
tab = "» ", tab = "» ",
@@ -29,7 +29,7 @@ o.expandtab = true -- Inserts spaces w
o.smartindent = true -- Adds indentation automatically on new lines. o.smartindent = true -- Adds indentation automatically on new lines.
o.swapfile = false -- Disables swapfile creation. o.swapfile = false -- Disables swapfile creation.
o.incsearch = true -- Updates search matches as you type. o.incsearch = true -- Updates search matches as you type.
o.completeopt = { "menuone", "noselect", "fuzzy", "nosort" } -- Enables fuzzy completion matching. o.completeopt = { "menuone", "noinsert", "fuzzy", "nosort" } -- Enables fuzzy completion matching.
o.pumheight = 8 -- Limits the completion popup menu size. o.pumheight = 8 -- Limits the completion popup menu size.
o.updatetime = 50 -- Reduces idle delay for swap and CursorHold events. o.updatetime = 50 -- Reduces idle delay for swap and CursorHold events.
o.spelllang = { "en_us" } -- Uses US English for spell checking. o.spelllang = { "en_us" } -- Uses US English for spell checking.
+57 -21
View File
@@ -12,6 +12,7 @@ local icons = require("mini.icons")
local git = require("mini.git") local git = require("mini.git")
local diff = require("mini.diff") local diff = require("mini.diff")
local statusline = require("mini.statusline") local statusline = require("mini.statusline")
local cmdline = require("mini.cmdline")
local hipatterns = require("mini.hipatterns") local hipatterns = require("mini.hipatterns")
local pairs = require("mini.pairs") local pairs = require("mini.pairs")
local ai = require("mini.ai") local ai = require("mini.ai")
@@ -39,39 +40,65 @@ clue.setup({
}, },
}) })
completion.setup({})
local function complete_accept_top()
if vim.fn.pumvisible() == 0 then
return "<C-y>"
end
if vim.fn.complete_info({ "selected" }).selected == -1 then
return "<C-n><C-y>"
end
return "<C-y>"
end
vim.keymap.set("i", "<C-y>", complete_accept_top, { expr = true })
icons.setup({}) icons.setup({})
git.setup({}) git.setup({})
diff.setup({}) diff.setup({})
local function set_mini_diff_highlights() local function set_mini_diff_highlights()
vim.api.nvim_set_hl(0, "MiniDiffSignAdd", { fg = "#9ccf8d" }) vim.api.nvim_set_hl(0, "MiniDiffSignAdd", { fg = "#9ccf8d", bold = true })
vim.api.nvim_set_hl(0, "MiniDiffSignChange", { fg = "#f6c177" }) vim.api.nvim_set_hl(0, "MiniDiffSignChange", { fg = "#f6c177", bold = true })
vim.api.nvim_set_hl(0, "MiniDiffSignDelete", { fg = "#eb6f92" }) vim.api.nvim_set_hl(0, "MiniDiffSignDelete", { fg = "#eb6f92", bold = true })
vim.api.nvim_set_hl(0, "MiniDiffOverAdd", { fg = "#9ccf8d" }) vim.api.nvim_set_hl(0, "MiniDiffOverAdd", { fg = "#9ccf8d", bg = "#333c48", bold = true })
vim.api.nvim_set_hl(0, "MiniDiffOverChange", { fg = "#f6c177" }) vim.api.nvim_set_hl(0, "MiniDiffOverChange", { fg = "#eb6f92", bg = "#43293a", bold = true })
vim.api.nvim_set_hl(0, "MiniDiffOverDelete", { fg = "#eb6f92" }) vim.api.nvim_set_hl(0, "MiniDiffOverChangeBuf", { fg = "#9ccf8d", bg = "#333c48", bold = true })
vim.api.nvim_set_hl(0, "MiniDiffOverContext", { fg = "#908caa", bg = "#26233a" })
vim.api.nvim_set_hl(0, "MiniDiffOverContextBuf", { fg = "#e0def4", bg = "#1f1d2e" })
vim.api.nvim_set_hl(0, "MiniDiffOverDelete", { fg = "#eb6f92", bg = "#43293a", bold = true })
end end
set_mini_diff_highlights() set_mini_diff_highlights()
vim.api.nvim_create_autocmd("ColorScheme", { vim.api.nvim_create_autocmd("ColorScheme", {
callback = set_mini_diff_highlights, callback = set_mini_diff_highlights,
}) })
statusline.setup({ use_icons = true }) local function statusline_filetype()
local filetype = vim.bo.filetype
if filetype == "" then
return ""
end
local icon = MiniIcons.get("filetype", filetype)
return icon .. " " .. filetype
end
-- Custom de-cluttered status line output. The default was waaay to noisy
local function statusline_active()
local mode, mode_hl = statusline.section_mode({ trunc_width = 120 })
local git_info = statusline.section_git({ trunc_width = 40 })
-- local diff_info = statusline.section_diff({ trunc_width = 75 })
-- local diagnostics = statusline.section_diagnostics({ trunc_width = 75 })
local lsp = statusline.section_lsp({ trunc_width = 75 })
local filename = statusline.section_filename({ trunc_width = 140 })
local fileinfo = statusline_filetype()
local search = statusline.section_searchcount({ trunc_width = 75 })
return statusline.combine_groups({
{ hl = mode_hl, strings = { mode } },
{ hl = "MiniStatuslineDevinfo", strings = { git_info, lsp } },
"%<",
{ hl = "MiniStatuslineFilename", strings = { filename } },
"%=",
{ hl = "MiniStatuslineFileinfo", strings = { fileinfo } },
{ hl = mode_hl, strings = { search } },
})
end
statusline.setup({
use_icons = true,
content = { active = statusline_active },
})
cmdline.setup({})
hipatterns.setup({ hipatterns.setup({
highlighters = { highlighters = {
@@ -87,6 +114,15 @@ pairs.setup({
modes = { insert = true, command = true, terminal = false }, modes = { insert = true, command = true, terminal = false },
}) })
completion.setup({})
vim.keymap.set("i", "<CR>", function()
if vim.fn.complete_info({ "selected" }).selected ~= -1 then
return "\25"
end
return MiniPairs.cr()
end, { expr = true })
ai.setup({}) ai.setup({})
notify.setup({ notify.setup({