Loading ...
Sorry, an error occurred while loading the content.

Annoying refolding when using completion and foldmethod=indent

Expand Messages
  • Haakon Riiser
    Take the following test.c: int main() { printf( hello, world n ); return 0; } Edit this file, and enable foldmethod=indent. Now, the printf and the return
    Message 1 of 3 , Oct 5, 2010
    • 0 Attachment
      Take the following test.c:

      int main()
      {
      printf("hello, world\n");
      return 0;
      }

      Edit this file, and enable foldmethod=indent. Now, the printf
      and the return lines are folded. Then, open the fold, for example
      using "za", and put the cursor on the printf-line. Next, press "O"
      to insert a line above the printf-line. Finally, press CTRL-P while
      in insert mode to use keyword completion.

      What happens for me when I do this is that the fold closes while
      doing keyword completion. If I accept a keyword, e.g. by pressing
      <Return> or <Space>, the fold opens again.

      PS:
      This /only/ happens when autoindent is turned on, and /only/
      when doing completion on the first line in the fold.

      I can reproduce this bug on the latest VIM snapshot (no parameters
      to ./configure, compiled on Fedora 12 x86_64):

      VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Oct 5 2010 08:48:15)
      Included patches: 1-19
      Compiled by haakon.riiser at fys.uio.no
      Normal version with GTK2 GUI. Features included (+) or not (-):
      -arabic +autocmd +balloon_eval +browse +builtin_terms +byte_offset +cindent +clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments -conceal +cryptv -cscope
      +cursorbind +cursorshape +dialog_con_gui +diff +digraphs +dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path +find_in_path +float +folding -footer +fork()
      +gettext -hangul_input +iconv +insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent +listcmds +localmap -lua +menu +mksession +modify_fname +mouse +mouseshape
      -mouse_dec +mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype +path_extra -perl +persistent_undo
      +postscript +printer -profile -python -python3 +quickfix +reltime -rightleft -ruby +scrollbind +signs +smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
      +tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title +toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore
      +wildmenu +windows +writebackup +X11 -xfontset +xim +xsmp_interact +xterm_clipboard -xterm_save
      system vimrc file: "$VIM/vimrc"
      user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
      system gvimrc file: "$VIM/gvimrc"
      user gvimrc file: "$HOME/.gvimrc"
      system menu file: "$VIMRUNTIME/menu.vim"
      fall-back for $VIM: "/tmp/inst/share/vim"
      Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0
      -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -g -O2 -D_FORTIFY_SOURCE=1
      Linking: gcc -L/usr/local/lib -o vim -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -l
      gobject-2.0 -lgmodule-2.0 -lglib-2.0 -lXt -lm -lncurses -lselinux -lacl -lgpm

      --
      Haakon

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Ben Fritz
      ... Try this: http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text (don t let the title fool you, it should also keep folds open, basically it
      Message 2 of 3 , Oct 5, 2010
      • 0 Attachment
        On Oct 5, 2:11 am, Haakon Riiser <haakon.rii...@...> wrote:
        > Take the following test.c:
        >
        >   int main()
        >   {
        >       printf("hello, world\n");
        >       return 0;
        >   }
        >
        > Edit this file, and enable foldmethod=indent.  Now, the printf
        > and the return lines are folded.  Then, open the fold, for example
        > using "za", and put the cursor on the printf-line.  Next, press "O"
        > to insert a line above the printf-line.  Finally, press CTRL-P while
        > in insert mode to use keyword completion.
        >
        > What happens for me when I do this is that the fold closes while
        > doing keyword completion.  If I accept a keyword, e.g. by pressing
        > <Return> or <Space>, the fold opens again.
        >

        Try this:

        http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text

        (don't let the title fool you, it should also keep folds open,
        basically it disables changes in the folds while in insert mode)

        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Haakon Riiser
        [Ben Fritz] ... Works perfectly -- thank you! -- Haakon -- You received this message from the vim_dev maillist. Do not top-post! Type your reply below the
        Message 3 of 3 , Oct 6, 2010
        • 0 Attachment
          [Ben Fritz]

          >> [...]
          >>
          >> What happens for me when I do this is that the fold closes while
          >> doing keyword completion.  If I accept a keyword, e.g. by pressing
          >> <Return> or <Space>, the fold opens again.
          >
          > Try this:
          >
          > http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text
          >
          > (don't let the title fool you, it should also keep folds open,
          > basically it disables changes in the folds while in insert mode)

          Works perfectly -- thank you!

          --
          Haakon

          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        Your message has been successfully submitted and would be delivered to recipients shortly.