Skip to main content

Neovim


설치

sudo snap install --beta nvim --classic
sudo snap alias nvim vim

NvChad

git clone https://github.com/NvChad/NvChad ~/.config/nvim --depth 1 && nvim
.config/nvim
├── init.lua
├── lazy-lock.json
├── LICENSE
└── lua/
├── core/
│ ├── bootstrap.lua
│ ├── default_config.lua
│ ├── init.lua
│ ├── mappings.lua
│ └── utils.lua
├── custom/
│ ├── chadrc.lua
│ ├── configs/
│ │ ├── lspconfig.lua
│ │ ├── null-ls.lua
│ │ └── overrides.lua
│ ├── highlights.lua
│ ├── init.lua
│ ├── mappings.lua
│ ├── plugins.lua
│ └── README.md
└── plugins/
├── configs/
│ ├── cmp.lua
│ ├── lazy_nvim.lua
│ ├── lspconfig.lua
│ ├── mason.lua
│ ├── nvimtree.lua
│ ├── others.lua
│ ├── telescope.lua
│ └── treesitter.lua
└── init.lua

~/.config/nvim/lua/core/default_config.lua~/.config/nvim/lua/custom/chadrc.lua를 병합한 설정이 사용됩니다.

.config/nvim/lua/custom

키 매핑

~/.config/nvim/lua/core/mappings.lua~/.config/nvim/lua/custom/mappings.lua를 병합한 설정이 사용됩니다.


  • <C>: Ctrl
  • <A>: Alt
  • <S>: Shift
  • <leader>: Space
  • :, ;: 커맨드

LSP

~/.config/nvim/lua/custom/configs/lspconfig.lua
local on_attach = require("plugins.configs.lspconfig").on_attach
local capabilities = require("plugins.configs.lspconfig").capabilities

local lspconfig = require "lspconfig"
local root_pattern = lspconfig.util.root_pattern

lspconfig.gopls.setup {
on_attach = on_attach,
capabilities = capabilities,
root_dir = root_pattern("go.mod")
}

Nvterm

  • <A-h>: 수평 터미널 토글
  • <A-v>: 수직 터미널 토글
  • <A-i>: 터미널 모달 토글
  • <leader>pt: 터미널 목록

NvCheatsheet

  • <leader>ch

Normal mode

  • :h key-notation: key notation

  • u: undo
  • <C-R>: redo

  • =: align ex) gg=G, =3
  • <C-K>: clang-format (설정한 경우)

  • :! <command>: shell에서 <command>를 실행합니다.
  • :r[ead]! <command>: stdout -> vim
  • :w[rite]! <command>: vim -> stdin
  • :sh: 쉘로 가기
  • <C-D>: 쉘에서 돌아오기

  • <C-A>: 숫자 증가
  • <C-X>: 숫자 감소

Visual mode

  • u: 소문자로 변환
  • U: 대문자로 변환