commit cd54a0e8f5ad9ce7b33a31867aed6dd8553e7c2c
parent 1be38321f3f39060ffc306f4ca097a8bbb09ea7c
Author: Jack Sangdahl <jack@pngu.org>
Date: Tue, 7 Jan 2025 13:23:37 +0100
Neovim configuration
Diffstat:
9 files changed, 169 insertions(+), 1 deletion(-)
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
@@ -0,0 +1,37 @@
+vim.g.base46_cache = vim.fn.stdpath("data") .. "/base46/"
+vim.g.mapleader = " "
+
+-- bootstrap lazy and all plugins
+local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
+
+if not vim.uv.fs_stat(lazypath) then
+ local repo = "https://github.com/folke/lazy.nvim.git"
+ vim.fn.system({ "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath })
+end
+
+vim.opt.rtp:prepend(lazypath)
+
+local lazy_config = require("configs.lazy")
+
+-- load plugins
+require("lazy").setup({
+ {
+ "NvChad/NvChad",
+ lazy = false,
+ branch = "v2.5",
+ import = "nvchad.plugins",
+ },
+
+ { import = "plugins" },
+}, lazy_config)
+
+-- load theme
+dofile(vim.g.base46_cache .. "defaults")
+dofile(vim.g.base46_cache .. "statusline")
+
+require("nvchad.options")
+require("nvchad.autocmds")
+
+vim.schedule(function()
+ require("mappings")
+end)
diff --git a/.config/nvim/lua/chadrc.lua b/.config/nvim/lua/chadrc.lua
@@ -0,0 +1,16 @@
+local M = {}
+
+M.base46 = {
+ theme = "onenord",
+}
+
+M.mason.pkgs = {
+ "lua-language-server",
+ "stylua",
+ "ruff",
+ "python-lsp-server",
+ "tinymist",
+ "typstfmt",
+}
+
+return M
diff --git a/.config/nvim/lua/configs/conform.lua b/.config/nvim/lua/configs/conform.lua
@@ -0,0 +1,18 @@
+local options = {
+ formatters_by_ft = {
+ lua = { "stylua" },
+ css = { "prettier" },
+ html = { "prettier" },
+ json = { "prettier" },
+ python = { "ruff_format" },
+ cpp = { "clang-format" },
+ c = { "clang-format" },
+ typst = { "typstfmt" },
+ },
+ format_on_save = {
+ timeout_ms = 500,
+ lsp_fallback = true,
+ },
+}
+
+return options
diff --git a/.config/nvim/lua/configs/lazy.lua b/.config/nvim/lua/configs/lazy.lua
@@ -0,0 +1,47 @@
+return {
+ defaults = { lazy = true },
+ install = { colorscheme = { "nvchad" } },
+
+ ui = {
+ icons = {
+ ft = "",
+ lazy = " ",
+ loaded = "",
+ not_loaded = "",
+ },
+ },
+
+ performance = {
+ rtp = {
+ disabled_plugins = {
+ "2html_plugin",
+ "tohtml",
+ "getscript",
+ "getscriptPlugin",
+ "gzip",
+ "logipat",
+ "netrw",
+ "netrwPlugin",
+ "netrwSettings",
+ "netrwFileHandlers",
+ "matchit",
+ "tar",
+ "tarPlugin",
+ "rrhelper",
+ "spellfile_plugin",
+ "vimball",
+ "vimballPlugin",
+ "zip",
+ "zipPlugin",
+ "tutor",
+ "rplugin",
+ "syntax",
+ "synmenu",
+ "optwin",
+ "compiler",
+ "bugreport",
+ "ftplugin",
+ },
+ },
+ },
+}
diff --git a/.config/nvim/lua/configs/lspconfig.lua b/.config/nvim/lua/configs/lspconfig.lua
@@ -0,0 +1,13 @@
+require("nvchad.configs.lspconfig").defaults()
+
+local lspconfig = require("lspconfig")
+local servers = { "html", "cssls", "pylsp", "clangd", "tinymist" }
+local nvlsp = require("nvchad.configs.lspconfig")
+
+for _, lsp in ipairs(servers) do
+ lspconfig[lsp].setup({
+ on_attach = nvlsp.on_attach,
+ on_init = nvlsp.on_init,
+ capabilities = nvlsp.capabilities,
+ })
+end
diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua
@@ -0,0 +1,6 @@
+require("nvchad.mappings")
+
+local map = vim.keymap.set
+
+map("n", ";", ":", { desc = "CMD enter command mode" })
+map("i", "jk", "<ESC>")
diff --git a/.config/nvim/lua/plugins/init.lua b/.config/nvim/lua/plugins/init.lua
@@ -0,0 +1,28 @@
+return {
+ {
+ "stevearc/conform.nvim",
+ event = 'BufWritePre',
+ opts = require "configs.conform",
+ },
+ {
+ "neovim/nvim-lspconfig",
+ config = function()
+ require "configs.lspconfig"
+ end,
+ },
+ {
+ "nvim-treesitter/nvim-treesitter",
+ opts = {
+ ensure_installed = {
+ "lua",
+ "html",
+ "css",
+ "python",
+ "rust",
+ "cpp",
+ "c",
+ "bash",
+ },
+ },
+ },
+}
diff --git a/.gitignore b/.gitignore
@@ -4,7 +4,7 @@
.config/*iscord
.config/Electron
.config/kicad
-.config/nvim
+.config/nvim/lazy-lock.json
.config/pulse
.config/typstfmt
.config/weechat
diff --git a/.pkglist.txt b/.pkglist.txt
@@ -56,6 +56,7 @@ openssh
openssh-openrc
pipewire
pipewire-jack
+pipewire-pulse
prettier
python-uv
ripgrep
@@ -73,8 +74,10 @@ typst
unzip
waybar
wayland
+weechat
wl-clipboard
wofi
+xdg-utils
xorg-xwayland
yadm
zathura