config.nvim

NeoVim config
git clone git://popovic.xyz/nvim.config.git/
Log | Files | Refs

commit 678c7992ad31174a825c896cd724b3a6c155a87c
parent 59b8bcec9126fd8a0ca62aecb2c40dcf90175793
Author: Milutin Popovic <milutin@popovic.xyz>
Date:   Tue, 21 Apr 2026 15:25:38 +0100

telescope bad files + tex formating

Diffstat:
Mlua/plugins/lsp.lua | 6++++++
Mlua/plugins/telescope.lua | 43+++++++++++++++++--------------------------
2 files changed, 23 insertions(+), 26 deletions(-)

diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua @@ -53,6 +53,11 @@ return { lspconfig.util.default_config.capabilities = capabilities require("conform").setup({ + formatters = { + latexindent = { + prepend_args = { "-y=defaultIndent:' '" }, + }, + }, formatters_by_ft = { javascript = { "prettier" }, javascriptreact = { "prettier" }, @@ -72,6 +77,7 @@ return { svelte = { "prettier" }, astro = { "prettier" }, rust = { "rustfmt" }, + tex = { "latexindent" }, }, format_on_save = false, }) diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua @@ -9,30 +9,36 @@ return { config = function() local previewers = require("telescope.previewers") - local _bad = { ".*%.tex", ".*%.md", ".*%.html" } - local bad_files = function(filepath) - for _, v in ipairs(_bad) do - if filepath:match(v) then - return false + local bad_patterns = { ".*%.tex$", ".*%.md$", ".*%.html$" } + + local is_bad_file = function(filepath) + for _, pat in ipairs(bad_patterns) do + if filepath:match(pat) then + return true end end - return true + return false end + local new_maker = function(filepath, bufnr, opts) opts = opts or {} - if opts.use_ft_detect == nil then opts.use_ft_detect = true end - opts.use_ft_detect = opts.use_ft_detect == false and false or bad_files(filepath) + + if is_bad_file(filepath) then + vim.bo[bufnr].modifiable = true + vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { "Preview disabled for: " .. filepath }) + vim.bo[bufnr].modifiable = false + return + end + previewers.buffer_previewer_maker(filepath, bufnr, opts) end - local edge_borders = { prompt = { "─", "│", "─", "│", "┌", "┐", "┘", "└" }, results = { "─", "│", "─", "│", "┌", "┐", "┘", "└" }, preview = { "─", "│", "─", "│", "┌", "┐", "┘", "└" }, } - require("telescope").setup { defaults = vim.tbl_extend( @@ -48,6 +54,7 @@ return { results_width = 0.8, }, }, + buffer_previewer_maker = new_maker, } ), extentions = { @@ -68,14 +75,6 @@ return { function() builtin.find_files({ search_dirs = { - os.getenv("XDG_CONFIG_HOME") .. "/nvim/lua", - os.getenv("XDG_CONFIG_HOME") .. "/nvim/after", - os.getenv("XDG_CONFIG_HOME") .. "/zsh", - os.getenv("XDG_CONFIG_HOME") .. "/shell", - os.getenv("XDG_CONFIG_HOME") .. "/X", - os.getenv("XDG_CONFIG_HOME") .. "/X11", - os.getenv("XDG_LOCAL_HOME") .. "/src", - os.getenv("XDG_LOCAL_HOME") .. "/bin", os.getenv("XDG_DOTFILES"), }, hidden = true, @@ -90,14 +89,6 @@ return { function() builtin.live_grep({ search_dirs = { - os.getenv("XDG_CONFIG_HOME") .. "/nvim/lua", - os.getenv("XDG_CONFIG_HOME") .. "/nvim/after", - os.getenv("XDG_CONFIG_HOME") .. "/zsh", - os.getenv("XDG_CONFIG_HOME") .. "/shell", - os.getenv("XDG_CONFIG_HOME") .. "/X", - os.getenv("XDG_CONFIG_HOME") .. "/X11", - os.getenv("XDG_LOCAL_HOME") .. "/src", - os.getenv("XDG_LOCAL_HOME") .. "/bin", os.getenv("XDG_DOTFILES"), }, hidden = true,