feat: Prepare to switch away from LazyVim lib
This commit is contained in:
parent
fd62e8aa32
commit
1757b0b11f
3 changed files with 26 additions and 5 deletions
|
@ -5,6 +5,8 @@ vim.cmd.filetype('plugin', 'indent', 'on')
|
|||
---@diagnostic disable-next-line:missing-parameter
|
||||
vim.g.sqlite_clib_path = require('luv').os_getenv('LIBSQLITE')
|
||||
|
||||
_G.MarleyVim = require('lib')
|
||||
|
||||
require('options')
|
||||
require('keymaps')
|
||||
require('autocmds')
|
||||
|
|
22
nvim/lua/lib/init.lua
Normal file
22
nvim/lua/lib/init.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
---@class lib
|
||||
local M = {}
|
||||
|
||||
---Find the root of a project based on `vim.g.root_spec`. Defaults to
|
||||
---`{ '.git' }` if unset.
|
||||
---@return string?
|
||||
function M.root()
|
||||
local root_spec = vim.g.root_spec or { '.git' }
|
||||
|
||||
return vim.fs.root(0, root_spec)
|
||||
end
|
||||
|
||||
---Require a file relative to the given prefix, to avoid repetition.
|
||||
---@param prefix string The string to prefix to all req calls.
|
||||
function M.local_require(prefix)
|
||||
---@param mod string The module to require.
|
||||
return function(mod)
|
||||
return require(prefix .. '.' .. mod)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
|
@ -2,11 +2,8 @@ local g = vim.g
|
|||
local opt = vim.opt
|
||||
|
||||
-- Root dir detection options.
|
||||
-- Each entry can be:
|
||||
-- * the name of a detector function like `lsp` or `cwd`
|
||||
-- * a pattern or array of patterns like `.git` or `lua`
|
||||
-- * a function with signature `function(buf) -> string|string[]`
|
||||
g.root_spec = { 'lsp', { '.git', 'lua' }, 'cwd' }
|
||||
-- Each entry can be a pattern `.git` or `package.json`
|
||||
g.root_spec = { '.git', 'package.json' }
|
||||
|
||||
-- Only set clipboard if not in SSH, to make sure the OSC 52 integration works
|
||||
-- automatically. Requires Neovim >= 0.10.0.
|
||||
|
|
Loading…
Reference in a new issue