diff options
Diffstat (limited to 'pkgs/old-custom-neovim/config/lua')
34 files changed, 1397 insertions, 0 deletions
diff --git a/pkgs/old-custom-neovim/config/lua/art.lua b/pkgs/old-custom-neovim/config/lua/art.lua new file mode 100644 index 0000000..f36a5d9 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/art.lua @@ -0,0 +1,269 @@ +-- Credits to the ascii.nvim plugin and jgs on the ascii art archive. + +Art = { + space = { + saturn = { + [[ ~+ ]], + [[ * + ]], + [[ ' | ]], + [[ () .-.,="``"=. - o - ]], + [[ '=/_ \ | ]], + [[ * | '=._ | ]], + [[ \ `=./`, ' ]], + [[ . '=.__.=' `=' * ]], + [[ + + ]], + [[ O * ' . ]], + }, + }, + neovim = { + default1 = { + [[ __ ]], + [[ ___ ___ ___ __ __ /\_\ ___ ___ ]], + [[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]], + [[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]], + [[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]], + [[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]], + }, + + default2 = { + [[ _______ ____ ____.__ ]], + [[ \ \ ____ ___\ \ / /|__| _____ ]], + [[ / | \_/ __ \/ _ \ Y / | |/ \ ]], + [[/ | \ ___( <_> ) / | | Y Y \]], + [[\____|__ /\___ >____/ \___/ |__|__|_| /]], + [[ \/ \/ \/ ]], + }, + + dos_rebel = { + [[ ]], + [[ ██████ █████ █████ █████ ███ ]], + [[ ░░██████ ░░███ ░░███ ░░███ ░░░ ]], + [[ ░███░███ ░███ ██████ ██████ ░███ ░███ ████ █████████████ ]], + [[ ░███░░███░███ ███░░███ ███░░███ ░███ ░███ ░░███ ░░███░░███░░███ ]], + [[ ░███ ░░██████ ░███████ ░███ ░███ ░░███ ███ ░███ ░███ ░███ ░███ ]], + [[ ░███ ░░█████ ░███░░░ ░███ ░███ ░░░█████░ ░███ ░███ ░███ ░███ ]], + [[ █████ ░░█████░░██████ ░░██████ ░░███ █████ █████░███ █████ ]], + [[ ░░░░░ ░░░░░ ░░░░░░ ░░░░░░ ░░░ ░░░░░ ░░░░░ ░░░ ░░░░░ ]], + [[ ]], + }, + + rowan_cap = { + [[ ]], + [[ dMMMMb dMMMMMP .aMMMb dMP dMP dMP dMMMMMMMMb ]], + [[ dMP dMP dMP dMP"dMP dMP dMP amr dMP"dMP"dMP ]], + [[ dMP dMP dMMMP dMP dMP dMP dMP dMP dMP dMP dMP ]], + [[ dMP dMP dMP dMP.aMP YMvAP" dMP dMP dMP dMP ]], + [[ dMP dMP dMMMMMP VMMMP" VP" dMP dMP dMP dMP ]], + [[ ]], + }, + + isometric = { + [[ ]], + [[ /\__\ /\ \ /\ \ /\__\ ___ /\__\ ]], + [[ /::| | /::\ \ /::\ \ /:/ / /\ \ /::| | ]], + [[ /:|:| | /:/\:\ \ /:/\:\ \ /:/ / \:\ \ /:|:| | ]], + [[ /:/|:| |__ /::\~\:\ \ /:/ \:\ \ /:/__/ ___ /::\__\ /:/|:|__|__ ]], + [[ /:/ |:| /\__\ /:/\:\ \:\__\ /:/__/ \:\__\ |:| | /\__\ __/:/\/__/ /:/ |::::\__\ ]], + [[ \/__|:|/:/ / \:\~\:\ \/__/ \:\ \ /:/ / |:| |/:/ / /\/:/ / \/__/~~/:/ / ]], + [[ |:/:/ / \:\ \:\__\ \:\ /:/ / |:|__/:/ / \::/__/ /:/ / ]], + [[ |::/ / \:\ \/__/ \:\/:/ / \::::/__/ \:\__\ /:/ / ]], + [[ /:/ / \:\__\ \::/ / ~~~~ \/__/ /:/ / ]], + [[ \/__/ \/__/ \/__/ \/__/ ]], + [[ ]], + }, + + ogre = { + [[ ]], + [[ __ _ ]], + [[ /\ \ \___ ___/\ /(_)_ __ ___ ]], + [[ / \/ / _ \/ _ \ \ / | | '_ ` _ \ ]], + [[ / /\ | __| (_) \ V /| | | | | | | ]], + [[ \_\ \/ \___|\___/ \_/ |_|_| |_| |_| ]], + [[ ]], + }, + + slant_relief = { + [[ ]], + [[ /\\\\\_____/\\\_______________________________/\\\________/\\\___________________________ ]], + [[ \/\\\\\\___\/\\\______________________________\/\\\_______\/\\\__________________________ ]], + [[ _\/\\\/\\\__\/\\\______________________________\//\\\______/\\\___/\\\_____________________ ]], + [[ _\/\\\//\\\_\/\\\_____/\\\\\\\\______/\\\\\_____\//\\\____/\\\___\///_____/\\\\\__/\\\\\__ ]], + [[ _\/\\\\//\\\\/\\\___/\\\/////\\\___/\\\///\\\____\//\\\__/\\\_____/\\\__/\\\///\\\\\///\\\_ ]], + [[ _\/\\\_\//\\\/\\\__/\\\\\\\\\\\___/\\\__\//\\\____\//\\\/\\\_____\/\\\_\/\\\_\//\\\__\/\\\ ]], + [[ _\/\\\__\//\\\\\\_\//\\///////___\//\\\__/\\\______\//\\\\\______\/\\\_\/\\\__\/\\\__\/\\\_ ]], + [[ _\/\\\___\//\\\\\__\//\\\\\\\\\\__\///\\\\\/________\//\\\_______\/\\\_\/\\\__\/\\\__\/\\\ ]], + [[ _\///_____\/////____\//////////_____\/////___________\///________\///__\///___\///___\///__ ]], + [[ ]], + }, + + ansi_shadow = { + [[ ]], + [[ ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ]], + [[ ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ]], + [[ ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ]], + [[ ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ]], + [[ ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ]], + [[ ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ]], + [[ ]], + }, + + bloody = { + [[ ]], + [[ ███▄ █ ▓█████ ▒█████ ██▒ █▓ ██▓ ███▄ ▄███▓ ]], + [[ ██ ▀█ █ ▓█ ▀ ▒██▒ ██▒▓██░ █▒▓██▒▓██▒▀█▀ ██▒ ]], + [[ ▓██ ▀█ ██▒▒███ ▒██░ ██▒ ▓██ █▒░▒██▒▓██ ▓██░ ]], + [[ ▓██▒ ▐▌██▒▒▓█ ▄ ▒██ ██░ ▒██ █░░░██░▒██ ▒██ ]], + [[ ▒██░ ▓██░░▒████▒░ ████▓▒░ ▒▀█░ ░██░▒██▒ ░██▒ ]], + [[ ░ ▒░ ▒ ▒ ░░ ▒░ ░░ ▒░▒░▒░ ░ ▐░ ░▓ ░ ▒░ ░ ░ ]], + [[ ░ ░░ ░ ▒░ ░ ░ ░ ░ ▒ ▒░ ░ ░░ ▒ ░░ ░ ░ ]], + [[ ░ ░ ░ ░ ░ ░ ░ ▒ ░░ ▒ ░░ ░ ]], + [[ ░ ░ ░ ░ ░ ░ ░ ░ ]], + [[ ░ ]], + [[ ]], + }, + + delta_corps_priest1 = { + [[ ]], + [[ ███▄▄▄▄ ▄████████ ▄██████▄ ▄█ █▄ ▄█ ▄▄▄▄███▄▄▄▄ ]], + [[ ███▀▀▀██▄ ███ ███ ███ ███ ███ ███ ███ ▄██▀▀▀███▀▀▀██▄ ]], + [[ ███ ███ ███ █▀ ███ ███ ███ ███ ███▌ ███ ███ ███ ]], + [[ ███ ███ ▄███▄▄▄ ███ ███ ███ ███ ███▌ ███ ███ ███ ]], + [[ ███ ███ ▀▀███▀▀▀ ███ ███ ███ ███ ███▌ ███ ███ ███ ]], + [[ ███ ███ ███ █▄ ███ ███ ███ ███ ███ ███ ███ ███ ]], + [[ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ]], + [[ ▀█ █▀ ██████████ ▀██████▀ ▀██████▀ █▀ ▀█ ███ █▀ ]], + [[ ]], + }, + + elite = { + [[ ]], + [[ ▐ ▄ ▄▄▄ . ▌ ▐·▪ • ▌ ▄ ·. ]], + [[ •█▌▐█▀▄.▀·▪ ▪█·█▌██ ·██ ▐███▪ ]], + [[ ▐█▐▐▌▐▀▀▪▄ ▄█▀▄ ▐█▐█•▐█·▐█ ▌▐▌▐█· ]], + [[ ██▐█▌▐█▄▄▌▐█▌.▐▌ ███ ▐█▌██ ██▌▐█▌ ]], + [[ ▀▀ █▪ ▀▀▀ ▀█▄▀▪. ▀ ▀▀▀▀▀ █▪▀▀▀ ]], + [[ ]], + }, + + the_edge = { + [[ ]], + [[ ▄ ▄███▄ ████▄ ▄ ▄█ █▀▄▀█ ]], + [[ █ █▀ ▀ █ █ █ ██ █ █ █ ]], + [[ ██ █ ██▄▄ █ █ █ █ ██ █ ▄ █ ]], + [[ █ █ █ █▄ ▄▀ ▀████ █ █ ▐█ █ █ ]], + [[ █ █ █ ▀███▀ █ █ ▐ █ ]], + [[ █ ██ █▐ ▀ ]], + [[ ▐ ]], + [[ ]], + }, + + banner3 = { + [[ ]], + [[ ## ## ######## ####### ## ## #### ## ## ]], + [[ ### ## ## ## ## ## ## ## ### ### ]], + [[ #### ## ## ## ## ## ## ## #### #### ]], + [[ ## ## ## ###### ## ## ## ## ## ## ### ## ]], + [[ ## #### ## ## ## ## ## ## ## ## ]], + [[ ## ### ## ## ## ## ## ## ## ## ]], + [[ ## ## ######## ####### ### #### ## ## ]], + [[ ]], + }, + + colossal = { + [[ ]], + [[ 888b 888 888 888 d8b ]], + [[ 8888b 888 888 888 Y8P ]], + [[ 88888b 888 888 888 ]], + [[ 888Y88b 888 .d88b. .d88b. Y88b d88P 888 88888b.d88b. ]], + [[ 888 Y88b888 d8P Y8b d88""88b Y88b d88P 888 888 "888 "88b ]], + [[ 888 Y88888 88888888 888 888 Y88o88P 888 888 888 888 ]], + [[ 888 Y8888 Y8b. Y88..88P Y888P 888 888 888 888 ]], + [[ 888 Y888 "Y8888 "Y88P" Y8P 888 888 888 888 ]], + [[ ]], + }, + + decimal = { + [[ ]], + [[ 78 101 111 86 105 109 ]], + [[ ]], + }, + + def_leppard = { + [[ ]], + [[ : ]], + [[ L. ,; t#, ]], + [[ EW: ,ft f#i ;##W. t ]], + [[ E##; t#E .E#t :#L:WE Ej .. : ]], + [[ E###t t#E i#W, .KG ,#D t .DD.E#, ,W, .Et ]], + [[ E#fE#f t#E L#D. EE ;#f EK: ,WK. E#t t##, ,W#t ]], + [[ E#t D#G t#E :K#Wfff; f#. t#iE#t i#D E#t L###, j###t ]], + [[ E#t f#E. t#E i##WLLLLt :#G GK E#t j#f E#t .E#j##, G#fE#t ]], + [[ E#t t#K: t#E .E#L ;#L LW. E#tL#i E#t ;WW; ##,:K#i E#t ]], + [[ E#t ;#W,t#E f#E: t#f f#: E#WW, E#t j#E. ##f#W, E#t ]], + [[ E#t :K#D#E ,WW; f#D#; E#K: E#t .D#L ###K: E#t ]], + [[ E#t .E##E .D#; G#t ED. E#t :K#t ##D. E#t ]], + [[ .. G#E tt t t E#t ... #G .. ]], + [[ fE ,;. j ]], + [[ , ]], + [[ ]], + }, + + larry_3d = { + [[ ]], + [[ __ __ __ __ ]], + [[ /\ \/\ \ /\ \/\ \ __ ]], + [[ \ \ `\\ \ __ ___\ \ \ \ \/\_\ ___ ___ ]], + [[ \ \ , ` \ /'__`\ / __`\ \ \ \ \/\ \ /' __` __`\ ]], + [[ \ \ \`\ \/\ __//\ \L\ \ \ \_/ \ \ \/\ \/\ \/\ \ ]], + [[ \ \_\ \_\ \____\ \____/\ `\___/\ \_\ \_\ \_\ \_\ ]], + [[ \/_/\/_/\/____/\/___/ `\/__/ \/_/\/_/\/_/\/_/ ]], + [[ ]], + }, + + lean = { + [[ ]], + [[ _/ _/ _/ _/ _/ ]], + [[ _/_/ _/ _/_/ _/_/ _/ _/ _/_/_/ _/_/ ]], + [[ _/ _/ _/ _/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ ]], + [[ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ ]], + [[ _/ _/ _/_/_/ _/_/ _/ _/ _/ _/ _/ ]], + [[ ]], + }, + + morse = { + [[ ]], + [[ -. . --- ...- .. -- ]], + [[ ]], + }, + + sharp = { + [[ ]], + [[ ]], + [[ ████ ██████ █████ ██ ]], + [[ ███████████ █████ ]], + [[ █████████ ███████████████████ ███ ███████████ ]], + [[ █████████ ███ █████████████ █████ ██████████████ ]], + [[ █████████ ██████████ █████████ █████ █████ ████ █████ ]], + [[ ███████████ ███ ███ █████████ █████ █████ ████ █████ ]], + [[ ██████ █████████████████████ ████ █████ █████ ████ ██████ ]], + [[ ]], + }, + }, + misc = { + hydra = { + [[ ]], + [[ ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ]], + [[ ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ]], + [[ ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ]], + [[ ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ]], + [[ ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ]], + [[ ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ]], + [[ ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ]], + [[ ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ]], + [[ ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ]], + [[ ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ]], + [[ ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ]], + [[ ]], + }, + }, +} diff --git a/pkgs/old-custom-neovim/config/lua/autocommands.lua b/pkgs/old-custom-neovim/config/lua/autocommands.lua new file mode 100644 index 0000000..c452696 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/autocommands.lua @@ -0,0 +1,9 @@ +-- Autocommands + +-- Equalize Splits when resized +vim.api.nvim_create_autocmd({"VimResized"}, { + callback = function() + -- vim.cmd.wincmd("=") + vim.cmd("FocusAutoresize") + end, +}) diff --git a/pkgs/old-custom-neovim/config/lua/colorschemes.lua b/pkgs/old-custom-neovim/config/lua/colorschemes.lua new file mode 100644 index 0000000..cbbbd60 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/colorschemes.lua @@ -0,0 +1,8 @@ +-- Set colorscheme. +vim.cmd.colorscheme("carbonfox") + +-- Enable good colors. +vim.o.termguicolors = true + +-- Require colorscheme patches. +require("colorschemes.carbonfox") diff --git a/pkgs/old-custom-neovim/config/lua/colorschemes/carbonfox.lua b/pkgs/old-custom-neovim/config/lua/colorschemes/carbonfox.lua new file mode 100644 index 0000000..a3bba87 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/colorschemes/carbonfox.lua @@ -0,0 +1,25 @@ +local link_highlight = Utils.link_highlight + +vim.api.nvim_create_autocmd({"ColorScheme", "VimEnter"}, { + callback = function() + -- Fixes some colorschemes having borderless floating windows. + if vim.g.colors_name == "carbonfox" then + + link_highlight("VertSplit", "Variable") + + -- link_highlight("FloatBorder", "Comment") + + -- Telescope-specific highlights + -- link_highlight("TelescopeBorder", "Comment") + -- link_highlight("TelescopeResultsTitle", "Variable") + -- link_highlight("TelescopePreviewTitle", "Variable") + -- link_highlight("TelescopePromptTitle", "Variable") + -- link_highlight("TelescopePromptNormal", "Variable") + -- link_highlight("TelescopePromptBorder", "Variable") + -- link_highlight("TelescopePromptPrefix", "Variable") + + -- Snacks-specific highlights + -- link_highlight("SnacksPickerDir", "SnacksPickerFile") + end + end, +}) diff --git a/pkgs/old-custom-neovim/config/lua/completion.lua b/pkgs/old-custom-neovim/config/lua/completion.lua new file mode 100644 index 0000000..1ba2a91 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/completion.lua @@ -0,0 +1,98 @@ +vim.opt.completeopt = {'menu', 'menuone', 'noselect'} + +require('luasnip.loaders.from_vscode').lazy_load() + +local cmp = require('cmp') +local luasnip = require('luasnip') + +local select_opts = {behavior = cmp.SelectBehavior.Select} + +cmp.setup({ + enabled = function() -- Disable in certain circumstances + local disabled = false + disabled = disabled or (vim.api.nvim_get_option_value('buftype', { buf = 0 }) == 'prompt') -- While in prompts. + disabled = disabled or (vim.fn.reg_recording() ~= '') + disabled = disabled or (vim.fn.reg_executing() ~= '') + disabled = disabled or require('cmp.config.context').in_treesitter_capture('comment') -- While in comments. + return not disabled + end, + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end + }, + sources = { + {name = 'path'}, + {name = 'nvim_lsp', keyword_length = 1}, + {name = 'buffer', keyword_length = 3}, + {name = 'luasnip', keyword_length = 2}, + }, + window = { + documentation = cmp.config.window.bordered() + }, + formatting = { + fields = {'menu', 'abbr', 'kind'}, + format = function(entry, item) + local menu_icon = { + nvim_lsp = 'λ', + luasnip = '⋗', + buffer = 'Ω', + path = '🖫', + } + + item.menu = menu_icon[entry.source.name] + return item + end, + }, + mapping = { + -- ['<Up>'] = cmp.mapping.select_prev_item(select_opts), + -- ['<Down>'] = cmp.mapping.select_next_item(select_opts), + + ['<C-p>'] = cmp.mapping.select_prev_item(select_opts), + ['<C-n>'] = cmp.mapping.select_next_item(select_opts), + + ['<C-u>'] = cmp.mapping.scroll_docs(-4), + ['<C-d>'] = cmp.mapping.scroll_docs(4), + + ['<C-e>'] = cmp.mapping.abort(), + -- ['<esc>'] = cmp.mapping.abort(), + ['<C-y>'] = cmp.mapping.confirm({select = true}), + ['<CR>'] = cmp.mapping.confirm({select = false}), + + ['<C-f>'] = cmp.mapping(function(fallback) + if luasnip.jumpable(1) then + luasnip.jump(1) + else + fallback() + end + end, {'i', 's'}), + + ['<C-b>'] = cmp.mapping(function(fallback) + if luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, {'i', 's'}), + + ['<Tab>'] = cmp.mapping(function(fallback) + local col = vim.fn.col('.') - 1 + + if cmp.visible() then + cmp.select_next_item(select_opts) + elseif col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then + fallback() + else + -- cmp.complete() + end + end, {'i', 's'}), + + ['<S-Tab>'] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item(select_opts) + else + fallback() + end + end, {'i', 's'}), + }, +}) diff --git a/pkgs/old-custom-neovim/config/lua/lsp.lua b/pkgs/old-custom-neovim/config/lua/lsp.lua new file mode 100644 index 0000000..a01758c --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/lsp.lua @@ -0,0 +1,87 @@ +-- Disable semantic tokens to stop weird highlighting. +vim.api.nvim_create_autocmd('LspAttach', { + callback = function(ev) + local client = vim.lsp.get_client_by_id(ev.data.client_id) + if client then + client.server_capabilities.semanticTokensProvider = nil + end + end +}) + +-- Use LspAttach autocommand to only map the following keys +-- after the language server attaches to the current buffer +vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + -- Enable completion triggered by <c-x><c-o> + -- vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' + + local mapkey = Utils.mapkey + + -- Workspace management + mapkey('n', "<leader>o", "Manage LSP workspace", "") + mapkey('n', '<leader>oa', "Add Workspace Folder", vim.lsp.buf.add_workspace_folder) + mapkey('n', '<leader>or', "Remove Workspace Folder", vim.lsp.buf.remove_workspace_folder) + mapkey('n', '<leader>ol', "List Workspace Folders", function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end) + + -- LSP Pickers + mapkey('n', "<leader>a", "Perform code action", ":lua require('actions-preview').code_actions()<cr>") + -- mapkey("n", "<leader>I", "Open workspace diagnostic picker", ":Namu diagnostics<cr>") + mapkey("n", "<leader>i", "Open diagnostic picker", ":Namu diagnostics<cr>") + mapkey("n", "<leader>s", "Open symbol picker", ":Namu symbols<cr>") + mapkey("n", "<leader>S", "Open workspace symbol picker", ":Namu workspace<cr>") + + -- Goto Keys + mapkey('n', 'gD', "Go to declaration", vim.lsp.buf.declaration) + mapkey('n', 'gd', "Go to definition", vim.lsp.buf.definition) + mapkey('n', 'go', "Go to type definition", vim.lsp.buf.type_definition) + mapkey('n', 'gi', "Go to implementation", vim.lsp.buf.implementation) + + -- Other LSP Keys + mapkey('n', 'gs', "Signature Help", vim.lsp.buf.signature_help) + mapkey('n', 'gr', "Buffer References", vim.lsp.buf.references) + mapkey('n', '<leader>r', "Rename Symbol", vim.lsp.buf.rename) + mapkey('n', '<leader>h', "Format Buffer", function() + vim.lsp.buf.format { async = true } + end) + end, +}) + +local lspconfig = require('lspconfig') + +-- Configure individual lsps +lspconfig.nil_ls.setup {} +lspconfig.lua_ls.setup { + on_init = function(client) + local path = client.workspace_folders[1].name + if vim.loop.fs_stat(path..'/.luarc.json') or vim.loop.fs_stat(path..'/.luarc.jsonc') then + return + end + + client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, { + runtime = { + -- Tell the language server which version of Lua you're using + -- (most likely LuaJIT in the case of Neovim) + version = 'LuaJIT' + }, + -- Make the server aware of Neovim runtime files + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME, + -- Depending on the usage, you might want to add additional paths here. + "${3rd}/luv/library" + -- "${3rd}/busted/library", + } + -- or pull in all of 'runtimepath'. NOTE: this is a lot slower + -- library = vim.api.nvim_get_runtime_file("", true) + } + }) + end, + settings = { + Lua = {} + } +} +lspconfig.marksman.setup {} diff --git a/pkgs/old-custom-neovim/config/lua/mappings.lua b/pkgs/old-custom-neovim/config/lua/mappings.lua new file mode 100644 index 0000000..cab9565 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/mappings.lua @@ -0,0 +1,113 @@ +-- Keymap function. +local mapkey = Utils.mapkey + +-- Map the leader key. +vim.g.mapleader = ' ' + +-- Pickers +mapkey("n", "<leader>f", "Open file picker", ":lua Snacks.picker.files()<cr>") +mapkey("n", "<leader>l", "Open recent file picker", ":lua Snacks.picker.recent()<cr>") +mapkey("n", "<leader>L", "Go to most recent buffer", ":b#<cr>") +mapkey("n", "<leader>y", "Open clipboard history picker", ":lua Snacks.picker.cliphist()<cr>") +mapkey("n", "<leader>/", "Open live grep picker", ":lua Snacks.picker.grep()<cr>") +mapkey("n", "<leader>\\", "Open command palette", ":lua Snacks.picker.commands()<cr>") +mapkey("n", "<leader>?", "Open help picker", ":lua Snacks.picker.help()<cr>") +mapkey("n", "<leader>p", "Open picker picker", ":lua Snacks.picker.pickers()<cr>") +mapkey("n", "<leader>'", "Open last picker", ":lua Snacks.picker.resume()<cr>") +mapkey("n", "<leader><leader>", "Open smart picker", ":lua Snacks.picker.smart()<cr>") +mapkey("n", "<leader>z", "Open zoxide picker", ":lua Snacks.picker.zoxide()<cr>") +mapkey("n", "<leader>R", "Open treesitter picker", ":Namu treesitter<cr>") +mapkey("n", "<leader>k", "Open colorscheme picker", ":Namu colorscheme<cr>") + +-- Dropbar +mapkey("n", "<leader>j", "Open dropdown", ":lua require('dropbar.api').pick()<cr>") + +-- Tabs +mapkey("n", "<leader>t", "Manage tabs", "") +mapkey("n", "<leader>to", "Open new tab", ":tabnew<cr>") +mapkey("n", "<leader>tc", "Close tab", ":tabclose<cr>") +mapkey("n", "<leader>tt", "Go to next tab", ":tabnext<cr>") +mapkey("n", "<leader>tT", "Go to previous tab", ":tabprev<cr>") + +-- Buffers +mapkey("n", "<leader>b", "Manage buffers", "") +mapkey("n", "<leader>bb", "Go to next buffer", ":bn<cr>") +mapkey("n", "<leader>bB", "Go to previous buffer", ":bp<cr>") +mapkey("n", "<leader>bd", "Delete current buffer", ":bd<cr>") +mapkey("n", "<leader>bD", "Force delete current buffer", ":bd!<cr>") +mapkey("n", "<leader>bp", "Open buffer picker", ":lua Snacks.picker.buffers()<cr>") +mapkey("n", "<leader>bg", "Open buffer live grep picker", ":lua Snacks.picker.grep_buffers()<cr>") +mapkey("n", "<leader>bc", "Clear invisible buffers", function () + local bufinfos = vim.fn.getbufinfo({buflisted = 1}) + vim.tbl_map(function (bufinfo) + if bufinfo.changed == 0 and (not bufinfo.windows or #bufinfo.windows == 0) then + vim.api.nvim_buf_delete(bufinfo.bufnr, {force = false, unload = false}) + vim.cmd.redrawtabline() + end + end, bufinfos) +end) + +-- Windows +mapkey("n", "<leader>w", "Manage windows", "<C-w>") +mapkey("n", "<C-w>S", "Open new horizontally", ":new<cr>") +mapkey("n", "<leader>wS", "Open new horizontally", ":new<cr>") +mapkey("n", "<C-w>V", "Open new vertically", ":vnew<cr>") +mapkey("n", "<leader>wV", "Open new vertically", ":vnew<cr>") + +-- Sessions +mapkey("n", "<leader>m", "Manage sessions", "") +mapkey("n", "<leader>mm", "Open session picker", ":Autosession search<cr>") +mapkey("n", "<leader>md", "Delete a session", ":Autosession delete<cr>") + +-- Terminals +mapkey("n", "<leader>c", "Manage terminals", "") +mapkey("n", "<leader>cc", "Toggle terminal", ":lua Snacks.terminal.toggle()<cr>") +mapkey("n", "<leader>co", "Open new terminal", ":lua Snacks.terminal.open()<cr>") + +-- Git +mapkey("n", "<leader>g", "Manage git", "") +mapkey("n", "<leader>gg", "Open lazygit", ":lua Snacks.lazygit()<cr>") +mapkey("n", "<leader>ga", "Add the current file", ":Git add %<cr>") +mapkey("n", "<leader>gs", "Open git status picker", ":lua Snacks.picker.git_status()<cr>") + +-- Other leader keys +mapkey("n", "<leader>e", "Open file manager", ":lua MiniFiles.open()<cr>") + +-- QOL Keys +mapkey("t", "<Esc><Esc>", "Exit terminal insert mode", "<C-\\><C-n>") +vim.keymap.set("c", "<cr>", function() + if vim.fn.pumvisible() == 1 then return '<c-y>' end + return '<cr>' +end, { expr = true }) -- Make enter complete command. +mapkey("n", "<esc>", "Clear highlights", ":noh<cr>") -- Make esc clear highlights + +-- Newline in normal mode. +mapkey('n', '<CR>', "Add newline below", 'm`o<Esc>``') +mapkey('n', '<S-CR>', "Add newline above", 'm`O<Esc>``') + +-- Really delete +mapkey({"n", "v"}, "<leader>d", "Really delete", [["_d]]) +mapkey({"n", "v"}, "<leader>x", "Really delete character", [["_x]]) + +-- Visual Movement Keys. +mapkey({"n", "v"}, "j", "Go down visually", "gj") +mapkey({"n", "v"}, "k", "Go up visually", "gk") + +-- Exit neovim +mapkey("n", "<leader>q", "Save and exit neovim", function() + vim.cmd("wa!") + vim.cmd("qa!") +end) + +mapkey("n", "<leader>Q", "Exit neovim", function() + vim.cmd("qa!") +end) + +-- Dimming +mapkey("n", "<leader>u", "Toggle scope dimming", function() + if Snacks.dim.enabled then + Snacks.dim.disable() + else + Snacks.dim.enable() + end +end) diff --git a/pkgs/old-custom-neovim/config/lua/neovide.lua b/pkgs/old-custom-neovim/config/lua/neovide.lua new file mode 100644 index 0000000..9d648c4 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/neovide.lua @@ -0,0 +1,48 @@ +if vim.g.neovide then + vim.o.guifont = "CodeNewRoman Nerd Font:h12" + vim.g.neovide_scale_factor = 0.8 + + vim.g.neovide_floating_shadow = false + + -- Zoom keymaps. + local change_scale_factor = function(delta) + vim.g.neovide_scale_factor = vim.g.neovide_scale_factor + delta + end + vim.keymap.set("n", "<C-=>", function() + change_scale_factor(0.05) + end) + vim.keymap.set("n", "<C-->", function() + change_scale_factor(-0.05) + end) + + -- Standard terminal emulator keymaps. + vim.api.nvim_set_keymap("c", "<sc-v>", "<C-R>+", { noremap = true }) -- Paste in command mode. + vim.api.nvim_set_keymap('t', '<sc-v>', '<C-\\><C-n>"+Pi', {noremap = true}) -- Paste in terminal mode. + + + local positionAnimationLength = 0.2 + local scrollAnimationFarLines = 0.1 + local scrollAnimationLength = 0.1 + vim.g.neovide_position_animation_length = positionAnimationLength + vim.g.neovide_scroll_animation_far_lines = scrollAnimationFarLines + vim.g.neovide_scroll_animation_length = scrollAnimationLength + + -- Don't smooth scroll in terminals. + vim.api.nvim_create_autocmd("BufEnter", { + pattern = "*", + callback = function(args) + local filetype = vim.api.nvim_buf_get_option(args.buf, "filetype") + + -- When entering terminal for first time I noticed the filetype is empty + if filetype == '' or filetype == 'terminal' then + vim.g.neovide_position_animation_length = 0 + vim.g.neovide_scroll_animation_far_lines = 0 + vim.g.neovide_scroll_animation_length = 0 + else + vim.g.neovide_position_animation_length = positionAnimationLength + vim.g.neovide_scroll_animation_far_lines = scrollAnimationFarLines + vim.g.neovide_scroll_animation_length = scrollAnimationLength + end + end, + }) +end diff --git a/pkgs/old-custom-neovim/config/lua/options.lua b/pkgs/old-custom-neovim/config/lua/options.lua new file mode 100644 index 0000000..20f3e01 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/options.lua @@ -0,0 +1,58 @@ +-- General Settings +vim.o.winborder = 'rounded' +vim.o.showtabline = 2 -- whether to only show tabline if there is more than one tab. +vim.o.laststatus = 3 -- only have one statusline at the bottom of the window. +vim.o.showmode = false -- don't show the mode in the commandline. +vim.o.ruler = false -- don't show #,# in the commandline. +vim.o.icm = 'split' +vim.o.cia = 'abbr,kind,menu' +vim.o.mouse = "" +vim.o.number = true -- set absolute numbered lines +-- vim.o.relativenumber = true -- set relative numbered lines +vim.o.scrolloff = 4 -- minimal number of screen lines to keep above and below the cursor +vim.o.signcolumn = "yes" -- always show the sign column, otherwise it would shift the text each time +vim.o.clipboard = "unnamedplus" -- use system clipboard +-- vim.o.equalalways = true -- equalize splits +vim.o.sessionoptions = "blank,curdir,folds,help,tabpages,winsize,winpos,terminal,globals,buffers,localoptions" -- define what is saved with the session. + +-- Split Behavior +vim.o.splitright = true +vim.o.splitbelow = true + +-- Indention +local indent = 2 +vim.o.autoindent = true -- auto indentation +vim.o.expandtab = true -- convert tabs to spaces +vim.o.shiftwidth = indent -- the number of spaces inserted for each indentation +vim.o.smartindent = true -- make indenting smarter +vim.o.softtabstop = indent -- when hitting <BS>, pretend like a tab is removed, even if spaces +vim.o.tabstop = indent -- insert 2 spaces for a tab +vim.o.shiftround = true -- use multiple of shiftwidth when indenting with "<" and ">" + +-- Backups +vim.o.backup = false -- create a backup file +vim.o.swapfile = false -- creates a swapfile +vim.o.writebackup = false -- if a file is being edited by another program, it is not allowed to be edited + +-- Search +vim.o.hlsearch = true -- highlight all matches on previous search pattern +vim.o.ignorecase = true -- ignore case in search patterns +vim.o.smartcase = true -- smart case + +-- Folding +vim.o.foldmethod = "expr" +vim.o.foldexpr = "v:lua.vim.treesitter.foldexpr()" -- Set folder to treesitter. +vim.o.foldlevel = 99 -- Don't fold initially. +vim.o.foldnestmax = 4 -- Don't fold if more than 4 folds deep. +vim.o.foldtext = "" -- Color text in folds. + +-- Thick window borders. +vim.opt.fillchars = { + horiz = '━', + horizup = '┻', + horizdown = '┳', + vert = '┃', + vertleft = '┫', + vertright = '┣', + verthoriz = '╋', +} diff --git a/pkgs/old-custom-neovim/config/lua/plugins/actions-preview.lua b/pkgs/old-custom-neovim/config/lua/plugins/actions-preview.lua new file mode 100644 index 0000000..0e3cc02 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/actions-preview.lua @@ -0,0 +1,3 @@ +require("actions-preview").setup { + backend = {"snacks"} +} diff --git a/pkgs/old-custom-neovim/config/lua/plugins/auto-session.lua b/pkgs/old-custom-neovim/config/lua/plugins/auto-session.lua new file mode 100644 index 0000000..99df59b --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/auto-session.lua @@ -0,0 +1 @@ +require("auto-session").setup() diff --git a/pkgs/old-custom-neovim/config/lua/plugins/comment.lua b/pkgs/old-custom-neovim/config/lua/plugins/comment.lua new file mode 100644 index 0000000..bd47faf --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/comment.lua @@ -0,0 +1 @@ +require("Comment").setup() diff --git a/pkgs/old-custom-neovim/config/lua/plugins/dropbar.lua b/pkgs/old-custom-neovim/config/lua/plugins/dropbar.lua new file mode 100644 index 0000000..5d4bb43 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/dropbar.lua @@ -0,0 +1,43 @@ +local dropbar = require('dropbar') +local sources = require('dropbar.sources') +local utils = require('dropbar.utils') + +Utils.link_highlight("DropBarFileName", "MiniFilesTitleFocused") + +local custom_path = { + get_symbols = function(buff, win, cursor) + local symbols = sources.path.get_symbols(buff, win, cursor) + symbols[#symbols].name_hl = 'DropBarFileName' + if vim.bo[buff].modified then + symbols[#symbols].name = symbols[#symbols].name .. ' [+]' + symbols[#symbols].name_hl = 'DropBarFileName' + symbols[#symbols].truncate = false + end + return symbols + end, +} + +dropbar.setup({ + bar = { + sources = function(buf, _) + if vim.bo[buf].ft == 'markdown' then + return { + custom_path, + sources.markdown, + } + end + -- if vim.bo[buf].buftype == 'terminal' then + -- return { + -- sources.terminal, + -- } + -- end + return { + custom_path, + utils.source.fallback { + sources.lsp, + sources.treesitter, + }, + } + end, + }, +}) diff --git a/pkgs/old-custom-neovim/config/lua/plugins/fidget.lua b/pkgs/old-custom-neovim/config/lua/plugins/fidget.lua new file mode 100644 index 0000000..4f1ab35 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/fidget.lua @@ -0,0 +1 @@ +require("fidget").setup() diff --git a/pkgs/old-custom-neovim/config/lua/plugins/focus.lua b/pkgs/old-custom-neovim/config/lua/plugins/focus.lua new file mode 100644 index 0000000..560f3ce --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/focus.lua @@ -0,0 +1,18 @@ +require("focus").setup { + enable = true, + split = { + -- bufnew = true, + }, + ui = { + winhighlight = true, -- Highlight focused and unfocused windows + signcolumn = false, -- Signcolumn on all windows + -- cursorline = false, + }, +} + +vim.api.nvim_create_autocmd("WinEnter", { + pattern = "picker", + callback = function(args) + vim.b[args.buf].cursorline = false + end, +}) diff --git a/pkgs/old-custom-neovim/config/lua/plugins/gitsigns.lua b/pkgs/old-custom-neovim/config/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..d16d238 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/gitsigns.lua @@ -0,0 +1 @@ +require("gitsigns").setup() diff --git a/pkgs/old-custom-neovim/config/lua/plugins/incline.lua b/pkgs/old-custom-neovim/config/lua/plugins/incline.lua new file mode 100644 index 0000000..92ced03 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/incline.lua @@ -0,0 +1,25 @@ +local icons = require 'mini.icons' +require('incline').setup { + hide = { + only_win = true, + }, + window = { + padding = 0, + margin = { horizontal = 0 }, + }, + render = function(props) + local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ':t') + if filename == '' then + filename = '[No Name]' + end + local ft_icon, ft_hl = icons.get("file", filename) + local modified = vim.bo[props.buf].modified + return { + ft_icon and { ' ', ft_icon, ' ', gui = ft_hl } or '', + ' ', + { filename, gui = 'bold' }, + ' ', + modified and '[+] ' or '', + } + end, +} diff --git a/pkgs/old-custom-neovim/config/lua/plugins/mini/clue.lua b/pkgs/old-custom-neovim/config/lua/plugins/mini/clue.lua new file mode 100644 index 0000000..3dcac1b --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/mini/clue.lua @@ -0,0 +1,66 @@ +local miniclue = require('mini.clue') +miniclue.setup({ + triggers = { + -- Leader triggers + { mode = 'n', keys = '<Leader>' }, + { mode = 'v', keys = '<Leader>' }, + + -- Built-in completion + { mode = 'i', keys = '<C-x>' }, + + -- `g` key + { mode = 'n', keys = 'g' }, + { mode = 'v', keys = 'g' }, + + -- Marks + { mode = 'n', keys = "'" }, + { mode = 'v', keys = "'" }, + { mode = 'n', keys = '`' }, + { mode = 'v', keys = '`' }, + + -- Registers + { mode = 'n', keys = '"' }, + { mode = 'v', keys = '"' }, + { mode = 'i', keys = '<C-r>' }, + { mode = 'c', keys = '<C-r>' }, + + -- Window commands + { mode = 'n', keys = '<C-w>' }, + -- { mode = 'n', keys = '<leader>w' }, + + -- `z` key + { mode = 'v', keys = 'z' }, + { mode = 'n', keys = 'z' }, + }, + + clues = { + { mode = {'n', 'v'}, keys = '<Leader>' }, + miniclue.gen_clues.builtin_completion(), + miniclue.gen_clues.g(), + miniclue.gen_clues.marks(), + miniclue.gen_clues.registers(), + miniclue.gen_clues.windows(), + Utils.replaceInTable(miniclue.gen_clues.windows(), "<C%-w>", "<leader>w"), + miniclue.gen_clues.z(), + }, + + window = { + delay = 0, + + scroll_down = "<C-d>", + scroll_up = "<C-u>", + }, +}) + +vim.api.nvim_create_autocmd("TermOpen", { + callback = function() + vim.cmd.lua("MiniClue.ensure_buf_triggers()") + end, +}) + +vim.api.nvim_create_autocmd("User", { + pattern = "MiniFilesWindowOpen", + callback = function() + vim.cmd.lua("MiniClue.ensure_buf_triggers()") + end, +}) diff --git a/pkgs/old-custom-neovim/config/lua/plugins/mini/cursorword.lua b/pkgs/old-custom-neovim/config/lua/plugins/mini/cursorword.lua new file mode 100644 index 0000000..530b88b --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/mini/cursorword.lua @@ -0,0 +1 @@ +require("mini.cursorword").setup() diff --git a/pkgs/old-custom-neovim/config/lua/plugins/mini/files.lua b/pkgs/old-custom-neovim/config/lua/plugins/mini/files.lua new file mode 100644 index 0000000..1dc1c3e --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/mini/files.lua @@ -0,0 +1,91 @@ +require("mini.files").setup { + mappings = { + close = '<esc>', + go_in = 'L', + go_in_plus = "<cr>", + go_out = 'H', + go_out_plus = '<c-h>', + mark_goto = "'", + mark_set = 'm', + reset = '<bs>', + reveal_cwd = '@', + show_help = 'g?', + synchronize = '=', + trim_left = '<', + trim_right = '>', + }, + windows = { + preview = true, + }, +} + +-- Set focused directory as current working directory +local set_cwd = function() + local path = (MiniFiles.get_fs_entry() or {}).path + if path == nil then return vim.notify('Cursor is not on valid entry') end + vim.fn.chdir(vim.fs.dirname(path)) +end + +-- Yank in register full path of entry under cursor +local yank_path = function() + local path = (MiniFiles.get_fs_entry() or {}).path + if path == nil then return vim.notify('Cursor is not on valid entry') end + vim.fn.setreg(vim.v.register, path) +end + +-- Open path with system default handler (useful for non-text files) +local ui_open = function() vim.ui.open(MiniFiles.get_fs_entry().path) end + +vim.api.nvim_create_autocmd('User', { + pattern = 'MiniFilesBufferCreate', + callback = function(args) + local b = args.data.buf_id + vim.keymap.set('n', 'g~', set_cwd, { buffer = b, desc = 'Set cwd' }) + vim.keymap.set('n', 'gX', ui_open, { buffer = b, desc = 'OS open' }) + vim.keymap.set('n', 'gy', yank_path, { buffer = b, desc = 'Yank path' }) + end, +}) + +-- Add custom bookmarks. +local set_mark = function(id, path, desc) + MiniFiles.set_bookmark(id, path, { desc = desc }) +end + +vim.api.nvim_create_autocmd('User', { + pattern = 'MiniFilesExplorerOpen', + callback = function() + set_mark('w', vim.fn.getcwd, 'Working directory') -- callable + set_mark('~', '~', 'Home directory') + end, +}) + +-- Add split keys +local map_split = function(buf_id, lhs, direction) + local rhs = function() + -- Make new window and set it as target + local cur_target = MiniFiles.get_explorer_state().target_window + local new_target = vim.api.nvim_win_call(cur_target, function() + vim.cmd(direction .. ' split') + return vim.api.nvim_get_current_win() + end) + + MiniFiles.set_target_window(new_target) + + MiniFiles.go_in() + end + + -- Adding `desc` will result into `show_help` entries + local desc = 'Split ' .. direction + vim.keymap.set('n', lhs, rhs, { buffer = buf_id, desc = desc }) +end + +vim.api.nvim_create_autocmd('User', { + pattern = 'MiniFilesBufferCreate', + callback = function(args) + local buf_id = args.data.buf_id + -- Tweak keys to your liking + map_split(buf_id, '<C-s>', 'belowright horizontal') + map_split(buf_id, '<C-v>', 'belowright vertical') + map_split(buf_id, '<C-t>', 'tab') + end, +}) diff --git a/pkgs/old-custom-neovim/config/lua/plugins/mini/git.lua b/pkgs/old-custom-neovim/config/lua/plugins/mini/git.lua new file mode 100644 index 0000000..943f91d --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/mini/git.lua @@ -0,0 +1 @@ +require("mini.git").setup() diff --git a/pkgs/old-custom-neovim/config/lua/plugins/mini/icons.lua b/pkgs/old-custom-neovim/config/lua/plugins/mini/icons.lua new file mode 100644 index 0000000..fd2c5f9 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/mini/icons.lua @@ -0,0 +1,3 @@ +require("mini.icons").setup() + +MiniIcons.mock_nvim_web_devicons() diff --git a/pkgs/old-custom-neovim/config/lua/plugins/mini/indentscope.lua b/pkgs/old-custom-neovim/config/lua/plugins/mini/indentscope.lua new file mode 100644 index 0000000..2543c40 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/mini/indentscope.lua @@ -0,0 +1,6 @@ +require("mini.indentscope").setup() + +-- Don't work in terminal or help windows. +local f = function(args) vim.b[args.buf].miniindentscope_disable = true end +vim.api.nvim_create_autocmd('Filetype', { pattern = 'help', callback = f }) +vim.api.nvim_create_autocmd('TermOpen', {callback = f}) diff --git a/pkgs/old-custom-neovim/config/lua/plugins/mini/pairs.lua b/pkgs/old-custom-neovim/config/lua/plugins/mini/pairs.lua new file mode 100644 index 0000000..493c4d0 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/mini/pairs.lua @@ -0,0 +1 @@ +require("mini.pairs").setup() diff --git a/pkgs/old-custom-neovim/config/lua/plugins/mini/tabline.lua b/pkgs/old-custom-neovim/config/lua/plugins/mini/tabline.lua new file mode 100644 index 0000000..1ec6e7f --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/mini/tabline.lua @@ -0,0 +1,20 @@ +require("mini.tabline").setup { + format = function(buf_id, label) + local suffix = vim.bo[buf_id].modified and '[+] ' or '' + return MiniTabline.default_format(buf_id, label) .. suffix + end +} + +local link_hl = Utils.link_highlight + +vim.api.nvim_create_autocmd({"Colorscheme", "VimEnter"}, { + + callback = function() + -- Change colors. + + -- Make modified buffers the same color. + link_hl("MiniTablineModifiedHidden", "MiniTablineHidden") + link_hl("MiniTablineModifiedVisible", "MiniTablineVisible") + link_hl("MiniTablineModifiedCurrent", "MiniTablineCurrent") + end, +}) diff --git a/pkgs/old-custom-neovim/config/lua/plugins/namu.lua b/pkgs/old-custom-neovim/config/lua/plugins/namu.lua new file mode 100644 index 0000000..82275b9 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/namu.lua @@ -0,0 +1 @@ +require("namu").setup() diff --git a/pkgs/old-custom-neovim/config/lua/plugins/presence.lua b/pkgs/old-custom-neovim/config/lua/plugins/presence.lua new file mode 100644 index 0000000..7ffb57f --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/presence.lua @@ -0,0 +1,3 @@ +require('presence').setup({ + neovim_image_text = "Neovim Text Editor", +}) diff --git a/pkgs/old-custom-neovim/config/lua/plugins/render-markdown.lua b/pkgs/old-custom-neovim/config/lua/plugins/render-markdown.lua new file mode 100644 index 0000000..45bdcf2 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/render-markdown.lua @@ -0,0 +1 @@ +require("render-markdown").setup() diff --git a/pkgs/old-custom-neovim/config/lua/plugins/snacks.lua b/pkgs/old-custom-neovim/config/lua/plugins/snacks.lua new file mode 100644 index 0000000..c2cf737 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/snacks.lua @@ -0,0 +1,36 @@ +require("snacks").setup { + bigfile = { enabled = true }, + picker = { + enabled = true, + win = { + input = { + keys = { + ["<Esc>"] = { "close", mode = { "n", "i" } }, + }, + }, + }, + }, + lazygit = { + enabled = true, + config = { + quitOnTopLevelReturn = true, + }, + win = { + height = 0.8, + }, + }, + input = { + enabled = true, + }, + terminal = { + -- interactive = false, + start_insert = true, + auto_insert = true, + win = { + height = 0.2, + }, + keys = {}, + }, +} + +-- Utils.mapkey("t", "<c-w>", "Manage windows", "<c-\\><c-o><c-w>") diff --git a/pkgs/old-custom-neovim/config/lua/plugins/tabby.lua b/pkgs/old-custom-neovim/config/lua/plugins/tabby.lua new file mode 100644 index 0000000..c00dad7 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/tabby.lua @@ -0,0 +1,53 @@ +local general_theme = Utils.generate_theme_from_highlight_groups() +local colors = { + current = { fg = general_theme.modes.normal, bg = general_theme.background, style = 'bold'}, + not_current = { fg = general_theme.text.light, bg = general_theme.background }; + fill = { bg = general_theme.background }; +}; +local theme = { + fill = colors.fill, + head = colors.fill, + current_tab = colors.current, + tab = colors.not_current, + win = colors.fill, + tail = colors.fill, +} +require('tabby').setup({ + line = function(line) + return { + { + -- { ' ', hl = theme.head }, + -- line.sep('', theme.head, theme.fill), + }, + line.tabs().foreach(function(tab) + local hl = tab.is_current() and theme.current_tab or theme.tab + return { + line.sep('', hl, theme.fill), + -- tab.is_current() and '' or '', + -- tab.number(), + tab.name(), + line.sep('', hl, theme.fill), + hl = hl, + margin = ' ', + } + end), + line.spacer(), + line.wins_in_tab(line.api.get_current_tab()).foreach(function(win) + return { + line.sep('', theme.win, theme.fill), + -- win.is_current() and '' or '', + win.buf_name(), + line.sep('', theme.win, theme.fill), + hl = theme.win, + margin = ' ', + } + end), + { + line.sep('', theme.tail, theme.fill), + -- { ' ', hl = theme.tail }, + }, + hl = theme.fill, + } + end, + -- option = {}, -- setup modules' option, +}) diff --git a/pkgs/old-custom-neovim/config/lua/plugins/treesitter.lua b/pkgs/old-custom-neovim/config/lua/plugins/treesitter.lua new file mode 100644 index 0000000..3ad4c9f --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/treesitter.lua @@ -0,0 +1,5 @@ +require("nvim-treesitter.configs").setup { + highlight = { + enable = true, + }, +} diff --git a/pkgs/old-custom-neovim/config/lua/plugins/ts-autotag.lua b/pkgs/old-custom-neovim/config/lua/plugins/ts-autotag.lua new file mode 100644 index 0000000..67b9f06 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/plugins/ts-autotag.lua @@ -0,0 +1 @@ +require("nvim-ts-autotag").setup() diff --git a/pkgs/old-custom-neovim/config/lua/statusline.lua b/pkgs/old-custom-neovim/config/lua/statusline.lua new file mode 100644 index 0000000..08bbe50 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/statusline.lua @@ -0,0 +1,249 @@ +-- Custom Statusline + +-- About 1/3 of this code is from https://github.com/MariaSolOs/dotfiles/blob/f1d6229f4a4675745aff95c540dc8f1b9007a77a/.config/nvim/lua/statusline.lua + +-- Highlight pattern +local hi_pattern = '%%#%s#%s%%*' + +-- Convert mode to string +local mode_to_str = { + ['n'] = 'NORMAL', + ['no'] = 'OP-PENDING', + ['nov'] = 'OP-PENDING', + ['noV'] = 'OP-PENDING', + ['no\22'] = 'OP-PENDING', + ['niI'] = 'NORMAL', + ['niR'] = 'NORMAL', + ['niV'] = 'NORMAL', + ['nt'] = 'NORMAL', + ['ntT'] = 'NORMAL', + ['v'] = 'VISUAL', + ['vs'] = 'VISUAL', + ['V'] = 'VISUAL', + ['Vs'] = 'VISUAL', + ['\22'] = 'VISUAL', + ['\22s'] = 'VISUAL', + ['s'] = 'SELECT', + ['S'] = 'SELECT', + ['\19'] = 'SELECT', + ['i'] = 'INSERT', + ['ic'] = 'INSERT', + ['ix'] = 'INSERT', + ['R'] = 'REPLACE', + ['Rc'] = 'REPLACE', + ['Rx'] = 'REPLACE', + ['Rv'] = 'VIRT REPLACE', + ['Rvc'] = 'VIRT REPLACE', + ['Rvx'] = 'VIRT REPLACE', + ['c'] = 'COMMAND', + ['cv'] = 'VIM EX', + ['ce'] = 'EX', + ['r'] = 'PROMPT', + ['rm'] = 'MORE', + ['r?'] = 'CONFIRM', + ['!'] = 'SHELL', + ['t'] = 'TERMINAL', +} + +local statusline_components = {} + +statusline_components.micro_spacer = function() + return " " +end + +statusline_components.small_spacer = function() + return " " +end + +statusline_components.spacer = function() + return '%=' +end + +statusline_components.diagnostic_status = function() + local diagnostics = {} + + local errors = #vim.diagnostic.get(0, { severity = 1 }) + + if errors > 0 then + table.insert(diagnostics, "%#DiagnosticSignError# " .. tostring(errors)) + end + + local warnings = #vim.diagnostic.get(0, { severity = 2 }) + + if warnings > 0 then + table.insert(diagnostics, "%#DiagnosticSignWarn# " .. tostring(warnings)) + end + + local infos = #vim.diagnostic.get(0, { severity = 3 }) + + if infos > 0 then + table.insert(diagnostics, "%#DiagnosticSignInfo# " .. tostring(infos)) + end + + local hints = #vim.diagnostic.get(0, { severity = 4 }) + + if hints > 0 then + table.insert(diagnostics, "%#DiagnosticSignHint# " .. tostring(hints)) + end + + table.insert(diagnostics, "%#StatusLine#") + + vim.defer_fn(vim.cmd.redrawstatus, 500) + + -- Don't show diagnostics in insert mode. + if mode_to_str[vim.api.nvim_get_mode().mode]:find "INSERT" then + return "" + end + + return table.concat(diagnostics, " ") +end + +statusline_components.mode = function() + -- Get the respective string to display. + local mode = mode_to_str[vim.api.nvim_get_mode().mode] or 'UNKNOWN' + + -- Set the highlight group. + local hl = 'MiniStatuslineModeOther' + if mode:find 'NORMAL' then + hl = 'MiniStatuslineModeNormal' + elseif mode:find 'PENDING' then + hl = 'MiniStatuslineModeNormal' + elseif mode:find 'VISUAL' then + hl = 'MiniStatuslineModeVisual' + elseif mode:find 'REPLACE' then + hl = 'MiniStatuslineModeReplace' + elseif mode:find 'INSERT' or mode:find 'SELECT' then + hl = 'MiniStatuslineModeInsert' + elseif mode:find 'COMMAND' or mode:find 'TERMINAL' or mode:find 'EX' then + hl = 'MiniStatuslineModeCommand' + end + + -- Construct the component. + return hi_pattern:format(hl, string.format(' %s ', mode)) +end + +statusline_components.position = function() + -- Get the respective string to display. + local mode = mode_to_str[vim.api.nvim_get_mode().mode] or 'UNKNOWN' + + -- Set the highlight group. + local hl = 'MiniStatuslineModeOther' + if mode:find 'NORMAL' then + hl = 'MiniStatuslineModeNormal' + elseif mode:find 'PENDING' then + hl = 'MiniStatuslineModeNormal' + elseif mode:find 'VISUAL' then + hl = 'MiniStatuslineModeVisual' + elseif mode:find 'REPLACE' then + hl = 'MiniStatuslineModeReplace' + elseif mode:find 'INSERT' or mode:find 'SELECT' then + hl = 'MiniStatuslineModeInsert' + elseif mode:find 'COMMAND' or mode:find 'TERMINAL' or mode:find 'EX' then + hl = 'MiniStatuslineModeCommand' + end + + -- Construct the component. + return hi_pattern:format(hl, ' %2l:%-2c ') +end + +statusline_components.git_branch = function() + if vim.g.gitsigns_head then + return string.format(' %s', vim.g.gitsigns_head) + else + return '' -- Return an empty string or some default value if the branch name is not available + end +end + +statusline_components.git_status = function() + if not vim.b.gitsigns_status_dict then + return '' + end + + if not vim.b.gitsigns_status_dict.added then + return '' + end + + if not vim.b.gitsigns_status_dict.changed then + return '' + end + + if not vim.b.gitsigns_status_dict.removed then + return '' + end + + local status = {} + + local gitsigns_status = vim.b.gitsigns_status_dict + + if gitsigns_status.added > 0 then + table.insert(status, hi_pattern:format("Added", (" %s"):format(gitsigns_status.added))) + end + + if gitsigns_status.changed > 0 then + table.insert(status, hi_pattern:format("Changed", (" %s"):format(gitsigns_status.changed))) + end + + if gitsigns_status.removed > 0 then + table.insert(status, hi_pattern:format("Removed", (" %s"):format(gitsigns_status.removed))) + end + + return table.concat(status, " ") +end + +statusline_components.working_directory = function() + local text = vim.fn.getcwd() + + local parts = {} + for part in string.gmatch(text, "[^/]+") do + table.insert(parts, part) + end + + -- replace /home/USER with ~/ + if #parts >= 3 then + table.remove(parts, 1) + table.remove(parts, 1) + table.insert(parts, 1, "~") + end + + text = table.concat(parts, "/") + + -- if the cwd takes up more than half the bar width, shorten it. + if text:len() > (vim.api.nvim_win_get_width(0) / 2.5) then + if #parts >= 1 then + text = ".../" .. parts[#parts] + end + end + return string.format('%s', text) +end + +Statusline_component = function(name) + return statusline_components[name]() +end + +local get_component = function(name) + return string.format('%%{%%v:lua.Statusline_component("%s")%%} ', name) +end + +local statusline = { + get_component("micro_spacer"), + + get_component("mode"), + get_component("micro_spacer"), + get_component("working_directory"), + get_component("micro_spacer"), + get_component("git_branch"), + get_component("micro_spacer"), + get_component("git_status"), + get_component("micro_spacer"), + get_component("diagnostic_status"), + + get_component("spacer"), + + '%{&filetype}', -- filetype + get_component("micro_spacer"), + '%2p%%', -- progress % + get_component("micro_spacer"), + get_component("position"), +} + +vim.o.statusline = table.concat(statusline, '') diff --git a/pkgs/old-custom-neovim/config/lua/utilities.lua b/pkgs/old-custom-neovim/config/lua/utilities.lua new file mode 100644 index 0000000..d2a26b6 --- /dev/null +++ b/pkgs/old-custom-neovim/config/lua/utilities.lua @@ -0,0 +1,51 @@ +Utils = {} + +Utils.mapkey = function(mode, key, desc, action) + vim.keymap.set(mode, key, action, {noremap = true, silent = true, desc = desc}) +end + +Utils.generate_theme_from_highlight_groups = function() + local get_highlight_colors = function(group) + local raw_colors = vim.api.nvim_get_hl(0, {name = group}) + local decimal_to_hex = function(decimal_color) + if decimal_color == nil then return nil end + return string.format("#%06X", decimal_color) + end + return { + fg = decimal_to_hex(raw_colors.fg), + bg = decimal_to_hex(raw_colors.bg), + } + end + return { + modes = { + normal = get_highlight_colors("MiniStatuslineModeNormal").bg, + insert = get_highlight_colors("MiniStatuslineModeInsert").bg, + visual = get_highlight_colors("MiniStatuslineModeVisual").bg, + replace = get_highlight_colors("MiniStatuslineModeReplace").bg, + command = get_highlight_colors("MiniStatuslineModeCommand").bg, + inactive = get_highlight_colors("MiniStatuslineModeInactive").bg, + }, + text = { + dark = get_highlight_colors("MiniStatuslineModeNormal").fg, + light = get_highlight_colors("Normal").fg, + }, + background = get_highlight_colors("Normal").bg, + } +end + +Utils.link_highlight = function(first_highlight, second_highlight) + vim.cmd.highlight {bang = true, "link", first_highlight, second_highlight} +end + +Utils.replaceInTable = function(t, str1, str2) + for key, value in pairs(t) do + if type(value) == "string" then + -- Replace <C-w> with <leader>w in the string + t[key] = value:gsub(str1, str2) + elseif type(value) == "table" then + -- Recursively process nested tables + Utils.replaceInTable(value, str1, str2) + end + end + return t +end |
