tom-anders / telescope-vim-bookmarks.nvim

Integrates vim-bookmarks into telescope.nvim
MIT License
114 stars 23 forks source link

Please add a default for "Telescope vim_bookmarks" #4

Closed 0x8000-0000 closed 3 years ago

0x8000-0000 commented 3 years ago

Please add a default option to "Telescope vim_bookmarks" and make it search starting from the current directory down, recursively.

Alternatively, make the default option configurable, with the most sensible options be:

I typically launch all my editor windows from the top of the tree so this would not make much of a difference to me, but maybe some users prefer to cd several layers deep.

Thank you!

tom-anders commented 3 years ago

For now, I changed the behavior so that :Telescope vim_bookmarks is equivalent to Telescope vim_bookmarks all.

I think the behavior you suggested of getting the bookmarks for the current directory or project root (via .git etc.) should be implemented in vim-bookmarks itself. @MattesGroeger what do you think?

MattesGroeger commented 3 years ago

Hey @tom-anders, thanks for all your work integrating vim-bookmarks with Telescope 🎉 👏

I have to admit that I'm quite out of the loop regarding the plugin as I have been absent for many years 😅 . From just quickly going through my own documentation I found this part which sounds like what you and @0x8000-0000 are looking for, no?

tom-anders commented 3 years ago

@MattesGroeger Yeah, I'd also say this looks like what we want. @0x8000-0000 If I understand this correctly, if you use this code snippet from the docu

" Finds the Git super-project directory.
function! g:BMWorkDirFileLocation()
    let filename = 'bookmarks'
    let location = ''
    if isdirectory('.git')
        " Current work dir is git's work tree
        let location = getcwd().'/.git'
    else
        " Look upwards (at parents) for a directory named '.git'
        let location = finddir('.git', '.;')
    endif
    if len(location) > 0
        return location.'/'.filename
    else
        return getcwd().'/.'.filename
    endif
endfunction

then :Telescope vim_bookmarks should do exactly what you want, i.e. only show you the bookmarks for the current project.

0x8000-0000 commented 3 years ago

@tom-anders - confirmed! It works great, thank you! (not sure why I cannot @MattesGroeger - but thank you Mattes, as well!)