Re: cpo-=l full list

2011-12-25 Fir de Conversatie Thilo Six
Taylor Hedberg wrote the following on 25.12.2011 05:20

Hello Charles,

 Charles E Campbell Jr, Sat 2011-12-24 @ 22:11:31-0500:
 If I may repeat myself, what advantage does
   set cpo-=a cpo-=A
 have over
   set cpo-=aA
 ???
 
 From `:help :set-=`:
 
   When the option is a list of flags, {value} must be
   exactly as they appear in the option.  Remove flags
   one by one to avoid problems.
 
 Removing the flags individually is guaranteed to work regardless of the
 order and position in which the flags appear in the option string. This
 is not true if you remove them in combination.

Thank you Taylor that i exactly what i thought of.

Charles here is a example:
:set cpo?
cpoptions=aABceFs
:set cpo-=aA
cpoptions=BceFs

so far so good. Now lets have a crazy user shuffling things around:
:set cpo?
cpoptions=ABFacespretty much default, just different order
:set cpo-=aA
:set cpo?
cpoptions=ABFaces
:set cpo-=a
:set cpo-=A
:set cpo?
cpoptions=BFces

HTH
-- 
Regards,
Thilo

4096R/0xC70B1A8F
721B 1BA0 095C 1ABA 3FC6  7C18 89A4 A2A0 C70B 1A8F


-- 
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


VIM QT fails to compile on Ubuntu 11.04

2011-12-25 Fir de Conversatie Konstantin Zertsekel
Hi all,

Not sure if this list is correct, but I'll give it a try...

I clones VIM QT by Rui Abreu Ferreira:
$ git clone https://git.gitorious.org/vim-qt/vim-qt.git

And just compiled it on Ubuntu 11.04 and got the below error:
CC=gcc -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_QT  -Iqt -I.
-I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore
-I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui
-I/usr/include/qt4 -I. -I.srcdir=. sh ./osdef.sh
gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_QT  -Iqt -I.
-I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore
-I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui
-I/usr/include/qt4 -I. -I.-O2 -fno-strength-reduce -Wall
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1   -o objects/buffer.o
buffer.c
In file included from vim.h:1972:0,
 from buffer.c:28:
globals.h:870:13: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
‘__attribute__’ before ‘xic’
make[2]: *** [objects/buffer.o] Error 1
make[2]: Leaving directory `/home/kosta/my/dev/vim/vim-qt/src'
make[1]: *** [myself] Error 2
make[1]: Leaving directory `/home/kosta/my/dev/vim/vim-qt/src'
make: *** [first] Error 2

My Ubuntu is:

kosta @ ~/my/dev/vim/vim-qt
18:38:19 $ uname -a
Linux zk 2.6.38-13-generic #53-Ubuntu SMP Mon Nov 28 19:33:45 UTC 2011
x86_64 x86_64 x86_64 GNU/Linux

kosta @ ~/my/dev/vim/vim-qt
18:39:27 $ cat /etc/issue
Ubuntu 11.04 \n \l

Can anybody help with it?
The full compilation log is attached.
Thanks in advance,
--- Kosta

-- 
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
kosta @ ~/my/dev/vim/vim-qt
18:34:52 $ make clean
Starting make in the src directory.
If there are problems, cd to the src directory and run make there
cd src  make clean
make[1]: Entering directory `/home/kosta/my/dev/vim/vim-qt/src'
cd testdir; make -f Makefile clean
make[2]: Entering directory `/home/kosta/my/dev/vim/vim-qt/src/testdir'
rm -rf *.out *.failed *.rej *.orig test.log tiny.vim small.vim mbyte.vim 
mzscheme.vim test.ok X* valgrind.* viminfo
make[2]: Leaving directory `/home/kosta/my/dev/vim/vim-qt/src/testdir'
if test -d po; then \
cd po; make checkclean; \
fi
make[2]: Entering directory `/home/kosta/my/dev/vim/vim-qt/src/po'
rm -f *.ck
make[2]: Leaving directory `/home/kosta/my/dev/vim/vim-qt/src/po'
rm -f *.o objects/* core vim.core vim vim xxd/*.o
rm -f xxd/xxd auto/osdef.h auto/pathdef.c auto/if_perl.c
rm -f conftest* *~ auto/link.sed
rm -f memfile_test
rm -f runtime pixmaps
rm -rf vim.app
rm -rf mzscheme_base.c
if test -d po; then \
cd po; make prefix= clean; \
fi
make[2]: Entering directory `/home/kosta/my/dev/vim/vim-qt/src/po'
rm -f *.ck
rm -f core core.* *.old.po *.mo *.pot sjiscorr
make[2]: Leaving directory `/home/kosta/my/dev/vim/vim-qt/src/po'
make[1]: Leaving directory `/home/kosta/my/dev/vim/vim-qt/src'

