Tutorials

Neovim Setup from Zero — From an Ordinary Terminal to a Mainstay Code Editor

Neovim Setup from Zero — From an Ordinary Terminal to a Mainstay Code Editor

A few years ago, I was still very comfortable with VS Code. Open the project, click on the sidebar, install the extension, and everything works. But as time went on, I started to feel like something was bothering me: startup was starting to get heavy, RAM was being used more and more frequently, and my hands were switching between keyboard and mouse too often. It feels like writing with a good pen, but having to stop every few minutes to sharpen it.

Then I tried Neovim. The first time I opened it, all that appeared was a black screen with small text and strange notifications. I almost gave up in the third minute. But after understanding that Neovim is not a ready-to-use editor but a framework that must be assembled, everything makes sense. This article is a record of my journey in building Neovim from zero to becoming an everyday mainstay.

Why Neovim, Not Another Editor?

Neovim is a fork of Vim that focuses on extensibility and modern integration. How is it different from classic Vim? Neovim has a Lua-based architecture, a cleaner API, and a very active plugin community. But what I personally feel most about is speed and consistency.

Imagine a work desk. VS Code is like a desk with lots of drawers, a lamp, and a built-in organizer. Just use it. Neovim is like a blank table with a basic set of tools. You decide what is necessary and what is not. The result? A desk that suits your way of working.

Other benefits:

  • Lightweight: Open large files without stuttering.
  • Keyboard-centric: Almost everything can be done without a mouse.
  • Portable: Configuration is stored in ~/.config/nvim, easy to carry to other servers.
  • Terminal-native: Suitable for headless or SSH servers.

Installation on Linux

Debian-based distributions usually have Neovim in the repositories, but the version is often left behind. For the latest features, I prefer to install from .deb or AppImage. Here's the method I use most often:

# Install dari repositori (versi lebih tua)
sudo apt update && sudo apt install neovim

# Atau download .deb terbaru dari GitHub release
cd ~/Downloads
wget https://github.com/neovim/neovim/releases/download/stable/nvim-linux64.deb
sudo dpkg -i nvim-linux64.deb

# Verifikasi
nvim --version

After installation, create a configuration directory:

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

Neovim reads the main configuration from ~/.config/nvim/init.lua. Previously the format was init.vim, but currently init.lua is a more flexible standard.

First Configuration: init.lua

Before installing a plugin, I usually set the basic options first. This file is like the foundation of a house: if it is sturdy, the additions on top of it will be more stable.

-- ~/.config/nvim/init.lua
vim.opt.number = true          -- Tampilkan nomor baris
vim.opt.relativenumber = true  -- Nomor relatif untuk navigasi cepat
vim.opt.tabstop = 2            -- Lebar tab
vim.opt.shiftwidth = 2         -- Indentasi otomatis
vim.opt.expandtab = true       -- Konversi tab jadi spasi
vim.opt.smartindent = true     -- Indentasi pintar
vim.opt.wrap = false           -- Jangan wrap panjang baris
vim.opt.termguicolors = true   -- Warna 24-bit
vim.opt.clipboard = "unnamedplus" -- Integrasi clipboard sistem
vim.g.mapleader = " "          -- Leader key: spasi

-- Load modul konfigurasi
require("config.keymaps")
require("config.options")

The last two lines call a separate file. Separating configurations makes them easier to manage when there are a lot of them.

Plugin Manager with lazy.nvim

There are several plugin managers for Neovim, but lazy.nvim is my favorite because of its performance and modern way of working. Plugins are only loaded when needed (lazy loading), so startup remains fast.

First, install lazy.nvim:

git clone --filter=blob:none https://github.com/folke/lazy.nvim.git \
  --branch=stable ~/.local/share/nvim/lazy/lazy.nvim

Then create a ~/.config/nvim/init.lua file to contain all plugins from the lua/plugins folder:

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", lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup("plugins")

With this setup, every Lua file inside ~/.config/nvim/lua/plugins will be considered a plugin definition.

Mandatory Plugins for Productivity

Here are the plugins that I use almost every day. They're not the only options, but the combination is enough to make Neovim feel like a modern editor.

