-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path.aliases
68 lines (58 loc) · 2.39 KB
/
.aliases
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
# Set the alias to nvim *only* if we can find nvim on the path.
# If this is not behaving as expected, try closing and reopening your terminal.
if command -v nvim > /dev/null; then
alias vim=nvim
fi
# Some notes on `ls` on Mac...
#
# Vanilla MacOS, based on BSD, has a different `ls`. It uses -G instead
# of --color. The colors are also handled differently (dircolors is not
# available by default; uses different env vars for controlling colors).
#
# Previously depended on a conda environment with GNU coreutils
# installed so that we get the exact same colors as on Linux. That proved
# finicky. See [0] for some details. so this always uses the system `ls` on Mac, setting the colors to be
# close enough.
#
# The solution here is:
# - check $LS_COLORS (note underscore) in an environment with dircolors and GNU ls
# - paste the value of $LS_COLORS into [2]
# - copy the reported $LSCOLORS (no underscore) value. That will be used by BSD ls.
# - export LSCOLORS on Mac.
#
# [0] https://github.com/daler/dotfiles/pull/35
# [1] https://superuser.com/a/1746907
# [2] https://geoff.greer.fm/lscolors
#
if [[ $OSTYPE == darwin* ]]; then
export LSCOLORS=ExGxBxDxCxEgEdxbxgxcxd
alias ls='/bin/ls -G'
else
if command -v dircolors > /dev/null; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
fi
alias ls="ls --color=auto"
fi
alias ll='ls -lrth'
alias la='ls -lrthA'
alias l='ls -CF'
alias tmux="tmux -u"
alias grep='grep --color=auto'
# Sometimes when you try to open an X window, especially running tmux, you can
# get an error about the display variable not being set. This alias fixes that.
alias D="export DISPLAY=:0"
# View syntax-highlighted files in the current directory, live-filtered by fzf.
alias v='fzf --preview "bat --color \"always\" --theme GitHub {}"'
# Save three keystrokes to go up a directory
alias ..="cd .."
# Run git-fugitive.
# Great for incrementally making git commits in the current directory. I don't
# remember the original mnemonic for "gsv", but it's muscle memory for me
# now...but the more logical "fugitive" does the same thing.
alias gsv="vim -c ':Git' -c ':bunload 1'"
alias fugitive="vim -c ':Git' -c ':bunload 1'"
# Run diffview.nvim to see the log. Mnemonic is "git log, visual"
alias glv="vim -c ':DiffviewFileHistory'"
# Start the SSH agent, prompting for your passphrase.
alias s="start_agent"