Upgrade to Pro — share decks privately, control downloads, hide ads and more …

2022.05.25_はじめてのIT勉強会.pdf

 2022.05.25_はじめてのIT勉強会.pdf

Avatar for obrkn

obrkn

May 23, 2022
Tweet

Other Decks in Programming

Transcript

  1. Table of contents ターミナル編 (1)ターミナルソフト「iTerm2」 (2)カラー「Dracula/iceberg」 (3)フォント「Ricty/HackGen」 (4)透明度・フルスクリーン・背景画像 (5)背景「Pokemon-Terminal」 プロンプト編

    (6)プロンプト変更の基本 (7)テーマ「Pure/Powerline/Starship/他」 (8)フレームワーク「Prezto/oh-my-zsh」 プロンプト ターミナル シェル
  2. (2)カラー「Dracula/iceberg」 iTerm2設定画面 ① ② 背景 文字 ANSIカラー プロンプトで 利用できる(後述) 黒

    Black 赤 Red 緑 Green 黄色 Yellow 青 Blue マゼンタ Magenta シアン Cyan 白 White カラースキームの適用
  3. Table of contents ターミナル編 (1)ターミナルソフト「iTerm2」 (2)カラー「Dracula/iceberg」 (3)フォント「Ricty/HackGen」 (4)透明度・フルスクリーン・背景画像 (5)背景「Pokemon-Terminal」 プロンプト編

    (6)プロンプト変更の基本 (7)テーマ「Pure/Powerline/Starship/他」 (8)フレームワーク「Prezto/oh-my-zsh」 プロンプト ターミナル シェル
  4. (6)プロンプト変更の基本 環境変数に表示項目や文字色を設定すると、プロンプトを変更できる bashの場合 画面左端 PS1 zshの場合 画面左端 PROMPT、画面右端 RPROMPT 例

    (zsh) 出力内容 例 %~ カレントディレクトリ ~/currentdir %D 日付 22-05-25 %t 時間 19:30PM %F{red} 色(赤) Red %(?.A.B) 成功ならAを出力 失敗ならBを出力 ~/.zshrc PROMPT="┌─%F{magenta}%~ %F{white}└─(*'-')< ~ $ " RPROMPT="%F{cyan}%t" 他にもいろいろな環境変数やエスケープ文字がある 環境変数 https://zsh.sourceforge.io/Doc/Release/Parameters.html#Parameters-Set-By-The-Shell エスケープ文字 https://zsh.sourceforge.io/Doc/Release/Prompt-Expansion.html#Prompt-Expansion Generatorサイトで手軽にプロンプトを自作できる! bash https://scriptim.github.io/bash-prompt-generator/ zsh https://zsh-prompt-generator.site/
  5. (7)テーマ「Pure/Powerline/Starship」 最適化されたプロンプトテーマ。Git表示や言語表示があるものもある。 Pure以外はPowerline fontsやNerd対応フォントでないと文字化けする。 Pure ☆11.3k Powerline shell ☆5.8k Starship

    ☆26.5k Spaceship ☆16.8k (Starshipと同様) Powerlevel10k ☆28.3k (Powerlevel10kは質問に答えていくと、自分好みのデザインが出来上がる) Pureは必要最小限の情報に抑えられており、おすすめのプロンプト。 テーマ一覧 👉 https://github.com/unixorn/awesome-zsh-plugins#themes Githubのスター数は2022/05/25現在
  6. リンク集 iTerm2 https://iterm2.com/ Dracula https://draculatheme.com/ Dracula iTerm https://draculatheme.com/iterm Iceberg https://cocopon.github.io/iceberg.vim/

    Iceberg-iTerm2 https://github.com/Arc0re/Iceberg-iTerm2 カラースキーム一覧 https://iterm2colorschemes.com/ Ricty https://rictyfonts.github.io/ HackGen https://github.com/yuru7/HackGen Pokemon-Terminal https://github.com/LazoCoder/Pokemon-Terminal Pokemon一覧 https://github.com/LazoCoder/Pokemon-Terminal/blob/master/pokemonterminal/Data/pokemon.txt bash prompt generator https://scriptim.github.io/bash-prompt-generator/ zsh prompt generator https://zsh-prompt-generator.site/ 環境変数 https://zsh.sourceforge.io/Doc/Release/Parameters.html#Parameters-Set-By-The-Shell エスケープ文字 https://zsh.sourceforge.io/Doc/Release/Prompt-Expansion.html#Prompt-Expansion Pure https://github.com/sindresorhus/pure Powerline-shell https://github.com/b-ryan/powerline-shell Starship https://starship.rs/ja-JP/ Spaceship https://spaceship-prompt.sh/ Powerlevel10k https://github.com/romkatv/powerlevel10k テーマ一覧 https://github.com/unixorn/awesome-zsh-plugins#themes Oh my zsh https://ohmyz.sh/ Oh my zshテーマ一覧 https://github.com/ohmyzsh/ohmyzsh/wiki/Themes Prezto https://github.com/sorin-ionescu/prezto フレームワーク一覧 https://github.com/unixorn/awesome-zsh-plugins#frameworks
  7. プラグイン(zsh) Oh my zshなどのフレームワークを入れなくても、 単体で入れられるプラグインは豊富にある https://github.com/unixorn/awesome-zsh-plugins#plugins https://github.com/topics/autocomplete その中でもおすすめのプラグインを紹介したい! 「zsh-syntax-highlighting」 入力中にそのコマンドが存在すれば緑色で、

    存在しなければ赤色でハイライト表示してくれる。 https://github.com/zsh-users/zsh-syntax-highlighting 「zsh-autosuggestions」 入力中に過去のコマンド履歴に基づいて候補を表示してくれる。 “Ctrl + e”でその候補を補完してくれる。 https://github.com/zsh-users/zsh-autosuggestions 「fzf (command-line fuzzy finder)」 入力中に”Ctrl + r”でコマンド履歴を、 ”Ctrl + t”でファイルを曖昧検索してくれる。 候補から”Ctrl + p”で上へ、”Ctrl + n”で下へカーソル移動し、 Enterで決定するとコマンドラインへ補完してくれる。 曖昧検索のプラグインとして、「 peco」も人気がある。 https://github.com/junegunn/fzf
  8. キーバインド・エイリアス シェルにはデフォルトでキーバインドが設定されており、カスタマイズもできる 設定されているキーバインドの一覧は、 bashなら”bind -p”、zshなら”bindkey -L”で確認できる 一覧の見方(zsh)は、 ^ はCtrlキー、 ^[

    はEscキー(WindowsならAltキー)を示す Escキーは使いにくいので、 iTerm2の設定で左OptionキーをEscキーに割り振っておこう 表におすすめのキーバインドを紹介したい! Ctrl + a 先頭移動 Ctrl + b 1文字左移動 Ctrl + c コマンド中断 Ctrl + e 末尾移動 Ctrl + f 1文字右移動 Ctrl + h 1文字左削除 Ctrl + k 末尾まで削除 Ctrl + u 先頭まで削除 Ctrl + w 単語削除 Ctrl + y ヤンク(貼付) Esc + b 単語左移動 Esc + f 単語右移動 GitやDocker等でよく使うコマンドは、エイリアスを登録する方法もある 例) lsコマンドを隠しファイル表示の -aオプションと 色分け表示の -Gオプションをつけて上書き登録 ~/.zshrc alias ls='ls -aG' cdコマンド等でパス入力中にフォルダ名やファイル名を忘れた場合は、とりあえず Tabキー を押すと補完or候補提示してくれる コマンド入力中に Option + 左クリック でマウスカーソル位置へ移動できる