weirongxu / coc-explorer

📁 Explorer for coc.nvim
MIT License
1.14k stars 45 forks source link

How to cd into dir of file under cursor? #452

Closed uwla closed 3 years ago

uwla commented 3 years ago

I tried the following setting in global mappings:

    "l": [
      "expandable?",
      ["expanded?", "cd", "expand"],
      ["expandablePrev", "cd"]
    ],

When pressing l, if it is a folder, it should expand it if closed or cd to it if opened. If it is a file, it should cd into its parent directory

weirongxu commented 3 years ago
"l": [
  "expandable?",
  ["expanded?", "cd", "expand"],
  ["collapse", "cd"]
],
uwla commented 3 years ago
"l": [
  "expandable?",
  ["expanded?", "cd", "expand"],
  ["collapse", "cd"]
],

I have tried but it did not work. It colapses the parent folder but does not cd into it. I guess the actions, including the cd, are applied to the file/dir under cursor when the keybinding was pressed and If the keybinding changed the current file/dir under cursor, the actions does not take effect on the new file/dir under cursor (but take effect on the file/dir when the keybinding was pressed, not after that)