Compare commits

..

5 Commits

Author SHA1 Message Date
8b856e1628 universal color for hostname, fitting a light and a dark background 2026-03-20 10:18:37 +01:00
5de2b953c9 change hostname from grey to black 2026-03-20 10:10:15 +01:00
d24877e683 change color of prompt slightly, especially color of pwd to more pleasing cyan and use AI to simply- and beautify the prompt-code 2026-03-20 09:37:49 +01:00
75876a1bd2 add 3 aliases: mn-ansible, lg and lsld
mn-ansible: change to standard ansible workdir, activate the virtualenv
and list all ansible-* folders

lg: start lazygit

lsld: list all directories in a folder
2026-02-26 09:00:26 +01:00
9a3b39bbc9 deleting unused and unnessecary stuff, adding plugins and some settings 2026-01-20 07:57:55 +01:00
4 changed files with 80 additions and 82 deletions

View File

@ -8,13 +8,6 @@ alias ll='ls -la'
alias lla='ls -htlr -A'
alias l='ls -l'
# cdl=move to directory and instantly list its contents
# everyone needs this ;-)
cdl(){
cd $@
ls -l
}
# change directory
alias ..='cd ..'
alias ...='cd ../..'
@ -41,16 +34,19 @@ cd() {
fi
}
# cdl=move to directory and instantly list its contents
# everyone needs this ;-)
cdl(){
cd $@
ls -l
}
# directly cd into the latest modified directory
cdla(){
cd "$(\ls -1dt ./*/ | head -n 1)"
}
# create an excuse
excuse(){
curl -s https://bofh-api.bombeck.io/v1/excuses/random/ | jq -r '.[0].quote'
}
alias mn-ansible='source /home/jscharre/workdir/ansible-2.10-py39/bin/activate && cd /home/jscharre/workdir/ansible-2.10-py39/ && ls -ld ans*'
# making git-life easier
gitc(){
@ -64,6 +60,7 @@ alias gitchd='git checkout develop' #directly switch to develop branch (ManageNo
# misc
alias px="ps auxf"
alias o="xdg-open"
alias lg='lazygit'
# pretty print json
alias ppjson='python -c "import sys, json; print json.dumps(json.load(sys.stdin), sort_keys=True, indent=4)"'
@ -89,7 +86,7 @@ alias pign=ping
# other stuff
alias eierabend='xflock4 ; systemctl suspend --no-wall'
alias updgrade='sudo aptitude update && sudo aptitude upgrade -y'
alias lock='xflock4'
alias lsld='ls -ld *'
# better passwords!
alias apg='apg -M sncl -n 15 -m 10 -x 20'
@ -105,4 +102,3 @@ alias telnet='echo use the curl method: curl telnet:\/\/<ip>:<port>'
# hopefully, there's ack-grep installed on the system...
alias ag='ack'

View File

@ -14,19 +14,3 @@ if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# Load pyenv automatically by appending
# the following to
# ~/.bash_profile if it exists, otherwise ~/.profile (for login shells)
# and ~/.bashrc (for interactive shells) :
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init - bash)"
# Restart your shell for the changes to take effect.
# Load pyenv-virtualenv automatically by adding
# the following to ~/.bashrc:
eval "$(pyenv virtualenv-init -)"

51
.bashrc
View File

@ -75,28 +75,43 @@ parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# set a fancy prompt
if [ $UID == 0 ]; then
# root: red
#PS_COLOR="\[\033[1;31m\]"
export PS1="\t \[$(tput bold)\]\[$(tput sgr0)\]\[\033[38;5;1m\]\u\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;7m\]@\h\[$(tput sgr0)\]\[\033[38;5;15m\]:\[$(tput sgr0)\]\[\033[38;5;1m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\]\$(parse_git_branch)\[\033[00m\]\n\\$ \[$(tput sgr0)\]"
## set a fancy prompt
# --- 1. Color-Definitions (256-Colors) ---
# Format: \[ \033[38;5;COLOR_IDm \] ('m' marks the end of the code)
# Reset standard text
F_RESET="\[\033[00m\]"
# Colors for user
U_USER="\[\033[38;5;3m\]" # Gelb/Orange
U_PWD="\[\033[38;5;39m\]" # soothing sky-blue
# Colors for Root
R_USER="\[\033[1;31m\]" # bold, red (important!)
R_PWD="\[\033[38;5;203m\]" # smooth salmon-rose
# Common colors
#C_HOST="\[\033[38;5;7m\]" # Light Grey
#C_HOST="\[\033[38;5;0m\]" # Black
C_HOST="\[\033[38;5;214m\]" # Orange
C_GIT="\[\033[38;5;15m\]" # White
C_CHAR="\[\033[38;5;15m\]" # White (for colon)
# --- 2. Logic and Prompt-Composition ---
if [ "$UID" -eq 0 ]; then
# --- ROOT PROMPT ---
# Structure: Time [RootColor]User [Normal]@[Host] : [RootPath]Path [Git] \n #
export PS1="\t ${R_USER}\u${C_HOST}@\h${C_CHAR}:${R_PWD}\w${C_GIT}\$(parse_git_branch)$F_RESET\n# "
else
# user
#PS_COLOR="\[\033[33m\]"
export PS1="\t \[$(tput sgr0)\]\[\033[38;5;3m\]\u\[$(tput sgr0)\]\[\033[38;5;7m\]@\h\[$(tput sgr0)\]\[\033[38;5;15m\]:\[$(tput sgr0)\]\[\033[38;5;87m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\]\$(parse_git_branch)\[\033[00m\]\n\\$ \[$(tput sgr0)\]"
# --- USER PROMPT ---
# Structure: Time [UserFarbe]User [Normal]@[Host] : [PathFarbe]Path [Git] \n $
export PS1="\t ${U_USER}\u${C_HOST}@\h${C_CHAR}:${U_PWD}\w${C_GIT}\$(parse_git_branch)$F_RESET\n\\$ "
fi
#PS1="\t ${PS_COLOR}${debian_chroot:+($debian_chroot)}\u@\h:\w\$ "
#export PS1="\t \[$(tput sgr0)\]\[\033[38;5;11m\]\u\[$(tput sgr0)\]${PS_COLOR}@\h:\[$(tput sgr0)\]\[\033[38;5;87m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\] \n\\$ \[$(tput sgr0)\]"
# Cleanup (for the variables not to stau 'exported')
unset F_RESET U_USER U_PWD R_USER R_PWD C_HOST C_GIT C_CHAR
# if this is an xterm modify the title
case $TERM in
xterm*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME} $(date +%H:%M:%S) [${PWD}]\007"'
;;
*)
;;
esac
# define your own aliases in ~/.bash_aliases
[ -f ~/.bash_aliases ] && source ~/.bash_aliases

