Re: taglist: ctrl ] azerty

2007-05-24 Thread Jürgen Krämer

Hi,

Mathieu Malaterre wrote:
 
   I am trying to use taglist on my AZERTY keyboard and I cannot get
 ctrl ] to work. If I type :ts + tagname I can see that taglist is
 working.

this depends heavily on the operating system you use and the installed
keyboard driver. For me on Windows XP with a German keyboard pressing
Ctrl++ works. It seems that ctrl-combinations that do not involve
alphabetic keys but only symbols have not moved from their original
position on an english/american keyboard, e.g., Ctrl+ü is
equivalent to Ctrl+[ and Ctrl+6 is the same as Ctrl+^.

You might try to press Ctrl and the rightmost key in the AZERTY row.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: vim | delete consecutive occurrences of a pattern

2007-04-27 Thread Jürgen Krämer

Hi,

Nikolaos A. Patsopoulos wrote:
 
 I have a text that has many occurrences of a pattern . I want to delete 
 every consecutive occurrence, e.g.
 
 Pattern Pattern other text Pattern Pattern Pattern Pattern other text 
 Pattern Pattern Pattern
 should look like this:
 Pattern other text Pattern other text Pattern
 
 I've used:
 
 :%s/\(Pattern\s\+\)\(Pattern\)/\1/g
 
 but have to run this more than once with: %g to result the wanted text.
 
 Can I do this with one command only?

if you want to remove multiple occurrences of the same *pattern*, use

  :%s/\(Pattern\)\(\s\+Pattern\)*/\1/g

But if you want to remove multiple occurrences of the same *text*, use

  :%s/\(Pattern\)\(\s\+\1\)*/\1/g

There is a noticeable difference if your pattern is not a simple text
but a more complex regular expressions, e.g.

  :%s/\(\d\+\)\(\s\+\d\+\)*/\1/g

would turn

  42 00 00 00 43 00 00 00

into

  42

while

  :%s/\(\d\+\)\(\s\+\1\)*/\1/g

would result in

  42 00 43 00


Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: vim | delete consecutive occurrences of a pattern

2007-04-27 Thread Jürgen Krämer

Hi,

Nikolaos A. Patsopoulos wrote:
 Tim Chase wrote:
 I have a text that has many occurrences of a pattern . I want to delete 
 every consecutive occurrence, e.g.

 Pattern Pattern other text Pattern Pattern Pattern Pattern other text 
 Pattern Pattern Pattern
 should look like this:
 Pattern other text Pattern other text Pattern

 I've used:

 :%s/\(Pattern\s\+\)\(Pattern\)/\1/g

 but have to run this more than once with: %g to result the wanted text.

 Can I do this with one command only? If not can I write a while function?:
 
 You seem to be close.  The following did it for me,

   :%s/\(Pattern\)\(\s\+Pattern\)\+/\1/g

 or, if you're lazy,

   :%s/\(Pattern\)\(\s\+\1\)\+/\1/g

 (no need to type the Pattern a 2nd time)

 I tried Jorgen' s code (all possible ways) but I still had to run the 
 command more than once.

strange, the only difference between Tim's and my versions where the \+
he used after the second parenthesis and the * I used. As both \+ and *
are greedy, this should not make a difference for the final result, only
maybe in speed.

Just out of curiosity could you show me/us the exact command you used?

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: join all lines inside pattern that occurs more than once

2007-04-26 Thread Jürgen Krämer

Hi,

Nikolaos A. Patsopoulos wrote:
 
 I want to join all lines that are inside a given pattern and occurs more 
 than once  in the text, ie:
 
 
 PatternStart 
 text1
 text2
 ...text3
 ..text4
 PatternEnd
 ...
 ...
 
 
 PatternStart 
 text1
 text2
 ...text3
 ..text4
 ...
 ...textn
 PatternEnd
 
 
 
 ...
 PatternStart text1text2...text3..text4PatternEnd
 
 
 
 PatternStart text1text2...text3..text4......textnPatternEnd
 
 
 
 I tried to use:
 :g/PatternStart\_.\{-}PatternEnd/ J
 
 but this joins only first and second line of the pattern.
 
 How can I tell vi to join all lines inside all occurrences of this 
 pattern with variable containing lines?

the pattern you supplied only specifies a single line range. If you want
to join a whole block you must give a start address and an end address,
e.g.

  :g/PatternStart/,/PatternEnd/j

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: Getting rid of indents

2007-04-13 Thread Jürgen Krämer

Hi,

Tomas Pihl wrote:

 As a convert from the dark side, I'm still learning Vim and have started to 
 use
 it for editing mails (from mutt) to get some practice. One thing that I 
 haven't
 managed to find is how I get rid of the (what I think) is some smart indenting
 after ( , ), / and , So if I type
 
   Hello all,
 
 and press return, I end up under a but I really want to be under H. What
 can I do to make this happen?

probably the cindent option is set. You can check this (and from where
it has been set) with

  :verbose set cindent?

(Note the trailing question mark.) This should give you the name of a
script file. To unset this option you can either remove the offending
line from this file or, if you want to deactivate this option only for
mails, put the line

  set nocindent

in a mail filetype plugin, e.g. ~/.vim/after/ftplugin/mail.vim.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: mark block from unknown position

2007-04-12 Thread Jürgen Krämer

Hi,

[EMAIL PROTECTED] schrieb:
 
  I am trying to automate this:
 
  There is a file, which contains one path/filename at each line.
  Lines with equal files (contents wise) are grouped together.  Groups
  are separated by # ---' (or whatever you want).
 
  To sort the lines of one group only I want to put the group into a
  visual block (correcht naming?) as part of a macro.

you don't need a visual block here. Say you have the following file

  # ---
  3.txt
  2.txt
  1.txt
  # ---
  6.txt
  5.txt
  4.txt
  # ---
  9.txt
  7.txt
  8.txt
  # ---

Then

  :g/^# ---/+1,/^# ---/-1!sort

will sort it by file names inside your groups. This command will emit
an error message E16: Invalid range for the last marker, which you
can safely ignore.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: mark block from unknown position

2007-04-12 Thread Jürgen Krämer

Hi,,

[EMAIL PROTECTED] wrote:
 
 J?rgen Kr?mer [EMAIL PROTECTED] [07-04-12 13:12]:
 Hi,

 [EMAIL PROTECTED] schrieb:
  I am trying to automate this:

  There is a file, which contains one path/filename at each line.
  Lines with equal files (contents wise) are grouped together.  Groups
  are separated by # ---' (or whatever you want).

  To sort the lines of one group only I want to put the group into a
  visual block (correcht naming?) as part of a macro.
 you don't need a visual block here. Say you have the following file

   # ---
   3.txt
   2.txt
   1.txt
   # ---
   6.txt
   5.txt
   4.txt
   # ---
   9.txt
   7.txt
   8.txt
   # ---

 Then

   :g/^# ---/+1,/^# ---/-1!sort

 will sort it by file names inside your groups. This command will emit
 an error message E16: Invalid range for the last marker, which you
 can safely ignore.

  Thanks for your reply ! :)

  Sort was only an example...is it possible
  to mark the group visually ?

yes. While in normal mode enter

  /^# ---/+CRV/^# ---/-

where CR means Press the Return/Enter key. After that the lines
between two consecutive markers are visually selected.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: Finding something conatined in two lines?

2007-04-12 Thread Jürgen Krämer

Hi,

[EMAIL PROTECTED] wrote:
 
  Suppose there is a file containing a path/filename -- in each line:
 
  #
  a.txt
  b.txt
  c.txt
  #
  1.txt
  2.txt
  3.txt
  4.txt
  #
  1.txt
  3.txt
  4.txt
  #
 
  Now I want to replace any combination of
  1.txt
  2,txt
  by - say - 
  x.txt
 
  Is there a way to expand / of two/more lines ?

you can represent an end-of-line inside a regular expression with \n

  :%s/^1\.txt\n2\.txt$/x.txt/

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: copy pasting HTML code into vim

2007-04-10 Thread Jürgen Krämer

Hi,

A.J.Mechelynck wrote:

 Kamaraju S Kusumanchi wrote:
 
  Let's say I open up a webpage, select some text and paste it into vim. Then
  all I see in vim is the text I see on the browser. While this is OK most of
  the times, sometimes I wish there is a way to paste the actual HTML code
  directly into the vim.
 
  Selecting view source of the webpage and then copy pasting into vim will
  work. But it is very cumbersome and time consuming. So this is not an
  option for me.
 
  Currently the editor in docs.google.com does what I need, Is there any way
  the same can be achieved by vim?
 
 Vim cannot get from the clipboard what isn't there: when you select text in a 
 browser (other than in View Source), what gets put onto the clipboard is the 
 text, not the source; IOW, the formatting tags aren't there.

actually, the selected HTML code might be available from the clipboard.
E.g., both Firefox and Internet Explorer put it there in multiple
formats. The following are lists of the available formats after copying
from FF and IE, respectively:

  49161: DataObject
  49422: text/html
  49366: HTML Format
  49776: text/_moz_htmlcontext
  49778: text/_moz_htmlinfo
 13: CF_UNICODETEXT
  1: CF_TEXT
  49171: Ole Private Data
 16: CF_LOCALE
  7: CF_OEMTEXT

  49161: DataObject
  1: CF_TEXT
 13: CF_UNICODETEXT
  49366: HTML Format
  49330: Rich Text Format
  49171: Ole Private Data
 16: CF_LOCALE
  7: CF_OEMTEXT

The formats starting with CF_ are pre-defined clipboard formats, the
remaining ones are registered through Windows' RegisterClipboardFormat()
function. I don't know how widely understood they are, but at least
Microsoft Word is able to render headlines and other HTML-formatting
instructions when text copied from Firefox is pasted into a document.
It seems, the clipboard object associated with HTML Format contains
enough information for correct rendering.

A different point is how to access the HTML content in VIM. I doubt it
would be a good idea to always paste the HTML source when accessing the
clipboard through the + or * register. Probably a pasteclipboard()
function which takes an argument for determining the preferred format
would be a better way. This function function could then be used inside
a mapping whenever a VIM user wants to paste the original HTML source.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: copy pasting HTML code into vim

2007-04-10 Thread Jürgen Krämer

Hi,

me wrote:
 
 actually, the selected HTML code might be available from the clipboard.
 E.g., both Firefox and Internet Explorer put it there in multiple
 formats. The following are lists of the available formats after copying
 from FF and IE, respectively:
 
   49161: DataObject
   49422: text/html
   49366: HTML Format
   49776: text/_moz_htmlcontext
   49778: text/_moz_htmlinfo
  13: CF_UNICODETEXT
   1: CF_TEXT
   49171: Ole Private Data
  16: CF_LOCALE
   7: CF_OEMTEXT
 
   49161: DataObject
   1: CF_TEXT
  13: CF_UNICODETEXT
   49366: HTML Format
   49330: Rich Text Format
   49171: Ole Private Data
  16: CF_LOCALE
   7: CF_OEMTEXT
 
 The formats starting with CF_ are pre-defined clipboard formats, the
 remaining ones are registered through Windows' RegisterClipboardFormat()
 function. I don't know how widely understood they are, but at least
 Microsoft Word is able to render headlines and other HTML-formatting
 instructions when text copied from Firefox is pasted into a document.
 It seems, the clipboard object associated with HTML Format contains
 enough information for correct rendering.
 
 A different point is how to access the HTML content in VIM. I doubt it
 would be a good idea to always paste the HTML source when accessing the
 clipboard through the + or * register. Probably a pasteclipboard()
 function which takes an argument for determining the preferred format
 would be a better way. This function function could then be used inside
 a mapping whenever a VIM user wants to paste the original HTML source.

sorry, I forgot to mention explicitly that this is totally Microsoft
Windows-centric. But I think other OSs might also support multiple
formats on the clipboard.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: script boolean operators

2007-04-10 Thread Jürgen Krämer

Hi,

Horvath Adam wrote:
 
 I can not find (manual, list-archiv, google) how to use boolean
 operators (and, or) in script.
 
 I prefer this:
 if i500 and i1000

boolean and is written as  and boolean or is written as ||. So
your example becomes

  if i500  i1000.

 One working solution:
 
 normal G
 let numberofrows = line(.)
 normal gg
 let i = 1
 while i=numberofrows
 if i500
 if i1000
  do something
 endif
 endif
 let i += 1
 endwhile
 
 Any other way?

  normal G
  let numberofrows = line(.)
  normal gg
  let i = 1
  while i=numberofrows
  if i500  i1000
   do something
  endif
  let i += 1
  endwhile

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: VIM Delete All Except

2007-04-05 Thread Jürgen Krämer

Hi,

jas01 wrote:
 I have a huge file where I need to delete all lines except for a few I need.
 I'm trying to do this in a single command.
 
 I know that:
 
 :v/Text/d 
 
 will delete all lines except for ones containing 'Text.' I have no idea how
 to put multiple strings so the command deletes everything except for 'Text'
 and 'Text2' and 'Text3'.

use  \|  in the search pattern

  :v/Text\|Text2\|Text3/d

See

  :help /\|

for more information.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: autocmd bug?

2007-03-27 Thread Jürgen Krämer

Hi,

A.J.Mechelynck wrote:
 Jürgen Krämer wrote:
 [...]
 the FileType event is only fired once with the exact filetype you
 specified in your set command, so you must additionally define the
 following autocommand:

   autocmd FileType c.doxygen setlocal cindent number cursorline
 
 If that is true, doesn't it defeat the purpose of setting the filetype with a 
 dot?

I'm not sure -- at least it seems to be a little bit inconsistent to
me, because :help 'filetype' explicitly mentions filetype plugins and
syntax files:

| When a dot appears in the value then this separates two filetype
| names.  Example:
|   /* vim: set filetype=c.doxygen : */ ~
| This will use the c filetype first, then the doxygen filetype.
| This works both for filetype plugins and for syntax files.  More than
| one dot may appear.

So, moving the :setlocal commands from the autocommand to a filetype
plugin would work, but there seem to be a lot of people that want to
keep their settings in one single place -- namely ~/.vimrc -- to make
it simpler to exchange them between multiple installations.

 Or should we add something like (untested)
 
:au Filetype \(w*\).\(\S*\) exe doau FileType \1 | exe doau FileType \2
 
 ?

Nice idea (esp. the recursion), but alas it's not that simple, because
the pattern only accepts wildcards (not regular expressions) and if it
did, the subpatterns would probably not be recognized in the command.
But your command gave me an idea -- the following should work

  au FileType *.* exe substitute(expand('amatch'),
  \  '^\(.*\)\.\(.*\)$',
  \  'doau FileType \1 | doau FileType \2',
  \  '')
 
 ('cindent' is set by the indent/c.vim plugin).

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: autocmd bug?

2007-03-26 Thread Jürgen Krämer

Hi,

Michael Wookey schrieb:
 I have the following  in my .vimrc:
 
 filetype plugin indent on
 autocmd FileType c,h,cpp,hpp,cs setlocal cindent number cursorline
 
 If I have a new buffer and set the filetype as follows, everything works
 just fine:
 
 :set filetype=c
 
 However, if I have a new buffer and I set the filetype like this, the
 autocmd doesn't fire:
 
 :set filetype=c.doxygen
 
 This syntax is described in:
 
 :help 'filetype'
 
 The result is that I don't get cindent, number or cursorline set.
 
 I actually noticed this behaviour when a modeline in a C file set the
 filetype to 'c.doxygen' and my options didn't appear.
 
 Does this work for anyone else or is it just my settings messing
 something up?  Vim build details are below.

the FileType event is only fired once with the exact filetype you
specified in your set command, so you must additionally define the
following autocommand:

  autocmd FileType c.doxygen setlocal cindent number cursorline

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: Best way to repeat a sequence of keystrokes/commands with a single keypress ?

2007-03-09 Thread Jürgen Krämer

Hi,

Ivan Vecerina wrote:
 
 I sometimes want to repeat a sequence of operations
 like I would repeat a single command.
 For example, I can repeat with '.' something like:
  gI//ESC{is a single operation '.' repeats all}
 But I cannot as easily repeat:
  02r/{ '.' will repeat the 2r/ , but not the move to 0 }
 
 [ Let's not focus on the example sequence I am using here,
   I do know that there are other ways to comment a line ]
 
 The obvious choice to repeat multiple operations is to record
 a macro (for example:  qq02r/q ), and replay it with @q.
 Unfortunately, '.' after @q only replays the last action
 within the macro, not the whole macro execution.
 So I have to repeatedly type two awkward keys (@q) instead
 of being able to use the dot command to repeat the whole
 sequence of operations.
  [ I wonder why this behavior was chosen. Is there any
way to have '.' repeat the whole macro instead ?]

you can use @@ to repeat the execution of the last macro.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: :!start command: need to be root

2007-02-14 Thread Jürgen Krämer

Hi,

Régis B. wrote:
 
 I use gVim on a Linux computer (KUbuntu), and I am trying to launch a
 program from inside gvim with the !start command, so for instance:
 
 :!start kdvi
 or
 :!start /usr/bin/kdvi
 
 But I get the following error:
 start: need to be root
 shell returned 1
 
 So obviously I need to be root to execute commands from inside gvim, which
 is extremely weird.
 
 You guys have any idea how to solve this?

I don't know what the start command on Linux does, but would it not
suffice to execute

  :!/usr/bin/kdvi

without start?

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: How to diff in gvim

2007-02-13 Thread Jürgen Krämer

Hi,

Naim Far wrote:
 
   Does anyone know how to do vert diffsplit between two buffers?!
 When using diffsplit I have to supply the full path of the second
 comparison file, what if I simply want the comparison to be done with
 another already opened buffer?!

execute

  :diffsplit

in both buffers.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: /Pattern with grouping ([]) and word character abrev (\w)

2007-02-07 Thread Jürgen Krämer

Hi,

Thomas Michael Engelke wrote:
 
 I'm trying to use a regex for searching in a file. I noticed that
 inside square brackets \w seems to loose all magical matching
 abilities. Is there a way to reverse that loss or do I have to specify
 everything inside [] explicitly?

yes, inside [] backslashes don't start a character class but may only be
used to denote special characters:

  \eEsc
  \tTab
  \rCR(NOT end-of-line!)
  \bBS
  \nline break, see above |/[\n]|
  \d123 decimal number of character
  \o40  octal number of character up to 0377
  \x20  hexadecimal number of character up to 0xff
  \u20AChex. number of multibyte character up to 0x
  \U1234hex. number of multibyte character up to 0x

There is a different notation to denote character classes inside brackets:

  [:alnum:] letters and digits
  [:alpha:] letters
  [:blank:] space and tab characters
  [:cntrl:] control characters
  [:digit:] decimal digits
  [:graph:] printable characters excluding space
  [:lower:] lowercase letters (all letters when
'ignorecase' is used)
  [:print:] printable characters including space
  [:punct:] punctuation characters
  [:space:] whitespace characters
  [:upper:] uppercase letters (all letters when
'ignorecase' is used)
  [:xdigit:]hexadecimal digits
  [:return:]the CR character
  [:tab:]   the Tab character
  [:escape:]the Esc character
  [:backspace:] the BS character

So instead of [\w] you should use [[:alpha:]] (note the double
brackets).

You can find more on brackets in regular expressions with

  :help /[]

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: Workspace concept ala TextPad

2007-02-07 Thread Jürgen Krämer

Hi,

A.J.Mechelynck wrote:
 Eric Leenman wrote:

 I read on the script that I need to follow the 6 points mentioned.

 [start of point 1]
 1. Download the workspace.zip file and unzip the files to the $HOME/.vim 
 or the $HOME/vimfiles or the $VIM/vimfiles directory. This should unzip 
 the following two files (the directory structure should be preserved):

  plugin/workspace.vim - main workspace plugin file
  doc/workspace.txt- documentation (help) file

   Refer to the 'add-plugin', 'add-global-plugin' and 'runtimepath'
   Vim help pages for more details about installing Vim plugins.
 [end of point 1]

 What I did:
 Download the zip file:
 And stored
 workspace.txt is stored in C:\Program Files\Vim\vimfiles\doc
   
 workspace.vim C:\Program Files\Vim\vimfiles\plugin
  

 Is this OK?
 
 No. These directories are only for what comes bundled with Vim. You should 
 not 
 change anything there, because any upgrade (maybe tomorrow, maybe next year) 
 may silently undo whatever changes you had made.

sorry to correct you, Tony, but I think you missed the vimfiles part of
those paths. C:\Program Files\Vim\vimfiles is used for system-wide
configuration files, not for files bundled with Vim.

[snip]

 [start of point 2]
 2. Change to the $HOME/.vim/doc or $HOME/vimfiles/doc or
   $VIM/doc/vimfiles directory, start Vim and run the :helptags .
  
Those directories are swapped -- it should have read $VIM/vimfiles/doc.

   command to process the workspace help file.
 [end of point 2]

An easier way to update the tags file is to just start Vim and enter

  :helptags $HOME/.vim/doc
  :helptags $HOME/vimfiles/doc

or

  :helptags $VIM/vimfiles/doc

In you case -- because C:\Program Files\Vim corresponds to $VIM -- the
third one is the correct one. After that, :help workspace should work.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: break option lines

2007-02-06 Thread Jürgen Krämer

Hi,

[EMAIL PROTECTED] schrieb:
 
 is it possible in a vimrc for comma separated
 option strings like this one below to break:
 
 set
 dictionary=$VIM\SQLDict\BPMS_Stamm.txt,$VIM\SQLDict\BPMS_Mandant.txt,$VIM\SQL
 Dict\CBS_2005.txt,$VIM\SQLDict\ICCS_Net_Strommixer.txt,$VIM\SQLDict\DBS.txt,$
 VIM\SQLDict\cbsbestenergy.txt,$VIM\SQLDict\iccs_2005.txt... many other
 files..

if you want to break a long line you must write a backslash as the
first non-white-space character on every but the first line

  set dictionary=$VIM\SQLDict\BPMS_Stamm.txt,
\$VIM\SQLDict\BPMS_Mandant.txt,
\$VIM\SQLDict\CBS_2005.txt,
\$VIM\SQLDict\ICCS_Net_Strommixer.txt,
\$VIM\SQLDict\DBS.txt,
\$VIM\SQLDict\cbsbestenergy.txt,
\$VIM\SQLDict\iccs_2005.txt

Or you can use multiple set-commands, the first with a single = and
the rest with +=:

  set dictionary=$VIM\SQLDict\BPMS_Stamm.txt
  set dictionary+=$VIM\SQLDict\BPMS_Mandant.txt
  set dictionary+=$VIM\SQLDict\CBS_2005.txt
  set dictionary+=$VIM\SQLDict\ICCS_Net_Strommixer.txt
  set dictionary+=$VIM\SQLDict\DBS.txt
  set dictionary+=$VIM\SQLDict\cbsbestenergy.txt
  set dictionary+=$VIM\SQLDict\iccs_2005.txt

If the option is a comma separated list VIM takes care of the commas.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: jump from word to word

2007-01-30 Thread Jürgen Krämer

Hi,

Claus Atzenbeck wrote:
 
 w jumps from word to word. However, it considers German umlauts
 (äöüÄÖÜ) and German sz (ß) as word end. For example, w stops at the
 indicated positions:
 
 Schwämme überall.
 ^   ^^   ^^ ^
 
 However, I would desire instead:
 
 Schwämme überall.
 ^^  ^
 
 Any idea how to teach Vim to consider special characters as mentioned
 above as normal letters?

  :help word
  :help 'iskeyword'

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: 7.0.188 - problem with directory browser?

2007-01-27 Thread Jürgen Krämer

Hi,

Bill McCarthy wrote:

 After sending my response, I received the following alien
 language (probably German from the .de) email.  I copied no
 recipient at @youngs.de.  Perhaps a member of this list is
 sending away from office responses to the list?
 
 From: [EMAIL PROTECTED]
 
 Die von Ihnen genutzte eMail-Adresse ([EMAIL PROTECTED]) existiert
 nicht oder existiert nicht mehr.

  The e-mail address you used ([EMAIL PROTECTED]) does not exist or does
  not exist anymore.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: disable é map in tex-suite

2007-01-23 Thread Jürgen Krämer

Hi,

neolistic wrote:

 It don't works, I tried
 iunmap é
 iunmap M-i
 
 and I can see the map with :imap
 i  é@PlugTex_InsertItemOnThisLine

from :help map-listing

| When listing mappings the characters in the first two columns are:
|
|   CHAR  MODE~
|  SpaceNormal, Visual and Operator-pending
| n   Normal
| v   Visual
| o   Operator-pending
| !   Insert and Command-line
| i   Insert
| l   :lmap mappings for Insert, Command-line and Lang-Arg
| c   Command-line
|
| Just before the {rhs} a special character can appear:
| *   indicates that it is not remappable
|indicates that only script-local mappings are remappable
| @   indicates a buffer-local mapping

Note the last line. To unmap this buffer-local mapping you should use

  :iunmap buffer é

or

  :iunmap buffer M-i

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: change syntax highlighting

2007-01-10 Thread Jürgen Krämer

Hi,

Geue, Stephan wrote:

 Hello, I would like to change the VIM colors, i.e. the C/C++ mapping of
 VIM colors to Xterm colors. First, I changed a few lines within
 /etc/X11/app-defaults/Xterm-color but this also changed the color scheme
 of the shell which is not my intention - and in some cases not
 acceptable at all. I identified a file that might be of relevance for
 that problem: /opt/vim/share/vim/vim70/syntax/cpp.vim. But I do neither
 know the syntax of that file nor if changing it is a solution. Can you
 tell me, which file has to be modified and where the doc files
 describing the necessary procedure are located? Thank you very much in
 advance!

the file syntax/cpp.vim defines the different syntax elements of C++.
You should not change this file.

The right way to change VIM's colors is to use a different color scheme.
There are already 17 color schemes supplied with VIM. You can find them
in the $VIMRUNTIME/colors directory. To use a different color scheme
just enter, e.g,

  :colorscheme morning

On www.vim.org you can find even more color schemes in the scripts
section. Just go to http://www.vim.org/search.php, select color scheme
in the type box below Search for Scripts and press the Search
button. If you find a scheme you like you save it to your local
~/.vim/colors directory.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: Indendation of Progress code

2007-01-10 Thread Jürgen Krämer

Hi,

Thomas Michael Engelke schrieb:
 
 I have a problem with indendation of a piece of Progress code. It's
 representative of a bit of indendation problems I have now and again,
 always indenting way too far without any visible cause. I hope someone
 can reproduce the issue.
 
 I've attached the problematic file (zipped) to this post. When I am in
 line 771 and use O (shift+o, that's the letter, not the number), I get
 the cursor one line up, but indented by 49 chars, not (as I would
 expect) 7. I'm not sure if this is a problem of vim, a problem of the
 Progress syntax file or a problem of my configuration.
 
 Please hint me in the right direction.

you seem to have

  set cindent

somewhere in one of your loaded scripts. Check where it has been set
with

  verbose set cindent?

and remove it from the script.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: % jumping over {} in c-files in the midst of {{{ folds

2007-01-08 Thread Jürgen Krämer

Hi,

Suresh Govindachar wrote:
A.J.Mechelynck wrote 
   Suresh Govindachar wrote:
   
Start gvim via command:
 c:\opt\vim\vim70\gvim.exe --noplugin -u NONE -U NONE
   
:saveas boo.c
:set filetype=c
   
Enter following text:
   
if(1)
{
  /* --- {{{3 */
}
   
:w
Now try to jump between { using %.  
   
Bug:  The { in the manual fold-markers interferes with %-jumping.
   
 [comments on using the matchit plugin]
  
   % is a feature of Vim -- I am not trying to use % in any fancy
   way, only in the way it is supposed to work under regular Vim.
   I am reporting a bug in vim (and not looking for a work-around
   based on a plugin).  The bug is that % is not ignoring { within 
   c-comments in a c-file. 

what did lead you to the conclusion that the behaviour of % -- to not
ignore matching parentheses inside comments -- is a bug? I don't see a
place in the help files where % is documented to skip comments. You can
only force it to skip strings by removing % from cpoptions (see :help
cpo-%). The text

  Does not recognize /* and */.

from this help section does not relate to /* and */ as C style comments,
but as potentially matching pairs which are not counted as such if % is
included in cpoptions.

IMHO ignoring comments while searching for a matching parenthesis might
be considered a missing feature, but this can easily -- as Tony wrote --
be implemented by sourcing the matchit plugin.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: % jumping over {} in c-files in the midst of {{{ folds

2007-01-08 Thread Jürgen Krämer

Hi,

Suresh Govindachar wrote:
Jürgen Krämer wrote: 
  
I don't see a place in the help files where % is documented to
skip comments. You can only force it to skip strings by removing
% from cpoptions (see :help cpo-%). 
   
 In the steps I gave to reproduce the bug, adding the following:
 
  :set cpo-=%
  
 does not make %-jumping skip the { inside comments.  So it is a
 bug in Vim.

no, it is not. % in cpoption only affects the skipping of strings -- if
it is included strings that are surrounded by s are not treated
specially, thus with the cursor on the opening paren of

  Test(---)---)

% will move the cursor to the closing paren inside the string. Nowhere
in the documentation it is said that the behaviour of % with regard to
comments can be changed.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: GVIM 7-0-178 seizing up

2006-12-19 Thread Jürgen Krämer

Hi,

Steve Hall wrote:
 From: zzapper david tvis co.uk, Tue, December 19, 2006 6:53 am
 http://downloads.sourceforge.net/cream/gvim-7-0-178.exe?modtime=1165578469big_mirror=0


 Downloaded above by following links from vim.org

 It works fine with most files but cannot edit .vimrc (unless I
 rename .vimrc to say fred) it shows the menu read only, edit anyway
 etc then seizes.
 
 The correct name of vimrc on Windows is _vimrc. A file with a
 preceding dot is actually not a permitted file name on Windows.

there is nothing wrong with a file name with a leading dot. Even
directory names with a leading dot are accepted:

  :echo $MYVIMRC
  C:\Dokumente und Einstellungen\jkr.HABEL\.vimrc
  set rtp?
  
runtimepath=~/.vim,D:\Progs\vim/vimfiles,D:\Progs\vim\vim70,D:\Progs\vim/vimfiles/after,~/.vim/after

 (Although there are ways of getting one on the system.)

It seems Windows Explorer does not allow to create a file name with a
leading dot, but on the command line and inside VIM it's no problem --
just

  echo set compatible .vimrc

or

  :w .vimrc

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: Linewise-only vnoremap

2006-12-07 Thread Jürgen Krämer

Hi,

Vigil wrote:
 vnoremap doesn't appear to care whether the text was selected blockwise or 
 linewise. How can I make a map work in linewise mode only?

you can use the visualmode() function and wrap your actual mapping with
an if-statement:

  :vnoremap F2 :c-uif visualmode() == 'V' bar echo 'linewise' bar endif 
cr

The c-u at the start of the mapping removes the visual range that is
supplied by VIM automatically when a colon is entered while in visual
mode. If you need this range you will have to re-supply it in your
original mapping.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: add yanked line to already yanked lines

2006-11-23 Thread Jürgen Krämer

Hi,

Daniel Nogradi wrote:
 
 I often find myself in need of copying (yanking) non-consecutive
 multiple lines so that I can paste them somewhere else in a
 consecutive way. Several lines are scattered around the file and would
 like to collect them kind of.
 
 At the moment I go to to first line, yank it, go to the destination
 position, paste it, look for the second line, yank it, go to the
 destination position, paste it after the already pasted line, etc.
 
 Is it possible to yank a line (or character or block of text) and then
 yank something else in a way that the second yanking does not
 overwrite the previously yanked stuff but adds to it? So that a
 subsequent paste would paste both?

in addition to Tony's suggestion you can use the :global command if
those lines match a common pattern:

  :let @a = ''
  :g/pattern/y A

will first clear the content of register a. The :global command then
appends every line that matches the pattern to register a.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: sorting columns alphabetically

2006-11-22 Thread Jürgen Krämer

Hi,

Vim Visual wrote:
 
 I have a text file like
 
 Mr Bla Blo
 Ms Ble Blu
 Dr Bli Blu
 etc
 
 and I would like to sort the file alphabetically after the surname
 (3rd column). How can I do that? I know how to sort it after the first
 one (visual + !sort)

with VIM 7 you can sort inside VIM:

  :%sort /^\S\+\s\+\S\+\s\+/

tells VIM to skip the first two words in every line and to sort on
whatever follows.

If the third column is always the last column another way would be to

  :%sort /\\S\+\$/ r

The r flag tells VIM to sort based on the matched text, which is the
last word in this case. This would also work around your problem with
initials you mentioned in your second mail.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: set backupext dynamicly

2006-11-10 Thread Jürgen Krämer

Hi,

Eric Leenman wrote:
 I've tried it but then I get the message :
 Error E510 'Can't backup file (add! to override)
 
 
 
 I have a clean gvim70.exe downloaded today.
 I've added two lines to my _vimrc, see below for the complete file.
 Do I need to do something with backup and write backup?
 
 [start _vimrc]
 set nocompatible
 source $VIMRUNTIME/vimrc_example.vim
 source $VIMRUNTIME/mswin.vim
 behave mswin
 
 set bdir=$VIM/backup
 let bex = '-' . strftime(%Y%b%d%X) . '~'
 [end _vimrc]

%X as part of the strftime parameter generates a time stamp like
14:51:23, but colons are invalid in Windows file names. Better use
something like this:

  let bex = '-' . strftime(%Y%m%d%H%M%S) . '~'

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: Replacing '%' in a text file

2006-10-09 Thread Jürgen Krämer

Hi,

Muhammad Farooq-i-Azam wrote:

 I have to replace every occurrence of % in a file with
 % |. I have been effectively replacing text using the
 following construct:
 
 :%s/\text\/replacement/g
 
 However when I try to do the following:
 
 :%s/\%\/% |/g 
 
 I am greeted by an error message. Obviously, the %
 character needs to be treated differently for being
 replaced. Escap sequence? I cannot figure out how to
 do it. May be trivial for the gurus here. I will be 
 thankful for a hint.

normally % is not included in the 'iskeyword' option so it is not
considered part of a word. Therefore there can not be the beginning of
a word right in front of %. The same is for true for the end of a word
immediately after a %. You either have to include % in the 'iskeyword'
option by issuing a

  :set iskeyword+=%

before executing your substitute command or use

 :%s/%/% |/g

without '\' and '\', respectively.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: bug in map expr and complete()

2006-10-06 Thread Jürgen Krämer

Hi,

Hari Krishna Dara wrote:
 The help on complete() gives an example as a usage pattern which seems
 to be very useful, but it doesn't work. Here is a slightly modified
 example to avoid breaking the lines in email transmission:
 
 inoremap expr F5 ListWeeks()
 func! ListWeeks()
   call complete(col('.'), ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'])
   return ''
 endfunc
 
 If you hit F5, Vim complains about the complete() as not allowed.
 
 Error detected while processing function ListWeeks:
 line1:
 E523: Not allowed here

I don't know the reason for this restriction, but it is documented under
:help complete():

| Set the matches for Insert mode completion.
| Can only be used in Insert mode.  You need to use a mapping
| with CTRL-R = |i_CTRL-R|.  It does not work after CTRL-O or
| with an expression mapping.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: toggling keymap

2006-10-04 Thread Jürgen Krämer

Hi,

Sven Brueggemann schrieb:
 
 where do I find CTRL-^ on a German keyboard? I know that I can
 map it, but I'd like to see if the standard keystroke fits my
 needs before changing it.

on my keyboard and with Windows XP it's CTRL-6.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: SR

2006-09-22 Thread Jürgen Krämer

Hi,

Eric Leenman schrieb:
 
 I have a file where I deleted all lines that don't contain a certain pattern
 For example I want to delete all lines that don't contain XXX and YYY.
 
 Before:
 
 [start of file]
 abcde XXX fghij YYY
 12345 AAA 67890 BBB
 klmno XXX pqrst YYY
 09876 XXX 54321 BBB
 *()- XXX ,./;' YYY
 [end of file]
 
 After:
 [start of file]
 abcde XXX fghij YYY
 *()- XXX ,./;' YYY
 [end of file]
 
 
 How do I do that?

  :g/PATTERN/d

deletes all lines that match a specific pattern. To keep all lines you
need to use

  :g!/PATTERN/d

or

  :v/PATTERN/d

Now your pattern is either

  XXX.*YYY

or

  XXX.*YYY\|YYY.*XXX

depending on wheter you only want to keep lines with contain XXX in
front of YYY or whether the order of those strings is irrelevant. So
the final command is

  :v/XXX.*YYY/d

or

  :v/XXX.*YYY\|YYY.*XXX/d

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: sorting lines on lenght of characters

2006-09-22 Thread Jürgen Krämer

Hi,

Eric Leenman wrote:
 
 Is it possible to sort lines on line length?
 Shortes firsts, longest last?
 If so how do you do this?

I would put the line lengths at the front of each line with leading
zeroes, sort the buffer, and remove the line lengths.

With Vim 7.0 you can do this with the following commands

  :%s/^/\=repeat('0', 8 - strlen(strlen(getline('.' . strlen(getline('.'))/
  :sort
  :%s/^\d\{8\}//

Note the double use of strlen() which is needed to prepends the line
length with the necessary number of zeroes to make it 8 digits wide.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: What is the key nameing of...

2006-09-21 Thread Jürgen Krämer

Hi,

Meino Christian Cramer wrote:
 
  I often have the problem to guess, how a certain keysequence is named
  by the syntax of the vim scripting language.
 
  Recently I tried to map Control-CursorUp but it simply does not work
  for me.
 
  Is there any function/script/hack/trick/* like Ctrl-v is for the raw
  keysequence to display the key thingy?

have you tried Ctrl-V + Control-CursorUp while in insert or command mode?
For me, Vim shows

  C-Up

  Something like (example!)  : 
 
  :showkeyCR
 
  will display
 
  :press key
 
  then one presses the key in question (for example Alt plus F11...)
  and then it displays:
 
  :C-F11

Now that would be a really strange answer for your example. ;-)

There also is a list with some/all special key codes. Have a look at

  :help key-codes

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: Selective line deletion

2006-09-18 Thread Jürgen Krämer

Hi,

Fabien Meghazi wrote:
 
 This is a stupid question about a basic feature but I don't have yet
 enough knowledge with vim.
 
 How can I delete all lines of a buffer where at least one instance of
 foobar is found ?
 
 eg the output of:
 
 grep -v file.txt foobar

  :g/foobar/d

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: vim | insert filename into file

2006-09-14 Thread Jürgen Krämer

Hi,

Nikolaos A. Patsopoulos wrote:
 
 how can anyone add the filename in the file in ex-mode?
 C-R%  and  %p works only in normal mode

  :put %

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: Counts for mapping

2006-09-11 Thread Jürgen Krämer

Hi,

Tom Carr wrote:

 Let's say I have the following mapping:
 nnoremap = 3l
 
 Now if I type =, it moves 3 characters to the right, as expected.
 Now if I type 1=, it moves 13 characters to the right instead of 3.
 Now if I type 3=, it moves 33 characters to the right instead of 9.
 
 Any idea how to make the counts work correctly with the mapping?
 (Vim 7.0)

you can achieve the desired behaviour with the help of a register:

  :let @q = '3l'
  :nnoremap = @q

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: testing patchlevel from script

2006-09-10 Thread Jürgen Krämer

Hi,

Yakov Lerner wrote:

 How can a script test for specific patchlevel ?
 For example, I have vim 7.0.86 and I need to check in the script that
 patchlevel is = 7.0.86. But v:version is 700. How ? It would be
 nice if to have patchlist available through some v: variable.

you can check for a specific patch with

  :let patch_ok = has('patch123')

See

  :help has()
  :help feature-list

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: expr returning path of sourced script?

2006-08-26 Thread Jürgen Krämer

Hi,

sgp wrote:
 On Windows gvim 7.0 I want to :set complete= to a file in the same folder of 
 a syntax file
 
 c:\path\to\syntax\syn.vim
 c:\path\to\syntax\keywords.txt
 
 what expression can I use with :exe to achieve that? I tried adding
 
 exe set 
 complete=k.substitute(fnamemodify(bufname('.'),':p:h').'\keywords.txt','\\','/','g')
 
 in syn.vim - but it doesn't work, as it yields the path of the edited file 
 not of syn.vim

  let complete = expand('sfile:p:h') . '\keywords.txt'

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: vim doesn't create backups of files edited in /tmp

2006-08-25 Thread Jürgen Krämer

Hi,

Alexander Skwar wrote:
 
 In my ~/.vimrc, I've got, among other settings, set backup. Because
 of this, vim creates backup files in the current directory. That's good!
 
 But when I edit a file which is in /tmp, there's no backup file left
 behind.
 
 Why's that so and how do I change this?
 
 I'm using vim 7.0 on Gentoo Linux.

have a look at

  :help 'backupskip'

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: saving unnamed buffer

2006-08-21 Thread Jürgen Krämer

Hi,

A.J.Mechelynck wrote:

 Yakov Lerner wrote:
 
  I fixed another bug, the '*' missing in the autocommand:
 
  au BufWritePre * if(expand('%') == '') | exe file .TempName() | endif
  au BufWritePre * if(expand('%') == '') | exe saveas .TempName() | endif
 
  , but still no luck. I'm still getting the E32: No file name error.
 
 Well, what gets displayed when you replace exe by echo or echomsg? 

probably nothing; I guess the file name is checked before BufWritePre is
executed.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: renaming unnamed buffer at creation

2006-08-21 Thread Jürgen Krämer

Hi,

Yakov Lerner wrote:

 Now that my attempt to write unnamed buffer under
 name /tmp/N failed, I want to autoname empty buffer.
 My first attempt does not work. Autoevent is ot invoked.
 
 function! TempName()
 let x=1
 while filereadable(/tmp/.x)
 let x = x + 1
 endwhile
 return /tmp/.x
 endfun
 
 au BufNew * if(expand('afile') == '') | call input(AAA) | endif
 au BufNew * if(expand('afile') == '') | exe file .TempName() | endif

I checked it with this autocommand

  au! BufNew *
\ if expand('afile') == '' |
\   exe 'file ' . input('Enter file name: ') |
\ else |
\   echomsg 'File already has a name' |
\ endif

It seems to be triggered, but when the 'file' command is executed, VIM
is still in the original buffer thus renaming this one instead of the
new one. One way to circumvent this problem I can think of is to use the
BufNew event to store the new file name in a variable and to use this
variable in a BufEnter event. The following code should do this, but it
is untested:

  au! BufNew *
\ if expand('afile') == '' |
\   let new_file_name = input('Enter file name: ') |
\ else |
\   echomsg 'File already has a name' |
\ endif

  au! BufEnter *
\ if expand('afile') == ''  exists('new_file_name') |
\   exe 'file ' . new_file_name |
\   unlet new_file_name |
\ endif

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: E505, File is write-protected

2006-08-21 Thread Jürgen Krämer

Hi,

Wolfgang Schmidt wrote:
 
 when I try to write (:w) a certain buffer, I get E505 (~ file XXX is 
 write-protected, override with w!).
 The protection seems to be set by Vim, not the OS (WinXP). So I looked 
 for the readonly option value,
 but it's set to noreadonly. I also checked write, which is set to 
 write. Nevertheless, everytime I try to
 :w the file, I get this E505 dialog. Any hints? I'm running Gvim 7.0 on 
 Win XP)

are you able to write the file with :w!? If not, the file might be
opened exclusively or with write-access denied by another program.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: renaming unnamed buffer at creation

2006-08-21 Thread Jürgen Krämer

Hi,

Charles E Campbell Jr wrote:
 Yakov Lerner wrote:
 
  Now that my attempt to write unnamed buffer under
  name /tmp/N failed, I want to autoname empty buffer.
  My first attempt does not work. Autoevent is ot invoked.
 
 
 The autocmd system is always invoked based on the buffer name.
 Thus it appears none of the autocmds will fire, including BufWriteCmd,
 BufReadCmd, CursorHold, etc. 

  :au BufNew * echo 'File name is ' . expand('afile') . '.'

is fired for empty buffer names, too, and will output

  File name is .

in this case.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: tabedit readonly

2006-08-18 Thread Jürgen Krämer

Hi,

SHANKAR R-R66203 wrote:
 
   How do I open a new file in a new tab, but in the read only mode.
 
   :tabedit -R file_name
 
 Does not seem to work.

  :tab sview file_name

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: gP-confusion

2006-08-16 Thread Jürgen Krämer

Hi,

Meino Christian Cramer wrote:
 From: Yakov Lerner [EMAIL PROTECTED]
 Subject: Re: gP-confusion
 Date: Wed, 16 Aug 2006 12:54:52 +
 
 On 8/16/06, Meino Christian Cramer [EMAIL PROTECTED] wrote:
   ...and what is the difference between

   y$$gp

   and

   y$$gP

   then. Or in other words: In what case I would prefer gP instead of
   gp ?
 gp  puts after the cursor, gP puts before the cursor.

 When you want to paste at the front of the line, you want
 gP, like 0gP. When you want to paste at the end of the
 line, you'll want to use $gp.
 
   ?Hu?
 
   ...of the line ???
 
  May be it should be: In front og the pasted text or afer the
  pasted text?

gp puts the text after the current cursor position, then positions the
cursor after the end of the newly yanked text: suppose you have 123 in
the register and the cursor is on the b in the current line:

  abc

Executing gp results in

  ab123c

with the cursor on the c.

gP puts the text before the current cursor position and positions the
cursor after the end of the newly yanked text, too. With the same values
and the cursor on the b again,

  abc

becomes

  a123bc

with the cursor on the b.

The examples Yakov provided -- 0gP and $gp -- combine moving to the
start of line with putting before the cursor and moving to the end
of line with putting after the cursor, respectively. Thus they
provide a way to prepend and append text to a line.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: non-greedy pattern matching

2006-08-16 Thread Jürgen Krämer

Hi,

Wolfgang Schmidt wrote:
 
 I'm trying to do a regexp replacement. My original line is
 
 ignore MATCH1 ignore_again MATCH2
 
 I want to match MATCH1 and MATCH2, so here's my trial:
 
 s/^ignore \(.*\{-}\) .*\{-} \(.*\)/matched:\1,\2/gc
 
 I tried to use \{-} to make the .* match non-greedy, but I get E62 and 
 E476.

in contrast to Perl where you have to append ? to * to make the match
non-greedy, in Vim you must replace * with \{-}. The correct regexp
would have been

  s/^ignore \(.\{-}\) .\{-} \(.*\)/matched:\1,\2/gc

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: using filereadable function

2006-08-16 Thread Jürgen Krämer

Hi,

SHANKAR R-R66203 wrote:
 
 I am trying to use the filereadable function.
 
 My code looks like given below (This code is part of a function) -
  
 if (!filereadable(a:dataFile)
^  ^
remove the quotes.

 let @/ = rs_searchString
 keepjumps exec rs_ori_lineNum
 echohl Todo
 echomsg a:dataFile  Cannot open file for reading
 echohl NONE
 return
 endif
 
 a:dataFile is the argument passed to the function, while calling the
 function.
 This does not seem to work.
 Eventhough the file is present, the function reports, the file is not
 present.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: half of hlsearch

2006-08-11 Thread Jürgen Krämer

Hi,

Meino Christian Cramer wrote:
 
  I am searching for a way to switch hlsearch half on (or half
  off...).
 
  Normally hlsearch is nice when searching regulary for a keyword or
  phrase.
 
  On the other side it highlight half of my text, if I do things like
  
   y/space
 
  . Is there a way to sitch off hlsearch when using y and other action
  which are not searching for something actions from the users point
  of view ?

you can achieve this with two mappings that toggle the state of the
'hlsearch' option depending on which type of search you are about to
execute.

After you have typed y VIM is in operator-pending mode which has its
own set of mappings. At this point you want to turn 'hlsearch' off.
Normally this can be done with set nohls in command-line mode but you
can't switch there from operator-pending mode like with c-o from
insert mode. So you need a little trick -- evaluate the expression
register only for making use of a side effect. For this you need a
helper function which executes a command and returns an empty string.
The empty string can then be inserted into the right hand side of the
mapping without causing any harm.

  function! Execute(command)
  execute a:command
  return ''
  endfunction

  onoremap / /c-r=Execute('set nohls')cr

Regular searches are started from normal mode. At this point you want
to turn 'hlsearch' on again. For this you need a normal mode mapping:

  nnoremap / /c-r=Execute('set hls')cr

Note that there is (at least) one potential problem with this: by doing
y/anything the last search pattern is set to anything. Executing
:set hls after that will cause anything to be highlighted -- not the
search pattern of your last regular search.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: Patch (Unofficial): Malformed characters in menu and toolbar when using zh_CN.GBK encoding under Linux

2006-08-10 Thread Jürgen Krämer

Hi,

Max Dyckhoff wrote:
 Bram, you have an overflow in your signature :)
 
 Max
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 10, 2006 1:44 PM
 Subject: Re: Patch (Unofficial): Malformed characters in menu and
 toolbar
 when using zh_CN.GBK encoding under Linux

 snip

 --
 hundred-and-one symptoms of being an internet addict:
 102. When filling out your driver's license application, you give
  your IP address.

 snip

from another mail by Bram:

| 257. Your ``hundred-and-one´´ lists include well over 101 items,
|  since you automatically interpret all numbers in hexadecimal
|  notation. (hex 101 = decimal 257)

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: Copy a line of text without the LF

2006-08-08 Thread Jürgen Krämer

Hi,

Meino Christian Cramer schrieb:
 
  I am using vim 7.0.42 on a Linux system.
  
  I want copy a complete line of text *without+ the final LF at the
  end, so it is possible to insert it elsewhere in the midth of text.

[snip]

just use

  y$

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: howto set magic=very?

2006-08-08 Thread Jürgen Krämer

Hi,

Linda W wrote:

 I couldn't figure out what flag to use to turn on the very magic
 flag by default.  Could someone maybe tell me where I should have
 looked to find it? :-)

there is no such flag. Everytime you want to use a very magic pattern
you have include \v inside the pattern.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: Copy a line of text without the LF

2006-08-08 Thread Jürgen Krämer

Hi,

Meino Christian Cramer wrote:
 From: Jürgen Krämer [EMAIL PROTECTED]
 Subject: Re: Copy a line of text without the LF
 Date: Tue, 08 Aug 2006 10:56:24 +0200
 
  Meino Christian Cramer schrieb:
I am using vim 7.0.42 on a Linux system.
  
I want copy a complete line of text *without+ the final LF at the
end, so it is possible to insert it elsewhere in the midth of text.
  [snip]
 
  just use
 
y$

  nice to now, that there is just another extra command... :)

it's not a command, it's a combination of a command (yank) and a motion
(to the end of line).

  BUT: For what hopefully logical reason y/$ does not work?

/$ is a different motion than $ -- in general, / as a motion puts
the cursor before the start of the matched text. As $ is a zero-width
anchor and the cursor can't be positioned after the last character on a
line VIM uses the character before the match as start of matched text.
Exception: With :set virtualedit=all the cursor can be placed beyond
the end of line and your command would have worked as expected.

  And more
  important: What is executed instead of one would extrapolate from
  knowing y/something other than $.

Here again the cursor is put before the start of the matched text, e.g.,

  y/a

would yank up to but not including the next a. If you want to include
the a you will have to use offsets, i.e. in this special case

  y/a/e

or more generally

  y/amore text/s+1

would include the a. Have a look at :help search-offset for more
information on offsets in searches.

  Or -- exaggerated to the limit -- do I need another extra command to
  search/yank for example a m at line's end ???

  y/m/e

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: Display the current character

2006-08-08 Thread Jürgen Krämer

Hi,

Ben lemasurier wrote:
 
 Is there a way to dispaly the current cursor position? e.g,, character 23.

  :set ruler

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: Search and Replace with a Regular Expression

2006-08-03 Thread Jürgen Krämer

Hi,

Marv Boyes wrote:
 Hello, all. I've been tasked with migrating a large MS Works
 database into the 21st century. The thing's original setup didn't
 enforce any sort of standardization in data entry, so there are nearly
 as many different formats and styles in the data as there have been
 people entering it. My best bet seems to be to hammer things into
 shape with a CSV version of the data before even thinking of trying to
 drop it into a new database app. Since it's plain text, Vim seems the
 perfect tool for the job. :)

 I could use some pointers on search and replace with regular
 expressions. I'm sure this will be painfully basic to most of you, but
 I can't seem ot get the hang of it for this particular job. Most of
 the problem is with dates, in that I have a mishmash of formats. Most
 of them are in dashed format, but there's not even much uniformity
 _there_: some are MM-DD-, some are M-D-YY, and so on. What I'd
 like to do is reformat them en masse as MM/DD/; preserving the
 original values, replacing dashes with slashes, putting zeroes in
 front of existing single digits, and expanding two-digit years into
 four digits by bolting on 20 at the front.

 For example, let's say I have some dates that look like this:

   7-30-05
   12-5-2006
   10-2-06

 What I'd like to end up with is this...

   07/30/2005
   12/05/2006
   10/02/2006

 ...without, of course, having to re-type every single one by hand. ;)

if you are sure that there are no dates from before 2000 the following
command should do the job (all on one line):

  :%s,\\(\d\+\)[-/]\(\d\+\)[-/]\%(20\)\?\(\d\d\)\,\=(submatch(1)  10 ? '0' : 
'') . submatch(1) . '-' . (submatch(2)  10 ? '0' : '') . submatch(2) . '-' . 
'20' . submatch(3),

I have used commas as separators so that there is no need to escape the
slashes used between the parts for month, day, and year. The regex part
is quite easy: we look for something word-like (\...\) which
consists of one or more digits (\d\+), a dash or a slash ([-/]),
some digits, a second dash or slash, and two or four digits; if the
third number has four digits, the first two must be 20
(\%(20\)\?\(\d\d\)). I used VIM's non-capturing parentheses to make
clear that the content of \%(20\) is not needed later.

If this expression matches, the submatches 1, 2, and 3 contain month,
day, and year, respectively.

Generating the replacement is simple, too; the expression is only
longer (therefore I have split it on three lines here):

  \=(submatch(1)  10 ? '0' : '') . submatch(1) . '-' .
(submatch(2)  10 ? '0' : '') . submatch(2) . '-' .
'20' . submatch(3)

It uses the \= special register to evaluate an expression.
submatch(1) contains the month. If it is less than 10 it has only one
digit. In this case the month is prefixed with a zero. The same is true
for the day in submatch(2). submatch(3) only contains the second to
last digits of the year, because we used non-capturing parentheses. So
we always have to prefix it with '20'. Those three strings are then
concatenated with dashes between them.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: Sorting a file

2006-08-02 Thread Jürgen Krämer

Hi,

Eric Leenman wrote:
 
 I have a long file which contains like:
 ##
   | 0123456
 ##
 Line   18 |   123
 Line   19 |abc
 --
 Line  332 |xyz
 ##
   | 0123456
 ##
 Line   18 |   641
 Line   19 |  GHI
 --
 Line  332 |  vcx
 ##
   | 0123456
 ##
 
 
 How do I sort this file so that
 - all line 18 , i.e., comes under each other? And line 19 , and so on.
 - removes the lines starting with ###
 - removes the lines starting with ---
 - removes the lines starting with spaces
 
 So that what remains look like this:
 ...
 Line   18 |   123
 Line   18 |   641
 Line   19 |abc
 Line   19 |  GHI
 Line  332 |xyz
 Line  332 |  vcx

  :g/^\(###\|---\|   \)d
  :%!sort

Note that the final order of lines with same numbers depends on the
whole line -- Lines with more spaces after Line  ### | will come out
first.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: Deleting a repetative pattern

2006-08-02 Thread Jürgen Krämer

Hi,

Eric Leenman wrote:
 
 I have a file which contains lines like below
 
 Line   18 |200  040  200 
   200  200  051  200  1C2  200  2E2  Line   18 | 
 200  040  200  040  200  052  200  1B9  200  2F4  
 Line   18 |200  040  200 
   040  200  200  200  1C2  200  2DC
 Line   18 |200  040  200 
   040  200  063  200  1D6  200  2D4
 
 How do I deleted per line all the 'odd' 200?
 So that it becomes like:
 
 Line   18 |   040
   200  051 1C2 2E2  Line   18 |  
   040 040  052   
1B9 2F4  Line   18 |  
   040 040  200 1C2 2DC
 Line   18 |   040
   040  063 1D6 2D4

use the 'g' flag of the substitute command:

  :%s/\200\/   /g

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: Deleting a repetative pattern

2006-08-02 Thread Jürgen Krämer

Hi,

Eric Leenman wrote:
 
 I see that my the 'ASCII-layout' is not what it should be.
 The command deletes all 200.
 
 How can I give the command to deleted only the 1st, 3rd, 5th, 7th, ect.. 
 200?
 And leaving (if any) the 2nd, 4th, 6th, ect.

  %s/\200\\(\%(.\{-\}\200\\)\?\)/   \1/g

this again replaces 200 with three spaces; if there is another 200
following with some text between them (this text can not contain a third
200, because of the non-greedy match forced by \{-\}) we keep this
200 together with the interspersed text.

 [snip]
 
 How do I deleted per line all the 'odd' 200?

Now I understand. When I read this for the first time, I wondered what's
so 'strange' about 200 -- I didn't think of 'odd' as the opposite of
'even'.

 [snip]
 
 use the 'g' flag of the substitute command:
   :%s/\200\/   /g
 
 [snip]

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: au! failure in vimrc

2006-07-31 Thread Jürgen Krämer

Hi,

Bill McCarthy wrote:
 
 Suppose two plugins define autocmds, so after start Vim,
 
 :au FuncUndefined
 
 displays:
 
 * call AsNeeded(1,expand(afile))
 Tlist_*   source C:\vim\vimfiles\plugin\taglist.vim
 
 Now I add a line to my _vimrc:
 
 au! FuncUndefined * call Foo()
 
 Now after starting Vim and typing :au FuncUndefined
 
 * call Foo()
   call AsNeeded(1,expand(afile))
 Tlist_*   source C:\vim\vimfiles\plugin\taglist.vim
 
 It did not replace!

it can't replace. Your _vimrc is sourced before all plugins, so at the
time your autocommand command is executed there's no other autocommand
to be replaced.

 Now removing the line I added to _vimrc, starting Vim and
 typing :au! FuncUndefined * call Foo()
 
 I get what I expected from :au FuncUndefined
 
 Tlist_*   source C:\vim\vimfiles\plugin\taglist.vim
 * call Foo()
 
 Vim only appears to fail in startup - it is not just a
 script error.  If I write a small script file that just
 contains the line:  au! FuncUndefined * call Foo()
 
 Sourcing that script works just like typing the command.

Putting this script in the after\plugin directory of the local or
personal part of your runtime path (i.e., $VIM\vimfiles\after\plugin or
$HOME\vimfiles\after\plugin) is the best way to replace or delete an
existing autocommand.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: Add to jumplist

2006-07-31 Thread Jürgen Krämer

Hi,

SHANKAR R-R66203 wrote:
 
   Is there a function, to add the line under the cursor to the jump-list
 ?
 
   This may sound strange. I am coding a function in which from the
 current line, the cursor moves to a different line or a file
 altogather.
  I want a way to come back if needed by the CTRL-O command

perhaps this excerpt from :help jumplist helps you

| When the |:keepjumps| command modifier is used, jumps are not stored in the
| jumplist.  Jumps are also not stored in other cases, e.g., in a |:global|
| command.  You can explicitly add a jump by setting the ' mark.


Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: Clearing Jumplist

2006-07-31 Thread Jürgen Krämer

Hi,

SHANKAR R-R66203 wrote:
 
When I open a particular file, I want to clear all the jumplist.
How do I do that ? Is there any function when called clears the
 jumplist.

I don't think there is a function for this. The best way I could think
of is to set the jumplist to the same (current) position 100 times

  :let i = 0 | while i  100 | mark ' | let i = i + 1 | endwhile

See :help jumplist for a reason for using the magic number 100.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: Visual select / paste behaviour

2006-07-28 Thread Jürgen Krämer

Hi,

Roel Vanhout wrote:
 
 Take the following example:
 
 file file_id=myidc:\test.txt/file
 
 When the cursor is on the 'm' of 'myid' and I press 'vw', a word is 
 selected in visual mode. However, the  at the end of 'myid' is also 
 selected. How do I change the list of 'word separators'?

to be exact 'w' in visual word does NOT select a word but it extends the
current selection to the START of the next word (for a definition of
word see :help word). So in your case 'viw' would be better. This
starts visual mode and selects the Inner Word. This works on any letter
of myid and does not select the following quote.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: Visual select / paste behaviour

2006-07-28 Thread Jürgen Krämer

[Resending this because I noticed that the original mail had been
encoded with base64 by either my mail client or a server on the way
to the mailing list.]

Hi,

Roel Vanhout wrote:
 
 Take the following example:
 
 file file_id=myidc:\test.txt/file
 
 When the cursor is on the 'm' of 'myid' and I press 'vw', a word is 
 selected in visual mode. However, the  at the end of 'myid' is also 
 selected. How do I change the list of 'word separators'?

to be exact 'w' in visual word does NOT select a word but it extends the
current selection to the START of the next word (for a definition of
word see :help word). So in your case 'viw' would be better. This
starts visual mode and selects the Inner Word. This works on any letter
of myid and does not select the following quote.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: Matching non-capitalized words?

2006-07-26 Thread Jürgen Krämer

Hi,

Tim Chase wrote:
 :%s/\[a-z]\+\//gI
  another option is to include \C in the regular expression itself:
 
  :%s/\C\[a-z]\+\//g
 
 One should be careful about this, as the help states:
 
 :help /\C
 
 
   Note that 'ignorecase', \c and \C are not
   used for the character classes.

this means that \u always matches uppercase characters regardless of
whether ignorecase is set or not. \c is (at least in this case)
equivalent to setting ignorecase before search -- \u still matches
only uppercase letters. Because \C is used to make a pattern independent
of the current value of ignorecase, \u does not change when used with
\C either.

 And when you look up
 
   :help /character-class
 
 it shows you what's considered a character class.  I don't know 
 if the [...] notation is considered a character-class or not, but 
 the \u \l etc are listed there.

[...] is not considered a character class but a collection. As such it
behaves differently depending on the current value of ignorecase. If
set [A-Z] matches lowercase letters, too, as is the case when \c is
included in the search pattern.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: search and result

2006-07-25 Thread Jürgen Krämer

Hi,

SHANKAR R-R66203 wrote:

 In a function,
I am executing a search.
I have to implement different things based on whether search got a
 result or failed with an error.
 
   exec '/^\w\+\t\w\+'
 
 In the next line, I have to check whether the test passed or failed.
 
 How do I do this ?

use the search() function:

  if search('/^\w\+\t\w\+') != 0
 do something
  endif

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: search and result

2006-07-25 Thread Jürgen Krämer

Hi,

SHANKAR R-R66203 wrote:

 I am actually having a little bit complicated situation.
 Inside a search() fucntion, can I use, variables.
 The part of the code is given below.
 
 
 let rs_sig = expand(cword)
 exec '1'
 exec '/^\s*module\s\+\w\+'
 let rs_line=getline(.)
 let rs_ModuleName=matchstr(rs_line,w\\+\\,0,2)
 exec 'tabedit D:\Profiles\r66203\_tags\LF\debussy.harlech'
 if search('/^' . rs_sig . '\t' . rs_ModuleName . '\t') != 0
 ^^

the slash is not needed.

 echo Got the signal inside a module
 else
 echo Not got it
 endif

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: Matching non-capitalized words?

2006-07-25 Thread Jürgen Krämer

Hi,

Tim Chase wrote:

  Make sure 'ignorecase' is off:
 
  :set noignorecase
 
  :%s/\[a-z]\+\//g
 
 If you don't want to bung with your vim-wide (or bufferwide) 
 settings, you can always just change your :s to include the I flag.
 
   :%s/\[a-z]\+\//gI

another option is to include \C in the regular expression itself:

:%s/\C\[a-z]\+\//g

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: How can I know difference between Vim6.3 and Vim 6.2?

2006-07-21 Thread Jürgen Krämer

Hi,

[EMAIL PROTECTED] wrote:
 
 This may be a silly question, but I had done a search and did not found the
 answer.
 
 The help version7 tells difference between version6 and version7
 
 However, 6.1 and 6.2 has differences, 6.2 and 6.3 has differences, where is
 the document about differences between the minor versions?

  :help version-6.3

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: Incompatible change in 7.0 which were not mentioned

2006-07-20 Thread Jürgen Krämer

Hi,

[EMAIL PROTECTED] wrote:
 
 I've got it, a will be interprated as args in Vim 6.4, and args
 will be the command line argument of the :Explore
 However, in Vim 7.0, a will NOT be args. it will still be a
 
 Note that the :h version7 does not noticed about the incompatible change.
 
 Is this a bug or a feature?

from :help version7 (lines 156 to 158):

| When defining a user command with |:command| the special items could be
| abbreviated.  This caused unexpected behavior, such as li being recognized
| as line1.  The items can no longer be abbreviated.

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: search history - more questions

2006-07-19 Thread Jürgen Krämer

Hi,

SHANKAR R-R66203 wrote:
 I found out that
:his /
 Gives the listing of the search history.
 
 In a particular file, I tried using
 :his /
 
   #  search history
   4  \wallace_tree_4_w4\
   5  ^I
   6  crg_arm
   7   
   8  ipss
  10  #
  11  perl D:/Profiles/r66203/utils/v2html/vhier_ls.pl -f
 verilog.harlech  test.hier
  13  \usb_rcv\
  14
 \(^\s*\(\else\\)[EMAIL PROTECTED](\#\s*(\s*\w\+\s*)\s\+\)\=\w\+\_s*(\(\/\/\
 )\=\)|\(^\s*\w\+\s\+#\s*(.\{-},\)
  15
 \(\(^\s*\(\else\\)[EMAIL PROTECTED](\#\s*(\s*\w\+\s*)\s\+\)\=\w\+\_s*(\(\/\
 /\)\=\)|\\)
  16
 \(\(^\s*\(\else\\)[EMAIL PROTECTED](\#\s*(\s*\w\+\s*)\s\+\)\=\w\+\_s*(\(\/\
 /\)\=\)|\(^\s*\w\+\s\+#\s*(.\{-},\)\)
  17
 \(\(^\s*\(\else\\)[EMAIL PROTECTED](\#\s*(\s*\w\+\s*)\s\+\)\=\w\+\_s*(\(\/\
 /\)\=\)\\|\(^\s*\w\+\s\+#\s*(.\{-},\)\)
  20  \reg_out25\
  87  \rd_even_flash_enb\
 138  pllmrbi_ipi
 155  ^\s*pllmrbi_ipi\
 156
 \(^\s*\(\else\\)[EMAIL PROTECTED](\#\s*(\s*\w\+\s*)\s\+\)\=\w\+\_s*(\(\/\/\
 )\=\)
 162  \(^\s*\w\+\s\+#\s*(.\{-},\)
 177  \ipp_obe_txdata_b\
   192
 \(\(^\s*\(\else\\)[EMAIL PROTECTED](\#\s*(\s*\w\+\s*)\s\+\)\=\w\+\_s*(\(\/\
 /\)\=\)\|\(^\s*\w\+\s\+#\s*(.\{-},\)\)
 
 I do not understand why the numbers are not consecutive.

whenever you re-use a search pattern by using UP the search pattern
is removed from its current position in the history and put at the end
of it.

 How the search history can be deleted ??

There is a histdel() function.

 And finaly another question -
 
 How do I put the result of the following command in a variable.
 :his / -2 

  :let var = histget('/', -2)

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: OPen a dialog box

2006-07-19 Thread Jürgen Krämer

Hi,

SHANKAR R-R66203 wrote:
 
I have want to display a message (which I have in a variable), in a
 popup-dialog box.
 Is it possible to do in VIM. I have seen that in ccase.vim 
 In this plugin, in order to enter comments, a dialog box appears and
 then we have to type in the check in comments into it.
 I want to do almost the samething. Looked into ccase.vim, but no clues.

have a look at

  :help input()
  :help inputdialog()

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: Shortest Pattern Match

2006-07-12 Thread Jürgen Krämer

Hi,

Bob Fleming wrote:
 Hi all, 
 
 I believe vim carries out greedy pattern matching, i.e. the longest pattern
 found will be used. Is there a way of performing shortest matching ?
 
 As an example, I have the following text:
 
 fe fi fo united kingdom fe fi fo 0911 209 30 30
 
 and I want to delete everything up to the word united so I used :%s/.*fo //
 but this deleted everything up to 0911.

have a look at :help /\{

  :%s/.\{-\}fo //

Another way to remove everything in front of united is

  :%s/.*\zeunited//

for the last united on the line and

  :%s/.\{-}\zeunited//

for the first united (see :help /\ze for the special meaning of \ze)

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: substitute a char with newline

2006-07-12 Thread Jürgen Krämer

Hi,

Fabio Rotondo schrieb:
 
 I have a text file with many lines made like this:
 
 [EMAIL PROTECTED]@[EMAIL PROTECTED]@
 
 And I'd like to have them splitted on @ in newlines.
 
 I have tried:
 
 :%s/@/\n/g
 
 but it does not work.
 What am I missing?

\n in the second part of a substitution denotes the NUL character which
is used internally to represent end-of-line. To insert newlines you
have to use \r:

  :%s/@/\r/g

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: substitute a char with newline

2006-07-12 Thread Jürgen Krämer

Hi,

Wim R. Crols wrote:
 
 Side-question: What line endings does \r insert? Or is this dependant on 
 fileformat?

\r only inserts a end-of-line-marker which is then represented by NUL
internally (more or less). The actual line ending that is visible in the
file is determined when the file is written by inspecting the fileformat
option.

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: Irritating column numbers with encoding=utf-8

2006-07-06 Thread Jürgen Krämer

Hi,

Bram Moolenaar wrote:

 Jürgen Krämer wrote:

 with 'encoding' set to utf-8 there is a quite confusing (to me)
 difference between the column number and my expectations (supported by
 the virtual column number) if there are non-ASCII characters on the
 line. I don't know what the intended meaning of column count and the
 intended behaviour of cursor() are, but it seems they both depend on
 the size of the encoded characters. I always thought nth column was
 more or less a synonym for nth character on a line while nth virtual
 column meant nth cell on a screen line.

[snipped

 I don't know whether the shown behaviour is a bug or just a feature I
 don't like, but in summary I think column number should really
 represent a character count (i.e, corresponding to what the user sees),
 not a byte count depending on the underlying encoding.

 I have seen this behaviour in VIM 6.2, 6.3, 6.4, and 7.0, so changing
 the code will definitely introduce an incompatibility. So the final
 question is: What do you (Vimmers) and you (Bram) think: is there a need
 for a change.

 I don't know why you call this a column count, in most places it's
 called a byte count.  Perhaps in some places in the docs the remark
 about this actually being a byte count is missing.

sorry, the column count in the first paragraph should have been a
column number. I called it so because I have the statusline option set
to

  %%f%= [%1*%M%*%{','.fileformat}%R%Y] [%6l,%4c%V] %3b=0x%02B %P

and noticed that %4c-%V displayed two numbers instead of the one I
expected, because I knew there were no tabs or unprintable characters
on that line. Even more disturbing was the fact that the first number
(the column number) was bigger than the second one (the virtual column
number). So I checked :help statusline and it told me

c N   Column number.
v N   Virtual column number.
V N   Virtual column number as -{num}.  Not displayed if equal to 'c'.

 You could also want a character count.  But what is a character when
 using composing characters?  E.g., when the umlaut is not included in
 a character but added as a separate composing character?

I would say that a character is what the user sees. Why should he (be
forced to) know wheter ä is represented internally as LATIN SMALL
LETTER A WITH DIAERESIS or as LATIN SMALL LETTER A plus COMBINING
DIARESIS? So in my opinion column count is equivalent to character
count unless there are characters like tabs and unprintable ones that
have a special representation -- on the screen, not internally.

 It's not so obvious what to do.  In these situations I rather keep it as
 it is.

I know it's a big change and would introduce imcompatibiliy with older
versions, but here is another example: Take this line (ignoring the
leading spaces)

  ääbbcc

and the following commands

  :s/\%3c../xx/
  %s/^..\zs../xx/

From my point of view they should both replace the 3rd and 4th column
with xx. When encoding is set to latin1 they do, but not when it is
set to utf-8 -- the first one replaces äb with xx. As a user I would
be really stumbled and ask Why that, it's the same text as before.

Changing these commands to

  :s/\%2c../xx/
  %s/^.\zs../xx/

makes things even more irritating. The second one works as expected, now
correctly replacing äb with xx, but the first one fails with E486:
Pattern not found: \%2c... Again: Ought I (as a user) really need to
know that \%2c depends on the number of non-ASCII letters in front of
the column I'm interested in?

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: Irritating column numbers with encoding=utf-8

2006-07-05 Thread Jürgen Krämer

Hi,

James Vega wrote:

 On Wed, Jul 05, 2006 at 11:50:51AM +0200, Jürgen Krämer wrote:

 with 'encoding' set to utf-8 there is a quite confusing (to me)
 difference between the column number and my expectations (supported by
 the virtual column number) if there are non-ASCII characters on the
 line.

 Column number n is really the nth byte on that line.  This is described
 at :help /\%c.  This description should explain all the behavior
 you're seeing.  This is the intended behavior and I'm not sure of a way
 off-hand to get the visual character count like you want.

yes, it does *explain* the behaviour. But it makes things even worse.
Suppose I have some lines with aligned data (just like a table) where I
want to replace certain columns with dashes, e.g.,

  PeterTraurig irgendwo  0
  Hänschen Klein   unterwegs 1
  Jürgen   Krämer  hier  2

  :%s/\%18c.*\%27c/-/

should strike out the third column of the table, but the result is

  PeterTraurig - 0
  Hänschen Klein  -s 1
  Jürgen   Krämer-   2

which is depending on the random number of non-ASCII characters in front
of the used position, characters whose internal representations should
never be relevant for this substitution, because the user cannot know
them.

Since it works as documented it is hard to call it a bug, but I would
really consider it a mis-feature, because it works in such a
non-predictable way.

To work around the problem in this example is not that hard -- I can use
/\%...v instead. The example in my original mail poses a bigger problem
(to me) -- I'd like to switch to encoding=utf-8 as default, but I
often need to work with text files of fixed line length. With encoding
set to latin1 the difference between column number and virtual column
number in the status line is a visual clue that there is a tabular or a
control code in the line, reminding me to look for this character. With
UTF-8 encoding this hint would be rendered useless because of all those
little umlauts in German. :-(

But perhaps this is just my special problem.

Regards,
Jürgen


-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: problem in understading 0tag usage

2006-06-28 Thread Jürgen Krämer

Hi,

SHANKAR R-R66203 wrote:
 
 
I am not using ctags for sure.
Somewhere I have set cscopetags option.
When set nocst, then 
   :tag
Works properly.
 
I have to find out in which file, this option is set.
 
I tried using
  :verbose set cst
 
But,this returned nothing.

'cscopetag' is a boolean option. You have to append a question mark to
query its state, otherwise you would/did just set it:

  :verbose set cst?

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: Replace all on a line

2006-06-26 Thread Jürgen Krämer

Hi,

Jerin Joy wrote:
 
 The replace all option 'g' doesn't seem to be working in my case. It
 replaces only the first occurrence on a line.
 
 for eg. in the following line I wanted to remove the extra whitespaces
 between input [] and the name of the variable:
 task init (input [1:0]   u, input [3:0]hash, input [3:0]hash_index1)
 
 Using:
 :%s/\][\ ]\+/\]\ /g
 
 replaces only for the first variable - input [1:0] u

was this really the command you typed inside VIM? I tested it and it
worked. But you can simplify it to

  :%s/] \+/] /g

which is a bit easier to read.

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: Replace all on a line

2006-06-26 Thread Jürgen Krämer

Hi,

Jerin Joy wrote:
 
 I tried the command with the \s instead of '\ ' and it doesn't work
 
 the command :%s/]\s\+/] /g changed
 task init (input [1:0]   u, input [3:0]hash, input [3:0]hash_index1)
 
 to
 task init (input [1:0] u, input [3:0]hash, input [3:0]hash_index1)
 
 Could something be hardcoded in my settings? I'm running vim 6.4.6 the
 default version with ubuntu 6.06.

maybe the 'gdefault' option is on. What does

  :verbose set gdefault?

output?

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: Replace all on a line

2006-06-26 Thread Jürgen Krämer

Hi,

Jerin Joy wrote:
  maybe the 'gdefault' option is on. What does
 
:verbose set gdefault?
  output?

 it doesn't output anything. Cursor just comes back to the file.

did you enter the question mark after gdefault? This is necessary to
query the state of a boolean option.

Mit freundlichen Grüßen,
Jürgen Krämer

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: What might cause .vimrc not to be read

2006-06-22 Thread Jürgen Krämer

Hi,

[EMAIL PROTECTED] wrote:
 Marc Weber [EMAIL PROTECTED] writes:
 
 No idea what might cause this but you might try
  * adding alias gvim=gvim -c source ~/.vimrc 
 
 I'm not using gvim.  I work in X at home machine but even then I use
 vim.   But a lot of what I do is from a bash cmdline on remote
 machines. 
 
 
 This: alias vim=vim -c source ~/.vimrc
 
  doesn't work here... fails like this when I start vim after sourcing
  .bashrc
 
  Error detected while processing command line:
  E471: Argument required

try

  alias vim=vim -c 'source ~/.vimrc'

instead.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: Extra spaces after reformatting.

2006-06-22 Thread Jürgen Krämer

Hi,

ChengHsin Hsu wrote:
 
 I recently start using vim for writing tex files. I found that an  
 extra space is always added between lines after reformatting (e.g.,  
 gq}).
 
 For example:
 Original text:
 a...b
 c...d
 d...e
 
 Reformatted text:
 a...b c...d d...e
 
 Is there an option that I can override this behavior?

I don't think so, but you might want to give

  v}gJgqip

a try. The v}gJ first joins the text from the cursor position up to
the end of the current paragraph into one line without inserting spaces.
Then gqip reformats the whole paragraph.

But guessing from your e-mail address: do you need this behaviour for
writing chinese texts? If so then you should have a look at the flags
'B' and 'M' of the formatoptions option (see :help formatoptions and
:help fo-table). Perhaps they are more appropriate.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)



Re: Differences in the gf command between Windows and Linux

2006-06-21 Thread Jürgen Krämer

Hi,

Tom Purl wrote:

 I've become a very big fan of using the pyGTD http://96db.com/pyGTD/
 script from within Vim 7.  pyGTD creates file output that looks
 similar to this:
 
 3.61 1:00 Get your hair cut
   C=0 P=4 CRC=33B0 I=4 U=4 T=1H [EMAIL PROTECTED],@Work ID=5
   [./inboxes/Shopping-Errands.txt]
 
 3.61 1:00 Cancel Comcast cable internet service
   C=0 P=4 CRC=A32D I=4 U=4 T=1H D=2006-06-21 [EMAIL 
 PROTECTED],@Work ID=7
   [./inboxes/Shopping-Errands.txt]
 
 On Linux, I'm able to place my cursor over the file names between
 brackets and navigate to them using the `gf` command.  On Windows,
 however, I get the following error:
 
 E447: Can't find file [./inboxes/Shopping-Errands.txt] in path
 
 `gf` works without the brackets on Windows, so I guess I need to find a
 way to filter out the brackets when I use that command.  Does anyone
 have a clue as to how I can do this?  Or would this be considered a bug?

have a look at

  :help 'isfname'

This options determines which characters are valid in a file name. To
remove the brackets execute

  :set isfname-=[
  :set isfname-=]

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: gf , isfname and @

2006-06-13 Thread Jürgen Krämer

Hi,

Emmanuel Sixou wrote:
 
 I am using vim7.
 The char @ seems not to be considered as a filename character even
 though it appears in the isfname set variable, for the commands gf, gF.
 What's wrong?

inside isfname and some other options @ is a placeholder for all
characters where isalpha() (i.e., a library function) returns true.

Have a look at :help 'isfname' and search for the first @ below the
different default values of this option. There you'll find an
explanation and how to insert a @ into this option.

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Bug with gU and German sharp s?

2006-06-08 Thread Jürgen Krämer

Hi,

can anybody confirm this misbehaviour in VIM 7.0:

Starting

  gvim -u NONE -U NONE

and typing

  iStraßenesc0gUe

results in

  STRASSEn

(note the lower case 'n'). The same is true for

  iStraßenesc0veU

It seems that after converting the sharp s to 'SS' VIM does not account
for the now longer word and selection and leaves one character in lower
case for every sharp s it converted. Another example:

  iAußenstraßenschilderesc0gUe

leaves two lower case letters at the end of

  AUSSENSTRASSENSCHILDer

This happens on a German Windows XP with VIM 7.0 (patches 1-17 applied).

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: what is wrong with this autoload var usage?

2006-06-07 Thread Jürgen Krämer

Hi,

Hari Krishna Dara wrote:

 I am trying to use the new vim7 object-based features and am stuck
 with an issue in using autoload style variables. Save the below as t.vim
 in your autoload directory and execute it (:runtime autoload/t.vim).
 
 let t#var = 'something'
 
 let s:hash = {}
 function! s:hash.func()
   echomsg 'from numbered function scope: '. t#var
 endfunction
 
 echomsg 'from global scope: '. t#var
 call s:hash.func()
 
 
 you get the below output:
 
 from global scope: something
 Error detected while processing function 3:
 line1:
 E121: Undefined variable: t#var
 E15: Invalid expression: 'from numbered function scope: '. t#var
 
 Is there something wrong that I am doing or is this a bug?

inside a function you have to reference global variables with the g:
prefix even if it's an autoload variable, i.e.

  function! s:hash.func()
echomsg 'from numbered function scope: '. g:t#var
  endfunction

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: vimgrep only .c/.h/.cpp extensions?

2006-06-07 Thread Jürgen Krämer

Hi,

Denis Perelyubskiy wrote:
 
 what do I :help on to find out how to grep only on, say, .c/.h/.cpp
 extensions? I know I can do .c  .h easy:
 
 :vimgrep/foo/j c:/hello/**/*.[ch]
 
 How do I now add .cpp? Or do I have to write out c:/hello/**/*.cpp
 again?

does

  :vimgrep/foo/j c:/hello/**/*.{[ch],cpp}

work for you?

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: page scrolling

2006-05-18 Thread Jürgen Krämer

Hi,

Ilya Hegai wrote:
 
 please, point me to the command, which allow to scroll page line by line, 
 like 
 in mc viewer (F3) with arrow keys

  :help CTRL-E
  :help CTRL-Y

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: Vertical selection

2006-05-18 Thread Jürgen Krämer

Hi,

Baha-Eddine MOKADEM wrote:
 
 Is it possible to make a vertical selection in a text, to have a
 rectangular selection in the text ?
 If so, how ?

  :help ctrl-v

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: C-W C-] to split vertically

2006-05-15 Thread Jürgen Krämer

Hi,

Salman Khilji wrote:

 This does not work.  Is it a bug that the following
 still splits horizontally instead of vertically?
 
 :vertical execute normal ^W]

  :nnoremap c-w] :vertical wincmd ]cr

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: Maximizing the vim window in not-english Windows XP

2006-05-10 Thread Jürgen Krämer

Hi,

Dimitris Zygiridis wrote:
 I use Greek Windows XP.

 The command:

 au GUIEnter * simalt ~x

 maybe works in english Windows,
 but I haven't found a way to send the
 required greek character instead of x.

don't you know the required character or do you know it and the command
you tried did not work? In the first case: the letter required is the
one underlined in the window's system menu entry that maximizes the
window. In the second case please show us what you have tried so far.

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: Maximizing the vim window in not-english Windows XP

2006-05-10 Thread Jürgen Krämer

Hi,

Dimitris Zygiridis wrote:

 ---Original Message---

 From: Jurgen Kramer
 Date: 05/10/06 11:20:40
 To: vim mailing list
 Subject: Re: Maximizing the vim window in not-english Windows XP
 
  Dimitris Zygiridis wrote:
   I use Greek Windows XP.
  
   The command:
  
   au GUIEnter * simalt ~x
  
   maybe works in english Windows,
   but I haven't found a way to send the
   required greek character instead of x.
 
  don't you know the required character or do you know it and the command
  you tried did not work? In the first case: the letter required is the
  one underlined in the window's system menu entry that maximizes the
  window. In the second case please show us what you have tried so far.

 1. I have tried to simply insert the greek character instead of x.

 2. I have tried to map the greek character to an english one, and then
 use it, instead of x.

 In both cases the system window remained open.

I can't check this with a German Windows because there are no non-ASCII
letters in the system menu, but after creating a normal menu entry with

  :amenu Datei.Öffnen :browse eCR
 ^
 (That's an uppercase O-Umlaut.)

issuing a

  :simalt DÖ

opens the Edit File dialog. Can you test this with a similar menu
entry by replacing the uppercase O-Umlaut with a greek letter? If this
works then the system menu might be treated differently.

Rgards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: Inexplicable Error Running Script

2006-05-10 Thread Jürgen Krämer

Hi,

[EMAIL PROTECTED] wrote:
 I notice that a script I sometimes use to automatically check in files
 with RCS when I save a file gives error under the new Vim 7.x but did
 not under Vim 6.4.
 
 Here is the script:
 
  Begin script autoci
 if version = 600
   if has(autocmd) 
 syntax enable
 function! s:RCSCheckIn()
   cd %:p:h
   exe '!ci -l -m'.strftime(%Y %b %d %X).' -t- %:t'
   cd -
 endfuction

this should be endfunction.

 function! s:HiStatusLines()
   hi StatusLine   ctermfg=0 ctermbg=1 guifg=Black guibg=Red term=bold
   hi StatusLineNC ctermfg=0 ctermbg=1 guifg=Black guibg=DarkGreen
 endfuction
  ^^

This should be endfunction, too.

 augroup autoci
   au!
   autocmd BufWrite * exe 'silent call sidRCSCheckIn()' 
   autocmd FileType * exe 'silent call sidHiStatusLines()' 
 augroup END
   endif  has(autocmd)
 endif
  E n d script autoci
 
 When I source this script under Vim 7.0 I receive the following errors:
 
 line   20:
 E126: Missing :endfunction
 line   21:
 E171: Missing :endif

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: Indentation and blank lines

2006-05-09 Thread Jürgen Krämer

Hi

Arménio Pinto wrote:

  I'm using Vim to edit Java code. There's an annoying behavior
 that I would like to fix, but haven't had any success yet. The problem
 is that the indentation disappears when you insert blank lines. For
 example (and suppose that the » it's a tab):

 Vim does...

 »»for (String name: names) {
 »»»System.out.println(name=+name);

 »»»System.out.println(Done);
 »»}

 ... and I would like it to be:

 »»for (String name: names) {
 »»»System.out.println(name=+name);
 »»»
 »»»System.out.println(Done);
 »»}

 That is, after the first println I hit ENTER twice and I and would
 like that the blank line remains with indentation. How can I do this?

insert any character and delete it immediately. You can put this in a
mapping which replaces the original behaviour of ENTER:

  :inoremap cr crXbs

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: fast file opening / find file as you type

2006-05-09 Thread Jürgen Krämer

Hi,

Benjamin Reitzammer wrote:
 
 I've searched the archive and asked many search engines for help, but
 I still haven't found what I'm looking for (well, I'll stop the
 humming, singing instantly ;)
 
 Currently I switch between jEdit and vim on a hourly basis, depending
 on the machine I'm working. I really love vim and would like to use it
 exclusively, but until now there's one major thing missing for me,
 that I couldn't find. Find filenames as you type, and open them
 instantly  or explained in more detail ...
 
 In jEdit there's a plugin called Openit
 (http://plugins.jedit.org/plugins/?OpenIt) which let's me configure a
 number of directories. It then indexes the filenames contained in
 these directories. Then it gives me the opportunity to search through
 all the indexed filenames very, very quickly, and opening a found
 file. Combined with fast typing, knowing the names of your files, and
 a shortcut for opening the searching window, this is awesome.
 I've uploaded a screenshot to better convey what I mean. It's at
 http://nur-eine-i.de/openit_screenshot.png
 
 
 Now my question:
 Is there something similar for vim? Or do you guys have any hacks,
 shell scripts for achieving this? Pressing a key combination, typing
 in some letters, hitting enter and you opened another file?

though I don't think that VIM uses indexing, maybe

  :help :find
  :help 'path'

is what you have been looking for.

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH  Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99