Compare commits

...

5 Commits

10 changed files with 194 additions and 33 deletions

View File

@ -1,3 +1,3 @@
^/\.git.* ^/\.git.*
.*\.bak$ .*.bak$
readme.md readme.md

3
shell/.stow-local-ignore Normal file
View File

@ -0,0 +1,3 @@
^/\.git.*
.*.bak$
readme.md

View File

@ -2,43 +2,68 @@
# ~/.bashrc # ~/.bashrc
# #
export PATH="$PATH:$HOME/.local/bin"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_BIN_HOME="$HOME/.local/bin"
export XDG_MUSIC_DIR="$HOME/Music"
export XDG_DOCUMENTS_DIR="$HOME/Documents"
# export XDG_PICTURES_DIR="$HOME/Media/images"
# export XDG_VIDEOS_DIR="$HOME/Media/videos"
# fix ansible dirs
export ANSIBLE_HOME="${XDG_CONFIG_HOME}/ansible/home"
export ANSIBLE_CONFIG="${XDG_CONFIG_HOME}/ansible/ansible.cfg"
export ANSIBLE_GALAXY_CACHE_DIR="${XDG_CACHE_HOME}/ansible/galaxy_cache"
#NOTE: for the tmp dir on remotes sould be configuard in ansible.cfg
# fix rust dirs
export RUSTUP_HOME="$HOME/.local/rust/rustup"
export CARGO_HOME="$HOME/.local/rust/cargo"
# fix discord dirs
# export DISCORD_USER_DATA_DIR="${XDG_DATA_HOME}"
# fix docker dirs
export DOCKER_CONFIG="${XDG_CONFIG_HOME}/docker"
# fix screen dirs
export SCREENRC="${XDG_CONFIG_HOME}/screen/screenrc"
export SCREENDIR="${XDG_RUNTIME_DIR}/screen"
# fix texlive dirs
export TEXMFHOME="${XDG_DATA_HOME}/texmf"
export TEXMFVAR="${XDG_CACHE_HOME}/texlive/texmf-var"
export TEXMFCONFIG="${XDG_CONFIG_HOME}/texlive/texmf-config"
# fix wget dirs
export WGETRC="${XDG_CONFIG_HOME}/wgetrc"
alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
# fix npm dirs
export NPM_CONFIG_USERCONFIG="${XDG_CONFIG_HOME}/npm/npmrc"
# fix gnupg dirs
#TODO: test this
# export GNUPGHOME="${XDG_DATA_HOME}/gnupg"
# fix java dirs
export _JAVA_OPTIONS="-Djava.util.prefs.userRoot=${XDG_CONFIG_HOME}/java"
# If not running interactively, don't do anything # If not running interactively, don't do anything
[[ $- != *i* ]] && return [[ $- != *i* ]] && return
alias ls='ls --color=auto' alias ls='ls --color=auto'
alias la='ls --color=auto -plhA' alias la='ls --color=auto -plhA'
alias grep='grep --color=auto' alias grep='grep --color=auto'
alias prusa-slicer='flatpak run com.prusa3d.PrusaSlicer'
parse_git_branch() {
local b=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
if [ "$b" != "" ]
then
local behind=$(git rev-list HEAD...@{u} --ignore-submodules --count 2>/dev/null)
local ahead=$(git rev-list @{u}...HEAD --ignore-submodules --count 2>/dev/null)
git diff --cached --exit-code &> /dev/null || b="${b}+"
git diff --exit-code &> /dev/null || b="${b}*"
if [[ "$behind" > 0 || "$ahead" > 0 ]]
then
b="$b ☁ "
if [[ "$ahead" > 0 ]]
then
b="$b+$ahead"
fi
if [[ "$behind" > 0 ]]
then
b="$b-$behind"
fi
fi
fi
echo -n "$b"
}
# \e[0;$(e=$?;((e))&& echo "91" || echo "0"))m\]\$\[\e[0m\]
PS1='\n\[\e[35m\]\h \[\e[32m\]\w \[\e[35m\]$(parse_git_branch)\[\e[0m\]\n$ '
export PATH="$PATH:$HOME/.local/bin"
export EDITOR=vim export EDITOR=vim
# quartus
export QSYS_ROOTDIR="$HOME/.local/intelFPGA_lite/18.1/quartus/sopc_builder/bin" export QSYS_ROOTDIR="$HOME/.local/intelFPGA_lite/18.1/quartus/sopc_builder/bin"
. "$HOME/.cargo/env"
# start ssh-agent # start ssh-agent
if [[ ! -f "$HOME/.ssh/agent.env" ]] if [[ ! -f "$HOME/.ssh/agent.env" ]]
@ -53,6 +78,15 @@ export SSH_AGENT_PID;
export SSH_AUTH_SOCK; export SSH_AUTH_SOCK;
# rust # rust
export RUSTUP_HOME="$HOME/.local/rust/rustup" . "$CARGO_HOME/env"
export CARGO_HOME="$HOME/.local/rust/cargo"
. $HOME/.local/rust/cargo # better tools
export FZF_CTRL_T_OPTS="
--walker-skip .git,node_modules,target,.var
--preview 'bat -n --color=always {}'
--bind 'ctrl-/:change-preview-window(down|hidden|)'"
eval "$(fzf --bash)"
eval "$(zoxide init bash --cmd cd)"
# prompt
eval "$(oh-my-posh init bash --config "$HOME/.config/oh-my-posh.toml")"