kosta @ ~/my/dev/vim/vim-qt
18:34:55 $ make
Starting make in the src directory.
If there are problems, cd to the src directory and run make there
cd src  make first
make[1]: Entering directory `/home/kosta/my/dev/vim/vim-qt/src'
rm -f auto/config.status auto/config.cache config.log auto/config.log
rm -f auto/config.h auto/link.log auto/link.sed auto/config.mk
touch auto/config.h
cp config.mk.dist auto/config.mk
GUI_INC_LOC= GUI_LIB_LOC= \
CC= CPPFLAGS= CFLAGS= \
LDFLAGS=  srcdir=. \
./configure\
  \
   \
   \
   \
   \
   \
\
   \
  \

checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for library containing strerror... none required
checking for gawk... gawk
checking for strip... strip
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking --enable-fail-if-missing argument... no
configure: checking for buggy tools...
- sed is'GNU sed version 4.2.1
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
to the extent permitted by law.

GNU sed home page: http://www.gnu.org/software/sed/.
General help using GNU software: http://www.gnu.org/gethelp/.

Re: VIM QT fails to compile on Ubuntu 11.04

2011-12-25 Fir de Conversatie Tony Mechelynck

On 25/12/11 17:39, Konstantin Zertsekel wrote:

Hi all,

Not sure if this list is correct, but I'll give it a try...

I clones VIM QT by Rui Abreu Ferreira:
$ git clone https://git.gitorious.org/vim-qt/vim-qt.git

And just compiled it on Ubuntu 11.04 and got the below error:
CC=gcc -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_QT  -Iqt -I.
-I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore
-I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui
-I/usr/include/qt4 -I. -I.srcdir=. sh ./osdef.sh
gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_QT  -Iqt -I.
-I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore
-I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui
-I/usr/include/qt4 -I. -I.-O2 -fno-strength-reduce -Wall
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1   -o objects/buffer.o
buffer.c
In file included from vim.h:1972:0,
  from buffer.c:28:
globals.h:870:13: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
‘__attribute__’ before ‘xic’


globals:h
853: #ifdef FEAT_XIM
854: # ifdef FEAT_GUI_GTK
...
869: # else
870: EXTERN XIC xic INIT(= NULL);
871: # endif
...
876: #endif

I don't know where XIC (type name) is defined.


make[2]: *** [objects/buffer.o] Error 1
make[2]: Leaving directory `/home/kosta/my/dev/vim/vim-qt/src'
make[1]: *** [myself] Error 2
make[1]: Leaving directory `/home/kosta/my/dev/vim/vim-qt/src'
make: *** [first] Error 2

[...]

I'm not sure the Qt port is still supported (last I heard, it wasn't), 
or by whom. Try the following:


1. get Bram's official Vim source, see 
http://vim.wikia.com/wiki/Getting_the_Vim_source_with_Mercurial


2. (if not already done) install Gnome (including several -dev packages 
needed to compile gvim; I'm not sure which apt-get command will get them 
all for you but no doubt someone else will know)


3. check your configure options. I recommend configuring with 
--enable-gnome-check, see 
http://users.skynet.be/antoine.mechelynck/vim/compunix.htm


4. Compile (i.e. make) in your new Mercurial clone. Or if you have an 
existing Mercurial clone of Vim and changed the configure options and/or 
the set of available software packages since the last compile, run make 
reconfig (and make sure that your configure options are set via 
environment variables, see § 3 above). Configure will compile with GTK2 
(if available) in preference to any other GUI.



Best regards,
Tony.
--
Violence is the last refuge of the incompetent.
-- Salvor Hardin

--
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


New patch to set cursor shape in Cygwin

2011-12-25 Fir de Conversatie Ben
Hi vim_dev,

I always liked the feature in win32 console vim where the cursor
changed shape depending on what mode you're in. I recently switched to
using cygwin console vim on my Windows systems instead of win32
console for various reasons (primarily because it understands cygwin
paths), and was disappointed to find the cursor shape-change feature
was not working, even though my version of cygwin vim was compiled
with +cursorshape. I had some time on my hands, so I went into the
source and figured out how to get it to work. Here's the patch:

diff -r a96cb758a8d7 runtime/doc/options.txt
--- a/runtime/doc/options.txt   Fri Dec 23 14:56:28 2011 +0100
+++ b/runtime/doc/options.txt   Mon Dec 26 00:11:47 2011 -0500
@@ -3334,17 +3334,17 @@
r-cr:hor20-Cursor/lCursor,
sm:block-Cursor
-blinkwait175-blinkoff150-blinkon175,
-   for MS-DOS and Win32 console:
+   for MS-DOS, Win32, and Cygwin console:
n-v-c:block,o:hor50,i-ci:hor15,
r-cr:hor30,sm:block)
global
{not in Vi}
{only available when compiled with GUI enabled, and
-   for MS-DOS and Win32 console}
+   for MS-DOS, Win32, and Cygwin console}
This option tells Vim what the cursor should look like in different
-   modes.  It fully works in the GUI.  In an MSDOS or Win32 console,
only
-   the height of the cursor can be changed.  This can be done by
-   specifying a block cursor, or a percentage for a vertical or
+   modes.  It fully works in the GUI.  In an MSDOS, Win32, and Cygwin
+   console, only the height of the cursor can be changed.  This can be
+   done by specifying a block cursor, or a percentage for a vertical or
horizontal cursor.
For a console the 't_SI' and 't_EI' escape sequences are used.

diff -r a96cb758a8d7 src/feature.h
--- a/src/feature.h Fri Dec 23 14:56:28 2011 +0100
+++ b/src/feature.h Mon Dec 26 00:11:47 2011 -0500
@@ -1156,8 +1156,8 @@
  * mouse shape Adjust the shape of the mouse pointer to the mode.
  */
 #ifdef FEAT_NORMAL
-/* MS-DOS console and Win32 console can change cursor shape */
-# if defined(MSDOS) || (defined(WIN3264)  !defined(FEAT_GUI_W32))
+/* MS-DOS console, Win32 console, and Cygwin console can change
cursor shape */
+# if defined(MSDOS) || (defined(WIN3264)  !defined(FEAT_GUI_W32))
|| defined(__CYGWIN__)
 #  define MCH_CURSOR_SHAPE
 # endif
 # if defined(FEAT_GUI_W32) || defined(FEAT_GUI_W16) ||
defined(FEAT_GUI_MOTIF) \
diff -r a96cb758a8d7 src/os_unix.c
--- a/src/os_unix.c Fri Dec 23 14:56:28 2011 +0100
+++ b/src/os_unix.c Mon Dec 26 00:11:47 2011 -0500
@@ -31,6 +31,11 @@

 #include vim.h

+#if defined(__CYGWIN__)
+#include windows.h
+static HANDLE g_hConOut = INVALID_HANDLE_VALUE;
+#endif
+
 #ifdef FEAT_MZSCHEME
 # include if_mzsch.h
 #endif
@@ -1222,6 +1227,10 @@
 #ifdef MACOS_CONVERT
 mac_conv_init();
 #endif
+
+#if defined(__CYGWIN__)
+g_hConOut = GetStdHandle(STD_OUTPUT_HANDLE);
+#endif
 }

 static void
@@ -7196,3 +7205,41 @@


 #endif
+
+#if defined(__CYGWIN__)
+
+#if defined(MCH_CURSOR_SHAPE)
+/*
+ * Set the shape of the cursor.
+ * 'thickness' can be from 1 (thin) to 99 (block)
+ */
+static void
+mch_set_cursor_shape(int thickness)
+{
+CONSOLE_CURSOR_INFO ConsoleCursorInfo;
+ConsoleCursorInfo.dwSize = thickness;
+ConsoleCursorInfo.bVisible = TRUE;
+
+SetConsoleCursorInfo(g_hConOut, ConsoleCursorInfo);
+}
+
+void
+mch_update_cursor(void)
+{
+intidx;
+intthickness;
+
+/*
+ * How the cursor is drawn depends on the current mode.
+ */
+idx = get_shape_idx(FALSE);
+
+if (shape_table[idx].shape == SHAPE_BLOCK)
+   thickness = 99; /* 100 doesn't work on W95 */
+else
+   thickness = shape_table[idx].percentage;
+mch_set_cursor_shape(thickness);
+}
+#endif
+
+#endif

Some possible concerns:
1. I know that cygwin vim can run in different terminals, such as rxvt
and the new cygwin terminal. The patch obviously only works when run
in a DOS box because it calls the Windows API function
SetConsoleCursorInfo, which only applies to the DOS box. I'm not sure
how to test what type of console we're running in... should we include
such a test to avoid calling that code unnecessarily?
2. I believe cygwin vim can be compiled for GUI mode, so the code
wouldn't work in that case either; should we include a preprocessor
test to exclude the code if compiling for GUI mode?
3. I'm not sure about how much testing needs to be done for a new
patch (this is the first patch I've ever submitted); I've only tested
it on one Windows 7 machine.

Any feedback is appreciated.

Thanks,
Ben

-- 
You received 

extend t T f F

2011-12-25 Fir de Conversatie Bee
extend t T f F

Is it possible to make ';' trigger a catch if there are no more
matches in a line? Without it displaying an error message.

Something like the following:

function! Semi()
  try | normal! ;
  catch | normal! +
  endtry
endfun
nmap F12 :call Semi()cr

-Bill

-- 
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


Re: New patch to set cursor shape in Cygwin

2011-12-25 Fir de Conversatie Tony Mechelynck

On 26/12/11 06:37, Ben wrote:

Hi vim_dev,

I always liked the feature in win32 console vim where the cursor
changed shape depending on what mode you're in. I recently switched to
using cygwin console vim on my Windows systems instead of win32
console for various reasons (primarily because it understands cygwin
paths), and was disappointed to find the cursor shape-change feature
was not working, even though my version of cygwin vim was compiled
with +cursorshape. I had some time on my hands, so I went into the
source and figured out how to get it to work. Here's the patch:

diff -r a96cb758a8d7 runtime/doc/options.txt
--- a/runtime/doc/options.txt   Fri Dec 23 14:56:28 2011 +0100
+++ b/runtime/doc/options.txt   Mon Dec 26 00:11:47 2011 -0500
@@ -3334,17 +3334,17 @@
r-cr:hor20-Cursor/lCursor,
sm:block-Cursor
-blinkwait175-blinkoff150-blinkon175,
-   for MS-DOS and Win32 console:
+   for MS-DOS, Win32, and Cygwin console:
n-v-c:block,o:hor50,i-ci:hor15,
r-cr:hor30,sm:block)
global
{not in Vi}
{only available when compiled with GUI enabled, and
-   for MS-DOS and Win32 console}
+   for MS-DOS, Win32, and Cygwin console}
This option tells Vim what the cursor should look like in different
-   modes.  It fully works in the GUI.  In an MSDOS or Win32 console,
only
-   the height of the cursor can be changed.  This can be done by
-   specifying a block cursor, or a percentage for a vertical or
+   modes.  It fully works in the GUI.  In an MSDOS, Win32, and Cygwin
+   console, only the height of the cursor can be changed.  This can be
+   done by specifying a block cursor, or a percentage for a vertical or
horizontal cursor.
For a console the 't_SI' and 't_EI' escape sequences are used.

diff -r a96cb758a8d7 src/feature.h
--- a/src/feature.h Fri Dec 23 14:56:28 2011 +0100
+++ b/src/feature.h Mon Dec 26 00:11:47 2011 -0500
@@ -1156,8 +1156,8 @@
   * mouse shapeAdjust the shape of the mouse pointer to the 
mode.
   */
  #ifdef FEAT_NORMAL
-/* MS-DOS console and Win32 console can change cursor shape */
-# if defined(MSDOS) || (defined(WIN3264)  !defined(FEAT_GUI_W32))
+/* MS-DOS console, Win32 console, and Cygwin console can change
cursor shape */
+# if defined(MSDOS) || (defined(WIN3264)  !defined(FEAT_GUI_W32))
|| defined(__CYGWIN__)
  #  define MCH_CURSOR_SHAPE
  # endif
  # if defined(FEAT_GUI_W32) || defined(FEAT_GUI_W16) ||
defined(FEAT_GUI_MOTIF) \
diff -r a96cb758a8d7 src/os_unix.c
--- a/src/os_unix.c Fri Dec 23 14:56:28 2011 +0100
+++ b/src/os_unix.c Mon Dec 26 00:11:47 2011 -0500
@@ -31,6 +31,11 @@

  #include vim.h

+#if defined(__CYGWIN__)
+#includewindows.h
+static HANDLE g_hConOut = INVALID_HANDLE_VALUE;
+#endif
+
  #ifdef FEAT_MZSCHEME
  # include if_mzsch.h
  #endif
@@ -1222,6 +1227,10 @@
  #ifdef MACOS_CONVERT
  mac_conv_init();
  #endif
+
+#if defined(__CYGWIN__)
+g_hConOut = GetStdHandle(STD_OUTPUT_HANDLE);
+#endif
  }

  static void
@@ -7196,3 +7205,41 @@


  #endif
+
+#if defined(__CYGWIN__)
+
+#if defined(MCH_CURSOR_SHAPE)
+/*
+ * Set the shape of the cursor.
+ * 'thickness' can be from 1 (thin) to 99 (block)
+ */
+static void
+mch_set_cursor_shape(int thickness)
+{
+CONSOLE_CURSOR_INFO ConsoleCursorInfo;
+ConsoleCursorInfo.dwSize = thickness;
+ConsoleCursorInfo.bVisible = TRUE;
+
+SetConsoleCursorInfo(g_hConOut,ConsoleCursorInfo);
+}
+
+void
+mch_update_cursor(void)
+{
+intidx;
+intthickness;
+
+/*
+ * How the cursor is drawn depends on the current mode.
+ */
+idx = get_shape_idx(FALSE);
+
+if (shape_table[idx].shape == SHAPE_BLOCK)
+   thickness = 99; /* 100 doesn't work on W95 */
+else
+   thickness = shape_table[idx].percentage;
+mch_set_cursor_shape(thickness);
+}
+#endif
+
+#endif

Some possible concerns:
1. I know that cygwin vim can run in different terminals, such as rxvt
and the new cygwin terminal. The patch obviously only works when run
in a DOS box because it calls the Windows API function
SetConsoleCursorInfo, which only applies to the DOS box. I'm not sure
how to test what type of console we're running in... should we include
such a test to avoid calling that code unnecessarily?


Isn't that what the 'term' option is for? My vimrc includes the following:

if (term == pcterm) || (term == win32)
 if exists(+guicursor)
 Console cursor shape (Windows only)
set guicursor=n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30
set guicursor+=sm:block,a:blinkwait750-blinkoff750-blinkon750
elseif (...)

What is