1

Last week I reinstalled Ubuntu 18.04 LTS on my laptop. During my last installation of ubuntu (also 18.04) I learned vim and used it in combination with the latex-suite. However on this new installation the <alt-I> function does not work.

The <alt> key works fine, for example with <alt-L> and <alt-C>, but when I use <alt-I> I get é in both gVim and vi in the gnome terminal.

I reused a part of my .vimrc of my previous installation. From what I understood, this is the part that handles the alt-key mapping:

   let c='a'
   while c <= 'z'
     exec "set <A-".c.">=\e".c
     exec "imap \e".c." <A-".c.">"
     let c = nr2char(1+char2nr(c))
   endw

   set timeout ttimeoutlen=50

(I think that I found this here: https://tex.stackexchange.com/questions/130389/vim-latex-suite-alt-macro-not-working but I am not sure since this is from my old .vimrc file, from my old installation.)

Because the alt-key works (for the other key combinations), I expect that it is some other setting.

Vim-latex is installed using Vundle. I tried to put this line:let g:Tex_AdvancedMath = 1 in ~/.vim/bundle/LaTeX-Suite-aka-Vim-LaTeX/ftplugin/tex_latexSuite.vim. I tried both methods:

" LaTeX filetype
"     Language: LaTeX (ft=tex)
"   Maintainer: Srinath Avadhanula
"        Email: srinath@fastmail.fm

if !exists('s:initLatexSuite')
    let s:initLatexSuite = 1
    exec 'so '.expand('<sfile>:p:h').'/latex-suite/main.vim'
    let g:Tex_AdvancedMath = 1
    silent! do LatexSuite User LatexSuiteInitPost
endif

silent! do LatexSuite User LatexSuiteFileType

and:

" LaTeX filetype
"     Language: LaTeX (ft=tex)
"   Maintainer: Srinath Avadhanula
"        Email: srinath@fastmail.fm

if !exists('s:initLatexSuite')
    let s:initLatexSuite = 1
    exec 'so '.expand('<sfile>:p:h').'/latex-suite/main.vim'

    silent! do LatexSuite User LatexSuiteInitPost
endif

silent! do LatexSuite User LatexSuiteFileType
let g:Tex_AdvancedMath = 1

(The difference between both methods is that either the let g:Tex_AdvancedMath = 1 is inside or outside the if statement).

Nothing worked so far. I did not had any trouble with the <alt>-key, like that it is linked to the menu in GVim for example.

To be complete, this is my .vimrc file:

set nocompatible              " be iMproved, required
filetype off                  " required

" 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'

Plugin 'LaTeX-Suite-aka-Vim-LaTeX'
Plugin 'junegunn/goyo.vim' 
Plugin 'junegunn/limelight.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'scrooloose/nerdtree'

Plugin 'tmhedberg/SimpylFold' "fold
Plugin 'vim-syntastic/syntastic'


" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required

set relativenumber
syntax on
set showmatch
set ruler
set smarttab
set shiftwidth=4
set tabstop=4

set expandtab

set grepprg=grep\ -nH\ $*
filetype indent on
let g:tex_flavor='latex'
let g:Tex_DefaultTargetFormat='pdf'
map <f2> :w<cr><leader>ll
"set spell spelllang=en_us
set spell spelllang=en

let c='a'
while c <= 'z'
  exec "set <A-".c.">=\e".c
  exec "imap \e".c." <A-".c.">"
  let c = nr2char(1+char2nr(c))
endw

set timeout ttimeoutlen=50

" Use a blinking upright bar cursor in Insert mode, a blinking block in normal
if &term == 'xterm-256color' || &term == 'screen-256color'
    let &t_SI = "\<Esc>[5 q"
    let &t_EI = "\<Esc>[1 q"
endif

if exists('$TMUX')
    let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
    let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
endif

edit

I disabled my .vimrc, by renaming .vimrc.vimrc_backup. Now the plugins are disabled, but I é is still the result from clicking <alt-i> in GVim, but not in the terminal.

2
  • <alt-i> and é are the same thing for gvim (I can't tell for Vim as I've given up on it because of alt key). There is an old issue in vim-latex where French users cannot properly type é. Because of that, there is a FAQ entry in vim-latex that explains how to avoid mapping <alt-i>. Could it be that the trick is activated in your configuration, or that may be vim-latex finally gave up on alt-i? vim-latex.sourceforge.net/faq.shtml#faq-e-acute Mar 6, 2019 at 0:08
  • Thank you for your answer. First I wanted to mention that this happens only in vim, not in another editor/terminal/browser. But I looked at your answer and now I tried to map <alt-i> to tex_InsertItemOnThisLine. This worked, but now that text is shown when I used <alt-i>, and I expect that some function should be called? Another problem is that most guides talk about tex.vim file, but I do not have that file. Is it possible that a Vundle installation is not the correct way to install the latex-suite? Mar 6, 2019 at 8:06

1 Answer 1

0

What worked for me was to remove the plugin from Vundle and manually add all the files in my .vim folder (as described here).

Then I added the line imap <buffer> <m-i> <Plug>Tex_InsertItemOnThisLine in ~/.vim/ftplugin/tex_latexSuite.vim. Now <alt-i> inserted an item, instead of the text Tex_InsertItemOnThisLine. So I think there was a problem with the combination of Vundle and the latex-suite.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.