Re: Hex viewer/editor with vim

2011-02-09 Thread Xavier Wang
2011/2/9 Peter de Ridder 

> Hi,
>
> Using vim do edit binary files isn't always that easy. With
> display+=uhex you can make unprintable characters show as hex, but the
> printable characters are still shown as normal characters. Using xxd
> so convert a file to hex gives a nice view of the file in both hex and
> printable characters. But editing is still a bit difficult even with
> hex editing helper scripts. e.g. insering or removing data isn't easy
> since all the xxd offsets number need to be renumbered.
>
> To make it easier for hex editing in vim I try the split hex editing
> in different parts which could be added to vim and be setup with a
> command e.g. :hexthis (like :diffthis for diffing). The parts I came
> up with are:
> - Show all characters (printable or unprintable) as hex.
> - Show unprintable characters as a dot.
> - Number lines with byte offsets.
> - Columnize every x bytes.
> - Enter characters as hex.
> - Join lines over eol and make eol editable as if it was a character.
> - Other features like vsplit and scrollbind are already present.
>
> I know some if these options can be either impossible or to hard to be
> reasonable but I put them in the list to be complete.
> I started on implementing a few of the parts. I added preliminary
> patches for them.
>
> I'm providing the preliminary patches so other people can test them,
> tell what is missing, give pointers in to right direction or provide
> ideas on further improvements. I'm interested in using these feature
> myself maybe others are interested too and maybe these can become part
> of the newer versions of vim, when completed.
>
> I'll explain the different parts a bit further:
> - Show all characters (printable or unprintable) as hex.
> Preliminary patch: hex-displaymode.patch
> A per window setting to display all characters as hex, making all
> characters 2 display cells wide. This can be used as main hex editing
> window. Like the hex data part of xxd. The patch adds window option
> 'displaymode'='hex'.
> - Show unprintable characters as a dot.
> Preliminary patch: hex-displaymode.patch
> A per window setting to display all unprintable characters as dots,
> making all characters 1 display cell wide. This way this can be setup
> with scrollbinding to the main hex editing window and have half the
> width. Since the main window will have characters of 2 wide and this
> window will have characters of 1 wide, so the wrapping and such will
> match and scrollbinding can be used. This setting is like the right
> printable character side of xxd. The patch adds window option
> 'displaymode'='dot'.
> - Number lines with byte offsets.
> Preliminary patch: hex-hexnumber.patch
> A setting like 'number' and the recent 'relativenumber' but instead of
> line number it shows line byte offsets. The +byte_offset feature
> provides the internals for this. Line the first column if xxd. The
> patch adds window option 'hexnumber'.
> - Columnize every x bytes.
> Experimental patch: hex-columnview.patch
> Columnize characters in groups of x bytes or multiple groups. And
> break a line at x bytes neither by inserting eol or dependant on the
> window width. Gives a better for of data in (mostly) the
> 'displaymode'='hex' window. The patch adds
> 'columnview'={break},{count},{count},... ('columnize' might be a
> better name?)
> - Enter characters as hex.
> Type only [0-9a-fA-F] to enter data. This could be handled by a script
> and doesn't need to be part of the c code base.
> - Join lines over eol and make eol editable as if it was a character.
> Make the eol act like it as a normal character and let the line breaks
> be fully handled by either 'wrap' or 'columnview'. As for now I don't
> see any option in vim which does something similar and it seems very
> hard to me if not impossible without breaking the core structure. I
> could also live without this part since the other parts would be a
> good enough improvement already. vim is still a text editor and not a
> full featured hex editor.
>
> Patches:
> hex-displaymode.patch: Base patch adding the +hex feature and the
> 'displaymode' window option. This should work on vim7.3 (It is based
> on 7.3-112).
> hex-hexnumber.patch: Aditional patch to add 'hexnumber' window option.
> hex-displaymode.patch needs to be applied.
> hex-columnview.patch: Aditional patch adding experimental window
> option 'columnview', this is know to break. hex-hexnumber.patch needs
> to be applied. I might have started in the wrong direction with this
> implementation, so I might need to start over with this one.
>
> Regards,
> Peter
>
> --
> 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
>

thank you for you patch! I desired editing hex text in Vim in a long time.

hex-columnview.patch can't compile in VC2008, you add preprocessing routine
within a macro, and VC can not hand this.

change 

Re: Hex viewer/editor with vim

2011-02-09 Thread Xavier Wang
2011/2/9 Bee 

> On Feb 8, 2:25 pm, Peter de Ridder  wrote:
> > Hi,
> >
> > Using vim do edit binary files isn't always that easy. With
> > display+=uhex you can make unprintable characters show as hex, but the
> > printable characters are still shown as normal characters. Using xxd
> > so convert a file to hex gives a nice view of the file in both hex and
> > printable characters. But editing is still a bit difficult even with
> > hex editing helper scripts. e.g. insering or removing data isn't easy
> > since all the xxd offsets number need to be renumbered.
> >
> > To make it easier for hex editing in vim I try the split hex editing
> > in different parts which could be added to vim and be setup with a
> > command e.g. :hexthis (like :diffthis for diffing). The parts I came
> > up with are:
> > - Show all characters (printable or unprintable) as hex.
> > - Show unprintable characters as a dot.
> > - Number lines with byte offsets.
> > - Columnize every x bytes.
> > - Enter characters as hex.
> > - Join lines over eol and make eol editable as if it was a character.
> > - Other features like vsplit and scrollbind are already present.
> >
> > I know some if these options can be either impossible or to hard to be
> > reasonable but I put them in the list to be complete.
> > I started on implementing a few of the parts. I added preliminary
> > patches for them.
> >
> > I'm providing the preliminary patches so other people can test them,
> > tell what is missing, give pointers in to right direction or provide
> > ideas on further improvements. I'm interested in using these feature
> > myself maybe others are interested too and maybe these can become part
> > of the newer versions of vim, when completed.
> >
> > I'll explain the different parts a bit further:
> > - Show all characters (printable or unprintable) as hex.
> > Preliminary patch: hex-displaymode.patch
> > A per window setting to display all characters as hex, making all
> > characters 2 display cells wide. This can be used as main hex editing
> > window. Like the hex data part of xxd. The patch adds window option
> > 'displaymode'='hex'.
> > - Show unprintable characters as a dot.
> > Preliminary patch: hex-displaymode.patch
> > A per window setting to display all unprintable characters as dots,
> > making all characters 1 display cell wide. This way this can be setup
> > with scrollbinding to the main hex editing window and have half the
> > width. Since the main window will have characters of 2 wide and this
> > window will have characters of 1 wide, so the wrapping and such will
> > match and scrollbinding can be used. This setting is like the right
> > printable character side of xxd. The patch adds window option
> > 'displaymode'='dot'.
> > - Number lines with byte offsets.
> > Preliminary patch: hex-hexnumber.patch
> > A setting like 'number' and the recent 'relativenumber' but instead of
> > line number it shows line byte offsets. The +byte_offset feature
> > provides the internals for this. Line the first column if xxd. The
> > patch adds window option 'hexnumber'.
> > - Columnize every x bytes.
> > Experimental patch: hex-columnview.patch
> > Columnize characters in groups of x bytes or multiple groups. And
> > break a line at x bytes neither by inserting eol or dependant on the
> > window width. Gives a better for of data in (mostly) the
> > 'displaymode'='hex' window. The patch adds
> > 'columnview'={break},{count},{count},... ('columnize' might be a
> > better name?)
> > - Enter characters as hex.
> > Type only [0-9a-fA-F] to enter data. This could be handled by a script
> > and doesn't need to be part of the c code base.
> > - Join lines over eol and make eol editable as if it was a character.
> > Make the eol act like it as a normal character and let the line breaks
> > be fully handled by either 'wrap' or 'columnview'. As for now I don't
> > see any option in vim which does something similar and it seems very
> > hard to me if not impossible without breaking the core structure. I
> > could also live without this part since the other parts would be a
> > good enough improvement already. vim is still a text editor and not a
> > full featured hex editor.
> >
> > Patches:
> > hex-displaymode.patch: Base patch adding the +hex feature and the
> > 'displaymode' window option. This should work on vim7.3 (It is based
> > on 7.3-112).
> > hex-hexnumber.patch: Aditional patch to add 'hexnumber' window option.
> > hex-displaymode.patch needs to be applied.
> > hex-columnview.patch: Aditional patch adding experimental window
> > option 'columnview', this is know to break. hex-hexnumber.patch needs
> > to be applied. I might have started in the wrong direction with this
> > implementation, so I might need to start over with this one.
> >
> > Regards,
> > Peter
> >
> >  hex-displaymode.patch
> > 22KViewDownload
> >
> >  hex-hexnumber.patch
> > 31KViewDownload
> >
> >  hex-columnview.patch
> > 22KViewDownload
>
> Editing in vim is difficult, so I cho

Re: ctrl-o with a mapping

2011-02-09 Thread Milan Vancura
> Here are some rules and guidelines from my personal "Vim scripting guide":
...snip
> -- regards, ingo

Hi Ingo.

Thank you for a very precise description. I must say there much of interesting
even for ~15 years user of vim like me :-) However, it's quite hard to read,
esp. as a FAQ entry. What about the following, wouldn't it be more readable for
beginners? Even I _know_ it is not the simplest or shortest solution for those
who know all details and special characters:

---
Mapping in normal mode could be executed after Ctrl-O from insert mode as well
but if there are more commands included in the mapping {rhs}, only the first
one will be executed in normal mode and the rest of {rhs} will be printed
literally in insert mode. One of ways to workaround this problem is to make
{rhs} be one command, via wrapping it to the function. For example:

function GetFontNameOfFirstChar()
  normal 0
  echo getfontname()
endfunction

:nmap  :call GetFontNameOfFirstChar()

For more solutions of this problem look here.
---

Milan

-- 
Milan Vancura, Prague, Czech Republic, Europe

-- 
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: Lookup speed for Vimscript lists and dictionaries

2011-02-09 Thread Bram Moolenaar

Hari Rangarajan wrote:

> I don't have much experience with the vim code base, I was hoping that
> someone here could quickly help with me info on the internal implementation
> of lookups for list and dictionaries. Is it hash tables or trees? Any other
> additional info would also be extremely helpful.

Dictionaries are hash tables (src/hashtab.c).  Lists are linked lists
(struct listvar_S in src/structs.h).

-- 
hundred-and-one symptoms of being an internet addict:
210. When you get a divorce, you don't care about who gets the children,
 but discuss endlessly who can use the email address.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
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: Bug in VIM 7.3.46

2011-02-09 Thread Simon Rushton
Hey Ben,

Thanks for your reply.

see below:

On Thu, Feb 3, 2011 at 8:49 PM, Ben Fritz  wrote:
>
>
> On Feb 3, 7:18 am, Simon Rushton  wrote:
>> Hope this is the best place for bug reports.
>>
>> > Environment
>>
>> I'm using VIM 7.3.46 on Windows XP.
>>
>> I'm writing sql and pkb files, so PL/SQL highlighting is being used,
>> and I have the following bespoke lines in my vimrc file:
>
> Since you're talking about syntax highlighting, doubtless you turn on
> syntax highlighting and filetype detection somewhere in your
> configuration. It does not occur in the lines you list below. Possibly
> it happens in a "system .vimrc" file. Look at the output of :version
> to find where this is.
>

I don't turn anything on or change any config settings other than the
changes I made to the bottom of the _vimrc file as described.
I just use the default settings and the highlighting works
automatically for me - due to the file extention .

>>
>> :colorscheme murphy
>>
>> set ts=2
>>
>> set autoindent
>> set expandtab
>>
>
> When you turn on filetype detection, do you also turn on filetype and/
> or indent plugins? These are a very likely place for the behavior
> you've noticed.
>
> What does
>
> :verbose set indentexpr?
>
> tell you?
>

It says:
Last set from C:\Program Files\Vim\vim73\indent\sqlanywhere.vim

I haven't dived into this .vim script to figure out what's going on...

>
>> > Bug
>>
>> When writing comments, i.e. prefixed with "--", if I insert the word
>> "end" then the text is inserted correctly, but also the indented line
>> jumps back to the start of the line, i.e. any white space at the start
>> of the line is deleted.
>>
>> It doesn't always happen, and I haven't narrowed down exactly the
>> conditions, but I can always reproduce it when I write a second
>> comment line directly beneath the first.
>>
>
> Looks like a problem with either the indent plugin or indentkeys
> setting, if in your setup filetype indent and/or plugin are enabled.
>
> --
> 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
>

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


Patch 7.3.113

2011-02-09 Thread Bram Moolenaar

Patch 7.3.113
Problem:Windows: Fall back directory for creating temp file is wrong.
Solution:   Use "." instead of empty string. (Hong Xu)
Files:  src/fileio.c


*** ../vim-7.3.112/src/fileio.c 2011-01-17 20:08:03.0 +0100
--- src/fileio.c2011-02-06 13:14:25.0 +0100
***
*** 7459,7465 
  
  STRCPY(itmp, "");
  if (GetTempPath(_MAX_PATH, szTempFile) == 0)
!   szTempFile[0] = NUL;/* GetTempPath() failed, use current dir */
  strcpy(buf4, "VIM");
  buf4[2] = extra_char;   /* make it "VIa", "VIb", etc. */
  if (GetTempFileName(szTempFile, buf4, 0, itmp) == 0)
--- 7459,7468 
  
  STRCPY(itmp, "");
  if (GetTempPath(_MAX_PATH, szTempFile) == 0)
! {
!   szTempFile[0] = '.';/* GetTempPath() failed, use current dir */
!   szTempFile[1] = NUL;
! }
  strcpy(buf4, "VIM");
  buf4[2] = extra_char;   /* make it "VIa", "VIb", etc. */
  if (GetTempFileName(szTempFile, buf4, 0, itmp) == 0)
*** ../vim-7.3.112/src/version.c2011-02-01 21:54:56.0 +0100
--- src/version.c   2011-02-09 14:46:12.0 +0100
***
*** 716,717 
--- 716,719 
  {   /* Add new patch number below this line */
+ /**/
+ 113,
  /**/

-- 
'Psychologist' -- Someone who looks at everyone else when
an attractive woman enters the room.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
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: vim crash

2011-02-09 Thread Bram Moolenaar

Christian Brabandt wrote:

> I can reproduce this. The problem here is a custom 'tabline' setting and 
> this results in a crash in the build_stl_str_hl() function. I have a 
> rather complicated tabline-setting, that I picked up in vim-use I guess. 
> I never need it though (and in fact tend to forget about it ;))
> 
> Here is a possible fix, that at least prevents the crash, but also 
> prevents drawing the statusline and tabline label. I must admit, I 
> haven't had time to investigate the build_stl_str_hl function in detail, 
> so I don't know the proper fix:

[bogus fix]

