Skip to content
閲覧中:
setup
Bash
which stylua
which black
which goimports
which gopls
which pyright
which bash-language-server
which shfmt
which clang-format
which jq
which sql-formatter
which prettierd
which ctags

Ubuntu 24 + Neovim 開発環境

Neovim で使用する formatter / LSP / ツール追加手順まとめ

あなたの現在の構成:

  • Ubuntu 24
  • Neovim 0.13-dev 系
  • lazy.nvim
  • conform.nvim
  • mason.nvim
  • ~/.npm-global
  • ~/go/bin
  • ~/.cargo/bin
  • Python venv/uv 環境

に合わせています。


1. PATH の整理

~/.bash_aliases

Bash
# PATH設定
export PATH="$HOME/.cargo/bin:$PATH"
export PATH="$HOME/go/bin:$PATH"
export PATH="$HOME/.npm-global/bin:$PATH"
export PATH="$HOME/.local/bin:$HOME/scripts:$PATH"

# Rust
source "$HOME/.cargo/env"

反映:

Bash
source ~/.bash_aliases
source ~/.bashrc

確認:

Bash
echo $PATH

2. Rust 環境(stylua 用)

公式 rustup インストール

Bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

反映:

Bash
source "$HOME/.cargo/env"

確認:

Bash
cargo --version
rustc --version

stylua

Lua formatter

Bash
cargo install stylua

確認:

Bash
which stylua
stylua --version

3. Python formatter

black

現在の venv / uv 環境で:

Bash
uv tool install black

または:

Bash
pip install black

確認:

Bash
which black
black --version

4. Go

goimports

Go formatter

Bash
go install golang.org/x/tools/cmd/goimports@latest

gopls

Go LSP

Bash
go install golang.org/x/tools/gopls@latest

確認:

Bash
which goimports
which gopls

5. npm 系ツール

npm global path

Bash
npm config set prefix ~/.npm-global

~/.bash_aliases

Bash
export PATH="$HOME/.npm-global/bin:$PATH"

反映:

Bash
source ~/.bash_aliases

pyright

Python LSP

Bash
npm install -g pyright

bash-language-server

Bash LSP

Bash
npm install -g bash-language-server

sql-formatter

SQL formatter

Bash
npm install -g sql-formatter

prettierd

JS/TS/CSS/HTML formatter

Bash
npm install -g @fsouza/prettierd

確認

Bash
which pyright
which bash-language-server
which sql-formatter
which prettierd

6. apt 系

shfmt

Shell formatter

Bash
sudo apt install -y shfmt

clang-format

C/C++/Java formatter

Bash
sudo apt install -y clang-format

jq

JSON formatter

Bash
sudo apt install -y jq

確認

Bash
which shfmt
which clang-format
which jq

7. 最終確認

Bash
which stylua
which black
which goimports
which gopls
which pyright
which bash-language-server
which shfmt
which clang-format
which jq
which sql-formatter
which prettierd

8. Neovim 側確認

Neovim 起動:

Bash
nvim

確認:

VimL
:checkhealth

特に:

  • mason
  • lsp
  • conform
  • treesitter

を確認。


9. 現在おすすめの formatter 構成

言語 formatter
Lua stylua
Python black
Go goimports
Shell shfmt
JSON jq
SQL sql-formatter
JS/TS prettierd
C/C++ clang-format
Java clang-format or google-java-format

10. あなたの構成との相性

現在のあなたの環境:

  • Neovim 0.13-dev
  • conform.nvim
  • lazy.nvim
  • mason.nvim
  • Ubuntu 24
  • uv
  • cargo
  • npm-global

はかなりモダンで強い構成です。

特に:

  • Rust 系 formatter
  • Go 系 LSP
  • npm 系 LSP
  • Python uv
  • format on save

との相性が良いです。