Configure elnudrop
This commit is contained in:
parent
5b8dbadbb1
commit
efa926d33f
11 changed files with 281 additions and 166 deletions
52
modules/bash/bashrc.nix
Normal file
52
modules/bash/bashrc.nix
Normal file
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
bashrcExtra = ''
|
||||
function v {
|
||||
if [[ $# -eq 0 ]]; then
|
||||
nvim ~/UNTITLED.md
|
||||
else
|
||||
nvim $1
|
||||
fi
|
||||
}
|
||||
|
||||
# Modify killall for wrapped applications, e.g. firefox
|
||||
# killall firefox -> killall firefox || killall .firefox-wrapped
|
||||
function killall {
|
||||
`which killall` $1 || `which killall` .''${1}-wrapped
|
||||
}
|
||||
|
||||
# pandoc macro
|
||||
# pandoc document.md -> pandoc document.md -o document.pdf ...
|
||||
function pdf {
|
||||
pandoc $1 -o ''${1%.*}.pdf --pdf-engine=xelatex -V mainfont="mplus-1c-medium" -V colorlinks=true -V linkcolor=blue
|
||||
}
|
||||
|
||||
# Change to directory when exiting ranger with Q
|
||||
# https://github.com/ranger/ranger/issues/1554#issuecomment-491650123
|
||||
function ranger {
|
||||
local IFS=$'\t\n'
|
||||
local tempfile="$(mktemp -t tmp.XXXXXX)"
|
||||
local ranger_cmd=(
|
||||
command
|
||||
ranger
|
||||
--cmd="map Q chain shell echo %d > "$tempfile"; quitall"
|
||||
)
|
||||
|
||||
''${ranger_cmd[@]} "$@"
|
||||
if [[ -f "$tempfile" ]] && [[ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]]; then
|
||||
cd -- "$(cat "$tempfile")" || return
|
||||
fi
|
||||
command rm -f -- "$tempfile" 2>/dev/null
|
||||
}
|
||||
'';
|
||||
greeter = ''
|
||||
pfetch
|
||||
while true; do
|
||||
f=`fortune`
|
||||
if [ ''${#f} -lt 128 ]; then
|
||||
echo "''${f}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
TERMINAL_STARTED=1
|
||||
'';
|
||||
}
|
34
modules/bash/default.nix
Normal file
34
modules/bash/default.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
home.packages = with pkgs; [ pfetch fortune ];
|
||||
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
shellAliases = {
|
||||
g = "git";
|
||||
ga = "g add";
|
||||
gc = "g commit -m ";
|
||||
gu = "ga . && gc";
|
||||
gs = "g status";
|
||||
gi = "g init";
|
||||
gp = "g push";
|
||||
gf = "g pull";
|
||||
gC = "g clone";
|
||||
goops = "g reset --soft HEAD^";
|
||||
|
||||
r = "ranger";
|
||||
rm = "trash-put";
|
||||
emacs = "emacsclient -nw";
|
||||
# Make clear command clear scrollback
|
||||
# https://github.com/kovidgoyal/kitty/issues/268#issuecomment-355765686
|
||||
clear = "printf '\\E[H\\E[3J'";
|
||||
};
|
||||
bashrcExtra = with import ./bashrc.nix; ''
|
||||
${bashrcExtra}
|
||||
if [ -z $TERMINAL_STARTED ] && [ -z $IN_NIX_SHELL ]; then
|
||||
${greeter}
|
||||
fi
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue