mrxvtrc filetype and syntax files
Hi Bram, Attached are the filetype, syntax and ftdetect files for mrxvt config files. Sorry I couldn't make your April 20th deadline ... but maybe you can stick these in Vim-7.1 if they don't make the Vim-7.0 release. Gautam -- BTW, FWIW, IMHO, AFAIK, yes. OTOH, AAMOF, maybe not. YMMV. Created : Wed 26 Apr 2006 01:20:53 AM CDT Modified : Thu 27 Apr 2006 03:21:09 AM CDT Author: Gautam Iyer [EMAIL PROTECTED] Description : Syntax file for mrxvtrc Quit when a syntax file was already loaded if exists(b:current_syntax) finish endif Define options. let s:boolOpts = '(highlightTabOnBell|syncTabTitle|hideTabbar|autohideTabbar|bottomTabbar|hideButtons|syncTabIcon|veryBoldFont|maximized|fullscreen|reverseVideo|loginShell|jumpScroll|scrollBar|scrollbarRight|scrollbarFloating|scrollTtyOutputInhibit|scrollTtyKeypress|scrollWithBuffer|transparent|transparentForce|transparentScrollbar|transparentMenubar|transparentTabbar|tabUsePixmap|utmpInhibit|visualBell|mapAlert|meta8|mouseWheelScrollPage|multibyte_cursor|tripleclickwords|showMenu|xft|xftNomFont|xftSlowOutput|xftAntialias|xftHinting|xftAutoHint|xftGlobalAdvance|tabShell|cmdAllTabs|cmdInitTabs|protectSecondary|thai|borderLess|overrideRedirect|holdExit|broadcast|smartResize|smoothResize|pointerBlank|cursorBlink|noSysConfig|disableMacros|linuxHomeEndKey|sessionMgt)' let s:colorOpts = '(vt\d+.(foreground|background)|background|foreground|ufBackground|textShadow|i?tab(Foreground|Background)|color([0-9]|1[0-5]|BD|UL|RV)|(scroll|trough|highlight|cursor|pointer|border|tint)Color|cursorColor2)' let s:numOpts = '(vt\d+.saveLines|maxTabWidth|minVisibleTabs|saveLines|scrollbarThickness|xftmSize|xftSize|desktop|externalBorder|internalBorder|lineSpace|pointerBlankDelay|cursorBlinkInterval|initTermNumber|shading|backgroundFade|bgRefreshInterval|fading|opacity|opacityDegree|xftPSize)' let s:strOpts = '(vt\d+\.(tabTitle|command)|tabTitle|termName|title|clientName|iconName|bellCommand|holdExitText|backspaceKey|deleteKey|printPipe|cutChars|answerbackString|smClientID|geometry|confFileSave|path|boldFont|m?font[1-5]?|xftFont|xftmFont|xftPFont|inputMethod|greektoggle_key|menu|menubarPixmap|vt\d+\.Pixmap|Pixmap|scrollbarPixmap|tabbarPixmap|appIcon|multichar_encoding)' syn case match syn match mrxvtComment[EMAIL PROTECTED] '^\s*!.*$' syn match mrxvtComment'\v^\s*!\s*\w+[.*]\w+.*:.*' Generic options (string / color / number / boolean) syn match mrxvtOptErr '\v^\s*\w+[.*]?.{-}(:|$)' exec 'syn match mrxvtBoolOpts nextgroup=mrxvtBoolVal,mrxvtValErr' \ '\v^\w+[.*]'.s:boolOpts.':\s*' exec 'syn match mrxvtNumOptsnextgroup=mrxvtNumVal,mrxvtValErr' \ '\v^\w+[.*]'.s:numOpts.':\s*' exec 'syn match mrxvtColorOpts nextgroup=mrxvtColorVal' \ '\v^\w+[.*]'.s:colorOpts.':\s*' exec 'syn match mrxvtStrOptsnextgroup=mrxvtStrVal,mrxvtValErr' \ '\v^\w+[.*]'.s:strOpts.':\s*' syn match mrxvtValErr contained '\v.+$' syn match mrxvtBoolValcontained \ '\v\c(0|1|yes|no|on|off|true|false)\s*$' syn match mrxvtStrVal contained '\v.+$' syn match mrxvtColorVal contained '\v#[0-9a-fA-F]{6}\s*$' syn match mrxvtNumVal contained '\v[+-]?(0[0-7]+|\d+|0x[0-9a-fA-F]+)$' Options with special values syn match mrxvtOptionsnextgroup=mrxvtSBstyle,mrxvtValErr \ '\v^\w+[.*]scrollbarStyle:\s*' syn match mrxvtSBstylecontained '\v(plain|xterm|rxvt|next|sgi)$' syn match mrxvtOptionsnextgroup=mrxvtSBalign,mrxvtValErr \ '\v^\w+[.*]scrollbarAlign:\s*' syn match mrxvtSBaligncontained '\v(top|bottom)$' syn match mrxvtOptionsnextgroup=mrxvtTSmode,mrxvtValErr \ '\v^\w+[.*]textShadowMode:\s*' syn match mrxvtTSmode contained \ '\v(none|(top|bot)?(left|right)|(top|bottom))$' syn match mrxvtOptionsnextgroup=mrxvtGrkKbd,mrxvtValErr \ '\v^\w+[.*]greek_keyboard:\s*' syn match mrxvtGrkKbd contained '\v(iso|ibm)$' syn match mrxvtOptionsnextgroup=mrxvtXftWt,mrxvtValErr \ '\v^\w+[.*]xftWeight:\s*' syn match mrxvtXftWt contained '\v(light|medium|bold)$' syn match mrxvtOptionsnextgroup=mrxvtXftSl,mrxvtValErr \ '\v^\w+[.*]xftSlant:\s*' syn match mrxvtXftSl contained '\v(roman|italic|oblique)$' syn match mrxvtOptionsnextgroup=mrxvtXftWd,mrxvtValErr \ '\v^\w+[.*]xftWidth:\s*' syn match mrxvtXftWd contained \ '\v((ultra)?(condensed|expanded)|normal)$' syn match mrxvtOptionsnextgroup=mrxvtXftHt,mrxvtValErr \ '\v^\w+[.*]xftRGBA:\s*' syn match mrxvtXftHt contained '\v(v?(rgb|bgr)|none)$'
Re: mrxvtrc filetype and syntax files
On 4/27/06, Gautam Iyer [EMAIL PROTECTED] wrote: Attached are the filetype, syntax and ftdetect files for mrxvt config files. Sorry I couldn't make your April 20th deadline ... but maybe you can stick these in Vim-7.1 if they don't make the Vim-7.0 release. Just a comment on the syntax definition. You could be using :syn-keyword for quite a few of the things that you're currently using :syn-match for. :syn-keyword is clearer and a lot faster as well. nikolai
Re: Now that we have feedkeys()...
Nikolai Weibull wrote: On 4/27/06, Bram Moolenaar [EMAIL PROTECTED] wrote: One could map 'd' to map 'ac' once pressed, but it would be hard to make sure that 'ac' was unbound if the user cancelled the command in any way. Can't you do this with :omap? Considering that something bound by :omap should perform a motion, how would you create a motion that needs to describe a region that begins before the cursor and ends after it, like other text objects do? I don't think you can change where the operated text starts from an :omap. At least not outside of Visual mode. -- Q: What do you call a fish without an eye? A: fsh! Q: What do you call a deer with no eyes? A: no eye deer. Q: What do you call a deer with no eyes and no legs? A: still no eye deer. /// 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///
Re: Bug: closing an inactive gui tab on windows
On Thu, 27 Apr 2006 09:47:06 +0100 (BST) Georg Dahn [EMAIL PROTECTED] wrote: Hi! There is another strange behavior with gui tabs on Windows. I. First test case 1. Open gVim (gvim -u NONE) 2. Assure, that 'guioptions' contain 'e' (gui tab) 3. Open a new tab with :tabnew and write something 4. Now the right tab is active 5. Right click on the left (inactive) tab and close it Then nothing seems to happen. Click somewhere in the edit window and the closed tab disappears. II. Second test case Do (1) - (5) as above. There are still two tabs seen. Just do (5) again. Then the message is shown, that the last tab cannot be closed (E784). I am running Vim 7.0f02 on Windows XP. This is perhaps a problem for Vim only on Windows, testing your procedure above on Linux doesn't exhibit the strangeness. Sean
Re: Now that we have feedkeys()...
On 4/27/06, Bram Moolenaar [EMAIL PROTECTED] wrote: Nikolai Weibull wrote: Considering that something bound by :omap should perform a motion, how would you create a motion that needs to describe a region that begins before the cursor and ends after it, like other text objects do? I don't think you can change where the operated text starts from an :omap. At least not outside of Visual mode. No, but using visual mode worked just fine. I rarely use visual mode, so I keep forgeting about it ;-). Thanks everyone!
Re: mrxvtrc filetype and syntax files
On Thu, Apr 27, 2006 at 11:35:52AM +0200, Nikolai Weibull wrote: On 4/27/06, Gautam Iyer [EMAIL PROTECTED] wrote: Attached are the filetype, syntax and ftdetect files for mrxvt config files. Sorry I couldn't make your April 20th deadline ... but maybe you can stick these in Vim-7.1 if they don't make the Vim-7.0 release. Just a comment on the syntax definition. You could be using :syn-keyword for quite a few of the things that you're currently using :syn-match for. :syn-keyword is clearer and a lot faster as well. Hi Nicolai, Thanks for pointing this out, I'll correct it. Since Benji Fisher's computer is 6 times faster than mine (which I'm still envious about), I'll jump through hoops to get my Vim to load up 0.1s faster ... :) :). Gautam -- A physics professor is one who talks in someone else's sleep.
Re: mrxvtrc filetype and syntax files
On 4/27/06, Gautam Iyer [EMAIL PROTECTED] wrote: On Thu, Apr 27, 2006 at 11:35:52AM +0200, Nikolai Weibull wrote: Just a comment on the syntax definition. You could be using :syn-keyword for quite a few of the things that you're currently using :syn-match for. :syn-keyword is clearer and a lot faster as well. Hi Nicolai, Hi. I'm curious, why did you spell my name with a 'c'? During the last couple of days, people have called me Nicholas, Niklas, and twice Nicolai. I see a conspiracy forming... Thanks for pointing this out, I'll correct it. :-) n.o.w.
Re: mrxvtrc filetype and syntax files
On Thu, Apr 27, 2006 at 09:40:56PM +0200, Nikolai Weibull wrote: On 4/27/06, Gautam Iyer [EMAIL PROTECTED] wrote: On Thu, Apr 27, 2006 at 11:35:52AM +0200, Nikolai Weibull wrote: Just a comment on the syntax definition. You could be using :syn-keyword for quite a few of the things that you're currently using :syn-match for. :syn-keyword is clearer and a lot faster as well. Hi Nicolai, Hi. I'm curious, why did you spell my name with a 'c'? During the last couple of days, people have called me Nicholas, Niklas, and twice Nicolai. I see a conspiracy forming... Well if Vim does not flag it as a spell error, I don't give it a second thought. Though I'm knot quiet clear weather this algorithm always leads two the write spelling. :) GI -- 'Television' -- The electronic device that alternates between extreme violence and finding great long-distance rates.
Re: mrxvtrc filetype and syntax files
Dnia czwartek, 27 kwietnia 2006 21:40, Nikolai Weibull napisał: Hi Nicolai, Hi. I'm curious, why did you spell my name with a 'c'? During the last couple of days, people have called me Nicholas, Niklas, and twice Nicolai. I see a conspiracy forming... Hello Mikolaj, It is popular name but in each language is spelled differently :) m.
GTK2 and Vim70f
Hi all, I have been unsuccessful at building 7.0f with gtk2 support. I build all of the dependancies in a self contained tree, but vim configure is not recognizing the gtk2 trees.. I have attached my build script for reference but no matter what I do I can't seem to get this to look at my new gtk2 builds. Am I missing something? Is there a way to point to using my gtk2 directories? For gtk2 gtk-config is depracated in favor of pkg-config. The local version of pkg-config does correctly identify gtk2 as a valid library using pkg-config --list-all. Anyone else out there confirm this? #!/bin/bash # # File build-me.sh # # By: Steven Klass # # Description: # dest=`pwd`/gvim7.0 files= ./fontconfig-2.3.2.tar \ ./freetype-2.1.10.tar \ ./libpng-1.2.8.tar \ ./jpeg-6b.tar \ ./tiff-3.7.4.tar \ ./glib-2.8.6.tar \ ./pkg-config-0.20.tar \ ./cairo-1.0.4.tar \ ./atk-1.10.3.tar \ ./pango-1.10.4.tar \ ./gtk+-2.8.17.tar \ ./vim70f.tar logfile='/tmp/gvim7.log' echo Building gvim with prefix = $dest | tee $logfile if [ -d $dest ] ; then echo Removing Destination Directory $dest | tee -a $logfile rm -rf $dest/* mkdir $dest/bin mkdir $dest/lib else mkdir $dest fi cd src # Time to set up the build stuff.. export PATH=$dest/bin:$PATH export LD_LIBRARY_PATH=$dest/lib:$LD_LIBRARY_PATH export LDFLAGS=-L$dest/lib export CPPFLAGS=-I$dest/include echo Building dependancies | tee -a $logfile echo == | tee -a $logfile for file in $files; do options= echo Starting to work on $file | tee -a $logfile dir=`echo $file | sed s/\.tar//` if [ -d $dir ] ; then echo Removing existing directory $dir | tee -a $logfile rm -rf $dir fi echo Untarring $file | tee -a $logfile tar xpvf $file /dev/null if [ -d $dir ] ; then cd $dir/ if [ -f configure ] ;then if [ $dir == ./libpng-1.2.8 ] ; then cat scripts/makefile.smsc | sed s#prefix=/usr/local#prefix=$dest# Makefile else # Option specific stuff.. if [ $dir == ./fontconfig-2.3.2 ] ; then echo ..setting options | tee -a $logfile options=--disable-docs fi if [ $dir == ./vim70f ] ; then echo ..setting options | tee -a $logfile options=--with-features=huge --enable-gui=gtk2 --enable-perlinterp --enable-pythoninterp --enable-cscope fi echo ..configure $options | tee -a $logfile ./configure --prefix=$dest $options /dev/null if [ $? -eq 0 ] ; then echo ..configure ok | tee -a $logfile else echo ..configure $dir not ok | tee -a $logfile exit fi fi if [ $dir == ./cairo-1.0.4 ] ; then mv config.h config.h.orig cat config.h.orig | sed s/#define HAVE_FT_GLYPHSLOT_EMBOLDEN 1// config.h fi make /dev/null if [ $? -eq 0 ] ; then echo ..make ok | tee -a $logfile else echo ..make $dir not ok | tee -a $logfile exit fi make test /dev/null if [ $? -eq 0 ] ; then echo ..make test ok | tee -a $logfile else echo ..make test $dir not ok | tee -a $logfile fi make install /dev/null if [ $? -eq 0 ] ; then echo ..make install ok | tee -a $logfile else echo ..make install $dir not ok | tee -a $logfile exit fi else echo Configure script does not exists for $dir exit fi else echo Directory $dir does not exist for $file exit fi echo $dir is complete | tee -a $logfile cd ../ done -- --- Steven M. Klass Design Automation Manager SMSC 3930 East Ray Road, Suite 200 Phoenix, Arizona 85044 (480) 704-7046 (Desk) (480) 225-1112 (Mobile) [EMAIL PROTECTED]
Re: swapping tab and escape
Hi All, Matt kindly suggested this mapping for the above inoremap m-i tab nnoremap tab esc vnoremap tab escgV inoremap tab esc`^ but how would I add a mapping to make tab work as escape in the command line, also is there any loss of functionality making this mapping, I don't use tab in the command line, but does it do anything useful that I don't know about? Thanks, Rob.
Re: Bugs in feedkeys(): doesn't work with silent and vim went into a loop
On 4/27/06, Hari Krishna Dara [EMAIL PROTECTED] wrote: I am trying to use feedkeys() to give input to a Vim command that is expecting input from the user, and it works if the command is not executed using :silent prefix. Here is an example (executed on JDK 1.4.2 source): :ta Integer tag 1 of 11 or more :call feedkeys(4\CR) | ts takes me to the 4th tag If I prefix the :ts command with :silent, this doesn't work, and the fed keys are handled by Vim as normal mode commands. :call feedkeys(4\CR) | silent ts I was doing this (feeding keys) in Vim 6.3 using a dynamic mapping, which suffered from the same problem, so had to use the command without silent, and that is a big usability issue, so was really hoping that feedkeys() will solve this problem, but unfortuately it doesn't. Also, I just observed that while experimenting with feedkeys(), Vim went into a loop. It responds to ^C with a beep, but ignores all my other keys. It essentially stopped responding to user input (keyboard and mouse), but quit gracefully when I hit the window close button. Here is how to reproduce it (again using JDK 1.4.2 source, but should work on any tags): :ta Integer :ta Integer :call feedkeys(4\CR) | silent ts ^T :call feedkeys(4\CR) | silent ts E426: tag not found: Integer non-responding Vim The ^T is to return back to the previous tag in the stack. I'll try to find how to fix it. It will take me at least several days. Yakov
Re: vimgrep slow?
Eric Arnold wrote: That will probably do for now. Thanks. However, having a flag would be a good thing, since it would allow future modifications to vimgrep to be encapsulated in the flag. Meaning, in the future, :vimgrep /pattern/fast would not necessarily be synonymous with :set eventignore=all Before even thinking of disabling autocommands, we first need proof that this actually changes the search time more than a few percent. Above that, if BufRead autocommands take so much time there is probably something wrong with them. You should find out why this happens. Vim already disables FileType autocommands to avoid ftplugins and syntax scripts, these are not needed for grepping. But this causes trouble for buffers that have a match, especially the first one. Vim takes care of that for Filetype, but if you disable all autocommands you may experience the side effect of that. -- TIM: But follow only if you are men of valour. For the entrance to this cave is guarded by a monster, a creature so foul and cruel that no man yet has fought with it and lived. Bones of full fifty men lie strewn about its lair ... Monty Python and the Holy Grail PYTHON (MONTY) PICTURES LTD /// 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///
RE: Balloons
Earlier, I asked: Some questions on balloons: 1) In response to an user-event (say, a right click) can a message be shown in a balloon? 2) And if this is possible, would it be faster than, say, splitting to make a new buffer and showing the message there? For an example, consider Yasuhiro Matsumoto's calendar utility (www.vim.org/scripts/script.php?script_id=52) being made to show its output calendar in a balloon. Just to experiment, here's what I did: The version of calendar.vim that works for me is 1.3r 1) :nmap rightmouse :CalendarHcr 2) In calendar.vim, near line 830 there are a bunch of setlocal commands. I modified calendar.vim by adding the following line at the end of that bunch of setlocals nmap buffer space :q!cr 3) Ensured that this file was sourced. A) Then I right clicked, and hit space to make the calendar come up and disappear. Continuing with the experiment, 4) Inside function! Calendar(...) and before the section: ++ +++ build window ++ I added the lines: echo vdisplay1 return'' 5) Ensured that this file was sourced. B) Then I right clicked, and hit space to make the calendar come up and disappear. I find that B is much faster than A for both display and exit. One can guess why A is slower for display, but why is it slow for exit too? --Suresh
autochdir doesnt work right
I've tried all variation of BufEnter and autchdir commands to get the cwd switched to that of the file that is open. None of them ever work when I specify a file on the command line. The buffer for the file I specify is open, but the cwd is right where I started vim. I have to :bn|:bp to get the buffer switched. Its only this first file. Anyone know why? Change directory if exists('+autochdir') set autochdir else autocmd BufEnter * silent! lcd %:p:h:gs/ /\\ / endif -- - Eric
Re: autochdir doesnt work right
On Thu, Apr 27, 2006 at 09:44:04AM -0700, Eric Crahen wrote: I've tried all variation of BufEnter and autchdir commands to get the cwd switched to that of the file that is open. None of them ever work when I specify a file on the command line. The buffer for the file I specify is open, but the cwd is right where I started vim. I have to :bn|:bp to get the buffer switched. Its only this first file. Anyone know why? Change directory if exists('+autochdir') set autochdir else autocmd BufEnter * silent! lcd %:p:h:gs/ /\\ / endif Without checking, I guess that the BufEnter autocommand is not triggered when vim first starts up. This should work: autocmd VimEnter,BufEnter * silent! lcd %:p:h HTH --Benji Fisher
Re: autochdir doesnt work right
On Thu, 27 Apr 2006, Eric Crahen wrote: I've tried all variation of BufEnter and autchdir commands to get the cwd switched to that of the file that is open. None of them ever work when I specify a file on the command line. The buffer for the file I specify is open, but the cwd is right where I started vim. I have to :bn|:bp to get the buffer switched. Its only this first file. Anyone know why? Change directory if exists('+autochdir') set autochdir else autocmd BufEnter * silent! lcd %:p:h:gs/ /\\ / endif Hi Eric, I don't use 'autochdir', but here's what I have that works for me: set local directory autocmd BufWinEnter,BufWritePost * \ if expand(%) !~ ^\\%(\\a\\+://\\|$\\) | \ lcd %:p:h | \ endif | HTH :) -- Gerald
Svn and patches
Hello, Does the stuff downloaded from svn include all the latest patches? I suspect it does since the version from yesterday's download says 7.0f02. If so, how latest? Meaning, I suppose Bram commits before sending notice of the patch to the mailing list -- how much after that will it appear on a svn checkout? I recommend getting sources via svn -- it was really very trivial -- much simpler than getting and starting with tar.bz2 and extra.tar.gz. --Suresh
Re: Insert Visual mode
On Thu, Apr 27, 2006 at 11:32:59AM -0700, Gerald Lai wrote: Yes, this may not be a legal way to change modes, but I believe (but have not confirmed) many existing scripts rely on C-r= to evaluate functions that do change modes in some way. If this is true, this is one bug that is relied on heavily by many. Does anybody else have an opinion on this? :) I agree that a change like this might break existing scripts. I cannot think of any off hand. HTH --Benji Fisher
Re: Bugs in feedkeys(): doesn't work with silent and vim went into a loop
Hari Kirshna Dara wrote: I am trying to use feedkeys() to give input to a Vim command that is expecting input from the user, and it works if the command is not executed using :silent prefix. Here is an example (executed on JDK 1.4.2 source): :ta Integer tag 1 of 11 or more :call feedkeys(4\CR) | ts takes me to the 4th tag If I prefix the :ts command with :silent, this doesn't work, and the fed keys are handled by Vim as normal mode commands. :call feedkeys(4\CR) | silent ts If you try :silent ts manually you will see that this doesn't work either. This has nothing to do with feedkeys(). If you silence an interactive command you can predict it won't work. This is mostly to prevent Vim from an apparent hang when someone uses :silent for an interactive command (often indirectly). I understand that silencing an interactive command should work this way, but when there are keys to be consumed, especially fed in advance using feedkeys(), what is wrong in feeding to the interactive command? To me, the usefulness of feedkeys() goes down significantly if this is not supported. In fact, I don't know where you would need feedkeys() as using a dynamic mapping can already achieve this. I don't know what you are talking about. The 4\CR in your example is executed, the cursor moves four lines down. Making interactive commands with :silent sometimes accept keys and sometimes not makes them unpredictable. Consider the hit-enter prompt, for example. All interactive commands in unix work with redirected stdio (well, except those that directly open the console, which are very rare), and why shouldn't this be the case with vim commands? We have output redirection for interactive commands, why can't they have a way to take input by other means? You are over-generalizing. Does firefox redirect stdio? Does reboot? This only applies to commands that were made to be used in a pipe. -- ARTHUR: Charge! [They all charge with swords drawn towards the RABBIT. A tremendous twenty second fight with Peckinpahish shots and borrowing heavily also on the Kung Fu and karate-type films ensues, in which some four KNIGHTS are comprehensively killed.] ARTHUR: Run away! Run away! Monty Python and the Holy Grail PYTHON (MONTY) PICTURES LTD /// 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///
Re: Svn and patches
Suresh Govindachar wrote: Does the stuff downloaded from svn include all the latest patches? I suspect it does since the version from yesterday's download says 7.0f02. If so, how latest? Meaning, I suppose Bram commits before sending notice of the patch to the mailing list -- how much after that will it appear on a svn checkout? I recommend getting sources via svn -- it was really very trivial -- much simpler than getting and starting with tar.bz2 and extra.tar.gz. I mostly make a new snapshot every night. They should be in SVN within some hours. I don't know exactly how often Edward updates it, but you can assume there is a fresh Vim every morning. The zip archive is available earlier. -- An indication you must be a manager: You give constructive feedback to your dog. /// 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///
Re: autochdir doesnt work right
On 4/27/06, Eric Crahen [EMAIL PROTECTED] wrote: On 4/27/06, Gerald Lai [EMAIL PROTECTED] wrote: On Thu, 27 Apr 2006, Eric Crahen wrote: I've tried all variation of BufEnter and autchdir commands to get the cwd switched to that of the file that is open. None of them ever work when I specify a file on the command line. The buffer for the file I specify is open, but the cwd is right where I started vim. I have to :bn|:bp to get the buffer switched. Its only this first file. Anyone know why? Change directory if exists('+autochdir') set autochdir else autocmd BufEnter * silent! lcd %:p:h:gs/ /\\ / endif Hi Eric, I don't use 'autochdir', but here's what I have that works for me: set local directory autocmd BufWinEnter,BufWritePost * \ if expand(%) !~ ^\\%(\\a\\+://\\|$\\) | \ lcd %:p:h | \ endif | HTH :) I tried adding that and there was no effect Try running from the prompt: $ vim -u NONE Then do: :set nocp laststatus=2 :autocmd BufWinEnter * lcd %:p:h Split open 2 files in different directories and switch between both the windows. Do you see the paths change? -- Gerald
Re: autochdir doesnt work right
When I open files from within vim its not a problem. Its the files that are opened from the command line, a method I use every day. On 4/27/06, Gerald Lai [EMAIL PROTECTED] wrote: On 4/27/06, Eric Crahen [EMAIL PROTECTED] wrote: On 4/27/06, Gerald Lai [EMAIL PROTECTED] wrote: On Thu, 27 Apr 2006, Eric Crahen wrote: I've tried all variation of BufEnter and autchdir commands to get the cwd switched to that of the file that is open. None of them ever work when I specify a file on the command line. The buffer for the file I specify is open, but the cwd is right where I started vim. I have to :bn|:bp to get the buffer switched. Its only this first file. Anyone know why? Change directory if exists('+autochdir') set autochdir else autocmd BufEnter * silent! lcd %:p:h:gs/ /\\ / endif Hi Eric, I don't use 'autochdir', but here's what I have that works for me: set local directory autocmd BufWinEnter,BufWritePost * \ if expand(%) !~ ^\\%(\\a\\+://\\|$\\) | \ lcd %:p:h | \ endif | HTH :) I tried adding that and there was no effect Try running from the prompt: $ vim -u NONE Then do: :set nocp laststatus=2 :autocmd BufWinEnter * lcd %:p:h Split open 2 files in different directories and switch between both the windows. Do you see the paths change? -- Gerald -- - Eric
Re: autochdir doesnt work right
On Thu, 27 Apr 2006, Eric Crahen wrote: On 4/27/06, Gerald Lai [EMAIL PROTECTED] wrote: On 4/27/06, Eric Crahen [EMAIL PROTECTED] wrote: On 4/27/06, Gerald Lai [EMAIL PROTECTED] wrote: On Thu, 27 Apr 2006, Eric Crahen wrote: I've tried all variation of BufEnter and autchdir commands to get the cwd switched to that of the file that is open. None of them ever work when I specify a file on the command line. The buffer for the file I specify is open, but the cwd is right where I started vim. I have to :bn|:bp to get the buffer switched. Its only this first file. Anyone know why? Change directory if exists('+autochdir') set autochdir else autocmd BufEnter * silent! lcd %:p:h:gs/ /\\ / endif Hi Eric, I don't use 'autochdir', but here's what I have that works for me: set local directory autocmd BufWinEnter,BufWritePost * \ if expand(%) !~ ^\\%(\\a\\+://\\|$\\) | \ lcd %:p:h | \ endif | HTH :) I tried adding that and there was no effect Try running from the prompt: $ vim -u NONE Then do: :set nocp laststatus=2 :autocmd BufWinEnter * lcd %:p:h Split open 2 files in different directories and switch between both the windows. Do you see the paths change? [modified for bottom posting] When I open files from within vim its not a problem. Its the files that are opened from the command line, a method I use every day. The autocmds VimEnter, BufEnter, WinEnter, and BufWinEnter all activate when a file is opened from the command line. You can use any of these. The example set local directory I gave you will only set the directory for windows in Vim. When you quit Vim, you will still be where you executed Vim. Consider using :cd instead of :lcd See :help :cd :help :lcd. I'm sorry I misunderstood what you wanted in the first place. HTH :) -- Gerald
Conditional search and replace.
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. I could probably write out a script to do this, but I'm betting there is a really slick way for Vim to do this without a script. Any Ideas? Thanks. Kurt
Re: Conditional search and replace.
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 matches key this regexp (the literal key) / do the following action s/ substitute longthis regexp (the literal long in this case) / with int this result (the literal int) /g and do it for all the occurances of long in the line If you want to avoid problems with things like longbottom, or singalong becoming things like intbottom and singaint, you can use :g/key/s/\long\/int/g which will ensure that long occurs as a word (as defined I *think* by the 'iskeyword' property) :help \ :help iskeyword :help :g I could probably write out a script to do this, but I'm betting there is a really slick way for Vim to do this without a script. Vim is full of slickness :) -tim
RE: File - register
[slightly redone version of previous post] Hello, What's the best way to get the contents of a file into a register? The following works (file is foo.bat) but is there a better way? :new|r foo.bat|1d|exec 'normal ayG'|q! Thanks, --Suresh
Re: File - register
: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 possibly by dealing with it in normal mode 1d| normal ayG:q!cr and is there a better way? While there are likely a whole mess of ways to skin a cat, one that occurs to me that you can also use: :let @a=system('cat foo.bat') (or on Win32, you might be able to use type instead of cat) It's a little less cryptic. HTH, -tim
Re: File - register
On Thu, 27 Apr 2006, Suresh Govindachar wrote: Hello, What's the best way to get the contents of a file into a register? I tried the following (file is foo.bat), but it doesn't get rid of the new buffer: :new|r foo.bat|1d|normal ayG|q! So why does the q! get lost, and is there a better way? Do :new | r foo.bat | 1d_ | set nonu | redir @a | sil! %p | redir END q! gets lost because :normal reads its argument till the end of the cmdline. HTH :) -- Gerald
Re: File - register
Hi Suresh, On 4/27/06, Suresh Govindachar [EMAIL PROTECTED] wrote: Hello, What's the best way to get the contents of a file into a register? I tried the following (file is foo.bat), but it doesn't get rid of the new buffer: :new|r foo.bat|1d|normal ayG|q! So why does the q! get lost, and is there a better way? In Vim7, you can use the readfile() function: let l = readfile(foo.bat) This returns a List with an entry for each line in the file. - Yegappan
Re: File - register
On 4/27/06, Yegappan Lakshmanan [EMAIL PROTECTED] wrote: Hi Suresh, On 4/27/06, Suresh Govindachar [EMAIL PROTECTED] wrote: Hello, What's the best way to get the contents of a file into a register? I tried the following (file is foo.bat), but it doesn't get rid of the new buffer: :new|r foo.bat|1d|normal ayG|q! So why does the q! get lost, and is there a better way? In Vim7, you can use the readfile() function: let l = readfile(foo.bat) This returns a List with an entry for each line in the file. You can also do the following: new | r foo.bat | let l = getbufline('%', 1, '$') | q! - Yegappan
Backslash in maps
Hello, Why does the following _single_ line map generate the E10 error?: nmap space :let @a=substitute(getline('.'),'\(^.*|\s*\)\|\(\s\s*$\)','','g') How would it be fixed? Thanks, --Suresh
Re: swapping tab and escape
Yes... I, Matt, who recommended the tab mappings, do no advise mapping tab this way for command line because of the lack of completion. However, you can do a ctrl-d for a kind of completion. --Matt On Thu, Apr 27, 2006 at 01:58:53AM -0700, Gerald Lai wrote: On Thu, 27 Apr 2006, Robert Cussons wrote: Hi All, Matt kindly suggested this mapping for the above inoremap m-i tab nnoremap tab esc vnoremap tab escgV inoremap tab esc`^ but how would I add a mapping to make tab work as escape in the command line, also is there any loss of functionality making this mapping, I don't use tab in the command line, but does it do anything useful that I don't know about? Tab is used as the completion key in the command line. This is extremely useful, IMHO. For example, (with cursor as _ underscore) typing :help dos-p_ and then hitting Tab will produce :help msdos-problems_ If you'd like to make Tab act as Esc in the command line, do :cnoremap Tab Esc HTH :) -- Gerald
Re: Backslash in maps
On Thu, 27 Apr 2006, Suresh Govindachar wrote: Hello, Why does the following _single_ line map generate the E10 error?: nmap space :let @a=substitute(getline('.'),'\(^.*|\s*\)\|\(\s\s*$\)','','g') How would it be fixed? What do you intend to do with the mapping? First, replace all | with Bar: nmap space :let @a=substitute(getline('.'),'\(^.*Bar\s*\)\Bar\(\s\s*$\)','','g') |s are used as the command separator in the :cmdline. I think you'd want the first Bar to be escaped with a backslash \ . Also, put CR at the end: nmap space :let @a=substitute(getline('.'),'\(^.*\Bar\s*\)\Bar\(\s\s*$\)','','g')CR Simplifying the regex yields: nmap space :let @a=substitute(getline('.'),'^.*\Bar\s*\Bar\s\s*$','','g')CR HTH. -- Gerald
Re: Backslash in maps
Gerald Lai sent on Thu, 27 Apr 2006 17:44:05 -0700 (PDT): On Thu, 27 Apr 2006, Suresh Govindachar wrote: Hello, Why does the following _single_ line map generate the E10 error?: nmap space :let @a=substitute(getline('.'),'\(^.*|\s*\)\|\(\s\s*$\)','','g') Note that error E10 concerns viml line continuation but the preceding is all one line -- does not have viml line continuation. How would it be fixed? What do you intend to do with the mapping? The line would have several '|' characters in it; I want @a to contain the the stuff after the very last '|' but without any leading or trailing white space in the captured stuff: So, for example, if the line was: stuff | more stuff | want this gold then @a should contain want this gold (without quotes) Also, put the cursor on the above example line, and issue the command echo substitute(getline('.'),'\(^.*|\s*\)\|\(\s\s*$\)','','g') First, replace all | with Bar: Well, putting the cursor on the example line and issuing the following command gives the wrong answer: echo substitute(getline('.'),'\(^.*bar\s*\)\bar\(\s\s*$\)','','g') [...] Here's my present work-around: let @b='\\(^.*|\\s*\\)\\|\\(\\s\\s*$\\)','','g' nmap space :exec let @a=substitute(getline('.'),[EMAIL PROTECTED]) --Suresh
Re: Backslash in maps
On 2006-04-28, Suresh Govindachar [EMAIL PROTECTED] wrote: Gerald Lai sent on Thu, 27 Apr 2006 17:44:05 -0700 (PDT): On Thu, 27 Apr 2006, Suresh Govindachar wrote: Hello, Why does the following _single_ line map generate the E10 error?: nmap space :let @a=substitute(getline('.'),'\(^.*|\s*\)\|\(\s\s*$\)','','g') Note that error E10 concerns viml line continuation but the preceding is all one line -- does not have viml line continuation. Actually, the description of E10 says it is _often_ caused by command-line continuation; it does not say that that is the only cause. How would it be fixed? I played with this a little bit before seeing Gerald's reply and discovered, as he pointed out, that the problem is with the '|'. I worked around it by adding backslashes until it worked. I found I had to escape the first one in the pattern to avoid the error, then figured I would have to escape the second one twice to make vim see it as '\|'. nmap space :let @a=substitute(getline('.'),'\(^.*\|\s*\)\\|\(\s\s*$\)','','g')CR And as Gerald said, it needs a CR at the end, too. What do you intend to do with the mapping? The line would have several '|' characters in it; I want @a to contain the the stuff after the very last '|' but without any leading or trailing white space in the captured stuff: So, for example, if the line was: stuff | more stuff | want this gold then @a should contain want this gold (without quotes) Now that I know what you intended this to do, I tested my version and it seems to work. I wish I had a better understanding of when vim ignores quotes and instead requires backslashes to escape |'s. HTH, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Wireless Division | Spokane, Washington, USA
Re: Bugs in feedkeys(): doesn't work with silent and vim went into a loop
On 4/27/06, Bram Moolenaar [EMAIL PROTECTED] wrote: [...] This looks like a bug... Well, here you can see how adding something without know exactly what happens messes up things. feedkeys() sets the typebuf_was_filled flag and that causes the loop. I'll change that. Hopefully this will work: --- eval.c 27 Apr 2006 00:02:04 - 1.170 +++ eval.c 27 Apr 2006 09:58:48 - @@ -9029,7 +9029,8 @@ ins_typebuf(keys_esc, (remap ? REMAP_YES : REMAP_NONE), typebuf.tb_len, !typed, FALSE); vim_free(keys_esc); - typebuf_was_filled = TRUE; + if (vgetc_busy) + typebuf_was_filled = TRUE; } } } I don't have a compile environment. Do you think this will fix the problem where feedkeys() causes getchar() to work improperly (forever returning the same key)?
Re: vim prison ?
On 4/27/06, Eric Arnold [EMAIL PROTECTED] wrote: On 4/27/06, Meino Christian Cramer [EMAIL PROTECTED] wrote: From: James Vega [EMAIL PROTECTED] Subject: Re: vim prison ? Date: Thu, 27 Apr 2006 23:08:51 -0400 On Fri, Apr 28, 2006 at 04:52:25AM +0200, Meino Christian Cramer wrote: Now I recognize, that file1 does not need any changes and want vim to simply forget that file. I have set hidden in my .vimrc since I normally have to edit more than one file. And the files are long and loading takes some time ( : ...[converting]... .). ... GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED] Hi James, thank you for your super fast reply :O) ! I searched through the help files before. Ad a newbie to vim it is not simple for me sometimes to find out for what to search... And a simple grep ist not /that/ helpful First of all, you need to understand all the modes the buffers can be in. There are several commands which handle them. As for grep, are you using :helpgrep ? If you do, then you can use :copen to see all the results in a window that will jump to the instances. Don't forget ^D with :help P.s. I meant to say, start by reading all of windows.txt
Quick peak at files
Hello, I have summarized my posts today titled Balloons, File - register and Backslash in maps as a vimtip (www.vim.org/tips/tip.php?tip_id=1218) titled Quick peak at files; the tip is also attached below. --Suresh Quick peak at files In an operating system's command-line terminal, one can get a quick peak at a file using commands such as more, cat, head etc. In vim, one way to peak at a file would be to open it in a new buffer -- but there is a way to peak at a file from vim without having to open it in a buffer, browse it and close the buffer -- one can just view it in vim's command line! This mode of viewing is facilitated in vim version 7 by version 7's support for scrolling (see :help scroll-back). So to peak at a file, we just echo its contents (:help echo; info on other commands mentioned here can be found likewise via :help). Simple implementation: - One way to implement the idea would be: :new|r file_name|1d|exec 'normal ayG'|q!|echo @a One could also do :echo system('cat foo.bat'), but we are trying to avoid explicit system calls. In version 7, vim supports readfile(). But the results of readfile() is an array of lines -- and these lines would need to be joined to enable viewing; so we have: :echo join(readfile('foo.bat'), \n) Applications: Here are two applications that build on the idea presented here. A) Yasuhiro Matsumoto's calendar utility (www.vim.org/scripts/script.php?script_id=52) is written to display the calendar in a buffer. For a quick peak at the calendar, one can modify the plugin to support echoing the calendar in vim's command line, and make a simple map (such as of a RightMouse click) to trigger the display on the command line! B) I have the following in my vimfiles\after\ftplugin\index.vim to speed up previewing emails using my mail user agent utility (www.vim.org/scripts/script.php?script_id=1052) if(v:version 700) nnoremap buffer space :exec let @a='r '.expand('%:p:h').'/'.substitute( \getline('.'), \'\\(^.*\|\\s*\\)\\\|\\(\\s\\s*$\\)', \'', \'g') \\\|new\\|@a\\|1d\\| \silent exec 'normal\ d}\ayG'\\|q!\\|echo\ @acr else nnoremap buffer space :exec let alist=readfile(expand('%:p:h').'/'. \substitute(getline('.'), \'\\(^.*\|\\s*\\)\\\|\\(\\s\\s*$\\)', \'', \'g') \)\\| \while(remove(alist, 0) != '') \\\|endwhile \\\|echo\ \substitute(getline('.'), \'\\(^.*\|\\s*\\)\\\|\\(\\s\\s*$\\)', \'', \'g').\\n\n\ \\\|echo join(alist,\\n\)cr endif Acknowledgment: -- While the idea presented here is mine, people on the vim@vim.org mailing list suggested alternate ways of implementing it and helped with some implementation details (such as escaping |). Happy vimming! --Suresh
Re: Svn and patches
On 4/28/06, Bram Moolenaar [EMAIL PROTECTED] wrote: Suresh Govindachar wrote: Does the stuff downloaded from svn include all the latest patches? I suspect it does since the version from yesterday's download says 7.0f02. If so, how latest? Meaning, I suppose Bram commits before sending notice of the patch to the mailing list -- how much after that will it appear on a svn checkout? Hi, I'm the subversion repository maintainer. I sync the subversion repository with the CVS repository everyday at about 9:00 (+0800), or 1:00 (GMT). So if you checkout the code at about 2:00 (GMT), you can get the latest version. :-) I recommend getting sources via svn -- it was really very trivial -- much simpler than getting and starting with tar.bz2 and extra.tar.gz. I mostly make a new snapshot every night. They should be in SVN within some hours. I don't know exactly how often Edward updates it, but you can assume there is a fresh Vim every morning. The zip archive is available earlier. -- An indication you must be a manager: You give constructive feedback to your dog. /// 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///