Re: HTML editing with vim: where to start ?
A.J.Mechelynck wrote: Vinay Doma wrote: A.J.Mechelynck wrote: Maybe I overreacted. OK, let's amend it: if you want a Windows-like editor, don't use Vim, use WordPad (in plaintext mode). I still won't recommend mswin.vim to anybody. But what about mswin.vim don't you like? All it has is a bunch of windows friendly mappings (Cut, Copy, Paste, Select All, Redo, Undo, etc). Looks pretty harmless to me. And you could always modify them to suit your need. vdoma What I don't like about it is that it interferes with standard Vim normal-mode commands, making Vim less Vim-like, and, in some cases, making some commands totally unavailable without unneeded extra work (such as creating noremaps for them and running the risk of hiding still other commands). One case in point is that of Ctrl-X which you (or someone else in this thread) noticed; there are others: almost every Ctrl-letter keystroke has a meaning in Vim; making them Windows-like hides the "proper" Vim command. There are Vim commands for everything you mentioned, and (IMO) those "windows-like" commands just stand in the way of learning the more versatile "native" Vim commands (for Cut: x = cut letter, dd = cut line, daw = cut word, [Visual]d = cut visual selection, etc.; prefix by "+ to place them into the clipboard. Select All is ggVG which breaks down as gg = go to top, V = start linewise visual, G = go to bottom. Undo is u, Redo is Ctrl-R [not r which is "replace"], And so on.) In the years I've been on this list, I don't count the number of times when newbies have come asking, in essence, "Why doesn't Vim behave as advertised?" and mswin.vim (which they unknowingly were sourcing in their vimrc) was the reason. Best regards, Tony. I never thought of that. I just started learning Vim on Windows because I was doing vi on HP/UX (now Vim7). I realize the handicap that mswin.vim gave me. I have commented it out for now to see if I can cut it, since my goal was to learn one editor on all the platform I am on (Windows, OSX, HP/UX). Robert
Re: HTML editing with vim: where to start ?
In the years I've been on this list, I don't count the number of times when newbies have come asking, in essence, "Why doesn't Vim behave as advertised?" and mswin.vim (which they unknowingly were sourcing in their vimrc) was the reason. Or the converse, where someone will ask "Why does vim behave differently on Linux/Mac/whatever than it does on my Windows box that I've been using for a long time?". Plenty of those come through on the list too :) Maybe mswin.vim should create a menu option called "make vim behave like it should, not like a Windows app" that opens all available vimrc files and nukes/comments any references to mswin ;) -tim (who also can't count the number of times mswin.vim has been involved in the answer to a post on the list)
Re: HTML editing with vim: where to start ?
Vinay Doma wrote: A.J.Mechelynck wrote: Maybe I overreacted. OK, let's amend it: if you want a Windows-like editor, don't use Vim, use WordPad (in plaintext mode). I still won't recommend mswin.vim to anybody. But what about mswin.vim don't you like? All it has is a bunch of windows friendly mappings (Cut, Copy, Paste, Select All, Redo, Undo, etc). Looks pretty harmless to me. And you could always modify them to suit your need. vdoma What I don't like about it is that it interferes with standard Vim normal-mode commands, making Vim less Vim-like, and, in some cases, making some commands totally unavailable without unneeded extra work (such as creating noremaps for them and running the risk of hiding still other commands). One case in point is that of Ctrl-X which you (or someone else in this thread) noticed; there are others: almost every Ctrl-letter keystroke has a meaning in Vim; making them Windows-like hides the "proper" Vim command. There are Vim commands for everything you mentioned, and (IMO) those "windows-like" commands just stand in the way of learning the more versatile "native" Vim commands (for Cut: x = cut letter, dd = cut line, daw = cut word, [Visual]d = cut visual selection, etc.; prefix by "+ to place them into the clipboard. Select All is ggVG which breaks down as gg = go to top, V = start linewise visual, G = go to bottom. Undo is u, Redo is Ctrl-R [not r which is "replace"], And so on.) In the years I've been on this list, I don't count the number of times when newbies have come asking, in essence, "Why doesn't Vim behave as advertised?" and mswin.vim (which they unknowingly were sourcing in their vimrc) was the reason. Best regards, Tony.
Re: HTML editing with vim: where to start ?
A.J.Mechelynck wrote: Maybe I overreacted. OK, let's amend it: if you want a Windows-like editor, don't use Vim, use WordPad (in plaintext mode). I still won't recommend mswin.vim to anybody. But what about mswin.vim don't you like? All it has is a bunch of windows friendly mappings (Cut, Copy, Paste, Select All, Redo, Undo, etc). Looks pretty harmless to me. And you could always modify them to suit your need. vdoma
Re: HTML editing with vim: where to start ?
"A.J.Mechelynck" <[EMAIL PROTECTED]> wrote: > Mikolaj Machowski wrote: > >> my guess is :source $VIMRUNTIME/mswin.vim -- the script that cripples > >> Vim in a not-very-successful attempt to make it more Windows-like. WTF, > >> if you want a Windows-like editor, don't use Vim, use Notepad! IMHO > >> mswin.vim is better done without. > >> > > > > Hey, it is not *that* bad :) > > Maybe I overreacted. OK, let's amend it: if you want a Windows-like editor, > don't use Vim, use WordPad (in plaintext mode). I still won't recommend > mswin.vim to anybody. My preferred Notepad replacement is Notepad++ http://notepad-plus.sourceforge.net/uk/site.htm Syntax highlighting, a tabbed interface, handles Unix (LF-separated) files, lightweight, etc. It's not Vim, but it's a good fallback when dealing with people who don't want to learn Vim. -- /George V. Reilly mailto:[EMAIL PROTECTED] http://www.georgevreilly.com/blog/
Re: HTML editing with vim: where to start ?
Mikolaj Machowski wrote: my guess is :source $VIMRUNTIME/mswin.vim -- the script that cripples Vim in a not-very-successful attempt to make it more Windows-like. WTF, if you want a Windows-like editor, don't use Vim, use Notepad! IMHO mswin.vim is better done without. Hey, it is not *that* bad :) m. Maybe I overreacted. OK, let's amend it: if you want a Windows-like editor, don't use Vim, use WordPad (in plaintext mode). I still won't recommend mswin.vim to anybody. Best regards, Tony.
Re: HTML editing with vim: where to start ?
> my guess is :source $VIMRUNTIME/mswin.vim -- the script that cripples > Vim in a not-very-successful attempt to make it more Windows-like. WTF, > if you want a Windows-like editor, don't use Vim, use Notepad! IMHO > mswin.vim is better done without. Hey, it is not *that* bad :) m.
Re: HTML editing with vim: where to start ?
Mikolaj Machowski wrote: Dnia środa, 17 maja 2006 22:27, Ivan Vecerina napisał: "Mikolaj Machowski" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] [...] [ I would never have fould this by chance, c-x does "cut" by default on my install... ] :behave mswin? [...] my guess is :source $VIMRUNTIME/mswin.vim -- the script that cripples Vim in a not-very-successful attempt to make it more Windows-like. WTF, if you want a Windows-like editor, don't use Vim, use Notepad! IMHO mswin.vim is better done without. Best regards, Tony.
Re: HTML editing with vim: where to start ?
Dnia środa, 17 maja 2006 22:27, Ivan Vecerina napisał: > "Mikolaj Machowski" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > : Dnia wtorek, 16 maja 2006 14:17, Ivan Vecerina napisał: > : > - get vim to automatically close/complete the innermost previously > : > opened tag. > : > : What do you mean automatically?. You can do: > : > : inoremap > > That's a great step forward, and I was able to make this work in a .html > file. > But it would not work in a PHP file Works for me. > Where can I find documentation for this feature (seems to be part of the > vim70 new enhancements), with which help keyword/tag ? :help ft-html-omni :help ft-php-omni :help ft-css-omni :help ft-javascript-omni > > [ I would never have fould this by chance, c-x does "cut" by default on > my install... ] :behave mswin? > How do I do an s/.../.../ on the current visual block? > [ I guess I can find out, but maybe you could answer this by the way ] For operation on visual blocks you need special plugins. Don't remember names (never need them). m.
Re: HTML editing with vim: where to start ?
Dnia czwartek, 18 maja 2006 03:49, David Fishburn napisał: > > Since Ivan mentioned he is using PHP with his HTML, closetag will be > very useful for him. PHP/HTML/XML omni-completion mixes *extremely* well :) m.
RE: HTML editing with vim: where to start ?
> -Original Message- > From: Mikolaj Machowski [mailto:[EMAIL PROTECTED] > Sent: Wednesday, May 17, 2006 6:57 AM > To: vim@vim.org > Subject: Re: HTML editing with vim: where to start ? > > Dnia wtorek, 16 maja 2006 18:37, A.J.Mechelynck napisał: > > Ivan Vecerina wrote: > > [...] > > > > > For example, here are a few simple things I need to do > all the time: > > > [...] > > > - get vim to automatically close/complete the innermost > previously > > > opened tag. > > > > [...] > > > > see the closeag.vim plugin, > > http://vim.sourceforge.net/scripts/script.php?script_id=13 > > For base needs this is not needed. Closetag is now part of > completion scripts for HTML. Since Ivan mentioned he is using PHP with his HTML, closetag will be very useful for him. I keep the following in my vimrc: " CloseTag options: " http://vim.sourceforge.net/script.php?script_id=13 " closetag.vim " Functions and mappings to close open HTML/XML tags " This uses to close an open tag above if filereadable(expand('$VIM/vimfiles/scripts/closetag.vim')) let g:closetag_html_style=1 autocmd Filetype html,xml,xsl,sql,ant,sqlunit,mhtml,php source $VIM/vimfiles/scripts/closetag.vim endif HTH, Dave
RE: HTML editing with vim: where to start ?
> -Original Message- > From: news [mailto:[EMAIL PROTECTED] On Behalf Of Ivan Vecerina > Sent: Tuesday, May 16, 2006 8:17 AM > To: vim@vim.org > Subject: HTML editing with vim: where to start ? > > Hi, > I'm pretty new to Vim, but went through several tutorials, > quick references, a number of help pages, and briefly through > the Vim book. I also hear announcements about Vim7's enhanced > built-in support for HTML editing. I even tried to play a bit > with the auto-completion (got some 'completion lists' popping > up after opening a PHP/HTML file...). > > But where do I go from here to learn efficient HTML editing > with Vim, having expert around to receive guidance from? > Especially when it comes to Vim7, all tutorials I have seen > seem terribly outdated. > For example, here are a few simple things I need to do all the time: > - Insert tags around a selected block of text (e.g. ...) > - get vim to automatically close/complete the innermost > previously opened tag. > - delete both the start and end tag with a minimum number of > keystrokes. > I could find half a dozen of ways to do the above, and even > more posts about ways to semi-automate this. > But those most common operations ought to be well supported > in Vim7 I imagine, is there a good default way to accomplish them? > Other things I don't know how to find is: how do I make sure > that VIM finds the CSS associated with the document I am > editing (to help with auto-completion)? > What are other tricks I should know for HTML-style document > editing, and where can I learn them? > Are there any targeted tutorials I should look into? > Is there an obvious resource I should use? Along with the other suggestions you might want to look at the tip I posted: Tip #346: Wrap text in HTML/XML tags after prompting for the tag name http://www.vim.org/tips/tip.php?tip_id=346 Basically, after pressing ,,, it will prompt you for what to wrap the text in. I use this all the time to wrap text afterwards. HTH, Dave
Re: HTML editing with vim: where to start ?
"Gerald Lai" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] : On Tue, 16 May 2006, Ivan Vecerina wrote: : You could read Bram Moolenaar's : "Seven Habits of Effective Text Editing" at: : http://www.moolenaar.net/habits.html A very good read indeed. : I think using matchit is one of the fastest ways to delete block-like : items, including start and end tags. : http://www.vim.org/scripts/script.php?script_id=39 matchit seems like a must-install, too bad it's not activated by default. And it is not mentioned in the vimbook or the FAQs I read so far (maybe because they were pre-vim6). This was a great pointer - thanks. : In order to obtain more support for operations involving HTML tags, you : could search in : : http://www.vim.org/scripts/index.php ... : http://www.vim.org/tips/index.php : : to get a feel of what other users want and have made out of Vim. : Also, stay on this mailing list and you will learn a lot. Yes. Problem with those resources is that they include a lot of noise, and are not up-to-date when it comes to vim7 - which seems to have introduced some useful improvements, as pointed out in Mikolaj's replies. Many thanks, Ivan -- http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Re: HTML editing with vim: where to start ?
"Mikolaj Machowski" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] : Dnia wtorek, 16 maja 2006 14:17, Ivan Vecerina napisa³: : > - get vim to automatically close/complete the innermost previously : > opened tag. : : What do you mean automatically?. You can do: : : inoremap That's a great step forward, and I was able to make this work in a .html file. But it would not work in a PHP file Where can I find documentation for this feature (seems to be part of the vim70 new enhancements), with which help keyword/tag ? [ I would never have fould this by chance, c-x does "cut" by default on my install... ] : > Other things I don't know how to find is: how do I make sure that VIM : > finds the CSS associated with the document I am editing (to help with : > auto-completion)? : : It should work automatically. : : > What are other tricks I should know for HTML-style document editing, and : > where can I learn them? : : Useful new feature for HTML-edition is of course omni-completion but : also new text-objects: : ::help at ::help it So I can do things like vat vit ... cool. >From there, it should also be easy to add a command that will delete the start and end tag of the current visual selection. How do I do an s/.../.../ on the current visual block? [ I guess I can find out, but maybe you could answer this by the way ] Thanks a lot / Dziekuje, Ivan
Re: HTML editing with vim: where to start ?
Dnia wtorek, 16 maja 2006 18:37, A.J.Mechelynck napisał: > Ivan Vecerina wrote: > [...] > > > For example, here are a few simple things I need to do all the time: > > [...] > > - get vim to automatically close/complete the innermost previously > > opened tag. > > [...] > > see the closeag.vim plugin, > http://vim.sourceforge.net/scripts/script.php?script_id=13 For base needs this is not needed. Closetag is now part of completion scripts for HTML. m.
Re: HTML editing with vim: where to start ?
Dnia wtorek, 16 maja 2006 14:17, Ivan Vecerina napisał: > - get vim to automatically close/complete the innermost previously > opened tag. What do you mean automatically?. You can do: inoremap > Other things I don't know how to find is: how do I make sure that VIM > finds the CSS associated with the document I am editing (to help with > auto-completion)? It should work automatically. > What are other tricks I should know for HTML-style document editing, and > where can I learn them? Useful new feature for HTML-edition is of course omni-completion but also new text-objects: :help at :help it m.
Re: HTML editing with vim: where to start ?
Hi Ivan, > The FAQ contains some obscure information that goes beyond your average > Vim cheat sheet. For the aforementioned average Vim cheat sheet... http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html --Eljay
Re: HTML editing with vim: where to start ?
On Tue, 16 May 2006, Ivan Vecerina wrote: Hi, I'm pretty new to Vim, but went through several tutorials, quick references, a number of help pages, and briefly through the Vim book. I also hear announcements about Vim7's enhanced built-in support for HTML editing. I even tried to play a bit with the auto-completion (got some 'completion lists' popping up after opening a PHP/HTML file...). But where do I go from here to learn efficient HTML editing with Vim, having expert around to receive guidance from? IMHO, in order to learn efficient HTML editing with Vim, or any other type of editing for that matter, you should master Vim's basic operations and practice them regularly. You could read Bram Moolenaar's "Seven Habits of Effective Text Editing" at: http://www.moolenaar.net/habits.html Also recommended is the Vim FAQ at: http://vimdoc.sourceforge.net/htmldoc/vimfaq.html The FAQ contains some obscure information that goes beyond your average Vim cheat sheet. You can try to answer the FAQs to see if you REALLY know Vim ;) I've put together the information above in a Vim tip at: http://www.vim.org/tips/tip.php?tip_id=1172 Especially when it comes to Vim7, all tutorials I have seen seem terribly outdated. For example, here are a few simple things I need to do all the time: - Insert tags around a selected block of text (e.g. ...) This came up very recently on this mailing list twice. You can read the recent thread at: http://groups.yahoo.com/group/vim/message/68627 Take note of http://www.vim.org/tips/tip.php?tip_id=346 - get vim to automatically close/complete the innermost previously opened tag. Good suggestion mentioned by Tony. - delete both the start and end tag with a minimum number of keystrokes. I think using matchit is one of the fastest ways to delete block-like items, including start and end tags. http://www.vim.org/scripts/script.php?script_id=39 For example, to delete from a start tag to an end tag, place the cursor on the start tag and hit "d%". To only delete the tags, place the cursor on the start tag, hit "%" and delete the end tag. Then hit Ctrl-o and delete the start tag. I could find half a dozen of ways to do the above, and even more posts about ways to semi-automate this. But those most common operations ought to be well supported in Vim7 I imagine, is there a good default way to accomplish them? In order to obtain more support for operations involving HTML tags, you could search in http://www.vim.org/scripts/index.php The good "default" way of accomplishing editing tasks is YOUR way of accomplishing editing tasks. Make Vim work for you, not the other way around :) Other IDEs have long subdued users into thinking that there is often a good default way of doing things. The Vim way is different. Other things I don't know how to find is: how do I make sure that VIM finds the CSS associated with the document I am editing (to help with auto-completion)? Someone else may be able to help you with this. What are other tricks I should know for HTML-style document editing, and where can I learn them? Are there any targeted tutorials I should look into? Is there an obvious resource I should use? If you have time, you can look through http://www.vim.org/tips/index.php to get a feel of what other users want and have made out of Vim. Also, stay on this mailing list and you will learn a lot. HTH :) -- Gerald
Re: HTML editing with vim: where to start ?
Ivan Vecerina wrote: [...] For example, here are a few simple things I need to do all the time: [...] - get vim to automatically close/complete the innermost previously opened tag. [...] see the closeag.vim plugin, http://vim.sourceforge.net/scripts/script.php?script_id=13 Bst regards, Tony.