-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.functions
82 lines (73 loc) · 1.9 KB
/
.functions
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# stuff to set sane settings for devices
function keyb() {
echo "natural scroll... "; xinput --set-prop 12 315 1;
echo "natural scroll mouse... "; xinput --set-prop 'pointer:MOSART Semi. 2.4G Keyboard Mouse' 'libinput Natural Scrolling Enabled' 1;
echo "natural scroll mouse... "; xinput --set-prop 'SynPS/2 Synaptics TouchPad' 'libinput Natural Scrolling Enabled' 1;
echo "key repeat ... "; xset r rate 225 100;
echo "caps -> escape ... "; setxkbmap -option caps:swapescape;
echo "nat scroll ";
xinput --set-prop 'pointer:Lenovo ThinkPad Compact USB Keyboard with TrackPoint' 'libinput Natural Scrolling Enabled' 1;
xinput --set-prop 'TPPS/2 IBM TrackPoint' 'libinput Natural Scrolling Enabled' 1
echo "keyboard uk ... ";
setxkbmap us;
echo "... done";
}
# open vimwiki
function vw() {
vim ~/Dropbox/vimwiki/index.md;
}
function todo() {
vim ~/Dropbox/vimwiki/todo.md
}
# open latex scratchpad
function vl() {
v ~/Dropbox/vimwiki/latex.md;
}
function mkd() {
mkdir -p "$@" && cd "$_";
}
# Determine size of a file or total size of a directory
function fs() {
if du -b /dev/null > /dev/null 2>&1; then
local arg=-sbh;
else
local arg=-sh;
fi
if [[ -n "$@" ]]; then
du $arg -- "$@";
else
du $arg .[^.]* *;
fi;
}
# Use Git’s colored diff when available
hash git &>/dev/null;
if [ $? -eq 0 ]; then
function diff() {
git diff --no-index --color-words "$@";
}
fi;
# `v` with no arguments opens the current directory in Vim, otherwise opens the
# given location
function v() {
if [ $# -eq 0 ]; then
vim "$(fzf)";
else
vim "$@";
fi;
}
# open vim without vimrc
function vn() {
if [ $# -eq 0 ]; then
$vim -u NONE "$(fzf)";
else
$vim -u NONE "$@";
fi;
}
# Fzf search bash history + executes.
function fh() {
eval $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac | sed 's/ *[0-9]* *//')
}
# Fzf search with AG
function fa() {
ag --nobreak --nonumbers --noheading . | fzf
}