Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suggestion: use relative path for statusline path #10

Open
matu3ba opened this issue Feb 13, 2023 · 2 comments
Open

suggestion: use relative path for statusline path #10

matu3ba opened this issue Feb 13, 2023 · 2 comments

Comments

@matu3ba
Copy link

matu3ba commented Feb 13, 2023

Trying to yank a few lines for the search count (I hate it being a separate wasted line), I got to your config.
I do also like your lsp progress and gitsigns solution, though I think I need to install something for this to work.
it just works (for me).

add_cmd('Frel', function() vim.fn.setreg('+', plenary.path:new(vim.api.nvim_buf_get_name(0)):make_relative()) end, {}) -- copy relative path
plenary.path handles gracefully uris, so oil:// etc path just work and dont need extra handling..

if you prefer checking against cwd (relative path resolving does this automatically and falls back to absolute one if not within cwd) you could use uv.cwd() like you use it elsewhere.
If you use alot harpoon, you might find a few handy things in my dotfiles.

This also makes several of your vim.fs.dirname superfluous. See also :h vim.fs

@matu3ba

This comment was marked as outdated.

@matu3ba
Copy link
Author

matu3ba commented Feb 14, 2023

my bad. This is needed to handle all relevant cases:

local function get_fileinfo()
  if vim.bo.buftype == "" then
    if vim.bo.readonly == true then
      return "ro"
    end
    if vim.bo.modified then
      return " +"
    else
      return "  "
    end
  elseif vim.bo.buftype == "acwrite" then
    return "ac"
  elseif vim.bo.buftype == "help" then
    return "he"
  elseif vim.bo.buftype == "nofile" then
    return "nf"
  elseif vim.bo.buftype == "nowrite" then
    return "nw"
  elseif vim.bo.buftype == "quickfix" then
    return "qf"
  elseif vim.bo.buftype == "terminal" then
    return "te"
  elseif vim.bo.buftype == "prompt" then
    return "pr"
  else
    return "  "
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant