krisajenkins / evil-tabs

Integrating Vim-style tabs for Evil mode users.
MIT License
66 stars 11 forks source link

Full path needed for `tabe`, relative path does not work #13

Open peterhadlaw opened 9 years ago

peterhadlaw commented 9 years ago

Evil tabs auto completes relative file paths properly but when you try opening a file using a relative path, emacs opens the file relative to the home dir. Maybe my config is wrong but I tried disabling everything but evil tabs and same issue.

karepker commented 8 years ago

I also ran into this issue, and I think I found the culprit and a solution.

elscreen-create does not respect Evil's default directory, so when evil-tabs calls elscreen-create then find-file, find-file opens the file relative to the wrong directory.

There are two solutions to this as far as I can tell.

  1. Make elscreen-create respect default-directory, so then find-file runs relative to the default directory of the buffer from which you run :tabe. I think this is unlikely, considering the elscreen repository hasn't been updated in about a year.
  2. Find a different implementation for :tabe. Turns out this is actually easy, because elscreen offers an elscreen-find-file command which appears correctly to open new buffers relative to default-directory. I've changed my local copy of evil-tabs to use this single call, i.e. replace the lines that call elscreen-create and find-file to just one line calling elscreen-find-file, and relative paths now work! I'll try and send a pull request when I can.