Re: Substitute within a highlight group.
On 01/28/2011 07:27 PM, David Fishburn wrote: SRSearch optionally takes parameters. Oh. I'v already done without srhg. May be it will be usefull for someone. This function finds DNS zone serial and increments it. function AdjustSerial() let l:pos = getpos( '.' ) call cursor( 1, 1 ) while search( '\D\zs\d', 'W' ) > 0 if synIDattr( synID( line('.'), col('.'), 1 ), 'name' ) \ == 'zoneSerial' s/\(\d\+\)/\=IncSerial( submatch( 1 ) )/ break endif endwhile call setpos( '.', l:pos ) endfunction function IncSerial( s ) let l:today = strftime( "%Y%m%d", localtime() ) if match( a:s, '^' . l:today ) == 0 return str2nr( a:s ) + 1 else return l:today . '01' endif endfunction -- sergio. -- 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: Access vim command from the lua end WAS: How do the default key commands work
It's not about remapping. I'm writing a vimscript in lua. In a function I need the position of the opening and closing bracket. So in vim I would execute »%« twice. Than I have both positions. If there would be functions for the basic comands I just would execute the corresponding function. But apparently this is not the case. So I rephrase my question. How to access basic vim commands (here: %) from inside lua? How to access an arbitrary vim function from inside lua? Use the :normal command (probably with ! to avoid using user mappings). E.g. :lua vim.command"normal! %" Then to get the cursor position, you can use the getpos() function. E.g. :lua mypos = vim.eval"getpos('.')" Or something like that (I don't know Lua, and don't have the interface compiled in, so haven't tested; but this is the idea). Smiles, Ben. vim 7.3 compiled with lua interpreter Regards Marco -- 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: Typing numbers
Reply to message «Re: Typing numbers», sent 01:55:03 31 January 2011, Monday by adroid28: > Thanks for the advice but I have a macbook so I wouldn't want to do that > to it.. :) If I was using an external keyboard I would definitely do the > painting part. I think that would help! Instead of painting, you may use programming dvorak. It has all but two keys different from standart us keyboard (considering only alphanumeric part of keyboard), so having keys not black won't help you at all. It is also useful to map CapsLock to Left Control and Left Control to Escape. > I find though that the more customizing the less you can work on any system > you > happen upon and I wouldn't want that for keyboard skills... Do you have to type fast on systems that you cannot customize? I sometimes have to type on other systems, but it does not matter whether I will type fast or not there. In any case, making enter short is enough for me to slow down by about 20%. Original message: > Wow! A lot of info! > > Dotan Cohen wrote: > > I took a file to the F, J, 4, 8, F4, and F8 keys on the keyboard to > > help find them faster. Then I painted the whole keyboard black! > > Although painting may be a bit extreme, I do recommend filing a notch > > into the aforementioned keys. Years later and it still saves me > > precious seconds tens of times per day. > > > > If you really want to go wild on the keyboard, you can cut the silicon > > domes inside to make the keys easier to press. That is the third thing > > that I do to any new keyboard now (while the paint on the key caps is > > drying, after filing notches). > > Thanks for the advice but I have a macbook so I wouldn't want to do that > to it.. :) If I was using an external keyboard I would definitely do the > painting part. I think that would help! > > I find though that the more customizing the less you can work on any system > you > happen upon and I wouldn't want that for keyboard skills... > > D. signature.asc Description: This is a digitally signed message part.
Re: Typing numbers
Wow! A lot of info! Dotan Cohen wrote: > > > I took a file to the F, J, 4, 8, F4, and F8 keys on the keyboard to > help find them faster. Then I painted the whole keyboard black! > Although painting may be a bit extreme, I do recommend filing a notch > into the aforementioned keys. Years later and it still saves me > precious seconds tens of times per day. > > If you really want to go wild on the keyboard, you can cut the silicon > domes inside to make the keys easier to press. That is the third thing > that I do to any new keyboard now (while the paint on the key caps is > drying, after filing notches). > > Thanks for the advice but I have a macbook so I wouldn't want to do that to it.. :) If I was using an external keyboard I would definitely do the painting part. I think that would help! I find though that the more customizing the less you can work on any system you happen upon and I wouldn't want that for keyboard skills... D. -- View this message in context: http://vim.1045645.n5.nabble.com/Typing-numbers-tp3361514p3363830.html Sent from the Vim - General mailing list archive at Nabble.com. -- 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: Scrolling screen lines, I knew, it's impossible.
Ben Schmidt wrote: > >> On 27/01/11 3:38 AM, oCameLo wrote: > >>> There's so many questions and feature requests about use mouse to > >>> scroll screen lines, but until now, it's still impossible. > >> > >> Bram, you're not opposed to this kind of feature, are you? So if I did > >> some work on it, it could be included in Vim at some stage, right? > > > > This is a change that has a high probablity of introducing new bugs. > > True, though if coded carefully, these bugs should only appear when the > feature is turned on. > > > There are also a few questions about how to allow the user to access > > this, with an option setting or with different scroll commands? > > Probably a setting, so that it can work with scrollbars. > > I think it would probably be best to do this in stages: > > 1. Add new commands to scroll one screen line at a time. Test it out, > including by mapping the scrollwheel to those new commands in the X > GUIs. This shouldn't be too hard, as Vim can already display lines > starting part way through; it just usually doesn't. The experience > wouldn't be very smooth yet either, but screen-line scrolling would at > least be possible, and it would pave the way for something better. > > 2. Add an option to make scrolling work with screen lines. The meaning > of this option would be to affect all scrolling. To start with, though, > just make it change the meaning of the scroll wheel in X GUIs (already > implemented), and where easy, the clicks of the scroll bar arrows. It > might not affect Windows yet; it depends how the scrolling works there, > and I haven't looked in any detail. > > 3. Make other parts of Vim, such as moving line-to-line, vertical jumps, > and scrolling for scrolloff honour the new option, too, choosing window > positions that begin with partial lines. This would make the editing > experience pretty smooth. > > 4. Update the code for scrollbars more thoroughly, so that dragging the > bar can work with screen lines, too. Windows should definitely benefit > by this stage and the feature would basically be finished. > > 5. Pick the nits of little bugs that we can't foresee. > > What do you think? Would this be an OK way to proceed? Sounds good. -- "The question of whether computers can think is just like the question of whether submarines can swim." -- Edsger W. Dijkstra /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org/// -- 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: Delete, add 16, and insert
On 01/30/11 14:26, Adam wrote: What you want is to enter the ^A literally which can be done by prefixing it with control+V: Oh sorry yeah that's what I did do (^V^A) I guess I left it out. When you do that it appears that it's only incrementing by 1 though instead of the prefix that you give it (16 in this case) Good then, just wanted to make sure you weren't being surprised by the behavior...I just tested it with a simple file with rows of numbers and it worked with the [count] prefix: :g/^\d/norm 16^A (with the ^A as described). I also tested against the OP's data and it worked for me. Additionally, in my test case (with numbers on each line), you can just use the :norm command with the range as detailed at :help :normal-range and just issue :%norm 16^A (if any lines shouldn't be incremented, using a smarter :g command would be better) -tim -- 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: Delete, add 16, and insert
> > Then you may have some plugin remapping ? Try doing >execute "normal! 16\" > and see whether it helps. There is a known (and fixed in vim-7.3.100) bug > that > count is not passed to plugins in normal commands. > Yup I must have some plugin that is doing that (the execute worked just fine). I updated to a newer build of 7.3 and it worked as expected. Much appreciated! ~Adam~ -- 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: Delete, add 16, and insert
Reply to message «Re: Delete, add 16, and insert», sent 23:26:19 30 January 2011, Sunday by Adam: Then you may have some plugin remapping ? Try doing execute "normal! 16\" and see whether it helps. There is a known (and fixed in vim-7.3.100) bug that count is not passed to plugins in normal commands. Original message: > > What you want is to enter the ^A literally which can be done by prefixing > > > it with control+V: > Oh sorry yeah that's what I did do (^V^A) I guess I left it out. When you > do that it appears that it's only incrementing by 1 though instead of the > prefix that you give it (16 in this case) > > ~Adam~ signature.asc Description: This is a digitally signed message part.
Re: Delete, add 16, and insert
> > What you want is to enter the ^A literally which can be done by prefixing > it with control+V: > Oh sorry yeah that's what I did do (^V^A) I guess I left it out. When you do that it appears that it's only incrementing by 1 though instead of the prefix that you give it (16 in this case) ~Adam~ -- 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: Delete, add 16, and insert
On 01/30/11 12:46, Adam wrote: :g/^\d/norm 16(press control-a) I tried just going :norm 16^A but that also doesn't work (they both just increment the number by 1). I know that pressing 16^a in normal mode works correctly so that isn't the problem. If you only pressed ^A then it wasn't part of the command, but rather an instruction to vim to auto-complete with all matching patterns: :help c_CTRL-A What you want is to enter the ^A literally which can be done by prefixing it with control+V: :g/^\d/norm 16^V^A which will appear as :g/^\d/norm 16^A as detailed at :help c_CTRL-V Hope that makes sense, -tim -- 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: Delete, add 16, and insert
I'm curious why this doesn't work: :g/^\d/norm 16(press control-a) I tried just going :norm 16^A but that also doesn't work (they both just increment the number by 1). I know that pressing 16^a in normal mode works correctly so that isn't the problem. ~Adam~ -- 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: Access vim command from the lua end WAS: How do the default key commands work
On 2011-01-30 Tim Chase wrote: > If you want a catalog of the functionality, you can look at > things like > > [...] > > or more generically: > >:h index.txt Nice list I didn't know before. > They're available "natively" from within a "noremap" version of a > mapping. So if you want to swap the functionality of "j" and "k" > (wow, that would get annoying, but it's a good example), you can use > >:nnoremap j k >:nnoremap k j > > If you didn't use the "nore" version, then the 2nd one would > produce a recursive mapping: > >:nmap j k " now both j & k act like k >:nmap k j " now k calls j calls k calls j calls k...boom > > Hope this makes sense. There's no underlying function (like I > understand Emacs has) accessible to which keys can be rebound. Thanks for the explanation. It's not about remapping. I'm writing a vimscript in lua. In a function I need the position of the opening and closing bracket. So in vim I would execute »%« twice. Than I have both positions. If there would be functions for the basic comands I just would execute the corresponding function. But apparently this is not the case. So I rephrase my question. How to access basic vim commands (here: %) from inside lua? How to access an arbitrary vim function from inside lua? vim 7.3 compiled with lua interpreter Regards Marco -- 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: Typing numbers
On Fri, Jan 28, 2011 at 16:18, adroid28 wrote: > > Hi all :) > > I am fairly new in vim and also my touch typing is not that great. > Although I can deal very well with all the vim commands I found my self > always looking down when I need to write a number argument. I was > wondering wether there is a way in vim to input numbers without leaving > the home row. Or is it that with time I will be able to reach the numbers > row without looking? > I took a file to the F, J, 4, 8, F4, and F8 keys on the keyboard to help find them faster. Then I painted the whole keyboard black! Although painting may be a bit extreme, I do recommend filing a notch into the aforementioned keys. Years later and it still saves me precious seconds tens of times per day. If you really want to go wild on the keyboard, you can cut the silicon domes inside to make the keys easier to press. That is the third thing that I do to any new keyboard now (while the paint on the key caps is drying, after filing notches). Keyboard pictures upon request. -- Dotan Cohen http://gibberish.co.il http://what-is-what.com -- 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: Typing numbers
On 01/30/11 04:52, John Little wrote: There's only so much can fit under my skull.. I don't believe that limit is relevant; there's only a few hundred vim commands, if you use them you'll remember them. Now settable *options* ... ;-) -tim -- 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 the default key commands work
On 01/30/11 03:25, Marco wrote: there are just the definded mappings listed, not the basic built-in commands like »%«, »e« or »w«. The natively functionality for these is defined in C functions and mapped in Vim's source-code. If you want a catalog of the functionality, you can look at things like :help normal-index :h visual-index :h insert-index :h ex-cmd-index :h ex-edit-index or more generically: :h index.txt They're available "natively" from within a "noremap" version of a mapping. So if you want to swap the functionality of "j" and "k" (wow, that would get annoying, but it's a good example), you can use :nnoremap j k :nnoremap k j If you didn't use the "nore" version, then the 2nd one would produce a recursive mapping: :nmap j k " now both j & k act like k :nmap k j " now k calls j calls k calls j calls k...boom Hope this makes sense. There's no underlying function (like I understand Emacs has) accessible to which keys can be rebound. -tim -- 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, please
On 01/29/11 19:07, Ed Bradford wrote: I use DropBox. I edit a file on computer "A" and FORGET to exit vim. Now on computer "B", the .swp file prevents me from editing. I know I can ignore and just to go computer. However, VIM and DropBox could solve my problem by having an option to update on 1,4,16,64,256 second intervals and abandoning the lock file that is the .swp file. DropBox has solved the SYNC problem. Please embrace it and make DropBox and VIM work as people WANT, not as developer's expect. While I suspect that's not what most vim users want, vim does already supply the ability to live dangerously without a net if you want. You can tweak the following options: :help 'updatetime' :h 'updatecount' :h 'swapfile' :h CursorHold So you can instruct vim to auto-save the swap-file every N seconds, every M keystrokes, or to not write a swap-file at all. This does open you to the possibility of writing data you *don't* want. You can see an example at http://vim.wikia.com/wiki/Auto-save_current_buffer_periodically Another alternative: I know a number of folks on the list (myself included) who use vim within a session of "screen" so we can reattach not just a running session of vim, but any console applications from anywhere we have a SSH (or telnet, yuck) connection to our boxes. Not quite the same, but a very powerful tool to have in your arsenal. As an aside, I'm not sure if English is your first language, but your demanding "make vim work how I want, not how you want, even though it's a rare edge-case" tone doesn't win you any points. -tim -- 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: Typing numbers
In the spirit of this thread, I'll bite... Chris said: > There's only so much can fit under my skull.. I don't believe that limit is relevant; there's only a few hundred vim commands, if you use them you'll remember them. > ... and I prefer to stick with a limited subset of keyboard actions > that may not be the quickest and most efficient for all occasions.. > but that I can use without hesitation or incurring any overhead > rememberiing. Use more commands often enough and you'll use them without hesitation also. > Clever is not always better.. True, but vim really rewards being open to cleverness. From http://www.moolenaar.net/habits.html: "If you think like this, you will get stuck in the stone age of computing. Some people use Notepad for everything, and then wonder why other people get their work done in half the time... " Read the rest of that article for some balance on this. Regards, John -- 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
Invitation to connect on LinkedIn
I'd like to add you to my professional network on LinkedIn. - Yang Yang Zhou Video Codec Software Engineer at Polycom Confirm that you know Yang Zhou https://www.linkedin.com/e/tuoc8u-gjjsmirq-6c/isd/2236375880/1uRIHvke/EML-invite_guest_snackified_59/ --- After connecting with Yang, check out: - Kenneth Jordan at BGS Associates - Stephen LaCount at LaCount Law - Hugo Ahlenius at Nordpil (c) LinkedIn 2011 -- 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: Basic scripting question
Christian Brabandt [11-01-30 10:40]: > Hi meino.cramer! > > On So, 30 Jan 2011, meino.cra...@gmx.de wrote: > > > this is a very basic question ... I am currently learning vim > > scripting. > > > > With getline(.) I can get the contents of a line of a buffer. > > > > But: i > > How can I replace a line in the buffer with another contents? > > Use setline() or first delete its contents and then paste your buffer in > there. > > > How can I delete a line completly so it become an empty one or > > vanishes? > > Use the normal dd command > or use the :d _ command > or use setline('.', '') > > > How can I insert a line at a certain point? > > Use the append() or setline function calls. > > > How can a define the position in the text where this all will happen? > > position the cursor somewhere using cursor() or setpos(). Alternatively, > if you use setline() or append(), they take as argument, on which line > to operate. > > > Mit freundlichen Grüßen > Christian > -- > > -- > 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 Christian, thanks for your help! :) "setline()" seems to be the swiss army knife for me... ;) Best regards, mcc -- 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: Basic scripting question
Hi meino.cramer! On So, 30 Jan 2011, meino.cra...@gmx.de wrote: > this is a very basic question ... I am currently learning vim > scripting. > > With getline(.) I can get the contents of a line of a buffer. > > But: i > How can I replace a line in the buffer with another contents? Use setline() or first delete its contents and then paste your buffer in there. > How can I delete a line completly so it become an empty one or > vanishes? Use the normal dd command or use the :d _ command or use setline('.', '') > How can I insert a line at a certain point? Use the append() or setline function calls. > How can a define the position in the text where this all will happen? position the cursor somewhere using cursor() or setpos(). Alternatively, if you use setline() or append(), they take as argument, on which line to operate. Mit freundlichen Grüßen Christian -- -- 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 the default key commands work
On 2011-01-30 meino.cra...@gmx.de wrote: > for those keys, for which is true, that they are mapped to a function > call try using > > :map Thanks. I was aware of this command. But there are just the definded mappings listed, not the basic built-in commands like »%«, »e« or »w«. Marco -- 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
Help, please
I use DropBox. I edit a file on computer "A" and FORGET to exit vim. Now on computer "B", the .swp file prevents me from editing. I know I can ignore and just to go computer. However, VIM and DropBox could solve my problem by having an option to update on 1,4,16,64,256 second intervals and abandoning the lock file that is the .swp file. DropBox has solved the SYNC problem. Please embrace it and make DropBox and VIM work as people WANT, not as developer's expect. Ed Bradford egbegb2 AT gmail DOT com -- It is impossible to rightly govern a nation without God and the Bible. George Washington -- 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