about summary refs log tree commit diff stats
path: root/modules/by-name/nv/nvim/files/ftplugin/tex.lua
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-11-09 12:35:44 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-11-09 12:54:51 +0100
commit2122a01f99c6da466b8f0f55c965c11a9043d117 (patch)
tree6c1697afc30a5bb72635bda7db9b5610386a5b71 /modules/by-name/nv/nvim/files/ftplugin/tex.lua
parentfix(pkgs/stamp): Fallback to `dot-license` (diff)
downloadnixos-config-2122a01f99c6da466b8f0f55c965c11a9043d117.tar.gz
nixos-config-2122a01f99c6da466b8f0f55c965c11a9043d117.zip
refactor(modules/legacy/conf/nvim): Move to `by-name`
Diffstat (limited to 'modules/by-name/nv/nvim/files/ftplugin/tex.lua')
-rw-r--r--modules/by-name/nv/nvim/files/ftplugin/tex.lua60
1 files changed, 60 insertions, 0 deletions
diff --git a/modules/by-name/nv/nvim/files/ftplugin/tex.lua b/modules/by-name/nv/nvim/files/ftplugin/tex.lua
new file mode 100644
index 00000000..4107a7c5
--- /dev/null
+++ b/modules/by-name/nv/nvim/files/ftplugin/tex.lua
@@ -0,0 +1,60 @@
+-- local used = false;
+-- vim.keymap.set('n', '<leader>t', function()
+--     used = not used;
+--     if used then
+--         require('nvim-treesitter.configs').setup {
+--             highlight = {
+--                 additional_vim_regex_highlighting = { "latex", "markdown" },
+--             },
+--         }
+--     else
+--         require('nvim-treesitter.configs').setup {
+--             highlight = {
+--                 additional_vim_regex_highlighting = { "" },
+--             },
+--         }
+--     end
+-- end
+-- );
+--
+--
+
+-- Set tex specific telescope extension
+require("telescope").setup({
+  extensions = {
+    bibtex = {
+      -- Depth for the *.bib file
+      depth = 1,
+      -- Path to global bibliographies (placed outside of the project)
+      global_files = {},
+      -- Define the search keys to use in the picker
+      search_keys = { "author", "year", "title" },
+      -- Template for the formatted citation
+      citation_format = "{{author}} ({{year}}), {{title}}.",
+      -- Only use initials for the authors first name
+      citation_trim_firstname = true,
+      -- Max number of authors to write in the formatted citation
+      -- following authors will be replaced by "et al."
+      citation_max_auth = 2,
+      -- Wrapping in the preview window is disabled by default
+      wrap = false,
+      -- Custom format for citation label
+      custom_formats = {
+        { id = "tex_autocite", cite_marker = "\\autocite{%s}" },
+      },
+      format = "tex_autocite",
+      -- Use context awareness
+      context = true,
+      -- Fallback to global/directory .bib files if context not found
+      -- This setting has no effect if context = false
+      context_fallback = true,
+    },
+  },
+})
+require("telescope").load_extension("bibtex")
+vim.keymap.set(
+  "n",
+  "<leader>ib",
+  function() require("telescope").extensions.bibtex.bibtex() end,
+  { noremap = true, silent = true, desc = "list bibtex entries in telescope" }
+)