1. Telescope (Fuzzy Finder)

-- lua/plugins/telescope.lua
return {
  'nvim-telescope/telescope.nvim',
  dependencies = { 'nvim-lua/plenary.nvim' },
  config = function()
    local builtin = require('telescope.builtin')
    vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
    vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
    vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
  end
}

With Space + ff, I can search for files. Space + fg to search for text throughout the project. This replaces the explorer sidebar and search panel.

2. Treesitter (Smart Parsing)

-- lua/plugins/treesitter.lua
return {
  'nvim-treesitter/nvim-treesitter',
  build = ':TSUpdate',
  config = function()
    require('nvim-treesitter.configs').setup {
      ensure_installed = { "lua", "python", "javascript", "html", "css" },
      highlight = { enable = true },
      indent = { enable = true },
    }
  end
}

Treesitter makes syntax highlighting more accurate and helps with features like automatic indentation and text objects.

3. LSP and Autocompletion

-- lua/plugins/lsp.lua
return {
  'neovim/nvim-lspconfig',
  dependencies = {
    'hrsh7th/nvim-cmp',
    'hrsh7th/cmp-nvim-lsp',
    'L3MON4D3/LuaSnip',
  },
  config = function()
    local lspconfig = require('lspconfig')
    local capabilities = require('cmp_nvim_lsp').default_capabilities()
    lspconfig.lua_ls.setup { capabilities = capabilities }
    lspconfig.pyright.setup { capabilities = capabilities }
  end
}

LSP provides features such as go-to-definition, diagnostics, and hover documentation. nvim-cmp handles autocompletion.

4. A Theme That's Easy on the Eyes

-- lua/plugins/theme.lua
return {
  'catppuccin/nvim',
  name = 'catppuccin',
  priority = 1000,
  config = function()
    vim.cmd.colorscheme 'catppuccin-mocha'
  end
}

Keymap that keeps your hands from moving far

One of the reasons for moving to Neovim was ergonomics. I want the hand to stay on home row. Some keymaps that I use:

-- lua/config/keymaps.lua
vim.keymap.set('n', '<leader>w', ':w<CR>', { desc = 'Simpan file' })
vim.keymap.set('n', '<leader>q', ':q<CR>', { desc = 'Tutup buffer' })
vim.keymap.set('n', '<leader>h', '<C-w>h', { desc = 'Pindah ke split kiri' })
vim.keymap.set('n', '<leader>j', '<C-w>j', { desc = 'Pindah ke split bawah' })
vim.keymap.set('n', '<leader>k', '<C-w>k', { desc = 'Pindah ke split atas' })
vim.keymap.set('n', '<leader>l', '<C-w>l', { desc = 'Pindah ke split kanan' })

I use the space bar for the leader key because it is easy to reach with my thumb. There is no need to rotate the wrist as when reaching the Ctrl + Shift + ... combination in a conventional editor.

Transitioning from VS Code: Survival Tips

The first week of moving to Neovim felt like learning to retype. I often get frustrated because things are usually one click so I need to remember the shortcut. But there are some strategies that help me survive:

  • Don't migrate everything at once: Start with configuration files or small scripts, not the main project.
  • Learn editing modals little by little: Normal mode, insert mode, visual mode. Focus on basic navigation first.
  • Create shortcut notes: I write down my favorite keymaps in notes until my muscles remember.
  • Use vimtutor: Just run it in the terminal, practice 30 minutes a day for a week.
  • Don't be a perfectionist: The configuration doesn't have to be perfect from day one. I still often simplify my setup.

Conclusion

Neovim is not the answer for everyone. If you need an editor that runs straight away without configuration, VS Code or IDE is still a reasonable choice. But if you want an editor that is fully customizable, works quickly in the terminal, and reduces hand switching between keyboard and mouse, Neovim is worth a try.

For me, the process of assembling Neovim is actually part of the learning process. Every plugin installed, every keymap added, is a decision about how I want to work. In the end, what I gained wasn't just a new editor, but a deeper understanding of the tools I use every day.

If you've tried Neovim, what's your favorite plugin? Or are you still unsure about moving? Write in the comments column.