From 7e851a0f9a2c609b61463d2723d770e7d45d329a Mon Sep 17 00:00:00 2001 From: siriusfox Date: Sat, 2 Aug 2025 16:01:34 -0700 Subject: [PATCH] Update windows.bashrc --- 2023-03-00_windows.bashrc | 18 -------- windows.bashrc | 86 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 18 deletions(-) delete mode 100644 2023-03-00_windows.bashrc create mode 100644 windows.bashrc diff --git a/2023-03-00_windows.bashrc b/2023-03-00_windows.bashrc deleted file mode 100644 index 06fc0d4..0000000 --- a/2023-03-00_windows.bashrc +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# When notepad++ is available, use it -function npp() { - export IFS=$'\n' - NOTEPADPP_EXE='/c/Program Files/Notepad++/notepad++.exe' - if [[ -e "${NOTEPADPP_EXE}" ]]; then - echo 'notepad++.exe '$*' &' - "${NOTEPADPP_EXE}" $* & - return 0 - else - echo "notepad++ not found." - return 1 - fi -} - - -alias _wrapping_fix='kill -WINCH $$' diff --git a/windows.bashrc b/windows.bashrc new file mode 100644 index 0000000..664c7cb --- /dev/null +++ b/windows.bashrc @@ -0,0 +1,86 @@ +#!/bin/bash + +# Change to VI or something else if you want a different default CLI editor. +export EDITOR=nano + +# Ignore Window's specific invisible files in `ls` +alias ls='ls --color=auto --ignore="NTUSER.DAT*"' +# Use a window's kill command to attack some hokey windows foolishness that +# results in pasted text wrapping in the wrong column for a given bash window +# size. Run once per login session if the problem occors. +alias _wrapping_fix='kill -WINCH $$' +# Grep colors are your friend. +alias grep='grep --color=auto' +# diff without windows newlines +alias diff='diff --strip-trailing-cr --color=auto' + +# Define the TERM variable as some processes want to know +if [[ -z "${TERM}" ]]; then + export TERM=cygwin +fi + +# less and more are two utilities for reading text files at the command line. +# git bash includes the more modern `less` but not `more.` If we detect that +# `more` isn't available, set the less alias flags to replicate the behavior +# transparently +if [[ ! $(which more 2>/dev/null) ]]; then + alias more="$(which less) -XSE" +fi + +export HISTIGNORE='pwd:exit:fg:bg:top:clear:history:ls:uptime:df' +export LESS='-rFX' + +alias randbin='dd if=/dev/random bs=1 count=32 | base64' + +# Use a GUI diff-tool when installed +if [[ -e '/c/Program Files (x86)/Meld/Meld.exe' ]]; then + alias meld='/c/Program\ Files\ \(x86\)/Meld/Meld.exe' +elif [[ -e '/cygdrive/c/Program Files (x86)/Meld/Meld.exe' ]]; then + alias meld='/cygdrive/c/Program\ Files\ \(x86\)/Meld/Meld.exe' +fi + +# When notepad++ is available, use it +function npp() { + export IFS=$'\n' + NOTEPADPP_EXE='/c/Program Files/Notepad++/notepad++.exe' + if [[ -e "${NOTEPADPP_EXE}" ]]; then + echo 'notepad++.exe '$*' &' + "${NOTEPADPP_EXE}" $* & + return 0 + else + echo "notepad++ not found." + return 1 + fi +} +alias kate=npp + +# a find alias that will ignore .git directories, but not git repo contents +function ngfind() { + export IFS=$'\n' + POSITIONAL_ARGS=() + while [[ $# -gt 0 && "${1:0:1}" != "-" ]]; do + POSITIONAL_ARGS+=("$1") + shift; + done + find ${POSITIONAL_ARGS[*]} -not -wholename '*/.git/*' $* +} + +# Curl, but use netrc and automatically name files. +function nget() { + export IFS=$'\n' + URL="$1" + FN="${1##*/}" + if [[ ${#FN} -lt 1 ]]; then + echo "ERROR, zero length file name!" + else + curl -n --output "$FN" "$URL" + fi +} + +function -bashrc-reload() { source ~/.bashrc } +alias __bashrc_reload='source ~/.bashrc' + +# avoid some windows pain +if ! command -v python3 &>/dev/null ; then + alias python3=python +fi