updated yazi conf. nvim completions and latex

This commit is contained in:
liph
2026-02-13 09:37:55 +01:00
parent 84b025eb0e
commit e6e444fff7
49 changed files with 1791 additions and 226 deletions

View File

@@ -6,6 +6,7 @@
],
"runtime.unicodeName": true,
"diagnostics.disable": [
"undefined-doc-name"
"undefined-doc-name",
"assign-type-mismatch"
]
}

View File

@@ -0,0 +1,89 @@
-- after/ftplugin/html.lua (or just :source % once)
local port = 8085
local root = vim.loop.cwd()
local job_id = nil
vim.api.nvim_create_user_command("Serve", function()
-- kill previous python instance
if job_id then
vim.fn.jobstop(job_id)
end
-- one-liner HTTP server + websocket broadcast
local script = ([[
import http.server, os, subprocess, threading, time, mimetypes, json
from http.server import HTTPServer, SimpleHTTPRequestHandler
import websockets, asyncio, pathlib
ROOT = %q
PORT = %d
clients = set()
class Handler(SimpleHTTPRequestHandler):
def log_message(self, fmt, *args): pass # shut up
def do_GET(self):
if self.path == '/':
self.path = '/index.html'
# inject tiny reload script into every HTML
if self.path.endswith('.html'):
ctype = 'text/html; charset=utf-8'
with open(os.path.join(ROOT, self.path.lstrip('/')), 'rb') as f:
content = f.read().decode()
inject = '<script>let ws=new WebSocket("ws://localhost:%d/ws");ws.onmessage=()=>location.reload()</script>'
content = content.replace('</body>', inject .. '</body>')
self.send_response(200)
self.send_header('Content-type', ctype)
self.end_headers()
self.wfile.write(content.encode())
else:
super().do_GET()
async def ws_handler(websocket):
clients.add(websocket)
try:
await websocket.wait_closed()
finally:
clients.remove(websocket)
async def websocket_main():
await websockets.serve(ws_handler, "localhost", %d, path="/ws")
def broadcast_reload():
for c in clients:
asyncio.run(c.send("reload"))
clients.clear()
def reload_loop():
while True:
time.sleep(0.05)
try:
subprocess.check_call(["inotifywait", "-e", "close_write", "-t", "0", ROOT],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
broadcast_reload()
except: pass # inotify not installed → noop (manual F5 still works)
def main():
threading.Thread(target=reload_loop, daemon=True).start()
asyncio.set_event_loop(asyncio.new_event_loop())
threading.Thread(target=lambda: asyncio.run(websocket_main()), daemon=True).start()
HTTPServer(("", PORT), Handler).serve_forever()
if __name__ == '__main__':
main()
]]):format(root, port, port, port)
job_id = vim.fn.jobstart({ "python", "-c", script }, { stdout_buffered = true })
vim.fn.jobstart({ "sleep", "0.2" }, {
on_exit = function()
vim.ui.open(("http://localhost:%d"):format(port))
end,
})
vim.notify("Serving → http://localhost:" .. port, vim.log.levels.INFO)
end, {})
vim.api.nvim_create_user_command("ServeStop", function()
if job_id then
vim.fn.jobstop(job_id)
job_id = nil
end
end, {})

View File

@@ -5,13 +5,13 @@ local function extract_email(address_string)
if email then
return email
end
-- Match standalone email: "email@example.com"
email = address_string:match("([%w%._%+-]+@[%w%._%+-]+)")
if email then
return email
end
-- Fallback: return as-is if no pattern matches
return address_string
end
@@ -21,14 +21,14 @@ function _G.mail_complete(findstart, base)
if findstart == 1 then
-- Find start of word
local line = vim.api.nvim_get_current_line()
local col = vim.fn.col('.')
local col = vim.fn.col(".")
local line_to_cursor = line:sub(1, col - 1)
-- Only on header lines
if not line_to_cursor:match("^%s*[ToCcBcFrom]+:%s*") then
return -1
end
-- Find start of current address
local start = line_to_cursor:reverse():find("[%s,]")
if start then
@@ -42,10 +42,10 @@ function _G.mail_complete(findstart, base)
if not handle then
return {}
end
local result = handle:read("*a")
handle:close()
local matches = {}
for address in result:gmatch("[^\r\n]+") do
if address ~= "" then
@@ -54,21 +54,21 @@ function _G.mail_complete(findstart, base)
table.insert(matches, clean_email)
end
end
return matches
end
end
-- Set omnifunc
vim.bo.omnifunc = 'v:lua.mail_complete'
vim.bo.omnifunc = "v:lua.mail_complete"
-- Map Tab to trigger completion on header lines
vim.keymap.set('i', '<Tab>', function()
vim.keymap.set("i", "<Tab>", function()
local line = vim.api.nvim_get_current_line()
if line:match("^%s*[ToCcBcFrom]+:%s*") then
return '<C-x><C-o>'
return "<C-x><C-o>"
else
return '<Tab>'
return "<Tab>"
end
end, { expr = true, buffer = true })
@@ -80,10 +80,10 @@ local function pick_email()
vim.notify("Could not query abook", vim.log.levels.ERROR)
return
end
local addresses = {}
local display_addresses = {}
for line in handle:lines() do
if line ~= "" then
local clean_email = extract_email(line)
@@ -93,12 +93,12 @@ local function pick_email()
end
end
handle:close()
if #addresses == 0 then
vim.notify("No addresses in abook", vim.log.levels.WARN)
return
end
-- Use vim.ui.select (works with fzf-lua if installed)
vim.ui.select(display_addresses, {
prompt = "Select recipient:",
@@ -114,15 +114,13 @@ local function pick_email()
local new_line = line:sub(1, col) .. email .. line:sub(col + 1)
vim.api.nvim_set_current_line(new_line)
-- Move cursor after inserted text
vim.api.nvim_win_set_cursor(0, {row, col + #email})
vim.api.nvim_win_set_cursor(0, { row, col + #email })
end
end)
end
-- Map Ctrl+f to pick email (Option 3)
vim.keymap.set('i', '<C-f>', pick_email, { buffer = true, desc = "Pick email address with fzf" })
vim.keymap.set("i", "<C-f>", pick_email, { buffer = true, desc = "Pick email address with fzf" })
-- Optional: Map Ctrl+a for Tab completion manually (in case Tab doesn't work)
vim.keymap.set('i', '<C-a>', '<C-x><C-o>', { buffer = true, desc = "Trigger address completion" })
```
im.keymap.set("i", "<C-a>", "<C-x><C-o>", { buffer = true, desc = "Trigger address completion" })
vim.keymap.set("i", "<C-a>", "<C-x><C-o>", { buffer = true, desc = "Trigger address completion" })

View File

@@ -1,7 +1,7 @@
{
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" },
"R.nvim": { "branch": "main", "commit": "80268b5a66ad48e308513cb0ebccc16d5e1e7d5a" },
"R.nvim": { "branch": "main", "commit": "659dc18aba2d2b799c04efbce66a15ea87bd6ec6" },
"barbecue": { "branch": "main", "commit": "cd7e7da622d68136e13721865b4d919efd6325ed" },
"catppuccin": { "branch": "main", "commit": "beaf41a30c26fd7d6c386d383155cbd65dd554cd" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
@@ -10,7 +10,8 @@
"cmp-nvim-lua": { "branch": "main", "commit": "e3a22cb071eb9d6508a156306b102c45cd2d573d" },
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
"cmp-r": { "branch": "main", "commit": "70bfe8f4c062acc10266e24825439c009a0b1b89" },
"cmp-tabnine": { "branch": "main", "commit": "c0167cdc86c15e782c5461ee62aebee89231c2ed" },
"cmp-vimtex": { "branch": "master", "commit": "5283bf9108ef33d41e704027b9ef22437ce7a15b" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"conform.nvim": { "branch": "master", "commit": "c2526f1cde528a66e086ab1668e996d162c75f4f" },
"dashboard-nvim": { "branch": "master", "commit": "0775e567b6c0be96d01a61795f7b64c1758262f6" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
@@ -19,14 +20,15 @@
"everforest": { "branch": "master", "commit": "b03a03148c8b34c24c96960b93da9c8883d11f54" },
"flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" },
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
"fzf-lua": { "branch": "main", "commit": "c86b72c62b01d2242cafa45fb0d1fc3bf66e6a2b" },
"gitsigns.nvim": { "branch": "main", "commit": "1ce96a464fdbc24208e24c117e2021794259005d" },
"fzf-lua": { "branch": "main", "commit": "fb8c50ba62a0daa433b7ac2b78834f318322b879" },
"gitsigns.nvim": { "branch": "main", "commit": "31217271a7314c343606acb4072a94a039a19fb5" },
"grapple.nvim": { "branch": "main", "commit": "b41ddfc1c39f87f3d1799b99c2f0f1daa524c5f7" },
"gruvbox-mat": { "branch": "master", "commit": "790afe9dd085aa04eccd1da3626c5fa05c620e53" },
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
"kanagawa.nvim": { "branch": "master", "commit": "aef7f5cec0a40dbe7f3304214850c472e2264b10" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" },
"live-preview.nvim": { "branch": "main", "commit": "f056b4b859d54595afce53e67129f7684380d3ba" },
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
"luvit-meta": { "branch": "main", "commit": "0ea4ff636c5bb559ffa78108561d0976f4de9682" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "ae609525ddf01c153c39305730b1791800ffe4fe" },
@@ -41,20 +43,22 @@
"nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-lint": { "branch": "master", "commit": "bcd1a44edbea8cd473af7e7582d3f7ffc60d8e81" },
"nvim-lspconfig": { "branch": "master", "commit": "0480b120318ec8bab27b530ffab6ee76a8c4d806" },
"nvim-lspconfig": { "branch": "master", "commit": "f4e9d367d4e067d7a5fabc9fd3f1349b291eb718" },
"nvim-navic": { "branch": "master", "commit": "f5eba192f39b453675d115351808bd51276d9de5" },
"nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" },
"nvim-spectre": { "branch": "master", "commit": "72f56f7585903cd7bf92c665351aa585e150af0f" },
"nvim-surround": { "branch": "main", "commit": "1098d7b3c34adcfa7feb3289ee434529abd4afd1" },
"nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" },
"nvim-treesitter": { "branch": "main", "commit": "70a9fecaf5aeae70c765d4c51a8038165a91aa06" },
"nvim-treesitter": { "branch": "main", "commit": "9f2dad22ef8bb14fd1e0a3aa8859cdc88170668b" },
"nvim-treesitter-textobjects": { "branch": "main", "commit": "a0e182ae21fda68c59d1f36c9ed45600aef50311" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
"nvim-ufo": { "branch": "main", "commit": "ab3eb124062422d276fae49e0dd63b3ad1062cfc" },
"nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" },
"obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" },
"onedark-warm": { "branch": "master", "commit": "213c23ae45a04797572242568d5d51937181792d" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"portal.nvim": { "branch": "main", "commit": "77d9d53fec945bfa407d5fd7120f1b4f117450ed" },
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "d6b802552cbe7d643a3b6b31f419c248d1f1e220" },
"render-markdown.nvim": { "branch": "main", "commit": "48b4175dbca8439d30c1f52231cbe5a712c8f9d9" },
"rose-pine": { "branch": "main", "commit": "cf2a288696b03d0934da713d66c6d71557b5c997" },
@@ -62,9 +66,11 @@
"sonokai": { "branch": "master", "commit": "b023c5280b16fe2366f5e779d8d2756b3e5ee9c3" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "ad7d9580338354ccc136e5b8f0aa4f880434dcdc" },
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
"toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" },
"tokyonight": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" },
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
"vimtex": { "branch": "master", "commit": "f707368022cdb851716be0d2970b90599c84a6a6" },
"vimtex": { "branch": "master", "commit": "95b93a24740f7b89dd8331326b41bdd1337d79f6" },
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" },
"yazi.nvim": { "branch": "main", "commit": "b3df5d00bbf5cd862b853993135598f12b2eb3b5" }
"yazi.nvim": { "branch": "main", "commit": "a3fe7b5855254974837c23c915865478b0d54534" }
}

View File

@@ -0,0 +1,65 @@
-- completions.lua: Provides intelligent code completion via LSP or snippet engines.
-- completion.lua (nvim-cmp + LuaSnip)
return {
------------------------------------------------------------------
-- 1. Snippet engine & pre-made snippets
------------------------------------------------------------------
{
"L3MON4D3/LuaSnip",
version = "v2.*",
build = "make install_jsregexp",
dependencies = { "rafamadriz/friendly-snippets" },
},
------------------------------------------------------------------
-- 2. Core completion engine + standard sources
------------------------------------------------------------------
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lua",
"micangl/cmp-vimtex",
},
------------------------------------------------------------------
-- 3. nvim-cmp setup
------------------------------------------------------------------
config = function()
local cmp = require("cmp")
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<Tab>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
["<S-Tab>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<C-e>"] = cmp.mapping.abort(),
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
}),
sources = cmp.config.sources({
{ name = "vimtex" },
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "nvim_lua" },
}, {
{ name = "buffer" },
{ name = "path" },
}),
})
-- cmd-line completion
cmp.setup.cmdline({ "/", "?" }, { sources = { { name = "buffer" } } })
cmp.setup.cmdline(":", { sources = cmp.config.sources({ { name = "path" } }, { { name = "cmdline" } }) })
end,
},
}

View File

@@ -0,0 +1,92 @@
-- lua/plugins/dap.lua
return {
{ "mfussenegger/nvim-dap" }, -- core debugger client
{ "rcarriga/nvim-dap-ui", dependencies = { "mfussenegger/nvim-dap" } },
-- Adapter bridge (Mason downloads the compiled server for us)
{
"mxsdev/nvim-dap-vscode-js",
dependencies = { "mfussenegger/nvim-dap" },
config = function()
local mason_js = vim.fn.stdpath "data"
.. "/mason/packages/js-debug-adapter" -- Mason path
require("dap-vscode-js").setup {
node_path = "node", -- node binary
debugger_path = mason_js, -- root dir of js-debug
adapters = { "pwa-node","pwa-chrome","pwa-msedge","node-terminal" }
}
end
},
-- Ensure js-debug-adapter is present (Mason does the download)
{
"williamboman/mason.nvim",
cmd = { "Mason" },
config = true,
},
{
"williamboman/mason-lspconfig.nvim", -- pull Mason registry
opts = function(_, o)
o.ensure_installed = o.ensure_installed or {}
vim.list_extend(o.ensure_installed, { "js-debug-adapter" })
end
},
-- Optional key-maps (adapt to your taste)
{
"mfussenegger/nvim-dap",
keys = {
{ "<F5>", function() require("dap").continue() end, desc="Start / Continue" },
{ "<F9>", function() require("dap").toggle_breakpoint() end, desc="Toggle BP" },
{ "<F10>", function() require("dap").step_over() end, desc="Step over" },
{ "<F11>", function() require("dap").step_into() end, desc="Step into" },
{ "<S-F11>",function() require("dap").step_out() end, desc="Step out" },
}
},
-- Debugger UI (optional)
{
"rcarriga/nvim-dap-ui",
opts = {},
keys = {
{ "<leader>du", function() require("dapui").toggle() end, desc="Dap-UI" },
}
}
}
-- -------------------------------------------------------------
-- Launch / attach configurations
-- -------------------------------------------------------------
local dap = require "dap"
dap.configurations.javascript = {
-- 1. Run current file with node
{
name = "Launch Node file",
type = "pwa-node",
request = "launch",
program = "${file}",
cwd = "${workspaceFolder}",
stopOnEntry = false,
},
-- 2. Attach to an existing node process (started with --inspect)
{
name = "Attach to node process",
type = "pwa-node",
request = "attach",
processId = require("dap.utils").pick_process
},
-- 3. Launch Chrome and attach to page
{
name = "Launch Chrome & attach",
type = "pwa-chrome",
request = "launch",
url = "http://localhost:8080",
webRoot = "${workspaceFolder}",
userDataDir = false -- reuse your normal profile
}
}
-- share same configs for TS
dap.configurations.typescript = dap.configurations.javascript
dap.configurations.typescriptreact = dap.configurations.javascript

View File

@@ -0,0 +1,71 @@
return {
"olimorris/emmet-ls",
ft = {
"html",
"htm",
"css",
"scss",
"sass",
"less",
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"svelte",
"php",
"xml",
"xsl",
},
config = function()
-- Enable snippet support
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
-- Set up emmet-ls using the new method
vim.api.nvim_create_autocmd("FileType", {
pattern = {
"html",
"htm",
"css",
"scss",
"sass",
"less",
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"svelte",
"php",
"xml",
"xsl",
},
callback = function(args)
vim.lsp.start({
name = "emmet-ls",
cmd = { "emmet-ls", "--stdio" },
root_dir = vim.fs.dirname(vim.fs.find({ ".git" }, { upward = true })[1]),
capabilities = capabilities,
filetypes = {
"html",
"htm",
"css",
"scss",
"sass",
"less",
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"svelte",
"php",
"xml",
"xsl",
},
})
end,
})
end,
}

View File

@@ -0,0 +1,17 @@
-- noice.lua: Replaces default UI messages with polished, keyboard-friendly notifications.
return { -- lazy.nvim
{
"folke/noice.nvim",
event = "VeryLazy",
opts = {},
dependencies = {
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
"MunifTanjim/nui.nvim",
-- OPTIONAL:
-- `nvim-notify` is only needed, if you want to use the notification view.
-- If not available, we use `mini` as the fallback
"rcarriga/nvim-notify",
},
},
}

View File

@@ -1,3 +1,4 @@
-- ~/.config/nvim/lua/plugins/nvim-ufo.lua
return {
"kevinhwang91/nvim-ufo",
dependencies = "kevinhwang91/promise-async",
@@ -26,13 +27,14 @@ return {
},
},
config = function()
local ufo = require("ufo")
ufo.setup({
provider_selector = function(bufnr, filetype, buftype)
-- prefer LSP, fall back to treesitter
return { "lsp", "treesitter" }
require("ufo").setup({
provider_selector = function(_, filetype)
-- File-types that constantly throw UfoFallbackException → skip TS
local noisy = { "html", "css", "json", "yaml", "txt", "md" }
if vim.tbl_contains(noisy, filetype) then
return { "lsp", "indent" } -- 2 providers max → no warning
end
end,
fold_virt_text_handler = ufo.handler, -- default virtual text
})
end,
}

View File

@@ -0,0 +1,88 @@
-- vimtex.lua: Full LaTeX editing support (compiling, viewing, and syntax).
return {
"lervag/vimtex",
ft = "tex",
config = function()
-- PDF viewer
vim.g.vimtex_view_method = "zathura"
-- Compiler settings
vim.g.vimtex_compiler_latexmk = {
continuous = 1,
callback = 1,
options = {
"-pdf",
"-shell-escape",
"-verbose",
"-file-line-error",
"-synctex=1",
"-interaction=nonstopmode",
},
}
-- Concealment (makes LaTeX prettier to read)
vim.g.vimtex_syntax_conceal = {
accents = 1,
math_symbols = 1,
math_fracs = 1,
math_super_sub = 1,
}
vim.g.vimtex_toc_config = {
name = "TOC",
layers = { "content", "todo", "include" },
split_width = 25,
todo_sorted = 0,
show_help = 1,
show_numbers = 1,
}
-- Don't open quickfix window automatically
vim.g.vimtex_quickfix_mode = 0
-- kenable folding
vim.g.vimtex_fold_enabled = 1
-- What to fold (customize as needed)
vim.g.vimtex_fold_types = {
envs = {
enabled = 1,
whitelist = {}, -- Empty = all environments
blacklist = {},
},
sections = {
enabled = 1,
sections = {
"%(add)?part",
"%(chapter|%(sub)*section|%(sub)?paragraph)",
"appendix",
},
},
items = {
enabled = 0, -- Don't fold individual list items
},
}
-- Disable some features for better performance (optional)
vim.g.vimtex_indent_enabled = 1
vim.g.vimtex_syntax_enabled = 1
vim.g.vimtex_syntax_conceal = {
accents = 1,
ligatures = 1,
cites = 1,
fancy = 1,
spacing = 1,
greek = 1,
math_bounds = 1,
math_delimiters = 1,
math_fracs = 1,
math_super_sub = 1,
math_symbols = 1,
sections = 0,
styles = 1,
}
vim.opt.conceallevel = 2
end,
}

View File

@@ -1,5 +1,6 @@
-- completions.lua: Provides intelligent code completion via LSP or snippet engines.
-- completion.lua (nvim-cmp + LuaSnip)
return {
------------------------------------------------------------------
-- 1. Snippet engine & pre-made snippets
@@ -9,8 +10,14 @@ return {
version = "v2.*",
build = "make install_jsregexp",
dependencies = { "rafamadriz/friendly-snippets" },
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_lua").load({
paths = { vim.fn.stdpath("config") .. "/snippets" },
})
end,
},
------------------------------------------------------------------
--------------------------------------------------------------
-- 2. Core completion engine + standard sources
------------------------------------------------------------------
{
@@ -21,43 +28,59 @@ return {
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lua",
"micangl/cmp-vimtex",
"saadparwaiz1/cmp_luasnip",
},
------------------------------------------------------------------
-- 3. nvim-cmp setup
------------------------------------------------------------------
config = function()
local cmp = require("cmp")
require("luasnip.loaders.from_vscode").lazy_load()
local luasnip = require("luasnip")
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
luasnip.lsp_expand(args.body) -- Correctly calls LuaSnip [3]
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<Tab>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
["<S-Tab>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<C-e>"] = cmp.mapping.abort(),
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
-- Fix: Tab now handles expansion and jumping
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "nvim_lua" },
{ name = "luasnip", priority = 1000 }, -- Priority 2: Standard Snippets
{ name = "nvim_lsp", priority = 750 }, -- Priority 1: LSP (Snippets)
{ name = "vimtex", priority = 500 }, -- Priority 3: Vimtex (Text/Commands)
{ name = "nvim_lua", priority = 250 },
}, {
{ name = "buffer" },
{ name = "path" },
}),
})
-- cmd-line completion
cmp.setup.cmdline({ "/", "?" }, { sources = { { name = "buffer" } } })
cmp.setup.cmdline(":", { sources = cmp.config.sources({ { name = "path" } }, { { name = "cmdline" } }) })
end,
},
}

View File

@@ -77,15 +77,15 @@ return {
key_hl = "Number",
action = "ObsidianQuickSwitch",
},
-- {
-- icon = " ",
-- icon_hl = "Title",
-- desc = "Projects (SPC fp) ", -- Note: shows keymap
-- desc_hl = "String",
-- key = "p",
-- key_hl = "Number",
-- action = "Telescope projections", -- Will lazy-load when pressed
-- },
{
icon = " ",
icon_hl = "Title",
desc = "Projects (SPC fp) ", -- Note: shows keymap
desc_hl = "String",
key = "p",
key_hl = "Number",
action = "Telescope projections", -- Will lazy-load when pressed
},
{
icon = " ",
icon_hl = "Title",

View File

@@ -0,0 +1,26 @@
-- ~/.config/nvim/lua/plugins/live-preview.lua
return {
"brianhuster/live-preview.nvim",
dev = false,
cmd = { "LivePreview", "LivePreviewStop" },
keys = {
{ "<leader>lp", "<cmd>LivePreview<CR>", desc = "Start live HTML preview" },
},
config = function()
require("live-preview").setup({
port = 3027, -- local server port
browser = "default", -- system browser
dynamic_root = true, -- serve from the project root
autokill = false, -- keep server alive when you leave nvim
})
-- (optional) auto-save on change so the browser refreshes
vim.o.autowriteall = true
vim.api.nvim_create_autocmd({ "InsertLeavePre", "TextChanged" }, {
pattern = "*.{html,htm,css,js,md}",
callback = function()
vim.cmd("silent! write")
end,
})
end,
}

View File

@@ -95,7 +95,7 @@ return {
language = "en-US",
enabled = { "latex", "tex", "bib", "markdown", "mail", "text" },
checkFrequency = "save", -- Only check when you save, not on every keystroke
diagnosticSeverity = "hint", -- Less intrusive
diagnosticSeverity = "warning", -- Less intrusive
completionEnabled = true,
additionalRules = {
enablePickyRules = true,

View File

@@ -15,6 +15,7 @@ return {
ensure_installed = {
"lua_ls",
"pyright",
"emmet_ls",
"bashls",
"ts_ls",
"solargraph",

View File

@@ -1,18 +1,32 @@
-- noice.lua: Replaces default UI messages with polished, keyboard-friendly notifications.
return { -- lazy.nvim
return {
{
"folke/noice.nvim",
event = "VeryLazy",
opts = {
-- add any options here
cmdline = {
view = "cmdline_popup",
opts = { border = { style = "rounded", padding = { 0, 1 } } },
},
messages = {
view = "notify",
view_opts = { border = { style = "rounded", padding = { 0, 1 } } },
},
popupmenu = {
backend = "nui",
nui = { border = { style = "rounded", padding = { 0, 1 } } },
},
lsp = {
hover = { opts = { border = { style = "rounded", padding = { 0, 1 } } } },
signature = { opts = { border = { style = "rounded", padding = { 0, 1 } } } },
},
presets = {
lsp_doc_border = true, -- adds border to hover/signature automatically
},
},
dependencies = {
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
"MunifTanjim/nui.nvim",
-- OPTIONAL:
-- `nvim-notify` is only needed, if you want to use the notification view.
-- If not available, we use `mini` as the fallback
"rcarriga/nvim-notify",
},
},

View File

@@ -12,8 +12,8 @@ return {
opts = {
workspaces = {
{
name = "personal",
path = "/mnt/flash1/podman/nextcloud/config/obsidian/vaults/Phil/",
name = "liph",
path = "/mnt/flash1/podman/nextcloud/config/obsidian/vaults",
},
},

View File

@@ -0,0 +1,68 @@
return {
"folke/todo-comments.nvim",
event = "VeryLazy", -- start only after UI is ready
dependencies = { "nvim-lua/plenary.nvim" },
opts = {
signs = true, -- show icons in the sign column
sign_priority = 10,
keywords = {
FIX = { icon = "", color = "error", alt = { "FIXME", "BUG", "FIXIT", "ISSUE" } },
TODO = { icon = "", color = "info", alt = { "todo" } },
HACK = { icon = "", color = "warning", alt = { "hack" } },
WARN = { icon = "", color = "warning", alt = { "WARNING", "XXX" } },
PERF = { icon = "", color = "#e6645a", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
NOTE = { icon = "", color = "hint", alt = { "INFO", "NOTE" } },
TEST = { icon = "", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
},
merge_keywords = true, -- merge with default list above
highlight = {
before = "", -- "fg" or "bg" or ""
keyword = "wide", -- "fg", "bg", "wide" or ""
after = "fg", -- "fg" or "bg" or ""
pattern = [[.*<(KEYWORDS)\s*:]],
comments_only = true, -- highlight only inside comments
max_line_len = 400,
exclude = {}, -- list of filetypes to exclude
},
colors = {
error = { "DiagnosticError", "#e6645a" },
warning = { "DiagnosticWarn", "#ff9e64" },
info = { "DiagnosticInfo", "#7aa2f7" },
hint = { "DiagnosticHint", "#9ece6a" },
test = { "#d4ae5b" },
},
search = {
command = "rg",
args = {
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
},
pattern = [[\b(KEYWORDS):]], -- ripgrep regex
},
},
keys = {
-- navigation between todo-comments
{
"]t",
function()
require("todo-comments").jump_next()
end,
desc = "Next todo comment",
},
{
"[t",
function()
require("todo-comments").jump_prev()
end,
desc = "Previous todo comment",
},
-- telescope / fzf-lua live search
{ "<leader>st", "<cmd>TodoTelescope<CR>", desc = "Todo comments (Telescope)" },
{ "<leader>sT", "<cmd>TodoFzfLua<CR>", desc = "Todo comments (FzfLua)" },
-- Trouble.nvim integration
{ "<leader>xt", "<cmd>TodoTrouble<CR>", desc = "Todo comments (Trouble)" },
},
}

View File

@@ -0,0 +1,59 @@
return {
"akinsho/toggleterm.nvim",
version = "*",
cmd = { "ToggleTerm", "TermExec" },
keys = {
-- normal terminal (horizontal split)
{ "<C-t>", "<cmd>ToggleTerm direction=horizontal<CR>", desc = "Toggle horizontal terminal" },
-- floating terminal
{ "<C-f>", "<cmd>ToggleTerm direction=float<CR>", desc = "Toggle floating terminal" },
-- vertical terminal
{ "<leader>tv", "<cmd>ToggleTerm direction=vertical size=60<CR>", desc = "Toggle vertical terminal" },
},
opts = {
size = function(term)
if term.direction == "horizontal" then
return 15
elseif term.direction == "vertical" then
return vim.o.columns * 0.4
end
end,
open_mapping = [[<C-t>]],
shading_factor = 2,
direction = "horizontal",
float_opts = {
border = "rounded",
width = math.floor(vim.o.columns * 0.9),
height = math.floor(vim.o.lines * 0.9),
winblend = 0,
},
highlights = {
FloatBorder = { link = "FloatBorder" },
},
persist_size = true,
persist_mode = true,
shell = vim.o.shell,
auto_scroll = true,
close_on_exit = true,
},
config = function(_, opts)
require("toggleterm").setup(opts)
-- send escape to leave terminal mode
vim.keymap.set("t", "<Esc>", [[<C-\><C-n>]])
-- quick access to lazygit (requires lazygit binary)
vim.keymap.set("n", "<leader>gg", function()
local Terminal = require("toggleterm.terminal").Terminal
local lazygit = Terminal:new({
cmd = "lazygit",
direction = "float",
hidden = true,
on_open = function(t)
vim.api.nvim_buf_set_keymap(t.bufnr, "t", "<Esc>", [[<C-\><C-n>]], { noremap = true, silent = true })
end,
})
lazygit:toggle()
end, { desc = "LazyGit floating window" })
end,
}

View File

@@ -0,0 +1,61 @@
return {
"kevinhwang91/nvim-ufo",
dependencies = "kevinhwang91/promise-async",
event = { "BufReadPost", "BufNewFile" },
keys = {
{
"zR",
function()
require("ufo").openAllFolds()
end,
desc = "Ufo: open all folds",
},
{
"zM",
function()
require("ufo").closeAllFolds()
end,
desc = "Ufo: close all folds",
},
{
"zr",
function()
require("ufo").openFoldsExceptKinds()
end,
desc = "Ufo: open outer folds",
},
------------------------------------------------------------------
-- 1. Close everything *outside* the current fold hierarchy
------------------------------------------------------------------
{
"zX",
function()
require("ufo").closeAllFolds() -- close every fold
vim.cmd("normal! l") -- ONE right press
vim.cmd("normal! zo") -- open fold under cursor
vim.cmd("normal! zz") -- keep it centred
end,
desc = "Close folds outside current (+1 right)",
},
------------------------------------------------------------------
-- 3. helpers you already had
------------------------------------------------------------------
{ "zt", "za", desc = "Toggle fold under cursor" },
},
config = function()
require("ufo").setup({
foldlevel = 99,
foldlevelstart = 99,
provider_selector = function(_, ft)
-- Silence the fallback spam by skipping Treesitter for noisy types
local noisy = { "html", "css", "json", "yaml", "txt", "markdown", "zsh" }
if vim.tbl_contains(noisy, ft) then
return { "lsp", "indent" } -- max 2 providers
end
return { "lsp" }
end,
})
end,
}

View File

@@ -6,7 +6,6 @@ return {
config = function()
-- PDF viewer
vim.g.vimtex_view_method = "zathura"
-- Compiler settings
vim.g.vimtex_compiler_latexmk = {
continuous = 1,
@@ -27,7 +26,6 @@ return {
math_fracs = 1,
math_super_sub = 1,
}
vim.g.vimtex_toc_config = {
name = "TOC",
layers = { "content", "todo", "include" },
@@ -36,13 +34,10 @@ return {
show_help = 1,
show_numbers = 1,
}
-- Don't open quickfix window automatically
vim.g.vimtex_quickfix_mode = 0
-- kenable folding
-- Enable folding
vim.g.vimtex_fold_enabled = 1
-- What to fold (customize as needed)
vim.g.vimtex_fold_types = {
envs = {
@@ -62,11 +57,11 @@ return {
enabled = 0, -- Don't fold individual list items
},
}
-- Disable some features for better performance (optional)
vim.g.vimtex_indent_enabled = 1
vim.g.vimtex_syntax_enabled = 1
-- Enhanced concealment settings - ADD THESE OPTIONS
vim.g.vimtex_syntax_conceal = {
accents = 1,
ligatures = 1,
@@ -83,6 +78,44 @@ return {
styles = 1,
}
-- Set conceal level (2 = moderate concealment)
vim.opt.conceallevel = 2
-- KEYBINDS FOR UNFOLDING AND CONCEALMENT TOGGLE
vim.api.nvim_create_autocmd("FileType", {
pattern = "tex",
callback = function()
-- Toggle all folds open/close
vim.keymap.set("n", "<leader>fo", "zR", { buffer = true, desc = "Open all folds" })
vim.keymap.set("n", "<leader>fc", "zM", { buffer = true, desc = "Close all folds" })
-- Toggle concealment (show/hide LaTeX commands)
vim.keymap.set("n", "<leader>tc", function()
if vim.opt.conceallevel:get() == 0 then
vim.opt.conceallevel = 2
print("Concealment enabled")
else
vim.opt.conceallevel = 0
print("Concealment disabled")
end
end, { buffer = true, desc = "Toggle concealment" })
-- Alternative: Quick toggle for specific vimtex concealment
vim.keymap.set("n", "<leader>tv", function()
if vim.g.vimtex_syntax_conceal_enabled == 1 then
vim.g.vimtex_syntax_conceal_enabled = 0
print("VimTeX concealment disabled")
else
vim.g.vimtex_syntax_conceal_enabled = 1
print("VimTeX concealment enabled")
end
end, { buffer = true, desc = "Toggle vimtex conceal" })
end,
})
-- -- You can also add global keybinds if preferred
-- vim.keymap.set("n", "<leader>lt", "<cmd>VimtexTocToggle<cr>", { desc = "LaTeX TOC" })
-- vim.keymap.set("n", "<leader>lc", "<cmd>VimtexCompile<cr>", { desc = "LaTeX compile" })
-- vim.keymap.set("n", "<leader>lv", "<cmd>VimtexView<cr>", { desc = "LaTeX view" })
end,
}

View File

@@ -0,0 +1,70 @@
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
local fmt = require("luasnip.extras.fmt").fmt
ls.add_snippets("tex", {
-- \beg → full figure environment
s(
"beg",
fmt(
[[
\begin{{{}}}{}
{}
\end{{{}}}]],
{
i(1, "environment"),
i(2, ""),
i(3, ""),
-- mirror node 1 so \end matches \begin automatically
require("luasnip.extras").rep(1),
}
)
),
-- fig → full figure block
s(
"fig",
fmt(
[[
\begin{{figure}}[htbp]
\centering
\includegraphics[width={}]{{{}}
\caption{{{}}}
\label{{fig:{}}}
\end{{figure}}]],
{
i(1, "0.8\\textwidth"),
i(2, "file"),
i(3, "caption"),
i(4, "label"),
}
)
),
-- eq → equation
s(
"eq",
fmt(
[[
\begin{{equation}}
{}
\end{{equation}}]],
{ i(1, "") }
)
),
-- ali → align
s(
"ali",
fmt(
[[
\begin{{align}}
{} &= {} \\
\end{{align}}]],
{ i(1, ""), i(2, "") }
)
),
})

View File

@@ -17,6 +17,32 @@ vim.keymap.set("n", "<c-l>", ":wincmd l<CR>")
vim.keymap.set("n", "<leader>h", ":nohlsearch<CR>")
vim.wo.number = true
-- In your keybindings file
vim.keymap.set("n", "<leader>lc", ":!pdflatex %<CR>", { desc = "Compile LaTeX" })
vim.keymap.set("n", "<leader>lv", ":!zathura %:r.pdf &<CR>", { desc = "View PDF" })
-- latex pdf compile and live preview
-- vimtex already provides these — just map them to your preferred keys
vim.keymap.set("n", "<leader>lc", "<cmd>VimtexCompile<CR>", { desc = "Compile LaTeX (toggle)" })
vim.keymap.set("n", "<leader>lv", "<cmd>VimtexView<CR>", { desc = "View PDF in Zathura" })
vim.keymap.set("n", "<leader>le", "<cmd>VimtexErrors<CR>", { desc = "Show errors" })
vim.keymap.set("n", "<leader>lk", "<cmd>VimtexStop<CR>", { desc = "Stop compiler" })
vim.keymap.set("n", "<leader>lK", "<cmd>VimtexStopAll<CR>", { desc = "Stop all compilers" })
vim.keymap.set("n", "<leader>lx", "<cmd>VimtexClean<CR>", { desc = "Clean aux files" })
vim.keymap.set("n", "<leader>lt", "<cmd>VimtexTocToggle<CR>", { desc = "Toggle TOC" })
-- vim.keymap.set("n", "<leader>lc", ":!pdflatex %<CR>", { desc = "Compile LaTeX" })
-- vim.keymap.set("n", "<leader>lv", ":!zathura %:r.pdf &<CR>", { desc = "View PDF" })
-- vim.g.vimtex_fold_enabled = 1
-- vim.g.vimtex_fold_types = {
-- sections = {
-- parse_levels = 1,
-- sections = { "section", "subsection", "subsubsection" },
-- },
-- envs = {
-- blacklist = { "document" },
-- },
-- }
-- -- vimtex knows these environment names and will expand them fully
-- vim.g.vimtex_complete_enabled = 1
-- vim.g.vimtex_complete_close_braces = 1
vim.o.foldcolumn = "1" -- small gutter with +/- signs
vim.o.foldlevel = 99 -- start with all folds open
vim.o.foldlevelstart = 99
vim.o.foldtext = "" -- use default line