-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.fish
51 lines (41 loc) · 1.55 KB
/
config.fish
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
if status is-interactive
###########################################################################
# Set up vi keybindings
fish_vi_key_bindings insert
# Smash J and K to get out if insert mode.
bind --mode insert --sets-mode default jk repaint-mode
bind --mode insert --sets-mode default kj repaint-mode
# Make sure we actually can type J and K still.
bind --mode insert j self-insert
bind --mode insert k self-insert
# Jump commands
bind --mode default \cl repeat-jump
# Autosuggestion
bind --mode insert \cf accept-autosuggestion
# source: https://github.com/fish-shell/fish-shell/issues/2271#issuecomment-352210807
function reverse_history_search
# Delimit with NUL to handle multiline commands correctly
history --null | fzf --read0 --no-sort --exact | read -l command
if test $command
# Put command into the command line.
commandline -rb $command
# Force a repaint of the command line.
commandline --function repaint
end
end
function fish_user_key_bindings
bind -M default / reverse_history_search
end
###########################################################################
# aliases and functions
alias tree='tree -C'
alias ta='tmux attach'
end
set --export PATH "$HOME"/bin $PATH
which vim > /dev/null; and set --export EDITOR vim
# Prefer nvim if it's around
which nvim > /dev/null; and set --export EDITOR nvim
function cdn
nvr --remote-expr 'execute("pwd")' | tr --delete '\n' | read -l new_dir
cd $new_dir
end