README+cleanup
This commit is contained in:
parent
0505ea2ce9
commit
5fc64864b6
5 changed files with 14 additions and 212 deletions
13
README.md
13
README.md
|
@ -1,21 +1,22 @@
|
|||
## Configurations
|
||||
|
||||
- [Neovim Nightly](https://github.com/neovim/neovim)
|
||||
- [Wezterm](https://github.com/wez/wezterm)
|
||||
- [Fish Shell](https://github.com/fish-shell/fish-shell)
|
||||
- And more
|
||||
|
||||
Pick and choose - you might want to change some stuff (git config for example).
|
||||
|
||||
## Fonts
|
||||
|
||||
You will have to install the fonts I use in these dotfiles separately
|
||||
|
||||
- [ttf-jetbrains-mono-nerd](https://github.com/ryanoasis/nerd-fonts)
|
||||
|
||||
## Nice programs to have
|
||||
## Tools
|
||||
|
||||
- [ripgrep](https://github.com/BurntSushi/ripgrep) (used by nvim)
|
||||
- [fd](https://github.com/sharkdp/fd) (used by nvim)
|
||||
- [exa](https://github.com/ogham/exa) (ls replacement used by fish)
|
||||
- [ripgrep](https://github.com/BurntSushi/ripgrep) `grep` alternative (used by nvim)
|
||||
- [fd](https://github.com/sharkdp/fd) - `find` alternative (used by nvim)
|
||||
- [lsd](https://github.com/lsd-rs/lsd) - `ls` alternative
|
||||
|
||||
## Usage
|
||||
|
||||
|
@ -27,8 +28,10 @@ cd ~/.dotfiles
|
|||
```
|
||||
|
||||
- For automated dotfile linking use [just](https://github.com/casey/just)
|
||||
- Use `just add target` where target is the config directory
|
||||
|
||||
```
|
||||
cd ~/.dotfiles
|
||||
just add fish
|
||||
just add nvim
|
||||
just add wezterm
|
||||
|
|
12
justfile
12
justfile
|
@ -1,8 +1,8 @@
|
|||
add target:
|
||||
#!/bin/env sh
|
||||
set -e
|
||||
target={{trim_end_matches(target, '/')}}
|
||||
find $target -mindepth 1 | while read p
|
||||
do
|
||||
find $target -mindepth 1 | while read p; do
|
||||
t=~/`echo -n $p | sed "s/^$target\///" | sed s/dot-/./g`
|
||||
s="{{justfile_directory()}}/$p"
|
||||
if ( ! test -e $t ); then
|
||||
|
@ -13,13 +13,13 @@ add target:
|
|||
|
||||
remove target:
|
||||
#!/bin/env sh
|
||||
set -e
|
||||
target={{trim_end_matches(target, '/')}}
|
||||
find $target -mindepth 1 | while read p
|
||||
do
|
||||
find $target -mindepth 1 | while read p; do
|
||||
t=~/`echo -n $p | sed "s/^$target\///" | sed s/dot-/./g`
|
||||
if ( test -L $t ); then
|
||||
rm $t && echo "rm $t"
|
||||
rm $t && echo "Removing $t"
|
||||
fi
|
||||
done
|
||||
|
||||
# vim: set ft=sh :
|
||||
# vim: set syntax=sh :
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
#!/bin/env bash
|
||||
|
||||
# share.sh - Shares a file with a link by uploading to a "Gokapi" backend
|
||||
# Depends on: curl, jq, libsecret
|
||||
|
||||
set -e
|
||||
|
||||
URL="https://${SHARE_DOMAIN}/api/files/add"
|
||||
|
||||
usage() {
|
||||
printf "share - Share a file
|
||||
|
||||
Usage: share [options] FILE
|
||||
|
||||
Options:
|
||||
-f <name>\tName of the file that will be uploaded
|
||||
-p <passwd>\tPassword
|
||||
-d <number>\tAllowed nubmer of downloads
|
||||
-e <expiry>\tExpiry in days\n"
|
||||
}
|
||||
|
||||
[ $# -eq 0 ] && usage && exit 1
|
||||
|
||||
options=$(getopt "hp:d:e:f:" "$@")
|
||||
eval set -- "$options"
|
||||
|
||||
while true; do
|
||||
case $1 in
|
||||
-p)
|
||||
shift
|
||||
PASSWORD="$1"
|
||||
;;
|
||||
-d)
|
||||
shift
|
||||
ALLOWED_DOWNLOADS="$1"
|
||||
;;
|
||||
-e)
|
||||
shift
|
||||
EXPIRY_DAYS="$1"
|
||||
;;
|
||||
-f)
|
||||
shift
|
||||
FILENAME="$1"
|
||||
;;
|
||||
-h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
[ $# -eq 0 ] && usage && exit 1 || FILE=$1
|
||||
|
||||
if [ ! -f "$FILE" ] && [ $FILE != "-" ]; then
|
||||
echo "File ${FILE} not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
APIKEY=$(secret-tool lookup share apikey)
|
||||
if [ ! "$APIKEY" ]; then
|
||||
echo "Please enter your API key for Gokapi"
|
||||
secret-tool store --label "API key for share.sh" share apikey
|
||||
APIKEY=$(secret-tool lookup share apikey)
|
||||
fi
|
||||
|
||||
read RESULT ID URL HOTLINKURL HOTLINKID < <(echo $(curl -# -X POST \
|
||||
--fail \
|
||||
-F "file=@${FILE};filename=${FILENAME:-$FILE}" \
|
||||
-F "password=${PASSWORD}" \
|
||||
-F "allowedDownloads=${ALLOWED_DOWNLOADS:-0}" \
|
||||
-F "expiryDays=${EXPIRY_DAYS}" \
|
||||
-H "accept: application/json" \
|
||||
-H "apikey: ${APIKEY}" \
|
||||
-H "Content-Type: multipart/form-data" \
|
||||
"${URL}" | jq -r '.Result, .FileInfo.Id, .Url, .HotlinkUrl, .FileInfo.HotlinkId'))
|
||||
|
||||
if [ $RESULT != "OK" ]; then
|
||||
echo "An error occured when trying to upload the file."
|
||||
echo "Result was: $RESULT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Uploaded url: ${URL}${ID}"
|
||||
[ ! "$HOTLINKID" ] || echo "Hotlink: ${HOTLINKURL}${HOTLINKID}"
|
|
@ -1,15 +0,0 @@
|
|||
#!/bin/env bash
|
||||
|
||||
# shot - Take a screenshot and upload it
|
||||
# Depends on: share
|
||||
|
||||
filename=$(date "+%F_%T").png
|
||||
flameshot_cmd="flatpak run org.flameshot.Flameshot"
|
||||
|
||||
if command -v $flameshot_cmd &> /dev/null; then
|
||||
$flameshot_cmd gui -r | ~/.local/bin/share -f $filename - | grep "Hotlink:" | cut -d ' ' -f2 | xclip -selection c \
|
||||
&& notify-send "Shot" "Screenshot URL copied to clipboard"
|
||||
else
|
||||
echo "No supported screenshot program found"
|
||||
exit 1
|
||||
fi
|
98
zsh/.zshrc
98
zsh/.zshrc
|
@ -1,98 +0,0 @@
|
|||
unsetopt beep
|
||||
# unsetopt AUTO_MENU
|
||||
# setopt MENU_COMPLETE
|
||||
# setopt AUTO_CD
|
||||
|
||||
# History
|
||||
HISTFILE=~/.zsh_history
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
setopt HIST_IGNORE_ALL_DUPS
|
||||
setopt EXTENDED_HISTORY
|
||||
setopt APPEND_HISTORY
|
||||
|
||||
if [ -e "/usr/share/fzf" ]; then
|
||||
source /usr/share/fzf/key-bindings.zsh
|
||||
source /usr/share/fzf/completion.zsh
|
||||
fi
|
||||
|
||||
### Aliases ---------------------------------------------
|
||||
alias vim="nvim"
|
||||
alias rm="rm -i"
|
||||
alias mv="mv -i"
|
||||
alias ls="exa --group-directories-first"
|
||||
alias ll="ls -lh"
|
||||
alias la="ls -lha"
|
||||
alias grep="grep --color=auto"
|
||||
alias less="less -r"
|
||||
alias nnn="nnn -e"
|
||||
[ "$TERM" = "xterm-kitty" ] && alias ssh="kitty +kitten ssh"
|
||||
alias gs="git status"
|
||||
alias gap="git add -p"
|
||||
alias gc="git commit"
|
||||
alias lg="lazygit"
|
||||
### -----------------------------------------------------
|
||||
|
||||
# Fix keys
|
||||
bindkey '^[[H' beginning-of-line
|
||||
bindkey '^[[F' end-of-line
|
||||
bindkey '^H' backward-delete-word
|
||||
bindkey '^[[1;5D' backward-word
|
||||
bindkey '^[[1;5C' forward-word
|
||||
bindkey '^[[3~' delete-char
|
||||
bindkey '^[[3;5~' delete-word
|
||||
|
||||
### zsh-autosuggestions
|
||||
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#a6a6a6"
|
||||
ZSH_AUTOSUGGEST_USE_ASYNC=1
|
||||
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
|
||||
zle -N autosuggest-accept
|
||||
bindkey '^ ' autosuggest-accept
|
||||
|
||||
export ZISH_HOME=$HOME/.local/share/zish
|
||||
export RUSTUP_HOME="$XDG_DATA_HOME"/rustup
|
||||
export PATH="$PATH:$HOME/.local/bin"
|
||||
|
||||
install_plugin() {
|
||||
IFS='/' read group project <<< "$1"
|
||||
repo=$1
|
||||
dir="$ZISH_HOME/repos/$repo"
|
||||
shift
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
IFS=':' read action value <<< "$1"
|
||||
case $action in
|
||||
"build")
|
||||
build=$value
|
||||
;;
|
||||
"use")
|
||||
use=$dir/$value
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [[ ! -d $dir ]]; then
|
||||
mkdir -p $dir && cd $dir && git clone --depth=1 "https://github.com/$repo" .
|
||||
[ -v build ] && eval $build
|
||||
fi
|
||||
|
||||
[ -v use ] && source $use || source $dir/$project.plugin.zsh
|
||||
}
|
||||
|
||||
install_plugin "zsh-users/zsh-syntax-highlighting"
|
||||
install_plugin "zsh-users/zsh-autosuggestions"
|
||||
install_plugin "zsh-users/zsh-completions"
|
||||
install_plugin "trapd00r/LS_COLORS" build:"dircolors -b LS_COLORS > c.zsh" use:"c.zsh"
|
||||
|
||||
zstyle ":completion:*" list-colors ${(s.:.)LS_COLORS}
|
||||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
|
||||
zstyle ':completion:*' menu select
|
||||
|
||||
autoload -U compinit
|
||||
|
||||
eval "$(zoxide init zsh)"
|
||||
|
||||
# starship prompt: https://github.com/starship/starship
|
||||
# Must be at end of file
|
||||
eval "$(starship init zsh)"
|
Loading…
Reference in a new issue