Re: better recognising of tex vs plaintex filetype
On Sat, 26 Aug 2006 01:38:11 +0200, Stefano Zacchiroli wrote: [ Forwarded to vim-dev, as requested by Bram. Consider both the patch and the suggested default change as RFCs ] Hi Bram, could you please consider the attached patch for filetype.vim? It provides better recognition of 'tex' filetypes against 'plaintex' ones. It looks for sectioning commands that are specific to latex (\part, \section, \paragraph, ...). I don't think this is correct: these commands can be defined (and therefore appear) in plain TeX documents too (defined by the document writer), and they are defined by other TeX formats too (eplain and AMS-TeX, for example). Moreover, LaTeX requires these to appear before \begin{document}: in a LaTeX document there is some possibility of them appearing before only within a definition or somesuch, in which case \newcommand similia will appear before. -- Giuseppe Oblomov Bilotta Hic manebimus optime
Re: better recognising of tex vs plaintex filetype
On Sat, Aug 26, 2006 at 08:42:39AM +0200, Giuseppe Bilotta wrote: I don't think this is correct: these commands can be defined (and therefore appear) in plain TeX documents too (defined by the document writer), and they are defined by other TeX formats too (eplain and AMS-TeX, for example). Moreover, LaTeX requires these to appear before \begin{document}: in a LaTeX document there is some possibility of them appearing before only within a definition or somesuch, in which case \newcommand similia will appear before. Good point. Still, with the current situation, working with long latex document, likely to be split in several files which are \included from a single on, is annoying. The reason being that the included files do not have a preamble, and the recognition of 'tex' vs 'plaintex' is mainly based on stuff to appear in preamble. Note that not recognizing files as 'tex' properly will inhibit an important plugin as the vim latex suite to be loaded automatically. Maybe is just a matter of changing the default to 'tex' then? I tend to believe that the vast majority of documents in some \TeX dialect authored these day are \LaTeX ones ... Cheers. -- Stefano Zacchiroli -*- Computer Science PhD student @ Uny Bologna, Italy [EMAIL PROTECTED],debian.org,bononia.it} -%- http://www.bononia.it/zack/ If there's any real truth it's that the entire multidimensional infinity of the Universe is almost certainly being run by a bunch of maniacs. -!-
Re: Looking for the difference of two files, linewise
On Fri, 25 Aug 2006 16:58:38 -0400, Kamaraju Kusumanchi [EMAIL PROTECTED] wrote: On Friday 25 August 2006 14:04, Mike wrote: On Fri, 25 Aug 2006, William O'Higgins Witteman might have said: I have two files, one very long and the other much shorter. Every line in the short file is also in the long file. What I need is a file with every line in the long file *not* in the short file. Is there an easy way to have vim provide me with my desired complementary file? $ man comm Sorry for the nitpicking. But this sometimes might not work. For example $cat temp1.txt temp3 temp1 $cat temp2.txt temp2 temp3 temp4 temp1 temp5 $comm -3 temp1.txt temp2.txt temp2 temp1 temp4 temp1 temp5 $diff temp1.txt temp2.txt | grep '^' | cut -f 1 -d ' ' --complement temp2 temp4 temp5 The OP did not mention that his files were sorted. So comm command might not be applicable for his case. Alternatively, Perl offers a solution for files where the lines may be in any order: $ cat longfile one two three four five six seven eight nine ten $ cat shortfile nine six three $ perl -e 'open S, $ARGV[0] or die $ARGV[0]; %lines = map { $_ = 1 } S; close S; open L, $ARGV[1] or die $ARGV[1]; while (L) { print unless exists $lines{$_} } close L;' shortfile longfile one two four five seven eight ten -- Matthew Winn
Re: Paragraph formatting options
On 2006-08-24, cga2000 [EMAIL PROTECTED] wrote: On Sat, Aug 19, 2006 at 01:45:32AM EDT, Gary Johnson wrote: On 2006-08-19, cga2000 [EMAIL PROTECTED] wrote: [..] I'm three hours behind/ahead of you (EST) .. so it's bedtime for me .. It's getting late here, too, but I just got a new Windows PC and two new flat-panel monitors that I share between the Windows PC and my Linux PC, so I'm trying to get everything configured the way I want. So .. how did it go..? Pretty well. The monitors have dual inputs, so I can switch them easily between the two PCs. I don't have a way to switch a keyboard and mouse, though, so I have to shuffle the two keyboards and mice around when I want to use one machine or the other. That, plus not being able to copy-and-paste between the two and not being able to easily monitor what's happening on one machine while using the other make the setup less than ideal. But it beats all heck out of dual booting one machine. On the software side: I can log on to any Unix computer in this lab, whether it is running HP-UX, SunOS or Linux, and have pretty much the same environment. The basic applications are the same and all my customizations are in my HOME directory which is NFS automounted to each machine I'm logged on to. Each Windows machine, on the other hand, is its own little universe: every application you want to use has to be installed on it and every customization has to be applied to each machine individually. I can't believe anyone actually thinks the system administration cost of Windows is less than that of Unix, if you include the cost of users doing their own administration. (Grumble grumble.) Is there any way I could map a simple toggle to (de)activate fo+=a (auto-format) .. so I can get rid of it quickly when it starts causing problems .. such as editing mail headers in mutt .. eg. ?? Try this: map silent F1 :if match(fo, 'a') != -1 bar set fo+=a bar else bar set fo-=a bar endifCR HTH, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Wireless Division | Spokane, Washington, USA
Re: expr returning path of sourced script?
Hi, sgp wrote: On Windows gvim 7.0 I want to :set complete= to a file in the same folder of a syntax file c:\path\to\syntax\syn.vim c:\path\to\syntax\keywords.txt what expression can I use with :exe to achieve that? I tried adding exe set complete=k.substitute(fnamemodify(bufname('.'),':p:h').'\keywords.txt','\\','/','g') in syn.vim - but it doesn't work, as it yields the path of the edited file not of syn.vim let complete = expand('sfile:p:h') . '\keywords.txt' Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin)
Re: sharing keyboard/mouse (was: Paragraph formatting options)
On Aug 26, 2006, at 18:09, Gary Johnson wrote: Pretty well. The monitors have dual inputs, so I can switch them easily between the two PCs. I don't have a way to switch a keyboard and mouse, though, so I have to shuffle the two keyboards and mice around when I want to use one machine or the other. That, plus not being able to copy-and-paste between the two [...] Have you tried Synergy? It allows you to share mouse/keyboard (and even clipboards) between machines. You will still have to hit the video selection buttons if you want to have both monitors on a single machine at once, but it solves the keyboard/mouse problem.. http://synergy2.sourceforge.net/ -- Jim Tittsler http://www.OnJapan.net/ GPG: 0x01159DB6 Python Starship http://Starship.Python.net/crew/jwt/ Mailman IRC irc://irc.freenode.net/#mailman
How to create a plugin that runs after any skeletons are loaded as part of BufNewFile.
What I'm trying to do is create a plugin that acts based upon the contents of an arbitrary file buffer as soon after it has loaded its contents as possible. For existing files, using a BufReadPost autocmd is fine. For new file buffers that have text loaded into them via a BufNewFile autocmd, I can't just create a BufNewFile autocmd myself because I can't guarantee that mine will run last. So, the obvious thing to do is use BufEnter and/or BufWinEnter. However, I've got other plugins that will need the result of the new plugin and that want to use BufEnter and BufWinEnter themselves, which leads me back to the ordering problem. I can't make sure that the plugin will run first. It looks like FileType and Syntax events can occur between BufNewFile and BufWinEnter, but this only happens for files that a file type can be figured out for. If I edit a non-existent file called blah, there aren't any events between BufNewFile and BufWinEnter. Any suggestions?