Compare commits

...

5 Commits

Author SHA1 Message Date
2a1321e961 add modules for lua lsp. 2025-11-19 21:06:08 +01:00
997af51bee rename _make to __colour_make for clairification 2025-11-19 13:17:43 +01:00
67988b7ffc rename _lazy_ssh to __lazy_ssh_agent for clairification 2025-11-19 13:11:42 +01:00
d32b47dd72 redirect stderr as well with ssh-add 2025-11-19 13:08:35 +01:00
9b73f4cc9b fix: bash prompt weirdness
Under certain situations, the bash prompt was not getting aligned
properly.
Mainly when writing a bunch of text, and removing it with M-BS, where
the width of the printed text is kept.
2025-11-19 13:05:26 +01:00
3 changed files with 17 additions and 11 deletions

25
.bashrc
View File

@@ -12,25 +12,26 @@ esac
[ -z "${PS1-}" ] && return
# lazy loading of ssh agents
_lazy_ssh() {
__lazy_ssh_agent() {
if [ -z "$SSH_AUTH_SOCK" ]; then
eval "$(ssh-agent -s)" >/dev/null
ssh-add "$HOME/.ssh/github" >/dev/null
ssh-add "$HOME/.ssh/gitea" >/dev/null
ssh-add "$HOME/.ssh/admin@homeserver" >/dev/null
ssh-add "$HOME/.ssh/github" >/dev/null 2>&1
ssh-add "$HOME/.ssh/gitea" >/dev/null 2>&1
ssh-add "$HOME/.ssh/admin@homeserver" >/dev/null 2>&1
fi
}
# aliases so the function is called beforehand
alias ssh='_lazy_ssh; ssh'
alias sudo='_lazy_ssh; sudo'
alias ssh='__lazy_ssh_agent; ssh'
alias sudo='__lazy_ssh_agent; sudo'
# alias to colourise make output
_make() {
# colourises make output, so when it prints via
# $(warning) or $(error), it is formatted properly
__colour_make() {
make "$@" 2> >(sed -E \
-e "s/^([Mm]akefile:[0-9]+:.*)/\x1b[33m\1\x1b[0m/" \
-e "s/^.*error.*$/\x1b[31m&\x1b[0m/I" >&2)
}
alias make='_make'
alias make='__colour_make'
# lazily loads the git utilities, to prevent slowdowns
__lazy_git_ps1() {
@@ -50,11 +51,13 @@ __regenprompt() {
local err=$? # acquire the error code of the last executed command
local git=$(__lazy_git_ps1)
# Format the error code to be in the last column of the terminal
# this shall be printed as non-printable characters, so won't effect text wrapping.
if [ $err -ne 0 ]; then
err="\[\033[$((COLUMNS - 4))G\033[01;31m\]${err}\[\033[0G\]"
err="\033[$((COLUMNS - 4))G\033[01;31m${err}\033[0G"
else unset err; fi
PS1="$err" # error code
PS1="\[$err\]" # error code
PS1="$PS1\[\033[?25h\]" # show cursor
PS1="$PS1\[\033[01;35m\]\u@\h" # user@host
PS1="$PS1\[\033[00m\]:" # separator

View File

@@ -4,6 +4,7 @@ vim.g.maplocalleader = ' '
Autocmd = vim.api.nvim_create_autocmd
Map = vim.keymap.set
---@module 'gruvbox'
---@class userdata
---@field palette GruvboxPalette
_G.userdat = {}

View File

@@ -1,9 +1,11 @@
---@module 'lazy'
---@type LazySpec
return { {
'ellisonleao/gruvbox.nvim',
lazy = false,
dependencies = { 'johnfrankmorgan/whitespace.nvim' },
priority = 1000,
---@module 'gruvbox'
---@type GruvboxConfig
opts = {
styles = {