71
.vimrc
View File

@ -6,7 +6,7 @@
"set nocompatible " use vim defaults
syntax on " use syntax highlighting
set background=dark " when using black background terminal
colorscheme ron " for bash in windows this fixes my colors in vim inside tmux
" colorscheme ron " for bash in windows this fixes my colors in vim inside tmux
set nomodeline " workaround to close a vuln
@ -63,14 +63,8 @@ filetype on
let mapleader=" "
let g:mapleader=" "
" settings for vim 7
if version >= 700
set spellfile=~/.vimspell.de.add,~/.vimspell.en.add
" setlocal spell spelllang=de " enable spell checker
endif
hi LineTooLong cterm=bold ctermbg=red guibg=LightYellow
match LineTooLong /\%>80v.\+/
match LineTooLong /\%>160v.\+/
"useful mappings for managing tabs
map <leader>tn :tabnew<cr>
@ -91,12 +85,7 @@ endfun
" grep will sometimes skip displaying the file name
set grepprg=grep\ -nH\ $*
" Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
let g:tex_flavor='latex'
"let g:Tex_Folding=0 "I don't like folding.
let g:Tex_Folding=0 "I don't like folding.
set iskeyword+=:
" Press Space to turn off highlighting and clear any message already displayed.
@ -113,9 +102,6 @@ function! Incr()
endfunction
vnoremap <C-a> :call Incr()<CR>
" Prss CTRL + _ (CTRL + SHIFT + -) to close a html tag
if filereadable(glob('~/.vim/scripts/closetag.vim')) | source ~/.vim/scripts/closetag.vim | endif
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$\| \+\ze\t/
@ -125,23 +111,11 @@ nnoremap <F2> :<C-U>%retab!<CR>:set list<CR>:%s/^\(\t\+\) */\1/<CR>
nnoremap <F5> "=strftime("%c")<CR>P
inoremap <F5> <C-R>=strftime("%c")<CR>
" a few autocommands for when silly people send stupid file formats
" Read-only .doc through antiword
autocmd BufReadPre *.doc silent set ro
autocmd BufReadPost *.doc silent %!antiword "%"
" Read-only odt/odp through odt2txt
autocmd BufReadPre *.odt,*.odp silent set ro
autocmd BufReadPost *.odt,*.odp silent %!odt2txt "%"
" Read-only pdf through pdftotext
autocmd BufReadPre *.pdf silent set ro
autocmd BufReadPost *.pdf silent %!pdftotext -nopgbrk -layout -q -eol unix "%" -
"| fmt -w250
" Read-only rtf through unrtf
autocmd BufReadPre *.rtf silent set ro
autocmd BufReadPost *.rtf silent %!unrtf --text
" YAML and Ansible and so on
augroup ansible_vim_fthosts
autocmd!
autocmd BufNewFile,BufRead hosts setfiletype yaml.ansible
augroup END
" as long as vim isn't in diff-mode check the code at opening and closing
" also: special vimdiff-settings
@ -157,6 +131,14 @@ if ! &diff
nnoremap <leader>l <C-L>
endif
" NerdTree Settings
nnoremap <leader>n :NERDTreeToggle<CR>
nnoremap <leader>nf :NERDTreeFocus<CR>
nnoremap <leader>nc :NERDTreeClose<CR>
" block-editing workaround for a windows-terminal-wsl situation
nnoremap <Leader>v <c-v>
"tweaking my statusline
function! GitBranch()
return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
@ -184,3 +166,24 @@ set statusline+=\ %p%%
set statusline+=\ %l:%c
set statusline+=\
call plug#begin('~/.vim/plugged')
" --- Your Plugin List Goes Here ---
" Example:
Plug 'tpope/vim-surround'
Plug 'preservim/nerdtree'
Plug 'pearofducks/ansible-vim'
" Automatically install plugins if they are not installed
" Call plug#config_commit() is the modern way to replace auto_install, save_state, etc.
" call plug#config_commit()
" Optional: For automatic plugin updates on startup if you want
" autocmd VimEnter *
" \ PlugUpgrade |
" \ execute PlugInstall |
" \ PlugClean
" Initialize plugin system, then load plugins
call plug#end()