Re: how can I add this feature to vim!!
Robert Cussons wrote: Michael F. Lamb wrote: jaywee wrote: *! Swap caps lock and escape, good for Vim remove Lock = Caps_Lock keysym Escape = Caps_Lock keysym Caps_Lock = Escape add Lock = Caps_Lock *to a file named .speedswapper to the home directory, and run *xmodmap ~/.speedswapper* in a terminal, I follow the guide and finally done! but the bad thing is I have to run the command every time I reboot ubuntu!! so any helps?? If it's a default Ubuntu install, meaning you're a Gnome user, name the file .Xmodmap rather than .speedswapper. When you log in, it should detect it automatically, and ask if you wish to use it. You might also find that configuration option available in the Gnome "Keyboard Properties" part of the system configuration menu, I'm not sure. Hi, I've been using this tip for ages and find it very useful, but I have the same problem as jaywee and none of the solutions so far suggested have solved the problem. I am using Debian Etch with KDE 3.5.5. In my home directory, I have tried creating a .xinitrc with the same contents as the .speedswapper file (there wasn't one already existing), I have tried creating a .Xmodmap file with the same contents and I have looked in the KDE control panel for anything that might be able to do this, but didn't find anything. It's not a big problem, but it just would be nice to have it done automatically :-) Thanks for any help, Rob. Hi, to make commands to be run when your desktop first loads I found this page useful: http://gentoo-wiki.com/HOWTO_Autostart_Programs so, to ensure your keys get swapped when KDE starts, put the commands into any accessible file (~/.speedswapper above). Then create a shell script in the appropriate directory for your distribution (on xfce4 here it is ~/.config/autostart, and in KDE it is ~/.kde/Autostart) that calls xmodmap: #!/bin/bash xmodmap ~/.speedswapper Make that executable (chmod +x ~/.kde/Autostart/swapscript) and you should have what you want (just in case any of you are lawyers, I, of course, do not mean to imply that this solution will give you everything that you want, just the required results of this question). cheers Chris
minibuf explorer and vim's default scrolling position
When I use the MiniBufExplorer plugin with a vertical buffer list and open 30 files in a 34-line window, it only shows the last 16 entries. I don't know if it's a MiniBufExplorer problem or some kind of default scrolling behavior in vim that causes it to want to fill up only half the screen. I want it to use all 32 lines in the display area for the file list. A text screenshot is at: http://rafb.net/p/SpeWiC26.html Any help appreciated, apologies if this isn't the right place for this question.
'set hidden' overwrites cmdline after BufEnter event?
Hello, I wrote a plugin that displays some information in the commandline using the echon command when entering a buffer. This works fine, unless a buffer is entered for the second time and the 'set hidden' option is enabled - in this case vim overwrites the command line with info like: "/tmp/file1" [readonly] 557 lines --0%-- (1 of 2) 1,1 Top I would like to understand why vim overwrites the commandline on some occasions, but not on others and if there is a possible workaround. The following code shows this behaviour: - save the following vimscript in ~/.vim/plugin/bla.vim: function! Bla() redraw echon "-- bla bla bla --" endfunction set hidden autocmd BufEnter * call Bla() - start vim with 2 filenames on the commandline - vim now displays the first file, and shows -- bla bla bla -- in the bottomline - go the the next buffer with :bnext - vim now displays the second file, and shows -- bla bla bla -- in the bottomline - go the the next buffer with :bnext - vim now displays the first file, but instead of showing the blablabla line, it now shows something like "filename" [readonly] 57 lines --0%-- (1 of 2) When the 'set hidden' line is omited from the script, the behaviour is consistent and the 'blablabla' line is always printed in the commandline, also when entering the first buffer for the second time. Can anybody explain to me why this is happening ? -- :wq ^X^Cy^K^X^C^C^C^C
Re: Insert mode and arrow keys philosophy
Hi all, In my first reply to this topic, I had in mind the 'small' keyboards without arrows keys (I first started to code BASIC on an Apple 2 and the T arrows weren't on the keyboard). This is why I said "although the use of h/j/k/l might have originated for other reasons back in the old 'vi' days". Thanks to Gene to confirm this and here is a picture of an ADM-3a keyboard: http://neil.franklin.ch/Computers/ADM-3A/IMG_0344.JPG. About the wrist movement that's just as bad when you hit ESC as when you use the arrow keys: just do the movement in slow motion for yourself: Hitting ESC is merely a little stretch with your hand (I use my middle finger to hit ESC) while you have to move your arm, elbow, forearm and hand to use the arrows keys. Don't forget either that in 'motion' mode you have tons of other shortcuts that will speed up your typing and avoid you to 'move' your hand to HOME, END, PG-UP and PG-DOWN etc. And as Raimon pointed out, ESC can be remapped to anything you want that could be easier for you to use. If it is true that at first some of the shortcuts are a bit 'unnatural' and could feel like you type twice more to reach the same results as with using the keyboard-provided keys, in the long term, once you've mastered motion in Vim, you'll realise that it's tuely priceless and it does speed up your typing. Good luck with it! All the best; Laurent
Re: Insert mode and arrow keys philosophy
Hi, Insert mode is to insert something in your text. If you want to move again, just hit ESC and you'll be back in motion mode. The idea behind using h/j/k/l is to avoid moving your hand/wrist too often while going back and forth between your keyboard and the arrow set (although the use of h/j/k/l might have originated for other reasons back in the old 'vi' days). If you touchtype, just hit ESC and stick with h/j/k/l as often as you can, using arrows will waste your time. If you don't touchtype, you won't really 'get' how great h/j/k/l is so don't worry too much about it and use the arrows whenever you want it. Laurent Yakov Lerner wrote: On 2/20/07, Pavel Shevaev <[EMAIL PROTECTED]> wrote: > Can you clarify which costs you are willing to > pay/sacrifice to avoid use of arrows ? Actually I'm just trying to follow the best vim practices and it's really hard for me to get used to h/j/k/l combination after working with some other text editors. That's why I'm asking how vim gurus work the most efficient way in insert mode... BTW, i type English symbols without looking at the keyboard(we call it "blind typing" in Russia) and the basic position of my right hand is on j/k/l/; buttons, that's why it's kinda hard to get used to switch to h/j/k/l position. I wonder if anybody remaps h/j/k/l => j/k/l/; and ; => h ;) If you ask me, I advise you to feel free to use arrows in any mode. "Arrows not working in insert mode" was the worst annoyance of the original vi, as far as I remember. Yakov Yakov
How to list occurrences of a pattern in a *buffer*?
Assume I have an unnamed buffer which hasn't been saved to the disk. Can I list all occurrences in that buffer of a pattern in the QuickFix window, and navigate with double-clicking mouse-1 or ":.cc"? I know something about ":grep" and ":vimgrep". They seem to be use only on *files*. And ":g//#" just *prompts* a list. Any idea? ___ 抢注雅虎免费邮箱-3.5G容量,20M附件! http://cn.mail.yahoo.com
Re: alphabetical order of a long bibl file
gosh, I was wrong! you don't even need vim7 for that... just visual, !sort -k 2 and that's it the problem is that after that the block are no longer separated by whitespaces and a BIG blank screen is showed but the rerefences are ahead, in the bottom of the file... That's why I thought vim was removing everything... it wasn't, it was just working properly... you delete spaces and they are kept, as blank lines... the size of the file is the same but you just have to look in the bottom! A mere :%s/$/\r suffices then, as Tim said vim is just great! Pau 2007/1/5, Vim Visual <[EMAIL PROTECTED]>: HI, thanks for the answer. If I try that the whole reference blocks are deleted... If I do it after having selected them on visual mode, I get "Not an editor command" If you want to try yourself, the whole file is here http://www.aei.mpg.de/~pau/biblio_TOT.bbl vim version 7.0.42 here ... ?? Thanks Pau 2007/1/4, Tim Chase <[EMAIL PROTECTED]>: > > I have a long bibliography file for a latex document and I must put > > the references in order. Unfortunately the different authors have used > > different styles, so that I have two blocks. > > In the first block all references look like > > > > > > \bibitem[ {Aarseth}, 1999]{Aarseth99}{Aarseth}, S.~J. (1999).\newblock > > {From NBODY1 to NBODY6: The Growth of an Industry}.\newblock {\em > > PASP}, 111:1333--1346. > > -- > > > > (note that each entry is a single row) > > > > And in the second block I have > > > > -- > > \bibitem{stroeer06emri} Stroeer A, Gair J R and Vecchio A, 2006, > > Proceedings of 6th LISA Symposium submitted, preprint gr-qc/0605227 > > -- > > > > (idem, single rows) > > Well, if a few liberties can be taken, Vim7's sorting > functionality offers a killer solution to this problem: > > :%sort /\\bibitem[^{]*{\zs/ > > Since each bib item is on its own line (and not overflowing to > multiple lines), a simple sort at the "right" offset (as kindly > found by the regexp) will do the trick. In this case, the > pattern is "start ("\zs") the sorting comparison after '\bibitem > up through the first open-curly-bracket' ("\\bibitem[^{]*{")" > > (okay, now /that/ had some odd quoting and parenthesizing in it...) > > It does have the side effect that the block are no longer > separated by whitespace, but this can then be rectified with > > :%s/$/\r > > which will doublespace them again. > > Adjust the "%" for to be your desired range. > > > I have more than 200 references and I don't feel like doing this per hand! > > > Hopefully this does the trick for you. If not, drop a line to > the list with the details of went gonzo (likely some precondition > I'm missing). > > -tim > > >
Re: alphabetical order of a long bibl file
HI, thanks for the answer. If I try that the whole reference blocks are deleted... If I do it after having selected them on visual mode, I get "Not an editor command" If you want to try yourself, the whole file is here http://www.aei.mpg.de/~pau/biblio_TOT.bbl vim version 7.0.42 here ... ?? Thanks Pau 2007/1/4, Tim Chase <[EMAIL PROTECTED]>: > I have a long bibliography file for a latex document and I must put > the references in order. Unfortunately the different authors have used > different styles, so that I have two blocks. > In the first block all references look like > > > \bibitem[ {Aarseth}, 1999]{Aarseth99}{Aarseth}, S.~J. (1999).\newblock > {From NBODY1 to NBODY6: The Growth of an Industry}.\newblock {\em > PASP}, 111:1333--1346. > -- > > (note that each entry is a single row) > > And in the second block I have > > -- > \bibitem{stroeer06emri} Stroeer A, Gair J R and Vecchio A, 2006, > Proceedings of 6th LISA Symposium submitted, preprint gr-qc/0605227 > -- > > (idem, single rows) Well, if a few liberties can be taken, Vim7's sorting functionality offers a killer solution to this problem: :%sort /\\bibitem[^{]*{\zs/ Since each bib item is on its own line (and not overflowing to multiple lines), a simple sort at the "right" offset (as kindly found by the regexp) will do the trick. In this case, the pattern is "start ("\zs") the sorting comparison after '\bibitem up through the first open-curly-bracket' ("\\bibitem[^{]*{")" (okay, now /that/ had some odd quoting and parenthesizing in it...) It does have the side effect that the block are no longer separated by whitespace, but this can then be rectified with :%s/$/\r which will doublespace them again. Adjust the "%" for to be your desired range. > I have more than 200 references and I don't feel like doing this per hand! Hopefully this does the trick for you. If not, drop a line to the list with the details of went gonzo (likely some precondition I'm missing). -tim
alphabetical order of a long bibl file
Hi, I have a long bibliography file for a latex document and I must put the references in order. Unfortunately the different authors have used different styles, so that I have two blocks. In the first block all references look like \bibitem[ {Aarseth}, 1999]{Aarseth99}{Aarseth}, S.~J. (1999).\newblock {From NBODY1 to NBODY6: The Growth of an Industry}.\newblock {\em PASP}, 111:1333--1346. \bibitem[ {Aarseth}, 2003]{Aarseth03}{Aarseth}, S.~J. (2003).\newblock {Black hole binary dynamics}.\newblock {\em Ap\&SS}, 285:367--372. \bibitem[ {Alexander} and {Hopman}, 2003]{AH03}{Alexander}, T. and {Hopman}, C. (2003).\newblock {Orbital inspiral into a massive black hole in a galactic center}.\newblock {\em ApJ Lett.}, 590:L29--L32. -- (note that each entry is a single row) And in the second block I have -- \bibitem{stroeer06emri} Stroeer A, Gair J R and Vecchio A, 2006, Proceedings of 6th LISA Symposium submitted, preprint gr-qc/0605227 \bibitem{farmer} Farmer A J and Phinney E S, 2003, Mon.~Not.~Roy.~Astron.~Soc.~{\bf 346} 1197 \bibitem{sesana05} Sesana A, Haardt F, Madau P and Volonteri M 2005 {\it Astrophys. J.} {\bf 623} 23 \bibitem{emriconf} Barack L and Cutler C 2004 \PR D {\bf 70} 122002 -- (idem, single rows) This means that (for these four entries) the final result should be --- \bibitem[ {Aarseth}, 1999]{Aarseth99}{Aarseth}, S.~J. (1999).\newblock {From NBODY1 to NBODY6: The Growth of an Industry}.\newblock {\em PASP}, 111:1333--1346. \bibitem[ {Aarseth}, 2003]{Aarseth03}{Aarseth}, S.~J. (2003).\newblock {Black hole binary dynamics}.\newblock {\em Ap\&SS}, 285:367--372. \bibitem[ {Alexander} and {Hopman}, 2003]{AH03}{Alexander}, T. and {Hopman}, C. (2003).\newblock {Orbital inspiral into a massive black hole in a galactic center}.\newblock {\em ApJ Lett.}, 590:L29--L32. \bibitem{emriconf} Barack L and Cutler C 2004 \PR D {\bf 70} 122002 \bibitem{farmer} Farmer A J and Phinney E S, 2003, Mon.~Not.~Roy.~Astron.~Soc.~{\bf 346} 1197 \bibitem{sesana05} Sesana A, Haardt F, Madau P and Volonteri M 2005 {\it Astrophys. J.} {\bf 623} 23 \bibitem{stroeer06emri} Stroeer A, Gair J R and Vecchio A, 2006, Proceedings of 6th LISA Symposium submitted, preprint gr-qc/0605227 -- My first feeling was to try something like visual + ! sort -k but this doesn't work... any idea? I have more than 200 references and I don't feel like doing this per hand! Thanks Pau
Re: sorting columns alphabetically
sorry, I got it: sort -k 3 The problem now are midnames, like Mr Bla Blo Ms Ble Blu Dr Bli T. Blu but I have deleted them :) 2006/11/22, Vim Visual <[EMAIL PROTECTED]>: Hi, I have a text file like Mr Bla Blo Ms Ble Blu Dr Bli Blu etc and I would like to sort the file alphabetically after the surname (3rd column). How can I do that? I know how to sort it after the first one (visual + !sort) thanks! Pau
sorting columns alphabetically
Hi, I have a text file like Mr Bla Blo Ms Ble Blu Dr Bli Blu etc and I would like to sort the file alphabetically after the surname (3rd column). How can I do that? I know how to sort it after the first one (visual + !sort) thanks! Pau
set -o vi
Hi, I guess you already know that typping set -o vi sets the cursor to vi mode... but vi indeed... Is there a way to set the cursor to vim, and load all map, ab etc defined in my vimrc? It'd great because I have to type a lot of times long commands like rsync -avurltz --rsh=ssh --progress [EMAIL PROTECTED]: Of course I could use aliases in my zshrc but I don't like aliases and would prefer vim to do the job for me, so that I could define a map RS to complete that command, for instance thanks, Pau
Re: Fighting with comments - Close the gap between vimtutor and :help
Gary Johnson wrote: I don't think that's true. Vim :help comprises two manuals: Vim User Manual - :help user-manual Vim Reference Manual - :help reference This is even discussed in ":help 01.1". The User Manual is written in a different style than the Reference Manual and is more readable. I believe the User Manual is intended to be the intermediate-level guide you're looking for. Regards, Gary Well, I said "that's basically it", I didn't really want to go through the details of :help and analyse what's missing in it because I don't think there is anything missing in it. I'm more talking about a tutorial "that will take you by the hand and bring you through the Vim universe in a nice and easy way" to quote myself. I believe that an official well-written tutorial that goes nice and easy with lengthy descriptions and good examples is missing. Something to turn people from novices to Vim addict. I'm always surprised that not every single coder doesn't use Vim on an everyday basis. Especially when I can say that since I've made the effort to learn the 'basics' of the software, I code two to three times faster, even tho I believe I don't use more than 20% of Vim. I've also had a look at the FAQ as suggested by belgian compatriot Tony and I think that it could be the perfect start for a good tutorial. Yet the tutorial needs to be adressed to novices with the objective to get them hooked asap :) I'll be in touch with the FAQ team and see if it is possible to start such a project. Laurent
Re: Fighting with comments - Close the gap between vimtutor and :help
Hi everobody, I recently had a very similar conversation with three guys on #vim (irc.freenode.net). Basicaly, there is two official help for Vim: - the vimtutor - :help And that's basically it. :help being your Vim dictionnary/encyclopedia/bible, it's very complete and has everything in it but it's hardcore to read and understand. Unfortunately, it's not easy at all to go through and to 'get' the way it works. I believe that there is room between vimtutor and :help to have some beginner to intermediate tutorial that will take you by the hand and bring you through the Vim universe in a nice and easy way. Let's not forget (especially for the Vim gurus out there) that Vim is very powerful but because of that it can be very hard to understand sometimes or even to adapt to it and make it your favourite text editor. Of course Google is your friend but the sheer ammount of tutorials out there can easily make you go left, right and center and basically not teach you anything useful but some 'tips and tricks' that is cool but won't make you code faster or deeply understand Vim. So I think that there is room for some official tutorial after the vimtutor and before a perfect use of the ultimate :help. The tutorial will totally avoid to be a scientific precision on how-to-exactly-define-terms-the-best-way-possible-using-the-less-words-possible. The tutorial should be well written and take time to explain things to novice in simple words. The idea is to bring people to the Vim highway efficiently. Such a basic tutorial could _also_ help novices to avoid asking questions that will make any Vim guru feel like saying: 'RTFM' As an example, here are some topics proposed: Non-technical: - Phylosophy behind Vim Where you would learn why it will help you to be faster in your everyday coding and what the user has to understand to truely enjoy Vim (talk about the need to touch-type to be truely efficient for instance) - Phylosophy behind the three modes (Normal, Visual, Insert) - Phylosophy behind the command line mode - Differences between Vi and Vim - Explain the folder structure and how the various config files work - Differences between Vim on Windows, Mac, Linux, Unix and console use - Configure once, use everywhere (or how to adapt your config to a different platform) - etc. Technical: - The big apple : Think different! Where you would learn that you need to think gg instead of 'CTRL-home' or xp to invert the order of two letters etc. This could have a list of standard keyboard shortcuts mapped to a list of Vim shortcuts. - Basics of Vim variables (:set :let etc.) - My first function : hello world! - Basic understanding of filetypes - Basic folding - Basics of syntax highlighting - Basic mappings & abbreviations - etc. Help! I need somebody - Phylosophy behind the :help command: how to 'think' :help - How to use :help efficiently - Good references to go one step further - etc. Of course, this is only a guide of what would be useful to a beginner but I firmy believe that some official tutorial is needed. Maybe this could be achieved by doing a 'best off' the various tutorials already available. Let me know what you think of this, Laurent A.J.Mechelynck wrote: Meghdad Azriel wrote: I was just kidding ;) I know that they are not secret but, they´re not that intuitive... and i´m still learning how to use that help effectivelly... maybe I neet to read those basic files with care... [...] To use the help effectively, one should learn to use the tools Vim itself includes to search the help (see, among others, ":help :help" and ":help :helpgrep"): :help brings you to the help for if there is one, otherwise to some help topic "resembling" what you typed :help pattern completes your command-line with the first help topic matching the pattern. Hit again to see the next one. Hit Ctrl-D to see them all. If you have 'wildmenu' on, the bottom status line will be replaced by a "menu" of possible matches: hit or to select, to accept, to abort. :helpgrep pattern searches the whole help text for /pattern/. The results are used to build a "quickfix error list" (see ":help quickfix.txt"). Then the following commands may come useful: :cn[ext] :cp[revious] or :cN[ext] :cnf[ile] :cpf[ile] or :cNf[ile] :cfir[st] or :cr[ewind] :cla[st] to navigate the list, displaying the helpfiles with the cursor on a match; :cope[n] to open the list of matching lines in its own split-window, where you can position the cursor on any of those lines then hit to see the same line in context in its helpfile; :ccl[ose] to close the quickfix window, even if it is not the current window. (Brackets represent the optional part of the command name
Re: copy from pdfs
ah! I love you! you solved the problem! My encoding was set to UTF-8, though 2006/10/16, A.J.Mechelynck <[EMAIL PROTECTED]>: Vim Visual wrote: > Hi, > > is there a way to remove all those strange symbols (and substitute > them with proper caracters) you get when you select a text section > from a pdf file and try to paste it into a vim file? > > The "fi" and " ` " etc are unknown to vim and it refuses to paste them... > > For instance: > > - efficient > > - "K" > > Try to copy and paste them into a vim file... > > Pau > > What do you have 'encoding' set to? If it is set to Latin1, try adding the following to your vimrc: if (&enc !~? '^u') && (&tenc == '') let &tenc = &enc endif set enc=utf8 setglobal bomb Best regards, Tony.
copy from pdfs
Hi, is there a way to remove all those strange symbols (and substitute them with proper caracters) you get when you select a text section from a pdf file and try to paste it into a vim file? The "fi" and " ` " etc are unknown to vim and it refuses to paste them... For instance: - efficient - "K" Try to copy and paste them into a vim file... Pau
Mac OS 10.3 - v7.0 - netrwPlugin.vim
Hello, I have not upgraded for some time, so today I did. I read a thread here about the new way the split vertical file explorer and the netrwPlugin.vim plugin. I also got used to the way the old directory and file list would open a file when clicked in the main window. So I changed the name of netrwPlugin.vim to stop it and pasted the old explorer.vim into my plugin directory. I don't have the time nor the expertise to go through the netrwPlugin.vim to see if I will be breaking anything I might really need. I couldn't find anything in :help about it, nor on the vim site or the authors site. Any thoughts? Thanks, dstefani
Re: re-edit of previously edited file no longer returns to same location w/vim7
Linda W wrote: I don't source example files by default. But my system has a /etc/vimrc and it does have the lines below, which appear to be equivalent if not the same as what is in the example. Perhaps vim no longer reads /etc/vimrc...? --- [EMAIL PROTECTED] computersdunno how old vim was resetting position "refixed" though...thanks for help
Re: How to comment a line in vim?
I have this in my vimrc to comment/uncomment lines or blocks of text in visual with the characters - (comment) and _ (uncomment) Have a look and you'll get the idea. You have to define the symbol for the extension of the file you're working on """ " Per a comentar/descomentar blocs de text sencers " "-" comenta i "_" el descomenta. Cal emprar-ho en " mode "visual" function! SimboletComentarZsh() map - :s/^/# /:nohlsearch map _ :s/^\s*# \=//:nohlsearch set comments=:# endfunction function! SimboletComentarFortran() map - :s/^/C /:nohlsearch map _ :s/^\s*C \=//:nohlsearch set comments=:C endfunction function! SimboletComentarLatex() map - :s/^/% /:nohlsearch map _ :s/^\s*% \=//:nohlsearch set comments=:% endfunction " Ací definim el tipus de "comment" segons el fitxer... autocmd FileType zsh call SimboletComentarZsh() autocmd FileType pythoncall SimboletComentarZsh() autocmd FileType perl call SimboletComentarZsh() autocmd FileType shcall SimboletComentarZsh() autocmd FileType octavecall SimboletComentarZsh() autocmd FileType java call SimboletComentarJava() autocmd FileType fortran call SimboletComentarFortran() autocmd FileType tex call SimboletComentarLatex() """
Re: deleting repeated blocks of text
Again thanks a lot... it's working fine, but today I found out that some blocks are repeated!! This script is meant to filter the information of a web page, and it's run once every 24 hours Can you have a look at the beginning of my file, Gerald? I think it's correct and still I am getting the last block of today repeated (in /tmp/arXiV_2.txt): :!links -dump http://lanl.arxiv.org/list/astro-ph/new > /tmp/arXiV_1.txt :e /tmp/arXiV_1.txt :1,/received/d :$?^\s*Cross-listings?,$d :%s/\[abs, ps, pdf, other\] ://g :%s/\[abs, pdf\] ://g :%s/Title:/\T\ítol\/Title<\/i>:\<\/b\>/g :%s/Authors:/\Autors\/Authors<\/i>:\<\/b\>/g :%s/Comments:/\Comentaris\/Comments<\/i>:\<\/b\>/g :let @a='' :g/hole\|relativistic\c|gravitational\c|waves\c|compact\c|n-body\c|grape\c|coalescence\c|LISA\|black\c|supermassive\c|intermediate\c/?^\s*astro-ph?,/^\s*astro-ph/-y A :%d :put a :1d :%s!^\s*astro-ph/\(\d\+\)!http://xxx.lanl.gov/pdf/astro-ph/\1";>& :%s// :%s/^$// :1s/// G :s/// :g/xxx\.lanl\.gov\|/put!='#end#' :%s/^\(.*xxx\.lanl\.gov\_.\{-}\_^#end#\)\%(\n\1\)\+$/\1 :g/^#end#$/d :w! /tmp/arXiV_2.txt
Re: deleting repeated blocks of text
Hey! Thanks! This worked out perfectly Now I have another question to you... The final file, which I got thanks to the help of all of you, is to be embedded into another web page... Which command should I add in the script to tell vi to embed it in the correct place? At the moment I do it by telling vi something like "go to line XXX, delete everything, insert text": :386,$d o :r /tmp/arXiV_2.txt :w! ~pau/WWW/arXiV.html But the inconvinient is that I have to modify the vim script whenever I add something to the web page, the number line 386 is wrong... and it is very tedious The place of the web page to embed it looks like this (without blank lines) : Between and - . . . . http://xxx.lanl.gov/pdf/astro-ph/0605080";> astro-ph/0605080 Títol/Title: Populating the Galaxy with low-mass X-ray binaries Autors/Authors: Paul D. Kiel, Jarrod R. Hurley Comentaris/Comments: 17 pages and 9 figures; accepted by MNRAS We perform binary population synthesis calculations to investigate the incidence of low-mass X-ray binaries and their birth rate in the Galaxy. We use a binary evolution algorithm that models all the relevant processes including tidal circularization and synchronization. Parameters in the evolution algorithm that are uncertain and may affect X-ray binary formation are allowed to vary during the investigation. We agree with previous studies that under standard assumptions of binary evolution the formation rate and number of black-hole low-mass X-ray binaries predicted by the model are more than an order of magnitude less than what is indicated by observations. We find that the common-envelope process cannot be manipulated to produce significant numbers of black-hole low-mass X-ray binaries. However, by simply reducing the mass-loss rate from helium stars adopted in the standard model, to a rate that agrees with the latest data, we produce a good match to the observations. Including low-mass X-ray binaries that evolve from intermediate-mass systems also leads to favourable results. We stress that constraints on the X-ray binary population provided by observations are used here merely as a guide as surveys suffer from incompleteness and much uncertainty is involved in the interpretation of results. http://xxx.lanl.gov/pdf/astro-ph/0605093";> astro-ph/0605093 Títol/Title: Toroidal LNRF-velocity profiles in thick accretion discs orbiting rapidly rotating Kerr black holes Autors/Authors: Zdenek Stuchlik, Petr Slany, Gabriel Torok Comentaris/Comments: Updated version of the Section talk at Albert Einstein Century International Conference at Palais de l'Unesco, Paris, France, 18-23 July, 2005; to appear in the Proceedings; AIP style files included; 8 pages We show that in the equatorial plane of marginally stable thick discs (with uniformly distributed specific angular momentum the orbital velocity relative to the locally non-rotating frames (LNRF) has a positive radial gradient in the vicinity of black holes with spin a>0.99979. The change of sign of the velocity gradient occurs just above the center of the thick toroidal discs, in the region where stable circular geodesics of the Kerr spacetime are allowed. The global character of the phenomenon is given in terms of topology changes of the von Zeipel surfaces (equivalent to the equivelocity surfaces in the tori with constant specific angular momentum distribution). Toroidal von Zeipel surfaces exist around the circle corresponding to the minimum of the equatorial LNRF velocity profile, indicating a possibility of development of some vertical instabilities in those parts of marginally stable tori with positive gradient of the LNRF velocity. Eventual oscillatory frequencies connected with the phenomenon are given in a coordinate-independent form. http://xxx.lanl.gov/pdf/astro-ph/0605094";> astro-ph/0605094 Títol/Title: Basic properties of toroidal structures in Kerr--de Sitter backgrounds Autors/Authors: Zdenek Stuchlik, Petr Slany Comentaris/Comments: Updated version of the Section talk at Albert Einstein Century International Conference at Palais de l'Unesco, Paris, France, 18-23 July, 2005; to appear in the Proceedings; AIP style files included; 8 pages Perfect fluid tori with uniform distribu
deleting repeated blocks of text
Hi, this is the continuation of a post... The point is that I have a file where blocks of text appear sometimes once, sometimes twice or even three times etc... I would like to find out how to delete the blocks that are repeated, so that in the end I am left with a text file in which the blocks appear only ONCE The text file looks like this, for instance:(please note that there are NOT blank lines in my text file, it's just after pasting here) What a call a "block" is a paragraph starting with a "http://xxx.lanl.gov/..."; until the next "http://xxx.lanl.gov/..."; http://xxx.lanl.gov/pdf/astro-ph/0605038";> astro-ph/0605038 Títol/Title: The Mass of the Central Black Hole in the Seyfert Galaxy NGC 4151 Autors: Kyle G. Metzroth (1, 2), Christopher A. Onken (1,3), Bradley M. Peterson (1) ((1) Department of Astronomy, The Ohio State University, (2) Department of Mechanical Engineering, The Ohio State University, (3) NRC Herzberg Institute of Astrophysics) Comentaris/Comments: 25 pages, 5 figures. Accepted for publication in The Astrophysical Journal In order to improve the reverberation-mapping based estimate of the mass of the central supermassive black hole in the Seyfert 1 galaxy NGC 4151, we have reanalyzed archival ultraviolet monitoring spectra from two campaigns undertaken with the International Ultraviolet Explorer. We measure emission-line time delays for four lines, C IV 1549, He II 1640, C III] 1909, and Mg II 2798, from both campaigns. We combine these measurements with the dispersion of the variable part of each respective emission line to obtain the mass of the central object. Despite the problematic nature of some of the data, we are able to measure a mass of 41.1 (+/- 7.3) million solar masses, although this, like all reverberation-based masses, is probably systematically uncertain by a factor of 3-4. http://xxx.lanl.gov/pdf/astro-ph/0605038";> astro-ph/0605038 Títol/Title: The Mass of the Central Black Hole in the Seyfert Galaxy NGC 4151 Autors: Kyle G. Metzroth (1, 2), Christopher A. Onken (1,3), Bradley M. Peterson (1) ((1) Department of Astronomy, The Ohio State University, (2) Department of Mechanical Engineering, The Ohio State University, (3) NRC Herzberg Institute of Astrophysics) Comentaris/Comments: 25 pages, 5 figures. Accepted for publication in The Astrophysical Journal In order to improve the reverberation-mapping based estimate of the mass of the central supermassive black hole in the Seyfert 1 galaxy NGC 4151, we have reanalyzed archival ultraviolet monitoring spectra from two campaigns undertaken with the International Ultraviolet Explorer. We measure emission-line time delays for four lines, C IV 1549, He II 1640, C III] 1909, and Mg II 2798, from both campaigns. We combine these measurements with the dispersion of the variable part of each respective emission line to obtain the mass of the central object. Despite the problematic nature of some of the data, we are able to measure a mass of 41.1 (+/- 7.3) million solar masses, although this, like all reverberation-based masses, is probably systematically uncertain by a factor of 3-4. http://xxx.lanl.gov/pdf/astro-ph/0605046";> astro-ph/0605046 Títol/Title: On the viability of holistic cosmic-ray source models Autors: J. Aublin, E. Parizot Comentaris/Comments: 5 pages, 1 figure, Accepted for publication in Astronomy and Astrophysics We consider the energy spectrum of cosmic-rays (CRs) from a purely phenomenological point of view and investigate the possibility that they all be produced by the same type of sources with a single power-law spectrum, in E^{-x}, from thermal to ultra-high energies. We show that the relative fluxes of the Galactic (GCR) and extra-galactic (EGCR) components are compatible with such a holistic model, provided that the index of the source spectrum be x \simeq 2.23\pm 0.07. This is compatible with the best-fit indices for both GCRs and EGCRs, assuming that their source composition is the same, which is indeed the case in a holistic model. It is also compatible with theoretical expectations for particle acceleration at relativistic shocks. http://xxx.lanl.gov/pdf/astro-ph/0605049";> astro-ph/0605049 Títol/Title: X-rays from the Globular Cluster G1: Intermediate Mass Black Hole or Low Mass X-ray Binary? Autors: David Pooley (UC Berkeley), Saul Rappaport (MIT)
Re: modify a text file
The problem is that I have to tell vim to convert the end of line and empty spaces into , and I do it like this: I mean : The problem is that I have to tell vim to convert the end of line and empty LINES into , and I do it like this:
Re: modify a text file
> when I run it I end up with an empty file... ? Well, you should be able to trace through it by entering each of the commands individually instead of sourcing the file to see where things are going funky. Places matters could go awry: I solved it like this: :1,/received/d :$?^\s*For subscribe options?,$d :let @a='' :g/hole\|relativistic\|LISA\|black\|supermassive\|intermediate/?^\s*astro-ph?,/^\s*astro-ph/-y A :%d :put a :1d :%s!^\s*astro-ph/\(\d\+\)!http://xxx.lanl.gov/pdf/astro-ph/\1";>& :w! /tmp/2.html :q and using the cat /tmp/1.html | vim -s foo_arXiv.vim - Well, we all have our peculiar areas of specialty. When it comes to things like plugins, syntax-highlighting nuances, i18n/encoding stuff, and indentation, I leave that to the folks on the list that are far more well-versed than myself. I'm more of an "ex" & regexp sorta guy, doing some crazy stuff there, but otherwise, just using pretty stock unadorned vim. I guess I am one of the syntax-highlighting guys... Now, as you can see, I am trying to generate an html out of the result ... the idea is to create not a web page but an htmlized file to include it later into a "real" web page... The problem is that I have to tell vim to convert the end of line and empty spaces into , and I do it like this: :1,/received/d :$?^\s*For subscribe options?,$d :let @a='' :g/hole\|relativistic\|LISA\|black\|supermassive\|intermediate/?^\s*astro-ph?,/^\s*astro-ph/-y A :%d :put a :1d :%s!^\s*astro-ph/\(\d\+\)!http://xxx.lanl.gov/pdf/astro-ph/\1";>& :%s!/^.// :%s!/^$// :w! /tmp/2.html :q But it doesn't work... In case you are interested in what I am doing, try this: #!/usr/bin/env zsh links -dump http://lanl.arxiv.org/list/astro-ph/new | sed 's/\[abs, ps, pdf, other\]//' | sed 's/Title:/\Title\<\/b\>/g'| sed 's/Authors:/\Autors\<\/b\>/g' > /tmp/1.html && cat /tmp/1.html | vim -s ~pau/bin/foo_arXiv.vim - where foo_arXiv.vim is posted above And, btw, if you also tell me how to make vim embed the resulting file into a determined position of the real web page (let's call it real_web.html) , I will be more than grateful!! Pau -tim
Re: modify a text file
Hi Tim, somehow my email was partially deleted... ?? cat file | vim - What stands the "-" for? Then, clean up the stuff we don't want 1,/received/d $?^\s*For subscribe options?,$d to strip off the header and footer. this worked out nicely My first-pass solution will end up with duplicate results if more than one of your keywords appear in the same "block" but on diff. lines: :let @a='' :g/red\|relativistic/?^\s*astro-ph?,/^\s*astro-ph/-y A :%d :put a :1d :wq name_of_output.txt this is the content of foo.vim? On separated lines? I also tried with CTRL + V + ENTER at the end of each line, but the result was the same... cat input.txt | vim -s foo.vim - when I run it I end up with an empty file... ? I'm sorry I couldn't come up with a clean way to snag just the unique paragraphs easily without having an instance show up as its own result-block. I was saying in my deleted email that in any case it's a nice lesson... When I think that people here think I know vim... what a shame! Anyways, it's at least one sorta-solution to what you describe. -tim
Re: Vimdiff
Alright, got it. The path wasn't correct in my _vimrc file. Stupid me for not looking further into this myself. Ah well, sometimes you work so hard that you can't think proprely anymore and that extra little effort you should put into solving a problem is just not there. Thanks Roy and Benji, Laurent Roy Fulbright wrote: Make sure you have a "diff" program located somewhere in your path on MSWin. That's what caused the error for me when I first installed Vim and tried to run vimdiff. Regards, Roy Fulbright Benji Fisher wrote: On Thu, Apr 27, 2006 at 12:30:27AM +0200, vim wrote: When I'm opening a file and then going into File->Split diff with and choose another file, I get the following error: E97: Cannot create diffs Version used: Version gVim 7.0f beta MS-Windows 32 bit GUI version There are a few suggestions under :help E97 HTH --Benji Fisher
modify a text file
Hi, I am struggling with sed and gawk but I guess that it'd be possible to employ vim in the command line (it's to make a script that will be automatically launched every 24 hours) but I don't have any idea of how to do it... How could I select the blocks (see file ahead) of a text file (say .txt) in which some particular words appear? Imagine that I want to keep the blocks containing words like "black", "supermassive", "red", "intermediate", "relativistic"... and delete the rest of blocks (and also the header and bottom of the file) What would be the command line with vim? (or are there other possibilities?) I would also like how to reemplace the astro-ph/0604565 with http://xxx.lanl.gov/pdf/astro-ph/0604565 for all numbers, not only for 0604565 ... any hint??? thanks! Remark: What I call header is the part from " arXiv.org" at the beginning of the file and until "received", and the bottom is from "For subscribe" until "(Access key information)". What I call a "block" is from the "astro-ph/number", Title, Authors and the tex block arXiv.org > astro-ph Search for (Help | Advanced search) ___ [__] [ Go! ] Astrophysics astro-ph new abstracts, Thu, 27 Apr 06 00:00:08 GMT 0604527 -- 0604550 received astro-ph/0604527 : Title Constraints on the Nature of Jets from kpc Scale X-ray Data Autors D. E. Harris (SAO), H. Krawczynski (Washington University in St. Louis) Comments: 5 pages; 3 figures; latex. This paper is based on a poster contribution to the meeting, ``Triggering Relativistic Jets'', held in Cozumel, MX at the end of March 2005 and will be published via a CD distributed with a special issue of Revista Mexicana de Astronomia y Astrofisica, Serie de Conferencias, eds. W.H. Lee & E. Ramirez-Ruiz, 2006 Motivated by the large number of jets detected by the Chandra X-ray Observatory, and by the inverse Compton X-ray emission model (IC/CMB) for relativistic jets, we revisit two basic questions: ``If the medium that carries the jet's energy consists of hot electrons, can we use the physical length of the jet to constrain the maximum electron energy?'' and ``Why do jets have knots?'' Based on the two non-thermal emission processes for X-rays from jets, we consider constraints on the jet medium and other properties from these two simple questions. We argue that hot pairs cannot be the dominant constituent of the medium responsible for the jet's momentum flux and that some mechanisms for producing fluctuating brightness along jets (rather than a monotonically decreasing intensity) are precluded by observed jet morphologies. astro-ph/0604528 : Title Minimal Noncanonical Cosmologies Autors Gabriela Barenboim, Joseph D. Lykken Comments: 20 pages, 5 figures, 3 tables We demonstrate how much it is possible to deviate from the standard cosmological paradigm of inflation-assisted LambdaCDM, keeping within current observational constraints, and without adding to or modifying any theoretical assumptions. We show that within a minimal framework there are many new possibilities, some of them wildly different from the standard picture. We present three illustrative examples of new models, described phenomenologically by a noncanonical scalar field coupled to radiation and matter. These models have interesting implications for inflation, quintessence, reheating, electroweak baryogenesis, and the relic densities of WIMPs and other exotics. For subscribe options to combined physics archives, e-mail To: [EMAIL PROTECTED], Subject: subscribe --- For help on viewing and making submissions, see this http URL For a list of archive mirror sites, see this http URL --- Third-party submissions cause excessive problems. Author self-submissions are exceedingly preferred. E-mail submissions have been discontinued in favor of better support for Web submissions. See this http URL Links to: arXiv, form interface, /find, astro-ph, /recent, /0604, /abs, help (Access key information)
Vimdiff
When I'm opening a file and then going into File->Split diff with and choose another file, I get the following error: E97: Cannot create diffs Version used: Version gVim 7.0f beta MS-Windows 32 bit GUI version Regards, Laurent