Skip to content

Instantly share code, notes, and snippets.

@ChristopherBilg
Forked from sasja-san/init.lua
Created May 27, 2026 03:34
Show Gist options
  • Select an option

  • Save ChristopherBilg/8ad792e3f7bf3d603373f17fe279cc3d to your computer and use it in GitHub Desktop.

Select an option

Save ChristopherBilg/8ad792e3f7bf3d603373f17fe279cc3d to your computer and use it in GitHub Desktop.
local CFG = require("configs") -- a bunch of shit I don't want in this file
GH = "https://github.com/" -- Prefix for package URLs
-- PERF:
-- ░▒▓█▓▒░ ░▒▓█████▓▒░░▒▓██████▓▒░░▒▓███████▓▒░░▒▓█████▓▒░▒▓███████▓▒░
-- ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░
-- ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░
-- ░▒▓█▓▒░ ░▒▓███▓▒░ ░▒▓████████▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓███▓▒░ ░▒▓███████▓▒░
-- ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░
-- ░▒▓█▓▒░ ░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░
-- ░▒▓█████▓▒░▒▓█████▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓███████▓▒░░▒▓█████▓▒░▒▓█▓▒░░▒▓█▓▒░
local function set_leader(key)
vim.g.mapleader = key
vim.g.maplocalleader = key
-- vim.keymap.set({"n","v"}, key, "<nop>")
end
LEADER = ","
set_leader(LEADER)
-- FIX:
-- ▄▄· ▄▄▌ ▄▄▄ .▄▄ · ▄▄· ▄ .▄▄▄▄ .• ▌ ▄ ·. ▄▄▄ .
-- █ ▐█ ▌▪▪ ██• ▪ ▀▄ █·▐█ ▀. ▐█ ▌▪██▪▐█▀▄.▀··██ ▐███▪▀▄.▀·
-- ██ ▄▄ ▄█▀▄ ██▪ ▄█▀▄ ▐▀▀▄ ▄▀▀▀█▄██ ▄▄██▀▐█▐▀▀▪▄▐█ ▌▐▌▐█·▐▀▀▪▄
-- █ ▐███▌▐█▌.▐▌▐█▌▐▌▐█▌.▐▌▐█•█▌▐█▄▪▐█▐███▌██▌▐▀▐█▄▄▌██ ██▌▐█▌▐█▄▄▌
-- ·▀▀▀ ▀█▄▀▪.▀▀▀ ▀█▄▀▪.▀ ▀ ▀▀▀▀ ·▀▀▀ ▀▀▀ · ▀▀▀ ▀▀ █▪▀▀▀ ▀▀▀
vim.pack.add({
GH.."typicode/bg.nvim",
GH.."ellisonleao/gruvbox.nvim",
GH.."sainnhe/everforest",
GH.."savq/melange-nvim",
GH.."rafi/awesome-vim-colorschemes",
GH.."mcauley-penney/techbase.nvim",
GH.."folke/tokyonight.nvim",
GH.."alljokecake/naysayer-theme.nvim",
GH.."vague2k/vague.nvim",
{ src = GH.."catppuccin/nvim", name = "catppuccin", },
{ src = GH.."rose-pine/neovim", name = "rose-pine", },
})
-- themes i like from the awesome pack
--
-- angr " dark gray bg, pretty bright text
-- alduin " gruvbox, but better
-- atom " works in bright environments
-- deus
-- flattened_light " like solarized
-- flattened_dark " solarized flat, but brighter red
-- cuspoint
-- gruvbox " brown, beige, red and a bit green/yellow-ish
-- iceberg " makes python look good
-- jellybeans " quite dark
-- lucius
-- materialbox
-- nord " works in lighter environments
-- OceanicNextLight
-- PaperColor " dark with lots of colors
-- parsec " easy on the eyes
-- snow " low contrast << good when a bit dorker
--
-- All the solarized are basically the same, differences
-- from default solarized in comment
-- solarized8 " normal solarized
-- solarized8_flat " nu column and status don't pop
-- solarized8_low " like flat but brighter background
-- solarized8_high " grey-ish text changed to white
--
-- stellarized
-- termschool
-- wombat256mod " good in many lighting cond.
-- yellow-moon " purple-ish
-- catppuccin
-- gruvbox
-- rose-pine
-- vague
-- Works well with both light and dark for `:set background=X`
-- everforest
-- melange
vim.cmd("colorscheme melange")
-- local colors = vim.g.colors_name
-- Can I set this myself? I guess so.
vim.g.have_nerd_font = true
-- SauceCodePro Nerd Font Mono:h10
-- TODO:
-- ██████╗ ██████╗ ████████╗██╗ ██████╗ ███╗ ██╗███████╗
-- ██╔═══██╗██╔══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║██╔════╝
-- ██║ ██║██████╔╝ ██║ ██║██║ ██║██╔██╗ ██║███████╗
-- ██║ ██║██╔═══╝ ██║ ██║██║ ██║██║╚██╗██║╚════██║
-- ╚██████╔╝██║ ██║ ██║╚██████╔╝██║ ╚████║███████║
-- ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝
local opts = {
-- FILE AND I/O STUFF
timeoutlen = 350, -- e.g. telescope & which-key
autoread = true,
backup = false,
writebackup = false,
swapfile = false,
-- VISUALS
termguicolors = true,
title = true,
winborder = "rounded",
-- FOLDS
-- foldcolumn = "0", -- fold markers left of number column
-- foldmethod = "syntax",
-- foldnestmax = 10,
-- foldenable = true,
-- foldlevel = 2,
-- VERTICAL THINGS
number = true,
relativenumber = false,
numberwidth = 5,
signcolumn = "number", -- LSP markers share with number column
colorcolumn = "80", -- vertical marking
cursorline = true, -- Line with cursor is highlighted
cursorlineopt = "number,screenline",
scrolloff = 3, -- lines
wildmenu = true, -- popup, maybe turn off?
hidden = true, -- hide abandened buffers
incsearch = true,
showmatch = true,
mat = 3, -- matching paren light up (tenths of second)
inccommand = "split", -- view substitutions live
-- VISUAL MODE
whichwrap = "b,s,<,>,h,l", -- reach next/prev line in VISUAL
-- TEXT RELATED
encoding = "utf8",
ignorecase = true, -- for searches
wrap = true,
-- TAB settings
expandtab = true, -- Use spaces instead of tabs
tabstop = 4, -- Number of spaces for a tab
softtabstop = 4, -- Number of spaces for a tab when editing
shiftwidth = 4, -- Number of spaces for autoindent
shiftround = true, -- Round indent to multiple of shiftwidth
smarttab = true, -- Cursor in leading whitespace? -> indent 'shiftwith'
-- INDENT settings
breakindent = true, -- wrapped lines keep indentation level
smartindent = true,
autoindent = true,
-- COPY & PASTE
clipboard = "unnamedplus", -- Read :help on this
listchars = { tab = '» ', trail = '·', nbsp = '' },
list = false, -- off because it conflicts with indentline plugin
completeopt = { "noselect", "fuzzy", "menu", "menuone", "preview" },
}
-- Set options from table
for k, v in pairs(opts) do
vim.opt[k] = v
end
-- WARN:
-- __ __ .__ .__
-- _______/ |______ _/ |_ __ __ _____| | |__| ____ ____ ______
-- / ___/\ __\__ \\ __\ | \/ ___/ | | |/ \_/ __ \ / ___/
-- \___ \ | | / __ \| | | | /\___ \| |_| | | \ ___/ \___ \
-- /____ > |__| (____ /__| |____//____ >____/__|___| /\___ >____ >
-- \/ \/ \/ \/ \/ \/
-- ___. _____ _____ ____ .__
-- \_ |__ __ ___/ ____\/ ____\___________ / _ \ | | __ _______
-- | __ \| | \ __\\ __\/ __ \_ __ \ > _ </\ | | | | \__ \
-- | \_\ \ | /| | | | \ ___/| | \/ / <_\ \/ | |_| | // __ \_
-- |___ /____/ |__| |__| \___ >__| \_____\ \ |____/____/(____ /
-- \/ \/ \/ \/
-- List all open buffers at the top of the window
vim.pack.add({
{ src = GH .. "akinsho/bufferline.nvim", tag = "v4.9.*", },
GH.."nvim-tree/nvim-web-devicons",
})
require("bufferline").setup(
{ options = { mode = "buffers", separator_style = "slant", } }
)
vim.pack.add({
-- { src = GH.."nvim-lualine/lualine.nvim", version = "3946f01" },
-- Use alternate source because it fixes space bug for language icon:
-- https://github.com/nvim-lualine/lualine.nvim/issues/1453
{ src = GH.."monr3d/lualine.nvim" },
GH.."nvim-tree/nvim-web-devicons",
})
require("lualine").setup( CFG.lualine_conf )
-- FIX:
-- ██ ▄█▀▓█████▓██ ██▓ ███▄ ▄███▓ ▄▄▄ ██▓███
-- ██▄█▒ ▓█ ▀ ▒██ ██▒▓██▒▀█▀ ██▒▒████▄ ▓██░ ██▒
-- ▓███▄░ ▒███ ▒██ ██░▓██ ▓██░▒██ ▀█▄ ▓██░ ██▓▒
-- ▓██ █▄ ▒▓█ ▄ ░ ▐██▓░▒██ ▒██ ░██▄▄▄▄██ ▒██▄█▓▒ ▒
-- ▒██▒ █▄░▒████▒ ░ ██▒▓░▒██▒ ░██▒ ▓█ ▓██▒▒██▒ ░ ░
-- ▒ ▒▒ ▓▒░░ ▒░ ░ ██▒▒▒ ░ ▒░ ░ ░ ▒▒ ▓▒█░▒▓▒░ ░ ░
-- ░ ░▒ ▒░ ░ ░ ░▓██ ░▒░ ░ ░ ░ ▒ ▒▒ ░░▒ ░
-- ░ ░░ ░ ░ ▒ ▒ ░░ ░ ░ ░ ▒ ░░
-- ░ ░ ░ ░░ ░ ░ ░ ░
-- ░ ░
vim.pack.add({{ src = GH.."folke/which-key.nvim", version = "v3.17.0" },
GH.."echasnovski/mini.icons",
GH.."nvim-tree/nvim-web-devicons", })
local wk = require("which-key")
-- defaults: "<C-u>" / "<C-d>", using "j"/"k" won't work
local wk_scroll_up = "<Up>"
local wk_scroll_down = "<Down>"
wk.setup( CFG.whichkey_conf(wk_scroll_up, wk_scroll_down) )
wk.add({
{ mode = { "n" },
-- Move up/down on wrapped lines
{ "j", "gj", desc = "Down" },
{ "k", "gk", desc = "Up" },
-- FIX: remove this once done
{ "<C-s>", ":source<cr>", desc = "Reload config :source" },
{ "<C-S-s>", ":source<cr>", desc = "Reload config :source" },
{ "<C-S-d>", ":set background=dark<cr>", desc = "Dark background" },
{ "<C-S-l>", ":set background=light<cr>", desc = "Light background" },
{ "<leader>w", ":write<cr>", desc = "Write" },
{ "<leader>b", group = "buffers" },
{ "<leader>bd", ":bdelete<cr>", desc = "Delete buffer" },
{ "<leader>bn", ":bnext<cr>", desc = "Next buffer" },
{ "<leader>bp", ":bprevious<cr>", desc = "Previous buffer" },
{ "<S-l>", ":bnext<cr>", desc = "Next buffer" },
{ "<S-h>", ":bprevious<cr>", desc = "Previous buffer" },
{ "<leader>t", group = "Telescope" },
{ "<leader>tf", "<cmd>Telescope find_files hidden=true<cr>",
desc = "Telescope Find" },
{ "<leader>tg", "<cmd>Telescope live_grep grep_open_files=true<cr>",
desc = "Telescope Grep" },
{ "<leader>tc", "<cmd>Telescope colorscheme<cr>",
desc = "Telescope Colorscheme" },
{ "<leader>l", group = "LSP" },
{ "<leader>lf", vim.lsp.buf.format, desc = "Auto format buffer" },
{ "<leader>ld", vim.lsp.buf.definition, desc = "Goto definition" },
-- Diagnostic keymaps
{ "<leader>d", vim.diagnostic.open_float, desc = "show diagnostics here" },
{ "<leader>h", vim.lsp.buf.hover, desc = "Hover" },
},
{ mode = { "i" },
{ "<C-s>", "<C-o>:w<cr>", desc = "Write" },
},
{ mode = { "v" },
{ "<", "<gv", desc = "Adjust indentation left" },
{ ">", ">gv", desc = "Adjust indentation right" },
},
{ mode = {"n","i"},
{ "<S-Insert>", "<C-R>*", desc = "Paste" },
-- Bindings fitting for swedish programmer dvorak, same as alacritty
{ "<C-0>", "<C-o>:GUIFontSizeSet 10<cr>", desc = "fontsize = default" },
{ "<C-=>", "<C-o>:GUIFontSizeUp 1<cr>", desc = "fontsize++" },
{ "<C-->", "<C-o>:GUIFontSizeDown 1<cr>", desc = "fontsize--" },
-- Search Highlights
{ "<C-h>", function()
if vim.o.hlsearch
then vim.cmd(":set nohlsearch")
else vim.cmd(":set hlsearch")
end
end,
desc = "Toggle search HLs" },
-- { "<C-S-h>", "<cmd>:set hlsearch<cr>", desc = "Reveal search HLs" },
{ "<C-S-t>", "<cmd>Neotree toggle<cr>", desc = "File explorer" },
},
{ mode = {"n","v"},
-- right click
{ "<leader>r", "<cmd>:popup PopUp<cr>", desc = "RMB PopUp" },
{ "<leader>o", function() require("menu").open("default") end,
desc = "LSP Code Actions" },
-- { "<RightMouse>", function()
-- require("menu.utils").delete_old_menus()
-- vim.cmd.exec("'normal! \\<RightMouse>'")
-- -- clicked buf
-- local buf = vim.api.nvim_win_get_buf(vim.fn.getmousepos().winid)
-- local options = (vim.bo[buf].ft == "NvimTree") and "nvimtree"
-- or "default"
-- require("menu").open(options, { mouse = true })
-- end, desc = "Right click menu lol?" },
},
})
-- Add Alt + n to select BufferLine tabs
for n = 1, 9 do
local lhs = string.format("<A-%d>", n)
local rhs = string.format(":BufferLineGoToBuffer %d<CR>", n)
local d = string.format("Tab %d", n)
local h = 2 <= n and n <= 8 -- hides 7 entries
wk.add({ {lhs, rhs, desc = d, hidden = h, group = "Tab"} })
end
-- TODO:
-- ███████████ ████ ███
-- ▒▒███▒▒▒▒▒███▒▒███ ▒▒▒
-- ▒███ ▒███ ▒███ █████ ████ ███████ ████ ████████ █████
-- ▒██████████ ▒███ ▒▒███ ▒███ ███▒▒███▒▒███ ▒▒███▒▒███ ███▒▒
-- ▒███▒▒▒▒▒▒ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒▒█████
-- ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒▒▒▒███
-- █████ █████ ▒▒████████▒▒███████ █████ ████ █████ ██████
-- ▒▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒▒▒▒ ▒▒▒▒▒███▒▒▒▒▒ ▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒▒
-- ███ ▒███
-- ▒▒██████
-- ▒▒▒▒▒▒
vim.pack.add({
{ src = GH.."nvim-neo-tree/neo-tree.nvim", version = "3.37.3" },
GH.."nvim-lua/plenary.nvim", -- dep
GH.."MunifTanjim/nui.nvim", -- dep
GH.."nvim-tree/nvim-web-devicons", -- opt dep
})
-- file select/search window
vim.pack.add({
{ src = GH.."nvim-telescope/telescope.nvim", branch = "0.1.x" },
GH.."nvim-lua/plenary.nvim",
GH.."nvim-telescope/telescope-fzf-native.nvim", -- opt
GH.."BurntSushi/ripgrep", -- opt
GH.."nvim-tree/nvim-web-devicons", -- opt
GH.."sharkdp/fd", -- opt
})
require("telescope").setup( CFG.telescope_conf )
-- Add comment highlighting for FIX TODO HACK WARN PERF NOTE TEST
vim.pack.add({
{
src = GH.."folke/todo-comments.nvim",
version = "v1.4.0", opts = { signs = false, },
},
GH.."nvim-lua/plenary.nvim", })
require("todo-comments").setup()
-- detect & adjust tabstop etc. automatically
vim.pack.add({ GH.."tpope/vim-sleuth" })
-- colored indentation levels, dark and light rainbows in conf
vim.pack.add({ GH.."lukas-reineke/indent-blankline.nvim" })
CFG.apply_rainbow_colors() -- run initially
CFG.register_indent_blankline() -- Register vim hooks
-- Gives GuiFontSizeUp / GuiFontSizeDown
vim.pack.add({ { src = GH.."ktunprasert/gui-font-resize.nvim" } })
require("gui-font-resize").setup({
options = { charge_by = 1, bounds = { maximum = 24, minimum = 8 } }
})
vim.pack.add({
{ src = GH.."nvzone/menu" },
{ src = GH.."nvzone/volt" },
})
-- require("menu")
-- PERF:
-- ,. ' ,. -, .,
-- / ';\ ,.·'´, ,'\ ,·´ '` ·.'
-- ,' ,'::'\ ,·'´ .·´'´-·'´::::\' \`; `·;·. `·,
-- ,' ;:::';' ; ';:::\::\::;:' ; ,'\::`·, \'
-- '; ,':::;' \·. `·;:'-·'´ ; ,'::'\:::'; ';
-- ; ,':::;' ' \:`·. '`·, ' ; ;:::;'·:.' ,·'\'
-- ,' ,'::;' `·:'`·, \' '; ';: -· '´. ·'´:::'\'
-- ; ';_:,.-·´';\‘ ,.'-:;' ,·\ ; ,-·:'´:\:::::::;·'
-- ', _,.-·'´:\:\‘ ,·'´ ,.·´:::'\ ,' ';::::::'\;:·'´
-- \¨:::::::::::\'; \`*'´\::::::::;·'‘ \·.,·\;-· '´ '
-- '\;::_;:-·'´‘ \::::\:;:·´ \::\:\
-- '¨ '`*'´‘ `'·;·'
-- various syntax highlighters
-- vim.pack.add({ GH.."nvim-treesitter/nvim-treesitter" })
-- require "nvim-treesitter".setup()
-- completion plugin needed to make shit work
vim.pack.add({ { src = GH.."saghen/blink.cmp" }, })
-- local lsp_capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities)
vim.pack.add({ { src = GH.."mason-org/mason.nvim" }, })
require("mason").setup({})
-- should set up the `vim.lsp` object
vim.pack.add({ GH.."/neovim/nvim-lspconfig" })
local lua_ws = { library = vim.api.nvim_get_runtime_file("", true) }
vim.lsp.enable({ "lua_ls" })
vim.lsp.config("lua_ls", { settings = { Lua = { workspace = lua_ws }}})
local elixir_ls_dir = "/home/sasja/.dotfiles/dl_skryptz/elixir-ls-v0.29.3"
vim.pack.add({ GH.."elixir-editors/vim-elixir" })
vim.lsp.enable("elixir-ls")
vim.lsp.config("elixir-ls", { cmd = elixir_ls_dir.."/language_server.sh", })
vim.pack.add({
{ src = GH.."quarto-dev/quarto-nvim" },
{ src = GH.."jmbuhr/otter.nvim" },
{ src = GH.."nvim-treesitter/nvim-treesitter" },
})
vim.lsp.enable("quarto")
-- vim.lsp.config("quarto")
local rustaceanvim_opts = {
server =
{
on_attach = function(_, bufnr)
local lsp_map = require("helper.mapping").lsp_map
lsp_map("<leader>cR", function() vim.cmd.RustLsp("codeAction") end,
bufnr, "Code Action")
lsp_map("<leader>dr", function() vim.cmd.RustLsp("debuggables") end,
bufnr, "Rust Debuggables")
end,
default_settings =
{
-- rust-analyzer language server configuration
["rust-analyzer"] =
{
cargo =
{
allFeatures = true,
loadOutDirsFromCheck = true,
buildScripts =
{
enable = true,
},
},
-- Add clippy lints for Rust.
checkOnSave = true,
procMacro = {
enable = true,
ignored = {
["async-trait"] = { "async_trait" },
["napi-derive"] = { "napi" },
["async-recursion"] = { "async_recursion" },
},
},
},
},
},
}
-- vim.pack.add({
-- { src = GH.."mrcjkb/rustaceanvim", tag = "v6.9.7", ft = "rust",
-- opts = rustaceanvim_opts }
-- })
-- vim.lsp.config( "rustaceanvim" )
-- vim.lsp.enable( "rustaceanvim" )
vim.diagnostic.config({ virtual_text = true })
-- vim: ts=2 sts=2 sw=2 et
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment