JohnBeckett (talk | contribs) (Add May archive) |
JohnBeckett (talk | contribs) (Add June archive) |
||
Line 4: | Line 4: | ||
To discuss suggestions for new items, please edit the [[Talk:Did you know|talk page]]. |
To discuss suggestions for new items, please edit the [[Talk:Did you know|talk page]]. |
||
+ | |||
+ | ==June 2008== |
||
+ | *You can have Vim try to detect whether to ignore case in searches. {{help|'smartcase'}} |
||
+ | *Toggle an option by adding <tt>!</tt> (<tt>set spell!</tt> will turn spell checking on/off). {{help|:set}} |
||
+ | *With <tt>set</tt>, use <tt>+=</tt> to add option flags, or <tt>-=</tt> to remove them. {{help|add-option-flags}} |
||
==May 2008== |
==May 2008== |
Revision as of 03:30, 30 June 2008
This is an archive of the Did you know? section on the Main Page
The Did you know? section was started in February 2008. Every few weeks, the section on the Main Page will be replaced. Old items will be moved here so anyone interested can browse them.
To discuss suggestions for new items, please edit the talk page.
June 2008
- You can have Vim try to detect whether to ignore case in searches. :help 'smartcase'
- Toggle an option by adding ! (set spell! will turn spell checking on/off). :help :set
- With set, use += to add option flags, or -= to remove them. :help add-option-flags
May 2008
- A user-defined command can evaluate :Calc sin(pi/2).
- It's sometimes better to not use the slash delimiter for :s/old/new/.
- You can drag & drop one or more files into gvim.
- Use register @/ to execute commands without changing the search register.
- You can map a key to <Nop> to disable an unwanted key.
- When substituting, the replacement can be the result of an expression.
- With a good regex, you can change all HTML tags to lowercase.
- input() can read an HTML tag to wrap around a visual selection.
- Use vat to select a tag block, then da> to delete the tags.
- Vim can display a lot more than ASCII characters!
April 2008
- The shortmess and cmdheight options allow you to avoid "Hit Enter to continue" prompts.
- An option controls how backspace and other delete keys work in insert mode.
- You can display line numbers and change the width of the number column.
- It's easy to change text between lowercase and UPPERCASE.
- The command history allows you to repeat several commands, possibly after editing them.
- @: will repeat a colon (Ex) command (and @@ will repeat again).
- You can use :g/^\s*$/;//-1sort to sort each block of lines in a file.
- It's useful to map . .`[ to repeat the last command and put the cursor at start of change.
- You can open a web browser with the URL in the current line.
- With --remote-send you can close a Vim you left open remotely.
- If you're used to Perl regex, you can use Perl compatible regular expressions.
- In insert mode, Ctrl-Y inserts the character above. You can make it insert the word above.
March 2008
- There are many ways to search the help files.
- You can modify the value of almost everything with the 'let' command.
- The Best Vim Tips are in tip 305.
- The status line can show your fileencoding and bomb.
- There is more than one way to jump to line 42.
- A tricky search can find text that does not match.
- After typing a couple of characters, you can complete a word.
- In a program, you can jump to the beginning or end of a code block.
- With two related files in a vertical split, you can scroll both windows together.
- A map using expand("%:p") can copy the current file path to the clipboard.
- It's easy to count the words in a file or block.
- You can even make a frequency table counting the occurrences of each word!
February 2008
- You can press * to search for the current word.
- To insert the next matching word, press Ctrl-N.
- Use % to jump to the matching bracket, and more.
- Ctrl-A can increment numbers.
- You can wrap long lines while moving the cursor by screen lines.
- Use :lcd %:p:h to change directory to the file in the current window.
- ga shows the ascii value of the current character.
- zz scrolls the current line to the middle of the screen; scrolloff can keep it there.
- You can list changes to the current file, even old changes.
- Non-US keyboards have lots of useful keys for normal-mode mappings.
- Use za to toggle folds open/closed.
- Vim can do calculations using Python, Perl or bc.