2023-03-12 03:28:32 +00:00
|
|
|
-- https://neovim.io/doc/user/lua-guide.html
|
2023-06-09 10:00:42 +00:00
|
|
|
vim.opt.completeopt = { "menuone", "noinsert", "noselect" }
|
2022-09-21 03:37:23 +00:00
|
|
|
vim.opt.swapfile = false
|
|
|
|
vim.opt.title = true
|
2022-07-30 18:30:59 +00:00
|
|
|
vim.opt.virtualedit = "block"
|
|
|
|
vim.opt.whichwrap = "<,>,[,]"
|
|
|
|
|
2023-05-19 09:43:12 +00:00
|
|
|
-- Case character
|
|
|
|
vim.opt.ignorecase = true
|
|
|
|
vim.opt.smartcase = true
|
|
|
|
|
2022-09-21 03:37:23 +00:00
|
|
|
-- Line number
|
|
|
|
vim.opt.number = true
|
|
|
|
vim.opt.relativenumber = true
|
|
|
|
vim.opt.scrolloff = 4
|
2023-07-06 08:29:18 +00:00
|
|
|
vim.opt.signcolumn = "number"
|
2022-09-21 03:37:23 +00:00
|
|
|
|
|
|
|
-- Tab
|
|
|
|
vim.opt.tabstop = 4
|
|
|
|
vim.opt.shiftwidth = 4
|
|
|
|
vim.opt.expandtab = true
|
|
|
|
|
|
|
|
-- Wrap
|
|
|
|
vim.opt.breakindent = true
|
|
|
|
|
2023-03-20 06:22:29 +00:00
|
|
|
-- Clipboard support
|
2023-04-02 18:35:22 +00:00
|
|
|
vim.opt.clipboard = "unnamedplus"
|
2023-03-20 06:22:29 +00:00
|
|
|
|
2022-09-21 03:37:23 +00:00
|
|
|
-- Truecolor
|
|
|
|
if vim.env.COLORTERM == "truecolor" then
|
|
|
|
vim.opt.termguicolors = true
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Mouse support
|
|
|
|
vim.opt.mouse = "a"
|
2023-10-05 19:13:12 +00:00
|
|
|
vim.opt.mousemodel = "popup"
|
2023-09-07 09:19:15 +00:00
|
|
|
vim.opt.mousescroll = "ver:4,hor:6"
|
2022-09-21 03:37:23 +00:00
|
|
|
|
2024-03-18 11:43:15 +00:00
|
|
|
-- Annoying
|
|
|
|
vim.cmd([[aunmenu PopUp.How-to\ disable\ mouse]])
|
|
|
|
vim.cmd([[aunmenu PopUp.-1-]])
|
|
|
|
|
2022-09-21 03:37:23 +00:00
|
|
|
-- Workaround
|
|
|
|
-- https://github.com/neovim/neovim/issues/16416
|
2023-07-04 06:23:12 +00:00
|
|
|
-- https://github.com/rafamadriz/dotfiles/commit/1298a91558a7def5866ebee3a0b13899a6d1a78e
|
|
|
|
vim.keymap.set("i", "<C-c>", "<C-c>")
|
2022-09-21 03:37:23 +00:00
|
|
|
|
2023-07-07 08:25:50 +00:00
|
|
|
-- Typo
|
|
|
|
vim.cmd("command W w")
|
|
|
|
vim.cmd("command Q q")
|
|
|
|
vim.cmd("command WQ wq")
|
|
|
|
vim.cmd("command Wq wq")
|
2023-07-22 17:23:03 +00:00
|
|
|
vim.cmd("command Qa qa")
|
2023-07-07 08:25:50 +00:00
|
|
|
|
2023-07-07 06:46:28 +00:00
|
|
|
-- Leader
|
2023-09-24 09:15:36 +00:00
|
|
|
vim.g.mapleader = ";"
|
2023-09-23 05:29:21 +00:00
|
|
|
vim.keymap.set("n", "'", "<Leader>", { remap = true })
|
2023-07-07 06:46:28 +00:00
|
|
|
|
|
|
|
-- Keymap
|
2023-10-02 16:33:21 +00:00
|
|
|
vim.keymap.set("n", "<Leader>w", ":w<CR>")
|
2023-07-07 06:46:28 +00:00
|
|
|
vim.keymap.set("n", "n", "nzz")
|
|
|
|
vim.keymap.set("n", "N", "Nzz")
|
2023-07-07 09:59:07 +00:00
|
|
|
vim.keymap.set("n", "{", "{zz")
|
|
|
|
vim.keymap.set("n", "}", "}zz")
|
2023-08-28 04:46:23 +00:00
|
|
|
|
2023-09-26 05:47:26 +00:00
|
|
|
-- Unnamed register aka black hole to not push to register aka trigger yank
|
2023-10-11 09:42:42 +00:00
|
|
|
vim.keymap.set("n", "d", '"_d')
|
2023-10-05 19:27:05 +00:00
|
|
|
vim.keymap.set({ "n", "v" }, "D", '"_D')
|
|
|
|
vim.keymap.set({ "n", "v" }, "c", '"_c')
|
|
|
|
vim.keymap.set({ "n", "v" }, "x", '"_x')
|
2023-09-26 05:47:26 +00:00
|
|
|
|
2023-09-06 12:02:33 +00:00
|
|
|
-- Conflict with :q
|
|
|
|
-- https://neovim.io/doc/user/cmdline.html#c_CTRL-F
|
2023-09-23 05:15:16 +00:00
|
|
|
vim.keymap.set({ "n", "v" }, "q:", "<Nop>")
|
2023-09-06 12:02:33 +00:00
|
|
|
|
2023-08-28 04:46:23 +00:00
|
|
|
-- Conflict with QMK Space Cadet
|
2023-09-23 05:15:16 +00:00
|
|
|
vim.keymap.set({ "n", "v" }, "(", "<Nop>")
|
|
|
|
vim.keymap.set({ "n", "v" }, ")", "<Nop>")
|
2023-04-18 03:52:55 +00:00
|
|
|
|
2023-08-28 04:46:23 +00:00
|
|
|
-- Disable scrolling
|
|
|
|
-- https://neovim.io/doc/user/scroll.html
|
2023-09-23 05:15:16 +00:00
|
|
|
vim.keymap.set({ "n", "v" }, "<C-e>", "<Nop>")
|
|
|
|
vim.keymap.set({ "n", "v" }, "<C-d>", "<Nop>")
|
|
|
|
vim.keymap.set({ "n", "v" }, "<C-f>", "<Nop>")
|
|
|
|
vim.keymap.set({ "n", "v" }, "<C-y>", "<Nop>")
|
|
|
|
vim.keymap.set({ "n", "v" }, "<C-u>", "<Nop>")
|
|
|
|
vim.keymap.set({ "n", "v" }, "<C-b>", "<Nop>")
|
2023-08-28 04:46:23 +00:00
|
|
|
|
2024-04-30 07:36:23 +00:00
|
|
|
-- Disable more
|
|
|
|
vim.g.loaded_python3_provider = 0
|
|
|
|
vim.g.loaded_ruby_provider = 0
|
|
|
|
vim.g.loaded_node_provider = 0
|
|
|
|
vim.g.loaded_perl_provider = 0
|
|
|
|
|
2023-06-17 04:20:37 +00:00
|
|
|
-- 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",
|
2023-06-17 04:53:00 +00:00
|
|
|
"--branch=stable",
|
2023-06-17 04:20:37 +00:00
|
|
|
lazypath,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
vim.opt.rtp:prepend(lazypath)
|
2022-09-21 03:37:23 +00:00
|
|
|
|
2023-06-17 04:20:37 +00:00
|
|
|
require("lazy").setup({
|
2023-06-30 08:08:46 +00:00
|
|
|
-- Colorschemes
|
|
|
|
-- https://github.com/catppuccin/nvim
|
2023-06-29 18:04:45 +00:00
|
|
|
{
|
2023-06-30 08:08:46 +00:00
|
|
|
"catppuccin/nvim",
|
|
|
|
name = "catppuccin",
|
2023-09-15 08:18:57 +00:00
|
|
|
lazy = false,
|
2023-06-30 08:08:46 +00:00
|
|
|
priority = 1000,
|
2023-06-29 18:04:45 +00:00
|
|
|
config = function()
|
2023-06-30 08:08:46 +00:00
|
|
|
require("catppuccin").setup({
|
2023-08-06 07:26:21 +00:00
|
|
|
flavour = "mocha",
|
2023-10-28 19:56:54 +00:00
|
|
|
transparent_background = false,
|
2023-10-24 07:29:13 +00:00
|
|
|
custom_highlights = function(colors)
|
2024-02-29 15:17:14 +00:00
|
|
|
-- Eva-01 vibe
|
|
|
|
-- https://enjoykeycap.github.io/docs/gmk-keycaps/Mecha-01/
|
|
|
|
-- https://www.pantone.com/connect/802-C
|
|
|
|
-- https://www.pantone.com/connect/267-C
|
|
|
|
local color_eva = {
|
|
|
|
fg = "#44d62c",
|
|
|
|
bg = "#5f249e",
|
|
|
|
}
|
|
|
|
|
2023-10-24 07:29:13 +00:00
|
|
|
return {
|
2024-02-29 15:17:14 +00:00
|
|
|
-- Help my eyes
|
|
|
|
Comment = {
|
|
|
|
fg = colors.overlay2,
|
|
|
|
},
|
|
|
|
LineNr = {
|
|
|
|
fg = colors.overlay1,
|
|
|
|
},
|
2024-03-20 07:01:52 +00:00
|
|
|
ExtraWhitespace = {
|
|
|
|
bg = color_eva.bg,
|
|
|
|
},
|
2023-10-28 17:57:26 +00:00
|
|
|
-- Support mini.statusline
|
|
|
|
StatusLineNC = {
|
2023-10-24 07:29:13 +00:00
|
|
|
fg = colors.flamingo,
|
|
|
|
},
|
2024-03-28 05:45:33 +00:00
|
|
|
-- Support gitsigns.nvim
|
|
|
|
GitSignsCurrentLineBlame = {
|
|
|
|
fg = colors.overlay1,
|
|
|
|
style = { "italic" },
|
|
|
|
},
|
2024-02-29 15:17:14 +00:00
|
|
|
-- https://neovim.io/doc/user/diagnostic.html#diagnostic-highlights
|
|
|
|
DiagnosticVirtualTextError = color_eva,
|
|
|
|
DiagnosticSignError = color_eva,
|
2023-10-24 07:29:13 +00:00
|
|
|
}
|
|
|
|
end,
|
2024-03-25 18:16:35 +00:00
|
|
|
integrations = {
|
|
|
|
treesitter_context = false,
|
|
|
|
},
|
2023-06-30 08:08:46 +00:00
|
|
|
})
|
|
|
|
|
2023-08-06 07:26:21 +00:00
|
|
|
vim.cmd("colorscheme catppuccin")
|
2023-06-29 18:04:45 +00:00
|
|
|
end,
|
2023-09-15 08:18:57 +00:00
|
|
|
},
|
|
|
|
|
2024-03-29 05:44:09 +00:00
|
|
|
-- https://gitlab.com/ibhagwan/fzf-lua
|
2023-07-04 04:19:40 +00:00
|
|
|
{
|
2024-04-01 18:27:22 +00:00
|
|
|
url = "https://codeberg.org/ibhagwan/fzf-lua.git",
|
2023-07-04 04:19:40 +00:00
|
|
|
dependencies = {
|
|
|
|
"neovim/nvim-lspconfig",
|
|
|
|
},
|
2023-07-04 06:23:12 +00:00
|
|
|
config = function()
|
2024-02-28 08:52:15 +00:00
|
|
|
require("fzf-lua").setup({
|
|
|
|
"fzf-native",
|
|
|
|
winopts = {
|
|
|
|
preview = {
|
|
|
|
wrap = "wrap",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
2023-07-04 06:23:12 +00:00
|
|
|
|
2023-09-23 05:29:21 +00:00
|
|
|
vim.keymap.set("n", "<Leader>f", ":FzfLua files<CR>")
|
2023-09-24 04:33:12 +00:00
|
|
|
vim.keymap.set("n", "<Leader>l", ":FzfLua blines<CR>")
|
2023-11-03 17:14:22 +00:00
|
|
|
vim.keymap.set("n", "<Leader>rg", ":FzfLua live_grep_resume<CR>")
|
2023-09-23 05:29:21 +00:00
|
|
|
vim.keymap.set("n", "<Space>s", ":FzfLua lsp_document_symbols<CR>")
|
|
|
|
vim.keymap.set("n", "<Space>d", ":FzfLua lsp_definitions<CR>")
|
2023-11-06 19:23:44 +00:00
|
|
|
vim.keymap.set("n", "gd", ":FzfLua lsp_definitions<CR>")
|
2023-09-23 05:29:21 +00:00
|
|
|
vim.keymap.set("n", "<Space>r", ":FzfLua lsp_references<CR>")
|
2023-11-06 19:23:44 +00:00
|
|
|
vim.keymap.set("n", "gr", ":FzfLua lsp_references<CR>")
|
2023-09-23 05:29:21 +00:00
|
|
|
vim.keymap.set("n", "<Space>i", ":FzfLua lsp_implementations<CR>")
|
2023-11-06 19:23:44 +00:00
|
|
|
vim.keymap.set("n", "gi", ":FzfLua lsp_implementations<CR>")
|
2023-12-25 08:17:27 +00:00
|
|
|
vim.keymap.set("n", "<Space>ca", ":FzfLua lsp_code_actions previewer=false<CR>")
|
2023-07-04 06:23:12 +00:00
|
|
|
end,
|
2023-07-04 04:19:40 +00:00
|
|
|
},
|
2022-09-21 03:37:23 +00:00
|
|
|
|
2023-04-12 07:09:54 +00:00
|
|
|
-- https://github.com/nvim-tree/nvim-tree.lua
|
2023-06-17 04:20:37 +00:00
|
|
|
{
|
2023-04-12 07:09:54 +00:00
|
|
|
"nvim-tree/nvim-tree.lua",
|
2023-07-08 14:44:45 +00:00
|
|
|
init = function()
|
|
|
|
vim.g.loaded_netrw = 1
|
|
|
|
vim.g.loaded_netrwPlugin = 1
|
|
|
|
end,
|
2022-09-21 03:37:23 +00:00
|
|
|
config = function()
|
|
|
|
require("nvim-tree").setup({
|
|
|
|
renderer = {
|
2023-04-12 07:09:54 +00:00
|
|
|
group_empty = true,
|
2023-07-01 08:07:07 +00:00
|
|
|
root_folder_label = false,
|
2024-02-26 03:52:30 +00:00
|
|
|
indent_width = 2,
|
2024-02-26 03:27:32 +00:00
|
|
|
special_files = {
|
|
|
|
"go.mod",
|
|
|
|
"go.sum",
|
|
|
|
},
|
2023-02-07 10:10:22 +00:00
|
|
|
icons = {
|
|
|
|
show = {
|
2024-02-26 03:52:30 +00:00
|
|
|
file = false,
|
|
|
|
folder = false,
|
2023-02-07 10:10:22 +00:00
|
|
|
folder_arrow = false,
|
|
|
|
},
|
|
|
|
},
|
2022-09-21 03:37:23 +00:00
|
|
|
},
|
2023-05-24 07:10:08 +00:00
|
|
|
filters = {
|
2023-12-16 16:08:40 +00:00
|
|
|
git_ignored = false,
|
2023-06-29 03:28:18 +00:00
|
|
|
custom = {
|
2023-08-10 09:50:45 +00:00
|
|
|
"\\.bin$",
|
2023-08-10 17:06:56 +00:00
|
|
|
"\\.class$",
|
2023-09-13 05:54:17 +00:00
|
|
|
"\\.exe$",
|
|
|
|
"\\.hex$",
|
2024-02-29 11:28:46 +00:00
|
|
|
"\\.jpeg$",
|
|
|
|
"\\.jpg$",
|
2023-08-10 17:06:56 +00:00
|
|
|
"\\.out$",
|
2023-09-13 05:54:17 +00:00
|
|
|
"\\.pdf$",
|
2024-02-29 11:28:46 +00:00
|
|
|
"\\.png$",
|
2023-09-13 05:54:17 +00:00
|
|
|
"\\.zip$",
|
2023-08-10 17:06:56 +00:00
|
|
|
"^\\.DS_Store$",
|
|
|
|
"^\\.git$",
|
|
|
|
"^\\.idea$",
|
2024-02-29 11:28:46 +00:00
|
|
|
"^\\.ruff_cache$",
|
2023-08-10 17:06:56 +00:00
|
|
|
"^\\.vscode$",
|
2024-02-29 15:17:14 +00:00
|
|
|
"pycache",
|
|
|
|
"venv",
|
2023-06-29 03:28:18 +00:00
|
|
|
},
|
2023-05-24 07:10:08 +00:00
|
|
|
},
|
2022-09-21 03:37:23 +00:00
|
|
|
})
|
2023-07-04 06:23:12 +00:00
|
|
|
|
|
|
|
vim.keymap.set("n", "<C-n>", ":NvimTreeToggle<CR>")
|
|
|
|
vim.keymap.set("n", "<Leader>n", ":NvimTreeFindFile<CR>")
|
2023-09-15 16:44:23 +00:00
|
|
|
|
|
|
|
-- https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup
|
|
|
|
local function open_nvim_tree(data)
|
2023-09-21 02:48:58 +00:00
|
|
|
-- Buffer is a real file on the disk
|
2023-09-15 16:44:23 +00:00
|
|
|
local real_file = vim.fn.filereadable(data.file) == 1
|
|
|
|
|
2023-09-21 02:48:58 +00:00
|
|
|
-- Buffer is a [No Name]
|
2023-09-15 16:44:23 +00:00
|
|
|
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
|
|
|
|
|
|
|
|
if not real_file and not no_name then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2023-09-15 16:47:42 +00:00
|
|
|
local IGNORED_FT = {
|
|
|
|
"gitcommit",
|
|
|
|
}
|
|
|
|
|
|
|
|
-- &ft
|
|
|
|
local filetype = vim.bo[data.buf].ft
|
|
|
|
|
2023-09-21 02:48:58 +00:00
|
|
|
-- Skip ignored filetypes
|
2023-09-15 16:47:42 +00:00
|
|
|
if vim.tbl_contains(IGNORED_FT, filetype) then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2023-09-21 02:48:58 +00:00
|
|
|
-- Ignore small window
|
|
|
|
-- https://stackoverflow.com/a/42648387
|
|
|
|
if vim.api.nvim_win_get_width(0) < 800 then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2023-09-15 16:44:23 +00:00
|
|
|
require("nvim-tree.api").tree.toggle({ focus = false })
|
|
|
|
end
|
|
|
|
|
|
|
|
local augroup = vim.api.nvim_create_augroup("UserNvimTreeConfig", {})
|
|
|
|
vim.api.nvim_create_autocmd("VimEnter", {
|
|
|
|
group = augroup,
|
|
|
|
callback = open_nvim_tree,
|
|
|
|
})
|
2022-09-21 03:37:23 +00:00
|
|
|
end,
|
2023-06-17 04:20:37 +00:00
|
|
|
},
|
2022-09-21 03:37:23 +00:00
|
|
|
|
2023-06-23 03:58:51 +00:00
|
|
|
-- https://github.com/lewis6991/gitsigns.nvim
|
|
|
|
{
|
|
|
|
"lewis6991/gitsigns.nvim",
|
|
|
|
config = function()
|
|
|
|
require("gitsigns").setup({
|
2023-07-01 09:02:34 +00:00
|
|
|
signs = {
|
|
|
|
untracked = { text = "" },
|
|
|
|
},
|
2023-07-13 14:18:53 +00:00
|
|
|
current_line_blame = true,
|
|
|
|
current_line_blame_opts = {
|
|
|
|
ignore_whitespace = true,
|
|
|
|
},
|
2024-03-28 05:45:33 +00:00
|
|
|
current_line_blame_formatter = "<author> <author_time:%Y-%m-%d> <summary>",
|
2023-06-23 03:58:51 +00:00
|
|
|
on_attach = function(bufnr)
|
|
|
|
local gs = package.loaded.gitsigns
|
|
|
|
|
|
|
|
local function map(mode, l, r, opts)
|
|
|
|
opts = opts or {}
|
|
|
|
opts.buffer = bufnr
|
|
|
|
vim.keymap.set(mode, l, r, opts)
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Navigation
|
|
|
|
map("n", "]c", function()
|
|
|
|
if vim.wo.diff then
|
|
|
|
return "]c"
|
|
|
|
end
|
|
|
|
vim.schedule(function()
|
|
|
|
gs.next_hunk()
|
|
|
|
end)
|
|
|
|
return "<Ignore>"
|
|
|
|
end, { expr = true })
|
|
|
|
|
|
|
|
map("n", "[c", function()
|
|
|
|
if vim.wo.diff then
|
|
|
|
return "[c"
|
|
|
|
end
|
|
|
|
vim.schedule(function()
|
|
|
|
gs.prev_hunk()
|
|
|
|
end)
|
|
|
|
return "<Ignore>"
|
|
|
|
end, { expr = true })
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
},
|
2023-04-26 05:57:22 +00:00
|
|
|
|
2023-07-21 03:37:15 +00:00
|
|
|
-- https://github.com/tpope/vim-fugitive
|
|
|
|
{
|
|
|
|
"tpope/vim-fugitive",
|
|
|
|
},
|
|
|
|
|
2023-07-08 11:29:01 +00:00
|
|
|
-- https://github.com/tpope/vim-projectionist
|
|
|
|
{
|
|
|
|
"tpope/vim-projectionist",
|
|
|
|
init = function()
|
|
|
|
vim.g.projectionist_heuristics = {
|
|
|
|
["*.go"] = {
|
|
|
|
["*.go"] = {
|
|
|
|
alternate = "{}_test.go",
|
|
|
|
type = "source",
|
|
|
|
},
|
2024-04-06 07:22:49 +00:00
|
|
|
["*_generated.go"] = {
|
|
|
|
alternate = "{}_test.go",
|
|
|
|
type = "source",
|
|
|
|
},
|
2023-07-08 11:29:01 +00:00
|
|
|
["*_test.go"] = {
|
2024-04-06 07:22:49 +00:00
|
|
|
alternate = { "{}.go", "{}_generated.go" },
|
2023-07-08 11:29:01 +00:00
|
|
|
type = "test",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
end,
|
2023-10-02 15:18:06 +00:00
|
|
|
config = function()
|
|
|
|
vim.keymap.set("n", "<Leader>a", ":A<CR>")
|
|
|
|
end,
|
2023-07-08 11:29:01 +00:00
|
|
|
},
|
|
|
|
|
2023-06-21 09:35:14 +00:00
|
|
|
-- https://github.com/echasnovski/mini.nvim
|
2023-06-17 04:20:37 +00:00
|
|
|
{
|
2023-06-21 09:35:14 +00:00
|
|
|
"echasnovski/mini.nvim",
|
2023-02-28 09:00:43 +00:00
|
|
|
config = function()
|
2023-06-21 09:35:14 +00:00
|
|
|
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-bracketed.md
|
2023-06-17 04:33:05 +00:00
|
|
|
require("mini.bracketed").setup({
|
|
|
|
comment = { suffix = "", options = {} },
|
2023-07-25 18:04:19 +00:00
|
|
|
file = { suffix = "", options = {} },
|
|
|
|
indent = { suffix = "", options = {} },
|
|
|
|
jump = { suffix = "", options = {} },
|
|
|
|
location = { suffix = "", options = {} },
|
|
|
|
oldfile = { suffix = "", options = {} },
|
2023-11-11 14:35:32 +00:00
|
|
|
treesitter = { suffix = "", options = {} },
|
2023-07-25 18:04:19 +00:00
|
|
|
undo = { suffix = "", options = {} },
|
|
|
|
window = { suffix = "", options = {} },
|
|
|
|
yank = { suffix = "", options = {} },
|
2023-06-17 04:33:05 +00:00
|
|
|
})
|
2023-02-28 09:00:43 +00:00
|
|
|
|
2023-06-21 09:35:14 +00:00
|
|
|
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-comment.md
|
2024-02-10 16:56:53 +00:00
|
|
|
require("mini.comment").setup()
|
2023-03-01 09:19:40 +00:00
|
|
|
|
2023-10-03 03:22:37 +00:00
|
|
|
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-completion.md
|
2023-10-03 05:48:54 +00:00
|
|
|
require("mini.completion").setup({
|
|
|
|
mappings = {
|
|
|
|
force_twostep = "<C-Space>",
|
|
|
|
force_fallback = "",
|
|
|
|
},
|
|
|
|
})
|
2023-10-03 03:22:37 +00:00
|
|
|
|
2023-06-21 09:35:14 +00:00
|
|
|
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-cursorword.md
|
2023-04-02 18:10:10 +00:00
|
|
|
require("mini.cursorword").setup()
|
|
|
|
|
2024-03-01 15:05:55 +00:00
|
|
|
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-hipatterns.md
|
|
|
|
local hipatterns = require("mini.hipatterns")
|
|
|
|
hipatterns.setup({
|
|
|
|
highlighters = {
|
|
|
|
hex_color = hipatterns.gen_highlighter.hex_color(),
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2023-10-28 17:25:41 +00:00
|
|
|
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-pairs.md
|
|
|
|
require("mini.pairs").setup()
|
|
|
|
|
2023-09-20 06:49:26 +00:00
|
|
|
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-statusline.md
|
2023-10-28 17:57:26 +00:00
|
|
|
require("mini.statusline").setup()
|
2023-09-20 06:49:26 +00:00
|
|
|
|
2023-06-21 09:35:14 +00:00
|
|
|
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-surround.md
|
2023-04-02 18:17:38 +00:00
|
|
|
require("mini.surround").setup()
|
2023-05-03 17:12:34 +00:00
|
|
|
end,
|
2023-06-17 04:20:37 +00:00
|
|
|
},
|
2023-05-03 17:12:34 +00:00
|
|
|
|
2022-09-21 03:37:23 +00:00
|
|
|
-- Programming languages
|
2024-03-25 18:16:35 +00:00
|
|
|
-- https://github.com/stevearc/conform.nvim
|
2023-07-08 14:44:45 +00:00
|
|
|
{
|
2024-03-25 18:16:35 +00:00
|
|
|
"stevearc/conform.nvim",
|
|
|
|
config = function()
|
|
|
|
local conform = require("conform")
|
|
|
|
conform.setup({
|
|
|
|
formatters_by_ft = {
|
2024-04-30 08:13:02 +00:00
|
|
|
["_"] = { "trim_whitespace" },
|
2024-04-04 10:04:12 +00:00
|
|
|
bash = { "shfmt" },
|
2024-03-25 18:16:35 +00:00
|
|
|
go = { "gofumpt" },
|
|
|
|
javascript = { "deno_fmt" },
|
|
|
|
json = { "deno_fmt" },
|
|
|
|
lua = { "stylua" },
|
|
|
|
markdown = { "deno_fmt" },
|
|
|
|
python = { "ruff_format" },
|
|
|
|
sh = { "shfmt" },
|
|
|
|
toml = { "taplo" },
|
2024-04-16 09:01:54 +00:00
|
|
|
yaml = { "prettier" },
|
2024-04-04 10:04:12 +00:00
|
|
|
zsh = { "shfmt" },
|
2024-03-25 18:16:35 +00:00
|
|
|
},
|
|
|
|
formatters = {
|
|
|
|
gofumpt = {
|
|
|
|
prepend_args = { "-extra" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
vim.keymap.set("n", "<Space>f", function()
|
|
|
|
conform.format()
|
|
|
|
end)
|
2023-07-08 14:44:45 +00:00
|
|
|
end,
|
|
|
|
},
|
2022-09-21 03:37:23 +00:00
|
|
|
|
2024-03-18 16:39:49 +00:00
|
|
|
-- https://github.com/nvim-treesitter/nvim-treesitter
|
|
|
|
{
|
|
|
|
"nvim-treesitter/nvim-treesitter",
|
|
|
|
build = {
|
|
|
|
":TSUpdate",
|
|
|
|
},
|
|
|
|
config = function()
|
|
|
|
require("nvim-treesitter.configs").setup({
|
|
|
|
ensure_installed = {
|
|
|
|
"go",
|
|
|
|
"lua",
|
2024-03-21 03:04:16 +00:00
|
|
|
"markdown",
|
2024-03-18 16:39:49 +00:00
|
|
|
"proto",
|
|
|
|
"python",
|
|
|
|
},
|
|
|
|
highlight = {
|
|
|
|
enabled = true,
|
|
|
|
disable = function(lang, bufnr)
|
|
|
|
-- Skip big files with many lines
|
2024-03-27 07:13:25 +00:00
|
|
|
return vim.api.nvim_buf_line_count(bufnr) > 10000
|
2024-03-18 16:39:49 +00:00
|
|
|
end,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
|
|
|
|
-- https://github.com/nvim-treesitter/nvim-treesitter-context
|
|
|
|
{
|
|
|
|
"nvim-treesitter/nvim-treesitter-context",
|
|
|
|
dependencies = {
|
|
|
|
"nvim-treesitter/nvim-treesitter",
|
|
|
|
},
|
|
|
|
config = function()
|
|
|
|
require("treesitter-context").setup({
|
|
|
|
enable = true,
|
|
|
|
max_lines = 2,
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
|
2023-06-29 10:20:29 +00:00
|
|
|
-- https://github.com/neovim/nvim-lspconfig
|
|
|
|
{
|
|
|
|
"neovim/nvim-lspconfig",
|
|
|
|
config = function()
|
2023-07-01 08:49:15 +00:00
|
|
|
local lspconfig = require("lspconfig")
|
2023-06-29 10:20:29 +00:00
|
|
|
|
2023-06-29 11:26:53 +00:00
|
|
|
-- Go
|
2023-06-29 10:20:29 +00:00
|
|
|
-- https://github.com/golang/tools/blob/master/gopls/doc/vim.md
|
2023-07-01 15:38:50 +00:00
|
|
|
-- https://github.com/golang/tools/blob/master/gopls/doc/settings.md
|
2023-07-01 08:49:15 +00:00
|
|
|
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#gopls
|
2023-06-29 10:20:29 +00:00
|
|
|
lspconfig.gopls.setup({
|
|
|
|
settings = {
|
|
|
|
gopls = {
|
2023-10-28 18:26:26 +00:00
|
|
|
usePlaceholders = true,
|
2023-06-29 10:20:29 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2024-02-29 15:17:14 +00:00
|
|
|
-- Python
|
|
|
|
-- https://github.com/Microsoft/pyright
|
|
|
|
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#pyright
|
|
|
|
lspconfig.pyright.setup({})
|
|
|
|
|
2024-03-31 07:29:25 +00:00
|
|
|
-- Markdown
|
|
|
|
-- https://github.com/artempyanykh/marksman
|
|
|
|
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#marksman
|
|
|
|
lspconfig.marksman.setup({})
|
|
|
|
|
2023-06-30 17:27:29 +00:00
|
|
|
-- General
|
2023-06-29 10:20:29 +00:00
|
|
|
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
|
|
|
|
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
|
2023-09-07 18:35:11 +00:00
|
|
|
vim.keymap.set("n", "<Space>e", vim.diagnostic.open_float)
|
2023-07-25 06:02:23 +00:00
|
|
|
vim.keymap.set("n", "<Space>lr", ":LspRestart<CR>")
|
2023-06-29 10:20:29 +00:00
|
|
|
|
2023-07-25 06:02:23 +00:00
|
|
|
local augroup = vim.api.nvim_create_augroup("UserLspConfig", {})
|
2023-06-29 10:20:29 +00:00
|
|
|
vim.api.nvim_create_autocmd("LspAttach", {
|
2023-07-25 06:02:23 +00:00
|
|
|
group = augroup,
|
2023-06-29 10:20:29 +00:00
|
|
|
callback = function(ev)
|
|
|
|
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
|
|
|
|
|
|
|
|
local opts = { buffer = ev.buf }
|
2023-10-24 07:29:13 +00:00
|
|
|
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
2023-07-04 06:23:12 +00:00
|
|
|
vim.keymap.set("n", "<Space>k", vim.lsp.buf.hover, opts)
|
2023-11-06 19:23:44 +00:00
|
|
|
vim.keymap.set("n", "gk", vim.lsp.buf.hover, opts)
|
2023-06-29 10:20:29 +00:00
|
|
|
vim.keymap.set("n", "<F2>", vim.lsp.buf.rename, opts)
|
2023-07-25 06:02:23 +00:00
|
|
|
end,
|
|
|
|
})
|
2023-12-30 04:06:11 +00:00
|
|
|
|
|
|
|
-- Chaos
|
|
|
|
-- https://www.reddit.com/r/neovim/comments/18teetv/one_day_you_will_wake_up_and_choose_the_chaos
|
|
|
|
-- https://github.com/neovim/nvim-lspconfig/wiki/UI-Customization
|
|
|
|
-- https://neovim.io/doc/user/diagnostic.html#diagnostic-highlights
|
|
|
|
local signs = {
|
|
|
|
Error = "🤬",
|
2024-01-16 07:09:24 +00:00
|
|
|
Warn = "😤",
|
|
|
|
Info = "🤔",
|
2024-01-27 18:24:25 +00:00
|
|
|
Hint = "🤯",
|
2023-12-30 04:06:11 +00:00
|
|
|
}
|
|
|
|
for type, icon in pairs(signs) do
|
|
|
|
local hl = "DiagnosticSign" .. type
|
|
|
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
|
|
|
end
|
2024-01-12 10:27:00 +00:00
|
|
|
|
|
|
|
-- https://neovim.io/doc/user/diagnostic.html#diagnostic-api
|
|
|
|
vim.diagnostic.config({
|
2024-02-29 15:17:14 +00:00
|
|
|
underline = false,
|
2024-03-25 18:16:35 +00:00
|
|
|
virtual_text = false,
|
2024-01-12 10:27:00 +00:00
|
|
|
})
|
2023-06-29 10:20:29 +00:00
|
|
|
end,
|
|
|
|
},
|
2024-01-24 10:41:16 +00:00
|
|
|
|
|
|
|
-- https://github.com/github/copilot.vim
|
|
|
|
{
|
|
|
|
"github/copilot.vim",
|
|
|
|
init = function()
|
|
|
|
vim.g.copilot_filetypes = {
|
|
|
|
["*"] = false,
|
2024-02-26 03:27:32 +00:00
|
|
|
gitcommit = true,
|
2024-01-24 10:41:16 +00:00
|
|
|
go = true,
|
|
|
|
lua = true,
|
2024-02-26 03:27:32 +00:00
|
|
|
make = true,
|
2024-02-17 08:26:42 +00:00
|
|
|
markdown = true,
|
2024-02-22 12:38:42 +00:00
|
|
|
proto = true,
|
|
|
|
python = true,
|
2024-02-17 08:26:42 +00:00
|
|
|
toml = true,
|
|
|
|
yaml = true,
|
2024-03-10 18:06:52 +00:00
|
|
|
zsh = true,
|
2024-01-24 10:41:16 +00:00
|
|
|
}
|
2024-03-17 09:07:38 +00:00
|
|
|
vim.g.copilot_no_tab_map = true
|
|
|
|
end,
|
|
|
|
config = function()
|
|
|
|
vim.keymap.set("i", "<M-Right>", 'copilot#Accept("\\<CR>")', {
|
|
|
|
expr = true,
|
|
|
|
replace_keycodes = false,
|
|
|
|
})
|
2024-01-24 10:41:16 +00:00
|
|
|
end,
|
|
|
|
},
|
2024-04-30 08:13:02 +00:00
|
|
|
}, {
|
|
|
|
performance = {
|
|
|
|
rtp = {
|
|
|
|
disabled_plugins = {
|
|
|
|
"editorconfig",
|
|
|
|
"gzip",
|
|
|
|
"spellfile",
|
|
|
|
"tarPlugin",
|
|
|
|
"tohtml",
|
|
|
|
"tutor",
|
|
|
|
"zipPlugin",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2023-06-17 04:20:37 +00:00
|
|
|
})
|