Make all plugin configs return a function
Simplifies writing the `config = ...` field for each plugin
This commit is contained in:
+3
-3
@@ -266,8 +266,8 @@ function P.setup_server(self, name)
|
|||||||
self:reload_server_buf(name)
|
self:reload_server_buf(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
function P.setup(self)
|
function P.setup()
|
||||||
self._setup_diagnostics()
|
P._setup_diagnostics()
|
||||||
|
|
||||||
utils.try_require("cmp_nvim_lsp", package_name, function (mod)
|
utils.try_require("cmp_nvim_lsp", package_name, function (mod)
|
||||||
P.capabilities = mod.default_capabilities()
|
P.capabilities = mod.default_capabilities()
|
||||||
@@ -276,7 +276,7 @@ function P.setup(self)
|
|||||||
utils.try_require("mason-lspconfig", package_name, function (mod)
|
utils.try_require("mason-lspconfig", package_name, function (mod)
|
||||||
mod.setup_handlers({
|
mod.setup_handlers({
|
||||||
function (name)
|
function (name)
|
||||||
self:setup_server(name)
|
P:setup_server(name)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
|
|||||||
+29
-29
@@ -30,14 +30,14 @@ local plugins = {
|
|||||||
"rcarriga/nvim-notify",
|
"rcarriga/nvim-notify",
|
||||||
priority = 900,
|
priority = 900,
|
||||||
lazy = false,
|
lazy = false,
|
||||||
config = function () require("plugins.notify") end,
|
config = require("plugins.notify"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"rafamadriz/friendly-snippets",
|
"rafamadriz/friendly-snippets",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
config = function () require("plugins.luasnip") end,
|
config = require("plugins.luasnip"),
|
||||||
-- comment out on windows and install jsregexp manually
|
-- comment out on windows and install jsregexp manually
|
||||||
build = (
|
build = (
|
||||||
require("utils").os_name ~= "Windows_NT"
|
require("utils").os_name ~= "Windows_NT"
|
||||||
@@ -48,7 +48,7 @@ local plugins = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"windwp/nvim-autopairs",
|
"windwp/nvim-autopairs",
|
||||||
config = function () require("plugins.autopairs") end,
|
config = require("plugins.autopairs"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"saadparwaiz1/cmp_luasnip",
|
"saadparwaiz1/cmp_luasnip",
|
||||||
@@ -70,63 +70,63 @@ local plugins = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"hrsh7th/nvim-cmp",
|
"hrsh7th/nvim-cmp",
|
||||||
config = function () require("plugins.cmp") end,
|
config = require("plugins.cmp"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"onsails/lspkind.nvim",
|
"onsails/lspkind.nvim",
|
||||||
config = function () require("plugins.lspkind") end,
|
config = require("plugins.lspkind"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"williamboman/mason.nvim",
|
"williamboman/mason.nvim",
|
||||||
config = function () require("plugins.mason") end,
|
config = require("plugins.mason"),
|
||||||
lazy = true,
|
lazy = true,
|
||||||
event = "VimEnter",
|
event = "VimEnter",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"williamboman/mason-lspconfig.nvim",
|
"williamboman/mason-lspconfig.nvim",
|
||||||
config = function () require("plugins.mason_lspconfig") end,
|
config = require("plugins.mason_lspconfig"),
|
||||||
lazy = true,
|
lazy = true,
|
||||||
event = "VimEnter",
|
event = "VimEnter",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
config = function () require("lsp"):setup() end,
|
config = require("lsp").setup,
|
||||||
lazy = true,
|
lazy = true,
|
||||||
ft = require("lsp"):filetypes(),
|
ft = require("lsp"):filetypes(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
config = function () require("plugins.treesitter") end,
|
config = require("plugins.treesitter"),
|
||||||
build = ":TSUpdate",
|
build = ":TSUpdate",
|
||||||
lazy = true,
|
lazy = true,
|
||||||
event = "VimEnter",
|
event = "VimEnter",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mfussenegger/nvim-dap",
|
"mfussenegger/nvim-dap",
|
||||||
config = function () require("plugins.dap") end,
|
config = require("plugins.dap").setup,
|
||||||
lazy = true,
|
lazy = true,
|
||||||
ft = require("lsp"):filetypes(),
|
ft = require("lsp"):filetypes(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"rcarriga/nvim-dap-ui",
|
"rcarriga/nvim-dap-ui",
|
||||||
config = function () require("plugins.dap_ui") end,
|
config = require("plugins.dap_ui"),
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"mfussenegger/nvim-dap",
|
"mfussenegger/nvim-dap",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tpope/vim-fugitive",
|
"tpope/vim-fugitive",
|
||||||
config = function () require("plugins.fugitive") end,
|
config = require("plugins.fugitive"),
|
||||||
lazy = true,
|
lazy = true,
|
||||||
event = "VimEnter",
|
event = "VimEnter",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"rbong/vim-flog",
|
"rbong/vim-flog",
|
||||||
config = function () require("plugins.flog") end,
|
config = require("plugins.flog"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nvim-lualine/lualine.nvim",
|
"nvim-lualine/lualine.nvim",
|
||||||
config = function () require("plugins.lualine") end,
|
config = require("plugins.lualine"),
|
||||||
lazy = true,
|
lazy = true,
|
||||||
event = "VimEnter",
|
event = "VimEnter",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
@@ -135,13 +135,13 @@ local plugins = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"lewis6991/gitsigns.nvim",
|
"lewis6991/gitsigns.nvim",
|
||||||
config = function () require("plugins.gitsigns") end,
|
config = require("plugins.gitsigns"),
|
||||||
lazy = true,
|
lazy = true,
|
||||||
event = "VimEnter",
|
event = "VimEnter",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
config = function () require("plugins.telescope") end,
|
config = require("plugins.telescope"),
|
||||||
lazy = true,
|
lazy = true,
|
||||||
event = "VimEnter",
|
event = "VimEnter",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
@@ -150,25 +150,25 @@ local plugins = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"numToStr/Comment.nvim",
|
"numToStr/Comment.nvim",
|
||||||
config = function () require("plugins.comment") end,
|
config = require("plugins.comment"),
|
||||||
lazy = true,
|
lazy = true,
|
||||||
event = "VimEnter",
|
event = "VimEnter",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"lukas-reineke/indent-blankline.nvim",
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
config = function () require("plugins.indent-blankline") end,
|
config = require("plugins.indent-blankline"),
|
||||||
lazy = true,
|
lazy = true,
|
||||||
event = "VimEnter",
|
event = "VimEnter",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"simeji/winresizer",
|
"simeji/winresizer",
|
||||||
config = function () require("plugins.winresizer") end,
|
config = require("plugins.winresizer"),
|
||||||
lazy = true,
|
lazy = true,
|
||||||
keys = { "<C-W>r", },
|
keys = { "<C-W>r", },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"sindrets/winshift.nvim",
|
"sindrets/winshift.nvim",
|
||||||
config = function () require("plugins.winshift") end,
|
config = require("plugins.winshift"),
|
||||||
lazy = true,
|
lazy = true,
|
||||||
keys = { "<C-W>m", },
|
keys = { "<C-W>m", },
|
||||||
},
|
},
|
||||||
@@ -179,7 +179,7 @@ local plugins = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"kyazdani42/nvim-tree.lua",
|
"kyazdani42/nvim-tree.lua",
|
||||||
config = function () require("plugins.tree") end,
|
config = require("plugins.tree"),
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-tree/nvim-web-devicons",
|
"nvim-tree/nvim-web-devicons",
|
||||||
},
|
},
|
||||||
@@ -191,7 +191,7 @@ local plugins = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"stevearc/aerial.nvim",
|
"stevearc/aerial.nvim",
|
||||||
config = function () require("plugins.aerial") end,
|
config = require("plugins.aerial"),
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
"nvim-tree/nvim-web-devicons",
|
"nvim-tree/nvim-web-devicons",
|
||||||
@@ -199,23 +199,23 @@ local plugins = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"RubixDev/mason-update-all",
|
"RubixDev/mason-update-all",
|
||||||
config = function () require("plugins.mason_update_all") end,
|
config = require("plugins.mason_update_all"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"famiu/bufdelete.nvim",
|
"famiu/bufdelete.nvim",
|
||||||
config = function () require("plugins.bufdelete") end,
|
config = require("plugins.bufdelete"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter-context",
|
"nvim-treesitter/nvim-treesitter-context",
|
||||||
config = function () require("plugins.treesitter-context") end,
|
config = require("plugins.treesitter-context"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fedepujol/move.nvim",
|
"fedepujol/move.nvim",
|
||||||
config = function () require("plugins.move") end,
|
config = require("plugins.move"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nvim-orgmode/orgmode",
|
"nvim-orgmode/orgmode",
|
||||||
config = function () require("plugins.orgmode") end,
|
config = require("plugins.orgmode"),
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
},
|
},
|
||||||
@@ -225,7 +225,7 @@ local plugins = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"sindrets/diffview.nvim",
|
"sindrets/diffview.nvim",
|
||||||
config = function () require("plugins.diffview") end,
|
config = require("plugins.diffview"),
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-tree/nvim-web-devicons",
|
"nvim-tree/nvim-web-devicons",
|
||||||
},
|
},
|
||||||
@@ -233,7 +233,7 @@ local plugins = {
|
|||||||
{
|
{
|
||||||
"iamcco/markdown-preview.nvim",
|
"iamcco/markdown-preview.nvim",
|
||||||
build = "cd app && npm install",
|
build = "cd app && npm install",
|
||||||
config = function () require("plugins.markdown-preview") end,
|
config = require("plugins.markdown-preview"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+24
-20
@@ -13,23 +13,27 @@
|
|||||||
|
|
||||||
-- https://github.com/stevearc/aerial.nvim
|
-- https://github.com/stevearc/aerial.nvim
|
||||||
|
|
||||||
require("aerial").setup({
|
local function setup()
|
||||||
layout = {
|
require("aerial").setup({
|
||||||
min_width = 40,
|
layout = {
|
||||||
placement = "edge",
|
min_width = 40,
|
||||||
},
|
placement = "edge",
|
||||||
disable_max_size = 10000000,
|
},
|
||||||
highlight_on_hover = true,
|
disable_max_size = 10000000,
|
||||||
ignore = {
|
highlight_on_hover = true,
|
||||||
unlisted_buffers = true,
|
ignore = {
|
||||||
},
|
unlisted_buffers = true,
|
||||||
on_attach = function (bufnr)
|
},
|
||||||
vim.keymap.set(
|
on_attach = function (bufnr)
|
||||||
"n",
|
vim.keymap.set(
|
||||||
"<leader>at",
|
"n",
|
||||||
function () vim.cmd.AerialToggle({ bang = true, }) end,
|
"<leader>at",
|
||||||
{ buffer = bufnr, }
|
function () vim.cmd.AerialToggle({ bang = true, }) end,
|
||||||
)
|
{ buffer = bufnr, }
|
||||||
end,
|
)
|
||||||
show_guides = true,
|
end,
|
||||||
})
|
show_guides = true,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
@@ -16,6 +16,10 @@
|
|||||||
|
|
||||||
-- https://github.com/windwp/nvim-autopairs
|
-- https://github.com/windwp/nvim-autopairs
|
||||||
|
|
||||||
require("nvim-autopairs").setup({
|
local function setup()
|
||||||
fast_wrap = {},
|
require("nvim-autopairs").setup({
|
||||||
})
|
fast_wrap = {},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
@@ -16,9 +16,13 @@
|
|||||||
|
|
||||||
-- https://github.com/famiu/bufdelete.nvim
|
-- https://github.com/famiu/bufdelete.nvim
|
||||||
|
|
||||||
vim.keymap.set(
|
local function setup()
|
||||||
"n",
|
vim.keymap.set(
|
||||||
"<C-w>q",
|
"n",
|
||||||
vim.cmd.Bwipeout,
|
"<C-w>q",
|
||||||
{ remap = false, silent = true, }
|
vim.cmd.Bwipeout,
|
||||||
)
|
{ remap = false, silent = true, }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
+51
-47
@@ -16,57 +16,61 @@
|
|||||||
|
|
||||||
-- https://github.com/catppuccin/nvim
|
-- https://github.com/catppuccin/nvim
|
||||||
|
|
||||||
local catppuccin = require("catppuccin")
|
local function setup()
|
||||||
|
local catppuccin = require("catppuccin")
|
||||||
|
|
||||||
-- Sometimes requires running :CatppuccinCompile,
|
-- Sometimes requires running :CatppuccinCompile,
|
||||||
-- like when switching to a font that supports italics.
|
-- like when switching to a font that supports italics.
|
||||||
catppuccin.setup({
|
catppuccin.setup({
|
||||||
flavour = "mocha", -- latte, frappe, macchiato, mocha
|
flavour = "mocha", -- latte, frappe, macchiato, mocha
|
||||||
no_italic = false,
|
no_italic = false,
|
||||||
styles = {
|
styles = {
|
||||||
comments = { "italic", },
|
comments = { "italic", },
|
||||||
},
|
|
||||||
integrations = {
|
|
||||||
cmp = true,
|
|
||||||
gitsigns = true,
|
|
||||||
nvimtree = true,
|
|
||||||
treesitter = true,
|
|
||||||
notify = true,
|
|
||||||
aerial = true,
|
|
||||||
indent_blankline = {
|
|
||||||
enabled = true,
|
|
||||||
colored_indent_levels = false,
|
|
||||||
},
|
},
|
||||||
mason = true,
|
integrations = {
|
||||||
neogit = true,
|
cmp = true,
|
||||||
noice = true,
|
gitsigns = true,
|
||||||
dap = {
|
nvimtree = true,
|
||||||
enabled = true,
|
treesitter = true,
|
||||||
enable_ui = true,
|
notify = true,
|
||||||
},
|
aerial = true,
|
||||||
native_lsp = {
|
indent_blankline = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
virtual_text = {
|
colored_indent_levels = false,
|
||||||
errors = { "italic", },
|
|
||||||
hints = { "italic", },
|
|
||||||
warnings = { "italic", },
|
|
||||||
information = { "italic", },
|
|
||||||
},
|
},
|
||||||
underlines = {
|
mason = true,
|
||||||
errors = { "underline", },
|
neogit = true,
|
||||||
hints = { "underline", },
|
noice = true,
|
||||||
warnings = { "underline", },
|
dap = {
|
||||||
information = { "underline", },
|
enabled = true,
|
||||||
|
enable_ui = true,
|
||||||
},
|
},
|
||||||
inlay_hints = {
|
native_lsp = {
|
||||||
background = true,
|
enabled = true,
|
||||||
|
virtual_text = {
|
||||||
|
errors = { "italic", },
|
||||||
|
hints = { "italic", },
|
||||||
|
warnings = { "italic", },
|
||||||
|
information = { "italic", },
|
||||||
|
},
|
||||||
|
underlines = {
|
||||||
|
errors = { "underline", },
|
||||||
|
hints = { "underline", },
|
||||||
|
warnings = { "underline", },
|
||||||
|
information = { "underline", },
|
||||||
|
},
|
||||||
|
inlay_hints = {
|
||||||
|
background = true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
telescope = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
lsp_trouble = true,
|
||||||
},
|
},
|
||||||
telescope = {
|
})
|
||||||
enabled = true,
|
|
||||||
},
|
|
||||||
lsp_trouble = true,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
catppuccin.load()
|
catppuccin.load()
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
+147
-141
@@ -16,9 +16,7 @@
|
|||||||
|
|
||||||
-- https://github.com/hrsh7th/nvim-cmp
|
-- https://github.com/hrsh7th/nvim-cmp
|
||||||
|
|
||||||
local module_name = "plugins.config.cmp"
|
local function has_words_before()
|
||||||
|
|
||||||
local has_words_before = function ()
|
|
||||||
unpack = unpack or table.unpack
|
unpack = unpack or table.unpack
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
return col ~= 0
|
return col ~= 0
|
||||||
@@ -27,149 +25,157 @@ local has_words_before = function ()
|
|||||||
:match("%s") == nil
|
:match("%s") == nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local utils = require("utils")
|
local function setup()
|
||||||
local cmp = require("cmp")
|
local module_name = "plugins.config.cmp"
|
||||||
local luasnip = require("luasnip")
|
local utils = require("utils")
|
||||||
|
local cmp = require("cmp")
|
||||||
|
local luasnip = require("luasnip")
|
||||||
|
|
||||||
local lspkind
|
local lspkind
|
||||||
utils.try_require("lspkind", module_name, function (module)
|
utils.try_require("lspkind", module_name, function (module)
|
||||||
lspkind = module
|
lspkind = module
|
||||||
end)
|
end)
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
enabled = function ()
|
enabled = function ()
|
||||||
-- disable completion in comments
|
-- disable completion in comments
|
||||||
local context = require "cmp.config.context"
|
local context = require "cmp.config.context"
|
||||||
-- keep command mode completion enabled when cursor is in a comment
|
-- keep command mode completion enabled when cursor is in a comment
|
||||||
if vim.api.nvim_get_mode().mode == "c" then
|
if vim.api.nvim_get_mode().mode == "c" then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
return not context.in_treesitter_capture("comment") and
|
return not context.in_treesitter_capture("comment") and
|
||||||
not context.in_syntax_group("Comment")
|
not context.in_syntax_group("Comment")
|
||||||
end
|
|
||||||
end,
|
|
||||||
completion = { keyword_length = 3, },
|
|
||||||
snippet = {
|
|
||||||
expand = function (args)
|
|
||||||
luasnip.lsp_expand(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
formatting = {
|
|
||||||
format = function (entry, vim_item)
|
|
||||||
if lspkind then
|
|
||||||
vim_item = lspkind.cmp_format({
|
|
||||||
mode = "symbol",
|
|
||||||
maxwidth = 50,
|
|
||||||
ellipsis_char = "...",
|
|
||||||
before = function (_, item)
|
|
||||||
item.dup = 0 -- remove duplicates, see nvim-cmp #511
|
|
||||||
return item
|
|
||||||
end,
|
|
||||||
})(entry, vim_item)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return vim_item
|
|
||||||
end,
|
end,
|
||||||
},
|
completion = { keyword_length = 3, },
|
||||||
experimental = { ghost_text = true, },
|
snippet = {
|
||||||
mapping = {
|
expand = function (args)
|
||||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
luasnip.lsp_expand(args.body)
|
||||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
end,
|
||||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
},
|
||||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
formatting = {
|
||||||
["<CR>"] = cmp.mapping(
|
format = function (entry, vim_item)
|
||||||
function (fallback)
|
if lspkind then
|
||||||
if cmp.visible() then
|
vim_item = lspkind.cmp_format({
|
||||||
cmp.confirm(
|
mode = "symbol",
|
||||||
{
|
maxwidth = 50,
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
ellipsis_char = "...",
|
||||||
select = true,
|
before = function (_, item)
|
||||||
}
|
item.dup = 0 -- remove duplicates, see nvim-cmp #511
|
||||||
)
|
return item
|
||||||
else
|
end,
|
||||||
fallback()
|
})(entry, vim_item)
|
||||||
end
|
end
|
||||||
end, { "i", "s", }
|
|
||||||
),
|
|
||||||
["<Tab>"] = cmp.mapping(
|
|
||||||
function (fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
elseif luasnip.expand_or_jumpable() then
|
|
||||||
luasnip.expand_or_jump()
|
|
||||||
elseif has_words_before() then
|
|
||||||
cmp.complete()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s", }
|
|
||||||
),
|
|
||||||
["<S-Tab>"] = cmp.mapping(
|
|
||||||
function (fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
elseif luasnip.jumpable(-1) then
|
|
||||||
luasnip.jump(-1)
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s", }
|
|
||||||
),
|
|
||||||
["<Down>"] = cmp.mapping(
|
|
||||||
function (fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s", }
|
|
||||||
),
|
|
||||||
["<Up>"] = cmp.mapping(
|
|
||||||
function (fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s", }
|
|
||||||
),
|
|
||||||
},
|
|
||||||
sources = {
|
|
||||||
{ name = "nvim_lsp", },
|
|
||||||
{ name = "luasnip", },
|
|
||||||
{ name = "nvim_lua", },
|
|
||||||
{ name = "orgmode", },
|
|
||||||
{ name = "path", },
|
|
||||||
-- { name = 'buffer' },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
cmp.setup.cmdline(
|
return vim_item
|
||||||
"/",
|
end,
|
||||||
{
|
},
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
experimental = { ghost_text = true, },
|
||||||
sources = { { name = "buffer", }, },
|
mapping = {
|
||||||
}
|
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||||
)
|
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||||
|
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
["<CR>"] = cmp.mapping(
|
||||||
|
function (fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.confirm(
|
||||||
|
{
|
||||||
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
|
select = true,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s", }
|
||||||
|
),
|
||||||
|
["<Tab>"] = cmp.mapping(
|
||||||
|
function (fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
elseif has_words_before() then
|
||||||
|
cmp.complete()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s", }
|
||||||
|
),
|
||||||
|
["<S-Tab>"] = cmp.mapping(
|
||||||
|
function (fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif luasnip.jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s", }
|
||||||
|
),
|
||||||
|
["<Down>"] = cmp.mapping(
|
||||||
|
function (fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s", }
|
||||||
|
),
|
||||||
|
["<Up>"] = cmp.mapping(
|
||||||
|
function (fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s", }
|
||||||
|
),
|
||||||
|
},
|
||||||
|
sources = {
|
||||||
|
{ name = "nvim_lsp", },
|
||||||
|
{ name = "luasnip", },
|
||||||
|
{ name = "nvim_lua", },
|
||||||
|
{ name = "orgmode", },
|
||||||
|
{ name = "path", },
|
||||||
|
-- { name = 'buffer' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
cmp.setup.cmdline(
|
cmp.setup.cmdline(
|
||||||
":",
|
"/",
|
||||||
{
|
{
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
sources = cmp.config.sources(
|
sources = { { name = "buffer", }, },
|
||||||
{ { name = "path", }, },
|
}
|
||||||
{ { name = "cmdline", option = { ignore_cmds = { "Man", "!", }, }, }, }
|
)
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
utils.try_require(
|
cmp.setup.cmdline(
|
||||||
"nvim-autopairs.completion.cmp",
|
":",
|
||||||
module_name,
|
{
|
||||||
function (cmp_autopairs)
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
cmp.event:on(
|
sources = cmp.config.sources(
|
||||||
"confirm_done",
|
{ { name = "path", }, },
|
||||||
cmp_autopairs.on_confirm_done()
|
{ {
|
||||||
)
|
name = "cmdline",
|
||||||
end
|
option = { ignore_cmds = { "Man", "!", }, },
|
||||||
)
|
}, }
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
utils.try_require(
|
||||||
|
"nvim-autopairs.completion.cmp",
|
||||||
|
module_name,
|
||||||
|
function (cmp_autopairs)
|
||||||
|
cmp.event:on(
|
||||||
|
"confirm_done",
|
||||||
|
cmp_autopairs.on_confirm_done()
|
||||||
|
)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
+10
-6
@@ -16,9 +16,13 @@
|
|||||||
|
|
||||||
-- https://github.com/numToStr/Comment.nvim
|
-- https://github.com/numToStr/Comment.nvim
|
||||||
|
|
||||||
require("Comment").setup(
|
local function setup()
|
||||||
{
|
require("Comment").setup(
|
||||||
--ignore empty lines
|
{
|
||||||
ignore = "^$",
|
--ignore empty lines
|
||||||
}
|
ignore = "^$",
|
||||||
)
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
+29
-24
@@ -16,29 +16,25 @@
|
|||||||
|
|
||||||
-- https://github.com/mfussenegger/nvim-dap
|
-- https://github.com/mfussenegger/nvim-dap
|
||||||
|
|
||||||
local dap = require("dap")
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<F5>", dap.continue)
|
|
||||||
vim.keymap.set("n", "<F10>", dap.step_over)
|
|
||||||
vim.keymap.set("n", "<F11>", dap.step_into)
|
|
||||||
vim.keymap.set("n", "<F12>", dap.step_out)
|
|
||||||
|
|
||||||
local utils = require("utils")
|
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local env_ok = false
|
M.env_ok = false
|
||||||
|
|
||||||
|
function M.check_env()
|
||||||
|
local utils = require("utils")
|
||||||
|
|
||||||
local function check_env()
|
|
||||||
utils.assert_installed("python3")
|
utils.assert_installed("python3")
|
||||||
utils.assert_python3_module_installed("debugpy")
|
utils.assert_python3_module_installed("debugpy")
|
||||||
env_ok = true
|
M.env_ok = true
|
||||||
end
|
end
|
||||||
|
|
||||||
local function start(config)
|
function M.start(config)
|
||||||
if not env_ok then
|
local dap = require("dap")
|
||||||
check_env()
|
|
||||||
|
if not M.env_ok then
|
||||||
|
M:check_env()
|
||||||
end
|
end
|
||||||
|
|
||||||
dap.adapters.python = {
|
dap.adapters.python = {
|
||||||
type = "executable",
|
type = "executable",
|
||||||
command = "python",
|
command = "python",
|
||||||
@@ -65,7 +61,7 @@ function M.launch(args)
|
|||||||
console = "integratedTerminal",
|
console = "integratedTerminal",
|
||||||
args = args,
|
args = args,
|
||||||
}
|
}
|
||||||
start(config)
|
M.start(config)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.pytest(args)
|
function M.pytest(args)
|
||||||
@@ -83,16 +79,25 @@ function M.pytest(args)
|
|||||||
console = "integratedTerminal",
|
console = "integratedTerminal",
|
||||||
-- program = "${file}";
|
-- program = "${file}";
|
||||||
}
|
}
|
||||||
start(config)
|
M.start(config)
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
function M.setup()
|
||||||
TODO: Add this after loading dap for integrating catppuccin:
|
local dap = require("dap")
|
||||||
local sign = vim.fn.sign_define
|
|
||||||
|
|
||||||
sign("DapBreakpoint", { text = "●", texthl = "DapBreakpoint", linehl = "", numhl = ""})
|
vim.keymap.set("n", "<F5>", dap.continue)
|
||||||
sign("DapBreakpointCondition", { text = "●", texthl = "DapBreakpointCondition", linehl = "", numhl = ""})
|
vim.keymap.set("n", "<F10>", dap.step_over)
|
||||||
sign("DapLogPoint", { text = "◆", texthl = "DapLogPoint", linehl = "", numhl = ""})
|
vim.keymap.set("n", "<F11>", dap.step_into)
|
||||||
--]]
|
vim.keymap.set("n", "<F12>", dap.step_out)
|
||||||
|
|
||||||
|
--[[
|
||||||
|
TODO: Add this after loading dap for integrating catppuccin:
|
||||||
|
local sign = vim.fn.sign_define
|
||||||
|
|
||||||
|
sign("DapBreakpoint", { text = "●", texthl = "DapBreakpoint", linehl = "", numhl = ""})
|
||||||
|
sign("DapBreakpointCondition", { text = "●", texthl = "DapBreakpointCondition", linehl = "", numhl = ""})
|
||||||
|
sign("DapLogPoint", { text = "◆", texthl = "DapLogPoint", linehl = "", numhl = ""})
|
||||||
|
--]]
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
+43
-39
@@ -16,44 +16,48 @@
|
|||||||
|
|
||||||
-- https://github.com/rcarriga/nvim-dap-ui
|
-- https://github.com/rcarriga/nvim-dap-ui
|
||||||
|
|
||||||
require("dapui").setup({
|
local function setup()
|
||||||
icons = { expanded = "▾", collapsed = "▸", },
|
require("dapui").setup({
|
||||||
mappings = {
|
icons = { expanded = "▾", collapsed = "▸", },
|
||||||
-- Use a table to apply multiple mappings
|
|
||||||
expand = { "<CR>", "<2-LeftMouse>", },
|
|
||||||
open = "o",
|
|
||||||
remove = "d",
|
|
||||||
edit = "e",
|
|
||||||
repl = "r",
|
|
||||||
toggle = "t",
|
|
||||||
},
|
|
||||||
layouts = {
|
|
||||||
{
|
|
||||||
elements = {
|
|
||||||
"scopes",
|
|
||||||
"breakpoints",
|
|
||||||
"stacks",
|
|
||||||
"watches",
|
|
||||||
},
|
|
||||||
size = 40,
|
|
||||||
position = "left",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
elements = {
|
|
||||||
"repl",
|
|
||||||
"console",
|
|
||||||
},
|
|
||||||
size = 10,
|
|
||||||
position = "bottom",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
floating = {
|
|
||||||
max_height = nil, -- These can be integers or a float between 0 and 1.
|
|
||||||
max_width = nil, -- Floats will be treated as percentage of your screen.
|
|
||||||
border = "single", -- Border style. Can be "single", "double" or "rounded"
|
|
||||||
mappings = {
|
mappings = {
|
||||||
close = { "q", "<Esc>", },
|
-- Use a table to apply multiple mappings
|
||||||
|
expand = { "<CR>", "<2-LeftMouse>", },
|
||||||
|
open = "o",
|
||||||
|
remove = "d",
|
||||||
|
edit = "e",
|
||||||
|
repl = "r",
|
||||||
|
toggle = "t",
|
||||||
},
|
},
|
||||||
},
|
layouts = {
|
||||||
windows = { indent = 1, },
|
{
|
||||||
})
|
elements = {
|
||||||
|
"scopes",
|
||||||
|
"breakpoints",
|
||||||
|
"stacks",
|
||||||
|
"watches",
|
||||||
|
},
|
||||||
|
size = 40,
|
||||||
|
position = "left",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
elements = {
|
||||||
|
"repl",
|
||||||
|
"console",
|
||||||
|
},
|
||||||
|
size = 10,
|
||||||
|
position = "bottom",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
floating = {
|
||||||
|
max_height = nil, -- These can be integers or a float between 0 and 1.
|
||||||
|
max_width = nil, -- Floats will be treated as percentage of your screen.
|
||||||
|
border = "single", -- Border style. Can be "single", "double" or "rounded"
|
||||||
|
mappings = {
|
||||||
|
close = { "q", "<Esc>", },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
windows = { indent = 1, },
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
+67
-63
@@ -16,72 +16,76 @@
|
|||||||
|
|
||||||
-- https://github.com/sindrets/diffview.nvim
|
-- https://github.com/sindrets/diffview.nvim
|
||||||
|
|
||||||
local actions = require("diffview.actions")
|
local function setup()
|
||||||
|
local actions = require("diffview.actions")
|
||||||
|
|
||||||
require("diffview").setup({
|
require("diffview").setup({
|
||||||
enhanced_diff_hl = true,
|
enhanced_diff_hl = true,
|
||||||
view = {
|
view = {
|
||||||
default = {
|
default = {
|
||||||
layout = "diff2_horizontal",
|
layout = "diff2_horizontal",
|
||||||
winbar_info = true,
|
winbar_info = true,
|
||||||
},
|
|
||||||
merge_tool = {
|
|
||||||
layout = "diff3_mixed",
|
|
||||||
disable_diagnostics = true,
|
|
||||||
winbar_info = true,
|
|
||||||
},
|
|
||||||
file_history = {
|
|
||||||
layout = "diff2_horizontal",
|
|
||||||
winbar_info = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
default_args = {
|
|
||||||
DiffviewOpen = { "--imply-local", },
|
|
||||||
},
|
|
||||||
keymaps = {
|
|
||||||
file_panel = {
|
|
||||||
["<cr>"] = false,
|
|
||||||
{
|
|
||||||
"n",
|
|
||||||
"<CR>",
|
|
||||||
function ()
|
|
||||||
actions.select_entry()
|
|
||||||
vim.cmd.wincmd("l")
|
|
||||||
end,
|
|
||||||
{ desc = "Open the current file in diffview", },
|
|
||||||
},
|
},
|
||||||
{
|
merge_tool = {
|
||||||
"n",
|
layout = "diff3_mixed",
|
||||||
"s",
|
disable_diagnostics = true,
|
||||||
actions.toggle_stage_entry,
|
winbar_info = true,
|
||||||
{ desc = "Stage / unstage the selected entry", },
|
|
||||||
},
|
},
|
||||||
{
|
file_history = {
|
||||||
"n",
|
layout = "diff2_horizontal",
|
||||||
"u",
|
winbar_info = true,
|
||||||
actions.toggle_stage_entry,
|
|
||||||
{ desc = "Stage / unstage the selected entry", },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"n",
|
|
||||||
"cc",
|
|
||||||
function ()
|
|
||||||
vim.cmd.G("commit")
|
|
||||||
vim.cmd.wincmd("J")
|
|
||||||
end,
|
|
||||||
{ desc = "Commit staged changes", },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"n",
|
|
||||||
"ca",
|
|
||||||
function ()
|
|
||||||
vim.cmd.G("commit --amend")
|
|
||||||
vim.cmd.wincmd("J")
|
|
||||||
end,
|
|
||||||
{ desc = "Amend the last commit", },
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
default_args = {
|
||||||
})
|
DiffviewOpen = { "--imply-local", },
|
||||||
|
},
|
||||||
|
keymaps = {
|
||||||
|
file_panel = {
|
||||||
|
["<cr>"] = false,
|
||||||
|
{
|
||||||
|
"n",
|
||||||
|
"<CR>",
|
||||||
|
function ()
|
||||||
|
actions.select_entry()
|
||||||
|
vim.cmd.wincmd("l")
|
||||||
|
end,
|
||||||
|
{ desc = "Open the current file in diffview", },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"n",
|
||||||
|
"s",
|
||||||
|
actions.toggle_stage_entry,
|
||||||
|
{ desc = "Stage / unstage the selected entry", },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"n",
|
||||||
|
"u",
|
||||||
|
actions.toggle_stage_entry,
|
||||||
|
{ desc = "Stage / unstage the selected entry", },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"n",
|
||||||
|
"cc",
|
||||||
|
function ()
|
||||||
|
vim.cmd.G("commit")
|
||||||
|
vim.cmd.wincmd("J")
|
||||||
|
end,
|
||||||
|
{ desc = "Commit staged changes", },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"n",
|
||||||
|
"ca",
|
||||||
|
function ()
|
||||||
|
vim.cmd.G("commit --amend")
|
||||||
|
vim.cmd.wincmd("J")
|
||||||
|
end,
|
||||||
|
{ desc = "Amend the last commit", },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>gg", vim.cmd.DiffviewOpen)
|
vim.keymap.set("n", "<leader>gg", vim.cmd.DiffviewOpen)
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
@@ -16,4 +16,8 @@
|
|||||||
|
|
||||||
-- https://github.com/rbong/vim-flog
|
-- https://github.com/rbong/vim-flog
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>gl", vim.cmd.Flog)
|
local function setup()
|
||||||
|
vim.keymap.set("n", "<leader>gl", vim.cmd.Flog)
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
+18
-14
@@ -16,19 +16,23 @@
|
|||||||
|
|
||||||
-- https://github.com/tpope/vim-fugitive
|
-- https://github.com/tpope/vim-fugitive
|
||||||
|
|
||||||
local function git_status_tab()
|
local function setup()
|
||||||
vim.cmd.tabnew()
|
local function git_status_tab()
|
||||||
vim.cmd("leftabove vertical G")
|
vim.cmd.tabnew()
|
||||||
vim.cmd("vertical resize 60")
|
vim.cmd("leftabove vertical G")
|
||||||
vim.cmd.set("wfw")
|
vim.cmd("vertical resize 60")
|
||||||
|
vim.cmd.set("wfw")
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>gd", vim.cmd.Gdiffsplit)
|
||||||
|
vim.keymap.set("n", "<leader>gc", function () vim.cmd.G("commit") end)
|
||||||
|
vim.keymap.set("n", "<leader>ga", function () vim.cmd.G("commit --amend") end)
|
||||||
|
vim.keymap.set("n", "<leader>gp", function () vim.cmd.G("push") end)
|
||||||
|
|
||||||
|
-- Only used if diffview is not available
|
||||||
|
if not pcall(require, "diffview") then
|
||||||
|
vim.keymap.set("n", "<leader>gg", git_status_tab)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>gd", vim.cmd.Gdiffsplit)
|
return setup
|
||||||
vim.keymap.set("n", "<leader>gc", function () vim.cmd.G("commit") end)
|
|
||||||
vim.keymap.set("n", "<leader>ga", function () vim.cmd.G("commit --amend") end)
|
|
||||||
vim.keymap.set("n", "<leader>gp", function () vim.cmd.G("push") end)
|
|
||||||
|
|
||||||
-- Only used if diffview is not available
|
|
||||||
if not pcall(require, "diffview") then
|
|
||||||
vim.keymap.set("n", "<leader>gg", git_status_tab)
|
|
||||||
end
|
|
||||||
|
|||||||
+32
-26
@@ -16,29 +16,35 @@
|
|||||||
|
|
||||||
-- https://github.com/lewis6991/gitsigns.nvim
|
-- https://github.com/lewis6991/gitsigns.nvim
|
||||||
|
|
||||||
require("gitsigns").setup({
|
local function setup()
|
||||||
on_attach = function (bufnr)
|
require("gitsigns").setup({
|
||||||
local gs = package.loaded.gitsigns
|
on_attach = function (bufnr)
|
||||||
vim.keymap.set("n", "<leader>gv", gs.select_hunk, { buffer = bufnr, })
|
local gs = package.loaded.gitsigns
|
||||||
vim.keymap.set("n", "<leader>gs", gs.stage_hunk, { buffer = bufnr, })
|
vim.keymap.set("n", "<leader>gv", gs.select_hunk, { buffer = bufnr, })
|
||||||
vim.keymap.set("n", "<leader>gu", gs.undo_stage_hunk, { buffer = bufnr, })
|
vim.keymap.set("n", "<leader>gs", gs.stage_hunk, { buffer = bufnr, })
|
||||||
vim.keymap.set("n", "<leader>gr", gs.reset_hunk, { buffer = bufnr, })
|
vim.keymap.set("n", "<leader>gu", gs.undo_stage_hunk,
|
||||||
vim.keymap.set(
|
{ buffer = bufnr, })
|
||||||
"x",
|
vim.keymap.set("n", "<leader>gr", gs.reset_hunk, { buffer = bufnr, })
|
||||||
"<leader>gr",
|
vim.keymap.set(
|
||||||
":Gitsigns reset_hunk<CR>",
|
"x",
|
||||||
{ buffer = bufnr, }
|
"<leader>gr",
|
||||||
)
|
":Gitsigns reset_hunk<CR>",
|
||||||
vim.keymap.set("n", "<leader>g?", gs.preview_hunk, { buffer = bufnr, })
|
{ buffer = bufnr, }
|
||||||
vim.keymap.set(
|
)
|
||||||
"n",
|
vim.keymap.set("n", "<leader>g?", gs.preview_hunk,
|
||||||
"<leader>gb",
|
{ buffer = bufnr, })
|
||||||
function ()
|
vim.keymap.set(
|
||||||
gs.blame_line { full = true, ignore_whitespace = true, }
|
"n",
|
||||||
end,
|
"<leader>gb",
|
||||||
{ buffer = bufnr, })
|
function ()
|
||||||
end,
|
gs.blame_line { full = true, ignore_whitespace = true, }
|
||||||
signs = {
|
end,
|
||||||
untracked = { text = "│", },
|
{ buffer = bufnr, })
|
||||||
},
|
end,
|
||||||
})
|
signs = {
|
||||||
|
untracked = { text = "│", },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
@@ -14,10 +14,14 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
]]
|
]]
|
||||||
|
|
||||||
require("indent_blankline").setup {
|
local function setup()
|
||||||
use_treesitter = true,
|
require("indent_blankline").setup {
|
||||||
show_first_indent_level = false,
|
use_treesitter = true,
|
||||||
show_trailing_blankline_indent = false,
|
show_first_indent_level = false,
|
||||||
show_current_context = true,
|
show_trailing_blankline_indent = false,
|
||||||
max_indent_increase = 1
|
show_current_context = true,
|
||||||
}
|
max_indent_increase = 1,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
@@ -17,3 +17,7 @@
|
|||||||
-- https://github.com/onsails/lspkind.nvim
|
-- https://github.com/onsails/lspkind.nvim
|
||||||
|
|
||||||
-- configured and loaded in plugins.config.cmp
|
-- configured and loaded in plugins.config.cmp
|
||||||
|
local function setup()
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
+31
-27
@@ -16,32 +16,36 @@
|
|||||||
|
|
||||||
-- https://github.com/nvim-lualine/lualine.nvim
|
-- https://github.com/nvim-lualine/lualine.nvim
|
||||||
|
|
||||||
require("lualine").setup({
|
local function setup()
|
||||||
options = {
|
require("lualine").setup({
|
||||||
icons_enabled = true,
|
options = {
|
||||||
theme = "auto",
|
icons_enabled = true,
|
||||||
component_separators = { left = "", right = "", },
|
theme = "auto",
|
||||||
section_separators = { left = "", right = "", },
|
component_separators = { left = "", right = "", },
|
||||||
always_divide_middle = true,
|
section_separators = { left = "", right = "", },
|
||||||
globalstatus = true,
|
always_divide_middle = true,
|
||||||
},
|
globalstatus = true,
|
||||||
sections = {
|
|
||||||
lualine_a = {},
|
|
||||||
lualine_b = {},
|
|
||||||
lualine_c = {
|
|
||||||
"mode",
|
|
||||||
{ "filename", path = 1, },
|
|
||||||
"diff",
|
|
||||||
{ "diagnostics", sources = { "nvim_lsp", }, },
|
|
||||||
},
|
},
|
||||||
lualine_x = {
|
sections = {
|
||||||
"bo:filetype",
|
lualine_a = {},
|
||||||
"encoding",
|
lualine_b = {},
|
||||||
"bo:fileformat",
|
lualine_c = {
|
||||||
"progress",
|
"mode",
|
||||||
"location",
|
{ "filename", path = 1, },
|
||||||
|
"diff",
|
||||||
|
{ "diagnostics", sources = { "nvim_lsp", }, },
|
||||||
|
},
|
||||||
|
lualine_x = {
|
||||||
|
"bo:filetype",
|
||||||
|
"encoding",
|
||||||
|
"bo:fileformat",
|
||||||
|
"progress",
|
||||||
|
"location",
|
||||||
|
},
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
},
|
},
|
||||||
lualine_y = {},
|
})
|
||||||
lualine_z = {},
|
end
|
||||||
},
|
|
||||||
})
|
return setup
|
||||||
|
|||||||
@@ -16,4 +16,8 @@
|
|||||||
|
|
||||||
-- https://github.com/L3MON4D3/LuaSnip
|
-- https://github.com/L3MON4D3/LuaSnip
|
||||||
|
|
||||||
require("luasnip.loaders.from_vscode").lazy_load()
|
local function setup()
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
@@ -16,8 +16,12 @@
|
|||||||
|
|
||||||
-- https://github.com/iamcco/markdown-preview.nvim
|
-- https://github.com/iamcco/markdown-preview.nvim
|
||||||
|
|
||||||
vim.g.mkdp_filetypes = { "markdown", }
|
local function setup()
|
||||||
vim.g.mkdp_port = "9080"
|
vim.g.mkdp_filetypes = { "markdown", }
|
||||||
vim.g.mkdp_echo_preview_url = 1
|
vim.g.mkdp_port = "9080"
|
||||||
vim.g.mkdp_open_ip = "192.168.2.22"
|
vim.g.mkdp_echo_preview_url = 1
|
||||||
vim.g.mkdp_open_to_the_world = 1
|
vim.g.mkdp_open_ip = "192.168.2.22"
|
||||||
|
vim.g.mkdp_open_to_the_world = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
@@ -16,4 +16,8 @@
|
|||||||
|
|
||||||
-- https://github.com/williamboman/mason.nvim
|
-- https://github.com/williamboman/mason.nvim
|
||||||
|
|
||||||
require("mason").setup()
|
local function setup()
|
||||||
|
require("mason").setup()
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
@@ -16,9 +16,13 @@
|
|||||||
|
|
||||||
-- https://github.com/williamboman/mason-lspconfig.nvim
|
-- https://github.com/williamboman/mason-lspconfig.nvim
|
||||||
|
|
||||||
require("mason-lspconfig").setup({
|
local function setup()
|
||||||
-- A list of servers to automatically install if they're not already installed. Example: { "rust_analyzer@nightly", "lua_ls" }
|
require("mason-lspconfig").setup({
|
||||||
-- This setting has no relation with the `automatic_installation` setting.
|
-- A list of servers to automatically install if they're not already installed. Example: { "rust_analyzer@nightly", "lua_ls" }
|
||||||
---@type string[]
|
-- This setting has no relation with the `automatic_installation` setting.
|
||||||
ensure_installed = require("lsp"):language_servers(),
|
---@type string[]
|
||||||
})
|
ensure_installed = require("lsp"):language_servers(),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
@@ -16,4 +16,8 @@
|
|||||||
|
|
||||||
-- https://github.com/RubixDev/mason-update-all
|
-- https://github.com/RubixDev/mason-update-all
|
||||||
|
|
||||||
require("mason-update-all").setup()
|
local function setup()
|
||||||
|
require("mason-update-all").setup()
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
+13
-9
@@ -16,12 +16,16 @@
|
|||||||
|
|
||||||
-- https://github.com/fedepujol/move.nvim
|
-- https://github.com/fedepujol/move.nvim
|
||||||
|
|
||||||
local opts = { noremap = true, silent = true, }
|
local function setup()
|
||||||
vim.keymap.set("n", "<A-j>", function () vim.cmd.MoveLine(1) end, opts)
|
local opts = { noremap = true, silent = true, }
|
||||||
vim.keymap.set("n", "<A-k>", function () vim.cmd.MoveLine(-1) end, opts)
|
vim.keymap.set("n", "<A-j>", function () vim.cmd.MoveLine(1) end, opts)
|
||||||
vim.keymap.set("n", "<A-h>", function () vim.cmd.MoveHChar(-1) end, opts)
|
vim.keymap.set("n", "<A-k>", function () vim.cmd.MoveLine(-1) end, opts)
|
||||||
vim.keymap.set("n", "<A-l>", function () vim.cmd.MoveHChar(1) end, opts)
|
vim.keymap.set("n", "<A-h>", function () vim.cmd.MoveHChar(-1) end, opts)
|
||||||
vim.keymap.set("x", "<A-j>", ":MoveBlock(1)<CR>", opts)
|
vim.keymap.set("n", "<A-l>", function () vim.cmd.MoveHChar(1) end, opts)
|
||||||
vim.keymap.set("x", "<A-k>", ":MoveBlock(-1)<CR>", opts)
|
vim.keymap.set("x", "<A-j>", ":MoveBlock(1)<CR>", opts)
|
||||||
vim.keymap.set("x", "<A-h>", ":MoveHBlock(-1)<CR>", opts)
|
vim.keymap.set("x", "<A-k>", ":MoveBlock(-1)<CR>", opts)
|
||||||
vim.keymap.set("x", "<A-l>", ":MoveHBlock(1)<CR>", opts)
|
vim.keymap.set("x", "<A-h>", ":MoveHBlock(-1)<CR>", opts)
|
||||||
|
vim.keymap.set("x", "<A-l>", ":MoveHBlock(1)<CR>", opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
+14
-10
@@ -16,17 +16,21 @@
|
|||||||
|
|
||||||
-- https://github.com/rcarriga/nvim-notify
|
-- https://github.com/rcarriga/nvim-notify
|
||||||
|
|
||||||
local has_telescope, telescope = pcall(require, "telescope")
|
local function setup()
|
||||||
|
local has_telescope, telescope = pcall(require, "telescope")
|
||||||
|
|
||||||
local notify = require("notify")
|
local notify = require("notify")
|
||||||
notify.setup({
|
notify.setup({
|
||||||
render = "default",
|
render = "default",
|
||||||
stages = "static",
|
stages = "static",
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.notify = notify
|
vim.notify = notify
|
||||||
|
|
||||||
if has_telescope then
|
if has_telescope then
|
||||||
telescope.load_extension("notify")
|
telescope.load_extension("notify")
|
||||||
vim.keymap.set("n", "<leader>fn", telescope.extensions.notify.notify)
|
vim.keymap.set("n", "<leader>fn", telescope.extensions.notify.notify)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
+32
-28
@@ -16,32 +16,36 @@
|
|||||||
|
|
||||||
-- https://github.com/nvim-orgmode/orgmode
|
-- https://github.com/nvim-orgmode/orgmode
|
||||||
|
|
||||||
local orgmode = require("orgmode")
|
local function setup()
|
||||||
orgmode.setup_ts_grammar()
|
local orgmode = require("orgmode")
|
||||||
orgmode.setup({
|
orgmode.setup_ts_grammar()
|
||||||
org_agenda_files = { "~/Documents/org/**/*", },
|
orgmode.setup({
|
||||||
org_default_notes_file = "~/Documents/org/notes.org",
|
org_agenda_files = { "~/Documents/org/**/*", },
|
||||||
org_todo_keywords = {
|
org_default_notes_file = "~/Documents/org/notes.org",
|
||||||
"TODO(t)",
|
org_todo_keywords = {
|
||||||
"ACTIVE(a)",
|
"TODO(t)",
|
||||||
"WAITING(w)",
|
"ACTIVE(a)",
|
||||||
"|",
|
"WAITING(w)",
|
||||||
"DONE(d)",
|
"|",
|
||||||
"DISCARDED(c)",
|
"DONE(d)",
|
||||||
},
|
"DISCARDED(c)",
|
||||||
org_todo_keyword_faces = {
|
},
|
||||||
ACTIVE = ":foreground dodgerblue :weight bold",
|
org_todo_keyword_faces = {
|
||||||
WAITING = ":foreground lightgoldenrod :weight bold",
|
ACTIVE = ":foreground dodgerblue :weight bold",
|
||||||
DISCARDED = ":foreground grey :weight bold",
|
WAITING = ":foreground lightgoldenrod :weight bold",
|
||||||
},
|
DISCARDED = ":foreground grey :weight bold",
|
||||||
win_split_mode = "float",
|
},
|
||||||
win_border = "single",
|
win_split_mode = "float",
|
||||||
org_archive_location = "~/Documents/org/archive.org::",
|
win_border = "single",
|
||||||
org_log_done = "note",
|
org_archive_location = "~/Documents/org/archive.org::",
|
||||||
org_log_into_drawer = "LOGBOOK",
|
org_log_done = "note",
|
||||||
org_highlight_latex_and_related = "entities",
|
org_log_into_drawer = "LOGBOOK",
|
||||||
org_agenda_span = "week",
|
org_highlight_latex_and_related = "entities",
|
||||||
org_agenda_skip_scheduled_if_done = true,
|
org_agenda_span = "week",
|
||||||
org_agenda_skip_deadline_if_done = true,
|
org_agenda_skip_scheduled_if_done = true,
|
||||||
|
org_agenda_skip_deadline_if_done = true,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
+32
-28
@@ -16,32 +16,36 @@
|
|||||||
|
|
||||||
-- https://github.com/nvim-telescope/telescope.nvim
|
-- https://github.com/nvim-telescope/telescope.nvim
|
||||||
|
|
||||||
local builtin = require("telescope.builtin")
|
local function setup()
|
||||||
|
local builtin = require("telescope.builtin")
|
||||||
|
|
||||||
vim.keymap.set(
|
vim.keymap.set(
|
||||||
"n",
|
"n",
|
||||||
"<leader>ff",
|
"<leader>ff",
|
||||||
function () builtin.find_files({ hidden = true, }) end
|
function () builtin.find_files({ hidden = true, }) end
|
||||||
)
|
)
|
||||||
vim.keymap.set(
|
vim.keymap.set(
|
||||||
"n",
|
"n",
|
||||||
"<leader>fr",
|
"<leader>fr",
|
||||||
function () builtin.oldfiles({ hidden = true, }) end
|
function () builtin.oldfiles({ hidden = true, }) end
|
||||||
)
|
)
|
||||||
vim.keymap.set(
|
vim.keymap.set(
|
||||||
"n", "<leader>fg", function ()
|
"n", "<leader>fg", function ()
|
||||||
builtin.live_grep(
|
builtin.live_grep(
|
||||||
{
|
{
|
||||||
additional_args = function (_)
|
additional_args = function (_)
|
||||||
return {
|
return {
|
||||||
"--hidden",
|
"--hidden",
|
||||||
"--iglob=!.venv",
|
"--iglob=!.venv",
|
||||||
"--iglob=!vendor",
|
"--iglob=!vendor",
|
||||||
"--iglob=!.git",
|
"--iglob=!.git",
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
vim.keymap.set("n", "<leader>fb", builtin.buffers)
|
vim.keymap.set("n", "<leader>fb", builtin.buffers)
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
+14
-10
@@ -16,15 +16,19 @@
|
|||||||
|
|
||||||
-- https://github.com/folke/tokyonight.nvim
|
-- https://github.com/folke/tokyonight.nvim
|
||||||
|
|
||||||
local tokyonight = require("tokyonight")
|
local function setup()
|
||||||
|
local tokyonight = require("tokyonight")
|
||||||
|
|
||||||
tokyonight.setup({
|
tokyonight.setup({
|
||||||
style = "night",
|
style = "night",
|
||||||
styles = {
|
styles = {
|
||||||
comments = { italic = false, },
|
comments = { italic = false, },
|
||||||
keywords = { italic = false, },
|
keywords = { italic = false, },
|
||||||
},
|
},
|
||||||
lualine_bold = false,
|
lualine_bold = false,
|
||||||
})
|
})
|
||||||
|
|
||||||
tokyonight.load()
|
tokyonight.load()
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
+46
-42
@@ -16,52 +16,56 @@
|
|||||||
|
|
||||||
-- https://github.com/nvim-tree/nvim-tree.lua
|
-- https://github.com/nvim-tree/nvim-tree.lua
|
||||||
|
|
||||||
require("nvim-tree").setup({
|
local function setup()
|
||||||
sync_root_with_cwd = true,
|
require("nvim-tree").setup({
|
||||||
view = {
|
sync_root_with_cwd = true,
|
||||||
width = 40,
|
view = {
|
||||||
preserve_window_proportions = true,
|
width = 40,
|
||||||
},
|
preserve_window_proportions = true,
|
||||||
renderer = {
|
|
||||||
add_trailing = true,
|
|
||||||
group_empty = true,
|
|
||||||
highlight_git = true,
|
|
||||||
indent_markers = {
|
|
||||||
enable = true,
|
|
||||||
},
|
},
|
||||||
icons = {
|
renderer = {
|
||||||
git_placement = "after",
|
add_trailing = true,
|
||||||
show = {
|
group_empty = true,
|
||||||
folder_arrow = true,
|
highlight_git = true,
|
||||||
|
indent_markers = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
icons = {
|
||||||
|
git_placement = "after",
|
||||||
|
show = {
|
||||||
|
folder_arrow = true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
update_focused_file = {
|
||||||
update_focused_file = {
|
enable = true,
|
||||||
enable = true,
|
update_root = true,
|
||||||
update_root = true,
|
ignore_list = {
|
||||||
ignore_list = {
|
"help",
|
||||||
"help",
|
},
|
||||||
},
|
},
|
||||||
},
|
diagnostics = {
|
||||||
diagnostics = {
|
enable = true,
|
||||||
enable = true,
|
show_on_dirs = false,
|
||||||
show_on_dirs = false,
|
|
||||||
},
|
|
||||||
actions = {
|
|
||||||
change_dir = {
|
|
||||||
enable = false,
|
|
||||||
},
|
},
|
||||||
open_file = {
|
actions = {
|
||||||
resize_window = true,
|
change_dir = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
open_file = {
|
||||||
|
resize_window = true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
filters = {
|
||||||
filters = {
|
custom = { "^\\.git$", },
|
||||||
custom = { "^\\.git$", },
|
},
|
||||||
},
|
notify = {
|
||||||
notify = {
|
threshold = vim.log.levels.WARN,
|
||||||
threshold = vim.log.levels.WARN,
|
absolute_path = false,
|
||||||
absolute_path = false,
|
},
|
||||||
},
|
})
|
||||||
})
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>tt", require("nvim-tree.api").tree.toggle)
|
vim.keymap.set("n", "<leader>tt", require("nvim-tree.api").tree.toggle)
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
@@ -16,7 +16,11 @@
|
|||||||
|
|
||||||
-- https://github.com/nvim-treesitter/nvim-treesitter-context
|
-- https://github.com/nvim-treesitter/nvim-treesitter-context
|
||||||
|
|
||||||
require("treesitter-context").setup({
|
local function setup()
|
||||||
max_lines = 1,
|
require("treesitter-context").setup({
|
||||||
min_window_height = 10,
|
max_lines = 1,
|
||||||
})
|
min_window_height = 10,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
-- https://github.com/nvim-treesitter/nvim-treesitter
|
-- https://github.com/nvim-treesitter/nvim-treesitter
|
||||||
|
|
||||||
|
local function setup()
|
||||||
require("nvim-treesitter.configs").setup({
|
require("nvim-treesitter.configs").setup({
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"c", -- recommended default
|
"c", -- recommended default
|
||||||
@@ -49,3 +50,6 @@ require("nvim-treesitter.configs").setup({
|
|||||||
vim.opt.foldmethod = "expr"
|
vim.opt.foldmethod = "expr"
|
||||||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||||
vim.opt.foldenable = false
|
vim.opt.foldenable = false
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
+12
-8
@@ -16,13 +16,17 @@
|
|||||||
|
|
||||||
-- https://github.com/Mofiqul/vscode.nvim
|
-- https://github.com/Mofiqul/vscode.nvim
|
||||||
|
|
||||||
local vscode = require("vscode")
|
local function setup()
|
||||||
|
local vscode = require("vscode")
|
||||||
|
|
||||||
vscode.setup({
|
vscode.setup({
|
||||||
style = "dark",
|
style = "dark",
|
||||||
transparent = false,
|
transparent = false,
|
||||||
italic_comments = false,
|
italic_comments = false,
|
||||||
disable_nvimtree_bg = false,
|
disable_nvimtree_bg = false,
|
||||||
})
|
})
|
||||||
|
|
||||||
vscode.load()
|
vscode.load()
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
@@ -16,8 +16,12 @@
|
|||||||
|
|
||||||
-- https://github.com/simeji/winresizer
|
-- https://github.com/simeji/winresizer
|
||||||
|
|
||||||
vim.g.winresizer_vert_resize = "5"
|
local function setup()
|
||||||
vim.g.winresizer_horiz_resize = "5"
|
vim.g.winresizer_vert_resize = "5"
|
||||||
vim.g.winresizer_start_key = ""
|
vim.g.winresizer_horiz_resize = "5"
|
||||||
|
vim.g.winresizer_start_key = ""
|
||||||
|
|
||||||
vim.keymap.set("n", "<C-W>r", vim.cmd.WinResizerStartResize)
|
vim.keymap.set("n", "<C-W>r", vim.cmd.WinResizerStartResize)
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
@@ -16,8 +16,12 @@
|
|||||||
|
|
||||||
-- https://github.com/sindrets/winshift.nvim
|
-- https://github.com/sindrets/winshift.nvim
|
||||||
|
|
||||||
vim.keymap.set(
|
local function setup()
|
||||||
"n",
|
vim.keymap.set(
|
||||||
"<C-W>m",
|
"n",
|
||||||
vim.cmd.WinShift
|
"<C-W>m",
|
||||||
)
|
vim.cmd.WinShift
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
return setup
|
||||||
|
|||||||
Reference in New Issue
Block a user