separator in user-defined command name
I tried '-' and '_' in user-defined command name, both are not accepted (like X_Y, X-Y). Is there maybe some [other] separator that is allowed in user-defined command name ? Thanks Yakov
Re: question on gf and path
It worked and I appreciate the simpleness. Thanks. On Fri, 1 Dec 2006, Tim Chase wrote: Is there a way to make gf open some.file from this line? Include(/includes/some.file); where the file is actually sitting under web server root, like /var/www/html/includes/some.file I tried adding /var/www/html to the :set path but vim will not recognize it. /var/www/html/; was the same. Basically I'm looking for a way to add prefixes. Assuming you have /var/www/html in your path, the following pairing should help you out: nnoremap silent gf :exec 'e ' . findfile(substitute(expand('cfile'), '^/*','',''))cr nnoremap silent c-wf :exec 'sp ' . findfile(substitute(expand('cfile'), '^/*','',''))cr The findfile() function also takes an extra parameter if you want to refrain from munging your actual path, you could do something like findfile(..., path.',/var/www/html') On the same note, would it be possible to let gf open /var/www/html/includes/some.file when I gf on this string http://somehost.com/includes/some.file or by defining a new command (say wf)? A similar transformation could tweak the previous, something like substitute(expand(...), '^\(http://[^/]/\)\=/*','','') would strip off leading slashes and leading protocol+host. (that regexp/substitute() is untested, but should be approx. correct, save for possible needs to escape the \ characters) Alternatively, you could map it to leadergf and leaderc-wf to maintain the original meanings, but create new mappings to provide the additional functionality. HTH, -tim Regards, Ben K. Developer http://benix.tamu.edu
Re: question on gf and path
Thanks. On Sat, 2 Dec 2006, Marc Weber wrote: On Fri, Dec 01, 2006 at 10:30:26AM -0600, Ben K. wrote: Is there a way to make gf open some.file from this line? Include(/includes/some.file); where the file is actually sitting under web server root, like /var/www/html/includes/some.file I tried adding /var/www/html to the :set path but vim will not recognize it. /var/www/html/; was the same. Basically I'm looking for a way to add prefixes. On the same note, would it be possible to let gf open /var/www/html/includes/some.file when I gf on this string http://somehost.com/includes/some.file or by defining a new command (say wf)? That's exactly where you can use my little script (which will isntall some dependencies, too) Just add this into your ftplgugin/filetype.vim file: -- 8 -- 8 filetype_sourced.vim -- 8 -- 8 -- 8 noremap gf :call vl#ui#navigation#gfHandler#HandleGF()cr call vl#ui#navigation#gfHandler#AddGFHandler([matchstr(expand('cWORD'),'Include(\\\zs[^\].*\\ze\)')]) -- 8 -- 8 -- 8 -- 8 -- 8 -- 8 -- 8 and source the installer file http://www.mawercer.de/marcweber/vim/vimlib/installers/vimlib_gfhandler_installer_sourceme.vim (Don't be afraid. The installer will ask for confirmation before doing anything.) I would suggest saving it to another directory (eg ~/.vimlib or ~/.vim_gf) and adding this folder to your runtimepath. set runtimepath+=~/.vimlib Then its easy to remove it again if you don't like it. I think you can see that [matchstr ... does the interesting thing which is getting the file from under the cursor by calling expand('cWORD') and remvoving the Include text. You have to adjust it the way you like. You have to write your own code which removes /includes and adds /var/www/html/includes/ which would look like this: call vl#ui#navigation#gfHandler#AddGFHandler(['/var/www/html/includes'.matchstr(expand('cWORD'),'Include(\/includes\\zs[^\].*\\ze\)')]) You can even add different include directories: call vl#ui#navigation#gfHandler#AddGFHandler(['/var/www/html/includes1' call vl#ui#navigation#gfHandler#AddGFHandler(['/var/www/html/includes2' call vl#ui#navigation#gfHandler#AddGFHandler(['/var/www/html/includes3' Then you'll be asked which file to open if it doesn't exist. Unfortunately the documentation (http://www.mawercer.de/marcweber/vim/vimlib/docs/vl_ui_navigation_gfHandler_vim.html) isn't up to date because vim segfaults while creating it and I don't have the time to find the code causing it. If something doesn't work drop me a mail. HTH Marc Weber Regards, Ben K. Developer http://benix.tamu.edu
How to change controls to other Keyboard input
Is it posible to change vim controls to be independent on input characters? I use english and czech keyboard and they have different key layout. Can I translate keys in command mode? I need to ů have same meaning as ; becouse they are on same key. It's really hard to use Vim with czech keyboard, but i need to write thesis in czech of course. Thanks for advices. Best Regards. Ondra
Re: separator in user-defined command name
Hello, Yakov Lerner [EMAIL PROTECTED] wrote: I tried '-' and '_' in user-defined command name, both are not accepted (like X_Y, X-Y). Is there maybe some [other] separator that is allowed in user-defined command name ? I'm afraid only uppercase letters can be used In case you need to define several commands like X-Y, X-Z, X-U, ... then you can also consider X having a sub command as its first parameter. This is what I choose in a BuildToolWrapper.vim - :BTW echo toolchains() :BTW setlocal make :BTW addlocal cygwin :BTW addlocal STLFilt :BTW help ... HTH, -- Luc Hermitte http://hermitte.free.fr/vim/
Re: Do something for all ft, except....
Hello, Meino Christian Cramer [EMAIL PROTECTED] wrote: As far as I understood augroups I can do specific actions for a specific filetype. Or none - * I now came accross the situation to define a keymapping for all filetypes except for one. Is there a more elegant (and suitable for a lot more than one single keybinding) way to do this as to define the keymapping and delete it afterwards in a augroup for the filetype where it is not wanted ? I think the best approach consists in having a general autcommand that matches all files. The action of the aucommand would be someting like if ft!='specificFT' \| runtime! macros/yourScript.vim \|endif (By the way: Is there any command for restore the old keymapping and - if not - how can I backup a keymapping before changing it with *map-commands?) I'm not aware of any feature like this one. We can obtain the associated action of a mapping before it is overriden, but after that it would be too late. Moreover, we have no guarantee that another mapping will not try to override the association. HTH, -- Luc Hermitte http://hermitte.free.fr/vim/
Do a grep -r without match .svn directory ?
Hi, In vim, I would like do a :grep -r but don't match .svn directory. Grep or vim have this feature ? Thanks for you help Stephane
Re: Tutorial on mapping keys in Vim
Hi Yegappan, * Yegappan Lakshmanan on Wednesday, November 29, 2006 at 22:22:28 -0800: I have created a tutorial on mapping keys in Vim. http://www.geocities.com/yegappan/vim_maps_tutorial.txt This tutorial describes mode specific maps, key notations, tips about maps in various modes, etc. Let me know if you have any comments Unfortunately only a very short one: I like it, it's very useful, thank you very much! or suggestions on improving this tutorial. Not on this one (yet). But a similar thing on how to handle the 'tabstop', 'softtabstop', 'shiftwidth', 'expandtab' etc. options would be nice to have ;) Thanks again. c -- _B A U S T E L L E N_ lesen! --- http://www.blacktrash.org/baustellen.html
Re: Man generates lines that are too long
De. Chip, Charles E Campbell Jr said on 12/04/2006 02:52 PM: Guido Van Hoecke wrote: The :Man command always outputs lines that do not fit within the current line length. You could try Manpageview, available at * from vim.sf.net: http://vim.sourceforge.net/scripts/script.php?script_id=489 * latest version from my website: http://mysite.verizon.net/astronaut/vim/index.html#MANPAGEVIEW I got the latest version (dec 4) from your website. It ignores my default number option, and foldcolumn value. I like that: no need for an autocommand in my .vimrc. However, I do not understand why it does not properly display certain characters. The -f option section in the procmail manpage displays as follows (using plain linux (ubuntu 6.10) man command): -f fromwhom Causes procmail to regenerate the leading ‘From ’ line with fromwhom as the sender (instead of -f one could use the alternate and obsolete -r). If fromwhom consists merely of a single ‘-’, then procmail will only update the timestamp on the ‘From ’ line (if present, if not, it will generate a new one). Manpageview shows this: -f fromwhom Causes procmail to regenerate the leading â8090From ' line with fromwhom as the sender (instead of -f one could use the alternate and obsolete -r). If fromwhom consists merely of a single â8090-', then procmail will only update the timestamp on the â8090From ' line (if present, if not, it will generate a new one). Apparently it has a problem with opening quotes? Additionally, this causes some unfortunate wrapping. The default man command underlines the three occurances of the 'fromwhom' word, Manpageview doesn't. The underline thing does not really bother me, the quote character handling is a bit unfortunate. This behaviour is as described in gvim as well as vim, in a GNOME Terminal 2.16.1 as well as in a plain xterm. My vim :version output: :version VIM - Vi IMproved 7.0 (2006 May 7, compiled Oct 20 2006 09:47:48) Included patches: 1-35 Compiled by [EMAIL PROTECTED] Big version with GTK2-GNOME GUI. Features included (+) or not (-): +arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent +clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +cryptv +cscope +cursorshape +dialog_con_gui +diff +digraphs +dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path +folding -footer +fork() +gettext -hangul_input +iconv +insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap +menu +mksession +modify_fname +mouse +mouseshape +mouse_dec +mouse_gpm -mouse_jsbterm +mouse_netterm +mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype +path_extra +perl +postscript +printer -profile +python +quickfix +reltime +rightleft +ruby +scrollbind +signs +smartindent -sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white +tcl +terminfo +termresponse +textobjects +title +toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup +X11 -xfontset +xim +xsmp_interact +xterm_clipboard -xterm_save system vimrc file: $VIM/vimrc user vimrc file: $HOME/.vimrc user exrc file: $HOME/.exrc system gvimrc file: $VIM/gvimrc user gvimrc file: $HOME/.gvimrc system menu file: $VIMRUNTIME/menu.vim fall-back for $VIM: /usr/share/vim Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/usr/include/gtk-2.0 - I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pan go-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -DORBIT2=1 -pthread -I/usr/ include/libgnomeui-2.0 -I/usr/include/libgnome-2.0 -I/usr/include/libgnomecanvas-2.0 -I/ usr/include/gtk-2.0 -I/usr/include/libart-2.0 -I/usr/include/gconf/2 -I/usr/include/libb onoboui-2.0 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include /gnome-keyring-1 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/orbi t-2.0 -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr/include/p ango-1.0 -I/usr/include/freetype2 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/u sr/include/cairo -I/usr/include/libxml2 -O2 -g -Wall-D_REENTRANT -D_GNU_SOURCE - DTHREADS_HAVE_PIDS -DDEBIAN -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFS ET_BITS=64 -I/usr/lib/perl/5.8/CORE -I/usr/include/python2.4 -pthread -I/usr/include/t cl8.4 -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_LARGEFILE64_SOURCE=1 -I/usr/lib/ruby/1.8/x8 6_64-linux Linking: gcc -rdynamic -Wl,-export-dynamic -Wl,-E -L/usr/local/lib -o vim -lgtk-x 11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lfontconfig -lXext -lX render -lXinerama -lXi -lXrandr -lXcursor -lXfixes -lpango-1.0 -lcairo -lgobject-2.0 -lg module-2.0
Re: your best vim scripting tip
On Mon, 04 Dec 2006 00:40:53 +0100 A.J.Mechelynck [EMAIL PROTECTED] wrote: Kim Schulz wrote: Hi, It you should give one (or more) tips to a person who was going to start creating scripts for vim, then what would it be? (besides know your :help :-) ) ideas could be: Do's and dont's best util script often used functions ways of optimization etc. etc.. In addition to what Yakov and Mikolaj have said, and with which I fully agree, my main advice would be: Your Mileage Will Vary. - One person's most used script might not even be useful for another user. - A keymap, a colorscheme, a syntax script, a utility script or a vimrc each require fundamentally different approaches. One thing Mikolaj mentioned, but which I want to stress: make your scripts as portable as you can: - You're on Linux now, but if and when you find yourself facing a Mac or Windows (or other) machine, you will still want to use Vim the same way. - Your scripts should work in both Vim and gvim (if at all possible). - If ever you find yourself using a Vim version with a limited featureset, or an older version of Vim, you don't want your vimrc (or other Vim script) to halt on an error because you set an unsupported option or use an unsupported command (for that version). This means that IMHO: * you should test has(), exists() etc. whenever there is a possibility that some feature might possibly be absent on some version of Vim. (Better be safe than sorry.) * if there are several ways to program a single task, use vim-script in preference to interfacing with perl, python, etc., unless: (a) you know that the required interpreter will always be available whenever you will need that task, and (b) the alien version of the script is faster and cleaner than the vim version, or the task at hand cannot be handled with pure vim-script. Best regards, Tony. Thanks. it was answers like this I was looking for. -- Kim Schulz| Private : http://www.schulz.dk [EMAIL PROTECTED] | Business: http://www.devteam.dk +45 5190 4262 | Sparetime: http://www.fundanemt.com
Re: How to change controls to other Keyboard input
On 12/4/06, Ondřej Ševčík [EMAIL PROTECTED] wrote: Is it posible to change vim controls to be independent on input characters? I use english and czech keyboard and they have different key layout. Can I translate keys in command mode? I need to ů have same meaning as ; becouse they are on same key. It's really hard to use Vim with czech keyboard, but i need to write thesis in czech of course. Just use nmap. Like :nmap ů ; Yakov
Re: separator in user-defined command name
On 2006-12-04, [EMAIL PROTECTED] wrote: Hello, Yakov Lerner [EMAIL PROTECTED] wrote: I tried '-' and '_' in user-defined command name, both are not accepted (like X_Y, X-Y). Is there maybe some [other] separator that is allowed in user-defined command name ? I'm afraid only uppercase letters can be used Actually, uppercase letters, lowercase letters and digits can be used, but the name must start with an uppercase letter. :help user-cmd-ambiguous Regards, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Wireless Division | Spokane, Washington, USA
Re: Do something for all ft, except....
On 2006-12-03, Meino Christian Cramer [EMAIL PROTECTED] wrote: Hi As far as I understood augroups I can do specific actions for a specific filetype. I now came accross the situation to define a keymapping for all filetypes except for one. Is there a more elegant (and suitable for a lot more than one single keybinding) way to do this as to define the keymapping and delete it afterwards in a augroup for the filetype where it is not wanted ? (By the way: Is there any command for restore the old keymapping and - if not - how can I backup a keymapping before changing it with *map-commands?) I don't know under what conditions you want to restore a previous mapping, but if you set any filetype-specific mappings with the buffer option (see :help map-buffer), then they will apply only to the buffer in which they were defined. Other buffers, or any new buffers you create with a different file type, will use the mappings defined for their file type, or will use the global mappings if none are defined for their file type. So, if your old keymappings were global and your new keymappings are buffer-local, the old keymappings will be restored when you open a new buffer (if not overridden by a new set of local keymappings). HTH, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Wireless Division | Spokane, Washington, USA
Re: Do a grep -r without match .svn directory ?
Hi, On 12/4/06, KLEIN Stéphane [EMAIL PROTECTED] wrote: Hi, In vim, I would like do a :grep -r but don't match .svn directory. Grep or vim have this feature ? If you use the grep.vim plugin, then you can set the Grep_Skip_Dirs variable to skip the .svn directory. You can get this plugin from: http://vim.sourceforge.net/scripts/script.php?script_id=311 - Yegappan
VIM Books
I have been using VIM for years to do my development and feel I am a competent user. I have done some minor tweaks in my .vimrc but I have never written a plugin and very rarely do any scripting in the editor. But, I want to take it to the next level. I esp want to start scripting functionality (preferrably in VIM 7 via Ruby). I also do most of my programming and writing in VIM (other than when I am doing Eclipse RCP development). I remember there being a couple of VIM books out there. Are any worth reading for someone like me? Recommendations? TIA. Kevin Taylor
RE: VIM Books
From: Taylor, Kevin, Mon, December 04, 2006 5:16 pm I have been using VIM for years to do my development and feel I am a competent user. I have done some minor tweaks in my .vimrc but I have never written a plugin and very rarely do any scripting in the editor. But, I want to take it to the next level. I esp want to start scripting functionality (preferrably in VIM 7 via Ruby). I also do most of my programming and writing in VIM (other than when I am doing Eclipse RCP development). I remember there being a couple of VIM books out there. Are any worth reading for someone like me? Recommendations? I've found the online help much better than any third-party manual. If you read: :help usr_41 :help eval :help options you are 90% the way there. -- Steve Hall [ digitect dancingpaper com ]
Re: VIM Books
I have been using VIM for years to do my development and feel I am a competent user. I have done some minor tweaks in my .vimrc but I have never written a plugin and very rarely do any scripting in the editor. But, I want to take it to the next level. I esp want to start scripting functionality (preferrably in VIM 7 via Ruby). It's hard to beat simply diving in with the vim help-files and trying your hand at some scripting. The included help files are volumnous in their coverage, even if it can be a bit of a task to find the material. I'd much rather have that problem than not have the answer in there at all. There's also a treasure-trove of example scripts at www.vim.org where you can find a handful of ones that sound interesting and rip into their guts to see what makes them tick. You can try your hand at tweaking them and see what you can do. Additionally, when/if you have questions, this list is a very welcoming place to try and help you along. I remember there being a couple of VIM books out there. Are any worth reading for someone like me? Recommendations? O'Reilly has _Learning the vi Editor_ and the _vi Pocket Reference_ both of which sound like you're past them a bit. Perhaps more to your interest would be _Vi IMproved--Vim_ put out by New Riders, which focuses specifically on Vim. I've thumbed through all three, reading the parts I found interesting, but find that between the help-files and the list, dead-tree (paper) books can't keep up with the pace. Having used Vim for nearly 7 years (and vi before that), there are still dark corners of Vim I've never explored. I don't know whether that should encourage or terrify you. :) But basic scripting is easy enough to pick up for anybody who has used other programming languages. Particularly, Vim7 has the nicities of list/dictionary data-types that make some previously painful operations much less so. HTH, -tim
(un)sourcing
Hi, I use the following autocmd in my ~/.vimrc to load a source file with my personal vim mappings while editing a tex file: autocmd FileType tex source ~/Dot.vilatexrc This works fine. However, the mappings continue to exist even after I open a different filetype without restarting vim. Is there an unsource command? If yes, how do I tell vim to do that each time I open another filetype. I have to add that, the appropriate syntax plugins and indent files are loaded for the new filetype. So, I'm happy with that. Any pointers will help. Thanks in advance. Senthil. -- Today's fortune: Don't kiss an elephant on the lips today.
Re: sourcing
On Mon 4-Dec-06 5:56pm -0600, C.G.Senthilkumar. wrote: I use the following autocmd in my ~/.vimrc to load a source file with my personal vim mappings while editing a tex file: autocmd FileType tex source ~/Dot.vilatexrc This works fine. However, the mappings continue to exist even after I open a different filetype without restarting vim. Is there an unsource command? If yes, how do I tell vim to do that each time I open another filetype. You could make those mappings local. When you delete a buffer with local mappings, those mappings are cleared. See :help map-local -- Best regards, Bill
Re: How to change controls to other Keyboard input
Ondřej Ševčík wrote: Is it posible to change vim controls to be independent on input characters? I use english and czech keyboard and they have different key layout. Can I translate keys in command mode? I need to ů have same meaning as ; becouse they are on same key. It's really hard to use Vim with czech keyboard, but i need to write thesis in czech of course. Thanks for advices. Best Regards. Ondra you can test the following in your vimrc, before setting them: 'encoding' if encoding == 'latin1' :language messages if v:lang =~? '^en' || v:lang == 'C' :language ctype if v:ctype =~? '\%(iso-8859-1\|latin1\)$' then depending on the result, either set a 'langmap' (to translate into English the Czech characters input by your Czech keyboard driver) or a 'keymap' (to use an English-language keyboard to input Czech). 'keymap' assumes that your keyboard driver is in English and translates the keypresses in Insert mode but not in Normal mode: e.g., with my $VIM/vimfiles/keymap/russian-phonetic_utf-8.vim, when I type Vsego horo%sego in Insert mode I get Всего хорошего; but in Normal mode my Vim commands remain in Latin (except the operand of the r command, the search pattern to the / command, etc.). The keymap can be toggled on or off by means of Ctrl-^ in Insert mode or by toggling the 'iminsert' option between 1 and 0. 'langmap' assumes that your keyboard driver is in some foreign language (the help gives an example for Greek) and translates Normal-mode commands, but not Insert-mode text, into English. IIUC, in that case it is not foreseen to set it on in Insert-mode also in order to input English text. see :help expr-option :help :language :help v:var :help 'keymap' :help 'langmap' :help i_CTRL-^ etc. Best regards, Tony.
Re: sourcing
On Mon 4-Dec-06 6:54pm -0600, you wrote: On Mon, 4 Dec 2006, Bill McCarthy wrote: On Mon 4-Dec-06 5:56pm -0600, C.G.Senthilkumar. wrote: I use the following autocmd in my ~/.vimrc to load a source file with my personal vim mappings while editing a tex file: autocmd FileType tex source ~/Dot.vilatexrc This works fine. However, the mappings continue to exist even after I open a different filetype without restarting vim. Is there an unsource command? If yes, how do I tell vim to do that each time I open another filetype. You could make those mappings local. When you delete a buffer with local mappings, those mappings are cleared. See :help map-local :help map-local *:map-local* *:map-buffer* *E224* *E225* If the first argument to one of these commands is buffer it will apply to mappings locally to the current buffer only. Example: :map buffer ,w /[.,;]CR ... What does the buffer mean? Is it a literal string or the name of the file I'm editing or something else? It is a type of map it this context. The map will only apply to the current buffer. When you read a file into a buffer, for example, the file type is set which triggers the FileType event. There are examples given of such a map. I'll give another below. Instead of using an autocmd, you could place those maps in a file called tex.vim in your local ftplugin directory. Place this single line in such a file: map buffer c-a :echo 'It worked!'CR Now edit a tex file and try c-a. Moving to another window not containing a tex file and c-a has its normal behavior. -- Best regards, Bill
Re: Do a grep -r without match .svn directory ?
KLEIN Stéphane wrote: Hi, In vim, I would like do a :grep -r but don't match .svn directory. Grep or vim have this feature ? Thanks for you help Stephane This is actually OT for Vim, since grep is an external program; but you can use grep -r --exclude=PATTERN to skip any directory matching the pattern (at least with GNU grep). In Vim you would use (IIUC) :set grepprg=grep\ -r\ --exclude=*.svn :grep \word\ ~/dir/subdir/* Best regards, Tony.
Re: (un)sourcing
C.G.Senthilkumar. wrote: Hi, I use the following autocmd in my ~/.vimrc to load a source file with my personal vim mappings while editing a tex file: autocmd FileType tex source ~/Dot.vilatexrc This works fine. However, the mappings continue to exist even after I open a different filetype without restarting vim. Is there an unsource command? If yes, how do I tell vim to do that each time I open another filetype. I have to add that, the appropriate syntax plugins and indent files are loaded for the new filetype. So, I'm happy with that. Any pointers will help. Thanks in advance. Senthil. there is no unsource command, but you can build your script so as to avoid unwanted side-effects: - use :map buffer not plain :map similarly for map!, imap, cnoremap, etc. - use :setlocal not plain :set - if you need to set a global option for the duration of your script, save it on entry and restore it on exit, e.g. :let save_cpo = cpo :set cpovim ... :let cpo = save_cpo :unlet save_cpo etc. Note that a script which is only to be sourced at the FileType autocommand for tex files can be called (on Windows) ~/vimfiles/after/ftplugin/tex.vim (on Unix/Linux) ~/.vim/after/ftplugin/tex.vim It will then run immediately after $VIMRUNTIME/ftplugin/tex.vim without the need for you to set up an autocommand. The caveats about :map buffer and :setlocal still apply. If your script has a different name, and you don't want to rename it, you can simply source it from a script with the above name; or if your system supports soft links, you can link it from ~/.vim/after/ftplugin/tex/ i.e., you can set it up with (e.g.) the following shell commands (which are shown for Unix): mkdir -p ~/.vim/after/ftplugin/tex cd ~/.vim/after/ftplugin/tex ln -sv ~/Dot.vilatexrc vilatex.vim At the FileType autocommand event for tex files, Vim will lookup (among others) scripts named ~/.vim/after/ftplugin/tex/*.vim : it will find ~/.vim/after/ftplugin/tex/vilatex.vim, which is a soft link pointing to ~/Dot.vilatexrc, and source the latter. see :help ftplugin-name Best regards, Tony.
Re: Pasting utf8
On Fri, Dec 01, 2006 at 11:31:50AM -0800, Bill Moseley wrote: VIM - Vi IMproved 7.0 (2006 May 7, compiled Nov 15 2006 16:24:17) Included patches: 1-164 I don't normally use utf8, but I have a uxterm running on Linux. If I copy and paste some UTF8 text from Firefox into Vim I see: Weeding for Your Library\u2019s Health ^^^ But, pasting into the xterm it works fine. That is, in my uxterm I do this (which works correctly): $ echo Weeding for Your Library’s Health utf8-test Where Weeding... was pasted into the xterm with my middle mouse click. Now in Vim I open utf8-test my screen looks fine and encoding? shows encoding=utf8: Weeding for Your Library’s Health ~ ~ ~ 1,16 All But, if I paste with my middle mouse button into Vim I get: Weeding for Your Library’s Health Weeding for Your Library\u2019s Health --- pasted line ~ ~ ~ -- INSERT -- 2,18 Bot What is it not pasting the utf8 character? set mouse? shows mouse=a. I cannot reproduce this problem. Do you get the same behavior if you paste with *p (starting in Normal mode) or C-R* (starting in Insert mode)? What if you start vim with $ vim -u NONE (If your locale is set to something unicode, then 'encoding' should still be set to utf-8; but it is still worth checking this and correcting if I am wrong.) There may be something wrong with your terminal, or some sort of argument between uxterm and vim. Do you have a problem with gvim or with vim running in other terminals? I use gnome-terminal, but I get the same (expected) result when I try with uxterm. HTH --Benji Fisher
Re: Do a grep -r without match .svn directory ?
On Tue, 05 Dec 2006, A.J.Mechelynck wrote: KLEIN Stéphane wrote: Hi, This is actually OT for Vim, since grep is an external program; but you can use grep -r --exclude=PATTERN to skip any directory matching the pattern (at least with GNU grep). Apparently this doesn't work for GNU grep. It only excludes matches on file basenames, I am told. Correct me if I am wrong. In Vim you would use (IIUC) :set grepprg=grep\ -r\ --exclude=*.svn :grep \word\ ~/dir/subdir/* -- Greg MathesonAll teaching is teaching under difficult circumstances. --Dr Bean
Re: Do a grep -r without match .svn directory ?
Greg Matheson wrote: On Tue, 05 Dec 2006, A.J.Mechelynck wrote: KLEIN Stéphane wrote: Hi, This is actually OT for Vim, since grep is an external program; but you can use grep -r --exclude=PATTERN to skip any directory matching the pattern (at least with GNU grep). Apparently this doesn't work for GNU grep. It only excludes matches on file basenames, I am told. Correct me if I am wrong. In Vim you would use (IIUC) :set grepprg=grep\ -r\ --exclude=*.svn :grep \word\ ~/dir/subdir/* Hmm... In man grep I read -R, -r, --recursive Read all files under each directory, recursively; this is equiv‐ alent to the -d recurse option. --include=PATTERN Recurse in directories only searching file matching PATTERN. --exclude=PATTERN Recurse in directories skip file matching PATTERN. so maybe you're right. I haven't tested it. Best regards, Tony.
Re: VIM Books
2006/12/5, Taylor, Kevin [EMAIL PROTECTED]: I have been using VIM for years to do my development and feel I am a competent user. I have done some minor tweaks in my .vimrc but I have never written a plugin and very rarely do any scripting in the editor. But, I want to take it to the next level. I esp want to start scripting functionality (preferrably in VIM 7 via Ruby). I also do most of my programming and writing in VIM (other than when I am doing Eclipse RCP development). I remember there being a couple of VIM books out there. Are any worth reading for someone like me? Recommendations? TIA. Kevin Taylor I have a friend who had started use vim just 2 months ago, but he had written a set of very nice plugins for id-utilities and tag jump. What he had learn from is only the two old plugins: Project and TagList. He said read the Taglist plugin is enough to write your own. Regards. Yu Jianrong
Re: VIM Books
:help usr_41.txt should get you started. Hope this helps. Senthil. On Tue, 5 Dec 2006, Jianrong Yu wrote: 2006/12/5, Taylor, Kevin [EMAIL PROTECTED]: I have been using VIM for years to do my development and feel I am a competent user. I have done some minor tweaks in my .vimrc but I have never written a plugin and very rarely do any scripting in the editor. But, I want to take it to the next level. I esp want to start scripting functionality (preferrably in VIM 7 via Ruby). I also do most of my programming and writing in VIM (other than when I am doing Eclipse RCP development). I remember there being a couple of VIM books out there. Are any worth reading for someone like me? Recommendations? TIA. Kevin Taylor