Monday, May 31, 2010

Re: about backspace key



On Tue, Jun 1, 2010 at 2:19 PM, Gary Johnson <garyjohn@spocom.com> wrote:
On 2010-06-01, taco wrote:

> On Tue, Jun 1, 2010 at 10:57 AM, Ben Fritz <fritzophrenic@gmail.com> wrote:

>     On May 31, 9:01 pm, taco <tac...@gmail.com> wrote:
>     > at insert mode, if I enter character and press backspace to delete it, it
>     > works. after a second or I have pressed ESC, same as at insert mode,
>     > pressing backspace don't delete any character. vim default setting just
>     as
>     > this like?
>     >
>
>     Every post made to your original question tells you how to fix this,
>     and how to learn more.
>
>     Try reading them.

> ok, I am sorry,
>
> "Set backspace
> set backspace=eol,start,indent
>
> add above lines to .vimrc can fix this issue.
>
> I want to learn more, whether vim default setting about backspace is like :
> > at insert mode, if I enter character and press backspace to delete it, it
> > works. after a second or I have pressed ESC, same as at insert mode,
> > pressing backspace don't delete any character. vim default setting just as
> > this like?

Do you mean that pressing backspace does not delete the preceding
character in normal mode?  (See ":help vim-modes" for a definition
of normal mode.)  If so, that is correct:  in normal mode, pressing
backspace is supposed to move the cursor to the left, not delete
anything.  See

   :help <BS>

for a description of the behavior of the backspace key in normal
mode.  That help entry also shows you how to change the behavior to
delete a character.

Please don't top-post on this mailing list.  The convention here is
to bottom-post, as explained in the footer attached to every message
to this list.

HTH,
Gary

sorry again, I am new here.
thank you for your helping.
 
--
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 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

Re: about backspace key

On 2010-06-01, taco wrote:

> On Tue, Jun 1, 2010 at 10:57 AM, Ben Fritz <fritzophrenic@gmail.com> wrote:

> On May 31, 9:01 pm, taco <tac...@gmail.com> wrote:
> > at insert mode, if I enter character and press backspace to delete it, it
> > works. after a second or I have pressed ESC, same as at insert mode,
> > pressing backspace don't delete any character. vim default setting just
> as
> > this like?
> >
>
> Every post made to your original question tells you how to fix this,
> and how to learn more.
>
> Try reading them.

> ok, I am sorry,
>
> "Set backspace
> set backspace=eol,start,indent
>
> add above lines to .vimrc can fix this issue.
>
> I want to learn more, whether vim default setting about backspace is like :
> > at insert mode, if I enter character and press backspace to delete it, it
> > works. after a second or I have pressed ESC, same as at insert mode,
> > pressing backspace don't delete any character. vim default setting just as
> > this like?

Do you mean that pressing backspace does not delete the preceding
character in normal mode? (See ":help vim-modes" for a definition
of normal mode.) If so, that is correct: in normal mode, pressing
backspace is supposed to move the cursor to the left, not delete
anything. See

:help <BS>

for a description of the behavior of the backspace key in normal
mode. That help entry also shows you how to change the behavior to
delete a character.

Please don't top-post on this mailing list. The convention here is
to bottom-post, as explained in the footer attached to every message
to this list.

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

Re: Progress indicator for :TOhtml command

On Tue, 1 Jun 2010, Yongwei Wu wrote:

> I tried it on Windows, and the display was too flashy and intrusive.
> I can't say I like it.

I tried it too--on Windows and on Linux--and it was flashy and
unusable on both, plus about 15 to 20 percent slower than the original
on both.

I would be for having a progress meter, if it could be implemented in
a better way without slowing the script down.

My best suggestion is just to output one line every 5 to 10 percent
through processing with the current progress, e.g.:

0%
5%
10%
15%
[...]
95%
Done

- Christian

--
Abdominos... sit-ups & pizza.
Christian J. Robinson <heptite@gmail.com> http://christianrobinson.name/

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

Re: Progress indicator for :TOhtml command

On 1 June 2010 04:47, Benjamin Fritz <fritzophrenic@gmail.com> wrote:
> I love using the :TOhtml command, and I keep finding more ways to use
> it. Recently, I had a large-ish log file (several thousand lines), in
> which I wanted to call attention to a few groups of lines, but I
> figured people may want the context as well. So, I set up some folds
> and some quick syntax highlighting, and went to go create an html copy
> of it using the "dynamic folding" feature of the command.
>
> Unfortunately, I discovered that processing such a large file, even
> with no syntax highlighting, takes a *very* long time. I probably
> should have selected just a smaller area of interest but...
>
> I waited quite a while, and finally hit CTRL-C to stop it. Luckily it
> hadn't actually gotten that far (probably about 30%), but I was
> worried that it may have been almost done, and all I needed to do was
> wait a bit longer.
>
> So anyway, for future use, I wanted to be able to see quickly whether
> the conversion was worth waiting for. Therefore, I have written a
> patch to add a progress indicator. When I opened the file, I noticed
> that indentation is quite a mess (a mix of tabs and spaces, sometimes
> in the same line), so I also fixed that up (by using gg=G with noet,
> sw=2, sts=2, and ts=2). For clarity, I ran the diff on the file
> *after* fixing the ident.
>
> Since the indentation patch is actually *larger* than the file itself,
> I have just attached the fully patched file instead of a patch. This
> will also make it easier for Windows users to try :-)
>
> Please comment...especially if you know of a better way to accomplish
> something similar. I tried using :echon to draw the progress bar, but
> the echo was being cleared each time through the main loop, so I
> switched to using :echo with a string that is gradually built as the
> script processes.

I tried it on Windows, and the display was too flashy and intrusive.
I can't say I like it.

And there was nothing to "fix" about the tabs. They were perfectly
fine. Tabstop was set to the default (8), and only shiftwidth was set
to 2 (along with sts, which does not affect the saved file). You
seemed to have confused them. The original version is easier to view
(using type/cat/more/less or nearly anything).

--
Wu Yongwei
URL: http://wyw.dcweb.cn/

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

Re: about backspace key

ok, I am sorry,

"Set backspace
set backspace=eol,start,indent

add above lines to .vimrc can fix this issue.

I want to learn more, whether vim default setting about backspace is like :
> at insert mode, if I enter character and press backspace to delete it, it
> works. after a second or I have pressed ESC, same as at insert mode,
> pressing backspace don't delete any character. vim default setting just as
> this like?

Best Reards!

On Tue, Jun 1, 2010 at 10:57 AM, Ben Fritz <fritzophrenic@gmail.com> wrote:


On May 31, 9:01 pm, taco <tac...@gmail.com> wrote:
> at insert mode, if I enter character and press backspace to delete it, it
> works. after a second or I have pressed ESC, same as at insert mode,
> pressing backspace don't delete any character. vim default setting just as
> this like?
>

Every post made to your original question tells you how to fix this,
and how to learn more.

Try reading them.

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

Re: about backspace key

On May 31, 9:01 pm, taco <tac...@gmail.com> wrote:
> at insert mode, if I enter character and press backspace to delete it, it
> works. after a second or I have pressed ESC, same as at insert mode,
> pressing backspace don't delete any character. vim default setting just as
> this like?
>

Every post made to your original question tells you how to fix this,
and how to learn more.

Try reading them.

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

Re: about backspace key

at insert mode, if I enter character and press backspace to delete it, it works. after a second or I have pressed ESC, same as at insert mode, pressing backspace don't delete any character. vim default setting just as this like?


On Mon, May 31, 2010 at 8:55 PM, just <hoolooday@gmail.com> wrote:
"Set backspace
set backspace=eol,start,indent

BTW,you can use <c-h> to delete the  word instead of the backspace

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

Re: delete lines from while loop

Hi Andrei!

On Mo, 31 Mai 2010, Andrei Popescu wrote:

> Hello,
>
> I'm trying to add new features to the po.vim plugin[1], first one being
> the removal of the previous msgid in fuzzy strings:
>
> #, fuzzy
> #| msgid ""
> #| "The following disk access storage devices (DASD) are available. Please "
> #| "select each device you want to use one at a time."
> msgid ""
> "The following direct access storage devices (DASD) are available. Please "
> "select each device you want to use one at a time."
> msgstr ""
> "Următoarele Dispozitive de stocare cu acces la disc (DASD) sunt disponibile. "
> "Vă rugăm să alegeți pe rând fiecare dispozitiv pe care doriți să-l folosiți."
>
> So far I have:
>
> " Remove previous msgid and fuzzy description from the translation.
> if !hasmapto('<Plug>RemoveFuzzy')
> if gui
> imap <buffer> <unique> <S-F8> <Plug>RemoveFuzzy
> nmap <buffer> <unique> <S-F8> <Plug>RemoveFuzzy
> else
> imap <buffer> <unique> <LocalLeader>r <Plug>RemoveFuzzy
> nmap <buffer> <unique> <LocalLeader>r <Plug>RemoveFuzzy
> endif
> endif
> inoremap <buffer> <unique> <Plug>RemoveFuzzy <ESC>{vap:call <SID>RemoveFuzzy()<CR>gv<ESC>}i
> nnoremap <buffer> <unique> <Plug>RemoveFuzzy {vap:call <SID>RemoveFuzzy()<CR>gv<ESC>}
>
> fu! <SID>RemoveFuzzy() range
> for linenum in range(a:firstline, a:lastline)
> let line = getline(linenum)
> if line =~ '^#,.*fuzzy'
> exe "normal! dd"
> "call setline(linenum, substitute(line, '^.*$','',''))
> elseif line =~ '^#|\smsgid\s".*"$'
> exe "normal! dd"
> "call setline(linenum, substitute(line, '^.*$','',''))
> elseif line =~ '^#|\s".*"$'
> exe "normal! dd"
> "call setline(linenum, substitute(line, '^.*$','',''))
> endif
> endfor
> endf

I am not sure, I understand your problem. Anyway, your function has one
problem. You are deleting lines (including the end-of-line), so you
after the exe "normal! dd" command your file has actually one line less
then before. And the next time you run getline(linenum) you get actually
the wrong line. (which would now be equivalent to linenum+1 and each
time you do normal! dd you add another one)


regards,
Christian
--
Was ist der Unterschied zwischen Männern und Schweinen?
Schweine verwandeln sich nicht in Männer, wenn sie betrunken sind.

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

Progress indicator for :TOhtml command

I love using the :TOhtml command, and I keep finding more ways to use
it. Recently, I had a large-ish log file (several thousand lines), in
which I wanted to call attention to a few groups of lines, but I
figured people may want the context as well. So, I set up some folds
and some quick syntax highlighting, and went to go create an html copy
of it using the "dynamic folding" feature of the command.

Unfortunately, I discovered that processing such a large file, even
with no syntax highlighting, takes a *very* long time. I probably
should have selected just a smaller area of interest but...

I waited quite a while, and finally hit CTRL-C to stop it. Luckily it
hadn't actually gotten that far (probably about 30%), but I was
worried that it may have been almost done, and all I needed to do was
wait a bit longer.

So anyway, for future use, I wanted to be able to see quickly whether
the conversion was worth waiting for. Therefore, I have written a
patch to add a progress indicator. When I opened the file, I noticed
that indentation is quite a mess (a mix of tabs and spaces, sometimes
in the same line), so I also fixed that up (by using gg=G with noet,
sw=2, sts=2, and ts=2). For clarity, I ran the diff on the file
*after* fixing the ident.

Since the indentation patch is actually *larger* than the file itself,
I have just attached the fully patched file instead of a patch. This
will also make it easier for Windows users to try :-)

Please comment...especially if you know of a better way to accomplish
something similar. I tried using :echon to draw the progress bar, but
the echo was being cleared each time through the main loop, so I
switched to using :echo with a string that is gradually built as the
script processes.

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

Re: plugins don't work on newer version

On 31/05/2010 7:06 AM, taco wrote:
> thank you! it worked now, but I need copy those plugins to ~/.vim/plugin/

Yes, that is the _correct_ location you are supposed to install any
customizations / plugins you add to Vim.

The directory you specified earlier should only be touched by a Vim
installer.

Dave

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

delete lines from while loop

Hello,

I'm trying to add new features to the po.vim plugin[1], first one being
the removal of the previous msgid in fuzzy strings:

#, fuzzy
#| msgid ""
#| "The following disk access storage devices (DASD) are available. Please "
#| "select each device you want to use one at a time."
msgid ""
"The following direct access storage devices (DASD) are available. Please "
"select each device you want to use one at a time."
msgstr ""
"Următoarele Dispozitive de stocare cu acces la disc (DASD) sunt disponibile. "
"Vă rugăm să alegeți pe rând fiecare dispozitiv pe care doriți să-l folosiți."

So far I have:

" Remove previous msgid and fuzzy description from the translation.
if !hasmapto('<Plug>RemoveFuzzy')
if gui
imap <buffer> <unique> <S-F8> <Plug>RemoveFuzzy
nmap <buffer> <unique> <S-F8> <Plug>RemoveFuzzy
else
imap <buffer> <unique> <LocalLeader>r <Plug>RemoveFuzzy
nmap <buffer> <unique> <LocalLeader>r <Plug>RemoveFuzzy
endif
endif
inoremap <buffer> <unique> <Plug>RemoveFuzzy <ESC>{vap:call <SID>RemoveFuzzy()<CR>gv<ESC>}i
nnoremap <buffer> <unique> <Plug>RemoveFuzzy {vap:call <SID>RemoveFuzzy()<CR>gv<ESC>}

fu! <SID>RemoveFuzzy() range
for linenum in range(a:firstline, a:lastline)
let line = getline(linenum)
if line =~ '^#,.*fuzzy'
exe "normal! dd"
"call setline(linenum, substitute(line, '^.*$','',''))
elseif line =~ '^#|\smsgid\s".*"$'
exe "normal! dd"
"call setline(linenum, substitute(line, '^.*$','',''))
elseif line =~ '^#|\s".*"$'
exe "normal! dd"
"call setline(linenum, substitute(line, '^.*$','',''))
endif
endfor
endf

but it doesn't work and I don't understand why. As it is now it only
deletes the empty line separating this "paragraph" from the previous
one. I'm guessing the problem is with the "exe" command, because
replacing it with the commented out "call" the lines are emptied as
expected.

I also tried other variations, like

exe ":delete"
exe "1d"

There must be a detail I'm missing, but I read the docs and searched the
web and couldn't find the answer. Any hints?

[1] http://www.vim.org/scripts/script.php?script_id=695

Regards,
Andrei
--
Offtopic discussions among Debian users and developers:
http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic

Re: plugins don't work on newer version

On 2010-05-31, taco wrote:
> thank you! it worked now, but I need copy those plugins to ~/.vim/plugin/
>
> if those plugins locate at /usr/share/vim/vim70/plugin/ it don't work.but,
> version 7.0 can work
>
> I don't why.

The reason is that since you are now using Vim 7.2, Vim is looking
for its plugins in a directory with "vim72" in its path rather than
"vim70". You can find out where it is looking by executing

:echo $VIMRUNTIME

to see just that directory, or

:set rtp?

to see all the directories Vim searches. You can also see the names
of the plugins that Vim has actually loaded by executing

:scriptnames

This is why you should never put non-standard plugins such as
tlist.vim in $VIMRUNTIME; you should always put them in either a
common directory such as /usr/share/vim/vimfiles or in your HOME
directory in ~/.vim. In that way, Vim can always find those plugins
even as you update your installation to more recent versions.

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

Re: plugins don't work on newer version

Marc Weber,
thank you very much. I got it.


On Mon, May 31, 2010 at 9:06 PM, Marc Weber <marco-oweber@gmx.de> wrote:
Excerpts from taco's message of Mon May 31 13:06:36 +0200 2010:
> thank you! it worked now, but I need copy those plugins to ~/.vim/plugin/
>
> if those plugins locate at /usr/share/vim/vim70/plugin/ it don't work.but,
> version 7.0 can work
>
> I don't why.

