aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-17 02:57:11 +0900
committernsfisis <nsfisis@gmail.com>2024-08-17 02:57:11 +0900
commit4d13f7def1bdfebde5b8bd35bdfc4de2b7e87140 (patch)
tree646dcb42684ec9db3e568e24d68b9dd9c55011b5
parent5ac97e5aceeea6a30fcce64b2d1257071f18f47d (diff)
parent9ceb2eecf2f2e0d00452d1a30e1692c05466ff26 (diff)
downloaddotfiles-4d13f7def1bdfebde5b8bd35bdfc4de2b7e87140.tar.gz
dotfiles-4d13f7def1bdfebde5b8bd35bdfc4de2b7e87140.tar.zst
dotfiles-4d13f7def1bdfebde5b8bd35bdfc4de2b7e87140.zip
Merge branch 'feat/fish'
-rw-r--r--.config/alacritty/alacritty.common.toml2
-rw-r--r--.config/nvim/lua/init/01-options.lua2
-rw-r--r--.vimrc2
-rw-r--r--.zshrc473
-rw-r--r--home-manager/config/fish/config.fish125
-rw-r--r--home-manager/config/fish/path.fish1
-rw-r--r--home-manager/config/tmux/tmux.conf1
-rw-r--r--home-manager/home.nix29
-rw-r--r--mitamae/default.rb2
-rw-r--r--mitamae/node.hotaru.json3
-rw-r--r--mitamae/node.pc168.json3
11 files changed, 143 insertions, 500 deletions
diff --git a/.config/alacritty/alacritty.common.toml b/.config/alacritty/alacritty.common.toml
index 5821061..2176511 100644
--- a/.config/alacritty/alacritty.common.toml
+++ b/.config/alacritty/alacritty.common.toml
@@ -36,7 +36,7 @@ if command -v tmux >/dev/null; then
tmux new -s "$(date '+%Y-%m-%d %H%M%S')";
fi
else
- zsh;
+ fish;
fi
''']
diff --git a/.config/nvim/lua/init/01-options.lua b/.config/nvim/lua/init/01-options.lua
index 0ad6773..d90ef2a 100644
--- a/.config/nvim/lua/init/01-options.lua
+++ b/.config/nvim/lua/init/01-options.lua
@@ -142,7 +142,7 @@ O.wildignorecase = true
-- Executing external commands {{{1
-O.shell = 'zsh'
+O.shell = 'fish'
O.keywordprg = ''
diff --git a/.vimrc b/.vimrc
index 5dee3da..85ce1d1 100644
--- a/.vimrc
+++ b/.vimrc
@@ -130,7 +130,7 @@ set wildignore+=*.o,*.obj,*.lib
set wildignorecase
set wildmenu
-set shell=zsh
+set shell=fish
set keywordprg=
set fileencodings=utf-8,cp932,euc-jp
diff --git a/.zshrc b/.zshrc
deleted file mode 100644
index e60f438..0000000
--- a/.zshrc
+++ /dev/null
@@ -1,473 +0,0 @@
-if type nvim >/dev/null 2>&1; then
- export VISUAL=nvim
- export EDITOR=nvim
-else
- export VISUAL=vim
- export EDITOR=vim
-fi
-
-if type open >/dev/null 2>&1; then
- export BROWSER=open
-elif type xdg-open >/dev/null 2>&1; then
- export BROWSER=xdg-open
-fi
-
-export LSCOLORS=exfxcxdxbxegedabagacad
-export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
-
-export BAT_THEME=base16
-
-
-
-########################
-# Changing Directories #
-########################
-
-
-# Do "pushd ." after "cd".
-setopt AUTO_PUSHD
-
-# If "/foo/bar" is a link to "/hoge/piyo", "/foo/bar/.." means "/foo", not "/hoge".
-setopt NO_CHASE_LINKS
-
-# Don't execute "pushd" for duplicated direcotries again.
-setopt PUSHD_IGNORE_DUPS
-
-# Make "pushd" and 'popd' not to print the directory stack.
-setopt PUSHD_SILENT
-
-
-
-##############
-# Completion #
-##############
-
-# The completion has finished, the cursor is moved to the end of the word.
-setopt ALWAYS_TO_END
-
-# Do not expand glob patterns, instead, complete matched words.
-setopt GLOB_COMPLETE
-
-# Do not beep when the completion failed.
-setopt NO_LIST_BEEP
-
-# Make the completion list smaller.
-setopt LIST_PACKED
-
-# Sort the completion list horizontally.
-setopt LIST_ROWS_FIRST
-
-# Insert the first word immediately.
-setopt MENU_COMPLETE
-
-
-
-##########################
-# Expansion and Globbing #
-##########################
-
-# Do not print an error when a bad pattern wad passed.
-setopt NO_BAD_PATTERN
-
-# Expand character classes, like "{a-z}" or "{0-9}".
-setopt BRACE_CCL
-
-# Add some special characters, '#', '~', and '^', in glob expansion.
-setopt EXTENDED_GLOB
-
-# In "aaa=bbb", bbb will be expanded. It is often used for options.
-setopt MAGIC_EQUAL_SUBST
-
-# Append a slash to the expanded directory.
-setopt MARK_DIRS
-
-# Sort items numerically, not lexicographically.
-setopt NUMERIC_GLOB_SORT
-
-
-
-
-###########
-# History #
-###########
-
-# Do not beep when you refer to unexisting history record.
-setopt NO_HIST_BEEP
-
-# Erase oldest duplicate history when history file is full.
-setopt HIST_EXPIRE_DUPS_FIRST
-
-# Skip duplicate histories in finding the history.
-setopt HIST_FIND_NO_DUPS
-
-# Ignore duplicate history.
-setopt HIST_IGNORE_DUPS
-setopt HIST_IGNORE_ALL_DUPS
-
-# Ignore commands starting with spaces.
-setopt HIST_IGNORE_SPACE
-
-# Ignore function definitions.
-setopt HIST_NO_FUNCTIONS
-
-# Erase extra space.
-setopt HIST_REDUCE_BLANKS
-
-# Ignore "history" itself.
-setopt HIST_NO_STORE
-
-# Expand a command line from history before executing.
-setopt HIST_VERIFY
-
-# Share the history.
-setopt SHARE_HISTORY
-
-
-
-################
-# Input/Output #
-################
-
-# Prevent redirection ">" from overwriting existing files. Instead, use ">|" if you will ignore this option.
-setopt NO_CLOBBER
-
-# Correct the spelling of the command.
-setopt CORRECT
-
-# Disable flow control.
-setopt NO_FLOW_CONTROL
-
-# Do not exit when reading EOF(^D).
-setopt IGNORE_EOF
-
-# Regard '#' as comment even in interactive mode.
-setopt INTERACTIVE_COMMENTS
-
-# Wait 10 seconds before executing `rm *` or `rm path/*`.
-setopt RM_STAR_WAIT
-
-# Allow the short form of the loop statement.
-setopt SHORT_LOOPS
-
-
-
-#########################
-# Zsh Line Editor (ZLE) #
-#########################
-
-# Do not beep.
-setopt NO_BEEP
-
-# Use zle.
-setopt ZLE
-
-
-
-
-# Load completion
-# Note about "-u" flag of compinit:
-# https://github.com/zsh-users/zsh/blob/24a82b9dad1cbe109d9fb5753c429fd37b1618cd/Completion/compinit#L67-L72
-autoload -U compinit
-compinit -u autoload -U promptinit
-zstyle ':completion::complete:*' use-cache true
-#zstyle ':completion:*:default' menu select true
-zstyle ':completion:*:default' menu select=1
-
-# Ignore case in completion
-zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
-
-
-# Enable color in completion
-autoload -Uz colors
-colors
-zstyle ':completion:*' list-colors "${LS_COLORS}"
-
-# Highlight kill's candidates
-zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([%0-9]#)*=0=01;31'
-
-# Complete commands even if input starts with "sudo"
-zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/X11R6/bin
-
-# Exclude the current directory from completion list when typing "../".
-zstyle ':completion:*' ignore-parents parent pwd ..
-
-autoload -U zcalc
-autoload zed
-
-
-bindkey -e
-
-
-# Enable history completion
-autoload history-search-end
-zle -N history-beginning-search-backward-end history-search-end
-zle -N history-beginning-search-forward-end history-search-end
-
-# Start-with matching in history
-bindkey "^P" history-beginning-search-backward-end
-bindkey "^N" history-beginning-search-forward-end
-
-# Incremental search in history
-bindkey '^R' history-incremental-pattern-search-backward
-bindkey '^S' history-incremental-pattern-search-forward
-
-
-autoload -Uz zmv
-
-
-# Limit of completion list
-LISTMAX=1000
-
-# Exclude '|' and ':' from word character set
-WORDCHARS="$WORDCHARS|:"
-
-
-
-# C-u To delete input from the cursor position to the beginning of the line
-bindkey "^U" backward-kill-line
-
-# C-j To go to the parent directory.
-function __cd_parent_dir() {
- [ -e $BUFFER ] || return
-
- pushd .. > /dev/null
- __change_terminal_title
- zle reset-prompt
-}
-zle -N __cd_parent_dir
-bindkey "^J" __cd_parent_dir
-
-# C-o To go to the previous directory.
-function __cd_prev_dir() {
- [ -e $BUFFER ] || return
-
- popd > /dev/null
- __change_terminal_title
- zle reset-prompt
-}
-zle -N __cd_prev_dir
-bindkey "^O" __cd_prev_dir
-
-# C-g To go to the project root.
-function __cd_project_root_dir() {
- [ -e $BUFFER ] || return
-
- if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' ]]; then
- pushd $(git rev-parse --show-toplevel) > /dev/null
- zle reset-prompt
- fi
-}
-zle -N __cd_project_root_dir
-bindkey "^G" __cd_project_root_dir
-
-# C-z fg
-function __fg() {
- fg
-}
-zle -N __fg
-bindkey "^Z" __fg
-
-
-zmodload zsh/complist
-
-
-SPROMPT="%179F%BDid you mean %r? (n/y):%b%f "
-
-
-HISTTIMEFORMAT="[%Y/%M/%D %H:%M:%S] "
-HISTFILE="$XDG_STATE_HOME/zsh/history"
-HISTSIZE=1000000
-SAVEHIST=1000000
-
-
-function 256colors() {
- local code
- for code in {0..255}; do
- echo -e "\e[38;05;${code}m $code: Test"
- done
-}
-
-function truecolors() {
- awk 'BEGIN{
- s="/\\/\\/\\/\\/\\"; s=s s s s s s s s;
- for (colnum = 0; colnum < 77; colnum++) {
- r = 255 - (colnum * 255 / 76);
- g = (colnum * 510 / 76);
- b = (colnum * 255 / 76);
- if (g > 255)
- g = 510 - g;
- printf "\033[48;2;%d;%d;%dm", r, g, b;
- printf "\033[38;2;%d;%d;%dm", 255 - r, 255 - g, 255 - b;
- printf "%s\033[0m", substr(s, colnum + 1, 1);
- }
- printf "\n";
- }'
-}
-
-
-
-# noxxx on => xxx off
-# noxxx off => xxx on
-function showoptions() {
- set -o | sed -e 's/^no\(.*\)on$/\1 off/' -e 's/^no\(.*\)off$/\1 on/'
-}
-
-
-
-function __change_terminal_title() {
- local _title=$(pwd | rev | awk -F \/ '{print "/"$1"/"$2}'| rev)
- echo -ne "\033]0;${_title}\007"
-}
-
-function chpwd() {
- __change_terminal_title
-}
-
-
-
-function mkcd() {
- mkdir -p $1
- cd $_
-}
-
-
-
-function pwgen() {
- 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
-}
-
-
-
-alias cp='cp -i'
-alias mkdir='mkdir -p'
-alias mv='mv -i'
-alias rm="rm -i"
-alias ssh='TERM=xterm-256color ssh'
-alias tree='tree -N --gitignore'
-
-alias zmv='noglob zmv -W'
-alias fd='noglob fd'
-
-alias g='git'
-alias gs='git s'
-
-if type nvim >/dev/null 2>&1; then
- alias vim='nvim'
- alias vimdiff='nvim -d'
- alias view='nvim -R'
- alias e='nvim'
-else
- alias e='vim'
-fi
-
-if type fzf >/dev/null 2>&1; then
- if type fd >/dev/null 2>&1; then
- export FZF_DEFAULT_COMMAND='fd --type f --strip-cwd-prefix --hidden --exclude .git'
- fi
- if type nvim >/dev/null 2>&1; then
- function ee() {
- if [[ -z "$1" ]]; then
- fzf --reverse --bind 'enter:become(nvim {})'
- else
- find "$1" -type f -print0 | fzf --read0 --reverse --bind 'enter:become(nvim {})'
- fi
- }
- else
- function ee() {
- if [[ -z "$1" ]]; then
- fzf --reverse --bind 'enter:become(vim {})'
- else
- find "$1" -type f -print0 | fzf --read0 --reverse --bind 'enter:become(vim {})'
- fi
- }
- fi
-fi
-
-if [[ "$(uname)" == "Darwin" ]]; then
- alias o='open'
-else
- alias o='xdg-open'
-fi
-
-if type bat >/dev/null 2>&1; then
- alias cat='bat'
-fi
-
-if type rg >/dev/null 2>&1; then
- alias grep='rg'
-fi
-
-if [[ "$(uname)" == "Darwin" ]]; then
- alias ls='ls -G'
- alias lsa='ls -G -a'
- alias ll='ls -G -l'
- alias lsal='ls -G -al'
- alias lla='ls -G -al'
-else
- alias ls='ls --color=always'
- alias lsa='ls --color=always -a'
- alias ll='ls --color=always -l'
- alias lsal='ls --color=always -al'
- alias lla='ls --color=always -al'
-fi
-
-if [[ "$(uname)" == "Darwin" ]]; then
- alias tac='tail -r'
-fi
-
-
-alias direnvnix='nix flake new -t github:nix-community/nix-direnv'
-
-
-
-
-# fpath=(~/.config/zsh/completions $fpath)
-# autoload -Uz _my_composer
-compdef _my_composer composer composer.phar
-
-# TODO
-# Move these definitions to a separate file.
-autoload -Uz _composer
-
-# Fall back to the default file/dir completion if the existing completion
-# doesn't return anything.
-function _my_composer() {
- _composer "$@" || _files "$@"
-}
-
-
-
-export LD_LIBRARY_PATH=$HOME/lib:$LD_LIBRARY_PATH
-
-# To override system-provided Ruby with brewed Ruby
-if [[ "$(uname)" == "Darwin" ]]; then
- export PATH="/opt/homebrew/opt/ruby/bin:$PATH"
-fi
-
-export PATH="$HOME/go/bin:$PATH"
-export PATH="$HOME/.cargo/bin:$PATH"
-export PATH="$HOME/.deno/bin:$PATH"
-export PATH=/usr/local/go/bin:$PATH
-
-
-
-# Confirm before executing `terraform apply`.
-function terraform() {
- local subcommand="$1"
- if [[ $subcommand = "apply" ]]; then
- echo "Are you sure to apply?"
- echo -n "(y/n): "
- read -r answer
- if [[ $answer = "y" ]]; then
- command terraform "$@"
- else
- echo "Cancelled."
- fi
- else
- command terraform "$@"
- fi
-}
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..e74da8a 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,28 +127,15 @@ in
''
else
"";
- shellConfig = if useNixManagedZsh then
- ''
- set-option -g default-shell ${homeDirectory}/.nix-profile/bin/zsh
- ''
- else
- "";
in
- commonConfig + clipboardConfig + terminalConfig + shellConfig;
- };
-
- programs.zsh = {
- enable = true;
-
- envExtra = ''
- export PATH="$HOME/bin:$HOME/.local/bin:$PATH"
- '';
-
- initExtra = builtins.readFile ../.zshrc;
+ commonConfig + clipboardConfig + terminalConfig;
};
programs.fish = {
enable = true;
+
+ interactiveShellInit = builtins.readFile ./config/fish/config.fish;
+ shellInitLast = builtins.readFile ./config/fish/path.fish;
};
programs.starship = {
diff --git a/mitamae/default.rb b/mitamae/default.rb
index 465b860..16de368 100644
--- a/mitamae/default.rb
+++ b/mitamae/default.rb
@@ -69,8 +69,6 @@ link "#{home}/bin/tmux-pane-idx" do
to "#{home}/dotfiles/bin/tmux-pane-idx"
end
-directory "#{home}/.local/state/zsh"
-
# SKK
directory "#{home}/.config/skk"
http_request "#{home}/.config/skk/SKK-JISYO.L.unannotated.gz" do
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
+ }
}
}
}