Re: delete in the insert mode

2006-04-09 Thread Tim Chase
imap c-j c-oJ then hitting ctrl-j in insert mode will be like hitting shift-j in normal mode. Suresh has the mapping idea correct, but just a small caveat regarding the choice of c-j as your mapped key: control+J is a line-feed...on some operating systems enter sends control+M,

Re: Start new line from insert mode

2006-04-26 Thread Tim Chase
I am in the middle of line in insert mode and want to break out of the line and start a new line (above or below) What I want is effectively ESCo or ESCO But does Vim7 have a native command for this? I cant imagine such a command being added in Vim7 in some sort of native fashion, given

Re: Conditional search and replace.

2006-04-27 Thread Tim Chase
I would like to write a search and replace that only operates on lines that are found in a separate search. So, for example, lets say I want to replace all occurrences of long with int but only on lines that have the word key on them. :g/key/s/long/int/g That's :g/ on every line that

Re: File - register

2006-04-27 Thread Tim Chase
:new|r foo.bat|1d|normal ayG|q! So why does the q! get lost, Well, the :normal command swallows everything after it, so the pipe cue bang is interpreted as commands to execute in normal mode. You can work around that either by using the exec command: 1d|exec 'normal ayG' | q! or

Re: modify a text file

2006-04-28 Thread Tim Chase
I am struggling with sed and gawk but I guess that it'd be possible to employ vim in the command line (it's to make a script that will be automatically launched every 24 hours) but I don't have any idea of how to do it... How could I select the blocks (see file ahead) of a text file (say

Re: modify a text file

2006-04-29 Thread Tim Chase
cat file | vim - What stands the - for? It is a standard *nix convention of accepting stdin as the source for the file (in this case, the output of cat). That way, we never actually bung with the original file. If you don't care if it gets hosed in the process, you can just do

Re: hiding lines

2006-05-01 Thread Tim Chase
What if #if/#endif blocks are nested ? Yakov is correct, that nested #if/#endif blocks would cause trouble. My first thought at a [100% untested] solution would be something like :g/^\s*#endif/norm dV% which would find all of the #endif tokens and delete their associated blocks,

Re: one input to many lines

2006-05-02 Thread Tim Chase
Hi. My name is Marcelo I'm new in this list and in VIM. Welcome! My question is about one input to many lines and columns in just one render (evaluation, returns ...) For example, if i have a table of numbers and need add 10 for the forth columns in the 420, 530 and 710 lines. Could you

Re: one input to many lines

2006-05-03 Thread Tim Chase
Thanks a lot Tim. You is right about what I meant. To make it more clear, here are the rows. . . i1 0 9 180 /*this is the 420 line number*/ . i2 0 17.1 220 /*430*/ . i3 + 7.875 365 /*710*/ the numbers in question are 180, 220 and 365. No tested your code yet. I'll give a try tomorrow.

Re: ^M problems with migrating VIM from WinXP to Linux

2006-05-03 Thread Tim Chase
I want to remove the ^M on my WinXP machine and then copy them over again to my linux machine. This is the ever-popular line-break-delimiter problem. If you do :set ff? Vim will likely currently come back with dos. You should be able to solve it by executing :set ff=unix

Re: ^M problems with migrating VIM from WinXP to Linux

2006-05-03 Thread Tim Chase
I wish Vim internally supported nul (00) line endings, but alas. You might be able to set up a before/after filter, much like the gzip example (:help gzip-example), using tr, of the form tr '\000\012' '\012\000' This will swap all NUL characters in the file and 0x0A (octal 012)

Re: Commenting out a block of text

2006-05-05 Thread Tim Chase
:s/start_of_visual_selection(.*)end_of_visual_selection/\/*\1\/*/ Any ideas? My first thought would be vnoremap f4 esc`i/* esc`a */esc (all characters typed literally...note the back-ticks rather than single-quote characters) which should work with both line-wise and characterwise

Re: Determining Screen Width Natively

2006-05-09 Thread Tim Chase
AFAIK, Vim isn't able to tell what screen resolution you're using. I did notice that my version of gvim running here on Debian/Testing that gvim *somewhat* respects the usual X -geom parameter. It seems that it handles the size correctly, and positive positioning, but it seems to ignore

Re: basic question: quick split like awk

2006-05-11 Thread Tim Chase
Is there a way to split a line automatically like awk would? Given A quick brown fox jumped over , awk '{print $3}' ... == brown Well, Vim supports passing a range of lines through awk, so assuming you have awk available, you can just do :%!awk '{print $3}' Fairly

Re: splitting windows

2006-05-11 Thread Tim Chase
How can I open four files (eg: file1.txt, file2.txt, file3.txt and file4.txt) for a view as following: VIM ¦file1 ¦file2 ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦

Re: vim vb syntax file

2006-05-15 Thread Tim Chase
Thomas Barthel wrote: I downloaded vim 7 last week and realized that there is a new syntax file for vb. Long time ago (2002 or 2003) I created an update myself. It is incomplete too, so I kept it on my computer. Maybe the two files can be merged. Thomas, I've merged your changes into the

Re: HTML editing with vim: where to start ?

2006-05-19 Thread Tim Chase
In the years I've been on this list, I don't count the number of times when newbies have come asking, in essence, Why doesn't Vim behave as advertised? and mswin.vim (which they unknowingly were sourcing in their vimrc) was the reason. Or the converse, where someone will ask Why does vim behave

Re: How to insert increasing numbers in each line of a file

2006-05-20 Thread Tim Chase
I don't really know how to do this but im sure that there's a solution. I have some file and i need to insert a number before each line and a separator. The number is the line number. Is there any way in vim to do this easily? Well, the canonical way to do this on *nix boxes is just

Re: Line Numbers

2006-05-24 Thread Tim Chase
In my old VIM version (5.4) I could put the line set nu in my .exrc file and have line numbers on the file I was editing. Since I upgraded to VIM 7.0, I've discovered no option for the .vimrc file to do the same thing. Have I missed something? Putting the set nu in your vimrc *should* do

Re: Typing 'oun' in INSERT mode moves me to the next line.

2006-05-25 Thread Tim Chase
2) you've got some funky keyboard mapping at the console/GUI level. This would evidence itself in other editors, so if you pull up Nano or Emacs and rapidly type oun in the same fashion as you do in Vim, you'd get other funky characters. How to remedy this lies outside vim...you'd have to check

Re: VIM script replacement question

2006-05-25 Thread Tim Chase
I get this: #3 00 00 #4 11 10 #5 11 00 How I can put spaces between numbers in same rows? Looks like you omitted spaces between the \2 and \3 and between the \4 and \5 in Alan's solution (or my 2nd one that broke out each piece individually) The final replacement should read /#\1\r\2

Re: Jumping to Headline in h1Headline/h1

2006-05-26 Thread Tim Chase
:help motion.txt and then you will be on your way to joining the ranks of vim experts. Some of us are just rank ;) But yes, Vim's multitude of ways for jumping around a document quickly are one of the hallmarks of why folks who learn it well seldom leave for another editor. -tim

Re: Jumping to Headline in h1Headline/h1

2006-05-26 Thread Tim Chase
Then again, some might argue that Vim is about thinking before making a calculated move.. Vim...the chess of editors :) Vim is an artistic blend of the two. Basic stuff becomes second nature so that it just comes flying out of the fingers. The more complex stuff takes a moment of thought

Re: gvimrc vs vimrc

2006-05-29 Thread Tim Chase
I have never used a gvimrc. Does that get parsed by gVim only? Yes. You can learn more about it at :help gvimrc :help initialization Note that, in the help on initialization, step #8 is Perform GUI initializations. This links to the help on gvimrc. -tim

Re: Deleting lines from L1 to L2 in Vim script

