Ultisnips: Tab triggering not working

Created on 11 Sep 2017  路  4Comments  路  Source: SirVer/ultisnips

Hello,

I apologize in advance if this is a trivial issue. I have been trying to fix this for hours but I am a new user and not very good at this.
I have set my snippets but nothing happens when I type the trigger word and press tab. I have tried googling possible fixes and made changes to my .vimrc accordingly but nothing has seemed to work so far. Not sure what to do. Any help would be greatly appreciated.

Thank you
I have copied my .vimrc here

set nocompatible              
filetype off                  

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
" call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo

Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
" Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'}
" Track the engine.

Plugin 'lervag/vimtex'

Plugin 'SirVer/ultisnips'

" Snippets are separated from the engine. Add this if you want them:
Plugin 'honza/vim-snippets'

" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
let g:ycm_key_list_previous_completion=['<Up>']
let g:UltiSnipsExpandTrigger="<c-e>"
let g:UltiSnipsListSnippets="<c-l>"
set rtp+=~/project/dotfiles/.vim  
"...
let g:UltiSnipsSnippetsDir = "~/project/dotfiles/.vim/snips"
let g:UltiSnipsSnippetDirectories=["UltiSnips", "snips"]
let g:UltiSnipsEditSplit= "context"

" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"

filetype off
filetype on

" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

" All of your Plugins must be added before the following line
call vundle#end()

filetype plugin indent on   
" To ignore plugin indent changes, instead use:
"filetype plugin on
syntax on


source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

set diffexpr=MyDiff()
function MyDiff()
  let opt = '-a --binary '
  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  let arg1 = v:fname_in
  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  let arg2 = v:fname_new
  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  let arg3 = v:fname_out
  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  if $VIMRUNTIME =~ ' '
    if &sh =~ '\<cmd'
      if empty(&shellxquote)
        let l:shxq_sav = ''
        set shellxquote&
      endif
      let cmd = '"' . $VIMRUNTIME . '\diff"'
    else
      let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
    endif
  else
    let cmd = $VIMRUNTIME . '\diff'
  endif
  silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
  if exists('l:shxq_sav')
    let &shellxquote=l:shxq_sav
  endif
endfunction

"Personal Settings.
"More to be added soon.
execute pathogen#infect()
filetype plugin indent on
set background=dark
colorscheme solarized
pending feedback

Most helpful comment

Your problem is here:

~
let g:UltiSnipsSnippetsDir = "~/project/dotfiles/.vim/snips"
let g:UltiSnipsSnippetDirectories=["UltiSnips", "snips"]
~

The first line tells :UltiSnipsEdit to open files in ~/project/dotfiles/.vim/snips (which should better be written as $HOME . "/project/dotfiles/.vim/snips". The second line tells the engine to look for snippets in all directories in your runtimepath and there in directories called UltiSnips and snips.

Your problem is that ~/project/dotfiles/.vim is likely not in your rtp. Try deleting the line about g:UltiSnipsSnippetsDir and change the other to:

let g:UltiSnipsSnippetDirectories=[$HOME . "/project/dotfiles/.vim/snips"]

Also read up in the documentation about these two variables (:help UltiSnips-snippet-search-path).

All 4 comments

It seems you have another let g:UltiSnipsExpandTrigger="<c-e> in there?

I added that after reading some other threads about having this issue. Removing it does not work, and adding it did nothing.

Can you please provide a docker repo for investigation? See CONTRIBUTING.md#reproducing-bugs

Your problem is here:

~
let g:UltiSnipsSnippetsDir = "~/project/dotfiles/.vim/snips"
let g:UltiSnipsSnippetDirectories=["UltiSnips", "snips"]
~

The first line tells :UltiSnipsEdit to open files in ~/project/dotfiles/.vim/snips (which should better be written as $HOME . "/project/dotfiles/.vim/snips". The second line tells the engine to look for snippets in all directories in your runtimepath and there in directories called UltiSnips and snips.

Your problem is that ~/project/dotfiles/.vim is likely not in your rtp. Try deleting the line about g:UltiSnipsSnippetsDir and change the other to:

let g:UltiSnipsSnippetDirectories=[$HOME . "/project/dotfiles/.vim/snips"]

Also read up in the documentation about these two variables (:help UltiSnips-snippet-search-path).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

carlitux picture carlitux  路  3Comments

jonathf picture jonathf  路  6Comments

chrisrytting picture chrisrytting  路  7Comments

codybuell picture codybuell  路  4Comments

PratikBhusal picture PratikBhusal  路  3Comments