diff --git a/custom-snippets/tex.snippets b/custom-snippets/tex.snippets index 8f00d11..43c594d 100644 --- a/custom-snippets/tex.snippets +++ b/custom-snippets/tex.snippets @@ -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 diff --git a/vimrc.vim b/vimrc.vim index 1ea416c..0496458 100644 --- a/vimrc.vim +++ b/vimrc.vim @@ -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