fix: Deal with some edge cases

This commit is contained in:
Sayantan Santra 2024-03-15 09:21:36 -05:00
parent ca3df73d3a
commit 9189537120
Signed by: SinTan1729
GPG key ID: EB3E68BFBA25C85F
2 changed files with 6 additions and 3 deletions

View file

@ -3,7 +3,10 @@ global !p
# def math():
# return vim.eval('vimtex#syntax#in_mathzone()') == '1'
def itemize_like():
return get_env() in ["itemize", "enumerate"]
try:
return get_env() in ["itemize", "enumerate"]
except:
return False
def get_env():
return vim.eval('vimtex#env#get_inner()["name"]')
@ -20,7 +23,7 @@ snippet "\\item\s*\S+.*" "create next item" rb
endsnippet
context itemize_like()
pre_expand "del snip.buffer[snip.line]; snip.cursor.set(snip.line, len(snip.buffer[snip.line+1])+1)"
pre_expand "del snip.buffer[snip.line]; snip.cursor.set(snip.line, len(snip.buffer[snip.line]))"
snippet "\\item\s*$" "exit itemize_like envs" rb
$0
endsnippet

View file

@ -58,7 +58,7 @@ let g:loaded_node_provider=0
let g:loaded_ruby_provider=0
" Change the leader and localleader
let mapleader = ","
let mapleader=","
let maplocalleader=';'
" Use ,dd for deleting without putting into buffer