null-ls and session
This commit is contained in:
		@@ -1,17 +1,17 @@
 | 
			
		||||
-- Bootstrap lazy.nvim
 | 
			
		||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
 | 
			
		||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
 | 
			
		||||
	local lazyrepo = "https://github.com/folke/lazy.nvim.git"
 | 
			
		||||
	local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
 | 
			
		||||
	if vim.v.shell_error ~= 0 then
 | 
			
		||||
		vim.api.nvim_echo({
 | 
			
		||||
			{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
 | 
			
		||||
			{ out, "WarningMsg" },
 | 
			
		||||
			{ "\nPress any key to exit..." },
 | 
			
		||||
		}, true, {})
 | 
			
		||||
		vim.fn.getchar()
 | 
			
		||||
		os.exit(1)
 | 
			
		||||
	end
 | 
			
		||||
  local lazyrepo = "https://github.com/folke/lazy.nvim.git"
 | 
			
		||||
  local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
 | 
			
		||||
  if vim.v.shell_error ~= 0 then
 | 
			
		||||
    vim.api.nvim_echo({
 | 
			
		||||
      { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
 | 
			
		||||
      { out,                            "WarningMsg" },
 | 
			
		||||
      { "\nPress any key to exit..." },
 | 
			
		||||
    }, true, {})
 | 
			
		||||
    vim.fn.getchar()
 | 
			
		||||
    os.exit(1)
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
vim.opt.rtp:prepend(lazypath)
 | 
			
		||||
 | 
			
		||||
@@ -25,15 +25,16 @@ require("config.options")
 | 
			
		||||
 | 
			
		||||
-- Setup lazy.nvim
 | 
			
		||||
require("lazy").setup({
 | 
			
		||||
	spec = {
 | 
			
		||||
		-- import your plugins
 | 
			
		||||
		{ import = "plugins" },
 | 
			
		||||
	},
 | 
			
		||||
	-- Configure any other settings here. See the documentation for more details.
 | 
			
		||||
	-- colorscheme that will be used when installing plugins.
 | 
			
		||||
	install = { colorscheme = { "kanagawa" } },
 | 
			
		||||
	-- automatically check for plugin updates
 | 
			
		||||
	checker = { enabled = true },
 | 
			
		||||
  spec = {
 | 
			
		||||
    -- import your plugins
 | 
			
		||||
    { import = "plugins" },
 | 
			
		||||
  },
 | 
			
		||||
  -- Configure any other settings here. See the documentation for more details.
 | 
			
		||||
  -- colorscheme that will be used when installing plugins.
 | 
			
		||||
  install = { colorscheme = { "kanagawa" } },
 | 
			
		||||
  -- automatically check for plugin updates
 | 
			
		||||
  checker = { enabled = true },
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
require("config.keymap")
 | 
			
		||||
require("fzf-lua").register_ui_select()
 | 
			
		||||
 
 | 
			
		||||
@@ -11,6 +11,9 @@ return {
 | 
			
		||||
  },
 | 
			
		||||
  opts = {
 | 
			
		||||
    async = true,
 | 
			
		||||
    format = {
 | 
			
		||||
      timeout_ms = 5000,
 | 
			
		||||
    },
 | 
			
		||||
    formatters_by_ft = {
 | 
			
		||||
      lua = { "stylua" },
 | 
			
		||||
      -- Conform will run multiple formatters sequentially
 | 
			
		||||
@@ -20,10 +23,10 @@ return {
 | 
			
		||||
      -- Conform will run the first available formatter
 | 
			
		||||
      javascript = { "eslint_d", "prettierd", "prettier", stop_after_first = true },
 | 
			
		||||
      typescript = { "eslint_d", "prettierd", "prettier", stop_after_first = true },
 | 
			
		||||
      prisma = { "null-ls", lsp_format = false },
 | 
			
		||||
      format_on_save = {
 | 
			
		||||
        -- These options will be passed to conform.format()
 | 
			
		||||
        timeout_ms = 500,
 | 
			
		||||
        lsp_format = "fallback",
 | 
			
		||||
        timeout_ms = 5000,
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
 
 | 
			
		||||
@@ -1,23 +1,92 @@
 | 
			
		||||
return {
 | 
			
		||||
  "ibhagwan/fzf-lua",
 | 
			
		||||
  dependencies = { "echasnovski/mini.icons" },
 | 
			
		||||
  opts = {
 | 
			
		||||
    winopts={
 | 
			
		||||
      height = 0.85,
 | 
			
		||||
      width = 0.95,
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  config = function()
 | 
			
		||||
    require("fzf-lua").setup({
 | 
			
		||||
      winopts = {
 | 
			
		||||
        height = 0.85,
 | 
			
		||||
        width = 0.95,
 | 
			
		||||
      },
 | 
			
		||||
    })
 | 
			
		||||
    require("fzf-lua").register_ui_select()
 | 
			
		||||
  end,
 | 
			
		||||
  keys = {
 | 
			
		||||
    { "<leader>ff", function() require('fzf-lua').files() end, desc="Find Files in current dir"},
 | 
			
		||||
    { "<leader>fb", function() require('fzf-lua').buffers() end, desc="Find open buffers"},
 | 
			
		||||
    { "<leader><leader>", function() require('fzf-lua').buffers() end, desc="Find open buffers"},
 | 
			
		||||
    { "<leader>fgf", function() require('fzf-lua').git_files() end, desc="Find git files"},
 | 
			
		||||
    { "<leader>fgb", function() require('fzf-lua').git_branches() end, desc="Find git branches"},
 | 
			
		||||
    { "<leader>fB", function() require('fzf-lua').builtin() end, desc="Find builtin finders"},
 | 
			
		||||
    { "<leader>fr", function() require('fzf-lua').resume() end, desc="Resume last search"},
 | 
			
		||||
    { "<leader>fG", function() require('fzf-lua').live_grep() end, desc="Grep files live"},
 | 
			
		||||
    { "<leader>fw", function() require('fzf-lua').grep_cword() end, desc="Grep current word"},
 | 
			
		||||
    { "<leader>fW", function() require('fzf-lua').grep_cWORD() end, desc="Grep current WORD"},
 | 
			
		||||
    { "<leader>/", function() require('fzf-lua').lgrep_curbuf() end, desc="Grep current buffer"},
 | 
			
		||||
  }
 | 
			
		||||
    {
 | 
			
		||||
      "<leader>ff",
 | 
			
		||||
      function()
 | 
			
		||||
        require("fzf-lua").files()
 | 
			
		||||
      end,
 | 
			
		||||
      desc = "Find Files in current dir",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "<leader>fb",
 | 
			
		||||
      function()
 | 
			
		||||
        require("fzf-lua").buffers()
 | 
			
		||||
      end,
 | 
			
		||||
      desc = "Find open buffers",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "<leader><leader>",
 | 
			
		||||
      function()
 | 
			
		||||
        require("fzf-lua").buffers()
 | 
			
		||||
      end,
 | 
			
		||||
      desc = "Find open buffers",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "<leader>fgf",
 | 
			
		||||
      function()
 | 
			
		||||
        require("fzf-lua").git_files()
 | 
			
		||||
      end,
 | 
			
		||||
      desc = "Find git files",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "<leader>fgb",
 | 
			
		||||
      function()
 | 
			
		||||
        require("fzf-lua").git_branches()
 | 
			
		||||
      end,
 | 
			
		||||
      desc = "Find git branches",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "<leader>fB",
 | 
			
		||||
      function()
 | 
			
		||||
        require("fzf-lua").builtin()
 | 
			
		||||
      end,
 | 
			
		||||
      desc = "Find builtin finders",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "<leader>fr",
 | 
			
		||||
      function()
 | 
			
		||||
        require("fzf-lua").resume()
 | 
			
		||||
      end,
 | 
			
		||||
      desc = "Resume last search",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "<leader>fG",
 | 
			
		||||
      function()
 | 
			
		||||
        require("fzf-lua").live_grep()
 | 
			
		||||
      end,
 | 
			
		||||
      desc = "Grep files live",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "<leader>fw",
 | 
			
		||||
      function()
 | 
			
		||||
        require("fzf-lua").grep_cword()
 | 
			
		||||
      end,
 | 
			
		||||
      desc = "Grep current word",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "<leader>fW",
 | 
			
		||||
      function()
 | 
			
		||||
        require("fzf-lua").grep_cWORD()
 | 
			
		||||
      end,
 | 
			
		||||
      desc = "Grep current WORD",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "<leader>/",
 | 
			
		||||
      function()
 | 
			
		||||
        require("fzf-lua").lgrep_curbuf()
 | 
			
		||||
      end,
 | 
			
		||||
      desc = "Grep current buffer",
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,9 @@ return {
 | 
			
		||||
    "WhoIsSethDaniel/mason-tool-installer.nvim",
 | 
			
		||||
    "yioneko/nvim-vtsls",
 | 
			
		||||
    opts = {
 | 
			
		||||
      format = {
 | 
			
		||||
        timeout_ms = 10000,
 | 
			
		||||
      },
 | 
			
		||||
      settings = {
 | 
			
		||||
        typescript = {
 | 
			
		||||
          inlayHints = {
 | 
			
		||||
@@ -20,7 +23,7 @@ return {
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    { "j-hui/fidget.nvim",       opts = {} },
 | 
			
		||||
    { "j-hui/fidget.nvim", opts = {} },
 | 
			
		||||
 | 
			
		||||
    "saghen/blink.cmp",
 | 
			
		||||
  },
 | 
			
		||||
@@ -87,7 +90,7 @@ return {
 | 
			
		||||
 | 
			
		||||
        local client = vim.lsp.get_client_by_id(event.data.client_id)
 | 
			
		||||
        if
 | 
			
		||||
            client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf)
 | 
			
		||||
          client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf)
 | 
			
		||||
        then
 | 
			
		||||
          local highlight_augroup = vim.api.nvim_create_augroup("kickstart-lsp-highlight", { clear = false })
 | 
			
		||||
          vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										18
									
								
								nvim/lua/plugins/null-ls.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								nvim/lua/plugins/null-ls.lua
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
return {
 | 
			
		||||
  "nvimtools/none-ls.nvim",
 | 
			
		||||
  dependencies = {
 | 
			
		||||
    "nvim-lua/plenary.nvim",
 | 
			
		||||
    "nvimtools/none-ls-extras.nvim",
 | 
			
		||||
  },
 | 
			
		||||
  config = function()
 | 
			
		||||
    local null_ls = require("null-ls")
 | 
			
		||||
    null_ls.setup({
 | 
			
		||||
      sources = {
 | 
			
		||||
        null_ls.builtins.code_actions.gitsigns,
 | 
			
		||||
        null_ls.builtins.code_actions.refactoring,
 | 
			
		||||
        null_ls.builtins.formatting.prisma_format,
 | 
			
		||||
        require("none-ls.diagnostics.eslint"), -- requires none-ls-extras.nvim
 | 
			
		||||
      },
 | 
			
		||||
    })
 | 
			
		||||
  end,
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										57
									
								
								nvim/lua/plugins/session.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								nvim/lua/plugins/session.lua
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,57 @@
 | 
			
		||||
return {
 | 
			
		||||
  "rmagatti/auto-session",
 | 
			
		||||
  lazy = false,
 | 
			
		||||
  keys = {
 | 
			
		||||
    -- Will use Telescope if installed or a vim.ui.select picker otherwise
 | 
			
		||||
    { "<leader>wr", "<cmd>AutoSession search<CR>", desc = "Session search" },
 | 
			
		||||
    { "<leader>ws", "<cmd>AutoSession save<CR>",   desc = "Save session" },
 | 
			
		||||
    { "<leader>wa", "<cmd>AutoSession toggle<CR>", desc = "Toggle autosave" },
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  ---enables autocomplete for opts
 | 
			
		||||
  ---@module "auto-session"
 | 
			
		||||
  ---@type AutoSession.Config
 | 
			
		||||
  opts = {
 | 
			
		||||
    -- The following are already the default values, no need to provide them if these are already the settings you want.
 | 
			
		||||
    session_lens = {
 | 
			
		||||
      picker = nil, -- "telescope"|"snacks"|"fzf"|"select"|nil Pickers are detected automatically but you can also manually choose one. Falls back to vim.ui.select
 | 
			
		||||
      mappings = {
 | 
			
		||||
        -- Mode can be a string or a table, e.g. {"i", "n"} for both insert and normal mode
 | 
			
		||||
        delete_session = { "i", "<C-d>" },
 | 
			
		||||
        alternate_session = { "i", "<C-s>" },
 | 
			
		||||
        copy_session = { "i", "<C-y>" },
 | 
			
		||||
      },
 | 
			
		||||
 | 
			
		||||
      picker_opts = {
 | 
			
		||||
        -- For Telescope, you can set theme options here, see:
 | 
			
		||||
        -- https://github.com/nvim-telescope/telescope.nvim/blob/master/doc/telescope.txt#L112
 | 
			
		||||
        -- https://github.com/nvim-telescope/telescope.nvim/blob/master/lua/telescope/themes.lua
 | 
			
		||||
        --
 | 
			
		||||
        -- border = true,
 | 
			
		||||
        -- layout_config = {
 | 
			
		||||
        --   width = 0.8, -- Can set width and height as percent of window
 | 
			
		||||
        --   height = 0.5,
 | 
			
		||||
        -- },
 | 
			
		||||
 | 
			
		||||
        -- For Snacks, you can set layout options here, see:
 | 
			
		||||
        -- https://github.com/folke/snacks.nvim/blob/main/docs/picker.md#%EF%B8%8F-layouts
 | 
			
		||||
        --
 | 
			
		||||
        -- preset = "dropdown",
 | 
			
		||||
        -- preview = false,
 | 
			
		||||
        -- layout = {
 | 
			
		||||
        --   width = 0.4,
 | 
			
		||||
        --   height = 0.4,
 | 
			
		||||
        -- },
 | 
			
		||||
 | 
			
		||||
        -- For Fzf-Lua, picker_opts just turns into winopts, see:
 | 
			
		||||
        -- https://github.com/ibhagwan/fzf-lua#customization
 | 
			
		||||
        --
 | 
			
		||||
        --  height = 0.8,
 | 
			
		||||
        --  width = 0.50,
 | 
			
		||||
      },
 | 
			
		||||
 | 
			
		||||
      -- Telescope only: If load_on_setup is false, make sure you use `:AutoSession search` to open the picker as it will initialize everything first
 | 
			
		||||
      load_on_setup = true,
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user