Re: Problem doing diffs using win 2000
Yegappan Lakshmanan wrote: Do you have the 'diffexpr' set in your .vimrc file? :verbose set diffexpr? - Yegappan Hi, yes, it's set to MyDiff(), which is defined in _vimrc as set diffexpr=MyDiff() function MyDiff() let opt = '-a --binary ' if diffopt =~ 'icase' | let opt = opt . '-i ' | endif if diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif let arg1 = v:fname_in if arg1 =~ ' ' | let arg1 = '' . arg1 . '' | endif let arg2 = v:fname_new if arg2 =~ ' ' | let arg2 = '' . arg2 . '' | endif let arg3 = v:fname_out if arg3 =~ ' ' | let arg3 = '' . arg3 . '' | endif silent execute '!C:\Programme\Vim\vim70\diff ' . opt . arg1 . ' ' . arg2 . ' ' . arg3 endfunction This work's fine for WinXP, but not for Win2k Cheers, Wolfgang
Re: s?
Thanks for all the explanations everyone. I do see your points, and will try to add 's' to my weaponry :) Wim On 6/30/06, Wim R. Crols [EMAIL PROTECTED] wrote: Hi, Not really a request for help, but I was wondering if you guys ever use the 's' command. It's just a shortcut for 'cl', which I almost never need. Since I don't assume it was put in to be complete or something, I'm intrigued by it's enigmatic purpose. :) Thanks, Wim
Re: Motion for Cammel Notation
On Mon, Jul 03, 2006 at 12:20:37PM +0300, Giorgos Gaganis wrote: Hello I was wondering if it is possible to have a motion command that would be aware of the Cammel Notation (eg BufferedInputStreamReader) so that the cursor would stop on the capital letters. I would particularly want to use it with the 'c' command. What about map c /\ucr ? This will go to the next upper case character. ? searches backwards See :h / :h ? :h pattern Remember that you can use fC to jump the the next uppercase C which will be faster than pressing c 3 times. See also :h , and :h ; to repeat last movement. I'm using c quite often. I wouldn't remap it ;) Marc
Re: Motion for Cammel Notation
I would particularly want to use it with the 'c' command. [cut] I'm using c quite often. I wouldn't remap it ;) I think the OP wants an (in vim nomenclature) operator pending mode mapping, so that it can be used *with* the c command, rather than *instead* of the c command. :onoremap /\ucr :onoremap lt ?\ucr This pair of mappings will allow one to do c or c to change to the next/previous start of a camel-case word The 2nd mapping has problems if you're in the first word or on the 1st character of the 2nd word (e.g. abcdEfgHiJklmno and your cursor is on the E), so you can change the mapping to :onoremap lt ?\ubslashbarbslashltcr which will handle both cases. There's a good bit of help on the matter scattered throughout the docs. Some suggested places to start reading: :help omap :help operator-pending :help map_backslash :help bar (reading the surrounding section on bslash, lt, cr and when to use them too is helpful) These mappings do happen to break the convenience of the and commands, as after the first or , vim is now in operator-pending mode, so unless there is another uppercase letter on the line (before or after the cursor respectively), this will give you grief. However, you can map them to other keys if you prefer (plus/minus are rarely used, given their synonymity with j/k), or you might be able to create additional mappings for and to explicitly perform their original actions: :nnoremap ltlt ltlt :nnoremap might do the trick (untested). HTH, -tim
Correction: Problem doing diffs using win 2000
Hi, after re-examination of the problem I found the diff functionaliy now working on Win2k, still don't know what caused the problem. Anyway, diff'ing does work under Win2k, sorry for the confusion and thanks to those who tried to help. Sorry, Wolfgang Wolfgang Schmidt wrote: Hi, I just installed gvim70 (from the self-extracting exe) on WIN 2K system. Everything seems to work, exept the diff functionality. If I do a diff, e.g. C:\Programme\Vimvim _vimrc -d _vimrc.bak I get 2 Dateien zum Editieren Das angegebene Programm kann nicht ausgeführt werden. E97: Kann keine Differenz erstellen so Vim complains, that the diff program can't be executed. But the diff program is present (C:\Programme\Vim\vim70\diff.exe) and it works (I tried it manually from the commandline). Maybe there's a problem with diff under win2K? I've used the same installer executable to install gvim70 on some Win XP machines, and I did not have any problems with diff. Thanx in advance Wolfgang
Re: Backups
On 7/3/06, Vigil [EMAIL PROTECTED] wrote: Because savevers (script #89) no longer works properly with vim 7 savevers perfectly works for me in vim7, just as it did for vim6 Yakov
Re: Funcref and script local functions
On 7/2/06, Hari Krishna Dara [EMAIL PROTECTED] wrote: On Thu, 29 Jun 2006 at 10:50pm, Eric Arnold wrote: Ok. For starters, it seems that you *can* call a numbered function from anywhere: function! s:T() echomsg here echomsg 'SID=' . expand( 'sfile' ) endfunction let F=function('s:T') echomsg F() let F1 = function( 'SNR66_T' ) echomsg F1() echomsg string( F ) let s:dict = {} function s:dict.init() dict echomsg in dict function endfunction unlet! F2 let F2 = s:dict.init call call(F2,[],{}) Note: F2 is a global, so the numbered function declared for a local dict is available to call globally. Right, and that is what I intended by saying the Funcref's are behaving as the original functions. Since numbered functions are accessible globally, their Fucrefs are too (for that matter, I don't think you can even call numbered functions directly, so this situation is not completely same). I'm still not getting it, I think. Do you have a case where the numbered function scheme will break down, or is it about the callbacks, described below? On 6/29/06, Hari Krishna Dara [EMAIL PROTECTED] wrote: When Funcref's were introduced in Vim7, I expected them to work for script-local functions, across scripts. The documentation didn't say that, but it didn't say that it wouldn't either, and I thought that that is one of its biggest uses (other than the actual intended functionality, which is for implementing numbered functions). However, I I'm not sure that there is a problem. As with C code, if you have the option of declaring a function global/local, public/private, etc. I think Vim script is allowing these options. Are you saying that you want to override the private script declarations by declaring a function reference to a low enough level pointer that it goes under the scope checker? found that the Funcref references for such functions can't actually be passed out to other scripts. This reduces the usefulness of this feature as we can't register private functions to receive callbacks from other scripts. I think this is probably a request that it be more object oriented than it is, ie. you really want object-scoped functions, not script-scoped. You seem to want the script localized, so it can't be access generally, but then be public for registering callbacks. This seems like an object-scope problem. I think that the numbered functions are allowed globally, probably because they are intended to be used as you describe, for callbacks from other scripts, since they are only created for the 'dict' object functions, as far as I can tell. What is weird is that the the Funcref() actually behaves exactly like the function name itself. Say you have a function called s:T() and say the script id is 60. The Funcref obtained via function('s:T') can't be called from outside the script, but if the Funcref is obtained using function('SNR60_T'), then it will be fine. Also, a Funcref obtained Both of these examples seem reasonable to me. If you declare a function reference to a script-local object, s:T then you don't want it being accessed outside the script. If you declare a 'SNR60_T'reference, then you probably wanted to use it outside the script, otherwise you wouldn't have gone through the trouble of finding the script id. using these two methods will not be to the same object, though you would expect them to be. The below echoes 0: How did you test what the object was? Actually, I wouldn't expect it to be the same object in any case, since each reference to it should crease a new instance. They both might refer to the same function definition stored internally, but I don't know. Also, we aren't talking about true objects, just to be clear, but an enhancment that allows object-oriented-like functional access. This limits the expectations we can have. echomsg function('s:T') is function('SNR60_T') where as the below echoes 1: echomsg function('s:T') is function('s:T') In this case you are *not* creating numbered functions, so the string value you use is what gets stored. I think you misunderstood me, I didn't mean this. The above two facts make Funcref counter-intuitive to understand. I actually wonder why even a special function called function() was required to obtain the Funcref in the first place (unlike in Python). I suppose the Funcref function was probably created as a shortcut to adding a more complex syntax modification to the language. There are other aspects of the new features that are very counter-intuitive to me, whether I think in terms of Python or generic objects in any language. The one which gets me the most is the implicit typing of variables based on the initializer. For basic types prior to Vim7 (integer and string), you could easily switch the value of the variable from integer to string or vice versa, and the type() of the
Re: insert space after comma based on context
You can also ctrl-v, which will prevent the , map. On Thu, 29 Jun 2006, Zhang Le wrote: Hi, Most of time I want a space after a comma, so I use imap , , The problem is, sometime I do not want a comma inside square brackets in some programming language such python and matlab: a[10,:] or a(10,:) Is there a way to not insert a space based on context around the cursor so that if the text before cursor is [xxx, or (xxx, no space will be inserted? Any tips? Zhang Le -- .
Re: Motion for Cammel Notation
Tim Chase wrote: I would particularly want to use it with the 'c' command. [cut] I'm using c quite often. I wouldn't remap it ;) I think the OP wants an (in vim nomenclature) operator pending mode mapping, so that it can be used *with* the c command, rather than *instead* of the c command. :onoremap /\ucr :onoremap lt ?\ucr This pair of mappings will allow one to do c or c Thank you very much for your answers. What Tim suggested is doing the job with the following modification :onoremap u /\u\\|\Wcr the above works like 'cw' but also stops on uppercase letters. Although it does the job there is a really annoying side-effect. Because it uses a search all uppercase and nonword chars are highlighted which makes the screen practically unreadable. I have found the :nohl command but using it like this: :onoremap u /\u\\|\Wcr:nohlcr simply enters the text :nohl in insert mode is there a way to temporarily turn off search highlighting? to change to the next/previous start of a camel-case word The 2nd mapping has problems if you're in the first word or on the 1st character of the 2nd word (e.g. abcdEfgHiJklmno and your cursor is on the E), so you can change the mapping to :onoremap lt ?\ubslashbarbslashltcr which will handle both cases. There's a good bit of help on the matter scattered throughout the docs. Some suggested places to start reading: :help omap :help operator-pending :help map_backslash :help bar (reading the surrounding section on bslash, lt, cr and when to use them too is helpful) These mappings do happen to break the convenience of the and commands, as after the first or , vim is now in operator-pending mode, so unless there is another uppercase letter on the line (before or after the cursor respectively), this will give you grief. However, you can map them to other keys if you prefer (plus/minus are rarely used, given their synonymity with j/k), or you might be able to create additional mappings for and to explicitly perform their original actions: :nnoremap ltlt ltlt :nnoremap might do the trick (untested). HTH, -tim
Re: Backups
Because savevers (script #89) no longer works properly with vim 7 savevers perfectly works for me in vim7, just as it did for vim6 Weird. Tell me, do your settings differ greatly from mine?: savevers set backup set patchmode=.prev let savevers_dirs=~/backups/vim exe set backupskip+=* . patchmode exe set suffixes+= . patchmode exe set wildignore+=* . patchmode -- .
Re: Backups
On 7/3/06, Vigil [EMAIL PROTECTED] wrote: Because savevers (script #89) no longer works properly with vim 7 savevers perfectly works for me in vim7, just as it did for vim6 Weird. Tell me, do your settings differ greatly from mine?: savevers set backup set patchmode=.prev let savevers_dirs=~/backups/vim exe set backupskip+=* . patchmode exe set suffixes+= . patchmode exe set wildignore+=* . patchmode Here are my savevers settings: {{{ configuration for savevers.vim http://www.vim.org/scripts/script.php?script_id=89 -- savevers.vim plugin by Ed Ralston let savevers_types='*' let savevers_max= let savevers_purge=1 let savevers_dirs=~/tmp/ patchmode is required for savevers to work set patchmode=.ORIG set backup }}} Can it be that my version of savevers, being not the latest savevers, works better than the later versions of savevers ? I am attaching the exact version of savevers that I'm using. I never pulled from vim.org another version of savevers since I pulled it for the 1st time, and this was long time ago. Anyway, this one works for me flawlessly. Yakov savevers.vim Description: Binary data
Re: Backups
Can it be that my version of savevers, being not the latest savevers, works better than the later versions of savevers ? Weird. I guess when I pulled my latest copy (we both are using 0.8), it was corrupt or something, because yours works. Thanks. -- .
Re: Funcref and script local functions
On 7/3/06, Yakov Lerner [EMAIL PROTECTED] wrote: On 6/30/06, Hari Krishna Dara [EMAIL PROTECTED] wrote: ... The Funcref obtained via function('s:T') can't be called from outside the script ... [unexpectedly] I agree, Hari. I'd expect funcref function('s:T') to be callable outside of the script, too. To make myself more clear. I expect g:Xxx() to be callable from global scope of from another script in this example: --- scritp x.vim function! s:XXX() echo func XXX endfunction let g:Xxx=function('s:XXX') Yakov
Re: Funcref and script local functions
On 7/3/06, Yakov Lerner [EMAIL PROTECTED] wrote: On 7/3/06, Yakov Lerner [EMAIL PROTECTED] wrote: On 6/30/06, Hari Krishna Dara [EMAIL PROTECTED] wrote: ... The Funcref obtained via function('s:T') can't be called from outside the script ... [unexpectedly] I agree, Hari. I'd expect funcref function('s:T') to be callable outside of the script, too. To make myself more clear. I expect g:Xxx() to be callable from global scope of from another script in this example: --- scritp x.vim function! s:XXX() echo func XXX endfunction let g:Xxx=function('s:XXX') Yakov The problem with this is that you can no longer have private object function refs. I'd be interested to hear from Bram about what the intent was here. I think I can see some method in the maddness. 1) let ref = function('s:XXX') This mains the standard scope rules for the func ref, and so it stays local even if the variable holding it is global. I can image situations where this could be useful. 2) let ref = function('SNR66_XXX') This forces the function to be available globally because it is explicitely defined, and there is little chance of mistakes about that. 3) function obj.funcref() dict Again, I think the intent for having the object function in the global scope is unknown (to me at least). I think it left global because you don't really need specific scoping for it, as when it is used, it *should* be used via the object name, which is scoped by the user. function s:obj.funcref() dict Hari, can you give an example of why function('s:T') should be globally scoped? I can't see a need for it, given all the possibilites for obtaining a ref.
Re: Funcref and script local functions
On 7/3/06, Eric Arnold [EMAIL PROTECTED] wrote: On 7/3/06, Yakov Lerner [EMAIL PROTECTED] wrote: On 7/3/06, Yakov Lerner [EMAIL PROTECTED] wrote: On 6/30/06, Hari Krishna Dara [EMAIL PROTECTED] wrote: ... The Funcref obtained via function('s:T') can't be called from outside the script ... [unexpectedly] I agree, Hari. I'd expect funcref function('s:T') to be callable outside of the script, too. To make myself more clear. I expect g:Xxx() to be callable from global scope of from another script in this example: --- scritp x.vim function! s:XXX() echo func XXX endfunction let g:Xxx=function('s:XXX') Yakov The problem with this is that you can no longer have private object function refs. Of course you can .: let s:Xxx=function('s:XXX') script-private funcref let l:Xxx=function('s:XXX') function-private funcref let g:Xxx=function('s:XXX') globally-accessible funcref Yakov
Re: line wrap question
* K.S.Sreeram on Monday, July 03, 2006 at 22:57:08 +0530: In 'set wrap' mode, say I have a single long line which wraps and forms 5 screen lines. Now when I press 'j', the cursor jumps over the 5 lines and goes to the next physical line(6th screen line). Is it possible for me to configure vim, so that cursor movement keys go to the next screen line, instead of the next physical line? :help gj c -- _B A U S T E L L E N_ lesen! --- http://www.blacktrash.org/baustellen.html
Re: Motion for Cammel Notation
Hi, Am Montag, 03. Jul 2006, 12:20:37 +0300 schrieb Giorgos Gaganis: I was wondering if it is possible to have a motion command that would be aware of the Cammel Notation (eg BufferedInputStreamReader) so that the cursor would stop on the capital letters. See also tip #1016. Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de
Re: line wrap question
On 7/3/06, K.S.Sreeram [EMAIL PROTECTED] wrote: Hi All In 'set wrap' mode, say I have a single long line which wraps and forms 5 screen lines. Now when I press 'j', the cursor jumps over the 5 lines and goes to the next physical line(6th screen line). Is it possible for me to configure vim, so that cursor movement keys go to the next screen line, instead of the next physical line? I have played with the 'textwidth' option, but that actually *inserts* newlines into the text. But I don't want my long lines to be physically broken with newlines. Any help appreciated. I have this in my .vimrc. Press F3 to toggle between Up/Down action: alternate Up/Down arrows when lines are long fu! ToggleLongLinesUpDown() if !exists(s:UpDownLongLines) || s:UpDownLongLines==0 imap silent Down C-ogj imap silent Up C-ogk nmap silent Down gj nmap silent Up gk echo Up/Down for long lines = new(screen lines) let s:UpDownLongLines=1 else nunmap Down nunmap Up let s:UpDownLongLines=0 echo Up/Down for long lines = vi standard endif endfunction map F3 :call ToggleLongLinesUpDown() cr Yakov
Re: Motion for Cammel Notation
On 7/3/06, Giorgos Gaganis [EMAIL PROTECTED] wrote: Tim Chase wrote: I would particularly want to use it with the 'c' command. [cut] I'm using c quite often. I wouldn't remap it ;) I think the OP wants an (in vim nomenclature) operator pending mode mapping, so that it can be used *with* the c command, rather than *instead* of the c command. :onoremap /\ucr :onoremap lt ?\ucr This pair of mappings will allow one to do c or c Thank you very much for your answers. What Tim suggested is doing the job with the following modification :onoremap u /\u\\|\Wcr the above works like 'cw' but also stops on uppercase letters. Although it does the job there is a really annoying side-effect. Because it uses a search all uppercase and nonword chars are highlighted which makes the screen practically unreadable. Preserving search pattern will resolve the side-effect you mention. The following works for me: function! U() let x=@/ /\u\|\W let @/=x endfun :onoremap u :call U()cr I tried to make this into one-liner but failed. Multiple commands on the rhs of omap didn't work for me, so I packaged rhs as a function. Yakov
[OSX issue?] Re: Backups
set backup set backupdir=~/.vim/backup set dir=~/.vim/temp Configuration for savevers.vim http://www.vim.org/scripts/script.php?script_id=89 set patchmode=.prev let savevers_types=* let savevers_max=10 let savevers_purge=1 let savevers_dir=backupdir That is my config...and it doesn't work. It should dump them all in the backupidr but instead they show up in my home dir. I am on OSX. I have tried a full path /Users/robert/.vim/backup but that doesn't work either. :Robert
Re: [OSX issue?] Re: Backups
Robert Hicks wrote: set backup set backupdir=~/.vim/backup set dir=~/.vim/temp Configuration for savevers.vim http://www.vim.org/scripts/script.php?script_id=89 set patchmode=.prev let savevers_types=* let savevers_max=10 let savevers_purge=1 let savevers_dir=backupdir That is my config...and it doesn't work. It should dump them all in the backupidr but instead they show up in my home dir. I am on OSX. I have tried a full path /Users/robert/.vim/backup but that doesn't work either. :Robert Found it looking at my post...dirs...not dir.
Re: [OSX issue?] Re: Backups
On 7/4/06, Robert Hicks [EMAIL PROTECTED] wrote: set backup set backupdir=~/.vim/backup set dir=~/.vim/temp Configuration for savevers.vim http://www.vim.org/scripts/script.php?script_id=89 set patchmode=.prev let savevers_types=* let savevers_max=10 let savevers_purge=1 let savevers_dir=backupdir I think it's spelled savevers_dirs not savevers_dir. At least such (savevers_dirs) it's spelled in my config. That is my config...and it doesn't work. It should dump them all in the backupidr but instead they show up in my home dir. Yakov
[[ equivalent for fortran90
In C programming, I can do [[ inside a function to go to the begining of the function (actually to the begining { ). Is there any clever way to extend this to fortran 90 programming as well? In fortran90 programs, the equivalent of C's functions are of the form subroutine name ... end subroutine name function name ... end function name The main obstacle is that there are no {, } which start and end the functions as in C. In this case, how can I go from the middle of a function to the start of a function? Similarly, how can I go from the middle of a function to the end of the function, jump between functions etc.? thanks raju -- http://kamaraju.googlepages.com/cornell-bazaar http://groups.google.com/group/cornell-bazaar/about
Re: [[ equivalent for fortran90
On 7/4/06, Kamaraju Kusumanchi [EMAIL PROTECTED] wrote: In C programming, I can do [[ inside a function to go to the begining of the function (actually to the begining { ). Is there any clever way to extend this to fortran 90 programming as well? In fortran90 programs, the equivalent of C's functions are of the form subroutine name ... end subroutine name function name ... end function name The main obstacle is that there are no {, } which start and end the functions as in C. In this case, how can I go from the middle of a function to the start of a function? Similarly, how can I go from the middle of a function to the end of the function, jump between functions etc.? How about map [[ ?^\s*\(function\|subroutine\)\cr -- untested Yakov
Re: Creating a backup directory
Tim Chase wrote: Is there a function to create a backup directory if there isn't one when Vim tries to backup a file? Well, you can use the following code: -- function! EnsureDirExists(d) let l:s = substitute(a:d, '[/\\]*$', '/', '') let l:isDir = isdirectory(resolve(expand(l:s))) if !l:isDir echo Making directoryl:s call system(mkdir .escape(s, )) let l:isDir = isdirectory(resolve(expand(l:s))) if !l:isDir echoerr Could not create directory: .l:s. (is it already a file? endif endif remove the following line to cut down on verbosity...more here for testing purposes. echo a:d. [.l:s.] was .(l:isDir?: not ).a directory endfunction test our function with various lines of data at the end of the file $?^finish$?+,$v/^\s*/call EnsureDirExists(getline('.')) finish tests go here a nonexistant directory ~/nonexistant a directory ~/tmp a directory with backslash ~/tmp/ a link to a directory ~/temp a link to a directory with backslash ~/temp/ same as above, only using $HOME instead of ~ for paths $HOME/nonexistant $HOME/tmp $HOME/tmp/ $HOME/temp $HOME/temp/ test a directory with a space in its name ~/tmp/foo bar test a directory with a space in its name and a backslash ~/tmp/foo bar/ test the root directory / test a blank line test a file ~/tmp/foo.txt -- The EnsureDirExists function will try its darndest to ensure that the directory passed to it exists, after which point, you can set your backupdir option. You might have to tweak the mkdir call to either use -p or whatever the win32 version is to make all components of a path if it's multiple levels deep. Just a few thoughts... Wow, cool. I really need to learn Vim more. :-) :Robert
For Vim + PHP users: regarding the PHP syntax
Greetings fellow PHP developers, You may not be aware that as of a month ago, I have taken up maintenance of the PHP syntax file for Vim, and the latest versions can be found here: http://www.vim.org/scripts/script.php?script_id=1571 Version 0.9 (the initial upload) is currently distributed with Vim. The newer versions (0.9.1 and 0.9.2) carry many more changes, but are still intended to be completely stable and ready for general use. Unfortunately progress has been halted temporarily as my motherboard at home just died, but I hope to resume work shortly. - If you have any thoughts on features you would like to see in the syntax, or if there are bugs you know about, you can email me directly at toomuchphp-vim at yahoo.com or else you can post to the vim mailing list with 'PHP' in the subject and my mail filter should bring it to my attention. Of course, if you post to the vim list, others will be able to read and comment on your ideas. Some things you might like to give me feedback regarding are: - Items in the TODO list (search for TODO inside the php.vim), is there anything you would like added? - Do the color selections work well with your colorscheme? - Do you have items in your own 'after/syntax/php.vim' or have you made modifications to your copy of the syntax file which you feel should be added to the official distribution? Thank you for your time and attention. regards, Peter toomuchphp-vim at yahoo.com Send instant messages to your online friends http://au.messenger.yahoo.com
how to
Recently, I need the following abbreviation: iabbr method method name= /method But it can not be executed successfully because I think vim consider method as a buffer like option. I go over vim's online help, but found nothing about how to escape this. Any comment will be appreciated! Thanks. BR Vincent -- The tool that save the most labor in a programming project is probably a text-editing system -- The Mythical Man-Month Try to make life easier ...