Re: How to handle non-ascii characters?

2017-10-23 Thread Eli the Bearded
Barry Gold wrote:

You wrote:
> I'm impressed that you can type your entire vimrc from memory. I'm
> tempted to use some of that. If only I _understood_ it.

Well the normal stuff that applies globablly. Stuff for specific classes
of files is a bit more difficult. :^) It's basically these three maps
and some :set options.


>>  " Use * to "run" a line from the edit buffer
>>  " Mnemonic: * is executible in "ls -F"
>>  " Uses register y
>>  :map * "yyy@y

:mapbegin a key remap
 *  remap key "*"
   "y   into register y
 yy yank the current line
   @y   execute the commands in register y

The beauty of this one is the ability to compose complex commands
(typically ":g/select/ s/this/that/" type stuff for me) and then
being able to 'u'ndo and fix the command if I don't get it right
the first time. It also is useful to keep commands in comments of
code.

>>  " Find previous space and split line on it
>>  " Mnemonic: 'S'pace
>>  :map S F r

:mapbegin a key remap
 S  remap key "S"
   F("F ") find previous " " on  current line
r   replace that space with carriage return

>>  " Double the character under the cursor
>>  " Mnemonic: fix C code like "if (0 = i) ..."
>>  :map = y p

:mapbegin a key remap
 =  remap key "="
   y("y ") yank character under cursor
 o  put last yank

I remember learning a lot of vi tricks from comp.editors from people
doing things like the above breakdown. Approximately no one reads or
posts there any more.

Elijah

-- 
-- 
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: How to handle non-ascii characters?

2017-10-23 Thread Barry Gold

On 10/23/2017 1:50 PM, Eli the Bearded wrote:

Barry Gold wrote:

None of these looks like themselves when I edit the file with vim in a
cygwin Terminal window. I can search for [^ -~^t] to find the non-ASCII
characters, then go to the original word document to find out what the
correct character is. If I had only a few of these, that would be
enough. But in a longer document, a given non-ASCII can occur hundreds
of times. So once I've found (e.g.) an emdash, I want to replace _all_
occurrences with  "—". But I have no way of representing the
character I want to replace on the command line.

I have a very similar problem to yours and have evolved some fixes that
I use. You've already gotten some replies, but maybe my methods would
help, too.

In my case, I paste content from web pages into Usenet posts and want to
have as much US-ASCII as possible for best readibility. To that end I
have a specific vimrc for news that fixes things with map!s. It could
easily be modified to a ':so script' usage, to fix things on command
or a 'autocmd BufRead *.html' script to fix thins on load.

In my vimrc:

autocmd BufRead .article.* :so ~eli/.news_vimrc

And my news_vimrc looks like this:

:r! cat ~/.news_vimrc | mmencode -q
" smart quotes
map! =E2=80=99 '
map! =E2=80=98 '
map! =E2=80=9C "
map! =E2=80=9D "
map! =E2=80=B3 "
" ellipsis
map! =E2=80=A6 ...
" n-dash
map! =E2=80=93 --
" m-dash
map! =E2=80=94 --
" U+2212 minus
map! =E2=88=92 -
" U+2010 hyphen
map! =E2=80=90 -
"
" find non-ascii
map  /[^   -~]
" add mime headers if leaving in non-ascii
map  iContent-Type: text/plain; charset=3D"UTF-8"MIME-Version: 1.=
0
map!  Content-Type: text/plain; charset=3D"UTF-8"MIME-Version: 1.=
0
" general news settings
set ai sw=3D4 tw=3D72

Basically, I'm suggesting that you take all the charcters you find and
want to replace, and save the replacements in a script you can run
easily before looking for new characters that you want to fix.

I use http://qaz.wtf/u/ "Show unicode character" if needed to identify
characters, the plugin might suit you better.

And I have a long-standing macro:

" Use * to "run" a line from the edit buffer
" Mnemonic: * is executible in "ls -F"
" Uses register y
:map * "yyy@y

If I were you, I would make the commands, test them with *, then 'p'ut
them in the fix script.

That * command is one of three macros I consider essential. The other
two I think are less likely to be universally useful, but anyway:

" Find previous space and split line on it
" Mnemonic: 'S'pace
:map S F r
"
" Double the character under the cursor
" Mnemonic: fix C code like "if (0 = i) ..."
:map = y p

I'm impressed that you can type your entire vimrc from memory. I'm 
tempted to use some of that. If only I _understood_ it.



--
On Beta, we'd have earrings for that. You could buy them in any jewelry store.
http://www.conchord.org/xeno/bdgsig.html

--
--
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: How to handle non-ascii characters?

2017-10-23 Thread Tony Mechelynck
To each his/her taste of course, but IMHO all-ASCII does not always go
hand in hand with best legibility. What it does go hand in hand with
is best typability on English-language keyboards when no keymap is in
use.

My first HTML pages were in French and I took the trouble to replace
all French non-ASCII characters by their ASCII entities: à
ç é ï œ û etc. etc. etc. For French the
result is still (barely) human-readable thanks to the many unaccented
Latin letters in the text.

My current project is a Russian-French dictionary, and replacing all
Cyrillic by numeric entities would have turned it completely into
gobbledygook. Here I have chosen in favour of UTF-8 with the help of
an owncoded keymap and an "international" Latin-alphabet keyboard
(except in rare cases such as   written as such in otherwise
empty  table cells) and this suits me perfectly; even the French
text looks more readable to me now that I write it in UTF-8.

Best regards,
Tony.

On Mon, Oct 23, 2017 at 10:50 PM, Eli the Bearded
 wrote:
> Barry Gold wrote:
>> None of these looks like themselves when I edit the file with vim in a
>> cygwin Terminal window. I can search for [^ -~^t] to find the non-ASCII
>> characters, then go to the original word document to find out what the
>> correct character is. If I had only a few of these, that would be
>> enough. But in a longer document, a given non-ASCII can occur hundreds
>> of times. So once I've found (e.g.) an emdash, I want to replace _all_
>> occurrences with  "—". But I have no way of representing the
>> character I want to replace on the command line.
>
> I have a very similar problem to yours and have evolved some fixes that
> I use. You've already gotten some replies, but maybe my methods would
> help, too.
>
> In my case, I paste content from web pages into Usenet posts and want to
> have as much US-ASCII as possible for best readibility. To that end I
> have a specific vimrc for news that fixes things with map!s. It could
> easily be modified to a ':so script' usage, to fix things on command
> or a 'autocmd BufRead *.html' script to fix thins on load.
>
> In my vimrc:
>
>autocmd BufRead .article.* :so ~eli/.news_vimrc
>
> And my news_vimrc looks like this:
>
> :r! cat ~/.news_vimrc | mmencode -q
> " smart quotes
> map! =E2=80=99 '
> map! =E2=80=98 '
> map! =E2=80=9C "
> map! =E2=80=9D "
> map! =E2=80=B3 "
> " ellipsis
> map! =E2=80=A6 ...
> " n-dash
> map! =E2=80=93 --
> " m-dash
> map! =E2=80=94 --
> " U+2212 minus
> map! =E2=88=92 -
> " U+2010 hyphen
> map! =E2=80=90 -
> "
> " find non-ascii
> map  /[^ -~]
> " add mime headers if leaving in non-ascii
> map  iContent-Type: text/plain; charset=3D"UTF-8"MIME-Version: 1.=
> 0
> map!  Content-Type: text/plain; charset=3D"UTF-8"MIME-Version: 1.=
> 0
> " general news settings
> set ai sw=3D4 tw=3D72
>
> Basically, I'm suggesting that you take all the charcters you find and
> want to replace, and save the replacements in a script you can run
> easily before looking for new characters that you want to fix.
>
> I use http://qaz.wtf/u/ "Show unicode character" if needed to identify
> characters, the plugin might suit you better.
>
> And I have a long-standing macro:
>
> " Use * to "run" a line from the edit buffer
> " Mnemonic: * is executible in "ls -F"
> " Uses register y
> :map * "yyy@y
>
> If I were you, I would make the commands, test them with *, then 'p'ut
> them in the fix script.
>
> That * command is one of three macros I consider essential. The other
> two I think are less likely to be universally useful, but anyway:
>
> " Find previous space and split line on it
> " Mnemonic: 'S'pace
> :map S F r
> "
> " Double the character under the cursor
> " Mnemonic: fix C code like "if (0 = i) ..."
> :map = y p
>
> Elijah
> --
> can type his entire vimrc from memory, and often does
>
> --
> --
> 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: How to handle non-ascii characters?

2017-10-23 Thread Eli the Bearded
Barry Gold wrote:
> None of these looks like themselves when I edit the file with vim in a
> cygwin Terminal window. I can search for [^ -~^t] to find the non-ASCII
> characters, then go to the original word document to find out what the
> correct character is. If I had only a few of these, that would be
> enough. But in a longer document, a given non-ASCII can occur hundreds
> of times. So once I've found (e.g.) an emdash, I want to replace _all_
> occurrences with  "—". But I have no way of representing the
> character I want to replace on the command line.

I have a very similar problem to yours and have evolved some fixes that
I use. You've already gotten some replies, but maybe my methods would
help, too.

In my case, I paste content from web pages into Usenet posts and want to
have as much US-ASCII as possible for best readibility. To that end I
have a specific vimrc for news that fixes things with map!s. It could
easily be modified to a ':so script' usage, to fix things on command
or a 'autocmd BufRead *.html' script to fix thins on load.

In my vimrc:

   autocmd BufRead .article.* :so ~eli/.news_vimrc

And my news_vimrc looks like this: 

:r! cat ~/.news_vimrc | mmencode -q
" smart quotes
map! =E2=80=99 '
map! =E2=80=98 '
map! =E2=80=9C "
map! =E2=80=9D "
map! =E2=80=B3 "
" ellipsis
map! =E2=80=A6 ...
" n-dash
map! =E2=80=93 --
" m-dash
map! =E2=80=94 --
" U+2212 minus
map! =E2=88=92 -
" U+2010 hyphen
map! =E2=80=90 -
"
" find non-ascii
map  /[^ -~]
" add mime headers if leaving in non-ascii
map  iContent-Type: text/plain; charset=3D"UTF-8"MIME-Version: 1.=
0
map!  Content-Type: text/plain; charset=3D"UTF-8"MIME-Version: 1.=
0
" general news settings
set ai sw=3D4 tw=3D72

Basically, I'm suggesting that you take all the charcters you find and
want to replace, and save the replacements in a script you can run
easily before looking for new characters that you want to fix.

I use http://qaz.wtf/u/ "Show unicode character" if needed to identify
characters, the plugin might suit you better.

And I have a long-standing macro:

" Use * to "run" a line from the edit buffer
" Mnemonic: * is executible in "ls -F"
" Uses register y
:map * "yyy@y

If I were you, I would make the commands, test them with *, then 'p'ut
them in the fix script.

That * command is one of three macros I consider essential. The other
two I think are less likely to be universally useful, but anyway:

" Find previous space and split line on it
" Mnemonic: 'S'pace 
:map S F r
"
" Double the character under the cursor
" Mnemonic: fix C code like "if (0 = i) ..."
:map = y p

Elijah
--
can type his entire vimrc from memory, and often does

-- 
-- 
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: Vim startup profiling

2017-10-23 Thread Bram Moolenaar

Ken Takata wrote:

> 2017/5/26 Fri 22:36:40 UTC+9 Ken Takata wrote:
> > > 096.000  047.000  044.000: sourcing D:\Logiciels\Vim\vim80/menu.vim
> > > 096.000  072.000  025.000: sourcing D:\Logiciels\Vim\vim80\filetype.vim
> > 
> > menu.vim uses `globpath()` to search some kind of files under the
> runtimepath.
> > If you search `globpath` in menu.vim, you may find the following lines:
> > 
> >   let s:n = globpath(&runtimepath, "colors/*.vim")
> > let s:n = globpath(&runtimepath, "keymap/*.vim")
> >   let s = globpath(&rtp, "spell/*." . enc . ".spl")
> >   let s:n = globpath(&runtimepath, "compiler/*.vim")
> > 
> > Color schemes, keymaps, spell files and compiler plugins are searched when
> > menu.vim is loaded.
> > This is why it takes long time to be loaded.
> > 
> > Unlike those items, file types are not listed automatically.  If a user
> > selects "Syntax" -> "Show File Types in Menu", they will be listed.
> > If we use a similar way for color schemes etc., the startup time would be
> > reduced.
> 
> I wrote a patch for reduce the loading the of menu.vim by skip using
> globpath().
> 
> https://bitbucket.org/k_takata/vim-ktakata-mq/src/bf92d701bca2ef46f6caa64aae89438e039370bb/improve-loading-menu.vim.patch?at=default&fileviewer=file-view-default
> 
> Instead of searching colors/*.vim and other files, the following menuitems are
> added in the menu:
> 
>   Edit > Show Color Schemes in Menu
>   Edit > Show Keymaps in Menu
>   Tools > Show Compiler Settings in Menu
> 
> If these menuitems are selected, all available colorschemes etc. are shown
> in the menu.  If a user want to load them at startup, the following line
> can be added in .vimrc:
>   :let do_globpath_menus = 1
> (This is similar to `:let do_syntax_sel_menu = 1`.)
> 
> 
> In my environment, the loading time of menu.vim is:
>   Without this patch:  30 - 50 ms
>   Skip using globpath: 15 - 20 ms

Not a very big difference.  But still worth it if you never use those
menus.

I wonder if we can do this lazily.  Thus fill in the missing entries
when we start waiting for the user to type.  Should be around the same
place where timers may be triggered.  Not sure if we can do it with an
actual timer from the menu.vim script though.  Might need a special kind
of timer.  Perhaps an "idle timer"?

-- 
With sufficient thrust, pigs fly just fine.
   -- RFC 1925

 /// 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_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: ZWNJ (Zero Width Non-Joiner) in Persian

2017-10-23 Thread Bram Moolenaar

Hamidreza Jafari wrote:

> Vim with mlterm is able to process Farsi input except with (some)
> special characters such as zero width non-joiner which is becoming a
> concern. I observe:
> 
> - if I set keymap to persian-iranian then text entry in Farsi and
> driving Vim with commands are seamless because there is no need to
> change keyboard language at OS level for commands. Keyboard language
> is fix in English. Whenever I start to type for text it automatically
> changes to Persian. Problem is I don't find a way to insert the famous
> ZWNJ, coincidentally a much used character in Persian and Arabic.
> 
> - if I do not change keymap to Persian, I can achieve similar text
> entry capability with the benefit that ZWNJ input is as easy as the
> usual: shift + space. It actually shows the codepoint in blue ()
> but viewing from other editor-aware (such as mlterm's cat) it shows
> all well done. Now the problem is I should change keyboard language to
> English at OS level every time I escape to drive, that is use Vim's
> commands for text manipulation, navigation etc. It breaks (or brakes!)
> Vim's major usability.
> 
> I checked mlterm's font options (in configuration) but didn't notice a
> difference when changing font name etc.
> 
> How do I introduce ZWNJ to the first scenario?
> 
> ZWNJ reference: https://codepoints.net/U+200C

There hasn't been much work on Farsi support lately.  The Farsi mapping
is outdated, doesn't work with utf-8.  What I heard was that it's
probably best to do something similar to what Arabic support is doing.

Anyway, can you type this character with CTRL-V u 200c?
If not, maybe we can make CTRL-V switch the input to English, since
that makes most sense.


-- 
ARTHUR:  Shut up!  Will you shut up!
DENNIS:  Ah, now we see the violence inherent in the system.
ARTHUR:  Shut up!
DENNIS:  Oh!  Come and see the violence inherent in the system!
 HELP! HELP!  I'm being repressed!
  The Quest for the Holy Grail (Monty Python)

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


ZWNJ (Zero Width Non-Joiner) in Persian

2017-10-23 Thread Hamidreza Jafari
Hello,

Vim with mlterm is able to process Farsi input except with (some) special 
characters such as zero width non-joiner which is becoming a concern. I observe:

- if I set keymap to persian-iranian then text entry in Farsi and driving Vim 
with commands are seamless because there is no need to change keyboard language 
at OS level for commands. Keyboard language is fix in English. Whenever I start 
to type for text it automatically changes to Persian. Problem is I don't find a 
way to insert the famous ZWNJ, coincidentally a much used character in Persian 
and Arabic.

- if I do not change keymap to Persian, I can achieve similar text entry 
capability with the benefit that ZWNJ input is as easy as the usual: shift + 
space. It actually shows the codepoint in blue () but viewing from other 
editor-aware (such as mlterm's cat) it shows all well done. Now the problem is 
I should change keyboard language to English at OS level every time I escape to 
drive, that is use Vim's commands for text manipulation, navigation etc. It 
breaks (or brakes!) Vim's major usability.

I checked mlterm's font options (in configuration) but didn't notice a 
difference when changing font name etc.

How do I introduce ZWNJ to the first scenario?

ZWNJ reference: https://codepoints.net/U+200C

-- 
-- 
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: Advice needed: best practices for vim plugin testing

2017-10-23 Thread Lifepillar

On 19/10/2017 23:36, Marcin Szamotulski wrote:

On 11:10 Thu 19 Oct , Felipe Vieira wrote:

Hi everyone,

I've been trying to develop a plugin and I'm used to writing testing for the
softwares I develop. The problem is that I cannot find a suitable testing
platform for vim plugins. 

>
> [...]
>

Hi Felipe,

I've been missing a testing suite for vim too.  One possible solution is
to use the same technique that vim is using itself to test the code.
There are now bunch of assert functions (:h assert_equal(), etc.).


Here you may find a minimal script based on Vim functions:

https://gist.github.com/lifepillar/b5018945561e024eeb9fc57650fc5d61

Just write the tests at the top of the script using the above-mentioned
assert functions, then source it.

Depending of what you are looking for, that might be all you need. For
something more sophisticated than that, you may take a look at Vim's
own test suite, from which my snippet is derived.

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: Vim startup profiling

2017-10-23 Thread Ken Takata
Hi,

2017/5/26 Fri 22:36:40 UTC+9 Ken Takata wrote:
> > 096.000  047.000  044.000: sourcing D:\Logiciels\Vim\vim80/menu.vim
> > 096.000  072.000  025.000: sourcing D:\Logiciels\Vim\vim80\filetype.vim
> 
> menu.vim uses `globpath()` to search some kind of files under the
runtimepath.
> If you search `globpath` in menu.vim, you may find the following lines:
> 
>   let s:n = globpath(&runtimepath, "colors/*.vim")
> let s:n = globpath(&runtimepath, "keymap/*.vim")
>   let s = globpath(&rtp, "spell/*." . enc . ".spl")
>   let s:n = globpath(&runtimepath, "compiler/*.vim")
> 
> Color schemes, keymaps, spell files and compiler plugins are searched when
> menu.vim is loaded.
> This is why it takes long time to be loaded.
> 
> Unlike those items, file types are not listed automatically.  If a user
> selects "Syntax" -> "Show File Types in Menu", they will be listed.
> If we use a similar way for color schemes etc., the startup time would be
> reduced.

I wrote a patch for reduce the loading the of menu.vim by skip using
globpath().

https://bitbucket.org/k_takata/vim-ktakata-mq/src/bf92d701bca2ef46f6caa64aae89438e039370bb/improve-loading-menu.vim.patch?at=default&fileviewer=file-view-default

Instead of searching colors/*.vim and other files, the following menuitems are
added in the menu:

Edit > Show Color Schemes in Menu
Edit > Show Keymaps in Menu
Tools > Show Compiler Settings in Menu

If these menuitems are selected, all available colorschemes etc. are shown
in the menu.  If a user want to load them at startup, the following line
can be added in .vimrc:
:let do_globpath_menus = 1
(This is similar to `:let do_syntax_sel_menu = 1`.)


In my environment, the loading time of menu.vim is:
Without this patch:  30 - 50 ms
Skip using globpath: 15 - 20 ms

Regards,
Ken Takata

-- 
-- 
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: vim paste question

2017-10-23 Thread Tony Mechelynck
On Mon, Oct 23, 2017 at 12:21 PM, dexter i  wrote:
> i want to be able to emit the following lines into the file under current 
> cursor position.
>  is the word i just yanked. what's the best way to achieve 
> this.
>
> {
> .testtype = ; \
> .testtypestring = ""; \
> }

In Vim terminology, cut, copy and paste are called respectively
delete, yank and put.

See
:help p
:help P

If the yank was characterwise, p will put it after the character at
the cursor and P (i.e., Shift-p) will put it before that same
character. Putting it "instead of" the character, word, etc. at the
cursor is possible too but I don't think that's what you want.

OTOH, if you want to start typing between the line at the cursor and
the next one (or after the last line if the cursor is on it), going
from Normal to Insert mode in the process, the mnemonic for that is
"open", see :help o (and :help O if you want to start typing between
the line at the cursor and the one just above it, or before the first
line if the cursor is on it).

Finally, if you want to put a certain set of lines (linewise)
repeatedly after the cursor line, moving the cursor each time, you
could just yank those lines into a specific lettered register (e.g. by
visually highlighting the concerned lines with, let's say, Vjjj then
yanking with "ay to save them in register a -- or also, with the :yank
ex-command and a count, :4y a -- or with the same command and a range,
:/^{/,/^}/yank a ) then repeatedly putting with "ap to put the
linewise register a after the cursor line (the :yank, :delete and :put
ex-commands always operate linewise). You can save 26 strings that
way, each of them character- line- or block-wise (generally I reserve
register q for macros created with the q command).

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.


Re: vim paste question

2017-10-23 Thread Tim Chase
On 2017-10-23 03:21, dexter i wrote:
> i want to be able to emit the following lines into the file under
> current cursor position.  is the word i just
> yanked. what's the best way to achieve this.
> 
> {
> .testtype = ; \
> .testtypestring = ""; \
> }

There are some templating plugins that make this easier, but if it's
a one-off, you could do something like

 :nnoremap Q o{.testtype = 0;.testtypestring = 
"0";}

Adjust for your padding-spaces before the  if you want, but
it would depend on the length of your pasted content.  You could use
the expression register instead, something like

  =@0.repeat(' ', 50-strlen(@0))

and

  =@0.'"'.repeat(' ', 50-strlen(@0))

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


vim paste question

2017-10-23 Thread dexter i
i want to be able to emit the following lines into the file under current 
cursor position.
 is the word i just yanked. what's the best way to achieve 
this.

{
.testtype = ; \
.testtypestring = ""; \
}

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