Re: Synchronizing or merging undo across platforms
On 28/11/11 06:31, Christian Brabandt wrote: Hi Bram! On So, 27 Nov 2011, Bram Moolenaar wrote: Christian Brabandt wrote: On Wed, November 16, 2011 9:38 pm, Paul wrote: On Nov 16, 1:42 am, Christian Brabandtcbli...@256bit.org wrote: Well, first check that :echo undofile(@%) points to the same undofile across each platform. Aha, thanks. That helped me determine that my Vim silently ignores me when I try to set relative directories for undodir. :set undodir=. works fine, but no undo file is created when I :set undodir=./undodir This seems to be a different behavior than that of backupdir, even though :help undodir says See |'backupdir'| for details of the format. Is this expected/documented/fixable? Hm, setting 'undodir' to a relative directory works for me. I can't reproduce this. However there is a bug when using rundo with those files. When using a separate 'undodir' directory to store the undofiles, Vim uses the complete path of the file as filename, replacing the path separators ('/') by '%'. So far this works as documented by :h 'undodir'. Now when using :rundo with a filename, that contains the complete path and using '%' as directory separators, those '%' will be replaced by the current file name (as documented by :h filename-modifiers) and surprise surprise Vim won't be able to read the undofile. So this is just plain wrong in this case. So here is a patch, that fixes that. This applies only to :rundo and I am not sure, whether this should also apply to :wundo (I tend not to apply it there) but this should be kept in mind. Bram, please check and apply. In most places where you can use a file name % is expanded. And it's also useful, especially in the form %:h to get the directory. I don't understand. Using '%' as path separators contradicts the usage your pointing out. How am I supposed to :rundo an undofile, that contains the '%'-separator? The path separator is % in 'undodir' but / in the operand of :rundo (see the examples under :help :rundo). #v+ ~$ mkdir -p /tmp/undo ~$ vim -u NONE -U NONE -N -i NONE -c ':set undodir=/tmp/undo|set undofile|exe wundo undofile(@%)|q' ~/.vimrc ~$ vim -u NONE -U NONE -N -i NONE -c ':set undodir=/tmp/undo|set undofile|exe verbose rundo undofile(@%)' ~/.vimrc ~/.vimrc 438L, 13769C Reading undo file: /tmp/undo/.vimrchome.vimrcchrisbra.vimrc.vim.vimrcvimrc Fehler beim Ausführen von command line: E822: Cannot open undo file for reading: /tmp/undo/.vimrchome.vimrcchrisbra.vim rc.vim.vimrcvimrc #v- regards, Christian Best regards, Tony. -- Burn's Hog Weighing Method: (1) Get a perfectly symmetrical plank and balance it across a sawhorse. (2) Put the hog on one end of the plank. (3) Pile rocks on the other end until the plank is again perfectly balanced. (4) Carefully guess the weight of the rocks. -- Robert Burns -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: How to customize CTRL-W CTRL-F?
On 27/11/11 18:28, Peng Yu wrote: Hi, I want to customize the behavior of CTRL-W CTRL-F. For example, it is of the pattern #includeheader.h, I will search for C and C++ header file directories. If it is of the pattern import os, I'll search for python library directories for file os.py. More generally, it a line match for some pattern, I will call an external program (the program could be written as a vim function) to resolve the file to be opened. :help CTRL-W_f doesn't tell me how to customize it. Could anybody let me know how to do so? Thanks! Regards, Peng About customizing key bindings (or bindings for key sequences), see :help map.txt About defining a custom function in Vim, see the help section starting at :help user-functions About regular expressions in Vim, see the help section starting at :help pattern-overview (or :help rn-ov if you are, like me, a lazy typist) for a summary and the rest of the same helpfile for the encyclopaedic treatment of the matter. About calling an external program in order to use its stdout output, see :help system() It's been too long since I've been Linux-only, I don't remember if system() is or isn't one of the cases where, on Windows, calling an external program requires opening a cmd.exe window which you'll have to close by hitting any key after it finishes. I also can't tell if you are on Windows or not: if you aren't, this paragraph does not apply to you. Best regards, Tony. -- Love is the triumph of imagination over intelligence. -- H. L. Mencken -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: gvim doesn't start from desktop icons or unity launcher but from shell
On 23/11/11 08:28, punknroll wrote: I found out that the error exists in the .vimrc file. when i rename it gvim starts again. https://github.com/spf13/spf13-vim/blob/master/.vimrc what can prevent the gui from starting here? Hard to tell by eyeball alone; experimenting is your friend. Now that you know that the error happens with a vimrc and not without it, first try starting Vim as gvim -u NORC -N If that alone is enough to prevent the GUI from starting (it shouldn't), the 'nocompatible' setting makes a difference. Otherwise, start commenting (by if 0 ... endif) about half of your vimrc, not straddling the boundary of another if- while- for- function- or try-range (i.e. none of these or similar multiline statements should be partly instide the :if 0 and partly outside it). Then comment or uncomment smaller and smaller parts until you have (hopefully) narrowed down the problem zone to just one line. Best regards, Tony. -- Alexander Graham Bell is alive and well in New York, and still waiting for a dial tone. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: How do I make vim.exe / gvim.exe use ncftp.exe instead of ftp.exe?
On 22/11/11 00:35, Haider Raza wrote: I have tried the 'let g:netrw_ftp_cmd=ncftp' command in vim and in the _vimrc file. I also edited the netwr.vim file directly and put ncftp there but when I look at the dos box that comes up when the ftp request is made to edit a file, I see that vim is using ftp.exe to make the connection. Please help, I have searched google upside down for an answer but apparently nobody has had this problem. Thanks, Haider Raza Is ncftp.exe in your PATH ? Even if it is, if it doesn't work this way, you may want to use a full path, and with 8.3 elements to avoid spaces, maybe something like :let g:netrw_ftp_cmd = 'C:\PROGRA~1\ncftp\ncftp.exe' (where PROGRA~1 is the 8.3 name of the Program Files folder), or similar. (Check first where the ncftp executable is found.) The normal place for this command is in your vimrc, so that it is executed before the various netrw plugins are sourced. The first of these (sourced at startup) is $VIMRUNTIME/plugin/netrwPlugin.vim ; there are others which are sourced when needed. The command :scriptnames will tell you which Vim scripts were sourced, and in which sequence. If your vimrc is not (with the correct path) at or near the top of the list, you have a problem. Typing :echo g:netrw_ftp_cmd or even :echo ' . g:netrw_ftp_cmd . ' will tell you what the variable is set to at any given time. You could also, if nothing else avails, use debug mode (:help debug-mode) to interrupt Vim in the middle of what it is doing and see how the value changes. Best regards, Tony. -- Be security conscious -- National defense is at stake. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: can I disable input method in vim normal mode
On 21/11/11 18:37, jason.桂林 wrote: I normally input code in vim, it's all ascii chars, but sometime I need type chinese, for document and comment. The input method is chinese at insert mode, and I press esc, and then I type some vim command, but this command can't be execute unless I switch input method back to english. I will never use chinese input method at normal mode, and visual mode. so can I disable input method at these mode? If I can't, I think it's a big problem. -- Best regards, Jason Green 桂林 It should be possible, but you have to make sure that Vim and the input-method interface agree on which signals they exchange how and when; and first and foremost, you must know that there are two different input-method subpackages in Vim, one for Window (called IME or Global IME) and one for Unix-like systems with X11 (called XIM). See: - for Windows (compiled with +multi_byte_ime or +multi_byte_ime/dyn) :help mbyte-IME - for X11 (compiled with +xim) :help mbyte-XIM - for all versions (compiled with either of the above) :help 'imactivatekey' :help 'imcmdline' :help 'imdisable' :help 'iminsert' :help 'imsearch' On Windows, if :version says your gvim is compiled with +multi_byte_ime/dyn, type :echo has('multi_byte_ime') to see if the dynamic library has been found (it should normally have). (The possible answers are 1=yes, 0=no.) On X11, +xim in the :version text is usually assurance enough. I recommend that you read the full section relevant for your OS, and then the full text of the help for these five options. If after that (and some experimenting) you need more help, come back here, but don't forget to tell us (1) which OS you are on, and (2) (in full detail) what you tried and what happened. Best regards, Tony. -- Between 1950 and 1952, a bored weatherman, stationed north of Hudson Bay, left a monument that neither government nor time can eradicate. Using a bulldozer abandoned by the Air Force, he spent two years and great effort pushing boulders into a single word. It can be seen from 10,000 feet, silhouetted against the snow. Government officials exchanged memos full of circumlocutions (no Latin equivalent exists) but failed to word an appropriation bill for the destruction of this cairn, that wouldn't alert the press and embarrass both Parliament and Party. It stands today, a monument to human spirit. If life exists on other planets, this may be the first message received from us. -- The Realist, November, 1964. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: In script always search from start of buffer
On 21/11/11 14:19, porphyry5 wrote: On Sun, Nov 20, 2011 at 5:10 PM, Tony Mechelynck [via VIM] [hidden email] /user/SendEmail.jtp?type=nodenode=5010492i=0 wrote: Yes, and why not use bar-separated commands? You _are_ running in 'nocompatible' mode aren't you? The following (untested) assumes that this mapping definition is part of a script (of your vimrc, maybe): Essentially I wrote scripts by trying each command individually in the buffer, then writing the script as a string that exactly mimics what I did with the individual commands, so normal-mode commands have no termination, ex mode commands are terminated by a carriage return. Now I understand that is not reliable. If the resulting script fits on a single line I put it directly in .vimrc, otherwise I make it a .vim script and map to that script in .vimrc. And yes, I use set nocompatible in .vimrc map p$ \ :1d Bar \ while @ != Bar \ b # Bar \ 1call search(@) Bar \ s/^/$ / Bar \ b # Bar \ d Bar \ endwhileCR What I find particularly confusing is the lack of correspondence between command formats in scripts vs their counterparts in the buffer command line, as above. You are constrained to use :1d in both places, because 1d does something different in both places, but you use b# here to switch buffers, which requires :b# at the command line or you get a completely different result. Analogous to :1d, one would expect you to use :1/@ to go to line 1 and search for the content of the register, but you use the far lengthier '1call search(@)' instead. As far as I can determine the two forms work the same as far as / goes, but something must have prompted you to use search() instead? In scripts, I use ex-commands as much as possible, because _every_ line of a script must be an ex-command, which could be typed on the bottom-line of your Vim screen after hitting : — the whole mapping definition above is _one_ command-line, which I recommend to write as above in a script, on several lines with continuation lines, for legibility. It stores the {rhs} as the following command line: :1d | while @ != | b # | 1call search(@) | s/^/$ / | b # | d | endwhile^M where the ^M at the end means that the mapping will hit the return key to execute the ex-command immediately, and the bars at various places in the middle allow (with some restrictions) concatenating.several ex-commands on one line. In a function, the exact same set of operations would be written as function MarkHeaderLinesInAltFile() 1d while @ != b # 1call search(@) s/^/$ / b # d endwhile endfunction where the initial colons at the start of each line are not written simply because every script line is implicitly an ex-command so you don't need to repeatedly put Vim into command-line mode. You could then define your mapping as map p$ :call MarkHeaderLinesInAltFile()CR The difference between :1/@ and :1call search(@) is that the first searches for the first at-sign in the file (or the second if the first one is the very first character in the file) while the second searches for the first match with the pattern in the default register. Adding a double quote after :1/@ would change nothing: it would be taken as the start of a comment. To use the contents of the default register and write it as a naked range in a script, you would have to write :execute '1/' . @ which to my mind is much less elegant than :1call search(@) Since _every_ line of a script is an ex-command, / and ? searches can only be used in scripts as part of ex-command ranges. Ex-commands are explained in detail in the helpfile |cmdline.txt| but I'm not sure in which sequence you should read its various sections. Now please go back, _read_ all the help topics I listed (quoted below), try your best to understand them, and I hope it will bring you some enlightenment. See :help cmdline.txt :help [range] :help 'nocompatible' :help :bar :help map_bar :help line-continuation :help :d :help :call :help search() :help :s :help :map-buffer :help 'runtimepath' :help :autocmd :help FileType Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 223. You set up a web-cam as your home's security system. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: In script always search from start of buffer
On 21/11/11 15:23, Graham Lawrence wrote: On Mon, Nov 21, 2011 at 4:44 AM, Tim Chasev...@tim.thechases.com wrote: In normal-mode, the number prefixing a search is a count, to find the Nth match. In command-line mode (entered when you hit the colon), it's the line at which to start. But one thing still puzzles me: in fact, I had tried each of gg, 1G and cursor with and without a leading:, with and without a trailing space, with and without a trailingCR; and, as I originally wrote the script, it read :map p$ ggdd:while @ != CR:b#CRgg:silent! /^RCR0i$SpaceEsc:b#CRdd:endwhile in which the first gg works, the second gg fails with E492, and I would very much like to know why. Strange things happen when you mix command-line mode and looping. When you start the :while, Vim starts a command-entering mode waiting for the endwhile. Thus the : before the b# is optional, and the gg is then treated as an Ex command (triggering the E492). -tim Thank you very much, that makes it very clear, and also resolves another thing that had been bugging me. Somewhere I had got the notion that: was optional in scripts, kept encountering situations where it was not true, and took to colon-izing everything as it would be in the buffer command line. But actually the: is optional only if the script is implicitly in command mode due to a previous command, like a loop structure. So presumably one would also be in the same situation using a | separated string of commands in the command line; they could be of the form :command1 | command2 | command3...CR and the initial: would extend to subsequent commands on the same line. And presumably any normal mode commands in such string would fail unless prepended bynormal Scripts _are_ implicitly in command-line mode everywhere: e.g. view the example vimrc by using :view $VIMRUNTIME/vimrc_example.vim and you will notice that none of its lines starts with a colon. However, the {rhs} of a mapping is not a full script line, and _it_ is not implicitly in command-line mode. The reason why normal-mode commands must be prefixed by normal in scripts is that the :normal command executes its argument as a normal-mode command (or set of commands). If you want to execute :normal as part of a string of bar-separated concatenated ex-commands (and other than at the end) you must wrap it in an :execute because :normal would see the bar as part of its arguments: :cmd1 | cmd2 | exe normal w3li \e | cmd3 | etc... Best regards, Tony. -- Travel important today; Internal Revenue men arrive tomorrow. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: In script always search from start of buffer
On 21/11/11 12:22, porphyry5 wrote: On Sun, Nov 20, 2011 at 1:25 PM, Gary Johnson-4 [via VIM] [hidden email] /user/SendEmail.jtp?type=nodenode=5010270i=0 wrote: On 2011-11-20, porphyry5 wrote: In a script, how can I get repeated searches always to begin at the start of the buffer? If I precede the search with gg or :cursor(1, 1) I get E492, with 1G I get E464. :map p$ ggdd:while @ != CR:b#CR:cursor (1, 1)CR:silent! /^RCR0i$SpaceEsc:b#CRdd:endwhile I haven't looked closely at your mapping, but to use a normal-mode command such as gg in a script, that is, as an ex command, you must precede it with :normal, as :normal gg Similarly, to use a function as an ex command, you must precede it with :call, as :call cursor(1, 1) See :help :normal :help :call Another way to move the cursor to the first line of the buffer is to simply put the number 1 on a line by itself, or in a mapping like yours, as :1CR. HTH, Gary It certainly does help, thank you, particularly with reference to :help :normal, because it seems that sometimes a normal-mode command works as-is, other times it doesn't. I originally wrote the script as :map p$ ggdd:while @ != CR:b#CRgg:silent! /^RCR0i$SpaceEsc:b#CRdd:endwhile in which the first gg works, the second gg fails. If you type :while @ != followed by Return, you will notice that Vim does not go back to Normal mode: it presents you with a new, empty command-line already prefixed by a colon. This is because a :while statement cannot be executed as long as everything until and including the :endwhile isn't known. The :b# above is OK in this context (a second colon, or even a string of many colons, at the start of an ex-command, changes nothing), but the following gg is still interpreted in that implicit command-line mode, and since there is no :gg:silent ex-command, you get an error. That error invalidates the whole incomplete complex command (started by :while not yet followed by :endwhile), Vim discards it, and I think the exception propagates (making Vim discard the whole mapping) until it is ready to read the next command at the keyboard. OTOH, if you type :if 0 you will be presented by empty lines in the same way, and if you type nonsense in them, there will be no error. Further :if's, :while's, etc. will cause additional indentation, and when you come back to indent level zero with the _matching_ :endif (with no matching :else or :elseif) Vim will come back to Normal mode, do nothing, and still give no error for any intervening nonsense line, because they were on the false path of the :if. I find it less confusing, when typing at the command-line (not in a script) to type complex commands (:while, :if, etc.) all on one line until their :endwhile, :endif, etc., separating intervening commands with bars, and taking care that some commands take the | as part of their arguments: such commands (listed under :help :bar) need to be wrapped in :execute if they are to be part of such a set of concatenated commands other than at the end. Doing it this way (on one line) allows me to come back if, before hitting Enter, I notice that I'm made a typo several bars before in the line. Best regards, Tony. -- No animal should ever jump on the dining room furniture unless absolutely certain he can hold his own in conversation. -- Fran Lebowitz -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: can I disable input method in vim normal mode
On 22/11/11 04:23, pansz wrote: 2011/11/22 Tony Mechelynckantoine.mechely...@gmail.com: - for X11 (compiled with +xim) :help mbyte-XIM - for all versions (compiled with either of the above) :help 'imactivatekey' :help 'imcmdline' :help 'imdisable' :help 'iminsert' :help 'imsearch' Does this work for console vim (with +xim present)? I've tried 'imdisable' and it does not seem to work. The problem with the console is that it intercepts what you type and then passes it to the application (Vim), possibly after some translation, or maybe doesn't pass it at all. This additional layer between the keyboard and the editor means that the _terminal_ may be trying to interact with the XIM and pass the cooked keystrokes to Vim. For such complex keyboard interaction, I recommend gvim, because it has much better control over keyboard input, and also over output since you can set any suitable font by means of 'guifont' without even leaving Vim. With gvim, there is no ambiguity: the application with which the XIM interacts can only be Vim, there is no terminal which the XIM could see as its opposite number, to which it would be talking. Best regards, Tony. -- I have made mistakes but I have never made the mistake of claiming that I have never made one. -- James Gordon Bennett -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: In script always search from start of buffer
On 20/11/11 22:24, Gary Johnson wrote: On 2011-11-20, porphyry5 wrote: In a script, how can I get repeated searches always to begin at the start of the buffer? If I precede the search with gg or :cursor(1, 1) I get E492, with 1G I get E464. :map p$ ggdd:while @ != CR:b#CR:cursor (1, 1)CR:silent! /^RCR0i$SpaceEsc:b#CRdd:endwhile I haven't looked closely at your mapping, but to use a normal-mode command such as gg in a script, that is, as an ex command, you must precede it with :normal, as :normal gg Similarly, to use a function as an ex command, you must precede it with :call, as :call cursor(1, 1) See :help :normal :help :call Another way to move the cursor to the first line of the buffer is to simply put the number 1 on a line by itself, or in a mapping like yours, as :1CR. HTH, Gary Yes, and why not use bar-separated commands? You _are_ running in 'nocompatible' mode aren't you? The following (untested) assumes that this mapping definition is part of a script (of your vimrc, maybe): map p$ \ :1d Bar \ while @ != Bar \ b # Bar \ 1call search(@) Bar \ s/^/$ / Bar \ b # Bar \ d Bar \ endwhileCR See :help 'nocompatible' :help :bar :help map_bar :help line-continuation :help :d :help :call :help search() :help :s :help :map-buffer :help 'runtimepath' :help :autocmd :help FileType This would add a dollar and a space in front of the first line other than the first in the alternate file which matches as a pattern any line in the current file before the first empty line (or until end-of-file if there is no empty line), and remove the matched lines (and the terminating empty line, if any) from the current file. Repeated lines cause repeated dollar-space insertion. If there is no match, add dollar-space to the first line of the alternate file. If there are several unmatched lines, add '$ ' that many times to the first line. If a line in the current file starts with '$ ', the matching is done after the changes for all preceding patterns have been made. I mention :map-buffer and what I listed after it because if you need this mapping for only one filetype (or a small number of them), it should be defined with buffer, either in an after-ftplugin, or alternatively at the FileType event but still with buffer. Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 222. You send more than 20 personal e-mails a day. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: _vimrc file on Windows with 7.3
On 21/11/11 01:44, Henry Hertz Hobbit wrote: I use these function keys on Linux with no problems (the zz is lower case, not upper case and was done to get rid of some strange behavior on OpenSuse 11.2 until I altered what caused it not to come back to where I was at but shoved the line to the bottom of the window). map F5 :nCRzz map F6 :rewCRzz map F7 :wnCRzz map F8 :w!CRzz map F12 :x!CR These function keys do not work with 7.3 on Windows. Which patchlevel? (Mine is 7.3.353, on openSUSE 12.1.) See :intro I cannot remember for sure but I think they did work with 7.2. I have the _vimrc file in these two locations: %UserProfile%\_vimrc %ProgramFiles%\Vim The Wiki mentions $Home for Windows. You have your choide of these two environment variables: %UserProfile% and %HomePath%. I prefer the former because it has the drive letter and I am frequently on E:, a FAT32 file system and F:, a USB FAT32 file system. I also have these environment variables Vim=C:\Program Files\Vim VimRunTime=C:\Program Files\Vim\vim73 (the second had vim72 when I was using GVim 7.2) Here is the contents of the_vimrc file: http://www.securemecca.com/tmp/vimrc.txt I am normally starting vim via a gvimi.bat file in cmd.exe. Here is what is in that file: http://www.securemecca.com/tmp/gvimi.txt However, even when I just right click on a file and select edit with gvim the function keys still don't work. If anybody knows why it doesn't work and knows what I am doing wrong please let us all know the right way to do it. Cross e-mail me to hhhobbit(gnat)gmail.com http://gmail.com since I only read the digest version and may miss the answer. Thanks. I think that environment variable names are case-sensitive. Try using %USERPROFILE%, VIM and VIMRUNTIME, and check in a running Vim what $USERPROFILE, $HOME, $VIM and $VIMRUNTIME (all these in all caps) point to. I'm not sure about %ProgramFiles% vs. %PROGRAMFILES%. Bet regards, Tony. -- Bare feet magnetize sharp metal objects so they point upward from the floor -- especially in the dark. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: [HELP]Gvim can't find all the fonts on my system
On 20/11/11 04:42, zhang listar wrote: I have installed gvim72 on my system but gvim can't find all the fonts installed on my system. How to fix it? Thanks in advance. You can't, unless you're using gvim with GTK2 (on X11 which normally means Unix-like but not macvim) and even on GTK2 non-monospace fonts look ugly, because the fixed characer cell makes thin letters (i, l, etc.) look too widely spaced, and it makes thick letters (m etc.) appear cramped. When built with a widget set other than GTK2, gvim will only accept monospace fonts. This includes Windows and macvim. Also, Vim 7.2 is obsolete by now. Vim 7.3 was released on 15 August 2010, and since then it has already received 353 bug fixes, see http://ftp.vim.org/pub/vim/patches/7.3/README On Windows, I recommend Vim without Cream, the Vim package available (separately from Cream) at http://sourceforge.net/projects/cream/files/ On Mac OSX, I recommend macvim, but you should get the details from the vim_mac list, I don't know them. On Linux and other Unix-like systems other than Mac OSX, I recommend compiling your own Vim, see http://vim.wikia.com/wiki/Getting_the_Vim_source_with_Mercurial http://users.skynet.be/antoine.mechelynck/vim/compunix.htm Best regards, Tony. -- There was an old man of the port Whose prick was remarkably short. When he got into bed, The old woman said, This isn't a prick; it's a wart! -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Gvim can't find all the fonts on my system
On 20/11/11 05:29, zhang listar wrote: 在 2011年11月20日 上午11:56,Ben Fritzfritzophre...@gmail.com 写道: On Nov 19, 9:42 pm, zhang listarlistarmings...@gmail.com wrote: I have installed gvim72 on my system but gvim can't find all the fonts installed on my system. How to fix it? Thanks in advance. You can't. In general, Vim can only use monospace fonts. Most of the fonts on a given system are normally NOT monospace fonts. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php Thanks for your reply. But is there any patch that fix the problem? I want to use YaHei Consolas Hybrid or Bitsteram Vera Mono, but gvim can't recognize any of them. - No, there is no fix, Vim is essentially monospace-only. On X11 systems ONLY, you can use gvim with GTK2, which will accept any font but the non-monospaced ones will look ugly. - Bitsteram Vera Mono doesn't exist. Try Bitstream Vera Sans Mono. - On some systems you can use :set gfn=* (without the quotes) to see all the fonts which gvim knows about. - See http://vim/wikia.com/wiki/Setting_the_font_in_the_GUI for details. Best regards, Tony. -- `Just the place for a Snark!' the Bellman cried, As he landed his crew with care; Supporting each man on the top of the tide By a finger entwined in his hair. 'Just the place for a Snark! I have said it twice: That alone should encourage the crew. Just the place for a Snark! I have said it thrice: What I tell you three times is true.' -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Gvim can't find all the fonts on my system
On 20/11/11 05:41, Tony Mechelynck wrote: [...] - See http://vim/wikia.com/wiki/Setting_the_font_in_the_GUI for details. Oops! http://vim.wikia.com/wiki/Setting_the_font_in_the_GUI Best regards, Tony. -- It seems like the less a statesman amounts to, the more he loves the flag. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: gvim doesn't start from desktop icons or unity launcher but from shell
On 15/11/11 08:20, punknroll wrote: hi all, when i try to start gvim from the desktop icon or the unity launcher the gvim process shows up for a few seconds when i run top in the shell but doesn't start. When I enter the same command in the shell gvim -f %F gvim starts without errors. Any ideas? Thanx Andi Any messages on stderr? I had this recently (gvim wouldn't start from a desktop shortcut) after an OS upgrade but console Vim wouldn't start either. stderr messages seemed to imply that the perl library could not be found. make reconfig followed by make install fixed it (with the make variables defined beforehand as environment variables). Best regards, Tony. -- Parker's Law: Beauty is only skin deep, but ugly goes clean to the bone. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: What does '* in 'exists(*GetAwkIndent)' mean?
On 15/11/11 04:38, Tim Chase wrote: On 11/14/11 21:29, Peng Yu wrote: I don't know how to search for the usage of * in the following vim code. Could anybody which keyword I should search in vim help for its usage? exists(*GetAwkIndent) Reading at :help exists() mentions that the * prefix checks for the existence of a built-in function. -tim ...or a user-defined function. In short: of a function. I would expect GetAwkIndent() to be defined (if it is) by a script, not by Vim's C code. Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 221. Your wife melts your keyboard in the oven. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: autocommand to replace special characters into a file.
On 14/11/11 11:37, Eddine wrote: Hello At work I have to edit regurlarly files containing special characters like*^M or ^A* for the moment Im' at the first stage where I just try to make replace a string by another one in my autocommand: *au VimEnter,BufNewFile,BufRead,BufEnter *.log s/string1/string2/* But this doesn't give me good results: Wehn opeining a .log file, Vim prompts me to know if I want to replace the first occurence ; hitting y (yes key) change the first matching one then brings me error messages : E488: trailing characters E486: pattern not found string1 Any mean to make it replace all matching strings whitout prompting and without error ? Thanks in adavance for your help. Eddine. _Exactly_ what command did you use? s/string1/string2 (where string1 is six letters, Sierra Tango Romeo India November Golf, and the digit one) will never replace a ^M or a ^A Best regards, Tony. -- There was a gay countess of Bray, And you may think it odd when I say, That in spite of high station, Rank and education, She always spelled cunt with a k. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: autocommand to replace special characters into a file.
On 14/11/11 12:52, Eddine wrote: yes I know s/string1/string2 will not replace ^M or ^A ; I just want to make a first try to replace string1 to string2 first before replacing string1 by ^M 2011/11/14 Tony Mechelynck antoine.mechely...@gmail.com mailto:antoine.mechely...@gmail.com On 14/11/11 11:37, Eddine wrote: Hello At work I have to edit regurlarly files containing special characters like*^M or ^A* for the moment Im' at the first stage where I just try to make replace a string by another one in my autocommand: *au VimEnter,BufNewFile,BufRead,__BufEnter *.log s/string1/string2/* But this doesn't give me good results: Wehn opeining a .log file, Vim prompts me to know if I want to replace the first occurence ; hitting y (yes key) change the first matching one then brings me error messages : E488: trailing characters E486: pattern not found string1 Any mean to make it replace all matching strings whitout prompting and without error ? Thanks in adavance for your help. Eddine. _Exactly_ what command did you use? s/string1/string2 (where string1 is six letters, Sierra Tango Romeo India November Golf, and the digit one) will never replace a ^M or a ^A Best regards, Tony. -- There was a gay countess of Bray, And you may think it odd when I say, That in spite of high station, Rank and education, She always spelled cunt with a k. Well, s/string1/string2 will replace string1 by string2 in the current line only, and give an error if there is no match. See :help range to replace in the whole file :help :s_flags to give no error for no match and near the bottom of the list given at :help /ordinary-atom about replacing a special (e.g. non-printable) character. Best regards, Tony. -- Court, n.: A place where they dispense with justice. -- Arthur Train -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Combined commands provide wrong result
On 12/11/11 11:30, Guido Van Hoecke wrote: Hi, I want to edit a csv file with e.g. following content: tag2,2011/10/31,28250,28208,0,0,0.9985 tag1,2011/10/31,1591,1583,8,0,1 tag2,2011/10/30,15046,15008,0,0,0.9975 tag1,2011/10/30,981,975,6,0,1 tag2,2011/10/29,13019,12993,0,0,0.998 tag1,2011/10/29,401,401,0,0,1 tag2,2011/10/28,8687,8674,0,0,0.9985 tag1,2011/10/28,1245,1233,12,0,1 tag2,2011/10/27,8117,8108,0,0,0.9989 tag1,2011/10/27,703,697,6,0,1 tag2,2011/10/26,8327,8318,0,0,0.9989 tag1,2011/10/26,496,496,0,0,1 tag2,2011/10/25,0,0,0,0,0 tag1,2011/10/25,973,971,2,0,1 tag2,2011/10/24,0,0,0,0,0 tag1,2011/10/24,823,823,0,0,1 tag2,2011/10/23,0,0,0,0,0 tag1,2011/10/23,1938,1936,2,0,1 tag2,2011/10/22,0,0,0,0,0 tag1,2011/10/22,968,968,0,0,1 tag2,2011/10/21,0,0,0,0,0 tag1,2011/10/21,526,526,0,0,1 tag2,2011/10/20,0,0,0,0,0 tag1,2011/10/20,828,828,0,0,1 tag2,2011/10/19,0,0,0,0,0 tag1,2011/10/19,1079,1079,0,0,1 tag2,2011/10/18,0,0,0,0,0 tag1,2011/10/18,850,849,1,0,1 tag2,2011/10/17,0,0,0,0,0 tag1,2011/10/17,2056,2056,0,0,1 tag2,2011/10/16,0,0,0,0,0 tag1,2011/10/16,1545,1542,3,0,1 tag2,2011/10/15,0,0,0,0,0 tag1,2011/10/15,1801,1783,18,0,1 tag2,2011/10/14,0,0,0,0,0 tag1,2011/10/14,1651,1644,5,0,0.9988 tag2,2011/10/13,0,0,0,0,0 tag1,2011/10/13,1785,1785,0,0,1 tag2,2011/10/12,0,0,0,0,0 tag1,2011/10/12,2071,2071,0,0,1 I want to get rid of all lines ending on 0,0,0,0,0 I want to replace all ',' by ';' I want to replace all '.' by ',' With three individual commands, all is ok: :%g/0,0,0,0,0/d :%s/,/;/g :%s/\./,/g The end result is (as expected): tag2;2011/10/31;28250;28208;0;0;0,9985 tag1;2011/10/31;1591;1583;8;0;1 tag2;2011/10/30;15046;15008;0;0;0,9975 tag1;2011/10/30;981;975;6;0;1 tag2;2011/10/29;13019;12993;0;0;0,998 tag1;2011/10/29;401;401;0;0;1 tag2;2011/10/28;8687;8674;0;0;0,9985 tag1;2011/10/28;1245;1233;12;0;1 tag2;2011/10/27;8117;8108;0;0;0,9989 tag1;2011/10/27;703;697;6;0;1 tag2;2011/10/26;8327;8318;0;0;0,9989 tag1;2011/10/26;496;496;0;0;1 tag1;2011/10/25;973;971;2;0;1 tag1;2011/10/24;823;823;0;0;1 tag1;2011/10/23;1938;1936;2;0;1 tag1;2011/10/22;968;968;0;0;1 tag1;2011/10/21;526;526;0;0;1 tag1;2011/10/20;828;828;0;0;1 tag1;2011/10/19;1079;1079;0;0;1 tag1;2011/10/18;850;849;1;0;1 tag1;2011/10/17;2056;2056;0;0;1 tag1;2011/10/16;1545;1542;3;0;1 tag1;2011/10/15;1801;1783;18;0;1 tag1;2011/10/14;1651;1644;5;0;0,9988 tag1;2011/10/13;1785;1785;0;0;1 tag1;2011/10/12;2071;2071;0;0;1 But I want to combine these three operations in one command: :%g/0,0,0,0,0/d|%s/,/;/g|%s/\./,/g but this gives following result: tag2;2011/10/31;28250;28208;0;0;0;9985 tag1;2011/10/31;1591;1583;8;0;1 tag2;2011/10/30;15046;15008;0;0;0;9975 tag1;2011/10/30;981;975;6;0;1 tag2;2011/10/29;13019;12993;0;0;0;998 tag1;2011/10/29;401;401;0;0;1 tag2;2011/10/28;8687;8674;0;0;0;9985 tag1;2011/10/28;1245;1233;12;0;1 tag2;2011/10/27;8117;8108;0;0;0;9989 tag1;2011/10/27;703;697;6;0;1 tag2;2011/10/26;8327;8318;0;0;0;9989 tag1;2011/10/26;496;496;0;0;1 tag1;2011/10/25;973;971;2;0;1 tag1;2011/10/24;823;823;0;0;1 tag1;2011/10/23;1938;1936;2;0;1 tag1;2011/10/22;968;968;0;0;1 tag1;2011/10/21;526;526;0;0;1 tag1;2011/10/20;828;828;0;0;1 tag1;2011/10/19;1079;1079;0;0;1 tag1;2011/10/18;850;849;1;0;1 tag1;2011/10/17;2056;2056;0;0;1 tag1;2011/10/16;1545;1542;3;0;1 tag1;2011/10/15;1801;1783;18;0;1 tag1;2011/10/14;1651;1644;5;0;0;9988 tag1;2011/10/13;1785;1785;0;0;1 tag1;2011/10/12;2071;2071;0;0;1 Note that all 0.99 get changed into 0;99 rather than 0,99 Is this an error or do I hit some limitation in combining commands? I have hlsearch on, and at the end of this combined command all '.' characters are highlighted when undoing the change. So the last thing searched was indeed '.' and I do not understand why it seems to be replaced with ';' rather than ',' Please advise. TIA, Guido. As said under :help :bar, the :g[lobal] command considers the | as part of its operands. You ought to be able to do it with :exe '%g/0,0,0,0,0/d' | %s/,/;/g | %s/\./,/g because wrapping the :g command inside :exe (which does not include the | in its operands) defines where :g ends and separates it from the | Best regards, Tony. -- Two men came before Nasrudin when he was magistrate. The first man said, This man has bitten my ear -- I demand compensation. The second man said, He bit it himself. Nasrudin withdrew to his chambers, and spent an hour trying to bite his own ear. He succeeded only in falling over and bruising his forehead. Returning to the courtroom, Nasrudin pronounced, Examine the man whose ear was bitten. If his forehead is bruised, he did it himself and the case is dismissed. If his forehead is not bruised, the other man did it and must pay three silver pieces. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Setting encoding for a type of file
On 11/11/11 04:52, Ben Fritz wrote: On Nov 10, 3:26 pm, Marcio Gilmarciom...@bol.com.br wrote: On Nov 10, 6:09 pm, Christian Brabandtcbli...@256bit.org wrote: autocmd FileType dosbatch :e! ++enc=cp850 works, but put the syntax highlight off On Nov 10, 6:16 pm, Tony Mechelynckantoine.mechely...@gmail.com wrote: au BufReadPre,BufNewFile *.bat,*.btm,*.sys setlocal fenc=cp850 don't works. On Nov 10, 6:29 pm, Ben Fritzfritzophre...@gmail.com wrote: autocmd FileType dosbatch e ++enc=cp850 Same as Christian Brabandt's: works, but put the syntax highlight off Oops, forgot the nested keyword. Try: autocmd FileType dosbatch nested e ++enc=cp850 See :help autocmd-nested I actually have something a bit more complex (I've removed some irrelevant stuff for your immediate problem, if some of this is confusing as-is). I use a different method, by changing 'fileencodings' prior to loading the file, so that Vim automatically detects my desired fileencoding: Don't detect utf-8 without a BOM by default, I don't use UTF-8 normally and any files in latin1 will detect as UTF. Detect cp1252 rather than latin1 so files are read in correctly. Fall back to latin1 if system does not support cp1252 for some reason. exec 'set fileencodings=ucs-bom,'.s:windows_enc.',latin1' if has('autocmd') augroup fenc_detect au! batch files need to use the encoding of the cmd.exe prompt in Windows if has('win32') || has('win64') get the cmd.exe encoding by asking for it let g:batcp = substitute(system('chcp'), '^\c\s*Active code page: \(\d\+\)\s*[^[:print:]]*$', 'cp\1', '') if g:batcp =~? '^cp\d\+$' autocmd BufReadPre *.bat exec 'set fileencodings='.g:batcp autocmd BufNewFile *.bat exec 'setlocal fileencoding='.g:batcp endif endif restore default fileencodings after loading the files that use a special value to force specific encodings exec 'autocmd BufReadPost *.bat set fileencodings=ucs- bom,'.s:windows_enc.',latin1' augroup END endif This works only for DOS batch files, other files are also opened in cp850. But in the Cygwin vim don't recognizes the s:windows_enc variable, I will substitute this for 'cp850' Oops, that's an artifact of my using the same .vimrc on Unix and Windows. I do something like this, before the code snippet: if has('unix') let s:windows_enc = '8bit-cp1252' else windows let s:windows_enc = 'cp1252' endif You can also use the value 'Windows-1252' (the official name) which is known by iconv and so should work both on Unix Vim statically linked with +iconv and on Windows Vim dynamically linked with +iconv/dyn if iconv.dll or libiconv.dll can be found. s:windows_enc doesn't exist by default. Setting it to cp850 means ALL files will be detected with this encoding, if they don't have a BOM. This works for me: exec 'autocmd BufReadPre *.bat set fileencodings=ucs-bom,cp850,latin1' As Tony says, this will set ALL files to cp850, unless they have a BOM. The point of my script snippet was: 1. For most files, use ucs-bom to use a Unicode encoding if the file has a BOM, then try windows-1252, but if the system doesn't recognize windows-1252, try latin1 (I actually have more autocmds to check for characters specific to windows-1252 and use latin1 if not present). 2. For *.bat files only, override this to ONLY try the cmd.exe encoding 3. Restore option (1) after loading dos files, since the option is global and the fenc is already set appropriately Best regards, Tony. -- Mencken and Nathan's Fifteenth Law of The Average American: The worst actress in the company is always the manager's wife. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: How to copy strings into system's clipboard on n900 (maemo)?
On 11/11/11 09:31, Yue Wu wrote: On Thu, 10 Nov 2011 23:52:44 +0800, Ben Fritz fritzophre...@gmail.com wrote: On Nov 10, 8:21 am, Yue Wu vano...@gmail.com wrote: Hello list, Sorry I've posted a same mail on vim_dev then I realized that I've posted in a wrong mailing list. My question is more specific for n900, but I don't know where to get help, so I try to seek it here ;p vim works fine on n900's port, except it doesn't support 'autochdir', I'm very curious about it. What's not supported about it? It's there but doesn't work? Or it's not there at all? The big question is that, I don't know how to copy strings in system's clipboard, register * and + doesn't work even vim has compiled to support the feature. In normal way, I can make a selection then click xterm's menu then choise copy, but it's too slow. So my question is that if it possible to copy strings directly by vim? I don't know, I am pretty sure if your Vim is compiled for it, it should work. But then, I don't know what n900 refers to. Maybe you need an X server running. You can try some of the suggestions (especially in the comments) here: http://vim.wikia.com/wiki/Clipboard After testing again, I find that, register + works fine for English charactors, but Chinese charactors couldn't be copied at all, after copied from vim, all Chinese charactors were disappeared. Strange. I'm tempted to say that it sounds like there's something wrong with the Maemo clipboard but I don't know that system well enough. What is your system locale (what does Vim answer to the :lang command with no arguments)? Is it possible to set it (before starting Vim) to some Unicode locale, similar to the en_US.UTF-8 which I use on my desktop Linux system? Maybe zh_CN.UTF-8 for Simplified Chinese or zh_TW.UTF-8 for Traditional Chinese? And of course have Vim compiled with +multi_byte and run it with 'encoding' set to utf-8, see http://vim.wikia.com/wiki/Working_with_Unicode Best regards, Tony. -- I don't think they could put him in a mental hospital. On the other hand, if he were already in, I don't think they'd let him out. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: No 'authochdir' in maemo port of vim[Was: How to copy strings into system's clipboard on n900 (maemo)?]
On 11/11/11 09:38, Yue Wu wrote: On Fri, 11 Nov 2011 16:20:42 +0800, Yue Wu vano...@gmail.com wrote: On Thu, 10 Nov 2011 23:52:44 +0800, Ben Fritz fritzophre...@gmail.com wrote: On Nov 10, 8:21 am, Yue Wu vano...@gmail.com wrote: Hello list, Sorry I've posted a same mail on vim_dev then I realized that I've posted in a wrong mailing list. My question is more specific for n900, but I don't know where to get help, so I try to seek it here ;p vim works fine on n900's port, except it doesn't support 'autochdir', I'm very curious about it. What's not supported about it? It's there but doesn't work? Or it's not there at all? No the option here, output from :version is: According to :help 'autochdir' that option can be included or excluded at compile-time without a feature known by :version or has() to go for it. To detect its presence you have to use exists('+autochdir') which will return zero if the option is not both defined and functional. And I can't find strchars() function here, is it a new feature from 7.3 or it's missing in the version I'm using? Sorry I'm not a programmer, but I know a little of scripting in vimscript, so if my question is naive, please forgive me. [...] strchars() is new in Vim 7.3 so it's normal that you don't yet have it on 7.2. In fact it's so new that (through an oversight I suppose) even in 7.3.353 (where it exists) it hasn't yet been removed from the TODO list. Best regards, Tony. -- Scientists are people who build the Brooklyn Bridge and then buy it. -- William Buckley -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: autowrapping when editing a line
On 11/11/11 13:08, Eric Smith wrote: I know that vim does not rewrap lines as you extend them like many other editors. What I was wondering is what makes this so difficult to implement in vim and could it ever be implemented? (Sorry to ask) It was already implemented when I met Vim, which was at release 6.1 then. You just have to :set wrap and each file line will be displayed on one or more screen lines (as many as necessary). See :help 'wrap' Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 215. Your mouse-clicking forearm rivals Popeye's. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Possible bug with user-defined commands used in autocommands
On 11/11/11 15:34, Taylor Hedberg wrote: I'm running into some strange behavior with autocommands, using Vim 7.3.353. I'm not sure whether it's a bug, or just one of those gotchas that seem to pop up throughout Vim's syntax. I have a command defined as follows: command! WinWidth execute 'vertical resize' (textwidth + 1) I want the command to be automatically executed when I enter a window in which w:winwidth is 1. So I wrote: autocmd WinEnter * if exists(w:winwidth) w:winwidth | WinWidth | endif But whenever the autocommand triggers, I get: E488: Trailing characters: WinWidth | endif This doesn't make sense to me, as WinWidth doesn't take any arguments, nor am I passing any. Somehow, the `| endif` is being interpreted as arguments to the command. But if I rewrite it like this, it works: function! s:auto_win_width() if exists(w:winwidth) w:winwidth WinWidth endif endfunction autocmd WinEnter * call s:auto_win_width() So it seems that there is some problem with using a user-defined command in a single-line series of commands, separated by '|'s (if I replace the `WinWidth` with something built-in, like `echo 'foo'`, it works in both cases). Is this some obscure special case of Vim's syntax or is it just a bug? You forgot to set the -bar switch in the definition of WinWidth, therefore it cannot be followed by | and another command. See :help :command-bar Best regards, Tony. -- What I want is all of the power and none of the responsibility. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: what should I know if I want to wrote a simple plugin like this
On 11/11/11 15:36, Jason wrote: I just need a very simple plugin, I want do it myself, when I press {enter , it become below `I` means cursor { I } if I press ({enter it goes to ({ I }) |( = (|) |{ = {|} I don't want to know every thing about plugin development, but I want to know the most useful things about write a plugins. I don't think you need a plugin for that. A simple function and an expr mapping ought to be enough. See :help :function :help map.txt :help :map-expr Best regards, Tony. -- Another good night not to sleep in a eucalyptus tree. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: python scripting: get current visual selection
On 11/11/11 18:16, Gelonida N wrote: Hi, I am rather new to the python scripting module of vim. I wanted to write a small test script, which is analyzing all text, that I yanked into named buffers. (not sure if 'named-buffer' is the correct vi term) Small example buf_names = 'abcd' for buf_name in buf_names: yank_buffer = vim.?('a') # don't know this command yank_buf_len = len(yank_buf) # not sure if len() would be right print('yank buffer %s contains %d characters' % (buf_name, yank_buf_len)) I found vim.buffers , but this addresses the edit-buffers and not the 'yank-buffers' Thanks a lot in advance. To get what has just been yanked (and is in Vim register 0 ), try yank_buffer = vim.eval('@0') Similarly, for the contents of register a yank_buffer = vim_eval('@a') See :help python-eval :help expr-register :help registers Best regards, Tony. -- The more we disagree, the more chance there is that at least one of us is right. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: python scripting: get current visual selection
On 11/11/11 18:56, AK wrote: On 11/11/2011 12:49 PM, Gelonida N wrote: On 11/11/2011 06:39 PM, AK wrote: On 11/11/2011 12:16 PM, Gelonida N wrote: Hi, I am rather new to the python scripting module of vim. I wanted to write a small test script, which is analyzing all text, that I yanked into named buffers. (not sure if 'named-buffer' is the correct vi term) I think this should work: text = vim.eval(@a) print len(text) They are called registers, not yank buffers, and to get their value in script, see :h @r -ak Thanks a lot AK and Tony, This helps me a lot. (also getting the nominclature right) Is there a register for the contents of the current visual selection (before I pressed 'y') or would I have to fetch this contents differently (force for example a yank to a register ufront) It might be in + or * register on unix? But a more reliable way is to yank it into a register, you can then restore selection using gv command: :h gv -ak + is the clipboard (as in Edit = Paste); * is the X11 selection (as in MiddleMouse). Vim's visual selection isn't put in a register unless you have :set clipboard=autoselect (in console mode) or :set guioptions+=a (in gvim) (see :h 'clipboard' and :h guioptions-a ). Best regards, Tony. -- Don't change the reason, just change the excuses! -- Joe Cointment -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: How to copy to or paste from clipboard at mac OS X
On 11/11/11 19:03, jason.桂林 wrote: I am using MacVim now, copy paste is a very big trouble for me. If I use Cmd+V to paste, the indent and some auto things will make the code totally chaos. If I select and use Cmd+C to copy, the line number will include in the code I am mess up -- Best regards, Jason Green 桂林 I'm not sure what differences there are between the X11 clipboard and the Cocoa clipboard: maybe you ought to ask this on the vim_mac list. In general, Vim sees the clipboard as the + register: I recommend not to use mswin.vim, but rather to use +p +P :[range]put + Edit = Paste to put (paste) [Visual]+y +y{motion} +y{object} +yy :[range]y + Edit = Copy to yank (copy) [Visual]+yd +d{motion} +d{object} +dd :[range]d + Edit = Cut to delete (cut). If indent behaves weirdly when you paste, then maybe you should toggle the 'paste' option (q.v.). Best regards, Tony. -- If you only have a hammer, you tend to see every problem as a nail. -- Maslow -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: what is vim's printf, as it is in c
On 10/11/11 05:29, Ben Fritz wrote: On Nov 8, 11:07 pm, Steve liusliu@gmail.com wrote: On Wed, Nov 9, 2011 at 12:59 PM, Marc Webermarco-owe...@gmx.de wrote: Excerpts from Steve liu's message of Wed Nov 09 05:47:10 +0100 2011: I finally got it. I don't know your words at all yesterday. So I learn 'register' and 'buffer' the whole morning. And finally got it. I now know how to redirect output in vim. It doesn't matter how you did it. It matters that you did it. Congratulation! Keep in Mind that VimL is nice for scripting tasks but doesn't scale very well. Thus for larger projects consider interfacing with another language such as python, perl, ruby, (there are countless others) [?] Probably Marc is referring to a few things: 1. Vim's internal scripting language (sometimes called either VimL or vimscript) can be hard to use, because a large number of user settings can affect script execution 2. VimL is often slower than other interpreted languages such as python, perl, ruby, tcl, scheme, etc. and almost always slower than compiled languages like C or C++. 3. Other modern languages have more support/examples/read-made libraries (though probably not more documentation), more common syntax/ semantics, better debugging support, cleaner object-oriented methods, etc. 4. All those interpreted languages I mentioned above have an interface which can be used from within Vim to run a script in this other language and control Vim functionality. Some very impressive plugins are written in other languages, e.g. the gundo plugin, written mostly in python (I believe partially to make it easier to pull in tree-rendering code from Mercurial's source code). So Marc is recommending, if you do anything heavy, consider a different language than Vim's internals. That said, I've never felt the need to resort to a different language when hacking Vim. Neither have I; and it should also be remembered that Vim is often compiled without MzScheme, or without Python, etc., but never without Vim-script capability — indeed, the latter cannot be left out at compile-time. Parts of it can: for instance the stripped-down Vim installed as vi on some Linux distros comes with (among others) no syntax highlighting, no split windows and no arithmetic evaluation — but it will still accept vim-script language (of a kind) in its vimrc. Best regards, Tony. -- A chubby man with a white beard and a red suit will approach you soon. Avoid him. He's a Commie. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: How to copy strings into system's clipboard on n900 (maemo)?
On 10/11/11 17:29, Charles Campbell wrote: Ben Fritz wrote: [snip] I don't know, I am pretty sure if your Vim is compiled for it, it should work. But then, I don't know what n900 refers to. Maybe you need an X server running. [snip] Hello, A quick google search shows that Nokia makes a smartphone called the N900; the wiki article mentions Maemo 5 (although I still have no idea what it is). Regards, Chip Campbell Maemo is a smartphone operating system. See http://en.wikipedia.org/wiki/Maemo for details. Best regards, Tony. -- BLISS is ignorance -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Setting encoding for a type of file
On 10/11/11 20:06, Marcio Gil wrote: When I edit a DOS batch (for example), I always need to put ':e + +enc=cp850'. Can I add in my _vimrc file a auto command for this? Example: autocmd FileType dosbatch setlocal fileencoding=cp850 (don't works!) Thanks, Marcio. The FileType autocommand event is too late for setting the 'fileencoding', because at that point the file has already been read. For the same reason it isn't useful to set that option by means of a modeline. Try (untested) au BufReadPre,BufNewFile *.bat,*.btm,*.sys setlocal fenc=cp850 Best regards, Tony. -- The notion of a record is an obsolete remnant of the days of the 80-column card. -- Dennis M. Ritchie -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Setting encoding for a type of file
On 10/11/11 22:52, Marcio Gil wrote: On Nov 10, 7:26 pm, Marcio Gilmarciom...@bol.com.br wrote: This works for me: exec 'autocmd BufReadPre *.bat set fileencodings=ucs-bom,cp850,latin1' I put this in my _vimrc: autocmd BufNewFile,BufReadPre *.bat,*.sys,*.cmd,*.prg,*.ch set fileencodings=ucs-bom,cp850,latin1 Thank you all. Marcio. This won't work if you edit a batch file and then some non-batch file (*.c, *.htm, *.txt, whatever; even if you look at a Vim helpfile) in the same Vim session. Since 'fileencodings' is a global-only option, it will still be ucs-bom,cp850,latin1 (where the latin1 part will never be used, since it is after cp850 which is 8-bit and therefore cannot give a fail signal), so Vim will treat that second file (if it has no BOM) as if it were in cp850 which is probably not what you want. Maybe au BufNewFile,BufReadPre * \ set fencs=ucs-bom,utf-8,latin1 au BufNewFile,BufReadPre \ *.bat,*.sys,*.cmd,*.prg,*.ch \ set fencs=ucs-bom,cp850 The autocommands will be run in the order they were defined, so that for these 5 extensions the second one takes precedence. The first one should be set to the defaults you want to use for all other files. Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 214. Your MCI Circle of Friends are all Hayes-compatible. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Abbreviation with an @
On 06/11/11 23:51, Quincy Bowers wrote: I would like to create an abbreviation like the following: :iabbrev @author @author Author Name But when I attempt this I get the error 'E474: Invalid argument'. This works fine though: :iabbrev @ @author Author Name Can anyone tell me the right way to write this abbreviation command without changing the left hand side to something other than @author? Thanks, Quincy There are three kinds of abbreviations, see :help abbreviations - full-id the {lhs} consists of keyword characters only - end-id the last character, but none of the others, is a keyword char. - non-id the last character is not a keyword char, the rest can be anything except whitespace. @ is non-id @a is end-id @au or @aut or @author are not valid abbreviations. (letters, but not @, are keyword characters). Conclusion: :abbrev @author {rhs} is invalid for any value of {rhs}. The answer to your question is: you can't. Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 212. Your Internet group window has more icons than your Accessories window. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Abbreviation with an @
On 07/11/11 06:37, Bee wrote: On Nov 6, 9:14 pm, Christian Brabandtcbli...@256bit.org wrote: Hi Tim! On So, 06 Nov 2011, Tim Chase wrote: On 11/06/11 19:04, Quincy Bowers wrote: Ah, I wonder if abbreviations can only be defined if they don't cross keyword boundaries... And if that is the case is that intended? That's why I was confused that :iab @a @author Author Name worked, but :iab @author @author Author Name errored out. That is explained at :h abbreviation. , | There are three types of abbreviations: | | full-id The full-id type consists entirely of keyword | characters (letters and characters from 'iskeyword' | option). This is the most common abbreviation. | | Examples: foo, g3, -1 | | end-id The end-id type ends in a keyword character, but all | the other characters are not keyword characters. | | Examples: #i, ..f, $/7 | | non-id The non-id type ends in a non-keyword character, the | other characters may be of any type, excluding space | and tab. {this type is not supported by Vi} | | Examples: def#, 4/7$ ` So while @a is of type end-id @author isn't. regards, Christian :set isk? returns: iskeyword=@,48-57,_,192-255 That means @ is a keyword character, it also means _ is a keyword character, and both the following SHOULD be full-id. This fails: :iab @author @author Author Name But this seems to be ok: :iab _author @author Author Name -Bill In the value of 'iskeyword' (whose explanation resends to 'isfname'), @ doesn't mean @, it means A-Za-z (plus maybe á, é, etc.). To make the @ character a keyword character, use @-@ Best regards, Tony. -- This test has been designed to evaluate reactions of management personal to various situations. You are making a sales presentation to a group of corporate executives in the plushest office you've ever seen. The enchillada casserole and egg salad sandwich you had for lunch react, creating severe pressure. Your sphincter loses control and you break wind, causing the glass bookcase doors to shatter and a secretary to pass out. YOU SHOULD: (a) Offer to come back next week when the smell has gone away. (b) Point to the Chief Executive and accuse him of the offense. (c) Challenge anyone in the room to do better. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: copy the output of :%g command to a register
On 07/11/11 07:16, sinbad wrote: hi, how to copy the output of :%g command to a register cheers The :g command produces no output; the output is from the ex-command after the second slash in :[range]g/pattern/command. For the default :p command, see :help :redir Best regards, Tony. -- Uncle Ed's Rule of Thumb: Never use your thumb for a rule. You'll either hit it with a hammmer or get a splinter in it. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: mapping ALT-backspace
On 05/11/11 17:21, Benjamin R. Haskell wrote: On Sat, 5 Nov 2011, Tony Mechelynck wrote: Well, under Linux each different terminal (Linux console, KDE konsole, gnome-terminal, xterm, mlterm, ...) can react differently, but gvim has a better grasp of what you type than any of them, because there's one fewer layer between Vim and your keyboard. For a similar reason it also gives you better control of what you display (more colours, better control of: fonts, multi-language texts, cursor shapes, ...). IMHO the only job for which console Vim is better than the GUI is when displaying RTL and LTR scripts together in a single file, in a full-bidi terminal such as mlterm. I found mlterm great for just-Arabic, but I could never quite get fonts set up properly for displaying RTL and LTR simultaneously. But, you're also leaving out (IMHO the best reason to use console Vim:) how nice it is to have a consistent UI regardless of whether you're working locally or on a remote machine. I do most of my work in terminal emulators, and the fact that Vim behaves exactly the same whether I've first ssh'ed somewhere else is great. The overhead from X11 over slightly-unreliable network links is just enough to be irritating. I guess the reason I left this out is that I never work on a remote machine. Best regards, Tony. -- Job Placement, n.: Telling your boss what he can do with your job. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Compound search
On 06/11/11 02:02, Bee wrote: [...] PS Is there any way to edit or delete a post? As long as you're still composing it, you can change anything. Once you send it, it's too late. :-P Best regards, Tony. -- If that makes any sense to you, you have a big problem. -- C. Durance, Computer Science 234 -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Compound search
On 06/11/11 04:13, Bee wrote: On Nov 5, 6:54 pm, Tony Mechelynckantoine.mechely...@gmail.com wrote: On 06/11/11 02:02, Bee wrote: [...] PS Is there any way to edit or delete a post? As long as you're still composing it, you can change anything. Once you send it, it's too late. :-P Best regards, Tony. -- If that makes any sense to you, you have a big problem. -- C. Durance, Computer Science 234 Ha! I did find out how to delete a message. I see you saw it before I was able to delete. The 'More options' on the right of a post has delete, which can be done after posting. Delete... maybe, but not modify. I'm getting my Vim-list messages by POP, which means that I'll see everything unless the author deletes it either within the 10-minute interval before I next poll the mail server, or when I'm not connected to the Internet (and even if I leave the modem connected when I go to bed or to town, my ISP will disconnect me forcibly whenever I reach 36 hours ą 1 second continuous connection time). Best regards, Tony. -- Always try to do things in chronological order; it's less confusing that way. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: mapping ALT-backspace
On 03/11/11 17:07, meino.cra...@gmx.de wrote: Tony Mechelynckantoine.mechely...@gmail.com [11-11-03 17:00]: On 03/11/11 03:54, meino.cra...@gmx.de wrote: Tony Mechelynckantoine.mechely...@gmail.com [11-11-02 06:40]: On 02/11/11 03:53, meino.cra...@gmx.de wrote: Hi, the zsh I am using is recoginzing ALT-backspace as delete one word backward, which is very handy. Unfortunately I have not found a way to map this in a similiar way for vim. How can I map ALT-backspace in vim? Thank you very much in advance for any help! Best regards, mcc In Console Vim, it may depend on your terminal: I'm not sure that every terminal passes something recognizable to Vim when you hit Alt-Backspace. In gvim, it'sM-BS and my gvim (with GTK2/Gnome2 GUI) sees it. To see if Vim gets something when you hit that key combo, open Vim in Insert mode in an empty buffer and hit Ctrl-V followed by Alt-Backspace, then Ctrl-K followed by Alt-Backspace. If you don't get anything, Vim hasn't seen the keypress. If it sees something, in gvim you should see the equivazlent in both cases; in Console Vim you should see the bytes passed by the keyboard interface after Ctrl-V, or the equivalent (here,M-BS, unless the keyboard passes something else) after Ctrl-K. In Insert mode, to delete the word before the cursor you can hit Ctrl-W, see :help i_CTRL-W In Normal mode, you should be able to use Shift-Left as a modifier to the d (delete) command, to delete [count] words leftwards, or the command daw (delete a word) to delete the word under the cursor (on both sides) and the white space on one side of it. See :help text-objects Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 209. Your house stinks because you haven't cleaned it in a week. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php Hi Tony, Thank you very much for your explanations. Since I am using console vim most of the time I am trying to get it working there. The result of the test is, that vim doesn't see any of the keypresses. You wrote that is due to the terminal. I dont understand this completly I fear... The zsh, running under the same terminal adn which was the one startet vim, does see ALT-nackspace. What I am doing/inderstanding wrong here? Best regards, mcc I don't know. Maybe nothing: Vim in Windows console uses cooked input IIRC, and that puts it more at the mercy of the DOS-like keyboard driver than if it used raw input; but OTOH (IIUC), raw input would read AaZzQqWwMm incorrectly on AZERTY keyboards, YyZz and maybe Ww on QWERTZ keyboards, and practically everything on Dvorak keyboards, not to mention non-Latin keyboards. But maybe I don't UC. See also :help win32-problems (I'm not sure how applicable these are to Windows NT / XP / Vista / 7). Best regards, Tony. -- We gave you an atomic bomb, what do you want, mermaids? -- I. I. Rabi to the Atomic Energy Commission -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php Hi Tony, I am running Linux, not windows. Sorry for not mention this... Best regards, mcc Well, under Linux each different terminal (Linux console, KDE konsole, gnome-terminal, xterm, mlterm, ...) can react differently, but gvim has a better grasp of what you type than any of them, because there's one fewer layer between Vim and your keyboard. For a similar reason it also gives you better control of what you display (more colours, better control of: fonts, multi-language texts, cursor shapes, ...). IMHO the only job for which console Vim is better than the GUI is when displaying RTL and LTR scripts together in a single file, in a full-bidi terminal such as mlterm. Best regards, Tony. -- It's odd, and a little unsettling, to reflect upon the fact that English is the only major language in which I is capitalized; in many other languages You is capitalized and the i is lower case. -- Sydney J. Harris -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Ubuntu packages of latest Vim? (to fix bug)
On 05/11/11 04:03, John Little wrote: Does anyone have packages for Ubuntu Oneiric of the latest Vim? Building your own vim from the Mecurial repository is much easier than you might expect. For Ubuntu start with sudo apt-get build-dep vim-gnome then follow Tony's instructions at http://vim.wikia.com/wiki/Getting_the_Vim_source_with_Mercurial and http://users.skynet.be/antoine.mechelynck/vim/compunix.htm In short, Oneiric's gVim ... doesn't show the menu bar at all. Not showing the menu bar is a Unity thing, not vim's fault. Mousing over the bar at the top of the screen (not the vim window) might, depending on the invocation of gvim, show you vim's menu bar there. There's workarounds, by setting an environment variable before invoking vim. (Unless you are keen on Unity, I suggest defecting to Kubuntu.) Regards, John Best regards, Tony. -- One way to make your old car run better is to look up the price of a new model. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: mapping ALT-backspace
On 03/11/11 03:54, meino.cra...@gmx.de wrote: Tony Mechelynckantoine.mechely...@gmail.com [11-11-02 06:40]: On 02/11/11 03:53, meino.cra...@gmx.de wrote: Hi, the zsh I am using is recoginzing ALT-backspace as delete one word backward, which is very handy. Unfortunately I have not found a way to map this in a similiar way for vim. How can I map ALT-backspace in vim? Thank you very much in advance for any help! Best regards, mcc In Console Vim, it may depend on your terminal: I'm not sure that every terminal passes something recognizable to Vim when you hit Alt-Backspace. In gvim, it'sM-BS and my gvim (with GTK2/Gnome2 GUI) sees it. To see if Vim gets something when you hit that key combo, open Vim in Insert mode in an empty buffer and hit Ctrl-V followed by Alt-Backspace, then Ctrl-K followed by Alt-Backspace. If you don't get anything, Vim hasn't seen the keypress. If it sees something, in gvim you should see the equivazlent in both cases; in Console Vim you should see the bytes passed by the keyboard interface after Ctrl-V, or the equivalent (here,M-BS, unless the keyboard passes something else) after Ctrl-K. In Insert mode, to delete the word before the cursor you can hit Ctrl-W, see :help i_CTRL-W In Normal mode, you should be able to use Shift-Left as a modifier to the d (delete) command, to delete [count] words leftwards, or the command daw (delete a word) to delete the word under the cursor (on both sides) and the white space on one side of it. See :help text-objects Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 209. Your house stinks because you haven't cleaned it in a week. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php Hi Tony, Thank you very much for your explanations. Since I am using console vim most of the time I am trying to get it working there. The result of the test is, that vim doesn't see any of the keypresses. You wrote that is due to the terminal. I dont understand this completly I fear... The zsh, running under the same terminal adn which was the one startet vim, does see ALT-nackspace. What I am doing/inderstanding wrong here? Best regards, mcc I don't know. Maybe nothing: Vim in Windows console uses cooked input IIRC, and that puts it more at the mercy of the DOS-like keyboard driver than if it used raw input; but OTOH (IIUC), raw input would read AaZzQqWwMm incorrectly on AZERTY keyboards, YyZz and maybe Ww on QWERTZ keyboards, and practically everything on Dvorak keyboards, not to mention non-Latin keyboards. But maybe I don't UC. See also :help win32-problems (I'm not sure how applicable these are to Windows NT / XP / Vista / 7). Best regards, Tony. -- We gave you an atomic bomb, what do you want, mermaids? -- I. I. Rabi to the Atomic Energy Commission -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Mapping Problem. Down key have a slow response time.
On 03/11/11 06:47, ozhan fenerci wrote: Dear List, I have remapped up-down-right-left keyboard keys. It is like Vim Mappings My Mappings h-move leftk j-move downb k-move upn l-move rightl I have remapped these keys in the .vimrc file to work in insert mode and control mode. Normal Mode noremap h b noremap j n noremap l l noremap n k noremap b j noremap k h Insert Mode imap C-space esc imap C-l right imap C-k left imap C-n up imap C-b down It works but in Insert mode C-bdown has a slow response time from other mappings. It is not as fast as other mappings. I wonder what I am doing wrong. Regards, Ozhan Not sure. The following may or may not help you, it probably won't hinder you: :set timeout timeoutlen=5000 ttimeoutlen=100 where: - the times are in milliseconds - ttimeoutlen should be shorter than the time between two keypresses at your fastest typing speed but longer than the time between successive bytes sent by the keyboard driver for a multibyte keycode (such as most non-printing keys) - timeoutlen should be longer than the time between the successive keypresses in the {lhs} of a mapping (if you have mappings with a multikey {lhs}) at your slowest typing speed, but still not too slow so you can wait for a mapping to time out if you do _not_ want to trigger it. See: :help 'timeout' :help 'timeoutlen' Best regards, Tony. -- The Heineken Uncertainty Principle: You can never be sure how many beers you had last night. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: replacing all characters in the current line?
On 02/11/11 05:21, Jose Caballero wrote: Hi, this happened to me today. I had a line like this one === and I wanted to replace all characters by '-', so I could have something like I thought I could do it by combining 'g' and 'r' as I understood 'g' is good to repeat the same command over all chars in a line (like guu or gUU). However, I was not able to make it work. I ended up doing something like :.s/=/-/g Is not really possible to replace all chars in the current line with a combination of 'g' and 'r' commands? Cheers, Jose In Normal mode, IIUC g is not a complete command, but the first character of quite a number of multikey commands, see :help g To replace all characters in a line, I would use the :s[ubstitute] command, as you ended up doing, or one of its variants: To underline a (left-justified) heading: yyp then :s/./-/g The . range is optional, since the default for the :s command is the current line. However the above method wouldn't work if there are hard tabs in the line. Best regards, Tony. -- Celestial navigation is based on the premise that the Earth is the center of the universe. The premise is wrong, but the navigation works. An incorrect model can be a useful tool. -- Kelvin Throop III -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: How to enable mouse wheel scrolling in non-gui vim.exe?
On 02/11/11 05:23, Toddintr wrote: I meant to say How can I enable mouse scroll WHEEL in non-gui vim.exe? -- sorry. Todd AFAICT it depends on the terminal; and I have freed myself from Windows some time ago (months? years? Years I think) so I cannot experiment on a Windows console. Here on Linux, every different terminal emulator reacts differently to mouse actions: some don't pass them to Vim at all, some can move the cursor and open a Select area by dragging but won't react to the mouse wheel, some will move the cursor up and down when I roll the wheel but won't react to mouse clicks... Apparently I can't get full mouse performance in console Vim but only in gvim. Maybe you can configure your cmd.exe console, maybe by clicking (left or right, I'm not sure) the top left icon of the terminal window when Vim is running in it? Best regards, Tony. -- There was a bluestocking in Florence Wrote anti-sex pamphlets in torrents, Till a Spanish grandee, Got her off with his knee, And she burned all her works with abhorrence. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: mapping ALT-backspace
On 02/11/11 03:53, meino.cra...@gmx.de wrote: Hi, the zsh I am using is recoginzing ALT-backspace as delete one word backward, which is very handy. Unfortunately I have not found a way to map this in a similiar way for vim. How can I map ALT-backspace in vim? Thank you very much in advance for any help! Best regards, mcc In Console Vim, it may depend on your terminal: I'm not sure that every terminal passes something recognizable to Vim when you hit Alt-Backspace. In gvim, it's M-BS and my gvim (with GTK2/Gnome2 GUI) sees it. To see if Vim gets something when you hit that key combo, open Vim in Insert mode in an empty buffer and hit Ctrl-V followed by Alt-Backspace, then Ctrl-K followed by Alt-Backspace. If you don't get anything, Vim hasn't seen the keypress. If it sees something, in gvim you should see the equivazlent in both cases; in Console Vim you should see the bytes passed by the keyboard interface after Ctrl-V, or the equivalent (here, M-BS, unless the keyboard passes something else) after Ctrl-K. In Insert mode, to delete the word before the cursor you can hit Ctrl-W, see :help i_CTRL-W In Normal mode, you should be able to use Shift-Left as a modifier to the d (delete) command, to delete [count] words leftwards, or the command daw (delete a word) to delete the word under the cursor (on both sides) and the white space on one side of it. See :help text-objects Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 209. Your house stinks because you haven't cleaned it in a week. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: function to apply multiple whole-file substitutions
On 02/11/11 03:53, eda wizard wrote: Greetings all, I'm trying to craft a function to apply a series of pattern-matching substitutions to the file. So far I've got this in my .vimrc function Scrub () :%s// /g :%s/\s*$//g endfunction map :call Scrub () but it's not working, seems to complain about lack of line-endings. Would someone help me out please? Trick-or-treat, Still-learning Steve Like Sven, I'm not sure what you actually want to do — it wouldhave been simpler if you had just told us that, in plain English. If you want to delete all end-of-line spaces, a simple substitute will do the trick: :%s/\s*$// or even :%s/\s\+$//e the e flag avoids an error message if there are zero substitutions in the whole file (none of your lines ends in whitespace). It is not necessary in the first case because that will match on every line, matching zero or more whitespace, as many as possible. Also, what _exact_ error message do you get? And there seems not to be a {lhs} in your mapping: after correcting your function, you should rewrite the mapping as :map F4 :call Scrub()CR — with F4 or anything else as the first space-separated aregument, meaning what you hit to trigger the mapping, and CR at the end meaning the mapping generates an Enter key at the end — the omission of the CR at the end might be the reason why Vim complains about a missing end-of-line, but I cannot be sure without the exact error message. Best regards, Tony. -- Ray's Rule of Precision: Measure with a micrometer. Mark with chalk. Cut with an axe. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Mapping shortcuts
On 31/10/11 21:15, Chris Jones wrote: On Mon, Oct 31, 2011 at 01:06:45PM EDT, George Papanikolaou wrote: I know this is simple. but I can't figure it out by Googling... so. Nothing wrong with googling, but there's no guarantee whoever posted his favorite trick fully understands the problem and that whatever worked in his case will not have side-effects that may be quite unsuitable in your case. Maybe now's the time for you to start working with the complete (and 100% accurate) vim help and lose the Google-search habit...? Rather than start with the Vim reference manual, where non-specialists often find themselves overwhelmed by the sheer quantity of information and give up, it's probably more effective to study the Vim user manual one chapter at a time until you have a fair idea of vim's capabilities and how to put them to good use. You can access the user manual via: :help user-manual This gives you access to the user manual's table of contents. In this particular case, you will not find a ‘mappings’ section (this is why you often need to have at least skimmed through the entire manual beforehand to find what you are looking for), but there is a very clear (and authoritative) howto-style discussion of them under: |usr_40.txt| Make new commands Note that there is a very useful introduction to the way the Vim documentation is organized in: |usr_01.txt| About the manuals You may want to read it even before you read the introduction to mappings mentioned above. [...] CJ Also, IMHO there are two must read sections, about searching the help. First, hit the F1 key in vim or gvim and read what you find there. Later, when you have the time, read the help chapter giving full details of how to search the help, at :help online-help Best regards, Tony. -- My doctor told me to stop having intimate dinners for four. Unless there are three other people. -- Orson Welles -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Mapping shortcuts
On 31/10/11 22:03, Benjamin R. Haskell wrote: [...] The problem is sometimes that it's too complete, and isn't organized by the person who's looking for the information (naturally). Google often cuts through that problem (e.g. by allowing synonyms that the help writer didn't consider, or terms that aren't fully correct). [...] Yes, the Vim help is as complete and as accurate as is humanly possible, but sometimes it presents a needle-and-haystack problem. This, however, has been greatly alleviated, first (in Vim 6.2 IIRC) by the :helpgrep command, and later (Vim 7.x) by the helphelp.txt helpfile, which centralizes all help on searching help (except the short summary found by hitting F1) in a single place. Hence the must read in my previous post. And I'll add here: even if you do find something which seems relevant about Vim by Googling or by searching the Wikipedia, always check it afterwards with the online help, where you may find that your Google info is perhaps slightly out-of-date, or omits just the corner case which is giving you problems now. Best regards, Tony. -- A wizard cannot do everything; a fact most magicians are reticent to admit, let alone discuss with prospective clients. Still, the fact remains that there are certain objects, and people, that are, for one reason or another, completely immune to any direct magical spell. It is for this group of beings that the magician learns the subtleties of using indirect spells. It also does no harm, in dealing with these matters, to carry a large club near your person at all times. -- The Teachings of Ebenezum, Volume VIII -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Filetype error
On 29/10/11 03:47, Justin Lafferty wrote: For the longest of times my .vimrc has looked as follows: Because some options may not be vi compatible set nocompatible Turns on filetype plugins filetype plugin on filetype indent on Ignore case when searching set ignorecase set smartcase Highlight searches set hlsearch Toggles the highliting off with ctrl+n :map silent C-n :set invhlsearchCR Shows matches as they are found set incsearch Remove trailing whitespace autocmd FileType c,cpp,java,php,js,python,ruby autocmd BufWritePre buffer :call setline(1,map(getline(1,$),'substitute(v:val,\\s\\+$,,)')) use spaces instead of tab set expandtab set smarttab Changes tab amount set shiftwidth=4 set softtabstop=4 Maps jj to esc for faster exit of insert modes imap jj Esc Turns on syntax coloring syntax on Enable line numbers set number set numberwidth=3 Normal backspace operation set backspace=indent,eol,start But now for some reason whenever I type the comment character for the particular language I am using, the character is repeated on the next line. For example if i am editing test.cpp if i type: //Comment Then press enter the file now looks as follows: //Comment // Through editing out the different options I have boiled the problem down to the filetype plugin on. And was wondering if anyone knows a fix for this. And if it helps, my .vim/ftplugin directory is empty. It is not an error, or as the saying goes, T'aint a bug, it's a feature. IIUC many standard ftplugins have long set formatoptions+=ro — of course, when you create a [NoName] file it still has no filetype (even if you give the file a name without reloading it) and therefore no ftplugin has set anything special for it. As soon as you name it _and_ reload it, the ftplugins apply. See :help 'formatoptions' :help fo-table - Flag r means: Automatically insert the current comment leader after hitting Enter in Insert mode. - Flag o means: Automatically insert the current comment leader after hitting 'o' or 'O' in Normal mode. To avoid these in C and C++ files, add the following two-line file as $HOME/.vim/after/ftplugin/c.vim (for Unix, Linux or Mac OS X) or $HOME/vimfiles/after/ftplugin/c.vim (in Vim notation, for Windows): disable comment leader insertion setlocal fo-=r fo-=o (the C++ ftplugin does nothing other than invoke the C ftplugin). If the directories don't yet exist, create them too. The above is per-filetype (with the exception that the C ftplugin is also used for C++), so if you want the same for, let's say, javascript and CSS (which have similar comment structures as C and C++), you'll have to drop copies of the same file as javascript.vim and css.vim in the same directory: you get the drift. For a blanket disable, you may use instead autocmd FileType * setlocal fo-=r fo-=o which must be placed _after_ filetype plugin on in your .vimrc or _vimrc in order to have an effect; *but* if at any time you use :filetype plugin off followed by :filetype plugin on this autocommand will lose its effect, which is not the case of the scripts in .../after/ftplugin/. See also the following recent threads on vim_use: - Permanent disable comment next line (about 'formatoptions' flags r and o) - Please fix: make Windows Vim use same files as unix. No reason not to and it's confusing in mixed envirionments. (started as: Can't get vim to use custom color in personal folder(finds .vimrc/.gvimrc but not .vim/colors/name.vim) ) (about ~/vimfiles/ vs. ~/.vim/) Best regards, Tony. -- Blessed are the meek for they shall inhibit the earth. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: how to make 'h,j,k,l' faster ?
On 28/10/11 17:21, Ben Fritz wrote: On Oct 28, 6:16 am, Tim Chasev...@tim.thechases.com wrote: On 10/27/11 22:20, gaoqiang wrote: I feel those keys slow. and word-move-keys are a little diffcult to make a accurate move. While it's a bit of a non-answer, I'd recommend using Vim's many other movement keys to move faster and more accurately. I almost NEVER use h/l to move left/right but rather use f/F/t/T/,/; (and occasionally in prose, the parens to move by sentence) to move horizontally. For vertical movements, it's usually faster to guess roughly and then fine-tune with j/k to move up/down. This can be done with }/{ to jump to blank lines, using / to search forward, using ]]/[[/]}/]{/[{/[}/[(/]) to jump to code-block starts/ends, or using H/M/L to jump to the first/middle/last line on the screen. Also, don't forget that you can prefix a count on each of these commands to do it N times (or in the case of H/L, go to the Nth-[top|bottom]-line-of-the-screen) I find it very nice to set relative line numbers and use a count with j/k for down/up movement. One would think you could do the same thing with absolute line numbers and G, but I always find that to be too much typing. I usually end up typing 4j instead of or 1546G, much faster. And getting in the habit makes it that much easier to do things like d4j instead of Vd. A naked range is also a go to line: :1234 goes to line 1234 :$-5 goes to 5 lines above the last line (i.e. the 6th line from the end) :.+10 goes 10 lines down :'B+2 goes to the file containing mark 'B, 2 lines after the mark :'-2 goes to 2 lines higher than the end of the latest Visual area You can also use relative line numbers after a search: /^\s*}$/-1 goes to the line before the next line containing only zero or more whitespace and one closing brace ?^$?+1 goes to the first line after the previous empty line etc. Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 206. You religiously respond immediately to e-mail, while ignoring your growing pile of snail mail. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Pernanent disable comment next line
On 28/10/11 17:36, Michael D. Berger wrote: In a previous thread I read that I could disable automatically commenting of the next line with: :set formatoptions-=ro This works, but I have to do it every time I open a file. So on my Fedora 15_64 system, I added that set line to /etc/vimrc but it didn't work. Any suggestions? Thanks, Mike. What about adding it to $HOME/.vimrc instead? And if it still doesn't work, try :verbose setlocal fo? in a problematic file, to see where it was set. If, for instance, it was set in /usr/share/vim/vim73/ftplugin/c.vim (i.e. $VIMRUNTIME/ftplugin/c.vim) then create a file named $HOME/.vim/after/ftplugin/c.vim (creating any needed directories in the process), with the one-line content: setlocal fo-=r fo-=o (Note: unsetting both flags separately works even if they don't follow each other immediately in the order given). Best regards, Tony. -- There's no easy quick way out, we're gonna have to live through our whole lives, win, lose, or draw. -- Walt Kelly -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Please fix: make Windows Vim use same files as unix. No reason not to and it's confusing in mixed envirionments.
On 28/10/11 22:26, Linda W wrote: [...] If you put a symlink on linux, windows will see it as a hardlink. That means any file copies will go through it. [...] If you set a symlink on a Linux (ext2, ext3, ext4, reiser, etc.) filesystem, Windows won't see it at all because it cannot read those filesystems. I was the one who mentioned symlinks, I mentioned them in the context of double-boot, not of Cygwin, and I explicitly mentioned ext2, ext3, ext4 and reiser filesystems. So who's distorting whose words? Regards, Tony. -- We'll cross out that bridge when we come back to it later. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: printfont doesn't change font only height on Linux
On 27/10/11 15:23, octoploid wrote: I'm trying to change the font that vim uses with the hardcopy command: set printfont=Consolas:h9 This changes the font height but the font used is still Courier: %%PageResources: font Courier Is there a way to actually choose a different font? :help pfn-option is ambiguous: it says it has the same format as 'guifont' but later on it says on non-Windows systems, only :h11 is recognised, where 11 is the font size. However, on X11 systems anything that includes :h11 would be invalid for 'guifont'. So what should 'printfont' be set to in that case? Here are the valid 'guifont' formats for the various X11 GUI flavours: GTK2 (but not GTK1): :set gfn=Consolas\ 9 kvim (obsolete): :set gfn=Consolas/9/-1/5/50/0/0/0/1/0 Photon (is that X11 or not, I'm not sure): :set gfn=Consolas:s9 Other X11 (including GTK1 but not GTK2): :set gfn=-*-consolas-medium-r-normal-*-*-90-*-*-m-*-* see http://vim.wikia.com/wiki/Setting_the_font_in_the_GUI Best regards, Tony. -- I've had a perfectly wonderful evening. But this wasn't it. -- Groucho Marx -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Please fix: make Windows Vim use same files as unix. No reason not to and it's confusing in mixed envirionments.
On 13/10/11 01:47, Linda W wrote: Jürgen Krämer wrote: (at least when I launch from explorer...)...so if it finds my .vim and .gvim, why doesn't it find .vim/colors/.vim? did you change the 'runtimepath' option? On Windows the directory for user-specific scripts is ~/vimfiles by default, not ~/.vim. --- I don't set a runtime path. I'd expect it to work the same as on unix/linux. Why should windows be different? IMO, it should look for .vim first, and then any old-style compat name, but **not looking** for ~/.vim at all would seem to be a bug. Vim also doesn't seem to find This is one of all those Vim traditions which remain because it is not worth breaking upwards compatibility to change them. On Unix-like systems, there is a tradition to put program config files for all programs in a directory with a name starting with a period, which would then be hidden by default. On DOS-like systems, before LongFileNames were invented, you couldn't have a file- or directory-name starting with a period. So ~/vimfiles was established where ~/.vim was the Unix tradition, and also ~/_vimrc and ~/_gvimrc where Unix would use ~/.vimrc and ~/.gvimrc. On systems with LongFileNames, Windows Vim still looks for .vimrc when it couldn't find ~/_vimrc, and for ~/.gvimrc when it couldn't find ~/_gvimrc. Conversely on Unix. This is a courtesy to double-boot etc. users. But these are just one file each, and read only once each, at startup. Adding an additional 'runtimepath' directory might make every runtime script lookup more sluggish, for little advantage. Platform-hopping Vim users should know (and, like everything else about Vim, it is documented, in this case at :help 'runtimepath') that user scripts are placed under ~/.vim/ on Unix and under ~/vimfiles/ on Windows. Beware though, that _system-wide_ scripts not distributed with Vim belong under $VIM/vimfiles on all systems, even on Unix. On a double-boot system, where soft links are easier to manage from the Unix side, and where the Linux kernel can read vfat filesystems but the Windows kernel cannot make head or tail of an ext2, ext3, ext4 or reiser filesystem, you could have your /etc/fstab mount your vfat partition somewhere, and then make ~/.vim on the Unix side a soft link to what would be seen as ~/vimfiles when running on the Windows side. In that case, don't forget that Windows Vim can source Unix-format scripts (with LF-only ends of lines) but Unix vim cannot source Dos-format scripts (with CR-LF), so all those common scripts would need to use Unix 'fileformat'. Best regards, Tony. -- I love this fucking University, and this University loves fucking me. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Syntax highlighting Problem in for Bash
On 21/10/11 15:17, Tom Bodine wrote: I was bitten by the old unexpected EOF while looking for matching `' error in bash. Where you start a comment some where in the middle of your script and forget to place a quote mark at the end. After searching through the text I could not find any string that matched this criteria. It was only when I loaded the script into SciTE that I could see that this text was the problem script # Syntax.: libraryCheck [-test] {executable} # Parameters : executable - an Executable and Linkable Formated file : -test : just do the test but don't fail on error # Return values .: 0 on success, exits if libraries not found /script Even though the third line appears as executable text to Bash, to me it looks like part of the comment in the other lines. Vim did not help me here since it colors the line starting with the colon the same as the line starting with the hash mark. In order to find the problem I loaded the script into Scite. Where as Scite treats lines starting with colons correctly and leaves them colored like regular text, Vim colors them the same as comments ( those lines wich start with hash marks). How can I change Vim's syntax coloring to treat lines starting with colons differently from those starting with hash marks? Thanks and Regards Tom Bodine In bash (as can be seen with help : without the quotes at the bash prompt) : is a do-nothing command. So it can be regarded as legitimate to treat it as a comment. Actually, in the current $VIMRUNTIME/syntax/sh.vim (version 118 dated Aug 16, 2011 and applying to all three of sh, bash and ksh) these colon lines are set to syntax group shColon at line 287, then at line 536 the shColon highlight group is linked to shComment which is in turn linked to Comment at line 612. So a colorscheme could highlight colon lines as something else than a comment by changing the highlight for the shColon highlight group. AFAICT from reading :help ft-bash-syntax there is no setting to change those default highlights. However the fact that the sh syntax script makes no provision for quoted strings extending on more than one line can be regarded as a bug (or as a limitation). I'm CC-ing Charles Dr. Chip Campbell, the current maintainer of that script. Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 203. You're an active member of more than 20 newsgroups. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: One line without EOL
On 21/10/11 17:25, meino.cra...@gmx.de wrote: Hi, is it possible to create a line of text with vim which do not contain any \n, \ra ? Or in other words: The line should contain nothing more than the visible chars. I need this to generate test data for testing a VFD... How can I accomplish this? Thank you very much in advance for any help! Best regards, mcc It is possible but definitely not recommended. You must :setlocal binary noeol in the file before writing it, and it must contain only the one line (it is of course not possible to have any line other than the last one end without an end-of-line mark). See :help 'binary' :help 'eol' Best regards, Tony. -- Behold the warranty ... the bold print giveth and the fine print taketh away. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Can change X11 window title after vim started?
On 20/10/11 16:23, LiaoCaiYuan wrote: dear all, in emacs, I can set it by (set-frame-name NewName) how can I do it in vim? Whether or not it is possible at all depends on whether you are using gvim or Console Vim (and, in the latter case, in which terminal). See :help 'title' :help 'titlelen' :help 'titlestring' Best regards, Tony. -- You need only reflect that one of the best ways to get yourself a reputation as a dangerous citizen these days is to go about repeating the very phrases which our founding fathers used in the struggle for independence. -- Charles A. Beard -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Tracing Vim into a log file.
On 20/10/11 23:49, Eddine wrote: Hello Yet another question, I have a strange behavior in my Vim at work. I often edit logs from process still working and still writing the log I'm reading in VIm (I have set autoread so it reloads) and I often have a behavior where my file is like folded ; All the part from the line 1 to current position of cursor disapears and let this charcter g` let says I Have line1 line2 line3 line4 line5 line6 X --- position of the cursor line7 line8 line9 line10 etc... I then have g`line6 X line7 line8 line9 line10 etc... Entering command :0 bring me back my whole file. I really don't know what happens. Is there a way I can trace Vim into a log to know what happens? Thank you for your attention. Eddine. I don't know what happened, just that :0 is supposed to bring you to line zero (but since there is no such line, you get to the first line instead). Maybe there was a missing refresh? Try opening your logfile in readonly mode (e.g. with :view rather than :edit, :sview rather than :new, gview rather than gvim, view rather than vim, etc.) and if you still have the problem, try Ctrl-L to redraw the screen. BTW, trying to write a single file from two processes at the same time (such as Vim and the log-writing process) is courting disaster. If you do, you're bound to get problems sooner rather than later. Best regards, Tony. -- Alexander Graham Bell is alive and well in New York, and still waiting for a dial tone. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: trying to understand my own (very old) vim macros
On 19/10/11 21:25, oexel wrote: hello list! I'm trying to understand the vim macros I wrote with the valuable help from YOU (perhaps your parents :-) some 10 years ago. there are a lot of mappings where the rhs is backslash-tilde-letter, for example: map \~O :let @z='q.pck'c-M\~W and those mappings are then used by other mappings (just as this map uses \~W); what does the \~ combination mean? is it possible to activate such mappings from the keyboard? which keys should I type? TIA! If ~W represents a single key (you cannot choose to put the cursor on one or the other, it is always on the same one of both) then it means Alt-uppercase-W (Alt-Shift-w) (assuming that your 'cpoptions' does not contain the B flag) and it's recommended to replace it by A-W or M-W in the mapping (if your 'cpoptions' does not include the flag). In gvim with GTK2/Gnome2 GUI, hitting Alt-Shift-w gives me no result (gvim doesn't see the keystroke, not even when preceded by Ctrl-V). Beware that Alt-Shift-W means 0xD7 which in Latin1 is the multiply by sign (looks like a kind of x a pixel or two above the baseline). Vim makes no difference between the two so you cannot map в and Alt-Shift-w to do different things. If you can put the cursor on either the tilde or the W then AFAIK \~W is just a backslash then a tilde then a W (but you probably should have B in 'cpoptions' in that case). The backslash might also mean either of the Leaderor the LocalLeader prefixes (q.v.) Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 202. You're amazed to find out Spam is a food. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: winwidth winheight doesn't work here
On 15/10/11 13:23, Roger wrote: On Sun, Oct 09, 2011 at 11:37:56PM +0200, Tony Mechelynck wrote: On 09/10/11 11:08, Roger wrote: Reading the good book Learning the VIM Editor(s) and see winwidth winheight mentioned, but am having trouble getting it working here! Why, when settings winwidth on vertical split files, it's not automagically resizing the windows as I toggle between the files? I have set to noequalalways, also. :-/ With me it does, but remember that these options are desired minimums for the current window and that the absolute minimums for any window are set by 'winminwidth' and 'winminheight'. When switching windows, the new window will not be resized if it already exceeds the desired minimum, nor will it be made bigger than would allow all other windows to remain at or above the absolute minimum. Also, some special window types have their own desired minimums: see :help 'helpheight' :help 'cmdwinheight' :help 'previewheight' The absolute minimums may be set to zero, the desired minimum for the current window must be at least 1 since the currentcursor location must always be visible. The following should swell the current window to maximum size, squashing other windows to only a vertical divider on left and right or a status line above and below: :set nowfh no fixed size :set noea eadirection=both no equal size :set wmw=0 wmh=0 squash other windows :set wiw= wh=999 hh=999 cwh=999 pvh=999 enlarge current window :let netrw_winsize = 100 netrw split to 100% size For GVIM: nowfh was already default here. was ea, but I set to noea. eadirection=both was default too. set wmw wmh is set to default 1? Now the culprit was your wiw, wh, hh, cwh, pvh values! My default values were set to something like these: winwidth=1 winheight=1 helpheight=20 cmdwinheight=7 previewheight=12 And, once I used your wiw, wh, hh, cwh, pvh values, changing focus of the windowns and window resizing automagically happens now! The O'Reilly Learning VIM mentioned something about these values, but gave no real set values for a reader to try on his/her own VIM session. With your values, I'm now rolling on customizing to my liking! Next, I should be able to do this with CLI VIM(?). -- Roger http://rogerx.freeshell.org/ The snippet I proposed above should work equally well in console mode as is does in GUI mode, provided that the executable was compiled with +windows and (for the :let statement) with +eval. Note that you can't really test +eval in a script, because in a Vim compiled with -eval the :if...:endif construct is a nestable comment. This shouldn't matter here since bracketing the whole snippet with :if has('windows')...:endif will avoid errors in all cases — and we aren't interested in split-windows' relative sizes when in a Vim which can't even split windows. Best regards, Tony. -- Don't believe everything you hear or anything you say. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: css3 syntax file
On 15/10/11 05:09, stardiviner wrote: [...] If i can write syntax file, I will do it by myself. But I ask here because I can not ... Maybe I should learn it now. which part should I reference in vim help ? What about :help syntax.txt ? Best regards, Tony. -- Flying saucers on occasion Show themselves to human eyes. Aliens fume, put off invasion While they brand these tales as lies. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Jump between the beginning and the end of a block of python code (such as function, class)?
On 15/10/11 05:28, Peng Yu wrote: Hi, I language use {} to denote function, class, etc. I can use % to jump between the beginning and end of a block of code. But python doesn't use {}. I'm wondering if there is a way to do so in python? Python uses indenting, and nothing else, to define code blocks. For some it is a blessing, for others a curse, but that's the way of Python. Maybe you could use 'cursorcolumn' and place your cursor on the first nonblank in a line to see which statements are at the same indent level. Or (assuming a 'foldmethod' of indent which seems about right for Python), you could play with folding and unfolding the current block: when the containing block is unfolded and the block of interest is folded, it's quite obvious where the latter starts and ends. Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 199. You read this entire list of symptoms, looking for something that doesn't describe you. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Tab Stop Colors
On 15/10/11 23:54, kageska wrote: How do I change the color of the tab stops in Vim? Everytime I hit tab to align the text in my code it goes red. Is there a way to turn this off? With 'list' off, hard tabs should be coloured the same as whitespace, unless they have a special meaning in the filetype in question, e.g. as column separators in a tab-separated database or at the left margin in a Makefile. The following command may help you determine which highlight group(s) apply at the cursor location: if has(user_commands) command -nargs=0 -bar WhatSyntax \ echomsg synIDattr(synID(line(.),col(.),0),name) \ synIDattr(synIDtrans(synID(line(.),col(.),0)),name) \ synIDattr(synID(line(.),col(.),1),name) \ synIDattr(synIDtrans(synID(line(.),col(.),1)),name) endif With 'list' on, the ^I representing a hard tab if tab: is not included in 'listchars', or the two characters specified after that colon (and alternating at a frequency of 'tabstop' with one of the one and between zero and (tabstop - 1) of the other) if it is, are highlighted with the SpecialKey highlight. How that highlight is displayed depends on your colorscheme (if any). By default it uses blue foreground against the default background. See :help 'list' :help 'listchars' Best regards, Tony. -- It's Like This Even the samurai have teddy bears, and even the teddy bears get drunk. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: install vim 7.0.109 on Ubuntu 10.04
On 15/10/11 23:53, Frederico Cadete wrote: I had a similar experience when I recompiled Vim, coming from using vim as packaged by Ubuntu. The differences in behaviour were annoying, but they were not because of the compiling options; it was because of the system vimrc (in this case /usr/share/vim73/debian.vim, if memory does not fail me), which sets some default vim options. The system vimrc would of course not be called that on RedHat / Fedora, but in any Vim executable you can find out where it looks for a system vimrc by looking near the middle of the output of :version (if Vim is running) or of vim --version (or gvim --version etc., and without the quotes) if it isn't. By default the system vimrc is at $VIM/vimrc (with no dot) but that can be changed at compile-time and one often-used location on Unix-like systems is /etc/vimrc Maybe the difficulties your students are having are not just because of version but also because of system options. I hope this helps. Regards, Frederico Best regards, Tony. -- If God had not given us sticky tape, it would have been necessary to invent it. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: css3 syntax file
On 14/10/11 06:25, stardiviner wrote: Is there css3 syntax file which support HTML5 tags ? I find that onle css2 syntax can be found in linux system. and I searched plugins on vim.org. there are two syntax files for css3. but non of them support *and* this code: @media screen and (max-width:1000px) { } if you have a good idea, please tell me , thanks. I don't. What _I_ would like is to see a Vim syntax file for CSS that would support Mozilla extensions, including e.g. the @-moz-document at-rule after which there will be two levels of braces, not one. See: https://developer.mozilla.org/en/CSS_Reference/Mozilla_Extensions https://developer.mozilla.org/en/CSS/@-moz-document Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 197. Your desk collapses under the weight of your computer peripherals. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Need Syntax file for the Linux
On 13/10/11 07:36, Dayananda wrote: Could you please point me to the syntax file /*syntax.vim*/ When I do *:syntax enable : *It is not finding the syntax.vim file, and the syntax is not getting highlighted. Could you please help me get the syntax file. Thanks and Regards, Dayananda The files syntax.vim, synload.vim and syncolor.vim are in $VIMRUNTIME/syntax/ and Vim should find them with no particular action of yours, if it is correctly installed. Your Vim executable must be compiled with +syntax in order to display syntax highlighting. On Windows, installing Steve Hall's Vim without Cream by running the latest gvim-*.exe self-installer found at http://sourceforge.net/projects/cream/files/ installs not only the vim.exe and gvim.exe binaries but also the runtime files which go with them. On Windows, I think that the default Vim 7.3 $VIMRUNTIME is C:\Program Files\vim\vim73 but I'm not 100% sure. Executables are installed into $VIMRUNTIME itself, you may want to add that folder near the start of your $PATH. On Unix, after make compiles Vim, make install installs it. Any settings defined via environment variables must be common to both (and to make config and make reconfig if you use them); see http://users.skynet.be/antoine.mechelynck/vim/compunix.htm On Unix, $VIMRUNTIME is by default (for Vim 7.3) /usr/local/vim/vim73/ but that can be modified at compile-time (Vim packages compiled by Linux distributions usually use /usr/share/ etc. instead of /usr/local/share/ etc.). Executables are installed into $VIMRUNTIME/../../bin/, which is in the standard $PATH. See :help $VIMRUNTIME :help 'runtimepath' If you install a precompiled Vim from your Linux distribution, at least two packages are usually necessary: on openSUSE Linux which I'm using, the Vim packages are as follows: vim-data runtime files, always needed vim-base basic files, always needed, and a tiny executable vim a normal executable vim-enhanced an executable with Perl, Python, etc. interfaces but no GUI gvim a full-featured executable usable as GUI or in a terminal vim-base-debuginfo vim-debuginfo vim-enhanced-debuginfo gvim-debuginfo debug symbols, e.g. to debug crashes; from the debug repo You may install all of them if you want. IIRC, on RedHat or Fedora (at least when I used them), the package names were vim-common vim-minimal vim-enhanced vim-x11 and the first of these had to be installed together with one or more of the other three. Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 196. Your computer costs more than your car. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Need Syntax file for the Linux
On 13/10/11 08:34, Dayananda wrote: Thank you SC and sorry for very short description of the problem. I am able to find the syntax file in the */usr/share/vim/vim63/syntax* [...] That's the $VIMRUNTIME directory for Vim 6.3, which is long obsolete by now: Vim 6.4 was released on 15-Oct-2005 Vim 7.0 was released on 7-May-2006 Vim 7.1 was released on 12-May-2007 Vim 7.2 was released on 6-Sep-2008 Vim 7.3 was released on 15-Aug-2010 The current stable version is Vim 7.3.338 since yesterday. Best regards, Tony. -- The Briggs/Chase Law of Program Development: To determine how long it will take to write and debug a program, take your best estimate, multiply that by two, add one, and convert to the next higher units. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Vim 7.2 on CentOS 6 - set ruler has no effect
On 08/10/11 05:39, Ismail, Mohd F. wrote: From: Christian Brabandtcbli...@256bit.org Date: Thu, 6 Oct 2011 20:11:31 +0200 Local: Thurs, Oct 6 2011 1:11 pm Subject: Re: Vim 7.2 on CentOS 6 - set ruler has no effect Print | Individual message | Show original | Report this message | Find messages by this author Hi Ismail,! On Do, 06 Okt 2011, Ismail, Mohd F. wrote: Here it is. I'll compile my own version then. Is there a guide on what's best option to include? [...] Huge version without GUI. Features included (+) or not (-): +arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent -clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments Are you sure, this is the same version which has the problem. set ruler should work just find from this version. Could it be, there is another vim in your path, may be a tiny vim or you called it vi? Try :version from within the vim, that has the problem and look for +cmdline_info (enabled ruler feature) or -cmdline_info (disbaled ruler feature) regards, Christian Hi Christian, You're right. There are /bin/vi and /usr/bin/vim. vim is the one with set ruler that works fine, while vi doesn't show that. Thank you for pointing that out. --Farid On RedHat and similar systems, you may have several Vim executables installed: /bin/vi is a minimal version with no arithmetic evaluation, no syntax highlighting, no ruler, no split-windows, no multibyte support, etc. Its only advantage is that it is guaranteed to be on a filesystem which is always mounted even when running the system in single-user emergency-repairs mode (runlevel 1 or S) and even if /usr is on different filesystem which, in that case, may be left unmounted. /usr/bin/vim is a normal version with most functionalities but no GUI. /usr/X11R6/bin/gvim is a full-fledged executable with GUI. It can also run in a terminal if the X server is not accessible or if invoked with the -v command-line switch or from a vim softlink. Since they come from distinct packages you may have one, two or all three of them installed. Best regards, Tony. -- There are times when truth is stranger than fiction and lunch time is one of them. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: jumping to corresponding syntax element
On 13/10/11 10:12, Gergely Buday wrote: Hi, the percent sign makes vi jump to the corresponding closing parenthesis, should I point to the opening one. How can I program a similar functionality for other classes of syntactical elements? In Standard ML, there is a let - in - end construct that can span several pages so it would be useful to jump from one let to the corresponding end. Of course a let-in-end triple can be found in another. Is there a way to program this in vi? - Gergely 1. Enable the matchit plugin, see :help matchit-install 1.1 Create the directory $VIM/vimfiles/plugin if it doesn't exist, and place in it a one-line file containing just runtime macros/matchit.vim You can name it matchit.vim 1.2 On Unix/Linux, you can enable the matchit help via a softlink: :shell mkdir -pv $VIM/vimfiles/doc cd $VIM/vimfiles/doc ln -sv ../../vim73/macros/matchit.txt exit :helptags $VIM/vimfiles/doc On Windows, you may have to copy the matchit.txt file from $VIMRUNTIME/macros to $VIM/vimfiles/doc/. The :helptags command (as above) is still necessary so that the help entries in the file will be made part of Vim's help system. 2. If the ftplugin for StandardML doesn't already set the b:match_words variable, you can set it in an after-plugin, named (for instance) $VIM/vimfiles/after/ftplugin/standardml.vim (if standardml is the 'filetype' value for those files). For details, see :help matchit-newlang (after installing the matchit help as above). 3. In order not to lose the standard function of the % key for files which have no specific syntax pairings, I recommend adding the following in your vimrc: augroup vimrclocal au FileType c,cpp,css,javascript \ let b:match_words = matchpairs augroup END This will also avoid %-jumping from ( or ) in a comment to ) or ( in the code or vice-versa (likewise for []{}). Best regards, Tony. -- In any world menu, Canada must be considered the vichyssoise of nations -- it's cold, half-French, and difficult to stir. -- Stuart Keate -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Can VIM display two files simultaneously?
On 12/10/11 04:26, wolfv wrote: I am considering learning VIM (vim-cucumber to be exact). Can VIM display two files simultaneously (a step definitions file and it's feature file)? Thanks. I don't know what vim-cucumber might be; but Vim itself can display any number of files simultaneously in split-windows (well, almost: any number within the limits of available screen space), if it was compiled with +windows. See :help windows.txt Best regards, Tony. -- Osborn's Law: Variables won't; constants aren't. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: avoid CursorHoldI causing delay
On 11/10/11 12:04, Szabolcs wrote: Dear group member, I am using CursorHold and CursorHoldI with a delay of 800 ms to constantly auto-save the LaTeX file that is being edited. (Which in turn causes it to be automatically recompiled and shown in a PDF reader. I do this to get real-time preview.). Occasionally, when I'm working on a large file that takes longer to compile, Vim becomes less a responsive, and misses a few keystrokes. I.e. sometimes a few characters I type simply don't show up 'csing bron wors'. Is there anything I can do to ensure Vim won't miss any keystrokes? (It's okay if the keystrokes show up with a delay, but I don't want them to go AWOL) An 'updatetime' of 800 milliseconds is unusually short: no wonder Vim gets sluggish if it saves your file to disk that often. The default is 4000 (4 seconds) which will still save your work reasonably fast, while saving quite a lot on disk head movement and reducing the risk of keyboard buffer overflow. Best regards, Tony. -- Don't suspect your friends -- turn them in! -- Brazil -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: what's a conversion error and how do I correct it?
On 22/05/11 13:00, Christian Brabandt wrote: Hi eNG1Ne! On So, 22 Mai 2011, eNG1Ne wrote: Working on a Linux box (Ubuntu 10.4), I've successfully copy/pasted a block of text from a Planmaker spreadsheet into a vim file. The text includes U+2012 dashes, which are correctly displayed in vim … but when I try to save the vim file, I get the message conversion error. I guess, your fileencodings setting (notice the plural) does not include utf-8, so Vim does not try to save it with that encoding. It probably either tries to save it using plain old ASCII encoding or something like latin1, which does not include this char and therefore conversion fails. You should fix your 'fencs' setting to something like ucs-bom,utf-8,default,latin1 or you can force Vim to save it in utf-8 encoding, by issuing :w ++enc=utf8 filename. (It might be, that this needs the +multi_byte feature, which is only enabled, when compiling at least a big version of Vim). Probably related, but when I used :dig to try and find the code for the U+2012 dash (so I could use search/replace) I couldn't spot one. Just out of curiosity, what do the numbers in the digraph reference page refer to? The decimal number for that unicode char. regards, Christian Conversely, when reading, Vim will not give a conversion error message if there is an 8-bit encoding at the end of your 'fileencodings', but it can still fail to recognize the actual encoding used: for instance, with :set fencs=ucs-bom,utf-8,latin1 which is a good setting for people in Western countries like I am, try to read a file containing Japanese encoded in Shift-JIS, Traditional Chinese in Big5, Simplified Chinese in GB18030, or even Russian in KOI8-R, and the text will look like gibberish, because Vim saw no BOM, saw correctly that the text wasn't UTF-8 on disk, and fell back on Latin1. In that case you need to tell Vim the actual encoding of the file (and if you don't know it, maybe try several possible ones, proceeding by trial and error), by adding a ++enc modifier to your :e or :view command, for instance :view ++enc=sjis example.txt and (assuming that 'encoding' is already set to utf-8) Vim will then (if compiled with +iconv, or with +iconv/dyn and the iconv or libiconv library is available) happily translate the shift-JIS into the UTF-8 used internally. About digraphs: 0x2012 == 8210 and I see no digraph for that, but you could use Ctrl-V u 2012 (without the spaces, see :help i_CTRL-V_digit which also applies in command-line mode) or make your own digraph (but try to use something which is not already in use). Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 195. Your cat has its own home page. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Highlighting for tabline for Tabbed Windows feature
On 07/10/11 08:21, Roger wrote: [...] One still unanswered question, is why the tabline scheme is different between Linux Virtual Terminal, X URXVT Default Color Themed Terminal, and X URXVT User Customized Color Themed Terminal. Linux Virtual Terminal (/dev/tty1 to /dev/tty6) has only 8 background colors, 16 foreground colors, and its background is usually dark. Try to use a yellow background there and you'll get brown, a red background and you'll get dark red which is a kind of reddish brown. The other two I don't know, but they may have a different number of available colours (I would expect at least 16, at most 256, for both bg and fg) and/or a light background. If a highlight group doesn't set any colours, it will default to whatever colours the terminal used at Vim startup. Best regards, Tony. -- Losing your drivers' license is just God's way of saying BOOGA, BOOGA! -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Highlighting for tabline for Tabbed Windows feature
On 06/10/11 21:52, Roger wrote: The following scenarios are what I get here for a tabline for Tabbed Windows. There seems to be inconsistencies for tabline color scheme or theme for my scenarios, and am wondering how best to fix, or in the case of URXVT default and my settings, what is hindering tabline highlighting? (See below scenarios.) 1) Virtual Terminal On virtual terminal, active tab is white font on a black background, while inactive tabs are cyan/lt blue on a black background. (I like this, however I think it would be also preferable to use a bold font, in addition to the blue font color, so that the active tab is more noticeable.) 2) URXVT using Black Background and White Foreground (Customized) Within URXVT, fonts are white on black background with underlining for inactive tabs and no underlining for the active/focused tab. This tabline color theme is barely functional. Is there a way to do something similar to the above font coloring for tabline, in addition, using a bold font? (I just noticed the default URXVT theme for some reason is better highlighted as noted below... wondering what causing me to loose this on an inverted color scheme.) 3) URXVT using Default Theme Active tab is black font on white background with inactive tabs highlighted grey with a white font. I can distinctly tell which window tab I'm working in with this color scheme. Although I'd probably still want to use a bold font for the active tab font! (I still really dislike using a white background though! ;-) See :help setting-tabline for how to set a custom tabline in text mode (i.e., either in a terminal, or with the e flag absent from 'guioptions' in gvim). The three highlight groups used for the tablilne are mentioned there too. You may want to write your own colorscheme, and possibly check one or more of the 'term' setting, the 'background' setting, or the 't_Co' setting, to select different colours depending on the terminal you're running in. see: :help setting-tabline :help 'term' :help 'background' :help 't_Co' :help cterm-colors Best regards, Tony. -- U: There's a U -- a Unicorn! Run right up and rub its horn. Look at all those points you're losing! UMBER HULKS are so confusing. -- The Roguelet's ABC -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Vim 7.2 on CentOS 6 - set ruler has no effect
On 03/10/11 06:15, Ismail, Mohd F. wrote: [...] When I type :verbose set ruler?, I got, at the bottom left corner, in red background E519: Option not supported: ruler? [...] That's clear enough: the 'ruler' functionality was excluded at compile-time. But I'm curious: try running vim --version vim-version.txt then pasting the file vim-version.txt in an email. Then we'll have a better idea of how you can get a Vim version which includes that functionality. Best regards, Tony. -- Do not meddle in the affairs of troff, for it is subtle and quick to anger. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: replace e flag works in command but fails if that command in key mapping
On 02/10/11 16:04, porphyry5 wrote: Well, I think I finally have this figured out. If I'm using sessions, any session includes its own .vimrc, being that .vimrc in effect when the session was first begun. Then changing the actual .vimrc file has no effect on the session, because it will never reload the actual .vimrc. So if I want to change a mapping in .vimrc, and have the benefit of that change in my session, I must make the new mapping explicitly in the current session, as well as in .vimrc. On the contrary, starting Vim with -S will source your vimrc first; but then it will proceed with your session file, which may override anything your vimrc has set. You may use sessions without running :mksession -- a session file is just a Vim script sourced after your vimrc, usually to set up your windows and tabs and such. You can create one by hand, e.g. as cd ~ e file1.txt new file2.txt new /path/to/file3.txt lcd %:h tabnew /someotherpathto/file4.txt tabnew file5.txt tab help tabnext wrap around to first tab wincmd w wrap around to first window You can even name it ~/Session.vim, then vim -S or gvim -S will run it; and they will use all the settings of your vimrc too. Best regards, Tony. -- There's only one way to have a happy marriage and as soon as I learn what it is I'll get married again. -- Clint Eastwood -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Vim 7.2 on CentOS 6 - set ruler has no effect
On 02/10/11 18:24, Ismail, Mohd F. wrote: Hi Tony, When I type that command in vim window, it gives me nothing. It just returns the cursor position to its initial position. Am I supposed to type it some where else? You should be using Vim in Normal mode, then type :echo has('cmdline_info') followed by hitting Enter. A 0 (zero, meaning no) or a 1 (one, meaning yes) should appear at bottom left of your Vim screen. Anything you type will make it disappear again. Hi Ben Fritz, I looked into the vimrc and there is no statusline keyword anywhere in the file. I didn't customize my vi and just use what ever was set up by CentOS people. Aha! Is it ~/.vimrc or $VIM/vimrc or /etc/vimrc or something else? If anything but the first of these, Vim will be in 'compatible' mode by default. What do you see at the bottom of the screen if (in Normal mode) you type :verbose set ruler? (with the question mark), followed by hitting the Enter key? --Farid Oh, and BTW, the custom of these lists is to reply below, not above, the text you're replying to. Best regards, Tony. -- Idiot, n.: A member of a large and powerful tribe whose influence in human affairs has always been dominant and controlling. -- Ambrose Bierce, The Devil's Dictionary -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Set gfn based on screen resolution
On 01/10/11 10:15, philipx wrote: Is there a way to determine the screen resolution in gVim and act upon that information, for example to set a different font size? I seem to find myself working in two different modes: either on my laptop or on a large screen. Maybe I'm getting old, or maybe the distance to the screen is different between the two (I suspect I sit closer to the laptop's screen), but I use Menlo:h11 on my laptop and I'd like :h12 or even :h13 when I'm connected to the monitor. Thank you! I don't think you can ask Vim for the pixel size of your screen, but you can do almost as good (after gvim startup, i.e. either in the gvimrc or in a GUIEnter autocommand): 1. Set some standard 'guifont' 2. :set lines=999 columns= (gvim will now set its screen size to within one character cell of your monitor size, and adjust the option values accordingly) 3. Compare lines and/or columns with some reference values and increase the 'guifont' size if larger. Note: There are several incompatible platform-dependent 'guifont' formats, and each gvim version recognizes only one of them. If someday you find yourself on Linux and try to set the 'guifont' you set on Windows, it may or may not give you an error but it will almost certainly not set the font you expected. See http://vim.wikia.com/wiki/Setting_the_font_in_the_GUI Here are a few examples: GTK2: :set gfn=Courier\ New\ 11 kvim (obsolete): :set gfn=Courier\ New/11/-1/5/50/0/0/0/1/0 Photon: :set gfn=Courier\ New:s11 other X11 (including the now obsolete GTK1): :set gfn=-*-courier-medium-r-normal-*-*-110-*-*-m-*-* Mac: :set gfn=Monaco:h11 Windows: :set gfn=Courier_New:h11:cDEFAULT Best regards, Tony. -- You have the body of a 19 year old. Please return it before it gets wrinkled. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Vim 7.2 on CentOS 6 - set ruler has no effect
On 02/10/11 02:09, Ismail, Mohd F. wrote: Hi, I'm using CentOS 6, with vim 7.2. For whatever reason, there is no row and column info at the bottom right corner. I check the /etc/vimrc and set ruler is enabled. What could be the problem? --Farid What does Vim answer to :echo has('cmdline_info') (without the double quotes but with the single ones)? If it's 0 (zero), then the 'ruler' feature wasn't included at compile-time. BTW, Vim 7.2 is obsolete now (though admittedly less than the Vim 5.x I saw someone use recently). The current version is 7.3.329. If you're interested, see http://vim.wikia.com/wiki/Getting_the_Vim_source_with_Mercurial http://users.skynet.be/antoine.mechelynck/vim/compunix.htm Best regards, Tony. -- After a number of decimal places, nobody gives a damn. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: setloclist() doesn't work
On 30/09/11 08:44, sinbad wrote: hi, i am trying to store the contents of location list, so as to use multiple location lists for the same split-window window. here is what i did. created a location list for some pattern. now i ran the following commands in vi. I hope you mean Vim, and in 'nocompatible' mode. Legacy vi has no quickfix capabilities. :let x= getloclist(0) :call setloclist(0, x, 'r') location-list is screwed up, i can see some contents in the location list with filename missing. is it the rightway of using get/setloclist() functions. thanks Does it work if you omit the ,'r' (last argument of setloclist())? Best regards, Tony. -- Do what comes naturally now. Seethe and fume and throw a tantrum. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Link to part of the same file
On 30/09/11 19:04, Fernando Basso wrote: What would be a good way (if possible at all) to have vim link, say, a table of contents to each section? I use vim for taking all kinds of notes and that would be terrific. Thanks in advance. It depends on the filetype (tables of contents are written very differently in Vim helpfiles and in HTML, and they're implicit in Wikimedia source) so you would have to code an ad-hoc filetype-dependent function. Probably set it up in ~/.vim/after/ftplugin/filetype.vim (replacing filetype by the filetype, and, on Windows only, .vim by vimfiles), possibly with the bulk of the function code in some autoload script. See :help after-directory :help autoload Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 189. You put your e-mail address in the upper left-hand corner of envelopes. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: creating a new location list
On 29/09/11 07:48, sinbad wrote: hi, i know that we can have multiple location lists for a window. i read through the documentation but couldn't find the command or function that creates a new location list. lexpr doesn't take window nr as argument. so i was wondering how can i create a new location list. every time i use lexpr, the old location list will be rewritten. i am missing some thing here ? thanks sinbad Most quickfix and location-list commands are documented under :help quickfix There are various ways to create a new location list: :lfile [errorfile] read the errorfile and jump to the first error :lhelpgrep {pattern}[@xx] search the help for the pattern (if @xx is given, it's a language code) and return the results as a location list for the help window. If the current window is not a help window, its location list isn't changed. :lvimgrep[!] /pattern/[g][j] {file}... search the named file(s) for the pattern and return the result as a location list similarly :lgrep, :lmake, etc. Best regards, Tony. -- Razors pain you; Rivers are damp; Acids stain you; And drugs cause cramp. Guns aren't lawful; Nooses give; Gas smells awful; You might as well live. -- Dorothy Parker -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Vim as default email (thunderbird) editor
On 28/09/11 17:50, Fernando Basso wrote: On Sep 28, 10:58 am, Quincy Bowersqui...@quakbo.com wrote: Make sure you setup External Editor to call 'gvim --nofork' or it won't work properly. Other than that I can't imagine what would be wrong. It still doesn't work. Even using gvim --nofork. Try setting your External Editor preferences to call gvim with not only --nofork (or -f) but also a full path, i.e., not just gvim --nofork but something like /usr/local/bin/gvim -f or C:\PROGRA~1\vim\vim73\gvim.exe -f etc. Best regards, Tony. -- Why isn't there a special name for the tops of your feet? -- Lily Tomlin -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Stop a libcall loop
On 27/09/11 08:13, niva wrote: Hi, I have done a dll that go into a while loop. It freeze gvim interface and I wonder if I can recode this loop in order to stop it by signal sent or another way ? Thanks for help Hm, here are a few ideas: 1. Have you tried Esc or Ctrl-Break? Does it do anything? If neither does, maybe you could test for an Esc and/or a Ctrl-Break in the loop in order to terminate it early. 2. Maybe you could send Vim a signal that it doesn't use, and intercept it in the DLL? Not sure which signal though; under Linux I would have suggested SIGUSR2. This requires adding a signal handler to the DLL, chaining with any signal handler already installed in the caller. 3. Maybe you could send Vim a signal that it does intercept, but if (1) above doesn't work, it might terminate Vim (under Linux I would have suggested SIGHUP, or if that doesn't work, SIGTERM). 4. If worst comes to worst, you may have to kill Vim (under Linux: SIGKILL; under Windows: open the Task Manager, probably by Ctrl-Alt-Del, then select Vim and terminate it). Best regards, Tony. -- There once was an old man from Esser, Who's knowledge grew lesser and lesser. It at last grew so small, He knew nothing at all, And now he's a College Professor. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Highlight current line number when using set number
On 26/09/11 16:03, Francesc Salvat-Pujol wrote: On Mon, Sep 26, 2011 at 2:07 PM, Ben Fritz fritzophre...@gmail.com mailto:fritzophre...@gmail.com wrote: On Sep 25, 4:04 am, Francesc Salvat-Pujol f.sal...@gmail.com mailto:f.sal...@gmail.com wrote: Hi, When using the option set number, is there a way of highlighting the current line number with a color other than LineNr? Using set cuc cul is too much. I am aware that the question has been asked before, i.e. http://groups.google.com/group/vim_use/browse_thread/thread/90adce932... or with slightly different approach: http://groups.google.com/group/vim_use/browse_thread/thread/83fa20161... Unfortunately, none of these threads really offer a solution in the sense described at the beginning of the mail. Any ideas? That second thread offers a method which will get you closer, but even using the signs feature, I don't think Vim can highlight a specific line number in the line number column, and only the line number column (i.e. not the line text). Probably your best bet is to just set a cursorline highlight which is not too distracting and use that. Uhum... Well, too bad. Thanks for the replies though. Cheers, Cesc In gvim (where the Normal background is white) (and in 256-color consoles with the CSApprox.vim plugin) I use the following in my almost-default colorscheme, http://users.skynet.be/antoine.mechelynck/vim/almost-default.vim hi clear CursorLine hi CursorLine guibg=#F4F4F4 hi clear CursorColumn hi link CursorColumn CursorLine which give me crosshairs in very light grey (95.7% grey), just enough to be visible, not enough to be distracting. Best regards, Tony. -- APL is a write-only language. I can write programs in APL, but I can't read any of them. -- Roy Keir -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: sort content of a register
On 25/09/11 02:46, porphyry5 wrote: One by one I have appended a number of lines to a register (z). I need to sort them and then paste them at the start of the document. Without complaint, vim accepts the command :zsort but the content of z is unchanged. Is it possible to do this in the register, or must I paste it into the document and sort it there? It may be possible to do it in the register, but it is easier to do it in the text: 0put z 1,.sort or maybe 0put z mark z 1,.sort 1,'z yank z if you want to yank the sorted lines back into the register. Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 182. You may not know what is happening in the world, but you know every bit of net-gossip there is. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Remembering syntax when moving in and out of buffers
On 25/09/11 17:35, Spiros Bousbouras wrote: On Sep 21, 7:38 pm, Benjamin R. Haskellv...@benizi.com wrote: On Wed, 21 Sep 2011, Spiros Bousbouras wrote: On Sep 18, 11:14 pm, Benjamin R. Haskell wrote: Actually I have disabled running the Debian specific stuff in /etc/vim/vimrc so the explanation even for what I describe in my opening post must be the same as below. I tried again running what I describe in the opening post with verbose set to 20 and the only autocommand executed is the one I set up explicitly , there's no if !did_filetype() . Okay. I really don't understand why you're bent on disabling the normal Vim filetype mechanisms. With them disabled, yes, you'll not see anything related to them (including the BufRead autocmd). Maybe I'm missing something. I wasn't trying to disable the normal filetype detection mechanisms per se , I was trying to get rid of functionality I found irritating and which seemed to be the result of filetype detection. It's been around 4 years so I don't remember for sure but I think that one thing that annoyed me was that I was writing Scheme code , added a ; in the beginning of some line (which counts as a comment in Scheme) and then vim started adding a ; at the beginning of all subsequent lines. That's customizable. I think that :set fo-=c fo-=r fo-=o fo-=q will disable all comment formatting and all comment leaderinsertion; though youmay want something less drastic, see :help fo-table I think it also did parenthesis matching which I found distracting and possibly also syntax highlighting which yet again I found distracting. That is also customizable. Method I: to disable it entirely: add the line let loaded_matchparen = 1 in your vimrc. Method II: to disable it by default, but with possibility to re-enable: add the line au VimEnter * NoMatchParen to your vimrc. You can then use :DoMatchParen and :NoMatchParen to enable and disable parenthesis matching respectively, see :help matchparen (When it comes to syntax highlighting in most situations I don't want any. What prompted this thread was the requirement for some very simple highlighting in a file type of my own for which there won't be any ready made plugins nor will it be useful to anyone apart from myself.) The fact that the Debian specific stuff also sets up some autoevent , as you said earlier in the thread , which probably wouldn't be useful to me either , confirms in my eyes the wisdom of my old decision to disable Debian specific stuff. Compiling your own Vim will by default put the executable in /usr/local/bin, equate (if unset) $VIM with /usr/local/share/vim, $VIMRUNTIME with /usr/share/vim/vim73, and look for the system vimrc at $VIM/vimrc. When compiled by a distro, I'm not 100% sure about Debian, but typical settings (as used by openSUSE) are /usr/bin, /usr/share/vim, /usr/share/vim/vim73 and /etc/vimrc. Both will look for your own vimrc at ~/.vimrc. So if you have both, your own Vim takes precedence (it is first in the $PATH) and the distro stuff isn't used. I wasn't using -u NONE, sorry. I was explaining what goes wrong without it. In the -u NONE case that you present, it gets cleared because syntax starts fresh prior to loading each new buffer, so that filetype detection can detect the file and load the proper syntax without having to worry about clearing out the syntax of whatever other file or files are open. Right. This brings us back to what I was saying in the OP namely that it is a strange design choice. Note in particular that buffer local variables are remembered yet syntax is not. As I understand it , syntax is buffer specific. So why would syntax from other files have to be cleared and why would proper syntax have to be reloaded ? I can't think of a scenario where I'm editing a buffer , set up a syntax , move away , return to the buffer and now a different syntax has to be valid. If you don't set hidden, and use :filetype plugin on and :syntax on, the syntax highlights will be loaded once per buffer at buffer load. I'm not sure what happens with 'hidden'. If you use :syntax on followed by :filetype off, you won't by default get any highlighting since filetypes won't be detected. You can then set syntax for one file by means of :setlocal syntax=foobar and by using :setlocal you will avoid changing the syntax settings of other present or future buffers. If you want no highlighting in general but automatic syntax highlighting for sompe particular files, you can have syntax on filetype off (in that order) in your vimrc, then a syntax-setting modeline near the beginning or the end of the files which interest you. Here are a few examples of such modelines: // vim:ft=cpp: /* vim: set ft=c :*/ !-- vim: set ft=html :-- # vim:ft=sh: vim:tw=78:ts=8:ft=help:norl: The second form (with set) is necessary when you need a comment trailer (as above for C and
Re: How to map CTRL + Right Arrow
On 25/09/11 18:02, Roy Fulbright wrote: I currently have the following mapping, which works fine, to move to the next tab in my edit session: noremap silentLeaderright :tabnextCR It would be much more convenient to use CTRL + Right Arrow instead of backslash (my Leader character) + Right Arrow. I've tried: noremap silentCright :tabnextCR noremap silentC-right :tabnextCR but neither of these work. I've looked at help map, help expr, and help leader but found no answer. Can someone show me how to map CTRL + Right Arrow? Thanks in advance, Roy 1. Maybe Vim doesn't get the Ctrl-Right combination. To determine if that is the case, put Vim in Insert mode then hit Ctrl-V (or Ctrl-Q if your Ctrl-V is remapped to the paste operation) followed by Ctrl-Right. If nothing appears in the buffer (and, assuming that you have 'showcmd' on, ^V remains displayed near bottom right of the Vim screen), then Vim doesn't get the Ctrl-Right combo and there's nothing to be done, other than selecting a different {lhs} for your mapping, or using gvim, which should recognise the keystroke correctly. 2. Maybe Vim gets the Ctrl-Right but sees it as no different than something else. Still in Insert mode, hit Ctrl-K followed by Ctrl-Right. If Vim displays C-Right it has correctly seen the keystroke and you should be able to map it (by using C-Right as your {lhs}). If it displays Right it has seen the keystroke but as if you hadn't held Ctrl down: this means your terminal passes Ctrl-Right as if it were just Right. Anything else means the key has been misidentified. 3. If the key is seen, but not as itself and not as some recognizable key, then there is probably an error in the termcap for the current terminal. In that case :set term? will tell you which termcap entry Vim is using. If you don't see the same 'term' value on a different type of console (which can happen: e.g. on my system, KDE konsole and true xterm are both detected as xterm), you can try to add the following to your vimrc: if term == termname set C-Right=keycode endif where termname above should be replaced by the value of 'term' (with quotes around it) and keycode by what you get when hitting Ctrl-V followed by Ctrl-Right in Insert mode (with nothing around it). C-Right should be left as-is (9 characters). Don't forget that in a :set command, white space is not allowed between the = sign and the value, and any space, double quote, vertical bar or backslash present as part of the value must be backslash-escaped. Best regards, Tony. -- I have the world's largest collection of seashells. I keep it scattered around the beaches of the world ... Perhaps you've seen it. -- Steven Wright -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Substitutions Triggered by autocmd Are Noisy
On 25/09/11 18:49, Bastien Dejean wrote: Hi, I'm trying to removed some of the default mutt headers since there's no facility for doing so inside mutt. Hence the following: autocmd FileType mail :%s/^\(Reply-To\|Bcc\): \n//e The only problem is that I get the Press ENTER or type command to continue prompt. Appending 'silent' before the substitution doesn't help. Regards, Try setting 'report' to a high number, as follows: au FileType mail \ let s:report = report | \ set report=99 | \ %s/^\(Reply-To\|Bcc\%): \n//e | \ let report = s:report Best regards, Tony. -- A novice was trying to fix a broken Lisp machine by turning the power off and on. Knight, seeing what the student was doing spoke sternly: You can not fix a machine by just power-cycling it with no understanding of what is going wrong. Knight turned the machine off and on. The machine worked. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: How to map CTRL + Right Arrow
On 25/09/11 20:19, Tony Mechelynck wrote: On 25/09/11 18:02, Roy Fulbright wrote: I currently have the following mapping, which works fine, to move to the next tab in my edit session: noremap silentLeaderright :tabnextCR It would be much more convenient to use CTRL + Right Arrow instead of backslash (my Leader character) + Right Arrow. Oh, and BTW: Ctrl-PageDown and Ctrl-PageUp (if Vim sees them, see my porevious post) should go to the next or previous tab respectively without the need for a mapping. Best regards, Tony. -- She is descended from a long line that her mother listened to. -- Gypsy Rose Lee -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Remembering syntax when moving in and out of buffers
On 19/09/11 01:35, Benjamin R. Haskell wrote: On Mon, 19 Sep 2011, Tony Mechelynck wrote: On 19/09/11 00:14, Benjamin R. Haskell wrote: = What [the OP was] doing: = 1. in your .vimrc (1 line): autocmd BufReadPost,BufNewFile *.myfile source ~/myfile.vim 2. in ~/myfile.vim (6 lines of code): if exists(b:myfile) finish endif let b:myfile = 1 syntax match special /special/ highlight special term=bold cterm=bold = What [the OP] could be doing (one version): = 1. in your .vimrc (3 lines): these 3 lines actually belong in ~/.vim/filetype.vim (for Unix) or in ~/vimfiles/filetype.vim (for Windows) or in $VIM/vimfiles/filetype.vim (for access by any user, on any OS) — in all cases, create missing directories as you go along. The other version below (replacing filetype.vim by ftdetect/myfile.vim and doing away with the augroup, which Vim sets before sourcing everything in the ftdetect directory) would also work. Interesting. I didn't know about ~/.vim/filetype.vim. This way this autocommand will be correctly forgotten and remembered back if ever you do :filetype off and later :filetype on. See :help new-filetype. This wasn't the version I was advocating. But, since the OP implied that creating the proper directories was more complex (Thanks but if these are the alternatives then it's simpler to just [keep things as before]), I was providing a way that would work without having to create more directories. For the record, my suggested = What you could be doing (the other version): = is the one I actually recommend (and is what new-filetype seems to advocate): The way I understand it, having one filetype-detection script per filetype and dropping them all in a ftdetect subfolder is the way to go if you distribute your package (maybe as a vimball containing ftdetect/foobarbaz.vim, ftplugin/foobarbaz.vim, syntax/foobarbaz.vim, autoload/foobarbazFileHandlers.vim, autoload/foobarbazOptionsMenu.vim, etc.). When defining filetypes for my own use only, I find it simpler (but YMMV) to add just one filetype-detection autocommand per filetype in a common ~/.vim/filetype.vim (single-user) and/or $VIM/vimfiles/filetype.vim (system-wide), bracketed in both cases by :augroup ftdetect ... :augroup END I did not notice the ftdetect/ possibility immediately when coming to Vim, either (not sure which) because it didn't yet exist at the time, or because I imitated what Vim already does by means of $VIMRUNTIME/filetype.vim (which users should of course not modify in-place because, like anything under $VIMRUNTIME, it may be silently replaced by any update, thus losing your house changes if you had any). = What you could be doing (the other version): = 1. in ~/.vim/ftdetect/myfile.vim (1 line): au BufReadPost,BufNewFile *.myfile setf myfile 2. put the last two lines of ~/myfile.vim into ~/.vim/syntax/myfile.vim (2 lines): syn match special /special/ hi special term=bold cterm=bold Best regards, Tony. -- It is one of the superstitions of the human mind to have imagined that virginity could be a virtue. -- Voltaire -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: ctermbg different depending on terminal
On 19/09/11 17:56, Nathan Neff wrote: Hello, I have two terminals that I use -- xterm and urxvt. If I open up vim in urxvt, the Visual highlighting is this: Visual xxx term=reverse ctermbg=7 guibg=LightGrey If I open up vim in xterm, the Visual highlighting is this: Visual xxx term=reverse cterm=reverse guibg=LightGrey If I open up vim in Terminator, it's the same as in Xterm Where does the ctermbg=7 come from when I'm in urxvt? Thanks --Nate The default could come from a different 'background' setting but experiment shows that current Vim 7.3 sets the Visual highlight to cterm=reverse in both cases (you _are_ using the same Vim version on all these terminals aren't you?) To see where that highlight was last set, use :verbose hi Visual Vim will then tell you if that highlight was last set from a script or (unlikely) a modeline. If it was set by you typing ex-commands at the keyboard, or by Vim factory defaults, it won't tell you where it was set, because if it was you you should now, and if factory defaults it was never set. Best regards, Tony. -- For large values of one, one equals two, for small values of two. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: libcall problem under windows
On 19/09/11 20:17, niva wrote: Hi, After linking this dll ... .h extern C __declspec(dllexport) char * decrease(int * a); .cpp extern C __declspec(dllexport) char * decrease(int * a) { *a = - *a; return NULL; } ...I call it from gvim with this command echo libcall(dlltest.dll, decrease, 5) but I get the E364 error From :help libcall() [...] The function must take exactly one parameter, either a character pointer or a long integer, and must return a character pointer or NULL. [...] So why are you declaring the function with a pointer to an integer, then passing it a pointer to a character string? The function, if it did no type-checking, would get 0x35 0x00 (5 followed by a null byte on 16 bits), interpret it as the low word of a 32-bit integer, and change it and the following word to their arithmetic opposite, altering the string constant to something which is not a proper null-terminated string, and altering whatever is found in the next two bytes of memory, with unspecified results. If you want to get one less than the argument (as suggested by the name decrease) I propose the following (untested) which uses libcallnr() rather than libcall() since we want to return a numeric value rather than a string: .h extern C __declspec(dllexport) int decrease(long a); .cpp extern C __declspec(dllexport) int decrease(long a) { return (a-1); } :echo libcallnr('dlltest', 'decrease', 5) (with no quotes around the 5) which should return 4 if I didn't goof, though I'm not sure why libcallnr() should take a long and return an int. Maybe I misunderstood. Or if you want to change the sign in-place of an integer variable (as implied by the code you sent), well, you can't, because (the way I understand the help) libcall() doesn't take a pointer to an integer but either a pointer to a character string, or a long integer passed by value. But of course you could do that without libcall() by using simply :let foo = -foo or for the decrement case (the example I gave above) :let foo -= 1 Best regards, Tony. -- If I kiss you, that is a psychological interaction. On the other hand, if I hit you over the head with a brick, that is also a psychological interaction. The difference is that one is friendly and the other is not so friendly. The crucial point is if you can tell which is which. -- Dolph Sharp, I'm O.K., You're Not So Hot -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Setting the bold attribute for Normal text
On 18/09/11 16:40, Spiros Bousbouras wrote: I start a buffer not belonging to any specific filetype. I type some random stuff and then do :highlight Normal ctermfg=green I get green letters. But if instead I do :highlight Normal cterm=bold term=bold I don't get bold text. What am I doing wrong ? After setting the Normal highlight as above, does hitting Ctrl-L change anything? (If it does, there's a missing redraw somewhere). Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 173. You keep tracking down the email addresses of all your friends (even childhood friends). -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Remembering syntax when moving in and out of buffers
On 19/09/11 00:14, Benjamin R. Haskell wrote: On Sun, 18 Sep 2011, Spiros Bousbouras wrote: On Sep 18, 5:45 pm, Benjamin R. Haskell wrote: On Sun, 18 Sep 2011, Spiros Bousbouras wrote: The problem is that the filetype is being detected again every time you switch buffers. Apparently Debian (like most distros) has a bunch of auto-detection on filetypes. With your: :let verbose=20 You can see there's an autocmd on BufRead that gets triggered every time. It's conditioned on: if !did_filetype() And, since your filetype isn't set up the way Debian expects it (which may or may not be the way Vim normally does it), did_filetype() returns 0. I'm afraid I don't follow your explanation. Don't the Debian specific stuff become irrelevant when I do vim -u NONE ? Or do you mean that Debian have modified the source of vim before compiling so that even when I start vim with -u NONE some filetype detection stuff still happens ? In the experiment with vim -u NONE a b I described why is it that when I return to a then issuing only the syntax command (but not the highlight command) turns on highlighting ? And I didn't see any autocommands being executed either , the output was exactly as I described it. I wasn't using -u NONE, sorry. I was explaining what goes wrong without it. In the -u NONE case that you present, it gets cleared because syntax starts fresh prior to loading each new buffer, so that filetype detection can detect the file and load the proper syntax without having to worry about clearing out the syntax of whatever other file or files are open. There are a few ways to avoid having Vim load the buffer from scratch each time you switch to it. One way is to set the 'hidden' option. Another is to set bufhidden=hide. Both of those alter how buffer management works slightly. (You can switch away from a buffer that contains unsaved changes, for example, though Vim will prompt you about that if you try to exit.) Here's a version of the problem with no simplifications: File a contains This is a special line File b is empty. I do vim -u NONE a b :let verbose=20 :syntax match special /special/ :highlight special term=bold cterm=bold The word special gets highlighted. 2Ctrl-^ b 0 lines, 0 characters Ctrl-^ a 1 line, 23 characters Now special is no longer highlighted. :syntax No Syntax items defined for this buffer :syntax match special /special/ The word special gets highlighted again. Note that this time I didn't have to enter the highlight command to get the highlighting. I would be especially interested if anyone who runs Debian Lenny would try the above test. Is Debian Lenny the same as Debian 6? I don't use Debian, but I have VM's of Debian 5 and 6 for testing things. Under 6 is where I observed the BufRead problem. Debian 6 is squeeze , Debian 5 is lenny. Works the same on Lenny for me as it did on Squeeze. I'm not sure which parts of this are necessary, but the following works for me. Using your example with the 'a' and 'b' files, but moving 'a' to 'a.myfile' (so it can be detected by extension): 1. Change your autocmd for detection from: (old:) autocmd BufReadPost,BufNewFile *.myfile source ~/myfile.vim to, either: i. if you *really* want to keep it in vimrc (for some reason -- not recommended, but it worked fine in testing): aug filetypedetect autocmd BufReadPost,BufNewFile *.myfile setf myfile aug END ii. or just put it in ~/.vim/ftdetect/myfile.vim (where you don't need the augroup wrapper): au BufReadPost,BufNewFile *.myfile setf myfile au is short for :autocmd setf is short for :setfiletype 2. And create a file ~/.vim/syntax/myfile.vim containing just the following two lines: syn match special /special/ hi special term=bold cterm=bold Then it's properly detected for me under Debian 6. Thanks but if these are the alternatives then it's simpler just to reexecute the syntax commands every time the buffer is loaded. Maybe I'm missing something, but my suggestion is simpler than (or at worst as simple as) what you're already doing. And it has the benefit of being better-contained: All your Vim-related settings are in your ~/.vimrc file and ~/.vim directory (and its subdirs). = What you said you were doing: = 1. in your .vimrc (1 line): autocmd BufReadPost,BufNewFile *.myfile source ~/myfile.vim 2. in ~/myfile.vim (6 lines of code): if exists(b:myfile) finish endif let b:myfile = 1 syntax match special /special/ highlight special term=bold cterm=bold = What you could be doing (one version): = 1. in your .vimrc (3 lines): these 3 lines actually belong in ~/.vim/filetype.vim (for Unix) or in ~/vimfiles/filetype.vim (for Windows) or in $VIM/vimfiles/filetype.vim (for access by any user, on any OS) — in all cases, create missing directories as you go along. The other version below (replacing filetype.vim by ftdetect/myfile.vim and doing away with the augroup, which Vim sets before sourcing everything in the ftdetect directory) would also work.
Re: vim and tmux
On 17/09/11 14:40, Michael Henry wrote: On 09/15/2011 11:20 PM, meino.cra...@gmx.de wrote: tmux uses C-b as prefix to its commands. I don't run tmux, but for use with GNU screen, I use the key prefix CTRL-@ (CTRL-2 works without the SHIFT key as well), since that's not used by Vim or anything else that I currently use. Michael Henry Ctrl-@ is NULL, not sure if Vim wouldn't identify it with Ctrl-J (see :help NL-used-for-Nul) which might make it problematic as the {lhs} of a mapping. Just my 0.20€ Best regards, Tony. -- When the surgeon came to see her on the morning after her operation, the young woman asked her somewhat hesitantly how long it would be before she could resume her sex life. I really haven't thought about it, gulped the stunned surgeon. You're the first patient who's asked me that after a tonsillectomy! -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: Interrupt a while as CTRL_C
On 15/09/11 20:19, niva wrote: Hi, I am running this script and would like to interrupt it from a call feedkeys(\C-c) but it does not work. while 1 calll system(myexe) sleep 1000m redraw endwhile When I type CTRL + C on my keyboard, it works and stop the while loop. When I click on amenu icon that execute :call feedkeys((\C-c)CR it fails and does not stop the current while loop script. Thanks for help (untested) func s:Sleep(prog) while 1 call system(a:prog) sleep 1 redraw if getchar(0) == 3 return endif endwhile endfunc command -nargs=1 -complete=shellcmd SleepCall call s:Sleep(q-args) Invoke it at the console or in a script by :call SleepCall('myexe') Get out of it (I think) by hitting Ctrl-C or by feedkeys(\C-C). Anything else you type before Crtl-C is discarded. Best regards, Tony. -- Klein bottle for sale ... inquire within. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: gvim or vim in console...
On 14/09/11 22:55, Shay wrote: Just switched. After 8-9 years or so, I went a little deeper into colorschemes and plugins and found that vim was trashed outside of X. I'm sure there's a way to call vim from the command line without plugins or .vimrc, but I wouldn't remember it. [...] without plugins and vimrc vim -u NONE with plugins, without vimrc vim -u NORC with vimrc, without plugins vim --noplugin see :help --noplugin If you load Vim with no vimrc, you may want to add the -N command-line switch in order to start in 'nocompatible' mode. see :help -N Best regards, Tony. -- Major Premise: Sixty men can do a piece of work sixty times as quickly as one man. Minor Premise: One man can dig a posthole in sixty seconds. Conclusion: Sixty men can dig a posthole in one second. -- Ambrose Bierce, The Devil's Dictionary -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: recolor the extra gray pixels around fullscreen gvim.
On 14/09/11 02:01, Shay wrote: Looks like gvim maximizes to the greatest number of full lines and columns? The rest of the screen is filled with pale gray. Can I recolor the filled area? Changing my gtk theme doesn't seem to help. If your GTK or KDE (or Windows or Mac) theme doesn't help, then AFAIK you can't, other than by changing the C source, maybe, but I don't know where; and recompiling. Needless to say, the expected return on investment is probably too low to justify making the attempt, possibly negative (side-effects, regressions, ...). Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 170. You introduce your wife as my_l...@home.wife and refer to your children as forked processes. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
Re: yank inner word
On 12/09/11 20:24, Spiros Bousbouras wrote: On Sep 12, 3:40 pm, Ben Fritzfritzophre...@gmail.com wrote: Yikes! Text-objects are way more useful without using visual mode, Ok , I'm convinced text objects are wonderful. Is there a way to get the line range covered by a text object to be used in user defined commands ? I can see that you can yank the object itself and use the yanked text in your command but say that for whatever reason you want the line range or even better the byte range which the object occupies. Is there a way to get that ? Getting the line range or the byte range covered by an object into user-defined commands is possible: it's what operator-pending mappings are all about. But I don't pretend that I really understand it. Best regards, Tony. -- It's easier to get forgiveness for being wrong than forgiveness for being right. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php