Re: r! not working in any case ?
Meino Christian Cramer wrote: Hi, from :h r! I read that r! cmd can be used to transfer text given by a cmd via stdout into a buffer. I am using zsh 4.3.2 and have defined an alias of this form alias hcnf='./configure --help' . I wanted to insert the expanded alias into a zsh-script, which I wanted to edit with vim. Therefore I did in vim (with the buffer containing the zsh-script): :r! alias hcnf and got shell returned 1 Press ENTER to type command to continue . But alias hcnf and alias hcnf | less given on the commandline to proof, that stdout is used (instead of stderr) works fine. I cannot find the error I did Thank you very much in advance for any help ! :) Have a nice weekend! mcc The :r! command gives the same result than 'zsh -c command' (if you haven't changed shellcmdflag). It doesn't use an interactive shell so if you have define your alias in .zshrc it won't be recognized. In that case, ry putting it in .zshenv instead. koxinga
Re: r! not working in any case ?
From: koxinga [EMAIL PROTECTED] Subject: Re: r! not working in any case ? Date: Sun, 29 Oct 2006 10:20:16 +0100 Meino Christian Cramer wrote: Hi, from :h r! I read that r! cmd can be used to transfer text given by a cmd via stdout into a buffer. I am using zsh 4.3.2 and have defined an alias of this form alias hcnf='./configure --help' . I wanted to insert the expanded alias into a zsh-script, which I wanted to edit with vim. Therefore I did in vim (with the buffer containing the zsh-script): :r! alias hcnf and got shell returned 1 Press ENTER to type command to continue . But alias hcnf and alias hcnf | less given on the commandline to proof, that stdout is used (instead of stderr) works fine. I cannot find the error I did Thank you very much in advance for any help ! :) Have a nice weekend! mcc The :r! command gives the same result than 'zsh -c command' (if you haven't changed shellcmdflag). It doesn't use an interactive shell so if you have define your alias in .zshrc it won't be recognized. In that case, ry putting it in .zshenv instead. koxinga Hi koxinga, flat-hand-against-my-front-head-effect! :) Yes, I should have known this...but... Thanks for your help! Keep hacking! mcc
mapping with delay processing
How can I make mapping or abbrev that behaves as follows: when I type echo (echospace) and I type nothing else within 1 second, it adds '' (so it becomes 'echo '). If I continue typing quickly after 'echo ', then [] is not added. I'm sure it's possible. Yakov
Re: mapping with delay processing
- Original Message From: Yakov Lerner [EMAIL PROTECTED] To: vim users list vim@vim.org Sent: Sunday, October 29, 2006 12:38:36 PM Subject: mapping with delay processing How can I make mapping or abbrev that behaves as follows: when I type echo (echospace) and I type nothing else within 1 second, it adds '' (so it becomes 'echo '). If I continue typing quickly after 'echo ', then [] is not added. I'm sure it's possible. Yakov see :h sleep hth John -- Sane sicut lux seipsam, tenebras manifestat, sic veritas norma sui, falsi est. -- Spinoza
Need Help with Change Last, First to First Last
Hi. I want to reorder variable2 and variable3 from the following line structure for 44 lines in a datafile, the data field separator is a (( character variable1 data((variable2 data((variable3 data((variable4 data ((variable5 data((variable6 data((variable7 data((variable8 data ((variable9 data(( .. (( (end of line. some lines have upwards to 20 or more variables) to variable1 data((variable3 data((variable2 data(( etc when I use the following syntax (which I extrapolated from sec 12.2 of VIM manual, version 6.3): 6,50s;\(variable2.*\)((;\(variable3.*\);\2\1; variable3 data is correctly moved into the position formerly held by variable2 data. However, variable2 data is appended to the end of the entire line and NOT moved to the position that was formerly taken by variable3 data Any ideas as to what's wrong? Thanks Mike
Re: Need Help with Change Last, First to First Last
Hi, On 10/29/06, Mike Blonder [EMAIL PROTECTED] wrote: Hi. I want to reorder variable2 and variable3 from the following line structure for 44 lines in a datafile, the data field separator is a (( character variable1 data((variable2 data((variable3 data((variable4 data ((variable5 data((variable6 data((variable7 data((variable8 data ((variable9 data(( .. (( (end of line. some lines have upwards to 20 or more variables) to variable1 data((variable3 data((variable2 data(( etc when I use the following syntax (which I extrapolated from sec 12.2 of VIM manual, version 6.3): 6,50s;\(variable2.*\)((;\(variable3.*\);\2\1; Try using the following command: :6,50s;\(variable2.\{-}\)((\(variable3.\{-}\)((;\2((\1(( - Yegappan variable3 data is correctly moved into the position formerly held by variable2 data. However, variable2 data is appended to the end of the entire line and NOT moved to the position that was formerly taken by variable3 data Any ideas as to what's wrong? Thanks Mike
Re: Need Help with Change Last, First to First Last
Thanks, it works perfectly. Can you explain: why you changed .* to . and the function of {-} Thanks Mike On Oct 29, 2006, at 10:27 AM, Yegappan Lakshmanan wrote: Hi, On 10/29/06, Mike Blonder [EMAIL PROTECTED] wrote: Hi. I want to reorder variable2 and variable3 from the following line structure for 44 lines in a datafile, the data field separator is a (( character variable1 data((variable2 data((variable3 data((variable4 data ((variable5 data((variable6 data((variable7 data((variable8 data ((variable9 data(( .. (( (end of line. some lines have upwards to 20 or more variables) to variable1 data((variable3 data((variable2 data(( etc when I use the following syntax (which I extrapolated from sec 12.2 of VIM manual, version 6.3): 6,50s;\(variable2.*\)((;\(variable3.*\);\2\1; Try using the following command: :6,50s;\(variable2.\{-}\)((\(variable3.\{-}\)((;\2((\1(( - Yegappan variable3 data is correctly moved into the position formerly held by variable2 data. However, variable2 data is appended to the end of the entire line and NOT moved to the position that was formerly taken by variable3 data Any ideas as to what's wrong? Thanks Mike
Re: Need Help with Change Last, First to First Last
Hello, On 10/29/06, Mike Blonder [EMAIL PROTECTED] wrote: Hi. I want to reorder variable2 and variable3 from the following line structure for 44 lines in a datafile, the data field separator is a (( character variable1 data((variable2 data((variable3 data((variable4 data ((variable5 data((variable6 data((variable7 data((variable8 data ((variable9 data(( .. (( (end of line. some lines have upwards to 20 or more variables) to variable1 data((variable3 data((variable2 data(( etc when I use the following syntax (which I extrapolated from sec 12.2 of VIM manual, version 6.3): 6,50s;\(variable2.*\)((;\(variable3.*\);\2\1; Try using the following command: :6,50s;\(variable2.\{-}\)((\(variable3.\{-}\)((;\2((\1(( Thanks, it works perfectly. Can you explain: why you changed .* to . and the function of {-} '*' is greedy and matches as many characters as possible. \{-} is non-greedy and matches as few characters as possible. For example, take the following single-line of text: The quick brown fox jumped over the fence. The quick brown fox jumped over the fence. If you use the following substitute command on the above text: :s/The.*fox/The dog/g The line will be changed to the following: The dog jumped over the fence. OTOH, if you use the following command: :s/The.\{-}fox/The dog/g The line will be changed to: The dog jumped over the fence. The dog jumped over the fence. - Yegappan variable3 data is correctly moved into the position formerly held by variable2 data. However, variable2 data is appended to the end of the entire line and NOT moved to the position that was formerly taken by variable3 data Any ideas as to what's wrong?
Re: mapping with delay processing
On Sun, Oct 29, 2006 at 01:38:36PM +0200, Yakov Lerner wrote: How can I make mapping or abbrev that behaves as follows: when I type echo (echospace) and I type nothing else within 1 second, it adds '' (so it becomes 'echo '). If I continue typing quickly after 'echo ', then [] is not added. I'm sure it's possible. Yakov Untested: use an abbreviation that defines two autocommands: :augroup Hack :au CursorHoldI * execute normal a\\Esc :au CursorHoldI,InsertLeave,CursorMovedI * au! Hack :agroup END What I did test is that CursorMovedI is triggered when you insert a character. Thus both autocommands are cleared after 'updatetime' or the first typed character (or cursor movement or leaving Insert mode). I am not sure whether the :normal command will work. Of course, you can also have the abbreviation change updatetime and have the autocommands restore it. HTH --Benji Fisher
getchar(1) consumes a key ?
inoremap exprF2 PeekCharTimeout(1000)?you pressed key! :timeout! I hit a case when getchar(1) seemingly consumes a pressed key. 1. vim -u NONE -c 'so x.vim' # file x.vim is below 2. If you press iF2 and wait, you get 'timeout!', so this part works OK. 3. The other branch, has problem: press iF2 then quickly 123. You get: you pressed key! 23 Note that '1' gets lost. We expect result 'you pressed key! 123' Since I call only getchar(1) here I don't understand why one pressed char gets lost. Thanks Yakov - x.vim set nocp inoremap exprF2 PeekCharTimeout(1000)?you pressed key! :timeout! function! PeekCharTimeout(milli) non-consuming key-wait with timeout let k=a:milli while k 0 getchar(1) == 0 sleep 100m let k = k - 100 endwh return getchar(1) endfun
Re: Select just-pasted text
Perfect! This is so easy to map to my own key combination too. Thanks to all who replied. --- Bram Moolenaar [EMAIL PROTECTED] wrote: Jimmy Mack wrote: I really like the gv command, which starts visual mode and automatically selects the previous selection, regardless of where the cursor happens to be. I would like to see a similar command that starts visual mode and selects the block of text I have just pasted in. After extensive browsing through the help system and online, I can't find a way to do this. My vim scripting skills are weak, can anyone tell me if this is possible to script a command for? I'm not sure if vim retains information about the boundaries of the most recently pasted text. You can use: `[v`] If the cursor is still at the start of the pasted text then v`] works. -- Computers in the future may weigh no more than 1.5 tons. Popular Mechanics, 1949 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\download, build and distribute -- http://www.A-A-P.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org/// __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: tags with abc::efg?
Beware, add the colon to 'iskeyword' works but it may mess up one thing: the switch-case statement and the label: switch (foo) { case bar: } here the bar will be recognized as bar:, and of course the bar: does not exist. It will be inconvinient to search bar using the * or the C-], pretty annoying. Unless we could add :: to 'iskeyword' instead of the single colon, it seems to be difficult to cope with this. Any hints? -- Sincerely, Pan, Shi Zhu. ext: 2606 Henry [EMAIL PROTECTED] 写于 2006-10-28 08:59:38: AJ, Thank you very much. This is what I was looking for. Sincerely, Henry --- A.J.Mechelynck [EMAIL PROTECTED] wrote: Henry wrote: Hi, I have a bunch TCL procs defined with :: in the name. ie: abc::efg. I created a tags file, inside the tag file, it has abc::efg When I try to jump to this proc abc::efg in vim, using CTRL-], it can't find it. If cursor is under abc, then I get an message E426: tag not found: abc If the cursor is under efg, then I get a message E426: tag not found: efg. So it seems that vim can't trace the tag properly. It should use the entire string abc::efg to search for the tag. Anybody has a solution?? Thanks. I think it has something to do with your 'iskeyword' option. Try using :setlocal isk+=: (adding the colon to the 'iskeyword' option) on the files which have that kind of tags. Or, if it is for any TCL files, you might want to add the above command (without the initial colon) in a file named (on Unix-like systems) ~/.vim/after/ftplugin/tcl.vim or (on other systems) ~/vimfiles/after/ftplugin/tcl.vim (in both cases in vim notation). Create the file and any directories in its path if they don't exist yet. You might for instance paste the following lines as a *.vim script and source it (this is untested): if has(unix) !mkdir -p ~/.vim/after/ftplugin let s:vimdir = .vim else silent! !mkdir $HOME/vimfiles silent! !mkdir $HOME/vimfiles/after silent! !mkdir $HOME/vimfiles/after/ftplugin let s:vimdir = vimfiles endif exe 'new ~/' . s:vimdir . '/after/ftplugin/tcl.vim' $put ='setlocal isk+=:' wq See :help 'iskeyword' :help after-directory etc. Best regards, Tony. Low, Low, Low Rates! Check out Yahoo! Messenger's cheap PC-to-Phone call rates (http://voice.yahoo.com)
Setting window size at startup under linux
Hi all, I'm using Suse Linux, with KDE, and have a vim function to set my window size on startup. The function just sets columns and lines, and calls winpos, depending upon various other variables I provide. Previously I was registering this function to be called by an autocmd on the GUIEnter event - but I found that the window seemed to be resized by the operating system afterwards. I tried changing to the VimEnter event which should come last - and that works most of the time, but not always. I tried inserting a 5 second sleep into my function triggered by VimEnter - so the operating system could mess around with the window size before I then set it to the size I want - but no, I get a 5 second delay, my window is then set to my size - and then reset by the OS. It's not dramatically reset - eg, I set it to 360 columns (spanning two monitors), and the OS reset it to 315. If I run my function again manually, it sets the 360 columns perfectly. I guess there may be some X related ways to achieve what I want - but all I really want to do is wait until after the operating system has had it's play with the window size, and then let my function go to work. Anyone got any hints please? Thanks in advance, John
Re: VIM 7.0 under Windows and Unicode fonts
On 10/29/06, Karl Guertin [EMAIL PROTECTED] wrote: On 10/28/06, Alexander C. Gaber [EMAIL PROTECTED] wrote: If you can suggest the most complete Unicode font (the used languages, I don't care about math symbols, but definitely care about *all* used languages today). I seriously switch through all languages in a week's worth and definitely three character sets a day, I'd hate having to change fonts based on what I need to edit right then. Or, if I can use Windows fonts, please let me know how. I hit that page on ubuntu linux using bitstream vera [1] and the coverage is decent. It's missing Old Irish, Gothic, Burmese, Mongolian, Tibetan and has a few characters missing from Braille, Turkish (Ottoman), Urdu, Pashto, Vietnamese (nôm). The rest have glyphs but I have no clue whether they're correct or not. [1] http://packages.ubuntulinux.org/edgy/x11/ttf-bitstream-vera Karl, I think you are mistaken. Although Bitstream Vera Sans Mono is a decent font, it does not have better effect than Courier New in this case. It contains 269 glyphs, while Courier New contains 1318 glyphs. When using Courier New, I can display ASCII, Latin1, Greek, Cyrillic, Arabic, Hebrew, Yiddish, as well as Chinese and Japanese (NSimsun seems automatically used), text at the same time. Alex, if you cannot display Chinese while choosing Courier New, you may try setting your default locale (Control Panel Regional and Language Options Advanced Language for non-Unicode programs) to Chinese (PRC). It should work. And then you will be able to edit English, French, Greek, Russian, Chinese, Japanese, and Arabic simultaneously. Best regards, Yongwei -- Wu Yongwei URL: http://wyw.dcweb.cn/
Re: VIM 7.0 under Windows and Unicode fonts
Yongwei Wu [EMAIL PROTECTED] 写于 2006-10-30 10:41:21: Alex, if you cannot display Chinese while choosing Courier New, you may try setting your default locale (Control Panel Regional and Language Options Advanced Language for non-Unicode programs) to Chinese (PRC). It should work. And then you will be able to edit English, French, Greek, Russian, Chinese, Japanese, and Arabic simultaneously. Best regards, Yongwei A little off-topic, but AFAIK this works perfect in Windows but not identical in Linux, since Windows do not connect the internal processing locale to the locale of user interfaces. The UI will never change when you change the locale. (That's a good design IMO) When you change the locale in Linux, the messages, menu texts are all changed to the targeting locale after reboot. So it is hard to have a Chinese UI and retain English locale, and it might be more difficult to have a Chinese locale while retain English UI. Alex's case is an example, if what he want is to display chinese correctly, set locale to chinese is an easy way, but he might be troubled if all the messages in the UI also changed into chinese. -- Sincerely, Pan, Shi Zhu. ext: 2606
Re: VIM 7.0 under Windows and Unicode fonts
Yongwei Wu wrote: When using Courier New, I can display ASCII, Latin1, Greek, Cyrillic, Arabic, Hebrew, Yiddish, as well as Chinese and Japanese (NSimsun seems automatically used), text at the same time. Thank you so very much! I think I found a solution to my problems by using the NSimsun font as my guifontwide: :set guifont=Courier_New:h11 :set guifontwide=NSimsun:h11 I can't quite test now if I can see all characters, but I should definitely give this a try. I also tried :set guifontwide=Bitstream_Cyberbit:h11 and :set guifontwide=TITUS_Cyberbit_Basic:h11 but, while this seems to work fine in Vim 6.4, it is no longer recognized as a valid font (???) in Vim 7.0. Now, the best thing would be a monospaced font having all the Unicode characters ;) but the day that will exist, it would be my dream come true (and probably, by then, I had moved on from this, and no longer need it...).
Re: VIM 7.0 under Windows and Unicode fonts
On 10/30/06, Alexander C. Gaber [EMAIL PROTECTED] wrote: Yongwei Wu wrote: When using Courier New, I can display ASCII, Latin1, Greek, Cyrillic, Arabic, Hebrew, Yiddish, as well as Chinese and Japanese (NSimsun seems automatically used), text at the same time. Thank you so very much! I think I found a solution to my problems by using the NSimsun font as my guifontwide: :set guifont=Courier_New:h11 :set guifontwide=NSimsun:h11 That works (though it does not look as good as the automatic font mapping). Because of the different font widths, the following lines may work better than yours: :set guifont=Courier_New:h10 :set guifontwide=NSimsun:h12 I can't quite test now if I can see all characters, but I should definitely give this a try. I also tried :set guifontwide=Bitstream_Cyberbit:h11 and :set guifontwide=TITUS_Cyberbit_Basic:h11 but, while this seems to work fine in Vim 6.4, it is no longer recognized as a valid font (???) in Vim 7.0. Cyberbit is not a monospaced font, I suppose. Now, the best thing would be a monospaced font having all the Unicode characters ;) but the day that will exist, it would be my dream come true (and probably, by then, I had moved on from this, and no longer need it...). I would prefer better a user-configurable font mapping (doable in Linux; don't know how to achieve it in Windows), like the Java font.properties. Because of the Unification of Han characters, the shape of some Chinese characters can hardly be perfect for all users of Simplified Chinese, Traditional Chinese, Japanese, and Korean (some characters in Cyberbit look really ugly in my eyes). In the world of Unicode, pure text without language tags is becoming even a little more irrelevant :-(. Best regards, Yongwei -- Wu Yongwei URL: http://wyw.dcweb.cn/
Re: Setting window size at startup under linux
On Mon, Oct 30, 2006 at 11:30:40AM +1000, John Orr wrote: Hi all, I'm using Suse Linux, with KDE, and have a vim function to set my window size on startup. The function just sets columns and lines, and calls winpos, depending upon various other variables I provide. Previously I was registering this function to be called by an autocmd on the GUIEnter event - but I found that the window seemed to be resized by the operating system afterwards. I tried changing to the VimEnter event which should come last - and that works most of the time, but not always. I tried inserting a 5 second sleep into my function triggered by VimEnter - so the operating system could mess around with the window size before I then set it to the size I want - but no, I get a 5 second delay, my window is then set to my size - and then reset by the OS. It's not dramatically reset - eg, I set it to 360 columns (spanning two monitors), and the OS reset it to 315. If I run my function again manually, it sets the 360 columns perfectly. I guess there may be some X related ways to achieve what I want - but all I really want to do is wait until after the operating system has had it's play with the window size, and then let my function go to work. Anyone got any hints please? Thanks in advance, John If you are right that the OS is messing with your window, then this may not help, but it does not hurt to try: :verbose set lines? columns? after starting up. Somewhat more involved is to set 'verbose' to something big and log all messages. If you are using vim 7.0, this is pretty easy: :help 'verbosefile' It is a little harder with earlier versions of vim. Again, this may not help at all. On the other hand, if there is a way to fix it in your vimrc file, then looking at these messages should point to it. HTH --Benji Fisher
Re: VIM 7.0 under Windows and Unicode fonts
[EMAIL PROTECTED] wrote: Yongwei Wu [EMAIL PROTECTED] 写于 2006-10-30 10:41:21: Alex, if you cannot display Chinese while choosing Courier New, you may try setting your default locale (Control Panel Regional and Language Options Advanced Language for non-Unicode programs) to Chinese (PRC). It should work. And then you will be able to edit English, French, Greek, Russian, Chinese, Japanese, and Arabic simultaneously. Best regards, Yongwei A little off-topic, but AFAIK this works perfect in Windows but not identical in Linux, since Windows do not connect the internal processing locale to the locale of user interfaces. The UI will never change when you change the locale. (That's a good design IMO) When you change the locale in Linux, the messages, menu texts are all changed to the targeting locale after reboot. So it is hard to have a Chinese UI and retain English locale, and it might be more difficult to have a Chinese locale while retain English UI. Alex's case is an example, if what he want is to display chinese correctly, set locale to chinese is an easy way, but he might be troubled if all the messages in the UI also changed into chinese. -- Sincerely, Pan, Shi Zhu. ext: 2606 To keep English UI, add at the _top_ of your vimrc (before sourcing the vimrc_example and before filetype on if you use either): if has(unix) language messages C else language messages en endif If, in addition, you want to force Chinese character locale regardless of what was set by the OS, you may want to add also if tenc == let tenc = enc endif set enc=utf-8 language ctype zh_CN.utf-8 (or something). The exact setting may or may not be OS-dependent, I didn't try it (while I tested the messages setting on both WinXP and Linux -- not in a Chinese locale but in a French one). See :help :language Best regards, Tony.
Re: Setting window size at startup under linux
Thanks for the tip Benji, a good one. :verbose set lines? columns? gives me lines=51 columns=315 Last set from ~/.vimrc It is correct that it should last have been set by .vimrc, but the only time it appears to be set in .vimrc I've got a print out after it indicating it is 360, which is what I'm trying to set it to. There's nothing else appearing to touch columns. However, your tip did alert me to the fact that whilst I'm normally running this function from the VimEnter event, for this particular application it's getting called via a -c command line switch - which does happen earlier in the init process. I'll modify things to ensure it is indeed VimEnter which triggers the function, which might, if I'm lucky, happen after the OS has finished it's window sizing functionality. Thanks again for your reply, John On Monday 30 October 2006 15:46, Benji Fisher wrote: On Mon, Oct 30, 2006 at 11:30:40AM +1000, John Orr wrote: Hi all, I'm using Suse Linux, with KDE, and have a vim function to set my window size on startup. The function just sets columns and lines, and calls winpos, depending upon various other variables I provide. Previously I was registering this function to be called by an autocmd on the GUIEnter event - but I found that the window seemed to be resized by the operating system afterwards. I tried changing to the VimEnter event which should come last - and that works most of the time, but not always. I tried inserting a 5 second sleep into my function triggered by VimEnter - so the operating system could mess around with the window size before I then set it to the size I want - but no, I get a 5 second delay, my window is then set to my size - and then reset by the OS. It's not dramatically reset - eg, I set it to 360 columns (spanning two monitors), and the OS reset it to 315. If I run my function again manually, it sets the 360 columns perfectly. I guess there may be some X related ways to achieve what I want - but all I really want to do is wait until after the operating system has had it's play with the window size, and then let my function go to work. Anyone got any hints please? Thanks in advance, John If you are right that the OS is messing with your window, then this may not help, but it does not hurt to try: :verbose set lines? columns? after starting up. Somewhat more involved is to set 'verbose' to something big and log all messages. If you are using vim 7.0, this is pretty easy: :help 'verbosefile' It is a little harder with earlier versions of vim. Again, this may not help at all. On the other hand, if there is a way to fix it in your vimrc file, then looking at these messages should point to it. HTH --Benji Fisher