definition: better sub filename
This commit is contained in:
parent
31017128cb
commit
979079b21b
|
@ -121,6 +121,10 @@ function def:create_win(bufnr, root_dir)
|
|||
if util.ismac and (vim.bo[bufnr].filetype == 'c' or vim.bo[bufnr].filetype == 'cpp') then
|
||||
fname = util.sub_mac_c_header(fname)
|
||||
end
|
||||
if vim.bo[bufnr].filetype == 'rust' then
|
||||
fname = util.sub_rust_toolchains(fname)
|
||||
end
|
||||
|
||||
if not self.list or vim.tbl_isempty(self.list) then
|
||||
local float_opt = {
|
||||
width = math.floor(api.nvim_win_get_width(0) * config.definition.width),
|
||||
|
|
|
@ -235,4 +235,12 @@ function M.get_bold_num()
|
|||
return num
|
||||
end
|
||||
|
||||
function M.sub_rust_toolchains(fname)
|
||||
local rustup_home = os.getenv('RUSTUP_HOME') or vim.fs.joinpath(vim.env.HOME, '.rustup')
|
||||
local toolchains = vim.fs.joinpath(rustup_home, 'toolchains')
|
||||
local parts = vim.split(fname, M.path_sep, { trimempty = true })
|
||||
local count = #vim.split(toolchains, M.path_sep, { trimempty = true })
|
||||
return vim.fs.joinpath(unpack(parts, count + 1))
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
Loading…
Reference in New Issue