Re: Fastest way to append line or char to a buffer
The last code I posted was a little broken. Here is a patch that appears (after a reasonable amount of testing) to work quite well for very quickly appending chars to a vim line. As I said, scripting language authors that use Vim output buffers as STDOUT style streams could use this to good advantage. Cheers Brad append-char.patch.gz Description: GNU Zip compressed data
UTF-8 Problem with Localization in Windows GVIM
This is really an old problem. It begins with VIM 6. While it is possible to set encoding=UTF-8 on Windows to be able to process text file in multiple encodings at the same time, the localized menu/messages has problems. The simplest _vimrc one may think of will render anything except the menu incorrect: set encoding=utf-8 source $VIMRUNTIME/vimrc_example.vim Reverse the order of these two lines will make the tool tips of the toolbar buttons correct, but the menu will be corrupt, as well as all the localized messages. The best I can get is with this _vimrc (simplified): source $VIMRUNTIME/vimrc_example.vim set encoding=utf-8 lang messages zh_CN.UTF-8 runtime! delmenu.vim In the time of Vim 6, it works well, except the tool tips for the toolbar buttons. I have to disable the toolbar translations in menu_zh_cn.utf-8.vim to make it work perfectly. With the new tab support in Vim 7, more headaches come. When I use localized messages, the context menu on the tabs (Close tab, New tab, and Open tab ...) is corrupt and the text is unreadable. Since the translation seems not in a .vim file, I find nowhere to fix it. Editing vim.mo might work, but it seems too incovenient and unreliable. The problem, as it seems to me, is that the context menu on the tab and the tool tips for the toolbar buttons only support the `ANSI' encoding. Any fixes/hacks to make it work? Best regards, Yongwei -- Wu Yongwei URL: http://wyw.dcweb.cn/
Re: Doing something til specific column
I tried something like this: :%s/^\(Chapter\ [0-9]\+:\ .*\)\%30c$/\1\./g I works fine, but needs to be repeated until no more matches are found. I'm sure you guys more experencied with Vim scripting will be able to complete my idea. -- Rodolfo Borges
Re: Doing something til specific column
Hi, thinking about this problem one round more I found another way to do this myself...looks a little weird and complicated -- but I think it is vimmish enough therefore: in normal mode with virtualedit set to block: C-V70|ypC-V70|r. The problem with this I still have currently: I dont know how to make 70 and . variable in a script so I can give those as parameters to a command/function. Thanks you very much for any help in advance! mcc
Re: Doing something til specific column
:%s/^\(Chapter\ [0-9]\+:\ .*\)\%30c$/\1\./g I works fine, but needs to be repeated until no more matches are found. I'm sure you guys more experencied with Vim scripting will be able to complete my idea. Well, if you're looking to make the change on every line that matches that pattern, you can take this (which I sent previously): :s/$/\=Repeat('.', 70 - strlen(getline('.'))) and do it on every line that matches that pattern: :g/^Chapter \d\+: /s/$/\=Repeat('.', 70 - strlen(getline('.'))) If you want to go with your keep appending periods on lines that until they match, you should just be able to :while 1 | %s/^.*\%30c$/./ | endwhile It will raise an error when the pattern no longer matches, which will break the loop. Inelegant in its own way, but it works. :) -tim
Re: Doing something til specific column
From: Rodolfo Borges [EMAIL PROTECTED] Subject: Re: Doing something til specific column Date: Sun, 20 Aug 2006 09:07:11 -0300 I tried something like this: :%s/^\(Chapter\ [0-9]\+:\ .*\)\%30c$/\1\./g I works fine, but needs to be repeated until no more matches are found. I'm sure you guys more experencied with Vim scripting will be able to complete my idea. -- Rodolfo Borges Hi Rodolfo ! The Chapter*-thingy was only meant as an example. The task I want to do is: repeat overwriting (or may be inserting) charcters with a previously given character starting from the current cursor position until a perviously given number of the end-column is reached. Thanks a lot for your help anyway ! :) keep hacking! mcc
Re: Doing something til specific column
The Chapter*-thingy was only meant as an example. The task I want to do is: repeat overwriting (or may be inserting) charcters with a previously given character starting from the current cursor position until a perviously given number of the end-column is reached. This sounds an awful lot like the description of a padleft or padright function: function! PadRight(s, c, len) let l:s = a:s while strlen(l:s) a:len let l:s = l:s . a:c for a PadLeft function, just use let l:s = a:c . l:s instead endwhile return l:s endfunc which can then be used with :%s/.*/\=PadRight(submatch(0), '.', 70) Or you can even do crazy stuff like :%s/^\([^:]*\):\s*/\=PadRight(submatch(1), '.', 50) which will transform text like Chapter 9: page 20 Chapter 10: page 22 into Chapter 9.page 20 Chapter 10page 22 (which will put the page XX starting at area^Wcharacter 51) This seems to give you the parameterizability (is that a word?) that you mentioned...wanting to change the character and the count fairly easily. -tim
[viminfo] Vim can't remeber position
Dear vim-list, I compile Vim-7.0 from source with default config. $ vim --version | grep viminfo +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace I also put viminfo variable in ~/.vimrc as: set viminfo='20,50,s10,h,r/mnt/usb But, when I open an old file, cursor always goto the first line Do I miss something in configuration step Thanks and regards, -- hoalu
Re: gvim fullscreen mode on Gnome ?
On Sat, 19 Aug 2006 12:08:13 +0200 KLEIN Stéphane [EMAIL PROTECTED] wrote: Hi, is there gvim full screen mode feature on GNU/Linux Gnome... ? In gnome I have f12 mapped to fullscreen of current window. this includes removing the window decoration etc. Only the menu and the toolbar of gvim will be shown but these can be removed via the guioptions in gvim too. the gnome-keybinding-properties program can be used to bind the fullscreen feature to any keybinding you want. -- Kim Schulz| Private : http://www.schulz.dk [EMAIL PROTECTED] | Business: http://www.devteam.dk +45 5190 4262 | Sparetime: http://www.fundanemt.com
Re: [viminfo] Vim can't remeber position
Lu Tan Hoa wrote: Dear vim-list, I compile Vim-7.0 from source with default config. $ vim --version | grep viminfo +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace I also put viminfo variable in ~/.vimrc as: set viminfo='20,50,s10,h,r/mnt/usb But, when I open an old file, cursor always goto the first line Do I miss something in configuration step Thanks and regards, I recommend adding the line runtime vimrc_example.vim near the top of your vimrc. But if you don't want to, you can still copy the autocommand found near line 70 of $VIMRUNTIME/vimrc_example.vim, as follows: When editing a file, always jump to the last known cursor position. Don't do it when the position is invalid or when inside an event handler (happens when dropping a file on gvim). autocmd BufReadPost * \ if line('\) 0 line('\) = line($) | \ exe normal g`\ | \ endif Best regards, Tony.
Re: Why is after/colors/colorscheme.vim disabled?
Peter Hodge wrote: Hello, I am just curious as to why after/colors/ scripts are disabled instead of behaving like after/ftplugin and after/syntax scripts? regards, Peter I'm not sure if it's a bug or a feature, but :colorscheme foobar works like :runtime colors/foobar.vim with no exclamation mark after :runtime. To use ~/.vim/colors/foobar.vim as a user addition to $VIMRUNTIME/colors/foobar.vim, invoke it with :runtime! colors/foobar.vim (with exclamation mark) instead. You might even want to define a user-command :command ColorScheme -nargs=1 runtime! colors/args.vim See :help :runtime Best regards, Tony.
Re: Why is after/colors/colorscheme.vim disabled?
On 8/21/06, A.J.Mechelynck [EMAIL PROTECTED] wrote: Peter Hodge wrote: Hello, I am just curious as to why after/colors/ scripts are disabled instead of behaving like after/ftplugin and after/syntax scripts? regards, Peter I'm not sure if it's a bug or a feature, but Every bug is a feature. :-) :colorscheme foobar works like :runtime colors/foobar.vim with no exclamation mark after :runtime. To use ~/.vim/colors/foobar.vim as a user addition to $VIMRUNTIME/colors/foobar.vim, invoke it with :runtime! colors/foobar.vim (with exclamation mark) instead. You might even want to define a user-command :command ColorScheme -nargs=1 runtime! colors/args.vim See :help :runtime Best regards, Tony.