garbas / vim-snipmate

snipMate.vim aims to be a concise vim script that implements some of TextMate's snippets features in Vim.
www.vim.org/scripts/script.php?script_id=2540
2.01k stars 181 forks source link

Multiline templates not working with vim 7.3 #213

Closed engelsanchez closed 7 years ago

engelsanchez commented 9 years ago

Hello there. I tried installing and using vim-snipmate today for the first time. It works fantastically on my Mac where I have vim 7.4 installed. On my Linux dev box I have less control over things and our company has 7.3 installed. Single line templates work as far as I can tell (default values, mirrors, tabbing back and forth), but multiline templates fail immediately. After the template text is inserted, the cursor ends up after the first tab stop and has left insert mode. I verified this using a C file and the tde (typedef) template from vim-snippets, a two line template:

typedef enum {
   /* data */<-- Cursor ends up right here, not in insert mode anymore
} foo;

I'd be happy to debug this further if you give me a way to print debug information in the script. I'm a vimscript n00b.

My .vimrc is very basic on this machine:

runtime bundle/vim-pathogen/autoload/pathogen.vim
execute pathogen#infect()

" NERDTree (smart directory browsing) configuration.
map <F8> :NERDTreeToggle<CR>

"autocmd BufEnter * if &modifiable | NERDTreeFind | wincmd p | endif

" Configure Tagbar, a code outline panel plugin.
nmap <F9> :TagbarToggle<CR>

syntax on
filetype plugin indent on
set laststatus=2
set number
set ignorecase
set incsearch
set expandtab
set tabstop=3
set shiftwidth=3
set textwidth=80
set colorcolumn=+1
set t_Co=256
highlight ColorColumn ctermbg=Cyan guibg=#2c2d27

set cino+=(0
set cino+=:0

And I have the following pathogen managed plugins:

ctrlp.vim
nerdtree
tagbar
tlib_vim
vim-addon-mw-utils
vim-pathogen
vim-snipmate
vim-snippets
ajzafar commented 9 years ago

@engelsanchez I have two questions: Which patchlevel of Vim 7.3 are you using (the Included patches line in Vim's version output)? And does this happen with both versions of the snippet parser (see g:snipMate.snippet_version in :h SnipMate-options)? I suspect that this is related to #203 and #206. Both involved problems with a regex used in the legacy parser. If that is the problem here and the newer version 1 snippet parser does work, I'm inclined to ask that you simply use the version 1 parser. Version 0 is legacy after all, and I don't want to be spending a lot of time trying to fix problems with it. Clearly I can't properly test this specific issue to find a proper solution anyway.

engelsanchez commented 9 years ago

@ajzafar: I had seen the parser version changes you made recently, and I had already tried both: it didn't work with either version unfortunately. I saw that you had worked recently on something related and had also tried reverting to c86c64508, but not the previous change before the fix to multiline. I should try that.

Vim version output is:

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Sep 28 2012 05:42:23)
Included patches: 1-29
ajzafar commented 9 years ago

@engelsanchez If this is happening with both versions, then this may not be related to the other issues at all, possibly even unrelated to the parsers. I'm unable to reproduce this with Vim 7.3.29 on my machine though, with both master and c86c645 and both snippet parser versions, so I'm going to need more information. Preferably let's try testing this only with version 1 of the parser. Once we find out what's going wrong, we can take a look at version 0 if it needs separate fixing.

ajzafar commented 7 years ago

Closing due to inactivity.