before change to base lazy
This commit is contained in:
		
							parent
							
								
									c51b67a644
								
							
						
					
					
						commit
						3022b2eb12
					
				
							
								
								
									
										126
									
								
								init.lua
								
								
								
								
							
							
						
						
									
										126
									
								
								init.lua
								
								
								
								
							| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,13 @@
 | 
			
		|||
{
 | 
			
		||||
  "extras": [
 | 
			
		||||
 | 
			
		||||
    "lazyvim.plugins.extras.coding.luasnip",
 | 
			
		||||
    "lazyvim.plugins.extras.coding.yanky",
 | 
			
		||||
    "lazyvim.plugins.extras.editor.overseer",
 | 
			
		||||
    "lazyvim.plugins.extras.lang.angular",
 | 
			
		||||
    "lazyvim.plugins.extras.lang.json",
 | 
			
		||||
    "lazyvim.plugins.extras.lang.markdown",
 | 
			
		||||
    "lazyvim.plugins.extras.lang.typescript",
 | 
			
		||||
    "lazyvim.plugins.extras.util.dot"
 | 
			
		||||
  ],
 | 
			
		||||
  "news": {
 | 
			
		||||
    "NEWS.md": "6520"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,116 +2,65 @@ return {
 | 
			
		|||
  {
 | 
			
		||||
    'mfussenegger/nvim-dap',
 | 
			
		||||
    dependencies = {
 | 
			
		||||
      'leoluz/nvim-dap-go',
 | 
			
		||||
      'rcarriga/nvim-dap-ui',
 | 
			
		||||
      'theHamsta/nvim-dap-virtual-text',
 | 
			
		||||
      'nvim-neotest/nvim-nio',
 | 
			
		||||
      'williamboman/mason.nvim',
 | 
			
		||||
      'williamboman/mason.nvim', -- for installing netcoredbg
 | 
			
		||||
    },
 | 
			
		||||
    config = function()
 | 
			
		||||
      local dap = require 'dap'
 | 
			
		||||
      local ui = require 'dapui'
 | 
			
		||||
      local dapui = require 'dapui'
 | 
			
		||||
 | 
			
		||||
      require('dapui').setup()
 | 
			
		||||
      require('dap-go').setup()
 | 
			
		||||
      require('nvim-dap-virtual-text').setup {}
 | 
			
		||||
      -- Setup DAP UI
 | 
			
		||||
      dapui.setup()
 | 
			
		||||
      require('nvim-dap-virtual-text').setup()
 | 
			
		||||
 | 
			
		||||
      -- Configuration for .NET Core (ASP.NET Core) using net8.0
 | 
			
		||||
      -- CoreCLR Adapter Configuration for .NET
 | 
			
		||||
      dap.adapters.coreclr = {
 | 
			
		||||
        type = 'executable',
 | 
			
		||||
        command = '/usr/local/bin/netcoredbg/netcoredbg', -- Update with the correct path to netcoredbg
 | 
			
		||||
        command = '/usr/local/bin/netcoredbg/netcoredbg',
 | 
			
		||||
        args = { '--interpreter=vscode' },
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      -- DAP Configuration for .NET Core
 | 
			
		||||
      dap.configurations.cs = {
 | 
			
		||||
        {
 | 
			
		||||
          type = 'coreclr',
 | 
			
		||||
          name = 'Launch ASP.NET Core',
 | 
			
		||||
          name = 'Launch .NET Core Web API',
 | 
			
		||||
          request = 'launch',
 | 
			
		||||
          preLaunchTask = function()
 | 
			
		||||
            -- Run the project before launching the debugger
 | 
			
		||||
            local build_cmd = 'dotnet publish --configuration Debug --runtime linux-x64 --self-contained'
 | 
			
		||||
            print('Running: ' .. build_cmd)
 | 
			
		||||
            vim.fn.system(build_cmd)
 | 
			
		||||
          end,
 | 
			
		||||
          program = function()
 | 
			
		||||
            local cwd = vim.fn.getcwd()
 | 
			
		||||
            local dll = vim.fn.glob(cwd .. '/bin/Debug/net8.0/linux-x64/MelodyFitnessApi.dll', 0, 1)
 | 
			
		||||
            if #dll == 0 then
 | 
			
		||||
              print 'No DLL found in bin/Debug/net8.0/linux-x64'
 | 
			
		||||
              return ''
 | 
			
		||||
            end
 | 
			
		||||
            print('Using program: ' .. dll[1])
 | 
			
		||||
            return dll[1]
 | 
			
		||||
            return vim.fn.input('Path to dll: ', vim.fn.getcwd() .. '/bin/Debug/net8.0/linux-x64/MelodyFitnessApi.dll', 'file')
 | 
			
		||||
          end,
 | 
			
		||||
          cwd = '${workspaceFolder}',
 | 
			
		||||
          stopAtEntry = false,
 | 
			
		||||
          console = 'integratedTerminal',
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          type = 'coreclr',
 | 
			
		||||
          name = 'Attach ASP.NET Core',
 | 
			
		||||
          name = 'Attach to .NET Core',
 | 
			
		||||
          request = 'attach',
 | 
			
		||||
          processId = require('dap.utils').pick_process,
 | 
			
		||||
          cwd = '${workspaceFolder}',
 | 
			
		||||
        },
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      -- Configuration for Ionic Angular (JavaScript/TypeScript) using Firefox
 | 
			
		||||
      dap.adapters.chrome = {
 | 
			
		||||
        type = 'executable',
 | 
			
		||||
        command = 'node',
 | 
			
		||||
        args = { os.getenv 'HOME' .. '/.vscode/extensions/vscode-chrome-debug/out/src/chromeDebug.js' },
 | 
			
		||||
      }
 | 
			
		||||
      dap.configurations.javascript = {
 | 
			
		||||
        {
 | 
			
		||||
          type = 'chrome',
 | 
			
		||||
          name = 'Attach to Chrome (Ionic App)',
 | 
			
		||||
          request = 'attach',
 | 
			
		||||
          program = '${file}',
 | 
			
		||||
          cwd = vim.fn.getcwd(),
 | 
			
		||||
          sourceMaps = true,
 | 
			
		||||
          protocol = 'inspector',
 | 
			
		||||
          port = 9222, -- Port where Chrome is listening
 | 
			
		||||
          url = 'https://localhost:8100/login', -- URL of your running Ionic app
 | 
			
		||||
          webRoot = '${workspaceFolder}',
 | 
			
		||||
          timeout = 20000, -- Optional: Increase if you experience timeouts
 | 
			
		||||
          address = '0.0.0.0',
 | 
			
		||||
        },
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      dap.configurations.typescript = dap.configurations.javascript
 | 
			
		||||
 | 
			
		||||
      vim.keymap.set('n', '<space>tb', dap.toggle_breakpoint)
 | 
			
		||||
      vim.keymap.set('n', '<space>gb', dap.run_to_cursor)
 | 
			
		||||
 | 
			
		||||
      vim.keymap.set('n', '<space>?', function()
 | 
			
		||||
        require('dapui').eval(nil, { enter = true })
 | 
			
		||||
      -- Key mappings for debugging
 | 
			
		||||
      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)
 | 
			
		||||
      vim.keymap.set('n', '<Leader>b', dap.toggle_breakpoint)
 | 
			
		||||
      vim.keymap.set('n', '<Leader>B', function()
 | 
			
		||||
        dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
 | 
			
		||||
      end)
 | 
			
		||||
 | 
			
		||||
      vim.keymap.set('n', '<F1>', dap.continue)
 | 
			
		||||
      vim.keymap.set('n', '<F2>', dap.step_into)
 | 
			
		||||
      vim.keymap.set('n', '<F3>', dap.step_over)
 | 
			
		||||
      vim.keymap.set('n', '<F4>', dap.step_out)
 | 
			
		||||
      vim.keymap.set('n', '<F5>', dap.step_back)
 | 
			
		||||
      vim.keymap.set('n', '<F12>', dap.restart)
 | 
			
		||||
 | 
			
		||||
      -- Key mapping to toggle the DAP UI
 | 
			
		||||
      vim.keymap.set('n', '<Leader>dui', function()
 | 
			
		||||
        ui.toggle()
 | 
			
		||||
      end)
 | 
			
		||||
 | 
			
		||||
      dap.listeners.before.attach.dapui_config = function()
 | 
			
		||||
        ui.open()
 | 
			
		||||
      -- Automatically open/close DAP UI on start/end
 | 
			
		||||
      dap.listeners.after.event_initialized['dapui_config'] = function()
 | 
			
		||||
        dapui.open()
 | 
			
		||||
      end
 | 
			
		||||
      dap.listeners.before.launch.dapui_config = function()
 | 
			
		||||
        ui.open()
 | 
			
		||||
      dap.listeners.before.event_terminated['dapui_config'] = function()
 | 
			
		||||
        dapui.close()
 | 
			
		||||
      end
 | 
			
		||||
      dap.listeners.before.event_terminated.dapui_config = function()
 | 
			
		||||
        ui.close()
 | 
			
		||||
      end
 | 
			
		||||
      dap.listeners.before.event_exited.dapui_config = function()
 | 
			
		||||
        ui.close()
 | 
			
		||||
      dap.listeners.before.event_exited['dapui_config'] = function()
 | 
			
		||||
        dapui.close()
 | 
			
		||||
      end
 | 
			
		||||
    end,
 | 
			
		||||
  },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,45 @@
 | 
			
		|||
return {
 | 
			
		||||
  'nvimdev/lspsaga.nvim',
 | 
			
		||||
  dependencies = {
 | 
			
		||||
    'nvim-tree/nvim-web-devicons',
 | 
			
		||||
    'nvim-treesitter/nvim-treesitter',
 | 
			
		||||
  },
 | 
			
		||||
  config = function()
 | 
			
		||||
    -- Setup lspsaga with your custom settings
 | 
			
		||||
    require('lspsaga').setup {
 | 
			
		||||
      use_saga_diagnostic_sign = true,
 | 
			
		||||
      error_sign = 'E',
 | 
			
		||||
      warn_sign = 'W',
 | 
			
		||||
      hint_sign = 'H',
 | 
			
		||||
      infor_sign = 'I',
 | 
			
		||||
      code_action_icon = '💡',
 | 
			
		||||
      finder_action_keys = {
 | 
			
		||||
        open = 'o',
 | 
			
		||||
        vsplit = 's',
 | 
			
		||||
        split = 'i',
 | 
			
		||||
        quit = 'q',
 | 
			
		||||
        scroll_down = '<C-f>',
 | 
			
		||||
        scroll_up = '<C-b>',
 | 
			
		||||
      },
 | 
			
		||||
      code_action_keys = {
 | 
			
		||||
        quit = 'q',
 | 
			
		||||
        exec = '<CR>',
 | 
			
		||||
      },
 | 
			
		||||
      rename_action_quit = '<C-c>',
 | 
			
		||||
      definition_preview_icon = '🔍',
 | 
			
		||||
      border_style = 'round',
 | 
			
		||||
      rename_prompt_prefix = '➤',
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    -- Add custom key mappings for lspsaga
 | 
			
		||||
    local opts = { noremap = true, silent = true }
 | 
			
		||||
 | 
			
		||||
    -- Key mappings for lspsaga actions
 | 
			
		||||
    vim.api.nvim_set_keymap('n', '<leader>ca', ':Lspsaga code_action<CR>', opts) -- Code action
 | 
			
		||||
    vim.api.nvim_set_keymap('n', '<leader>rn', ':Lspsaga rename<CR>', opts) -- Rename
 | 
			
		||||
    vim.api.nvim_set_keymap('n', 'gh', ':Lspsaga hover_doc<CR>', opts) -- Hover doc
 | 
			
		||||
    vim.api.nvim_set_keymap('n', 'gd', ':Lspsaga lsp_finder<CR>', opts) -- LSP finder
 | 
			
		||||
    vim.api.nvim_set_keymap('n', '[e', ':Lspsaga diagnostic_jump_prev<CR>', opts) -- Previous diagnostic
 | 
			
		||||
    vim.api.nvim_set_keymap('n', ']e', ':Lspsaga diagnostic_jump_next<CR>', opts) -- Next diagnostic
 | 
			
		||||
  end,
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
local ls = require 'luasnip'
 | 
			
		||||
local s = ls.snippet
 | 
			
		||||
local t = ls.text_node
 | 
			
		||||
local f = ls.function_node
 | 
			
		||||
 | 
			
		||||
-- Function to generate the namespace based on the file path
 | 
			
		||||
local function generate_namespace()
 | 
			
		||||
  local file_path = vim.fn.expand '%:p:h' -- Get the file path of the current buffer
 | 
			
		||||
  -- Adjust 'src' or 'project_root' based on your directory structure
 | 
			
		||||
  local namespace = file_path:gsub('.*src[\\/]', ''):gsub('[\\/]', '.') -- Replace slashes with dots
 | 
			
		||||
  return 'namespace ' .. namespace
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
-- Function to get the file name (without extension) as the class name
 | 
			
		||||
local function get_class_name()
 | 
			
		||||
  return vim.fn.expand '%:t:r' -- Get the file name without the extension
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
-- Snippet for C# class generation
 | 
			
		||||
ls.add_snippets('cs', {
 | 
			
		||||
  s('myclass', { -- Updated the trigger from 'class' to 'myclass'
 | 
			
		||||
    -- Insert the namespace based on the file path
 | 
			
		||||
    f(generate_namespace, {}),
 | 
			
		||||
    t { '', '' }, -- Line break after namespace
 | 
			
		||||
    -- Generate class name based on file name
 | 
			
		||||
    t 'public class ',
 | 
			
		||||
    f(get_class_name, {}),
 | 
			
		||||
    t { '', '{', '\t' },
 | 
			
		||||
    ls.insert_node(0), -- Cursor here
 | 
			
		||||
    t { '', '}' }, -- End of class
 | 
			
		||||
  }),
 | 
			
		||||
})
 | 
			
		||||
| 
						 | 
				
			
			@ -16,6 +16,7 @@ return {
 | 
			
		|||
  opts = {
 | 
			
		||||
    filesystem = {
 | 
			
		||||
      window = {
 | 
			
		||||
        position = 'float',
 | 
			
		||||
        mappings = {
 | 
			
		||||
          ['\\'] = 'close_window',
 | 
			
		||||
          -- Add a new key mapping to open a terminal in a floating window
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue