Files
dotfiles/private_dot_config/private_fish/config.fish.tmpl
T

130 lines
3.5 KiB
Cheetah
Raw Normal View History

2023-04-29 16:26:17 +02:00
# ===========================================================================
# Fish config
# ===========================================================================
# requires fisher (https://github.com/jorgebucaran/fisher)
2023-04-29 22:55:09 +02:00
set -gx COLORTERM truecolor
set -gx EDITOR nvim
2023-04-29 22:55:09 +02:00
set -gx LANG fr_FR.UTF-8
set -gx LC_ALL fr_FR.UTF-8
2023-05-01 11:03:51 +02:00
set --universal fish_greeting
2023-04-29 17:02:52 +02:00
2023-04-29 18:23:03 +02:00
# nix
if test -e $HOME/.nix-profile/etc/profile.d/nix.sh
fenv source $HOME/.nix-profile/etc/profile.d/nix.sh
abbr -a nix-update "nix-channel --update && nix-env -u"
function nix-search
nix-env -qa --description ".*$argv.*"
end
end
2023-04-30 21:09:22 +02:00
fish_add_path "$HOME/.local/bin"
abbr -a vi nvim
2023-05-11 08:53:28 +02:00
abbr -a v nvim
2023-05-11 08:09:43 +02:00
abbr -a s subl .
2023-08-18 14:06:23 +02:00
abbr -a r ranger
2023-04-29 18:28:39 +02:00
abbr -a cdd "cd {{ .deploydir }}"
set -x cdd {{ .deploydir }}
# git
2023-04-30 21:09:22 +02:00
abbr -a tiga tig --all
2023-05-02 19:45:03 +02:00
function __git_fetch_after_cd__on_variable_pwd --on-variable PWD
if test -d .git
git fetch
end
end
2023-04-29 18:23:03 +02:00
# fzf
2023-04-30 21:09:22 +02:00
function p --description "cd project"
cd {{ .projectdir }} && _fzf_search_directory
2023-04-29 16:26:17 +02:00
end
2023-04-30 21:09:22 +02:00
# File find: CTRL+F, Git log: CTRL+G
fzf_configure_bindings --directory=\cf --git_log=\cg
2023-08-22 14:44:09 +02:00
set fzf_diff_highlighter diff-so-fancy
2023-04-29 16:26:17 +02:00
# java
2023-04-30 21:09:22 +02:00
abbr -a m mvn
abbr -a mvnp mvn -Dmaven.test.skip -Dmaven.javadoc.skip=true -DskipMunitTests clean package
abbr -a mvni mvn -Dmaven.test.skip -Dmaven.javadoc.skip=true clean install
abbr -a mvnd mvn -Dmaven.test.skip -Dmaven.javadoc.skip=true deploy -P profile-nexus
function mbump
2023-05-11 15:48:56 +02:00
if test (count $argv) -eq 0
echo "Usage: mbump <version> (means -SNAPSHOT) or mbump <version> <kind> (kind is R or S)"
else
if test (count $argv) -gt 1; and test $argv[2] = 'R';
set kind = 'RELEASE'
else
set kind = 'SNAPSHOT'
end
mvn versions:set -DgenerateBackupPoms=false -DnewVersion=$argv[1]-$kind
end
end
alias d "python3 ~/.local/bin/deploy.py {{ .deploydir }}"
2023-04-29 18:23:03 +02:00
2023-05-24 16:09:48 +02:00
# sdkman
if test -f "$__fish_sdkman_init"
function sdk_autoenv --on-variable PWD
if test -f ".sdkmanrc"
sdk env
end
end
end
2023-04-29 18:23:03 +02:00
# node
if test -e "{{ .extra_ca_cert }}"
set -x NODE_EXTRA_CA_CERTS {{ .extra_ca_cert }}
set -x NODE_BUILD_CURL_OPTS --insecure
end
2023-05-02 08:21:16 +02:00
set -Ux fish_user_paths $HOME/.nodenv/bin $fish_user_paths
2023-04-29 18:23:03 +02:00
# python
if test -e "{{ .extra_ca_cert }}"
set -x REQUESTS_CA_BUNDLE {{ .extra_ca_cert }}
2023-04-29 17:02:52 +02:00
end
# tmux
set -x FAVORITE_COMMAND1 "{{ .tmux_favorite1 }}"
set -x FAVORITE_COMMAND2 "{{ .tmux_favorite2 }}"
set -x FAVORITE_COMMAND3 "{{ .tmux_favorite3 }}"
set -x FAVORITE_COMMAND4 "{{ .tmux_favorite4 }}"
# sponge
set sponge_successful_exit_codes 0 130
2023-05-26 07:57:19 +02:00
# extend with specific config
if test -e "$HOME/.config/fish/custom.fish"
source "$HOME/.config/fish/custom.fish"
end
# ranger: Q to cd on exit
function ranger
set tempfile (mktemp -t tmp.XXXXXX)
set command_argument "map Q chain shell echo %d > $tempfile; quitall"
command ranger --cmd="$command_argument" $argv
if test -s $tempfile
set ranger_pwd (cat $tempfile)
if test -n $ranger_pwd -a -d $ranger_pwd
builtin cd -- $ranger_pwd
end
end
command rm -f -- $tempfile
end
2023-07-31 09:43:36 +02:00
# Commands to run in interactive sessions can go here
2023-04-29 16:26:17 +02:00
if status is-interactive
2023-07-31 09:43:36 +02:00
abbr -a rm "rm --interactive --verbose"
abbr -a mv "mv --interactive --verbose"
abbr -a cp "cp --interactive --verbose"
abbr -a ag "ag --ignore-case"
2023-07-31 09:43:36 +02:00
# direnv (https://direnv.net)
2023-08-01 21:35:38 +02:00
if type -q direnv
2023-07-31 09:43:36 +02:00
direnv hook fish | source
end
2024-02-21 11:53:26 +01:00
# run tmux session
2024-07-27 15:29:42 +02:00
#if not set -q TMUX
# tmux attach -t build; or tmux new -s build
#end
2023-04-29 16:26:17 +02:00
end