Skip to content

Commit c2f5e1d

Browse files
committed
filetype colors and suffixes for ls
1 parent 2cfe25f commit c2f5e1d

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

bashrc

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@
2121
# Provides prompt for non-login shells, specifically shells started
2222
# in the X environment.
2323

24-
# Aliases for colored ls
25-
alias l='ls -alh'
26-
alias ll='ls -lh'
27-
alias la='ls -a'
24+
# Colors
25+
alias l='ls -AFlh'
26+
alias ll='ls -Flh'
27+
alias la='ls -AF'
2828
for c in {e,f,}grep {v,}dir ls; do alias $c="$c --color=auto"; done;
2929

30-
# Colors for PS1
3130
NORMAL='\e[0m'
3231
RED='\e[1;31m'
3332
GREEN='\e[1;32m'
@@ -81,9 +80,18 @@ alias ....='cd ../../..'
8180
alias nano='nano -w'
8281

8382
# Last directory recoding measure.
84-
_last_dir() { cd $(cat ~/.last_directory); }
83+
_lastdir_go() {
84+
if [ -s ~/.last_directory ]; then
85+
if [ -d $(cat ~/.last_directory) ]; then
86+
echo -e "$YELLOW>>>\t${CYAN}Returning you to the last directory...$NORMAL \`$(cat ~/.last_directory)'"
87+
cd $(cat ~/.last_directory)
88+
else
89+
echo -e "$YELLOW>>>\t${CYAN}Last recorded directory cannot be accessed or was already removed.$NORMAL"
90+
fi
91+
fi
92+
}
8593

86-
_record() {
94+
_lastdir_rec() {
8795
local _ret=$? # Return value transparency is actually important here
8896
echo -ne "$YELLOW>>>\t\033[36mRecording your current working directory...\033[0m"
8997
pwd > ~/.last_directory

profile.d/dircolors

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ if [ -f "/etc/dircolors" ] ; then
44
if [ -f "$HOME/.dircolors" ] ; then
55
eval $(dircolors -b $HOME/.dircolors)
66
fi
7+
else eval $(dircolors -b)
78
fi

skel/.bash_logout

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
# by James Robertson <[email protected]>
44

55
# Personal items to perform on logout.
6-
_record
6+
_lastdir_rec
77
# End ~/.bash_logout

skel/.bashrc

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ if [ -f "/etc/bashrc" ] ; then
1313
source /etc/bashrc
1414
fi
1515

16-
if [[ "$LASTDIR" == yes && -s ~/.last_directory ]]; then
17-
if [ -d $(cat ~/.last_directory) ]; then
18-
echo -e "$YELLOW>>>\t\033[36mReturning you to the last directory...\033[0m \`$(cat ~/.last_directory)'"
19-
_last_dir
20-
else
21-
echo -e "$YELLOW>>>\t\033[36mLast recorded directory cannot be accessed or was already removed.\033[0m"
22-
fi
23-
fi
24-
16+
# Restores last directory state.
17+
_lastdir_go
2518
# End ~/.bashrc

0 commit comments

Comments
 (0)