Ported config from nixvim.
Made some changes to taste along the way, though there are some still to come.
This commit is contained in:
		
							parent
							
								
									9a78fd2d53
								
							
						
					
					
						commit
						3bd72ab98f
					
				
					 13 changed files with 601 additions and 740 deletions
				
			
		| 
						 | 
				
			
			@ -2,6 +2,47 @@ local catUtils = require('nixCatsUtils')
 | 
			
		|||
if (catUtils.isNixCats and nixCats('lspDebugMode')) then
 | 
			
		||||
  vim.lsp.set_log_level("debug")
 | 
			
		||||
end
 | 
			
		||||
-- we create a function that lets us more easily define mappings specific
 | 
			
		||||
-- for LSP related items. It sets the mode, buffer and description for us each time.
 | 
			
		||||
 | 
			
		||||
local lspmap = function(keys, func, desc)
 | 
			
		||||
  if desc then
 | 
			
		||||
    desc = 'LSP: ' .. desc
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  -- all of our LSP keybindings will be namespaced under <leader>l
 | 
			
		||||
  keys = '<leader>l' .. keys
 | 
			
		||||
 | 
			
		||||
  vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
lspmap('r', vim.lsp.buf.rename, '[R]ename')
 | 
			
		||||
lspmap('a', vim.lsp.buf.code_action, '[C]ode Action')
 | 
			
		||||
 | 
			
		||||
lspmap('d', vim.lsp.buf.definition, 'Goto [D]efinition')
 | 
			
		||||
 | 
			
		||||
-- NOTE: why are these functions that call the telescope builtin?
 | 
			
		||||
-- because otherwise they would load telescope eagerly when this is defined.
 | 
			
		||||
-- due to us using the on_require handler to make sure it is available.
 | 
			
		||||
if nixCats('telescope') then
 | 
			
		||||
  lspmap('R', function() require('telescope.builtin').lsp_references() end, 'Goto [R]eferences')
 | 
			
		||||
  lspmap('I', function() require('telescope.builtin').lsp_implementations() end, 'Goto [I]mplementation')
 | 
			
		||||
  lspmap('s', function() require('telescope.builtin').lsp_document_symbols() end, 'Document [S]ymbols')
 | 
			
		||||
  lspmap('ws', function() require('telescope.builtin').lsp_dynamic_workspace_symbols() end, '[W]orkspace [S]ymbols')
 | 
			
		||||
end   -- TODO: Investigate whether I can replace these with snacsk.nvim.
 | 
			
		||||
 | 
			
		||||
lspmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition')
 | 
			
		||||
lspmap('h', vim.lsp.buf.hover, 'Hover Documentation')
 | 
			
		||||
lspmap('s', vim.lsp.buf.signature_help, 'Signature Documentation')
 | 
			
		||||
lspmap('f', vim.lsp.buf.format, 'Format buffer')
 | 
			
		||||
 | 
			
		||||
-- Lesser used LSP functionality
 | 
			
		||||
lspmap('D', vim.lsp.buf.declaration, 'Goto [D]eclaration')
 | 
			
		||||
lspmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
 | 
			
		||||
lspmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
 | 
			
		||||
lspmap('wl', function()
 | 
			
		||||
  print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
 | 
			
		||||
end, '[W]orkspace [L]ist Folders')
 | 
			
		||||
 | 
			
		||||
-- NOTE: This file uses lzextras.lsp handler https://github.com/BirdeeHub/lzextras?tab=readme-ov-file#lsp-handler
 | 
			
		||||
-- This is a slightly more performant fallback function
 | 
			
		||||
| 
						 | 
				
			
			@ -9,7 +50,8 @@ end
 | 
			
		|||
-- nixCats gives us the paths, which is faster than searching the rtp!
 | 
			
		||||
local old_ft_fallback = require('lze').h.lsp.get_ft_fallback()
 | 
			
		||||
require('lze').h.lsp.set_ft_fallback(function(name)
 | 
			
		||||
  local lspcfg = nixCats.pawsible({ "allPlugins", "opt", "nvim-lspconfig" }) or nixCats.pawsible({ "allPlugins", "start", "nvim-lspconfig" })
 | 
			
		||||
  local lspcfg = nixCats.pawsible({ "allPlugins", "opt", "nvim-lspconfig" }) or
 | 
			
		||||
      nixCats.pawsible({ "allPlugins", "start", "nvim-lspconfig" })
 | 
			
		||||
  if lspcfg then
 | 
			
		||||
    local ok, cfg = pcall(dofile, lspcfg .. "/lsp/" .. name .. ".lua")
 | 
			
		||||
    if not ok then
 | 
			
		||||
| 
						 | 
				
			
			@ -23,7 +65,7 @@ end)
 | 
			
		|||
