Switch to different language server for typst

This commit is contained in:
Thomas Avé 2024-10-18 12:32:06 +02:00
parent 70230292d0
commit 441a6517cf
5 changed files with 10 additions and 167 deletions

View File

@ -38,7 +38,7 @@
emmet-ls
ruff-lsp
csharp-ls
typst-lsp
tinymist
];
home.file."${config.xdg.configHome}/nvim" = {

View File

@ -156,8 +156,9 @@ return {
capabilities = capabilities
}
require('lspconfig').typst_lsp.setup {
capabilities = capabilities
require('lspconfig').tinymist.setup {
capabilities = capabilities,
offset_encoding = "utf-8",
}
require('lspconfig').cmake.setup {

View File

@ -1,12 +1,11 @@
return {
'nvim-treesitter/nvim-treesitter',
dependencies = {
"https://github.com/TheZoq2/tree-sitter-typst",
"luckasRanarison/tree-sitter-hyprlang"
},
build = ":TSUpdate",
opts = {
ensure_installed_sync = { "cpp", "c", "lua", "vim", "dockerfile", "python", "java", "cmake", "diff", "gitcommit", "html", "css", "javascript", "json", "rust", "sql", "yaml", "markdown", "markdown_inline", "nix" },
ensure_installed_sync = { "typst", "cpp", "c", "lua", "vim", "dockerfile", "python", "java", "cmake", "diff", "gitcommit", "html", "css", "javascript", "json", "rust", "sql", "yaml", "markdown", "markdown_inline", "nix" },
auto_install = true,
highlight = {
enable = true,
@ -27,19 +26,4 @@ return {
enable = true
},
},
config = function (_, opts)
require("nvim-treesitter.configs").setup(opts)
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
require'nvim-treesitter.install'.prefer_git = true
parser_config.typst = {
install_info = {
url = "https://github.com/frozolotl/tree-sitter-typst.git", -- local path or git repo
files = {"src/parser.c", "src/scanner.cc"},
},
filetype = "typst", -- if filetype does not match the parser name
}
vim.filetype.add({
pattern = { [".*.typ"] = "typst" },
})
end
}

View File

@ -1,147 +0,0 @@
#!/bin/bash
# Headless
NVIM=true
ZSH=true
PROFILE=true
TMUX=true
# GUI
AWESOME=false
ALACRITTY=false
MPV=false
SUDO="sudo"
if [[ $(whoami) == "root" ]]; then
SUDO=""
fi
#################################################
# Basic Preparation #
#################################################
OS=$(grep -E '^(NAME)=' /etc/os-release )
if [[ -z "${XDG_CONFIG_HOME}" ]]; then
mkdir -p "$HOME"/.config
XDG_CONFIG_HOME="$HOME"/.config
fi
if [[ -z "${XDG_DATA_HOME}" ]]; then
mkdir -p "$HOME"/.local/share
XDG_DATA_HOME="$HOME"/.local/share
fi
#################################################
# Neovim #
#################################################
if $NVIM; then
dependencies="neovim git unzip fzf cmake gcc make curl wget ripgrep"
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
$SUDO pacman -Sy --needed --noconfirm $dependencies npm go fd dotnet-sdk
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
$SUDO apt update
$SUDO apt install -y software-properties-common
$SUDO add-apt-repository ppa:neovim-ppa/unstable -y
$SUDO curl -sL https://deb.nodesource.com/setup_21.x | $SUDO bash -
repo_version=$(if command -v lsb_release &> /dev/null; then lsb_release -r -s; else grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"'; fi)
wget https://packages.microsoft.com/config/ubuntu/"$repo_version"/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
$SUDO dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
$SUDO apt update
$SUDO apt install -y $dependencies python3-venv python3-pip nodejs golang fd-find cargo dotnet-sdk-8.0
fi
nvim --headless "+Lazy! sync" +qa
nvim --headless "+MasonInstall bash-language-server pyright typescript-language-server rust-analyzer clangd cmake-language-server css-lsp dockerfile-language-server emmet-ls gopls html-lsp jdtls json-lsp ltex-ls lua-language-server ruff-lsp rustfmt rustywind texlab vetur-vls vim-language-server yaml-language-server csharp-language-server typst-lsp" +qa
fi
#################################################
# ZSH #
#################################################
if $ZSH; then
PROFILE=true
dependencies="fzf zsh curl zoxide fzy"
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
$SUDO pacman -Sy --needed --noconfirm $dependencies zsh-autosuggestions
echo "Please manually install yay"
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
$SUDO apt update
$SUDO apt install -y $dependencies
fi
mkdir -p "$HOME"/.local/state/zsh/
git clone https://github.com/cxreg/smartcd.git /tmp/smartcd
cd /tmp/smartcd || exit
make install
cd - || exit
fi
#################################################
# Awesome #
#################################################
if $AWESOME; then
dependencies="awesome picom numlockx xcape rofi"
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
$SUDO pacman -Sy --needed --noconfirm $dependencies network-manager-applet xorg-xmodmap adobe-source-code-pro-fonts noto-fonts ttf-nerd-fonts-symbols
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
$SUDO apt update
$SUDO apt install -y $dependencies awesome-extra
fi
fi
#################################################
# Alacritty #
#################################################
if $ALACRITTY; then
dependencies="alacritty"
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
$SUDO pacman -Sy --needed --noconfirm $dependencies
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
$SUDO apt update
$SUDO apt install -y software-properties-common
$SUDO add-apt-repository ppa:aslatter/ppa -y
$SUDO apt update
$SUDO apt install -y $dependencies
fi
fi
#################################################
# MPV #
#################################################
if $MPV; then
dependencies="mpv"
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
$SUDO pacman -Sy --needed --noconfirm $dependencies
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
$SUDO apt update
$SUDO apt install -y $dependencies
fi
fi
#################################################
# Tmux #
#################################################
if $TMUX; then
dependencies="tmux git zsh xdg-utils"
if [[ $OS == "NAME=\"Arch Linux\"" ]]; then
$SUDO pacman -Sy --needed --noconfirm $dependencies
git clone https://github.com/tmux-plugins/tpm "$XDG_DATA_HOME"/tmux/plugins/tpm
"$XDG_DATA_HOME"/tmux/plugins/tpm/bin/install_plugins
elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then
$SUDO apt update
$SUDO apt install -y $dependencies
git clone https://github.com/tmux-plugins/tpm "$HOME"/.tmux/plugins/tpm
"$HOME"/.tmux/plugins/tpm/bin/install_plugins
fi
fi

View File

@ -77,6 +77,9 @@
xdg.mimeApps = {
enable = true;
defaultApplications = {
"x-scheme-handler/mailto" = "userapp-Thunderbird-7GETV2.desktop";
"x-scheme-handler/mid" = "userapp-Thunderbird-7GETV2.desktop";
"message/rfc822" = "userapp-Thunderbird-7GETV2.desktop";
"application/pdf" = "org.gnome.Evince.desktop";
"x-scheme-handler/tg" = "org.telegram.desktop.desktop";
"video/*" = "mpv.desktop";
@ -84,6 +87,8 @@
};
associations.added = {
"x-scheme-handler/tg" = "org.telegram.desktop.desktop";
"x-scheme-handler/mailto" = "userapp-Thunderbird-7GETV2.desktop";
"x-scheme-handler/mid" = "userapp-Thunderbird-7GETV2.desktop";
"image/jpeg" = "org.gnome.Loupe.desktop";
};
};