Some zsh stuff

This commit is contained in:
Leon Kowarschick 2020-07-04 13:29:51 +02:00
parent 5a48f2412b
commit 101e97c853
6 changed files with 173 additions and 60 deletions

View file

@ -501,3 +501,10 @@ Read them by running the command 'home-manager news'.
Read them by running the command 'home-manager news'. Read them by running the command 'home-manager news'.
Read them by running the command 'home-manager news'.
I was asking if you were using a vector font that looked like that, or if it's an upscaled version of a bitmap font
Read them by running the command 'home-manager news'.

View file

@ -218,13 +218,3 @@ click-middle = bash ~/.config/polybar/polybar-scripts/pulseaudio-control.bash to
click-left = bash ~/.config/polybar/polybar-scripts/pulseaudio-control.bash next-sink click-left = bash ~/.config/polybar/polybar-scripts/pulseaudio-control.bash next-sink
scroll-up = bash ~/.config/polybar/polybar-scripts/pulseaudio-control.bash up scroll-up = bash ~/.config/polybar/polybar-scripts/pulseaudio-control.bash up
scroll-down = bash ~/.config/polybar/polybar-scripts/pulseaudio-control.bash down scroll-down = bash ~/.config/polybar/polybar-scripts/pulseaudio-control.bash down
[module/polynotifications]
type = custom/script
# Change the path to where you downloaded polynotifications
exec = ~/.config/polybar/polynotifications/polynotifications.sh
format = <label>
label-padding = 1
tail = true

@ -1 +0,0 @@
Subproject commit bf8ad4a5a5a1d8af7d1a392a736d353c40d03ac1

View file

