Recent Changes - Search:


Reference:

C

edit SideBar


Short hints

folding

 set foldenable
 set foldmethod=marker
 set foldmarker={,}
  • zc - close a fold
  • zo - open a fold
  • zM - close all folds
  • zR - open all folds

custom title text for tabs

 :set tabline=text title for tab

spell checking

 :set spell
 :set spelling=de,en,fr

bufdo, tabdo, windo

The commands bufdo, windo and tabdo are great for operating on all buffers or windows or tabs. However, the commands finish in a different place from where you started.

ctrl s for search after register content

Mark a word or text part you want to search after. Copy it into register s. Then map the following and you can search the word with ctrl-s.

 map <C-S> let @/=@s<CR>/<CR>

wrapmargin

 :set wrapmargin=20
wraps the input at 20 characters before the right end

Sessions / Views

 :mksession <file>
 :mkview <file>
 :set viewdir=$HOME/.vim/views

use session:

 vim -S Session.vim

or

 :source Session.vim

use view:

 :loadview View.vim

Make view if you leave Buffer:

 autocmd BufWinLeave * mkview
 autocmd BufWinEnter * silent loadview

With sessionoptions you can adjust the settings which are going to store into the session file:

 :set sessionoption=OPTIONS
 :set sessionoption=blank, buffers, curdir, folds, globals, help, localoptions, options, resize, sesdir, slash, tabpages, unix, winpos, winsize
 :set sessionoptions+=winpos

Options which are bold are default values. To show the options use:

 :echo &sessionoptions

Sessions as a Project Manager

 :mksession!

and add in your .vimrc:

 silent source! Session.vim

mark again the previous marked part

  • gv

Hint was found here.

unicode

 set encoding=utf-8

Then you can use <crtl>+k and afterward [u] [:] to get a ü on a keyboard without this pad.

content overview:

vim syntax of commands

 * searchs the word under cursor forward
 # same backwards
after the search and leaving the word you cannot continue the search with * or # but with n or N.

Mark a section in visual mode and press "=" to format this section.

The graphical pendant to vim is gvim. Config file is .gvimrc where you can place properties like "set guifont=...".

command mode:

dw deletes a word
dd deletes line
u undo
U undo for actual line
ctrl/R redo
. repetition of the last change
~ converts letters from lower to capital and capital to lower characters
gqap formats paragraph
qa starts recording mode for macro (ends with input of q). To run marco press @a
mb sets mark b. To reach this position again just press `b

ex commands: (these commands can be placed into .vimrc (_vimrc under windows) file in your home directory

":sysntax on" enables syntax highlighting
":map <F3> gqap" defines command gqap on key <F3>
":imap <S-F3> asdf<SPACE>" defines insert operation if you press shift <F3>
":imap <S-F4> asdf<CR>"
":marks" lists all defined marks
":n" next buffer
":prev" previous buffer
":first" jump to first buffer
":buffers" views all buffers
":args" shows file name from command line
"[number]Ctrl/^" jumps to buffer with the given number
"ZZ" saves changes and quit vim
":w" writes changes
":w!" writes even in read only mode
":w >> filename" appends buffer to file filename
":x" quits and saves if there were made changes
":q" quit
":q!" quit even with changes
Edit - History - Print - Recent Changes - Search
Page last modified on May 14, 2010, at 08:36 AM