Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config file in a symlinked folder not properly recognized when calling UltiSnips Edit #1543

Open
ludovicschwartz opened this issue Nov 6, 2023 · 1 comment

Comments

@ludovicschwartz
Copy link

When the .snippets filed are stored in a symlinked folder, calling :UltiSnipsEdit returns the following error :
UltiSnips was not able to find a default directory for snippets. Do any of ['/home/user/.config/nvim', '/home/user/.vim'] exist AND contain any of the folders in g:UltiSnipsSnippetDirectories ? With default vim settings that would be: ~/.vim/UltiSnips Try :UltiSnipsEdit! instead of :UltiSnipsEdit.
The snippets themselves work just fine.

Expected behavior:
The symlinked file all.snippets (or the file corresponding to the type of document being edited) is opened by neovim

Actual behavior:
An error message appears

Steps to reproduce

  • Store the config of UltiSnips in /PathToConfig/UltiSnips/all.snippets
  • Create a symlink usingln -s /PathToConfig/UltiSnips ~/.config/nvim/UltiSnips
  • Launch Neovim
  • Run the :UltiSnipsEdit command

.config/nvim/init.vim :

"Vimplug plugins
call plug#begin()
Plug 'Sirver/ultisnips'
" Ultisnip configuration
let g:UltiSnipsExpandTrigger='<tab>'    " use Tab to expand snippets
let g:UltiSnipsJumpForwardTrigger='jk'    " use Tab to move forward through tabstops
let g:UltiSnipsJumpBackwardTrigger='<S-Tab>'  " use Shift-Tab to move backward through tabstops
let g:UltiSnipsSnippetDirectories=[$HOME.'/.config/nvim/UltiSnips',"UltiSnips"]
call plug#end()

  • Operating System: Ubuntu 20.04
  • Vim Version: NVIM 0.9.4
@ludovicschwartz
Copy link
Author

Upon further investigation, the error seems to be coming from this piece of code in snippet_manager.py :

has_storage_dir = (
            vim_helper.eval(
                "exists('g:UltiSnipsSnippetStorageDirectoryForUltiSnipsEdit')"
            )
            == "1"
        )

Indeed, doing a :echo exists('g:UltiSnipsSnippetStorageDirectoryForUltiSnipsEdit') returns 0.

Adding this line to the vim/nvim fixed the issue :
let g:UltiSnipsSnippetStorageDirectoryForUltiSnipsEdit=$HOME.'/.config/nvim/UltiSnips'

That being said, the behaviour changed when creating the symlink, and I still don't understand why it stopped working. I'll dig deeper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant