This commit is contained in:
Manuel
2025-08-25 19:49:05 +02:00
parent aed2435b50
commit f916d78fc2
4 changed files with 114 additions and 9 deletions

View File

@@ -77,3 +77,7 @@ end
-- Load custom configurations
local exist, custom = pcall(require, "custom")
if exist and type(custom) == "table" and custom.configs then custom.configs() end
vim.opt.linebreak = true
vim.opt.breakat = " \t"

View File

@@ -5,10 +5,10 @@
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"conform.nvim": { "branch": "master", "commit": "3543d000dafbc41cc7761d860cfdb24e82154f75" },
"conform.nvim": { "branch": "master", "commit": "a0ab60ed666c56b37fd7ed1847d2ac52f2482ce0" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" },
"image.nvim": { "branch": "master", "commit": "5cbb891eb8dde53f350dde69e23106d4e85d898b" },
"image.nvim": { "branch": "master", "commit": "0650f44d8a21bc2f4db2f2f514a3d026772ee10c" },
"jupytext.nvim": { "branch": "master", "commit": "2e86acfa4345f611c86f57116db0c06ffecb721d" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
@@ -17,21 +17,22 @@
"mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" },
"molten-nvim": { "branch": "main", "commit": "4e1c9997cb53b9d3236c5d6462d80119250ed5b7" },
"none-ls-extras.nvim": { "branch": "main", "commit": "924fe88a9983c7d90dbb31fc4e3129a583ea0a90" },
"none-ls.nvim": { "branch": "main", "commit": "5fcb73913a9290f78097e34420fe0e6130c5c33c" },
"none-ls.nvim": { "branch": "main", "commit": "53ec77181d96494b9dc9457110dd62dc623cc78d" },
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-conda": { "branch": "main", "commit": "7e63124d98f48a3bb255eaa71d1602db610b9047" },
"nvim-lspconfig": { "branch": "master", "commit": "1c505a2a37c7732fb2a7e290c0f822abfb2ba1c5" },
"nvim-tree.lua": { "branch": "master", "commit": "b70a741f5a29a1d2baa3bbe7e5c0a4a5d6423849" },
"nvim-lspconfig": { "branch": "master", "commit": "e844850b3143a1627437f811549fc7d70cfedf05" },
"nvim-tree.lua": { "branch": "master", "commit": "fefa335f1c8f690eb668a1efd18ee4fc6d64cd3e" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-web-devicons": { "branch": "master", "commit": "c2599a81ecabaae07c49ff9b45dcd032a8d90f1a" },
"nvim-web-devicons": { "branch": "master", "commit": "81b37d7937953b50e5fd8d9d7dfe2c6d0088fde1" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"rose-pine": { "branch": "main", "commit": "72befaffeac38db7bdd49e0549eaa2c4806dd878" },
"rose-pine": { "branch": "main", "commit": "72a04c4065345b51b56aed4859ea1d884f734097" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
"transparent.nvim": { "branch": "main", "commit": "8ac59883de84e9cd1850ea25cf087031c5ba7d54" },
"vim-tidal": { "branch": "master", "commit": "e440fe5bdfe07f805e21e6872099685d38e8b761" },
"vimtex": { "branch": "master", "commit": "c74d9927d9ac2fd24f965634ab56fc5d3c0a60a7" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
"vimtex": { "branch": "master", "commit": "dc90feacb86f7b85b0b791d8073eefc769a23725" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" },
"zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" }
}

View File

@@ -83,3 +83,72 @@ map("n", "tt", function()
local height = math.floor(vim.o.lines / 2)
cmd("belowright split | resize " .. height .. " | terminal")
end, { noremap = true, silent = true })
-- toggle-cmp.lua
local ok, cmp = pcall(require, "cmp")
if not ok then return end
-- initial state (true = autocomplete on)
vim.g.cmp_autocomplete = vim.g.cmp_autocomplete == nil and true or vim.g.cmp_autocomplete
function _G.toggle_cmp_autocomplete()
vim.g.cmp_autocomplete = not vim.g.cmp_autocomplete
if vim.g.cmp_autocomplete then
-- enable automatic completion
cmp.setup {
completion = {
-- typical events to auto-open completion
autocomplete = { cmp.TriggerEvent.TextChanged, cmp.TriggerEvent.InsertEnter }
}
}
print("cmp autocomplete: ON")
else
-- disable automatic completion and close any open menu
cmp.setup { completion = { autocomplete = false } }
pcall(cmp.close)
print("cmp autocomplete: OFF")
end
end
-- mappings
vim.keymap.set("n", "<leader>cc", "<cmd>lua _G.toggle_cmp_autocomplete()<CR>", { noremap = true, silent = true })
vim.keymap.set("i", "<C-\\>", function() _G.toggle_cmp_autocomplete() end, { silent = true })
-- manual trigger (still works when autocomplete is off)
vim.keymap.set("i", "<C-Space>", function() require("cmp").complete() end, { silent = true })
-- quick hide/abort in insert
vim.keymap.set("i", "<C-e>", function() require("cmp").abort() end, { silent = true })
-- zen-mode max-width helper
local M = {}
-- configuration: change these to taste
M.zen_ratio = 0.80 -- try to use 80% of the editor width
M.zen_max = 90 -- but never wider than 100 columns
M.zen_min = 60 -- optional: never narrower than 60 columns
function M.open_zen_with_max()
local cols = vim.o.columns or vim.api.nvim_get_option('columns')
local desired = math.floor(cols * M.zen_ratio)
-- clamp between min and max (optional min)
local width = math.max(M.zen_min, math.min(desired, M.zen_max))
require("zen-mode").toggle({
window = {
width = width,
-- keep your usual window options if you like
options = {
number = false,
relativenumber = false,
},
},
})
end
-- map keys (change mapping as you prefer)
vim.keymap.set("n", "<leader>z", function() M.open_zen_with_max() end, { noremap = true, silent = true })
return M

View File

@@ -187,6 +187,7 @@ local builtin_plugins = {
{ 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' },
{ 'nvim-telescope/telescope.nvim', dependencies = { 'nvim-lua/plenary.nvim' } },
{ 'neovim/nvim-lspconfig' },
{ 'folke/zen-mode.nvim' },
@@ -314,3 +315,33 @@ cmp.setup({
['<CR>'] = require('cmp').mapping.confirm({ select = true }),
})
})
-- zen-mode max-width helper
local M = {}
-- configuration: change these to taste
M.zen_ratio = 0.90 -- try to use 80% of the editor width
M.zen_max = 100 -- but never wider than 100 columns
M.zen_min = 60 -- optional: never narrower than 60 columns
function M.open_zen_with_max()
local cols = vim.o.columns or vim.api.nvim_get_option('columns')
local desired = math.floor(cols * M.zen_ratio)
-- clamp between min and max (optional min)
local width = math.max(M.zen_min, math.min(desired, M.zen_max))
require("zen-mode").toggle({
window = {
width = width,
-- keep your usual window options if you like
options = {
number = false,
relativenumber = false,
},
},
})
end
-- map keys (change mapping as you prefer)
vim.keymap.set("n", "<leader>z", function() M.open_zen_with_max() end, { noremap = true, silent = true })