> Attached is:
> valgrind.log when running the vim -N -i NONE --cmd 'set tpm=65' -p 
> /tmp/vim-crash/* (a directory containing about 60 files)
> tabline.vim My custom tabline setting

I can't reproduce it.  The MyTabLine() function is missing.  Also, you
need to start vim with "-u NONE" to exclude all kinds of other stuff.

And make sure you run the latest Vim, including patch 7.3.112.
The line numbers in your valgrind output don't match my source, please
quote the actual source lines.

I also tried the instructions in your other message, didn't work either.

-- 
hundred-and-one symptoms of being an internet addict:
217. Your sex life has drastically improved...so what if it's only cyber-sex!

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
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: ctrl-o with a mapping

2011-02-09 Thread Ingo Karkat
On 08-Feb-2011 00:06, Christian Brabandt wrote:

> On Sa, 05 Feb 2011, Ingo Karkat wrote:
> 
>> Here are some rules and guidelines from my personal "Vim scripting guide":
> 
> Good information. I took your text, reworked it a little bit and put it 
> into the faqı It's question 20.20 and it should be in the web tomorrow 
> or the day after tomorrow. Please check.
> 
> ı) http://www.github.com/chrisbra/vim_faq
> and on the web at:
> http://vimhelp.appspot.com/vim_faq.txt.html

Hello Christian,

I'm glad you have found the information useful and have added it to the VIM FAQ.
Thanks for maintaining this FAQ; I guess I will find some good nuggets there.

So far, I've reviewed only the added question 20.20; here's my list of
corrections. (Excuse the plain diff; I'll fork and send a pull request in case I
find additional corrections.)

-- regards, ingo

#v+
--- vim_faq.txt.orig2011-02-09 15:24:31.798020200 +0100
+++ vim_faq.txt 2011-02-09 15:36:25.059282500 +0100
@@ -5122,7 +5122,7 @@
 From https://groups.google.com/group/vim_dev/msg/75f1f2dfc00908bb

 Not every normal mode-mapping is automatically suitable for execution via
- from within inser mode; you need to explicitly design your mappings
+ from within insert mode; you need to explicitly design your mappings
 for that purpose.

 The  command allows execution of one normal mode command from
@@ -5139,17 +5139,19 @@

 b) Concatenate multiple Ex commands via  on the rhs:

-   :nnoremap zC :call MyMap1()call MyMap2()
+   :nnoremap zC :call MyMap1()call MyMap2()

 c) Shadow normal mode mappings by insert mode mappings that
re-enter normal mode, then invoke the normal mode mapping:

-   :inoremap  

Re: ctrl-o with a mapping

2011-02-09 Thread Ingo Karkat
On 09-Feb-2011 12:14, Milan Vancura wrote:
>> Here are some rules and guidelines from my personal "Vim scripting guide":
> ...snip
>> -- regards, ingo
> 
> Hi Ingo.
> 
> Thank you for a very precise description. I must say there much of interesting
> even for ~15 years user of vim like me :-) However, it's quite hard to read,
> esp. as a FAQ entry. What about the following, wouldn't it be more readable 
> for
> beginners? Even I _know_ it is not the simplest or shortest solution for those
> who know all details and special characters:
> 
> ---
> Mapping in normal mode could be executed after Ctrl-O from insert mode as well
> but if there are more commands included in the mapping {rhs}, only the first
> one will be executed in normal mode and the rest of {rhs} will be printed
> literally in insert mode. One of ways to workaround this problem is to make
> {rhs} be one command, via wrapping it to the function. For example:
> 
> function GetFontNameOfFirstChar()
>   normal 0
>   echo getfontname()
> endfunction
> 
> :nmap  :call GetFontNameOfFirstChar()
> 
> For more solutions of this problem look here.
> ---

Hi Milan,

On the one hand I fully agree that this entry is too detailed; I wrote it as my
personal notes in case I would encounter this problem again in the far future,
and I wanted to have all the options at hand.

Your suggested entry perfectly captures the essence of the problem and a
possible solution. I am not sure whether an added function is always the best
way to solve the problem, though. It really depends on the kind of mappings that
one wants to combine.

I guess I'll leave it to Christian, the FAQ maintainer, to decide whether he
wants to keep the full details or replace it with your shorter suggestion and
the link to this archived entry on vim_dev.

-- regards, ingo

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


Patch 7.3.114

2011-02-09 Thread Bram Moolenaar

Patch 7.3.114
Problem:Potential problem in initialization when giving an error message
early.
Solution:   Initialize 'verbosefile' empty. (Ben Schmidt)
Files:  src/option.h


*** ../vim-7.3.113/src/option.h 2010-12-02 16:01:23.0 +0100
--- src/option.h2011-02-09 15:37:36.0 +0100
***
*** 854,860 
--- 854,864 
  # define VE_ONEMORE   8
  #endif
  EXTERN long   p_verbose;  /* 'verbose' */
+ #ifdef IN_OPTION_C
+ char_u*p_vfile = (char_u *)""; /* used before options are initialized 
*/
+ #else
  EXTERN char_u *p_vfile;   /* 'verbosefile' */
+ #endif
  EXTERN intp_warn; /* 'warn' */
  #ifdef FEAT_CMDL_COMPL
  EXTERN char_u *p_wop; /* 'wildoptions' */
*** ../vim-7.3.113/src/version.c2011-02-09 14:46:58.0 +0100
--- src/version.c   2011-02-09 15:46:17.0 +0100
***
*** 716,717 
--- 716,719 
  {   /* Add new patch number below this line */
+ /**/
+ 114,
  /**/

-- 
>From the classified section of a city newspaper:
Dog for sale: eats anything and is fond of children.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

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


Patch 7.3.115

2011-02-09 Thread Bram Moolenaar

Patch 7.3.115
Problem:Vim can crash when tmpnam() returns NULL.
Solution:   Check for NULL. (Hong Xu)
Files:  src/fileio.c


*** ../vim-7.3.114/src/fileio.c 2011-02-09 14:46:58.0 +0100
--- src/fileio.c2011-02-09 16:14:35.0 +0100
***
*** 7483,7490 
  # else /* WIN3264 */
  
  #  ifdef USE_TMPNAM
  /* tmpnam() will make its own name */
! if (*tmpnam((char *)itmp) == NUL)
return NULL;
  #  else
  char_u*p;
--- 7483,7493 
  # else /* WIN3264 */
  
  #  ifdef USE_TMPNAM
+ char_u*p;
+ 
  /* tmpnam() will make its own name */
! p = tmpnam((char *)itmp);
! if (p == NULL || *p == NUL)
return NULL;
  #  else
  char_u*p;
*** ../vim-7.3.114/src/version.c2011-02-09 15:59:32.0 +0100
--- src/version.c   2011-02-09 16:44:11.0 +0100
***
*** 716,717 
--- 716,719 
  {   /* Add new patch number below this line */
+ /**/
+ 115,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
218. Your spouse hands you a gift wrapped magnet with your PC's name
 on it and you accuse him or her of genocide.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

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


Patch 7.3.116

2011-02-09 Thread Bram Moolenaar

Patch 7.3.116
Problem:'cursorline' is displayed too short when there are concealed
characters and 'list' is set.  (Dennis Preiser)
Solution:   Check for 'cursorline' when 'list' is set. (Christian Brabandt)
Files:  src/screen.c


*** ../vim-7.3.115/src/screen.c 2011-02-01 18:01:06.0 +0100
--- src/screen.c2011-02-09 16:59:28.0 +0100
***
*** 5099,5105 
  #ifdef FEAT_DIFF
|| filler_todo > 0
  #endif
!   || (wp->w_p_list && lcs_eol != NUL && p_extra != at_end_str)
|| (n_extra != 0 && (c_extra != NUL || *p_extra != NUL)))
)
{
--- 5099,5109 
  #ifdef FEAT_DIFF
|| filler_todo > 0
  #endif
!   || (wp->w_p_list && lcs_eol != NUL && p_extra != at_end_str
! #ifdef FEAT_SYN_HL
!  && !wp->w_p_cul
! #endif
!   )
|| (n_extra != 0 && (c_extra != NUL || *p_extra != NUL)))
)
{
*** ../vim-7.3.115/src/version.c2011-02-09 16:44:45.0 +0100
--- src/version.c   2011-02-09 17:08:58.0 +0100
***
*** 716,717 
--- 716,719 
  {   /* Add new patch number below this line */
+ /**/
+ 116,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
219. Your spouse has his or her lawyer deliver the divorce papers...
 via e-mail.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

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


Patch 7.3.117

2011-02-09 Thread Bram Moolenaar

Patch 7.3.117
Problem:On some systems --as-needed does not work, because the "tinfo"
library is included indirectly from "ncurses". (Charles Campbell)
Solution:   In configure prefer using "tinfo" instead of "ncurses".
Files:  src/configure.in, src/auto/configure


*** ../vim-7.3.116/src/configure.in 2010-11-16 19:25:56.0 +0100
--- src/configure.in2011-02-09 17:28:16.0 +0100
***
*** 2618,2630 
AC_MSG_RESULT([empty: automatic terminal library selection])
dnl  On HP-UX 10.10 termcap or termlib should be used instead of
dnl  curses, because curses is much slower.
!   dnl  Newer versions of ncurses are preferred over anything.
dnl  Older versions of ncurses have bugs, get a new one!
dnl  Digital Unix (OSF1) should use curses (Ronald Schild).
dnl  On SCO Openserver should prefer termlib (Roger Cornelius).
case "`uname -s 2>/dev/null`" in
!   OSF1|SCO_SV)tlibs="ncurses curses termlib termcap";;
!   *)  tlibs="ncurses termlib termcap curses";;
esac
for libname in $tlibs; do
  AC_CHECK_LIB(${libname}, tgetent,,)
--- 2618,2631 
AC_MSG_RESULT([empty: automatic terminal library selection])
dnl  On HP-UX 10.10 termcap or termlib should be used instead of
dnl  curses, because curses is much slower.
!   dnl  Newer versions of ncurses are preferred over anything, except
!   dnl  when tinfo has been split off, it conains all we need.
dnl  Older versions of ncurses have bugs, get a new one!
dnl  Digital Unix (OSF1) should use curses (Ronald Schild).
dnl  On SCO Openserver should prefer termlib (Roger Cornelius).
case "`uname -s 2>/dev/null`" in
!   OSF1|SCO_SV)tlibs="tinfo ncurses curses termlib termcap";;
!   *)  tlibs="tinfo ncurses termlib termcap curses";;
esac
for libname in $tlibs; do
  AC_CHECK_LIB(${libname}, tgetent,,)
*** ../vim-7.3.116/src/auto/configure   2010-11-16 19:25:56.0 +0100
--- src/auto/configure  2011-02-09 17:29:13.0 +0100
***
*** 9886,9894 
  else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: empty: automatic terminal 
library selection" >&5
  $as_echo "empty: automatic terminal library selection" >&6; }
!   case "`uname -s 2>/dev/null`" in
!   OSF1|SCO_SV)tlibs="ncurses curses termlib termcap";;
!   *)  tlibs="ncurses termlib termcap curses";;
esac
for libname in $tlibs; do
  as_ac_Lib=`$as_echo "ac_cv_lib_${libname}''_tgetent" | $as_tr_sh`
--- 9886,9894 
  else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: empty: automatic terminal 
library selection" >&5
  $as_echo "empty: automatic terminal library selection" >&6; }
! case "`uname -s 2>/dev/null`" in
!   OSF1|SCO_SV)tlibs="tinfo ncurses curses termlib termcap";;
!   *)  tlibs="tinfo ncurses termlib termcap curses";;
esac
for libname in $tlibs; do
  as_ac_Lib=`$as_echo "ac_cv_lib_${libname}''_tgetent" | $as_tr_sh`
*** ../vim-7.3.116/src/version.c2011-02-09 17:09:26.0 +0100
--- src/version.c   2011-02-09 17:41:37.0 +0100
***
*** 716,717 
--- 716,719 
  {   /* Add new patch number below this line */
+ /**/
+ 117,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
220. Your wife asks for sex and you tell her where to find you on IRC.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
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: Patch 7.3.117

2011-02-09 Thread Charles Campbell

Bram Moolenaar wrote:

Patch 7.3.117
Problem:On some systems --as-needed does not work, because the "tinfo"
library is included indirectly from "ncurses". (Charles Campbell)
Solution:   In configure prefer using "tinfo" instead of "ncurses".
Files:  src/configure.in, src/auto/configure
   

Thank you, Bram!

FIrst, this patch does work (at least on my centos 5.2 system).  I was 
compiling vim without patch#50 heretofore.  Glad I won't have to hang 
onto patch#50 and "unpatch" vim 7.4 whenever it comes!


Regards,
Chip Campbell

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


tr() problem ?

2011-02-09 Thread Dimitar DIMITROV
Hi,

I wonder why the below works:

command! Translate call setline(line('.'), tr(getline('.'),
   \'ABVGDEWZIJK',
   \'АБВГДЕЖЗИЙК'))

then :Translate on any line

But this doesn't:

command! Translate call setline(line('.'), tr(getline('.'),
   \'ABVGDEWZIJKLMNOPRSTUYFHXC$^&}{!|Qabvgdewzijklmnoprstuyfhxc467][1\q',
   \'АБВГДЕЖЗИЙКЛМНОПРСТУYФХXЦЧШЩЪЬЮЮЯабвгдежзийклмнопрстуyфхxцчшщъьююя'))

then :Translate on any line

The error is:
E475: Invalid argument: 
ABVGDEWZIJKLMNOPRSTUYFHXC$^&}{!|Qabvgdewzijklmnoprstuyfhxc467][1\q

Tested with gVim 7.3.107



  

-- 
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: ctrl-o with a mapping

2011-02-09 Thread Milan Vancura
> Your suggested entry perfectly captures the essence of the problem and a
> possible solution. I am not sure whether an added function is always the best
> way to solve the problem, though. It really depends on the kind of mappings 
> that
> one wants to combine.

Hi Ingo,

I think your list is much better from the technical point of view - and thanks
for it! I saved it for my purposes, too. I just wanted to write something
shorter and easier to read as this should go to FAQ - to not discourage the
reader. In practice, your solutions are faster to do if one understands the
background - this is why I suggested to link them at the end of the answer,
too.

We'll see what does Christian do with our texts :-)

Thanks once again for your help-text, it was usable even for ~15 years user of
vim like me,

Milan

BTW: Do you know the example with echo does not work as user expect? Because
the output is immediately overwritten with "--INSERT--" - so it's questionable
if this example is good to mention in FAQ, probably not...

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


Patch 7.3.118

2011-02-09 Thread Bram Moolenaar

Patch 7.3.118
Problem:Ruby uses SIGVTALARM which makes Vim exit. (Alec Tica)
Solution:   Ignore SIGVTALARM. (Dominique Pelle)
Files:  src/os_unix.c


*** ../vim-7.3.117/src/os_unix.c2010-12-17 16:27:10.0 +0100
--- src/os_unix.c   2011-02-09 18:19:57.0 +0100
***
*** 283,289 
  #ifdef SIGTERM
  {SIGTERM, "TERM", TRUE},
  #endif
! #ifdef SIGVTALRM
  {SIGVTALRM,   "VTALRM",   TRUE},
  #endif
  #if defined(SIGPROF) && !defined(FEAT_MZSCHEME) && !defined(WE_ARE_PROFILING)
--- 283,289 
  #ifdef SIGTERM
  {SIGTERM, "TERM", TRUE},
  #endif
! #if defined(SIGVTALRM) && !defined(FEAT_RUBY)
  {SIGVTALRM,   "VTALRM",   TRUE},
  #endif
  #if defined(SIGPROF) && !defined(FEAT_MZSCHEME) && !defined(WE_ARE_PROFILING)
***
*** 1107,1113 
   * On Linux, signal is not always handled immediately either.
   * See https://bugs.launchpad.net/bugs/291373
   *
!  * volatile because it is used in in signal handler sigcont_handler().
   */
  static volatile int sigcont_received;
  static RETSIGTYPE sigcont_handler __ARGS(SIGPROTOARG);
--- 1107,1113 
   * On Linux, signal is not always handled immediately either.
   * See https://bugs.launchpad.net/bugs/291373
   *
!  * volatile because it is used in signal handler sigcont_handler().
   */
  static volatile int sigcont_received;
  static RETSIGTYPE sigcont_handler __ARGS(SIGPROTOARG);
*** ../vim-7.3.117/src/version.c2011-02-09 17:42:53.0 +0100
--- src/version.c   2011-02-09 18:46:53.0 +0100
***
*** 716,717 
--- 716,719 
  {   /* Add new patch number below this line */
+ /**/
+ 118,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
221. Your wife melts your keyboard in the oven.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
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: vim crash

2011-02-09 Thread Christian Brabandt
Hi Bram!

On Mi, 09 Feb 2011, Bram Moolenaar wrote:

> I can't reproduce it.  The MyTabLine() function is missing.  Also, you
> need to start vim with "-u NONE" to exclude all kinds of other stuff.
> 
> And make sure you run the latest Vim, including patch 7.3.112.
> The line numbers in your valgrind output don't match my source, please
> quote the actual source lines.
> 
> I also tried the instructions in your other message, didn't work either.

Sorry, I don't know what is wrong then. All I do, I described in 
Message-ID: <20110202213533.gc8...@256bit.org>
I don't know how to provide more useful information than that:

:version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Feb  9 2011 19:14:18)
Included patches: 1-118
Compiled by chrisbra@r500vm
Huge 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: "/home/chrisbra/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/
include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include
/cairo -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/pixm
an-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I
/usr/lib/glib-2.0/include -g -O2 -D_FORTIFY_SOURCE=1
Linking: gcc   -L/usr/local/lib -Wl,--as-needed -o vim   -pthread -lgtk-x11-2.0
-lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lc
airo -lgio-2.0 -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -
lgthread-2.0 -lrt -lglib-2.0   -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -l
m -lncurses -lnsl  -lselinux -lacl -lattr -lgpm

System:
Linux r500vm 2.6.32-5-686 #1 SMP Fri Dec 10 16:12:40 UTC 2010 i686 GNU/Linux
(Debian Squeeze in a vmware)

gcc (Debian 4.4.5-8) 4.4.5
Copyright (C) 2010 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.

nterestingly, I get two different results, when running from gdb:
1) when compiling with DEBUG:
(gdb) bt
#0  0x08057ccf in build_stl_str_hl (wp=0x8219808,
out=0xbfffd8e0 " 2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18 
 19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38 
 39  40  41  42  43  44  45  46  47  48  49  50  51 abLabel("..., outlen=4096,
fmt=0x8270c98 "%!MyTabLine()", use_sandbox=0, fillchar=32, maxwidth=80,
hltab=0xbfffeb60, tabtab=0xbfffe8e0) at buffer.c:3470
#1  0x08158f2c in win_redr_custom (wp=0x0, draw_ruler=)
at screen.c:6531
#2  0x0815a51e in draw_tabline () at screen.c:9713
#3  0x08166615 in update_screen (type=40) at screen.c:465
#4  0x080e49f5 in main_loop (cmdwin=0, noexmode=0) at main.c:1161
#5  0x080e7d75 in main (argc=75, argv=0xb174) at main.c:961


2) when compiling without DEBUG:
Program received signal SIGSEGV, Segmentation fault.
build_stl_str_hl (wp=0x821a808,
out=0xbfffd8e0 " 2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18 
 19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38 
 39  40  41  42  43  44  45  46  47  48  49  50  51  52  53 "..., outlen=4096,
fmt=0x8271c98 "%!MyTabLine()", use_sandbox=0, fillchar=32, maxwidth=80,
---Type  to continue, or q  to quit---
hltab=0xbfffeb60, tabtab=0xbfffe8e0) at buffer.c:3461
3461for (s = usefmt; *s; )
(gdb) bt
#0  build_stl_str_hl (wp=0x821a808,
out=0xbfffd8e0 " 2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18 
 19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38 
 39  4

Re: tr() problem ?

2011-02-09 Thread James Vega
On Wed, Feb 9, 2011 at 12:04 PM, Dimitar DIMITROV  wrote:
> But this doesn't:
>
> command! Translate call setline(line('.'), tr(getline('.'),
>    \'ABVGDEWZIJKLMNOPRSTUYFHXC$^&}{!|Qabvgdewzijklmnoprstuyfhxc467][1\q',
>    \'АБВГДЕЖЗИЙКЛМНОПРСТУYФХXЦЧШЩЪЬЮЮЯабвгдежзийклмнопрстуyфхxцчшщъьююя'))
>
> then :Translate on any line
>
> The error is:
> E475: Invalid argument:
> ABVGDEWZIJKLMNOPRSTUYFHXC$^&}{!|Qabvgdewzijklmnoprstuyfhxc467][1\q

This has something to do with how Vim is storing the U+0440 character
(which breaks down to \xd1\x80) in the "to" string.  A minimal
reproduction can be done with this simplified version:

  command! Translate echo tr(getline('.'), 'r', 'р')

and then use Translate with your cursor on the line defining the
command.

In fact, if you use the following erroneous version of the command, the
error string that Vim prints when you try to use :Translate will show
that the U+0440 character has been corrupted:

  command! Translate echo tr(getline('.'), 'r', \'p')

I end up getting: E15: Invalid expression: \'рX')

Everything works fine if the command is defined using "\u0440" instead
of the literal character.

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega 

-- 
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: Hex viewer/editor with vim

2011-02-09 Thread Peter de Ridder
On Wed, Feb 9, 2011 at 4:10 AM, Bee  wrote:
>
> Editing in vim is difficult, so I chose to edit in vim style:
>
> http://bvi.sourceforge.net/
>
> I have compiled this for linux and mac, works well.
>
> -Bill

I didn't know that one yet. That is one of the few hex editor which
has support for inserting tekst in an easy way. I see there is a
cygwin verion but no windows version.

So to clarify my motivations, a bit further, for patching vim:
I would like to be able to use it on windows too. So a benefit of vim
is the support for large files with inserting and a wide range of
platform support.
Editing in vim isn't as dedicated to hex editing as bvi and it is not
my intention to make it that way. But scripts could easy the way of
hex editing.
Also at times, I like to see a file, I'm editing, in hex, so it would
be easy to use the same editor for that.

If you do a lot of hex editing/manipulations bvi seems like a nice
editor. And I don't think my patches will replace it.

regards,
Peter

-- 
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: Hex viewer/editor with vim

2011-02-09 Thread Peter de Ridder
On Wed, Feb 9, 2011 at 11:00 AM, Xavier Wang  wrote:
>
> thank you for you patch! I desired editing hex text in Vim in a long time.
> hex-columnview.patch can't compile in VC2008, you add preprocessing routine
> within a macro, and VC can not hand this.
> change all
> RET_WIN_BUF_CHARTABSIZE(curwin, curbuf, s, col
> #ifdef FEAT_HEX
> , sep
> #endif
> )
> like macro to:
> # ifndef FEAT_HEX
>         RET_WIN_BUF_CHARTABSIZE(curwin, curbuf, s, col)
> # else
>         RET_WIN_BUF_CHARTABSIZE(curwin, curbuf, s, col, sep)
> # endif
> may resolve this problem.
> but when I set columnview, Vim behaves strange. it usually only show one or
> two line of text, and the nest of line are "@", I don't know why it happens.
> and, maybe you can close the syntax highlights or add new highlights groups.
> and, how to show the original text after the hex text, so as in a normal hex
> editor?

I'll take that suggestion for the define in mind.

The columnview patch is very experimental. I noticed that strange
behaviour too. It seems to be related to line numbering being enabled.
I think I started in the wrong direction with this patch. So I'll
start over and try to base my code on how 'linebreak' works.

The settings for 'displaymode' and 'hexnumber' are pretty straight
forward. But the 'columnview' setting is a bit more difficult. For
example the 'wrap' setting must be enabled. I require that for now
because of the way I implemented the line breaking. I wonder if it
makes sense to keep this or to see if the 'columnview' implementation
should work around the 'wrap' mode. I hope the rest of the
'columnview' setting makes sense.
If I remove the dependency of 'columnview' to 'wrap' I could see
'columnview' be used like 'textwidth' so the line wrapping can be
setup independent of the window width.

Regards,
Peter

-- 
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: vim crash

2011-02-09 Thread Bram Moolenaar

Christian Brabandt wrote:

> On Mi, 09 Feb 2011, Bram Moolenaar wrote:
> 
> > I can't reproduce it.  The MyTabLine() function is missing.  Also, you
> > need to start vim with "-u NONE" to exclude all kinds of other stuff.
> > 
> > And make sure you run the latest Vim, including patch 7.3.112.
> > The line numbers in your valgrind output don't match my source, please
> > quote the actual source lines.
> > 
> > I also tried the instructions in your other message, didn't work either.
> 
> Sorry, I don't know what is wrong then. All I do, I described in 
> Message-ID: <20110202213533.gc8...@256bit.org>
> I don't know how to provide more useful information than that:
> 
> :version
> VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Feb  9 2011 19:14:18)
> Included patches: 1-118
> Compiled by chrisbra@r500vm
> Huge 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: "/home/chrisbra/local/share/vim"
> Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread 
> -I/usr/
> include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 
> -I/usr/include
> /cairo -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ 
> -I/usr/include/pixm
> an-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/glib-2.0 
> -I
> /usr/lib/glib-2.0/include -g -O2 -D_FORTIFY_SOURCE=1
> Linking: gcc   -L/usr/local/lib -Wl,--as-needed -o vim   -pthread 
> -lgtk-x11-2.0
> -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 
> -lc
> airo -lgio-2.0 -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 
> -lgmodule-2.0 -
> lgthread-2.0 -lrt -lglib-2.0   -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE 
> -l
> m -lncurses -lnsl  -lselinux -lacl -lattr -lgpm
> 
> System:
> Linux r500vm 2.6.32-5-686 #1 SMP Fri Dec 10 16:12:40 UTC 2010 i686 GNU/Linux
> (Debian Squeeze in a vmware)
> 
> gcc (Debian 4.4.5-8) 4.4.5
> Copyright (C) 2010 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.
> 
> nterestingly, I get two different results, when running from gdb:
> 1) when compiling with DEBUG:
> (gdb) bt
> #0  0x08057ccf in build_stl_str_hl (wp=0x8219808,
> out=0xbfffd8e0 " 2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  
> 18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  
> 37  38  39  40  41  42  43  44  45  46  47  48  49  50  51 abLabel("..., 
> outlen=4096,
> fmt=0x8270c98 "%!MyTabLine()", use_sandbox=0, fillchar=32, maxwidth=80,
> hltab=0xbfffeb60, tabtab=0xbfffe8e0) at buffer.c:3470
> #1  0x08158f2c in win_redr_custom (wp=0x0, draw_ruler=)
> at screen.c:6531
> #2  0x0815a51e in draw_tabline () at screen.c:9713
> #3  0x08166615 in update_screen (type=40) at screen.c:465
> #4  0x080e49f5 in main_loop (cmdwin=0, noexmode=0) at main.c:1161
> #5  0x080e7d75 in main (argc=75, argv=0xb174) at main.c:961
> 
> 
> 2) when compiling without DEBUG:
> Program received signal SIGSEGV, Segmentation fault.
> build_stl_str_hl (wp=0x821a808,
> out=0xbfffd8e0 " 2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  
> 18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  
> 37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53 "..., 
> outlen=4096,
> fmt=0x8271c98 "%!MyTabLine()", use_sandbox=0, fillchar=32, maxwidth=80,
> ---Type  to continue, or q  to quit---
> hltab=0xbfffeb60, tabtab=0xbfffe8e0) at buffer.c:3461
> 3461for (

Issue with bundled plugin (htmlcomplete)

2011-02-09 Thread Alfredo Deza
Hi,

I am not sure how to deal with this issue (I will copy paste the original
report for readability):

*What steps will reproduce the problem?*
1. Create an html tag that htmlcomplete registers as a cssfile, but
isn't readable (ex: )
2. Attempt to insert/edit inside the line.
*What is the expected output? What do you see instead?*
Any relevant autocomplete information or nothing. Instead, you get
'Error detected while processing function htmlcomplete#CompleteTags,
undefined variable: classlines'.
*Please use labels and text to provide additional information.*

The fix is to move lines 309-310 (" We gathered classes definitions
from all external...") before the endif on 308.

--o--

So I went ahead and did that, and the problem went away.

Since this is a plugin that is bundled with VIM (as of 7.3 it can be
found there) I suggested in the MacVim issue list (where the bug was
reported) but the maintainer told me to contact the plugin author
directly.

And I did.

But I have not received any answers at all.

So I am not sure if I should report this as a VIM bug (since it is
bundled with VIM) or continue to pester theplugin author that doesn't
address the issue.

What can I do to help out and properly report this (and get it fixed) ?

Thanks

- Original Reported issue: http://code.google.com/p/macvim/issues/detail?id=285

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


Select Tab by Index

2011-02-09 Thread Vikas Yendluri
Vim tabs are awesome; is there any work planned to allow selection of
tab by index (i.e. :tab0 would switch to the 0th tab, etc.).

-- 
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: Select Tab by Index

2011-02-09 Thread Lech Lorens
On 09-Feb-2011 Vikas Yendluri  wrote:
> Vim tabs are awesome; is there any work planned to allow selection of
> tab by index (i.e. :tab0 would switch to the 0th tab, etc.).

You can do this by using the normal-mode command gt:
1gt

or from the command line:

:normal 1gt


-- 
Cheers,
Lech

-- 
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: Select Tab by Index

2011-02-09 Thread Erik Falor
On Wed, Feb 09, 2011 at 11:57:17AM -0800, Vikas Yendluri wrote:
> Vim tabs are awesome; is there any work planned to allow selection of
> tab by index (i.e. :tab0 would switch to the 0th tab, etc.).

You can supply a count to the gt command to jump directly to the nth
tab.

-- 
Erik Falor
Registered Linux User #445632 http://counter.li.org


pgp7MRrj6vv0d.pgp
Description: PGP signature


Re: Select Tab by Index

2011-02-09 Thread Erik Falor
On Wed, Feb 09, 2011 at 10:31:31PM +0100, Lech Lorens wrote:
> On 09-Feb-2011 Vikas Yendluri  wrote:
> > Vim tabs are awesome; is there any work planned to allow selection of
> > tab by index (i.e. :tab0 would switch to the 0th tab, etc.).
> 
> You can do this by using the normal-mode command gt:
> 1gt
> 
> or from the command line:
> 
> :normal 1gt

The command you're actually looking for is :tabn[ext]

If you think Vim's tabs are awesome, you'll probably get a lot out of
the online help for tabpages:

:help tabpage

-- 
Erik Falor
Registered Linux User #445632 http://counter.li.org


pgpw7LR87Qbhi.pgp
Description: PGP signature


Re: vim crash

2011-02-09 Thread Christian Brabandt
Hi Bram!

On Mi, 09 Feb 2011, Bram Moolenaar wrote:

> 
> Christian Brabandt wrote:
> 
> > On Mi, 09 Feb 2011, Bram Moolenaar wrote:
> > 
> > > I can't reproduce it.  The MyTabLine() function is missing.  Also, you
> > > need to start vim with "-u NONE" to exclude all kinds of other stuff.
> > > 
> > > And make sure you run the latest Vim, including patch 7.3.112.
> > > The line numbers in your valgrind output don't match my source, please
> > > quote the actual source lines.
> > > 
> > > I also tried the instructions in your other message, didn't work either.
> > 
> > Sorry, I don't know what is wrong then. All I do, I described in 
> > Message-ID: <20110202213533.gc8...@256bit.org>
> > I don't know how to provide more useful information than that:
> > 
> > :version
> > VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Feb  9 2011 19:14:18)
> > Included patches: 1-118
> > Compiled by chrisbra@r500vm
> > Huge 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: "/home/chrisbra/local/share/vim"
> > Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread 
> > -I/usr/
> > include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 
> > -I/usr/include
> > /cairo -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ 
> > -I/usr/include/pixm
> > an-1 -I/usr/include/freetype2 -I/usr/include/libpng12 
> > -I/usr/include/glib-2.0 -I
> > /usr/lib/glib-2.0/include -g -O2 -D_FORTIFY_SOURCE=1
> > Linking: gcc   -L/usr/local/lib -Wl,--as-needed -o vim   -pthread 
> > -lgtk-x11-2.0
> > -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lm 
> > -lpangocairo-1.0 -lc
> > airo -lgio-2.0 -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 
> > -lgmodule-2.0 -
> > lgthread-2.0 -lrt -lglib-2.0   -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM 
> > -lICE -l
> > m -lncurses -lnsl  -lselinux -lacl -lattr -lgpm
> > 
> > System:
> > Linux r500vm 2.6.32-5-686 #1 SMP Fri Dec 10 16:12:40 UTC 2010 i686 GNU/Linux
> > (Debian Squeeze in a vmware)
> > 
> > gcc (Debian 4.4.5-8) 4.4.5
> > Copyright (C) 2010 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.
> > 
> > nterestingly, I get two different results, when running from gdb:
> > 1) when compiling with DEBUG:
> > (gdb) bt
> > #0  0x08057ccf in build_stl_str_hl (wp=0x8219808,
> > out=0xbfffd8e0 " 2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17 
> >  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36 
> >  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51 abLabel("..., 
> > outlen=4096,
> > fmt=0x8270c98 "%!MyTabLine()", use_sandbox=0, fillchar=32, maxwidth=80,
> > hltab=0xbfffeb60, tabtab=0xbfffe8e0) at buffer.c:3470
> > #1  0x08158f2c in win_redr_custom (wp=0x0, draw_ruler=)
> > at screen.c:6531
> > #2  0x0815a51e in draw_tabline () at screen.c:9713
> > #3  0x08166615 in update_screen (type=40) at screen.c:465
> > #4  0x080e49f5 in main_loop (cmdwin=0, noexmode=0) at main.c:1161
> > #5  0x080e7d75 in main (argc=75, argv=0xb174) at main.c:961
> > 
> > 
> > 2) when compiling without DEBUG:
> > Program received signal SIGSEGV, Segmentation fault.
> > build_stl_str_hl (wp=0x821a808,
> > out=0xbfffd8e0 " 2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17 
> >  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36 
> >  37  38  39 

Re: Hex viewer/editor with vim

2011-02-09 Thread Bee


On Feb 9, 11:29 am, Peter de Ridder  wrote:
> On Wed, Feb 9, 2011 at 4:10 AM, Bee  wrote:
>
> > Editing in vim is difficult, so I chose to edit in vim style:
>
> >http://bvi.sourceforge.net/
>
> > I have compiled this for linux and mac, works well.
>
> > -Bill
>
> I didn't know that one yet. That is one of the few hex editor which
> has support for inserting tekst in an easy way. I see there is a
> cygwin verion but no windows version.
>
> So to clarify my motivations, a bit further, for patching vim:
> I would like to be able to use it on windows too. So a benefit of vim
> is the support for large files with inserting and a wide range of
> platform support.
> Editing in vim isn't as dedicated to hex editing as bvi and it is not
> my intention to make it that way. But scripts could easy the way of
> hex editing.
> Also at times, I like to see a file, I'm editing, in hex, so it would
> be easy to use the same editor for that.
>
> If you do a lot of hex editing/manipulations bvi seems like a nice
> editor. And I don't think my patches will replace it.
>
> regards,
> Peter

I would also like to have hex editing in vim and on all platforms that
I work. But at this point vim is not so good for hex editing.

If/until vim is a good hex editor... on Linux and Mac I use bvi, on
Windows I use HxD.


-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: Patch 7.3.117 (typo in configure message)

2011-02-09 Thread Tony Mechelynck

On 09/02/11 17:43, Bram Moolenaar wrote:


Patch 7.3.117
Problem:On some systems --as-needed does not work, because the "tinfo"
library is included indirectly from "ncurses". (Charles Campbell)
Solution:   In configure prefer using "tinfo" instead of "ncurses".
Files:  src/configure.in, src/auto/configure


*** ../vim-7.3.116/src/configure.in 2010-11-16 19:25:56.0 +0100
--- src/configure.in2011-02-09 17:28:16.0 +0100
***
*** 2618,2630 
 AC_MSG_RESULT([empty: automatic terminal library selection])
 dnl  On HP-UX 10.10 termcap or termlib should be used instead of
 dnl  curses, because curses is much slower.
!   dnl  Newer versions of ncurses are preferred over anything.
 dnl  Older versions of ncurses have bugs, get a new one!
 dnl  Digital Unix (OSF1) should use curses (Ronald Schild).
 dnl  On SCO Openserver should prefer termlib (Roger Cornelius).
 case "`uname -s 2>/dev/null`" in
!   OSF1|SCO_SV)tlibs="ncurses curses termlib termcap";;
!   *)  tlibs="ncurses termlib termcap curses";;
 esac
 for libname in $tlibs; do
   AC_CHECK_LIB(${libname}, tgetent,,)
