Updated config

This commit is contained in:
Eduard Urbach 2025-05-18 15:59:57 +02:00
parent 285360a1dc
commit 557f33c14a
No known key found for this signature in database
GPG key ID: C874F672B1AF20C0
35 changed files with 159 additions and 694 deletions

View file

@ -1,48 +1,68 @@
# Git # Git
if command -q git
alias g "git" alias g "git"
alias gc "git clone" alias gc "git clone"
alias gd "git diff --ignore-space-at-eol" alias gd "git diff --ignore-space-at-eol"
alias gl "git log --oneline" alias gl "git log --oneline"
alias gp "git pull" alias gp "git pull"
alias gs "git status" alias gs "git status"
# Go
alias gb "go build -v"
alias godeps "go list -f '{{ join .Deps \"\n\"}}' ."
alias gt "go test -v"
alias gts "gotestsum"
# Home
alias home "git --git-dir=$HOME/.home/ --work-tree=$HOME" alias home "git --git-dir=$HOME/.home/ --work-tree=$HOME"
alias homeinit "git clone --bare https://git.urbach.dev/sys/home $HOME/.home && home checkout" alias homeinit "git clone --bare https://git.urbach.dev/sys/home $HOME/.home && home checkout"
alias h "home" alias h "home"
alias hs "home status" alias hs "home status"
alias hd "home diff --ignore-space-at-eol" alias hd "home diff --ignore-space-at-eol"
alias hp "home pull" alias hp "home pull"
end
# Go
if command -q go
alias gb "go build -v"
alias godeps "go list -f '{{ join .Deps \"\n\"}}' ."
alias gt "go test -v"
alias gts "gotestsum"
end
# Hyperfine # Hyperfine
if command -q hyperfine
alias bench "hyperfine --shell=none" alias bench "hyperfine --shell=none"
end
# Kernel # Kernel
if command -q dmesg
alias kerr "sudo dmesg --level=emerg,alert,crit,err" alias kerr "sudo dmesg --level=emerg,alert,crit,err"
alias klog "sudo dmesg" alias klog "sudo dmesg"
end
# List # List
if command -q ls
alias l "ls" alias l "ls"
alias ll "ls -l" alias ll "ls -l"
alias l2 "ls -T -L2" alias l2 "ls -T -L2"
alias lu "ls -l --total-size --sort=size --reverse --no-permissions --no-user --no-time" alias lu "ls -l --total-size --sort=size --reverse --no-permissions --no-user --no-time"
alias lp "ls -l --no-filesize --no-time" alias lp "ls -l --no-filesize --no-time"
end
# Lsof # Lsof
if command -q lsof
alias tcp "lsof -PniTCP" alias tcp "lsof -PniTCP"
alias udp "lsof -PniUDP" alias udp "lsof -PniUDP"
end
# Neovim # Neovim
if command -q nvim
alias e "nvim" alias e "nvim"
alias n "nvim" alias n "nvim"
end
# Pacman # Pacman
if command -q apk
alias p "apk"
alias pi "sudo apk add"
alias pr "sudo apk del"
alias pu "sudo apk update"
alias pl "apk info"
alias powner "apk info --who-owns"
else if command -q pacman
alias p "pacman" alias p "pacman"
alias pi "sudo pacman -S" alias pi "sudo pacman -S"
alias pr "sudo pacman -Rs" alias pr "sudo pacman -Rs"
@ -54,8 +74,17 @@ alias paur "pacman -Qm"
alias pfiles "pacman -Ql" alias pfiles "pacman -Ql"
alias porphan "pacman -Qtdq" alias porphan "pacman -Qtdq"
alias powner "pacman -Qo" alias powner "pacman -Qo"
end
# Sudo
if command -q doas
alias sudo "doas"
end
# Systemctl # Systemctl
if command -q service
alias services "service -l"
else if command -q systemctl
alias start "sudo systemctl start" alias start "sudo systemctl start"
alias stop "sudo systemctl stop" alias stop "sudo systemctl stop"
alias enable "sudo systemctl enable" alias enable "sudo systemctl enable"
@ -65,15 +94,18 @@ alias running "systemctl list-units --type=service --state=running"
alias disabled "systemctl list-unit-files --type=service --state=disabled" alias disabled "systemctl list-unit-files --type=service --state=disabled"
alias enabled "systemctl list-unit-files --type=service --state=enabled" alias enabled "systemctl list-unit-files --type=service --state=enabled"
alias timers "systemctl list-timers" alias timers "systemctl list-timers"
alias bios "systemctl reboot --firmware-setup"
end
# Tmux # Tmux
if command -q tmux
alias ta "tmux attach" alias ta "tmux attach"
alias td "tmux detach" alias td "tmux detach"
alias tl "tmux ls" alias tl "tmux ls"
alias tk "tmux kill-server" alias tk "tmux kill-server"
end
# ... # ...
alias bios "systemctl reboot --firmware-setup"
alias cfg "config" alias cfg "config"
alias cls "clear" alias cls "clear"
alias debug "blinkenlights" alias debug "blinkenlights"