:echo &runtimepath

will tell you.
Plugins should not be enabled by default for all users. Maybe this was
done intentionally and all you have to do is adding

set runtimepath+=/usr/share/vim/vim70

to your .vimrc.

Marc Weber

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

Re: about backspace key

On 05/31/2010 07:44 AM, taco wrote:
> why my backspace can't work on insert mode? I alway need to
> move to before the character and press Delete key to delete
> it. where is the setting about it?

You want the 'backspace' option which controls what <backspace>
can/can't delete.

:help 'backspace'

It's there for backwards compatibility, but I like to set it to

set backspace=indent,eol,start

-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

Re: plugins don't work on newer version

Excerpts from taco's message of Mon May 31 13:06:36 +0200 2010:
> thank you! it worked now, but I need copy those plugins to ~/.vim/plugin/
>
> if those plugins locate at /usr/share/vim/vim70/plugin/ it don't work.but,
> version 7.0 can work
>
> I don't why.

:echo &runtimepath

will tell you.
Plugins should not be enabled by default for all users. Maybe this was
done intentionally and all you have to do is adding

set runtimepath+=/usr/share/vim/vim70

to your .vimrc.

Marc Weber

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

Re: about backspace key

2010/5/31 taco <tacoee@gmail.com>:
> hi, all
>       why my backspace can't work on insert mode? I alway need to move to
> before the character and press Delete key to delete it.
> where is the setting about it?
> Best Regards.
>

Read:

:h 'backspace'

-geirr

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

Re: about backspace key

"Set backspace
set backspace=eol,start,indent

BTW,you can use <c-h> to delete the  word instead of the backspace

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

about backspace key

hi, all
      why my backspace can't work on insert mode? I alway need to move to before the character and press Delete key to delete it.
where is the setting about it?

Best Regards.

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

Re: plugins don't work on newer version

thank you! it worked now, but I need copy those plugins to ~/.vim/plugin/

if those plugins locate at /usr/share/vim/vim70/plugin/ it don't work.but, version 7.0 can work

I don't why.

On Mon, May 31, 2010 at 6:33 PM, Marc Weber <marco-oweber@gmx.de> wrote:
Hi taco,

make sure your plugin is loaded.
Did it define *any* command?

You can debug this by opening the tlist.vim file adding a debug line
such as

echoe "This file was sourced"

at top.

If you neither see a red line printing this text nor find this text when
running :messages the file was not sourced.

If you know that's sourced look for "finish" and make sure that the
lines after that word are executed as well.

if this happens try to find the word "command" or com which is the
abbreviation for it. That should define those Tlist commands.
add the echoe line before and after those lines defining those commands.
Are those lines executed on startup as well?

If this happens and if you still don't have those commands something may
be broken. Post your results.

Marc Weber

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

Fwd: Problem using for maps

sorry I sent the previous message only to tony

---------- Mensaje reenviado ----------
De: Pablo Giménez <pablogipi@gmail.com>
Fecha: 31 de mayo de 2010 11:38
Asunto: Re: Problem using <Plug> for maps
Para: Tony Mechelynck <antoine.mechelynck@gmail.com>


This is the output of the verbose command:
  <C-O>       * <Plug>TdvimOpenfile
        Last set from /user_data/ARCHIVE/TDVim/keymaps.vim
And for <Plug>TdvimOpenfile:
   <Plug>TdvimOpenfiletab & :browse tabnew<CR>
        Last set from /user_data/ARCHIVE/TDVim/keymaps.vim
   <Plug>TdvimOpenfile * :browse e<CR>
        Last set from /user_data/ARCHIVE/TDVim/keymaps.vim

Seems that maps are sourced properly and my script is the last one doing it.
Is is strange cos it seems that is I use map rather than norempa it works.
This statement works:
map  <silent> <C-o> <Plug>TdvimOpenfile
And this one doesn't:
noremap  <silent> <C-o> <Plug>TdvimOpenfile

No idea why this is happening, at least I have a workaround.

El 28 de mayo de 2010 20:23, Tony Mechelynck <antoine.mechelynck@gmail.com> escribió:
On 28/05/10 19:24, Pablo Giménez wrote:

Hi.
I am trying to use the <Plug> attribute for my script keymaps. But so
far is not working as expected.
I have the next in a afile called keymaps.vim
nnoremap <silent> <Plug>KeymapsOpenFile :browse e<CR>
map <C-o> <Plug>KeymapsOpenFile

This is not working, when I press <C-o> nothing happens.
But if I manually from the command line type:
:map <C-o> <Plug>KeymapsOpenFile

Then the map works perfectly.
Any ideas???
thanks

--
Un saludo
Best Regards
Pablo Giménez

Maybe something  which is sourced after your keymaps.vim defines another mapping for that key? Or maybe your keymaps.vim is not sourced at all?

- In which directory have you put that keymaps.vim file?

- What does Vim say in reply to

       :verbose map <C-O>

when you type that in a Vim session where you have *not* manually defined the mapping from the command-line?



Best regards,
Tony.
--
What good is having someone who can walk on water if you don't follow
in his footsteps?



--
Un saludo
Best Regards
Pablo Giménez



--
Un saludo
Best Regards
Pablo Giménez

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

Re: plugins don't work on newer version

Hi taco,

make sure your plugin is loaded.
Did it define *any* command?

You can debug this by opening the tlist.vim file adding a debug line
such as

echoe "This file was sourced"

at top.

If you neither see a red line printing this text nor find this text when
running :messages the file was not sourced.

If you know that's sourced look for "finish" and make sure that the
lines after that word are executed as well.

if this happens try to find the word "command" or com which is the
abbreviation for it. That should define those Tlist commands.
add the echoe line before and after those lines defining those commands.
Are those lines executed on startup as well?

If this happens and if you still don't have those commands something may
be broken. Post your results.

Marc Weber

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

plugins don't work on newer version

hi, all.
      plugins such as taglist, work fine on vim7.0, but those plugins can't work any more after I update vim to version 7.2.441, the latest version. 
when I type : TlistToggle at command line, it note  me as fellow error:
                                                                            
E492: Not an editor command: TlistToggle 

what is wrong? 

Best Regards. 

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

Sunday, May 30, 2010

Re: Regex matching the first occurrence of a string

On May 30, 10:02 pm, Ben Fritz <fritzophre...@gmail.com> wrote:
>
> So, your final command would be:
>
> :%s/Begin\_.*\(End\)\{-1}/This was one block/c

Oops,

:%s/Begin\_.\{-}\(End\)\{-1}/This was one block/c

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

Re: Regex matching the first occurrence of a string

On May 28, 9:50 pm, ShayAllen <alexalle...@hotmail.com> wrote:
> I want to match everything between and including Begin and End. There are
> several blocks in the file:
>
> Begin
>   ssss
>   dfsdfsdf
>   sdfsdf
> End
>
> Begin
>   sasdfsa
>   sdfgsd
>   hghfgh
> End
>
> My best guess so far:
> :%s/Begin\_.*\(End\)\{-1}/This was one block/
> Doesn't work
>

One problem you have is that you use the "greedy" match, \_.*, so that
you will match everything between the FIRST begin and the LAST end.

Try using \_.\{-} instead, to match in a "non-greedy" fashion, so that
you only get the individual blocks.

From your title, I infer that you may want to match only the very
first block in the file. The easiest way to do this is probably just
to add the 'c' flag to the end of your substitute command, so that you
need to "confirm" each replacement (you could then cancel the
substitute after the first replacement).

So, your final command would be:

:%s/Begin\_.*\(End\)\{-1}/This was one block/c

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

Re: Regex matching the first occurrence of a string

ShayAllen wrote:
>
> I want to match everything between and including Begin and End. There are
> several blocks in the file:
>
> Begin
> ssss
> dfsdfsdf
> sdfsdf
> End
>
> Begin
> sasdfsa
> sdfgsd
> hghfgh
> End
>
> My best guess so far:
> :%s/Begin\_.*\(End\)\{-1}/This was one block/
> Doesn't work
>
> What am I missing?
> Thanks.
>

Fair questions, Tim. No nested blocks or other tricky stuff. Brett's
solution worked fine and was an instructive example for me. Thanks.

--
View this message in context: http://old.nabble.com/Regex-matching-the-first-occurrence-of-a-string-tp28712875p28725924.html
Sent from the Vim - General mailing list archive at Nabble.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

Saturday, May 29, 2010

Re: Where are the VIM buffers stored?

On 29 May 2010 14:33, Tim Chase <vim@tim.thechases.com> wrote:
> The persistence of registers within the viminfo file has been around for
> quite a while (at least since I started using vim back around version 5.x)
> -- however its default settings may vary depending on platform (some Linux
> distros may tweak the default behavior in the stock vim settings); or you
> may have put something in your vimrc, forgotten about it, and then not
> carried your vimrc to a new upgrade/platform.
>

Any of those are possible, I'm quite a noob and had distro-hopped a bit.

Thanks.


--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.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

Re: Text printing questions

On 28 mai, 21:17, Tony Mechelynck <antoine.mechely...@gmail.com>
wrote:
> On 28/05/10 18:55, ThG wrote:
>
>
>
>
>
> > Bonjour,
>
> > I want to use Vim to write a book, which means I periodically wish to
> > print my WIP.
> > Each Vim line is, in fact, a normal book paragraph, of course.
>
> > My .vimrc file has these settings :
>
> > set
> > printoptions=paper:A4,portrait:y,duplex:long,wrap:y,number:y,syntax:n
> > set printfont=Inconsolata:h13
>
> > The results are, as you already guessed :
> > - Vim line numbers : correctly adjusted on the left, no word wrapping
> > underneath
> > - Text wrapping : if it wraps, it is truncated, and it is not
> > truncated only when it does not wrap
> > - Plus, I have a little annoyance : the paragraphs (Vim lines) have no
> > space to visually separate them ; I know the solution is to insert a
> > blank line in between, but that messes up the numbering
>
> > My questions :
>
> > - Is it possible to have a word-wrap equivalent in the printing
> > process (I read that part of the manual, and I know this is not a
> > printoption) ? Btw, does Vim 7.3 solve this ?
> > - Is it possible to have a bigger linespace "breathing" at the end of
> > the Vim line ?
> > - And a very secondary question : is it possible to print directly a
> > booklet on a recto-verso A4, something like (in plain english) : print
> > page 4, then page 1, duplex:short, then page 3, and finally page 2
> > then repeat (increment 4) until you reach the end of the 500 pages
> > masterpiece ... ? or must I use Acrobat to do this ?
>
> > Thanks in advance
>
> > ThG
>
> One possibility (among several, I'm sure) would be to write your text in
> HTML using Vim (wrapping each paragraph between <p> and </p>, which will
> usually produce additional space between paragraphs) and then printing
> in your browser. This way you can set any font (not only a monospace
> one) and even justify the text, as follows:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html><head>
> <title>This title will be displayed on top of browser windows</title>
> <meta http-equiv="Content-Type" content="text/html, charset=utf-8">
> <style type="text/css">
> <!--
> body
>   { font-family:    "Century Schoolbook", "Times New Roman", serif
>   ; text-align:     justify
>   }
> h1, h2, h3
>   { text-align:     center
>   }
> //-->
> </style>
> </head><body>
> <h1>Here comes the title to be printed at the top of the document</h1>
> <h2>Introduction</h2>
> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
> eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
> minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
> ex ea commodo consequat.</p>
> <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
> dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
> proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
>
> <h2>First chapter: blah blah blah</h2>
> <p>One advantage is that you can use all the HTML markup, for instance
> <b>bold,</b> <i>italics,</i> <u>underlining</u>, <sub>subscripts</sub>,
> <sup>superscripts</sup>, etc., even tables and pictures (which I'm not
> going to detail here) in any combination (but with proper tag nesting),
> for instance <b><i>bold italics</i></b> or <i>italic text with one
> <u>underlined</u> italic word in the middle...</i></p>
>
> </body></html>
>
> Best regards,
> Tony.
> --
> With every passing hour our solar system comes forty-three thousand
> miles closer to globular cluster M13 in the constellation Hercules, and
> still there are some misfits who continue to insist that there is no
> such thing as progress.
>                 -- Ransom K. Ferm
-----------------------------------------------

Thanks for your solution : I tried it out, and it was the answer to my
question, but now i am faced with a new problem…

For me, the interest of Vim is to

1) allow me to write fullscreen with nothing standing in the way
(including tags)
2) give me access to a few powerful features : filter buffer according
to pattern (:g/pattern), move easily lines up & down (:m 12 ),
highlighting, etc…

A Html file would be compatible with 2), but not with 1), unless it is
possible to hide tags (I mean tags themselves, not the text in
between), but it is not, is it ?

So the workaround could be :
- to have a plain text file WIP.txt, to work with
- and to format it as WIP.html via macros (from <!DOCTYPE … to </h1>,
then paragraphs after paragraphs, then </body></html>) for printing :
after all, all I have to print is a title and paragraphs. And if I
want these paragraphs to be numbered, I might as well use an ordered
list.

(Btw, I tried a recursive macro (qa) calling itself while recording
(@a, then q), but then MacVim began to vibrate and froze. What did I
do wrong ?)

Anyway, back to work and thanks again

ThG

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

Re: Relative path to plugin script?

> Did you try expand('<sfile>:p:h') in order to obtain the directory where your script is installed?

I remember sfile not working within functions. So you have to define a
file local var as suggested:

let s:foo = expand('<sfile>:p:h') ..

Then you can use that var within that file easily.

Marc Weber

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

Re: Regex matching the first occurrence of a string

ShayAllen wrote:
> I want to match everything between and including Begin and End. There are
> several blocks in the file:
>
> Begin
> ssss
> dfsdfsdf
> sdfsdf
> End
>
> Begin
> sasdfsa
> sdfgsd
> hghfgh
> End
>
> My best guess so far:
> :%s/Begin\_.*\(End\)\{-1}/This was one block/

Try this...
%s/^Begin\_$\_.\{-}\_^End$/This was one block/

