본문 바로가기
C.W.K.
Stream
Lesson 03 of 04 · published

lazy.nvim 으로 plugin 관리

~14 min · neovim, lazy, plugins

Level 0갇힌 자
0 XP0/35 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete

Neovim plugin의 현대 표준

lazy.nvim (folke/lazy.nvim) 이 2026년 Neovim의 사실상 표준 plugin 매니저야. 이벤트나 명령, 파일 종류에 맞춰 늦게 불러오는 lazy-loading, 시작할 때 알아서 설치해주기, lockfile로 버전 고정하기, 상태와 성능을 볼 수 있는 깔끔한 UI까지 다 갖췄어.

Bootstrap — 표준 조각

bootstrap은 init.lua 맨 위에 놔. lazy.nvim이 깔려 있는지 보고, 없으면 git clone 해와. 그다음 require("lazy").setup(plugins)가 넘겨받아서 나머지를 전부 설치해.

Plugin spec

plugin 하나가 Lua table이야. 문자열 (GitHub의 user/repo) 하나에 선택 항목들을 얹는 형태지.

  • dependencies — 같이 필요한 다른 plugin.
  • config — plugin을 불러온 뒤 실행할 함수 (보통 require("plugin").setup({...})).
  • opts — config가 require("plugin").setup(opts)뿐일 때 쓰는 줄임 형태.
  • event — 특정 이벤트에 불러오기 (BufReadPost, InsertEnter, VeryLazy).
  • cmd — 그 명령을 처음 쓸 때 불러오기.
  • ft — 특정 파일 종류에서만 불러오기.
  • keys — 그 키를 처음 누를 때 불러오기.
  • build — 설치 후 실행할 셸 명령 (예를 들면 treesitter의 :TSUpdate).

Starter plugin 묶음

plugin 여섯 개면 사람들이 까는 것의 8할쯤은 덮여.

  • nvim-treesitter — AST 기반의 정확한 syntax 표시, 구조 단위 text object.
  • telescope.nvim — 파일, grep, buffer, LSP 심볼까지 뭐든 찾아주는 fuzzy finder.
  • nvim-lualine — 예쁜 status 줄.
  • which-key.nvim — 타이핑하는 동안 leader keymap을 메뉴로 띄워줘.
  • nvim-autopairs — 괄호랑 따옴표를 알아서 닫아줘.
  • nvim-surround — 감싸는 짝에 ys / ds / cs로 작업.
:Lazy 안에서 살아. lazy.nvim UI가 plugin마다 불러오는 데 걸린 시간을 보여주고, update와 clean과 sync를 다 할 수 있고, 깨진 것도 짚어줘. 설치가 끝나면 :Lazy profile을 돌려봐. 어떤 plugin이 시작 시간을 잡아먹고 있는지 정확히 나와.

Code

lazy.nvim bootstrap — init.lua 맨 위에 그대로 붙여·lua
-- lazy.nvim bootstrap
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
  vim.fn.system({
    "git", "clone", "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

-- plugin 키 작동하게 leader 를 lazy.setup 전에 박아
vim.g.mapleader = " "
vim.g.maplocalleader = " "
Starter plugin 셋·lua
require("lazy").setup({
  -- Treesitter — 더 나은 하이라이팅 + textobjects
  {
    "nvim-treesitter/nvim-treesitter",
    build = ":TSUpdate",
    config = function()
      require("nvim-treesitter.configs").setup({
        ensure_installed = {
          "lua", "python", "javascript", "typescript",
          "html", "css", "json", "yaml", "bash",
          "markdown", "markdown_inline", "vim", "vimdoc",
        },
        highlight = { enable = true },
        indent = { enable = true },
      })
    end,
  },

  -- Telescope — fuzzy finder
  {
    "nvim-telescope/telescope.nvim",
    dependencies = { "nvim-lua/plenary.nvim" },
    keys = {
      { "<leader>ff", "<cmd>Telescope find_files<CR>", desc = "Find files" },
      { "<leader>fg", "<cmd>Telescope live_grep<CR>", desc = "Live grep" },
      { "<leader>fb", "<cmd>Telescope buffers<CR>", desc = "Buffers" },
      { "<leader>fh", "<cmd>Telescope help_tags<CR>", desc = "Help" },
    },
  },

  -- Status 라인
  { "nvim-lualine/lualine.nvim", opts = { options = { theme = "auto" } } },

  -- Which-key (leader 팝업)
  { "folke/which-key.nvim", event = "VeryLazy", opts = {} },

  -- Autopair
  { "windwp/nvim-autopairs", event = "InsertEnter", config = true },

  -- Surround
  { "kylechui/nvim-surround", event = "VeryLazy", config = true },
})
Lazy.nvim UI 명령·vim
:Lazy           " UI 열기
:Lazy sync      " install + update + clean
:Lazy update    " update 만
:Lazy clean     " 안 쓰는 plugin 제거
:Lazy profile   " plugin 별 시작 타이밍
:Lazy log       " 최근 update 보기

External links

Exercise

bootstrap 조각과 starter plugin 묶음을 init.lua에 넣어. Neovim을 다시 켜면 lazy.nvim이 알아서 clone 하고 전부 설치할 거야. :Lazy를 열어서 여섯 개가 다 올라왔는지 확인하고, <Space>ff를 눌러 telescope의 파일 찾기를 시험해봐. 뭔가 실패하면 :Lazy log의 아래쪽을 읽어 — 에러 메시지가 꽤 친절해.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.