View file

@ -3,10 +3,10 @@ if status is-interactive
source $HOME/.config/fish/alias.fish source $HOME/.config/fish/alias.fish
end end
# PATH: Add scripts # Add scripts to PATH
fish_add_path $XDG_CONFIG_HOME/fish/scripts fish_add_path $XDG_CONFIG_HOME/fish/scripts
# PATH: Add Go binaries # Add Go binaries to PATH
if command -q go if command -q go
fish_add_path (go env GOPATH)/bin fish_add_path (go env GOPATH)/bin
end end

View file

@ -1,3 +1,3 @@
function config function config
$EDITOR $HOME/.config/$argv f $HOME/.config/$argv
end end

View file

@ -1,8 +1,19 @@
function f function f --wraps nnn --description 'support nnn quit and change directory'
set tmp (mktemp -t "yazi-cwd.XXXXXX") if test -n "$NNNLVL" -a "$NNNLVL" -ge 1
yazi $argv --cwd-file="$tmp" echo "nnn is already running"
if set cwd (command cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] return
builtin cd -- "$cwd" end
if test -n "$XDG_CONFIG_HOME"
set -x NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd"
else
set -x NNN_TMPFILE "$HOME/.config/nnn/.lastd"
end
command nnn $argv
if test -e $NNN_TMPFILE
source $NNN_TMPFILE
rm -- $NNN_TMPFILE
end end
rm -f -- "$tmp"
end end

View file

@ -1,4 +1,4 @@
function ls function ls --wraps eza
if command -q eza if command -q eza
eza --group-directories-first --time-style relative -T -L1 $argv eza --group-directories-first --time-style relative -T -L1 $argv
else else

View file

@ -1,6 +1,6 @@
require("boot")
require("settings") require("settings")
require("lsp") require("lsp")
require("packages")
require("keys") require("keys")
require("autocmds") require("autocmds")
require("usercmds") require("usercmds")

View file

@ -64,7 +64,7 @@ on({ "VimEnter" }, {
end end
if is_directory ~= 0 then if is_directory ~= 0 then
require("telescope.builtin").find_files() --require("telescope.builtin").find_files()
end end
end, end,
}) })

46
.config/nvim/lua/boot.lua Normal file
View file

@ -0,0 +1,46 @@
-- Disable providers
local disabled_providers = {
"node",
"perl",
"python3",
"ruby",
}
for _, provider in ipairs(disabled_providers) do
vim.g["loaded_" .. provider .. "_provider"] = 0
end
-- Disable plugins
local 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",
}
for _, plugin in ipairs(disabled_plugins) do
vim.g["loaded_" .. plugin] = 1
end

View file

@ -1,101 +0,0 @@
local icons = {
Namespace = "󰌗",
Text = "󰉿",
Method = "󰆧",
Function = "󰆧",
Constructor = "",
Field = "󰜢",
Variable = "󰀫",
Class = "󰠱",
Interface = "",
Module = "",
Property = "󰜢",
Unit = "󰑭",
Value = "󰎠",
Enum = "",
Keyword = "󰌋",
Snippet = "",
Color = "󰏘",
File = "󰈚",
Reference = "󰈇",
Folder = "󰉋",
EnumMember = "",
Constant = "󰏿",
Struct = "󰙅",
Event = "",
Operator = "󰆕",
TypeParameter = "󰊄",
Table = "",
Object = "󰅩",
Tag = "",
Array = "[]",
Boolean = "",
Number = "",
Null = "󰟢",
String = "󰉿",
Calendar = "",
Watch = "󰥔",
Package = "",
Copilot = "",
Codeium = "",
TabNine = "",
}
return {
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
-- "hrsh7th/cmp-nvim-lsp",
-- "hrsh7th/cmp-buffer",
-- "hrsh7th/cmp-path",
-- "L3MON4D3/LuaSnip",
},
opts = {
completion = {
autocomplete = true,
completeopt = "menu,menuone,noinsert",
},
formatting = {
fields = { "abbr", "kind", "menu" },
format = function(_, item)
local icon = icons[item.kind] or ""
item.kind = string.format(" %s %s", icon, item.kind)
return item
end,
},
-- snippet = {
-- expand = function(args)
-- require("luasnip").lsp_expand(args.body)
-- end,
-- },
-- preselect = cmp.PreselectMode.None,
sources = {
-- { name = "nvim_lsp" },
-- { name = "luasnip" },
{ name = "buffer" },
-- { name = "path" },
},
window = {
completion = {
border = "rounded",
scrollbar = false,
},
documentation = {
border = "rounded",
}
},
},
config = function(_, opts)
local cmp = require("cmp")
opts.mapping = {
["<C-space>"] = cmp.mapping.complete(),
["<C-up>"] = cmp.mapping.select_prev_item(),
["<C-down>"] = cmp.mapping.select_next_item(),
["<C-x>"] = cmp.mapping.abort(),
["<cr>"] = cmp.mapping.confirm({ select = true }),
}
cmp.setup(opts)
end,
}

