Re: cannot create diffs
Hi John, thanks for the reply. I have tried your suggestion, and I get the same output from both accounts: :function MyDiff2 function MyDiff2() 1 call input(MyDiff2 called) endfunction I should have said I was using vim on VMS, which is probably not what most of you are using. Unfortunately, I have no other multi-user environment where I could try the same thing with another vim build (win, unix). I think I will now turn to the vim-vms discussion list. Is there no other way to look under the hood? What does vim do between :windo:difft and calling 'diffexpr' for the first window? Thanks, Sam On Jan 10, 12:07 am, John Beckett johnb.beck...@gmail.com wrote: Samuel Ferencik wrote: In both accounts, I see the following: :set diffexpr? diffexpr=MyDiff2() :call MyDiff2() MyDiff2 called (I press CR) You seem to have proved that what you're seeing is impossible, so I would do one more sanity check. For both accounts: :set diffexpr? :function MyDiff2 Does B have exactly what you posted: function! MyDiff2() call input(MyDiff2 called) endfunction John --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
enable options based on variables
hi, i use vim both at work and at home so i share configuration files between them. is there any way to enable some options based on the value of global variable? i.e. athome=1 if (athome=1) set cursorline else set nocursorline or if (athome=1) let g:LookupFile_DefaultCmd = ':LUTags' else let g:LookupFile_DefaultCmd = ':LUWalk' the posted examples are pointless, but i hope you get the idea! thanks in advance for your time, -nikolas --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: cannot create diffs
On 12/01/09 09:56, Samuel Ferencik wrote: Hi John, thanks for the reply. I have tried your suggestion, and I get the same output from both accounts: :function MyDiff2 function MyDiff2() 1 call input(MyDiff2 called) endfunction I should have said I was using vim on VMS, which is probably not what most of you are using. Unfortunately, I have no other multi-user environment where I could try the same thing with another vim build (win, unix). I think I will now turn to the vim-vms discussion list. Is there no other way to look under the hood? What does vim do between :windo:difft and calling 'diffexpr' for the first window? Thanks, Sam Have you tried setting 'diffexpr' to the empty string (for instance by running vim -N -u NONE)? And if you have, did it work? Best regards, Tony. -- It's a good thing we don't get all the government we pay for. --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: enable options based on variables
On 12/01/09 10:10, Nicolas Aggelidis wrote: hi, i use vim both at work and at home so i share configuration files between them. is there any way to enable some options based on the value of global variable? i.e. athome=1 if (athome=1) set cursorline else set nocursorline or if (athome=1) let g:LookupFile_DefaultCmd = ':LUTags' else let g:LookupFile_DefaultCmd = ':LUWalk' the posted examples are pointless, but i hope you get the idea! thanks in advance for your time, -nikolas Why not? You could even check some environment variable if you know one which is set to a different value (or if you set one differently) on both systems: if $FOOBAR == '' set cursorline endif You could also set some setting differently on Windows or unix: if has('unix') language messages C else language messages en endif and so on. Best regards, Tony. -- BLACK KNIGHT: Come on you pansy! [hah] [parry thrust] [ARTHUR chops the BLACK KNIGHT's right arm off] ARTHUR:Victory is mine! [kneeling] We thank thee Lord, that in thy merc- [Black Knight kicks Arthur in the head while he is praying] The Quest for the Holy Grail (Monty Python) --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: cannot create diffs
Hello, I have now found the problem. I looked in the source code, and found that ex_diffupdate() writes temporary files into $TMP/... Well, my $TMP (in both A and B accounts) points to a directory in the A account, and this directory was only writable by A, so vim running under B could not create the temp files. (I don't even remember why I had $TMP defined in the first place; if it is unset, diffing works.) Thank you both for your suggestions. Sam On Jan 12, 10:25 am, Tony Mechelynck antoine.mechely...@gmail.com wrote: On 12/01/09 09:56, Samuel Ferencik wrote: Hi John, thanks for the reply. I have tried your suggestion, and I get the same output from both accounts: :function MyDiff2 function MyDiff2() 1 call input(MyDiff2 called) endfunction I should have said I was using vim on VMS, which is probably not what most of you are using. Unfortunately, I have no other multi-user environment where I could try the same thing with another vim build (win, unix). I think I will now turn to the vim-vms discussion list. Is there no other way to look under the hood? What does vim do between :windo:difft and calling 'diffexpr' for the first window? Thanks, Sam Have you tried setting 'diffexpr' to the empty string (for instance by running vim -N -u NONE)? And if you have, did it work? Best regards, Tony. -- It's a good thing we don't get all the government we pay for. --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: enable options based on variables
Nicolas Aggelidis (2009-01-12 11:10 +0200) wrote: hi, i use vim both at work and at home so i share configuration files between them. is there any way to enable some options based on the value of global variable? You can detect the system with hostname() function, like this: if hostname() == 'myhomebox' call do_this() else call do_that() endif --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Starting command from vim
Hi all, after searching for a while I couldn't find an exact solution for my problem. Therefore I ask here and hope not to bother. I have a textfile with several shell statements. I want to be able to visually mark one of them and to execute the marked one in an external shell. The output of this command should go to a new vim window (e.g. split one). Is this possible? When yes, how? Best regards Andreas --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Only slightly OT: Satire on mouse users
I think every vi/vim fan should see this satire on the steady progress of computer interfaces toward serving only the illiterate: http://feeds.theonion.com/~r/OnionNewsNetwork/~3/503805247/92328 Less and less people today realize that the keyboard (which I met on typewriters in the 60's) is one of the greatest inventions in history and even fewer know about the vi paradigm which makes such efficient use of this tool. Ephraim --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: Starting command from vim
Hi Tim, Tim Chase schrieb: Shooting from the hip (meaning the below is untested), I'd do something like For shooting from the hip you did hit the target... ;-) :nnoremap f4 yyc-wnP:%!shcr :vnoremap f4 yc-wnP:%!shcr I was so fixed on first executing and then opening a window that I didn't realized that the whole thing vice versa does it. Thank you for opening my mind. The only side-effect is that your scratch-register (@) and your yank-register (@0) get replaced with your command to be executed. It's a kind of excercise to enable the whole thing with a rarly used register. :-) Best regards Andreas --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Intellisense in conflict with omnicpp
Hi, I would like to view diff between intellisense and omnicpp but it seems there is conflict. I used omnicpp normally, I decided to install intellisense last release, I have followed the setup instructions but C-SPACE-a for c++ completion does not work. The menu of intellisense appears correctly and my include directories seem good. No error at start of gvim. Thanks for help Epanda --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: Limit line width
When I use vim to code C/C++ or Python, I like to has each line never longer than 79 columns. Is there a easy way that vim can help? Is there some aspect that isn't solved by using :set tw=79 that you need additional functionality? There are some things that can override this setting (such as intentionally joining lines to result in a 79 line). However, you can use gq with a motion/text-object to reformat such lines. For more help: :help 'textwidth' :he gq -tim --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: How to save/restore the hightlight for cursor?
On 12/01/09 13:44, Yue Wu wrote: As title, I want to change the setting of highlight for cursor, then restore it back. The following is untested. It requires Vim version 7. function SaveCursorColor() redir = highlight silent hi Cursor redir END if highlight =~ 'links to ' let s:hl-link = matchstr(highlight, 'links to \zs\S*') elseif highlight =~ '\cleared\' let s:hl-link = 'NONE' else let s:hl-link = '' for substr in ['term', 'cterm', 'ctermfg', 'ctermbg', \ 'gui', 'guifg', 'guibg', 'guisp'] if highlight =~ substr . '=' let s:hl-{substr} = matchstr(highlight, \ substr . '=\S*') else let s:hl-{substr} = '' endif endfor endif endfunction function RestoreCursorColor() if !exists('s:hl-link') echoerr 'Cursor not saved, cannot restore' return endif hi clear Cursor if s:hl-link == '' exe 'hi Cursor' s:hl-term s:hl-cterm s:hl-ctermfg \ s:hl-ctermbg s:hl-gui s:hl-guifg s:hl-guibg \ s:hl-guisp elseif hl-link != 'NONE' exe 'hi link Cursor' s:hl-link endif endfunction Best regards, Tony. -- Consequences, Schmonsequences, as long as I'm rich. -- Ali Baba Bunny [1957, Chuck Jones] --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: How to save/restore the hightlight for cursor?
On Mon, 12 Jan 2009 22:10:06 +0800, Tony Mechelynck antoine.mechely...@gmail.com wrote: function SaveCursorColor() redir = highlight silent hi Cursor redir END if highlight =~ 'links to ' let s:hl-link = matchstr(highlight, 'links to \zs\S*') elseif highlight =~ '\cleared\' let s:hl-link = 'NONE' else let s:hl-link = '' for substr in ['term', 'cterm', 'ctermfg', 'ctermbg', \ 'gui', 'guifg', 'guibg', 'guisp'] if highlight =~ substr . '=' let s:hl-{substr} = matchstr(highlight, \ substr . '=\S*') else let s:hl-{substr} = '' endif endfor endif endfunction function RestoreCursorColor() if !exists('s:hl-link') echoerr 'Cursor not saved, cannot restore' return endif hi clear Cursor if s:hl-link == '' exe 'hi Cursor' s:hl-term s:hl-cterm s:hl-ctermfg \ s:hl-ctermbg s:hl-gui s:hl-guifg s:hl-guibg \ s:hl-guisp elseif hl-link != 'NONE' exe 'hi link Cursor' s:hl-link endif endfunction It's too complicated, if I want to save/restore highlight for others, it would need a big change. No other simple and generic way? -- Regards, Van. --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
very slow for xml
When vim open a file and detect its filetype as xml. Vim become very sluggish even for moving cursor. It only become normal after set ft to empty. geany (another linux editor) does not have this problem for xml. I attached a very small xml file for test. -- regards, GPG key 1024D/4434BAB3 2008-08-24 gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 唐詩217 李商隱 無題二首之一 鳳尾香羅薄幾重 碧文圓頂夜深縫 扇裁月魄羞難掩 車走雷聲語未通 曾是寂寥金燼暗 斷無消息石榴紅 斑騅只繫垂楊岸 何處西南任好風 --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~--- ?xml version=1.0 encoding=UTF-8? !DOCTYPE abiword PUBLIC -//ABISOURCE//DTD AWML 1.0 Strict//EN http://www.abisource.com/awml.dtd; abiword template=false styles=unlocked xmlns:fo=http://www.w3.org/1999/XSL/Format; xmlns:math=http://www.w3.org/1998/Math/MathML; xid-max=8 xmlns:dc=http://purl.org/dc/elements/1.1/; fileformat=1.0 xmlns:svg=http://www.w3.org/2000/svg; xmlns:awml=http://www.abisource.com/awml.dtd; xmlns=http://www.abisource.com/awml.dtd; xmlns:xlink=http://www.w3.org/1999/xlink; version=0.99.2 xml:space=preserve props=dom-dir:ltr; document-footnote-restart-section:0; document-endnote-type:numeric; document-endnote-place-enddoc:1; document-endnote-initial:1; lang:en-US; document-endnote-restart-section:0; document-footnote-restart-page:0; document-footnote-type:numeric; document-footnote-initial:1; document-endnote-place-endsection:0 !-- -- !-- This file is an AbiWord document. -- !-- AbiWord is a free, Open Source word processor. -- !-- More information about AbiWord is available at http://www.abisource.com/ -- !-- You should not edit this file by hand. -- !-- -- metadata m key=dc.formatapplication/x-abiword/m m key=abiword.generatorAbiWord/m /metadata history version=1 edit-time=143 last-saved=1231769748 uid=2d158826-e0b3-11dd-8496-ceb035156980 version id=1 started=1231769748 uid=82506298-e0b3-11dd-8496-ceb035156980 auto=0 top-xid=8/ /history styles s type=P name=Normal followedby=Current Settings props=font-family:Times New Roman; margin-top:0pt; color:00; margin-left:0pt; text-position:normal; widows:2; font-style:normal; text-indent:0in; font-variant:normal; font-weight:normal; margin-right:0pt; font-size:12pt; text-decoration:none; margin-bottom:0pt; line-height:1.0; bgcolor:transparent; text-align:left; font-stretch:normal/ s type=C name=Reference props=font-size:10pt/ /styles pagesize pagetype=Letter orientation=portrait width=8.50 height=11.00 units=in page-scale=1.00/ section xid=7 props=page-margin-footer:0.5in; page-margin-header:0.5in p style=Normal xid=8c props=font-family:華康標準宋體test test test/cc props=font-family:華康標準宋體; font-size:12pt; color:00; text-decoration:none; text-position:normal; font-weight:normal; font-style:normal; lang:en-UStest test test/c/p p style=Normal xid=1c/cfoo barc props=font-family:Times New Roman; font-size:12pt; color:00; text-decoration:none; text-position:normal; font-weight:normal; font-style:normal; lang:en-USfoo barfoo barfoo barfoo barfoo barfoo barfoo barfoo barfoo /c/p p style=Normal xid=2 props=font-family:華康標準宋體; font-size:12pt; color:00; text-decoration:none; text-position:normal; font-weight:normal; font-style:normalc props=font-family:華康標準宋體; font-size:12pt; color:00; text-decoration:none; text-position:normal; font-weight:normal; font-style:normal; lang:en-UStest test testtest test test/c/p p style=Normal xid=3 props=font-family:華康標準宋體; dom-dir:ltr; margin-bottom:0.in; margin-left:0.in; lang:en-US; text-position:normal; font-weight:normal; text-decoration:none; line-height:1.00; font-style:normal; margin-top:0.in; margin-right:0.in; color:00; text-align:left; text-indent:0.in; font-size:12ptc props=font-family:Times New Roman; font-size:12pt; lang:en-US; text-position:normal; font-weight:normal; font-style:normal; text-decoration:nonefoo barfoo barfoo barfoo barfoo barfoo barfoo barfoo barfoo barfoo /cbr/c props=font-family:華康標準宋體; font-size:12pt; color:00; text-decoration:none; text-position:normal; font-weight:normal; font-style:normal; lang:en-UStest test testtest test test/c/p p style=Normal xid=4 props=font-family:Times New Roman; dom-dir:ltr; font-style:normal; margin-left:0.in; lang:en-US; margin-bottom:0.in; text-indent:0.in; text-position:normal; margin-top:0.in; font-weight:normal; margin-right:0.in; text-decoration:none; text-align:left; line-height:1.00; font-size:12ptc props=font-family:Times New Roman; font-size:12pt; lang:en-US;
unsubscribe
unsubscribe --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: How to save/restore the hightlight for cursor?
On Mon, 12 Jan 2009 22:30:43 +0800, Tony Mechelynck antoine.mechely...@gmail.com wrote: On 12/01/09 15:14, Yue Wu wrote: It's too complicated, if I want to save/restore highlight for others, it would need a big change. No other simple and generic way? Tell you users to do :hi Cursor, write down the result, and restore it by hand when needed. Thank you. you make me know there isn't a shortcut for it :) -- Regards, Van. --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: Limit line width
On Mon, Jan 12, 2009 at 9:20 PM, Tim Chase v...@tim.thechases.com wrote: When I use vim to code C/C++ or Python, I like to has each line never longer than 79 columns. Is there a easy way that vim can help? Is there some aspect that isn't solved by using :set tw=79 Hi, 'set tw' don't prevent too long lines from heppening. But I learned usage of 'gq' as you suggested, it can only fix too long line by splitting it. Is there any way better than this? What I expected is 1. When I go exceed 79 characters in a line, vim auto-wrap or auto-split for me ('gq' does a good job, but I hope it automatically done) 2. For an older source file, I hope I can reformat it easily by automatically splitting too long lines. The point 2 is optional I think, but the point 1 is important and most useful. Thanks for any inputs. --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: Unsubscribing the Mailinglist
On Mon, Jan 12, 2009 at 15:31, Bastian Bartels wrote: But how can I do it? :-) It's just there: http://www.vim.org/maillist.php You need to send a mail to vim-unsubscr...@vim.org --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: enable options based on variables
Hi, Nicolas Aggelidis wrote: but i still have one question: I want by default to use ttf-inconsolata fonts but if i haven't installed them on a system i want to go back on monospace. is there any way to do this within the vimrc? set guifont=monospace\ 14 if has(...) set guifont=Inconsolata\ 14 endif in other is it possible to check for the existence of a font from within vim? I don't think you can check wether a certain font is installed on your system, but you can just try to use it and catch the exception thrown by Vim if the font is not installed: try set guifont=Inconsolata\ 14 catch /^Vim\%((\a\+)\)\=:E596/ set guifont=monospace\ 14 endtry Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin) --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: enable options based on variables
On 12/01/09 15:50, Nicolas Aggelidis wrote: thank you all, you 've been really helpfull! now i do things like this: if !has(gui_running) colorscheme developer endif if has(gui_running) colorscheme desert endif if has('gui_running' colorscheme desert else colorscheme developer endif also i use bash-IDE script(in linux and bsd), i do something like this: set sh=/bin/bash if (g:freebsd == 1) set sh=/usr/local/bin/bash endif isn't your $SHELL environment variable set properly? Vim ought to set your 'shell' setting correctly by default. where g:freebsd is a variable that i declared... but i still have one question: I want by default to use ttf-inconsolata fonts but if i haven't installed them on a system i want to go back on monospace. is there any way to do this within the vimrc? set guifont=monospace\ 14 if has(...) set guifont=Inconsolata\ 14 endif in other is it possible to check for the existence of a font from within vim? if has('gui_gtk2') set gfn=Inconsolata\ 14,monospace\ 14 endif A comma-separated list can be used, the first (leftmost) one found will be used. Note that if you use the same vimrc in several versions of gvim you might have to set the 'guifont' to one of five incompatible versions depending on GUI flavour: see http://vim.wikia/org/wiki/Setting_the_font_in_the_GUI Best regards, Tony. -- The best cure for insomnia is to get a lot of sleep. -- W. C. Fields --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: very slow for xml
On Mon, Jan 12, 2009 at 10:25:50PM +0800, bill lam wrote: When vim open a file and detect its filetype as xml. Vim become very sluggish even for moving cursor. It only become normal after set ft to empty. geany (another linux editor) does not have this problem for xml. The XML file you attached has very long lines, which can slow down Vim's syntax highlighting. A workaround is to set synmaxcol to a nonzero value so that Vim doesn't attempt to highlight the entire line. The highlighting can get out of sync this way, however. -- Erik Falor Registered Linux User #445632 http://counter.li.org --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: How to save/restore the hightlight for cursor?
On 12/01/09 15:37, Yue Wu wrote: On Mon, 12 Jan 2009 22:30:43 +0800, Tony Mechelynck antoine.mechely...@gmail.com wrote: On 12/01/09 15:14, Yue Wu wrote: It's too complicated, if I want to save/restore highlight for others, it would need a big change. No other simple and generic way? Tell you users to do :hi Cursor, write down the result, and restore it by hand when needed. Thank you. you make me know there isn't a shortcut for it :) Excuse me if that last post sounded unusually flippant; I had spent quite some time to write two quite general functions to save and restore the Cursor highlight regardless of what it is set to, which can be easily adapted (with an argument to the function) to save any arbitrary highlight group, just to get the answer: That's too complicated. Well, here's how to make it easier: 1. Copy my functions to the clipboard and paste them into your vimrc, or into some plugin. 2. To save the cursor highlight group, use :call SaveCursorColor() 3. To restore it, use :call RestoreCursorColor. How simple do you want it to be? Best regards, Tony. -- -rwxr-xr-x 1 root 24 Oct 29 1929 /bin/ed -rwxr-xr-t 4 root 131720 Jan 1 1970 /usr/ucb/vi -rwxr-xr-x 1 root 5.89824e37 Oct 22 1990 /usr/bin/emacs --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
How to forward/backward to different marked positions(anchor) in vim?
Hi guys, I use vim to edit my PHP project, sometimes i need to jump to the declaration of functions and variables, or jump to many marked positions. Maybe only in one file, i forward to many position (anchor), is there any plugin, or any usefull vim script to easy forward/backword to the positions? If it support to jump to different file positions, that's good enough, The feature i want just like in Zend Studio, you can use Alt-,, Alt-. to forward/backward positions. I have tried cscope, ctags, but these still not work perfectly, and they dont save marks. Maybe i need to save the specific positions info, so i wrote a script, and it can jump from one file now. Below is part of my script, any errors, pls correct me:), and if you know any plugin, pls tell me, thanks. Mark Functions Start let g:globalFileSpace = {} let g:globalMarkList = ['a','b','c','d','e','f','g','h','i','j','k','l','n','o','p','q','r','s','t','u','v','w','x','y','z'] function! ResetGlobalFileMarkIndex() try let g:globalFileSpace[expand(%:p)]['index'] = 0 let g:globalFileSpace[expand(%:p)]['indexUsed'] = 0 exec :delmarks a-z catch /.*/ call InitFileMarkIndex() let g:globalFileSpace[expand(%:p)]['index'] = 0 let g:globalFileSpace[expand(%:p)]['indexUsed'] = 0 exec :delmarks a-z endtry endfunction function! ShowFileMarkInfo() try echo index = . g:globalFileSpace[expand(%:p)]['index'] echo indexUsed = . g:globalFileSpace[expand(%:p)] ['indexUsed'] catch /.*/ echo Not set global index endtry endfunction function! InitGlobalFileSpace() if !has_key(g:globalFileSpace,expand(%:p)) let g:globalFileSpace[expand(%:p)] = {} end endfunction function! InitFileMarkIndex() if !has_key(g:globalFileMarks,expand(%:p)) call InitGlobalFileSpace() end if !has_key(g:globalFileSpace[expand(%:p)],'index') let g:globalFileSpace[expand(%:p)]['index'] = 0 end if !has_key(g:globalFileSpace[expand(%:p)],'indexUsed') let g:globalFileSpace[expand(%:p)]['indexUsed'] = 0 end endfunction function! GetIndexMark(...) if !exists(a:1) echo Error: GetIndexMark need param1 return 0 end let index = a:1 if index0 || index24 return '' end try let mark = g:globalMarkList[index] return mark catch /.*/ echo Error: GetIndexMark() index Mark Not found. return '' endtry endfunction function! LoopGetIndexMark(...) @parm1 index @parm2 forward let index = a:1 if exists(a:2) let forword = a:2 else let forword = 1 end if forword let index = index + 1 else let index = index - 1 end if index24 let index = 0 end if index0 let index = 24 end let mark = get(g:globalMarkList,index,'') if strlen(mark) return [mark,index] else return ['',''] end endfunction function! GetFileMarkIndex(...) try let index = g:globalFileSpace[expand(%:p)]['index'] catch /.*/ call InitFileMarkIndex() let index = g:globalFileSpace[expand(%:p)]['index'] endtry return index endfunction function! SetFileMarkIndex(...) if !exists(a:1) echo error in setting used index. return end let index = a:1 try let g:globalFileSpace[expand(%:p)]['index'] = index catch /.*/ call InitFileMarkIndex() let g:globalFileSpace[expand(%:p)]['index'] = index endtry return 1 endfunction function! SetFileMarkUsedIndex(...) if !exists(a:1) echo error in setting used index. return end let index = a:1 try let index = a:1 let g:globalFileSpace[expand(%:p)]['indexUsed'] = index catch /.*/ call InitFileMarkIndex() let g:globalFileSpace[expand(%:p)]['indexUsed'] = index endtry return 1 endfunction function! GetFileMarkUsedIndex(...) try let index = g:globalFileSpace[expand(%:p)]['indexUsed'] catch /.*/ call InitFileMarkIndex() let index = g:globalFileSpace[expand(%:p)]['indexUsed'] endtry return index endfunction function! GetFileCurrentMark() let index = GetFileMarkIndex() return GetIndexMark(index) endfunction function! MarkChar(...) if !exists(a:1) echo Error param in Mark() return end let char = a:1 exec norm m . char endfunction function! GetOffsetMark(...) @param1: offset @parma2: start if !exists(a:1) echo Error: GotoIndexMark() need param1 offset return end let offset = a:1 if exists(a:2) let start = a:2 else let start = GetFileMarkIndex() end let index = start + offset let mark = GetIndexMark(index) let mycount=1 while !IsMarkExists(mark) mycount30 let ret = LoopGetIndexMark(index,(offset0))
RE: Rules for replying to posts on this list (Was: Easiest way to insert a blank line?)
Rather than optimising how people post, I would be happy simply to stop the recent flood of lazy top posting. I don't know how other mail clients behave when it comes to hiding various elements of messages, but for what it's worth: Wellp, in general, unless a top-posted post is something along the lines of Thanks! or That works great!, in which case I'd just delete it immediately, it'd be something I wouldn't want to read backwards or upside-down, in which case I'd *also* delete it immediately. Ditto for 4 video-pages of nonstop ''s, or what *appears* to be so but is in fact a line or two of actual reply but buried within with no blank lines to set them off. Or some cutesy html-formatted crap that makes real quoting difficult (blockquoted with indentation, left-border colored, etc.). Or worse, some B'harni-awful colorscheme like green-on-red, or *any* color on a blinding-white background. Make it hard for me to read, and I just won't read it. Simple. If enough people were to have their posts ignored if top-posted (or exhibiting any of the subsequent offenses), they might (eventually) be inclined to change. Simply rewarding bad behavior while complaining about it changes nothing. sigh --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
a pattern problem
how can i did this? i want match abcd which is not in quote. e.g: abcd //match abcd //mismatch \abcd //mismatch \ab abcd //match how can i did this? --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: enable options based on variables
On 1/12/09, Nicolas Aggelidis wrote: thank you all, you 've been really helpfull! now i do things like this: if !has(gui_running) colorscheme developer endif if has(gui_running) colorscheme desert endif If you haven't seen the CSApprox.vim plugin, you might like it. It should make the 'developer' colorscheme look almost the same in vim in an 88 or 256 color terminal as it looks in gvim. On quick glance, it seems to get just about everything the same for me except for line numbers. The color for line numbers isn't specified in the developer.vim colorscheme, so it falls through to the default colorscheme, where the color depends on the 'background' setting... Anyway, if you try it and run into any problems, feel free to ask me. ~Matt --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: How to save/restore the hightlight for cursor?
On 1/12/09, Yue Wu wrote: It's too complicated, if I want to save/restore highlight for others, it would need a big change. No other simple and generic way? Well, using synIDattr() you should be able to get all the information you need about any highlight group; which you can use to save it and restore it later. CSApprox can serve as an example of gathering that info (s:Highlights()). Though it never restores them it does use a dictionary with the same sort of structure as s:Highlights() returns to set colors later (s:SetCtermFromGui()). My way is even more complicated than Tony's, but is by necessity completely generic, and doesn't rely on :redir (which is very slow, and is non-trivial to parse). ~Matt --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: a pattern problem
* StarWing on Monday, January 12, 2009 at 09:01:32 -0800 how can i did this? i want match abcd which is not in quote. e.g: abcd //match abcd //mismatch \abcd //mismatch \ab abcd //match how can i did this? [^]abcd[^] which of course would also match abcde, so perhaps: [^]\abcd\[^] Depends what exactly you want, really. c -- \black\trash movie_C O W B O Y_ _C A N O E_ _C O M A_ Ein deutscher Western/A German Western -- http://www.blacktrash.org/underdogma/ccc.html -- http://www.blacktrash.org/underdogma/ccc-en.html --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: a pattern problem
StarWing schrieb: how can i did this? i want match abcd which is not in quote. e.g: abcd //match abcd //mismatch \abcd //mismatch \ab abcd //match how can i did this? /\v%(^[^]*%(%(%(\\.|[^\\])*)[^]*)*)@=abcd makes sure that 0 or more fully quoted parts do match from the start of the line up to the actual match for abcd in the same line. basically an even number of quotes is required left from abcd, but within a quoted part, escaped quotes (and other escaped chars) are skipped. :h pattern :h /\v ... -- Andy --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
RE: selecting and coping in 7.2
It seems it does not copies. ( I just discovered ' [shift] + [ins] ' to paste. Is there something similar to copy ? ) Aside from ^C (copy), ^X (cut), and ^V (paste), there be shift-insert (paste) as well as control-insert (copy) and control-delete (cut). Others will argue that it should be shift-delete for this or that, but I'm not getting dragged into that yet again. Find which ones work for you and enjoy. --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: a pattern problem
Hi, how can i did this? i want match abcd which is not in quote. e.g: abcd //match abcd //mismatch \abcd //mismatch \ab abcd //match how can i did this? use negative look-ahead and look-behind, something like: \(\)\@!abcd\(\)\...@! should work. [^]abcd[^] will not work if abcd stand at the beginning or end of a line. Kind regards Chris --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: selecting and coping in 7.2
On Jan 12, 12:30 pm, Gene Kwiecinski gkwiecin...@dclab.com wrote: It seems it does not copies. ( I just discovered ' [shift] + [ins] ' to paste. Is there something similar to copy ? ) Aside from ^C (copy), ^X (cut), and ^V (paste), there be shift-insert (paste) as well as control-insert (copy) and control-delete (cut). Others will argue that it should be shift-delete for this or that, but I'm not getting dragged into that yet again. Find which ones work for you and enjoy. Or try it the Vim way: Copy to clipboard: +y Paste from clipboard: +p Copy (for use only within Vim): y Paste (last text copied with just y): p This is an EXTREMELY simplified view. Read more at: :help y :help p :help registers :help quote+ and for that matter: :help d :help c and many, many other commands that use registers, with help locations around the same area as those already mentioned. Basically what the + notation does is tells Vim to use the system clipboard rather than the internal one for the next operation. --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: selecting and coping in 7.2
On 12 Gen, 19:30, Gene Kwiecinski gkwiecin...@dclab.com wrote: It seems it does not copies. ( I just discovered ' [shift] + [ins] ' to paste. Is there something similar to copy ? ) Aside from ^C (copy), ^X (cut), and ^V (paste), there be shift-insert (paste) as well as control-insert (copy) and control-delete (cut). Others will argue that it should be shift-delete for this or that, but I'm not getting dragged into that yet again. Find which ones work for you and enjoy. It does not work. As I select text in insert mode it does switch in (insert) VISUAL mode; and in command mode it does switch in VISUAL mode and in either it does not copy. Tried with ^C, control-insert but it does not copy text. To be clear I want to paste it somewhere ( in consolle prompt, in firefox, in mutt ) --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: selecting and coping in 7.2
On 12 Gen, 20:45, Ben Fritz fritzophre...@gmail.com wrote: Or try it the Vim way: Copy to clipboard: +y Paste from clipboard: +p it does not works either. I do explain. I open a file with vim, then I want copy text to paste eg. in firefox, as I select text ( in command mode ) it does go in --VISUAL -- mode, I press '+' and the cursor goes down one row, then I press 'y' and it come to command mode but it did not copied text to clipboard, infact pushing the central mouse wheel in firefox it paste nothing. Basically what the + notation does is tells Vim to use the system clipboard rather than the internal one for the next operation. Is it possible that I miss something in my .vimrc ? --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: fuzzyfinder plugin displays very lengthy absolute paths to matching files
I really like the fuzzyfinder plugin, but when my project is located within a mediumly deep directory structure, the matched pathnames that it displays in its dropdown are absolute, and hence too long to see what Johnathan, I added a kludge to fix this exact problem. I hope that the original author doesn't mind me posting this kludge. I've talked with the author, and he's really nice. In ~/.vim/plugin/fuzzyfinder.vim, make the s:FormatCompletionItem look like the function defined here: http://notesmine.com/fuzzy_finder_kludge Then, in your .vimrc, put this line: let g:fuzzy_root=getcwd() Now, let's say you have a project in projectA directory: /my/really/deep/directory/of/projects/projectA/myfile.txt /my/really/deep/directory/of/projects/projectA/src/foo.c If you CD to /my/really/deep/directory/of/projects/projectA, then open Vim using the commandline, You should only see files like: myfile.txt src/foo.c Instead of the files with /my/really/deep/directory/of/projects/ projectA appended to them. Here's my screenshot: http://notesmine.com/fuzzy_finder_kludge --Nate On Jan 11, 1:19 pm, Jonathan Hartley tart...@tartley.com wrote: On Jan 11, 2:52 pm, Tony Mechelynck wrote: Then, global plugins are read after your vimrc. Yet you can override them too: either (if you have only a few changes) by autocommands defined in your vimrc for the VimEnter event (which is triggered at the very end of startup), or if your changes are more extensive, by one or more user scripts at ~/.vim/after/plugin/*.vim (that's on Unix: on Windows, replace /.vim/ by /vimfiles/). These after plugins are all sourced just after the plugins in $VIMRUNTIME/plugin. Understood, many thanks! I'll check out the VimEnter event mechanism for now. My original problem still stands. I'm tinkering with it every couple of hours, inbetween getting real work done. Best, Jonathan --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: selecting and coping in 7.2
my .vimrc is An example for a vimrc file. Maintainer: Bram Moolenaar b...@vim.org Last change: 2006 Nov 16 To use it, copy it to for Unix and OS/2: ~/.vimrc for Amiga: s:.vimrc for MS-DOS and Win32: $VIM\_vimrc for OpenVMS: sys$login:.vimrc When started as evim, evim.vim will already have done these settings. if v:progname =~? evim finish endif Use Vim settings, rather then Vi settings (much better!). This must be first, because it changes other options as a side effect. set nocompatible allow backspacing over everything in insert mode set backspace=indent,eol,start if has(vms) set nobackup do not keep a backup file, use versions instead else set backup keep a backup file endif set history=50 keep 50 lines of command line history set rulershow the cursor position all the time set showcmd display incomplete commands set incsearchdo incremental searching set vb elimina il bip For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries let guioptions = substitute(guioptions, t, , g) Don't use Ex mode, use Q for formatting map Q gq In many terminal emulators the mouse works just fine, thus enable it. set mouse=a Switch syntax highlighting on, when the terminal has colors Also switch on highlighting the last used search pattern. if t_Co 2 || has(gui_running) syntax on set hlsearch endif Only do this part when compiled with support for autocommands. if has(autocmd) Enable file type detection. Use the default filetype settings, so that mail gets 'tw' set to 72, 'cindent' is on in C files, etc. Also load indent files, to automatically do language-dependent indenting. filetype plugin indent on Put these in an autocmd group, so that we can delete them easily. augroup vimrcEx au! For all text files set 'textwidth' to 78 characters. autocmd FileType text setlocal textwidth=78 When editing a file, always jump to the last known cursor position. Don't do it when the position is invalid or when inside an event handler (happens when dropping a file on gvim). autocmd BufReadPost * \ if line('\) 0 line('\) = line($) | \ exe normal! g`\ | \ endif augroup END else set autoindent always set autoindenting on endif has(autocmd) Convenient command to see the difference between the current buffer and the file it was loaded from, thus the changes you made. command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis \ | wincmd p | diffthis Questa riga serve per settare il tokrange di txtfmt al valore dell'encoding di cygwin ( latin1 ) invece che a quella di linux ( utf-8 ) in modo da poter leggere i file formattati ( e colorati ) da txtfmt/vim di cygwin ( consiglio di brett stahlman autore di txtfmt ) let g:txtfmtTokrange = 180 --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: selecting and coping in 7.2
Try instead, press (the literal double-quote character) and THEN press + (the literal plus character). After this, press the 'y' key. This is because instead of +y (select the '+' register and yank the text) you executed +y (move the cursor down one row and yank the text to Vim's unnamed register). If you want to paste by middle-click (rather than CTRL-V) then you will need to use * instead of + in the above commands. * is the selection register whereas + is the clipboard register. In Windows, these are the same...I apologize for that misunderstanding. Ben something changed now. It seems that, selecting, then pressing * y it copies. But it seems that if I paste it somewhere and then copy something else it continues to paste the first thing I copied. It seems it does not substitute the first copied text with the last. --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
FuzzyFinder for tags in currently open file?
Hello, I like the shrink-as-you-type menu that FuzzyFinder provides. I want to use it to search and jump to tags in my currently open file. Is there a way to do that? Also, I don't want to have to generate a tags file every time I want to do this. I basically want FuzzyFinder to automatically run the ctags program every time I invoke it.. that way it's always up to date. Thanks for the help. --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: How to save/restore the hightlight for cursor?
On Mon, 12 Jan 2009 23:40:30 +0800, Tony Mechelynck antoine.mechely...@gmail.com wrote: On 12/01/09 15:37, Yue Wu wrote: On Mon, 12 Jan 2009 22:30:43 +0800, Tony Mechelynck antoine.mechely...@gmail.com wrote: On 12/01/09 15:14, Yue Wu wrote: It's too complicated, if I want to save/restore highlight for others, it would need a big change. No other simple and generic way? Tell you users to do :hi Cursor, write down the result, and restore it by hand when needed. Thank you. you make me know there isn't a shortcut for it :) Excuse me if that last post sounded unusually flippant; I had spent quite some time to write two quite general functions to save and restore the Cursor highlight regardless of what it is set to, which can be easily adapted (with an argument to the function) to save any arbitrary highlight group, just to get the answer: That's too complicated. Well, here's how to make it easier: 1. Copy my functions to the clipboard and paste them into your vimrc, or into some plugin. 2. To save the cursor highlight group, use :call SaveCursorColor() 3. To restore it, use :call RestoreCursorColor. How simple do you want it to be? I'm really sorry for my talking sounds I ignore your excellent functions! Last night is too late, so I didn't look at them clearly and patiently, sorry! About your functions, yes, it works for all hightlights! Thank you! My last talking at last night about a simpler way means it still is complicated comparing with the way like save/restore options, I thought there would be a way like save/restore options for hightlights. Thank you again for your nice functions, I learned from you a way that can save/restore the highlights(Although I want a simpler way, I don't know how to do it in other ways until you tell me), and sorry again for no patiently to see the functions that taking you much time! -- Regards, Van. --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: selecting and coping in 7.2
On 2009-01-12, r r.tr...@inwind.it wrote: But it seems that if I paste it somewhere and then copy something else it continues to paste the first thing I copied. It seems it does not substitute the first copied text with the last. I've noticed that recently, too, but it happens only sometimes and I haven't been able to troubleshoot it. I use vim 7.2.22 in an xterm 6.8.2 on a Red Hat system with KDE. Very frustrating. Regards, Gary --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: Automatically make multiple folds for all text NOT containing search text
On 2009-01-10, Tony Mechelynck antoine.mechely...@gmail.com wrote: Oh, but you can set up mappings for search commands as distinct from mappings for ex-commands. Here's an example: :cnoremap expr CR ((getcmdtype == '/' BarBar getcmdtype == '?')?BslashCR:set fdm=expr:'') The above requires Vim 7.0 or later, and of course with expression evaluation compiled-in. Can someone explain this a bit more slowly for me please? And on vim 7.2 with +eval it gives me E121: Undefined variable: getcmdtype E15: Invalid expression: ((getcmdtype == '/' || getcmdtype == '?')?\CR:set fdm=expr:'') I have to use ZQ to get out; nothing with : works. I can see we're mapping the CR you hit at the end of the command, but after that I'm lost :-( --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
RE: Automatically make multiple folds for all text NOT containing search text
Sitaram Chamarty wrote: :cnoremap expr CR ((getcmdtype == '/' BarBar getcmdtype == '?')?BslashCR:set fdm=expr:'') Can someone explain this a bit more slowly for me please? The 'getcmdtype' should be 'getcmdtype()'. I can't offer more help at the moment, except that Tim gave a reply where he said he had updated the command to (one line): :cnoremap buffer expr cr (getcmdtype()=~'[/?]') ?\r:setlocal fdm=expr fde=(getline(v:lnum)=~@/)?0:1 fdl=0\r:\r John --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: Limit line width
On Tue, Jan 13, 2009 at 1:04 AM, Ben Fritz fritzophre...@gmail.com wrote: On Jan 12, 8:50 am, Steven Woody narkewo...@gmail.com wrote: What I expected is 1. When I go exceed 79 characters in a line, vim auto-wrap or auto-split for me ('gq' does a good job, but I hope it automatically done) See :help 'formatoptions' and :help fo-table for everything you can put in 'formatoptions'. You probably are looking for :setlocal fo+=t and :setlocal fo+=c. If you create a file, $HOME/vimfiles/after/ ftplugin/xml.vim on Windows or $HOME/.vim/after/ftplugin/xml.vim on Unix, and place those two set commands in it, the setting will automatically be applied for every xml file. Personally, I also like fo +=l to allow me to enter long lines if I want to (note that gq will still work to reformat these lines manually). 2. For an older source file, I hope I can reformat it easily by automatically splitting too long lines. gq is the way to go here. To reformat the entire file: gg (command to go to the first line in a file) gqG (reformat all lines until the end of the file) It works! Thank you very much! --~--~-~--~~~---~--~~ You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---