latex-lsp / texlab

An implementation of the Language Server Protocol for LaTeX
GNU General Public License v3.0
1.54k stars 52 forks source link

LaTeX code formatting with latexindent failed in neovim #1025

Closed YaQia closed 7 months ago

YaQia commented 7 months ago

I am using nvim-lspconfig to let texlab works, here is my config:

    settings = {
        texlab = {
            auxDirectory = ".",
            bibtexFormatter = "texlab",
            build = {
                args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" },
                executable = "xelatex",
                forwardSearchAfter = false,
                onSave = false,
            },
            chktex = {
                onEdit = true,
                onOpenAndSave = true,
            },
            diagnosticsDelay = 300,
            formatterLineLength = 80,
            forwardSearch = {
                executable = "zathura",
                args = {
                    "--synctex-editor-command",
                    [[~/.local/share/nvim/lazy/nvim-texlabconfig/nvim-texlabconfig -file '%%%{input}' -line %%%{line} -server ]]
                        .. vim.v.servername,
                    "--synctex-forward",
                    "%l:1:%f",
                    "%p",
                },
            },
            latexFormatter = "latexindent",
            latexindent = {
                modifyLineBreaks = false,
            },
        },
    }

I can use latexindent in command line, which gives me the formatted code in standard output.

System: Arch Linux

YaQia commented 7 months ago

I realized this is a problem caused by Arch Linux. When I type :!latexindent % in neovim, it tells me missing libcrypt.so.1. After I installed libxcrypt-compat (which is in the core repository), it works perfectly.