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

UltiSnips does not handle some symlinks correctly? #1483

Open
MaximLeyenson opened this issue Aug 23, 2022 · 1 comment
Open

UltiSnips does not handle some symlinks correctly? #1483

MaximLeyenson opened this issue Aug 23, 2022 · 1 comment

Comments

@MaximLeyenson
Copy link

Expected behavior:

I keep my configuration files on GitLab, and sync across systems. Thus I have a

/home/my_username/island/dot-files/vim/UltiSnips/

folder, which contains

tex.snippets  
text.snippets
...

if I symlink this folder into ~/.vim/,

 $ file ~/.vim/UltiSnips 

 /home/my_username/.vim/UltiSnips: symbolic link to /home/my_username/island/dot-files/vim/UltiSnips 

it is not processed correctly.

Actual behavior:

$ vim /tmp/a.txt
:UltiSnipsEdit

I get

UltiSnips was not able to find a default directory for snippets. Do you have a .vim directory? Try :UltiSnipsEdit! instead of :UltiSnipsEdit.

Workaround I found

if I create a regular folder

    /home/my_username/.vim/UltiSnips/

and symlink files

tex.snippets, text.snippets, ...

there,

then everythng works as expected.

Steps to reproduce

  1. Create a folder Ultisnips somewhere with some custom snippets.
  2. $ ln -sf Ultisnips ~/.vim/Ultisnips

  • Operating System: Ubuntu 20.04.4 LTS
  • Vim Version: VIM - Vi IMproved 8.1 (2018 May 18, compiled Feb 01 2022 09:16:32)
    Included patches: 1-2269, 3612, 3625, 3669, 3741
  • UltiSnips Version: 1edcb40
  • Python inside Vim: 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
@halilim
Copy link

halilim commented Feb 24, 2023

Some workaround (assuming an installation with vim-plug - normally in .vim/plugged):

fun Snip(folder, cmd)
  if a:cmd == 'view'
    " https://github.com/honza/vim-snippets
    let prefix = 'plugged/vim-snippets/'
  else
    let prefix = ''
  endif

  exe a:cmd '~/.vim/' . prefix . a:folder . '/' . &filetype . '.snippets'
endf
command SnipViewUltiSnips call Snip('UltiSnips', 'view')
command SnipViewSnipMate call Snip('snippets', 'view')
command SnipEditUltiSnips call Snip('UltiSnips', 'edit')

nnoremap <Leader>,s :SnipEditUltiSnips<CR>

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

2 participants