--- 2618,2631 
 AC_MSG_RESULT([empty: automatic terminal library selection])
 dnl  On HP-UX 10.10 termcap or termlib should be used instead of
 dnl  curses, because curses is much slower.
!   dnl  Newer versions of ncurses are preferred over anything, except
!   dnl  when tinfo has been split off, it conains all we need.


^
should be: contains


 dnl  Older versions of ncurses have bugs, get a new one!
 dnl  Digital Unix (OSF1) should use curses (Ronald Schild).
 dnl  On SCO Openserver should prefer termlib (Roger Cornelius).
 case "`uname -s 2>/dev/null`" in
!   OSF1|SCO_SV)tlibs="tinfo ncurses curses termlib termcap";;
!   *)  tlibs="tinfo ncurses termlib termcap curses";;
 esac
 for libname in $tlibs; do
   AC_CHECK_LIB(${libname}, tgetent,,)
*** ../vim-7.3.116/src/auto/configure   2010-11-16 19:25:56.0 +0100
--- src/auto/configure  2011-02-09 17:29:13.0 +0100

[...]

Best regards,
Tony.
--
Too much of everything is just enough.
-- Bob Wier

--
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: Hex viewer/editor with vim

2011-02-09 Thread Xavier Wang
2011/2/10 Peter de Ridder 

> On Wed, Feb 9, 2011 at 11:00 AM, Xavier Wang  wrote:
> >
> > thank you for you patch! I desired editing hex text in Vim in a long
> time.
> > hex-columnview.patch can't compile in VC2008, you add preprocessing
> routine
> > within a macro, and VC can not hand this.
> > change all
> > RET_WIN_BUF_CHARTABSIZE(curwin, curbuf, s, col
> > #ifdef FEAT_HEX
> > , sep
> > #endif
> > )
> > like macro to:
> > # ifndef FEAT_HEX
> > RET_WIN_BUF_CHARTABSIZE(curwin, curbuf, s, col)
> > # else
> > RET_WIN_BUF_CHARTABSIZE(curwin, curbuf, s, col, sep)
> > # endif
> > may resolve this problem.
> > but when I set columnview, Vim behaves strange. it usually only show one
> or
> > two line of text, and the nest of line are "@", I don't know why it
> happens.
> > and, maybe you can close the syntax highlights or add new highlights
> groups.
> > and, how to show the original text after the hex text, so as in a normal
> hex
> > editor?
>
> I'll take that suggestion for the define in mind.
>
> The columnview patch is very experimental. I noticed that strange
> behaviour too. It seems to be related to line numbering being enabled.
> I think I started in the wrong direction with this patch. So I'll
> start over and try to base my code on how 'linebreak' works.
>
> The settings for 'displaymode' and 'hexnumber' are pretty straight
> forward. But the 'columnview' setting is a bit more difficult. For
> example the 'wrap' setting must be enabled. I require that for now
> because of the way I implemented the line breaking. I wonder if it
> makes sense to keep this or to see if the 'columnview' implementation
> should work around the 'wrap' mode. I hope the rest of the
> 'columnview' setting makes sense.
> If I remove the dependency of 'columnview' to 'wrap' I could see
> 'columnview' be used like 'textwidth' so the line wrapping can be
> setup independent of the window width.
>
> Regards,
> Peter
>
> --
> 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
>

the problem is Vim haven't a good abstract paint layer. has anybody
try to refactoring
the render engine of Vim?

now win_line function in screen.c has 2670 loc, if Vim can split render info
several different module:

memline -> layout -> symtax -> show

 then we can replace some of these module to make Vim more flexible, e.g.
hex editing.

but the first difficult task is to refactoring Vim, it does need
a experienced expert...

-- 
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: Hex viewer/editor with vim

2011-02-09 Thread Tony Mechelynck

On 09/02/11 02:34, James Vega wrote:

On Wed, Feb 09, 2011 at 01:45:23AM +0100, Tony Mechelynck wrote:

On 08/02/11 23:25, Peter de Ridder wrote:

Using vim do edit binary files isn't always that easy. With
display+=uhex you can make unprintable characters show as hex, but the
printable characters are still shown as normal characters. Using xxd
so convert a file to hex gives a nice view of the file in both hex and
printable characters. But editing is still a bit difficult even with
hex editing helper scripts. e.g. insering or removing data isn't easy
since all the xxd offsets number need to be renumbered.


Maybe you don't need to reinvent the wheel: see :help hex-editing


He addressed that in the first paragraph.



Oops! «Les pièges de la lecture rapide» (The pitfalls of fast reading). 
My bad.



Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
20. When looking at a pageful of someone else's links, you notice all of 
them

are already highlighted in purple.

--
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: Hex viewer/editor with vim

2011-02-09 Thread Tony Mechelynck

On 08/02/11 23:25, Peter de Ridder wrote:

Hi,

Using vim do edit binary files isn't always that easy. With
display+=uhex you can make unprintable characters show as hex, but the
printable characters are still shown as normal characters. Using xxd
so convert a file to hex gives a nice view of the file in both hex and
printable characters. But editing is still a bit difficult even with
hex editing helper scripts. e.g. insering or removing data isn't easy
since all the xxd offsets number need to be renumbered.

To make it easier for hex editing in vim I try the split hex editing
in different parts which could be added to vim and be setup with a
command e.g. :hexthis (like :diffthis for diffing). The parts I came
up with are:
- Show all characters (printable or unprintable) as hex.
- Show unprintable characters as a dot.
- Number lines with byte offsets.
- Columnize every x bytes.
- Enter characters as hex.
- Join lines over eol and make eol editable as if it was a character.
- Other features like vsplit and scrollbind are already present.

I know some if these options can be either impossible or to hard to be
reasonable but I put them in the list to be complete.
I started on implementing a few of the parts. I added preliminary
patches for them.

I'm providing the preliminary patches so other people can test them,
tell what is missing, give pointers in to right direction or provide
ideas on further improvements. I'm interested in using these feature
myself maybe others are interested too and maybe these can become part
of the newer versions of vim, when completed.

