ddrscott / vim-side-search

Search context in Vim in a sidebar using `rg` output
http://ddrscott.github.io/blog/2016/side-search/
MIT License
79 stars 6 forks source link

SideSearch(): if cmd is called with a path at the end, convert it to absolute path #17

Closed jakutis closed 2 years ago

jakutis commented 2 years ago

This fixes use case, when for example user specifies a relative path as the last argument to :SideSearch and then navigates from one file to another while his Vim config changes current Vim dir on every file/buffer opening/selection, for example with this config:

set autochdir
autocmd BufEnter * lcd %:p:h

Sorry for not noticing this in #16

ddrscott commented 2 years ago

The nested if statements are breaking my brain. I'll trust that it works, but for the sake of my 2 remaining brain cells, I'd like to get the logic cleaned up a bit. It's probably time to add some tests 😊

I'll try to play with the code again this weekend and see if I can get some tests in place to help explain what's going on.

jakutis commented 2 years ago

The nested if statements are breaking my brain. I'll trust that it works, but for the sake of my 2 remaining brain cells, I'd like to get the logic cleaned up a bit. It's probably time to add some tests blush

I'll try to play with the code again this weekend and see if I can get some tests in place to help explain what's going on.

Yes, the cleanup was low-hanging, pushed it..

ddrscott commented 2 years ago

Brain un-broken. Thanks for the update!