This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# All my gist code is licensed under the terms of the MIT license. | |
# Video demo: https://www.youtube.com/watch?v=KFtZbsSG_fA | |
# add this to your ~/.bashrc or something like that | |
# alias for every locate database | |
alias locate="glocate --regextype=posix-extended --database=${HOME}/tmp/locatedb-min" | |
alias locatehome="glocate --regextype=posix-extended --database=${HOME}/tmp/locatedb-home" | |
alias locateall="glocate --regextype=posix-extended --database=${HOME}/tmp/locatedb" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# All my gist code is licensed under the terms of the MIT license. | |
# poor-man's ripgrep | |
# - like grep, but ignore hidden files and folders (prefixed with a dot) and | |
# node_modules. | |
# - because grep's --exclude-dir only matches top-level directories, we need to | |
# use find | |
# - last argument is starting point. It must be provided, otherwise it's tricky | |
# to distinguish it from the pattern | |
# - any previous arguments are passed to grep before the matching files, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# All my gist code is licensed under the terms of the MIT license. | |
# Video demo: https://www.youtube.com/shorts/0zx4uSBUt_k | |
# Add this somewhere in your ~/.bashrc | |
# Use bash-preexec.sh (https://github.com/rcaloras/bash-preexec) to: | |
# - disable the Ctrl-Z keybinding before printing the prompt | |
# - enable the Ctrl-Z keybinding before executing a command | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# All my gist code is licensed under the terms of the MIT license. | |
# Video demo: https://www.youtube.com/shorts/9sKEQ-DFL8I | |
# commands | |
# - list all commands in your PATH, and their directories | |
function commands () { | |
local green='\x1b[32m' | |
local reset='\x1b[0m' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# All my gist code is licensed under the terms of the MIT license. | |
# Video demo: https://www.youtube.com/shorts/7IEfnUqjaSk | |
# add the contents of this file to ~/.inputrc | |
# this is where the magic happens | |
set editing-mode vi | |
# vi INSERT prompt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# All my gist code is licensed under the terms of the MIT license. | |
# Video demo: https://www.youtube.com/watch?v=Yat95AAV5k4 | |
# from https://unix.stackexchange.com/a/217390/569343 | |
# write provided text to the terminal input | |
# (does not work in subshells) | |
# - There are some weird errors when I remove the 2>/dev/nulls, but I don't | |
# even know how to begin to fix them. | |
function write_to_input () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# All my gist code is licensed under the terms of the MIT license. | |
# Video demo: https://www.youtube.com/shorts/cZIxuQuY7RE | |
# custom kill -l | |
# - column format and color the texts after SIG | |
# - add some descriptions | |
function kill () { | |
local green='\x1b[32m' | |
local bold='\x1b[1m' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# All my gist code is licensed under the terms of the MIT license. | |
# Video demo: https://www.youtube.com/shorts/ojhaUNYetsU | |
shopt -s autocd | |
# silence_autocd | |
# - Hack to stop autocd from printing the directory after autocd'ing. | |
# - Unfortunately there is no clean way to do this except messing with | |
# BASH_XTRACEFD, a poorly understood file descriptor that we are better not |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# All my gist code is licensed under the terms of the MIT license. | |
# Video demo: https://www.youtube.com/shorts/q26DJ5qOXxM | |
# custom declare -F | |
# - add filename and table output to "declare -F" | |
# - this is based on the "declare -F name" output when shopt extdebug is on | |
function declare () { | |
if [[ $# == 1 && "$1" == "-F" ]]; then | |
shopt -s extdebug |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# All my gist code is licensed under the terms of the MIT license. | |
# Video demo: https://www.youtube.com/shorts/9dU44VdoGIo | |
# custom bind | |
# - color and table formatting for "-V" and "-P" | |
# - if using vi mode, print both "normal" and "insert" keybindings | |
# - print keybindings for all keymaps if "-a" is present | |
function bind () { | |
if [[ "$#" == 1 && "$1" == "-V" ]]; then |