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,
|
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({
|
use({
|
||||||
'rcarriga/nvim-notify',
|
'rcarriga/nvim-notify',
|
||||||
config = function()
|
config = function()
|
||||||
|
@ -56,21 +73,6 @@ return packer.startup(function()
|
||||||
disable = vim.tbl_contains(user_plugins.disable, 'notify'),
|
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
|
-- theme stuff
|
||||||
use({ -- statusline
|
use({ -- statusline
|
||||||
'NTBBloodbath/galaxyline.nvim',
|
'NTBBloodbath/galaxyline.nvim',
|
||||||
|
|
|
@ -28,23 +28,12 @@ function M.highlight(group, bg, fg, gui)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.get_relative_path(path)
|
function M.get_relative_path(file_path)
|
||||||
local split_path = M.split(path, '/')
|
local plenary_path = require('plenary.path')
|
||||||
local split_cwd = M.split(vim.fn.getcwd(), '/')
|
local parsed_path, _ = file_path:gsub('file://', '')
|
||||||
local curr_dir = split_cwd[#split_cwd]
|
local path = plenary_path:new(parsed_path)
|
||||||
local nice_path = ''
|
local relative_path = path:make_relative(vim.fn.getcwd())
|
||||||
|
return './' .. relative_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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
Loading…
Add table
Reference in a new issue