diff options
Diffstat (limited to 'home-manager/config')
| -rw-r--r-- | home-manager/config/fish/config.fish | 125 | ||||
| -rw-r--r-- | home-manager/config/fish/path.fish | 1 | ||||
| -rw-r--r-- | home-manager/config/tmux/tmux.conf | 1 |
3 files changed, 127 insertions, 0 deletions
diff --git a/home-manager/config/fish/config.fish b/home-manager/config/fish/config.fish new file mode 100644 index 0000000..4330a58 --- /dev/null +++ b/home-manager/config/fish/config.fish @@ -0,0 +1,125 @@ +set -l has_nvim (type -q nvim) +set -l has_fd (type -q fd) +set -l on_darwin (test (uname) = "Darwin") + +function fish_greeting; end + +# Abbreviations +abbr -a direnvnix 'nix flake new -t github:nix-community/nix-direnv' +abbr -a g 'git' +abbr -a gs 'git s' +abbr -a ll 'ls -l' +abbr -a lla 'ls -la' +abbr -a lsa 'ls -a' +abbr -a lsal 'ls -la' +abbr -a lsl 'ls -l' + +# Aliases +alias cat 'bat' +alias cp 'cp -i' +alias e 'nvim' +alias grep 'rg' +alias mkdir 'mkdir -p' +alias mv 'mv -i' +alias rm 'rm -i' +alias ssh 'TERM=xterm-256color ssh' +alias tree 'tree -N --gitignore' +alias view 'nvim -R' +alias vim nvim +alias vimdiff 'nvim -d' + +if [ -n $on_darwin ] + alias tac 'tail -r' +end + +# Bindings +function __cd_parent_dir + if [ -n (commandline) ] + return + end + cd .. + commandline -f repaint +end +bind \cj __cd_parent_dir + +function __cd_prev_dir + if [ -n (commandline) ] + return + end + cd - + commandline -f repaint +end +bind \co __cd_prev_dir + +function __cd_project_root_dir + if [ -n (commandline) ] + return + end + if [ (git rev-parse --is-inside-work-tree 2>/dev/null) = 'true' ] + cd (git rev-parse --show-toplevel) + commandline -f repaint + end +end +bind \cg __cd_project_root_dir + +bind \cz fg + +function 256colors + for code in (seq 0 255) + printf '\e[38;05;%dm%3d: Test\n' $code $code + end +end + +function mkcd + mkdir -p $argv[1] + cd $argv[1] +end + +function pwgen --wraps pwgen + if [ (count $argv) -gt 0 ] + command pwgen $argv + else + command pwgen -N 1 64 + command pwgen -N 1 48 + command pwgen -N 1 32 + command pwgen -N 1 24 + command pwgen -N 1 16 + end +end + +if [ -n $has_nvim ] + if [ -n $has_fd ] + set -gx FZF_DEFAULT_COMMAND "fd --type f --strip-cwd-prefix --hidden --exclude .git" + end + function ee + if [ (count $argv) -eq 0 ] + fzf --reverse --bind 'enter:execute(nvim {})' + else + find $argv[1] -type f -print0 | fzf --read0 --reverse --bind 'enter:execute(nvim {})' + end + end +else + function ee + if [ (count $argv) -eq 0 ] + fzf --reverse --bind 'enter:execute(vim {})' + else + find $argv[1] -type f -print0 | fzf --read0 --reverse --bind 'enter:execute(vim {})' + end + end +end + +function terraform + set -l subcommand $argv[1] + if [ $subcommand = "apply" ] + echo "Are you sure to apply?" + echo -n "(y/n): " + read answer + if [ $answer = "y" ] + command terraform $argv + else + echo "Cancelled." + end + else + command terraform $argv + end +end diff --git a/home-manager/config/fish/path.fish b/home-manager/config/fish/path.fish new file mode 100644 index 0000000..301d603 --- /dev/null +++ b/home-manager/config/fish/path.fish @@ -0,0 +1 @@ +fish_add_path $HOME/go/bin $HOME/.cargo/bin $HOME/.deno/bin $HOME/.local/bin $HOME/bin diff --git a/home-manager/config/tmux/tmux.conf b/home-manager/config/tmux/tmux.conf index d62e67c..0746f82 100644 --- a/home-manager/config/tmux/tmux.conf +++ b/home-manager/config/tmux/tmux.conf @@ -12,6 +12,7 @@ # BASICS {{{2 set-option -g renumber-windows on set-option -g focus-events on +set-option -g default-shell fish # TERMINAL FEATURES {{{2 set-option -ga terminal-overrides ',tmux-256color:RGB' |
