oppara / dotfiles

0 stars 0 forks source link

lualine newfile の対応 #10

Closed oppara closed 1 year ago

oppara commented 1 year ago

readonly, modified と同じ対応をする

oppara commented 1 year ago
local function is_new_file()
  local filename = vim.fn.expand('%')
  return filename ~= '' and vim.bo.buftype == '' and vim.fn.filereadable(filename) == 0
end

  if self.options.newfile_status and is_new_file() then
    table.insert(symbols, self.options.symbols.newfile)
  end
oppara commented 1 year ago

lua/lualine/components/filename.lua

local default_options = {
  symbols = {
    modified = '[+]',
    readonly = '[-]',
    unnamed = '[No Name]',
    newfile = '[New]',
  },
  file_status = true,
  newfile_status = false,
  path = 0,
  shorting_target = 40,
}
oppara commented 1 year ago

参考になる設定.
https://github.com/nvim-lualine/lualine.nvim/blob/master/examples/slanted-gaps.lua#L96-L113