aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Nazaryev <sergey@nazaryev.ru>2017-11-21 02:55:50 +0300
committerSergey Nazaryev <sergey@nazaryev.ru>2017-11-21 02:56:00 +0300
commit4743786e18afa4664d6676b20ab45f472d8b72ec (patch)
treec93172265d9b2397cb7715ed4530eeb9adb133bf
parent6c8bfcf1c47c1600f780f25e118da77fe3939bf2 (diff)
downloaddotfiles-4743786e18afa4664d6676b20ab45f472d8b72ec.zip
dotfiles-4743786e18afa4664d6676b20ab45f472d8b72ec.tar.gz
dotfiles-4743786e18afa4664d6676b20ab45f472d8b72ec.tar.bz2
open + path + mc -b
-rw-r--r--bash_aliases1
-rw-r--r--bash_open22
-rw-r--r--bash_path3
-rwxr-xr-xinstall.sh8
4 files changed, 34 insertions, 0 deletions
diff --git a/bash_aliases b/bash_aliases
index 3d7a4d0..454067e 100644
--- a/bash_aliases
+++ b/bash_aliases
@@ -1,5 +1,6 @@
#!/bin/bash
+alias mc='mc -b'
alias ls='LC_COLLATE=C ls -F -h -w 80 --color --group-directories-first'
alias grep="ag"
alias search="find . -name"
diff --git a/bash_open b/bash_open
new file mode 100644
index 0000000..a5d96d4
--- /dev/null
+++ b/bash_open
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+open() {
+ file="$1"
+
+ IFS='/' read -r major minor < <(file -ib "$file" 2>/dev/null | cut -d ';' -f 1)
+
+ case "$major/$minor" in
+ text/html)
+ firefox "$file";;
+ application/pdf)
+ zathura "$file";;
+ image/*)
+ feh "$file";;
+ text/*)
+ xterm -e vim "$file";;
+ video/*)
+ mplayer "$file";;
+ *)
+ /usr/bin/xdg-open "$file";;
+ esac
+}
diff --git a/bash_path b/bash_path
new file mode 100644
index 0000000..ed363b1
--- /dev/null
+++ b/bash_path
@@ -0,0 +1,3 @@
+path() {
+ readlink -f "$1" | tee /dev/stderr | tr -d '\n' | xsel
+}
diff --git a/install.sh b/install.sh
index 88003d9..e868a39 100755
--- a/install.sh
+++ b/install.sh
@@ -213,6 +213,14 @@ install_dotfile "bash dircolors" \
"$HOME/.bashrc.d/02-bash_dircolors"
install_dotfile "bash" \
+ "$dotfilesdir/bash_open" \
+ "$HOME/.bashrc.d/04-bash_open"
+
+install_dotfile "bash" \
+ "$dotfilesdir/bash_path" \
+ "$HOME/.bashrc.d/04-bash_path"
+
+install_dotfile "bash" \
"$dotfilesdir/inputrc" \
"$HOME/.inputrc"