TheBlob42 / drex.nvim

Another directory/file explorer for Neovim written in Lua
GNU General Public License v3.0
96 stars 8 forks source link

DrexDrawerFindFileAndFocus throws error when in empty buffer #46

Open minusf opened 1 week ago

minusf commented 1 week ago

I'd like to keep just a single shortcut to open the files drawer, whether there is a file in the buffer or not... If there is no file in the buffer, the drawer could just show the current folder. Currently and unhandled error is thrown, and the current folder shown :D

Error executing Lua callback: The given path '/some/path/src/django/www/' is equal to the buffers root path!
stack traceback:
        [C]: in function 'error'
        ...local/share/nvim/plugged/drex.nvim/lua/drex/elements.lua:25: in function 'expand_path'
        ...local/share/nvim/plugged/drex.nvim/lua/drex/elements.lua:302: in function 'focus_element'
        .../.local/share/nvim/plugged/drex.nvim/lua/drex/drawer.lua:152: in function 'find_element'
        ...op/.local/share/nvim/plugged/drex.nvim/plugin/drex.lua:51: in function <...op/.local/share/nvim/plugged/drex.nvim/plugin/drex.lua:50>
TheBlob42 commented 1 week ago

Good catch :thinking: I will have a look into this