View file

@ -1,11 +0,0 @@
return {
"j-hui/fidget.nvim",
opts = {
integration = {
["nvim-tree"] = {
enable = true,
},
},
},
config = true,
}

View file

@ -1,15 +0,0 @@
return {
"lukas-reineke/indent-blankline.nvim",
event = "VeryLazy",
main = "ibl",
opts = {
indent = {
char = "",
},
scope = {
enabled = true,
show_start = false,
},
},
config = true,
}

View file

@ -1,4 +0,0 @@
return {
"mrded/nvim-lsp-notify",
config = true,
}

View file

@ -1,103 +0,0 @@
return {
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
opts = {
servers = {
clangd = {},
gdscript = {},
gopls = {},
lua_ls = {
settings = {
Lua = {
completion = {
callSnippet = "Replace",
},
runtime = {
version = "LuaJIT",
},
workspace = {
checkThirdParty = false,
library = {
"${3rd}/luv/library",
unpack(vim.api.nvim_get_runtime_file("", true)),
},
},
},
},
},
rust_analyzer = {
settings = {
["rust-analyzer"] = {
imports = {
granularity = {
group = "module",
},
prefix = "self",
},
cargo = {
buildScripts = {
enable = true,
},
},
procMacro = {
enable = true
},
},
},
},
},
},
config = function(_, opts)
-- Servers
local servers = opts.servers
for server, server_opts in pairs(servers) do
require("lspconfig")[server].setup(server_opts)
end
-- Icons
local icons = {
Error = "",
Warn = "",
Hint = "",
Info = "",
}
for name, icon in pairs(icons) do
name = "DiagnosticSign" .. name
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
end
-- Runs when the LSP is attached
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("lsp-attach", { clear = true }),
callback = function(event)
local function map(mode, lhs, rhs, info)
vim.keymap.set(mode, lhs, rhs, { buffer = event.buf, desc = "LSP: " .. info })
end
map("n", "gr", require("telescope.builtin").lsp_references, "References")
map("n", "gd", require("telescope.builtin").lsp_definitions, "Definition")
map({ "n", "i" }, "<f1>", vim.lsp.buf.hover, "Hover")
map({ "n", "i" }, "<f2>", vim.lsp.buf.rename, "Rename")
map({ "n", "i" }, "<C-f>", vim.lsp.buf.format, "Format")
map("n", "<leader>ca", vim.lsp.buf.code_action, "Code action")
-- Highlight the word your cursor is on
-- local client = vim.lsp.get_client_by_id(event.data.client_id)
--
-- if client and client.server_capabilities.documentHighlightProvider then
-- vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
-- buffer = event.buf,
-- callback = vim.lsp.buf.document_highlight,
-- })
--
-- vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
-- buffer = event.buf,
-- callback = vim.lsp.buf.clear_references,
-- })
-- end
end,
})
end,
}

View file

@ -1,11 +0,0 @@
return {
"L3MON4D3/LuaSnip",
dependencies = {
"rafamadriz/friendly-snippets"
},
event = "InsertEnter",
version = "v2.*",
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end,
}

View file

@ -1,8 +0,0 @@
return {
"echasnovski/mini.completion",
event = "InsertEnter",
opts = {
set_vim_settings = false,
},
config = true,
}

View file