I'll explain the different parts a bit further:
- Show all characters (printable or unprintable) as hex.
Preliminary patch: hex-displaymode.patch
A per window setting to display all characters as hex, making all
characters 2 display cells wide. This can be used as main hex editing
window. Like the hex data part of xxd. The patch adds window option
'displaymode'='hex'.
- Show unprintable characters as a dot.
Preliminary patch: hex-displaymode.patch
A per window setting to display all unprintable characters as dots,
making all characters 1 display cell wide. This way this can be setup
with scrollbinding to the main hex editing window and have half the
width. Since the main window will have characters of 2 wide and this
window will have characters of 1 wide, so the wrapping and such will
match and scrollbinding can be used. This setting is like the right
printable character side of xxd. The patch adds window option
'displaymode'='dot'.
- Number lines with byte offsets.
Preliminary patch: hex-hexnumber.patch
A setting like 'number' and the recent 'relativenumber' but instead of
line number it shows line byte offsets. The +byte_offset feature
provides the internals for this. Line the first column if xxd. The
patch adds window option 'hexnumber'.
- Columnize every x bytes.
Experimental patch: hex-columnview.patch
Columnize characters in groups of x bytes or multiple groups. And
break a line at x bytes neither by inserting eol or dependant on the
window width. Gives a better for of data in (mostly) the
'displaymode'='hex' window. The patch adds
'columnview'={break},{count},{count},... ('columnize' might be a
better name?)
- Enter characters as hex.
Type only [0-9a-fA-F] to enter data. This could be handled by a script
and doesn't need to be part of the c code base.
- Join lines over eol and make eol editable as if it was a character.
Make the eol act like it as a normal character and let the line breaks
be fully handled by either 'wrap' or 'columnview'. As for now I don't
see any option in vim which does something similar and it seems very
hard to me if not impossible without breaking the core structure. I
could also live without this part since the other parts would be a
good enough improvement already. vim is still a text editor and not a
full featured hex editor.

Patches:
hex-displaymode.patch: Base patch adding the +hex feature and the
'displaymode' window option. This should work on vim7.3 (It is based
on 7.3-112).
hex-hexnumber.patch: Aditional patch to add 'hexnumber' window option.
hex-displaymode.patch needs to be applied.
hex-columnview.patch: Aditional patch adding experimental window
option 'columnview', this is know to break. hex-hexnumber.patch needs
to be applied. I might have started in the wrong direction with this
implementation, so I might need to start over with this one.

Regards,
Peter


IIUC, when 'encoding' is "utf-8" and you are entering characters as hex, 
you would have to type E4B880, not 4E00, for the Chinese horizontal-bar 
number one (一 U+4E00, one character, three bytes), and F0A08480, not 
20100 or 00020100, for the "additional Chinese character" 𠄀 (U+20100, 
one character, four bytes)? Similarly for *any* character above U+007F 
when 'encoding' is set to "utf-8"? For instance, E9 when 'encoding' is 
latin1, but C3A9 when it is utf-8, for the lowercase e-acute, é, U+00E9, 
the most frequent accented letter in the French 

Re: Hex viewer/editor with vim

2011-02-09 Thread Ben Fritz


On Feb 8, 4:25 pm, Peter de Ridder  wrote:
> Hi,
>
> Using vim do edit binary files isn't always that easy. With
> display+=uhex you can make unprintable characters show as hex, but the
> printable characters are still shown as normal characters. Using xxd
> so convert a file to hex gives a nice view of the file in both hex and
> printable characters. But editing is still a bit difficult even with
> hex editing helper scripts. e.g. insering or removing data isn't easy
> since all the xxd offsets number need to be renumbered.
>

I noticed the other day that XXD has an option to do a raw dump or
convert back from one, without using offsets. This should in theory
allow easy insertion/deletion. I have toyed with the idea of tweaking
my hex-edit autocmds to use just %!xxd to convert TO hex  mode, but
then strip off the addresses after conversion. Then to restore,
additionally strip off the ASCII view and use the xxd option which
only works with raw bytes.

Just some random thoughts, I don't have any opinion on your patches as
of yet.

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


Doc bug in options.txt for 'statusline' items %b and %B

2011-02-09 Thread Tony Mechelynck
In a custom 'statusline', items %b or %B mean the current character, not 
necessarily the current byte. For instance, if 'encoding' is UTF-8, the 
status line string


U+%04B

will display the Unicode codepoint under the cursor according to the 
usual conventions: U+ 4 hex digits in the BMP (U+ to U+), or U+ 
as many hex digits as necessary (normally 5 or 6) outside the BMP (i.e. 
U+1 and higher — the Unicode Consortium currently allows codepoints 
up to U+10FFFD, where U+F and higher, among others, are "for private 
use"; Vim allows codepoints up to U+7FFF). Similarly with lowercase 
b but in decimal (I just checked them both).


See the attached proposed patch to options.txt. This patch was 
constructed according to the "traditional Vim" patching conventions (to 
apply it, start at the parent of runtime/ src/ etc., patch using -p0, 
and non-unified context diff) rather than "Mercurial" patching 
conventions (start at the same point but patch using -p1, and unified 
context diff).


I *think* that transmission via email will have converted all ends of 
lines to "dos-style" (CR+LF rather than my usual "unix-style" LF) but 
I'm not 100% sure.



Best regards,
Tony.
--
I gave up Smoking, Drinking and Sex.  It was the most *horrifying* 20
minutes of my life!

--
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
*** ../vim73/runtime/doc/options.txt	2011-02-09 21:05:33.0 +0100
--- runtime/doc/options.txt	2011-02-10 05:45:09.0 +0100
***
*** 1,4 
! *options.txt*	For Vim version 7.3.  Last change: 2011 Jan 30
  
  
  		  VIM REFERENCE MANUAL	  by Bram Moolenaar
--- 1,4 
! *options.txt*	For Vim version 7.3.  Last change: 2011 Feb 10
  
  
  		  VIM REFERENCE MANUAL	  by Bram Moolenaar
***
*** 6554,6560 
  	k S   Value of "b:keymap_name" or 'keymap' when |:lmap| mappings are
  	  being used: ""
  	n N   Buffer number.
! 	b N   Value of byte under cursor.
  	B N   As above, in hexadecimal.
  	o N   Byte number in file of byte under cursor, first byte is 1.
  	  Mnemonic: Offset from start of file (with one added)
--- 6554,6560 
  	k S   Value of "b:keymap_name" or 'keymap' when |:lmap| mappings are
  	  being used: ""
  	n N   Buffer number.
! 	b N   Value of character under cursor.
  	B N   As above, in hexadecimal.
  	o N   Byte number in file of byte under cursor, first byte is 1.
  	  Mnemonic: Offset from start of file (with one added)



Re: Doc bug in options.txt for 'statusline' items %b and %B

2011-02-09 Thread Tony Mechelynck

On 10/02/11 06:34, Tony Mechelynck wrote:
[...]

Oops! Forgot to :setl nobomb

Here is the same patch without the BOM.


Best regards,
Tony.
--
HOW YOU CAN TELL THAT IT'S GOING TO BE A ROTTEN DAY:
#15 Your pet rock snaps at you.

--
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
*** ../vim73/runtime/doc/options.txt	2011-02-09 21:05:33.0 +0100
--- runtime/doc/options.txt	2011-02-10 05:45:09.0 +0100
***
*** 1,4 
! *options.txt*	For Vim version 7.3.  Last change: 2011 Jan 30
  
  
  		  VIM REFERENCE MANUAL	  by Bram Moolenaar
--- 1,4 
! *options.txt*	For Vim version 7.3.  Last change: 2011 Feb 10
  
  
  		  VIM REFERENCE MANUAL	  by Bram Moolenaar
***
*** 6554,6560 
  	k S   Value of "b:keymap_name" or 'keymap' when |:lmap| mappings are
  	  being used: ""
  	n N   Buffer number.
! 	b N   Value of byte under cursor.
  	B N   As above, in hexadecimal.
  	o N   Byte number in file of byte under cursor, first byte is 1.
  	  Mnemonic: Offset from start of file (with one added)
--- 6554,6560 
  	k S   Value of "b:keymap_name" or 'keymap' when |:lmap| mappings are
  	  being used: ""
  	n N   Buffer number.
! 	b N   Value of character under cursor.
  	B N   As above, in hexadecimal.
  	o N   Byte number in file of byte under cursor, first byte is 1.
  	  Mnemonic: Offset from start of file (with one added)