feat(utils): learning some plenary
This commit is contained in:
parent
f1230ee2c7
commit
7e3ce5094b
2 changed files with 23 additions and 32 deletions
|
@ -37,6 +37,23 @@ return packer.startup(function()
|
|||
end,
|
||||
})
|
||||
|
||||
use({ 'nvim-lua/plenary.nvim' })
|
||||
|
||||
use({ -- color scheme
|
||||
'folke/tokyonight.nvim',
|
||||
config = function()
|
||||
vim.g.tokyonight_style = 'night'
|
||||
vim.g.tokyonight_sidebars = { 'qf', 'packer' }
|
||||
vim.cmd('color tokyonight')
|
||||
end,
|
||||
disable = vim.tbl_contains(user_plugins.disable, 'theme'),
|
||||
})
|
||||
|
||||
use({ -- icons
|
||||
'kyazdani42/nvim-web-devicons',
|
||||
after = 'tokyonight.nvim',
|
||||
})
|
||||
|
||||
use({
|
||||
'rcarriga/nvim-notify',
|
||||
config = function()
|
||||
|
@ -56,21 +73,6 @@ return packer.startup(function()
|
|||
disable = vim.tbl_contains(user_plugins.disable, 'notify'),
|
||||
})
|
||||
|
||||
use({ -- color scheme
|
||||
'folke/tokyonight.nvim',
|
||||
config = function()
|
||||
vim.g.tokyonight_style = 'night'
|
||||
vim.g.tokyonight_sidebars = { 'qf', 'packer' }
|
||||
vim.cmd('color tokyonight')
|
||||
end,
|
||||
disable = vim.tbl_contains(user_plugins.disable, 'theme'),
|
||||
})
|
||||
|
||||
use({ -- icons
|
||||
'kyazdani42/nvim-web-devicons',
|
||||
after = 'tokyonight.nvim',
|
||||
})
|
||||
|
||||
-- theme stuff
|
||||
use({ -- statusline
|
||||
'NTBBloodbath/galaxyline.nvim',
|
||||
|
|
|
@ -28,23 +28,12 @@ function M.highlight(group, bg, fg, gui)
|
|||
end
|
||||
end
|
||||
|
||||
function M.get_relative_path(path)
|
||||
local split_path = M.split(path, '/')
|
||||
local split_cwd = M.split(vim.fn.getcwd(), '/')
|
||||
local curr_dir = split_cwd[#split_cwd]
|
||||
local nice_path = ''
|
||||
|
||||
local ok = false
|
||||
for _, dir in ipairs(split_path) do
|
||||
if dir == curr_dir then
|
||||
ok = true
|
||||
end
|
||||
if ok then
|
||||
nice_path = nice_path .. '/' .. dir
|
||||
end
|
||||
end
|
||||
|
||||
return '.' .. nice_path
|
||||
function M.get_relative_path(file_path)
|
||||
local plenary_path = require('plenary.path')
|
||||
local parsed_path, _ = file_path:gsub('file://', '')
|
||||
local path = plenary_path:new(parsed_path)
|
||||
local relative_path = path:make_relative(vim.fn.getcwd())
|
||||
return './' .. relative_path
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
Loading…
Add table
Reference in a new issue