@ -14,36 +14,7 @@ let
cxmonad = "cd ~/.xmonad && nvim ~/.xmonad/lib/Config.hs && cd -"; cxmonad = "cd ~/.xmonad && nvim ~/.xmonad/lib/Config.hs && cd -";
}; };
in manFunction = ''
{
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
defaultKeymap = "viins";
dotDir = "~/.config";
history = {
save = 10000;
share = true;
ignoreDups = true;
ignoreSpace = true;
};
localVariables = {
#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "bg=${myConf.colors.accentDark}"; # why does this not work D:
};
initExtra = ''
setopt HIST_IGNORE_ALL_DUPS
autoload -Uz promptinit
promptinit
zstyle ":completion:*" menu select
zstyle ':completion::complete:*' gain-privileges 1
compinit
_comp_options+=(globdots)
function man() { function man() {
env \ env \
LESS_TERMCAP_md=$(tput bold; tput setaf 4) \ LESS_TERMCAP_md=$(tput bold; tput setaf 4) \
@ -56,16 +27,143 @@ in
PAGER="''${commands[less]:-$PAGER}" \ PAGER="''${commands[less]:-$PAGER}" \
man "$@" man "$@"
} }
'';
fixedKeybinds = ''
typeset -g -A key
key[Home]="^[[H"
key[End]="^[[F"
key[Insert]="''${terminfo[kich1]}"
key[Backspace]="''${terminfo[kbs]}"
key[Delete]="''${terminfo[kdch1]}"
key[Up]="''${terminfo[kcuu1]}"
key[Down]="''${terminfo[kcud1]}"
key[Left]="''${terminfo[kcub1]}"
key[Right]="''${terminfo[kcuf1]}"
key[PageUp]="''${terminfo[kpp]}"
key[PageDown]="''${terminfo[knp]}"
key[Shift-Tab]="''${terminfo[kcbt]}"
# setup key accordingly
[[ -n "''${key[Home]}" ]] && bindkey -M vicmd "''${key[Home]}" beginning-of-line && bindkey -M viins "''${key[Home]}" beginning-of-line
[[ -n "''${key[End]}" ]] && bindkey -M vicmd "''${key[End]}" end-of-line && bindkey -M viins "''${key[End]}" end-of-line
[[ -n "''${key[Insert]}" ]] && bindkey -M vicmd "''${key[Insert]}" overwrite-mode && bindkey -M viins "''${key[Insert]}" overwrite-mode
[[ -n "''${key[Backspace]}" ]] && bindkey -M vicmd "''${key[Backspace]}" backward-delete-char && bindkey -M viins "''${key[Backspace]}" backward-delete-char
[[ -n "''${key[Delete]}" ]] && bindkey -M vicmd "''${key[Delete]}" delete-char && bindkey -M viins "''${key[Delete]}" delete-char
[[ -n "''${key[Up]}" ]] && bindkey -M vicmd "''${key[Up]}" up-line-or-history && bindkey -M viins "''${key[Up]}" up-line-or-history
[[ -n "''${key[Down]}" ]] && bindkey -M vicmd "''${key[Down]}" down-line-or-history && bindkey -M viins "''${key[Down]}" down-line-or-history
[[ -n "''${key[Left]}" ]] && bindkey -M vicmd "''${key[Left]}" backward-char && bindkey -M viins "''${key[Left]}" backward-char
[[ -n "''${key[Right]}" ]] && bindkey -M vicmd "''${key[Right]}" forward-char && bindkey -M viins "''${key[Right]}" forward-char
[[ -n "''${key[PageUp]}" ]] && bindkey -M vicmd "''${key[PageUp]}" beginning-of-buffer-or-history && bindkey -M viins "''${key[PageUp]}" beginning-of-buffer-or-history
[[ -n "''${key[PageDown]}" ]] && bindkey -M vicmd "''${key[PageDown]}" end-of-buffer-or-history && bindkey -M viins "''${key[PageDown]}" end-of-buffer-or-history
[[ -n "''${key[Shift-Tab]}" ]] && bindkey -M vicmd "''${key[Shift-Tab]}" reverse-menu-complete && bindkey -M viins "''${key[Shift-Tab]}" reverse-menu-complete
'';
fzf-tab-stuff = ''
FZF_TAB_COMMAND=(
fzf
--ansi
--expect='$continuous_trigger' # For continuous completion
'--color=hl:$(( $#headers == 0 ? 108 : 255 ))'
--nth=2,3 --delimiter='\x00' # Don't search prefix
--layout=reverse --height="''${FZF_TMUX_HEIGHT:=50%}"
--tiebreak=begin -m --bind=tab:down,btab:up,change:top,ctrl-space:toggle --cycle
'--query=$query' # $query will be expanded to query string at runtime.
'--header-lines=$#headers' # $#headers will be expanded to lines of headers at runtime
)
zstyle ':fzf-tab:*' command $FZF_TAB_COMMAND
zstyle ':completion:complete:*:options' sort false
zstyle ':fzf-tab:complete:_zlua:*' query-string input
local extract="
local in=\''${\''${\"\$(<{f})\"%\$'\0'*}#*\$'\0'}
local -A ctxt=(\"\''${(@ps:\2:)CTXT}\")
local realpath=\''${ctxt[IPREFIX]}\''${ctxt[hpre]}\$in
realpath=\''${(Qe)~realpath}
"
zstyle ':fzf-tab:complete:cd:*' extra-opts --preview=$extract'lsd -1 --color=always $realpath'
zstyle ':fzf-tab:complete:ls:*' extra-opts --preview=$extract'lsd -1 --color=always $realpath'
'';
in
{
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
#defaultKeymap = "viins";
history = {
save = 10000;
share = false;
ignoreDups = true;
ignoreSpace = true;
};
localVariables = {
#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "bg=${myConf.colors.accentDark}"; # why does this not work D:
#ZSH_AUTOSUGGEST_USE_ASYNC = 1;
};
initExtra = ''
setopt nobeep
setopt HIST_IGNORE_ALL_DUPS
autoload -Uz colors && colors
autoload -Uz promptinit && promptinit
autoload -U compinit
zstyle ':completion:*' menu select
zstyle ':completion::complete:*' gain-privileges 1
zstyle ':completion:*' list-prompt ""
zstyle ':completion:*' select-prompt ""
zmodload zsh/complist
compinit
_comp_options+=(globdots)
# enable cdr command
autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
add-zsh-hook chpwd chpwd_recent_dirs
# deer is a ranger-style file manager directly in the shell that doesn't fully context-switch
#source ~/nixpkgs/config/deer.zsh #source ~/nixpkgs/config/deer.zsh
#zle -N deer #zle -N deer
#bindkey '\ek' deer #bindkey '\ek' deer
${fzf-tab-stuff}
${fixedKeybinds}
${abbrs} ${abbrs}
${manFunction}
${builtins.readFile ./prompt.zsh} ${builtins.readFile ./prompt.zsh}
''; '';
plugins = [ plugins = [
#{
#name = "zsh-completions";
#src = pkgs.fetchFromGitHub {
#owner = "zsh-users";
#repo = "zsh-completions";
#rev = "0.32.0";
#sha256 = "12l9wrx0aysyj62kgp5limglz0nq73w8c415wcshxnxmhyk6sw6d";
#};
#}
{
name = "fzf-tab";
src = pkgs.fetchFromGitHub {
owner = "Aloxaf";
repo = "fzf-tab";
rev = "d92299baafdf197c93a88e54f9bbc1c8bb31d427";
sha256 = "046fbhp5777iwl6n901db84bbmxbjgnh5gv9yqy9x15s8ikagzdl";
};
}
{ {
name = "zsh-autosuggestions"; name = "zsh-autosuggestions";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
@ -85,6 +183,7 @@ in
sha256 = "0y8va5kc2ram38hbk2cibkk64ffrabfv1sh4xm7pjspsba9n5p1y"; sha256 = "0y8va5kc2ram38hbk2cibkk64ffrabfv1sh4xm7pjspsba9n5p1y";
}; };
} }
{ {
name = "zsh-abbr"; name = "zsh-abbr";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
@ -94,16 +193,7 @@ in
sha256 = "0aln7ashadbgharfn4slhimbw624ai82p4yizsxwvz70y4dv0wpg"; sha256 = "0aln7ashadbgharfn4slhimbw624ai82p4yizsxwvz70y4dv0wpg";
}; };
} }
{
# look at this https://github.com/zdharma/fast-syntax-highlighting
name = "zsh-syntax-highlighting";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-syntax-highlighting";
rev = "0.7.1";
sha256 = "03r6hpb5fy4yaakqm3lbf4xcvd408r44jgpv4lnzl9asp4sb9qc0";
};
}
{ {
name = "fast-syntax-highlighting"; name = "fast-syntax-highlighting";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {

View file

@ -19,16 +19,17 @@ in
}; };
home.packages = [ home.packages = with pkgs; [
elkowar_local.bashtop elkowar_local.bashtop
pkgs.htop htop
pkgs.direnv direnv
pkgs.rnix-lsp rnix-lsp
pkgs.nix-prefetch-git nix-prefetch-git
pkgs.gtop gtop
pkgs.simplescreenrecorder simplescreenrecorder
pkgs.bat bat
pkgs.websocat fontforge
websocat
#pkgs.timg #pkgs.timg
]; ];

26
files/scripts/mkFFGH.sh Executable file
View file

@ -0,0 +1,26 @@
#!/bin/bash
repo_url="$1"
rev="$2"
if [ -n "$rev" ]; then
output="$(nix-prefetch-git "$repo_url" --rev "$rev" 2>/dev/null)"
else
output="$(nix-prefetch-git "$repo_url" 2>/dev/null)"
fi
owner="$(echo "$repo_url" | sed 's/.*github\..*\/\(.*\)\/\(.*\)$/\1/')"
repo="$(echo "$repo_url" | sed 's/.*github\..*\/\(.*\)\/\(.*\)$/\2/')"
rev="${rev:-$(echo "$output" | grep "\"rev\": " | sed 's/.*: "\(.*\)".*$/\1/')}"
sha="$(echo "$output" | grep "\"sha256\": " | sed 's/.*: "\(.*\)".*$/\1/')"
echo "pkgs.fetchFromGitHub {"
echo " owner = \"$owner\";"
echo " repo = \"$repo\";"
echo " rev = \"$rev\";"
echo " sha256 = \"$sha\";"
echo "};"