Re: Where g:, b:, t: and w: variables are described?

2011-02-23 Thread Tim Chase
On 02/23/2011 04:14 PM, ZyX wrote: I recently found that there exists `g:' (without any text after `:') variable which is a dictionary that holds all other global variables, same for `b:', `t:' and `w:' variables. Can anybody point me in which help topic they are described? You can read about

Re: text substitution for all the files opened in vim

2011-02-24 Thread Tim Chase
On 02/23/2011 11:20 PM, Ben Schmidt wrote: On 24/02/11 3:50 PM, Peng Yu wrote: :%s only perform substitution with a file. Is there a command that can perform substitution in all the files that are opened by a vim session? Check out :help :argdo :help :bufdo ...remembering that vim will

Re: text substitution for all the files opened in vim

2011-02-24 Thread Tim Chase
On 02/24/2011 09:07 AM, David Kahn wrote: On Thu, Feb 24, 2011 at 6:33 AM, Christian Brabandtcbli...@256bit.orgwrote: On Thu, February 24, 2011 1:03 pm, Tim Chase wrote: On 02/23/2011 11:20 PM, Ben Schmidt wrote: :help :argdo :help :bufdo ...remembering that vim will complain if you try

Re: Changing CLI Vim's font (was uselessly Abridged summary of vim_use@googlegroups.com - 30 Messages in 12 Topics)

2011-02-26 Thread Tim Chase
On 02/26/2011 03:53 AM, Tong Zhang wrote: How can I change my vim's fonts(CLI)? CLI Vim depends on the font(s) of the containing console, so it depends on the font you're using in cmd.exe/xterm/rxvt/Terminal/etc. For GUI Vim, you can set 'guifont': :set guifont=? [snipping verbose,

Re: Editing contents of a register?

2011-02-28 Thread Tim Chase
On 02/28/2011 07:49 PM, Rostyslaw Lewyckyj wrote: Suppose that I have a collection of editing commands such as %g/pattern_a/ %g/pattern_b/ %g/pattern_c/ that find and list all the lines of a file that satisfy some patterns. After I visually inspect a given list of lines,

Re: search and replace with word list

2011-03-02 Thread Tim Chase
On 03/02/2011 02:30 PM, Raleigh Rinehart wrote: Now what I would like to do is to replace each occurrence of MODULEX in file1 with the corresponding word in file 2. By corresponding I mean if the lines (from file 1) and the words (from file 2) were both well ordered sets then the match is

Re: search and replace with word list

2011-03-02 Thread Tim Chase
On 03/02/2011 04:21 PM, raleighr3 wrote: I understand what you want, file1.txt looks something like ... Folder![CDATA[C:\work\sources\foo\bar\baz\MODULEX\lib]]/Folder ... Folder![CDATA[C:\work\sources\foo\bar\baz\MODULEX\lib]]/Folder ... and you have file2.txt which looks something like ...

Re: search and replace with word list

2011-03-04 Thread Tim Chase
On 03/04/2011 05:55 AM, jcordes wrote: I would like to have a better understanding of the line :%s@.*@:-/MODULEX/s// I saw only *two* occurrences of the @ character -- where is the third @? I think I am confused by the fact that this is not a straightforward 'substitute' command -- at

Re: How to access to the string inside a string variable in a :e command

2011-03-06 Thread Tim Chase
On 03/06/2011 01:29 PM, Jean Johner wrote: let foobar = test2.f Using echo foobar results in test2.f (OK) Now I want to open test2.f :e foobar opens a file foobar :e 'foobar' opens the file 'foobar' What is the syntax to open test2.f using the foobar variable. You have to build the string and

Re: Undo gd

2011-03-08 Thread Tim Chase
On 03/07/2011 10:11 PM, Colin Beighley wrote: Oftentimes when I use gd to go to the definition of a variable, function, etc I would like to return to the place in the code I was at before doing that. Is there a hot sequence for this? Essentially what I want is an undo gd. In addition to

Re: Normal mode commands when Caps Lock is on

2011-03-11 Thread Tim Chase
On 03/11/2011 04:26 AM, H Xu wrote: Is it possible to reverse uppercase letter and lowercase letter when Caps Lock is on? Sometimes normal mode commands are uncomfortable to use when Caps Lock is on. When Caps Lock is on, For example, Shift + I would lead to the effect of 'i', which makes me

Re: The right way to do global operatot in visually selected block?

2011-03-13 Thread Tim Chase
On 03/13/2011 06:05 AM, Yosi Izaq wrote: ','g/X/d Is this the correct way or am I working too hard? This is what I do, and I can't think of any more concise way to write this -- when you're in visual mode and press the :, vim automatically feeds the visual range so all you have to type (in

Re: try not converting error to exception bug? (was hit-return when pattern not found)

2011-03-16 Thread Tim Chase
On 03/16/2011 06:02 AM, Hofmann, Joachim wrote: gvim +?0 Datei(en) BefehlsausgabenVoll.log When the pattern is not found: BefehlsausgabenVoll.log 148L, 8098C Error detected while processing command line: E486: Pattern not found: 0 Datei(en) Press ENTER or type command to continue How can I

Re: try not converting error to exception bug? (was hit-return when pattern not found)

2011-03-18 Thread Tim Chase
On 03/18/2011 11:27 AM, Bram Moolenaar wrote: Tim Chase wrote: :try | /does_not_exist/ | catch /.*/ | endtry Error detected while processing : E486: Pattern not found: does_not_exist You need to put the catch on a separate line, because when skipping commands it will skip the line(s

Re: Fold by timestamp?

2011-03-20 Thread Tim Chase
On 03/20/2011 12:19 PM, sanjay ravat wrote: I am relatively new to vim. I need to inspect log files that run into thousands of lines. Each line starts with a timestamp. How can I fold the logs based on timestamp? It would help to have (1) an excerpt of the log-file (possibly redacted, leaving

Re: Fold by timestamp?

2011-03-21 Thread Tim Chase
On 03/21/2011 01:43 PM, sanjay ravat wrote: [2011-03-21T18:45:46.004-07:00] [Other info]... log message [2011-03-21T18:45:46.008-07:00] [Other info]... log message [2011-03-21T18:45:46.607-07:00] [Other info]... log message Thanks for the example data and better description. After

Re: Extracting part of previous line in substitute command

2011-03-22 Thread Tim Chase
On 03/22/2011 03:33 PM, Dennis Benzinger wrote: Hi! I have a log file with timestamps and messages: 01:00 x 02:00 y 03:00 z To compare the time elapsed between two events I want to prefix each line with the timestamp of the previous time. I tried to use %s/^/\=matchstr(getline(line(.)-1),

Re: Fold by timestamp?

2011-03-23 Thread Tim Chase
On 03/21/2011 11:58 PM, c b wrote: Hi Tom, s/Tom/Tim/ :) On Mon, Mar 21, 2011 at 5:31 PM, Tim Chasev...@tim.thechases.com wrote: On 03/21/2011 01:43 PM, sanjay ravat wrote: [2011-03-21T18:45:46.004-07:00] [Other info]... log message [2011-03-21T18:45:46.008-07:00] [Other info]... log

Re: Fold by timestamp?

2011-03-23 Thread Tim Chase
On 03/23/2011 10:05 AM, Benjamin R. Haskell wrote: On Wed, 23 Mar 2011, Tim Chase wrote: set foldexpr=(getline(v:lnum)[:19]==getline(v:lnum+1)[:19])?6:((getline(v:lnum)[:16]==getline(v:lnum+1)[:16])?'6':((getline(v:lnum)[:13]==getline(v:lnum+1)[:13])?'5':((getline(v:lnum)[:10]==getline(v:lnum+1

Re: Can a macro be executed while in insert mode?

2011-03-24 Thread Tim Chase
On 03/23/2011 11:24 PM, E wrote: Can a macro be executed while in insert mode? The short answer is yes, in insert-mode you can use control+O to execute one normal-mode command (such as a macro) without leaving insert-mode (capital-oh, not zero if your font doesn't distinguish that clearly)

Re: Keeping hlsearch on after function call

2011-03-25 Thread Tim Chase
On 03/25/2011 01:31 PM, meino.cra...@gmx.de wrote: I a function I a search (:/) at the last step. : But regardless how intense I define 'set hlsearch' -- when the function returns, the matches marked via hlsearch are gone. I'm not sure whether you do or don't want the highlighting, and if so,

Re: Missing selection register (*)?

2011-03-25 Thread Tim Chase
On 03/25/2011 02:41 PM, Suresh Govindachar wrote: On Windows, after yanking a line, :echo @* shows the yanked line. But on Unix, there doesn't seem to be anything in the * register -- it is as though there is no * register at all! Version of vim used on Fedora 14 was:

Re: Keeping hlsearch on after function call

2011-03-25 Thread Tim Chase
On 03/25/2011 02:20 PM, meino.cra...@gmx.de wrote: After the funtino has returned control back to the user the matched keywords should be highlighted as if the user her-/himself did the search... My second function worked for me to do what you describe: If you want to have the pattern from

Re: Keeping hlsearch on after function call

2011-03-25 Thread Tim Chase
On 03/25/2011 03:17 PM, meino.cra...@gmx.de wrote: I used :/pattern instead of /pattern/ In a function, they should be the same. E.g: function! Tim() /pattern/ endfunction and function! Meino() :/pattern/ endfunction! should be exactly the same. and I also add the

Re: Another search 'n' highlight question

2011-03-25 Thread Tim Chase
On 03/25/2011 09:37 PM, meino.cra...@gmx.de wrote: possible to do two totally different searches in the function and get highlighted the matches of *both* searches when the function returns control to the user. Due to teh complexity of the regular expressions of that matches it will be nearly

Re: Call user created command, select all lines and copy them to global buffer

2011-03-26 Thread Tim Chase
On 03/26/2011 04:56 AM, Sapfeer wrote: So, I'm trying to define such command, here is it: command! -range=% QuoteLinesAndCopy :line1,line2/^\s*$/d;s/^/ / g;line1,line2y + ...but when I issue it I get the following error: E488: Trailing characters: :1,30/^\s*$/d;s/^/ /g;1,30y + I'm afraid

Re: Filtering text through external commands

2011-03-27 Thread Tim Chase
On 03/27/2011 02:24 PM, Matt Martini wrote: How do I set up a mapping to make the currently selected text (visual mode) get processed by an external command? I have a bunch of scripts that do text processing (mostly perl and bash) that I want to process the current buffer in vim. To process

Re: Make vim use the right external program

2011-03-28 Thread Tim Chase
On 03/28/2011 08:11 AM, BPJ wrote: How can I make :!perl ... use the perl symlinked at ~/bin/perl rather than /usr/bin/perl without actually having to type :!~/bin/perl every time? What's your $PATH set to? You can find out what your system thinks it's set to with set PATH at the

Re: Way to clear line without removing the line?

2011-03-28 Thread Tim Chase
On 03/28/2011 01:33 PM, David Kahn wrote: If I want to remove all contents of a line, I press 'd' twice. But in most cases I want the line to still be there (meaning the space, so after deleting I would have a blank line), so I tend to find myself when deleting afterward replacing the line (like

Re: problem with Key mapping of Ctrl - End.

2011-03-30 Thread Tim Chase
On 03/30/2011 07:45 PM, shuda Li wrote: I try to map the Ctrl - End to move the cursor to the end of file: mapC-End :$RC However the line has no effect at all. I checked :mapC-End and it returnsC-End mapped to :$RC Depends on what your terminal is sending. I presume this is (non-g)vim

Re: about submatch in VIM

2011-03-31 Thread Tim Chase
On 03/31/2011 12:10 PM, Coiby wrote: I want to increase the number in this format /ddd by one but also keep /. But the following command doesn't work: $s/\/\([1-9]\+\)/\/\=submatch(1)-1)/g Can anyone give a tip? In addition to what ZyX's comments (particularly about the \= needing to be at

Re: Finding the correct map

2011-03-31 Thread Tim Chase
On 03/31/2011 05:01 PM, carlosvillu wrote: I came from Textmate and i try to created a map that i was so useful for me. When i edit a file in insert mode, i want can press shiftLeft /shiftRigth for select caracter by caracter and shiftcmdLeftshiftcmdRight to select word by word. Really I tried,

Re: about submatch in VIM

2011-04-01 Thread Tim Chase
On 04/01/2011 07:01 AM, Coiby wrote: I will appreciate it if you recommend some books on such topic. There are several books[1] and websites[2] regarding regular expressions. Popular books: - Mastering Regular Expressions (published by O'Reilly) - Regular Expression Cookbook (published by

Re: vim counterpart for persistent includes

2011-04-01 Thread Tim Chase
On 04/01/2011 10:48 AM, Tim Gray wrote: I'm a new user of vim and am currently evaluating it for my uses. I'm coming from BBEdit. One of the features of BBEdit that I've found useful is the 'persistent include.'* It's mostly used for HTML. The idea behind it is that you can specify a file in

Re: Some Vim peculiarities

2011-04-02 Thread Tim Chase
On 04/02/2011 04:01 PM, Jostein Berntsen wrote: I have some questions regarding some peculiar behavior in my Vim 7.3. Some of these might have been there from previous versions, while some seems to have been introduced in the new version. Some might also come from some plugins I have installed,

Re: Backwards searches and the ? operator

2011-04-03 Thread Tim Chase
On 04/03/2011 12:46 PM, Spiros Bousbouras wrote: I've just had some very frustrating minutes trying to figure out why searching with a pattern which I felt should work wasn't actually working. After trying this and that I decided eventually to look up \? in the help file and saw that it's not

Re: Substitute via expression on matched text

2011-04-04 Thread Tim Chase
On 04/04/2011 01:58 PM, Taylor Hedberg wrote: In other words, these lines match the regex: /^PP \d\+,\d\+/ I wanted to decrement the second number in each pair by 120 To simplify Venu's solution: :%s/^PP \d\+,\zs\d\+/\=submatch(0)-120/g -tim -- You received this

Re: Path easy-search

2011-04-06 Thread Tim Chase
On 04/06/2011 11:00 AM, Christian Brabandt wrote: Simply assign your search string directly to the search-register, e.g. if you have your search string in the Clipboard, use: :let @/=@+ and press n to jump to the next occurence. Of course you can also assign it manually: :let

Re: Path easy-search

2011-04-06 Thread Tim Chase
On 04/06/2011 11:34 AM, Christian Brabandt wrote: *g*, when searching backwards, I always get confused, whether to use n/N for my desired direction. Is 'n' keeping the direction or searching forward? And if 'N' reverses the direction and ? also reverses the direction this reverses twice? That is

Re: question on search

2011-04-06 Thread Tim Chase
On 04/06/2011 01:51 PM, googler wrote: How do I search for the words containing the string CKINV, but which do not start with G8S_ ? For example, I would be interested in the string xyz_CKINVX8 but not G8S_CKINVX3. /\\%(G8S_\)\@!\w*CKINV -tim -- You received this message from the vim_use

Re: why the Up key doesn't work to go through the searching history

2011-04-07 Thread Tim Chase
On 04/07/2011 10:04 AM, wxuyec wrote: while it works for gvim and the command mode. after I press /, when I want to use Up key to go through the searching history, I get a character A inserted. In addition to Tony's good advice, it would also be worthwhile to check that (1) you've got a build

Re: Any non-programmer users of Vim here?

2011-04-07 Thread Tim Chase
On 04/07/2011 08:05 PM, Tim Gray wrote: I feel like to get the most out of it you need to a) put the time in to learn it and b) put the time in *configuring* to make it work for you. While I certainly agree with (a), I'm at the other end of the spectrum on (b). One of the things I like most

Re: soft wrapping at a specified column

2011-04-08 Thread Tim Chase
On 04/08/2011 09:30 AM, Tim Gray wrote: Is there really no way for Vim to soft wrap at a specified column? I know I can turn on hard wrapping or resize the window. Unfortunately, when you resize the window to something that makes really long lines more readable (like 80-90 columns), as soon as

Re: Any non-programmer users of Vim here?

2011-04-08 Thread Tim Chase
On 04/08/2011 10:22 AM, Ben Fritz wrote: 1. Text objects. Things like cap (change a paragraph) and dis (delete a sentence) would be amazing for writing prose. As a matter of fact, almost *all* my usage of the is and as text objects are used when editing prose. They don't serve much purpose

Re: Any non-programmer users of Vim here?

2011-04-08 Thread Tim Chase
On 04/08/2011 09:51 AM, Eric Weir wrote: On Apr 7, 2011, at 10:20 PM, Tim Chase wrote: http://oreilly.com/pub/a/oreilly/ask_tim/1999/unix_editor.html Thanks, Tim. The note on this link recommends O'Reilly's book on Vi and when you go to the O'Reilly pages linked in it their are rave comments

Re: why the Up key doesn't work to go through the searching history

2011-04-08 Thread Tim Chase
On 04/08/2011 04:57 PM, wxuyec wrote: I checked what you suggested. 1) The return for :echo has('cmdline_hist') is 1. 2) the answers to :set cp? history? are nocompatible history=50 it seems that the problem doesn't come from these issues. and the Ctrl-p and Ctrl-n work. Okay, that's good and

Re: Any non-programmer users of Vim here?

2011-04-08 Thread Tim Chase
On 04/08/2011 08:43 PM, Eric Weir wrote: Well, I found time to work through the vim tutor exercise. Pretty basic. Not sure I remember what I learned -- I liked that it said don't try to memorize, to learn by doing Nothing like practice to burn it in :) As mentioned in a previous email, I

Re: Inserting output of Ex command into buffer

2011-04-09 Thread Tim Chase
On 04/09/2011 12:11 PM, Spiros Bousbouras wrote: How can you insert the output of an Ex command into the buffer at the place where the cursor is ? Say for example in the 1st line here I want to insert right after you the output of :chdir .So I place the cursor after you and then do what ? A

Re: vim addressing and command (syntax?)

2011-04-10 Thread Tim Chase
On 04/10/2011 05:27 PM, Rostyslaw Lewyckyj wrote: I am getting confused trying to understand vim line number addressing rules, and predicting accurately how commands will be parsed. Why is .+1 different from . + 1 and .-1 different from . - 1 For illustration compare (in some test file):

Re: Inserting output of Ex command into buffer

2011-04-10 Thread Tim Chase
On 04/10/2011 05:39 PM, Spiros Bousbouras wrote: On Apr 9, 6:29 pm, Tim Chasev...@tim.thechases.com wrote: On 04/09/2011 12:11 PM, Spiros Bousbouras wrote: How can you insert the output of an Ex command into the buffer at the place where the cursor is? 1) use :redir to a register and paste

Re: Macros on rest of file (was Any non-programmer users of Vim here?)

2011-04-11 Thread Tim Chase
On 04/11/2011 01:11 AM, eNG1Ne wrote: Quibbles? can't find a run to end of file for macros Would :,$norm @a work for you? (obviously assuming that your macro was recorded into register a) Alternatively, if your macro processes more than one line at a time, you could tweak it to

Re: Pattern matching problem

2011-04-11 Thread Tim Chase
On 04/11/2011 03:05 AM, Benjamin R. Haskell wrote: On Mon, 11 Apr 2011, howard Schwartz wrote: More seriously, I trying to do a substitute and replace on lines like this: DEBIT,03/25/2011,ATT First Payment PPD ID: 4031004,-42.34 I want to replace it with a line like

Re: Inserting output of Ex command into buffer

2011-04-13 Thread Tim Chase
On 04/13/2011 08:52 AM, Jürgen Krämer wrote: How can you insert the output of an Ex command into the buffer at the place where the cursor is? 1) use :redir to a register and paste the register contents: Strange that there isn't a simpler method built-in. I totally agree with you. Would

Re: pdf ref search

2011-04-13 Thread Tim Chase
On 04/13/2011 01:41 PM, Scottb wrote: Hi all, I'm working with a lot of PDF lately and I'm looking for a way to map a key combination that will allow me to follow object references. Basically that would mean look at the object ref number that is under the cursor right now and find a pattern like

Re: pdf ref search

2011-04-13 Thread Tim Chase
On 04/13/2011 04:27 PM, Scottb wrote: The reference 19 0 R points to a PDF object declaration somewhere in the file like 19 0 obj. So, right now (thanks to your help) I can put my cursor over the 19 in the /Outlines reference value, hit F4 and navigate directly to the 19 0 obj. Now... it would

Re: pdf ref search

2011-04-13 Thread Tim Chase
On 04/13/2011 05:17 PM, Benjamin R. Haskell wrote: On Wed, 13 Apr 2011, Scottb wrote: I suppose that would mean [...] \d+\s\d+\sR [...] BTW... just noticing that characters classes (like \d for digits) don't seem to work in regular Vim / searches, is that really the case? It's that you need

Re: Remove duplicate lines based on match with 1 column

2011-04-13 Thread Tim Chase
On 04/13/2011 06:53 PM, jcordes wrote: On Apr 13, 8:46 pm, meino.cra...@gmx.de wrote: jcordesjohncor...@gmail.com [11-04-14 01:32]: 2011Spring.pdf 10/Apr/2011 at 7:50:40 PM 76.11.9.6 2011Spring.pdf 10/Apr/2011 at 8:10:14 PM 24.222.177.150 2011Spring.pdf 11/Apr/2011 at 7:21:10 PM

Re: Inserting output of Ex command into buffer

2011-04-13 Thread Tim Chase
On 04/13/2011 07:15 PM, Spiros Bousbouras wrote: Consider the analogous situation with shell programming: Ok , with more thought I see that it is a problem. Consider Vsystem(command1 | redir @a | echom 'abc' | redir END | command2) The return value of Vsystem() should include the output of

Re: searching and cursor postion

2011-04-13 Thread Tim Chase
On 04/13/2011 04:03 PM, Richard Livornese wrote: I'm trying to figure out how the correct command to search for a string and have the cursor positioned at the end(or beginning) of that string. From the documentation, it seems to me this should work: /string/e But when I try that I get the

Re: Starting to write with Vim

2011-04-14 Thread Tim Chase
On 04/14/2011 07:55 AM, Eric Weir wrote: I did :set linebreak in a file. I see that it isn't retained when I save, close, and then reopen a file. How do I make this default? As others have mentioned, put set linebreak in your ~/.vimrc which, can be done from the command-prompt with echo

Re: Matching and

2011-04-14 Thread Tim Chase
On 04/14/2011 03:06 PM, lazloman wrote: I'd like for vim to highlight the match when I type an. I'm aware of :set showmatch and matchtime, but these don't highlight the angle brackets. Will I have to use %? I prefer showmatch since it doesn't require any additional input from me, so if there is

Re: pdf ref search

2011-04-15 Thread Tim Chase
On 04/15/2011 04:35 AM, Erik Christiansen wrote: Tim, have you tried using /\v to start all regexes in Vim? I know about it, but don't think to use it often because by the time I think grr, I should have used \v, I've got a sufficiently-complex regex that I'd have to go back and modify it

Re: Starting to write with Vim

2011-04-15 Thread Tim Chase
On 04/15/2011 09:50 AM, Eric Weir wrote: but f/F/t/T are eluding me at the moment. I can't tell what they do. They allow you to jump to (f/F) or one-character-shy-of (t/T) the Nth (default N=1) match of the subsequent letter. So in this paragraph, if I'm at the beginning (on the T in They),

Re: incrementing number in each line

2011-04-19 Thread Tim Chase
On 04/18/2011 10:35 PM, googler wrote: :%s/${eco_prefix}_net_\(\d\d\d\) -new_cell_name ${eco_prefix}_\zs\d\d\d/\1 This is what I actually used after posting the question. But I was wondering if there is a better way. In this case, I had already changed the first numbers manually, so I could

Re: Lost Blowfish Key

2011-04-20 Thread Tim Chase
On 04/20/2011 01:50 AM, Mathew Brown wrote: Thanks a lot. I'll give it a try and hopefully can retrieve the file again :) $ for key in $(cat keys); do vim blowfish.txt --cmd set key=$key\ -c :set key= | saveas $key | q; done Just as a caveat, this will expose your passwords in the

Re: scripting question

2011-04-20 Thread Tim Chase
On 04/20/2011 02:08 PM, niva wrote: Hi, I am writing a script and have to detect some features of the opened file. my vimscript contains a recursive conditional blocks if cond1 else if cond2 if condN etc... else endif endif I would like to replace that by an object

Re: Vimscript Question

2011-04-20 Thread Tim Chase
On 04/20/2011 06:15 PM, Marc Weber wrote: let conditions = [['a=7','echo 7'],['a=8','echo 8']] for [c,action] in conditions exec 'let c_result = '.action if c_result exec action I think, to mimic the OP's structure, you need a break in here endif unlet c, c_result, action

Re: editing vim help files

2011-04-20 Thread Tim Chase
On 04/20/2011 04:12 PM, Adam Monsen wrote: Anyone handy with editing help files? I'm wondering how to align a title and tag, ala SPONSOR VIM DEVELOPMENT *sponsor* where the title is left-aligned and the tag right-aligned, on the same line. While I

Re: Replacing a visual selection

2011-04-21 Thread Tim Chase
On 04/21/2011 07:37 AM, Jean-Rene David wrote: Currently my workflow replacing a visual selection is like this: 1. Go to Visual mode 2. Select text 3. y'ank 4. :%s/c-r*/foo/g How about: 1. go to visual mode 2. select text 3. press c This only does the match under the cursor

Re: edit alternate file -- e!# vs b!#

2011-04-23 Thread Tim Chase
On 04/23/2011 11:54 AM, Bee wrote: To edit the alternate file, is there any difference between these: nnoremap ,g :e!#cr nnoremap ,g :b!#cr While there may be other differences, you can edit unnamed buffers with :b!# while :e!# requires that the file exist. Additionally, if the file

Re: arithmetic expressions in search

2011-04-27 Thread Tim Chase
On 04/27/2011 01:59 PM, ZyX wrote: Normally you do the following: create a regular expression that is able to find all numbers and then write additional code which will filter the results of the first search so that only numbers divisible by 7 are left. I must say that there are times I've

:windo g/pattern/q peculiarity

2011-04-28 Thread Tim Chase
Not sure if this is an old-version-of-vim thing, or if it's just a peculiar interaction. Scenario: I had a bunch of vim-windows open on various files and wanted to close those that contained a given pattern (in the example below, using @ as my pattern to close windows with email addresses in

Re: why does :copy move the cursor?

2011-04-28 Thread Tim Chase
On 04/28/2011 12:52 PM, Jean-Rene David wrote: Lately I've been using the Ex commands :d, :t, :m to shuffle text around while editing. [snip] I wonder why my cursors is *moved* to line 150 after the command. I was wondering if others had thoughts on this behavior. Is there a use of them where

Re: why does :copy move the cursor?

2011-04-28 Thread Tim Chase
On 04/28/2011 01:16 PM, Ben Schmidt wrote: Fortunately, my previous location is just a control+O away for when I want to be at the source location instead of the destination location. This doesn't work for me. Hmm...I was fairly certain that I used this. It must have just been

Re: :windo g/pattern/q peculiarity

2011-04-28 Thread Tim Chase
On 04/28/2011 01:15 PM, Jean-Rene David wrote: * Tim Chase [2011.04.28 14:00]: [...] :windo g/pattern/q which did as I expected, but had the odd side effect of printing misleading messages about additional/fewer lines: 193 more lines E486: Pattern not found: @ 86 fewer lines 16

Re: regex for special chars

2011-04-29 Thread Tim Chase
On 04/29/2011 04:18 AM, sinbad wrote: searching for ^[[K^[[?1l^[ using / works. but when i use the same string in :%s, it says the pattern is not found. how to make it recongnize as / does. or is there any way to automatically convert the string to equivalent regexp that :%s understands. While

Re: :windo g/pattern/q peculiarity

2011-04-29 Thread Tim Chase
On 04/28/2011 09:49 PM, Jean-Rene David wrote: * Tim Chase [2011.04.28 14:40]: Because each of your files have the same number of lines, it doesn't register a change. For a full example: bash$ cd ~/tmp; mkdir moreless; cd moreless bash$ for i in 10 20 30 40 50; do seq $i ${i}.txt ; done

Re: vim to resize split windows when size of xterm's window changes

2011-04-29 Thread Tim Chase
On 04/29/2011 09:26 AM, Taylor Hedberg wrote: There's a VimResized event that you can use with autocommands. I'd try something like this (untested): autocmd VimResized * normal!C-W= There's a :wincmd command, so you should be able to just do autocmd VimResized * wincmd = -tim -- You

Re: is there s 'toinitialupper' function?

2011-04-29 Thread Tim Chase
On 04/29/2011 11:55 AM, Andrew Long wrote: I'm writing a script where I want to capitalise the first letter of a word. I know hat 'toupper' will change lower-to-upper case on the whole string, like \U in a :s command, but is there an equivalent of \u (convert the initial character only?) I

Re: How to get undo functionality after :bnext

2011-04-29 Thread Tim Chase
On 04/29/2011 03:47 PM, Reckoner wrote: When editing multiple buffers, I do :bnext to get to the next buffer. Unfortunately, when I return to that buffer or one of the previously edited buffers, I can no longer undo the changes in the corresponding buffer. Is there a way to set it up so that

Re: capture result of a global search

2011-04-29 Thread Tim Chase
On 04/29/2011 03:59 PM, cyboman wrote: does anybody know if there is a way to capture the result of a global search in vim. for example in perl i can do the following string =~ /(pattern1)someword/i and $1 will contain patter1. is something like this possible in vim scripting? You don't

Re: Language switching shortcuts

2011-04-29 Thread Tim Chase
On 04/29/2011 12:48 PM, Kevin Steinhardt wrote: F11 would do `set spelllang=en_gb` then `set spell` F12 would do `set spelllang=nl` then `set spell` also For normal-mode, it's a pretty straight-forward :nnoremap f11 :set spellang=eng_gb spellcr :nnoremap f12 :set spelllang=nl

Re: is there s 'toinitialupper' function?

2011-04-30 Thread Tim Chase
On 04/30/2011 10:39 AM, Bee wrote: On Apr 29, 4:47 pm, John Beckettjohnb.beck...@gmail.com wrote: Tim Chase wrote: let s=substitute(s, '\w\+', '\u\1', 'g') The above is intended to change each word in s, making the first letter uppercase and not changing the rest. The search pattern

Re: How to get undo functionality after :bnext

2011-04-30 Thread Tim Chase
On 04/30/2011 05:33 PM, reckoner wrote: On 4/29/2011 1:51 PM, Tim Chase wrote: On 04/29/2011 03:47 PM, Reckoner wrote: When editing multiple buffers, I do :bnext to get to the next buffer. Unfortunately, when I return to that buffer or one of the previously edited buffers, I can no longer undo

Re: Vim stuck in noremap mode?

2011-05-03 Thread Tim Chase
On 05/03/2011 07:40 PM, Ben Schmidt wrote: - Has anybody else experienced anything like this? I can't say I've encountered anything of the like. - Any ideas what might cause it? Your list of plugins, vimrc, and perhaps germane modelines might be worth including. It might also be helpful

Re: Why Does gVim Reverse Characters In Each Line?

2011-05-03 Thread Tim Chase
On 05/03/2011 09:02 AM, octopusgrabbus wrote: I am using gVim and editing a file using e ftp://user@host//full-path-to-file. Each line in the file has its characters reversed. Yet, if I copy those lines and try to paste them here, they are in normal reading order. What setting do I need to

Re: Issue with gvim

2011-05-05 Thread Tim Chase
On 05/05/2011 12:09 PM, Jean-Rene David wrote: You seem to use 'shell' and 'terminal' interchangeably. They are not the same thing. 'tcsh' and 'bash' are shells, not terminals. It doesn't matter *how* you start gvim. You will always get a limited functionality terminal from it. You can hack

Re: Vim's regex dialect [Was: Help me please ^^]

2011-05-06 Thread Tim Chase
On 05/06/2011 05:27 AM, Erik Christiansen wrote: I've been slow to realise that Vim users don't necessarily use a variety of posix compliant applications, and so haven't experienced the great productivity benefit of being able to move between them _without_ trial and error, or resort to

Re: search lines without a pattern

2011-05-10 Thread Tim Chase
On 05/10/2011 11:51 AM, cyboman wrote: does anybody know how to do search of lines that don't contain a pattern: /pattern searches for a occurrence of a pattern, but i need a way to search for lines that don't have a pattern. You can use /^\%(\%(pattern\)\@!.\)*$ or if you're performing

Re: how to remove numbers from txt files but leave them on for coding

2011-05-11 Thread Tim Chase
On 05/11/2011 04:57 AM, woodygar wrote: Hi just stated to use vim as a python ide - how to remove numbers from .txt but leave them on for .py .pyw files I'm not sure what you mean by this, but you can start vim with prompt vim *.txt and then execute :set hidden :argdo :%s/\d\+//g

Re: Abbreviations, but only within a certain file type

2011-05-12 Thread Tim Chase
On 05/12/2011 08:05 AM, Kevin Steinhardt wrote: Forgive my ignorance once more, but is there a way to tell vim that I'd only like it to expand an abbreviation keyword if the file type is .htm, .html or .mkd? I'd like to have some abbreviations for left and right single 'book quotes' and I though

Re: Meaning of % before a command

2011-05-13 Thread Tim Chase
On 05/13/2011 11:16 AM, Taylor Hedberg wrote: `%` is a special address range that means do this for all lines in the buffer. So `:%retab` means retab the entire buffer. For `:retab` in particular, though, the default is to act on the entire buffer, so the `%` is redundant. Many commands only

Re: 'commandline' vs ':e' for jump to line (FEAT. REQ)

2011-05-18 Thread Tim Chase
On 05/18/2011 03:32 AM, Ben Schmidt wrote: Here's a simple solution for .vimrc that might work: command! -nargs=1 -bang Edit call FileAndLine(e,bang,f-args) command! -nargs=1 -bang Split call FileAndLine(sp,bang,f-args) function! FileAndLine(cmd,bang,arg) let

Re: question about string expression evaluation / bug?

2011-05-22 Thread Tim Chase
On 05/22/2011 05:48 PM, hsitz wrote: In this Vim installation the expression 'xxx' '' evaluates to 0 (false) while in all other Vims I've seen the expression evaluates (as it should) to 1 (true). I confirm that it should eval to 1. Is there some Vim setting (encoding?) that might have

Re: Residual Character Display on Windows

2011-05-24 Thread Tim Chase
On May 23, 10:25 pm, Yongwei Wuwuyong...@gmail.com wrote: Probably related to my recent upgrade to Windows 7 64-bit, I have found that very often there are residual characters left in the GVim window, where a space or another character should be displayed. It occurs apparently when I scroll very

Re: Trouble with VIM and some hidden vimrc file

2011-05-26 Thread Tim Chase
On 05/26/2011 10:32 AM, Denzel Li wrote: I have been using vim for years and I love it. My problem is: it seems that my vim is using an old _vimrc file hidden somewhere rather than the one in the vim directory. The first thing to check would be the output of :scriptnames to see what Vim

Re: delete inside parentheses VIM?

2011-05-29 Thread Tim Chase
On 05/28/2011 11:01 PM, Tony Mechelynck wrote: On 29/05/11 05:11, Antonio Recio wrote: dab it is useful to remove parentheses and content when cursor is over, I think. But I want to delete all the parentheses and the inside the parentheses with an unique commmand. IIUC, when used with a count

Re: Searching for accented characters.

2011-05-29 Thread Tim Chase
On 05/29/2011 06:43 PM, Beren Sanders wrote: Is there an easy standard way to make accented characters match searches for their normal counterparts? For example, I obtain é by typing CTRL-k ' e and I would like to set it up so that searching for Ajoute will match both Ajoute and Ajouté. It

Re: Searching for accented characters. [PS]

2011-05-29 Thread Tim Chase
On 05/29/2011 06:43 PM, Beren Sanders wrote: For example, I obtain é by typing CTRL-k ' e and I would like to set it up so that searching for Ajoute will match both Ajoute and Ajouté. My previous example finds *all* (Latin1) accented variants such as e, é, è, ë, ė, ê, etc. If you JUST want

Re: Vim scripts: insert new line staying with normal mode

2011-05-31 Thread Tim Chase
On 05/31/2011 08:33 AM, Steven Lee wrote: I attempt to write a function implementing insert new line which filled consecutive '=' : How can I correct above scripts? While it diverges from your original script, I'd go for something more readable like: :nnoremap f4 :put=repeat('-',len)cr

  1   2   3   4   5   6   7   8   9   10   >