nvim: the epic config restructure

This commit is contained in:
2023-07-08 15:20:43 +03:00
parent 43a54ad044
commit 9a81f16153
31 changed files with 384 additions and 495 deletions

View File

@ -1,4 +1,3 @@
require("plugins")
require("options")
require("mappings")
require("colors")
require("config.options")
require("config.mappings")
require("config.plugins")

View File

@ -1,2 +0,0 @@
-- vim.cmd("colorscheme wal")
-- vim.cmd("colorscheme monokai")

View File

@ -0,0 +1,13 @@
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("plugins")

View File

@ -1,274 +0,0 @@
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({
{
"echasnovski/mini.nvim",
config = function()
require("plugins.mini")
end,
},
--
-- dev
--
-- lspconfig
{
"neovim/nvim-lspconfig",
config = function()
require("plugins.lsp")
end,
},
-- nvim lint
{
"mfussenegger/nvim-lint",
config = function()
require("plugins.lint")
end,
},
-- cmp
{
"hrsh7th/nvim-cmp",
config = function()
require("plugins.cmp")
end,
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-vsnip",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-nvim-lsp-signature-help",
},
},
-- snippets
{
"hrsh7th/vim-vsnip",
config = function()
require("plugins.vsnip")
end,
},
"rafamadriz/friendly-snippets",
-- autopairs
{
"windwp/nvim-autopairs",
config = function()
require("plugins.autopairs")
end,
},
-- treesitter
{
"nvim-treesitter/nvim-treesitter",
config = function()
require("plugins.treesitter")
end,
},
{
"nvim-treesitter/nvim-treesitter-context",
config = function()
require("plugins.treesitter-context")
end,
},
{
"RRethy/nvim-treesitter-textsubjects",
config = function()
require("plugins.treesitter-textobjects")
end,
},
-- formatter
{
"mhartington/formatter.nvim",
cmd = { "Format", "FormatWrite" },
config = function()
require("plugins.formatter")
end,
},
-- dap
{
"mfussenegger/nvim-dap",
config = function()
require("plugins.dap")
end,
dependencies = {
"leoluz/nvim-dap-go",
"mfussenegger/nvim-dap-python",
},
},
-- trouble
{
"folke/trouble.nvim",
cmd = { "Trouble", "TroubleToggle" },
config = function()
require("plugins.trouble")
end,
},
-- toggleterm
{
"akinsho/toggleterm.nvim",
cmd = { "ToggleTerm" },
config = function()
require("plugins.toggleterm")
end,
dependencies = {
"chomosuke/term-edit.nvim",
},
},
-- neogen
{
"danymat/neogen",
config = function()
require("plugins.neogen")
end,
},
-- neotest
{
"nvim-neotest/neotest",
config = function()
require("plugins.neotest")
end,
dependencies = {
"antoinemadec/FixCursorHold.nvim",
"nvim-neotest/neotest-python",
},
keys = {
"<leader>n",
},
},
-- refactoring
{
"ThePrimeagen/refactoring.nvim",
config = function()
require("plugins.refactoring")
end,
keys = {
"<leader>r",
},
},
--
-- git
--
-- "tpope/vim-fugitive",
{
"TimUntersberger/neogit",
config = function()
require("plugins.neogit")
end,
},
"sindrets/diffview.nvim",
--
-- files (and more)
--
-- telescope
{
"nvim-telescope/telescope.nvim",
config = function()
require("plugins.telescope")
end,
dependencies = {
"nvim-lua/plenary.nvim",
},
},
-- nvim tree
{
"kyazdani42/nvim-tree.lua",
config = function()
require("plugins.nvim-tree")
end,
dependencies = {
"kyazdani42/nvim-web-devicons",
},
cmd = { "NvimTreeOpen", "NvimTreeToggle" },
},
--
-- looks
--
-- lualine
{
"hoob3rt/lualine.nvim",
config = function()
require("plugins.lualine")
end,
},
--
-- colorscheme
--
{
"nekonako/xresources-nvim",
config = function()
require('xresources')
end,
},
--
-- telekasten
--
{
"renerocksai/telekasten.nvim",
config = function()
require("plugins.telekasten")
end,
dependencies = {
"telescope.nvim",
},
key = {
"<leader>z",
},
ft = {
"markdown",
},
},
"renerocksai/calendar-vim",
{
"shortcuts/no-neck-pain.nvim",
config = function()
require("plugins.no-neck-pain")
end,
},
{
"folke/which-key.nvim",
key = {
"<leader>",
},
config = function()
require("plugins.which-key")
end,
},
})

