diff --git a/config/plugins/lsps.nix b/config/plugins/lsps.nix index 5aa042f..4556221 100644 --- a/config/plugins/lsps.nix +++ b/config/plugins/lsps.nix @@ -13,7 +13,7 @@ nushell.enable = true; svelte.enable = true; tailwindcss.enable = true; - typst-lsp.enable = true; + tinymist.enable = true; marksman.enable = true; }; }; diff --git a/config/plugins/qol.nix b/config/plugins/qol.nix index c1eabb3..208bcfd 100644 --- a/config/plugins/qol.nix +++ b/config/plugins/qol.nix @@ -18,7 +18,57 @@ enable = true; settings.delay = 1000; }; - nvim-autopairs.enable = true; + nvim-autopairs = { + enable = true; + luaConfig.post = '' + local npairs = require('nvim-autopairs') + local Rule = require('nvim-autopairs.rule') + local cond = require('nvim-autopairs.conds') + + npairs.add_rules({ + Rule("$", "$",{"tex", "latex", "typst"}) + -- don't add a pair if the next character is % + :with_pair(cond.not_after_regex("%%")) + -- don't add a pair if the previous character is xxx + :with_pair(cond.not_before_regex("xxx", 3)) + -- don't move right when repeat character + :with_move(cond.none()) + -- don't delete if the next character is xx + :with_del(cond.not_after_regex("xx")) + -- disable adding a newline when you press + :with_cr(cond.none()) + }, + { + Rule("_", "_","typst") + -- don't add a pair if the previous character is xxx + :with_pair(cond.not_before_regex("[%w%.]", 3)) + -- don't move right when repeat character + :with_move(cond.none()) + -- don't delete if the next character is xx + :with_del(cond.not_after_regex("[%w%.]")) + }, + { + Rule("*", "*","typst") + -- don't add a pair if the previous character is xxx + :with_pair(cond.not_before_regex("[%w%.]", 3)) + -- don't move right when repeat character + :with_move(cond.none()) + -- don't delete if the next character is xx + :with_del(cond.not_after_regex("[%w%.]")) + }, + { + Rule("$$","$$","tex") + :with_pair(function(opts) + print(vim.inspect(opts)) + if opts.line=="aa $$" then + -- don't add pair on that line + return false + end + end) + } + ) + ''; + }; yanky = { enable = true; enableTelescope = true; diff --git a/config/plugins/typst.nix b/config/plugins/typst.nix index 03f636a..5b8bd8a 100644 --- a/config/plugins/typst.nix +++ b/config/plugins/typst.nix @@ -1,6 +1,5 @@ { inputs, pkgs, ... }: { - plugins.typst-vim.enable = true; extraPlugins = [ (pkgs.vimUtils.buildVimPlugin { name = "typst-preview.nvim";