Hyper-V の仮想マシンをつくりUbuntu 24.04 を入れた。自分のプログラムの挙動を調べたり動きを調べたりするために使う。
Ubuntu 24.04 を入れた後に、openssh-server と avahi-daemon とvim-nox を入れた。作業用ユーザをつくり、ホストからSSH できるようにした。ホスト側の ~/.ssh/config に
Host hoge HostName hoge.local User fuga
な感じで追加。
zsh を使いたい。
sudo apt install -y zshchsh
# ~/.zprofileif [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH"fiif [ -d "$HOME/.local/bin" ] ; then PATH="$HOME/.local/bin:$PATH"fi
# ~/.zshrc# Set up the promptautoload -Uz promptinitpromptinitprompt adam1setopt histignorealldups sharehistory# Use emacs keybindings even if our EDITOR is set to vibindkey -e# Keep 1000 lines of history within the shell and save it to ~/.zsh_history:HISTSIZE=10000SAVEHIST=10000HISTFILE=~/.zsh_historysetopt HIST_IGNORE_DUPSsetopt HIST_IGNORE_SPACE# Use modern completion systemautoload -Uz compinitcompinitzstyle ':completion:*' auto-description 'specify: %d'zstyle ':completion:*' completer _expand _complete _correct _approximatezstyle ':completion:*' format 'Completing %d'zstyle ':completion:*' group-name ''zstyle ':completion:*' menu select=2eval "$(dircolors -b)"zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}zstyle ':completion:*' list-colors ''zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%szstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'zstyle ':completion:*' menu select=longzstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%szstyle ':completion:*' use-compctl falsezstyle ':completion:*' verbose truezstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'curl --proto '=https' -fLsS https://rossmacarthur.github.io/install/crate.sh \ | bash -s -- --repo rossmacarthur/sheldon --to ~/.local/binsheldon init --shell zsh
ぶっちゃけ、補完の設定からちゃんとわかっていない状態なので、とりあえずサンプルにあったプラグインの組み込みをやってみる。
# ~/.config/sheldon/plugins.toml[plugins.base16]github = "chriskempson/base16-shell"
~/.zshrc の先頭にeval "$(sheldon source)" を追加。ターミナルを立ち上げなおすとエラー。メッセージをコピーしておくのを忘れたけど shell がどうとか言っている。
# ~/.config/sheldon/plugins.tomlshell = "zsh"[plugins.base16]github = "chriskempson/base16-shell"
とshell = "zsh" を追加。エラーは消えた。
最終的に、
# ~/.config/sheldon/plugins.tomlshell = "zsh"[plugins]# [plugins.base16]# github = "chriskempson/base16-shell"[plugins.zsh-defer]github = "romkatv/zsh-defer"[templates]defer = "{{ hooks?.pre | nl }}{% for file in files %}zsh-defer source \"{{ file }}\"\n{% endfor %}{{ hooks?.post | nl }}"PATH = 'export PATH="$PATH:{{ dir }}"'[plugins.zsh-autosuggestions]github = "zsh-users/zsh-autosuggestions"use = ["{{ name }}.zsh"][plugins.zsh-syntax-highlighting]github = "zsh-users/zsh-syntax-highlighting"[plugins.zsh-completions]github = "zsh-users/zsh-completions"[plugins.powerlevel10k]github = "romkatv/powerlevel10k"で、
# ~/.zshrc# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.# Initialization code that may require console input (password prompts, [y/n]# confirmations, etc.) must go above this block; everything else may go below.if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"fieval "$(sheldon source)"ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'# # Set up the prompt# autoload -Uz promptinit# promptinit# prompt adam1[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zshsetopt histignorealldups sharehistory# Use emacs keybindings even if our EDITOR is set to vibindkey -e# Keep 1000 lines of history within the shell and save it to ~/.zsh_history:HISTSIZE=10000SAVEHIST=10000HISTFILE=~/.zsh_historysetopt HIST_IGNORE_DUPSsetopt HIST_IGNORE_SPACE# Use modern completion systemautoload -Uz compinitcompinitzstyle ':completion:*' auto-description 'specify: %d'zstyle ':completion:*' completer _expand _complete _correct _approximatezstyle ':completion:*' format 'Completing %d'zstyle ':completion:*' group-name ''zstyle ':completion:*' menu select=2eval "$(dircolors -b)"zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}zstyle ':completion:*' list-colors ''zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%szstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'zstyle ':completion:*' menu select=longzstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%szstyle ':completion:*' use-compctl falsezstyle ':completion:*' verbose truezstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'ZSH_HIGHLIGHT_DIR="$HOME/.local/share/sheldon/repos/github.com/zsh-users/zsh-syntax-highlighting"if [ -f "$ZSH_HIGHLIGHT_DIR/zsh-syntax-highlighting.zsh" ]; then source "$ZSH_HIGHLIGHT_DIR/zsh-syntax-highlighting.zsh"fiのようにした。zsh-syntax-highlighting の設定は ~/.zshrc の最後に入れる(compinit より後ろに入れる)のが必要らしい。
引用をストックしました
引用するにはまずログインしてください
引用をストックできませんでした。再度お試しください
限定公開記事のため引用できません。