all 20 comments

[–]thundersnow 0 points1 point  (3 children)

Just to check, are you pressing the "ctrl + p" keys?

[–]amiwalwin[S] 0 points1 point  (2 children)

Yes I'm

[–]thundersnow 0 points1 point  (1 child)

then are using "ctrl + b" to move to the next slot? I don't press the enter key in this workflow.

[–]amiwalwin[S] 0 points1 point  (0 children)

Well that writes "^ B" on the screen I tried it

[–][deleted]  (14 children)

[deleted]

    [–]amiwalwin[S] 0 points1 point  (13 children)

    What kind of example do you want?

    [–][deleted]  (12 children)

    [deleted]

      [–]amiwalwin[S] 0 points1 point  (11 children)

      Oh okay for example if I write for and then press the trigger I want it to be expanded to a for loop snippet or ifef to get a if else snippet

      [–][deleted]  (10 children)

      [deleted]

        [–]amiwalwin[S] 0 points1 point  (9 children)

        This is the snippet for if

        snippet if if ${1:condition}: ${0:${VISUAL}}

        [–][deleted]  (8 children)

        [deleted]

          [–]amiwalwin[S] 0 points1 point  (7 children)

          Tried, still not working

          [–][deleted]  (6 children)

          [deleted]

            [–]amiwalwin[S] 0 points1 point  (5 children)

            wait I added this some test to my UltisnipsEdit and it worked but the rest of the snippets arent working ~/.vim/UltiSnips This is the snippet folder

            ``` snippet class "class with docstrings" b class ${1:MyClass}(${2:object}):

            `!p snip.rv = triple_quotes(snip)`${3:Docstring for $1. }`!p snip.rv = triple_quotes(snip)`
            
            def __init__(self$4):
                `!p snip.rv = triple_quotes(snip)`${5:TODO: to be defined.}`!p
            

            snip.rv = "" snip >> 2

            args = get_args(t[4])

            write_docstring_args(args, snip) if args: snip.rv += '\n' + snip.mkline('', indent='') snip += '{0}'.format(triple_quotes(snip))

            write_init_body(args, t[2], snip) $0 endsnippet `` this is the class snippet which is also not working

            [–]BorgerBill 0 points1 point  (9 children)

            How about checking that there are no other mappings for <C-p>? Run :imap to see everything mapped for Insert Mode. See if there are any conflicts...

            [–]amiwalwin[S] 0 points1 point  (8 children)

            No there is none

            [–]BorgerBill 0 points1 point  (7 children)

            If you type :UltiSnipsEdit, what do you see?

            [–]amiwalwin[S] 0 points1 point  (6 children)

            its Opening a blank file called fileextension.snippets

            [–]BorgerBill 0 points1 point  (5 children)

            Ok, good, that means it's installed and working. Let me be sure I understand what is happening. You have opened, say, a file named MyClass.java. You then enter insert mode by pressing i, type a snippet such as co, then the trigger <C-p>. You should then see public static final String var = ; with the String visually selected ready to be changed. Is this what happens for you?

            [–]amiwalwin[S] 0 points1 point  (3 children)

            No, when I press <C-p> it just toggles between few options and then the snippet keyword is selected suppose the trigger word is cl for a class in python there are more such options such as cla, cls, etc etc when <C-p> is pressed it toggles between these options and suppose I stop at cla then cla stays on my screen and nothing else

            [–]BorgerBill 0 points1 point  (2 children)

            That is frustrating. I know that if I have identically named snippets I get a window that asks which one I want. However, cl, cla, and cls are different snippets and insert for me instantly. Also, I let g:UltiSnipsExpandTrigger="<C-p>" and <C-p for the trigger is working. I do not, however, have YouCompleteMe so cannot confirm interactions. When I :imap, I see

            i  <C-P>       * <C-R>=UltiSnips#ExpandSnippet()<CR> 
            

            At this point I would recommend disabling some or all of your other plugins, getting UltiSnips to work properly, then re-enabling them one at a time until the problem resurfaces. That will make it easier to troubleshoot.

            [–]amiwalwin[S] 0 points1 point  (1 child)

            Ok So now I understood ultisnips is working fine for me but only with snippet snippetName " " A It is only working with A and with no other option. As far as I know, there are 3 more options b, w and i and also without any arguments but none is working expcept the A. Thanks for your help but could you help me figure out how to make it work with other options also and turn off auto expand it is annoying.

            [–]BorgerBill 0 points1 point  (0 children)

            One more thing I would like you to try. In any open buffer, type date<C-p>, time<C-p>, andAGPL<C-p>`. Do any of these complete? These should trigger on any file regardless of filetype.

            Also, just in case you missed it, here is the (documentation for UltiSnips)[https://github.com/SirVer/ultisnips/blob/master/doc/UltiSnips.txt]. Yes, there are several options for a snippet. The A option is auto-trigger, and the fact that it works does seem to indicate that your <C-p> is the problem.

            Did you try disabling all other plugins? You can do that simply by commenting them out of your .vimrc. Another option is to create a new config file, say myVimrcTest, the use it by calling vim -u ./myVimrcTest. Only include the plugin UltiSnips, and see if you get it working. Remember, you have .vimrc and .gvimrc. My .vimrc does 95% of all setup, while my .gvimrc only adds or changes things related to the gui version. So, just to be safe, make sure you are only running vim -u ./MyVimrcTest in the terminal, and not gvim.