updated neovim config

This commit is contained in:
2026-03-20 10:05:56 +01:00
parent 146429f594
commit 89ce9ab548
11 changed files with 455 additions and 320 deletions

View File

@@ -26,8 +26,8 @@ lines = 24
## Blank space added around the window in pixels. ## Blank space added around the window in pixels.
[window.padding] [window.padding]
x = 30 x = 3
y = 30 y = 0
## SCROLLING ------------------------------------------------------ ## SCROLLING ------------------------------------------------------
[scrolling] [scrolling]

View File

@@ -60,7 +60,7 @@ update_ms = 1000
#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct", #* 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. #* "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. #* Reverse sorting order, True or False.
proc_reversed = false proc_reversed = false

View File

@@ -1 +1 @@
monitor=eDP-1, disable

View File

@@ -14,3 +14,4 @@ env = QT_QPA_PLATFORMTHEME,qt6ct
# env = VDPAU_DRIVER,radeonsi # env = VDPAU_DRIVER,radeonsi
env = MOZ_ENABLE_WAYLAND,1 env = MOZ_ENABLE_WAYLAND,1
env = ELECTRON_OZONE_PLATFORM_HINT,wayland env = ELECTRON_OZONE_PLATFORM_HINT,wayland
env = EDITOR,nvim

View File

@@ -2,7 +2,7 @@
# laptop screen # laptop screen
monitor = eDP-1, 1920x1080@60, 0x0, 1 monitor = eDP-1, 1920x1080@60, 0x0, 1
# samsung home monitor # 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 # lid_state fallback

View File

@@ -5,7 +5,7 @@
# VARIABLES # VARIABLES
# ========================================== # ==========================================
# Dialogs and utility apps that should float in the center # 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)$ $dialog_classes = ^(pavucontrol|blueman-manager|nm-connection-editor|org.pulseaudio.pavucontrol)$
# App classes # App classes

View File

@@ -16,6 +16,7 @@ x-scheme-handler/about=google-chrome.desktop
x-scheme-handler/unknown=google-chrome.desktop x-scheme-handler/unknown=google-chrome.desktop
application/vnd.openxmlformats-officedocument.wordprocessingml.document=libreoffice-writer.desktop application/vnd.openxmlformats-officedocument.wordprocessingml.document=libreoffice-writer.desktop
x-scheme-handler/ror2mm=r2modman.desktop x-scheme-handler/ror2mm=r2modman.desktop
image/webp=feh.desktop
[Added Associations] [Added Associations]
application/pdf=org.pwmt.zathura-pdf-poppler.desktop; application/pdf=org.pwmt.zathura-pdf-poppler.desktop;
@@ -26,3 +27,4 @@ x-scheme-handler/https=zen.desktop;
text/html=zen.desktop; text/html=zen.desktop;
x-scheme-handler/chrome=zen.desktop; x-scheme-handler/chrome=zen.desktop;
application/vnd.openxmlformats-officedocument.wordprocessingml.document=libreoffice-writer.desktop; application/vnd.openxmlformats-officedocument.wordprocessingml.document=libreoffice-writer.desktop;
image/webp=feh.desktop;

88
nvim/README.md Normal file
View File

@@ -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 |
| :--- | :--- |
| `<leader>w` | Save current file |
| `<leader>q` | Quit all buffers / Exit Neovim |
### File Exploration & Searching (`mini.pick` & `mini.files`)
| Keybind | Action |
| :--- | :--- |
| `<leader>e` | Open File Explorer (`mini.files`) |
| `<leader><space>` | Search open buffers |
| `<leader>ff` | Search all files in current directory |
| `<leader>fh` | Search Neovim help tags |
### Window Management
| Keybind | Action |
| :--- | :--- |
| `<leader>h` | Move to the left window |
| `<leader>j` | Move to the window below |
| `<leader>k` | Move to the window above |
| `<leader>l` | Move to the right window |
### Code Formatting & LSP
| Keybind | Action |
| :--- | :--- |
| `<leader>f` | Format current file or selected range |
| `<leader>K` | Hover: Show documentation for item under cursor |
| `<leader>gd` | Go to Definition |
| `<leader>gr` | Find all references |
| `<leader>rn` | Rename variable/function across the project |
| `<leader>ca` | View available Code Actions (Quick fixes) |
### Terminal (`toggleterm`)
| Keybind | Action |
| :--- | :--- |
| `<C-\>` | Toggle floating terminal |
### Autocompletion (`blink.cmp`)
| Keybind | Action |
| :--- | :--- |
| `<C-Space>` | Manually trigger autocomplete menu |
| `<C-n>` / `<Tab>` | Select next item in the completion menu |
| `<C-p>` / `<S-Tab>`| Select previous item in the completion menu |
| `<CR>` | 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.

