Replace groups of dots by a tab

2018-02-02 Thread Bernard Fay
I have a file with a bunch of lines like the following one:

AAE ..Above Aerodrome Elevation

I would like to replace the dots by a single tab.

I tried the following substitutions but it does not work.
%s/\.*/\t/
%s/[\.]*/\t/


vim keep seeing the dot in the s command as a wildcard even though it is 
escaped.

Is there as way to do it?

Thanks,

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Replace groups of dots by a tab

2018-02-02 Thread Tim Chase
On 2018-02-02 10:45, Bernard Fay wrote:
> I have a file with a bunch of lines like the following one:
> 
> AAE ..Above Aerodrome
> Elevation
> 
> I would like to replace the dots by a single tab.
> 
> I tried the following substitutions but it does not work.
> %s/\.*/\t/
> %s/[\.]*/\t/

Because you're using "*" instead of "\+", it is likely finding the
zero periods at the beginning of the line, transforming it into

\tAAEE . Above Aerodrome Elevation

What you likely want is to require more than one period with either

  %s/[.]\+/\t

or

  %s/\.\+/\t

If for some reason a period appears in the abbreviation on the left
("A.A.E. ... Above Aerodrome Elevation"), you can require a
minimum number of them:

  :%s/\.\{4,}/\t

to require at least 4 consecutive periods for the replacement.

Additionally, you might want to eat whitespace on either side of it
too:

  :%s/\s*\.\{4,}\s*/\t

just to clean it up a bit.

-tim



-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Replace groups of dots by a tab

2018-02-02 Thread David Turetsky
Add a g at the end, otherwise it will only replace the first dot

— 
David

> On Feb 2, 2018, at 1:45 PM, Bernard Fay  wrote:
> 
> I have a file with a bunch of lines like the following one:
> 
> AAE ..Above Aerodrome Elevation
> 
> I would like to replace the dots by a single tab.
> 
> I tried the following substitutions but it does not work.
> %s/\.*/\t/
> %s/[\.]*/\t/
> 
> 
> vim keep seeing the dot in the s command as a wildcard even though it is 
> escaped.
> 
> Is there as way to do it?
> 
> Thanks,
> 
> -- 
> -- 
> You received this message from the "vim_use" 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_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to vim_use+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Replace groups of dots by a tab

2018-02-02 Thread Bernard Fay
On Friday, February 2, 2018 at 2:17:27 PM UTC-5, Tim Chase wrote:
> On 2018-02-02 10:45, Bernard Fay wrote:
> > I have a file with a bunch of lines like the following one:
> > 
> > AAE ..Above Aerodrome
> > Elevation
> > 
> > I would like to replace the dots by a single tab.
> > 
> > I tried the following substitutions but it does not work.
> > %s/\.*/\t/
> > %s/[\.]*/\t/
> 
> Because you're using "*" instead of "\+", it is likely finding the
> zero periods at the beginning of the line, transforming it into
> 
> \tAAEE . Above Aerodrome Elevation
> 
> What you likely want is to require more than one period with either
> 
>   %s/[.]\+/\t
> 
> or
> 
>   %s/\.\+/\t
> 
> If for some reason a period appears in the abbreviation on the left
> ("A.A.E. ... Above Aerodrome Elevation"), you can require a
> minimum number of them:
> 
>   :%s/\.\{4,}/\t
> 
> to require at least 4 consecutive periods for the replacement.
> 
> Additionally, you might want to eat whitespace on either side of it
> too:
> 
>   :%s/\s*\.\{4,}\s*/\t
> 
> just to clean it up a bit.
> 
> -tim

Wonderful!  Thanks tim

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Neither Emacs nor Vim nor Nano handle ligature literal insertion well

2018-02-02 Thread Gary Johnson
On 2018-02-02, Andrew Pennebaker wrote:

> I would really like convenient access to ligatures in my word processing
> software. Unfortunately, none of the major text editing applications appears 
> to
> handle ligatures intelligently: Each of Emacs, Vim, Nano, MS Word, Google
> Drive, Libre Office, and InDesign type a dumb "ae" when the user presses the a
> and e keyboard keys, whereas historically this sequence is typically rendered
> with the ash æ rune.

:imap ae ae

See

:help 24.9

Regards,
Gary

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


xpath plugin completion

2018-02-02 Thread Ni Va
Hi,

I search for a xpath plugin fast completion.

I tried https://github.com/actionshrimp/vim-xpath.git but it lags vim on 
entering chars to set xpath expression.

Thank you
Niva

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Partial current word under cursor

2018-02-02 Thread Tim Chase
> nnoremap s :%s/\<\(\)\>//g
> 
> I was thinking that I would set the cursor where I need to insert
> the new word, as in "get#Something" where # represents the cursor
> and then I'd need to replace it like so:
> s/\<\(left-of-cursor)\zs\ze(right-of-cursor)\>/whatever/g

You might try something like this:

nnoremap s :%s/\=substitute(expand(''),
'\l\zs\ze\u', '\\zs\\ze', '')\>//g

(all one command in case email decides to add line-breaks).

This will make s take the current Word under the cursor, look
for the break between the first lowercase letter and the following
uppercase letter (the "#" point in your "get#Something" example) and
add in the \zs and \ze at that point, then use that in a :substitute
command like your original.

It is a special-case for that lower-followed-by-uppercase transition,
but it sounds like that's what you're interested in here.

-tim


-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Neither Emacs nor Vim nor Nano handle ligature literal insertion well

2018-02-02 Thread Erik Christiansen
On 02.02.18 16:31, Andrew Pennebaker wrote:
> I would really like convenient access to ligatures in my word processing
> software. Unfortunately, none of the major text editing applications
> appears to handle ligatures intelligently: Each of Emacs, Vim, Nano, MS
> Word, Google Drive, Libre Office, and InDesign type a dumb "ae" when the
> user presses the a and e keyboard keys, whereas historically this sequence
> is typically rendered with the ash æ rune.

OK, but Vim handles all sorts of ligatures quite elegantly.
(See :h digraphs , and to list them :digraphs)
Granted, when I write emails in Danish, it quickly becomes tedious to
type ^Kae for æ, so I have the following mappings:

" Mapping Style:
:let mapleader = ";"

" Mapping åæø and «» is handier than digraphs:
inoremap  a "\uE5"
inoremap  e "\uE6"
inoremap  o "\uF8"
inoremap   "\uAB"
inoremap  > "\uBB"

Now ;e gives æ, ;a gives å, and ;o gives ø. While it's only one double
keystroke less, the typing style is much more natural and fully
mnemonic. Using  instead of e would reduce it to one double
keystroke, but I find it mnemonically convenient to reserve the alt key
for more broadly transformative actions. If you need a literal ;e, as
in these examples, then ^V;e makes the semicolon literal.

If you need thorn, it's ^Kth, giving þ. Also useful is ^K2S when needing
e.g. m², and ^K+- for ±.

So it's all there, and has been for at least one decade, probably
two. And with mappings, convenience can be amplified.

Erik

-- 
When printing with movable type was invented around 1450, typefaces included
many ligatures and additional letters, such as the letter þ (thorn) which was
first substituted in English with y (e.g. ye olde shoppe), but later written as
th. - http://en.wikipedia.org/wiki/Ligature_%28typography%29

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Neither Emacs nor Vim nor Nano handle ligature literal insertion well

2018-02-02 Thread Tony Mechelynck
On Fri, Feb 2, 2018 at 11:47 PM, Gary Johnson  wrote:
> On 2018-02-02, Andrew Pennebaker wrote:
>
>> I would really like convenient access to ligatures in my word processing
>> software. Unfortunately, none of the major text editing applications appears 
>> to
>> handle ligatures intelligently: Each of Emacs, Vim, Nano, MS Word, Google
>> Drive, Libre Office, and InDesign type a dumb "ae" when the user presses the 
>> a
>> and e keyboard keys, whereas historically this sequence is typically rendered
>> with the ash æ rune.
>
> :imap ae ae
>
> See
>
> :help 24.9
>
> Regards,
> Gary

No need for a mapping, it is a standard binding if yout Vim is
compiled with +digraphs

Or you can use a keymap. Maybe there is one already, but if there
isn't, you can make one yourself, see
http://vim.wikia.com/wiki/How_to_make_a_keymap

Best regards,
Tony.

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Neither Emacs nor Vim nor Nano handle ligature literal insertion well

2018-02-02 Thread Andrew Pennebaker
Hello,

I would really like convenient access to ligatures in my word processing
software. Unfortunately, none of the major text editing applications
appears to handle ligatures intelligently: Each of Emacs, Vim, Nano, MS
Word, Google Drive, Libre Office, and InDesign type a dumb "ae" when the
user presses the a and e keyboard keys, whereas historically this sequence
is typically rendered with the ash æ rune.

I am able to work around this limitation in most applications by
configuring TextExpander (macOS, Windows) or autokey (Linux) to match the
keyboard sequence "ae" and replace this with "æ". This allows most UTF-8
compatible graphical software, from Web browsers to document editors, to
correctly insert æ in place of ae. However, traditional text editors
including Emacs, Vim, and Nano are evidently NOT able to handle a literal æ
rune insertion, and tend to raise a generic error message when the text
expander application attempts to insert this key. This may be a result of a
conflict between shell encodings (need UTF-8 everywhere, though I'm
currently typing this with a bare Windows COMSPEC command prompt session).
In any case, it stinks that the user cannot easily insert ligatures into
text editors, so copying & pasting from Wikipedia via the OS clipboard
appears to be one of the more (in)convenient options for accessing
ligatures. We can do better!

-- 
Cheers,
Andrew

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Neither Emacs nor Vim nor Nano handle ligature literal insertion well

2018-02-02 Thread Gary Johnson
On 2018-02-03, Tony Mechelynck wrote:
> On Fri, Feb 2, 2018 at 11:47 PM, Gary Johnson wrote:
> > On 2018-02-02, Andrew Pennebaker wrote:
> >
> >> I would really like convenient access to ligatures in my word processing
> >> software. Unfortunately, none of the major text editing applications 
> >> appears to
> >> handle ligatures intelligently: Each of Emacs, Vim, Nano, MS Word, Google
> >> Drive, Libre Office, and InDesign type a dumb "ae" when the user presses 
> >> the a
> >> and e keyboard keys, whereas historically this sequence is typically 
> >> rendered
> >> with the ash ć rune.
> >
> > :imap ae ae
> >
> > See
> >
> > :help 24.9
> >
> > Regards,
> > Gary
> 
> No need for a mapping, it is a standard binding if yout Vim is
> compiled with +digraphs

Mine are compiled with +diagraphs, but the two-character sequence ae
is not automatically translated to ć.  That only happens if I prefix
ae with Ctrl-K.  I understood the OP to want ae to be translated to
ć without having to type anything else.

Regards,
Gary

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Partial current word under cursor

2018-02-02 Thread S

Hello!

It's a standard practice of mine having to replace whole words with 
something else, very useful when coding.  I have the following mapping 
in my vimrc:

nnoremap s :%s/\<\(\)\>//g
which lets me just hit \+s and replace the current word under the cursor.
Now I've found myself needing more and more frequently to insert 
something in between a word.  For example, say I have the word 
"getSomething" and I want to replace all occurrences with 
"getThisSomething", that is insert 'This' in between 'get' and 
'Something'.  I know how to do this by a hand-written regex but I wanted 
to create a mapping like the one above.


I was thinking that I would set the cursor where I need to insert the 
new word, as in "get#Something" where # represents the cursor and then 
I'd need to replace it like so:

s/\<\(left-of-cursor)\zs\ze(right-of-cursor)\>/whatever/g
but I haven't been able to find anything that lets me split the word 
under the cursor.  It's probably not possible to do with such a simple 
mapping and I might need a function for it but my knowledge of 
vim-scripting is next to nothing so I thought you guys could help me 
figure this out.


Thank you very much!
-- Sycc90


---
This email has been checked for viruses by AVG.
http://www.avg.com

--
--
You received this message from the "vim_use" 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_use" group.

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