Vim Tips Wiki
Register
Advertisement

New tips June 2009

This page is an archive listing tips created in June 2009. Please do not edit this page because discussion has finished. If you have any comments, edit the appropriate tip page.

Alternatively, comments can be posted on the mailing list.

Proposed new tip Current consensus
Change visual mode paste command behaviour Merged to VimTip605
Indent with tabs, align with spaces Keep
Toggle Insert-Normal Mode via ctrl-space Merged to VimTip285
Reload file without losing undo history Keep

General comments (not for a specific tip)

Change visual mode paste command behaviour

Merged to 605 Replace a word with the yanked text and original title kept. JohnBeckett 03:43, September 23, 2009 (UTC)


Merge? This might be good in one of visual mode tips (like VimTip1011, or Short mappings for common tasks. Since this was spawned from a vim_use discussion to address a specific issue, I'm a little uncertain about this one. If we do merge it, we need to be sure to keep the title as a redirect and maybe create a couple more redirects. --Fritzophrenic 19:12, 7 July 2009 (UTC)

Yes, let's merge this. Of the above, I like 1011. Other possible merge targets are 497 Replacing a string with default buffer contents (an empty tip), and 605 Replace a word with the yanked text. I'll think more later. JohnBeckett 12:02, 28 July 2009 (UTC)

I have roughly merged this new tip + 497 + 1011 to 605. The titles are:

new Change visual mode paste command behaviour
497 Replacing a string with default buffer contents
1011 Mappings and commands for visual mode
605 Replace a word with the yanked text

 TO DO 

  • Decide on a final title for VimTip605.
  • Fix VimTip497 redirect using the final title (so 497 goes to 605).
  • Fix VimTip1011 redirect using the final title (so 1011 goes to 605).
  • Delete new tip (do not keep title).

I suspect there are more tips that might be merged to 605, and 605 needs to be cleaned. I am putting off thinking about a good title until a bit more progress occurs. Any comments or ideas for a title? JohnBeckett 04:12, 19 August 2009 (UTC)


I understand the merge of VimTip1011, VimTip497, and this new tip, but why VimTip605? It doesn't seem to have anything to do with Visual mode! --Fritzophrenic 14:19, 19 August 2009 (UTC)


BTW, I see no point in deleting the new title, though my fear that it was linked in a vim_use thread seems unfounded. I believe this is the thread I was thinking of:

http://groups.google.com/group/vim_use/browse_thread/thread/53ba2a207d05f409

The mapping differs slightly and the tip is never mentioned, but this tip is good enough I would like to keep the old title around, if only to avoid the "where'd my tip go?" feeling if the author returns to check up on it. That being said, the author remains anonymous, and the title is fairly useless. I'd still like to see it kept as a redirect, but do what you will. --Fritzophrenic 14:48, 19 August 2009 (UTC)


Hi guys, I wrote the tip some time ago because I didn't find any discussion about this specific issue. If you believe that the title or the content is useless, just do what you believe! BTW, thanks for the links on google groups, I didn't searched very well. --Mrucci

Indent with tabs, align with spaces

  • Keep I had added info and reworked the tip. JohnBeckett 03:43, September 23, 2009 (UTC)

Unless I'm mistaken, this is just a plugin feature. Should we merge this to our Vim scripts page? --Fritzophrenic 19:12, 7 July 2009 (UTC)

Yes, I'll merge this somewhere. Perhaps mention the plugin on the scripts page and also mention some of the stuff in a related tip, but I don't think we need the three external links. If I find a good place to mention them, I might, but they don't look helpful to me. JohnBeckett 12:02, 28 July 2009 (UTC)
I think we can just lose all three links. The first mentions the same Smart Tabs plugin that the tip does, but only in passing. The rest of the article is about Emacs. The second mentions setting 'list' but has nothing else worth linking to I think. The third one especially rankles me. I finally read it when I got home and was able to use a non-IE browser, and it's pretty much nothing but an opinionated rant presenting the "tabs" side of the tabs vs. spaces debate as a moral issue. First of all, this wiki is no place for the tabs vs. spaces debate. Secondly, if you're looking at a tip called "Indent with tabs, align with spaces" then you already know what you want to do, external links telling you to do it add no value. And more importantly in my mind, it is VERY annoying to link to a site that derides people who can't take a little extra effort to use a mixture of tabs and spaces, while the site author refuses to take the little extra effort to support the most widely used browser on the internet, one which many people are required to use in their workplace. Anyway, I could go on...but long story short, I agree that the links are not needed. --Fritzophrenic 13:03, 20 August 2009 (UTC)

I have (probably) changed my mind because I think the article is more than just a link to a plugin. Our main indent tip is too complex to add a general chat, and I think we need something to discuss the tabs vs. spaces issue. Also, I had no idea that cinoptions could do all that tricky stuff (although I personally hate aligning text in programs, and would never use a scheme like this). I don't think we have a good alternative for a merge (without making the target too long), so I am inclined to keep this. I have removed the "see also" external links (and have added a better explanation to the tip that covers useful content from those links). JohnBeckett 10:47, September 19, 2009 (UTC)

I agree that the tip is now good enough to stand alone and that merging it would just add complexity to an already complex tip. I'd add a "see also" though. Keep. On a side note, 'cinoptions' can do some pretty amazing stuff. I have a setup similar to what is discussed in the tip, though without the smart tabs plugin; the projects I write code for at work have a set "indents shall be 2 spaces" standard, so I have no choice in the matter anyway. Luckily for me, I prefer spaces myself, though I always worked with 4 spaces in the past. --Fritzophrenic 14:41, September 21, 2009 (UTC)

Toggle Insert-Normal Mode via ctrl-space

Merged to VimTip285 (an extremely similar suggestion was already in the tip). I do not think this title is worth keeping and I propose deleting it. Let me know if contrary view. JohnBeckett 12:02, 28 July 2009 (UTC)

Merge to Avoid the escape key as suggested in the comments of the tip. --Fritzophrenic 19:12, 7 July 2009 (UTC)

Reload file without losing undo history

Keep I have renamed the tip to the above title (and did not keep the original title "Undo through :edit"). As agreed in the following, I also rewrote the tip with a user command. JohnBeckett 10:56, 29 July 2009 (UTC)

Rename to "Reload file without losing undo history" or similar, and keep. There are some problems and potential solutions mentioned in the comments, but they are clear enough that the tip is relatively solid. --Fritzophrenic 21:17, 26 July 2009 (UTC)
Are you sure? I hate a tip that starts by deleting all my text! Moreover, the builtin :e will refuse to work (with a warning) if the file is modifed (I need :e!). That is a good thing, and compatible with how I expect Vim to work (and training people to become used to :e working some other way is not really a good idea). I accept that if nothing goes wrong, I will be able to undo everything, but it's a bit dodgy for my liking. I suppose that if it were a user command like :Reload it would appeal more. JohnBeckett 12:02, 28 July 2009 (UTC)
Actually, I too would like it more if it were a user command. I was meaning to mention this but it seems I forgot. I also do not like the idea of overriding the :e command in this way! I will often use :e as a (somewhat lazy) way to refresh syntax highlighting or reload the ftplugin on an unmodified file, and this tip will not do that.
That being said, the tip's entire purpose is to allow you to "undo" past the reload, so I'm not too worried about causing problems there. Perhaps we should check the setting of the 'undolevels' option before deleting the text though :-).
I do think this tip is worth keeping, though I also agree it would be best to present it as a user-defined command rather than a replacement for :e (but we can still mention that this is possible, probably with an "if you're brave..." prefix). This idea is one reason I am proposing the rename; it's hard to say that a tip called "Undo through :edit" should do nothing to the :edit command at all. An alternate title allows this with no head-scratching.
--Fritzophrenic 02:31, 29 July 2009 (UTC)

Advertisement