From d62a59904ae3dd57e3f2f190d05c753854b215ac Mon Sep 17 00:00:00 2001 From: Nydragon Date: Sun, 20 Oct 2024 20:41:04 +0000 Subject: [PATCH] feat: add typst lsp --- init.lua | 6 ++++-- lua/formatter-config.lua | 8 ++++++++ lua/nvim-cmp-config.lua | 4 ++-- lua/nvim-lsp-config.lua | 4 ++++ nix/package.nix | 4 ++-- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 4d7a67c..eae30d4 100644 --- a/init.lua +++ b/init.lua @@ -61,11 +61,13 @@ vim.g.mapleader = " " vim.o.clipboard = "unnamedplus" vim.filetype.add({ - pattern = { [".*/hypr/.*%.conf"] = "hyprlang" }, + pattern = { + [".*/hypr/.*%.conf"] = "hyprlang", + [".*%.typ"] = "typst", + }, }) require("plugins") ---vim.o.cmdheight = 0 vim.cmd([[ highlight Normal guibg=none ctermbg=none diff --git a/lua/formatter-config.lua b/lua/formatter-config.lua index 1b53dca..5bfd32d 100644 --- a/lua/formatter-config.lua +++ b/lua/formatter-config.lua @@ -88,6 +88,14 @@ local function build() sh = { require("formatter.filetypes.sh").shfmt, }, + typst = { + function() + return { + exe = "typstyle", + args = { "--inplace" }, + } + end, + }, ["*"] = { require("formatter.filetypes.any").remove_trailing_whitespace, }, diff --git a/lua/nvim-cmp-config.lua b/lua/nvim-cmp-config.lua index 04edc88..1653be7 100644 --- a/lua/nvim-cmp-config.lua +++ b/lua/nvim-cmp-config.lua @@ -13,8 +13,8 @@ cmp.setup({ }, mapping = { -- Add tab support - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), [""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.complete(), diff --git a/lua/nvim-lsp-config.lua b/lua/nvim-lsp-config.lua index d26bea9..3a9ae82 100644 --- a/lua/nvim-lsp-config.lua +++ b/lua/nvim-lsp-config.lua @@ -34,3 +34,7 @@ lspconfig.bashls.setup({}) lspconfig.zls.setup({}) lspconfig.ts_ls.setup({}) + +lspconfig.tinymist.setup({ + single_file_support = true, +}) diff --git a/nix/package.nix b/nix/package.nix index 4d505e1..43dd4f6 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, ... }: +{ pkgs, lib ... }: let deps = with pkgs; [ lua @@ -46,7 +46,7 @@ pkgs.writeTextFile { #!${pkgs.bash}/bin/bash export PATH=${lib.makeBinPath deps}:$PATH export LUA_PATH=${../.}/lua/?.lua - ${pkgs.neovim}/bin/nvim -u ${../.}/init.lua $@ + ${pkgs.neovim-unwrapped}/bin/nvim -u ${../.}/init.lua $@ ''; checkPhase = '' ${pkgs.stdenv.shellDryRun} "$target"