refactor(utils): clean out inappropriate methods
This commit is contained in:
parent
a6b5dd1584
commit
d9c294e814
6 changed files with 21 additions and 20 deletions
|
@ -10,7 +10,7 @@ local plugins = {
|
|||
requires = { 'kyazdani42/nvim-web-devicons' },
|
||||
},
|
||||
},
|
||||
disable = { -- disabling some plugins may mean you'll have to remap some keybindings
|
||||
disable = { -- disabling some core plugins may mean you'll have to remap some keybindings
|
||||
'auto-session',
|
||||
'colorizer',
|
||||
'fugitive',
|
||||
|
|
|
@ -31,6 +31,20 @@ local get_mode = function()
|
|||
end
|
||||
end
|
||||
|
||||
local function get_basename(file)
|
||||
return file:match('^.+/(.+)$')
|
||||
end
|
||||
|
||||
local function get_git_root()
|
||||
local git_dir = require('galaxyline.providers.vcs').get_git_dir()
|
||||
if not git_dir then
|
||||
return 'not a git dir '
|
||||
end
|
||||
|
||||
local git_root = git_dir:gsub('/.git/?$', '')
|
||||
return get_basename(git_root) .. ' '
|
||||
end
|
||||
|
||||
local check_width_and_git_and_buffer = function()
|
||||
return condition.check_git_workspace() and condition.buffer_not_empty()
|
||||
end
|
||||
|
@ -337,7 +351,7 @@ gls.right = {
|
|||
},
|
||||
{
|
||||
GitRoot = {
|
||||
provider = utils.get_git_root,
|
||||
provider = get_git_root,
|
||||
condition = check_buffer_and_width,
|
||||
icon = ' ' .. icons.file .. ' ',
|
||||
highlight = 'GalaxyViModeInv',
|
||||
|
@ -434,7 +448,7 @@ gls.short_line_right = {
|
|||
},
|
||||
{
|
||||
GitRootShort = {
|
||||
provider = utils.get_git_root,
|
||||
provider = get_git_root,
|
||||
condition = condition.buffer_not_empty,
|
||||
icon = ' ' .. icons.file .. ' ',
|
||||
highlight = { colors.bg, colors.white },
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local colors = require('cosmic.core.theme.colors')
|
||||
local highlight = require('cosmic.utils').highlight
|
||||
local g = vim.g
|
||||
local title = vim.env.SHELL
|
||||
|
||||
|
@ -7,4 +5,3 @@ g.floaterm_width = 0.7
|
|||
g.floaterm_height = 0.8
|
||||
g.floaterm_title = '[' .. title .. ']:($1/$2)'
|
||||
g.floaterm_opener = 'vsplit'
|
||||
highlight('FloatermBorder', 'None', colors.floatBorder)
|
||||
|
|
|
@ -51,6 +51,9 @@ highlight('NotifyTRACEBorder', nil, colors.trace)
|
|||
highlight('NotifyTRACETitle', nil, colors.trace)
|
||||
highlight('NotifyTRACEIcon', nil, colors.trace)
|
||||
|
||||
-- terminal highlight
|
||||
highlight('FloatermBorder', 'None', colors.floatBorder)
|
||||
|
||||
vim.cmd([[
|
||||
highlight clear NormalFloat
|
||||
highlight link NormalFloat Normal
|
||||
|
|
|
@ -62,6 +62,7 @@ return packer.startup(function()
|
|||
vim.g.tokyonight_sidebars = { 'qf', 'packer' }
|
||||
vim.cmd('color tokyonight')
|
||||
end,
|
||||
-- disable = vim.tbl_contains(user_plugins.disable, 'theme'),
|
||||
})
|
||||
|
||||
use({ -- icons
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
local M = {}
|
||||
|
||||
local function get_basename(file)
|
||||
return file:match('^.+/(.+)$')
|
||||
end
|
||||
|
||||
function M.map(mode, lhs, rhs, opts)
|
||||
local options = { noremap = true }
|
||||
if opts then
|
||||
|
@ -12,16 +8,6 @@ function M.map(mode, lhs, rhs, opts)
|
|||
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||
end
|
||||
|
||||
function M.get_git_root()
|
||||
local git_dir = require('galaxyline.providers.vcs').get_git_dir()
|
||||
if not git_dir then
|
||||
return 'not a git dir '
|
||||
end
|
||||
|
||||
local git_root = git_dir:gsub('/.git/?$', '')
|
||||
return get_basename(git_root) .. ' '
|
||||
end
|
||||
|
||||
function M.split(str, sep)
|
||||
local res = {}
|
||||
for w in str:gmatch('([^' .. sep .. ']*)') do
|
||||
|
|
Loading…
Add table
Reference in a new issue