Correct zsh
parent
68f8a5fbe9
commit
91369ffe66
|
@ -14,7 +14,6 @@
|
|||
fuzzel.enable = true;
|
||||
gtk.enable = true;
|
||||
direnv.enable = true;
|
||||
pwnixos-packages.enable = true;
|
||||
nvim.enable = false;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
./fuzzel
|
||||
./gtk
|
||||
./direnv
|
||||
./pwnixos-packages
|
||||
./nvim
|
||||
];
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ in {
|
|||
brave
|
||||
discord
|
||||
firefox
|
||||
nixfmt
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
|
||||
with lib;
|
||||
let cfg = config.modules.pwnixos-packages;
|
||||
|
||||
in {
|
||||
options.modules.pwnixos-packages = { enable = mkEnableOption "pwnixos-packages"; };
|
||||
config = mkIf cfg.enable {
|
||||
#home.packages = with pkgs.nur.repos.exploitoverload; [
|
||||
# ADCSKiller
|
||||
# polenum
|
||||
#];
|
||||
};
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -9,66 +9,109 @@ in {
|
|||
home.packages = with pkgs; [
|
||||
zsh
|
||||
fzf
|
||||
lsd
|
||||
grc
|
||||
eza
|
||||
];
|
||||
|
||||
programs.zsh = {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
shellAliases = {
|
||||
md-notes = "cd ~/Documents/md-notes/ && nvim .";
|
||||
randwall = "feh --bg-scale --randomize ~/pictures/wallpapers/*";
|
||||
zapiski = "~/Documents/faks_git/FRI-ZAPISKI";
|
||||
ctf = "cd ~/Documents/ctf/2022";
|
||||
faks = "cd ~/Documents/faks";
|
||||
faks-git = "cd ~/Documents/faks_git";
|
||||
rm = "rm -i";
|
||||
night = "brightnessctl s 1%";
|
||||
nightlock = "swaylock -c 000000";
|
||||
hsrv = "ssh hsrv";
|
||||
rs = "export QT_QPA_PLATFORM=xcb; rstudio-bin --no-sandbox &";
|
||||
rot13 = "tr 'A-Za-z' 'N-ZA-Mn-za-m'";
|
||||
nix-update = "nix-channel --update && nix-env -u";
|
||||
ls = "lsd";
|
||||
sus = "systemctl suspend";
|
||||
sur = "systemctl reboot";
|
||||
sup = "power off";
|
||||
hg = "history | grep";
|
||||
ss = "grc ss";
|
||||
tree = "eza --tree";
|
||||
rebuild-os =
|
||||
"sudo nixos-rebuild switch --flake ${config.home.homeDirectory}/.config/home-manager#yoga --impure";
|
||||
};
|
||||
initExtra = ''
|
||||
export EDITOR='nvim'
|
||||
|
||||
bin_txt() {
|
||||
curl -X PUT --data "$1" https://p.spanskiduh.dev
|
||||
}
|
||||
|
||||
bin_file() {
|
||||
curl -X PUT --data-binary "@$1" https://p.spanskiduh.dev
|
||||
}
|
||||
|
||||
cleanup-os() {
|
||||
sudo nix-env --list-generations --profile /nix/var/nix/profiles/system
|
||||
sudo nix-env --delete-generations old --profile /nix/var/nix/profiles/system
|
||||
sudo nix-collect-garbage -d
|
||||
sudo nix-store --optimize
|
||||
sudo nix-env --list-generations --profile /nix/var/nix/profiles/system
|
||||
|
||||
}
|
||||
|
||||
# Gpg tty
|
||||
GPG_TTY=$(tty)
|
||||
export GPG_TTY
|
||||
export FUNCNEST=500
|
||||
|
||||
'';
|
||||
oh-my-zsh = {
|
||||
enable = true;
|
||||
|
||||
dotDir = ".config/zsh";
|
||||
|
||||
enableCompletion = true;
|
||||
enableAutosuggestions = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
|
||||
initExtra = ''
|
||||
bindkey "^[[1;3C" forward-word # Key Alt + Right
|
||||
bindkey "^[[1;3D" backward-word # Key Alt + Left
|
||||
'';
|
||||
|
||||
shellAliases = {
|
||||
cat = "bat";
|
||||
vi = "nvim";
|
||||
vim = "nvim";
|
||||
ls = "eza --icons";
|
||||
tree = "eza --tree --icons";
|
||||
kali = "distrobox enter --root kali-rolling";
|
||||
kali-create = "distrobox create --root kalilinux/kali-rolling";
|
||||
arch = "distrobox enter --root archlinux";
|
||||
arch-create = "distrobox create --root archlinux";
|
||||
};
|
||||
|
||||
plugins = with pkgs; [
|
||||
{
|
||||
name = "powerlevel10k";
|
||||
src = "${zsh-powerlevel10k}/share/zsh-powerlevel10k";
|
||||
file = "powerlevel10k.zsh-theme";
|
||||
}
|
||||
{
|
||||
name = "powerlevel10k-config";
|
||||
src = ./.;
|
||||
file = ".p10k.zsh";
|
||||
}
|
||||
{
|
||||
name = "fzf-zsh";
|
||||
src = "${fzf-zsh}/share/zsh/plugins/fzf-zsh";
|
||||
file = "fzf-zsh.plugin.zsh";
|
||||
}
|
||||
{
|
||||
name = "sudo-zsh";
|
||||
src = ./.;
|
||||
file = "sudo.plugin.zsh";
|
||||
}
|
||||
{
|
||||
name = "zsh-nix-shell";
|
||||
file = "nix-shell.plugin.zsh";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "chisui";
|
||||
repo = "zsh-nix-shell";
|
||||
rev = "v0.8.0";
|
||||
sha256 = "1lzrn0n4fxfcgg65v0qhnj7wnybybqzs4adz7xsrkgmcsr0ii8b7";
|
||||
};
|
||||
}
|
||||
theme = "cypher";
|
||||
plugins = [
|
||||
"sudo"
|
||||
"terraform"
|
||||
"systemadmin"
|
||||
"vi-mode"
|
||||
"z"
|
||||
"colorize"
|
||||
"compleat"
|
||||
"ansible"
|
||||
];
|
||||
};
|
||||
|
||||
plugins = [
|
||||
{
|
||||
name = "zsh-autosuggestions";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "zsh-users";
|
||||
repo = "zsh-autosuggestions";
|
||||
rev = "v0.4.0";
|
||||
sha256 = "0z6i9wjjklb4lvr7zjhbphibsyx51psv50gm07mbb0kj9058j6kc";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "fzf-tab";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "Aloxaf";
|
||||
repo = "fzf-tab";
|
||||
rev = "b06e7574577cd729c629419a62029d31d0565a7a";
|
||||
sha256 = "sha256-ilUavAIWmLiMh2PumtErMCpOcR71ZMlQkKhVOTDdHZw=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "warhol";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "unixorn";
|
||||
repo = "warhol.plugin.zsh";
|
||||
rev = "49a2fb6789179c789f54b95221c91fdc1bd5f804";
|
||||
sha256 = "sha256-cL7qfgoJseS/epWPyzUy0Ul4GMtyPzYkZ5tsHbRjcRI=";
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,108 +0,0 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# sudo or sudo -e (replacement for sudoedit) will be inserted before the command
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Dongweiming <ciici123@gmail.com>
|
||||
# * Subhaditya Nath <github.com/subnut>
|
||||
# * Marc Cornellà <github.com/mcornella>
|
||||
# * Carlo Sala <carlosalag@protonmail.com>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
__sudo-replace-buffer() {
|
||||
local old=$1 new=$2 space=${2:+ }
|
||||
|
||||
# if the cursor is positioned in the $old part of the text, make
|
||||
# the substitution and leave the cursor after the $new text
|
||||
if [[ $CURSOR -le ${#old} ]]; then
|
||||
BUFFER="${new}${space}${BUFFER#$old }"
|
||||
CURSOR=${#new}
|
||||
# otherwise just replace $old with $new in the text before the cursor
|
||||
else
|
||||
LBUFFER="${new}${space}${LBUFFER#$old }"
|
||||
fi
|
||||
}
|
||||
|
||||
sudo-command-line() {
|
||||
# If line is empty, get the last run command from history
|
||||
[[ -z $BUFFER ]] && LBUFFER="$(fc -ln -1)"
|
||||
|
||||
# Save beginning space
|
||||
local WHITESPACE=""
|
||||
if [[ ${LBUFFER:0:1} = " " ]]; then
|
||||
WHITESPACE=" "
|
||||
LBUFFER="${LBUFFER:1}"
|
||||
fi
|
||||
|
||||
{
|
||||
# If $SUDO_EDITOR or $VISUAL are defined, then use that as $EDITOR
|
||||
# Else use the default $EDITOR
|
||||
local EDITOR=${SUDO_EDITOR:-${VISUAL:-$EDITOR}}
|
||||
|
||||
# If $EDITOR is not set, just toggle the sudo prefix on and off
|
||||
if [[ -z "$EDITOR" ]]; then
|
||||
case "$BUFFER" in
|
||||
sudo\ -e\ *) __sudo-replace-buffer "sudo -e" "" ;;
|
||||
sudo\ *) __sudo-replace-buffer "sudo" "" ;;
|
||||
*) LBUFFER="sudo $LBUFFER" ;;
|
||||
esac
|
||||
return
|
||||
fi
|
||||
|
||||
# Check if the typed command is really an alias to $EDITOR
|
||||
|
||||
# Get the first part of the typed command
|
||||
local cmd="${${(Az)BUFFER}[1]}"
|
||||
# Get the first part of the alias of the same name as $cmd, or $cmd if no alias matches
|
||||
local realcmd="${${(Az)aliases[$cmd]}[1]:-$cmd}"
|
||||
# Get the first part of the $EDITOR command ($EDITOR may have arguments after it)
|
||||
local editorcmd="${${(Az)EDITOR}[1]}"
|
||||
|
||||
# Note: ${var:c} makes a $PATH search and expands $var to the full path
|
||||
# The if condition is met when:
|
||||
# - $realcmd is '$EDITOR'
|
||||
# - $realcmd is "cmd" and $EDITOR is "cmd"
|
||||
# - $realcmd is "cmd" and $EDITOR is "cmd --with --arguments"
|
||||
# - $realcmd is "/path/to/cmd" and $EDITOR is "cmd"
|
||||
# - $realcmd is "/path/to/cmd" and $EDITOR is "/path/to/cmd"
|
||||
# or
|
||||
# - $realcmd is "cmd" and $EDITOR is "cmd"
|
||||
# - $realcmd is "cmd" and $EDITOR is "/path/to/cmd"
|
||||
# or
|
||||
# - $realcmd is "cmd" and $EDITOR is /alternative/path/to/cmd that appears in $PATH
|
||||
if [[ "$realcmd" = (\$EDITOR|$editorcmd|${editorcmd:c}) \
|
||||
|| "${realcmd:c}" = ($editorcmd|${editorcmd:c}) ]] \
|
||||
|| builtin which -a "$realcmd" | command grep -Fx -q "$editorcmd"; then
|
||||
__sudo-replace-buffer "$cmd" "sudo -e"
|
||||
return
|
||||
fi
|
||||
|
||||
# Check for editor commands in the typed command and replace accordingly
|
||||
case "$BUFFER" in
|
||||
$editorcmd\ *) __sudo-replace-buffer "$editorcmd" "sudo -e" ;;
|
||||
\$EDITOR\ *) __sudo-replace-buffer '$EDITOR' "sudo -e" ;;
|
||||
sudo\ -e\ *) __sudo-replace-buffer "sudo -e" "$EDITOR" ;;
|
||||
sudo\ *) __sudo-replace-buffer "sudo" "" ;;
|
||||
*) LBUFFER="sudo $LBUFFER" ;;
|
||||
esac
|
||||
} always {
|
||||
# Preserve beginning space
|
||||
LBUFFER="${WHITESPACE}${LBUFFER}"
|
||||
|
||||
# Redisplay edit buffer (compatibility with zsh-syntax-highlighting)
|
||||
zle && zle redisplay # only run redisplay if zle is enabled
|
||||
}
|
||||
}
|
||||
|
||||
zle -N sudo-command-line
|
||||
|
||||
# Defined shortcut keys: [Esc] [Esc]
|
||||
bindkey -M emacs '\e\e' sudo-command-line
|
||||
bindkey -M vicmd '\e\e' sudo-command-line
|
||||
bindkey -M viins '\e\e' sudo-command-line
|
Loading…
Reference in New Issue