Compare commits

...

3 commits

Author SHA1 Message Date
Nikos Papadakis
5fc64864b6
README+cleanup 2023-09-12 20:22:31 +03:00
Nikos Papadakis
0505ea2ce9
fish 2023-09-12 00:58:24 +03:00
Nikos Papadakis
ee15a48829
fish 2023-09-12 00:50:20 +03:00
9 changed files with 26 additions and 265 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
**/fish_variables

View file

@ -1,21 +1,22 @@
## Configurations ## Configurations
- [Neovim Nightly](https://github.com/neovim/neovim) - [Neovim Nightly](https://github.com/neovim/neovim)
- [Wezterm](https://github.com/wez/wezterm)
- [Fish Shell](https://github.com/fish-shell/fish-shell) - [Fish Shell](https://github.com/fish-shell/fish-shell)
- And more - And more
Pick and choose - you might want to change some stuff (git config for example).
## Fonts ## Fonts
You will have to install the fonts I use in these dotfiles separately You will have to install the fonts I use in these dotfiles separately
- [ttf-jetbrains-mono-nerd](https://github.com/ryanoasis/nerd-fonts) - [ttf-jetbrains-mono-nerd](https://github.com/ryanoasis/nerd-fonts)
## Nice programs to have ## Tools
- [ripgrep](https://github.com/BurntSushi/ripgrep) (used by nvim) - [ripgrep](https://github.com/BurntSushi/ripgrep) `grep` alternative (used by nvim)
- [fd](https://github.com/sharkdp/fd) (used by nvim) - [fd](https://github.com/sharkdp/fd) - `find` alternative (used by nvim)
- [exa](https://github.com/ogham/exa) (ls replacement used by fish) - [lsd](https://github.com/lsd-rs/lsd) - `ls` alternative
## Usage ## Usage
@ -27,8 +28,10 @@ cd ~/.dotfiles
``` ```
- For automated dotfile linking use [just](https://github.com/casey/just) - 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 fish
just add nvim just add nvim
just add wezterm just add wezterm

File diff suppressed because one or more lines are too long

View file

@ -1,25 +1,26 @@
set -U fish_greeting set -U fish_greeting
alias exa="exa --group-directories-first" alias lsd="lsd --group-directories-first"
alias newkey="gpg-connect-agent \"scd serialno\" \"learn --force\" /bye" alias newkey="gpg-connect-agent \"scd serialno\" \"learn --force\" /bye"
alias usepodman="set -x -g DOCKER_HOST unix://(podman info --format '{{.Host.RemoteSocket.Path}}')" alias usepodman="set -x -g DOCKER_HOST unix://(podman info --format '{{.Host.RemoteSocket.Path}}')"
test "$TERM" = "xterm-kitty" && alias ssh="kitty +kitten ssh"
test "$TERM_PROGRAM" = "WezTerm" && alias ssh="wezterm ssh"
abbr vim nvim
abbr ls exa
abbr ll exa -l
abbr la exa -la
abbr gs git status abbr gs git status
abbr gc git commit abbr gc git commit
abbr gap git add -p abbr gap git add -p
abbr gps git push abbr gps git push
abbr gpl git pull abbr gpl git pull
test (command -v doas) && abbr sudo doas type -q nvim && abbr vim nvim
type -q doas && abbr sudo doas
if type -q lsd
abbr ls lsd
abbr ll lsd -l
abbr la lsd -la
abbr llg lsd -lg
end
# Environment variables # Environment variables
set -x -g RUSTUP_HOME $XDG_DATA_HOME/rustup set -x -g RUSTUP_HOME $XDG_DATA_HOME/rustup
set -x -g CARGO_HOME $HOME/.cargo set -x -g CARGO_HOME $HOME/.cargo
set -x -g PATH $CARGO_HOME/bin $RUSTUP_HOME/bin $HOME/.local/bin $PATH set -x -g PATH $CARGO_HOME/bin $RUSTUP_HOME/bin $HOME/.local/bin $PATH
test (command -v zoxide) && zoxide init fish | source type -q zoxide && zoxide init fish | source
test -e ~/.asdf && source ~/.asdf/asdf.fish test -e ~/.asdf && source ~/.asdf/asdf.fish

View file

@ -1,43 +0,0 @@
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR __fish_initialized:3400
SETUVAR _fish_abbr_gap:git\x20add\x20\x2dp
SETUVAR _fish_abbr_gc:git\x20commit
SETUVAR _fish_abbr_gs:git\x20status
SETUVAR _fish_abbr_la:exa\x20\x2dlha
SETUVAR _fish_abbr_ll:exa\x20\x2dlh
SETUVAR _fish_abbr_ls:exa
SETUVAR _fish_abbr_vim:nvim
SETUVAR _fish_abbr_za:zoxide\x20add
SETUVAR _fish_abbr_zq:zoxide\x20query
SETUVAR _fish_abbr_zqi:zoxide\x20query\x20\x2di
SETUVAR _fish_abbr_zr:zoxide\x20remove
SETUVAR fish_color_autosuggestion:555\x1ebrblack
SETUVAR fish_color_cancel:\x2dr
SETUVAR fish_color_command:blue
SETUVAR fish_color_comment:red
SETUVAR fish_color_cwd:green
SETUVAR fish_color_cwd_root:red
SETUVAR fish_color_end:green
SETUVAR fish_color_error:brred
SETUVAR fish_color_escape:brcyan
SETUVAR fish_color_history_current:\x2d\x2dbold
SETUVAR fish_color_host:normal
SETUVAR fish_color_host_remote:yellow
SETUVAR fish_color_normal:normal
SETUVAR fish_color_operator:brcyan
SETUVAR fish_color_param:cyan
SETUVAR fish_color_quote:yellow
SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold
SETUVAR fish_color_search_match:\x2d\x2dbackground\x3d111
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
SETUVAR fish_color_status:red
SETUVAR fish_color_user:brgreen
SETUVAR fish_color_valid_path:\x2d\x2dunderline
SETUVAR fish_greeting:\x1d
SETUVAR fish_key_bindings:fish_default_key_bindings
SETUVAR fish_pager_color_completion:normal
SETUVAR fish_pager_color_description:B3A06D\x1eyellow\x1e\x2di
SETUVAR fish_pager_color_prefix:cyan\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
SETUVAR fish_pager_color_selected_background:\x2dr

View file

@ -1,8 +1,8 @@
add target: add target:
#!/bin/env sh #!/bin/env sh
set -e
target={{trim_end_matches(target, '/')}} target={{trim_end_matches(target, '/')}}
find $target -mindepth 1 | while read p find $target -mindepth 1 | while read p; do
do
t=~/`echo -n $p | sed "s/^$target\///" | sed s/dot-/./g` t=~/`echo -n $p | sed "s/^$target\///" | sed s/dot-/./g`
s="{{justfile_directory()}}/$p" s="{{justfile_directory()}}/$p"
if ( ! test -e $t ); then if ( ! test -e $t ); then
@ -13,13 +13,13 @@ add target:
remove target: remove target:
#!/bin/env sh #!/bin/env sh
set -e
target={{trim_end_matches(target, '/')}} target={{trim_end_matches(target, '/')}}
find $target -mindepth 1 | while read p find $target -mindepth 1 | while read p; do
do
t=~/`echo -n $p | sed "s/^$target\///" | sed s/dot-/./g` t=~/`echo -n $p | sed "s/^$target\///" | sed s/dot-/./g`
if ( test -L $t ); then if ( test -L $t ); then
rm $t && echo "rm $t" rm $t && echo "Removing $t"
fi fi
done done
# vim: set ft=sh : # vim: set syntax=sh :

View file

@ -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}"

View file

@ -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

View file

@ -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)"