From 89ce9ab548afdc11e1f518abc13e964f5e9a816b Mon Sep 17 00:00:00 2001 From: Nils Pukropp Date: Fri, 20 Mar 2026 10:05:56 +0100 Subject: [PATCH] updated neovim config --- alacritty/alacritty.toml | 4 +- btop/btop.conf | 2 +- hypr/lid_state.conf | 2 +- hypr/modules/env.conf | 1 + hypr/modules/monitors.conf | 2 +- hypr/modules/window_rules.conf | 2 +- mimeapps.list | 2 + nvim/README.md | 88 +++ nvim/init.lua | 665 ++++++++++-------- .../sunshine.service | 1 + waybar/style.css | 6 +- 11 files changed, 455 insertions(+), 320 deletions(-) create mode 100644 nvim/README.md create mode 120000 systemd/user/xdg-desktop-autostart.target.wants/sunshine.service diff --git a/alacritty/alacritty.toml b/alacritty/alacritty.toml index 51479bb..42edbdb 100644 --- a/alacritty/alacritty.toml +++ b/alacritty/alacritty.toml @@ -26,8 +26,8 @@ lines = 24 ## Blank space added around the window in pixels. [window.padding] -x = 30 -y = 30 +x = 3 +y = 0 ## SCROLLING ------------------------------------------------------ [scrolling] diff --git a/btop/btop.conf b/btop/btop.conf index 2693ed4..60254d4 100644 --- a/btop/btop.conf +++ b/btop/btop.conf @@ -60,7 +60,7 @@ update_ms = 1000 #* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct", #* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly. -proc_sorting = "command" +proc_sorting = "cpu lazy" #* Reverse sorting order, True or False. proc_reversed = false diff --git a/hypr/lid_state.conf b/hypr/lid_state.conf index e8e4907..8b13789 100644 --- a/hypr/lid_state.conf +++ b/hypr/lid_state.conf @@ -1 +1 @@ -monitor=eDP-1, disable + diff --git a/hypr/modules/env.conf b/hypr/modules/env.conf index 5bf74a8..ef72db2 100644 --- a/hypr/modules/env.conf +++ b/hypr/modules/env.conf @@ -14,3 +14,4 @@ env = QT_QPA_PLATFORMTHEME,qt6ct # env = VDPAU_DRIVER,radeonsi env = MOZ_ENABLE_WAYLAND,1 env = ELECTRON_OZONE_PLATFORM_HINT,wayland +env = EDITOR,nvim diff --git a/hypr/modules/monitors.conf b/hypr/modules/monitors.conf index 185dfe7..3e75c93 100644 --- a/hypr/modules/monitors.conf +++ b/hypr/modules/monitors.conf @@ -2,7 +2,7 @@ # laptop screen monitor = eDP-1, 1920x1080@60, 0x0, 1 # samsung home monitor -monitor = desc:Samsung Electric Company LC27G7xT H4ZRA00734, 2560x1440@90, 0x-1440, 1 +monitor = desc:Samsung Electric Company LC27G7xT H4ZRA00734, 2560x1440@144, 0x-1440, 1 # lid_state fallback diff --git a/hypr/modules/window_rules.conf b/hypr/modules/window_rules.conf index 84fba41..b06e091 100644 --- a/hypr/modules/window_rules.conf +++ b/hypr/modules/window_rules.conf @@ -5,7 +5,7 @@ # VARIABLES # ========================================== # Dialogs and utility apps that should float in the center -$dialog_titles = ^(Open Form|Open File|Select a File|Choose a file|Open Workspace|Choose Directory|Save As|Save File|branchdialog|pinentry-gtk-2|Confirm to replace files|File Operation Progress)$ +$dialog_titles = ^(Open Form|Open File|Select a File|Choose a file|Open Workspace|Choose Directory|Save As|Save File|branchdialog|pinentry-gtk-2|Confirm to replace files|File Operation Progress|Open Files|Anmelden – Google Konten — Zen Browser)$ $dialog_classes = ^(pavucontrol|blueman-manager|nm-connection-editor|org.pulseaudio.pavucontrol)$ # App classes diff --git a/mimeapps.list b/mimeapps.list index c047f12..ace3ae3 100644 --- a/mimeapps.list +++ b/mimeapps.list @@ -16,6 +16,7 @@ x-scheme-handler/about=google-chrome.desktop x-scheme-handler/unknown=google-chrome.desktop application/vnd.openxmlformats-officedocument.wordprocessingml.document=libreoffice-writer.desktop x-scheme-handler/ror2mm=r2modman.desktop +image/webp=feh.desktop [Added Associations] application/pdf=org.pwmt.zathura-pdf-poppler.desktop; @@ -26,3 +27,4 @@ x-scheme-handler/https=zen.desktop; text/html=zen.desktop; x-scheme-handler/chrome=zen.desktop; application/vnd.openxmlformats-officedocument.wordprocessingml.document=libreoffice-writer.desktop; +image/webp=feh.desktop; diff --git a/nvim/README.md b/nvim/README.md new file mode 100644 index 0000000..07494d7 --- /dev/null +++ b/nvim/README.md @@ -0,0 +1,88 @@ +# My Neovim Configuration + +A fast, modern, and highly capable Neovim setup tailored for full-stack and systems development. It uses `mini.deps` for blazingly fast plugin management and heavily leverages the `mini.nvim` ecosystem to keep bloat to an absolute minimum. + +## Core Capabilities + +* **Modern Autocompletion:** Powered by the Rust-based `blink.cmp` for zero-latency, out-of-the-box completion with built-in snippet support. +* **Intelligent Formatting (`conform.nvim`):** Seamless asynchronous formatting for a massive array of languages. + * *Special Rule:* Rust files automatically format on save via `rustfmt`. +* **Real-time Linting (`nvim-lint`):** Automatically lints Python files with `flake8` every time the file is saved. +* **Robust Language Server Protocol (LSP):** Fully automated LSP installation and configuration via `mason.nvim` and `mason-lspconfig`. Includes specialized C# support via Roslyn. +* **Aesthetic & UI:** * Beautiful `Catppuccin` (Mocha/Latte) color scheme. + * Informative status lines and tab lines via `mini.statusline` and `mini.tabline`. + * Customized floating diagnostic windows and rounded borders. +* **Typst Integration:** Live Typst previewing with `typst-preview.nvim` and compilation via `tinymist`. +* **Integrated Terminal:** Floating terminal toggle via `toggleterm.nvim`. + +--- + +## Supported Languages & Tools + +Through `nvim-treesitter`, `mason`, and our custom handlers, this config provides full highlighting, formatting, and LSP support for: + +* **Systems & Backend:** Rust (`rust-analyzer`, `rustfmt`), C/C++ (`clangd`, `clang-format`), Go (`gopls`, `gofmt`) +* **.NET:** C# (`roslyn`, `rzls`, `csharpier`) +* **Scripting & Data:** Python (`pyright`, `isort`, `black`, `flake8`), Lua (`lua_ls`, `stylua`), Bash (`bashls`, `shfmt`) +* **Web Ecosystem:** HTML, CSS, JSON, YAML, JavaScript, TypeScript, React (`prettier`, various LSPs) +* **Other:** Typst (`tinymist`, `typstyle`), Robot Framework (`robotcode`), XML (`xmlformatter`) + +--- + +## Keybindings + +**Leader Key:** `,` (Comma) + +### General +| Keybind | Action | +| :--- | :--- | +| `w` | Save current file | +| `q` | Quit all buffers / Exit Neovim | + +### File Exploration & Searching (`mini.pick` & `mini.files`) +| Keybind | Action | +| :--- | :--- | +| `e` | Open File Explorer (`mini.files`) | +| `` | Search open buffers | +| `ff` | Search all files in current directory | +| `fh` | Search Neovim help tags | + +### Window Management +| Keybind | Action | +| :--- | :--- | +| `h` | Move to the left window | +| `j` | Move to the window below | +| `k` | Move to the window above | +| `l` | Move to the right window | + +### Code Formatting & LSP +| Keybind | Action | +| :--- | :--- | +| `f` | Format current file or selected range | +| `K` | Hover: Show documentation for item under cursor | +| `gd` | Go to Definition | +| `gr` | Find all references | +| `rn` | Rename variable/function across the project | +| `ca` | View available Code Actions (Quick fixes) | + +### Terminal (`toggleterm`) +| Keybind | Action | +| :--- | :--- | +| `` | Toggle floating terminal | + +### Autocompletion (`blink.cmp`) +| Keybind | Action | +| :--- | :--- | +| `` | Manually trigger autocomplete menu | +| `` / `` | Select next item in the completion menu | +| `` / ``| Select previous item in the completion menu | +| `` | Confirm selection | + +--- + +## Core Editor Settings +* **Indentation:** 4 spaces (Tabs are expanded to spaces). +* **Line Numbers:** Enabled. +* **Line Wrapping:** Disabled. +* **Clipboard:** Synced with the system clipboard (`unnamedplus`). +* **Undo History:** Persistent (saved to `~/.cache/nvim-undodir`), meaning you can undo changes even after closing and reopening a file. diff --git a/nvim/init.lua b/nvim/init.lua index 4bc723c..3b861a5 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -2,402 +2,445 @@ vim.o.number = true vim.o.wrap = false vim.o.tabstop = 4 vim.o.shiftwidth = 4 +vim.o.expandtab = true -- Use spaces instead of tabs vim.o.smartcase = true vim.o.ignorecase = true vim.o.hlsearch = false -vim.o.signcolumn = 'yes' -vim.o.clipboard = 'unnamedplus' +vim.o.signcolumn = "yes" +vim.o.clipboard = "unnamedplus" vim.o.undofile = true -vim.o.undodir = '/home/narl/.cache/nvim-undodir' +vim.o.undodir = "/home/narl/.cache/nvim-undodir" -vim.g.mapleader = ',' +vim.g.mapleader = "," -- Set up 'mini.deps' (customize to your liking) -require('mini.deps').setup() +require("mini.deps").setup() local add = MiniDeps.add - add({ - source = 'chomosuke/typst-preview.nvim' + source = "lewis6991/gitsigns.nvim", }) add({ - source = 'williamboman/mason.nvim' + source = "chomosuke/typst-preview.nvim", +}) +add({ + source = "williamboman/mason.nvim", }) add({ - source = 'stevearc/conform.nvim' + source = "stevearc/conform.nvim", }) add({ - source = 'williamboman/mason-lspconfig.nvim' + source = "williamboman/mason-lspconfig.nvim", }) add({ - source = 'mfussenegger/nvim-lint' + source = "mfussenegger/nvim-lint", }) add({ - source = 'akinsho/toggleterm.nvim' + source = "akinsho/toggleterm.nvim", }) -- Add to current session (install if absent) add({ - source = 'neovim/nvim-lspconfig', - -- Supply dependencies near target plugin - depends = { 'williamboman/mason.nvim' }, + source = "neovim/nvim-lspconfig", + -- Supply dependencies near target plugin + depends = { "williamboman/mason.nvim" }, }) add({ - source = 'seblyng/roslyn.nvim', + source = "seblyng/roslyn.nvim", }) add({ - source = 'tris203/rzls.nvim', + source = "tris203/rzls.nvim", }) add({ - source = 'nvim-treesitter/nvim-treesitter', - -- Use 'master' while monitoring updates in 'main' - checkout = 'master', - monitor = 'main', - -- Perform action after every checkout - hooks = { post_checkout = function() vim.cmd('TSUpdate') end }, + source = "nvim-treesitter/nvim-treesitter", + -- Use 'master' while monitoring updates in 'main' + checkout = "master", + monitor = "main", + -- Perform action after every checkout + hooks = { + post_checkout = function() + vim.cmd("TSUpdate") + end, + }, }) add({ - -- Completion framework: - source = 'hrsh7th/nvim-cmp', - - -- LSP completion source: - depends = {'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-nvim-lua', - 'hrsh7th/cmp-nvim-lsp-signature-help', - 'hrsh7th/cmp-vsnip', - 'hrsh7th/cmp-path', - 'hrsh7th/cmp-buffer', - 'hrsh7th/vim-vsnip', - }, + source = "https://git.narl.io/nvrl/mould-rs", + checkout = "main", }) add({ source = "catppuccin/nvim", name = "catppuccin" }) - -require('mini.files').setup({ - mappings = { - show_help = 'gh', - }, +add({ source = "folke/which-key.nvim" }) +add({ + source = 'Saghen/blink.cmp', + depends = { 'rafamadriz/friendly-snippets' }, + -- Compile the Rust binary after downloading + hooks = { + post_install = function(ctx) + vim.cmd('!cd ' .. ctx.path .. ' && cargo build --release') + end, + post_checkout = function(ctx) + vim.cmd('!cd ' .. ctx.path .. ' && cargo build --release') + end + }, }) -require('mini.icons').setup({style = 'ascii'}) -require('mini.pick').setup({}) -require('mini.snippets').setup({}) -require('mini.notify').setup({}) -require('mini.statusline').setup({}) -require('mini.tabline').setup({}) -require('mini.git').setup({}) + +require("mini.files").setup({ + mappings = { + show_help = "gh", + }, +}) +require("mini.icons").setup({ style = "ascii" }) +require("mini.pick").setup({}) +require("mini.snippets").setup({}) +require("mini.notify").setup({}) +require("mini.statusline").setup({}) +require("mini.tabline").setup({}) +require("mini.git").setup({}) +require("gitsigns").setup() +require("mini.indentscope").setup() +require("mini.pairs").setup() +require("mini.surround").setup() +require("which-key").setup() local imap_expr = function(lhs, rhs) -vim.keymap.set('i', lhs, rhs, { expr = true }) + vim.keymap.set("i", lhs, rhs, { expr = true }) end -imap_expr('', [[pumvisible() ? "\" : "\"]]) -imap_expr('', [[pumvisible() ? "\" : "\"]]) +imap_expr("", [[pumvisible() ? "\" : "\"]]) +imap_expr("", [[pumvisible() ? "\" : "\"]]) _G.cr_action = function() --- If there is selected item in popup, accept it with -if vim.fn.complete_info()['selected'] ~= -1 then return '\25' end --- Fall back to plain ``. You might want to customize this --- according to other plugins. For example if 'mini.pairs' is set up, replace --- next line with `return MiniPairs.cr()` -return '\r' + -- If there is selected item in popup, accept it with + if vim.fn.complete_info()["selected"] ~= -1 then + return "\25" + end + -- Fall back to plain ``. You might want to customize this + -- according to other plugins. For example if 'mini.pairs' is set up, replace + -- next line with `return MiniPairs.cr()` + return "\r" end -vim.keymap.set('i', '', 'v:lua.cr_action()', { expr = true }) -require("toggleterm").setup{ - size = function(term) - if term.direction == "horizontal" then - return 30 - elseif term.direction == "vertical" then - return 69 - end - end, - open_mapping = [[]], - hide_numbers = true, - shade_terminals = true, - persist_size = true, - direction = 'float', - close_on_exit = true, - shell = vim.o.shell, -} +vim.keymap.set("i", "", "v:lua.cr_action()", { expr = true }) +require("toggleterm").setup({ + size = function(term) + if term.direction == "horizontal" then + return 30 + elseif term.direction == "vertical" then + return 69 + end + end, + open_mapping = [[]], + hide_numbers = true, + shade_terminals = true, + persist_size = true, + direction = "float", + close_on_exit = true, + shell = vim.o.shell, +}) -require('nvim-treesitter.configs').setup { - ensure_installed = { "lua", "rust", "toml", "c_sharp" }, - auto_install = true, - highlight = { - enable = true, - additional_vim_regex_highlighting=false, - }, - ident = { enable = true }, - rainbow = { - enable = true, - extended_mode = true, - max_file_lines = nil, - } -} +require("nvim-treesitter.configs").setup({ + ensure_installed = { "lua", "rust", "toml", "c_sharp", "python", "typst" }, + auto_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + ident = { enable = true }, + rainbow = { + enable = true, + extended_mode = true, + max_file_lines = nil, + }, +}) require("mason").setup({ - registries = { - "github:mason-org/mason-registry", - "github:Crashdummyy/mason-registry", - }, - ui = { - icons = { - package_installed = "✓", - package_pending = "➜", - package_uninstalled = "✗" - } - } -}) -require("mason-lspconfig").setup() -vim.lsp.config('rust_analyzer', { - -- Server-specific settings. See `:help lsp-quickstart` - settings = { - ['rust-analyzer'] = {}, - }, + registries = { + "github:mason-org/mason-registry", + "github:Crashdummyy/mason-registry", + }, + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + }, + }, }) -require('roslyn').setup({ - config = { - -- the rest of your Roslyn configuration - handlers = require("rzls.roslyn_handlers"), - }, +local capabilities = require('blink.cmp').get_lsp_capabilities() + +require("mason-lspconfig").setup({ + ensure_installed = { + "lua_ls", -- Lua + "gopls", -- Go + "clangd", -- C/C++ + "html", -- HTML + "cssls", -- CSS + "jsonls", -- JSON + "yamlls", -- YAML + "bashls", -- Bash/Shell + "pyright", -- Python + "ts_ls", -- JS/TS/React + "rust_analyzer", -- Rust + "robotcode", -- Robot Framework + "tinymist", -- Typst + }, +}) + +-- List out the servers you are using +local servers = { + "lua_ls", + "gopls", + "clangd", + "html", + "cssls", + "jsonls", + "yamlls", + "bashls", + "pyright", + "ts_ls", + "rust_analyzer", + "robotcode", + "tinymist", +} + +-- Configure capabilities for each server using Neovim's native API +for _, server in ipairs(servers) do + vim.lsp.config(server, { + capabilities = capabilities, + }) +end + +require("roslyn").setup({ + config = { + -- the rest of your Roslyn configuration + handlers = require("rzls.roslyn_handlers"), + }, }) require("catppuccin").setup({ - flavour = "auto", -- latte, frappe, macchiato, mocha - background = { -- :h background - light = "latte", - dark = "mocha", - }, - transparent_background = false, -- disables setting the background color. - show_end_of_buffer = false, -- shows the '~' characters after the end of buffers - term_colors = false, -- sets terminal colors (e.g. `g:terminal_color_0`) - dim_inactive = { - enabled = false, -- dims the background color of inactive window - shade = "dark", - percentage = 0.15, -- percentage of the shade to apply to the inactive window - }, - no_italic = false, -- Force no italic - no_bold = false, -- Force no bold - no_underline = false, -- Force no underline - styles = { -- Handles the styles of general hi groups (see `:h highlight-args`): - comments = { "italic" }, -- Change the style of comments - conditionals = { "italic" }, - loops = {}, - functions = {}, - keywords = {}, - strings = {}, - variables = {}, - numbers = {}, - booleans = {}, - properties = {}, - types = {}, - operators = {}, - -- miscs = {}, -- Uncomment to turn off hard-coded styles - }, - color_overrides = {}, - custom_highlights = {}, - default_integrations = true, - integrations = { - cmp = true, - gitsigns = true, - nvimtree = true, - treesitter = true, - notify = false, - mini = { - enabled = true, - indentscope_color = "", - }, - -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations) - }, + flavour = "auto", -- latte, frappe, macchiato, mocha + background = { -- :h background + light = "latte", + dark = "mocha", + }, + transparent_background = false, -- disables setting the background color. + show_end_of_buffer = false, -- shows the '~' characters after the end of buffers + term_colors = false, -- sets terminal colors (e.g. `g:terminal_color_0`) + dim_inactive = { + enabled = false, -- dims the background color of inactive window + shade = "dark", + percentage = 0.15, -- percentage of the shade to apply to the inactive window + }, + no_italic = false, -- Force no italic + no_bold = false, -- Force no bold + no_underline = false, -- Force no underline + styles = { -- Handles the styles of general hi groups (see `:h highlight-args`): + comments = { "italic" }, -- Change the style of comments + conditionals = { "italic" }, + loops = {}, + functions = {}, + keywords = {}, + strings = {}, + variables = {}, + numbers = {}, + booleans = {}, + properties = {}, + types = {}, + operators = {}, + -- miscs = {}, -- Uncomment to turn off hard-coded styles + }, + color_overrides = {}, + custom_highlights = {}, + default_integrations = true, + integrations = { + cmp = true, + gitsigns = true, + nvimtree = true, + treesitter = true, + notify = false, + mini = { + enabled = true, + indentscope_color = "", + }, + -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations) + }, }) local sign = function(opts) - vim.fn.sign_define(opts.name, { - texthl = opts.name, - text = opts.text, - numhl = '' - }) + vim.fn.sign_define(opts.name, { + texthl = opts.name, + text = opts.text, + numhl = "", + }) end -sign({name = 'DiagnosticSignError', text = ''}) -sign({name = 'DiagnosticSignWarn', text = ''}) -sign({name = 'DiagnosticSignHint', text = ''}) -sign({name = 'DiagnosticSignInfo', text = ''}) ---Set completeopt to have a better completion experience --- :help completeopt --- menuone: popup even when there's only one match --- noinsert: Do not insert text until a selection is made --- noselect: Do not select, force to select one from the menu --- shortness: avoid showing extra messages when using completion --- updatetime: set updatetime for CursorHold -vim.opt.completeopt = {'menuone', 'noselect', 'noinsert'} -vim.opt.shortmess = vim.opt.shortmess + { c = true} -vim.api.nvim_set_option('updatetime', 300) +sign({ name = "DiagnosticSignError", text = "" }) +sign({ name = "DiagnosticSignWarn", text = "" }) +sign({ name = "DiagnosticSignHint", text = "" }) +sign({ name = "DiagnosticSignInfo", text = "" }) + +vim.opt.completeopt = { "menuone", "noselect", "noinsert" } +vim.opt.shortmess = vim.opt.shortmess + { c = true } +vim.api.nvim_set_option("updatetime", 300) --- Fixed column for diagnostics to appear --- Show autodiagnostic popup on cursor hover_range --- Goto previous / next diagnostic warning / error --- Show inlay_hints more frequently vim.cmd([[ set signcolumn=yes autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false }) ]]) vim.diagnostic.config({ - virtual_text = false, - signs = true, - update_in_insert = true, - underline = true, - severity_sort = false, - float = { - border = 'rounded', - source = 'always', - header = '', - prefix = '', - }, + virtual_text = false, + signs = true, + update_in_insert = true, + underline = true, + severity_sort = false, + float = { + border = "rounded", + source = "always", + header = "", + prefix = "", + }, }) --- setup must be called before loading -vim.cmd.colorscheme "catppuccin" +vim.cmd.colorscheme("catppuccin") -vim.keymap.set('n', 'w', 'write', {desc = 'Save file'}) -vim.keymap.set('n', 'q', 'quitall', {desc = 'Exit vim'}) +vim.keymap.set("n", "w", "write", { desc = "Save file" }) +vim.keymap.set("n", "q", "quitall", { desc = "Exit vim" }) --- Simplified clipboard mappings --- vim.keymap.set({'n', 'x', 'o'}, 'y', '"+y', {desc = 'Copy to clipboard'}) --- vim.keymap.set({'n', 'x'}, 'p', '"+p', {desc = 'Paste from clipboard'}) +vim.keymap.set("n", "e", "lua MiniFiles.open()", { desc = "File explorer" }) +vim.keymap.set("n", "", "Pick buffers", { desc = "Search open files" }) +vim.keymap.set("n", "ff", "Pick files", { desc = "Search all files" }) +vim.keymap.set("n", "fh", "Pick help", { desc = "Search help tags" }) -vim.keymap.set('n', 'e', 'lua MiniFiles.open()', {desc = 'File explorer'}) -vim.keymap.set('n', '', 'Pick buffers', {desc = 'Search open files'}) -vim.keymap.set('n', 'ff', 'Pick files', {desc = 'Search all files'}) -vim.keymap.set('n', 'fh', 'Pick help', {desc = 'Search help tags'}) +vim.keymap.set("n", "h", "wincmd h") +vim.keymap.set("n", "l", "wincmd l") +vim.keymap.set("n", "j", "wincmd j") +vim.keymap.set("n", "k", "wincmd k") -vim.keymap.set('n', 'h', 'wincmd h') -vim.keymap.set('n', 'l', 'wincmd l') -vim.keymap.set('n', 'j', 'wincmd j') -vim.keymap.set('n', 'k', 'wincmd k') +require("typst-preview").setup({ + debug = false, + open_cmd = nil, + port = 0, + host = "127.0.0.1", + invert_colors = "never", + follow_cursor = true, + dependencies_bin = { + ["tinymist"] = "/home/narl/.local/share/nvim/mason/bin/tinymist", + ["websocat"] = "/usr/bin/websocat", + }, + extra_args = nil, + get_root = function(path_of_main_file) + local root = os.getenv("TYPST_ROOT") + if root then + return root + end -require 'typst-preview'.setup { - -- Setting this true will enable logging debug information to - -- `vim.fn.stdpath 'data' .. '/typst-preview/log.txt'` - debug = false, + local main_dir = vim.fs.dirname(vim.fn.fnamemodify(path_of_main_file, ":p")) + local found = vim.fs.find({ "typst.toml", ".git" }, { path = main_dir, upward = true }) + if #found > 0 then + return vim.fs.dirname(found[1]) + end - -- Custom format string to open the output link provided with %s - -- Example: open_cmd = 'firefox %s -P typst-preview --class typst-preview' - open_cmd = nil, + return main_dir + end, + get_main_file = function(path_of_buffer) + return path_of_buffer + end, +}) - -- Custom port to open the preview server. Default is random. - -- Example: port = 8000 - port = 0, +require('blink.cmp').setup({ + -- 'default' maps match standard nvim-cmp behavior (, , , ) + -- 'super-tab' uses your Tab key for everything + keymap = { preset = 'default' }, - -- Custom host to bind the preview server to. - -- Note that '0.0.0.0' is not supported and [won't be](https://github.com/Myriad-Dreamin/tinymist/issues/2105) - -- Example: host = '192.168.0.10' - host = '127.0.0.1', + appearance = { + -- Sets the fallback highlight groups to nvim-cmp's highlight groups + use_nvim_cmp_as_default = true, + -- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + nerd_font_variant = 'mono' + }, - -- Setting this to 'always' will invert black and white in the preview - -- Setting this to 'auto' will invert depending if the browser has enable - -- dark mode - -- Setting this to '{"rest": "