2006-05-30 Thread Tim Chase
I would like to to delete line from L1 to L2, I try to script that but obviously commands are different for a script. What is the right thing to do ? Well, if L1 and L2 represent fixed line numbers, such as line 24 through line 38, you can just put 24,38d in your script. Quick,

Re: Deleting lines from L1 to L2 in Vim script

2006-05-30 Thread Tim Chase
And how about deleting from line L1 for instance to the end of the file. And put it in a script file, since G don't appear like a regexp and $ represent end of line if I'm not wrong ? $ represents the end-of-line in *normal* mode. As an Ex command, it means the last line in the file. Thus,

Re: Inserting text in front of multiple marked lines

2006-05-31 Thread Tim Chase
Perhaps this is a simple question but i'm a bit confused. If i mark several lines with shift+v and then use shift+i to insert in front of the line, the text entered is just placed in front of the first marked line. How can i easily add text to all marked lines? It sounds like you're trying

Re: Antw: Re: Loop through all lines in a file

2006-06-01 Thread Tim Chase
In the meantime I found a solution myself: let s:lnr=line(.) let s:image=getline(s:lnr) while (strlen(s:image) != 0) let s:lnr=s:lnr+1 let s:image=getline(s:lnr) endwhile I'm not that familiar with the global commands yet,

Re: how to fold lines not containing a pattern ?

2006-06-05 Thread Tim Chase
I would like to fold all lines not containing a keyword like 'warning'. Basically, I want to be able to open a file, apply this filter and immediately see all warnings related in my file. :set foldmethod=expr :set foldexpr=getline(v:lnum)=~'warning'?'1':1 You can learn more by reading at

Re: syntax match question

2006-06-06 Thread Tim Chase
I would like to match all options that start with a hyphen like: -one -two So all those would be a match from the - to the end of the word. Looks like a simple /\-\w\+\/ It makes some presumptions where your description falls silent. What constitutes a word for you? The vim

Re: Restore cursor to last line not working in Vim 7

2006-06-07 Thread Tim Chase
In version 6.3 (and as far as I can remember in Vim versions) it would return my cursor to the line I was at when I saved a file the next time I opened that file. It now returns me to the beginning of the file in Vim 7. I looked at :help restore-position, but that doesn't do it by default. The

Re: negative match pattern, again

2006-06-12 Thread Tim Chase
I need to match lines using g// (not v//); those lines having 'foo' and NOT having /)\s*;/ anywhere in the line. How do I write such regex. Well, there are several ways to go about it. One would be to use Dr. Chip's logipat script: http://vim.sourceforge.net/scripts/script.php?script_id=1290

Re: Positioning on a given char offset

2006-06-12 Thread Tim Chase
I have this problem: a program of mine is giving me error positions based on the file offset and not the line containing the error. Eg. it does not warn me about an error on line 12, but at the char 2032 Is there any command in Vim to position to that char offset? If the data is on one line,

Re: Working with windows line endings

2006-06-14 Thread Tim Chase
Since I need to share text files I work on with people who use notepad, how can I set vim to use windows line endings? Vim is pretty smart about automatically identifying line endings. If you get files from your coworkers, they should be in CR/LF format, and Vim should recognize these. If

Re: Working with windows line endings

2006-06-14 Thread Tim Chase
I have set fileformats=unix,dos at the bottom of my _vimrc, but still see the ^M's. My guess is that the file in question has one line that lacks a ^M in the line, and thus, it vim concludes that it must use unix-style line-endings. The likely culprit is the last line in the file. You can

Re: problem when open a file with vim

2006-06-14 Thread Tim Chase
I don't know since when this happens. Now every time I open a file with vim, I get this error. E576: viminfo: Missing '' in line: 5\awr_hang_state\masterdb1_ora_4834.trc E576: viminfo: Missing '' in line: ^I^I71990^I10 This file does not exist on my pc any more, but I open any file it

Re: problem when open a file with vim

2006-06-14 Thread Tim Chase
Sorry I'm still pretty new to vim. Do you mean file C:\Program Files\Vim\vim70\syntax\viminfo.vim? [cut] Maybe I should mention I use vim on windows. Where is viminfo file on windows? That's the syntax-coloring definition for viminfo files, so when you're editing viminfo files, they show up

Re: Quick Word Yank/Replace

2006-06-19 Thread Tim Chase
What would be the quickest way of yanking one word and replacing another word with it? Something that doesn't involve specifying registers, because that would require too many keystrokes and I might as well use cw and type the word myself then. You don't mention whether you only want to do this

Re: Stop highlighting

2006-06-20 Thread Tim Chase
By mistake I made a search for a character in a file in vim. How do I stop the highlighting of that character everywhere in the file? There are several ways to do it, depending on what you want. If you just want to not highlight this search, you can use :noh If you want to disable

Re: Tim Chase: :g/^/+,/^[EMAIL PROTECTED]/-1! par 72q (formatting email).

2006-06-20 Thread Tim Chase
So my question is, what is it about the command: :g/^/+,/^[EMAIL PROTECTED]/-1! par 72q Which causes this to happen? I've tried changing it but the result is always the same. This is a result of par [rightly, as it's a non-trivial task] not knowing how to deal with shell-code. As to why

Re: Pasting a vertical selection.

2006-06-20 Thread Tim Chase
I have to correct some datafiles, and I need to paste a column in the middle of my text file to replace the older column which contain bad values. How can I do that ? [cut] Hope I have been clear enough, Yes, that is fairly clear. Vim supports block-wise pasting. However, last I checked

Re: Register size

2006-06-21 Thread Tim Chase
I don't know of a limit within normal uses (i.e. 100K or so). How long is the text you are trying to yank? I can't say I've hit any abnormal limits either, and I've yanked/pasted some pretty long texts from log-file dumps. If you need to read in a huge quantity of data, you can save that

Re: Extra spaces after reformatting.

2006-06-22 Thread Tim Chase
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? The short

Re: Script to create automatic case statements

2006-06-22 Thread Tim Chase
What I would really like is to just do the ^N on the initial _some_root, see that the popup menu shows the correct four values, and press some key combo to insert them all on consecutive lines like above. I'm not even fussy if it inserts the case and the :, I can very easily do them myself with

Re: Adding keywords if a line starts with a certain word

2006-06-26 Thread Tim Chase
I would like to add additional keywords if the first word or first 4 characters of the statement is snit. snit::type dog { method {tail wag} {} {return Wag, wag} method {tail droop} {} {return Droop, droop} } Since snit is there then I would like to added method as a keyword. Your

Re: How to replace CR with LF

2006-06-26 Thread Tim Chase
I'm curious though - is there any way to substitute CR with LF using regexp's? You could try the somewhat odd-looking :%s/\r/\r/g which has worked in some cases for me... -tim

Re: Anchoring in a regex

2006-06-29 Thread Tim Chase
syn match tclV ttk\(\(::\)\?\([[:alnum:]_.]*::\)*\)\a[a-zA-Z0-9_.]* I only want this to work ttk at the start. I know that ^ means the start but I am not sure how to add that (I did try just adding it) to make the regex start with ttk. Just put it at the beginning: ^ttk... just as

Re: Disable Windows shortcuts in GVIM

2006-06-29 Thread Tim Chase
How is it possible, using GVIM, to forbid Windows executing commands destinated to VIM? e.g CTRL-V (Virtual select) is interpreted as Paste by MS. CTRL-A as select all, ... How can I disable this, and retrieve unix-like behaviour in my gvim ? Likely your vimrc is directly or indirectly

Re: a question about 'diff' setting

2006-06-29 Thread Tim Chase
The documentation says the 'diff' setting is local to window, so closing the windows show cancel the setting out, but when I try the below sequence on two related files say, x.old and x.new, it seems otherwise. Vim seems to keep the 'diff' information around in the same way it keeps marks in a

Re: s?

2006-06-30 Thread Tim Chase
Not really a request for help, but I was wondering if you guys ever use the 's' command. It's just a shortcut for 'cl', which I almost never need. Since I don't assume it was put in to be complete or something, I'm intrigued by it's enigmatic purpose. :) I'll admit that it took me a while

Re: Motion for Cammel Notation

2006-07-03 Thread Tim Chase
I would particularly want to use it with the 'c' command. [cut] I'm using c quite often. I wouldn't remap it ;) I think the OP wants an (in vim nomenclature) operator pending mode mapping, so that it can be used *with* the c command, rather than *instead* of the c command.

Re: gvim on windows xp

2006-07-06 Thread Tim Chase
I intend to use gvim mainly as a text editor. Unlike Emacs, with which you can read email, wash the dishes, and get psychological counsel... ;) (1) Is there a way to have a soft border or offset on the left, so that the text is not flush against the left window border? I've searched for

Re: substitute word

2006-07-08 Thread Tim Chase
how can I substitute a single word via regular expression? :s/\(\s\+\)word\(\s\+\)/\1new_word\2/g Alternatively, rather than saving your whitespace and then restoring it, you can use :s/\word1\/new_word/g This respects the word boundaries in vim, as defined by the 'iskeyword'

Re: substitute word

2006-07-09 Thread Tim Chase
:s/\word1\/new_word/g But you need to know the word you want to substitute, if I set it to cword and cword appears more than once in the line, multiple words will get replaced. Well, there are several scenarios, each of which vim can handle with aplomb. If you know the word, but

Re: Remapping - how to get the count

2006-07-11 Thread Tim Chase
I want to remap Ctrl-A (normal mode) to do something similar with other data, e.g. :nmap c-a ciwc-r=IncRoman(@-)cresc Now if a count is provided this will mess up the text, e.g. 10c-a does 10ciw... What is a good way to catch the count and make it available to the function call? Well,

Re: Remapping - how to get the count

2006-07-12 Thread Tim Chase
Why not just use C-U in the mapping (after the : ) to clear the command line, then use v:count or v:count1 instead of the second argument? Because they're not in my active vimming vocabulary... :) Yes, using v:count/v:count1 is a much cleaner more understandable way to do it. -tim

Re: How do I stop a mapping from looking like a mapping?

2006-07-12 Thread Tim Chase
I want to make a mapping like this: :inoremap foreach foreach() {CR}ESCk$3hi The end result being that when I type: foreach I should get foreach() { } Sounds more like you're reaching for an abbreviation rather than a mapping. :iab foreach foreach() {^M}^[O where ^M is

Re: Function To Search Directory And Display File List

2006-07-13 Thread Tim Chase
1. Searches a directory for all files that end in the string Template 2. Return those file names to the user as chooseable list, similar to the way that the spell checker functionality works when you use the z= command. Well, as an ugly first-pass hack: :let s = expand(*template) :echo

Re: Function To Search Directory And Display File List

2006-07-14 Thread Tim Chase
Well, as an ugly first-pass hack: :let s = expand(*template) :echo substitute(\n.s.\n, '^\%([^[:cntrl:]]*[[:cntrl:]]\)\{'.(confirm('Which file?', s)).'}\([^[:cntrl:]]*\).*', '\1', 'g') Thanks a *ton* Tim! This looks very succinct (if not a bit frightening). I'll definitely try this one out

Re: :e behaviour

2006-07-17 Thread Tim Chase
:cabbrev e E Now :e will change itself to :E when not followed by a letter, but :edit will get you the old behaviour of the :e command. However, beware the funky behaviors that can ensue from this: Trying to type something like :echo the letter e is nice will expand to

Re: delete buffers matching pattern

2006-07-17 Thread Tim Chase
Is there a way to delete all buffers matching a certain pattern? For example, suppose I just read in all files in a directory and this is my buffer list: 1 a.txt 2 b.txt 3 1.exe 4 2.exe 5 c.txt 6 3.exe 7 d.txt I want to do something like :bdelete *.exe. The following seems to do the trick

Re: delete buffers matching pattern

2006-07-19 Thread Tim Chase
:bufdo if bufname(%)=~?'.exe$' | bdel | endif I think you want to escape the dot: :bufdo if bufname(%) =~? '\.exe$' | bdel | endif Oh, so correct. My error. It's one of those subtle things that works just fine until it bites you in the bum when one has file

Re: a question related to substitution using regular expression

2006-07-25 Thread Tim Chase
My file is like the following: data_1.dat pre= -1908.77 post= -48977.33 diff= -448.947 data_2.dat pre= -444.333 post= -333.545 diff= -777.333 . . I hope to find out a regular expression subtitution commad to delete everything after dat to get a file like: data_1.dat data_2.dat . . I

Re: Matching non-capitalized words?

2006-07-25 Thread Tim Chase
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 Additionally, this will not find camel-case words, such as

Re: Inserting hex characters

2006-07-25 Thread Tim Chase
I'm editing binary files with Vim using set display=uhex and I was wondering if there's a way to insert characters given their scancode. Something like what I used to do in DOS by holding Alt then typing the number of the character to enter? Sounds like you're looking for what's described at

Re: Matching non-capitalized words?

2006-07-26 Thread Tim Chase
:%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. And when you

Re: Inserting hex characters

2006-07-26 Thread Tim Chase
Careful, Tim: UTF-8 is unsuited to binary editing, because you can't enter a byte 127 by itself in UTF-8. True enough. I tend not to use UTF-8, so I defer to your far greater experience/knowledge on the matter. For doing binary editing in vim (a rare occurance, when I'm not just using a

Re: Visual select / paste behaviour

2006-07-28 Thread Tim Chase
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'? Well, the answer to your question is that there's a setting

Re: Put the cursor in the middle of screen when replacing

2006-08-01 Thread Tim Chase
How to put cursor in the middle of screen when replacing words? I have to see the next few lines to know replace or not, but the word always sit in the bottom of the screen. Sounds like you're looking for the 'scrolloff' setting. :help 'scrolloff' will provide details on this. It

Re: Formatting a paragraph in insert mode

2006-08-02 Thread Tim Chase
Is it possible to format a paragraph (i.e. justify it) of text or comments while in insert mode? The way I do it now is to visually highlight the paragraph and then press g and then q. What I'd like is to be able to press Ctrl-q (or something) to format the paragraph (and the cursor left

Re: Formatting a paragraph in insert mode

2006-08-02 Thread Tim Chase
I believe you can just do a gwap to leave the cursor in the same position. Thanks! Every day I learn something new. A pretty amazing day when Tony Tim both learn the same something new about Vim that's easy, useful, and has been supported (mostly, save for a few bugfixes in later

Re: Sorting a file

2006-08-02 Thread Tim Chase
How do I sort this file so that - removes the lines starting with ### :g/^###/d - removes the lines starting with --- :g/^---/d - removes the lines starting with spaces :g/^\s\+/d - all line 18 , i.e., comes under each other? And line 19 , and so on. :%!sort (or, newer versions of

Re: Bits of text left over after switching splits

2006-08-02 Thread Tim Chase
I normally run with lots of splits. Recently I started using italics for various syntax highlighting (especially comments and enum tag values). Since then I have noticed the ocassional pixel remaining when I switch from one split to another. Any ideas what I can do to fix this? I'm on Windows

Re: Select prev visual block + 5 hor pos more

2006-08-03 Thread Tim Chase
With gv you can re-select the previous visual block. Is it possible to give a horizontal shift with it? Like + or - 5? Natively? Not as far as I know. However, if you haven't already discovered the o command in block-wise-visual-mode, it does bounce you to the opposite corner of the block.

Re: Search and Replace with a Regular Expression

2006-08-03 Thread Tim Chase
I can't seem ot get the hang of it for this particular job. Well, even as a regexp wonk, it's a bit of a daunting task you have before you. :) Most of the problem is with dates, in that I have a mishmash of formats. Since you don't mention any other problematic sections, I guess I'll

Re: Search and Replace with a Regular Expression

2006-08-03 Thread Tim Chase
right('0'.submatch(1), 2) to zero-pad to 2 places. Alas, the substitute() trick is the easiest way I've found to simulate this. [...] (0 . submatch(1))[-2:] Hmmm...a nifty new feature in vim7 that is here on my work machine, but unavailable on my hosting service (still running

Re: Search and Replace with a Regular Expression

2006-08-03 Thread Tim Chase
(0 . submatch(1))[-2:] Hmmm...a nifty new feature in vim7 that is here on my work machine, but unavailable on my hosting service (still running 6.3). Looks like a much-needed pilfering from Python's handy slicing syntax. :) well, then, strpart(0 . submatch(1), strlen(submatch(1)) -

Re: can vim do this?

2006-08-03 Thread Tim Chase
* autocomplete - say that I've declared a constant variable in Perl named MY_CONSTANT, later, to have the editor fill it in, I type in MY_, and some other key-stroke, and CONSTANT gets typed in for you Well, I usually just use ^N and ^P in insert mode to cycle through available completion

Re: how can one get the visual selection in a function?

2006-08-04 Thread Tim Chase
function! template(text) Do something with the text and return the result What I would like to do now is to be able to press a key let say F5 in visual mode and the text that I have selected should be passed into the text variable of the template function. Is this possible? I

Re: can vim do this?

2006-08-04 Thread Tim Chase
I forgot to ask one last thing - if I'm searching for something in a text file, can I have vim select every existing string that matches up to what I've typed at that point? Meaning, if the first two characters of what I'm looking for are va, all va gets highlighted as I type, then when I

Re: can vim do this?

2006-08-04 Thread Tim Chase
:help incsearch :help hls Using 'incsearch' doesn't highlight them all as you type, just the current match. However, with 'hls' set, once you hit enter, it will highlight all the items it found...not quite the behavior you described, but close. Thanks Tim - is that to say that this

Re: quick regex question

2006-08-04 Thread Tim Chase
here is the regex: %s/)\s*\n\s*{\n/) {\n/ig It runs through but my code is getting formatted like this now if(asdf) { ^@ nextline_of_code _newline_ Vim uses various represenations at different points for nulls and for newlines. Just change the \n in your replacement portion to \r, making

Re: inserting a character space whilst remaining in normal mode

2006-08-07 Thread Tim Chase
something I find myself doing quite often is the above, i.e. I have: extract(p,f,m,n) and I want extract(p, f, m, n) Well, if you just want to normalize all commas on the current line to have a single space after them, you could do something like :s/,\s*/, /g which can be mapped,

Re: Saveing of a recorded macro

2006-08-08 Thread Tim Chase
is it possible and if true yes. :) then how() Well, by default, vim supports saving the contents of registers via the viminfo file/settings :help 'viminfo' Since macros are recorded to registers, this would save any macros you have, up to a given size (either in

Re: Display the current character

2006-08-08 Thread Tim Chase
Is there a way to dispaly the current cursor position? e.g,, character 23. use ga which will display the hex/decimal/octal values of the character under the cursor. I remember it as _g_et _a_scii [value] :help ga There's also g8 for a UTF-8 character under the cursor.

Re: delete lines

2006-08-10 Thread Tim Chase
And then I decide that I want to remove $blah2, so I start to press backspace from here: fucntion foo() { $blah; $blah2; - cursor here } and then when I get to the beginning of the line, it stops. Can I make it so that it will follow up to the end of $blah on the previous line?

Re: delete lines

2006-08-10 Thread Tim Chase
is it also possible to enable the backspace key in normal mode -- the delete key is working in normal, so why should I miss the backspace key ? :nnoremap BS X (all typed literally with greater-than and less-than signs included) should do the trick. -tim

Re: delete lines

2006-08-10 Thread Tim Chase
:nnoremap BS X with this I cannot cross lines (delete $ between line n+1 and line n coming from line n+1 while backspacing and it is not possible to delete the last (or in other words the first char after ^ ) char of a line. Something perhaps like :nnoremap bs ibsrightesc might do

Re: half of hlsearch

2006-08-11 Thread Tim Chase
How can I find help for ye/ye ? :help ye or :help yE gives me help for the year-2000 compliance which is not directly what I wanted ... That's kinda funny that it drops you in y2k information. The trick to searching for them (and for that matter, grokking vi/vim) is to understand that

Re: search a/b/c/d/e in a file

2006-08-11 Thread Tim Chase
To search the string say /a/b/c/d/e/f/g/h/i in a file, is there a way to do it without going to each / and escaping it to \/ :let @/ = escape('string with /slashes/, \backslashes\, .periods., *asterisks* etc.', '/\.*') n Building on Tony's good suggestion...it's a good one, and

Re: search a/b/c/d/e in a file

2006-08-12 Thread Tim Chase
In the second variant you don't use a search command (like / ? or :s) but an arithmetic evaluation command. Then n does search, but _it_ doesn't change the latest search pattern. Don't know if the fact that :let @/ doesn't alter search history must be regarded as a bug, a feature, or a legacy

Re: Updated version of Piet Delport's DiffOrig

2006-08-12 Thread Tim Chase
I've been using a form of this, enhancing it over time. Here is my current version: This command was posted by Piet Delport a few years ago. com DiffOrig vert new | se bt=nofile | r # | 0d_ | difft | winc p | difft [cut] com! DT sil on! | let oft = ft | vert bel new [remainder of mappings

Re: non-greedy pattern matching

2006-08-16 Thread Tim Chase
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 You're s close. :) The \{-} is a *replacement* for the asterisk operator, not a

Re: an indentation question

2006-08-18 Thread Tim Chase
But, Anthony -- you get paid the top salary available for Vim mailing list personnel! :) Of course, it's probably a bit difficult to buy a cup of coffee with it... And you're both still making twice my vim mailing-list salary! :) -a mock-disgruntled tim

Re: :sort vimoutliner file on header

2006-08-19 Thread Tim Chase
[X] 100% Soccer team [X] 100% Sims, Tim [X] 100% physical [X] 100% uniform deposit #31 [ ] 50% Smith, Sam [ ] 0% physical [X] 100% uniform deposit [ ] 0% Comer, Hannah [ ] 0% physical

Re: :sort vimoutliner file on header

2006-08-19 Thread Tim Chase
1. within each block, add the sort keys in front of each line (surname, personal name, line number), plus maybe a delimiter to make step 3 (below) easier. 2. sort 3. remove the sort keys added in step 1 Do I understand your suggestion is to tweak the file to look like

Re: Doing something til specific column

2006-08-19 Thread Tim Chase
Chapter 1: Green Floyd and want to get Chapter 1: Green Floyd... so s/he needs to insert 70 - Chapter 1: Green Floyd.length() // ruby notation characters. Or in other words s/he needs to insert characters til column 70.

Re: Doing something til specific column

2006-08-20 Thread Tim Chase
:%s/^\(Chapter\ [0-9]\+:\ .*\)\%30c$/\1\./g I works fine, but needs to be repeated until no more matches are found. I'm sure you guys more experencied with Vim scripting will be able to complete my idea. Well, if you're looking to make the change on every line that matches that pattern, you

Re: Doing something til specific column

2006-08-20 Thread Tim Chase
The Chapter*-thingy was only meant as an example. The task I want to do is: repeat overwriting (or may be inserting) charcters with a previously given character starting from the current cursor position until a perviously given number of the end-column is reached. This sounds an awful lot like

Re: regex replace with match

2006-08-22 Thread Tim Chase
I was going to use a simple regex replacement like::%s/\(.\{8}\)\ (.\{2}\)\(.\{3}\)/\1,\2,\3,/g This does work when only replacing a small number of fields. I get 2 errors when I source a file with the command for all 35 fields. The errors are: E51: Too many \( E476: Invalid

  1   2   3   4   5   >