Ad blocker interference detected!
Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers
Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.
This is an archive of the Did you know section on the Main Page for 2008 (started in February 2008).
- A Byte of Vim is a free ebook on Vim
- Vim 7.2 has been released
- Visually-selected characters can be replaced to underline with dashes.
- The sleep command with a recursive mapping allows automatic scrolling of text.
- The command :set isfname+=32 allows gf to open file names with spaces.
- Ctrl-[ and Alt-Space are suggested as alternatives to hitting Esc.
- You can use syntax folding with Vim scripts.
- A simple script allows folding in .ini files.
- The command :%s//new/g performs a substitute using the last search.
- Use :bufdo %s/old/new/ge to substitute in all buffers.
- A substitute can swap the LHS and RHS of an assignment statement.
- The xxd tool allows hex editing and improved hex editing.
- Vim 7.2 has been released
- The command :0r foo.txt will insert a file before the first line.
- The useful mark commands include `0 to jump to the position when Vim was last exited.
- A simple script can number a group of lines.
- More scripting can wrap text in HTML tags.
- A plugin allows easy switching between source and header files.
- It's handy to search and replace the word under the cursor.
- Using :args *.c and :sall will load multiple files.
- Quickly change words or lines with commands like ciw c$ cis.
- Get an overview of your program using folds.
- If needed, it's easy to reload your file in a different encoding.
- Vim 7.2 has been released
- Mappings with expand("%:p:h") help working with files in the same directory.
- When searching, \n is newline, \r is CR, but when replacing, \r is newline, \n is a null byte.
- You can set, clear, invert, display, and restore a boolean option to its default.
- Press . to repeat the last change.
- With the right commands, you can swap characters, words and lines.
- There are many settings for working with Unicode, and handling BOM markers.
- A modeline can configure options for a particular file.
- A mapping can jump to where a Perl function is defined (without tags).
- You can fold sequences of two or more blank lines.
- You can list lines containing a keyword and prompt to jump to a line.
- During an incremental search, you can press Ctrl-L to insert the next character from the match.
- A syntax command can highlight doubled word errors (if you repeat repeat a word).
- Setting foldexpr allows you to fold everything except for matches to your search.
- Ctrl-A and Ctrl-X will increment and decrement numbers.
- gf and friends can open the file under the cursor, optionally in a new window.
- Some keys can delete text, and you can't undo, but you can recover and avoid the problem.
- Ctrl-R can insert a register or word in insert mode and the command line.
- You can format text with built-in commands, or an external program.
- Some mappings make it easy to copy the name of the current file to the clipboard.
- You can remove one mark or all marks.
- A modeline can't set the file encoding, but UTF-8 Vim can read Latin1 as Latin1.
- Using :set diffopt+=iwhite will ignore white space in vimdiff.
- Using set t_Co=256 will enable 256 colors under xterm.
- Under Mac OS X, using a script can open files from the command line in the same window.
- Using :set laststatus=2 will always show the status line.
- You can save typing by using abbreviations.
- The vis.vim plugin is useful for applying :substitute to a blockwise visual selection.
- Learning the standard movement keys saves time when moving around.
- It's worth learning how to work with Vim buffers.
- Move ahead of the masses by using Ctrl-o and Ctrl-i.
- Press gd or gD to jump to the declaration of a local or global variable.
- Press Ctrl-o or Ctrl-i to jump to previously visited locations (older/newer).
- In gvim, 'guioptions' can hide the toolbar and menu.
- Programmers should learn to browse with tags.
- Use 'formatoptions' to control text formatting including the automatic insertion of comments.
- The command :g/^\s*$/d will remove all blank lines.
- The command :g//d will delete all lines containing the last search pattern.
- There are several methods to change the indentation of a block of lines.
- A mapping can change the Home key to move to the first character, or the first that is nonblank.
- Filtering and redirection can capture output from Vim or external programs.
- HTML sections in PHP can be auto-indented.
- It's easy to change between backslash and forward slash in a file path.
- If you create your own tags file, you can jump to the correct line and column.
- If you work with many files, it's easy to save them all with :wa or :xa.
- Substituting with an expression allows a file to be sorted based on the number of words in each line.
- Simple substitutes or a Perl script can convert text using HTML entities like >.
- The command :g/^/exe ".w ".line(".").".txt" saves each line in the buffer to a separate file.
- :g// lists all lines containing the last search pattern, and :redir will capture the results.
- Some menu commands make beautifying code easy.
- With set browsedir=buffer the File, Open dialog defaults to the current file's directory.
- 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!
- 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.
- 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!
- 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.