#!/bin/bash # nnn # for nnn file manager n () { # Block nesting of nnn in subshells if [ -n $NNNLVL ] && [ "${NNNLVL:-0}" -ge 1 ]; then echo "nnn is already running" return fi # The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set) # To cd on quit only on ^G, remove the "export" as in: # NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd" # NOTE: NNN_TMPFILE is fixed, should not be modified export NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd" # Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn # stty start undef # stty stop undef # stty lwrap undef # stty lnext undef nnn -A -x "$@" if [ -f "$NNN_TMPFILE" ]; then . "$NNN_TMPFILE" rm -f "$NNN_TMPFILE" > /dev/null fi } # cd into config dir cfdir() { cd $HOME/.config/$1 } # sshfs into newnumyspace nnms_fs() { dir_name="newnumyspace" path="${HOME}/dev" if [ ! -d $path/$dir_name ] then mkdir $path/$dir_name echo "Created new directory $dir_name at $path" fi sshfs unn_w19014537@newnumyspace.co.uk:/home/unn_w19014537/ $path/$dir_name/ if [ $? -eq 0 ] then echo "Mounted at $path/$dir_name." fi } # pacman list sizes pacsizes() { pacman -Qi $1 | awk '/^Name/{name=$3} /^Installed Size/{size=$4$5; print size, name;}' | sort -h } # unreal compile # Courtesy of mrzapp from https://forums.unrealengine.com/development-discussion/c-gameplay-programming/97022-linux-how-to-compile-c-scripts-from-terminal function unrealbuild { UNR_PATH=/opt/UnrealEngine; RANDNUM=$(( ( RANDOM % 1000 ) + 1000 )); CURR_DIR=`pwd`; PROJ_NAME=$(basename ${1%.uproject}); echo $RANDNUM ${UNR_PATH}/Engine/Build/BatchFiles/Linux/RunMono.sh ${UNR_PATH}/Engine/Binaries/DotNET/UnrealBuildTool.exe $PROJ_NAME -ModuleWithSuffix $PROJ_NAME Linux Development -editorrecompile -canskiplink "${CURR_DIR}/${PROJ_NAME}.uproject" -progress } # view markdown files in zathura viewmd() { [ -z $1 ] && return [ ! -f $1 ] && return pandoc -t pdf $1 | zathura - }