require('lze').load {
 | 
			
		||||
  {
 | 
			
		||||
    "nvim-lspconfig",
 | 
			
		||||
    for_cat = "general.core",
 | 
			
		||||
    for_cat = "lsp",
 | 
			
		||||
    on_require = { "lspconfig" },
 | 
			
		||||
    -- NOTE: define a function for lsp,
 | 
			
		||||
    -- and it will run for all specs with type(plugin.lsp) == table
 | 
			
		||||
| 
						 | 
				
			
			@ -32,11 +74,6 @@ require('lze').load {
 | 
			
		|||
      vim.lsp.config(plugin.name, plugin.lsp or {})
 | 
			
		||||
      vim.lsp.enable(plugin.name)
 | 
			
		||||
    end,
 | 
			
		||||
    before = function(_)
 | 
			
		||||
      vim.lsp.config('*', {
 | 
			
		||||
        on_attach = require('myLuaConf.LSPs.on_attach'),
 | 
			
		||||
      })
 | 
			
		||||
    end,
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "mason.nvim",
 | 
			
		||||
| 
						 | 
				
			
			@ -54,7 +91,7 @@ require('lze').load {
 | 
			
		|||
  {
 | 
			
		||||
    -- lazydev makes your lsp way better in your config without needing extra lsp configuration.
 | 
			
		||||
    "lazydev.nvim",
 | 
			
		||||
    for_cat = "neonixdev",
 | 
			
		||||
    for_cat = "lua",
 | 
			
		||||
    cmd = { "LazyDev" },
 | 
			
		||||
    ft = "lua",
 | 
			
		||||
    after = function(_)
 | 
			
		||||
| 
						 | 
				
			
			@ -68,7 +105,7 @@ require('lze').load {
 | 
			
		|||
  {
 | 
			
		||||
    -- name of the lsp
 | 
			
		||||
    "lua_ls",
 | 
			
		||||
    enabled = nixCats('lua') or nixCats('neonixdev') or false,
 | 
			
		||||
    enabled = nixCats('lua'),
 | 
			
		||||
    -- provide a table containing filetypes,
 | 
			
		||||
    -- and then whatever your functions defined in the function type specs expect.
 | 
			
		||||
    -- in our case, it just expects the normal lspconfig setup options,
 | 
			
		||||
| 
						 | 
				
			
			@ -93,33 +130,9 @@ require('lze').load {
 | 
			
		|||
    },
 | 
			
		||||
    -- also these are regular specs and you can use before and after and all the other normal fields
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "gopls",
 | 
			
		||||
    for_cat = "go",
 | 
			
		||||
    -- if you don't provide the filetypes it asks lspconfig for them
 | 
			
		||||
    lsp = {
 | 
			
		||||
      filetypes = { "go", "gomod", "gowork", "gotmpl" },
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "rnix",
 | 
			
		||||
    -- mason doesn't have nixd
 | 
			
		||||
    enabled = not catUtils.isNixCats,
 | 
			
		||||
    lsp = {
 | 
			
		||||
      filetypes = { "nix" },
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "nil_ls",
 | 
			
		||||
    -- mason doesn't have nixd
 | 
			
		||||
    enabled = not catUtils.isNixCats,
 | 
			
		||||
    lsp = {
 | 
			
		||||
      filetypes = { "nix" },
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "nixd",
 | 
			
		||||
    enabled = catUtils.isNixCats and (nixCats('nix') or nixCats('neonixdev')) or false,
 | 
			
		||||
    enabled = catUtils.isNixCats and nixCats('lsp.nix'),
 | 
			
		||||
    lsp = {
 | 
			
		||||
      filetypes = { "nix" },
 | 
			
		||||
      settings = {
 | 
			
		||||
| 
						 | 
				
			
			@ -132,7 +145,7 @@ require('lze').load {
 | 
			
		|||
          nixpkgs = {
 | 
			
		||||
            -- in the extras set of your package definition:
 | 
			
		||||
            -- nixdExtras.nixpkgs = ''import ${pkgs.path} {}''
 | 
			
		||||
            expr = nixCats.extra("nixdExtras.nixpkgs") or [[import <nixpkgs> {}]],
 | 
			
		||||
            expr = nixCats.extra("nixdExtras.nixpkgs")
 | 
			
		||||
          },
 | 
			
		||||
          options = {
 | 
			
		||||
            -- If you integrated with your system flake,
 | 
			
		||||
| 
						 | 
				
			
			@ -152,7 +165,7 @@ require('lze').load {
 | 
			
		|||
            }
 | 
			
		||||
          },
 | 
			
		||||
          formatting = {
 | 
			
		||||
            command = { "nixfmt" }
 | 
			
		||||
            command = { "alejandra" }
 | 
			
		||||
          },
 | 
			
		||||
          diagnostic = {
 | 
			
		||||
            suppress = {
 | 
			
		||||
| 
						 | 
				
			
			@ -163,4 +176,8 @@ require('lze').load {
 | 
			
		|||
      },
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "rustaceanvim",
 | 
			
		||||
    for_cat = "lsp.rust",
 | 
			
		||||
  },
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,47 +0,0 @@
 | 
			
		|||
return function(_, bufnr)
 | 
			
		||||
  -- we create a function that lets us more easily define mappings specific
 | 
			
		||||
  -- for LSP related items. It sets the mode, buffer and description for us each time.
 | 
			
		||||
 | 
			
		||||
  local nmap = function(keys, func, desc)
 | 
			
		||||
    if desc then
 | 
			
		||||
      desc = 'LSP: ' .. desc
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
 | 
			
		||||
  nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
 | 
			
		||||
 | 
			
		||||
  nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
 | 
			
		||||
 | 
			
		||||
  -- NOTE: why are these functions that call the telescope builtin?
 | 
			
		||||
  -- because otherwise they would load telescope eagerly when this is defined.
 | 
			
		||||
  -- due to us using the on_require handler to make sure it is available.
 | 
			
		||||
  if nixCats('general.telescope') then
 | 
			
		||||
    nmap('gr', function() require('telescope.builtin').lsp_references() end, '[G]oto [R]eferences')
 | 
			
		||||
    nmap('gI', function() require('telescope.builtin').lsp_implementations() end, '[G]oto [I]mplementation')
 | 
			
		||||
    nmap('<leader>ds', function() require('telescope.builtin').lsp_document_symbols() end, '[D]ocument [S]ymbols')
 | 
			
		||||
    nmap('<leader>ws', function() require('telescope.builtin').lsp_dynamic_workspace_symbols() end, '[W]orkspace [S]ymbols')
 | 
			
		||||
  end -- TODO: someone who knows the builtin versions of these to do instead help me out please.
 | 
			
		||||
 | 
			
		||||
  nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
 | 
			
		||||
 | 
			
		||||
  -- See `:help K` for why this keymap
 | 
			
		||||
  nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
 | 
			
		||||
  nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
 | 
			
		||||
 | 
			
		||||
  -- Lesser used LSP functionality
 | 
			
		||||
  nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
 | 
			
		||||
  nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
 | 
			
		||||
  nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
 | 
			
		||||
  nmap('<leader>wl', function()
 | 
			
		||||
    print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
 | 
			
		||||
  end, '[W]orkspace [L]ist Folders')
 | 
			
		||||
 | 
			
		||||
  -- Create a command `:Format` local to the LSP buffer
 | 
			
		||||
  vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
 | 
			
		||||
    vim.lsp.buf.format()
 | 
			
		||||
  end, { desc = 'Format current buffer with LSP' })
 | 
			
		||||
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -7,15 +7,14 @@ require('lze').load {
 | 
			
		|||
    -- event = "",
 | 
			
		||||
    -- ft = "",
 | 
			
		||||
    keys = {
 | 
			
		||||
      { "<F5>", desc = "Debug: Start/Continue" },
 | 
			
		||||
      { "<F1>", desc = "Debug: Step Into" },
 | 
			
		||||
      { "<F2>", desc = "Debug: Step Over" },
 | 
			
		||||
      { "<F3>", desc = "Debug: Step Out" },
 | 
			
		||||
      { "<F5>",      desc = "Debug: Start/Continue" },
 | 
			
		||||
      { "<F1>",      desc = "Debug: Step Into" },
 | 
			
		||||
      { "<F2>",      desc = "Debug: Step Over" },
 | 
			
		||||
      { "<F3>",      desc = "Debug: Step Out" },
 | 
			
		||||
      { "<leader>b", desc = "Debug: Toggle Breakpoint" },
 | 
			
		||||
      { "<leader>B", desc = "Debug: Set Breakpoint" },
 | 
			
		||||
      { "<F7>", desc = "Debug: See last session result." },
 | 
			
		||||
      { "<F7>",      desc = "Debug: See last session result." },
 | 
			
		||||
    },
 | 
			
		||||
    -- colorscheme = "",
 | 
			
		||||
    load = (require('nixCatsUtils').isNixCats and function(name)
 | 
			
		||||
      vim.cmd.packadd(name)
 | 
			
		||||
      vim.cmd.packadd("nvim-dap-ui")
 | 
			
		||||
| 
						 | 
				
			
			@ -26,9 +25,10 @@ require('lze').load {
 | 
			
		|||
      vim.cmd.packadd("nvim-dap-virtual-text")
 | 
			
		||||
      vim.cmd.packadd("mason-nvim-dap.nvim")
 | 
			
		||||
    end,
 | 
			
		||||
    after = function (plugin)
 | 
			
		||||
    after = function(plugin)
 | 
			
		||||
      local dap = require 'dap'
 | 
			
		||||
      local dapui = require 'dapui'
 | 
			
		||||
      require('telescope').load_extension('dap')
 | 
			
		||||
 | 
			
		||||
      -- Basic debugging keymaps, feel free to change to your liking!
 | 
			
		||||
      vim.keymap.set('n', '<F5>', dap.continue, { desc = 'Debug: Start/Continue' })
 | 
			
		||||
| 
						 | 
				
			
			@ -70,15 +70,15 @@ require('lze').load {
 | 
			
		|||
      }
 | 
			
		||||
 | 
			
		||||
      require("nvim-dap-virtual-text").setup {
 | 
			
		||||
        enabled = true,                       -- enable this plugin (the default)
 | 
			
		||||
        enabled_commands = true,              -- create commands DapVirtualTextEnable, DapVirtualTextDisable, DapVirtualTextToggle, (DapVirtualTextForceRefresh for refreshing when debug adapter did not notify its termination)
 | 
			
		||||
        highlight_changed_variables = true,   -- highlight changed values with NvimDapVirtualTextChanged, else always NvimDapVirtualText
 | 
			
		||||
        highlight_new_as_changed = false,     -- highlight new variables in the same way as changed variables (if highlight_changed_variables)
 | 
			
		||||
        show_stop_reason = true,              -- show stop reason when stopped for exceptions
 | 
			
		||||
        commented = false,                    -- prefix virtual text with comment string
 | 
			
		||||
        only_first_definition = true,         -- only show virtual text at first definition (if there are multiple)
 | 
			
		||||
        all_references = false,               -- show virtual text on all all references of the variable (not only definitions)
 | 
			
		||||
        clear_on_continue = false,            -- clear virtual text on "continue" (might cause flickering when stepping)
 | 
			
		||||
        enabled = true,                     -- enable this plugin (the default)
 | 
			
		||||
        enabled_commands = true,            -- create commands DapVirtualTextEnable, DapVirtualTextDisable, DapVirtualTextToggle, (DapVirtualTextForceRefresh for refreshing when debug adapter did not notify its termination)
 | 
			
		||||
        highlight_changed_variables = true, -- highlight changed values with NvimDapVirtualTextChanged, else always NvimDapVirtualText
 | 
			
		||||
        highlight_new_as_changed = false,   -- highlight new variables in the same way as changed variables (if highlight_changed_variables)
 | 
			
		||||
        show_stop_reason = true,            -- show stop reason when stopped for exceptions
 | 
			
		||||
        commented = false,                  -- prefix virtual text with comment string
 | 
			
		||||
        only_first_definition = true,       -- only show virtual text at first definition (if there are multiple)
 | 
			
		||||
        all_references = false,             -- show virtual text on all all references of the variable (not only definitions)
 | 
			
		||||
        clear_on_continue = false,          -- clear virtual text on "continue" (might cause flickering when stepping)
 | 
			
		||||
        --- A callback that determines how a variable is displayed or whether it should be omitted
 | 
			
		||||
        --- variable Variable https://microsoft.github.io/debug-adapter-protocol/specification#Types_Variable
 | 
			
		||||
        --- buf number
 | 
			
		||||
| 
						 | 
				
			
			@ -97,23 +97,15 @@ require('lze').load {
 | 
			
		|||
        virt_text_pos = vim.fn.has 'nvim-0.10' == 1 and 'inline' or 'eol',
 | 
			
		||||
 | 
			
		||||
        -- experimental features:
 | 
			
		||||
        all_frames = false,       -- show virtual text for all stack frames not only current. Only works for debugpy on my machine.
 | 
			
		||||
        virt_lines = false,       -- show virtual lines instead of virtual text (will flicker!)
 | 
			
		||||
        virt_text_win_col = nil   -- position the virtual text at a fixed window column (starting from the first text column) ,
 | 
			
		||||
        all_frames = false,     -- show virtual text for all stack frames not only current. Only works for debugpy on my machine.
 | 
			
		||||
        virt_lines = false,     -- show virtual lines instead of virtual text (will flicker!)
 | 
			
		||||
        virt_text_win_col = nil -- position the virtual text at a fixed window column (starting from the first text column) ,
 | 
			
		||||
        -- e.g. 80 to position at column 80, see `:h nvim_buf_set_extmark()`
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      -- NOTE: Install lang specific config
 | 
			
		||||
      -- either in here, or in a separate plugin spec as demonstrated for go below.
 | 
			
		||||
    end,
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
    end,
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "nvim-dap-go",
 | 
			
		||||
    for_cat = { cat = 'debug.go', default = false },
 | 
			
		||||
    on_plugin = { "nvim-dap", },
 | 
			
		||||
    after = function(plugin)
 | 
			
		||||
      require("dap-go").setup()
 | 
			
		||||
    end,
 | 
			
		||||
  },
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,12 +15,6 @@ require('lze').load {
 | 
			
		|||
        -- javascript = { 'eslint' },
 | 
			
		||||
        -- typescript = { 'eslint' },
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      vim.api.nvim_create_autocmd({ "BufWritePost" }, {
 | 
			
		||||
        callback = function()
 | 
			
		||||
          require("lint").try_lint()
 | 
			
		||||
        end,
 | 
			
		||||
      })
 | 
			
		||||
    end,
 | 
			
		||||
  },
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,7 +24,7 @@ require('nixCatsUtils.catPacker').setup({
 | 
			
		|||
  { "BirdeeHub/lze", },
 | 
			
		||||
  { "BirdeeHub/lzextras", },
 | 
			
		||||
  { "stevearc/oil.nvim", },
 | 
			
		||||
  { 'joshdick/onedark.vim', },
 | 
			
		||||
  { 'ellisonleao/gruvbox.nvim', },
 | 
			
		||||
  { 'nvim-tree/nvim-web-devicons', },
 | 
			
		||||
  { 'nvim-lua/plenary.nvim', },
 | 
			
		||||
  { 'tpope/vim-repeat', },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
-- NOTE: These 2 need to be set up before any plugins are loaded.
 | 
			
		||||
vim.g.mapleader = ' '
 | 
			
		||||
vim.g.maplocalleader = ' '
 | 
			
		||||
vim.g.mapleader = ';'
 | 
			
		||||
vim.g.maplocalleader = ';'
 | 
			
		||||
 | 
			
		||||
-- [[ Setting options ]]
 | 
			
		||||
-- See `:help vim.o`
 | 
			
		||||
| 
						 | 
				
			
			@ -10,66 +10,77 @@ vim.g.maplocalleader = ' '
 | 
			
		|||
--  See `:help 'list'`
 | 
			
		||||
--  and `:help 'listchars'`
 | 
			
		||||
vim.opt.list = true
 | 
			
		||||
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
 | 
			
		||||
vim.opt.listchars = { eol = "↲", extends = "⟩", nbsp = "␣", precedes = "⟨", tab = ">-", trail = "•" }
 | 
			
		||||
vim.opt.showbreak = "↪";
 | 
			
		||||
 | 
			
		||||
-- Set highlight on search
 | 
			
		||||
vim.opt.hlsearch = true
 | 
			
		||||
vim.opt.incsearch = true
 | 
			
		||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
 | 
			
		||||
 | 
			
		||||
-- Preview substitutions live, as you type!
 | 
			
		||||
vim.opt.inccommand = 'split'
 | 
			
		||||
 | 
			
		||||
-- Automatically load changed files
 | 
			
		||||
vim.opt.autoread = true
 | 
			
		||||
 | 
			
		||||
-- Minimal number of screen lines to keep above and below the cursor.
 | 
			
		||||
vim.opt.scrolloff = 10
 | 
			
		||||
 | 
			
		||||
-- Make line numbers default
 | 
			
		||||
vim.wo.number = true
 | 
			
		||||
vim.opt.number = true
 | 
			
		||||
 | 
			
		||||
-- Enable mouse mode
 | 
			
		||||
vim.o.mouse = 'a'
 | 
			
		||||
vim.opt.mouse = 'a'
 | 
			
		||||
 | 
			
		||||
-- no hard wrapping
 | 
			
		||||
vim.opt.textwidth = 0
 | 
			
		||||
vim.opt.wrapmargin = 0
 | 
			
		||||
 | 
			
		||||
-- get nice visual guides for 80, 100, and 120 cols.
 | 
			
		||||
vim.opt.colorcolumn = { "90", "100", "120", }
 | 
			
		||||
 | 
			
		||||
-- add line numbers
 | 
			
		||||
vim.opt.number = true
 | 
			
		||||
vim.opt.numberwidth = 3
 | 
			
		||||
 | 
			
		||||
-- Indent
 | 
			
		||||
-- vim.o.smarttab = true
 | 
			
		||||
vim.opt.cpoptions:append('I')
 | 
			
		||||
vim.o.expandtab = true
 | 
			
		||||
-- vim.o.smartindent = true
 | 
			
		||||
-- vim.o.autoindent = true
 | 
			
		||||
-- vim.o.tabstop = 4
 | 
			
		||||
-- vim.o.softtabstop = 4
 | 
			
		||||
-- vim.o.shiftwidth = 4
 | 
			
		||||
vim.opt.smarttab = true
 | 
			
		||||
vim.opt.expandtab = true
 | 
			
		||||
vim.opt.smartindent = true
 | 
			
		||||
vim.opt.autoindent = true
 | 
			
		||||
vim.opt.tabstop = 4
 | 
			
		||||
vim.opt.softtabstop = -1
 | 
			
		||||
vim.opt.shiftwidth = 4
 | 
			
		||||
 | 
			
		||||
-- stops line wrapping from being confusing
 | 
			
		||||
vim.o.breakindent = true
 | 
			
		||||
 | 
			
		||||
-- Save undo history
 | 
			
		||||
vim.o.undofile = true
 | 
			
		||||
vim.opt.breakindent = true
 | 
			
		||||
 | 
			
		||||
-- Case-insensitive searching UNLESS \C or capital in search
 | 
			
		||||
vim.o.ignorecase = true
 | 
			
		||||
vim.o.smartcase = true
 | 
			
		||||
vim.opt.ignorecase = true
 | 
			
		||||
vim.opt.smartcase = true
 | 
			
		||||
 | 
			
		||||
-- Keep signcolumn on by default
 | 
			
		||||
vim.wo.signcolumn = 'yes'
 | 
			
		||||
vim.wo.relativenumber = true
 | 
			
		||||
vim.opt.signcolumn = 'yes'
 | 
			
		||||
vim.opt.relativenumber = true
 | 
			
		||||
 | 
			
		||||
-- Decrease update time
 | 
			
		||||
vim.o.updatetime = 250
 | 
			
		||||
vim.o.timeoutlen = 300
 | 
			
		||||
vim.opt.updatetime = 250
 | 
			
		||||
vim.opt.timeoutlen = 300
 | 
			
		||||
 | 
			
		||||
-- Set completeopt to have a better completion experience
 | 
			
		||||
vim.o.completeopt = 'menu,preview,noselect'
 | 
			
		||||
vim.opt.completeopt = { 'menu', 'preview', 'noselect' }
 | 
			
		||||
 | 
			
		||||
-- NOTE: You should make sure your terminal supports this
 | 
			
		||||
vim.o.termguicolors = true
 | 
			
		||||
vim.opt.termguicolors = true
 | 
			
		||||
 | 
			
		||||
-- disable unneded files
 | 
			
		||||
vim.opt.swapfile = false
 | 
			
		||||
 | 
			
		||||
-- [[ Disable auto comment on enter ]]
 | 
			
		||||
-- See :help formatoptions
 | 
			
		||||
vim.api.nvim_create_autocmd("FileType", {
 | 
			
		||||
  desc = "remove formatoptions",
 | 
			
		||||
  callback = function()
 | 
			
		||||
    vim.opt.formatoptions:remove({ "c", "r", "o" })
 | 
			
		||||
  end,
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
-- set options for auto-commenting and using gq
 | 
			
		||||
vim.opt.formatoptions = "rojq"
 | 
			
		||||
 | 
			
		||||
-- [[ Highlight on yank ]]
 | 
			
		||||
-- See `:help vim.highlight.on_yank()`
 | 
			
		||||
| 
						 | 
				
			
			@ -82,33 +93,16 @@ vim.api.nvim_create_autocmd('TextYankPost', {
 | 
			
		|||
  pattern = '*',
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
vim.g.netrw_liststyle=0
 | 
			
		||||
vim.g.netrw_banner=0
 | 
			
		||||
vim.g.netrw_liststyle = 0
 | 
			
		||||
vim.g.netrw_banner = 0
 | 
			
		||||
-- [[ Basic Keymaps ]]
 | 
			
		||||
 | 
			
		||||
-- Keymaps for better default experience
 | 
			
		||||
-- See `:help vim.keymap.set()`
 | 
			
		||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv", { desc = 'Moves Line Down' })
 | 
			
		||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv", { desc = 'Moves Line Up' })
 | 
			
		||||
vim.keymap.set("n", "<C-d>", "<C-d>zz", { desc = 'Scroll Down' })
 | 
			
		||||
vim.keymap.set("n", "<C-u>", "<C-u>zz", { desc = 'Scroll Up' })
 | 
			
		||||
vim.keymap.set("n", "n", "nzzzv", { desc = 'Next Search Result' })
 | 
			
		||||
vim.keymap.set("n", "N", "Nzzzv", { desc = 'Previous Search Result' })
 | 
			
		||||
 | 
			
		||||
vim.keymap.set("n", "<leader><leader>[", "<cmd>bprev<CR>", { desc = 'Previous buffer' })
 | 
			
		||||
vim.keymap.set("n", "<leader><leader>]", "<cmd>bnext<CR>", { desc = 'Next buffer' })
 | 
			
		||||
vim.keymap.set("n", "<leader><leader>l", "<cmd>b#<CR>", { desc = 'Last buffer' })
 | 
			
		||||
vim.keymap.set("n", "<leader><leader>d", "<cmd>bdelete<CR>", { desc = 'delete buffer' })
 | 
			
		||||
 | 
			
		||||
-- see help sticky keys on windows
 | 
			
		||||
vim.cmd([[command! W w]])
 | 
			
		||||
vim.cmd([[command! Wq wq]])
 | 
			
		||||
vim.cmd([[command! WQ wq]])
 | 
			
		||||
vim.cmd([[command! Q q]])
 | 
			
		||||
 | 
			
		||||
-- Remap for dealing with word wrap
 | 
			
		||||
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
 | 
			
		||||
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
 | 
			
		||||
-- make quick system clipboard opts easier
 | 
			
		||||
vim.keymap.set({ 'n', 'v', 'x' }, '<leader>p', '"+p', { noremap = true, silent = true, desc = 'Paste from clipboard' })
 | 
			
		||||
vim.keymap.set({ "v", "x", "n" }, '<leader>y', '"+y', { noremap = true, silent = true, desc = 'Yank to clipboard' })
 | 
			
		||||
vim.keymap.set({ "n", "v", "x" }, '<leader>Y', '"+yy', { noremap = true, silent = true, desc = 'Yank line to clipboard' })
 | 
			
		||||
vim.keymap.set('i', '<C-p>', '<C-r><C-p>+',
 | 
			
		||||
  { noremap = true, silent = true, desc = 'Paste from clipboard from within insert mode' })
 | 
			
		||||
 | 
			
		||||
-- Diagnostic keymaps
 | 
			
		||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
 | 
			
		||||
| 
						 | 
				
			
			@ -116,21 +110,8 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnos
 | 
			
		|||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
 | 
			
		||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
-- kickstart.nvim starts you with this. 
 | 
			
		||||
-- But it constantly clobbers your system clipboard whenever you delete anything.
 | 
			
		||||
 | 
			
		||||
-- Sync clipboard between OS and Neovim.
 | 
			
		||||
--  Remove this option if you want your OS clipboard to remain independent.
 | 
			
		||||
--  See `:help 'clipboard'`
 | 
			
		||||
-- vim.o.clipboard = 'unnamedplus'
 | 
			
		||||
 | 
			
		||||
-- You should instead use these keybindings so that they are still easy to use, but dont conflict
 | 
			
		||||
vim.keymap.set({"v", "x", "n"}, '<leader>y', '"+y', { noremap = true, silent = true, desc = 'Yank to clipboard' })
 | 
			
		||||
vim.keymap.set({"n", "v", "x"}, '<leader>Y', '"+yy', { noremap = true, silent = true, desc = 'Yank line to clipboard' })
 | 
			
		||||
vim.keymap.set({"n", "v", "x"}, '<C-a>', 'gg0vG$', { noremap = true, silent = true, desc = 'Select all' })
 | 
			
		||||
vim.keymap.set({'n', 'v', 'x'}, '<leader>p', '"+p', { noremap = true, silent = true, desc = 'Paste from clipboard' })
 | 
			
		||||
vim.keymap.set('i', '<C-p>', '<C-r><C-p>+', { noremap = true, silent = true, desc = 'Paste from clipboard from within insert mode' })
 | 
			
		||||
vim.keymap.set("x", "<leader>P", '"_dP', { noremap = true, silent = true, desc = 'Paste over selection without erasing unnamed register' })
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
-- moving between splits
 | 
			
		||||
vim.keymap.set('n', '<C-h>', '<C-w>h', { desc = 'move to right split' })
 | 
			
		||||
vim.keymap.set('n', '<C-j>', '<C-w>j', { desc = 'move to below split' })
 | 
			
		||||
vim.keymap.set('n', '<C-k>', '<C-w>k', { desc = 'move to above split' })
 | 
			
		||||
vim.keymap.set('n', '<C-l>', '<C-w>l', { desc = 'move to left split' })
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,20 +6,21 @@ end
 | 
			
		|||
return {
 | 
			
		||||
  {
 | 
			
		||||
    "cmp-cmdline",
 | 
			
		||||
    for_cat = "general.blink",
 | 
			
		||||
    for_cat = "completion",
 | 
			
		||||
    on_plugin = { "blink.cmp" },
 | 
			
		||||
    load = load_w_after,
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "blink.compat",
 | 
			
		||||
    for_cat = "general.blink",
 | 
			
		||||
    for_cat = "completion",
 | 
			
		||||
    dep_of = { "cmp-cmdline" },
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "luasnip",
 | 
			
		||||
    for_cat = "general.blink",
 | 
			
		||||
    for_cat = "completion",
 | 
			
		||||
    dep_of = { "blink.cmp" },
 | 
			
		||||
    after = function (_)
 | 
			
		||||
    after = function(_)
 | 
			
		||||
      vim.cmd.packadd("friendly-snippets")
 | 
			
		||||
      local luasnip = require 'luasnip'
 | 
			
		||||
      require('luasnip.loaders.from_vscode').lazy_load()
 | 
			
		||||
      luasnip.config.setup {}
 | 
			
		||||
| 
						 | 
				
			
			@ -27,31 +28,39 @@ return {
 | 
			
		|||
      local ls = require('luasnip')
 | 
			
		||||
 | 
			
		||||
      vim.keymap.set({ "i", "s" }, "<M-n>", function()
 | 
			
		||||
          if ls.choice_active() then
 | 
			
		||||
              ls.change_choice(1)
 | 
			
		||||
          end
 | 
			
		||||
        if ls.choice_active() then
 | 
			
		||||
          ls.change_choice(1)
 | 
			
		||||
        end
 | 
			
		||||
      end)
 | 
			
		||||
    end,
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "colorful-menu.nvim",
 | 
			
		||||
    for_cat = "general.blink",
 | 
			
		||||
    for_cat = "completion",
 | 
			
		||||
    on_plugin = { "blink.cmp" },
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "blink.cmp",
 | 
			
		||||
    for_cat = "general.blink",
 | 
			
		||||
    for_cat = "completion",
 | 
			
		||||
    event = "DeferredUIEnter",
 | 
			
		||||
    after = function (_)
 | 
			
		||||
    after = function(_)
 | 
			
		||||
      require("blink.cmp").setup({
 | 
			
		||||
        -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
 | 
			
		||||
        -- See :h blink-cmp-config-keymap for configuring keymaps
 | 
			
		||||
        keymap =  {
 | 
			
		||||
          preset = 'default',
 | 
			
		||||
        keymap = {
 | 
			
		||||
          preset = "enter",
 | 
			
		||||
          ["<Tab>"] = { "select_next", "fallback" },
 | 
			
		||||
          ["<S-Tab>"] = { "select_prev", "fallback" },
 | 
			
		||||
        },
 | 
			
		||||
        cmdline = {
 | 
			
		||||
          enabled = true,
 | 
			
		||||
          completion = {
 | 
			
		||||
            list = {
 | 
			
		||||
              selection = {
 | 
			
		||||
                preselect = false,
 | 
			
		||||
                -- auto_insert = false,
 | 
			
		||||
              },
 | 
			
		||||
            },
 | 
			
		||||
            menu = {
 | 
			
		||||
              auto_show = true,
 | 
			
		||||
            },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
local colorschemeName = nixCats('colorscheme')
 | 
			
		||||
if not require('nixCatsUtils').isNixCats then
 | 
			
		||||
  colorschemeName = 'onedark'
 | 
			
		||||
  colorschemeName = 'gruvbox'
 | 
			
		||||
end
 | 
			
		||||
-- Could I lazy load on colorscheme with lze?
 | 
			
		||||
-- sure. But I was going to call vim.cmd.colorscheme() during startup anyway
 | 
			
		||||
| 
						 | 
				
			
			@ -16,12 +16,12 @@ if ok then
 | 
			
		|||
  })
 | 
			
		||||
  vim.notify = notify
 | 
			
		||||
  vim.keymap.set("n", "<Esc>", function()
 | 
			
		||||
      notify.dismiss({ silent = true, })
 | 
			
		||||
    notify.dismiss({ silent = true, })
 | 
			
		||||
  end, { desc = "dismiss notify popup and clear hlsearch" })
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
-- NOTE: you can check if you included the category with the thing wherever you want.
 | 
			
		||||
if nixCats('general.extra') then
 | 
			
		||||
if nixCats('always') then
 | 
			
		||||
  -- I didnt want to bother with lazy loading this.
 | 
			
		||||
  -- I could put it in opt and put it in a spec anyway
 | 
			
		||||
  -- and then not set any handlers and it would load at startup,
 | 
			
		||||
| 
						 | 
				
			
			@ -74,56 +74,45 @@ require('lze').load {
 | 
			
		|||
    -- it is defined in luaUtils template in lua/nixCatsUtils/lzUtils.lua
 | 
			
		||||
    -- you could replace this with enabled = nixCats('cat.name') == true
 | 
			
		||||
    -- if you didnt care to set a different default for when not using nix than the default you already set
 | 
			
		||||
    for_cat = 'general.markdown',
 | 
			
		||||
    for_cat = 'markdown',
 | 
			
		||||
    cmd = { "MarkdownPreview", "MarkdownPreviewStop", "MarkdownPreviewToggle", },
 | 
			
		||||
    ft = "markdown",
 | 
			
		||||
    keys = {
 | 
			
		||||
      {"<leader>mp", "<cmd>MarkdownPreview <CR>", mode = {"n"}, noremap = true, desc = "markdown preview"},
 | 
			
		||||
      {"<leader>ms", "<cmd>MarkdownPreviewStop <CR>", mode = {"n"}, noremap = true, desc = "markdown preview stop"},
 | 
			
		||||
      {"<leader>mt", "<cmd>MarkdownPreviewToggle <CR>", mode = {"n"}, noremap = true, desc = "markdown preview toggle"},
 | 
			
		||||
      { "<leader>mp", "<cmd>MarkdownPreview <CR>",       mode = { "n" }, noremap = true, desc = "markdown preview" },
 | 
			
		||||
      { "<leader>ms", "<cmd>MarkdownPreviewStop <CR>",   mode = { "n" }, noremap = true, desc = "markdown preview stop" },
 | 
			
		||||
      { "<leader>mt", "<cmd>MarkdownPreviewToggle <CR>", mode = { "n" }, noremap = true, desc = "markdown preview toggle" },
 | 
			
		||||
    },
 | 
			
		||||
    before = function(plugin)
 | 
			
		||||
      vim.g.mkdp_auto_close = 0
 | 
			
		||||
    end,
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "undotree",
 | 
			
		||||
    for_cat = 'general.extra',
 | 
			
		||||
    cmd = { "UndotreeToggle", "UndotreeHide", "UndotreeShow", "UndotreeFocus", "UndotreePersistUndo", },
 | 
			
		||||
    keys = { { "<leader>U", "<cmd>UndotreeToggle<CR>", mode = { "n" }, desc = "Undo Tree" }, },
 | 
			
		||||
    before = function(_)
 | 
			
		||||
      vim.g.undotree_WindowLayout = 1
 | 
			
		||||
      vim.g.undotree_SplitWidth = 40
 | 
			
		||||
    end,
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "comment.nvim",
 | 
			
		||||
    for_cat = 'general.extra',
 | 
			
		||||
    "leap.nvim",
 | 
			
		||||
    for_cat = 'always',
 | 
			
		||||
    event = "DeferredUIEnter",
 | 
			
		||||
    after = function(plugin)
 | 
			
		||||
      require('Comment').setup()
 | 
			
		||||
    end,
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "indent-blankline.nvim",
 | 
			
		||||
    for_cat = 'general.extra',
 | 
			
		||||
    event = "DeferredUIEnter",
 | 
			
		||||
    after = function(plugin)
 | 
			
		||||
      require("ibl").setup()
 | 
			
		||||
      require('leap').set_default_mappings()
 | 
			
		||||
    end,
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "nvim-surround",
 | 
			
		||||
    for_cat = 'general.always',
 | 
			
		||||
    for_cat = 'always',
 | 
			
		||||
    event = "DeferredUIEnter",
 | 
			
		||||
    -- keys = "",
 | 
			
		||||
    after = function(plugin)
 | 
			
		||||
      require('nvim-surround').setup()
 | 
			
		||||
    end,
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "marks.nvim",
 | 
			
		||||
    for_cat = "always",
 | 
			
		||||
    after = function(plugin)
 | 
			
		||||
      require('marks').setup({})
 | 
			
		||||
    end
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "vim-startuptime",
 | 
			
		||||
    for_cat = 'general.extra',
 | 
			
		||||
    for_cat = 'extra',
 | 
			
		||||
    cmd = { "StartupTime" },
 | 
			
		||||
    before = function(_)
 | 
			
		||||
      vim.g.startuptime_event_width = 0
 | 
			
		||||
| 
						 | 
				
			
			@ -133,77 +122,92 @@ require('lze').load {
 | 
			
		|||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "fidget.nvim",
 | 
			
		||||
    for_cat = 'general.extra',
 | 
			
		||||
    for_cat = 'always',
 | 
			
		||||
    event = "DeferredUIEnter",
 | 
			
		||||
    -- keys = "",
 | 
			
		||||
    after = function(plugin)
 | 
			
		||||
      require('fidget').setup({})
 | 
			
		||||
    end,
 | 
			
		||||
  },
 | 
			
		||||
  -- {
 | 
			
		||||
  --   "hlargs",
 | 
			
		||||
  --   for_cat = 'general.extra',
 | 
			
		||||
  --   event = "DeferredUIEnter",
 | 
			
		||||
  --   -- keys = "",
 | 
			
		||||
  --   dep_of = { "nvim-lspconfig" },
 | 
			
		||||
  --   after = function(plugin)
 | 
			
		||||
  --     require('hlargs').setup {
 | 
			
		||||
  --       color = '#32a88f',
 | 
			
		||||
  --     }
 | 
			
		||||
  --     vim.cmd([[hi clear @lsp.type.parameter]])
 | 
			
		||||
  --     vim.cmd([[hi link @lsp.type.parameter Hlargs]])
 | 
			
		||||
  --   end,
 | 
			
		||||
  -- },
 | 
			
		||||
  {
 | 
			
		||||
    "toggleterm.nvim",
 | 
			
		||||
    for_cat = "always",
 | 
			
		||||
    after = function(plugin)
 | 
			
		||||
      require("toggleterm").setup({
 | 
			
		||||
        direction = "horizontal",
 | 
			
		||||
        insert_mappings = false,
 | 
			
		||||
        open_mapping = [[<c-\>]],
 | 
			
		||||
        terminal_mappings = false,
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
      local Terminal = require("toggleterm.terminal").Terminal
 | 
			
		||||
      Floatingterm = Terminal:new({
 | 
			
		||||
        hidden = true,
 | 
			
		||||
        direction = "float",
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
      vim.keymap.set(
 | 
			
		||||
        "n",
 | 
			
		||||
        "<leader>s",
 | 
			
		||||
        function()
 | 
			
		||||
          Floatingterm:toggle()
 | 
			
		||||
        end,
 | 
			
		||||
        { desc = "toggle [S]cratch terminal", }
 | 
			
		||||
      )
 | 
			
		||||
    end
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "lualine.nvim",
 | 
			
		||||
    for_cat = 'general.always',
 | 
			
		||||
    for_cat = 'always',
 | 
			
		||||
    -- cmd = { "" },
 | 
			
		||||
    event = "DeferredUIEnter",
 | 
			
		||||
    -- ft = "",
 | 
			
		||||
    -- keys = "",
 | 
			
		||||
    -- colorscheme = "",
 | 
			
		||||
    after = function (plugin)
 | 
			
		||||
 | 
			
		||||
    after = function(plugin)
 | 
			
		||||
      require('lualine').setup({
 | 
			
		||||
        options = {
 | 
			
		||||
          icons_enabled = false,
 | 
			
		||||
          theme = colorschemeName,
 | 
			
		||||
          component_separators = '|',
 | 
			
		||||
          section_separators = '',
 | 
			
		||||
        },
 | 
			
		||||
        sections = {
 | 
			
		||||
          lualine_c = {
 | 
			
		||||
            {
 | 
			
		||||
              'filename', path = 1, status = true,
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
          alwaysDivideMiddle = true,
 | 
			
		||||
          icons_enabled = true,
 | 
			
		||||
          component_separators = { left = '', right = '' },
 | 
			
		||||
          section_separators = { left = '', right = '' },
 | 
			
		||||
        },
 | 
			
		||||
        inactive_sections = {
 | 
			
		||||
          lualine_b = {
 | 
			
		||||
            {
 | 
			
		||||
              'filename', path = 3, status = true,
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
          lualine_x = {'filetype'},
 | 
			
		||||
          lualine_a = {},
 | 
			
		||||
          lualine_b = {},
 | 
			
		||||
          lualine_c = { "filename" },
 | 
			
		||||
          lualine_x = { "filetype" },
 | 
			
		||||
          lualine_y = {},
 | 
			
		||||
          lualine_z = {},
 | 
			
		||||
        },
 | 
			
		||||
        sections = {
 | 
			
		||||
          lualine_a = { "mode" },
 | 
			
		||||
          lualine_b = { "branch", "diff", "diagnostics" },
 | 
			
		||||
          lualine_c = { { "filename", path = 1 } },
 | 
			
		||||
          lualine_x = { "encoding", "fileformat", "filetype" },
 | 
			
		||||
          lualine_y = { "progress" },
 | 
			
		||||
          lualine_z = { "location" },
 | 
			
		||||
        },
 | 
			
		||||
        tabline = {
 | 
			
		||||
          lualine_a = { 'buffers' },
 | 
			
		||||
          -- if you use lualine-lsp-progress, I have mine here instead of fidget
 | 
			
		||||
          -- lualine_b = { 'lsp_progress', },
 | 
			
		||||
          lualine_z = { 'tabs' }
 | 
			
		||||
          lualine_a = { { "buffers", mode = 4 } },
 | 
			
		||||
          lualine_b = {},
 | 
			
		||||
          lualine_c = {},
 | 
			
		||||
          lualine_x = {},
 | 
			
		||||
          lualine_y = {},
 | 
			
		||||
          lualine_z = { { "tabs", mode = 2 } }
 | 
			
		||||
        },
 | 
			
		||||
      })
 | 
			
		||||
    end,
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "gitsigns.nvim",
 | 
			
		||||
    for_cat = 'general.always',
 | 
			
		||||
    for_cat = 'always',
 | 
			
		||||
    event = "DeferredUIEnter",
 | 
			
		||||
    -- cmd = { "" },
 | 
			
		||||
    -- ft = "",
 | 
			
		||||
    -- keys = "",
 | 
			
		||||
    -- colorscheme = "",
 | 
			
		||||
    after = function (plugin)
 | 
			
		||||
    after = function(plugin)
 | 
			
		||||
      require('gitsigns').setup({
 | 
			
		||||
        -- See `:help gitsigns.txt`
 | 
			
		||||
        signs = {
 | 
			
		||||
| 
						 | 
				
			
			@ -281,35 +285,80 @@ require('lze').load {
 | 
			
		|||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "which-key.nvim",
 | 
			
		||||
    for_cat = 'general.extra',
 | 
			
		||||
    -- cmd = { "" },
 | 
			
		||||
    event = "DeferredUIEnter",
 | 
			
		||||
    -- ft = "",
 | 
			
		||||
    -- keys = "",
 | 
			
		||||
    -- colorscheme = "",
 | 
			
		||||
    after = function (plugin)
 | 
			
		||||
    for_cat = 'always',
 | 
			
		||||
    after = function(plugin)
 | 
			
		||||
      require('which-key').setup({
 | 
			
		||||
      })
 | 
			
		||||
      require('which-key').add {
 | 
			
		||||
        { "<leader><leader>", group = "buffer commands" },
 | 
			
		||||
        { "<leader><leader>_", hidden = true },
 | 
			
		||||
        { "<leader>c", group = "[c]ode" },
 | 
			
		||||
        { "<leader>c_", hidden = true },
 | 
			
		||||
        { "<leader>d", group = "[d]ocument" },
 | 
			
		||||
        { "<leader>d_", hidden = true },
 | 
			
		||||
        { "<leader>g", group = "[g]it" },
 | 
			
		||||
        { "<leader>g_", hidden = true },
 | 
			
		||||
        { "<leader>gt", group = "[t]oggle" },
 | 
			
		||||
        { "<leader>m", group = "[m]arkdown" },
 | 
			
		||||
        { "<leader>m_", hidden = true },
 | 
			
		||||
        { "<leader>r", group = "[r]ename" },
 | 
			
		||||
        { "<leader>r_", hidden = true },
 | 
			
		||||
        { "<leader>s", group = "[s]earch" },
 | 
			
		||||
        { "<leader>s_", hidden = true },
 | 
			
		||||
        { "<leader>t", group = "[t]oggles" },
 | 
			
		||||
        { "<leader>t_", hidden = true },
 | 
			
		||||
        { "<leader>w", group = "[w]orkspace" },
 | 
			
		||||
        { "<leader>w_", hidden = true },
 | 
			
		||||
        { "<leader>f", group = "[f]ind" },
 | 
			
		||||
        { "<leader>t", group = "[t]ree" },
 | 
			
		||||
        { "<leader>c", group = "[c]heck" },
 | 
			
		||||
        { "<leader>l", group = "[l]sp" },
 | 
			
		||||
        { "<leader>lw", group = "[l]sp [w]orkspace" },
 | 
			
		||||
      }
 | 
			
		||||
    end,
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "nvim-tree.lua",
 | 
			
		||||
    for_cat = "tree",
 | 
			
		||||
    keys = {
 | 
			
		||||
      { "<leader>t", "<cmd>NvimTreeToggle<CR>", desc = "Toggle file tree", },
 | 
			
		||||
    },
 | 
			
		||||
    after = function(plugin)
 | 
			
		||||
      require("nvim-tree").setup()
 | 
			
		||||
    end
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    -- TODO: Replace toggle term and nvim-tree with snacks equivilants?
 | 
			
		||||
    -- Potentially checkout the lazygit module. Might even be able to replace
 | 
			
		||||
    -- telescope?
 | 
			
		||||
    -- if you do replace telescope, the picker module has a *ton* of interesting pickers, such as an undotree.
 | 
			
		||||
    "snacks.nvim",
 | 
			
		||||
    for_cat = "always",
 | 
			
		||||
    priority = 10,
 | 
			
		||||
    after = function()
 | 
			
		||||
      local Snacks = require("snacks")
 | 
			
		||||
      Snacks.setup({
 | 
			
		||||
        input = {},
 | 
			
		||||
        image = {},
 | 
			
		||||
        notifier = {},
 | 
			
		||||
        scroll = {},
 | 
			
		||||
        picker = {
 | 
			
		||||
          enabled = true,
 | 
			
		||||
          ui_select = true,
 | 
			
		||||
        },
 | 
			
		||||
        terminal = {},
 | 
			
		||||
        indent = {
 | 
			
		||||
          animate = { enabled = true },
 | 
			
		||||
          scope = { enabled = true },
 | 
			
		||||
          chunk = { enabled = true },
 | 
			
		||||
        },
 | 
			
		||||
      })
 | 
			
		||||
      -- setup rename autocmds
 | 
			
		||||
      local prev = { new_name = "", old_name = "" } -- Prevents duplicate events
 | 
			
		||||
      vim.api.nvim_create_autocmd("User", {
 | 
			
		||||
        pattern = "NvimTreeSetup",
 | 
			
		||||
        callback = function()
 | 
			
		||||
          local events = require("nvim-tree.api").events
 | 
			
		||||
          events.subscribe(events.Event.NodeRenamed, function(data)
 | 
			
		||||
            if prev.new_name ~= data.new_name or prev.old_name ~= data.old_name then
 | 
			
		||||
              data = data
 | 
			
		||||
              Snacks.rename.on_rename_file(data.old_name, data.new_name)
 | 
			
		||||
            end
 | 
			
		||||
          end)
 | 
			
		||||
        end,
 | 
			
		||||
      })
 | 
			
		||||
      vim.api.nvim_create_autocmd("User", {
 | 
			
		||||
        pattern = "OilActionsPost",
 | 
			
		||||
        callback = function(event)
 | 
			
		||||
          if event.data.actions.type == "move" then
 | 
			
		||||
            Snacks.rename.on_rename_file(event.data.actions.src_url, event.data.actions.dest_url)
 | 
			
		||||
          end
 | 
			
		||||
        end,
 | 
			
		||||
      })
 | 
			
		||||
    end
 | 
			
		||||
  },
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -57,7 +57,7 @@ end
 | 
			
		|||
return {
 | 
			
		||||
  {
 | 
			
		||||
    "telescope.nvim",
 | 
			
		||||
    for_cat = 'general.telescope',
 | 
			
		||||
    for_cat = 'telescope',
 | 
			
		||||
    cmd = { "Telescope", "LiveGrepGitRoot" },
 | 
			
		||||
    -- NOTE: our on attach function defines keybinds that call telescope.
 | 
			
		||||
    -- so, the on_require handler will load telescope when we use those.
 | 
			
		||||
| 
						 | 
				
			
			@ -65,49 +65,37 @@ return {
 | 
			
		|||
    -- event = "",
 | 
			
		||||
    -- ft = "",
 | 
			
		||||
    keys = {
 | 
			
		||||
      { "<leader>sM", '<cmd>Telescope notify<CR>', mode = {"n"}, desc = '[S]earch [M]essage', },
 | 
			
		||||
      { "<leader>sp",live_grep_git_root, mode = {"n"}, desc = '[S]earch git [P]roject root', },
 | 
			
		||||
      { "<leader>/", function()
 | 
			
		||||
        -- Slightly advanced example of overriding default behavior and theme
 | 
			
		||||
        -- You can pass additional configuration to telescope to change theme, layout, etc.
 | 
			
		||||
        require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
 | 
			
		||||
          winblend = 10,
 | 
			
		||||
          previewer = false,
 | 
			
		||||
        })
 | 
			
		||||
      end, mode = {"n"}, desc = '[/] Fuzzily search in current buffer', },
 | 
			
		||||
      { "<leader>s/", function()
 | 
			
		||||
      { "<leader>fM", '<cmd>Telescope notify<CR>', mode = {"n"}, desc = '[F]ind [M]essage', },
 | 
			
		||||
      { "<leader>fp",live_grep_git_root, mode = {"n"}, desc = '[F]ind git [P]roject root', },
 | 
			
		||||
      { "<leader>f/", function()
 | 
			
		||||
        require('telescope.builtin').live_grep {
 | 
			
		||||
          grep_open_files = true,
 | 
			
		||||
          prompt_title = 'Live Grep in Open Files',
 | 
			
		||||
        }
 | 
			
		||||
      end, mode = {"n"}, desc = '[S]earch [/] in Open Files' },
 | 
			
		||||
      { "<leader><leader>s", function() return require('telescope.builtin').buffers() end, mode = {"n"}, desc = '[ ] Find existing buffers', },
 | 
			
		||||
      { "<leader>s.", function() return require('telescope.builtin').oldfiles() end, mode = {"n"}, desc = '[S]earch Recent Files ("." for repeat)', },
 | 
			
		||||
      { "<leader>sr", function() return require('telescope.builtin').resume() end, mode = {"n"}, desc = '[S]earch [R]esume', },
 | 
			
		||||
      { "<leader>sd", function() return require('telescope.builtin').diagnostics() end, mode = {"n"}, desc = '[S]earch [D]iagnostics', },
 | 
			
		||||
      { "<leader>sg", function() return require('telescope.builtin').live_grep() end, mode = {"n"}, desc = '[S]earch by [G]rep', },
 | 
			
		||||
      { "<leader>sw", function() return require('telescope.builtin').grep_string() end, mode = {"n"}, desc = '[S]earch current [W]ord', },
 | 
			
		||||
      { "<leader>ss", function() return require('telescope.builtin').builtin() end, mode = {"n"}, desc = '[S]earch [S]elect Telescope', },
 | 
			
		||||
      { "<leader>sf", function() return require('telescope.builtin').find_files() end, mode = {"n"}, desc = '[S]earch [F]iles', },
 | 
			
		||||
      { "<leader>sk", function() return require('telescope.builtin').keymaps() end, mode = {"n"}, desc = '[S]earch [K]eymaps', },
 | 
			
		||||
      { "<leader>sh", function() return require('telescope.builtin').help_tags() end, mode = {"n"}, desc = '[S]earch [H]elp', },
 | 
			
		||||
      end, mode = {"n"}, desc = '[F]ind [/] in Open Files' },
 | 
			
		||||
      { "<leader>fb", function() return require('telescope.builtin').buffers() end, mode = {"n"}, desc = '[F]ind [B]uffers', },
 | 
			
		||||
      { "<leader>fr", function() return require('telescope.builtin').resume() end, mode = {"n"}, desc = '[F]ind [R]esume', },
 | 
			
		||||
      { "<leader>fd", function() return require('telescope.builtin').diagnostics() end, mode = {"n"}, desc = '[F]ind [D]iagnostics', },
 | 
			
		||||
      { "<leader>fg", function() return require('telescope.builtin').live_grep() end, mode = {"n"}, desc = '[F]ind by [G]rep', },
 | 
			
		||||
      { "<leader>fs", function() return require('telescope.builtin').builtin() end, mode = {"n"}, desc = '[F]ind [S]elect Telescope', },
 | 
			
		||||
      { "<leader>ff", function() return require('telescope.builtin').find_files() end, mode = {"n"}, desc = '[F]ind [F]iles', },
 | 
			
		||||
      { "<leader>fk", function() return require('telescope.builtin').keymaps() end, mode = {"n"}, desc = '[F]ind [K]eymaps', },
 | 
			
		||||
      { "<leader>fh", function() return require('telescope.builtin').help_tags() end, mode = {"n"}, desc = '[F]ind [H]elp', },
 | 
			
		||||
      { "<leader>fz", function() require("telescope").extensions.zoxide.list() end, mode = {"n"}, desc = '[F]ind [Z]oxide',},
 | 
			
		||||
      { "<leader>fi", function() require("telescope").extensions.file_browser.file_browser() end, mode={"n"}, desc = '[F]ind [I]nteractive file browser',},
 | 
			
		||||
    },
 | 
			
		||||
    -- colorscheme = "",
 | 
			
		||||
    load = function (name)
 | 
			
		||||
        vim.cmd.packadd(name)
 | 
			
		||||
        vim.cmd.packadd("telescope-fzf-native.nvim")
 | 
			
		||||
        vim.cmd.packadd("telescope-ui-select.nvim")
 | 
			
		||||
        vim.cmd.packadd("telescope-file-browser.nvim")
 | 
			
		||||
        vim.cmd.packadd("telescope-zoxide")
 | 
			
		||||
    end,
 | 
			
		||||
    after = function (plugin)
 | 
			
		||||
      require('telescope').setup {
 | 
			
		||||
      local telescope = require("telescope")
 | 
			
		||||
      telescope.setup {
 | 
			
		||||
        -- You can put your default mappings / updates / etc. in here
 | 
			
		||||
        --  All the info you're looking for is in `:help telescope.setup()`
 | 
			
		||||
        --
 | 
			
		||||
        defaults = {
 | 
			
		||||
          mappings = {
 | 
			
		||||
            i = { ['<c-enter>'] = 'to_fuzzy_refine' },
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
        -- pickers = {}
 | 
			
		||||
        extensions = {
 | 
			
		||||
          ['ui-select'] = {
 | 
			
		||||
| 
						 | 
				
			
			@ -117,8 +105,9 @@ return {
 | 
			
		|||
      }
 | 
			
		||||
 | 
			
		||||
      -- Enable telescope extensions, if they are installed
 | 
			
		||||
      pcall(require('telescope').load_extension, 'fzf')
 | 
			
		||||
      pcall(require('telescope').load_extension, 'ui-select')
 | 
			
		||||
      telescope.load_extension('ui-select')
 | 
			
		||||
      telescope.load_extension('zoxide')
 | 
			
		||||
      telescope.load_extension('file_browser')
 | 
			
		||||
 | 
			
		||||
      vim.api.nvim_create_user_command('LiveGrepGitRoot', live_grep_git_root, {})
 | 
			
		||||
    end,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,17 +3,17 @@
 | 
			
		|||
return {
 | 
			
		||||
  {
 | 
			
		||||
    "nvim-treesitter",
 | 
			
		||||
    for_cat = 'general.treesitter',
 | 
			
		||||
    for_cat = 'treesitter',
 | 
			
		||||
    -- cmd = { "" },
 | 
			
		||||
    event = "DeferredUIEnter",
 | 
			
		||||
    -- ft = "",
 | 
			
		||||
    -- keys = "",
 | 
			
		||||
    -- colorscheme = "",
 | 
			
		||||
    load = function (name)
 | 
			
		||||
        vim.cmd.packadd(name)
 | 
			
		||||
        vim.cmd.packadd("nvim-treesitter-textobjects")
 | 
			
		||||
    load = function(name)
 | 
			
		||||
      vim.cmd.packadd(name)
 | 
			
		||||
      vim.cmd.packadd("rainbow-delimiters.nvim")
 | 
			
		||||
    end,
 | 
			
		||||
    after = function (plugin)
 | 
			
		||||
    after = function(plugin)
 | 
			
		||||
      -- [[ Configure Treesitter ]]
 | 
			
		||||
      -- See `:help nvim-treesitter`
 | 
			
		||||
      require('nvim-treesitter.configs').setup {
 | 
			
		||||
| 
						 | 
				
			
			@ -28,51 +28,29 @@ return {
 | 
			
		|||
            node_decremental = '<M-space>',
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
        textobjects = {
 | 
			
		||||
          select = {
 | 
			
		||||
            enable = true,
 | 
			
		||||
            lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
 | 
			
		||||
            keymaps = {
 | 
			
		||||
              -- You can use the capture groups defined in textobjects.scm
 | 
			
		||||
              ['aa'] = '@parameter.outer',
 | 
			
		||||
              ['ia'] = '@parameter.inner',
 | 
			
		||||
              ['af'] = '@function.outer',
 | 
			
		||||
              ['if'] = '@function.inner',
 | 
			
		||||
              ['ac'] = '@class.outer',
 | 
			
		||||
              ['ic'] = '@class.inner',
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
          move = {
 | 
			
		||||
            enable = true,
 | 
			
		||||
            set_jumps = true, -- whether to set jumps in the jumplist
 | 
			
		||||
            goto_next_start = {
 | 
			
		||||
              [']m'] = '@function.outer',
 | 
			
		||||
              [']]'] = '@class.outer',
 | 
			
		||||
            },
 | 
			
		||||
            goto_next_end = {
 | 
			
		||||
              [']M'] = '@function.outer',
 | 
			
		||||
              [']['] = '@class.outer',
 | 
			
		||||
            },
 | 
			
		||||
            goto_previous_start = {
 | 
			
		||||
              ['[m'] = '@function.outer',
 | 
			
		||||
              ['[['] = '@class.outer',
 | 
			
		||||
            },
 | 
			
		||||
            goto_previous_end = {
 | 
			
		||||
              ['[M'] = '@function.outer',
 | 
			
		||||
              ['[]'] = '@class.outer',
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
          swap = {
 | 
			
		||||
            enable = true,
 | 
			
		||||
            swap_next = {
 | 
			
		||||
              ['<leader>a'] = '@parameter.inner',
 | 
			
		||||
            },
 | 
			
		||||
            swap_previous = {
 | 
			
		||||
              ['<leader>A'] = '@parameter.inner',
 | 
			
		||||
            },
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
      }
 | 
			
		||||
    end,
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "comment.nvim",
 | 
			
		||||
    for_cat = 'telescope',
 | 
			
		||||
    after = function(plugin)
 | 
			
		||||
      require('Comment').setup()
 | 
			
		||||
    end,
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "nvim-treesitter-context",
 | 
			
		||||
    for_cat = 'treesitter',
 | 
			
		||||
    keys = { { "<leader>x", "<cmd>TsContext toggle<CR>", mode = { "n" }, desc = "Toggle Context" }, },
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "treesj",
 | 
			
		||||
    for_cat = 'treesitter',
 | 
			
		||||
    keys = { { "<leader>j", "<cmd>TSJToggle<CR>", mode = { "n" }, desc = "Treesitter join" }, },
 | 
			
		||||
    after = function(_)
 | 
			
		||||
      require("treesj").setup({
 | 
			
		||||
        use_default_keymaps = false
 | 
			
		||||
      })
 | 
			
		||||
    end
 | 
			
		||||
  },
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue