I recently made the following key-map in my .vimrc
file:
inoremap # \
inoremap \ #
since I just want to switch those two key on my keyboard, everything works just fine until I notice this:
Only in
.tex
file, when I hit the # key (now map to\
), it will show as#
for about 1 second, then if I do nothing it will change to\
.also only in
.tex
file, when I hit the # key and immediately hit another key, for most of the key, say x, although it shows#
at first, it will change to/x
as soon as I hit x. But for some key like b, if I do not wait it to turn to\
(as described in (1)) before I hit b, it will be#b
in the end, if I wait it to turn to\
, then it will show as\b
.
Any solution to this?
The following is my .vimrc
file:
call plug#begin()
Plug 'lervag/vimtex'
Plug 'vim-scripts/AutoComplPop'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
call plug#end()
set complete+=kspell
let g:tex_flavor='latex'
let g:vimtex_view_method = 'zathura'
let g:vimtex_quickfix_mode=0
" show conceal"
set conceallevel=2
let g:tex_conceal='abdmg'
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
" :UltiSnipsEdit to split your window."
let g:UltiSnipsEditSplit="vertical"
let g:UltiSnipsSnippetDirectories=["UltiSnips", "mySnips"]
autocmd BufWinLeave *.* mkview
" autocmd BufWinEnter *.* silent loadview"
" keymap, see :help map-modes for reference"
inoremap # \
inoremap \ #
set cursorline
set cursorcolumn
set expandtab
set ts=4 sts=4 sw=4
set colorcolumn=80,120
set rnu
set ruler
syntax on
hi cursorline cterm=NONE ctermbg=237
hi cursorcolumn ctermbg=237
hi cursorlinenr cterm=NONE ctermbg=237
hi Conceal cterm=NONE ctermfg=lightyellow ctermbg=NONE
" to clear conceal highlighting use the command :hi clear Conceal"
hi ColorColumn ctermbg=240
g:tex_flavor
andg:tex_conceal
options when you use VimTeX. They will not be relevant and would therefore only be confusing. Also, notice thatset conceallevel
is a window local option. If you want it for LaTeX it would be better to set it with an autocmd, e.g.autocmd FileType tex setlocal conceallevel=2
.