Nekolik otazek k Vim

Pavel Lisy pali na tmapy.cz
Úterý Červenec 17 16:14:21 CEST 2001


On 17 Jul 2001 10:28:07 +0200, Ladislav Vaiz wrote:
> Dobry den,
> snazim se pouzivat Vim (5.7), mel bych nekolik otazek, na ktere se mi
> nepodarilo najit odpoved:
Používám 6.0, tak nevím, jestli to bylo

> 2) da se nastavit vyhledavani tak, aby pri stisku 'n' mi neukazal jeden
> vyskyt retezce dvakrat? Kdyz vyhledavam v neznamem souboru, tak casto
> prehlednu hlaseni "Search hit BOTTOM..." (zvlaste pokud mam obrazovku
> rozdelenou a hledam v hornim okne) a hledam stale dokola. Predstavoval
> bych si to tak, ze po dosazeni konce souboru se sice hleda od zacatku, ale
> po dosazeni mista zadani /abc se vypise treba "NOT FOUND" a na dalsi 'n''
> se nereaguje.
viz :help search
search({pattern} [, {flags}])				*search()*
	Search for regexp pattern {pattern}.  The search starts at the
	cursor position.
	{flags} is a String, which can contain these character flags:
	'b'	search backward instead of forward
	'w'	wrap around the end of the file
	'W'	don't wrap around the end of the file
	If neither 'w' or 'W' is given, the 'wrapscan' option applies.


:help wrapscan

				   *'wrapscan'* *'ws'* *'nowrapscan'* *'nows'*
'wrapscan' 'ws'		boolean	(default on)
			global
	Searches wrap around the end of the file.

> 3) je mozne v gvim vypnout panel s ikonami a menu? Nebo alespon moci
> pouzivat F10 v makru?

viz můj konfigurák, vypusťte T
" gvimrc-set
" =====================================
" užitečná nastavení proměnných
" =====================================
" set the X11 font to use
set
guifontset=-b&h-lucidatypewriter-medium-r-normal-*-*-120-*-*-m-*-iso8859-2
" a - označený blok načte rovnou do myšího bufferu, jinak je nutné
"     zadávat yank
" m - menu
" g - neaktivní menu bude šedé, jinak není vidět vůbec
" t - oddělovací (tearoff) menu
" T - ikonky toolbar (nepoužívám)
" b - dolní scrollbar
" r - pravý scrollbar
set guioptions=amgtbr

> 5) jak vyhledavat text pouze v jednom okne? Jinak receno abych mohl v
> ruznych oknech vyhledavat ruzne retezce, prepinat se mezi okny a davat 'n'
> a kazde okno hledalo "svuj" retezec.
> 
> 6) jak dosahnout (v makru) ulozeni vsech bufferu?
viz :help buffer resp. buffer-write

8. Writing with multiple buffers			*buffer-write*

							*:wa* *:wall*
:wa[ll]	Write all changed buffers.  Buffers without a file name or
	which are readonly are not written.

:wa[ll]!Write all changed buffers, even the ones that are readonly.
	Buffers without a file name are not written.


> 
> 7) lze pri :set virtualedit (6.0) ignorovat mezery na koncich radku a
> docilit tak toho, aby skok na konec skocil na posledni nemezerovy
> znak? Takto je to napr. v rhide a vyhovuje mi to vice.
> 
> 8) lze donutit vim k otevreni souboru read-only tak, aby opravdu neslo
> zapisovat? Prikaz :view resp. :sv mi to dovoli.

viz :help view a trocha hledání, myslím že to -m by mohlo pomoci

						*-R*
-R	Readonly mode.  The 'readonly' option will be set for all the
	files being edited.  You can still edit the buffer, but will
	be prevented from accidentally overwriting a file.  If you
	forgot that you are in View mode and did make some changes,
	you can overwrite a file by adding an exclamation mark to
	the Ex command, as in ":w!".  The 'readonly' option can be
	reset with ":set noro" (see the options chapter, |options|).
	Subsequent edits will not be done in readonly mode.  Calling
	the executable "view" has the same effect as the -R argument.
	The 'updatecount' option will be set to 10000, meaning that
	the swap file will not be updated automatically very often.

						*-m*
-m	Modifications not allowed.  The 'write' option will be	reset,
	so that writing files is disabled.  The 'write' option can be
	set to enable writing again.





Další informace o konferenci Linux