{"id":15493506,"url":"https://github.com/f3fora/nvim-texlabconfig","last_synced_at":"2025-08-02T22:13:30.272Z","repository":{"id":39588807,"uuid":"469629138","full_name":"f3fora/nvim-texlabconfig","owner":"f3fora","description":"nvim-texlabconfig: Forward and Inverse Search for Texlab and neovim","archived":false,"fork":false,"pushed_at":"2025-02-24T08:57:20.000Z","size":60,"stargazers_count":38,"open_issues_count":5,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-02T16:47:56.510Z","etag":null,"topics":["neovim","nvim","texlab"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/f3fora.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-03-14T07:45:44.000Z","updated_at":"2025-05-03T19:56:22.000Z","dependencies_parsed_at":"2024-06-20T14:10:15.359Z","dependency_job_id":"e8be50a6-4a0e-4222-a99c-ec14964f167d","html_url":"https://github.com/f3fora/nvim-texlabconfig","commit_stats":{"total_commits":61,"total_committers":3,"mean_commits":"20.333333333333332","dds":"0.032786885245901676","last_synced_commit":"b817297fd07bd6c127df56d01f439f2f838c49ed"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/f3fora/nvim-texlabconfig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f3fora%2Fnvim-texlabconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f3fora%2Fnvim-texlabconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f3fora%2Fnvim-texlabconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f3fora%2Fnvim-texlabconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/f3fora","download_url":"https://codeload.github.com/f3fora/nvim-texlabconfig/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f3fora%2Fnvim-texlabconfig/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268465077,"owners_count":24254238,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["neovim","nvim","texlab"],"created_at":"2024-10-02T08:07:33.917Z","updated_at":"2025-08-02T22:13:30.230Z","avatar_url":"https://github.com/f3fora.png","language":"Lua","funding_links":[],"categories":["Lua"],"sub_categories":[],"readme":"# nvim-texlabconfig\n\n**Texlab** is a popular Language Server for LaTeX, which supports **Forward Search** and **Inverse Search** between TeX and PDF files.\n\n**nvim-texlabconfig** provides some useful snippets to configure this capability for **neovim** and some viewers and a homonymous executable which allows a fast **Inverse Search**.\n\n## Requirements\n\n- [nvim](https://github.com/neovim/neovim) 0.8+\n- [TexLab](https://github.com/latex-lsp/texlab)\n- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig)\n- [go](https://go.dev/)\n\n### Tags\n\n- `v0.1.0` does not depend on `go` for building purpose and does not require an additional executable\n- `v0.2.0` is compatible with nvim 0.7\n- `v0.2.1` adds the `-server` flag\n\n## Installation\n\n**nvim-texlabconfig** can be installed for example with [lazy.nvim](https://github.com/folke/lazy.nvim).\n\n```lua\n{\n    'f3fora/nvim-texlabconfig',\n    config = function()\n        require('texlabconfig').setup(config)\n    end,\n    -- ft = { 'tex', 'bib' }, -- Lazy-load on filetype\n    build = 'go build'\n    -- build = 'go build -o ~/.bin/' -- if e.g. ~/.bin/ is in $PATH\n}\n```\n\nCalling `require('texlabconfig').setup()` is required and can eventually be [configured with a table](#configuration).\n\nThe executable `nvim-texlabconfig` has to be also build, e.g., with `go build`. By default, the result can be found in `:lua =require('texlabconfig').project_dir()` directory. However, the output location can be chosen with `-o` flag. From `go help build`:\n\n\u003e The -o flag forces build to write the resulting executable or object to the named output file or directory, instead of the default behavior described in the last two paragraphs. If the named output is an existing directory or ends with a slash or backslash, then any resulting executables will be written to that directory.`\n\n## Configuration\n\n**nvim-texlabconfig** is configured using the `setup` function. The argument is a table and is optional. The default values are listed below.\n\n```lua\nlocal config = {\n    cache_activate = true,\n    cache_filetypes = { 'tex', 'bib' },\n    cache_root = vim.fn.stdpath('cache'),\n    reverse_search_start_cmd = function()\n        return true\n    end,\n    reverse_search_edit_cmd = vim.cmd.edit,\n    reverse_search_end_cmd = function()\n        return true\n    end,\n    file_permission_mode = 438,\n}\n```\n\n### `cache_activate`\n\nDo not change this option.\n\nType: boolean\nDefault: `true`\n\n### `cache_filetypes`\n\nActivate cache for buffers with these file types.\n\nType: list of strings\nDefault: `{ 'tex', 'bib' }`\n\n### `cache_root`\n\nSpecify the cache directory. **nvim-texlabconfig** creates a `nvim-texlabconfig.json` file in this directory.\n\nType: string\nDefault: `vim.fn.stdpath('cache')`\n\n### `reverse_search_edit_cmd`\n\nWhen working in a multi-file project, initiating inverse search may require opening a file that is not currently open in a window. This option controls the command that is used to open files as a result of an inverse search.\n\nType: function(file_path: string)\nDefault: `vim.cmd.edit`\nExamples:\n\n- `vim.cmd.edit` open buffer in current window\n- `vim.cmd.tabedit` open buffer in new tab page\n- `vim.cmd.split` split current window to open buffer\n\n### `reverse_search_{start,end}_cmd`\n\nExecute a custom function at the beginning or at end of the inverse search process.\nIf the return value of this function if false or nil, the inverse search fails.\n\nType: function()  \nDefault: `function() return true end`\n\n### `file_permission_mode`\n\nSee [luv-file-system-operations](https://github.com/luvit/luv/blob/master/docs.md#file-system-operations=).\n\nType: integer\nDefault: `438`\n\n## Executable: `nvim-texlabconfig`\n\n`nvim-texlabconfig` is a convenient executable which simplifies the viewer configuration. It handles multiple neovim instances and choose the correct one.\n\nAssuming `nvim-texlabconfig` is placed in a `$PATH` directory and `cache_root` is the default one, the following command can be used, where `%f` is the absolute filename and `%l` is the line number.\n\n```sh\nnvim-texlabconfig -file '%f' -line %l\n```\n\nOtherwise, if `nvim-texlabconfig` is not in `$PATH`, e.g. it is placed in `:lua =require('texlabconfig').project_dir()`,\n\n```sh\n/path/to/nvim-texlabconfig -file '%f' -line %l\n```\n\nIf a different [`cache_root`](#cache_root) is used, the directory used has to be specified after `-cache_root` optional flag. This flag is useful in macOS. See e.g. [Skim](#skim).\n\n```sh\nnvim-texlabconfig -file '%f' -line %l -cache_root /path/to/cache_root/\n```\n\nAn optional flag `-server` is used to open the TeX file in the right neovim instance while working with multiple PDF documents. See e.g. [Zathura](#zathura).\n\n```sh\nnvim-texlabconfig -file '%f' -line %l -server `vim.v.servername`\n```\n\nFrom `nvim-texlabconfig -help` on Linux:\n\n\u003e Usage of nvim-texlabconfig:\n\u003e -cache_root string\n\u003e Path to nvim-texlabconfig.json file (default \"/home/user/.cache/nvim\")\n\u003e -file string\n\u003e Absolute filename [REQUIRED]\n\u003e -line int\n\u003e Line number [REQUIRED]\n\u003e -server string\n\u003e Server name (vim.v.servername)\n\n## Status\n\nHelp wanted to add and test other viewers, which are present in [Texlab Previewing Documentation](https://github.com/latex-lsp/texlab/wiki/Previewing).\n\n## Previewing\n\nTo configure Forward and Inverse Search, the default configuration of `texlab` defined in [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#texlab) has to be changed.\n\nDifferent values of `executable` and `args` are required for each viewer.\n\n\u003e **Warning**\n\u003e `args` will be escaped in some strange way.\n\n```lua\nlocal lspconfig = require('lspconfig')\nlocal executable\nlocal args\n\nlspconfig.texlab.setup({\n    setting = {\n        texlab = {\n            forwardSearch = {\n                executable = executable,\n                args = args,\n            },\n        },\n    },\n})\n```\n\nIn the following sections, some configurations are reported.\n\n### [Sioyek](https://sioyek.info/)\n\n```lua\nexecutable = \"sioyek\",\nargs = {\n    \"--reuse-window\",\n    \"--execute-command\",\n    \"toggle_synctex\", -- Open Sioyek in synctex mode.\n    \"--inverse-search\",\n    'nvim-texlabconfig -file \"%%%1\" -line \"%%%2\" -server ' .. vim.v.servername,\n    \"--forward-search-file\",\n    \"%f\",\n    \"--forward-search-line\",\n    \"%l\",\n    \"%p\",\n}\n```\n\nFrom [Sioyek documentation](https://sioyek-documentation.readthedocs.io/en/latest/usage.html#synctex):\n\n\u003e Press `f4` to toggle synctex mode (`toggle_synctex` command). While in this mode, **right clicking** on any text opens the corresponding `tex` file in the appropriate location.\n\n### [Skim](https://skim-app.sourceforge.io/)\n\n```lua\nlocal executable = '/Applications/Skim.app/Contents/SharedSupport/displayline'\nlocal args = { '%l', '%p', '%f' }\n```\n\nIn the Skim preferences (Skim → Preferences → Sync → PDF-TeX Sync support)\n\n```\nPreset: Custom\nCommand: nvim-texlabconfig\nArguments: -file '%file' -line %line -cache_root $cache_root\n```\n\nReplace `$cache_root` with the `require('texlabconfig.config').get().cache_root`, whose default value is `vim.fn.stdpath('cache')`, which uses XDG directory specifications on macOS rather than Standard Directories guidelines and returns `~/.cache/nvim/`.\n\n### [Zathura](https://pwmt.org/projects/zathura/)\n\n```lua\nlocal executable = 'zathura'\nlocal args = {\n    '--synctex-editor-command',\n    [[nvim-texlabconfig -file '%%%{input}' -line %%%{line} -server ]] .. vim.v.servername,\n    '--synctex-forward',\n    '%l:1:%f',\n    '%p',\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff3fora%2Fnvim-texlabconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ff3fora%2Fnvim-texlabconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff3fora%2Fnvim-texlabconfig/lists"}