vim:foldmethod=marker nomodifiable
zo opens a fold
zc closes
The gVim text text editor -- tips and tricks (Volker Kiefel)
* Change end of line codes: DOS/UNIX {{{
:set fileformat=dos
:set fileformat=unix
}}}
* Search and replace with confirmation {{{
:34,45s/old/new/gc
}}}
* Folds {{{
set foldmethod=manual
{Visual}zf
creates a fold
zd
deletes the fold under the cursor
zE
eliminates all folds in the window
zo
opens the fold
zc
closes the fold
For use of LaTeX files three curly braces are not optimal, as three curly
braces often occur in normal text/code. You may therefore define an
alternative (pair of) foldmarker(s). An example for a modeline for a LaTeX
file.
% vim:foldmethod=marker foldmarker=--->,s {{{
:set tabstop=n
(Number of spaces that a in the file counts for)
to remove tabs:
:set expandtab
:retab
}}}
* Visual {{{
gv
Start Visual mode with the same area as the previous area and the same mode.
In Visual mode the current and the previous Visual area are exchanged.
}}}
* Menus in console mode (Vim) {{{
Description see console-menus
}}}
* Line/word wrapping {{{
set wrap
wraps lines exactly at end of window
set wrap
set lbr [linebreak]
wraps lines at whitespaces between words, however this only affects display,
no s are inserted.
{Visual}J
Join highlighted lines, remove the indent, insert spaces
{Visual}gJ
Join the highlighted lines, do not insert or remove spaces
}}}
* Distance between lines: {{{
set linespace=1
engerer Abstand mit kleineren Ziffern
}}}
* count words {{{
g
Works also in visual mode
}}}
* Problems with syntax highlighting {{{
e. g. with TeX: force Vim to reanalyse
current file from beginning
:syntax sync fromstart
a pleasant colorscheme for vim
:colorscheme manxome
}}}
* Control maximum size of registers written to viminfo file {{{
some configuration paramaters can be written into the viminfo string, an
example:
set viminfo='20,s1000,h
this means that:
- marks are remembered for the last 20 edited files
- maximum size of registers saved in Kbyte (1000 Kbyte)
- Disables the effect of 'hlsearch' when loading the viminfo file
}}}
* Vim and the clipboard {{{
set clipboard=unnamed
Vim takes all text that should go in the unnamed register and puts it in the
clipboard register
}}}
* set options of gvim GUI {{{
Add scrollbar at the bottom of the screen:
guioptions+=b
}}}
* set language for use of menu translation {{{
if the language for the menus is set to a non-English language put
:set langmenu=none
before loading menus.
}}}
* Install German dictionary (Vim v7, win32, Linux) {{{
Get German Dictionary from
http://lingucomponent.openoffice.org/spell_dic.html
unzip de_DE.zip. Install with
:mkspell \vim\vim70\spell\de de_DE
Under Linux:
Create ~/.vim/spell
unzip de_DE.zip in the current directiry
start vim and run
:mkspell ~/.vim/spell/de de_DE
this generates de.latin1.spl.
to turn on spelling:
:set spell
:set spelllang=de
}}}
* Apply external program to marked text {{{
Mark Text, apply external command with "!"
:!fmt -w 77
reformats block of text with 77 columns
}}}