JohnBeckett (talk | contribs) (July archive) |
JohnBeckett (talk | contribs) (→2008: previous years) |
||
Line 97: | Line 97: | ||
*With a suitable definition for <tt>b:match_words</tt>, you can [[VimTip1321|fold a C# region]]. |
*With a suitable definition for <tt>b:match_words</tt>, you can [[VimTip1321|fold a C# region]]. |
||
− | == |
+ | ==Previous years== |
− | + | *[[/2008|2008 ''Did you know'']] |
Revision as of 11:06, 31 July 2009
This is an archive of the Did you know? section on the Main Page
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.
July 2009
- Vim Recipes is a new and free cookbook in PDF and HTML.
- An environment variable can be displayed, for example :echo $PATH.
- The 'opfunc' option can be used to define your own operator.
- A temporary change to the 'grepprg' option allows git grep in Vim.
- :pedit myfile opens a file in the preview window; useful for pydoc.
- Use :wa to save all modified files (no save if no change).
- Use :e .. to list files in the parent directory.
- Use :set showcmd to show the size of the visually-selected area.
- Press Ctrl-w then o to show only the current window (close others).
- Windows users should use the GnuWin32 diff package.
- You can search only unfolded text with :set fdo-=search.
June 2009
- Vim Recipes is a new and free cookbook in PDF and HTML
- The command :cabbrev can expand commands and fix your frequent typos.
- In insert mode, typing <C-R>=strftime("%c") inserts the current date and time.
- You can toggle folds open/closed with za.
- perldoc can be used to open a Perl module from its module name.
- A plugin allows sorting lines based on a visually-selected column.
- Under Windows, you can have pl2bat scripts detected as Perl filetype.
- Some mappings allow easy move up/down of current line.
- Use :set wildchar=<Tab> wildmenu wildmode=full for a menu to complete buffer/file names.
- In some terminals, meta keys are sent as escape sequences which can exit insert mode.
- The command :set cursorline highlights the current line.
May 2009
- Type gd to jump to the definition of a local variable, or gD for a global variable.
- Sort and remove duplicate lines with :sort u ("unique").
- Some code is needed for unique sorting in a script.
- Map the Enter key to Esc to quickly exit insert mode.
- And map Enter to insert a newline from normal mode.
- A mapping can search for the current word in a new window.
- It can be easy to cycle through buffers including hidden buffers.
- The pastetoggle option should be used when pasting into a terminal.
- Commands like :set wrap! wrap? are useful when toggling boolean options.
- Use \V to make a regex "very nomagic", or use :sno for a "very nomagic" substitute.
April 2009
- A Byte of Vim is a free ebook on Vim
- Vim 7.2 has been released
- Press [ then the Tab key to jump to the first line containing the current keyword.
- The 'pastetoggle' option should be used when pasting into console Vim.
- Using :set wrap! wrap? is handy to toggle an option and see its value.
- A simple map <CR> o<Esc> can insert a newline in normal mode.
- Using nr2char() helps convert from "quoted printable" to plain text.
- In a regex, \v is "very magic" (all characters except a-zA-Z0-9_ have special meaning).
- The 'binary' and 'eol' options can help preserve a missing final end-of-line.
- Using the ftplugin directory helps keep your vimrc clean.
- The command :scriptnames lists all scripts that have been sourced (more).
- Vim Doclet is a Doclet for Java that generates documentation in Vim Help format.
March 2009
- A Byte of Vim is a free ebook on Vim
- Vim 7.2 has been released
- Press [I to display all lines containing the current variable.
- Press gF to jump to a specified line number in a file.
- A mapping allows jumping sections in Latex documents.
- Using a mapping (with :update) allows quick saves of the current buffer, if changed.
- It's easy to replace the current word with the last yanked text.
- A keymap allows entry of characters that are not available on your keyboard.
- The command :e $MYVIMRC will edit your vimrc file.
- You can add a dashed line under a title.
- Some scripting allows fast changes to your font size.
- Using :set foldlevel=20 means all folds are open when a file is opened.
February 2009
- A Byte of Vim is a free ebook on Vim
- Vim 7.2 has been released
- Type [i to display the definition of the current variable, or [d for a macro.
- The :set hlsearch command highlights all search hits; use :noh to temporarily switch off.
- You may be able to recover lost text if the power fails while you are editing.
- Use digraphs to enter special characters: in insert mode, press Ctrl-K then Co for ©, or Ctrl-K then Pd for £.
- The quickfix list can be used to fold away lines with no errors/matches.
- The 'whichwrap' option controls whether the backspace and cursor keys wrap to the previous/next line.
- Manual fold markers can be hidden using the Ignore highlighting group.
- Some mappings allow Ctrl-S to save the current file, or a new file.
- It's useful to map a key for quicker access to recorded macros.
January 2009
- A Byte of Vim is a free ebook on Vim
- Vim 7.2 has been released
- You can keep your window layout by deleting a buffer without closing the window.
- A script makes it easy to move lines up or down.
- We have lots of opinions on the perfect programming font.
- gg"+yG is one way to copy the entire buffer to the clipboard.
- It is possible to run native-Windows Vim from cygwin without a wrapper.
- Some mappings allow you to quickly add or delete empty lines.
- A FocusLost autocommand is one way to auto-save files when the focus is lost.
- We have an extensive tutorial on mapping keys.
- With a suitable definition for b:match_words, you can fold a C# region.