---
title: "ターミナルがダサいとモテない。neovim + AstroNvim v4.0 紹介編 | grasys blog"
url: "https://blog.grasys.io/post/yusukeh/terminal-neovim-astronvim-v4/"
description: "AstroNvim が v4.0に update していて大幅に変わっています。 Photo by Goran Ivos on Unsplash 恵比寿で IT企業をやっているとモテると聞いて創業しましたが早いことありがたいことに10年目に突入した長谷川です。 まだモテる成果は出ていません、、、これからです！（もうめ…"
---

# ターミナルがダサいとモテない。neovim + AstroNvim v4.0 紹介編

-   ![](/_astro/noicon.CTHOhNiB_1HMs6A.webp)[yusukeh](/authors/yusukeh/)
-   公開日：2024年10月22日
-   カテゴリー：[Tech](/categories/tech/)
-   タグ：[#シリーズ: ターミナル環境](/tags/シリーズ-ターミナル環境/)[#terminal](/tags/terminal/)

![ターミナルがダサいとモテない。neovim + AstroNvim v4.0 紹介編](/_astro/hero.DJq1GAWm_Z28qwQQ.webp)

AstroNvim が v4.0に update していて大幅に変わっています。

![ターミナルがダサいとモテない。neovim + AstroNvim v4.0 紹介編](/_astro/01-0-gu9eUV0gPYg1_7n6-9544ebd9.GQ0AVhQa_2lUREH.webp)

Photo by [Goran Ivos](https://unsplash.com/@goran_ivos?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com/?utm_source=medium&utm_medium=referral)

恵比寿で IT企業をやっているとモテると聞いて創業しましたが早いことありがたいことに10年目に突入した長谷川です。

まだモテる成果は出ていません、、、これからです！（もうめんどくさいのでカウントやめました）

以前書いた「[ターミナルがダサいとモテない。neovim + AstroNvim 紹介編](https://blog.grasys.io/post/yusukeh/terminal-neovim-astronvim/)」は古くなりました。[](https://medium.com/@yusuke_h/%E3%82%BF%E3%83%BC%E3%83%9F%E3%83%8A%E3%83%AB%E3%81%8C%E3%83%80%E3%82%B5%E3%81%84%E3%81%A8%E3%83%A2%E3%83%86%E3%81%AA%E3%81%84-neovim-astronvim%E7%B4%B9%E4%BB%8B%E7%B7%A8-ca9f8092afe1?source=post_page-----a8beeca5f2c8--------------------------------)

AstroNvim は v4.0になったので書き直します。

実はしばらく NvChad に浮気してました。

## Neovim

neovim はさらっと行きます。[](https://neovim.io/?source=post_page-----a8beeca5f2c8--------------------------------)

[Home - Neovim](https://neovim.io/?source=post_page-----a8beeca5f2c8--------------------------------)

## Install Neovim

Plain textcontent\_copy

```
brew install neovim
```

さくっと入ります。

## AstroNvim[](https://astronvim.com/?source=post_page-----a8beeca5f2c8--------------------------------)

[AstroNvim](https://astronvim.com/?source=post_page-----a8beeca5f2c8--------------------------------)

v4.0に update していて変更点はこちらに記載があります。[](https://docs.astronvim.com/configuration/v4_migration/?source=post_page-----a8beeca5f2c8--------------------------------)

[Migration to v4.0](https://docs.astronvim.com/configuration/v4_migration/?source=post_page-----a8beeca5f2c8--------------------------------)

めっちゃ変更されていて、もう Migration と書いてあるけど無理。  
入れ直した方が早そうです。

主に以下の3個に分かれているみたいです。

-   KeyMapping や設定管理や更新などの機能が含まれる AstroCore
    
-   LSP 関連の AstroLSP
    
-   ColorTheme, Highlight, Icons など UserInterface 関連の AstroUI
    

変更箇所が多すぎるので諦めて入れ直しましょう！

## Backup AstroNvim

オフィシャルには Backup の仕方が書かれています。[](https://docs.astronvim.com/?source=post_page-----a8beeca5f2c8--------------------------------#-installation)

[Getting Started](https://docs.astronvim.com/?source=post_page-----a8beeca5f2c8--------------------------------#-installation)

もし AstroNvim がもうすでに入ってるなら以下の Script に適当な名前をつけて実行してください。

Plain textcontent\_copy

```
#!/usr/bin/env bash

declare -x nvim_dir=(
  ${HOME}/.config/nvim
  ${HOME}/.local/share/nvim
  ${HOME}/.local/state/nvim
  ${HOME}/.cache/nvim
)

for d in ${nvim_dir[@]}
do
  if [ -d ${d} ]; then
    echo "make backup: ${d}"
    mv ${d} ${d}.bak
  fi
done
```

## Requirements

ここを参考にしてください。

[Getting Started](https://docs.astronvim.com/?source=post_page-----a8beeca5f2c8--------------------------------#-requirements)

## Nerd Fonts[](https://www.nerdfonts.com/font-downloads?source=post_page-----a8beeca5f2c8--------------------------------)

[Nerd Fonts - Iconic font aggregator, glyphs/icons collection, & fonts patcher](https://www.nerdfonts.com/font-downloads?source=post_page-----a8beeca5f2c8--------------------------------)

macos であれば homebrew にたくさんあります。  
以下のコマンドで検索できます。  
Terminal で使うのは等幅フォント（monospaced font）の方が良いと思われるので勝手に mono で grep してます。

Plain textcontent\_copy

```
brew search nerd-font | grep mono
```

自分はこれを使ってます。[](https://github.com/yuru7/moralerspace?source=post_page-----a8beeca5f2c8--------------------------------)

[GitHub - yuru7/moralerspace: Moralerspace は、欧文フォント Monaspace と日本語フォント IBM Plex Sans JP…](https://github.com/yuru7/moralerspace?source=post_page-----a8beeca5f2c8--------------------------------)

## Install Tree-sitter

さくっと homebrew で入れちゃってください。

Plain textcontent\_copy

```
brew install tree-sitter
```

## Optional Requirements

### Install ripgrep

こちらも homebrew で

Plain textcontent\_copy

```
brew install ripgrep
```

### Install lazygit

こちらも homebrew

Plain textcontent\_copy

```
brew install lazygit
```

### Install go DiskUsage()

こちらも homebrew

Plain textcontent\_copy

```
brew install gdu
```

### Install bottom

こちらも homebrew

Plain textcontent\_copy

```
brew install bottom
```

### Python & Node

これはなんでも良いです。

自分の場合は Python = [Rye](https://rye.astral.sh/), Node = [Volta](https://volta.sh/) で構成しています。[](https://rye.astral.sh/?source=post_page-----a8beeca5f2c8--------------------------------)

## Install AstroNvim

Instalation の Clone the repository にあります。

Plain textcontent\_copy

```
git clone --depth 1 https://github.com/AstroNvim/template ~/.config/nvim
rm -rf ~/.config/nvim/.git
```

## 1st Setup

まずは nvim を起動

Plain textcontent\_copy

```
nvim
```

以下を実行してみましょう。

Plain textcontent\_copy

```
:Lazy check
```

更新がいくつかあると思うので update しましょう。

Plain textcontent\_copy

```
:Lazy update
```

## Configuration

The Starter Template をみるとデフォルトのファイル Tree がわかります。

[Getting Started](https://docs.astronvim.com/?source=post_page-----a8beeca5f2c8--------------------------------#-the-starter-template)

以下のような形になっています。

Plain textcontent\_copy

```
${HOME}/.config/nvim
├── init.lua
├── lazy-lock.json
├── lazyvim.json
├── lua
│  ├── community.lua
│  ├── lazy_setup.lua
│  ├── plugins
│  │  ├── astrocore.lua
│  │  ├── astrolsp.lua
│  │  ├── astroui.lua
│  │  ├── mason.lua
│  │  ├── none-ls.lua
│  │  ├── treesitter.lua
│  │  └── user.lua
│  └── polish.lua
├── neovim.yml
├── README.md
└── selene.toml
```

## AstroCommunity

ここにも記載がある通り、AstroCommunity という Repository がありこれを使って比較的簡単に拡張ができます。[](https://docs.astronvim.com/?source=post_page-----a8beeca5f2c8--------------------------------#-astrocommunity)

[Getting Started](https://docs.astronvim.com/?source=post_page-----a8beeca5f2c8--------------------------------#-astrocommunity)

AstroCommunity の GitHub は以下です。[](https://github.com/AstroNvim/astrocommunity?source=post_page-----a8beeca5f2c8--------------------------------)

[GitHub - AstroNvim/astrocommunity: A community repository of common plugin specifications](https://github.com/AstroNvim/astrocommunity?source=post_page-----a8beeca5f2c8--------------------------------)

[lua/astrocommunity](https://github.com/AstroNvim/astrocommunity/tree/main/lua/astrocommunity) の下に体系化されてたくさんの neovim plugin が存在します。

後で使うので適当に Home Directory あたりに git clone しておきましょう。

Plain textcontent\_copy

```
cd
git clone --depth 1 https://github.com/AstroNvim/astrocommunity
```

いくつか例を紹介します。

## draclula.nvim

私は dracula theme が好きで、あるなら必ず設定しますが AstroNvim でも適応できます。

AstroCommunity にも [lua/astrocommunity/colorscheme/dracula-nvim](https://github.com/AstroNvim/astrocommunity/tree/main/lua/astrocommunity/colorscheme/dracula-nvim) にあります。[](https://github.com/AstroNvim/astrocommunity/tree/main/lua/astrocommunity/colorscheme/dracula-nvim?source=post_page-----a8beeca5f2c8--------------------------------)

[astrocommunity/lua/astrocommunity/colorscheme/dracula-nvim at main · AstroNvim/astrocommunity](https://github.com/AstroNvim/astrocommunity/tree/main/lua/astrocommunity/colorscheme/dracula-nvim?source=post_page-----a8beeca5f2c8--------------------------------)

中にある [init.lua](https://github.com/AstroNvim/astrocommunity/blob/main/lua/astrocommunity/colorscheme/dracula-nvim/init.lua) を見てみるとこのようになっていて

Plain textcontent\_copy

```
return { "Mofiqul/dracula.nvim", lazy = true }
```

これを ${HOME}/.config/nvim/lua/plugins/user.lua に追記すれば動作します。  
私は管理しにくいので試しに ${HOME}/.config/nvim/lua/plugins/dracula-nvim.lua として書き込んだら動いたのでこの形で利用しています。

plugin の導入として別ファイルにするのではなく user.lua に追記すべきなんだと思いますが、backup や recovery などがしにくいので個別にファイルを投入しちゃってます。良いのか悪いのかわかりませんが、まあトラブったらこのやり方を廃止して patch作るしか無いかな。

Plain textcontent\_copy

```
cp \
  ${HOME}/astrocommunity/lua/astrocommunity/colorscheme/dracula-nvim/init.lua \
  ${HOME}/.config/nvim/lua/plugins/dracula-nvim.lua
```

${HOME}/.config/nvim/lua/plugins/astroui.lua の colorscheme を dracula に変更したら dracula colorscheme になります。

Plain textcontent\_copy

```
${HOME}/.config/nvim/lua/plugins/astroui.lua
  -- ~~ 省略 ~~
  opts = {
    -- change colorscheme
    -- colorscheme = "astrodark",
    colorscheme = "dracula", -- ← このように変更
    -- AstroUI allows you to easily modify highlight groups easily for any and all colorschemes
    highlights = {
  -- ~~ 省略 ~~
```

## transparent.nvim

Terminal が透明なので neovim も透明にしたい。[](https://github.com/AstroNvim/astrocommunity/tree/main/lua/astrocommunity/color/transparent-nvim?source=post_page-----a8beeca5f2c8--------------------------------)

[astrocommunity/lua/astrocommunity/color/transparent-nvim at main · AstroNvim/astrocommunity](https://github.com/AstroNvim/astrocommunity/tree/main/lua/astrocommunity/color/transparent-nvim?source=post_page-----a8beeca5f2c8--------------------------------)[](https://github.com/AstroNvim/astrocommunity/blob/main/lua/astrocommunity/color/transparent-nvim/init.lua?source=post_page-----a8beeca5f2c8--------------------------------)

[astrocommunity/lua/astrocommunity/color/transparent-nvim/init.lua at main ·…](https://github.com/AstroNvim/astrocommunity/blob/main/lua/astrocommunity/color/transparent-nvim/init.lua?source=post_page-----a8beeca5f2c8--------------------------------)

init.lua は以下のようになっています。

Plain textcontent\_copy

```
return {
  "xiyaowong/transparent.nvim",
  lazy = false,
  opts = {
    extra_groups = {
      "NormalFloat",
      "NvimTreeNormal",
    },
  },
  config = function(_, opts)
    local transparent = require "transparent"
    transparent.setup(opts)
    transparent.clear_prefix "BufferLine"
    transparent.clear_prefix "NeoTree"
    transparent.clear_prefix "lualine"
  end,
  dependencies = {
    {
      "AstroNvim/astrocore",
      opts = function(_, opts)
        opts.mappings.n["<Leader>uT"] = { "<Cmd>TransparentToggle<CR>", desc = "Toggle transparency" }
        if vim.tbl_get(opts, "autocmds", "heirline_colors") then
          table.insert(opts.autocmds.heirline_colors, {
            event = "User",
            pattern = "TransparentClear",
            desc = "Refresh heirline colors",
            callback = function()
              if package.loaded["heirline"] then require("astroui.status.heirline").refresh_colors() end
            end,
          })
        end
      end,
    },
  },
}
```

こちらを nvim の plugins にコピーします。

Plain textcontent\_copy

```
cp \
  ${HOME}/astrocommunity/lua/astrocommunity/color/transparent-nvim/init.lua \
  ${HOME}/.config/nvim/lua/plugins/transparent-nvim.lua
```

:TransparentEnable で有効にできます。[](https://github.com/xiyaowong/transparent.nvim?tab=readme-ov-file&source=post_page-----a8beeca5f2c8--------------------------------#commands)

[GitHub - xiyaowong/transparent.nvim: Remove all background colors to make nvim transparent](https://github.com/xiyaowong/transparent.nvim?tab=readme-ov-file&source=post_page-----a8beeca5f2c8--------------------------------#commands)

## im-select

im-select はとても便利で、これなくしては生活ができないくらい強力な plugin です。  
編集モードから抜けると自動的に半角にしてくれます。

[](https://github.com/keaising/im-select.nvim?source=post_page-----a8beeca5f2c8--------------------------------)[GitHub - keaising/im-select.nvim: Switch Input Method automatically depends on Neovim’s edit mode](https://github.com/keaising/im-select.nvim?source=post_page-----a8beeca5f2c8--------------------------------)

Plain textcontent\_copy

```
Install im-select
```

まず im-select を Install します。  
普通に homebrew にあります。

Plain textcontent\_copy

```
brew tap daipeihust/tap
brew install im-select
```

[](https://github.com/keaising/im-select.nvim?tab=readme-ov-file&source=post_page-----a8beeca5f2c8--------------------------------#2-install-and-setup-this-plugin)[GitHub - keaising/im-select.nvim: Switch Input Method automatically depends on Neovim’s edit mode](https://github.com/keaising/im-select.nvim?tab=readme-ov-file&source=post_page-----a8beeca5f2c8--------------------------------#2-install-and-setup-this-plugin)

自分は macos なので、ここに書いてあるとおり  
${HOME}/.config/nvim/lua/plugins/im-select.lua として保存します。

Google Japanese Input を利用しているので default\_im\_select を以下にします。

Plain textcontent\_copy

```
default_im_select = “com.google.inputmethod.Japanese.Roman”,
```

Plain textcontent\_copy

```
{
    "keaising/im-select.nvim",
    config = function()
        require('im_select').setup({
            -- IM will be set to `default_im_select` in `normal` mode
            -- For Windows/WSL, default: "1033", aka: English US Keyboard
            -- For macOS, default: "com.apple.keylayout.ABC", aka: US
            -- For Linux, default:
            --               "keyboard-us" for Fcitx5
            --               "1" for Fcitx
            --               "xkb:us::eng" for ibus
            -- You can use `im-select` or `fcitx5-remote -n` to get the IM's name
            default_im_select  = "com.google.inputmethod.Japanese.Roman",

            -- Can be binary's name, binary's full path, or a table, e.g. 'im-select',
            -- '/usr/local/bin/im-select' for binary without extra arguments,
            -- or { "AIMSwitcher.exe", "--imm" } for binary need extra arguments to work.
            -- For Windows/WSL, default: "im-select.exe"
            -- For macOS, default: "im-select"
            -- For Linux, default: "fcitx5-remote" or "fcitx-remote" or "ibus"
            default_command = "im-select.exe",

            -- Restore the default input method state when the following events are triggered
            set_default_events = { "VimEnter", "FocusGained", "InsertLeave", "CmdlineLeave" },

            -- Restore the previous used input method state when the following events
            -- are triggered, if you don't want to restore previous used im in Insert mode,
            -- e.g. deprecated `disable_auto_restore = 1`, just let it empty
            -- as `set_previous_events = {}`
            set_previous_events = { "InsertEnter" },

            -- Show notification about how to install executable binary when binary missed
            keep_quiet_on_no_binary = false,

            -- Async run `default_command` to switch IM or not
            async_switch_im = true
        })
    end,
}
```

## rendar-markdown.nvim

markdown viewer はいろいろありますが、今のところこれを使っています。  
CLI で確認できる glow を利用したものもありますが、フローティング表示で lua の config に style で glow の style JSON を適応しても dracula theme が適応されないので使うのやめました。

[](https://github.com/AstroNvim/astrocommunity/tree/main/lua/astrocommunity/markdown-and-latex/render-markdown-nvim?source=post_page-----a8beeca5f2c8--------------------------------)[astrocommunity/lua/astrocommunity/markdown-and-latex/render-markdown-nvim at main ·…](https://github.com/AstroNvim/astrocommunity/tree/main/lua/astrocommunity/markdown-and-latex/render-markdown-nvim?source=post_page-----a8beeca5f2c8--------------------------------)

[](https://github.com/MeanderingProgrammer/render-markdown.nvim?source=post_page-----a8beeca5f2c8--------------------------------)[GitHub - MeanderingProgrammer/render-markdown.nvim: Plugin to improve viewing Markdown files in…](https://github.com/MeanderingProgrammer/render-markdown.nvim?source=post_page-----a8beeca5f2c8--------------------------------)

先程 clone した astrocommunity からコピーしてきます。

Plain textcontent\_copy

```
cp \
  ${HOME}/astrocommunity/lua/astrocommunity/markdown-and-latex/render-markdown-nvim/init.lua \
  ${HOME}/.config/nvim/lua/plugins/render-markdown-nvim.lua
```

これで使えるようになります。

Commands は以下にあります。

[](https://github.com/MeanderingProgrammer/render-markdown.nvim?tab=readme-ov-file&source=post_page-----a8beeca5f2c8--------------------------------#commands)[GitHub - MeanderingProgrammer/render-markdown.nvim: Plugin to improve viewing Markdown files in…](https://github.com/MeanderingProgrammer/render-markdown.nvim?tab=readme-ov-file&source=post_page-----a8beeca5f2c8--------------------------------#commands)

:RenderMarkdown toggle で enable/disable の切り替えができます。

m️ermaid に対応してるのあったら誰か教えてください。

## nvcheatsheet-nvim

NvChad で知った plugins です。  
AstroCommunity にもあったので入れています。[](https://github.com/AstroNvim/astrocommunity/tree/main/lua/astrocommunity/keybinding/nvcheatsheet-nvim?source=post_page-----a8beeca5f2c8--------------------------------)

[astrocommunity/lua/astrocommunity/keybinding/nvcheatsheet-nvim at main · AstroNvim/astrocommunity](https://github.com/AstroNvim/astrocommunity/tree/main/lua/astrocommunity/keybinding/nvcheatsheet-nvim?source=post_page-----a8beeca5f2c8--------------------------------)

先程 clone した astrocommunity からコピーしてきます。

Plain textcontent\_copy

```
cp \
  ${HOME}/astrocommunity/lua/astrocommunity/keybinding/nvcheatsheet-nvim/init.lua \
  ${HOME}/.config/nvim/lua/plugins/nvcheatsheet-nvim.lua
```

これで有効にできます。  
astrocommunity のは key mapping が F1 key になっててちょっと使いにくいので自分は変えました。

## NvChad から AstroNvim に戻ってきた感想

NvChad は軽いって言われてるけど、そこまで気にならないかな  
確かに AstroNvim で画面描画を切り替える toggle したりするとほんの一瞬カクついたりはするけど、日常的に困るほどではない。

NvChad で感動したのは Nvcheatsheet！  
これは触りたてでわからないことだらけでめちゃくちゃ便利だった。

[](https://github.com/smartinellimarco/nvcheatsheet.nvim?source=post_page-----a8beeca5f2c8--------------------------------)[GitHub - smartinellimarco/nvcheatsheet.nvim: NvChad cheatsheet as a standalone neovim plugin](https://github.com/smartinellimarco/nvcheatsheet.nvim?source=post_page-----a8beeca5f2c8--------------------------------)

とはいうものの、これだけ多機能なのにこのまとまりの良さは AstroNvim の素敵なところかもしれないですね。

ターミナル環境について他の記事も書いているので、よろしければこちらもご覧ください！  
[『ターミナルがダサいとモテない』シリーズ一覧](https://blog.grasys.io/tags/series-terminal-update)

転載：[ターミナルがダサいとモテない。neovim + AstroNvim v4.0紹介編（Medium）](https://medium.com/@yusuke_h/%E3%82%BF%E3%83%BC%E3%83%9F%E3%83%8A%E3%83%AB%E3%81%8C%E3%83%80%E3%82%B5%E3%81%84%E3%81%A8%E3%83%A2%E3%83%86%E3%81%AA%E3%81%84-neovim-astronvim-v4-0%E7%B4%B9%E4%BB%8B%E7%B7%A8-a8beeca5f2c8)

## この記事を書いた人

[![](/_astro/yusukeh.BvUd2yKE_1mQ6Fp.webp)](/authors/yusukeh/)

### [yusukeh](/authors/yusukeh/)

Fly high. Think deep. Move fast. Go far.🦅

-   [Medium](https://medium.com/@yusukeh "Medium")

[プロフィールと記事一覧](/authors/yusukeh/)