View File

@ -0,0 +1,31 @@
if status is-interactive
alias ls='ls --color=auto'
alias la='ls --color=auto -plhA'
alias grep='grep --color=auto'
alias prusa-slicer='flatpak run com.prusa3d.PrusaSlicer'
export PATH="$PATH:$HOME/.local/bin"
export EDITOR=vim
# quartus
export QSYS_ROOTDIR="$HOME/.local/intelFPGA_lite/18.1/quartus/sopc_builder/bin"
# TODO: ssh-agent
# TODO: rust
# fuzzy find
export FZF_CTRL_T_OPTS="
--walker-skip .git,node_modules,target,.var
--preview 'bat -n --color=always {}'
--bind 'ctrl-/:change-preview-window(down|hidden|)'"
fzf --fish | source
# better cd
zoxide init fish --cmd cd | source
# prompt
oh-my-posh init fish --config "$HOME/.config/oh-my-posh.toml" | source
end

View File

@ -0,0 +1,5 @@
prefix=${XDG_DATA_HOME}/npm
cache=${XDG_CACHE_HOME}/npm
init-module=${XDG_CONFIG_HOME}/npm/config/npm-init.js
logs-dir=${XDG_STATE_HOME}/npm/logs

View File

@ -0,0 +1,81 @@
console_title_template = '{{ .Shell }} in {{ .Folder }}'
version = 3
final_space = true
[secondary_prompt]
template = ' '
foreground = 'magenta'
background = 'transparent'
## does not work in bash
[transient_prompt]
template = ' '
foreground_templates = ['{{if gt .Code 0}}red{{end}}', '{{if eq .Code 0}}default{{end}}']
background = 'transparent'
[[blocks]]
type = 'prompt'
alignment = 'left'
newline = true
[[blocks.segments]]
type = 'session'
template = '{{ if .SSHSession }}⇄ {{ end }}{{ .HostName }}'
style = 'plain'
foreground_templates = ['{{if .Root }}red{{else}}magenta{{end}}']
background = 'transparent'
[[blocks.segments]]
type = 'path'
template = ' {{ .Path }}'
style = 'plain'
foreground = 'green'
background = 'transparent'
[blocks.segments.properties]
style = 'full'
[[blocks.segments]]
type = 'git'
template = ' {{ url .HEAD .UpstreamURL }}{{ if (.Working.Changed) }}*{{ end }}{{ if (.Staging.Changed) }}+{{ end }}{{ if or (gt .Behind 0) (gt .Ahead 0) }} ☁ {{ if gt .Behind 0 }}-{{ .Behind }}{{ end }}{{ if gt .Ahead 0 }}+{{ .Ahead }}{{ end }}{{ end }}'
style = 'plain'
foreground = 'magenta'
background = 'transparent'
[blocks.segments.properties]
branch_icon = ''
commit_icon = '@'
fetch_status = true
fetch_upstream_icon = true
[blocks.segments.properties.ignore_submodules]
'*' = 'none'
[[blocks]]
type = 'rprompt'
overflow = 'hidden'
[[blocks.segments]]
template = '{{ .FormattedMs }}'
foreground = 'yellow'
background = 'transparent'
type = 'executiontime'
style = 'plain'
[blocks.segments.properties]
cache_duration = 'none'
threshold = 5000
[[blocks]]
type = 'prompt'
alignment = 'left'
newline = true
[[blocks.segments]]
template = ''
background = 'transparent'
type = 'text'
style = 'plain'
foreground_templates = ['{{if gt .Code 0}}red{{end}}', '{{if eq .Code 0}}magenta{{end}}']
[blocks.segments.properties]
cache_duration = 'none'

View File

@ -0,0 +1,7 @@
#!/bin/bash
font="$(fc-list | fzf)"
echo "$font"
display "$(echo "$font" | awk '{{ print $1 }}' | tr -d ':')"

View File

@ -5,7 +5,7 @@ function get_all_packages() {
find . -maxdepth 1 -type d -not -name ".git" -not -name "." find . -maxdepth 1 -type d -not -name ".git" -not -name "."
} }
stow_cmd="stow --dir '$HOME/.config/dotfiles' --target '$HOME' --dotfiles" stow_cmd="stow --dir $HOME/.config/dotfiles --target $HOME --dotfiles"
if [ "$*" == "" ] if [ "$*" == "" ]
then then