Re: Selecting font size

2007-06-05 Thread Tobia
Tim Johnson wrote:
 when I choose the font size, the font that is loaded is very different
 from what was installed when i started and is far from appealing.

Is it a bitmap font?  You can recognize a bitmap font from the sharp
edges and pixellated appearance.  Bitmap fonts come in only one size,
so if that's the case you don't have much choice but to change font.
Fortunately there are usually a wealth of fixed bitmap fonts of
varying size and shape to choose from and you can find a ton more on the
web, both free and commercial.

If it's not a bitmap font, then it's a strange behaviour.  Can you
post screenshots of both fonts you get, before and after changing size?
Maybe some of us will recognize them.

(Don't send picture files directly to the list, it's considered rude.
Rather, upload them to your web space, to http://imageshack.us/ or to
another such service and post the link to the picture.)


Tobia


Re: ex editor

2007-06-05 Thread Tobia
Tim Chase wrote:
 I'm likely one of the scant few who still wants Vim to support true
 open mode (:help :open).  Not urgently, but there are times it would
 have been handy.  Fortunately, I've got some older versions of vi that
 do support it for those scarse occasions I want it.

Can you please expand on what :open does and what it's useful for?
:help :open tells me nothing at all :-(


Tobia


Re: Open all folds in the current fold?

2007-06-04 Thread Tobia
Tim Chase wrote:
 I'm trying to find/create a command that acts somewhat like zO/zR
 for within an existing fold.

 The behavior I'm looking for is that if I'm within an existing
 fold, it recursively opens all the folds within the current fold:

Try  zczO

If it does what you want, you can map it to some  zX  combination that's
currently unused (or redundant)


Tobia


Edit output of external command

2007-06-04 Thread Tobia
Is there a better (faster?) way to edit the output of an external prog
in a new tab or window, than to filter the new buffer through it?

:tabnew|%!svn diff


Tobia


Re: OT: Vi in a browser...

2007-06-01 Thread Tobia
Gene Kwiecinski wrote:
 Speaking of which, is there any quicker way to visually select the
 entire file, analogous to ^A in other systems?

To copy the entire file to the system clipboard, you can do:

:%y+

Rpelace y with d if you want to cut instead of copy.
Replace + with * if you want to use middle-click to paste (on X11.)


Tobia


Re: collapsing single lines of html tag attributes via plugin??

2007-06-01 Thread Tobia
Howard Glynn wrote:
 In essence I would like to collapse huge (single) lines of tags to
 something like a id=xyz href=/img ...

There is a simple solution, maybe too simple, but... if you only have
one tag per line, or if you can reformat your file in such a way, it
might be enough to disable line wrap:

:set nowrap

You can map a function key to toggling line wrap:

:map F9 :set wrap!CR

Type that literally, with   and everything, or put it into ~/.vimrc


HTH
Tobia


Re: copying text char-by-char from the line above line..

2007-05-31 Thread Tobia
François Pinard wrote:
 At first, I had some difficulty remembering Ctrl-Y, until I decided that
 Y was a picture of what was going on: that is, funneled from above.
 Now, I use it very often.  Ctrl-E copies from the line below, often
 useful too, yet it is harder to see an upside-down Y into E :-).

It's easier to remember if you already know what C-Y and C-E do in
normal made (they scroll the page)


Tobia


Re: Vim over cifs share

2007-05-30 Thread Tobia
Fabien Meghazi wrote:
 I've got a problem while editing files through a cifs share.
 (probably a datestamp problem)

 Each time I write buffer to the opened file, vim prompts this :

 WARNING: The file has been changed since reading it!!!
 Do you really want to write to it (y/n)?

I know it's not an answer to what you asked, but I've usually been able
to fix this issue by:

- ntpdate pool.ntp.org (or equivalent time sync command) on the client
- ntpdate pool.ntp.org (or equivalent time sync command) on the server
- umount and mount the share


Tobia


Re: bullet points and paragraph indenting

2007-05-29 Thread Tobia
Troy Piggins wrote:
 When I intend to type a list of bullet points, I start with a - .
 If I type more than one line for that bullet point, the second line is
 automatically indented 2 spaces, so the text lines up with the first
 line's text. However if I type more than 2 lines, the third line
 starts at beginning of line

set autoindent


Tobia


Re: Why bottom-posting is prefered on Vim Mainling List?

2007-05-29 Thread Tobia
A slightly OT note, which amazingly is more IT than the thread itself


 Uhhh, that's not my doing, as the text gets resplit/rewrapped
 somewhere else along the line.  About the only thing I could do is
 manually split it shorter than the default (whatever that is)

Reformatting the quoted blocks (gq} or visual+gq as you like best)
while you're formatting your email works quite well.


Tobia


Re: Remapping mouse-wheel

2007-05-24 Thread Tobia
Waters, Bill wrote:
 When I have a split window (horizontal or vertical), the mouse wheel
 only works in one of the two splits.  It works in either (as it
 should) when I do a CTRL-mouse-wheel.

I don't think I understand your problem.

Ctrl-mouse wheel has no particular effect on my system (Vim 7.1 Gtk on
Debian) and it's not supposed to, according to the manual.

On my Vim the mouse wheel only scrolls in the active window, both with
and without Ctrl,


 I am looking for a work-around to this problem.

If I understand you correctly, you want the mouse wheel to always scroll
in all windows simultaneously?  Then put this in your .vimrc:

set scrollbind


HTH
Tobia


Vim to Vi (Was: weird defaults in Feisty)

2007-05-22 Thread Tobia
David Nečas (Yeti) wrote:
 it's a bit strange when a vim user describes vi as `crazy' and `so
 weird'...

It may sound strange to us Vim veterans, but it's what I would expect.

My path to learning Vi/Vim (which took place at the same time as my
learning of GNU/Linux, by the way) was as follows:

1. Use it as a Notepad with weird save/quit commands (esc:wcr ...)
   Always in insert mode, only using the arrows, Del, BS, Home, End, and
   hitting Esc and 'u' like crazy whenever something weird happened.

2. Learn copy  paste, first line-wise (dd yy p P), then selection-wise
   (v V ^V y d, still only using the arrow keys.

At this point (a few months?) I was already as productive as with my
former Windows editor of choice! (something like TextEdit™ or TextPad™)

3. Learn that command mode is actually useful for moving around in the
   file (gg, G, {, }) and opening two files at a time (:e, C-^)

4. Other stuff (complex movements, buffers/windows/tabs, registers,
   macros, mappings, autocommands, folding, custom syntax files...)

This timeline might look non-linear, in fact I believe that learning Vim
is an exponential task to the engaged user, and that's a very good thing!

The point is: I don't consider my learning path in any way peculiar, and
if Vim had suddenly reverted to Vi while I was in phases 1 to 3, I would
have looked at my computer with a blank, baffled expression on my face.


Tobia


Right click = toggle fold

2007-05-22 Thread Tobia
Hi

I just wanted to share this little mapping I've come up with:

:map RightMouse LeftMouseza

It makes right-clicking on a fold toggle it opened/closed.

Using the mouse wheel all the time to scroll around in GVim, I find this
very useful for navigating big files, especially with automatic syntax-
or indent-folding.

Scroll, click (expand), read, click (collapse), scroll some more...


Tobia


Javascript syntax folding

2007-05-20 Thread Tobia
How can I enable syntax folding in Javascript files?

The syntax file seems to support it, controlled by a variable named
javaScript_fold, but setting it in my vimrc or on the command line
doesn't seem to do anything:

let javaScript_fold=1

vim -u /dev/null +let javaScript_fold=1 file.js

What am I doing wrong?


Tobia

-- 
«A one-time pad isn't a cryptosystem: it's a state of mind.»
—Marcus Ranum


Re: Newbee question:Why don't I have the syntax highlighting when editing files like *.sh *.xml,etc?

2007-04-03 Thread Tobia
A.J.Mechelynck wrote:
 /etc/vim/vimrc is a strange location for a system vimrc

It is a very intuitive location.  In Debian all system-wide
configuration files are in /etc/package name/

 I know just enough Chinese to understand that 大 on the fourth line
 means big, so I can guess that that fourth line probably means Big
 version with GTK2 GUI. Features included (+) or not (-):

That would explain the problem.  To the original poster: try adding the
following line to /etc/vim/gvimrc.local (create it if needed)

source /etc/vim/vimrc


Tobia


Re: repeat replace many time on each line

2007-04-02 Thread Tobia
Bob Hiestand wrote:
 Tobia wrote:
  Arnaud Bourree wrote:
   I've Xml document with attribute likes:
   foo=00 12 AF
   I want to replace with:
   foo=0x00 0x12 0xAF
 
  this works:
 
  %s/\%(\%(foo=\\)\@=\%([0-9A-F]\{2\}\s\)*\)\@=\([0-9A-F]\{2\}\)/0x\1/g

 In using :s with the /g flag, I take it the potential changes are
 marked first, and then executed, per line?

It would seem so.

By the way, I would have used a simpler pattern for such a task:

%s/\v%(foo\=[^]*)@=(\x\x)/0x\1/g


 I prefer when dealing with that many special characters to use the
 very-magic form

Me too.  I can't stand trying to match \( \) with my eyes, they just
don't look right, not to mention \{ \? \+...  Egrep and Perl have it
right.  I wish I could turn very-magic on by default.


Tobia


Re: mapping for jumping to a tag

2007-04-01 Thread Tobia
Dimitar wrote:
 * Tobia [EMAIL PROTECTED] [070331 20:35]:
  :map C-J C-]  works here.

 Did you try this in a help file?
 :help
 then go to a tag and press c-j

Yes, I tried it in a help window, both in console Vim and in GVim,
before posting.  I don't know where else I can find tags!

Try starting vim -u NONE / gvim -U NONE and see if the problem persists.


Tobia


Re: Monospaced font problem

2007-04-01 Thread Tobia
Pablo Arantes wrote:
 I contacted the author of Pragmata to share my concerns but he
 couldn't help me much in this respect. I explained him the problem but
 I'm not sure he understood it.

I emailed him too.  We share our first language, so maybe he will
understand me better.


 I wonder if there is a feasible way to change this specification myself.

I had a look at the TTF file format[1] and it's quite easy.  I have
attached a small Python script that will query, set or clear the
monospaced flag on a TTF file.  Run it with no arguments to get help.

Remember to operate on a copy of the font file and to install/uninstall
the font through Windows's Control Panel.  That is: make a copy of the
font file; set the flag on it; uninstall the currently installed font;
install the modified version; profit.


Tobia

[1]
http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6.html
http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6post.html
#!/usr/bin/python

import sys, getopt, struct

def get_post_off(f):
f.seek(0)
data = f.read(512)
post_off = None
for i in range(30):
off = 12 + 16 * i
tag = data[off : off + 4]
if tag == 'post':
post_off = struct.unpack('I', data[off + 8 : off + 
12])[0]
break
if not post_off:
raise 'ERROR: cannot find table post in the font directory'
return post_off

def get_mono(f):
post_off = get_post_off(f)
f.seek(post_off + 12)
mono = struct.unpack('i', f.read(4))[0]
return mono

def set_mono(f, n):
post_off = get_post_off(f)
f.seek(post_off + 12)
f.write(struct.pack('i', n))

if __name__ == '__main__':
def usage():
print 'usage: ttfmono [-su] file.ttf'
print '  -s  set the monospaced flag'
print '  -u  unset the monospaced flag'
print '  otherwise: query the monospaced flag'
sys.exit(1)

opts, args = getopt.getopt(sys.argv[1:], 'su')
opts = dict(opts)
opt_set = '-s' in opts
opt_unset = '-u' in opts
if len(args) != 1: usage()
if opt_set and opt_unset: usage()

if opt_set or opt_unset:
ttf_file = open(args[0], 'r+')
else:
ttf_file = open(args[0])
if not ttf_file: usage()

if opt_set:
set_mono(ttf_file, 1)
elif opt_unset:
set_mono(ttf_file, 0)

print 'monospaced flag =', get_mono(ttf_file)
print sys.stderr, '(0 = variable-width, otherwise = monospaced)'
ttf_file.close()


Re: invoking yanked register into colon command

2007-03-31 Thread Tobia
Guillaume Bog wrote:
 What I used to do is selecting it with mouse and type
 :%s/ctrl-ins/newname/gc
 Is there a way to do this with the mouse

I guess you mean with the keyboard.  Yes, there is.

Ctrl-R /pull to the commandline the last search pattern
Ctrl-R ...the last unnamed delete or yank
Ctrl-R *...the current selection (X11 only)
Ctrl-R +...the clipboard contents
Ctrl-R x...the contents of register x
Ctrl-R Ctrl-W   ...the current word under the cursor

See :help c_CTRL-R


Tobia


Re: delete all but first occurence of a pattern

2007-03-31 Thread Tobia
I don't think Vim's regular expressions are the best tool for this job.
I mean, XML manipulation is much easier done in XSLT:

?xml version=1.0?
xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform;
xsl:template match=article
xsl:copy
xsl:copy-of select=@*/
AuthorList CompleteYN=Y
Author ValidYN=Y
xsl:copy-of select=AuthorList/Author[1]/*/
/Author
/AuthorList
xsl:copy-of select=node()[not(self::AuthorList)]/
/xsl:copy
/xsl:template
/xsl:stylesheet

This does what you want in your example, assuming the source is a proper
XML document (among other things there must be a root tag encompassing
all the articles.)  Invoke with xsltproc fix-authors.xsl articles.xml
or with any other XSLT tool.


To get back on-topic, I find these scripts make working with XSLT a bit
less painful:

xslhelper.vim  http://www.vim.org/scripts/script.php?script_id=1364
closetag.vim  http://www.vim.org/scripts/script.php?script_id=13

This, on the other hand, is on my list of things to check, but I still
haven't got around to checking it out:

xml.vim  http://www.vim.org/scripts/script.php?script_id=1397


Tobia


Re: mapping for jumping to a tag

2007-03-31 Thread Tobia
Dimitar wrote:
 I also tried to map c-j to c-] but it also didn't work.

Uh?  :map C-J C-]  works here.


Tobia


Re: Help on search and replace

2007-03-29 Thread Tobia
Dudley Fox wrote:
 Starting text:
 nameTable[pattern with spaces0] = (pattern with spaces0, 12345)
 
 Desired Text:
 nameTable[patternwithspaces0] = (pattern with spaces0, 12345)

Notwithstanding the usefulness of sub-replace-special, which I also
discovered in this thread, I find zero-width look-ahead/behind
assertions to be very powerful:

:%s/\v(\[[^]]*)@=\s//g

(
  \[ 
  [^]]* 
)@= 
\s

I also happen to like \v, but that's just syntactic sugar!


Tobia


Re: Customizing vim: How to change the char before commands

2007-03-26 Thread Tobia
A.J.Mechelynck wrote:
 fREW wrote:
  So is there a way we could swap the ; and : keys?  I hardly ever
  use ; but it would be nice to still have it available as :
 
 The following lines in your vimrc should do it:
 
   noremap ; :
   noremap : ;

Except that you still have to type : in some places, such as in
Hit ENTER or type command to continue prompts.


Tobia


Re: case-sens in completion on Mac OS X

2007-03-25 Thread Tobia
Ricardo SIGNES wrote:
 I am running Vim 7.0.218, the latest build from macvim.org.  I run the
 vim binary from inside the app bundle at the console to get my
 terminal vim.
 
 My filesystem is case-sensitive HFS+, but vim's filename completion
 acts case-insensitive.  This is driving me CRAZY.

Case-sensitivity ef filename completion is a compile-time option.  

It is set at misc1.c:8892 (Vim 7.0) from the CASE_INSENSITIVE_FILENAME
define, which is only defined at os_unix.h:44 and only if compiling
under Cygwin.  It would seem that the macvim.org developers explicitly
enabled this feature.

If you only use console Vim, you might have better luck with the one
provided by Darwinports or Fink.  Otherwise you might need to recompile
Vim following the steps of the macvim.org guys, or ask for their help.


Tobia


Re: How to turn a q recording into a map?

2007-03-24 Thread Tobia
[EMAIL PROTECTED] wrote:
 Somehow it never occured to me that I could view and edit the contents
 of a recording. Of course, it's just a register, so I pasted the register; 
 edited the contents; then yanked the lines back into the register...
 and naturally this worked fine.

This is going to be immensely useful! Thanks for the heads up


 I was thinking that there should be a way to take the register lines
 and automatically turn them into an noremap (including adding the @ to
 start register playback). Has anyone perfected this?

Like this?

:map {key} {C-R register}

For example if you want to save register q as F2:

:map F2 {C-R q}

where you actually type C-R q at the prompt.

If you like your new mapping and want to make it permanent:
  - open your ~/.vimrc in a new window/tab/buffer
  - bring up the commandline window (q:)
  - find the map comand you used
  - yank it (yy)
  - close the commandline window (C-C C-C)
  - paste it


Tobia


Re: hosting wiki tips

2007-03-24 Thread Tobia
Michael F. Lamb wrote:
 I was not around for the previous discussion on this topic and I
 haven't sifted through the archives yet. Is the community consensus
 basically pro-wiki but contentious on an implementation / hosting
 choice?

I'm new to this mailing list so I don't know either.  In any case I'd
like to mention DokuWiki http://wiki.splitbrain.org/wiki:dokuwiki  

In my experience it's very easy to set up and maintain, it's featureful,
lightweight and it has persistent history, so it doesn't need any more
backupping than any server needs and hosting providers already offer.

If there's a prominent spam problem, we could always restrict write
access to registered mailing list members.


Tobia


Re: specific lines SR question

2007-03-24 Thread Tobia
Eric Leenman wrote:
 entity HALFADDER is
 port(
 A, B  : in  bit;
 SUM, CARRY: out bit);
 end entity HALFADDER;
 
 component HALFADDER
 port(
 A, B  : in  bit;
 SUM, CARRY: out bit);
 end component;
 
 Is it then easy to replace the first and last line of these 5 lines of
 entity code to 5 lines of component code by pressing i.e. F5?

Sure!
Here it is, based on your examples:

:map F5 j{/^entityCRcecomponentESC/ isCRD/^end 
entityCRwCcomponent;ESC0

It works when invoked inside the entity block or just before it.

Explanation (spaces added for clarity, literal spaces marked with ␣):

j { go down one line and up a paragraph (so that it
works inside the block or one line before it)
/^entity CR   go to the next 'entity' at the start of a line
ce component ESC  change that word to 'component'
/␣is CR   go to the ' is'
D   delete it (delete to the end of line)
/^end␣entity CR   go to the next 'end entity'
w   skip a word ('end')
C component; ESC  change the rest of the line to 'component;'
0   go back to the start of the line

Tune it as needed :-)


Tobia


Re: Undo Levels Reset

2007-03-23 Thread Tobia
A.J.Mechelynck wrote:
 When I save a file, undo levels are kept. Using u then undoes, but marks 
 the file as modified. Using Ctrl-R redoes, and the 'modified' flag will 
 disappear when the file-in-memory is identical to the file-on-disk.

This is my experience as well.

Undo levels are only lost when I close Vim, when I reopen the file with
:e, or when Vim alerts me that the file has been changed and reloads it.
The latter can be dangerous if you're not careful, and I'd appreciate
any tips to work around it.


Tobia


Re: Count characters

2007-03-23 Thread Tobia
Harald Kröll wrote:
 a command or script to count the characters without syntax words. For
 example for people who write LaTeX documents in vim and have to
 control their length...

That depends on the definition of a control word.

If you only want to exclude \backslash_prefixed \words, and nothing
else, then this will do:

:%s/\(\\\w*\)\@!\w//gn

Explanation (right to left):

//gncount ALL…
\w  …letters, numbers, and underscores…
\@!…NOT preceded by…
\( \\ \w* \)…a backslash and possibly other letters/numbers

I'm not too familiar with Latex syntax, but if you wanted to exclude
\this[kind of thing] as well, it wouldn't be hard:

:%s/\v(\\\w*(\[[^]]*)?)@!\w//gn

( 
  \\ 
  \w* 
  ( 
\[ 
[^]]* 
  )? 
)@! 
\w 


Tobia


Re: highlighting weird characters...

2007-03-20 Thread Tobia
Mitch Wiedemann wrote:
 non-visually detectable characters (which I assume are high ASCII)

If I may nitpick, high ASCII is not the right terminology here.  
The ASCII table only contains 128 characters, with codes 0…127 (where
only codes 32…126 have a visual representation.)

What you call high ASCII are Unicode characters that are autside
ASCII, or Latin-1 characters that are autside ASCII.  In both cases they
have codes greater than 127.


 Is there a way I can have my Vim highlight these characters so I can
 see them and replace them with their HTML counterparts?

I usually do a :set hls (highlight search results) followed by /[^ -~]
(search for any character that is not between space and tilde, ie. that
is not a printable character from the ASCII set.)  You can add the tab
character (with Ctrl-V Tab) inside the square brackets if you use it in
your documents.  It will show as /[^ -~^I] with a blue ^I.

This has the added benefit of hitting n to get to the next one.


Tobia


Close tab / delete buffer?

2007-03-20 Thread Tobia
I'm an avid user of the new tabbed interface in Vim 7, maybe because 
I never understood how to use hidden buffers effectively.

One of the things I dislike about Vim's tabs is that when I close one,
by means of :q or ZZ, its buffer is not deleted.  This means that my Vim
accumulates open file descriptors and swap files all over the place,
unless I periodically fix the situation by hand with :ls and :bd

Is there a reason for this bizarre behaviour?  

I usually open files with :tabe when I need them, switch tabs, do my job,
and close them with ZZ or :q when my focus shifts to other files or when
I see too many tabs on the screen.  Is this usage pattern suboptimal?


Tobia

PS I find these handy:

map F11 gT
map F12 gt