before change to base lazy

This commit is contained in:
Martin-Melody 2024-10-28 22:16:06 +00:00
parent c51b67a644
commit 3022b2eb12
6 changed files with 185 additions and 131 deletions

126
init.lua
View file

@ -89,6 +89,7 @@ P.S. You can delete this when you're done too. It's your config now! :)
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
vim.g.lazyvim_picker = 'telescope'
-- Add the clipboard configuration for win32yank
if vim.fn.has 'win32' == 1 or vim.fn.has 'win64' == 1 then
@ -229,8 +230,7 @@ vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper win
-- [[ Custom Keymaps ]]
-- Keymap to close the current buffer but keep split windows open
vim.keymap.set('n', '<leader>bD', ':bp | bd #<CR>', { noremap = true, silent = true, desc = "Close buffer but keep split" })
vim.keymap.set('n', '<leader>bD', ':bp | bd #<CR>', { noremap = true, silent = true, desc = 'Close buffer but keep split' })
-- Vim Rest Console
vim.keymap.set('n', '<leader>r', ':Vrc<CR>', { noremap = true, silent = true })
@ -282,11 +282,32 @@ vim.opt.rtp:prepend(lazypath)
--
-- NOTE: Here is where you install your plugins.
require('lazy').setup({
--spec = {
--{ 'LazyVim/LazyVim', import = 'lazyvim.plugins' },
--{ import = 'custom.plugins' },
--},
spec = {
-- add LazyVim and import its plugins
{ 'LazyVim/LazyVim', import = 'lazyvim.plugins' },
-- import/override with your plugins
{ import = 'custom.plugins' },
},
defaults = {
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
lazy = false,
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
-- have outdated releases, which may break your Neovim install.
version = false, -- always use the latest git commit
-- version = "*", -- try installing the latest stable version for plugins that support semver
},
install = { colorscheme = { 'catppuccin', 'habamax' } },
checker = {
enabled = true, -- check for plugin updates periodically
notify = false, -- notify on update
}, -- automatically check for plugin updates
performance = {
rtp = {
-- disable some rtp plugins
disabled_plugins = {},
},
},
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
@ -384,7 +405,7 @@ require('lazy').setup({
{ -- Useful plugin to show you pending keybinds.
'folke/which-key.nvim',
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
event = 'VeryLazy', -- Sets the loading event to 'VimEnter'
config = function() -- This is the function that runs, AFTER loading
require('which-key').setup()
@ -451,6 +472,7 @@ require('lazy').setup({
-- This opens a window that shows you all of the keymaps for the current
-- Telescope picker. This is really useful to discover what Telescope can
-- do as well as how to actually do it!
-- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()`
require('telescope').setup {
@ -510,9 +532,8 @@ require('lazy').setup({
builtin.find_files { cwd = vim.fn.stdpath 'config' }
end, { desc = '[S]earch [N]eovim files' })
-- Shortcut for searching Obsidian files
vim.keymap.set('n', '<leader>so', function()
builtin.find_files { cwd = '~/Obsidian/vaults/' }
telescope.builtin.find_files { cwd = '~/Obsidian/vaults/' }
end, { desc = '[S]earch [O]bsidian files' })
end,
},
@ -801,12 +822,12 @@ require('lazy').setup({
-- `friendly-snippets` contains a variety of premade snippets.
-- See the README about individual language/framework/plugin snippets:
-- https://github.com/rafamadriz/friendly-snippets
-- {
-- 'rafamadriz/friendly-snippets',
-- config = function()
-- require('luasnip.loaders.from_vscode').lazy_load()
-- end,
-- },
{
'rafamadriz/friendly-snippets',
config = function()
require('luasnip.loaders.from_vscode').lazy_load()
end,
},
},
},
'saadparwaiz1/cmp_luasnip',
@ -821,6 +842,7 @@ require('lazy').setup({
-- See `:help cmp`
local cmp = require 'cmp'
local luasnip = require 'luasnip'
require 'custom.snips' -- Ensure this points to where your custom snippets file is located
luasnip.config.setup {}
cmp.setup {
@ -831,64 +853,59 @@ require('lazy').setup({
},
completion = { completeopt = 'menu,menuone,noinsert' },
-- For an understanding of why these mappings were
-- chosen, you will need to read `:help ins-completion`
--
-- No, but seriously. Please read `:help ins-completion`, it is really good!
mapping = cmp.mapping.preset.insert {
-- Select the [n]ext item
-- Existing mappings
['<C-n>'] = cmp.mapping.select_next_item(),
-- Select the [p]revious item
['<C-p>'] = cmp.mapping.select_prev_item(),
-- Scroll the documentation window [b]ack / [f]orward
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
-- Accept ([y]es) the completion.
-- This will auto-import if your LSP supports it.
-- This will expand snippets if the LSP sent a snippet.
['<C-y>'] = cmp.mapping.confirm { select = true },
-- If you prefer more traditional completion keymaps,
-- you can uncomment the following lines
--['<CR>'] = cmp.mapping.confirm { select = true },
--['<Tab>'] = cmp.mapping.select_next_item(),
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
-- Manually trigger a completion from nvim-cmp.
-- Generally you don't need this, because nvim-cmp will display
-- completions whenever it has completion options available.
['<C-Space>'] = cmp.mapping.complete {},
-- Think of <c-l> as moving to the right of your snippet expansion.
-- So if you have a snippet that's like:
-- function $name($args)
-- $body
-- end
--
-- <c-l> will move you to the right of each of the expansion locations.
-- <c-h> is similar, except moving you backwards.
-- LuaSnip keybindings
['<C-j>'] = cmp.mapping(function()
if luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
end
end, { 'i', 's' }), -- Jump forward in the snippet
['<C-k>'] = cmp.mapping(function()
if luasnip.jumpable(-1) then
luasnip.jump(-1)
end
end, { 'i', 's' }), -- Jump backward in the snippet
['<C-l>'] = cmp.mapping(function()
if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
end
end, { 'i', 's' }),
['<C-h>'] = cmp.mapping(function()
if luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
end
end, { 'i', 's' }),
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
-- Optionally, you could add Tab and Shift-Tab to cycle through items or placeholders
['<Tab>'] = cmp.mapping(function(fallback)
if luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
},
-- Additional sources for completion
sources = {
{
name = 'lazydev',
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
group_index = 0,
},
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'path' },
@ -1115,6 +1132,9 @@ require('lazy').setup({
-- Completion
require 'custom.plugins.completion',
-- lspsaga
require 'custom.plugins.lspsaga',
}, {
ui = {
-- If you are using a Nerd Font: set icons to an empty table which will use the