diff options
| -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 | ||||
| -rw-r--r-- | home-manager/home.nix | 19 | ||||
| -rw-r--r-- | mitamae/node.hotaru.json | 3 | ||||
| -rw-r--r-- | mitamae/node.pc168.json | 3 |
6 files changed, 140 insertions, 12 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' diff --git a/home-manager/home.nix b/home-manager/home.nix index 1ee6c37..1dba991 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -5,7 +5,6 @@ let clipboardCopyCommand = specialArgs.env.gui.clipboard.copyCommand; requiresWlClipboard = clipboardCopyCommand == "wl-copy"; terminalApp = specialArgs.env.gui.terminalApp; - useNixManagedZsh = specialArgs.env.useNixManagedZsh; in { home.username = username; @@ -85,6 +84,13 @@ in LC_ALL = ""; # Locale: Less LESSCHARSET = "utf-8"; + + # Editor + VISUAL = "nvim"; + EDITOR = "nvim"; + + # Bat + BAT_THEME = "base16"; }; programs.direnv = { @@ -121,14 +127,8 @@ in '' else ""; - shellConfig = if useNixManagedZsh then - '' - set-option -g default-shell ${homeDirectory}/.nix-profile/bin/zsh - '' - else - ""; in - commonConfig + clipboardConfig + terminalConfig + shellConfig; + commonConfig + clipboardConfig + terminalConfig; }; programs.zsh = { @@ -143,6 +143,9 @@ in programs.fish = { enable = true; + + interactiveShellInit = builtins.readFile ./config/fish/config.fish; + shellInitLast = builtins.readFile ./config/fish/path.fish; }; programs.starship = { diff --git a/mitamae/node.hotaru.json b/mitamae/node.hotaru.json index 46b196d..2477400 100644 --- a/mitamae/node.hotaru.json +++ b/mitamae/node.hotaru.json @@ -12,8 +12,7 @@ "copyCommand": null }, "terminalApp": "windowsTerminal" - }, - "useNixManagedZsh": true + } } } } diff --git a/mitamae/node.pc168.json b/mitamae/node.pc168.json index 1e0f682..8c94ae1 100644 --- a/mitamae/node.pc168.json +++ b/mitamae/node.pc168.json @@ -12,8 +12,7 @@ "copyCommand": "pbcopy" }, "terminalApp": "alacritty" - }, - "useNixManagedZsh": false + } } } } |