@ -1,18 +0,0 @@
return {
"echasnovski/mini.surround",
event = { "BufReadPost", "BufNewFile" },
opts = {
mappings = {
add = 'gsa',
delete = 'gsd',
find = 'gsf',
find_left = 'gsF',
highlight = 'gsh',
replace = 'gsr',
update_n_lines = 'gsn',
suffix_last = '',
suffix_next = '',
},
},
config = true,
}

View file

@ -1,14 +0,0 @@
return {
"mg979/vim-visual-multi",
keys = {
{ "<C-d>", mode = { "n", "x" }, desc = "Multicursor (word)" },
{ "<C-Up>", mode = { "n", "x" }, desc = "Multicursor (next line)" },
{ "<C-Down>", mode = { "n", "x" }, desc = "Multicursor (previous line)" },
},
init = function()
vim.g.VM_maps = {
["Find Under"] = "<C-d>",
["Find Subword Under"] = "<C-d>",
}
end,
}

View file

@ -1,17 +0,0 @@
return {
"folke/noice.nvim",
event = "VeryLazy",
dependencies = {
"MunifTanjim/nui.nvim",
},
opts = {
lsp = {
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
},
},
config = true,
}

View file

@ -1,11 +0,0 @@
return {
"rcarriga/nvim-notify",
event = "VeryLazy",
opts = {
background_colour = "#000000",
fps = 60,
render = "compact",
timeout = 0,
},
config = true,
}

View file

@ -1,7 +0,0 @@
return {
"NvChad/nvterm",
keys = {
{ "<A-i>", "<cmd>lua require('nvterm.terminal').toggle('float')<cr>", mode = { "n", "t" }, desc = "Toggle terminal" },
},
config = true,
}

View file

@ -1,19 +0,0 @@
return {
"navarasu/onedark.nvim",
lazy = false,
priority = 1000,
opts = {
style = "dark",
transparent = true,
term_colors = true,
highlights = {
["StatusLine"] = {fg = "$bg3", bg = "Normal"},
["StatusLineNC"] = {fg = "$bg3", bg = "Normal"},
},
},
config = function(_, opts)
local theme = require("onedark")
theme.setup(opts)
theme.load()
end,
}

View file

@ -1,10 +0,0 @@
return {
"folke/snacks.nvim",
event = "BufReadPre",
opts = {
explorer = {
replace_netrw = true,
},
},
config = true,
}

View file

@ -1,7 +0,0 @@
return {
"nvim-pack/nvim-spectre",
keys = {
{ "<leader>sr", function() require("spectre").open() end, desc = "Replace in files (Spectre)" },
},
config = true,
}

View file

@ -1,73 +0,0 @@
local function on_attach(bufnr)
local api = require("nvim-tree.api")
-- default mappings
api.config.mappings.default_on_attach(bufnr)
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
-- navigation
vim.keymap.set("n", "<C-Up>", api.tree.change_root_to_parent, opts("Up"))
vim.keymap.set("n", "<C-Left>", api.tree.change_root_to_parent, opts("Up"))
vim.keymap.set("n", "<C-Down>", api.tree.change_root_to_node, opts("Enter"))
vim.keymap.set("n", "<C-Right>", api.tree.change_root_to_node, opts("Enter"))
-- open folders with a single click
vim.keymap.set("n", "<LeftRelease>", function()
vim.defer_fn(function ()
local win = vim.api.nvim_get_current_win()
local view = require("nvim-tree.view")
if view.get_winnr() ~= win then return end
api.node.open.edit()
api.tree.focus()
end, 10)
end, opts("Open folder/file"))
end
return {
"nvim-tree/nvim-tree.lua",
event = "VeryLazy",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
keys = {
{ "<leader>e", function() require("nvim-tree.api").tree.toggle() end, desc = "Toggle files" },
},
opts = {
filesystem_watchers = {
enable = true,
},
filters = {
dotfiles = false,
},
on_attach = on_attach,
renderer = {
root_folder_label = false,
highlight_git = true,
icons = {
show = {
git = false,
},
glyphs = {
git = {
unstaged = "",
untracked = "",
deleted = "",
},
},
},
},
sync_root_with_cwd = true,
update_focused_file = {
enable = true,
update_root = false,
},
view = {
width = 30,
},
},
config = true,
}

View file

@ -1,16 +0,0 @@
return {
"folke/trouble.nvim",
event = "VeryLazy",
keys = {
{ "<leader>x", function() require("trouble").toggle() end, desc = "Show errors" },
},
dependencies = {
"nvim-tree/nvim-web-devicons",
},
opts = {
position = "right",
padding = false,
use_diagnostic_signs = true,
},
config = true,
}

View file

