-- https://neovim.io/doc/user/lua-guide.html
vim.opt.completeopt = { "menuone", "noinsert", "noselect" }
vim.opt.swapfile = false
vim.opt.title = true
vim.opt.virtualedit = "block"
vim.opt.whichwrap = "<,>,[,]"
-- Case character
vim.opt.ignorecase = true
vim.opt.smartcase = true
-- Line number
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.scrolloff = 4
-- Tab
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
-- Wrap
vim.opt.breakindent = true
-- Clipboard support
vim.opt.clipboard = "unnamedplus"
-- Truecolor
if vim.env.COLORTERM == "truecolor" then
vim.opt.termguicolors = true
end
-- Mouse support
vim.opt.mouse = "a"
-- Workaround
-- https://github.com/neovim/neovim/issues/16416
vim.keymap.set("i", "", "")
-- Keymap
vim.keymap.set("n", ";", "", { remap = true })
vim.keymap.set("n", "q", ":q")
-- Keymap for plugin
vim.keymap.set("n", "f", ":FZF")
vim.keymap.set("n", "rg", ":FZFRg")
vim.keymap.set("n", "", ":NvimTreeToggle")
vim.keymap.set("n", "n", ":NvimTreeFindFile")
vim.keymap.set("n", "tr", ":lua MiniTrailspace.trim()")
vim.keymap.set("n", "", ":GoRename")
vim.keymap.set("n", "gf", ":GoFillStruct:w")
vim.keymap.set("n", "gat", ":GoAlternate")
vim.keymap.set("n", "gt", ":GoTest")
vim.keymap.set("n", "gr", ":GoReferrers")
vim.keymap.set("n", "gcv", ":GoCoverage")
vim.keymap.set("n", "gdd", ":GoDeclsDir")
-- Use fzf
vim.opt.rtp:append({ "~/.fzf" })
-- Use plugin fzf.vim
vim.g.fzf_command_prefix = "FZF"
-- Use plugin nvim-tree.lua
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- Use plugin neoformat
vim.g.neoformat_basic_format_trim = 1
vim.g.neoformat_enabled_go = { "gofumpt" }
vim.g.shfmt_opt = "-ci"
-- Use plugin vim-go
vim.g.go_gopls_gofumpt = 1
vim.g.go_doc_popup_window = 1
-- Use plugin copilot
vim.g.copilot_filetypes = {
["*"] = false,
c = true,
cpp = true,
go = true,
java = true,
json = true,
lua = true,
make = true,
markdown = true,
proto = true,
python = true,
toml = true,
yaml = true,
}
-- https://github.com/folke/lazy.nvim
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)
require("lazy").setup({
-- https://github.com/junegunn/fzf.vim
"junegunn/fzf.vim",
-- https://github.com/nvim-lualine/lualine.nvim
{
"nvim-lualine/lualine.nvim",
config = function()
require("lualine").setup({
options = {
icons_enabled = false,
theme = "auto",
-- theme = "iceberg",
-- theme = "catppuccin",
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
},
extensions = { "fzf", "nvim-tree" },
})
-- Disable showmode when use lualine
vim.opt.showmode = false
end,
},
-- https://github.com/nvim-tree/nvim-tree.lua
{
"nvim-tree/nvim-tree.lua",
config = function()
require("nvim-tree").setup({
renderer = {
group_empty = true,
icons = {
show = {
file = false,
folder = false,
folder_arrow = false,
git = false,
modified = false,
},
},
},
filters = {
custom = { "^\\.git$", "^\\.DS_Store", "\\.out", "\\.class" },
},
})
end,
},
-- https://github.com/lukas-reineke/indent-blankline.nvim
{
"lukas-reineke/indent-blankline.nvim",
config = function()
require("indent_blankline").setup()
end,
},
-- https://github.com/airblade/vim-gitgutter
"airblade/vim-gitgutter",
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-bracketed.md
{
"echasnovski/mini.bracketed",
config = function()
require("mini.bracketed").setup({
comment = { suffix = "", options = {} },
})
end,
},
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-comment.md
{
"echasnovski/mini.comment",
config = function()
require("mini.comment").setup()
end,
},
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-cursorword.md
{
"echasnovski/mini.cursorword",
config = function()
require("mini.cursorword").setup()
end,
},
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-surround.md
{
"echasnovski/mini.surround",
config = function()
require("mini.surround").setup()
end,
},
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-trailspace.md
{
"echasnovski/mini.trailspace",
config = function()
require("mini.trailspace").setup()
end,
},
-- Colorschemes
-- https://github.com/cocopon/iceberg.vim
"cocopon/iceberg.vim",
-- https://github.com/projekt0n/github-nvim-theme
"projekt0n/github-nvim-theme",
-- https://github.com/nyoom-engineering/oxocarbon.nvim
"nyoom-engineering/oxocarbon.nvim",
-- https://github.com/catppuccin/nvim
{
"catppuccin/nvim",
name = "catppuccin",
config = function()
require("catppuccin").setup({
flavour = "mocha",
})
end,
},
-- Programming languages
-- https://github.com/sbdchd/neoformat
"sbdchd/neoformat",
-- https://github.com/nvim-treesitter/nvim-treesitter
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
},
-- https://github.com/nvim-treesitter/nvim-treesitter-context
{
"nvim-treesitter/nvim-treesitter-context",
config = function()
require("treesitter-context").setup({
enable = true,
max_lines = 2,
})
end,
},
-- https://github.com/fatih/vim-go
"fatih/vim-go",
-- https://github.com/github/copilot.vim
"github/copilot.vim",
})
-- vim.api.nvim_command("colorscheme iceberg")
vim.api.nvim_command("colorscheme oxocarbon")
-- vim.api.nvim_command("colorscheme github_dark")
-- vim.api.nvim_command("colorscheme catppuccin")