LaTeX-Box-Team / LaTeX-Box

Lightweight Toolbox for LaTeX - New Official repository
http://www.vim.org/scripts/script.php?script_id=3109
GNU General Public License v3.0
396 stars 66 forks source link

LaTeX-Box's custom indentation mis-positions the cursor when backspacing over \end tags while YouCompleteMe is active #240

Closed simichaels closed 9 years ago

simichaels commented 9 years ago

With LaTeX-Box's custom indentation on

let g:LatexBox_custom_indent=1

and with YouCompleteMe active, typing something like the following will produce unusual indent behavior.

Here '|' represents the cursor position.

\begin{enumerate}
    \item \begin{align*}
            a &= b
        \end |
\end{enumerate}

At this point, if I backspace three times, I get

\begin{enumerate}
    \item \begin{align*}
            a &= b
         |  \e
\end{enumerate}

In addition, if I then type any character and then backspace, the backspace operation actually skips over the typed character and inserts an indent. Here I type 'a b c ', and get

\begin{enumerate}
    \item \begin{align*}
            a &= b
       |    c    b    a  \e
\end{enumerate}

I believe this problem to be on LaTeX-Box's side rather than YCM's, since using Vim's default LaTeX indentation file doesn't cause this problem. However, this problem does happen only when YouCompleteMe is active, so my guess is that the LB's custom indent and YCM's autocompletion conflict somehow. Perhaps the "autocmd CompleteDone" call in indent/tex.vim has something to do with it?

YCM and LaTeX-Box related settings in my .vimrc are

let g:LatexBox_latexmk_async=1
let g:LatexBox_latexmk_preview_continuously=1
let g:LatexBox_viewer="open -a /Applications/TeXShop.app"
let g:LatexBox_quickfix=4
let g:LatexBox_autojump=0
let g:LatexBox_show_warnings=0
let g:LatexBox_custom_indent=0

let g:ycm_global_ycm_extra_conf = "/Users/spencer/.ycm_extra_conf.py"
let g:ycm_confirm_extra_conf = 0 " Use alternate confs without confirmation
let g:ycm_autoclose_preview_window_after_completion = 1
let g:ycm_key_invoke_completion = '<C-Space>'
let g:ycm_key_list_select_completion = ['<Tab>']
let g:ycm_key_list_previous_completion = ['<S-Tab>']
let g:ycm_semantic_triggers = {
    \  'tex'  : ['{'],
\ }

My vim version information is as follows.

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 17 2015 21:47:02)
MacOS X (unix) version
Included patches: 1-383
Compiled by Homebrew
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_binary
+arabic          +find_in_path    -mouse_sysmouse  +tag_old_static
+autocmd         +float           +mouse_urxvt     -tag_any_white
+balloon_eval    +folding         +mouse_xterm     +tcl
+browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +fullscreen      -mzscheme        +textobjects
+cindent         -gettext         +netbeans_intg   +title
+clientserver    -hangul_input    +odbeditor       +toolbar
+clipboard       +iconv           +path_extra      +transparency
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con_gui  -lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
+dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     +xim
+emacs_tags      +mouseshape      -sniff           -xsmp
+eval            +mouse_dec       +startuptime     -xterm_clipboard
+ex_extra        -mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
+farsi           +mouse_netterm   +syntax
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X_UNIX  -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1     -I/System/Library/Frameworks/Tcl.framework/Headers  -D_REENTRANT=1  -D_THREAD_SAFE=1  -D_DARWIN_C_SOURCE=1
Linking: clang   -L. -L/usr/local/lib -L. -L/usr/local/lib -L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config -framework CoreFoundation -lpython2.7 -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm  -lncurses -liconv -framework Cocoa   -fstack-protector -L/usr/local/lib  -L/System/Library/Perl/5.16/darwin-thread-multi-2level/CORE -lperl -framework Python  -F/System/Library/Frameworks -framework Tcl -framework CoreFoundation -framework Ruby