Monday, March 1, 2010

Re: Quickie to eliminate short lines or words.

On Mon, Mar 1, 2010 at 11:01 AM, John Culleton <john@wexfordpress.com> wrote:
> I have sketched out a few steps to create a concordance, an alphabetic list of
> all the words in a book, one word per line, with dupes eliminated. Now I need
> to eliminate all words of one or two characters.  Anyone have a quickie to
> suggest?

maybe this helps?

:g/^\a\{1,2}$/d

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

Quickie to eliminate short lines or words.

I have sketched out a few steps to create a concordance, an alphabetic list of
all the words in a book, one word per line, with dupes eliminated. Now I need
to eliminate all words of one or two characters. Anyone have a quickie to
suggest?
--
John Culleton
"Create Book Covers with Scribus"
Printable E-book 38 pages $5.95
http://www.booklocker.com/books/4055.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

Re: can I configure the "default" commands?

On 01/03/10 13:37, Jorge Timón wrote:
> Hi, Now I know how to map a command (for example :tabnext) to a key or
> combination of key (C-TAB). But can I change "default" commands like
> dd, w, $, 0...?
> I don't know if "default" is the right name for them.
> Is there a file where this mappings/bindings are done like
> map h :cursorleft
> map j :cursordown
> ...
> or something like that?
> Is there a list of all the default mappings?
>
> Maybe you're asking yourselves why would I want to change it.
> I use a spanish keyborad and some keys (like []{}) aren't very accessible.
>
> Thank you
>

To change what w does (instead of "move to word") you may have to remap
it in Normal, Visual and Operator-Pending modes, but not in Select mode
where it should (still) replace the selection by the letter w. The {rhs}
of the mapping may or may not be different for each mode, depending on
what you want to achieve. Similarly for $. It is not possible to map 0
in Normal mode (or it would make it impossible to type a zero as part of
a count), try mapping <Home> instead.

To change what dd does, remap d (the second d) in (only)
Operator-Pending mode using an <expr> mapping, because you want to remap
it to d (and allow remaps i.e. use :omap, not :onoremap) for all values
of v:operator (q.v.) except "d". Or else, remap dd in Normal and Visual
(but not Select or Operator-Pending).

The definition of what a key does when starting up (before sourcing any
vimrc or other script, and before any -c or -cmd command-line switch) is
defined in the C code, you cannot change it without recompiling (and I
don't recommend recompiling Vim after patching it for that purpose).

The list of all the default key bindings is in the index.txt helpfile
(see :help index.txt). To know what one particular key does in one
particular mode, you should probably use the helptag for that key in
that mode.

For "not very accessible keys", OTOH, you want to make some other key
function as if it were, let's say, Ctrl-], and that in all modes. The
following example shows what I use for my Belgian keyboard (where Ctrl-]
requires using Ctrl and AltGr together while pressing the key at the far
right end of the AZERTY row):

:noremap <F9> <C-]>
:noremap! <F9> <C-]>

IOW, I use F9 whenever I want to trigger the function of the Ctrl-] key.
Whether to use :map or :noremap here is a question of whether we want to
allow or disallow doing something else instead of (for Ctrl-]) jumping
to a tag (in Normal/Visual) or triggering an abbreviation (in
Insert/Replace/Command-line).

See
:help map-overview
:help :map-modes
:help v:operator
:help :map-<expr>

Best regards,
Tony.
--
ARTHUR: (as the MAN next to him is squashed by a sheep) Knights! Run away!
Midst echoing shouts of "run away" the KNIGHTS retreat to cover with
the odd
cow or goose hitting them still. The KNIGHTS crouch down under cover.
"Monty Python and the Holy Grail" PYTHON (MONTY)
PICTURES LTD

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

can I configure the "default" commands?

Hi, Now I know how to map a command (for example :tabnext) to a key or
combination of key (C-TAB). But can I change "default" commands like
dd, w, $, 0...?
I don't know if "default" is the right name for them.
Is there a file where this mappings/bindings are done like
map h :cursorleft
map j :cursordown
...
or something like that?
Is there a list of all the default mappings?

Maybe you're asking yourselves why would I want to change it.
I use a spanish keyborad and some keys (like []{}) aren't very accessible.

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: Programmatically detect a current "highlight" setting?

On 1 mar, 11:46, Tony Mechelynck <antoine.mechely...@gmail.com> wrote:
> On 01/03/10 08:42, Wincent Colaiuta wrote:
>
> > I'm writing a plug-in and want to temporarily hide the cursor.
>
> > It would be really neat if I could do "highlight Cursor NONE" and
> > later restore the highlight setting to whatever it was before.
>
> > But I am not sure how to capture the old setting. Evidently "highlight
> > Cursor" _echoes_ the current setting, but doesn't actually return
> > anything that I could capture programmatically.
>
> > Anything I can do?
>
> > Cheers,
> > Wincent
>
> see
>         :help :redir

Thanks, Tony. Read the first paragraph and thought , "ugh, redirecting
to a file, ugly but at least it will work...", and was very pleased to
see in the next paragraph how to redirect to a variable. Sweet.

Cheers,
Wincent

--
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: Programmatically detect a current "highlight" setting?

On 01/03/10 08:42, Wincent Colaiuta wrote:
> I'm writing a plug-in and want to temporarily hide the cursor.
>
> It would be really neat if I could do "highlight Cursor NONE" and
> later restore the highlight setting to whatever it was before.
>
> But I am not sure how to capture the old setting. Evidently "highlight
> Cursor" _echoes_ the current setting, but doesn't actually return
> anything that I could capture programmatically.
>
> Anything I can do?
>
> Cheers,
> Wincent
>

see
:help :redir

You should reformat the captured string(s) to remove the xxx and add
:hi! at the start.

A couple of caveats:
- a different reformat will be needed for a linked group, to replace
"foo xxx links to bar" by "hi! link foo bar"
- You may need to prefix the capturing :hi command by 0verbose in order
to make sure that your screen capture does _not_ include where the
highlight was defined (see :help :verbose).


Best regards,
Tony.
--
To understand this important story, you have to understand how the
telephone company works. Your telephone is connected to a local
computer, which is in turn connected to a regional computer, which is
in turn connected to a loudspeaker the size of a garbage truck on the
lawn of Edna A. Bargewater of Lawrence, Kan.

Whenever you talk on the phone, your local computer listens in. If it
suspects you're going to discuss an intimate topic, it notifies the
computer above it, which listens in and decides whether to alert the
one above it, until finally, if you really humiliate yourself, maybe
break down in tears and tell your closest friend about a sordid
incident from your past involving a seedy motel, a neighbor's spouse,
an entire religious order, a garden hose and six quarts of tapioca
pudding, the top computer feeds your conversation into Edna's
loudspeaker, and she and her friends come out on the porch to listen
and drink gin and laugh themselves silly.
-- Dave Barry, "Won't It Be Just Great Owning Our Own
Phones?"

--
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 open only session files?

On 31/12/09 07:43, Bee wrote:
> I forgot to say I have this set:
>
> " save/restore buffer list
> set viminfo+=%
>
> I was hoping the session file would take precedence.
>
> It seems not.
>

If you ":bd[elete]" or ":bw[ipe]" a file instead of just ":q[uit]"ting
it, then neither the viminfo nor the session file will remember it --
unless you saved the viminfo with ":wv[iminfo]" while the file was still
listed.

The session file is normally used to remember which files are in your
windows and tabs. (It can also remember options, the buffer list, etc.)
The buffer list is in addition to windows and tabs, and remembers (among
others) the marks (including the latest cursor position) for each of the
files in the buffer list.

See
:help :bdelete
:help :bwipe
:help viminfo
:help 'viminfo'
:help :wviminfo
:help 'sessionoptions'
:help :mksession


Best regards,
Tony.
--
If little green men land in your back yard, hide any little green women
you've got in the house.
-- Mike Harding, "The Armchair Anarchist's Almanac"

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