~andrewzah/dotfiles

ref: osx dotfiles/zsh/functions.zsh -rw-r--r-- 1.0 KiB
8b6e98a5Andrew Zah update 1 year, 8 months ago
                                                                                
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
function mkd() {
	mkdir -p "$@";
}

# mkdir -p && cd shorthand
function mkdc() {
	mkdir -p "$@" && cd "$_";
}
# `o` with no arguments opens the current directory, otherwise opens the given
# location
function o() {
	if [ $# -eq 0 ]; then
		open .;
	else
		open "$@";
	fi;
}

# `v` with no arguments opens the current directory in Vim, otherwise opens the
# given location
function v() {
	if [ $# -eq 0 ]; then
		nvim .;
	else
		nvim "$@";
	fi;
}

function m() {
	if [ $# -eq 0 ]; then
		make;
	else
		make "$@";
	fi;
}

function t() {
	if [ $# -eq 0 ]; then
		task;
	else
		task "$@";
	fi;
}

# SOURCES
# https://github.com/mathiasbynens/dotfiles/blob/master/.functions

# `tre` is a shorthand for `tree` with hidden files and color enabled, ignoring
# the `.git` directory, listing directories first. The output gets piped into
# `less` with options to preserve color and line numbers, unless the output is
# small enough for one screen.
function tre() {
	tree -aC -I '.git|node_modules|bower_components' --dirsfirst "$@"
}