View File

@@ -2,113 +2,131 @@ vim.o.number = true
vim.o.wrap = false vim.o.wrap = false
vim.o.tabstop = 4 vim.o.tabstop = 4
vim.o.shiftwidth = 4 vim.o.shiftwidth = 4
vim.o.expandtab = true -- Use spaces instead of tabs
vim.o.smartcase = true vim.o.smartcase = true
vim.o.ignorecase = true vim.o.ignorecase = true
vim.o.hlsearch = false vim.o.hlsearch = false
vim.o.signcolumn = 'yes' vim.o.signcolumn = "yes"
vim.o.clipboard = 'unnamedplus' vim.o.clipboard = "unnamedplus"
vim.o.undofile = true 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) -- Set up 'mini.deps' (customize to your liking)
require('mini.deps').setup() require("mini.deps").setup()
local add = MiniDeps.add local add = MiniDeps.add
add({ add({
source = 'chomosuke/typst-preview.nvim' source = "lewis6991/gitsigns.nvim",
}) })
add({ add({
source = 'williamboman/mason.nvim' source = "chomosuke/typst-preview.nvim",
})
add({
source = "williamboman/mason.nvim",
}) })
add({ add({
source = 'stevearc/conform.nvim' source = "stevearc/conform.nvim",
}) })
add({ add({
source = 'williamboman/mason-lspconfig.nvim' source = "williamboman/mason-lspconfig.nvim",
}) })
add({ add({
source = 'mfussenegger/nvim-lint' source = "mfussenegger/nvim-lint",
}) })
add({ add({
source = 'akinsho/toggleterm.nvim' source = "akinsho/toggleterm.nvim",
}) })
-- Add to current session (install if absent) -- Add to current session (install if absent)
add({ add({
source = 'neovim/nvim-lspconfig', source = "neovim/nvim-lspconfig",
-- Supply dependencies near target plugin -- Supply dependencies near target plugin
depends = { 'williamboman/mason.nvim' }, depends = { "williamboman/mason.nvim" },
}) })
add({ add({
source = 'seblyng/roslyn.nvim', source = "seblyng/roslyn.nvim",
}) })
add({ add({
source = 'tris203/rzls.nvim', source = "tris203/rzls.nvim",
}) })
add({ add({
source = 'nvim-treesitter/nvim-treesitter', source = "nvim-treesitter/nvim-treesitter",
-- Use 'master' while monitoring updates in 'main' -- Use 'master' while monitoring updates in 'main'
checkout = 'master', checkout = "master",
monitor = 'main', monitor = "main",
-- Perform action after every checkout -- Perform action after every checkout
hooks = { post_checkout = function() vim.cmd('TSUpdate') end }, hooks = {
post_checkout = function()
vim.cmd("TSUpdate")
end,
},
}) })
add({ add({
-- Completion framework: source = "https://git.narl.io/nvrl/mould-rs",
source = 'hrsh7th/nvim-cmp', checkout = "main",
-- 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',
},
}) })
add({ source = "catppuccin/nvim", name = "catppuccin" }) add({ source = "catppuccin/nvim", name = "catppuccin" })
add({ source = "folke/which-key.nvim" })
require('mini.files').setup({ add({
mappings = { source = 'Saghen/blink.cmp',
show_help = 'gh', 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.files").setup({
require('mini.snippets').setup({}) mappings = {
require('mini.notify').setup({}) show_help = "gh",
require('mini.statusline').setup({}) },
require('mini.tabline').setup({}) })
require('mini.git').setup({}) 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) local imap_expr = function(lhs, rhs)
vim.keymap.set('i', lhs, rhs, { expr = true }) vim.keymap.set("i", lhs, rhs, { expr = true })
end end
imap_expr('<Tab>', [[pumvisible() ? "\<C-n>" : "\<Tab>"]]) imap_expr("<Tab>", [[pumvisible() ? "\<C-n>" : "\<Tab>"]])
imap_expr('<S-Tab>', [[pumvisible() ? "\<C-p>" : "\<S-Tab>"]]) imap_expr("<S-Tab>", [[pumvisible() ? "\<C-p>" : "\<S-Tab>"]])
_G.cr_action = function() _G.cr_action = function()
-- If there is selected item in popup, accept it with <C-y> -- If there is selected item in popup, accept it with <C-y>
if vim.fn.complete_info()['selected'] ~= -1 then return '\25' end if vim.fn.complete_info()["selected"] ~= -1 then
return "\25"
end
-- Fall back to plain `<CR>`. You might want to customize this -- Fall back to plain `<CR>`. You might want to customize this
-- according to other plugins. For example if 'mini.pairs' is set up, replace -- according to other plugins. For example if 'mini.pairs' is set up, replace
-- next line with `return MiniPairs.cr()` -- next line with `return MiniPairs.cr()`
return '\r' return "\r"
end end
vim.keymap.set('i', '<CR>', 'v:lua.cr_action()', { expr = true }) vim.keymap.set("i", "<CR>", "v:lua.cr_action()", { expr = true })
require("toggleterm").setup{ require("toggleterm").setup({
size = function(term) size = function(term)
if term.direction == "horizontal" then if term.direction == "horizontal" then
return 30 return 30
@@ -120,13 +138,13 @@ require("toggleterm").setup{
hide_numbers = true, hide_numbers = true,
shade_terminals = true, shade_terminals = true,
persist_size = true, persist_size = true,
direction = 'float', direction = "float",
close_on_exit = true, close_on_exit = true,
shell = vim.o.shell, shell = vim.o.shell,
} })
require('nvim-treesitter.configs').setup { require("nvim-treesitter.configs").setup({
ensure_installed = { "lua", "rust", "toml", "c_sharp" }, ensure_installed = { "lua", "rust", "toml", "c_sharp", "python", "typst" },
auto_install = true, auto_install = true,
highlight = { highlight = {
enable = true, enable = true,
@@ -137,8 +155,8 @@ require('nvim-treesitter.configs').setup {
enable = true, enable = true,
extended_mode = true, extended_mode = true,
max_file_lines = nil, max_file_lines = nil,
} },
} })
require("mason").setup({ require("mason").setup({
registries = { registries = {
"github:mason-org/mason-registry", "github:mason-org/mason-registry",
@@ -148,19 +166,56 @@ require("mason").setup({
icons = { icons = {
package_installed = "", package_installed = "",
package_pending = "", package_pending = "",
package_uninstalled = "" package_uninstalled = "",
} },
}
})
require("mason-lspconfig").setup()
vim.lsp.config('rust_analyzer', {
-- Server-specific settings. See `:help lsp-quickstart`
settings = {
['rust-analyzer'] = {},
}, },
}) })
require('roslyn').setup({ 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 = { config = {
-- the rest of your Roslyn configuration -- the rest of your Roslyn configuration
handlers = require("rzls.roslyn_handlers"), handlers = require("rzls.roslyn_handlers"),
@@ -220,29 +275,19 @@ local sign = function(opts)
vim.fn.sign_define(opts.name, { vim.fn.sign_define(opts.name, {
texthl = opts.name, texthl = opts.name,
text = opts.text, text = opts.text,
numhl = '' numhl = "",
}) })
end end
sign({name = 'DiagnosticSignError', text = ''}) sign({ name = "DiagnosticSignError", text = "" })
sign({name = 'DiagnosticSignWarn', text = ''}) sign({ name = "DiagnosticSignWarn", text = "" })
sign({name = 'DiagnosticSignHint', text = ''}) sign({ name = "DiagnosticSignHint", text = "" })
sign({name = 'DiagnosticSignInfo', text = ''}) sign({ name = "DiagnosticSignInfo", text = "" })
--Set completeopt to have a better completion experience
-- :help completeopt vim.opt.completeopt = { "menuone", "noselect", "noinsert" }
-- menuone: popup even when there's only one match vim.opt.shortmess = vim.opt.shortmess + { c = true }
-- noinsert: Do not insert text until a selection is made vim.api.nvim_set_option("updatetime", 300)
-- 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)
-- 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([[ vim.cmd([[
set signcolumn=yes set signcolumn=yes
autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false }) autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false })
@@ -255,149 +300,147 @@ vim.diagnostic.config({
underline = true, underline = true,
severity_sort = false, severity_sort = false,
float = { float = {
border = 'rounded', border = "rounded",
source = 'always', source = "always",
header = '', header = "",
prefix = '', prefix = "",
}, },
}) })
-- setup must be called before loading vim.cmd.colorscheme("catppuccin")
vim.cmd.colorscheme "catppuccin"
vim.keymap.set('n', '<leader>w', '<cmd>write<cr>', {desc = 'Save file'}) vim.keymap.set("n", "<leader>w", "<cmd>write<cr>", { desc = "Save file" })
vim.keymap.set('n', '<leader>q', '<cmd>quitall<cr>', {desc = 'Exit vim'}) vim.keymap.set("n", "<leader>q", "<cmd>quitall<cr>", { desc = "Exit vim" })
-- Simplified clipboard mappings vim.keymap.set("n", "<leader>e", "<cmd>lua MiniFiles.open()<cr>", { desc = "File explorer" })
-- vim.keymap.set({'n', 'x', 'o'}, '<leader>y', '"+y', {desc = 'Copy to clipboard'}) vim.keymap.set("n", "<leader><space>", "<cmd>Pick buffers<cr>", { desc = "Search open files" })
-- vim.keymap.set({'n', 'x'}, '<leader>p', '"+p', {desc = 'Paste from clipboard'}) vim.keymap.set("n", "<leader>ff", "<cmd>Pick files<cr>", { desc = "Search all files" })
vim.keymap.set("n", "<leader>fh", "<cmd>Pick help<cr>", { desc = "Search help tags" })
vim.keymap.set('n', '<leader>e', '<cmd>lua MiniFiles.open()<cr>', {desc = 'File explorer'}) vim.keymap.set("n", "<leader>h", "<cmd>wincmd h<cr>")
vim.keymap.set('n', '<leader><space>', '<cmd>Pick buffers<cr>', {desc = 'Search open files'}) vim.keymap.set("n", "<leader>l", "<cmd>wincmd l<cr>")
vim.keymap.set('n', '<leader>ff', '<cmd>Pick files<cr>', {desc = 'Search all files'}) vim.keymap.set("n", "<leader>j", "<cmd>wincmd j<cr>")
vim.keymap.set('n', '<leader>fh', '<cmd>Pick help<cr>', {desc = 'Search help tags'}) vim.keymap.set("n", "<leader>k", "<cmd>wincmd k<cr>")
vim.keymap.set('n', '<leader>h', '<cmd>wincmd h<cr>') require("typst-preview").setup({
vim.keymap.set('n', '<leader>l', '<cmd>wincmd l<cr>')
vim.keymap.set('n', '<leader>j', '<cmd>wincmd j<cr>')
vim.keymap.set('n', '<leader>k', '<cmd>wincmd k<cr>')
require 'typst-preview'.setup {
-- Setting this true will enable logging debug information to
-- `vim.fn.stdpath 'data' .. '/typst-preview/log.txt'`
debug = false, debug = false,
-- 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, open_cmd = nil,
-- Custom port to open the preview server. Default is random.
-- Example: port = 8000
port = 0, port = 0,
host = "127.0.0.1",
-- Custom host to bind the preview server to. invert_colors = "never",
-- 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',
-- 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": "<option>","image": "<option>"}' will apply
-- your choice of color inversion to images and everything else
-- separately.
invert_colors = 'never',
-- Whether the preview will follow the cursor in the source file
follow_cursor = true, follow_cursor = true,
-- Provide the path to binaries for dependencies.
-- Setting this will skip the download of the binary by the plugin.
-- Warning: Be aware that your version might be older than the one
-- required.
dependencies_bin = { dependencies_bin = {
['tinymist'] = '/home/narl/.local/share/nvim/mason/bin/tinymist', ["tinymist"] = "/home/narl/.local/share/nvim/mason/bin/tinymist",
['websocat'] = '/usr/bin/websocat' ["websocat"] = "/usr/bin/websocat",
}, },
-- A list of extra arguments (or nil) to be passed to previewer.
-- For example, extra_args = { "--input=ver=draft", "--ignore-system-fonts" }
extra_args = nil, extra_args = nil,
-- This function will be called to determine the root of the typst project
get_root = function(path_of_main_file) get_root = function(path_of_main_file)
local root = os.getenv 'TYPST_ROOT' local root = os.getenv("TYPST_ROOT")
if root then if root then
return root return root
end end
-- Look for a project marker so imports from parent dirs stay inside root local main_dir = vim.fs.dirname(vim.fn.fnamemodify(path_of_main_file, ":p"))
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 })
local found = vim.fs.find({ 'typst.toml', '.git' }, { path = main_dir, upward = true })
if #found > 0 then if #found > 0 then
return vim.fs.dirname(found[1]) return vim.fs.dirname(found[1])
end end
return main_dir return main_dir
end, end,
-- This function will be called to determine the main file of the typst
-- project.
get_main_file = function(path_of_buffer) get_main_file = function(path_of_buffer)
return path_of_buffer return path_of_buffer
end, end,
}
-- Rust
local cmp = require'cmp'
cmp.setup({
-- Enable LSP snippets
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
-- Add tab support
['<S-Tab>'] = cmp.mapping.select_prev_item(),
['<Tab>'] = cmp.mapping.select_next_item(),
['<C-S-f>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
}) })
require('blink.cmp').setup({
-- 'default' maps match standard nvim-cmp behavior (<C-space>, <C-n>, <C-p>, <CR>)
-- 'super-tab' uses your Tab key for everything
keymap = { preset = 'default' },
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'
}, },
-- Installed sources:
-- Default list of enabled providers
sources = { sources = {
{ name = 'path' }, -- file paths default = { 'lsp', 'path', 'snippets', 'buffer' },
{ name = 'nvim_lsp', keyword_length = 3 }, -- from language server
{ name = 'nvim_lsp_signature_help'}, -- display function signatures with current parameter emphasized
{ name = 'nvim_lua', keyword_length = 2}, -- complete neovim's Lua runtime API such vim.lsp.*
{ name = 'buffer', keyword_length = 2 }, -- source current buffer
{ name = 'vsnip', keyword_length = 2 }, -- nvim-cmp source for vim-vsnip
{ name = 'calc'}, -- source for math calculation
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
formatting = {
fields = {'menu', 'abbr', 'kind'},
format = function(entry, item)
local menu_icon ={
nvim_lsp = 'λ',
vsnip = '',
buffer = 'Ω',
path = '🖫',
}
item.menu = menu_icon[entry.source.name]
return item
end,
}, },
-- Enable displaying function signatures as you type parameters
signature = { enabled = true }
})
require("conform").setup({
formatters_by_ft = {
cs = { "csharpier" },
rust = { "rustfmt" },
lua = { "stylua" },
go = { "gofmt" },
c = { "clang-format" },
cpp = { "clang-format" },
html = { "prettier" },
css = { "prettier" },
json = { "prettier" },
yaml = { "prettier" },
sh = { "shfmt" },
bash = { "shfmt" },
python = { "isort", "black" },
javascript = { "prettier" },
typescript = { "prettier" },
javascriptreact = { "prettier" },
typescriptreact = { "prettier" },
typst = { "typstyle" },
xml = { "xmlformatter" },
},
format_on_save = function(bufnr)
if vim.bo[bufnr].filetype ~= "rust" then
return
end
return {
timeout_ms = 3000,
lsp_fallback = true,
}
end,
})
vim.keymap.set({ "n", "v" }, "<leader>f", function()
require("conform").format({
lsp_fallback = true,
async = false,
timeout_ms = 3000,
})
end, { desc = "Format file or range" })
-- Nvim-Lint Configuration
require("lint").linters_by_ft = {
python = { "flake8" },
}
-- Trigger linting on file save
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
callback = function()
require("lint").try_lint()
end,
})
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(event)
local opts = { buffer = event.buf }
-- Press 'K' to show hover documentation
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
-- Press 'gd' to jump to a function/variable definition
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
-- Press '<leader>rn' to rename a variable across the whole project
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
-- Press '<leader>ca' to see code actions (like quick fixes)
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, opts)
-- Press 'gr' to find all references of the word under your cursor
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
end,
}) })

View File

@@ -0,0 +1 @@
/usr/lib/systemd/user/sunshine.service

View File

@@ -39,7 +39,7 @@ window#waybar {
background-color: alpha(@surface0, 0.95); background-color: alpha(@surface0, 0.95);
margin: 4px 2px; margin: 4px 2px;
padding: 0 12px; padding: 0 12px;
border-radius: 12px; border-radius: 5px;
border: 1px solid alpha(@surface1, 0.5); border: 1px solid alpha(@surface1, 0.5);
} }
@@ -57,7 +57,7 @@ window#waybar.bottom {
#workspaces button { #workspaces button {
padding: 0 8px; padding: 0 8px;
margin: 4px 2px; margin: 4px 2px;
border-radius: 8px; border-radius: 5px;
color: @subtext0; color: @subtext0;
background-color: transparent; background-color: transparent;
} }
@@ -124,7 +124,7 @@ window#waybar.bottom {
tooltip { tooltip {
background-color: alpha(@base, 0.95); background-color: alpha(@base, 0.95);
border: 1px solid @surface1; border: 1px solid @surface1;
border-radius: 12px; border-radius: 5px;
} }
tooltip label { tooltip label {