[NeoVim] 설치 및 설정

2024. 3. 5. 23:37ETC/IDE setting

1. Neovim 설치

 

Home - Neovim

News Vim Boss   2023.08 What Neovim shipped in 2022   2022.12 More… Impressions "Neovim is exactly what it claims to be. It fixes every issue I have with Vim." —Geoff Greer "Lua for plugins and config is SO good. I love it." —Oliver Caldwell "A n

neovim.io

 


2. Neovim 기본 설정

 

가. 기본 config 파일 생성

mkdir -p ~/.config/nvim/lua/

touch ~/.config/nvim/lua/options.lua

touch ~/.config/nvim/init.lua

 

나. options.lua

local options = {
  backup = false,                          -- creates a backup file
  clipboard = "unnamedplus",               -- allows neovim to access the system clipboard
  cmdheight = 2,                           -- more space in the neovim command line for displaying messages
  completeopt = { "menuone", "noselect" }, -- mostly just for cmp
  conceallevel = 0,                        -- so that `` is visible in markdown files
  fileencoding = "utf-8",                  -- the encoding written to a file
  hidden = true,                           -- required to keep multiple buffers and open multiple buffers
  hlsearch = true,                         -- highlight all matches on previous search pattern
  ignorecase = true,                       -- ignore case in search patterns
  mouse = "a",                             -- allow the mouse to be used in neovim
  pumheight = 10,                          -- pop up menu height
  showmode = false,                        -- we don't need to see things like -- INSERT -- anymore
  showtabline = 2,                         -- always show tabs
  smartcase = true,                        -- smart case
  smartindent = true,                      -- make indenting smarter again
  splitbelow = true,                       -- force all horizontal splits to go below current window
  splitright = true,                       -- force all vertical splits to go to the right of current window
  swapfile = false,                        -- creates a swapfile
  termguicolors = true,                    -- set term gui colors (most terminals support this)
  timeoutlen = 100,                        -- time to wait for a mapped sequence to complete (in milliseconds)
  undofile = true,                         -- enable persistent undo
  updatetime = 300,                        -- faster completion (4000ms default)
  writebackup = false,                     -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
  expandtab = true,                        -- convert tabs to spaces
  shiftwidth = 2,                          -- the number of spaces inserted for each indentation
  tabstop = 2,                             -- insert 2 spaces for a tab
  cursorline = true,                       -- highlight the current line
  number = true,                           -- set numbered lines
  relativenumber = false,                  -- set relative numbered lines
  numberwidth = 4,                         -- set number column width to 2 {default 4}
  signcolumn = "yes",                      -- always show the sign column, otherwise it would shift the text each time
  wrap = false,                            -- display lines as one long line
  scrolloff = 8,                           -- is one of my fav
  sidescrolloff = 8,
  guifont = "monospace:h17",               -- the font used in graphical neovim applications
}

vim.opt.shortmess:append "c"

for k, v in pairs(options) do
  vim.opt[k] = v
end

vim.cmd "set whichwrap+=<,>,[,],h,l"

 

다. init.lua

require("options")

vim의 .vimrc의 역할을 수행한다.

 


3. Neovim plugin 설치

 

 

Top Neovim Plugins in 2024

List of the most popular Neovim plugins by total number of installs across 1000+ tracked Neovim configurations on Dotfyle.

dotfyle.com

 

init.lua에 추가만 하면 쉽게 플러그인을 사용할 수 있다.

-- add lazynvim as plugin-manager --
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

-- add plugins below --

require("lazy").setup({
  "oxfist/night-owl.nvim",
  lazy = false, -- make sure we load this during startup if it is your main colorscheme
  priority = 1000, -- make sure to load this before all the other start plugins
  config = function()
    -- load the colorscheme here
    vim.cmd.colorscheme("night-owl")
  end,
})

-- end plugin --

-- my option --

require("options") -- ./lua/options.lua

'ETC > IDE setting' 카테고리의 다른 글

IntelliJ 초기 설정  (0) 2024.12.08
2022-04-09 Vim_setting_1  (0) 2022.04.09