WalaWiki content from p1k3.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
2.8 KiB

  1. WareLogging. TextBased. A feature-rich, post-minimalist implementation of ViEditor. [Brennen]'s favorite text editor.
  2. * [http://www.vim.org/ vim.org]
  3. * VimExtensions
  4. * A cheat sheet: http://p1k3.com/2004/11/8/vimcheat.txt
  5. * An HTML-based improvement: http://p1k3.com/2004/11/11/vimcheat
  6. * The current version: VimCheatSheet.
  7. * Someone else's [http://www.viemu.com/vi-vim-cheat-sheet.gif cheatsheet].
  8. * BramMoolenaar: [http://www.moolenaar.net/habits.html Seven habits of effective text editing]. There's a video of him giving a presentation on this somewhere.
  9. * VimAsShell
  10. * VimAndPerl
  11. = ideas =
  12. Can you mix syntax highlighting in a single file? Maybe. Here's a thought: How about something that recognizes filetypes in PerlLanguage (or others) HereDocuments and applies the right syntax? Like
  13. print <<HTML;
  14. <p>Here is some HTML.</p>
  15. <p>And stuff.</p>
  16. HTML
  17. ...turns out this works for PHP heredocs by default, I assume it'd be do-able for Perl.
  18. = keys, commands, settings =
  19. VimCheatSheet
  20. * Use tags. ctrl-] to follow a tag, ctrl-t moves backwards through the stack.
  21. * gU''motion'' - uppercase. gUw, for example.
  22. * :colorscheme <name> - use tab completion to cycle various schemes.
  23. * :%sort
  24. * grepping:
  25. ** :grep -ri pattern ./*
  26. ** :copen
  27. * ctrl-v enters a visual mode that allows for selection of a rectangular block.
  28. * q: gives a command line history.
  29. * :%!''command'' feeds all text to an external command and returns the output.
  30. ** frex, :%!sort will sort all lines.
  31. * :set showcmd displays commands on the status line as you enter them.
  32. * :set showmatch & :set matchtime=1 will briefly bounce to the matching bracket whenever a new bracket is typed in.
  33. * vim has a file browser plugin now, which does sort of what you would expect - it lists the files in a directory, and when the cursor is over one, you hit enter to open it. What's cool is that if you hit ?, you get a set of extra commands - o will open a file in a new window, O in a window that's already open. i turns on size/date info, s toggles sorting, etc. Try doing :help file-explorer.
  34. = record macros =
  35. <[Brennen]> Tonight I was doing something stupid-repetitive to a text file - enclosing certain blocks but not others in HTML paragraph tags. It came to me that I ought to try vim's recording feature, rather than screwing around with writing a search and replace that would actually work. Turns out it's really simple to use. Just hit 'q', followed by the name of a register (0-9a-zA-Z), and then go about your business. Once you've finished with the string of commands you wanted to record, just hit q again. Then to execute them, do '@' followed by the name of the register you used.
  36. Think of this as writing a miniature program on the fly. Since vi-style commands are built around a simple verb-object-number syntax, it's surprisingly elegant.