Key mapping on , and . with CTRL
Hi, Vimmers, Is there any way to map the comma and period with CTRL such as: map C-, :foo map C-. :foo It seems the , and . cannot be used here directly. How can I do in this case? Another question is how I can check all of the current key mappings in VIM? I remembered I saw something about it before, but failed to find it out. Thanks, -- Best, Zhaojun
Re: Key mapping on , and . with CTRL
Another question is how I can check all of the current key mappings in VIM? I remembered I saw something about it before, but failed to find it out. try :map hth, ymc
Re: Key mapping on , and . with CTRL
Hello, I think it depends on what your terminal can understand. One way you can find it out is to type ':map ' (using command mode), then press CTRL-V and then the key sequence you want to map. For example, to map CTRL-L you could use ':map CTRL-VCTRL-L'. regards, Peter --- Zhaojun WU [EMAIL PROTECTED] wrote: Hi, Vimmers, Is there any way to map the comma and period with CTRL such as: map C-, :foo map C-. :foo It seems the , and . cannot be used here directly. How can I do in this case? Another question is how I can check all of the current key mappings in VIM? I remembered I saw something about it before, but failed to find it out. Thanks, -- Best, Zhaojun Send instant messages to your online friends http://au.messenger.yahoo.com
Re: Key mapping on , and . with CTRL
You might also want to see the conversation earlier this week about which Control-keys are considered cross-platform. I think it was C-@ and C-A through C-Z, and the rest are not guaranteed to work on all systems. -Dmitriy On 10/27/06, Peter Hodge [EMAIL PROTECTED] wrote: Hello, I think it depends on what your terminal can understand. One way you can find it out is to type ':map ' (using command mode), then press CTRL-V and then the key sequence you want to map. For example, to map CTRL-L you could use ':map CTRL-VCTRL-L'. regards, Peter --- Zhaojun WU [EMAIL PROTECTED] wrote: Hi, Vimmers, Is there any way to map the comma and period with CTRL such as: map C-, :foo map C-. :foo It seems the , and . cannot be used here directly. How can I do in this case? Another question is how I can check all of the current key mappings in VIM? I remembered I saw something about it before, but failed to find it out. Thanks, -- Best, Zhaojun Send instant messages to your online friends http://au.messenger.yahoo.com
RE: gf question
On Thu, 26 Oct 2006, Max Dyckhoff wrote: set isfname-== On Thu, 26 Oct 2006, Russell Bateman wrote: progname=/usr/local/txserver OK both worked. Thanks. I found from the help that visually selecting and then doing gf also works thought it's a bit cumbersome. Wrapping the RHS with seems a better style. Most of the existing shell scripts (supplied by vendors) don't seem to honor that. Thanks Ben K. Developer http://benix.tamu.edu
Re: about fonts : from ubuntu to windows
- Original Message From: victor NOAGBODJI [EMAIL PROTECTED] To: vim@vim.org Sent: Friday, October 27, 2006 2:06:56 PM Subject: about fonts : from ubuntu to windows Hello all, I'm quite a newbie to Vim. I've been using it under ubuntu dapper. With moria color plugin, the font was nice, easy to read. I think it's the default system font of ubuntu or something... Now under windows xp. It's bold, hard to read. It's the default system font. Now how can I change that to a nice clean, easy to read font? thanks I like Bitstream Vera Sans Mono (use :set guifont=Bitstream_Vera_Sans_Mono:h14:cANSI) you can download the font at http://www.bitstream.com/font_rendering/products/dev_fonts/vera.html hth, John -- Sane sicut lux seipsam, tenebras manifestat, sic veritas norma sui, falsi est. -- Spinoza
RE: about fonts : from ubuntu to windows
-Original Message- From: John Degen [mailto:[EMAIL PROTECTED] Sent: Friday, October 27, 2006 9:25 AM To: victor NOAGBODJI; vim@vim.org Subject: Re: about fonts : from ubuntu to windows - Original Message From: victor NOAGBODJI [EMAIL PROTECTED] To: vim@vim.org Sent: Friday, October 27, 2006 2:06:56 PM Subject: about fonts : from ubuntu to windows Hello all, I'm quite a newbie to Vim. I've been using it under ubuntu dapper. With moria color plugin, the font was nice, easy to read. I think it's the default system font of ubuntu or something... Now under windows xp. It's bold, hard to read. It's the default system font. Now how can I change that to a nice clean, easy to read font? thanks I like Bitstream Vera Sans Mono (use :set guifont=Bitstream_Vera_Sans_Mono:h14:cANSI) you can download the font at http://www.bitstream.com/font_rendering/products/dev_fonts/vera.html I add the following to my vimrc file: Change default FONT Set personal font, here is a review of different ones: http://www.kuro5hin.org/story/2004/12/6/11739/5249 Bitstream Vera Fonts, downloaded from: http://www.gnome.org/fonts/ if has('win32') if filereadable(expand('$SystemRoot').'/fonts/Vera.ttf') For normal 11 point font set guifont=Bitstream_Vera_Sans_Mono:h11:cANSI For bold 11 point font set guifont=Bitstream_Vera_Sans_Mono:h11:b:cANSI elseif filereadable(expand('$SystemRoot').'/fonts/Raize.fon') Raize (12 pt bold) set guifont=Raize:h12:b:cANSI endif endif Since I have many machines I use my same installation of Vim on, not all of them have the fonts I want. This will only set the font if it exists on the machine, plus a second favourite (Raize). Does anyone know how to do the same thing in Ubuntu (or *nix in general)? I am not sure where the fonts get stored on a *nix system. Dave
Re: about fonts : from ubuntu to windows
- Original Message From: victor NOAGBODJI [EMAIL PROTECTED] To: vim@vim.org Sent: Friday, October 27, 2006 2:06:56 PM Subject: about fonts : from ubuntu to windows Hello all, I'm quite a newbie to Vim. I've been using it under ubuntu dapper. With moria color plugin, the font was nice, easy to read. I think it's the default system font of ubuntu or something... Now under windows xp. It's bold, hard to read. It's the default system font. Now how can I change that to a nice clean, easy to read font? thanks Sorry link should read: http://ftp.gnome.org/pub/GNOME/sources/ttf-bitstream-vera/1.10/ :) John -- Sane sicut lux seipsam, tenebras manifestat, sic veritas norma sui, falsi est. -- Spinoza
Re: Metaprogramming, mixed languages, and Vim.
On Thu, 26 Oct 2006, A.J.Mechelynck wrote: Hugh Sasse wrote: On Thu, 26 Oct 2006, A. S. Budden wrote: perl scripts embedded in a single Matlab script. I have done similar things for C and others. Well, in my .vimrc I now have: To MetaProgram C using Ruby function RubyMetaC() :unlet! b:current_syntax :syntax include @CSTUFF syntax/c.vim Method I. syntax include @CSTUFF $VIMRUNTIME/syntax/c.vim This doesn't pick any local additions to C syntax, nor does it pick the local syntax script if you've completely replaced the default C syntax script by something else placed earllier in 'runtimepath'. Method II: if you want to search all 'vimruntime' directories if has(unix) silent! syn include @CSTUFF ~/.vim/syntax/c.vim else silent! syn include @CSTUFF ~/vimfiles/syntax/c.vim endif silent! syn include @CSTUFF $VIM/vimfiles/syntax/c.vim syn include @CSTUFF $VIMRUNTIME/syntax/c.vim silent! syn include @CSTUFF $VIM/vimfiles/after/syntax/c.vim if has(unix) silent! syn include @CSTUFF ~/.vim/after/syntax/c.vim else silent! syn include @CSTUFF ~/vimfiles/after/syntax/c.vim endif Method III (recommended): include into your @CSTUFF cluster a file containing only the single line runtime! syntax/c.vim This would be equivalent (with fewer keystrokes) to Method II above. So all these will solve the my C syntax just looks white problem? :syntax region rubyC1 matchgroup=String start=+%Q{+ end=+}+ keepend [EMAIL PROTECTED] :syntax region rubyC2 matchgroup=String start=+%Q(+ end=+)+ keepend [EMAIL PROTECTED] :syntax region rubyC3 matchgroup=String start=+%Q+ end=++ keepend [EMAIL PROTECTED] :syntax on endfunction [...] I saw in the tip#856 (earlier in the thread) the use of :hi-link, but can't figure out what to link it to so that it picks up all C code as C. Hope that is of some interest, Al Thank you Hugh You can probably leave the C highlight groups alone. If you were creating a so I don't need hi-link. OK. I'll try those out new language, let's say foobar, you would define a number of syntax groups for your language, all of them with camel-case names starting foobar, and then use hi default link foobarFunction Function hi default link foobarIdentifier Identifier hi default link foobarComment Comment etc. Thank you. Best regards, Tony. Hugh
Re: about fonts : from ubuntu to windows
Thanks a lot for helping.
Smart use of Tab
Dear all, I've recently started using the CleverTab function below, modified from the bottom of the comments page on tip 102. This is brilliant from my point of view: - tab produces tabs at the start of the line for indenting*; - tab shows the longest unique option in the omnicomplete list when using omnicompletion; - tab cycles through the list of completions if the popup menu is visible but omnicompletion isn't used; - otherwise, it returns a tab. What I'd like to do is change the last one of those so that it puts in enough spaces to reach the next tabstop so that good formatting is maintained regardless of the tabstop setting on a users editor. However, I can't figure out how to achieve this. The 'expandtab' option is no use as it will change the tabs at the start of the line (used for indentation) to spaces, which will result in a really badly formatted piece of source code (as it is edited by several people who all like different tab stops)*. Similarly, replacing \Tab in the last return line with is no use as it will always insert four spaces, even if we're halfway through a tab stop (it's also not very flexible for different tabstop settings). Can anyone offer any suggestions for this? Cheers, Al function! CleverTab() If we've only had spaces/tabs thus far, add a tab if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$' return \Tab If we're omnifuncing, act on it elseif exists('omnifunc') omnifunc != '' return \C-X\C-O elseif pumvisible() return \C-N else This should ideally be 'spaced tab' return \Tab endif endfunction * If anyone wants to try to preach about the soft tabs vs. hard tabs, please do it elsewhere. Having worked on a lot of collaborative projects, I have found that, for me, hard tabs for indentation and soft ones elsewhere is by far the best way of maintaining consistent and neat code. If you disagree, that's fine by me, to each their own, but please keep it to yourself and spare us all the pointless rants.
Re: Key mapping on , and . with CTRL
Hi, Dmitriy, Peter, and YMC, Thanks a ton. :) Zhaojun On 10/27/06, Dmitriy Yamkovoy [EMAIL PROTECTED] wrote: You might also want to see the conversation earlier this week about which Control-keys are considered cross-platform. I think it was C-@ and C-A through C-Z, and the rest are not guaranteed to work on all systems. -Dmitriy On 10/27/06, Peter Hodge [EMAIL PROTECTED] wrote: Hello, I think it depends on what your terminal can understand. One way you can find it out is to type ':map ' (using command mode), then press CTRL-V and then the key sequence you want to map. For example, to map CTRL-L you could use ':map CTRL-VCTRL-L'. regards, Peter --- Zhaojun WU [EMAIL PROTECTED] wrote: Hi, Vimmers, Is there any way to map the comma and period with CTRL such as: map C-, :foo map C-. :foo It seems the , and . cannot be used here directly. How can I do in this case? Another question is how I can check all of the current key mappings in VIM? I remembered I saw something about it before, but failed to find it out. Thanks, -- Best, Zhaojun Send instant messages to your online friends http://au.messenger.yahoo.com
Re: Smart use of Tab
On Fri, Oct 27, 2006 at 04:46:02PM +0100, A. S. Budden wrote: Dear all, I've recently started using the CleverTab function below, modified from the bottom of the comments page on tip 102. This is brilliant from my point of view: - tab produces tabs at the start of the line for indenting*; - tab shows the longest unique option in the omnicomplete list when using omnicompletion; - tab cycles through the list of completions if the popup menu is visible but omnicompletion isn't used; - otherwise, it returns a tab. What I'd like to do is change the last one of those so that it puts in enough spaces to reach the next tabstop so that good formatting is maintained regardless of the tabstop setting on a users editor. However, I can't figure out how to achieve this. The 'expandtab' option is no use as it will change the tabs at the start of the line (used for indentation) to spaces, which will result in a really badly formatted piece of source code (as it is edited by several people who all like different tab stops)*. Similarly, replacing \Tab in the last return line with is no use as it will always insert four spaces, even if we're halfway through a tab stop (it's also not very flexible for different tabstop settings). Can anyone offer any suggestions for this? [snip] The 'expandtab' option does not affect existing tabs in the file (unless you :retab) so it should be safe to have your function reset/set it depending on whether you are at the start of the line or not. I have not tested this. For another approach, pretty much what you suggested, look at the VarTab() function in foo.vim, my file of example vim functions: http://www.vim.org/script.php?script_id=72 This function returns a calculated number of spaces, and it should be pretty easy to use the same idea for your function. (It just takes a little :while loop.) HTH --Benji Fisher
tags with abc::efg?
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. Everyone is raving about the all-new Yahoo! Mail (http://advision.webevents.yahoo.com/mailbeta/)
Re: Metaprogramming, mixed languages, and Vim.
Hugh Sasse wrote: On Thu, 26 Oct 2006, A.J.Mechelynck wrote: [...] Method III (recommended): include into your @CSTUFF cluster a file containing only the single line runtime! syntax/c.vim This would be equivalent (with fewer keystrokes) to Method II above. So all these will solve the my C syntax just looks white problem? [...] I think so. If it doesn't, then I goofed again and you'll have to fall back on Method II. Best regards, Tony.
Re: about fonts : from ubuntu to windows
victor NOAGBODJI wrote: Hello all, I'm quite a newbie to Vim. I've been using it under ubuntu dapper. With moria color plugin, the font was nice, easy to read. I think it's the default system font of ubuntu or something... Now under windows xp. It's bold, hard to read. It's the default system font. Now how can I change that to a nice clean, easy to read font? thanks Set the 'guifont' option. What to set it to will depend on which language you are using. For Latin alphabet on Windows I recommend Lucida_Console; however it has no Arabic glyphs and its Cyrillic glyphs are not 100% fixed-width so for Russian and Arabic I fall back on Courier_New, which is less elegant but quite readable and supports many non-Latin alphabetic languages. For CJK (Chinese-Japanese-Korean) I use MingLiU but there are others. For example, for Latin alphabet I might use :set guifont=Lucida_Console:h10:cDEFAULT To see a fonts menu in gvim for Windows (and also in some but not all other flavours of gvim), use :set guifont=*. If you want to slightly adjust what is already set, you can use :set guifont=Tab where Tab means hit the Tab key. This method can be used in 'nocompatible' mode with any non-boolean option. It will fill-in the current value on your command-line, with escaping slashes if needed, and you can edit it in-place, then accept the changes with Enter or discard the changes with Esc. Or once you have exactly what you want, :set guifont=Tab will display on the command-line exactly what you need to write into your vimrc or gvimrc in order to set it that way every time. Notes: 1. After using the guifont=* menu, the language setting is IMHO usually too strict; in my experience it works best by replacing :cANSI, :cBALTIC or whatever by just :cDEFAULT which lets gvim choose the appropriate glyphs (in the various language variants of that same font) for any language you might be using. 2. The line :set guifont=something should either go in your gvimrc, or, if you put it in your vimrc, be bracketed by if has('gui_running'). Otherwise that line would give you an error if you were to run the console version of Vim, which doesn't know about 'guifont'. Best regards, Tony.
Re: tags with abc::efg?
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.
Re: tags with abc::efg?
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)