:help /\{
:help /\_$
:help /\_^

Note that in your pattern, the \{-1} was modifying "End", which I don't
think is what you wanted.

Brett Stahlman

> Doesn't work
>
> What am I missing?
> 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

Re: Where are the VIM buffers stored?

On 05/29/2010 04:35 AM, Dotan Cohen wrote:
> On 29 May 2010 00:16, Tim Chase<vim@tim.thechases.com> wrote:
>> :help viminfo
>
> Yes, thanks. That is exactly what I needed.
>
> Since which VIM version are the registers available between sessions?
> It seems that I can now yank from one file, shut down the machine,
> then paste into another file. Was this always the case?

The persistence of registers within the viminfo file has been
around for quite a while (at least since I started using vim back
around version 5.x) -- however its default settings may vary
depending on platform (some Linux distros may tweak the default
behavior in the stock vim settings); or you may have put
something in your vimrc, forgotten about it, and then not carried
your vimrc to a new upgrade/platform.

-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

Re: Regex matching the first occurrence of a string

On 05/28/2010 09:50 PM, ShayAllen wrote:
>
> I want to match everything between and including Begin and End. There are
> several blocks in the file:
>
> Begin
> ssss
> dfsdfsdf
> sdfsdf
> End
>
> Begin
> sasdfsa
> sdfgsd
> hghfgh
> End
>
> My best guess so far:
> :%s/Begin\_.*\(End\)\{-1}/This was one block/
> Doesn't work

Without details of what "Doesn't work" means, it's a little hard
to guess. Can your blocks be nested?

Begin
stuff
Begin
stuff2
stuff3
End
stuff4
End

Does case matter? Can you have begin/end text in other stuff?

Begin
stuff
this is not the End
more stuff
End

-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

Re: Where are the VIM buffers stored?

On 29 May 2010 00:16, Tim Chase <vim@tim.thechases.com> wrote:
> On 05/28/2010 04:03 PM, Dotan Cohen wrote:
>>
>> Ii have noticed that I can exit VIM then open another file and my
>> buffers are saved! Where is that info saved?
>
> I presume by "buffers" you mean what Vim calls "registers" which are
> preserved in your viminfo file.
>
>  :help viminfo
>
> The items saved are controlled by your 'viminfo' setting:
>
>  :help 'viminfo'
>
> Hope this helps,
>
> -tim
>
>
>

Yes, thanks. That is exactly what I needed.

Since which VIM version are the registers available between sessions?
It seems that I can now yank from one file, shut down the machine,
then paste into another file. Was this always the case?


--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.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

Re: Relative path to plugin script?

> If you push bundle into &rtp, I'd recommend you to play with globpath() instead in order to find the script. It's a neater solution IMO.

findfile('bin/yourplugin.groovy', &rtp) would be an alternative
solution.

> exe "nnoremap <leader>f :call system(".string(s:install_dir).".'../bin/yourplugin.groovy')<cr>"

I think you should also use shellescape(s:install_dir).

Regards,
Tom

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

Friday, May 28, 2010

Regex matching the first occurrence of a string

I want to match everything between and including Begin and End. There are
several blocks in the file:

Begin
ssss
dfsdfsdf
sdfsdf
End

Begin
sasdfsa
sdfgsd
hghfgh
End

My best guess so far:
:%s/Begin\_.*\(End\)\{-1}/This was one block/
Doesn't work

What am I missing?
Thanks.
--
View this message in context: http://old.nabble.com/Regex-matching-the-first-occurrence-of-a-string-tp28712875p28712875.html
Sent from the Vim - General mailing list archive at Nabble.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

RE: Mapping the Super / Windows key

LuKreme wrote:
>>> if !has("gui_macvim")
>>> vnoremap <C-X> "+x
>>> vnoremap <C-C> "+y
>>> imap <C-V> "+gP
>>> cmap <C-V> <C-R>+
>>>
>>> " Pasting blockwise and linewise selections is not possible in
>>> Insert and " Visual mode without the +virtualedit feature.
>>> They are pasted as if they " were characterwise instead.
>>> " Uses the paste.vim autoload script.
>>>
>>> exe 'inoremap <script> <C-V>' paste#paste_cmd['i']
>>> exe 'vnoremap <script> <C-V>' paste#paste_cmd['v']
>>>
>>> " Use CTRL-Q to do what CTRL-V used to do
>>> noremap <C-Q> <C-V>
>>> endif
>
> Someone want to explain to me what this means (syntax-wise)?

It's too complex to explain! However if you are really keen, put
the cursor on the following line and type gf to open the file:
$VIMRUNTIME/autoload/paste.vim

Read :help autoload when you have a spare couple of hours.

In the above, I don't know if this line:
>>> imap <C-V> "+gP
is supposed to work (it looks like something is missing, but
mainly it is redundant due to what follows).

I'm pretty sure the following line should be removed as
pointless since (I think) all Vims will take Ctrl-Q instead of
Ctrl-V for some time (except for those terminals where Ctrl-Q is
XON).
>>> noremap <C-Q> <C-V>

I use the following:

" Select all, cut, copy, paste
nnoremap <C-A> ggVG
vnoremap <C-X> "+x
vnoremap <C-C> "+y
nnoremap <C-V> "+gP
cnoremap <C-V> <C-R>+
exe 'inoremap <script> <C-V>' paste#paste_cmd['i']
exe 'vnoremap <script> <C-V>' paste#paste_cmd['v']

John

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

Re: Where are the VIM buffers stored?

On 05/28/2010 04:03 PM, Dotan Cohen wrote:
> Ii have noticed that I can exit VIM then open another file and my
> buffers are saved! Where is that info saved?

I presume by "buffers" you mean what Vim calls "registers" which
are preserved in your viminfo file.

:help viminfo

The items saved are controlled by your 'viminfo' setting:

:help 'viminfo'

Hope this helps,

-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

Where are the VIM buffers stored?

Ii have noticed that I can exit VIM then open another file and my
buffers are saved! Where is that info saved?

Thanks.

--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.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

Re: Relative path to plugin script?

Hello,

"Nathan Neff" wrote :

> I'm writing a plugin that uses a script written in Groovy.
>
> I store the script in ~/.vim/bin, and when the user presses a key,
> the
> Groovy script is run by Vim. Everything worked great, until I
> switched to using pathogen(1) for Vim, and now my script is stored in
>
> ~/.vim/bundle/myplugin/bin
>
> so, Vim can't find ~/.vim/bin/myscript.groovy
>
> I guess I'm looking for a more bullet proof way to set up Vim to call
> the groovy script.
>
> For example, calling something like this from myplugin.vim:
>
> map <leader>f system(<this plugin's
> directory>/../bin/myplugin.groovy)
>
> So, I need a way to find the directory where the plugin is being ran
> from,

Did you try expand('<sfile>:p:h') in order to obtain the directory where your script is installed?
(the expression will return the expected result only from outside any function context) i.e.:

:let s:install_dir = expand('<sfile>:p:h')
exe "nnoremap <leader>f :call system(".string(s:install_dir).".'../bin/yourplugin.groovy')<cr>"

or may be just:
nnoremap <leader>f :call system(s:install_dir.'../bin/yourplugin.groovy')<cr>
but I'm not sure s: variables expands correctly into mapping context.

If you push bundle into &rtp, I'd recommend you to play with globpath() instead in order to find the script. It's a neater solution IMO.

--
Luc Hermitte
http://lh-vim.googlecode.com/
http://hermitte.free.fr/vim/

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

Relative path to plugin script?

I'm writing a plugin that uses a script written in Groovy.

I store the script in ~/.vim/bin, and when the user presses a key, the
Groovy script is run by Vim. Everything worked great, until I
switched to using pathogen(1) for Vim, and now my script is stored in

~/.vim/bundle/myplugin/bin

so, Vim can't find ~/.vim/bin/myscript.groovy

I guess I'm looking for a more bullet proof way to set up Vim to call
the groovy script.

For example, calling something like this from myplugin.vim:

map <leader>f system(<this plugin's directory>/../bin/myplugin.groovy)

So, I need a way to find the directory where the plugin is being ran
from, so that
I can create an absolute path to <this plugin directory>/bin/myscript.groovy

Any ideas?

Thanks,
--Nate

(1) See http://tammersaleh.com/posts/the-modern-vim-config-with-pathogen

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

Re: Problem using for maps

On 28/05/10 19:24, Pablo Giménez wrote:
> Hi.
> I am trying to use the <Plug> attribute for my script keymaps. But so
> far is not working as expected.
> I have the next in a afile called keymaps.vim
> nnoremap <silent> <Plug>KeymapsOpenFile :browse e<CR>
> map <C-o> <Plug>KeymapsOpenFile
>
> This is not working, when I press <C-o> nothing happens.
> But if I manually from the command line type:
> :map <C-o> <Plug>KeymapsOpenFile
>
> Then the map works perfectly.
> Any ideas???
> thanks
>
> --
> Un saludo
> Best Regards
> Pablo Giménez

Maybe something which is sourced after your keymaps.vim defines another
mapping for that key? Or maybe your keymaps.vim is not sourced at all?

- In which directory have you put that keymaps.vim file?

- What does Vim say in reply to

:verbose map <C-O>

when you type that in a Vim session where you have *not* manually
defined the mapping from the command-line?

Best regards,
Tony.
--
What good is having someone who can walk on water if you don't follow
in his footsteps?

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

Re: Text printing questions

On 28/05/10 18:55, ThG wrote:
> Bonjour,
>
> I want to use Vim to write a book, which means I periodically wish to
> print my WIP.
> Each Vim line is, in fact, a normal book paragraph, of course.
>
> My .vimrc file has these settings :
>
> set
> printoptions=paper:A4,portrait:y,duplex:long,wrap:y,number:y,syntax:n
> set printfont=Inconsolata:h13
>
> The results are, as you already guessed :
> - Vim line numbers : correctly adjusted on the left, no word wrapping
> underneath
> - Text wrapping : if it wraps, it is truncated, and it is not
> truncated only when it does not wrap
> - Plus, I have a little annoyance : the paragraphs (Vim lines) have no
> space to visually separate them ; I know the solution is to insert a
> blank line in between, but that messes up the numbering
>
> My questions :
>
> - Is it possible to have a word-wrap equivalent in the printing
> process (I read that part of the manual, and I know this is not a
> printoption) ? Btw, does Vim 7.3 solve this ?
> - Is it possible to have a bigger linespace "breathing" at the end of
> the Vim line ?
> - And a very secondary question : is it possible to print directly a
> booklet on a recto-verso A4, something like (in plain english) : print
> page 4, then page 1, duplex:short, then page 3, and finally page 2
> then repeat (increment 4) until you reach the end of the 500 pages
> masterpiece ... ? or must I use Acrobat to do this ?
>
> Thanks in advance
>
> ThG
>

One possibility (among several, I'm sure) would be to write your text in
HTML using Vim (wrapping each paragraph between <p> and </p>, which will
usually produce additional space between paragraphs) and then printing
in your browser. This way you can set any font (not only a monospace
one) and even justify the text, as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<title>This title will be displayed on top of browser windows</title>
<meta http-equiv="Content-Type" content="text/html, charset=utf-8">
<style type="text/css">
<!--
body
{ font-family: "Century Schoolbook", "Times New Roman", serif
; text-align: justify
}
h1, h2, h3
{ text-align: center
}
//-->
</style>
</head><body>
<h1>Here comes the title to be printed at the top of the document</h1>
<h2>Introduction</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat.</p>
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>

<h2>First chapter: blah blah blah</h2>
<p>One advantage is that you can use all the HTML markup, for instance
<b>bold,</b> <i>italics,</i> <u>underlining</u>, <sub>subscripts</sub>,
<sup>superscripts</sup>, etc., even tables and pictures (which I'm not
going to detail here) in any combination (but with proper tag nesting),
for instance <b><i>bold italics</i></b> or <i>italic text with one
<u>underlined</u> italic word in the middle...</i></p>

</body></html>

Best regards,
Tony.
--
With every passing hour our solar system comes forty-three thousand
miles closer to globular cluster M13 in the constellation Hercules, and
still there are some misfits who continue to insist that there is no
such thing as progress.
-- Ransom K. Ferm

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

Re: blank lines

On 28/05/10 18:12, epanda wrote:
> Hi,
>
> I am trying to add some blank lines or carriage return to actionscript
> file in order to make reading clear.
>
> call append(line('^'),"\n")
>
> I see this character ^@ at the beginning of my file. I would like only
> to see newline.
>
> I think it is set file format that does not correspond to the good one
> but on't know why.*
>
>
> Thank you
>

RTFM, :help append(), paraphrased below:

The second parameter to append() can be either a String or a List.

If a String, it will become only one line, with no linebreaks in the
middle. Both 0x00 and 0x0A produce a null (stored internally as a linefeed).

If a List, each item in the List will become one line. So to append the
three following lines the third one of which is empty) before line 1 of
the file,

THIS IS ONE BIG UNDERLINED TITLE WITH AN EMPTY LINE BELOW IT
============================================================


use
:call append(0, [
\ 'THIS IS ONE BIG UNDERLINED TITLE WITH AN EMPTY LINE BELOW IT',
\ '============================================================',
\ '' ])

Of course, only Vim 7 supports Lists, so this example won't work in Vim
6.x or earlier.


Best regards,
Tony.
--
"I'm really enjoying not talking to you ... Let's not talk again _REAL_
soon ..."

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

Re: How to recover files after vim crash?

Hi Tony!

On Fr, 28 Mai 2010, Tony Mechelynck wrote:

> - If Vim says "modified: YES" but not "NEWER than swap file", answer
> (r)ecover; then before you save the changes, use the :DiffOrig command
> (which is described under :help :DiffOrig and is defined by the
> vimrc_example.vim) to compare the file before and after recovery. If the
> changes are what you expect, you can save the new version, and then
> immediately reload it to (d)elete the now obsolete swap file.

Forgive me for shamelessly mentioning my recover.vim Plugin
http://www.vim.org/scripts/script.php?script_id=3068
It will open automatically a diff window whenever it detects, that for a
file already exists a swap file.

regards,
Christian

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

Re: Mapping the Super / Windows key

On 28-May-2010, at 00:02, Bernhard Walle wrote:
>
>> if !has("gui_macvim")
>> vnoremap <C-X> "+x
>> vnoremap <C-C> "+y
>> imap <C-V> "+gP
>> cmap <C-V> <C-R>+
>>
>> " Pasting blockwise and linewise selections is not possible in Insert and
>> " Visual mode without the +virtualedit feature. They are pasted as if they
>> " were characterwise instead.
>> " Uses the paste.vim autoload script.
>>
>> exe 'inoremap <script> <C-V>' paste#paste_cmd['i']
>> exe 'vnoremap <script> <C-V>' paste#paste_cmd['v']
>>
>> " Use CTRL-Q to do what CTRL-V used to do
>> noremap <C-Q> <C-V>
>> endif

Someone want to explain to me what this means (syntax-wise)?

I got that the " lines are comments…

--
"In order to avoid being called a flirt, she always yielded easily."
Charles, Count Talleyrand

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

Re: Any command to format C source in a nice way?

On 28/05/10 12:26, robert song wrote:
> Hi, everyone.
>
> Sometimes C codes in some files are hard to read,
> for example:
> if (!(({ unsigned long flag, roksum; (void)0; __asm__("adds %1, %2,
> %3; sbcccs %1, %1, %0; movcc %0, #0" : "=&r" (flag), "=&r" (roksum) :
> "r" (buf), "Ir" (count), "0" (current_thread_info()->addr_limit) :
> "cc"); flag; }) == 0))
> return -14;
>
> Is there any command to format the specified line directly?
>
> Best Regards,
> robert
>

See:
:help =
:help gq
:help 30.2
:help 30.3
:help C-indenting
:help 'cinkeys'
:help cinkeys-format
:help 'cinoptions'
:help cinoptions-values


Best regards,
Tony.
--
Try to get all of your posthumous medals in advance.

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

Re: Syntax Highlighting Minor Groups

On May 28, 2:52 am, airforceone <airforce...@lavabit.com> wrote:
> And apparently there's no group for the brackets, ++, ;, etc. operators.
> Which means we would have to do this with pattern matching huh?
>

Yes, you'd need to define your own syntax file addition most likely.

The way this stuff all works:

The syntax highlight rules specify a definition of highlight-able
names (a mix matches and regions, defined in terms of regular
expressions, and keywords). Many of these names will be linked to a
set of pre-defined names which you see in the :help, including
Operator, Statement, etc.

Your color scheme or other method of defining highlight rules, will
then apply to these linked names.

But, what all this means is, unless the maker of the syntax script
included a match for the stuff you want to highlight, you will not be
able to apply the highlight unless you define your own syntax rule to
match what you want to apply it to.

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

Re: How to recover files after vim crash?

On May 28, 1:15 am, "Christian Brabandt" <cbli...@256bit.org> wrote:
> On Fri, May 28, 2010 7:36 am, robert song wrote:
> > Sometimes vim freezes by some mis-operation, and I should kill it.
>
> That really shouldn't happen. In what context does this happen to you?
>

As an additional note, most operations in Vim, can be cancelled or
aborted by pressing CTRL-C. I very rarely need to kill Vim (sometimes
when I loose my network connection while editing a file on a mapped
drive to a ClearCase file system, but that's about it).

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

Re: Formatting help files

On 28/05/10 12:48, Pablo Giménez wrote:
> Hi.
> I have some help files along with my scripts and I wanto give them a
> better formatting.
> So far the text layout is not too bad, but I am wondering is there is
> anyway to make some letter to appear as bold or italic, like when you
> write a wiki.
> Is this possible with vim help files format????
> thanks
>
> --
> Un saludo
> Best Regards
> Pablo Giménez

If these help files are to be used by other Vim users (e.g. because you
distribute them with one or more Vim scripts), then you should stick to
"standard" help formatting. In that case you cannot make sure that any
particular text will be in any _particular_ color, boldness, etc.,
because any user may have a different "preferred colorscheme", and
colorschemes are allowed to set any coloring scheme. But you can make
some parts of the text appear in a different color than the rest to any
user who has set ":syntax on", by following the same rules as in the
help files distributed with Vim, as follows:

* Always put a modeline at the bottom, as Bram does with Vim's
helpfiles. Never set a global option in such a modeline, that can have
consequences undesired by whoever reads that help.

* Where you define a help tag, put its *help-tag-name* between
asterisks. Then after the user runs |:helptags| or |:UseVimball| he will
be able to use ":help help-tag-name" to go to it. The name should be
distinctive and different from all help tags already used by Vim;
ideally it should begin with the name of your plugin.

* To hotlink to an 'option', just put its name between single quotes,
Vim is clever enough to highlight that the right way.

* To hotlink to a |help-tag-name| for something other than an option,
put it between |bars| (q.v.)

* The words "Note" and "TODO" automagically receive distinctive
highlighting.

* See also (e.g. by looking at some of the Vim helpfiles after setting
":syntax off", or by viewing them in some dumb editor such as Notepad)
how the Vim help uses some character at the start or end of some lines
to produce distintive highlighting. For instance the following have a
meaning (I'm not sure I found them all):

- a special key name expressed either in <> notation as in <PageDown>,
or as a Ctrl character as in CTRL-X
- anything between {braces}, e.g. {lhs} and {rhs}
- a greater-than sign at the end of the line (maning: here comes a
block of ex-commands)
- a less-than sign as the first nonblank on a line (meaning: the line
above was the last one of a block of ex-commands)
- a line starting in column 1 also implicitly stops any block of
ex-commands before it.
- a tilde at the end of a line (to give this line a different colour,
usually for a column heading)


Best regards,
Tony.
--
ARTHUR: Bloody peasant!
DENNIS: Oh, what a give away. Did you hear that, did you hear that, eh?
That's what I'm on about -- did you see him repressing me, you
saw it
didn't you?
The Quest for the Holy Grail (Monty
Python)

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

Re: blank lines

On 2010-05-28, Bee wrote:
> On May 28, 9:12 am, epanda <callingel...@hotmail.fr> wrote:
> > Hi,
> >
> > I am trying to add some blank lines or carriage return to actionscript
> > file in order to make reading clear.
> >
> > call append(line('^'),"\n")
> >
> > I see this character ^@ at the beginning of my file. I would like only
> > to see newline.
>
> When doing a substitute in a file,
> search for \n
> but replace with \r
>
> :%s/\n/\r\r/gc
>
> Does this work?
>
> call append(line('^'),"\r")

No. That was my first thought, too, but it inserts ^M.

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

Re: How to recover files after vim crash?

On 28/05/10 07:36, robert song wrote:
> Hi, everyone.
>
> Sometimes vim freezes by some mis-operation, and I should kill it.
>
> In this way, all the opened file are lost, Is it able to reload the
> files once again after I open the vim just like the session-manager in
> firefox?
>
> Best Regards,
> robert
>

You usually can, unless you have forbidden the use of swapfiles (see
:help 'swapfile').

For that, you must know which files were being edited. This is easy in
two cases:
- There was only one, or only a few, and you remember which ones
- Vim was loaded from a session file (either made with :mksession, or a
custom one made by hand)

In that case, you can just restart Vim with the same files, and as each
file is opened Vim will give you a rather long ATTENTION message with a
prompt at the end (see ":help ATTENTION", a rather long help topic: it
is worth reading it all), meaning it has found a "swap file" for that
file, which in turn means that an edit of that file has somehow not been
completed.
- If Vim says "(still running)" (usually only on Unix-like systems) it
means that there is another Vim still editing that file on the same
machine. In that case you will want either to (a)bort or to (o)pen
readonly but NOT to mess with the swapfile used by that other Vim.
- Otherwise:
- Any file for which Vim says "modified: no" had either not been
changed, or already been saved. Answer (d)elete, you don't need the swap
file.
- If Vim says "modified: YES" but not "NEWER than swap file", answer
(r)ecover; then before you save the changes, use the :DiffOrig command
(which is described under :help :DiffOrig and is defined by the
vimrc_example.vim) to compare the file before and after recovery. If the
changes are what you expect, you can save the new version, and then
immediately reload it to (d)elete the now obsolete swap file.
- For the "NEWER than swap file" case, see the help (somewhere under
|ATTENTION|, at usr_11.txt line 198 in the latest Vim 7.3a help).

If that crashed edit session were editing any files whose names you
can't recall, the ATTENTION message will appear the next time you (or
someone) edit them. When that message appears, react as above. With the
default setting (swap file in the same directory as the editfile), the
swapfile won't get lost, and even if you let that crashed editfile sleep
for six months before editing it again, it can still be recovered then
if necessary.

See also ":help :recover" and ":help -r".


Best regards,
Tony.
--
When I was a kid I said to my father one afternoon, "Daddy, will you
take me to the zoo?" He answered, "If the zoo wants you let them come
and get you."
-- Jerry Lewis

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

Problem using for maps

Hi.
I am trying to use the <Plug> attribute for my script keymaps. But so far is not working as expected.
I have the next in a afile called keymaps.vim
nnoremap <silent>  <Plug>KeymapsOpenFile :browse e<CR>
map <C-o> <Plug>KeymapsOpenFile

This is not working, when I press <C-o> nothing happens.
But if I manually from the command line type:
:map <C-o> <Plug>KeymapsOpenFile

Then the map works perfectly.
Any ideas???
thanks

--
Un saludo
Best Regards
Pablo Giménez

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

Re: blank lines

On May 28, 9:12 am, epanda <callingel...@hotmail.fr> wrote:
> Hi,
>
> I am trying to add some blank lines or carriage return to actionscript
> file in order to make reading clear.
>
> call append(line('^'),"\n")
>
> I see this character ^@ at the beginning of my file. I would like only
> to see newline.

When doing a substitute in a file,
search for \n
but replace with \r

:%s/\n/\r\r/gc

Does this work?

call append(line('^'),"\r")

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

Text printing questions

Bonjour,

I want to use Vim to write a book, which means I periodically wish to
print my WIP.
Each Vim line is, in fact, a normal book paragraph, of course.

My .vimrc file has these settings :

set
printoptions=paper:A4,portrait:y,duplex:long,wrap:y,number:y,syntax:n
set printfont=Inconsolata:h13

The results are, as you already guessed :
- Vim line numbers : correctly adjusted on the left, no word wrapping
underneath
- Text wrapping : if it wraps, it is truncated, and it is not
truncated only when it does not wrap
- Plus, I have a little annoyance : the paragraphs (Vim lines) have no
space to visually separate them ; I know the solution is to insert a
blank line in between, but that messes up the numbering

My questions :

- Is it possible to have a word-wrap equivalent in the printing
process (I read that part of the manual, and I know this is not a
printoption) ? Btw, does Vim 7.3 solve this ?
- Is it possible to have a bigger linespace "breathing" at the end of
the Vim line ?
- And a very secondary question : is it possible to print directly a
booklet on a recto-verso A4, something like (in plain english) : print
page 4, then page 1, duplex:short, then page 3, and finally page 2
then repeat (increment 4) until you reach the end of the 500 pages
masterpiece ... ? or must I use Acrobat to do this ?

Thanks in advance

ThG

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

Re: Tags file not sorted

> > Another thing to think about is how 'sort' sorts your data.  I've
> > had to set
>
> >      LC_COLLATE=C
>

It would appear setting this environment variable fixed my issue.
To clarify my original post, I wrote a script that recusively called
ctags in each directory and just 'cat'd each tag file to one larger
file, then called 'sort' on it.

Thanks for your help!

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

Re: blank lines

On 2010-05-28, epanda wrote:
> Hi,
>
> I am trying to add some blank lines or carriage return to actionscript
> file in order to make reading clear.
>
> call append(line('^'),"\n")
>
> I see this character ^@ at the beginning of my file. I would like only
> to see newline.

Try this instead:

call append(line('^'),"\0")

In some situations, Vim uses \0 in place of \n and vice versa.

Alternatively, you could use

0put!

See

:help :put

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

blank lines

Hi,

I am trying to add some blank lines or carriage return to actionscript
file in order to make reading clear.

call append(line('^'),"\n")

I see this character ^@ at the beginning of my file. I would like only
to see newline.

I think it is set file format that does not correspond to the good one
but on't know why.*


Thank you

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

Re: Determine how many windows are on screen (P.S.)

On 28/05/10 14:30, David Fishburn wrote:
[...]
> More specifically, I am trying to determine if a user just opened Vim
> and they are sitting at the [No Name] buffer.
[...]

:if winnr('$') == 1 && bufname('%') == ""


Best regards,
Tony.
--
Take everything in stride. Trample anyone who gets in your 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

Re: Determine how many windows are on screen

On 28/05/10 14:30, David Fishburn wrote:
>
> Vim 7.2.411
>
> I am trying to determine via VimScript how many windows are on the
> screen at the moment.
> More specifically, I am trying to determine if a user just opened Vim
> and they are sitting at the [No Name] buffer.
> This could also be in a new tab.
>
> If so, I would like to take over that buffer with something else rather
> than creating a new buffer and end up having 2 buffers.
>
> Looking through :h functions, I don't see anything jumping out to give
> me a count of all windows.
> What I think will work is parsing the output from winrestcmd().
>
> 1resize 32|vert 1resize 117|2resize 32|vert 2resize 117|3resize 65|vert
> 3resize 117|
>
> Based on this output and simple regex to find '\<2resize\>' should do
> it, but it just seems a bit of a hack.
>
> That gets me to the point where I know we just have the one buffer.
>
> Not really sure how to get rid of the [No Name] buffer and replace it
> with my own.
> :0r myfile
>
> Results in [No Name] with the contents.
> But what I really want is [No Name] gone and just myfile.
>
> Suggestions?
>
> TIA,
> Dave
>

To determine how many windows are onscreen (in the current tabpage)

:let numwindows = winnr('$')

see :help winnr()

See also http://vim.wikia.com/wiki/Going_to_the_nth-from-last_window for
one possible use case.

If the current buffer is an empty [NoName] buffer, you can easily
replace it by /some/long/exemplary/path/to/foobar.txt by using

:e /some/long/exemplary/path/to/foobar.txt

(now who would have thought of that? ;-) and add an exclamation mark
after :e if the buffer is modified).

To close all windows (of the current tabpage) except the current one:

:only

The help for that command describes its interaction with the 'hidden'
and 'autowrite' options, and what difference there is if you add an
exclamation mark -- broadly, that interaction is what you would expect
it to be.

In all these examples, the initial colon is of course unnecessary when
the command is read from a sourced script.


Best regards,
Tony.
--
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)

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

Re: Formatting help files

2010/5/28 Stahlman Family <brettstahlman@comcast.net>
Pablo Giménez wrote:
Hi.
I have some help files along with my scripts and I wanto give them a better
formatting.
So far the text layout is not too  bad, but I am wondering is there is
anyway to make some letter to appear as bold or italic, like when you write
a wiki.
Is this possible with vim help files format????

Pablo,
You might have a look at the following plugin:

Txtfmt (The Vim Highlighter)
http://www.vim.org/scripts/script.php?script_id=2208

Txtfmt can be used either as a standalone filetype, or in conjunction with other filetypes (e.g., Vim "help"), to beautify your documents with word processor style highlighting. Txtfmt allows you to create arbitrary regions involving any combination of bold, underline, italic, etc..., as well as both foreground and background colors. The following site contains screenshots. (Note that there are multiple tabs in addition to "Home": the "ywchaos", "Jnl and Txtfmt" and "ywtxt" tabs show Txtfmt regions supplementing the statically-defined regions of other wiki/journal filetypes.)
Looks really cool!
Thanks Stahlman

http://www.txtfmt.webs.com/

To use Txtfmt within a Vim help file, you would need to set the filetype to help.txtfmt. One way to do this would be with the following modeline:

       vim:ft=help.txtfmt

If you decide to give it a try, there's a "Quick-Start Tutorial" on the download page that explains how to add the highlighting regions. Let me know if anything is unclear...

Sincerely,
Brett Stahlman



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



--
Un saludo
Best Regards
Pablo Giménez

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

Re: Determine how many windows are on screen

Hello,

"David Fishburn" wrote :

> I am trying to determine via VimScript how many windows are on the
> screen at the moment.
> More specifically, I am trying to determine if a user just opened Vim
> and they are sitting at the [No Name] buffer.

> [...]
>
> Suggestions?

I use the following:
http://code.google.com/p/lh-vim/source/browse/misc/trunk/vimrc_core.vim#516

If the len of the current buffer is null, and that there only one empty line, then I consider I'm sitting at this [No Name] buffer.
It also works after a :new.

HTH,

PS: you can also play with:
:echo len(filter(map(lh#buffer#list(), 'bufwinnr(v:val)'), 'v:val != -1'))
to obtain the list of opened windows and their number. But regarding what you are looking for, this is a very complex solution.
[lh#buffer#list() comes from lh-vim-lib, see my signature)

--
Luc Hermitte
http://lh-vim.googlecode.com/
http://hermitte.free.fr/vim/

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

Determine how many windows are on screen

Vim 7.2.411

I am trying to determine via VimScript how many windows are on the
screen at the moment.
More specifically, I am trying to determine if a user just opened Vim
and they are sitting at the [No Name] buffer.
This could also be in a new tab.

If so, I would like to take over that buffer with something else rather
than creating a new buffer and end up having 2 buffers.

Looking through :h functions, I don't see anything jumping out to give
me a count of all windows.
What I think will work is parsing the output from winrestcmd().

1resize 32|vert 1resize 117|2resize 32|vert 2resize 117|3resize 65|vert
3resize 117|

Based on this output and simple regex to find '\<2resize\>' should do
it, but it just seems a bit of a hack.

That gets me to the point where I know we just have the one buffer.

Not really sure how to get rid of the [No Name] buffer and replace it
with my own.
:0r myfile

Results in [No Name] with the contents.
But what I really want is [No Name] gone and just myfile.

Suggestions?

TIA,
Dave

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

Re: Formatting help files

Pablo Giménez wrote:
> Hi.
> I have some help files along with my scripts and I wanto give them a better
> formatting.
> So far the text layout is not too bad, but I am wondering is there is
> anyway to make some letter to appear as bold or italic, like when you write
> a wiki.
> Is this possible with vim help files format????

Pablo,
You might have a look at the following plugin:

Txtfmt (The Vim Highlighter)
http://www.vim.org/scripts/script.php?script_id=2208

Txtfmt can be used either as a standalone filetype, or in conjunction
with other filetypes (e.g., Vim "help"), to beautify your documents with
word processor style highlighting. Txtfmt allows you to create arbitrary
regions involving any combination of bold, underline, italic, etc..., as
well as both foreground and background colors. The following site
contains screenshots. (Note that there are multiple tabs in addition to
"Home": the "ywchaos", "Jnl and Txtfmt" and "ywtxt" tabs show Txtfmt
regions supplementing the statically-defined regions of other
wiki/journal filetypes.)

http://www.txtfmt.webs.com/

To use Txtfmt within a Vim help file, you would need to set the filetype
to help.txtfmt. One way to do this would be with the following modeline:

vim:ft=help.txtfmt

If you decide to give it a try, there's a "Quick-Start Tutorial" on the
download page that explains how to add the highlighting regions. Let me
know if anything is unclear...

Sincerely,
Brett Stahlman

> 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