@ -1,3 +1,5 @@
vim.g.mapleader = " "
local function map(mode, lhs, rhs, info) local function map(mode, lhs, rhs, info)
vim.keymap.set(mode, lhs, rhs, { desc = info }) vim.keymap.set(mode, lhs, rhs, { desc = info })
end end
@ -6,7 +8,6 @@ map("n", ";", ":", "Command mode")
map("n", "U", "<cmd>redo<cr>", "Redo") map("n", "U", "<cmd>redo<cr>", "Redo")
map("n", "<Bslash>", "<cmd>ToggleWord<cr>", "Toggle word") map("n", "<Bslash>", "<cmd>ToggleWord<cr>", "Toggle word")
map("n", "<C-q>", "<cmd>close<cr>", "Close window") map("n", "<C-q>", "<cmd>close<cr>", "Close window")
map("n", "<leader>l", "<cmd>Lazy<cr>", "Lazy")
map({"n", "v"}, "q", "<cmd>qa<cr>", "Quit all") map({"n", "v"}, "q", "<cmd>qa<cr>", "Quit all")
map({"n", "v"}, "<leader>q", "<cmd>qa!<cr>", "Quit all") map({"n", "v"}, "<leader>q", "<cmd>qa!<cr>", "Quit all")
map({"n", "i"}, "<esc>", "<cmd>noh<cr><esc>", "Clear search") map({"n", "i"}, "<esc>", "<cmd>noh<cr><esc>", "Clear search")

View file

@ -1,69 +0,0 @@
-- Install the package manager if needed
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- Load plugins
require("lazy").setup("plugins", {
defaults = {
lazy = true,
},
change_detection = {
notify = false
},
rocks = {
enabled = false
},
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",
},
},
},
})

View file

@ -1,5 +0,0 @@
return {
"windwp/nvim-autopairs",
event = "InsertEnter",
config = true,
}

View file

@ -1,23 +0,0 @@
return {
"numToStr/Comment.nvim",
keys = {
{
"<C-/>",
"<cmd>lua require('Comment.api').toggle.linewise.current()<cr>",
desc = "Toggle comment",
},
{
"<C-/>",
"<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>",
mode = "v",
desc = "Toggle comment",
},
},
config = true,
opts = {
mappings = {
basic = false,
extra = false,
},
},
}

View file

@ -1,9 +0,0 @@
return {
"folke/flash.nvim",
event = { "BufReadPost", "BufNewFile" },
keys = {
{ "s", function() require("flash").jump() end, mode = { "n", "o", "x" }, desc = "Flash" },
{ "S", function() require("flash").treesitter() end, mode = { "n", "o", "x" }, desc = "Flash Treesitter" },
},
config = true,
}

View file

@ -1,5 +0,0 @@
return {
"lewis6991/gitsigns.nvim",
event = "BufReadPre",
config = true,
}

View file

@ -1,7 +0,0 @@
return {
"tanvirtin/monokai.nvim",
lazy = false,
priority = 1000,
opts = {},
config = true,
}

View file

@ -1,36 +0,0 @@
return {
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope-project.nvim",
},
keys = {
{"<C-Tab>", "<cmd>Telescope buffers<cr>", desc = "Buffers"},
{"<leader>f", "<cmd>Telescope find_files<cr>", desc = "Find files"},
{"<leader>p", "<cmd>Telescope project<cr>", desc = "Projects"},
{"<leader>r", "<cmd>Telescope oldfiles<cr>", desc = "Recent files"},
},
config = function()
require("telescope").setup({
defaults = {
mappings = {
i = {
["<esc>"] = require("telescope.actions").close,
},
},
prompt_prefix = " ",
selection_caret = "",
},
extensions = {
project = {
base_dirs = {
{ path = "~/projects", max_depth = 3 },
},
order_by = "desc",
sync_with_nvim_tree = true,
theme = "dropdown",
},
},
})
end,
}

View file

@ -1,18 +0,0 @@
return {
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPost", "BufNewFile" },
build = ":TSUpdate",
opts = {
ensure_installed = {
"go",
"gomod",
"gowork",
"gosum",
},
highlight = { enable = true },
indent = { enable = true },
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
end,
}

View file

@ -1,11 +1,3 @@
-- Globals
local g = vim.g
g.mapleader = " "
for _, provider in ipairs { "node", "perl", "python3", "ruby" } do
g["loaded_" .. provider .. "_provider"] = 0
end
-- Options -- Options
local opt = vim.opt local opt = vim.opt
opt.autowrite = false opt.autowrite = false