-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
I noticed that when I edit a tex file and hit <BS> in the end of the line, somehow the trailing line break would be deleted automatically and the next line would be joined with the current line. This is unexpected and a bit annoying. Is there something wrong with my vimrc configuration of lexima?
" -----------------------------------------------------------------------------
" Automatic insertion of brackets using lexima
" -----------------------------------------------------------------------------
" --- Inline math: $ ... $
" Type $ → $…$ with cursor inside
call lexima#add_rule({'char': '$', 'input_after': '$', 'filetype': 'tex'})
" Typing $ again when cursor is just before the closing $ → jump out
call lexima#add_rule({'char': '$', 'at': '\%#\$', 'leave': 1, 'filetype': 'tex'})
" Backspace inside $…$ deletes both
call lexima#add_rule({'char': '<BS>', 'at': '\$\%#\$', 'delete': 1, 'filetype': 'tex'})
" If you type \$ → insert literal $ (no auto-pair)
call lexima#add_rule({'char': '$', 'at': '\\\%#', 'input': '$', 'priority': 200, 'filetype': 'tex'})
" --- Inline math: \( ... \)
" When you type '(' immediately after a backslash, create \(...\)
call lexima#add_rule({'char': '(', 'at': '\\\%#', 'input_after': '\)', 'filetype': 'tex'})
" Typing ')' when cursor is just before the closing \) → jump out
call lexima#add_rule({'char': ')', 'at': '\%#\\)', 'leave': 2, 'filetype': 'tex'})
" Backspace inside \(...\) deletes the pair
call lexima#add_rule({'char': '<BS>', 'at': '\\(\%#\\)', 'delete': 1, 'filetype': 'tex'})
" --- Display math: \[ ... \]
" When you type '[' immediately after a backslash, create \[...\]
call lexima#add_rule({'char': '[', 'at': '\\\%#', 'input_after': '\]', 'filetype': 'tex'})
" Typing ']' when cursor is just before the closing \] → jump out
call lexima#add_rule({'char': ']', 'at': '\%#\\]', 'leave': 2, 'filetype': 'tex'})
" Backspace inside \[...\] deletes the pair
call lexima#add_rule({'char': '<BS>', 'at': '\\[\%#\\]', 'delete': 1, 'filetype': 'tex'})
" --- Escaped braces: \{ ... \}
" When you type '{' immediately after a backslash, create \{...\}
call lexima#add_rule({'char': '{', 'at': '\\\%#', 'input_after': '\}', 'filetype': 'tex'})
" Typing '}' when cursor is just before the closing \} → jump out
call lexima#add_rule({'char': '}', 'at': '\%#\\}', 'leave': 2, 'filetype': 'tex'})
" Backspace inside \{...\} deletes the pair
call lexima#add_rule({'char': '<BS>', 'at': '\\{\%#\\}', 'delete': 1, 'filetype': 'tex'})
" Don’t join lines when cursor is just before a newline (this does not work)
call lexima#add_rule({
\ 'char': '<BS>',
\ 'at': '\%#\n',
\ 'input': '<BS>',
\ 'priority': 10000
\ })
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels