wrapping a series of comma separated words

2017-08-10 Thread Chris Lott
I'm constantly needing to wrap a series of comma separated titles with html  
tags, so this:

John has published work in foo, fubar, boo review, and many more.

Becomes this

John has published work in foo, fubar, boo review, and 
many more.
 
Right now I'm visually highlighting each title and using emmet to wrap with the 
tags, but it seems like there must be a shorter way!

-- 
-- 
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: wrapping a series of comma separated words

2017-08-10 Thread Lifepillar

On 10/08/2017 18:57, Chris Lott wrote:

I'm constantly needing to wrap a series of comma separated titles with html  
tags, so this:

 John has published work in foo, fubar, boo review, and many more.

Becomes this

 John has published work in foo, fubar, boo review, 
and many more.
  
Right now I'm visually highlighting each title and using emmet to wrap with the tags, but it seems like there must be a shorter way!


I have never used emmet, but I'd use Tim Pope's Surround plugin for
that. Move at the beginning of the text to be wrapped, then type

yst,ti>

Explanation:

ys = invoke "yank surround"
t, = till the next comma
t  = wrap with a tag
i>  = the  tag

If you also install the Repeat plugin, the action will be
dot-repeatable. So, typing W. repeatedly will wrap the subsequent
words. Of course, if you find yourself doing this often, you might
define a mapping for the sequence above.

Enjoy,
Life



--
--
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: xsel copies to clipboard twice

2017-08-10 Thread Tim Johnson
* Christian Brabandt  [170809 10:34]:
> 
> On Mi, 09 Aug 2017, Tim Johnson wrote:
<...> 
Redundant clipboard copy here - patches follow :

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:42:57)
Included patches: 1-52
Extra patches: 8.0.0056
Modified by pkg-vim-maintain...@lists.alioth.debian.org
Compiled by buildd@
Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):

Clipboard single copy here - patches follow :
-
M - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:42:57)
Included patches: 1-52
Extra patches: 8.0.0056
Modified by pkg-vim-maintain...@lists.alioth.debian.org
Compiled by buildd@
Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):

> 
> Looks pretty similar. However you did not include the patch level. 
I could include ldd output for both also
-- 
Tim 
http://www.akwebsoft.com, http://www.tj49.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.


Re: wrapping a series of comma separated words

2017-08-10 Thread Benji Fisher
On Thu, Aug 10, 2017 at 11:57 AM, Chris Lott  wrote:

> I'm constantly needing to wrap a series of comma separated titles with
> html  tags, so this:
>
> John has published work in foo, fubar, boo review, and many more.
>
> Becomes this
>
> John has published work in foo, fubar, boo
> review, and many more.
>
> Right now I'm visually highlighting each title and using emmet to wrap
> with the tags, but it seems like there must be a shorter way!


The basic idea is to use

:%s#pattern#&#g

I am using '#' instead of the usual '/' so that I do not have to escape '/'
in the replacement.  If you can afford the extra character, then this is
equivalent:

:%s/pattern/&<\/i>/g

Note that '&' in the replacement corresponds to the matched text.  (:help
sub-replace-special)

 The question is what pattern to use.  If you use '\k\+\ze,' then it
will match a "word" preceding a comma:  in your example, "foo", "fubar",
and "review".  The question is how to get "boo review" and not "in foo".
One possibility is to match either '\k\+' before a comma or '[^,]\+' after
", " and before ",", so the full pattern is ',\s*\zs[^,]\+\ze,\|\k\+\ze,'
and the full command is

:%s#,\s*\zs[^,]\+\ze,\|\k\+\ze,#&#g

-- 
HTH
Benji Fisher

-- 
-- 
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: xsel copies to clipboard twice [solved]

2017-08-10 Thread Tim Johnson
* Christian Brabandt  [170810 10:10]:
> 
> On Do, 10 Aug 2017, Tim Johnson wrote:
> 
> > * Christian Brabandt  [170809 10:34]:
> > > 
> > > On Mi, 09 Aug 2017, Tim Johnson wrote:
> > <...> 
> > Redundant clipboard copy here - patches follow :
> > 
> > VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:42:57)
> > Included patches: 1-52
> > Extra patches: 8.0.0056
> > Modified by pkg-vim-maintain...@lists.alioth.debian.org
> > Compiled by buildd@
> > Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
> > 
> > Clipboard single copy here - patches follow :
> > -
> > M - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:42:57)
> > Included patches: 1-52
> > Extra patches: 8.0.0056
> > Modified by pkg-vim-maintain...@lists.alioth.debian.org
> > Compiled by buildd@
> > Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
> 
> Are you sure? That looks like the same version for both your Vims?
> Well, check yourself for differences. There must be a difference 
> somewhere.

Ugh, they are now. Something on my system (perhaps me) has fiddled
with symlinks.

The bottom line is (I think) that when *clipboard features are
compiled the redundancy occurs. I am now using by preference a
"lighter" version without *clipboard (and other) features. This
gives me quicker launch time from mc and xsel functions as a JIT
resource. 

I appreciate the interest. I'm going to call this solved. Thanks for
the help.

-- 
Tim 
http://www.akwebsoft.com, http://www.tj49.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.


Re: xsel copies to clipboard twice

2017-08-10 Thread Christian Brabandt

On Do, 10 Aug 2017, Tim Johnson wrote:

> * Christian Brabandt  [170809 10:34]:
> > 
> > On Mi, 09 Aug 2017, Tim Johnson wrote:
> <...> 
> Redundant clipboard copy here - patches follow :
> 
> VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:42:57)
> Included patches: 1-52
> Extra patches: 8.0.0056
> Modified by pkg-vim-maintain...@lists.alioth.debian.org
> Compiled by buildd@
> Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
> 
> Clipboard single copy here - patches follow :
> -
> M - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:42:57)
> Included patches: 1-52
> Extra patches: 8.0.0056
> Modified by pkg-vim-maintain...@lists.alioth.debian.org
> Compiled by buildd@
> Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):

Are you sure? That looks like the same version for both your Vims?

> > Looks pretty similar. However you did not include the patch level. 
> I could include ldd output for both also

Well, check yourself for differences. There must be a difference 
somewhere.

Best,
Christian
-- 
Der eine hat eine falsche Rechtschreibung und der andere eine rechte
Falschschreibung.
-- Georg Christoph Lichtenberg

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


My colorscheme is messed-up but only if I edit a perl .pl file. Help!

2017-08-10 Thread DwigtArmyOfChampions
I am using Vim 7.4 through a remote PuTTY session. I set my "dracula" 
colorscheme in my vimrc, and then immediately after that, I remove the 
background setting for normal text. For Normal text, I personally prefer a 
solid (empty) black background to the background color that the dracula 
colorscheme uses. Here is the relevant code from my vimrc:

colorscheme dracula
hi Normal ctermfg=231 ctermbg=NONE cterm=NONE 

This works when I edit an HTML or text or JavaScript file, but if I edit a Perl 
file, the dracula colorscheme's default background is used instead. If I type 
:verbose hi Normal, it says "Last set from 
~/.vim/bundle/vim-dracula/colors/dracula.vim" So it appears the colorscheme 
file is getting sourced twice: once during the normal loading of the .vimrc and 
another time later on. Unfortunately the :scriptnames command only shows the 
first time a file gets sourced. How do I find what is causing the dracula.vim 
file to be sourced again?

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