gerw / vim-latex-suite

71 stars 16 forks source link

Using SnipMate along side the Vim-Latex-Suite #15

Closed llinfeng closed 9 years ago

llinfeng commented 9 years ago

Hi @gerw,

I am a heavy user of latex and I like all the shortcuts and abbreviations made possible by the Suite.

However, the suite seems to be too overwhelming in terms of occupying the key-bundling.

I use SnipMate for all my other programming languages, but I just cannot tune it to work for tex files.

Do you have any idea? Maybe, I only need key to be "released" from being occupied by Vim-Latex-Suite.

Thank you in advance.

-Linfeng

gerw commented 9 years ago

I do not understand your problem. Do you think latex-suite uses to many key-bindings? Do you have some specific key-bindings in mind?

llinfeng commented 9 years ago

Hi @gerw, I've fixed the problem, well some how. The specific key binding I had in mind was the key.

Currently, pressing the tab key is giving me two spaces, which is as expected since I've had the following setting in my _vimrc:

" Use spaces instead of tabs
set expandtab

" 1 tab == 2 spaces
set shiftwidth=2
set tabstop=2
set softtabstop=2
set shiftround

The good thing is, when I turned off the expendtab setting, I restored the freedom to use Snipmate, which triggers its default action (expending a prefix to chunks of pre-set strings). I think I might have been too luck to catch this simply walk-around. :)

What confused me is that: my expendtab is a global setting, which applies to all my other file types. In spirit of a controlled experiment, my guess is that the Vim-Latex-Suite may have a mysterious trigger that gave raise to the problem.

Life is still good. I can turn off the expendtab for .tex files specifically for now.

Thank you.

llinfeng commented 9 years ago

It turns out that the "motion" of tab key is more complicated.

There is not a setting that could help me keep using the key as a trigger for snipmate. It is wired that I have to do the following each time I close and re-open Vim.

  1. Leave set expandtab alive in _vimrc
  2. Open a new session of Vim
  3. Open tex file
  4. Edit _vimrc by commenting out set expandtab
  5. Go back to tex file and press <tab> after begin. Boom.

There is no walk-around based on my experiences of playing around with the settings. The following attempts for automating the process all failed:

Attempt 1: comment out set expandtab in _vimrc Attempt 2: leave expandtab and use auto command to implement setlocal expandtab for FileType tex.

au FileType tex setlocal noexpand

Attempt 3: open _vimrc first and comment out the set expandtab, and then open tex files.

@gerw, do you have a knowledge of how to automate the "enabling of tab key"?

Thank you

gerw commented 9 years ago

I still do not have any clue what you are talking about.

llinfeng commented 9 years ago

Simply put it: I have trouble using Snipmate, when working in tex environment with Vim-Latex-Suite installed. There is basically no way to recover the functionality of Snipmate unless I follow the 5-steps method mentioned above.

Snipmate is triggered by <tab> key.

gerw commented 9 years ago

I have just installed snipMate and everything works fine for me.

Moreover, there should be no need to use snipmate and the latex-suite, since latex-suite already offers completions for all the tex stuff, see http://vim-latex.sourceforge.net/documentation/latex-suite/latex-completion.html.

Therefore, I close this issue.

llinfeng commented 9 years ago

I will not reopen this issue, but here goes my opinion:

let g:Tex_Env_sjlog="\\begin{stlog}\<CR>\\input{../../../tex/sj_files/<++>}\<CR>\\end{stlog}"

Counting \<CR> does confuse me all the time.

snippet sjlog
    \begin{stlog}
        \input{../../../tex/sj_files/${1:}}
    \end{stlog}

Lastly, I found what went wrong with my Vim. I should have implemented mappings of <tab> through imap in tex.vim located in ~/vimfiles/ftplugin. I apologize for bringing up this issue, but the comparison should be useful.

PS: I found that, if one go through the 5-step procedure above, he will effectively disable the mappings defined in ~/vimfiles/ftplugin/tex.vim. Any idea on why this should happen? @gerw