Skip to content

Commit

Permalink
gitignore twiddle and comments on all_binaries_in_path
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Nov 14, 2024
1 parent cba60c5 commit 07230fa
Show file tree
Hide file tree
Showing 6 changed files with 421 additions and 219 deletions.
7 changes: 4 additions & 3 deletions .gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
diffcommitsfrommain = !"git log --no-merges origin/$(git mainormaster).."
# ^^ also, 2 vs 3 dots: so important. https://stackoverflow.com/a/48681527

# I prefer these from my fish abbv's, but for bash we'll keep this as a fallback.
db = diffbranch
dbt = diffbranch-that

# Squash a branch to one commit against a branch with many non-main commits.
# This can't be an alias, but here's the hack.
# # be on the new feature branch, be okay with rewriting it's history.
Expand Down Expand Up @@ -159,9 +163,6 @@
[include]
path = ~/.gitconfig.local

#[init]
# templatedir = ~/.git_template

[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
Expand Down
14 changes: 13 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
# the symlink for this broke so.. whatever
# This is intended as GLOBAL ~/.gitignore, not just this dotfiles repo. (But.. it's both.)

# I like having a personal readme file to keep notes.
PAUL.readme.md

# git credential file
.gitconfig.local

# Nice and clean by default, but this does create a problem if I don't add into new repos gitignore and other folks dont have the same default. problems when other folks don't have the same in their global gitignore.
node_modules

# why u be like that
.DS_Store
45 changes: 45 additions & 0 deletions docs/bash history.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
* `sh` has terrible history mgmt, just dont even try.
* `fish` is aiight but needs some love
* `bash` is better with a lot of config (like the below) -- Even then it still isn't good enough:
- up-arrow through history goes through all sessions, and not just the current one.

```sh
# Enable history expansion with space
# E.g. typing !!<space> will replace the !! with your last command
bind Space:magic-space

# Use standard ISO 8601 timestamp
# %F equivalent to %Y-%m-%d
# %T equivalent to %H:%M:%S (24-hours format)
export HISTTIMEFORMAT='%F %T '

# keep history up to date, across sessions, in realtime
# http://unix.stackexchange.com/a/48113
export HISTCONTROL="ignoredups" # no duplicate entries, but keep space-prefixed commands. (bash-sensible uses "erasedups:ignoreboth" but i think i validated this already?)
# here's the popularity amonngst other-peoples-dotfiles... (cmd: ag --nogroup --noheading --nofilename --hidden -o "HISTCONTROL.*" | grep -E -o "(ignore|erase)[a-z:]*" | sort | uniq -c | sort -r)
# 5 ignoreboth
# 4 ignoredups
# 2 erasedups:ignoreboth
# 1 ignorespace:erasedups
# 1 ignoredups:erasedups
# 1 erasedups

export HISTSIZE=100000 # big big history (default is 500)
export HISTFILESIZE=$HISTSIZE # big big history
shopt -s histappend # append to history, don't overwrite it
shopt -s cmdhist # Save multi-line commands as one command


# Enable incremental history search with up/down arrows (also Readline goodness)
# Learn more about this here: http://codeinthehole.com/writing/the-most-important-command-line-tip-incremental-history-searching-with-inputrc/
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'

# Don't record some commands
export HISTIGNORE="&:[ ]*:exit:ls:bg:fg:history:clear"

# Save and reload the history after each command finishes. Also look for any conflicting prompt_command definitions!!
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"

# ^ the only downside with this is [up] on the readline will go over all history not just this bash session.
```
4 changes: 2 additions & 2 deletions fish/functions.fish
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ function beep --description "make two beeps"
echo -e '\a'; sleep 0.1; echo -e '\a';
end

function all_binaries_in_path --description "list all binaries available in \$PATH, even if theres conflicts"
function all_binaries_in_path --description \
"list all binaries available in \$PATH (incl conflicts). pipe it to grep. top-most are what's used, in case of conflicts"
# based on https://unix.stackexchange.com/a/120790/110766 but tweaked to work on mac. and then made it faster.
find -L $PATH -maxdepth 1 -perm +111 -type f 2>/dev/null
#gfind -L $PATH -maxdepth 1 -executable -type f # shrug. probably can delete this.
end

function my_paths --description "list paths, in order"
Expand Down
Loading

0 comments on commit 07230fa

Please sign in to comment.