View File

@ -1,6 +1,11 @@
return {
"windwp/nvim-autopairs",
config = function()
-- autopairs
require("nvim-autopairs").setup({})
-- insert () after selecting functions
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local cmp = require("cmp")
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
end,
}

View File

@ -1 +0,0 @@
vim.g.calendar_no_mappings = true

View File

@ -1,3 +1,16 @@
return {
"hrsh7th/nvim-cmp",
config = function()
require("plugins.cmp")
end,
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-vsnip",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-nvim-lsp-signature-help",
},
opts = function()
vim.opt.completeopt = { "menuone", "noselect" }
local cmp = require("cmp")
@ -50,3 +63,5 @@ cmp.setup({
{ name = "orgmode" },
},
})
end,
}

View File

@ -1,2 +1,11 @@
return {
"mfussenegger/nvim-dap",
config = function()
require("dap-go").setup()
require("dap-python").setup()
end,
dependencies = {
"leoluz/nvim-dap-go",
"mfussenegger/nvim-dap-python",
},
}

View File

@ -1,3 +1,7 @@
return {
"mhartington/formatter.nvim",
cmd = { "Format", "FormatWrite" },
config = function()
require("formatter").setup({
filetype = {
lua = {
@ -21,3 +25,5 @@ require("formatter").setup({
},
},
})
end,
}

View File

@ -1,6 +1,11 @@
return {
"mfussenegger/nvim-lint",
config = function()
require("lint").linters_by_ft = {
python = { "mypy" },
rust = { "ruff" },
}
vim.cmd("au BufWrite <buffer> lua require('lint').try_lint()")
end,
}

View File

@ -1,9 +1,14 @@
local lsp = require("lspconfig")
-- lsp.jedi_language_server.setup{}
lsp.pyright.setup{}
lsp.gopls.setup{}
lsp.rust_analyzer.setup{}
lsp.clangd.setup{}
lsp.lua_ls.setup{}
lsp.solargraph.setup{}
return {
{
"neovim/nvim-lspconfig",
config = function()
lsp = require("lspconfig")
lsp.pyright.setup({})
lsp.gopls.setup({})
lsp.rust_analyzer.setup({})
lsp.clangd.setup({})
lsp.lua_ls.setup({})
lsp.solargraph.setup({})
end,
},
}

View File

@ -1,4 +1,6 @@
-- lualine colorscheme
return {
"hoob3rt/lualine.nvim",
config = function()
require("lualine").setup({
options = {
theme = "auto",
@ -6,3 +8,5 @@ require("lualine").setup({
component_separators = { "", "" },
},
})
end,
}

View File

@ -1,17 +0,0 @@
require("mini.ai").setup()
require("mini.bracketed").setup()
require("mini.comment").setup()
require("mini.move").setup()
require("mini.starter").setup()
require("mini.tabline").setup()
require("mini.surround").setup({
mappings = {
add = "<space>sa",
delete = "<space>sd",
find = "<space>sf",
find_left = "<space>sF",
highlight = "<space>sh",
replace = "<space>sr",
update_n_lines = "<space>sn",
},
})

View File

@ -1,3 +1,6 @@
return {
"danymat/neogen",
config = function()
require("neogen").setup({
languages = {
python = {
@ -7,3 +10,5 @@ require("neogen").setup({
},
},
})
end,
}

View File

@ -1,3 +1,9 @@
return {
"TimUntersberger/neogit",
dependencies = {
"sindrets/diffview.nvim",
},
config = function()
local neogit = require("neogit")
neogit.setup({
@ -5,3 +11,5 @@ neogit.setup({
diffview = true,
},
})
end,
}

View File

@ -1,3 +1,6 @@
return {
"nvim-neotest/neotest",
config = function()
require("neotest").setup({
adapters = {
require("neotest-python")({
@ -5,3 +8,12 @@ require("neotest").setup({
}),
},
})
end,
dependencies = {
"antoinemadec/FixCursorHold.nvim",
"nvim-neotest/neotest-python",
},
keys = {
"<leader>n",
},
}

View File

@ -1,3 +1,6 @@
return {
"shortcuts/no-neck-pain.nvim",
config = function()
require("no-neck-pain").setup({
buffers = {
right = {
@ -5,3 +8,5 @@ require("no-neck-pain").setup({
},
},
})
end,
}

View File

@ -1,3 +1,6 @@
return {
"kyazdani42/nvim-tree.lua",
config = function()
-- nvim tree
require("nvim-tree").setup({
update_cwd = true,
@ -11,3 +14,9 @@ vim.api.nvim_create_autocmd("BufEnter", {
pattern = "*",
command = "if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif",
})
end,
dependencies = {
"kyazdani42/nvim-web-devicons",
},
cmd = { "NvimTreeOpen", "NvimTreeToggle" },
}

View File

@ -1 +1,9 @@
return {
"ThePrimeagen/refactoring.nvim",
config = function()
require("refactoring").setup()
end,
keys = {
"<leader>r",
},
}

View File

@ -1,2 +1,17 @@
return {
"renerocksai/telekasten.nvim",
config = function()
local home = vim.fn.expand("~/docs/zettelkasten")
require("telekasten").setup({ home = home })
vim.g.calendar_no_mappings = true
end,
dependencies = {
"renerocksai/calendar-vim",
},
key = {
"<leader>z",
},
ft = {
"markdown",
},
}

View File

@ -1,4 +1,6 @@
-- telescope settings
return {
"nvim-telescope/telescope.nvim",
config = function()
require("telescope").setup({
defaults = {
-- sorting
@ -11,3 +13,8 @@ require("telescope").setup({
},
},
})
end,
dependencies = {
"nvim-lua/plenary.nvim",
},
}

View File

@ -1,3 +1,7 @@
return {
"akinsho/toggleterm.nvim",
cmd = { "ToggleTerm" },
config = function()
vim.o.hidden = true
require("toggleterm").setup({
start_in_insert = false,
@ -5,3 +9,8 @@ require("toggleterm").setup({
require("term-edit").setup({
prompt_end = "%$ ",
})
end,
dependencies = {
"chomosuke/term-edit.nvim",
},
}

View File

@ -1 +1,18 @@
return {
"nvim-treesitter/nvim-treesitter-context",
"RRethy/nvim-treesitter-textsubjects",
config = function()
require("treesitter-context").setup()
require("nvim-treesitter.configs").setup({
textsubjects = {
enable = true,
prev_selection = ",", -- (Optional) keymap to select the previous selection
keymaps = {
["."] = "textsubjects-smart",
[";"] = "textsubjects-container-outer",
["i;"] = "textsubjects-container-inner",
},
},
})
end,
}

View File

@ -1,11 +0,0 @@
require("nvim-treesitter.configs").setup({
textsubjects = {
enable = true,
prev_selection = ",", -- (Optional) keymap to select the previous selection
keymaps = {
["."] = "textsubjects-smart",
[";"] = "textsubjects-container-outer",
["i;"] = "textsubjects-container-inner",
},
},
})

View File

@ -1,5 +1,10 @@
return {
"nvim-treesitter/nvim-treesitter",
config = function()
require("nvim-treesitter.configs").setup({
highlight = {
enable = true,
},
})
end,
}

View File

@ -1 +1,8 @@
return {
"folke/trouble.nvim",
cmd = { "Trouble", "TroubleToggle" },
config = function()
require("plugins.trouble")
require("trouble").setup()
end,
}

View File

@ -1,7 +1,19 @@
return {
"hrsh7th/vim-vsnip",
dependencies = {
"rafamadriz/friendly-snippets",
},
config = function()
-- jumpable mappings
vim.api.nvim_exec([[
vim.api.nvim_exec(
[[
imap <expr> <Tab> vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)' : '<Tab>'
smap <expr> <Tab> vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)' : '<Tab>'
imap <expr> <S-Tab> vsnip#jumpable(-1) ? '<Plug>(vsnip-jump-prev)' : '<S-Tab>'
smap <expr> <S-Tab> vsnip#jumpable(-1) ? '<Plug>(vsnip-jump-prev)' : '<S-Tab>'
]], false)
]],
false
)
end,
}

View File

@ -1,3 +1,9 @@
return {
"folke/which-key.nvim",
key = {
"<leader>",
},
config = function()
local wk = require("which-key")
wk.register({
a = { name = "actions" },
@ -10,3 +16,5 @@ wk.register({
t = { name = "telescope" },
v = { name = "vcs" },
}, { prefix = "<leader>" })
end,
}

View File

@ -0,0 +1,6 @@
return {
"nekonako/xresources-nvim",
config = function()
require("xresources")
end,
}