Skip to content

feat: option to set path destination to parent folder when cursor is on a closed folder while creating files #628

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

Merged
merged 6 commits into from
Sep 26, 2021

Conversation

booperlv
Copy link
Contributor

a more thorough description of the feature in #622
Seems like this is the first instance of an option for the fs.lua module, so I decided to go with directly adding the variable there.
This was the only name I could think of that made sense, but I'm not sure if it makes enough sense, so please do help me think of a better name if so.

Please do tell me if there's anything that I should change! Thanks :)

@booperlv booperlv changed the title feat: option to set path destination to parent folder when cursor is on a closed folder feat: option to set path destination to parent folder when cursor is on a closed folder while creating files Sep 18, 2021
@CKolkey
Copy link
Contributor

CKolkey commented Sep 21, 2021

I've had something similar in a fork for a while:

  local add_into
  if node.entries ~= nil and node.open then
    add_into = utils.path_add_trailing(node.absolute_path)
  else
    add_into = node.absolute_path:sub(0, -(#node.name + 1))
  end

@booperlv
Copy link
Contributor Author

I've had something similar in a fork for a while:

  local add_into
  if node.entries ~= nil and node.open then
    add_into = utils.path_add_trailing(node.absolute_path)
  else
    add_into = node.absolute_path:sub(0, -(#node.name + 1))
  end

This does seem like a more robust solution! I'll change it accordingly :)

@booperlv booperlv requested a review from kyazdani42 September 26, 2021 03:29
@kyazdani42 kyazdani42 merged commit 2a5d529 into nvim-tree:master Sep 26, 2021
jim-fx pushed a commit to jim-fx/nvim-tree.lua that referenced this pull request Sep 28, 2021
Almo7aya pushed a commit to Almo7aya/nvim-tree.lua that referenced this pull request Oct 11, 2022
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

Successfully merging this pull request may close these issues.

3 participants