Re: Patch to utilize undefined text-objects

2014-02-04 Thread Daniel "paradigm" Thau
On Tuesday, February 4, 2014 5:06:08 PM UTC-5, telemachus wrote:
> On Tuesday, February 4th, 2014 at 4:50PM, Daniel "paradigm" Thau wrote:
> 
> > Should be fixed in the attachment.  As a bonus, it now supports things
> 
> > such as digraphs.
> 
> 
> 
> I'm loving this patch, but I do have a question. Is the following a bug or
> 
> intended behavior:
> 
> 
> 
> 1. Start with this text (cursor at the 'i')
> 
> 
> 
> foo,i,foo
> 
> 
> 
> 2. Enter 'cim,'
> 
> 3. This is the result, with the cursor immediately before the ','
> 
> 
> 
> foo,foo
> 
> 
> 
> 4. Expected result was this, with the cursor in between the commas:
> 
> 
> 
> foo,,foo
> 
> 
> 
> 
> 
> Thanks, Peter
> 
> -- 
> 
> We have not been faced with the need to satisfy someone else's
> 
> requirements, and for this freedom we are grateful.
> 
> Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System

That is in fact another bug.  No idea how that slipped by me.  I'll be sure to 
fix that as well.

-- 
-- 
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 because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


XXD ftplugin

2014-02-04 Thread Lech Lorens
Hi,

I'd like to propose the attached ftplugin for XXD I've been using for 
a long time.  The plugin highlights the corresponding hexadecimal 
representation for the character the cursor is on and the other way 
around.

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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
" Vim filetype plugin file
" Language:XXD
" Maintainer:  Lech Lorens 
" Last Change: 2014 Feb 4

" When the cursor is in the hexadecimal data representation, highlights the
" corresponding character in the ASCII column.
" When the cursor is in the ASCII column, highlights the corresponding two
" hexadecimal digits in the hex data area.

" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
finish
endif

" Don't load another plugin for this buffer
let b:did_ftplugin = 1

" Line continuations...
let s:cpo_save = &cpo
set cpo-=C

augroup xxdhighlight
autocmd! CursorMoved,CursorMovedI,WinEnter  call 
XxdHighlightMatching()
augroup END

function! XxdHighlightMatching()
let [buf,c_lnum,col,off] = getpos('.')
let line = substitute(getline('.'), '\v\s', ' ', 'g')

let addr = substitute(line, '\v(^\x+:\s+).*', '\1', '')
let addrLen = strlen(substitute(addr, '.', 'x', 'g'))

let col -= addrLen

3match none

if col <= 0
return
endif

let rest = substitute(line, '\v^\x+: +(.*)', '\1', '')

" Let's check whether the cursor is in the hex representation part or in
" the ASCII representation part of the line.

let hexPairs = substitute(rest, '\v^(%(\x+ ?)+).*', '\1', '')
let onlyHex = substitute(hexPairs, ' ', '', 'g')
let hexBytes = strlen(onlyHex) / 2
let hexPart = substitute(rest, '\v^(.*).{' . hexBytes . '}$', '\1', '')
let hexLen = strlen(substitute(hexPart, '.', 'x', 'g'))

if col <= hexLen
" The cursor's in the hex part.
let chars = split(hexPart, '\zs')
if chars[col - 1] == ' '
return
endif

let charIdx = 0
if col > 1
let hexBefore = substitute(hexPart, '\v^(.{' . (col - 
1) . '}).*',
\ '\1', '')
let onlyHex = substitute(hexBefore, ' ', '', 'g')
let charIdx = strlen(onlyHex) / 2
endif
let c_col = addrLen + hexLen + charIdx + 1
let c_after = c_col + 1
else
" The cursor's in the ASCII part.
let matchOffset = 0

let charIdx = col - hexLen - 1
if charIdx > 0
let hexBefore = substitute(hexPart,
\ '\v^(%(\x\x ?){' . charIdx . '}).*',
\ '\1', '')
let matchOffset += strlen(hexBefore)
endif
let c_col = addrLen + matchOffset + 1
let c_after = c_col + 2
endif

exe '3match MatchParen /\v%' . c_lnum . 'l%' . c_col . 'c.*\ze%' . 
c_after . 'c/'
endfunction

let &cpo = s:cpo_save
unlet s:cpo_save


Re: Patch to utilize undefined text-objects

2014-02-04 Thread Peter Aronoff
On Tuesday, February 4th, 2014 at 4:50PM, Daniel "paradigm" Thau wrote:
> Should be fixed in the attachment.  As a bonus, it now supports things
> such as digraphs.

I'm loving this patch, but I do have a question. Is the following a bug or
intended behavior:

1. Start with this text (cursor at the 'i')

foo,i,foo

2. Enter 'cim,'
3. This is the result, with the cursor immediately before the ','

foo,foo

4. Expected result was this, with the cursor in between the commas:

foo,,foo


Thanks, Peter
-- 
We have not been faced with the need to satisfy someone else's
requirements, and for this freedom we are grateful.
Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System

-- 
-- 
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 because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Patch to utilize undefined text-objects

2014-02-04 Thread Daniel "paradigm" Thau
On Tuesday, February 4, 2014 1:50:19 PM UTC-5, Ben Fritz wrote:
> On Friday, January 31, 2014 10:40:49 PM UTC-6, Ben Fritz wrote:
> 
> > On Friday, January 31, 2014 1:54:30 PM UTC-6, Daniel "paradigm" Thau wrote:
> 
> > > 
> 
> > > Should be fixed in the attachment.  As a bonus, it now supports things 
> > > such as digraphs.
> 
> > 
> 
> > I think you just gave me a way to edit bulleted list items in plaintext, 
> > using a c-coded text object. I'll need to try it out tomorrow :-)
> 
> 
> 
> Thanks! I tried out the latest patch, now using cim with my own digraph, I 
> can easily edit entire list items when I have a list like this:
> 
> 
> 
> • one
> 
> • two
> 
> • three
> 

Excellent :)

> I noticed a very minor bug, though.
> 
> 
> 
> When 'selection' is set to "exclusive" (as with :behave mswin) then vim{char} 
> is missing a character in the selection. Similarly, vam{char} is missing the 
> final matched character.

Interesting.  I'll look into it.

-- 
-- 
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 because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Patch to utilize undefined text-objects

2014-02-04 Thread Ben Fritz
On Friday, January 31, 2014 10:40:49 PM UTC-6, Ben Fritz wrote:
> On Friday, January 31, 2014 1:54:30 PM UTC-6, Daniel "paradigm" Thau wrote:
> > 
> > Should be fixed in the attachment.  As a bonus, it now supports things such 
> > as digraphs.
> 
> I think you just gave me a way to edit bulleted list items in plaintext, 
> using a c-coded text object. I'll need to try it out tomorrow :-)

Thanks! I tried out the latest patch, now using cim with my own digraph, I can 
easily edit entire list items when I have a list like this:

• one
• two
• three

I noticed a very minor bug, though.

When 'selection' is set to "exclusive" (as with :behave mswin) then vim{char} 
is missing a character in the selection. Similarly, vam{char} is missing the 
final matched character.

-- 
-- 
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 because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ENABLE_WINDOW_INPUT flag

2014-02-04 Thread Suresh Govindachar


On 2/3/2014 10:25 PM, John Little wrote:
  > On Tuesday, February 4, 2014 4:26:07 PM UTC+13, Suresh Govindachar 
wrote:

  >
  >> I am told that ENABLE_WINDOW_INPUT is disabled for xterm.
  >> Why is this being done?
  >
  > Is that the question you meant to ask?  ENABLE_WINDOW_INPUT is
  > some win32 API flag; it's not used with xterm.  Or are you
  > bumping your report:
  > https://groups.google.com/forum/?hl=en#!topic/vim_dev/ZfEpoxL-j7w

I asked the question I meant to ask.  However, I came across the 
information about ENABLE_WINDOW_INPUT while investigating why resizing 
worked somewhat when term was win32 and did not work when term was xterm 
via ConEmu on Windows.


I suspect ConEmu currently communicates changes in sizes the same way 
win32 console does rather that in some "xterm protocol" way -- if so, 
the information from ConEmu about changed sizes is not getting to Vim 
since ENABLE_WINDOW_INPUT is disabled even on Windows when term is xterm.


On Windows, when running Vim inside ConEmu and term is xterm, and 
ENABLE_WINDOW_INPUT is disabled, how does Vim expect to be informed 
about changes in sizes?  Also, what would happen if ENABLE_WINDOW_INPUT 
was always true on Windows irrespective of the value of term?


--Suresh



--
--
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 because you are subscribed to the Google Groups "vim_dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Issue 197 in vim: ]P does not paste over visually selected line

2014-02-04 Thread vim


Comment #5 on issue 197 by chr...@coosto.nl: ]P does not paste over  
visually selected line

http://code.google.com/p/vim/issues/detail?id=197

I have a test case that breaks the behaviour:

vim --noplugin -u NONE

iabc
def

if (true)
{
ghi
jkl
}gg2Y5j2V]P


Expected:
abc
def

if (true)
{
abc
def
}

Actual:

Expected:
abc
def

if (true)
{
ghi
abc
}

(in the P-buffer I have
def
jkl
, which is odd as well)

--
You received this message because this project is configured to send all  
issue notifications to this address.

You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
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 because you are subscribed to the Google Groups "vim_dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Issue 197 in vim: ]P does not paste over visually selected line

2014-02-04 Thread vim


Comment #4 on issue 197 by chrisbr...@googlemail.com: ]P does not paste  
over visually selected line

http://code.google.com/p/vim/issues/detail?id=197

grrml, and for some reason, this stupid webinterface hasn't uploaded the  
patch.

Here is it again

Attachments:
paste_bracket_v2.diff  1.3 KB

--
You received this message because this project is configured to send all  
issue notifications to this address.

You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
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 because you are subscribed to the Google Groups "vim_dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Issue 197 in vim: ]P does not paste over visually selected line

2014-02-04 Thread vim


Comment #3 on issue 197 by chrisbr...@googlemail.com: ]P does not paste  
over visually selected line

http://code.google.com/p/vim/issues/detail?id=197

Yes, you are right. Here is an updated patch.


--
You received this message because this project is configured to send all  
issue notifications to this address.

You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
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 because you are subscribed to the Google Groups "vim_dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Issue 197 in vim: ]P does not paste over visually selected line

2014-02-04 Thread vim


Comment #2 on issue 197 by chr...@coosto.nl: ]P does not paste over  
visually selected line

http://code.google.com/p/vim/issues/detail?id=197

I can confirm that this fixes my test case. But I wonder if the just 'cut'  
text shouldn't be put in the * register...


New test case:

vim -Nu NONE
iabc
def

if (true)
{
ghi
}gg2Y5jV]PP

Expected:

abc
def

if (true)
{
abc
def
ghi
}

Result:

abc
def

if (true)
{
abc
def
abc
def
}


--
You received this message because this project is configured to send all  
issue notifications to this address.

You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
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 because you are subscribed to the Google Groups "vim_dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Issue 197 in vim: ]P does not paste over visually selected line

2014-02-04 Thread vim


Comment #1 on issue 197 by chrisbr...@googlemail.com: ]P does not paste  
over visually selected line

http://code.google.com/p/vim/issues/detail?id=197

I see the problem. The [p paste operation does not take care of visual mode.

Attached is a patch, that fixes the issue.

Attachments:
paste_bracket.diff  1.4 KB

--
You received this message because this project is configured to send all  
issue notifications to this address.

You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
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 because you are subscribed to the Google Groups "vim_dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.