mirror of
https://github.com/youwen5/neovim-flake.git
synced 2024-11-24 19:03:49 -08:00
feat: improve typst support
This commit is contained in:
parent
ad551a46f8
commit
6cdb83a772
3 changed files with 52 additions and 3 deletions
|
@ -13,7 +13,7 @@
|
||||||
nushell.enable = true;
|
nushell.enable = true;
|
||||||
svelte.enable = true;
|
svelte.enable = true;
|
||||||
tailwindcss.enable = true;
|
tailwindcss.enable = true;
|
||||||
typst-lsp.enable = true;
|
tinymist.enable = true;
|
||||||
marksman.enable = true;
|
marksman.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,7 +18,57 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
settings.delay = 1000;
|
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 <cr>
|
||||||
|
: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 = {
|
yanky = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableTelescope = true;
|
enableTelescope = true;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
{ inputs, pkgs, ... }:
|
{ inputs, pkgs, ... }:
|
||||||
{
|
{
|
||||||
plugins.typst-vim.enable = true;
|
|
||||||
extraPlugins = [
|
extraPlugins = [
|
||||||
(pkgs.vimUtils.buildVimPlugin {
|
(pkgs.vimUtils.buildVimPlugin {
|
||||||
name = "typst-preview.nvim";
|
name = "typst-preview.nvim";
|
||||||
|
|
Loading…
Reference in a new issue