Search code examples
vimtex

Why a backtick disappears in TeX on Vim?


Backtick (`) in insert mode works strangely when I edit a TeX file on Vim. I am expecting that when I type `a Vim displays `a and when I type `b it displays `b, and so on. But, in fact, when I type `a it displays only a and when I type `b it displays only b. Furthermore, when I type, for example, `j it displays `j, as I expected. Some letters following a backtick will be displayed with a backtick (as I expect), and others without a backtick (strange behavior). Here is lists showing which letters follow a backtick and which letters replace a backtick.

following

// `j becomes `j

j o v B C H I J K M
N O R T V Z 1 2 3 4
5 7 9 ! @ # $ % ^ &
- _ + | ~ { } ; : '
" , / ?
Space(0x20)

replacing

// `a becomes a

a b c d e f g h i k
l m n p q r s t u w
x y z A D E F G L P
Q S U W X Y 6 8 0 *
( ) = \ ` [ ] . < >

This behavior appears only when I am editing a TeX file and in insert mode. In normal mode I do jump to the marked position, and on Markdown my Vim displays a certain number of backticks.

Why does it work in such a way and What should I do to have it work in a certain way?


  • macOS Sierra 10.12.3
  • Vim 8.0.57

my vimrc:

if 0 | endif

if has('vim_starting')
    if &compatible
        set nocompatible
    endif

    set runtimepath+=~/.vim/bundle/neobundle.vim/
endif

call neobundle#begin(expand('~/.vim/bundle/'))

NeoBundleFetch 'Shougo/neobundle.vim'

NeoBundle 'thinca/vim-quickrun'

NeoBundle 'Shougo/vimproc',{
            \'build' : {
            \  'windows' : 'make -f make_mingw32.mak',
            \  'cygwin' : 'make -f make_cygwin.mak',
            \  'mac' : 'make -f make_mac.mak',
            \  'unix' : 'make -f make_unix.mak',
            \  },
            \ }

NeoBundle 'Shougo/unite.vim'

NeoBundle 'osyo-manga/unite-quickfix'

NeoBundle 'osyo-manga/shabadou.vim'

NeoBundle 'lervag/vimtex'

NeoBundle 'Shougo/neosnippet'

NeoBundle 'Shougo/neocomplete'

NeoBundle 'Shougo/neosnippet-snippets'

NeoBundle 'nelstrom/vim-visual-star-search'

NeoBundle 'tpope/vim-fugitive'

NeoBundle 'vim-ruby/vim-ruby'

NeoBundle 'tpope/vim-endwise'

NeoBundle 'plasticboy/vim-markdown'

NeoBundle 'kannokanno/previm'

NeoBundle 'tyru/open-browser.vim'

NeoBundle 'derekwyatt/vim-scala'

NeoBundle 'scrooloose/nerdtree'

call neobundle#end()

filetype plugin indent on


NeoBundleCheck

syntax on


set spelllang=en,cjk
set spell

set expandtab
set shiftwidth=2
set softtabstop=2
set autoindent
set smartindent

set pumheight=10

set showmatch
set matchtime=1

set wrap

set ignorecase
set smartcase

set scrolloff=3
set ruler
set display=lastline

set cole=0

set backspace=indent,eol,start

au FileType * setl cole=0

nnoremap j gj
nnoremap k gk
nnoremap <Down> gj
nnoremap <Up> gk

nnoremap gj j
nnoremap gk k

nnoremap <silent><C-l> <C-w>l
nnoremap <silent><C-h> <C-w>h
nnoremap <silent><C-k> <C-w>k
nnoremap <silent><C-j> <C-w>j
nnoremap <silent><C-e> :NERDTreeToggle<CR>

nnoremap <Space>h ^
nnoremap <Space>l $

inoremap <C-j> <BS>
cnoremap <C-j> <BS>

imap <C-k>  <Plug>(neosnippet_expand_or_jump)
smap <C-k>  <Plug>(neosnippet_expand_or_jump)
xmap <C-k>  <Plug>(neosnippet_expand_target)

imap <expr><TAB> neosnippet#expandable_or_jumpable() ?
            \ "\<Plug>(neosnippet_expand_or_jump)"
            \: pumvisible() ? "\<C-n>" : "\<TAB>"

smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
            \ "\<Plug>(neosnippet_expand_or_jump)"
            \: "\<TAB>"


let g:tex_conceal = ''

let g:quickrun_config = {
            \ 'split' : '',
            \ 'runner' : 'vimproc',
            \ 'runner/vimproc/updatetime' : 10,
            \ 'tex' : {
            \ 'command' : 'latexmk',
            \ 'cmdopt' : '-pvc -pdfdvi',
            \ 'exec' : ['%c %o %s']
            \ },
            \}

Solution

  • Check your filetype, syntax, key mappings..

    :set ft? syn?
    :imap
    :map
    

    Try disabling digraphs:

    :set nodigraph
    

    try removing any backtick mapping that might be defined in a syntax configuration file:

    :iunmap `