diff --git a/dotfiles/.config/mimeapps.list b/dotfiles/.config/mimeapps.list index 0259f6a..de0ed05 100644 --- a/dotfiles/.config/mimeapps.list +++ b/dotfiles/.config/mimeapps.list @@ -25,6 +25,7 @@ application/x-ica=citrix-wfica.desktop application/x-wine-extension-ini=citrix-wfica.desktop; x-scheme-handler/fleet=jetbrains-fleet.desktop x-scheme-handler/magnet=magnet.desktop +video/x-matroska=mpv.desktop [Added Associations] x-scheme-handler/http=librewolf.desktop; @@ -46,3 +47,8 @@ application/octet-stream=vim.desktop; application/x-ica=citrix-wfica.desktop; application/x-wine-extension-ini=citrix-wfica.desktop; application/vnd.sqlite3=nvim.desktop; +application/x-executable=nvim-terminal.desktop; +application/vnd.sqlite3=nvim-terminal.desktop; +application/octet-stream=nvim-terminal.desktop; +text/plain=nvim-terminal.desktop; + diff --git a/dotfiles/.config/zsh/.zshrc_aliases b/dotfiles/.config/zsh/.zshrc_aliases index 06235fd..7569bb2 100644 --- a/dotfiles/.config/zsh/.zshrc_aliases +++ b/dotfiles/.config/zsh/.zshrc_aliases @@ -2,6 +2,8 @@ alias mpvgui='mpv --player-operation-mode=pseudo-gui' alias wget='wget --hsts-file="$XDG_DATA_HOME/wget-hsts"' +alias adb='HOME="$XDG_DATA_HOME"/android adb' +alias nvidia-settings='nvidia-settings --config="$XDG_CONFIG_HOME"/nvidia/settings' alias ll='ls -l' alias la='ls -al' @@ -11,32 +13,35 @@ alias lh='ls -lh' alias vim='nvim' alias svim='sudo nvim' -alias ga='git add' -alias gaa='git add .' -alias gaaa='git add -A' -alias gc='git commit' -alias gcm='git commit -m' -alias gd='git diff' -alias gi='git init' -alias gl='git log' -alias gp='git pull' -alias gpsh='git push' -alias gss='git status -s' -# Undo commit (https://stackoverflow.com/questions/2845731/how-to-uncommit-my-last-commit-in-git) -alias gundo='git reset --soft HEAD~1' -alias gck='git checkout' - gacp() { git add . local var="$@" - git commit -m "$var" + if [ $(echo "$var" | wc -c) -gt 70 ]; then + echo "Maximum characters: 72" + return 1 + fi + git commit -m "$var" -S git push } gac() { git add . local var="$@" - git commit -m "$var" + if [ $(echo "$var" | wc -c) -gt 70 ]; then + echo "Maximum characters: 72" + return 1 + fi + git commit -m "$var" -S +} + +gcmp() { + local var="$@" + if [ $(echo "$var" | wc -c) -gt 70 ]; then + echo "Maximum characters: 72" + return 1 + fi + git commit -m "$var" -S + git push } alias exiftcl='exiftool -all=' @@ -45,10 +50,8 @@ alias exift='exiftool' alias upgraded='grep -i upgraded /var/log/pacman.log | tac | less' alias installed='grep -i installed /var/log/pacman.log | tac | less' -# https://archlinux.org/mirrorlist/ alias mirrors='reflector --country Brazil,Chile,Colombia --protocol https --sort rate --save /etc/pacman.d/mirrorlist' -# https://stackoverflow.com/questions/9449778/what-is-the-benefit-of-using-instead-of-backticks-in-shell-scripts# alias open='xdg-open $(fzf)' alias o='xdg-open' @@ -60,10 +63,6 @@ alias trash-dir='cd $HOME/.local/share/Trash' alias val='valgrind --leak-check=full ./listdir prueba/ > valgrind.output 2>&1' -alias pampero='ssh slococo@pampero.itba.edu.ar' - -alias bd='systemctl start postgresql.service' - alias copy='xclip -selection clipboard' function compile() { @@ -75,246 +74,24 @@ function rcomp() { R -e "rmarkdown::render('$file.rmd', 'pdf_document')" && op $file.pdf } -function cl() { - nasm -f elf $1 - local program="${1//.asm/}" - ld -melf_i386 $program.o -o $program - if [[ $# -ge 3 ]]; then - ./$program "${@:3}" - else - ./$program - fi -} - -function cld() { - nasm -f elf $1 && nasm -f elf $2 - local program="${1//.asm/}" - local library="${2//.asm/}" - ld -melf_i386 $program.o $library.o -o $program - if [[ $# -ge 3 ]]; then - ./$program "${@:3}" - else - ./$program - fi -} - -function asc() { - nasm -f elf32 $1 - gcc -c -m32 $2 - local assem="${1//.asm/}" - local cprog="${2//.c/}" - gcc -m32 -no-pie $assem.o $cprog.o -o $assem - if [[ $# -ge 3 ]]; then - ./$assem "${@:3}" - else - ./$assem - fi -} - -function ascn() { - nasm -f elf32 $1 - local assem="${1//.asm/}" - gcc -m32 -no-pie $assem.o -o $assem - if [[ $# -ge 2 ]]; then - ./$assem "${@:2}" - else - ./$assem - fi -} - -function ascld() { - nasm -f elf32 $1 - gcc -c -m32 $2 - local assem="${1//.asm/}" - local cprog="${2//.c/}" - ld -melf_i386 $assem.o $cprog.o -o $assem - if [[ $# -ge 3 ]]; then - ./$assem "${@:3}" - else - ./$assem - fi -} - -function gci() { - echo "Copy after 'git@github.com:'" - git clone git@itba.github.com:$1 -} - -function gcir() { - echo "Copy after 'git@github.com:'" - git remote add origin git@itba.github.com:$1 -} - -function gcn() { - echo "Copy after 'git@github.com:'" - git clone git@github.com:$1 -} - -function gcin() { - echo "Copy after 'git@github.com:'" - git remote add origin git@github.com:$1 -} - -# Start an ssh-agent and run KeePass in order to cache the ssh passwords -function gith() { - #eval $(ssh-agent) - keepass & - ~/.local/bin/waitForSSH & -} - -# https://vsupalov.com/docker-shared-permissions/ -# https://medium.com/redbubble/running-a-docker-container-as-a-non-root-user-7d2e00f8ee15 -#alias dcom='docker run -v ${PWD}:/root -ti -w /root agodio/itba-so:1.0 ${1}' -#alias dcom='docker run -v ${PWD}:/root --security-opt seccomp:unconfined -ti agodio/itba-so:1.0' -alias dcom='docker run -v ${PWD}:/root --security-opt seccomp:unconfined --user $(id -u):$(id -g) -w /root -ti agodio/itba-so:1.0' -#alias dcom='docker run -v ${PWD}:/root --security-opt seccomp:unconfined --user $(id -u):$(id -g) -w /root --name TPE-ARQUI -ti agodio/itba-so:1.0' - -alias dcr='checkIfStarted' - -function dcreate() { - echo "Do you want to create a container with root or user (as the owner)?" - chosen=$(echo "root\nuser" | dmenu) - echo "Enter a name for the container" - read name - if [ $chosen = "root" ]; then - docker run -v ${PWD}:/root --security-opt seccomp:unconfined -w /root --name $name -ti agodio/itba-so:1.0 - else - docker run -v ${PWD}:/root --security-opt seccomp:unconfined --user $(id -u):$(id -g) -w /root --name $name -ti agodio/itba-so:1.0 - fi -} - -function checkIfStarted() { - if systemctl status docker | grep -q "inactive"; then - systemctl start docker - fi -} - -# https://stackoverflow.com/a/61390489 -function docom() { - local dockerID=`docker ps -l -q` - docker start $dockerID > /dev/null - docker exec -it $dockerID $@ - docker stop $dockerID > /dev/null -} - -function dcrun() { - local dockerID=`docker ps -l -q` - docker start $dockerID > /dev/null - docker exec -it $dockerID bash -c 'make all 2>&1 1>/dev/null | grep --color -iP "\^|warning:|error:|"' - docker stop $dockerID > /dev/null - ./run.sh -} - -function dcmake() { - local dockerID=`docker ps -l -q` - docker start $dockerID > /dev/null - docker exec -it $dockerID bash -c 'make all 2>&1 1>/dev/null | grep --color -iP "\^|warning:|error:|"' - docker stop $dockerID > /dev/null -} - -function dcstacho() { - checkIfStarted - #echo `docker ps -a | awk '{ print $12 }'` - #read line - #if [ $line -eq 2 ]; then - # local dockerID=`docker ps -a | awk 'NR==2 { print $12 }'` - #else - # local dockerID=`docker ps -a | awk 'NR==3 { print $12 }'` - #fi - #local dockerID=$(docker ps -a | awk -F"\t" '{print $12}' | tail -n +2 | dmenu) - local dockerID=$(docker ps -a --format "{{.Names}}" | dmenu) - docker start $dockerID > /dev/null - #docker exec -it $dockerID bash -c 'make all 2>&1 1>/dev/null | grep --color -iP "\^|warning:|error:|"' - #docker stop $dockerID > /dev/null - #./run.sh - docker start $dockerID > /dev/null - docker exec -it $dockerID bash $@ -} - -function dcruntpe() { - checkIfStarted - local dockerID='TPE-ARQUI' - docker start $dockerID > /dev/null - docker exec -it $dockerID bash -c 'make all 2>&1 1>/dev/null | grep --color -iP "\^|warning:|error:|"' - docker stop $dockerID > /dev/null - ./run.sh -} - -function dcgdbtpe() { - checkIfStarted - local dockerID='TPE-ARQUI-GDB' - docker start $dockerID > /dev/null - docker exec -it $dockerID bash -c 'make all 2>&1 1>/dev/null | grep --color -iP "\^|warning:|error:|"' - docker stop $dockerID > /dev/null - ./run.sh gdb -} - -function dcstatpe() { - checkIfStarted - local dockerID='TPE-ARQUI-GDB' - docker start $dockerID > /dev/null - docker exec -it $dockerID bash $@ -} - -function dcstotpe() { - local dockerID='TPE-ARQUI-GDB' - docker stop $dockerID > /dev/null -} - -function dcstatpe2() { - checkIfStarted - local dockerID='TPE-ARQUI' - docker start $dockerID > /dev/null - docker exec -it $dockerID bash $@ -} - -function dcsta() { - checkIfStarted - #local dockerID=`docker ps -l -q` - local dockerID=`docker ps -l` - docker start $dockerID > /dev/null - docker exec -it $dockerID bash $@ -} - -function dcsto() { - local dockerID=`docker ps -l -q` - docker stop $dockerID > /dev/null -} - -function extract { - if [ -z "$1" ]; then - echo "Usage: extract ." - else - if [ -f $1 ] ; then - case $1 in - *.tar.bz2) tar xvjf ../$1 ;; - *.tar.gz) tar xvzf ../$1 ;; - *.tar.xz) tar xvJf ../$1 ;; - *.lzma) unlzma ../$1 ;; - *.bz2) bunzip2 ../$1 ;; - *.rar) unrar x -ad ../$1 ;; - *.gz) gunzip ../$1 ;; - *.tar) tar xvf ../$1 ;; - *.tbz2) tar xvjf ../$1 ;; - *.tgz) tar xvzf ../$1 ;; - *.zip) unzip ../$1 ;; - *.Z) uncompress ../$1 ;; - *.7z) 7z x ../$1 ;; - *.xz) unxz ../$1 ;; - *.exe) cabextract ../$1 ;; - *) echo "extract: '$1' - unknown archive method" ;; - esac - else - echo "$1 - file does not exist" - fi - fi -} - -function maketar() { - tar cvzf "${1%%/}.tar.gz" "${1%%/}/" -} - -function makezip() { - zip -r "${1%%/}.zip" "$1" +function fcd() { + local fd_options fzf_options target + + fd_options=( + --hidden + --type directory + --exclude '.git' + ) + + fzf_options=( + --preview='tree -L 1 {}' + --bind=ctrl-space:toggle-preview + --exit-0 + --keep-right + ) + + target="$(fd . "${1:-.}" "${fd_options[@]}" | fzf "${fzf_options[@]}")" + + cd "$target" || return 1 } diff --git a/dotfiles/.zprofile b/dotfiles/.zprofile index e5f4af1..9529408 100644 --- a/dotfiles/.zprofile +++ b/dotfiles/.zprofile @@ -1,40 +1,46 @@ -# Runs only once https://unix.stackexchange.com/questions/71253/what-should-shouldnt-go-in-zshenv-zshrc-zlogin-zprofile-zlogout +#!/bin/sh -export XDG_CONFIG_HOME="$HOME"/.config -export XDG_CACHE_HOME="$HOME"/.cache -export XDG_DATA_HOME="$HOME"/.local/share -export XDG_STATE_HOME="$HOME"/.local/state +export EDITOR=nvim export TERM=st-256color export TERMINAL=st -export GOPATH="$XDG_CONFIG_HOME"/go -export CM_DIR="$XDG_CACHE_HOME/clipmenu" +export TERMINAL_PROG=st +export BROWSER=librewolf +export PAGER='nvimpager -p' + export CM_SELECTIONS="clipboard" export CM_DEBUG=1 export CM_OUTPUT_CLIP=0 export CM_MAX_CLIPS=1000 export CM_IGNORE_WINDOW="Bitwarden|KeePass" export _JAVA_AWT_WM_NONREPARENTING=1 -export PAGER='nvimpager -p' +export QT_QPA_PLATFORMTHEME=gtk2 +export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 + +export XDG_CONFIG_HOME="$HOME"/.config +export XDG_CACHE_HOME="$HOME"/.cache +export XDG_DATA_HOME="$HOME"/.local/share +export XDG_STATE_HOME="$HOME"/.local/state + +export CM_DIR="$XDG_CACHE_HOME"/clipmenu +export GOPATH="$XDG_CONFIG_HOME"/go export R_HOME_USER="$XDG_CONFIG_HOME"/R export R_PROFILE_USER="$XDG_CONFIG_HOME"/R/.Rprofile export R_LIBS_USER="$XDG_CONFIG_HOME"/R/library export R_HISTFILE="$XDG_CONFIG_HOME"/R/.Rhistory -export QT_QPA_PLATFORMTHEME=gtk2 -export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 export CARGO_HOME="$XDG_DATA_HOME"/cargo export CUDA_CACHE_PATH="$XDG_CACHE_HOME"/nv #export GNUPGHOME="$XDG_DATA_HOME"/gnupg export GRADLE_USER_HOME="$XDG_DATA_HOME"/gradle export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc -export XCURSOR_PATH=/usr/share/icons:${XDG_DATA_HOME}/icons +export XCURSOR_PATH=/usr/share/icons:"$XDG_DATA_HOME"/icons export LESSHISTFILE="$XDG_CACHE_HOME"/less/history export TERMINFO="$XDG_DATA_HOME"/terminfo export TERMINFO_DIRS="$XDG_DATA_HOME"/terminfo:/usr/share/terminfo export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc export NVM_DIR="$XDG_DATA_HOME"/nvm export PASSWORD_STORE_DIR="$XDG_DATA_HOME"/pass -export PSQL_HISTORY="$XDG_DATA_HOME/psql_history" -export ZSH="$XDG_DATA_HOME"/oh-my-zsh +export PSQL_HISTORY="$XDG_DATA_HOME"/psql_history +#export ZSH="$XDG_DATA_HOME"/oh-my-zsh export ZDOTDIR="$XDG_CONFIG_HOME"/zsh export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME"/bundle export BUNDLE_USER_CACHE="$XDG_CACHE_HOME"/bundle @@ -42,21 +48,19 @@ export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME"/bundle export NUGET_PACKAGES="$XDG_CACHE_HOME"/NuGetPackages export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker export MINIKUBE_HOME="$XDG_DATA_HOME"/minikube -# export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR"/gcr/ssh +export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR"/gcr/ssh +export XINITRC="$XDG_CONFIG_HOME"/x11/xinitrc +export ANDROID_USER_HOME="$XDG_DATA_HOME"/android +export W3M_DIR="$XDG_DATA_HOME"/w3m -export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus +export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus" -export PATH="$HOME/.local/bin:$PATH:$HOME/.local/share/gem/ruby/3.0.0/bin" -export PATH="$PATH:$HOME/.local/share/JetBrains/Toolbox/scripts" +export PATH="$HOME/.local/bin:$PATH" if grep -q "i5" /proc/cpuinfo; then export LAPTOP="" fi if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then - if [ -v LAPTOP ]; then - exec startx &> /dev/null - else - exec startx - fi + exec startx &> /dev/null fi