263 lines
5.8 KiB
Lua
263 lines
5.8 KiB
Lua
-- 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", "<C-c>", "<Esc>")
|
|
|
|
-- Keymap
|
|
vim.keymap.set("n", ";", "<leader>", { remap = true })
|
|
vim.keymap.set("n", "q", ":q<CR>")
|
|
|
|
-- Keymap for plugin
|
|
vim.keymap.set("n", "<leader>f", ":FZF<CR>")
|
|
vim.keymap.set("n", "<leader>rg", ":FZFRg<CR>")
|
|
vim.keymap.set("n", "<C-n>", ":NvimTreeToggle<CR>")
|
|
vim.keymap.set("n", "<leader>n", ":NvimTreeFindFile<CR>")
|
|
vim.keymap.set("n", "<leader>tr", ":lua MiniTrailspace.trim()<CR>")
|
|
vim.keymap.set("n", "<F2>", ":GoRename<CR>")
|
|
vim.keymap.set("n", "<leader>gf", ":GoFillStruct<CR>:w<CR>")
|
|
vim.keymap.set("n", "<leader>gat", ":GoAlternate<CR>")
|
|
vim.keymap.set("n", "<leader>gt", ":GoTest<CR>")
|
|
vim.keymap.set("n", "<leader>gr", ":GoReferrers<CR>")
|
|
vim.keymap.set("n", "<leader>gcv", ":GoCoverage<CR>")
|
|
vim.keymap.set("n", "<leader>gdd", ":GoDeclsDir<CR>")
|
|
|
|
-- 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()
|
|
end,
|
|
},
|
|
|
|
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-comment.md
|
|
{
|
|
"echasnovski/mini.comment",
|
|
config = function()
|
|
require("mini.comment").setup({
|
|
comment = { suffix = "", options = {} },
|
|
})
|
|
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")
|