From 98229919af604b4d62e36a268d0e7f9aff2e8395 Mon Sep 17 00:00:00 2001 From: Jacek Bukarewicz Date: Thu, 16 Jan 2014 14:09:28 +0100 Subject: [PATCH] Imported Upstream version 7.4 --- Contents | 8 +- Filelist | 48 +- Makefile | 120 +- README.txt | 10 +- README_ami.txt | 2 +- README_amibin.txt | 2 +- README_amisrc.txt | 2 +- README_bindos.txt | 17 +- README_dos.txt | 34 +- README_extra.txt | 5 +- README_mac.txt | 2 +- README_ole.txt | 2 +- README_os2.txt | 24 +- README_os390.txt | 6 +- README_src.txt | 8 +- README_srcdos.txt | 4 +- README_unix.txt | 2 +- README_vms.txt | 2 +- README_w32s.txt | 2 +- nsis/gvim.nsi | 14 +- runtime/autoload/ada.vim | 5 + runtime/autoload/ccomplete.vim | 9 +- runtime/autoload/clojurecomplete.vim | 20 + runtime/autoload/getscript.vim | 43 +- runtime/autoload/htmlcomplete.vim | 3 +- runtime/autoload/netrw.vim | 9961 +++++++++++--------- runtime/autoload/netrwFileHandlers.vim | 27 +- runtime/autoload/netrwSettings.vim | 61 +- runtime/autoload/phpcomplete.vim | 6 +- runtime/autoload/rubycomplete.vim | 47 +- runtime/autoload/spellfile.vim | 7 +- runtime/autoload/sqlcomplete.vim | 352 +- runtime/autoload/syntaxcomplete.vim | 551 +- runtime/autoload/tar.vim | 109 +- runtime/autoload/tohtml.vim | 685 +- runtime/autoload/vimball.vim | 142 +- runtime/autoload/xmlcomplete.vim | 8 +- runtime/autoload/zip.vim | 74 +- runtime/colors/koehler.vim | 4 +- runtime/colors/ron.vim | 8 +- runtime/compiler/checkstyle.vim | 7 +- runtime/compiler/cs.vim | 17 +- runtime/compiler/decada.vim | 9 +- runtime/compiler/erlang.vim | 13 + runtime/compiler/eruby.vim | 4 +- runtime/compiler/g95.vim | 28 + runtime/compiler/gcc.vim | 8 +- runtime/compiler/gfortran.vim | 27 + runtime/compiler/gnat.vim | 9 +- runtime/compiler/haml.vim | 28 + runtime/compiler/hp_acc.vim | 7 +- runtime/compiler/ifort.vim | 27 + runtime/compiler/intel.vim | 7 +- runtime/compiler/irix5_c.vim | 7 +- runtime/compiler/irix5_cpp.vim | 7 +- runtime/compiler/javac.vim | 7 +- runtime/compiler/mcs.vim | 10 +- runtime/compiler/mips_c.vim | 7 +- runtime/compiler/mipspro_c89.vim | 7 +- runtime/compiler/mipspro_cpp.vim | 7 +- runtime/compiler/msbuild.vim | 21 + runtime/compiler/ocaml.vim | 44 + runtime/compiler/php.vim | 18 +- runtime/compiler/rake.vim | 35 + runtime/compiler/rspec.vim | 22 +- runtime/compiler/rst.vim | 2 +- runtime/compiler/ruby.vim | 27 +- runtime/compiler/rubyunit.vim | 4 +- runtime/compiler/sass.vim | 30 + runtime/compiler/se.vim | 14 +- runtime/compiler/tcl.vim | 3 +- runtime/compiler/tex.vim | 11 +- runtime/compiler/tidy.vim | 16 +- runtime/compiler/xbuild.vim | 22 + runtime/compiler/xmllint.vim | 13 +- runtime/doc/arabic.txt | 4 +- runtime/doc/autocmd.txt | 110 +- runtime/doc/change.txt | 180 +- runtime/doc/cmdline.txt | 89 +- runtime/doc/debug.txt | 19 +- runtime/doc/debugger.txt | 2 +- runtime/doc/develop.txt | 14 +- runtime/doc/diff.txt | 41 +- runtime/doc/digraph.txt | 1329 ++- runtime/doc/editing.txt | 90 +- runtime/doc/eval.txt | 660 +- runtime/doc/evim-fr.1 | 3 +- runtime/doc/evim-fr.UTF-8.1 | 3 +- runtime/doc/evim-ja.UTF-8.1 | 51 + runtime/doc/farsi.txt | 2 +- runtime/doc/filetype.txt | 9 +- runtime/doc/fold.txt | 4 +- runtime/doc/ft_ada.txt | 24 +- runtime/doc/ft_sql.txt | 10 +- runtime/doc/gui.txt | 65 +- runtime/doc/gui_w16.txt | 4 +- runtime/doc/gui_w32.txt | 23 +- runtime/doc/gui_x11.txt | 4 +- runtime/doc/hangulin.txt | 2 +- runtime/doc/hebrew.txt | 4 +- runtime/doc/help.txt | 12 +- runtime/doc/helphelp.txt | 28 +- runtime/doc/howto.txt | 2 +- runtime/doc/if_cscop.txt | 25 +- runtime/doc/if_lua.txt | 211 +- runtime/doc/if_mzsch.txt | 43 +- runtime/doc/if_ole.txt | 2 +- runtime/doc/if_perl.txt | 13 +- runtime/doc/if_pyth.txt | 431 +- runtime/doc/if_ruby.txt | 17 +- runtime/doc/if_sniff.txt | 2 +- runtime/doc/if_tcl.txt | 6 +- runtime/doc/indent.txt | 345 +- runtime/doc/index.txt | 59 +- runtime/doc/insert.txt | 138 +- runtime/doc/intro.txt | 20 +- runtime/doc/map.txt | 135 +- runtime/doc/mbyte.txt | 39 +- runtime/doc/message.txt | 18 +- runtime/doc/mlang.txt | 6 +- runtime/doc/motion.txt | 39 +- runtime/doc/netbeans.txt | 28 +- runtime/doc/options.txt | 553 +- runtime/doc/os_390.txt | 2 +- runtime/doc/os_amiga.txt | 2 +- runtime/doc/os_beos.txt | 2 +- runtime/doc/os_dos.txt | 2 +- runtime/doc/os_mac.txt | 2 +- runtime/doc/os_mint.txt | 2 +- runtime/doc/os_msdos.txt | 2 +- runtime/doc/os_os2.txt | 2 +- runtime/doc/os_qnx.txt | 2 +- runtime/doc/os_risc.txt | 316 +- runtime/doc/os_unix.txt | 2 +- runtime/doc/os_vms.txt | 104 +- runtime/doc/os_win32.txt | 33 +- runtime/doc/pattern.txt | 117 +- runtime/doc/pi_getscript.txt | 75 +- runtime/doc/pi_gzip.txt | 4 +- runtime/doc/pi_netrw.txt | 1785 ++-- runtime/doc/pi_paren.txt | 7 +- runtime/doc/pi_spec.txt | 2 +- runtime/doc/pi_tar.txt | 37 +- runtime/doc/pi_vimball.txt | 38 +- runtime/doc/pi_zip.txt | 45 +- runtime/doc/print.txt | 2 +- runtime/doc/quickfix.txt | 45 +- runtime/doc/quickref.txt | 161 +- runtime/doc/quotes.txt | 23 +- runtime/doc/recover.txt | 2 +- runtime/doc/remote.txt | 2 +- runtime/doc/repeat.txt | 25 +- runtime/doc/rileft.txt | 2 +- runtime/doc/russian.txt | 2 +- runtime/doc/scroll.txt | 2 +- runtime/doc/sign.txt | 17 +- runtime/doc/spell.txt | 23 +- runtime/doc/sponsor.txt | 2 +- runtime/doc/starting.txt | 75 +- runtime/doc/syntax.txt | 928 +- runtime/doc/tabpage.txt | 14 +- runtime/doc/tags | 385 +- runtime/doc/tagsrch.txt | 18 +- runtime/doc/term.txt | 15 +- runtime/doc/tips.txt | 2 +- runtime/doc/todo.txt | 1049 ++- runtime/doc/uganda.txt | 6 +- runtime/doc/undo.txt | 43 +- runtime/doc/usr_01.txt | 17 +- runtime/doc/usr_02.txt | 2 +- runtime/doc/usr_03.txt | 2 +- runtime/doc/usr_04.txt | 2 +- runtime/doc/usr_05.txt | 5 +- runtime/doc/usr_06.txt | 2 +- runtime/doc/usr_07.txt | 2 +- runtime/doc/usr_08.txt | 4 +- runtime/doc/usr_09.txt | 2 +- runtime/doc/usr_10.txt | 2 +- runtime/doc/usr_11.txt | 2 +- runtime/doc/usr_12.txt | 2 +- runtime/doc/usr_20.txt | 2 +- runtime/doc/usr_21.txt | 14 +- runtime/doc/usr_22.txt | 8 +- runtime/doc/usr_23.txt | 2 +- runtime/doc/usr_24.txt | 2 +- runtime/doc/usr_25.txt | 2 +- runtime/doc/usr_26.txt | 2 +- runtime/doc/usr_27.txt | 2 +- runtime/doc/usr_28.txt | 4 +- runtime/doc/usr_29.txt | 2 +- runtime/doc/usr_30.txt | 2 +- runtime/doc/usr_31.txt | 2 +- runtime/doc/usr_32.txt | 2 +- runtime/doc/usr_40.txt | 16 +- runtime/doc/usr_41.txt | 48 +- runtime/doc/usr_42.txt | 2 +- runtime/doc/usr_43.txt | 2 +- runtime/doc/usr_44.txt | 2 +- runtime/doc/usr_45.txt | 2 +- runtime/doc/usr_90.txt | 2 +- runtime/doc/usr_toc.txt | 4 +- runtime/doc/various.txt | 47 +- runtime/doc/version4.txt | 2 +- runtime/doc/version5.txt | 8 +- runtime/doc/version6.txt | 12 +- runtime/doc/version7.txt | 8176 +++++++++++++++- runtime/doc/vi_diff.txt | 13 +- runtime/doc/vim-de.1 | 478 + runtime/doc/vim-de.UTF-8.1 | 478 + runtime/doc/vim-fr.1 | 15 +- runtime/doc/vim-fr.UTF-8.1 | 15 +- runtime/doc/vim-ja.UTF-8.1 | 501 + runtime/doc/vim2html.pl | 2 +- runtime/doc/vimdiff-fr.1 | 3 +- runtime/doc/vimdiff-fr.UTF-8.1 | 3 +- runtime/doc/vimdiff-ja.UTF-8.1 | 44 + runtime/doc/vimtutor-fr.1 | 5 +- runtime/doc/vimtutor-fr.UTF-8.1 | 5 +- runtime/doc/vimtutor-ja.UTF-8.1 | 45 + runtime/doc/visual.txt | 37 +- runtime/doc/windows.txt | 16 +- runtime/doc/workshop.txt | 2 +- runtime/doc/xxd-fr.1 | 5 +- runtime/doc/xxd-fr.UTF-8.1 | 5 +- runtime/doc/xxd-ja.UTF-8.1 | 366 + runtime/filetype.vim | 372 +- runtime/ftplugin/aap.vim | 4 +- runtime/ftplugin/abap.vim | 29 + runtime/ftplugin/abaqus.vim | 14 +- runtime/ftplugin/ada.vim | 4 +- runtime/ftplugin/ant.vim | 1 + runtime/ftplugin/art.vim | 3 +- runtime/ftplugin/aspvbs.vim | 1 + runtime/ftplugin/c.vim | 6 +- runtime/ftplugin/changelog.vim | 13 +- runtime/ftplugin/clojure.vim | 79 + runtime/ftplugin/config.vim | 1 + runtime/ftplugin/cs.vim | 5 + runtime/ftplugin/csc.vim | 1 + runtime/ftplugin/csh.vim | 1 + runtime/ftplugin/cucumber.vim | 38 +- runtime/ftplugin/debchangelog.vim | 4 +- runtime/ftplugin/docbk.vim | 24 + runtime/ftplugin/dosbatch.vim | 11 +- runtime/ftplugin/dtd.vim | 1 + runtime/ftplugin/erlang.vim | 87 + runtime/ftplugin/eruby.vim | 12 +- runtime/ftplugin/falcon.vim | 48 + runtime/ftplugin/fortran.vim | 25 +- runtime/ftplugin/git.vim | 6 +- runtime/ftplugin/gitcommit.vim | 17 +- runtime/ftplugin/gprof.vim | 32 + runtime/ftplugin/haml.vim | 8 +- runtime/ftplugin/hamster.vim | 5 +- runtime/ftplugin/help.vim | 5 +- runtime/ftplugin/html.vim | 1 + runtime/ftplugin/initex.vim | 1 + runtime/ftplugin/ishd.vim | 5 + runtime/ftplugin/java.vim | 3 +- runtime/ftplugin/jsp.vim | 1 + runtime/ftplugin/kwt.vim | 18 +- runtime/ftplugin/lisp.vim | 7 +- runtime/ftplugin/logcheck.vim | 4 +- runtime/ftplugin/lua.vim | 12 +- runtime/ftplugin/mail.vim | 7 +- runtime/ftplugin/make.vim | 7 +- runtime/ftplugin/man.vim | 12 +- runtime/ftplugin/markdown.vim | 11 +- runtime/ftplugin/matlab.vim | 4 +- runtime/ftplugin/ocaml.vim | 240 +- runtime/ftplugin/occam.vim | 10 + runtime/ftplugin/pascal.vim | 9 +- runtime/ftplugin/perl.vim | 35 +- runtime/ftplugin/perl6.vim | 49 +- runtime/ftplugin/php.vim | 7 +- runtime/ftplugin/plaintex.vim | 1 + runtime/ftplugin/postscr.vim | 17 +- runtime/ftplugin/pyrex.vim | 7 +- runtime/ftplugin/python.vim | 5 + runtime/ftplugin/qf.vim | 6 +- runtime/ftplugin/rpl.vim | 4 +- runtime/ftplugin/ruby.vim | 221 +- runtime/ftplugin/scheme.vim | 28 +- runtime/ftplugin/sgml.vim | 1 + runtime/ftplugin/sh.vim | 1 + runtime/ftplugin/spec.vim | 9 +- runtime/ftplugin/sql.vim | 189 +- runtime/ftplugin/svg.vim | 1 + runtime/ftplugin/tcl.vim | 1 + runtime/ftplugin/tcsh.vim | 1 + runtime/ftplugin/tex.vim | 1 + runtime/ftplugin/treetop.vim | 19 + runtime/ftplugin/tt2html.vim | 13 + runtime/ftplugin/vhdl.vim | 12 +- runtime/ftplugin/vim.vim | 2 +- runtime/ftplugin/xhtml.vim | 1 + runtime/ftplugin/xml.vim | 1 + runtime/ftplugin/xs.vim | 9 +- runtime/ftplugin/xsd.vim | 1 + runtime/ftplugin/zimbu.vim | 151 + runtime/ftplugin/zsh.vim | 9 +- runtime/ftplugof.vim | 8 +- runtime/indent/ada.vim | 5 + runtime/indent/awk.vim | 6 +- runtime/indent/clojure.vim | 398 + runtime/indent/cmake.vim | 5 + runtime/indent/css.vim | 21 +- runtime/indent/cucumber.vim | 36 +- runtime/indent/dtd.vim | 12 +- runtime/indent/eiffel.vim | 14 +- runtime/indent/erlang.vim | 1518 ++- runtime/indent/eruby.vim | 21 +- runtime/indent/falcon.vim | 451 + runtime/indent/fortran.vim | 73 +- runtime/indent/gitconfig.vim | 4 +- runtime/indent/gitolite.vim | 45 + runtime/indent/haml.vim | 4 +- runtime/indent/html.vim | 659 +- runtime/indent/idlang.vim | 5 +- runtime/indent/java.vim | 21 +- runtime/indent/liquid.vim | 5 +- runtime/indent/lisp.vim | 4 +- runtime/indent/mp.vim | 7 +- runtime/indent/ocaml.vim | 46 +- runtime/indent/occam.vim | 5 + runtime/indent/pascal.vim | 217 +- runtime/indent/perl.vim | 43 +- runtime/indent/perl6.vim | 22 +- runtime/indent/php.vim | 103 +- runtime/indent/python.vim | 33 +- runtime/indent/r.vim | 492 + runtime/indent/rst.vim | 34 +- runtime/indent/ruby.vim | 321 +- runtime/indent/sass.vim | 7 +- runtime/indent/sdl.vim | 12 +- runtime/indent/sqlanywhere.vim | 88 +- runtime/indent/tcsh.vim | 6 +- runtime/indent/tex.vim | 295 + runtime/indent/treetop.vim | 38 + runtime/indent/verilog.vim | 8 +- runtime/indent/vhdl.vim | 45 +- runtime/indent/vim.vim | 31 +- runtime/indent/xinetd.vim | 5 + runtime/indent/xml.vim | 19 +- runtime/indent/yaml.vim | 132 + runtime/indent/zimbu.vim | 128 + runtime/keymap/belarusian-jcuken.vim | 87 + runtime/lang/menu_af_af.latin1.vim | 7 +- runtime/lang/menu_ca_es.latin1.vim | 4 + runtime/lang/menu_chinese_gb.936.vim | 5 + runtime/lang/menu_chinese_taiwan.950.vim | 7 +- runtime/lang/menu_cs_cz.iso_8859-2.vim | 242 +- runtime/lang/menu_cs_cz.latin1.vim | 2 +- runtime/lang/menu_cs_cz.utf-8.vim | 308 + runtime/lang/menu_czech_czech_republic.1250.vim | 240 +- runtime/lang/menu_czech_czech_republic.ascii.vim | 242 +- runtime/lang/menu_de_de.latin1.vim | 5 + runtime/lang/menu_eo.utf-8.vim | 7 +- runtime/lang/menu_es_es.latin1.vim | 7 +- runtime/lang/menu_fi_fi.latin1.vim | 7 +- runtime/lang/menu_fr_fr.latin1.vim | 7 +- runtime/lang/menu_hu_hu.iso_8859-2.vim | 7 +- runtime/lang/menu_hu_hu.utf-8.vim | 7 +- runtime/lang/menu_it_it.latin1.vim | 7 +- runtime/lang/menu_ja.cp932.vim | 7 +- runtime/lang/menu_ja.euc-jp.vim | 7 +- runtime/lang/menu_ja.eucjp.vim | 7 +- runtime/lang/menu_ja.ujis.vim | 7 +- runtime/lang/menu_ja_jp.cp932.vim | 7 +- runtime/lang/menu_ja_jp.euc-jp.vim | 60 +- runtime/lang/menu_ja_jp.eucjp.vim | 7 +- runtime/lang/menu_ja_jp.ujis.vim | 7 +- runtime/lang/menu_ja_jp.utf-8.vim | 60 +- runtime/lang/menu_japanese_japan.932.vim | 60 +- runtime/lang/menu_ko_kr.euckr.vim | 26 +- runtime/lang/menu_ko_kr.utf-8.vim | 26 +- runtime/lang/menu_nl_nl.latin1.vim | 7 +- runtime/lang/menu_no_no.latin1.vim | 7 +- runtime/lang/menu_pl_pl.iso_8859-2.vim | 5 + runtime/lang/menu_pl_pl.utf-8.vim | 5 + runtime/lang/menu_polish_poland.1250.vim | 5 + runtime/lang/menu_pt_br.vim | 7 +- runtime/lang/menu_pt_pt.vim | 5 + runtime/lang/menu_ru_ru.koi8-r.vim | 102 +- runtime/lang/menu_ru_ru.vim | 104 +- runtime/lang/menu_sk_sk.iso_8859-2.vim | 7 +- runtime/lang/menu_sl_si.cp1250.vim | 5 + runtime/lang/menu_sl_si.latin2.vim | 5 + runtime/lang/menu_sl_si.utf-8.vim | 5 + runtime/lang/menu_slovak_slovak_republic.1250.vim | 7 +- runtime/lang/menu_sr_rs.ascii.vim | 5 + runtime/lang/menu_sr_rs.iso_8859-2.vim | 6 + runtime/lang/menu_sr_rs.iso_8859-5.vim | 6 + runtime/lang/menu_sr_rs.utf-8.vim | 6 + runtime/lang/menu_sv_se.latin1.vim | 7 +- runtime/lang/menu_uk_ua.cp1251.vim | 5 + runtime/lang/menu_uk_ua.koi8-u.vim | 5 + runtime/lang/menu_vi_vn.vim | 5 + runtime/lang/menu_zh_cn.gb2312.vim | 5 + runtime/lang/menu_zh_cn.utf-8.vim | 5 + runtime/lang/menu_zh_tw.utf-8.vim | 8 +- runtime/macros/editexisting.vim | 4 +- runtime/macros/justify.vim | 9 +- runtime/macros/less.bat | 10 + runtime/macros/less.sh | 16 +- runtime/macros/less.vim | 5 +- runtime/macros/matchit.vim | 5 +- runtime/makemenu.vim | 35 +- runtime/menu.vim | 21 +- runtime/mswin.vim | 7 +- runtime/optwin.vim | 51 +- runtime/plugin/getscriptPlugin.vim | 4 +- runtime/plugin/matchparen.vim | 28 +- runtime/plugin/netrwPlugin.vim | 52 +- runtime/plugin/tarPlugin.vim | 4 +- runtime/plugin/tohtml.vim | 168 +- runtime/plugin/vimballPlugin.vim | 18 +- runtime/plugin/zipPlugin.vim | 16 +- runtime/scripts.vim | 23 +- runtime/spell/br/br_FR.diff | 13 - runtime/spell/br/main.aap | 16 +- runtime/spell/en.utf-8.spl | Bin 570548 -> 570548 bytes runtime/spell/en.utf-8.sug | Bin 556546 -> 556476 bytes runtime/spell/ga/ga_IE.diff | 2 +- runtime/spell/gd/gd_GB.diff | 2 +- runtime/spell/hu/main.aap | 7 +- runtime/spell/spell.vim | 4 + runtime/spell/sv/sv_SE.diff | 2 +- runtime/synmenu.vim | 661 +- runtime/syntax/2html.vim | 1090 ++- runtime/syntax/abap.vim | 189 +- runtime/syntax/abel.vim | 11 +- runtime/syntax/ada.vim | 5 + runtime/syntax/aptconf.vim | 512 + runtime/syntax/art.vim | 8 +- runtime/syntax/asciidoc.vim | 183 + runtime/syntax/asm.vim | 49 +- runtime/syntax/asn.vim | 7 +- runtime/syntax/autoit.vim | 13 + runtime/syntax/automake.vim | 41 +- runtime/syntax/awk.vim | 18 +- runtime/syntax/ayacc.vim | 7 +- runtime/syntax/basic.vim | 7 +- runtime/syntax/bc.vim | 9 +- runtime/syntax/bib.vim | 16 +- runtime/syntax/bindzone.vim | 16 +- runtime/syntax/blank.vim | 8 +- runtime/syntax/bzr.vim | 8 +- runtime/syntax/c.vim | 182 +- runtime/syntax/cfg.vim | 4 +- runtime/syntax/cl.vim | 35 +- runtime/syntax/clean.vim | 14 +- runtime/syntax/clipper.vim | 9 +- runtime/syntax/clojure.vim | 134 + runtime/syntax/cmake.vim | 10 +- runtime/syntax/cpp.vim | 18 +- runtime/syntax/crontab.vim | 5 +- runtime/syntax/csc.vim | 7 +- runtime/syntax/csdl.vim | 536 ++ runtime/syntax/css.vim | 407 +- runtime/syntax/cucumber.vim | 62 +- runtime/syntax/cupl.vim | 11 +- runtime/syntax/cweb.vim | 7 +- runtime/syntax/d.vim | 525 +- runtime/syntax/datascript.vim | 7 +- runtime/syntax/debchangelog.vim | 6 +- runtime/syntax/debcontrol.vim | 25 +- runtime/syntax/debsources.vim | 6 +- runtime/syntax/diff.vim | 269 +- runtime/syntax/dircolors.vim | 4 +- runtime/syntax/dirpager.vim | 56 + runtime/syntax/django.vim | 6 +- runtime/syntax/dnsmasq.vim | 229 + runtime/syntax/docbk.vim | 192 +- runtime/syntax/dosini.vim | 31 +- runtime/syntax/dot.vim | 8 +- runtime/syntax/doxygen.vim | 4 +- runtime/syntax/dtd.vim | 23 +- runtime/syntax/dts.vim | 28 + runtime/syntax/eiffel.vim | 36 +- runtime/syntax/erlang.vim | 444 +- runtime/syntax/eruby.vim | 13 +- runtime/syntax/esmtprc.vim | 22 +- runtime/syntax/expect.vim | 9 +- runtime/syntax/falcon.vim | 199 + runtime/syntax/fasm.vim | 13 +- runtime/syntax/forth.vim | 51 +- runtime/syntax/fortran.vim | 549 +- runtime/syntax/fstab.vim | 41 +- runtime/syntax/fvwm.vim | 5 + runtime/syntax/gdb.vim | 13 +- runtime/syntax/gdmo.vim | 6 +- runtime/syntax/gitcommit.vim | 8 +- runtime/syntax/gitolite.vim | 86 + runtime/syntax/gitrebase.vim | 5 +- runtime/syntax/gnash.vim | 99 + runtime/syntax/gp.vim | 29 +- runtime/syntax/gpg.vim | 4 +- runtime/syntax/gprof.vim | 69 + runtime/syntax/groovy.vim | 71 +- runtime/syntax/group.vim | 6 +- runtime/syntax/gsp.vim | 8 +- runtime/syntax/hb.vim | 7 +- runtime/syntax/help.vim | 40 +- runtime/syntax/hgcommit.vim | 27 + runtime/syntax/hostsaccess.vim | 27 + runtime/syntax/html.vim | 25 +- runtime/syntax/idl.vim | 583 +- runtime/syntax/idlang.vim | 4 +- runtime/syntax/ist.vim | 7 +- runtime/syntax/jam.vim | 7 +- runtime/syntax/java.vim | 22 +- runtime/syntax/javacc.vim | 9 +- runtime/syntax/javascript.vim | 12 +- runtime/syntax/jovial.vim | 110 + runtime/syntax/kwt.vim | 2 +- runtime/syntax/lex.vim | 85 +- runtime/syntax/liquid.vim | 5 +- runtime/syntax/lisp.vim | 30 +- runtime/syntax/logindefs.vim | 236 +- runtime/syntax/logtalk.vim | 64 +- runtime/syntax/lout.vim | 20 +- runtime/syntax/lpc.vim | 9 +- runtime/syntax/lsl.vim | 7 +- runtime/syntax/lua.vim | 385 +- runtime/syntax/lynx.vim | 160 +- runtime/syntax/mail.vim | 12 +- runtime/syntax/mailcap.vim | 59 +- runtime/syntax/make.vim | 14 +- runtime/syntax/mallard.vim | 37 + runtime/syntax/markdown.vim | 67 +- runtime/syntax/masm.vim | 16 +- runtime/syntax/matlab.vim | 4 +- runtime/syntax/mma.vim | 52 +- runtime/syntax/mmix.vim | 13 +- runtime/syntax/monk.vim | 8 +- runtime/syntax/mrxvtrc.vim | 12 +- runtime/syntax/msidl.vim | 7 +- runtime/syntax/muttrc.vim | 42 +- runtime/syntax/nasm.vim | 51 +- runtime/syntax/natural.vim | 12 +- runtime/syntax/netrw.vim | 20 +- runtime/syntax/ninja.vim | 81 + runtime/syntax/nroff.vim | 11 +- runtime/syntax/objc.vim | 523 +- runtime/syntax/ocaml.vim | 60 +- runtime/syntax/opl.vim | 6 + runtime/syntax/pamconf.vim | 8 +- runtime/syntax/perl.vim | 288 +- runtime/syntax/perl6.vim | 74 +- runtime/syntax/pf.vim | 9 +- runtime/syntax/pfmain.vim | 536 +- runtime/syntax/php.vim | 150 +- runtime/syntax/pine.vim | 4 +- runtime/syntax/pli.vim | 278 + runtime/syntax/po.vim | 11 +- runtime/syntax/pod.vim | 109 +- runtime/syntax/pov.vim | 54 +- runtime/syntax/povini.vim | 18 +- runtime/syntax/progress.vim | 418 +- runtime/syntax/prolog.vim | 64 +- runtime/syntax/proto.vim | 74 + runtime/syntax/python.vim | 12 +- runtime/syntax/r.vim | 272 +- runtime/syntax/ratpoison.vim | 14 +- runtime/syntax/rcs.vim | 8 +- runtime/syntax/readline.vim | 503 +- runtime/syntax/redif.vim | 972 ++ runtime/syntax/resolv.vim | 16 +- runtime/syntax/reva.vim | 45 +- runtime/syntax/rexx.vim | 87 +- runtime/syntax/rhelp.vim | 94 +- runtime/syntax/rng.vim | 25 + runtime/syntax/rpl.vim | 7 +- runtime/syntax/rst.vim | 33 +- runtime/syntax/ruby.vim | 137 +- runtime/syntax/sas.vim | 15 +- runtime/syntax/sass.vim | 24 +- runtime/syntax/scheme.vim | 30 +- runtime/syntax/sd.vim | 12 +- runtime/syntax/sdl.vim | 2 +- runtime/syntax/sendpr.vim | 8 +- runtime/syntax/sgmldecl.vim | 6 + runtime/syntax/sgmllnx.vim | 5 +- runtime/syntax/sh.vim | 356 +- runtime/syntax/sisu.vim | 195 +- runtime/syntax/slice.vim | 1 + runtime/syntax/smil.vim | 7 +- runtime/syntax/snnspat.vim | 6 +- runtime/syntax/spice.vim | 7 +- runtime/syntax/spup.vim | 131 +- runtime/syntax/sqlanywhere.vim | 524 +- runtime/syntax/sqlhana.vim | 293 + runtime/syntax/sqr.vim | 12 +- runtime/syntax/sshconfig.vim | 173 +- runtime/syntax/sshdconfig.vim | 168 +- runtime/syntax/st.vim | 8 +- runtime/syntax/sudoers.vim | 86 +- runtime/syntax/svn.vim | 22 +- runtime/syntax/synload.vim | 6 +- runtime/syntax/sysctl.vim | 4 +- runtime/syntax/taskdata.vim | 5 + runtime/syntax/taskedit.vim | 5 + runtime/syntax/tasm.vim | 8 +- runtime/syntax/tex.vim | 593 +- runtime/syntax/tidy.vim | 261 +- runtime/syntax/treetop.vim | 110 + runtime/syntax/tsalt.vim | 7 +- runtime/syntax/tt2.vim | 210 + runtime/syntax/tt2html.vim | 20 + runtime/syntax/tt2js.vim | 20 + runtime/syntax/uil.vim | 19 +- runtime/syntax/upstart.vim | 112 + runtime/syntax/upstreamdat.vim | 296 + runtime/syntax/upstreaminstalllog.vim | 27 + runtime/syntax/upstreamlog.vim | 53 + runtime/syntax/usserverlog.vim | 59 + runtime/syntax/usw2kagtlog.vim | 49 + runtime/syntax/valgrind.vim | 7 +- runtime/syntax/verilog.vim | 34 +- runtime/syntax/vhdl.vim | 16 +- runtime/syntax/vim.vim | 356 +- runtime/syntax/viminfo.vim | 8 +- runtime/syntax/wget.vim | 345 +- runtime/syntax/xdefaults.vim | 8 +- runtime/syntax/xf86conf.vim | 8 +- runtime/syntax/xml.vim | 10 +- runtime/syntax/xpm2.vim | 10 +- runtime/syntax/xquery.vim | 90 +- runtime/syntax/xs.vim | 3301 ++++++- runtime/syntax/yacc.vim | 96 +- runtime/syntax/yaml.vim | 244 +- runtime/syntax/zimbu.vim | 130 + runtime/tools/ccfilter_README.txt | 2 +- runtime/tools/efm_perl.pl | 2 +- runtime/tools/vim_vs_net.cmd | 4 +- runtime/tutor/Makefile | 10 +- runtime/tutor/tutor | 2 +- runtime/tutor/{tutor.bj => tutor.bar} | 258 +- runtime/tutor/{tutor.bj.utf-8 => tutor.bar.utf-8} | 258 +- runtime/tutor/tutor.de | 2 +- runtime/tutor/tutor.de.utf-8 | 2 +- runtime/tutor/tutor.eo | 16 +- runtime/tutor/tutor.eo.utf-8 | 16 +- runtime/tutor/tutor.fr | 30 +- runtime/tutor/tutor.fr.utf-8 | 30 +- runtime/tutor/tutor.hr | 2 +- runtime/tutor/tutor.hr.cp1250 | 2 +- runtime/tutor/tutor.hr.utf-8 | 2 +- runtime/tutor/tutor.hu | 88 +- runtime/tutor/tutor.hu.cp1250 | 88 +- runtime/tutor/tutor.hu.utf-8 | 88 +- runtime/tutor/tutor.ja.euc | 82 +- runtime/tutor/tutor.ja.sjis | 82 +- runtime/tutor/tutor.ja.utf-8 | 82 +- runtime/tutor/tutor.ko.euc | 2 +- runtime/tutor/tutor.ko.utf-8 | 2 +- runtime/tutor/tutor.nb | 2 +- runtime/tutor/tutor.nb.utf-8 | 2 +- runtime/tutor/tutor.nl | 950 ++ runtime/tutor/tutor.nl.utf-8 | 950 ++ runtime/tutor/tutor.no | 2 +- runtime/tutor/tutor.no.utf-8 | 2 +- runtime/tutor/tutor.sk | 2 +- runtime/tutor/tutor.sk.cp1250 | 2 +- runtime/tutor/tutor.sk.utf-8 | 2 +- runtime/tutor/tutor.utf-8 | 2 +- runtime/tutor/tutor.vim | 10 +- runtime/tutor/tutor.zh.euc | 765 +- runtime/tutor/tutor.zh_cn.utf-8 | 996 ++ runtime/tutor/tutor.zh_tw.utf-8 | 852 ++ runtime/vimrc_example.vim | 4 +- src/GvimExt/GvimExt.reg | 4 +- src/GvimExt/Make_cyg.mak | 77 + src/GvimExt/Make_ming.mak | 26 +- src/GvimExt/Makefile | 6 +- src/GvimExt/gvimext.cpp | 41 +- src/GvimExt/gvimext.def | 2 +- src/GvimExt/gvimext_ming.def | 2 +- src/INSTALL | 27 +- src/INSTALLpc.txt | 98 +- src/INSTALLvms.txt | 2 +- src/Make_bc5.mak | 6 +- src/Make_cyg.mak | 122 +- src/Make_ivc.mak | 5 + src/Make_ming.mak | 178 +- src/Make_mvc.mak | 150 +- src/Make_ro.mak | 135 - src/Make_sas.mak | 4 +- src/Make_vms.mms | 4 +- src/Make_w16.mak | 3 +- src/Makefile | 220 +- src/VisVim/Commands.cpp | 5 +- src/VisVim/OleAut.cpp | 2 +- src/VisVim/README_VisVim.txt | 14 +- src/arabic.c | 2 +- src/ascii.h | 11 +- src/auto/configure | 1110 ++- src/bigvim.bat | 4 +- src/bigvim64.bat | 7 + src/blowfish.c | 5 +- src/buffer.c | 485 +- src/charset.c | 63 +- src/config.h.in | 11 + src/config.mk.in | 1 + src/configure.in | 898 +- src/dehqx.py | 7 +- src/diff.c | 87 +- src/digraph.c | 16 +- src/dosinst.c | 4 +- src/edit.c | 605 +- src/eval.c | 2097 ++-- src/ex_cmds.c | 800 +- src/ex_cmds.h | 24 +- src/ex_cmds2.c | 387 +- src/ex_docmd.c | 743 +- src/ex_eval.c | 8 +- src/ex_getln.c | 650 +- src/farsi.c | 4 +- src/feature.h | 84 +- src/fileio.c | 502 +- src/fold.c | 122 +- src/getchar.c | 349 +- src/glbl_ime.cpp | 2 +- src/globals.h | 57 +- src/gui.c | 471 +- src/gui.h | 35 +- src/gui_at_fs.c | 4 +- src/gui_athena.c | 5 +- src/gui_beval.c | 10 +- src/gui_gtk.c | 96 +- src/gui_gtk_x11.c | 99 +- src/gui_mac.c | 66 +- src/gui_motif.c | 11 +- src/gui_photon.c | 1570 +-- src/gui_riscos.c | 3558 ------- src/gui_riscos.h | 32 - src/gui_w16.c | 20 +- src/gui_w32.c | 224 +- src/gui_w48.c | 236 +- src/gui_x11.c | 25 +- src/gui_xmdlg.c | 4 +- src/gui_xmebw.c | 15 +- src/gui_xmebwp.h | 4 +- src/gvim.exe.mnf | 2 +- src/hardcopy.c | 109 +- src/hashtab.c | 12 +- src/if_cscope.c | 127 +- src/if_lua.c | 1047 +- src/if_mzsch.c | 657 +- src/if_mzsch.h | 34 +- src/if_ole.cpp | 6 +- src/if_ole.h | 7 +- src/if_perl.xs | 148 +- src/if_py_both.h | 6503 +++++++++++-- src/if_python.c | 1410 ++- src/if_python3.c | 1324 +-- src/if_ruby.c | 445 +- src/if_sniff.c | 13 +- src/if_tcl.c | 126 +- src/if_xcmdsrv.c | 150 +- src/integration.c | 1 - src/keymap.h | 14 +- src/link.sh | 18 +- src/macros.h | 38 +- src/main.aap | 4 +- src/main.c | 262 +- src/mark.c | 61 +- src/mbyte.c | 436 +- src/memfile.c | 301 +- src/memfile_test.c | 145 + src/memline.c | 93 +- src/menu.c | 13 +- src/message.c | 310 +- src/misc1.c | 1282 ++- src/misc2.c | 410 +- src/move.c | 41 +- src/msvc2008.bat | 2 +- src/msvc2010.bat | 7 + src/nbdebug.c | 2 +- src/netbeans.c | 261 +- src/normal.c | 397 +- src/ops.c | 408 +- src/option.c | 814 +- src/option.h | 32 +- src/os_amiga.c | 27 +- src/os_amiga.h | 18 +- src/os_beos.c | 5 +- src/os_beos.h | 4 +- src/os_dos.h | 10 +- src/os_mac.h | 2 +- src/os_mac_conv.c | 4 +- src/os_macosx.m | 25 +- src/os_msdos.c | 60 +- src/os_msdos.h | 9 +- src/os_mswin.c | 871 +- src/os_qnx.c | 70 +- src/os_riscos.c | 1292 --- src/os_riscos.h | 166 - src/os_unix.c | 498 +- src/os_unix.h | 48 +- src/os_win16.c | 27 +- src/os_win16.h | 25 +- src/os_win32.c | 1645 +++- src/os_win32.h | 42 +- src/po/Makefile | 41 +- src/po/README.txt | 25 +- src/po/af.po | 16 - src/po/ca.po | 24 +- src/po/de.po | 26 +- src/po/en_GB.po | 8 - src/po/eo.po | 653 +- src/po/es.po | 22 - src/po/fi.po | 35 +- src/po/fr.po | 544 +- src/po/ga.po | 18 - src/po/it.po | 691 +- src/po/ja.euc-jp.po | 6808 +++++++++++++ src/po/ja.po | 4390 +++++---- src/po/ja.sjis.po | 1334 ++- src/po/ko.UTF-8.po | 461 +- src/po/ko.po | 461 +- src/po/nb.po | 18 - src/po/nl.po | 5852 ++++++++++++ src/po/no.po | 18 - src/po/pl.UTF-8.po | 718 +- src/po/pl.cp1250.po | 718 +- src/po/pl.po | 716 +- src/po/pt_BR.po | 18 - src/po/ru.cp1251.po | 3178 +++++-- src/po/ru.po | 3178 +++++-- src/po/sjiscorr.c | 4 +- src/po/sk.cp1250.po | 16 - src/po/sk.po | 16 - src/po/sv.po | 20 +- src/po/uk.cp1251.po | 629 +- src/po/uk.po | 629 +- src/po/vi.po | 18 - src/po/zh_CN.UTF-8.po | 29 +- src/po/zh_CN.cp936.po | 18 - src/po/zh_CN.po | 18 - src/po/zh_TW.UTF-8.po | 18 - src/po/zh_TW.po | 18 - src/popupmnu.c | 5 +- src/proto.h | 8 +- src/proto/buffer.pro | 8 +- src/proto/charset.pro | 3 +- src/proto/digraph.pro | 2 +- src/proto/edit.pro | 1 + src/proto/eval.pro | 28 +- src/proto/ex_cmds.pro | 2 + src/proto/ex_cmds2.pro | 7 +- src/proto/ex_docmd.pro | 3 +- src/proto/ex_getln.pro | 8 +- src/proto/fileio.pro | 10 + src/proto/fold.pro | 2 +- src/proto/getchar.pro | 6 +- src/proto/gui_athena.pro | 2 +- src/proto/gui_gtk.pro | 2 +- src/proto/gui_gtk_x11.pro | 3 + src/proto/gui_mac.pro | 2 +- src/proto/gui_motif.pro | 2 +- src/proto/gui_photon.pro | 2 +- src/proto/gui_riscos.pro | 66 - src/proto/gui_w16.pro | 3 +- src/proto/gui_w32.pro | 3 +- src/proto/if_lua.pro | 2 + src/proto/if_mzsch.pro | 3 +- src/proto/if_python.pro | 4 + src/proto/if_python3.pro | 4 + src/proto/if_ruby.pro | 1 + src/proto/mark.pro | 3 +- src/proto/mbyte.pro | 4 +- src/proto/message.pro | 6 +- src/proto/misc1.pro | 9 +- src/proto/misc2.pro | 4 + src/proto/move.pro | 2 +- src/proto/ops.pro | 3 +- src/proto/option.pro | 10 +- src/proto/os_beos.pro | 4 + src/proto/os_mswin.pro | 11 - src/proto/os_riscos.pro | 49 - src/proto/os_win32.pro | 6 +- src/proto/regexp.pro | 9 +- src/proto/screen.pro | 7 +- src/proto/search.pro | 1 + src/proto/sha256.pro | 1 + src/proto/syntax.pro | 2 + src/proto/term.pro | 4 +- src/proto/ui.pro | 10 +- src/proto/version.pro | 1 + src/proto/winclip.pro | 14 + src/proto/window.pro | 14 +- src/pty.c | 15 +- src/quickfix.c | 501 +- src/regexp.c | 1299 ++- src/regexp.h | 90 +- src/regexp_nfa.c | 6787 +++++++++++++ src/screen.c | 422 +- src/search.c | 406 +- src/sha256.c | 7 +- src/spell.c | 275 +- src/structs.h | 156 +- src/syntax.c | 464 +- src/tag.c | 355 +- src/term.c | 559 +- src/term.h | 6 +- src/termlib.c | 2 +- src/testdir/Make_amiga.mak | 30 +- src/testdir/Make_dos.mak | 49 +- src/testdir/Make_ming.mak | 12 +- src/testdir/Make_os2.mak | 9 +- src/testdir/Make_vms.mms | 10 +- src/testdir/Makefile | 46 +- src/testdir/main.aap | 2 +- src/testdir/python2/module.py | 2 + src/testdir/python3/module.py | 2 + src/testdir/python_after/after.py | 2 + src/testdir/python_before/before.py | 1 + src/testdir/python_before/before_1.py | 1 + src/testdir/python_before/before_2.py | 1 + src/testdir/pythonx/failing.py | 1 + src/testdir/pythonx/failing_import.py | 1 + src/testdir/pythonx/module.py | 1 + src/testdir/pythonx/modulex.py | 1 + src/testdir/pythonx/topmodule/__init__.py | 1 + .../pythonx/topmodule/submodule/__init__.py | 1 + .../topmodule/submodule/subsubmodule/__init__.py | 1 + .../submodule/subsubmodule/subsubsubmodule.py | 1 + src/testdir/test1.in | 8 + src/testdir/test10.in | 121 +- src/testdir/test10.ok | 42 +- src/testdir/test14.in | 20 + src/testdir/test14.ok | 5 + src/testdir/test16.in | 1 + src/testdir/test17.in | 118 +- src/testdir/test17.ok | 30 + src/testdir/test19.in | 10 +- src/testdir/test19.ok | 3 + src/testdir/test24.in | Bin 1240 -> 1301 bytes src/testdir/test24.ok | 3 + src/testdir/test29.in | 152 +- src/testdir/test29.ok | 39 + src/testdir/test3.in | 748 +- src/testdir/test3.ok | 635 ++ src/testdir/test31.in | 6 + src/testdir/test31.ok | 1 + src/testdir/test34.in | 6 +- src/testdir/test34.ok | 4 +- src/testdir/test36.in | 131 +- src/testdir/test36.ok | 80 + src/testdir/test40.in | 30 +- src/testdir/test43.in | 9 +- src/testdir/test43.ok | 3 + src/testdir/test44.in | 13 +- src/testdir/test44.ok | 4 + src/testdir/test47.in | 17 +- src/testdir/test47.ok | 1 + src/testdir/test48.in | 4 + src/testdir/test48.ok | 1 + src/testdir/test49.ok | 13 +- src/testdir/test49.vim | 56 +- src/testdir/test50.in | 11 +- src/testdir/test53.in | 30 + src/testdir/test53.ok | 9 + src/testdir/test55.in | 40 + src/testdir/test55.ok | 12 + src/testdir/test57.in | 6 +- src/testdir/test57.ok | 4 + src/testdir/test58.in | 4 + src/testdir/test61.in | 24 + src/testdir/test61.ok | 6 + src/testdir/test62.in | 135 +- src/testdir/test62.ok | 81 + src/testdir/test64.in | 717 +- src/testdir/test64.ok | 1118 ++- src/testdir/test65.in | 19 +- src/testdir/test65.ok | 17 + src/testdir/test66.in | 10 +- src/testdir/test66.ok | 6 + src/testdir/test68.in | 61 + src/testdir/test68.ok | 33 + src/testdir/test69.in | 20 + src/testdir/test69.ok | 9 + src/testdir/test70.in | 12 +- src/testdir/test70.ok | 1 + src/testdir/test71.in | 20 +- src/testdir/test71a.in | 14 + src/testdir/test72.in | 6 + src/testdir/test72.ok | 10 + src/testdir/test73.in | 10 + src/testdir/test73.ok | 2 + src/testdir/test74.in | 36 + src/testdir/test74.ok | 5 + src/testdir/test75.in | 24 + src/testdir/test75.ok | 6 + src/testdir/test76.in | 46 + src/testdir/test76.ok | 4 + src/testdir/test77.in | 30 + src/testdir/test77.ok | 1 + src/testdir/test78.in | 46 + src/testdir/test78.ok | 3 + src/testdir/test79.in | Bin 0 -> 2713 bytes src/testdir/test79.ok | Bin 0 -> 421 bytes src/testdir/test8.in | 22 + src/testdir/test8.ok | 1 + src/testdir/test80.in | 180 + src/testdir/test80.ok | 115 + src/testdir/test81.in | 22 + src/testdir/test81.ok | 6 + src/testdir/test82.in | 103 + src/testdir/test82.ok | 5 + src/testdir/test83-tags2 | 2 + src/testdir/test83-tags3 | 102 + src/testdir/test83.in | 76 + src/testdir/test83.ok | 4 + src/testdir/test84.in | 35 + src/testdir/test84.ok | 3 + src/testdir/test85.in | 85 + src/testdir/test85.ok | 7 + src/testdir/test86.in | 1320 +++ src/testdir/test86.ok | 1197 +++ src/testdir/test87.in | 1271 +++ src/testdir/test87.ok | 1186 +++ src/testdir/test88.in | 88 + src/testdir/test88.ok | 24 + src/testdir/test89.in | 71 + src/testdir/test89.ok | 28 + src/testdir/test90.in | 53 + src/testdir/test90.ok | 6 + src/testdir/test91.in | 111 + src/testdir/test91.ok | 48 + src/testdir/test92.in | 48 + src/testdir/test92.ok | 26 + src/testdir/test93.in | 48 + src/testdir/test93.ok | 26 + src/testdir/test94.in | 95 + src/testdir/test94.ok | 20 + src/testdir/test95.in | 135 + src/testdir/test95.ok | 122 + src/testdir/test96.in | 142 + src/testdir/test96.ok | 9 + src/testdir/test97.in | 17 + src/testdir/test97.ok | 5 + src/testdir/test98.in | 43 + src/testdir/test98.ok | 1 + src/typemap | 2 +- src/ui.c | 275 +- src/undo.c | 37 +- src/version.c | 145 +- src/version.h | 20 +- src/vim.def | 2 +- src/vim.h | 143 +- src/vim.rc | 8 +- src/vim16.def | 2 +- src/vim16.rc | 2 +- src/vimio.h | 5 +- src/winclip.c | 800 ++ src/window.c | 759 +- src/workshop.c | 1 - src/xpm/COPYRIGHT | 31 + src/xpm/README.txt | 26 + src/xpm/include/simx.h | 139 + src/xpm/include/xpm.h | 501 + src/xpm/x64/lib/libXpm.a | Bin 0 -> 73758 bytes src/xpm/x64/lib/libXpm.lib | Bin 0 -> 195582 bytes src/xpm/x86/lib/libXpm.a | Bin 0 -> 66414 bytes src/xpm/x86/lib/libXpm.lib | Bin 0 -> 139938 bytes src/xpm_w32.c | 23 +- src/xxd/Make_ming.mak | 28 + src/xxd/xxd.c | 179 +- uninstal.txt | 4 +- vimtutor.com | 2 +- 1073 files changed, 130678 insertions(+), 39384 deletions(-) create mode 100644 runtime/autoload/clojurecomplete.vim create mode 100644 runtime/compiler/erlang.vim create mode 100644 runtime/compiler/g95.vim create mode 100644 runtime/compiler/gfortran.vim create mode 100644 runtime/compiler/haml.vim create mode 100644 runtime/compiler/ifort.vim create mode 100644 runtime/compiler/msbuild.vim create mode 100644 runtime/compiler/ocaml.vim create mode 100644 runtime/compiler/rake.vim create mode 100644 runtime/compiler/sass.vim create mode 100644 runtime/compiler/xbuild.vim create mode 100644 runtime/doc/evim-ja.UTF-8.1 create mode 100644 runtime/doc/vim-de.1 create mode 100644 runtime/doc/vim-de.UTF-8.1 create mode 100644 runtime/doc/vim-ja.UTF-8.1 create mode 100644 runtime/doc/vimdiff-ja.UTF-8.1 create mode 100644 runtime/doc/vimtutor-ja.UTF-8.1 create mode 100644 runtime/doc/xxd-ja.UTF-8.1 create mode 100644 runtime/ftplugin/abap.vim create mode 100644 runtime/ftplugin/clojure.vim create mode 100644 runtime/ftplugin/docbk.vim create mode 100644 runtime/ftplugin/erlang.vim create mode 100644 runtime/ftplugin/falcon.vim create mode 100644 runtime/ftplugin/gprof.vim create mode 100644 runtime/ftplugin/treetop.vim create mode 100644 runtime/ftplugin/tt2html.vim create mode 100644 runtime/ftplugin/zimbu.vim create mode 100644 runtime/indent/clojure.vim create mode 100644 runtime/indent/falcon.vim create mode 100644 runtime/indent/gitolite.vim create mode 100644 runtime/indent/r.vim create mode 100644 runtime/indent/tex.vim create mode 100644 runtime/indent/treetop.vim create mode 100644 runtime/indent/yaml.vim create mode 100644 runtime/indent/zimbu.vim create mode 100644 runtime/keymap/belarusian-jcuken.vim create mode 100644 runtime/lang/menu_cs_cz.utf-8.vim create mode 100644 runtime/macros/less.bat create mode 100644 runtime/spell/spell.vim create mode 100644 runtime/syntax/aptconf.vim create mode 100644 runtime/syntax/asciidoc.vim create mode 100644 runtime/syntax/clojure.vim create mode 100644 runtime/syntax/csdl.vim create mode 100644 runtime/syntax/dirpager.vim create mode 100644 runtime/syntax/dnsmasq.vim create mode 100644 runtime/syntax/dts.vim create mode 100644 runtime/syntax/falcon.vim create mode 100644 runtime/syntax/gitolite.vim create mode 100644 runtime/syntax/gnash.vim create mode 100644 runtime/syntax/gprof.vim create mode 100644 runtime/syntax/hgcommit.vim create mode 100644 runtime/syntax/hostsaccess.vim create mode 100644 runtime/syntax/jovial.vim create mode 100644 runtime/syntax/mallard.vim create mode 100644 runtime/syntax/ninja.vim create mode 100644 runtime/syntax/pli.vim create mode 100644 runtime/syntax/proto.vim create mode 100644 runtime/syntax/redif.vim create mode 100644 runtime/syntax/rng.vim create mode 100644 runtime/syntax/sqlhana.vim create mode 100644 runtime/syntax/treetop.vim create mode 100644 runtime/syntax/tt2.vim create mode 100644 runtime/syntax/tt2html.vim create mode 100644 runtime/syntax/tt2js.vim create mode 100644 runtime/syntax/upstart.vim create mode 100644 runtime/syntax/upstreamdat.vim create mode 100644 runtime/syntax/upstreaminstalllog.vim create mode 100644 runtime/syntax/upstreamlog.vim create mode 100644 runtime/syntax/usserverlog.vim create mode 100644 runtime/syntax/usw2kagtlog.vim create mode 100644 runtime/syntax/zimbu.vim rename runtime/tutor/{tutor.bj => tutor.bar} (80%) rename runtime/tutor/{tutor.bj.utf-8 => tutor.bar.utf-8} (81%) create mode 100644 runtime/tutor/tutor.nl create mode 100644 runtime/tutor/tutor.nl.utf-8 create mode 100644 runtime/tutor/tutor.zh_cn.utf-8 create mode 100644 runtime/tutor/tutor.zh_tw.utf-8 create mode 100644 src/GvimExt/Make_cyg.mak delete mode 100644 src/Make_ro.mak create mode 100644 src/bigvim64.bat delete mode 100644 src/gui_riscos.c delete mode 100644 src/gui_riscos.h create mode 100644 src/memfile_test.c create mode 100644 src/msvc2010.bat delete mode 100644 src/os_riscos.c delete mode 100644 src/os_riscos.h create mode 100644 src/po/ja.euc-jp.po create mode 100644 src/po/nl.po delete mode 100644 src/proto/gui_riscos.pro create mode 100644 src/proto/os_beos.pro delete mode 100644 src/proto/os_riscos.pro create mode 100644 src/proto/winclip.pro create mode 100644 src/regexp_nfa.c create mode 100644 src/testdir/python2/module.py create mode 100644 src/testdir/python3/module.py create mode 100644 src/testdir/python_after/after.py create mode 100644 src/testdir/python_before/before.py create mode 100644 src/testdir/python_before/before_1.py create mode 100644 src/testdir/python_before/before_2.py create mode 100644 src/testdir/pythonx/failing.py create mode 100644 src/testdir/pythonx/failing_import.py create mode 100644 src/testdir/pythonx/module.py create mode 100644 src/testdir/pythonx/modulex.py create mode 100644 src/testdir/pythonx/topmodule/__init__.py create mode 100644 src/testdir/pythonx/topmodule/submodule/__init__.py create mode 100644 src/testdir/pythonx/topmodule/submodule/subsubmodule/__init__.py create mode 100644 src/testdir/pythonx/topmodule/submodule/subsubmodule/subsubsubmodule.py create mode 100644 src/testdir/test71a.in create mode 100644 src/testdir/test74.in create mode 100644 src/testdir/test74.ok create mode 100644 src/testdir/test75.in create mode 100644 src/testdir/test75.ok create mode 100644 src/testdir/test76.in create mode 100644 src/testdir/test76.ok create mode 100644 src/testdir/test77.in create mode 100644 src/testdir/test77.ok create mode 100644 src/testdir/test78.in create mode 100644 src/testdir/test78.ok create mode 100644 src/testdir/test79.in create mode 100644 src/testdir/test79.ok create mode 100644 src/testdir/test80.in create mode 100644 src/testdir/test80.ok create mode 100644 src/testdir/test81.in create mode 100644 src/testdir/test81.ok create mode 100644 src/testdir/test82.in create mode 100644 src/testdir/test82.ok create mode 100644 src/testdir/test83-tags2 create mode 100644 src/testdir/test83-tags3 create mode 100644 src/testdir/test83.in create mode 100644 src/testdir/test83.ok create mode 100644 src/testdir/test84.in create mode 100644 src/testdir/test84.ok create mode 100644 src/testdir/test85.in create mode 100644 src/testdir/test85.ok create mode 100644 src/testdir/test86.in create mode 100644 src/testdir/test86.ok create mode 100644 src/testdir/test87.in create mode 100644 src/testdir/test87.ok create mode 100644 src/testdir/test88.in create mode 100644 src/testdir/test88.ok create mode 100644 src/testdir/test89.in create mode 100644 src/testdir/test89.ok create mode 100644 src/testdir/test90.in create mode 100644 src/testdir/test90.ok create mode 100644 src/testdir/test91.in create mode 100644 src/testdir/test91.ok create mode 100644 src/testdir/test92.in create mode 100644 src/testdir/test92.ok create mode 100644 src/testdir/test93.in create mode 100644 src/testdir/test93.ok create mode 100644 src/testdir/test94.in create mode 100644 src/testdir/test94.ok create mode 100644 src/testdir/test95.in create mode 100644 src/testdir/test95.ok create mode 100644 src/testdir/test96.in create mode 100644 src/testdir/test96.ok create mode 100644 src/testdir/test97.in create mode 100644 src/testdir/test97.ok create mode 100644 src/testdir/test98.in create mode 100644 src/testdir/test98.ok create mode 100644 src/winclip.c create mode 100644 src/xpm/COPYRIGHT create mode 100644 src/xpm/README.txt create mode 100644 src/xpm/include/simx.h create mode 100644 src/xpm/include/xpm.h create mode 100644 src/xpm/x64/lib/libXpm.a create mode 100644 src/xpm/x64/lib/libXpm.lib create mode 100644 src/xpm/x86/lib/libXpm.a create mode 100644 src/xpm/x86/lib/libXpm.lib create mode 100644 src/xxd/Make_ming.mak diff --git a/Contents b/Contents index eff854a..e34ae25 100644 --- a/Contents +++ b/Contents @@ -9,10 +9,10 @@ Vim Vi IMproved. A clone of the UNIX text editor Vi. Very useful messages, shows current file name in window title, on-line help, rectangular cut/paste, etc., etc., etc... - Version 7.3. Also runs under UNIX, MSDOS and other systems. - vim73rt.tgz contains the documentation and syntax files. - vim73bin.tgz contains the binaries. - vim73src.tgz contains the sources. + Version 7.4. Also runs under UNIX, MSDOS and other systems. + vim74rt.tgz contains the documentation and syntax files. + vim74bin.tgz contains the binaries. + vim74src.tgz contains the sources. Author: Bram Moolenaar et al. diff --git a/Filelist b/Filelist index 549eecc..b324933 100644 --- a/Filelist +++ b/Filelist @@ -39,6 +39,7 @@ SRC_ALL = \ src/mark.c \ src/mbyte.c \ src/memfile.c \ + src/memfile_test.c \ src/memline.c \ src/menu.c \ src/message.c \ @@ -56,6 +57,7 @@ SRC_ALL = \ src/popupmnu.c \ src/quickfix.c \ src/regexp.c \ + src/regexp_nfa.c \ src/regexp.h \ src/screen.c \ src/search.c \ @@ -72,6 +74,7 @@ SRC_ALL = \ src/version.c \ src/version.h \ src/vim.h \ + src/winclip.c \ src/window.c \ src/xxd/xxd.c \ src/main.aap \ @@ -80,6 +83,16 @@ SRC_ALL = \ src/testdir/test[0-9]*.ok \ src/testdir/test49.vim \ src/testdir/test60.vim \ + src/testdir/test83-tags? \ + src/testdir/python2/*.py \ + src/testdir/python3/*.py \ + src/testdir/pythonx/*.py \ + src/testdir/pythonx/topmodule/__init__.py \ + src/testdir/pythonx/topmodule/submodule/__init__.py \ + src/testdir/pythonx/topmodule/submodule/subsubmodule/__init__.py \ + src/testdir/pythonx/topmodule/submodule/subsubmodule/subsubsubmodule.py \ + src/testdir/python_after/*.py \ + src/testdir/python_before/*.py \ src/proto.h \ src/proto/blowfish.pro \ src/proto/buffer.pro \ @@ -128,6 +141,7 @@ SRC_ALL = \ src/proto/ui.pro \ src/proto/undo.pro \ src/proto/version.pro \ + src/proto/winclip.pro \ src/proto/window.pro \ @@ -259,8 +273,10 @@ SRC_DOS = \ src/Make_mvc.mak \ src/Make_w16.mak \ src/bigvim.bat \ + src/bigvim64.bat \ src/msvcsetup.bat \ src/msvc2008.bat \ + src/msvc2010.bat \ src/dimm.idl \ src/dlldata.c \ src/dosinst.c \ @@ -311,6 +327,7 @@ SRC_DOS = \ src/xxd/Make_bc5.mak \ src/xxd/Make_cyg.mak \ src/xxd/Make_djg.mak \ + src/xxd/Make_ming.mak \ src/xxd/Make_mvc.mak \ nsis/gvim.nsi \ nsis/README.txt \ @@ -345,6 +362,13 @@ SRC_DOS_BIN = \ src/vim*.ico \ src/vim.tlb \ src/vimtbar.lib \ + src/xpm/COPYRIGHT \ + src/xpm/README.txt \ + src/xpm/include/*.h \ + src/xpm/x64/lib/libXpm.a \ + src/xpm/x64/lib/libXpm.lib \ + src/xpm/x86/lib/libXpm.a \ + src/xpm/x86/lib/libXpm.lib \ src/vimtbar.dll \ nsis/icons/*.bmp \ nsis/icons/*.ico \ @@ -426,20 +450,14 @@ SRC_EXTRA = \ $(SRC_VMS) \ README_os390.txt \ src/Make_mint.mak \ - src/Make_ro.mak \ - src/gui_riscos.c \ - src/gui_riscos.h \ src/if_sniff.c \ src/infplist.xml \ src/link.390 \ src/os_beos.c \ src/os_beos.h \ src/os_beos.rsrc \ + src/proto/os_beos.pro \ src/os_mint.h \ - src/os_riscos.c \ - src/os_riscos.h \ - src/proto/gui_riscos.pro \ - src/proto/os_riscos.pro \ src/os_vms_fix.com \ src/toolbar.phi \ @@ -466,6 +484,7 @@ RT_ALL = \ runtime/macros/hanoi/hanoi.vim \ runtime/macros/hanoi/poster \ runtime/macros/justify.vim \ + runtime/macros/less.bat \ runtime/macros/less.sh \ runtime/macros/less.vim \ runtime/macros/life/click.me \ @@ -669,10 +688,13 @@ EXTRA = \ # generic language files LANG_GEN = \ + runtime/doc/*-de.1 \ + runtime/doc/*-de.UTF-8.1 \ runtime/doc/*-fr.1 \ runtime/doc/*-fr.UTF-8.1 \ runtime/doc/*-it.1 \ runtime/doc/*-it.UTF-8.1 \ + runtime/doc/*-ja.UTF-8.1 \ runtime/doc/*-pl.1 \ runtime/doc/*-pl.UTF-8.1 \ runtime/doc/*-ru.1 \ @@ -685,7 +707,17 @@ LANG_GEN = \ runtime/tutor/Makefile \ runtime/tutor/tutor.utf-8 \ runtime/tutor/tutor.?? \ - runtime/tutor/tutor.??.* \ + runtime/tutor/tutor.??.utf-8 \ + runtime/tutor/tutor.??.euc \ + runtime/tutor/tutor.??.sjis \ + runtime/tutor/tutor.??.iso9 \ + runtime/tutor/tutor.??.big5 \ + runtime/tutor/tutor.??.cp1250 \ + runtime/tutor/tutor.??.cp1251 \ + runtime/tutor/tutor.??.cp737 \ + runtime/tutor/tutor.??_??.utf-8 \ + runtime/tutor/tutor.bar \ + runtime/tutor/tutor.bar.utf-8 \ runtime/spell/README.txt \ runtime/spell/??/*.diff \ runtime/spell/??/main.aap \ diff --git a/Makefile b/Makefile index bf2b309..3565357 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,9 @@ # has run can result in compiling with $(CC) empty. first: + @if test ! -f src/auto/config.mk; then \ + cp src/config.mk.dist src/auto/config.mk; \ + fi @echo "Starting make in the src directory." @echo "If there are problems, cd to the src directory and run make there" cd src && $(MAKE) $@ @@ -30,6 +33,9 @@ first: # Some make programs use the last target for the $@ default; put the other # targets separately to always let $@ expand to "first" by default. all install uninstall tools config configure reconfig proto depend lint tags types test testclean clean distclean: + @if test ! -f src/auto/config.mk; then \ + cp src/config.mk.dist src/auto/config.mk; \ + fi @echo "Starting make in the src directory." @echo "If there are problems, cd to the src directory and run make there" cd src && $(MAKE) $@ @@ -68,14 +74,17 @@ all install uninstall tools config configure reconfig proto depend lint tags typ # Before creating an archive first delete all backup files, *.orig, etc. MAJOR = 7 -MINOR = 3 +MINOR = 4 # Uncomment this line if the Win32s version is to be included. -DOSBIN_S = dosbin_s +# DOSBIN_S = dosbin_s # Uncomment this line if the 16 bit DOS version is to be included. # DOSBIN_D16 = dosbin_d16 +# Uncomment this line if the 32 bit DOS version is to be included. +# DOSBIN_D32 = dosbin_d32 + # CHECKLIST for creating a new version: # # - Update Vim version number. For a test version in: src/version.h, Contents, @@ -83,8 +92,6 @@ DOSBIN_S = dosbin_s # runtime/doc/*.txt and nsis/gvim.nsi. Other things in README_os2.txt. For a # minor/major version: src/GvimExt/GvimExt.reg, src/vim.def, src/vim16.def, # src/gvim.exe.mnf. -# - Adjust the date and other info in src/version.h. -# - Correct included_patches[] in src/version.c. # - Compile Vim with GTK, Perl, Python, Python3, TCL, Ruby, MZscheme, Lua (if # you can make it all work), Cscope and "huge" features. Exclude workshop # and SNiFF. @@ -93,8 +100,14 @@ DOSBIN_S = dosbin_s # - With these features: "make depend" (works best with gcc). # - If you have a lint program: "make lint" and check the output (ignore GTK # warnings). -# - Enable the efence library in "src/Makefile" and run "make test". Disable -# Python and Ruby to avoid trouble with threads (efence is not threadsafe). +# - If you have valgrind, enable it in src/testdir/Makefile and run "make +# test". Enable EXITFREE, disable GUI, scheme and tcl to avoid false alarms. +# Check the valgrind output. +# - If you have the efence library, enable it in "src/Makefile" and run "make +# test". Disable Python and Ruby to avoid trouble with threads (efence is +# not threadsafe). +# - Adjust the date and other info in src/version.h. +# - Correct included_patches[] in src/version.c. # - Check for missing entries in runtime/makemenu.vim (with checkmenu script). # - Check for missing options in runtime/optwin.vim et al. (with check.vim). # - Do "make menu" to update the runtime/synmenu.vim file. @@ -102,8 +115,8 @@ DOSBIN_S = dosbin_s # - Check that runtime/doc/help.txt doesn't contain entries in "LOCAL # ADDITIONS". # - In runtime/doc run "make" and "make html" to check for errors. -# - Check if src/Makefile and src/feature.h don't contain any personal -# preferences or the GTK, Perl, etc. mentioned above. +# - Check if src/Makefile, src/testdir/Makefile and src/feature.h don't contain +# any personal preferences or the changes mentioned above. # - Check file protections to be "644" for text and "755" for executables (run # the "check" script). # - Check compiling on Amiga, MS-DOS and MS-Windows. @@ -122,36 +135,20 @@ DOSBIN_S = dosbin_s # PC: # - Run make on Unix to update the ".mo" files. # - "make dossrc" and "make dosrt". Unpack the archives on a PC. -# 16 bit DOS version: (OBSOLETE, 16 bit version doesn't build) -# - Set environment for compiling with Borland C++ 3.1. -# - "bmake -f Make_bc3.mak BOR=E:\borlandc" (compiling xxd might fail, in that -# case set environment for compiling with Borland C++ 4.0 and do -# "make -f make_bc3.mak BOR=E:\BC4 xxd/xxd.exe"). -# NOTE: this currently fails because Vim is too big. -# - "make test" and check the output. -# - Rename the executables to "vimd16.exe", "xxdd16.exe", "installd16.exe" and -# "uninstald16.exe". -# 32 bit DOS version: -# - Set environment for compiling with DJGPP; "gmake -f Make_djg.mak". -# - "rm testdir/*.out", "gmake -f Make_djg.mak test" and check the output for -# "ALL DONE". -# - Rename the executables to "vimd32.exe", "xxdd32.exe", "installd32.exe" and -# "uninstald32.exe". # Win32 console version: -# - Set environment for Visual C++ 2008, e.g.: -# "E:\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat". Or, when using the -# Visual C++ Toolkit 2003: "msvcsetup.bat" (adjust the paths when necessary). -# For Windows 98/ME the 2003 version is required, but then it won't work on -# Windows 7 and 64 bit. -# - "nmake -f Make_mvc.mak" +# - Set environment for Visual C++ 2008, e.g.: "msvc2008.bat" Or: +# "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat". +# Or, when using the Visual C++ Toolkit 2003: "msvcsetup.bat" (adjust the +# paths when necessary). +# For Windows 98/ME the 2003 version is required, but then the executable +# won't work on Windows 7 and 64 bit systems. +# - "nmake -f Make_mvc.mak" (use the same path as for vcvars32.bat) # - "rm testdir/*.out", "nmake -f Make_mvc.mak test" and check the output. -# - Rename the executables to "vimw32.exe", "xxdw32.exe". +# - Rename vim.exe to vimw32.exe, xxd/xxd.exe to xxdw32.exe. # - Rename vim.pdb to vimw32.pdb. -# - When building the Win32s version later, delete vimrun.exe, install.exe and -# uninstal.exe. Otherwise rename executables to installw32.exe and -# uninstalw32.exe. +# - Rename install.exe to installw32.exe and uninstal.exe to uninstalw32.exe. # Win32 GUI version: -# - "nmake -f Make_mvc.mak GUI=yes. +# - "nmake -f Make_mvc.mak GUI=yes" # - move "gvim.exe" to here (otherwise the OLE version will overwrite it). # - Move gvim.pdb to here. # - Delete vimrun.exe, install.exe and uninstal.exe. @@ -161,23 +158,13 @@ DOSBIN_S = dosbin_s # - Rename "gvim.exe" to "gvim_ole.exe". # - Rename gvim.pdb to "gvim_ole.pdb". # - Delete install.exe and uninstal.exe. -# - If building the Win32s version delete vimrun.exe. -# Win32s GUI version: -# - Set environment for Visual C++ 4.1 (requires a new console window): -# "vcvars32.bat" (use the path for VC 4.1 e:\msdev\bin) -# - "nmake -f Make_mvc.mak GUI=yes INTL=no clean" (use the path for VC 4.1) -# - "nmake -f Make_mvc.mak GUI=yes INTL=no" (use the path for VC 4.1) -# - Rename "gvim.exe" to "gvim_w32s.exe". -# - Rename "install.exe" to "installw32.exe" -# - Rename "uninstal.exe" to "uninstalw32.exe" -# - The produced uninstalw32.exe and vimrun.exe are used. # Create the archives: # - Copy all the "*.exe" files to where this Makefile is. # - Copy all the "*.pdb" files to where this Makefile is. # - "make dosbin". # NSIS self installing exe: # - To get NSIS see http://nsis.sourceforge.net -# - Make sure gvim_ole.exe, vimd32.exe, vimw32.exe, installw32.exe, +# - Make sure gvim_ole.exe, vimw32.exe, installw32.exe, # uninstalw32.exe and xxdw32.exe have been build as mentioned above. # - copy these files (get them from a binary archive or build them): # gvimext.dll in src/GvimExt @@ -190,7 +177,44 @@ DOSBIN_S = dosbin_s # - go to ../nsis and do "makensis gvim.nsi" (takes a few minutes). # - Copy gvim##.exe to the dist directory. # -# OS/2: (OBSOLETE, OS/2 version is no longer distributed) +# 64 bit builds (these are not in the normal distribution, the 32 bit build +# works just fine on 64 bit systems). +# Like the console and GUI version, but first run vcvars64.bat or +# "..\VC\vcvarsall.bat x86_amd64". +# - "nmake -f Make_mvc.mak" +# - "nmake -f Make_mvc.mak GUI=yes" +# Or run src/bigvim64.bat for an OLE version. +# +# OBSOLETE systems: You can build this if you have an appropriate system. +# +# 16 bit DOS version: (doesn't build anywhere) +# - Set environment for compiling with Borland C++ 3.1. +# - "bmake -f Make_bc3.mak BOR=E:\borlandc" (compiling xxd might fail, in that +# case set environment for compiling with Borland C++ 4.0 and do +# "make -f make_bc3.mak BOR=E:\BC4 xxd/xxd.exe"). +# NOTE: this currently fails because Vim is too big. +# - "make test" and check the output. +# - Rename the executables to "vimd16.exe", "xxdd16.exe", "installd16.exe" and +# "uninstald16.exe". +# +# 32 bit DOS version: (requires Windows XP or earlier) +# - Set environment for compiling with DJGPP; "gmake -f Make_djg.mak". +# - "rm testdir/*.out", "gmake -f Make_djg.mak test" and check the output for +# "ALL DONE". +# - Rename the executables to "vimd32.exe", "xxdd32.exe", "installd32.exe" and +# "uninstald32.exe". +# +# Win32s GUI version: (requires very old compiler) +# - Set environment for Visual C++ 4.1 (requires a new console window): +# "vcvars32.bat" (use the path for VC 4.1 e:\msdev\bin) +# - "nmake -f Make_mvc.mak GUI=yes INTL=no clean" (use the path for VC 4.1) +# - "nmake -f Make_mvc.mak GUI=yes INTL=no" (use the path for VC 4.1) +# - Rename "gvim.exe" to "gvim_w32s.exe". +# - Rename "install.exe" to "installw32.exe" +# - Rename "uninstal.exe" to "uninstalw32.exe" +# - The produced uninstalw32.exe and vimrun.exe are used. +# +# OS/2: (requires an OS/2 system) # - Unpack the Unix archive. # - "make -f Make_os2.mak". # - Rename the executables to vimos2.exe, xxdos2.exe and teeos2.exe and copy @@ -289,6 +313,8 @@ unixall: dist prepare $(LANG_SRC) \ | (cd dist/$(VIMRTDIR); tar xf -) # Need to use a "distclean" config.mk file +# Note: this file is not included in the repository to avoid problems, but it's +# OK to put it in the archive. cp -f src/config.mk.dist dist/$(VIMRTDIR)/src/auto/config.mk # Create an empty config.h file, make dependencies require it touch dist/$(VIMRTDIR)/src/auto/config.h @@ -444,7 +470,7 @@ runtime_unix2dos: dosrt_unix2dos cd dist/vim/$(VIMRTDIR); tar cf - * \ | (cd ../../../runtime/dos; tar xf -) -dosbin: prepare dosbin_gvim dosbin_w32 dosbin_d32 dosbin_ole $(DOSBIN_S) $(DOSBIN_D16) +dosbin: prepare dosbin_gvim dosbin_w32 $(DOSBIN_D32) dosbin_ole $(DOSBIN_S) $(DOSBIN_D16) # make Win32 gvim dosbin_gvim: dist no_title.vim dist/$(COMMENT_GVIM) diff --git a/README.txt b/README.txt index cf462db..c2fc2a9 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -README.txt for version 7.3 of Vim: Vi IMproved. +README.txt for version 7.4 of Vim: Vi IMproved. WHAT IS VIM @@ -97,10 +97,12 @@ The latest news about Vim can be found on the Vim home page: If you have problems, have a look at the Vim FAQ: http://vimdoc.sf.net/vimfaq.html -Send bug reports to: - Bram Moolenaar +If you still have problems or any other questions, use one of the mailing +lists to discuss them with Vim users and developers: + http://www.vim.org/maillist.php -There are several mailing lists for Vim, see http://www.vim.org/maillist.php. +If nothing else works, report bugs directly: + Bram Moolenaar MAIN AUTHOR diff --git a/README_ami.txt b/README_ami.txt index bfc5cc8..03cb6e2 100644 --- a/README_ami.txt +++ b/README_ami.txt @@ -1,4 +1,4 @@ -README_ami.txt for version 7.3 of Vim: Vi IMproved. +README_ami.txt for version 7.4 of Vim: Vi IMproved. This file explains the installation of Vim on Amiga systems. See README.txt for general information about Vim. diff --git a/README_amibin.txt b/README_amibin.txt index b1ca624..fbf5ba4 100644 --- a/README_amibin.txt +++ b/README_amibin.txt @@ -1,4 +1,4 @@ -README_amibin.txt for version 7.3 of Vim: Vi IMproved. +README_amibin.txt for version 7.4 of Vim: Vi IMproved. See "README.txt" for general information about Vim. See "README_ami.txt" for installation instructions for the Amiga. diff --git a/README_amisrc.txt b/README_amisrc.txt index 1a787fb..ddc58be 100644 --- a/README_amisrc.txt +++ b/README_amisrc.txt @@ -1,4 +1,4 @@ -README_amisrc.txt for version 7.3 of Vim: Vi IMproved. +README_amisrc.txt for version 7.4 of Vim: Vi IMproved. See "README.txt" for general information about Vim. See "README_ami.txt" for installation instructions for the Amiga. diff --git a/README_bindos.txt b/README_bindos.txt index db49d50..03c7c19 100644 --- a/README_bindos.txt +++ b/README_bindos.txt @@ -1,19 +1,16 @@ -README_bindos.txt for version 7.3 of Vim: Vi IMproved. +README_bindos.txt for version 7.4 of Vim: Vi IMproved. See "README.txt" for general information about Vim. See "README_dos.txt" for installation instructions for MS-DOS and MS-Windows. -These files are in the runtime archive (vim73rt.zip). +These files are in the runtime archive (vim74rt.zip). There are several binary distributions of Vim for the PC. You would normally pick only one of them, but it's also possible to install several. These ones are available (the version number may differ): - vim73d16.zip 16 bit DOS version - vim73d32.zip 32 bit DOS version - vim73w32.zip Windows 95/98/NT/etc. console version - gvim73.zip Windows 95/98/NT/etc. GUI version - gvim73ole.zip Windows 95/98/NT/etc. GUI version with OLE - gvim73_s.zip Windows 3.1 GUI version + vim74w32.zip Windows 95/98/NT/etc. console version + gvim74.zip Windows 95/98/NT/etc. GUI version + gvim74ole.zip Windows 95/98/NT/etc. GUI version with OLE -You MUST also get the runtime archive (vim73rt.zip). -The sources are also available (vim73src.zip). +You MUST also get the runtime archive (vim74rt.zip). +The sources are also available (vim74src.zip). diff --git a/README_dos.txt b/README_dos.txt index ca735f1..662a7e7 100644 --- a/README_dos.txt +++ b/README_dos.txt @@ -1,4 +1,4 @@ -README_dos.txt for version 7.3 of Vim: Vi IMproved. +README_dos.txt for version 7.4 of Vim: Vi IMproved. This file explains the installation of Vim on MS-DOS and MS-Windows systems. See "README.txt" for general information about Vim. @@ -47,13 +47,13 @@ These are the normal steps to install Vim from the .zip archives: Binary and runtime Vim archives are normally unpacked in the same location, on top of each other. -2. Unpack the zip archives. This will create a new directory "vim\vim73", +2. Unpack the zip archives. This will create a new directory "vim\vim74", in which all the distributed Vim files are placed. Since the directory name includes the version number, it is unlikely that you overwrite existing files. Examples: - pkunzip -d gvim73.zip - unzip vim73w32.zip + pkunzip -d gvim74.zip + unzip vim74w32.zip You need to unpack the runtime archive and at least one of the binary archives. When using more than one binary version, be careful not to @@ -69,7 +69,7 @@ These are the normal steps to install Vim from the .zip archives: archive and follow the instructions in the documentation. 3. Change to the new directory: - cd vim\vim73 + cd vim\vim74 Run the "install.exe" program. It will ask you a number of questions about how you would like to have your Vim setup. Among these are: - You can tell it to write a "_vimrc" file with your preferences in the @@ -80,8 +80,8 @@ These are the normal steps to install Vim from the .zip archives: console or in a shell. You can select one of the directories in your $PATH. If you skip this, you can add Vim to the search path manually: The simplest is to add a line to your autoexec.bat. Examples: - set path=%path%;C:\vim\vim73 - set path=%path%;D:\editors\vim\vim73 + set path=%path%;C:\vim\vim74 + set path=%path%;D:\editors\vim\vim74 - Create entries for Vim on the desktop and in the Start menu. That's it! @@ -93,8 +93,8 @@ Remarks: won't show a menubar. Then you need to set the $VIM environment variable to point to the top directory of your Vim files. Example: set VIM=C:\editors\vim - Vim version 7.3 will look for your vimrc file in $VIM, and for the runtime - files in $VIM/vim73. See ":help $VIM" for more information. + Vim version 7.4 will look for your vimrc file in $VIM, and for the runtime + files in $VIM/vim74. See ":help $VIM" for more information. - To avoid confusion between distributed files of different versions and your own modified vim scripts, it is recommended to use this directory layout: @@ -105,14 +105,14 @@ Remarks: C:\vim\vimfiles\ftplugin\*.vim Filetype plugins C:\vim\... Other files you made. Distributed files: - C:\vim\vim73\vim.exe The Vim version 7.3 executable. - C:\vim\vim73\doc\*.txt The version 7.3 documentation files. - C:\vim\vim73\bugreport.vim A Vim version 7.3 script. - C:\vim\vim73\... Other version 7.3 distributed files. + C:\vim\vim74\vim.exe The Vim version 7.4 executable. + C:\vim\vim74\doc\*.txt The version 7.4 documentation files. + C:\vim\vim74\bugreport.vim A Vim version 7.4 script. + C:\vim\vim74\... Other version 7.4 distributed files. In this case the $VIM environment variable would be set like this: set VIM=C:\vim - Then $VIMRUNTIME will automatically be set to "$VIM\vim73". Don't add - "vim73" to $VIM, that won't work. + Then $VIMRUNTIME will automatically be set to "$VIM\vim74". Don't add + "vim74" to $VIM, that won't work. - You can put your Vim executable anywhere else. If the executable is not with the other Vim files, you should set $VIM. The simplest is to add a line @@ -136,8 +136,8 @@ Remarks: Select Properties. 5. In the Program tab, change the "Cmdline" to add "/c" and the name of the Vim executable. Examples: - C:\command.com /c C:\vim\vim73\vim.exe - C:\command.com /c D:\editors\vim\vim73\vim.exe + C:\command.com /c C:\vim\vim74\vim.exe + C:\command.com /c D:\editors\vim\vim74\vim.exe 6. Select the font, window size, etc. that you like. If this isn't possible, select "Advanced" in the Program tab, and deselect "MS-DOS mode". diff --git a/README_extra.txt b/README_extra.txt index 68eebef..e496912 100644 --- a/README_extra.txt +++ b/README_extra.txt @@ -1,4 +1,4 @@ -README_extra.txt for version 7.3 of Vim: Vi IMproved. +README_extra.txt for version 7.4 of Vim: Vi IMproved. These extra files of Vim are for special purposes. This README explains what the files are for. For general information about Vim, see the "README.txt" @@ -13,9 +13,6 @@ src/if_sniff.* Interface to SNiFF. If you don't know what SNiFF is, src/os_amiga.* Files for the Amiga port. -src/gui_riscos.* -src/os_riscos.* Files for the RISC OS port. - src/gui_beos.* src/os_beos.* Files for the BeOS port. diff --git a/README_mac.txt b/README_mac.txt index 4dcebf6..08888d9 100644 --- a/README_mac.txt +++ b/README_mac.txt @@ -1,4 +1,4 @@ -README_mac.txt for version 7.3 of Vim: Vi IMproved. +README_mac.txt for version 7.4 of Vim: Vi IMproved. This file explains the installation of Vim on Macintosh systems. See "README.txt" for general information about Vim. diff --git a/README_ole.txt b/README_ole.txt index d7e70af..233c053 100644 --- a/README_ole.txt +++ b/README_ole.txt @@ -1,4 +1,4 @@ -README_ole.txt for version 7.3 of Vim: Vi IMproved. +README_ole.txt for version 7.4 of Vim: Vi IMproved. This archive contains gvim.exe with OLE interface and VisVim. This version of gvim.exe can also load a number of interface dynamically (you diff --git a/README_os2.txt b/README_os2.txt index 866c7a0..5602706 100644 --- a/README_os2.txt +++ b/README_os2.txt @@ -1,32 +1,32 @@ -README_os2.txt for version 7.3 of Vim: Vi IMproved. +README_os2.txt for version 7.4 of Vim: Vi IMproved. This file explains the installation of Vim on OS/2 systems. See "README.txt" for general information about Vim. NOTE: You will need two archives: - vim73rt.zip contains the runtime files (same as for the PC version) - vim73os2.zip contains the OS/2 executables + vim74rt.zip contains the runtime files (same as for the PC version) + vim74os2.zip contains the OS/2 executables 1. Go to the directory where you want to put the Vim files. Examples: cd C:\ cd D:\editors -2. Unpack the zip archives. This will create a new directory "vim/vim73", +2. Unpack the zip archives. This will create a new directory "vim/vim74", in which all the distributed Vim files are placed. Since the directory name includes the version number, it is unlikely that you overwrite existing files. Examples: - pkunzip -d vim73os2.zip - unzip vim73os2.zip + pkunzip -d vim74os2.zip + unzip vim74os2.zip After you unpacked the files, you can still move the whole directory tree to another location. 3. Add the directory where vim.exe is to your path. The simplest is to add a line to your autoexec.bat. Examples: - set path=%path%;C:\vim\vim73 - set path=%path%;D:\editors\vim\vim73 + set path=%path%;C:\vim\vim74 + set path=%path%;D:\editors\vim\vim74 That's it! @@ -41,10 +41,10 @@ Extra remarks: C:\vim\_viminfo Dynamic info for 'viminfo'. C:\vim\... Other files you made. Distributed files: - C:\vim\vim73\vim.exe The Vim version 7.3 executable. - C:\vim\vim73\doc\*.txt The version 7.3 documentation files. - C:\vim\vim73\bugreport.vim A Vim version 7.3 script. - C:\vim\vim73\... Other version 7.3 distributed files. + C:\vim\vim74\vim.exe The Vim version 7.4 executable. + C:\vim\vim74\doc\*.txt The version 7.4 documentation files. + C:\vim\vim74\bugreport.vim A Vim version 7.4 script. + C:\vim\vim74\... Other version 7.4 distributed files. In this case the $VIM environment variable would be set like this: set VIM=C:\vim diff --git a/README_os390.txt b/README_os390.txt index 17abc59..502b6f8 100644 --- a/README_os390.txt +++ b/README_os390.txt @@ -1,4 +1,4 @@ -README_zOS.txt for version 7.3 of Vim: Vi IMproved. +README_zOS.txt for version 7.4 of Vim: Vi IMproved. This readme explains how to build Vim on z/OS. Formerly called OS/390. See "README.txt" for general information about Vim. @@ -29,7 +29,7 @@ console version). Compiling: ========== -Vim can be compiled with or without GUI support. For 7.3 only the compilation +Vim can be compiled with or without GUI support. For 7.4 only the compilation without GUI was tested. Below is a section about compiling with X11 but this is from an earlier version of Vim. @@ -78,7 +78,7 @@ Change to the vim directory and do: With X11: --------- -WARNING: This instruction was not tested with Vim 7.3. +WARNING: This instruction was not tested with Vim 7.4. There are two ways for building VIM with X11 support. The first way is simple and results in a big executable (~13 Mb), the second needs a few additional diff --git a/README_src.txt b/README_src.txt index c2ccdc0..3af95f2 100644 --- a/README_src.txt +++ b/README_src.txt @@ -1,10 +1,8 @@ -README_src.txt for version 7.3 of Vim: Vi IMproved. +README_src.txt for version 7.4 of Vim: Vi IMproved. The source archive contains the files needed to compile Vim on Unix systems. -It is packed for Unix systems (NL line separator). It is also used for other -systems in combination with the extra archive (vim-7.3-extra.tar.gz, in the -"extra" directory of ftp.vim.org). +It is packed for Unix systems (NL line separator). For more information, see the README.txt file that comes with the runtime -archive (vim-7.3-rt.tar.gz). To be able to run Vim you MUST get the runtime +archive (vim-7.4-rt.tar.gz). To be able to run Vim you MUST get the runtime archive too! diff --git a/README_srcdos.txt b/README_srcdos.txt index 1ce563c..1b7cbcf 100644 --- a/README_srcdos.txt +++ b/README_srcdos.txt @@ -1,8 +1,8 @@ -README_srcdos.txt for version 7.3 of Vim: Vi IMproved. +README_srcdos.txt for version 7.4 of Vim: Vi IMproved. See "README.txt" for general information about Vim. See "README_dos.txt" for installation instructions for MS-DOS and MS-Windows. -These files are in the runtime archive (vim73rt.zip). +These files are in the runtime archive (vim74rt.zip). The DOS source archive contains the files needed to compile Vim on MS-DOS or diff --git a/README_unix.txt b/README_unix.txt index 5c1e79b..7aff642 100644 --- a/README_unix.txt +++ b/README_unix.txt @@ -1,4 +1,4 @@ -README_unix.txt for version 7.3 of Vim: Vi IMproved. +README_unix.txt for version 7.4 of Vim: Vi IMproved. This file explains the installation of Vim on Unix systems. See "README.txt" for general information about Vim. diff --git a/README_vms.txt b/README_vms.txt index 5acc92c..53364a1 100644 --- a/README_vms.txt +++ b/README_vms.txt @@ -1,4 +1,4 @@ -README_vms.txt for version 7.3 of Vim: Vi IMproved. +README_vms.txt for version 7.4 of Vim: Vi IMproved. This file explains the installation of Vim on VMS systems. See "README.txt" in the runtime archive for information about Vim. diff --git a/README_w32s.txt b/README_w32s.txt index 3595b18..0b5d1ae 100644 --- a/README_w32s.txt +++ b/README_w32s.txt @@ -1,4 +1,4 @@ -README_w32s.txt for version 7.3 of Vim: Vi IMproved. +README_w32s.txt for version 7.4 of Vim: Vi IMproved. This archive contains the gvim.exe that was specifically compiled for use in the Win32s subsystem in MS-Windows 3.1 and 3.11. diff --git a/nsis/gvim.nsi b/nsis/gvim.nsi index a2940eb..7b69e7d 100644 --- a/nsis/gvim.nsi +++ b/nsis/gvim.nsi @@ -5,7 +5,7 @@ # WARNING: if you make changes to this script, look out for $0 to be valid, # because uninstall deletes most files in $0. -# Location of gvim_ole.exe, vimd32.exe, GvimExt/*, etc. +# Location of gvim_ole.exe, vimw32.exe, GvimExt/*, etc. !define VIMSRC "..\src" # Location of runtime files @@ -22,7 +22,7 @@ !define HAVE_NLS !define VER_MAJOR 7 -!define VER_MINOR 3 +!define VER_MINOR 4 # ----------- No configurable settings below this line ----------- @@ -40,7 +40,7 @@ RequestExecutionLevel highest ComponentText "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer." DirText "Choose a directory to install Vim (must end in 'vim')" Icon icons\vim_16c.ico -# NSIS2 uses a different strategy with six diferent images in a strip... +# NSIS2 uses a different strategy with six different images in a strip... #EnabledBitmap icons\enabled.bmp #DisabledBitmap icons\disabled.bmp UninstallText "This will uninstall Vim ${VER_MAJOR}.${VER_MINOR} from your system." @@ -56,6 +56,9 @@ LicenseData ${VIMRT}\doc\uganda.nsis.txt !packhdr temp.dat "upx --best --compress-icons=1 temp.dat" !endif +SetCompressor /SOLID lzma +XPStyle on + # This adds '\vim' to the user choice automagically. The actual value is # obtained below with ReadINIStr. InstallDir "$PROGRAMFILES\Vim" @@ -247,11 +250,10 @@ Section "Vim console program (vim.exe)" ReadRegStr $R0 HKLM \ "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion IfErrors 0 lbl_winnt - # Windows 95/98/ME - File /oname=vim.exe ${VIMSRC}\vimd32.exe + # Windows 95/98/ME: not supported Goto lbl_done lbl_winnt: - # Windows NT/2000/XT + # Windows NT/2000/XP and later File /oname=vim.exe ${VIMSRC}\vimw32.exe lbl_done: StrCpy $2 "$2 vim view vimdiff" diff --git a/runtime/autoload/ada.vim b/runtime/autoload/ada.vim index 8f525f4..1f8234a 100644 --- a/runtime/autoload/ada.vim +++ b/runtime/autoload/ada.vim @@ -29,6 +29,8 @@ if version < 700 finish endif +let s:keepcpo= &cpo +set cpo&vim " Section: Constants {{{1 " @@ -619,6 +621,9 @@ lockvar g:ada#Comment lockvar! g:ada#Keywords lockvar! g:ada#Ctags_Kinds +let &cpo = s:keepcpo +unlet s:keepcpo + finish " 1}}} "------------------------------------------------------------------------------ diff --git a/runtime/autoload/ccomplete.vim b/runtime/autoload/ccomplete.vim index 12fc92d..d5bfa07 100644 --- a/runtime/autoload/ccomplete.vim +++ b/runtime/autoload/ccomplete.vim @@ -1,8 +1,10 @@ " Vim completion script " Language: C " Maintainer: Bram Moolenaar -" Last Change: 2010 Mar 23 +" Last Change: 2012 Jun 20 +let s:cpo_save = &cpo +set cpo&vim " This function is used for the 'omnifunc' option. function! ccomplete#Complete(findstart, base) @@ -498,7 +500,7 @@ function! s:StructMembers(typename, items, all) endif if !cached while 1 - exe 'silent! ' . n . 'vimgrep /\t' . typename . '\(\t\|$\)/j ' . fnames + exe 'silent! keepj noautocmd ' . n . 'vimgrep /\t' . typename . '\(\t\|$\)/j ' . fnames let qflist = getqflist() if len(qflist) > 0 || match(typename, "::") < 0 @@ -603,3 +605,6 @@ function! s:SearchMembers(matches, items, all) endfor return res endfunc + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/autoload/clojurecomplete.vim b/runtime/autoload/clojurecomplete.vim new file mode 100644 index 0000000..704ea07 --- /dev/null +++ b/runtime/autoload/clojurecomplete.vim @@ -0,0 +1,20 @@ +" Vim completion script +" Language: Clojure +" Maintainer: Sung Pae +" URL: https://github.com/guns/vim-clojure-static +" License: Same as Vim +" Last Change: 05 February 2013 + +" Special forms and public vars in clojure.core +" Generated from https://github.com/guns/vim-clojure-static/blob/vim-release-002/vim_clojure_static.clj +" Clojure 1.5.0-RC6 +let s:words = ["*","*'","*1","*2","*3","*agent*","*allow-unresolved-vars*","*assert*","*clojure-version*","*command-line-args*","*compile-files*","*compile-path*","*compiler-options*","*data-readers*","*default-data-reader-fn*","*e","*err*","*file*","*flush-on-newline*","*fn-loader*","*in*","*math-context*","*ns*","*out*","*print-dup*","*print-length*","*print-level*","*print-meta*","*print-readably*","*read-eval*","*read-whitelist*","*source-path*","*unchecked-math*","*use-context-classloader*","*verbose-defrecords*","*warn-on-reflection*","+","+'","-","-'","->","->>","->ArrayChunk","->Vec","->VecNode","->VecSeq","-cache-protocol-fn","-reset-methods",".","..","/","<","<=","=","==",">",">=","EMPTY-NODE","accessor","aclone","add-classpath","add-watch","agent","agent-error","agent-errors","aget","alength","alias","all-ns","alter","alter-meta!","alter-var-root","amap","ancestors","and","apply","areduce","array-map","as->","aset","aset-boolean","aset-byte","aset-char","aset-double","aset-float","aset-int","aset-long","aset-short","assert","assoc!","assoc","assoc-in","associative?","atom","await","await-for","await1","bases","bean","bigdec","bigint","biginteger","binding","bit-and","bit-and-not","bit-clear","bit-flip","bit-not","bit-or","bit-set","bit-shift-left","bit-shift-right","bit-test","bit-xor","boolean","boolean-array","booleans","bound-fn","bound-fn*","bound?","butlast","byte","byte-array","bytes","case","cast","catch","char","char-array","char-escape-string","char-name-string","char?","chars","chunk","chunk-append","chunk-buffer","chunk-cons","chunk-first","chunk-next","chunk-rest","chunked-seq?","class","class?","clear-agent-errors","clojure-version","coll?","comment","commute","comp","comparator","compare","compare-and-set!","compile","complement","concat","cond","cond->","cond->>","condp","conj!","conj","cons","constantly","construct-proxy","contains?","count","counted?","create-ns","create-struct","cycle","dec","dec'","decimal?","declare","def","default-data-readers","definline","definterface","defmacro","defmethod","defmulti","defn","defn-","defonce","defprotocol","defrecord","defstruct","deftype","delay","delay?","deliver","denominator","deref","derive","descendants","destructure","disj!","disj","dissoc!","dissoc","distinct","distinct?","do","doall","dorun","doseq","dosync","dotimes","doto","double","double-array","doubles","drop","drop-last","drop-while","empty","empty?","ensure","enumeration-seq","error-handler","error-mode","eval","even?","every-pred","every?","ex-data","ex-info","extend","extend-protocol","extend-type","extenders","extends?","false?","ffirst","file-seq","filter","filterv","finally","find","find-keyword","find-ns","find-protocol-impl","find-protocol-method","find-var","first","flatten","float","float-array","float?","floats","flush","fn","fn","fn?","fnext","fnil","for","force","format","frequencies","future","future-call","future-cancel","future-cancelled?","future-done?","future?","gen-class","gen-interface","gensym","get","get-in","get-method","get-proxy-class","get-thread-bindings","get-validator","group-by","hash","hash-combine","hash-map","hash-set","identical?","identity","if","if-let","if-not","ifn?","import","in-ns","inc","inc'","init-proxy","instance?","int","int-array","integer?","interleave","intern","interpose","into","into-array","ints","io!","isa?","iterate","iterator-seq","juxt","keep","keep-indexed","key","keys","keyword","keyword?","last","lazy-cat","lazy-seq","let","let","letfn","line-seq","list","list*","list?","load","load-file","load-reader","load-string","loaded-libs","locking","long","long-array","longs","loop","loop","macroexpand","macroexpand-1","make-array","make-hierarchy","map","map-indexed","map?","mapcat","mapv","max","max-key","memfn","memoize","merge","merge-with","meta","method-sig","methods","min","min-key","mod","monitor-enter","monitor-exit","munge","name","namespace","namespace-munge","neg?","new","newline","next","nfirst","nil?","nnext","not","not-any?","not-empty","not-every?","not=","ns","ns-aliases","ns-imports","ns-interns","ns-map","ns-name","ns-publics","ns-refers","ns-resolve","ns-unalias","ns-unmap","nth","nthnext","nthrest","num","number?","numerator","object-array","odd?","or","parents","partial","partition","partition-all","partition-by","pcalls","peek","persistent!","pmap","pop!","pop","pop-thread-bindings","pos?","pr","pr-str","prefer-method","prefers","primitives-classnames","print","print-ctor","print-dup","print-method","print-simple","print-str","printf","println","println-str","prn","prn-str","promise","proxy","proxy-call-with-super","proxy-mappings","proxy-name","proxy-super","push-thread-bindings","pvalues","quot","quote","rand","rand-int","rand-nth","range","ratio?","rational?","rationalize","re-find","re-groups","re-matcher","re-matches","re-pattern","re-seq","read","read-line","read-string","realized?","recur","reduce","reduce-kv","reduced","reduced?","reductions","ref","ref-history-count","ref-max-history","ref-min-history","ref-set","refer","refer-clojure","reify","release-pending-sends","rem","remove","remove-all-methods","remove-method","remove-ns","remove-watch","repeat","repeatedly","replace","replicate","require","reset!","reset-meta!","resolve","rest","restart-agent","resultset-seq","reverse","reversible?","rseq","rsubseq","satisfies?","second","select-keys","send","send-off","send-via","seq","seq?","seque","sequence","sequential?","set!","set","set-agent-send-executor!","set-agent-send-off-executor!","set-error-handler!","set-error-mode!","set-validator!","set?","short","short-array","shorts","shuffle","shutdown-agents","slurp","some","some->","some->>","some-fn","sort","sort-by","sorted-map","sorted-map-by","sorted-set","sorted-set-by","sorted?","special-symbol?","spit","split-at","split-with","str","string?","struct","struct-map","subs","subseq","subvec","supers","swap!","symbol","symbol?","sync","take","take-last","take-nth","take-while","test","the-ns","thread-bound?","throw","time","to-array","to-array-2d","trampoline","transient","tree-seq","true?","try","type","unchecked-add","unchecked-add-int","unchecked-byte","unchecked-char","unchecked-dec","unchecked-dec-int","unchecked-divide-int","unchecked-double","unchecked-float","unchecked-inc","unchecked-inc-int","unchecked-int","unchecked-long","unchecked-multiply","unchecked-multiply-int","unchecked-negate","unchecked-negate-int","unchecked-remainder-int","unchecked-short","unchecked-subtract","unchecked-subtract-int","underive","unquote","unquote-splicing","update-in","update-proxy","use","val","vals","var","var-get","var-set","var?","vary-meta","vec","vector","vector-of","vector?","when","when-first","when-let","when-not","while","with-bindings","with-bindings*","with-in-str","with-loading-context","with-local-vars","with-meta","with-open","with-out-str","with-precision","with-redefs","with-redefs-fn","xml-seq","zero?","zipmap"] + +" Simple word completion omnifunc +function! clojurecomplete#Complete(findstart, base) + if a:findstart + return searchpos('\<', 'bnW', line('.'))[1] - 1 + else + return { 'words': filter(copy(s:words), 'v:val =~ "\\V\\^' . a:base . '"') } + endif +endfunction diff --git a/runtime/autoload/getscript.vim b/runtime/autoload/getscript.vim index 6e01976..6b74d37 100644 --- a/runtime/autoload/getscript.vim +++ b/runtime/autoload/getscript.vim @@ -1,8 +1,8 @@ " --------------------------------------------------------------------- " getscript.vim -" Author: Charles E. Campbell, Jr. -" Date: Dec 28, 2009 -" Version: 32 +" Author: Charles E. Campbell +" Date: Apr 17, 2013 +" Version: 35 " Installing: :help glvs-install " Usage: :help glvs " @@ -15,7 +15,7 @@ if exists("g:loaded_getscript") finish endif -let g:loaded_getscript= "v32" +let g:loaded_getscript= "v35" if &cp echoerr "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)" finish @@ -74,6 +74,11 @@ if !exists("g:GetLatestVimScripts_allowautoinstall") let g:GetLatestVimScripts_allowautoinstall= 1 endif +" set up default scriptaddr address +if !exists("g:GetLatestVimScripts_scriptaddr") + let g:GetLatestVimScripts_scriptaddr = 'http://vim.sourceforge.net/script.php?script_id=' +endif + "" For debugging: "let g:GetLatestVimScripts_wget = "echo" "let g:GetLatestVimScripts_options = "options" @@ -314,7 +319,7 @@ fun! getscript#GetLatestVimScripts() if &mod silent! w! endif - q + q! " restore events and current directory exe "cd ".fnameescape(substitute(origdir,'\','/','ge')) @@ -415,7 +420,7 @@ fun! s:GetOneScript(...) echo 'considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid " grab a copy of the plugin's vim.sourceforge.net webpage - let scriptaddr = 'http://vim.sourceforge.net/script.php?script_id='.scriptid + let scriptaddr = g:GetLatestVimScripts_scriptaddr.scriptid let tmpfile = tempname() let v:errmsg = "" @@ -519,6 +524,7 @@ fun! s:GetOneScript(...) " -------------------------------------------------------------------------- " AutoInstall: only if doautoinstall has been requested by the plugin itself " -------------------------------------------------------------------------- +" call Decho("checking if plugin requested autoinstall: doautoinstall=".doautoinstall) if doautoinstall " call Decho(" ") " call Decho("Autoinstall: getcwd<".getcwd()."> filereadable(".sname.")=".filereadable(sname)) @@ -526,7 +532,7 @@ fun! s:GetOneScript(...) " call Decho("<".sname."> is readable") " call Decho("exe silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".shellescape(s:autoinstall)) exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".shellescape(s:autoinstall) - let curdir = escape(substitute(getcwd(),'\','/','ge'),"|[]*'\" #") + let curdir = fnameescape(substitute(getcwd(),'\','/','ge')) let installdir= curdir."/Installed" if !isdirectory(installdir) call mkdir(installdir) @@ -549,25 +555,42 @@ fun! s:GetOneScript(...) " decompress if sname =~ '\.bz2$' " call Decho("decompress: attempt to bunzip2 ".sname) - exe "silent !bunzip2 ".shellescape(sname) + exe "sil !bunzip2 ".shellescape(sname) let sname= substitute(sname,'\.bz2$','','') " call Decho("decompress: new sname<".sname."> after bunzip2") elseif sname =~ '\.gz$' " call Decho("decompress: attempt to gunzip ".sname) - exe "silent !gunzip ".shellescape(sname) + exe "sil !gunzip ".shellescape(sname) let sname= substitute(sname,'\.gz$','','') " call Decho("decompress: new sname<".sname."> after gunzip") + elseif sname =~ '\.xz$' +" call Decho("decompress: attempt to unxz ".sname) + exe "sil !unxz ".shellescape(sname) + let sname= substitute(sname,'\.xz$','','') +" call Decho("decompress: new sname<".sname."> after unxz") else " call Decho("no decompression needed") endif - " distribute archive(.zip, .tar, .vba) contents + " distribute archive(.zip, .tar, .vba, ...) contents if sname =~ '\.zip$' " call Decho("dearchive: attempt to unzip ".sname) exe "silent !unzip -o ".shellescape(sname) elseif sname =~ '\.tar$' " call Decho("dearchive: attempt to untar ".sname) exe "silent !tar -xvf ".shellescape(sname) + elseif sname =~ '\.tgz$' +" call Decho("dearchive: attempt to untar+gunzip ".sname) + exe "silent !tar -zxvf ".shellescape(sname) + elseif sname =~ '\.taz$' +" call Decho("dearchive: attempt to untar+uncompress ".sname) + exe "silent !tar -Zxvf ".shellescape(sname) + elseif sname =~ '\.tbz$' +" call Decho("dearchive: attempt to untar+bunzip2 ".sname) + exe "silent !tar -jxvf ".shellescape(sname) + elseif sname =~ '\.txz$' +" call Decho("dearchive: attempt to untar+xz ".sname) + exe "silent !tar -Jxvf ".shellescape(sname) elseif sname =~ '\.vba$' " call Decho("dearchive: attempt to handle a vimball: ".sname) silent 1split diff --git a/runtime/autoload/htmlcomplete.vim b/runtime/autoload/htmlcomplete.vim index 5420321..b2f1aee 100644 --- a/runtime/autoload/htmlcomplete.vim +++ b/runtime/autoload/htmlcomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: HTML and XHTML " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) -" Last Change: 2006 Oct 19 +" Last Change: 2011 Apr 28 function! htmlcomplete#CompleteTags(findstart, base) if a:findstart @@ -285,6 +285,7 @@ function! htmlcomplete#CompleteTags(findstart, base) let cssfiles = styletable + secimportfiles let classes = [] for file in cssfiles + let classlines = [] if filereadable(file) let stylesheet = readfile(file) let stylefile = join(stylesheet, ' ') diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index 6d1c37f..b077bb7 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -1,10 +1,10 @@ " netrw.vim: Handles file transfer and remote directory listing across " AUTOLOAD SECTION -" Date: Jul 27, 2010 -" Version: 140 -" Maintainer: Charles E Campbell, Jr +" Date: May 18, 2013 +" Version: 149 +" Maintainer: Charles E Campbell " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim -" Copyright: Copyright (C) 1999-2010 Charles E. Campbell, Jr. {{{1 +" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1 " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright " notice is copied with it. Like anything else that's free, @@ -22,10 +22,10 @@ if &cp || exists("g:loaded_netrw") finish endif -let g:loaded_netrw = "v140" -if v:version < 702 +let g:loaded_netrw = "v149" +if v:version < 703 || (v:version == 703 && !has("patch465")) echohl WarningMsg - echo "***warning*** this version of netrw needs vim 7.2" + echo "***warning*** this version of netrw needs vim 7.3.465 or later" echohl Normal finish endif @@ -35,14 +35,8 @@ if !exists("s:NOTE") let s:ERROR = 2 endif -" sanity checks -if v:version < 700 - call netrw#ErrorMsg(s:WARNING,"you need vim version 7.0 or later for version ".g:loaded_netrw." of netrw",1) - finish -endif - let s:keepcpo= &cpo -setlocal cpo&vim +set cpo&vim "DechoTabOn "call Decho("doing autoload/netrw.vim version ".g:loaded_netrw) @@ -51,12 +45,95 @@ setlocal cpo&vim " ====================== " --------------------------------------------------------------------- +" netrw#ErrorMsg: {{{2 +" 0=note = s:NOTE +" 1=warning = s:WARNING +" 2=error = s:ERROR +" May 01, 2013 : max errnum currently is 93 +fun! netrw#ErrorMsg(level,msg,errnum) +" call Dfunc("netrw#ErrorMsg(level=".a:level." msg<".a:msg."> errnum=".a:errnum.") g:netrw_use_errorwindow=".g:netrw_use_errorwindow) + + if a:level < g:netrw_errorlvl +" call Dret("netrw#ErrorMsg : suppressing level=".a:level." since g:netrw_errorlvl=".g:netrw_errorlvl) + return + endif + + if a:level == 1 + let level= "**warning** (netrw) " + elseif a:level == 2 + let level= "**error** (netrw) " + else + let level= "**note** (netrw) " + endif +" call Decho("level=".level) + + if g:netrw_use_errorwindow + " (default) netrw creates a one-line window to show error/warning + " messages (reliably displayed) + + " record current window number for NetrwRestorePosn()'s benefit + let s:winBeforeErr= winnr() +" call Decho("s:winBeforeErr=".s:winBeforeErr) + + " getting messages out reliably is just plain difficult! + " This attempt splits the current window, creating a one line window. + if bufexists("NetrwMessage") && bufwinnr("NetrwMessage") > 0 +" call Decho("write to NetrwMessage buffer") + exe bufwinnr("NetrwMessage")."wincmd w" +" call Decho("setl ma noro") + setl ma noro + keepj call setline(line("$")+1,level.a:msg) + keepj $ + else +" call Decho("create a NetrwMessage buffer window") + bo 1split + sil! call s:NetrwEnew() + sil! keepj call s:NetrwSafeOptions() + setl bt=nofile + keepj file NetrwMessage +" call Decho("setl ma noro") + setl ma noro + call setline(line("$"),level.a:msg) + endif +" call Decho("wrote msg<".level.a:msg."> to NetrwMessage win#".winnr()) + if &fo !~ '[ta]' + syn clear + syn match netrwMesgNote "^\*\*note\*\*" + syn match netrwMesgWarning "^\*\*warning\*\*" + syn match netrwMesgError "^\*\*error\*\*" + hi link netrwMesgWarning WarningMsg + hi link netrwMesgError Error + endif +" call Decho("(ErrorMsg) setl noma ro bh=wipe") + setl noma ro bh=wipe + + else + " (optional) netrw will show messages using echomsg. Even if the + " message doesn't appear, at least it'll be recallable via :messages +" redraw! + if a:level == s:WARNING + echohl WarningMsg + elseif a:level == s:ERROR + echohl Error + endif + echomsg level.a:msg +" call Decho("echomsg ***netrw*** ".a:msg) + echohl None + endif + +" call Dret("netrw#ErrorMsg") +endfun + +" --------------------------------------------------------------------- " NetrwInit: initializes variables if they haven't been defined {{{2 " Loosely, varname = value. fun s:NetrwInit(varname,value) +" call Decho("varname<".a:varname."> value=".a:value) if !exists(a:varname) if type(a:value) == 0 exe "let ".a:varname."=".a:value + elseif type(a:value) == 1 && a:value =~ '^[{[]' + exe "let ".a:varname."=".a:value elseif type(a:value) == 1 exe "let ".a:varname."="."'".a:value."'" else @@ -78,6 +155,8 @@ endif " --------------------------------------------------------------------- " Default values for netrw's global protocol variables {{{2 +call s:NetrwInit("g:netrw_use_errorwindow",1) + if !exists("g:netrw_dav_cmd") if executable("cadaver") let g:netrw_dav_cmd = "cadaver" @@ -97,6 +176,10 @@ endif if !exists("g:netrw_ftp_cmd") let g:netrw_ftp_cmd = "ftp" endif +let s:netrw_ftp_cmd= g:netrw_ftp_cmd +if !exists("g:netrw_ftp_options") + let g:netrw_ftp_options= "-i -n" +endif if !exists("g:netrw_http_cmd") if executable("elinks") let g:netrw_http_cmd = "elinks" @@ -119,7 +202,20 @@ if !exists("g:netrw_http_cmd") endif call s:NetrwInit("g:netrw_rcp_cmd" , "rcp") call s:NetrwInit("g:netrw_rsync_cmd", "rsync") -call s:NetrwInit("g:netrw_scp_cmd" , "scp -q") +if !exists("g:netrw_scp_cmd") + if executable("scp") + call s:NetrwInit("g:netrw_scp_cmd" , "scp -q") + elseif executable("pscp") + if (has("win32") || has("win95") || has("win64") || has("win16")) && filereadable('c:\private.ppk') + call s:NetrwInit("g:netrw_scp_cmd", 'pscp -i c:\private.ppk') + else + call s:NetrwInit("g:netrw_scp_cmd", 'pscp -q') + endif + else + call s:NetrwInit("g:netrw_scp_cmd" , "scp -q") + endif +endif + call s:NetrwInit("g:netrw_sftp_cmd" , "sftp") call s:NetrwInit("g:netrw_ssh_cmd" , "ssh") @@ -139,7 +235,7 @@ endif " Cygwin Detection ------- {{{3 if !exists("g:netrw_cygwin") if has("win32") || has("win95") || has("win64") || has("win16") - if &shell =~ '\%(\\|\\)\%(\.exe\)\=$' + if has("win32unix") && &shell =~ '\%(\\|\\)\%(\.exe\)\=$' let g:netrw_cygwin= 1 else let g:netrw_cygwin= 0 @@ -157,15 +253,19 @@ call s:NetrwInit("g:netrw_bufsettings" , "noma nomod nonu nobl nowrap ro") call s:NetrwInit("g:netrw_chgwin" , -1) call s:NetrwInit("g:netrw_compress" , "gzip") call s:NetrwInit("g:netrw_ctags" , "ctags") -if !exists("g:netrw_cursorline") - let g:netrw_cursorline= 1 - let s:netrw_usercul = &cursorline - let s:netrw_usercuc = &cursorcolumn +if exists("g:netrw_cursorline") && !exists("g:netrw_cursor") + call netrw#ErrorMsg(s:NOTE,'g:netrw_cursorline is deprecated; use g:netrw_cursor instead',77) + let g:netrw_cursor= g:netrw_cursorline endif +call s:NetrwInit("g:netrw_cursor" , 2) +let s:netrw_usercul = &cursorline +let s:netrw_usercuc = &cursorcolumn " Default values - d-g ---------- {{{3 +call s:NetrwInit("s:didstarstar",0) call s:NetrwInit("g:netrw_dirhist_cnt" , 0) call s:NetrwInit("g:netrw_decompress" , '{ ".gz" : "gunzip", ".bz2" : "bunzip2", ".zip" : "unzip", ".tar" : "tar -xf", ".xz" : "unxz" }') call s:NetrwInit("g:netrw_dirhistmax" , 10) +call s:NetrwInit("g:netrw_errorlvl" , s:NOTE) call s:NetrwInit("g:netrw_fastbrowse" , 1) call s:NetrwInit("g:netrw_ftp_browse_reject", '^total\s\+\d\+$\|^Trying\s\+\d\+.*$\|^KERBEROS_V\d rejected\|^Security extensions not\|No such file\|: connect to address [0-9a-fA-F:]*: No route to host$') if !exists("g:netrw_ftp_list_cmd") @@ -191,28 +291,39 @@ if !exists("g:netrw_ignorenetrc") endif call s:NetrwInit("g:netrw_keepdir",1) if !exists("g:netrw_list_cmd") + if g:netrw_scp_cmd =~ '^pscp' && executable("pscp") - " provide a 'pscp' listing command if (has("win32") || has("win95") || has("win64") || has("win16")) && filereadable("c:\\private.ppk") + " provide a pscp-based listing command let g:netrw_scp_cmd ="pscp -i C:\\private.ppk" endif let g:netrw_list_cmd= g:netrw_scp_cmd." -ls USEPORT HOSTNAME:" + elseif executable(g:netrw_ssh_cmd) - " provide a default listing command + " provide a scp-based default listing command let g:netrw_list_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME ls -FLa" + else " call Decho(g:netrw_ssh_cmd." is not executable") let g:netrw_list_cmd= "" endif + endif call s:NetrwInit("g:netrw_list_hide","") " Default values - lh-lz ---------- {{{3 +if exists("g:netrw_local_copycmd") + let g:netrw_localcopycmd= g:netrw_local_copycmd + call netrw#ErrorMsg(s:NOTE,"g:netrw_local_copycmd is deprecated in favor of g:netrw_localcopycmd",84) +endif +if !exists("g:netrw_localcmdshell") + let g:netrw_localcmdshell= "" +endif if !exists("g:netrw_localcopycmd") if has("win32") || has("win95") || has("win64") || has("win16") if g:netrw_cygwin let g:netrw_localcopycmd= "cp" else - let g:netrw_localcopycmd= "copy" + let g:netrw_localcopycmd= "cmd /c copy" endif elseif has("unix") || has("macunix") let g:netrw_localcopycmd= "cp" @@ -220,13 +331,22 @@ if !exists("g:netrw_localcopycmd") let g:netrw_localcopycmd= "" endif endif -call s:NetrwInit("g:netrw_local_mkdir","mkdir") +if exists("g:netrw_local_mkdir") + let g:netrw_localmkdir= g:netrw_local_mkdir + call netrw#ErrorMsg(s:NOTE,"g:netrw_local_mkdir is deprecated in favor of g:netrw_localmkdir",87) +endif +call s:NetrwInit("g:netrw_localmkdir","mkdir") +call s:NetrwInit("g:netrw_remote_mkdir","mkdir") +if exists("g:netrw_local_movecmd") + let g:netrw_localmovecmd= g:netrw_local_movecmd + call netrw#ErrorMsg(s:NOTE,"g:netrw_local_movecmd is deprecated in favor of g:netrw_localmovecmd",88) +endif if !exists("g:netrw_localmovecmd") if has("win32") || has("win95") || has("win64") || has("win16") if g:netrw_cygwin let g:netrw_localmovecmd= "mv" else - let g:netrw_localmovecmd= "move" + let g:netrw_localmovecmd= "cmd /c move" endif elseif has("unix") || has("macunix") let g:netrw_localmovecmd= "mv" @@ -234,7 +354,11 @@ if !exists("g:netrw_localmovecmd") let g:netrw_localmovecmd= "" endif endif -call s:NetrwInit("g:netrw_local_rmdir", "rmdir") +call s:NetrwInit("g:netrw_localrmdir", "rmdir") +if exists("g:netrw_local_rmdir") + let g:netrw_localrmdir= g:netrw_local_rmdir + call netrw#ErrorMsg(s:NOTE,"g:netrw_local_rmdir is deprecated in favor of g:netrw_localrmdir",86) +endif call s:NetrwInit("g:netrw_liststyle" , s:THINLIST) " sanity checks if g:netrw_liststyle < 0 || g:netrw_liststyle >= s:MAXLIST @@ -248,7 +372,7 @@ call s:NetrwInit("g:netrw_markfileesc" , '*./[\~') call s:NetrwInit("g:netrw_maxfilenamelen", 32) call s:NetrwInit("g:netrw_menu" , 1) call s:NetrwInit("g:netrw_mkdir_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME mkdir") -call s:NetrwInit("g:netrw_mousemaps" , (exists("&mouse") && &mouse =~ '[anh]')) +call s:NetrwInit("g:netrw_mousemaps" , (exists("+mouse") && &mouse =~ '[anh]')) call s:NetrwInit("g:netrw_retmap" , 0) if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin) call s:NetrwInit("g:netrw_chgperm" , "chmod PERM FILENAME") @@ -267,13 +391,13 @@ call s:NetrwInit("g:netrw_rmf_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME rm " Default values - s ---------- {{{3 " g:netrw_sepchr: picking a character that doesn't appear in filenames that can be used to separate priority from filename call s:NetrwInit("g:netrw_sepchr" , (&enc == "euc-jp")? "\" : "\") -call s:NetrwInit("s:netrw_silentxfer" , (exists("g:netrw_silent") && g:netrw_silent != 0)? "silent keepj " : "keepj ") +call s:NetrwInit("s:netrw_silentxfer" , (exists("g:netrw_silent") && g:netrw_silent != 0)? "sil keepj " : "keepj ") call s:NetrwInit("g:netrw_sort_by" , "name") " alternatives: date , size call s:NetrwInit("g:netrw_sort_options" , "") call s:NetrwInit("g:netrw_sort_direction", "normal") " alternative: reverse (z y x ...) if !exists("g:netrw_sort_sequence") if has("unix") - let g:netrw_sort_sequence= '[\/]$,\,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$' + let g:netrw_sort_sequence= '[\/]$,\,\.h$,\.c$,\.cpp$,\~\=\*$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$' else let g:netrw_sort_sequence= '[\/]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$' endif @@ -283,20 +407,31 @@ call s:NetrwInit("g:netrw_ssh_browse_reject", '^total\s\+\d\+$') call s:NetrwInit("g:netrw_use_noswf" , 0) " Default values - t-w ---------- {{{3 call s:NetrwInit("g:netrw_timefmt","%c") -call s:NetrwInit("g:netrw_xstrlen",0) +if !exists("g:netrw_xstrlen") + if exists("g:Align_xstrlen") + let g:netrw_xstrlen= g:Align_xstrlen + elseif exists("g:drawit_xstrlen") + let g:netrw_xstrlen= g:drawit_xstrlen + elseif &enc == "latin1" || !has("multi_byte") + let g:netrw_xstrlen= 0 + else + let g:netrw_xstrlen= 1 + endif +endif call s:NetrwInit("g:NetrwTopLvlMenu","Netrw.") -call s:NetrwInit("g:netrw_use_errorwindow",1) call s:NetrwInit("g:netrw_win95ftp",1) -call s:NetrwInit("g:netrw_winsize",25) +call s:NetrwInit("g:netrw_winsize",50) +if g:netrw_winsize == 0|let g:netrw_winsize= -1|endif +if g:netrw_winsize > 100|let g:netrw_winsize= 100|endif " --------------------------------------------------------------------- " Default values for netrw's script variables: {{{2 call s:NetrwInit("g:netrw_fname_escape",' ?&;%') if has("win32") || has("win95") || has("win64") || has("win16") - call s:NetrwInit("g:netrw_glob_escape",'[]*?`{$') + call s:NetrwInit("g:netrw_glob_escape",'*?`{[]$') else - call s:NetrwInit("g:netrw_glob_escape",'[]*?`{~$\') + call s:NetrwInit("g:netrw_glob_escape",'*[]?`{~$\') endif -call s:NetrwInit("g:netrw_menu_escape",'./&? \') +call s:NetrwInit("g:netrw_menu_escape",'.&? \') call s:NetrwInit("g:netrw_tmpfile_escape",' &;') call s:NetrwInit("s:netrw_map_escape","<|\n\r\\\\"") @@ -305,84 +440,152 @@ call s:NetrwInit("s:netrw_map_escape","<|\n\r\\\\"") " files read by network transfer aren't appropriately highlighted. "let g:decho_bufenter = 1 "Decho +" ====================== +" Netrw Initialization: {{{1 +" ====================== +if v:version >= 700 && has("balloon_eval") && !exists("s:initbeval") && !exists("g:netrw_nobeval") && has("syntax") && exists("g:syntax_on") + let s:initbeval = &beval +" let s:initbexpr = &l:bexpr + let &l:bexpr = "netrw#NetrwBalloonHelp()" + set beval + au BufWinEnter,WinEnter * if &ft == "netrw"|set beval|else|let &beval= s:initbeval|endif +endif +au WinEnter * if &ft == "netrw"|call s:NetrwInsureWinVars()|endif + " ============================== " Netrw Utility Functions: {{{1 " ============================== +" --------------------------------------------------------------------- +" netrw#NetrwBalloonHelp: {{{2 +if v:version >= 700 && has("balloon_eval") && &beval == 1 && has("syntax") && exists("g:syntax_on") + fun! netrw#NetrwBalloonHelp() + if !exists("w:netrw_bannercnt") || v:beval_lnum >= w:netrw_bannercnt || (exists("g:netrw_nobeval") && g:netrw_nobeval) + let mesg= "" + elseif v:beval_text == "Netrw" || v:beval_text == "Directory" || v:beval_text == "Listing" + let mesg = "i: thin-long-wide-tree gh: quick hide/unhide of dot-files qf: quick file info %:open new file" + elseif getline(v:beval_lnum) =~ '^"\s*/' + let mesg = ": edit/enter o: edit/enter in horiz window t: edit/enter in new tab v:edit/enter in vert window" + elseif v:beval_text == "Sorted" || v:beval_text == "by" + let mesg = 's: sort by name, time, or file size r: reverse sorting order mt: mark target' + elseif v:beval_text == "Sort" || v:beval_text == "sequence" + let mesg = "S: edit sorting sequence" + elseif v:beval_text == "Hiding" || v:beval_text == "Showing" + let mesg = "a: hiding-showing-all ctrl-h: editing hiding list mh: hide/show by suffix" + elseif v:beval_text == "Quick" || v:beval_text == "Help" + let mesg = "Help: press " + elseif v:beval_text == "Copy/Move" || v:beval_text == "Tgt" + let mesg = "mt: mark target mc: copy marked file to target mm: move marked file to target" + else + let mesg= "" + endif + return mesg + endfun +endif + " ------------------------------------------------------------------------ -" s:NetrwOptionSave: save options and set to "standard" form {{{2 +" s:NetrwOptionSave: save options prior to setting to "netrw-buffer-standard" form {{{2 " 06/08/07 : removed call to NetrwSafeOptions(), either placed " immediately after NetrwOptionSave() calls in NetRead " and NetWrite, or after the s:NetrwEnew() call in " NetrwBrowse. " vt: normally its "w:" or "s:" (a variable type) fun! s:NetrwOptionSave(vt) -" call Dfunc("s:NetrwOptionSave(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">"." winnr($)=".winnr("$")) - +" call Dfunc("s:NetrwOptionSave(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">"." winnr($)=".winnr("$")." mod=".&mod." ma=".&ma) " call Decho(a:vt."netrw_optionsave".(exists("{a:vt}netrw_optionsave")? ("=".{a:vt}netrw_optionsave) : " doesn't exist")) + if !exists("{a:vt}netrw_optionsave") let {a:vt}netrw_optionsave= 1 else " call Dret("s:NetrwOptionSave : options already saved") return endif -" call Decho("fo=".&fo.(exists("&acd")? " acd=".&acd : " acd doesn't exist")." diff=".&l:diff) +" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." diff=".&l:diff) " Save current settings and current directory +" call Decho("saving current settings and current directory") let s:yykeep = @@ - if exists("&l:acd") - let {a:vt}netrw_acdkeep = &l:acd - endif + if exists("&l:acd")|let {a:vt}netrw_acdkeep = &l:acd|endif let {a:vt}netrw_aikeep = &l:ai let {a:vt}netrw_awkeep = &l:aw + let {a:vt}netrw_bhkeep = &l:bh + let {a:vt}netrw_blkeep = &l:bl + let {a:vt}netrw_btkeep = &l:bt let {a:vt}netrw_bombkeep = &l:bomb + let {a:vt}netrw_cedit = &cedit let {a:vt}netrw_cikeep = &l:ci let {a:vt}netrw_cinkeep = &l:cin let {a:vt}netrw_cinokeep = &l:cino let {a:vt}netrw_comkeep = &l:com let {a:vt}netrw_cpokeep = &l:cpo let {a:vt}netrw_diffkeep = &l:diff - if g:netrw_keepdir - let {a:vt}netrw_dirkeep = getcwd() - endif + let {a:vt}netrw_fenkeep = &l:fen + let {a:vt}netrw_ffkeep = &l:ff let {a:vt}netrw_fokeep = &l:fo " formatoptions let {a:vt}netrw_gdkeep = &l:gd " gdefault let {a:vt}netrw_hidkeep = &l:hidden let {a:vt}netrw_imkeep = &l:im + let {a:vt}netrw_iskkeep = &l:isk + let {a:vt}netrw_lskeep = &l:ls + let {a:vt}netrw_makeep = &l:ma let {a:vt}netrw_magickeep = &l:magic + let {a:vt}netrw_modkeep = &l:mod + let {a:vt}netrw_nukeep = &l:nu let {a:vt}netrw_repkeep = &l:report + let {a:vt}netrw_rokeep = &l:ro let {a:vt}netrw_selkeep = &l:sel let {a:vt}netrw_spellkeep = &l:spell + let {a:vt}netrw_tskeep = &l:ts let {a:vt}netrw_twkeep = &l:tw " textwidth let {a:vt}netrw_wigkeep = &l:wig " wildignore + let {a:vt}netrw_wrapkeep = &l:wrap + let {a:vt}netrw_writekeep = &l:write + if g:netrw_use_noswf && has("win32") && !has("win95") + let {a:vt}netrw_swfkeep = &l:swf + endif + + " save a few selected netrw-related variables +" call Decho("saving a few selected netrw-related variables") + if g:netrw_keepdir + let {a:vt}netrw_dirkeep = getcwd() + endif if has("win32") && !has("win95") let {a:vt}netrw_swfkeep = &l:swf " swapfile endif - if &go =~ 'a' | silent! let {a:vt}netrw_regstar = @* | endif - silent! let {a:vt}netrw_regslash= @/ + if &go =~# 'a' | sil! let {a:vt}netrw_regstar = @* | endif + sil! let {a:vt}netrw_regslash= @/ -" call Dret("s:NetrwOptionSave : win#".winnr()." buf#".bufnr("%")) +" call Dret("s:NetrwOptionSave : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")." modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) endfun " ------------------------------------------------------------------------ " s:NetrwOptionRestore: restore options {{{2 fun! s:NetrwOptionRestore(vt) -" call Dfunc("s:NetrwOptionRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")." winnr($)=".winnr("$")) +" call Dfunc("s:NetrwOptionRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$")) if !exists("{a:vt}netrw_optionsave") -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) + if exists("s:nbcd_curpos_{bufnr('%')}") +" call Decho("(NetrwOptionRestore) restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)") + keepj call netrw#NetrwRestorePosn(s:nbcd_curpos_{bufnr('%')}) +" call Decho("(NetrwOptionRestore) win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$")) +" call Decho("(NetrwOptionRestore) unlet s:nbcd_curpos_".bufnr('%')) + unlet s:nbcd_curpos_{bufnr('%')} + else +" call Decho("(NetrwOptionRestore) no previous position") + endif +" call Decho("(NetrwOptionRestore) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") " call Dret("s:NetrwOptionRestore : ".a:vt."netrw_optionsave doesn't exist") return endif unlet {a:vt}netrw_optionsave - if exists("&acd") + if exists("+acd") if exists("{a:vt}netrw_acdkeep") -" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) +" call Decho("(NetrwOptionRestore) g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) let curdir = getcwd() let &l:acd = {a:vt}netrw_acdkeep unlet {a:vt}netrw_acdkeep if &l:acd -" call Decho("exe keepjumps lcd ".fnameescape(curdir)) " NOTE: was g:netrw_fname_escape for some reason +" call Decho("exe keepj lcd ".fnameescape(curdir)) " NOTE: was g:netrw_fname_escape for some reason try if !exists("&l:acd") && !&l:acd exe 'keepj lcd '.fnameescape(curdir) @@ -395,27 +598,41 @@ fun! s:NetrwOptionRestore(vt) endif if exists("{a:vt}netrw_aikeep") |let &l:ai = {a:vt}netrw_aikeep |unlet {a:vt}netrw_aikeep |endif if exists("{a:vt}netrw_awkeep") |let &l:aw = {a:vt}netrw_awkeep |unlet {a:vt}netrw_awkeep |endif + if g:netrw_liststyle != s:TREELIST + if exists("{a:vt}netrw_bhkeep") |let &l:bh = {a:vt}netrw_bhkeep |unlet {a:vt}netrw_bhkeep |endif + endif + if exists("{a:vt}netrw_blkeep") |let &l:bl = {a:vt}netrw_blkeep |unlet {a:vt}netrw_blkeep |endif + if exists("{a:vt}netrw_btkeep") |let &l:bt = {a:vt}netrw_btkeep |unlet {a:vt}netrw_btkeep |endif if exists("{a:vt}netrw_bombkeep") |let &l:bomb = {a:vt}netrw_bombkeep |unlet {a:vt}netrw_bombkeep |endif + if exists("{a:vt}netrw_cedit") |let &cedit = {a:vt}netrw_cedit |unlet {a:vt}netrw_cedit |endif if exists("{a:vt}netrw_cikeep") |let &l:ci = {a:vt}netrw_cikeep |unlet {a:vt}netrw_cikeep |endif if exists("{a:vt}netrw_cinkeep") |let &l:cin = {a:vt}netrw_cinkeep |unlet {a:vt}netrw_cinkeep |endif if exists("{a:vt}netrw_cinokeep") |let &l:cino = {a:vt}netrw_cinokeep |unlet {a:vt}netrw_cinokeep |endif if exists("{a:vt}netrw_comkeep") |let &l:com = {a:vt}netrw_comkeep |unlet {a:vt}netrw_comkeep |endif if exists("{a:vt}netrw_cpokeep") |let &l:cpo = {a:vt}netrw_cpokeep |unlet {a:vt}netrw_cpokeep |endif if exists("{a:vt}netrw_diffkeep") |let &l:diff = {a:vt}netrw_diffkeep |unlet {a:vt}netrw_diffkeep |endif - if exists("{a:vt}netrw_dirkeep") && isdirectory({a:vt}netrw_dirkeep) && g:netrw_keepdir - let dirkeep = substitute({a:vt}netrw_dirkeep,'\\','/','g') - if exists("{a:vt}netrw_dirkeep") |exe "keepjumps lcd ".fnameescape(dirkeep)|unlet {a:vt}netrw_dirkeep |endif - endif + if exists("{a:vt}netrw_fenkeep") |let &l:fen = {a:vt}netrw_fenkeep |unlet {a:vt}netrw_fenkeep |endif + if exists("{a:vt}netrw_ffkeep") |let &l:ff = {a:vt}netrw_ffkeep |unlet {a:vt}netrw_ffkeep |endif if exists("{a:vt}netrw_fokeep") |let &l:fo = {a:vt}netrw_fokeep |unlet {a:vt}netrw_fokeep |endif if exists("{a:vt}netrw_gdkeep") |let &l:gd = {a:vt}netrw_gdkeep |unlet {a:vt}netrw_gdkeep |endif if exists("{a:vt}netrw_hidkeep") |let &l:hidden = {a:vt}netrw_hidkeep |unlet {a:vt}netrw_hidkeep |endif if exists("{a:vt}netrw_imkeep") |let &l:im = {a:vt}netrw_imkeep |unlet {a:vt}netrw_imkeep |endif - if exists("{a:vt}netrw_magic") |let &l:magic = {a:vt}netrw_magic |unlet {a:vt}netrw_magic |endif + if exists("{a:vt}netrw_iskkeep") |let &l:isk = {a:vt}netrw_iskkeep |unlet {a:vt}netrw_iskkeep |endif + if exists("{a:vt}netrw_lskeep") |let &l:ls = {a:vt}netrw_lskeep |unlet {a:vt}netrw_lskeep |endif + if exists("{a:vt}netrw_makeep") |let &l:ma = {a:vt}netrw_makeep |unlet {a:vt}netrw_makeep |endif + if exists("{a:vt}netrw_magickeep")|let &l:magic = {a:vt}netrw_magickeep |unlet {a:vt}netrw_magickeep|endif + if exists("{a:vt}netrw_modkeep") |let &l:mod = {a:vt}netrw_modkeep |unlet {a:vt}netrw_modkeep |endif + if exists("{a:vt}netrw_nukeep") |let &l:nu = {a:vt}netrw_nukeep |unlet {a:vt}netrw_nukeep |endif if exists("{a:vt}netrw_repkeep") |let &l:report = {a:vt}netrw_repkeep |unlet {a:vt}netrw_repkeep |endif + if exists("{a:vt}netrw_rokeep") |let &l:ro = {a:vt}netrw_rokeep |unlet {a:vt}netrw_rokeep |endif if exists("{a:vt}netrw_selkeep") |let &l:sel = {a:vt}netrw_selkeep |unlet {a:vt}netrw_selkeep |endif if exists("{a:vt}netrw_spellkeep")|let &l:spell = {a:vt}netrw_spellkeep |unlet {a:vt}netrw_spellkeep|endif + " Problem: start with liststyle=0; press : result, following line resets l:ts. +" if exists("{a:vt}netrw_tskeep") |let &l:ts = {a:vt}netrw_tskeep |unlet {a:vt}netrw_tskeep |endif if exists("{a:vt}netrw_twkeep") |let &l:tw = {a:vt}netrw_twkeep |unlet {a:vt}netrw_twkeep |endif if exists("{a:vt}netrw_wigkeep") |let &l:wig = {a:vt}netrw_wigkeep |unlet {a:vt}netrw_wigkeep |endif + if exists("{a:vt}netrw_wrapkeep") |let &l:wrap = {a:vt}netrw_wrapkeep |unlet {a:vt}netrw_wrapkeep |endif + if exists("{a:vt}netrw_writekeep")|let &l:write = {a:vt}netrw_writekeep |unlet {a:vt}netrw_writekeep|endif if exists("s:yykeep") |let @@ = s:yykeep |unlet s:yykeep |endif if exists("{a:vt}netrw_swfkeep") if &directory == "" @@ -423,3512 +640,4201 @@ fun! s:NetrwOptionRestore(vt) " netrw will temporarily set the swapfile directory " to the current directory as returned by getcwd(). let &l:directory = getcwd() - silent! let &l:swf = {a:vt}netrw_swfkeep - setlocal directory= + sil! let &l:swf = {a:vt}netrw_swfkeep + setl directory= unlet {a:vt}netrw_swfkeep elseif &l:swf != {a:vt}netrw_swfkeep " following line causes a Press ENTER in windows -- can't seem to work around it!!! - silent! let &l:swf= {a:vt}netrw_swfkeep + sil! let &l:swf= {a:vt}netrw_swfkeep unlet {a:vt}netrw_swfkeep endif endif - if exists("{a:vt}netrw_regstar") |silent! let @*= {a:vt}netrw_regstar |unlet {a:vt}netrw_regstar |endif - if exists("{a:vt}netrw_regslash")|silent! let @/= {a:vt}netrw_regslash|unlet {a:vt}netrw_regslash|endif - -" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) -" call Decho("fo=".&fo.(exists("&acd")? " acd=".&acd : " acd doesn't exist")) -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) -" call Decho("diff=".&l:diff." win#".winnr()." w:netrw_diffkeep=".(exists("w:netrw_diffkeep")? w:netrw_diffkeep : "doesn't exist")) -" call Dret("s:NetrwOptionRestore : win#".winnr()." buf#".bufnr("%")) + if exists("{a:vt}netrw_dirkeep") && isdirectory({a:vt}netrw_dirkeep) && g:netrw_keepdir + let dirkeep = substitute({a:vt}netrw_dirkeep,'\\','/','g') + if exists("{a:vt}netrw_dirkeep") |exe "keepj lcd ".fnameescape(dirkeep)|unlet {a:vt}netrw_dirkeep |endif + endif + if exists("{a:vt}netrw_regstar") |sil! let @*= {a:vt}netrw_regstar |unlet {a:vt}netrw_regstar |endif + if exists("{a:vt}netrw_regslash")|sil! let @/= {a:vt}netrw_regslash|unlet {a:vt}netrw_regslash|endif + if exists("s:nbcd_curpos_{bufnr('%')}") +" call Decho("(NetrwOptionRestore) restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)") + keepj call netrw#NetrwRestorePosn(s:nbcd_curpos_{bufnr('%')}) +" call Decho("(NetrwOptionRestore) unlet s:nbcd_curpos_".bufnr('%')) + unlet s:nbcd_curpos_{bufnr('%')} + else +" call Decho("no previous position") + endif + +" call Decho("(NetrwOptionRestore) g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) +" call Decho("(NetrwOptionRestore) fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")) +" call Decho("(NetrwOptionRestore) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("(NetrwOptionRestore) diff=".&l:diff." win#".winnr()." w:netrw_diffkeep=".(exists("w:netrw_diffkeep")? w:netrw_diffkeep : "doesn't exist")) +" call Decho("(NetrwOptionRestore) ts=".&l:ts) + " Moved the filetype detect here from NetrwGetFile() because remote files + " were having their filetype detect-generated settings overwritten by + " NetrwOptionRestore. + if &ft != "netrw" +" call Decho("(NetrwOptionRestore) filetype detect (ft=".&ft.")") + filetype detect + endif +" call Dret("s:NetrwOptionRestore : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) endfun " --------------------------------------------------------------------- " s:NetrwSafeOptions: sets options to help netrw do its job {{{2 +" Use s:NetrwSaveOptions() to save user settings +" Use s:NetrwOptionRestore() to restore user settings fun! s:NetrwSafeOptions() " call Dfunc("s:NetrwSafeOptions() win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%"))."> winnr($)=".winnr("$")) " call Decho("win#".winnr()."'s ft=".&ft) - setlocal cino= - setlocal com= - setlocal cpo-=aA - if exists("&acd") | setlocal noacd | endif - setlocal nocin noai nobomb noci magic nospell nohid wig= noaw noim - setlocal fo=nroql2 - setlocal tw=0 - setlocal report=10000 - setlocal isk+=@ isk+=* isk+=/ - setlocal sel=inclusive + if exists("+acd") | setl noacd | endif + setl noai + setl noaw + setl nobomb + setl noci + setl nocin + if g:netrw_liststyle == s:TREELIST + setl bh=hide + endif + setl cino= + setl com= + setl cpo-=a + setl cpo-=A + setl fo=nroql2 + setl nohid + setl noim + setl isk+=@ isk+=* isk+=/ + setl magic + setl report=10000 + setl sel=inclusive + setl nospell + setl tw=0 + setl wig= + set cedit& if g:netrw_use_noswf && has("win32") && !has("win95") - setlocal noswf + setl noswf endif - call s:NetrwCursorline() + call s:NetrwCursor() " allow the user to override safe options " call Decho("ft<".&ft."> ei=".&ei) if &ft == "netrw" -" call Decho("do any netrw FileType autocmds") - silent keepalt keepjumps doau FileType netrw +" call Decho("do any netrw FileType autocmds (doau FileType netrw)") + sil! keepalt keepj doau FileType netrw endif -" call Decho("fo=".&fo.(exists("&acd")? " acd=".&acd : " acd doesn't exist")) +" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." bh=".&l:bh) " call Dret("s:NetrwSafeOptions") endfun " --------------------------------------------------------------------- -" netrw#NetrwClean: remove netrw {{{2 -" supports :NetrwClean -- remove netrw from first directory on runtimepath -" :NetrwClean! -- remove netrw from all directories on runtimepath -fun! netrw#NetrwClean(sys) -" call Dfunc("netrw#NetrwClean(sys=".a:sys.")") - - if a:sys - let choice= confirm("Remove personal and system copies of netrw?","&Yes\n&No") - else - let choice= confirm("Remove personal copy of netrw?","&Yes\n&No") - endif -" call Decho("choice=".choice) - let diddel= 0 - let diddir= "" - - if choice == 1 - for dir in split(&rtp,',') - if filereadable(dir."/plugin/netrwPlugin.vim") -" call Decho("removing netrw-related files from ".dir) - if s:NetrwDelete(dir."/plugin/netrwPlugin.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/plugin/netrwPlugin.vim",55) |endif - if s:NetrwDelete(dir."/autoload/netrwFileHandlers.vim")|call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrwFileHandlers.vim",55)|endif - if s:NetrwDelete(dir."/autoload/netrwSettings.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrwSettings.vim",55) |endif - if s:NetrwDelete(dir."/autoload/netrw.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrw.vim",55) |endif - if s:NetrwDelete(dir."/syntax/netrw.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/syntax/netrw.vim",55) |endif - if s:NetrwDelete(dir."/syntax/netrwlist.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/syntax/netrwlist.vim",55) |endif - let diddir= dir - let diddel= diddel + 1 - if !a:sys|break|endif - endif - endfor +" netrw#Explore: launch the local browser in the directory of the current file {{{2 +" indx: == -1: Nexplore +" == -2: Pexplore +" == +: this is overloaded: +" * If Nexplore/Pexplore is in use, then this refers to the +" indx'th item in the w:netrw_explore_list[] of items which +" matched the */pattern **/pattern *//pattern **//pattern +" * If Hexplore or Vexplore, then this will override +" g:netrw_winsize to specify the qty of rows or columns the +" newly split window should have. +" dosplit==0: the window will be split iff the current file has been modified +" dosplit==1: the window will be split before running the local browser +" style == 0: Explore style == 1: Explore! +" == 2: Hexplore style == 3: Hexplore! +" == 4: Vexplore style == 5: Vexplore! +" == 6: Texplore +fun! netrw#Explore(indx,dosplit,style,...) +" call Dfunc("netrw#Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.",a:1<".a:1.">) &modified=".&modified." modifiable=".&modifiable." a:0=".a:0." win#".winnr()." buf#".bufnr("%")) + if !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() + if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) + let b:netrw_curdir= substitute(b:netrw_curdir,'\','/','g') + endif +" call Decho("(Explore) set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)") endif - - echohl WarningMsg - if diddel == 0 - echomsg "netrw is either not installed or not removable" - elseif diddel == 1 - echomsg "removed one copy of netrw from <".diddir.">" - else - echomsg "removed ".diddel." copies of netrw" + let curdir = simplify(b:netrw_curdir) + let curfiledir = substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e') + if !exists("g:netrw_cygwin") && (has("win32") || has("win95") || has("win64") || has("win16")) + let curdir= substitute(curdir,'\','/','g') endif - echohl None +" call Decho("(Explore) curdir<".curdir."> curfiledir<".curfiledir.">") -" call Dret("netrw#NetrwClean") -endfun + " save registers + sil! let keepregstar = @* + sil! let keepregplus = @+ + sil! let keepregslash= @/ -" --------------------------------------------------------------------- -" netrw#Nread: {{{2 -fun! netrw#Nread(mode,fname) -" call Dfunc("netrw#Nread(mode=".a:mode." fname<".a:fname.">)") - call netrw#NetrwSavePosn() - call netrw#NetRead(a:mode,a:fname) - call netrw#NetrwRestorePosn() -" call Dret("netrw#Nread") -endfun + " if dosplit or file has been modified + if a:dosplit || &modified || a:style == 6 +" call Decho("(Explore) case dosplit=".a:dosplit." modified=".&modified." a:style=".a:style.": dosplit or file has been modified") + call s:SaveWinVars() + let winsz= g:netrw_winsize + if a:indx > 0 + let winsz= a:indx + endif -" ------------------------------------------------------------------------ -" Netrw Transfer Functions: {{{1 -" =============================== + if a:style == 0 " Explore, Sexplore +" call Decho("(Explore) style=0: Explore or Sexplore") + let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz + exe winsz."wincmd s" -" ------------------------------------------------------------------------ -" netrw#NetRead: responsible for reading a file over the net {{{2 -" mode: =0 read remote file and insert before current line -" =1 read remote file and insert after current line -" =2 replace with remote file -" =3 obtain file, but leave in temporary format -fun! netrw#NetRead(mode,...) -" call Dfunc("netrw#NetRead(mode=".a:mode.",...) a:0=".a:0." ".g:loaded_netrw) + elseif a:style == 1 "Explore!, Sexplore! +" call Decho("(Explore) style=1: Explore! or Sexplore!") + let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz + exe "keepalt ".winsz."wincmd v" - " NetRead: save options {{{3 - call s:NetrwOptionSave("w:") - call s:NetrwSafeOptions() - call s:RestoreCursorline() + elseif a:style == 2 " Hexplore +" call Decho("(Explore) style=2: Hexplore") + let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz + exe "keepalt bel ".winsz."wincmd s" - " NetRead: interpret mode into a readcmd {{{3 - if a:mode == 0 " read remote file before current line - let readcmd = "0r" - elseif a:mode == 1 " read file after current line - let readcmd = "r" - elseif a:mode == 2 " replace with remote file - let readcmd = "%r" - elseif a:mode == 3 " skip read of file (leave as temporary) - let readcmd = "t" - else - exe a:mode - let readcmd = "r" - endif - let ichoice = (a:0 == 0)? 0 : 1 -" call Decho("readcmd<".readcmd."> ichoice=".ichoice) + elseif a:style == 3 " Hexplore! +" call Decho("(Explore) style=3: Hexplore!") + let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz + exe "keepalt abo ".winsz."wincmd s" - " NetRead: get temporary filename {{{3 - let tmpfile= s:GetTempfile("") - if tmpfile == "" -" call Dret("netrw#NetRead : unable to get a tempfile!") - return - endif + elseif a:style == 4 " Vexplore +" call Decho("(Explore) style=4: Vexplore") + let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz + exe "keepalt lefta ".winsz."wincmd v" - while ichoice <= a:0 + elseif a:style == 5 " Vexplore! +" call Decho("(Explore) style=5: Vexplore!") + let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz + exe "keepalt rightb ".winsz."wincmd v" - " attempt to repeat with previous host-file-etc - if exists("b:netrw_lastfile") && a:0 == 0 -" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">") - let choice = b:netrw_lastfile - let ichoice= ichoice + 1 + elseif a:style == 6 " Texplore + call s:SaveBufVars() +" call Decho("(Explore) style = 6: Texplore") + exe "keepalt tabnew ".fnameescape(curdir) + call s:RestoreBufVars() + endif + call s:RestoreWinVars() +" else " Decho +" call Decho("(Explore) case a:dosplit=".a:dosplit." AND modified=".&modified." AND a:style=".a:style." is not 6") + endif + keepj norm! 0 + if a:0 > 0 +" call Decho("(Explore) case [a:0=".a:0."] > 0: a:1<".a:1.">") + if a:1 =~ '^\~' && (has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin)) +" call Decho("(Explore) ..case a:1<".a:1.">: starts with ~ and unix or cygwin") + let dirname= simplify(substitute(a:1,'\~',expand("$HOME"),'')) +" call Decho("(Explore) ..using dirname<".dirname."> (case: ~ && unix||cygwin)") + elseif a:1 == '.' +" call Decho("(Explore) ..case a:1<".a:1.">: matches .") + let dirname= simplify(exists("b:netrw_curdir")? b:netrw_curdir : getcwd()) + if dirname !~ '/$' + let dirname= dirname."/" + endif +" call Decho("(Explore) ..using dirname<".dirname."> (case: ".(exists("b:netrw_curdir")? "b:netrw_curdir" : "getcwd()").")") + elseif a:1 =~ '\$' +" call Decho("(Explore) ..case a:1<".a:1.">: matches ending $") + let dirname= simplify(expand(a:1)) +" call Decho("(Explore) ..using user-specified dirname<".dirname."> with $env-var") + elseif a:1 !~ '^\*\{1,2}/' && a:1 !~ '^\a\{3,}://' +" call Decho("(Explore) ..case a:1<".a:1.">: other, not pattern or filepattern") + let dirname= simplify(a:1) +" call Decho("(Explore) ..using user-specified dirname<".dirname.">") else - exe "let choice= a:" . ichoice -" call Decho("no lastfile: choice<" . choice . ">") +" call Decho("(Explore) ..case a:1: pattern or filepattern") + let dirname= a:1 + endif + else + " clear explore +" call Decho("(Explore) case a:0=".a:0.": clearing Explore list") + call s:NetrwClearExplore() +" call Dret("netrw#Explore : cleared list") + return + endif - if match(choice,"?") == 0 - " give help - echomsg 'NetRead Usage:' - echomsg ':Nread machine:path uses rcp' - echomsg ':Nread "machine path" uses ftp with <.netrc>' - echomsg ':Nread "machine id password path" uses ftp' - echomsg ':Nread dav://machine[:port]/path uses cadaver' - echomsg ':Nread fetch://machine/path uses fetch' - echomsg ':Nread ftp://[user@]machine[:port]/path uses ftp autodetects <.netrc>' - echomsg ':Nread http://[user@]machine/path uses http wget' - echomsg ':Nread rcp://[user@]machine/path uses rcp' - echomsg ':Nread rsync://machine[:port]/path uses rsync' - echomsg ':Nread scp://[user@]machine[[:#]port]/path uses scp' - echomsg ':Nread sftp://[user@]machine[[:#]port]/path uses sftp' - sleep 4 - break +" call Decho("(Explore) dirname<".dirname.">") + if dirname =~ '\.\./\=$' + let dirname= simplify(fnamemodify(dirname,':p:h')) + elseif dirname =~ '\.\.' || dirname == '.' + let dirname= simplify(fnamemodify(dirname,':p')) + endif +" call Decho("(Explore) dirname<".dirname."> (after simplify)") - elseif match(choice,'^"') != -1 - " Reconstruct Choice if choice starts with '"' -" call Decho("reconstructing choice") - if match(choice,'"$') != -1 - " case "..." - let choice=strpart(choice,1,strlen(choice)-2) - else - " case "... ... ..." - let choice = strpart(choice,1,strlen(choice)-1) - let wholechoice = "" + if dirname =~ '^\*//' + " starpat=1: Explore *//pattern (current directory only search for files containing pattern) +" call Decho("(Explore) case starpat=1: Explore *//pattern") + let pattern= substitute(dirname,'^\*//\(.*\)$','\1','') + let starpat= 1 +" call Decho("(Explore) ..Explore *//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">") + if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif - while match(choice,'"$') == -1 - let wholechoice = wholechoice . " " . choice - let ichoice = ichoice + 1 - if ichoice > a:0 - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",3) - endif -" call Dret("netrw#NetRead :2 getcwd<".getcwd().">") - return - endif - let choice= a:{ichoice} - endwhile - let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1) - endif - endif + elseif dirname =~ '^\*\*//' + " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) +" call Decho("(Explore) case starpat=2: Explore **//pattern") + let pattern= substitute(dirname,'^\*\*//','','') + let starpat= 2 +" call Decho("(Explore) ..Explore **//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">") + + elseif dirname =~ '/\*\*/' + " handle .../**/.../filepat +" call Decho("(Explore) case starpat=4: Explore .../**/.../filepat") + let prefixdir= substitute(dirname,'^\(.\{-}\)\*\*.*$','\1','') + if prefixdir =~ '^/' || (prefixdir =~ '^\a:/' && (has("win32") || has("win95") || has("win64") || has("win16"))) + let b:netrw_curdir = prefixdir + else + let b:netrw_curdir= getcwd().'/'.prefixdir endif + let dirname= substitute(dirname,'^.\{-}\(\*\*/.*\)$','\1','') + let starpat= 4 +" call Decho("(Explore) ..pwd<".getcwd()."> dirname<".dirname.">") +" call Decho("(Explore) ..case Explore ../**/../filepat (starpat=".starpat.")") -" call Decho("choice<" . choice . ">") - let ichoice= ichoice + 1 + elseif dirname =~ '^\*/' + " case starpat=3: Explore */filepat (search in current directory for filenames matching filepat) + let starpat= 3 +" call Decho("(Explore) case starpat=3: Explore */filepat (starpat=".starpat.")") - " NetRead: Determine method of read (ftp, rcp, etc) {{{3 - call s:NetrwMethod(choice) - if !exists("b:netrw_method") || b:netrw_method < 0 -" call Dfunc("netrw#NetRead : unsupported method") - return - endif - let tmpfile= s:GetTempfile(b:netrw_fname) " apply correct suffix + elseif dirname=~ '^\*\*/' + " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) + let starpat= 4 +" call Decho("(Explore) case starpat=4: Explore **/filepat (starpat=".starpat.")") - " Check if NetrwBrowse() should be handling this request -" call Decho("checking if NetrwBrowse() should handle choice<".choice."> with netrw_list_cmd<".g:netrw_list_cmd.">") - if choice =~ "^.*[\/]$" && b:netrw_method != 5 && choice !~ '^http://' -" call Decho("yes, choice matches '^.*[\/]$'") - keepj call s:NetrwBrowse(0,choice) -" call Dret("netrw#NetRead :3 getcwd<".getcwd().">") - return - endif + else + let starpat= 0 +" call Decho("(Explore) case starpat=0: default") + endif - " ============ - " NetRead: Perform Protocol-Based Read {{{3 - " =========================== - if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 - echo "(netrw) Processing your read request..." + if starpat == 0 && a:indx >= 0 + " [Explore Hexplore Vexplore Sexplore] [dirname] +" call Decho("(Explore) case starpat==0 && a:indx=".a:indx.": dirname<".dirname.">, handles Explore Hexplore Vexplore Sexplore") + if dirname == "" + let dirname= curfiledir +" call Decho("(Explore) ..empty dirname, using current file's directory<".dirname.">") endif - - "......................................... - " NetRead: (rcp) NetRead Method #1 {{{3 - if b:netrw_method == 1 " read with rcp -" call Decho("read via rcp (method #1)") - " ER: nothing done with g:netrw_uid yet? - " ER: on Win2K" rcp machine[.user]:file tmpfile - " ER: if machine contains '.' adding .user is required (use $USERNAME) - " ER: the tmpfile is full path: rcp sees C:\... as host C - if s:netrw_has_nt_rcp == 1 - if exists("g:netrw_uid") && ( g:netrw_uid != "" ) - let uid_machine = g:netrw_machine .'.'. g:netrw_uid - else - " Any way needed it machine contains a '.' - let uid_machine = g:netrw_machine .'.'. $USERNAME - endif + if dirname =~ '^scp://' || dirname =~ '^ftp://' + call netrw#Nread(2,dirname) + "call s:NetrwBrowse(0,dirname) else - if exists("g:netrw_uid") && ( g:netrw_uid != "" ) - let uid_machine = g:netrw_uid .'@'. g:netrw_machine - else - let uid_machine = g:netrw_machine + if dirname == "" + let dirname= getcwd() + elseif (has("win32") || has("win95") || has("win64") || has("win16")) && !g:netrw_cygwin + if dirname !~ '^[a-zA-Z]:' + let dirname= b:netrw_curdir."/".dirname + endif + elseif dirname !~ '^/' + let dirname= b:netrw_curdir."/".dirname endif +" call Decho("(Explore) ..calling LocalBrowseCheck(dirname<".dirname.">)") + call netrw#LocalBrowseCheck(dirname) +" call Decho("(Explore) win#".winnr()." buf#".bufnr("%")." modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) + endif + if exists("w:netrw_bannercnt") + " done to handle P08-Ingelrest. :Explore will _Always_ go to the line just after the banner. + " If one wants to return the same place in the netrw window, use :Rex instead. + exe w:netrw_bannercnt endif -" call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) - exe s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1) - let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) - let b:netrw_lastfile = choice - "......................................... - " NetRead: (ftp + <.netrc>) NetRead Method #2 {{{3 - elseif b:netrw_method == 2 " read with ftp + <.netrc> -" call Decho("read via ftp+.netrc (method #2)") - let netrw_fname= b:netrw_fname - call s:SaveBufVars()|new|call s:RestoreBufVars() - let filtbuf= bufnr("%") - setlocal ff=unix - keepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline(line("$"))) - if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline(line("$"))) - endif - call setline(line("$")+1,'get "'.netrw_fname.'" '.tmpfile) -" call Decho("filter input: ".getline(line("$"))) - if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine." ".g:netrw_port,1)) - exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine." ".g:netrw_port,1) - else -" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) - exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) - endif - " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' - let debugkeep = &debug - setlocal debug=msg - call netrw#ErrorMsg(s:ERROR,getline(1),4) - let &debug = debugkeep - endif - call s:SaveBufVars() - bd! - if bufname("%") == "" && getline("$") == "" && line('$') == 1 - " needed when one sources a file in a nolbl setting window via ftp - q! - endif - call s:RestoreBufVars() - let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) - let b:netrw_lastfile = choice +" call Decho("(Explore) curdir<".curdir.">") + " --------------------------------------------------------------------- + " Jan 24, 2013: not sure why the following was present. See P08-Ingelrest +" if has("win32") || has("win95") || has("win64") || has("win16") +" keepj call search('\<'.substitute(curdir,'^.*[/\\]','','e').'\>','cW') +" else +" keepj call search('\<'.substitute(curdir,'^.*/','','e').'\>','cW') +" endif + " --------------------------------------------------------------------- - "......................................... - " NetRead: (ftp + machine,id,passwd,filename) NetRead Method #3 {{{3 - elseif b:netrw_method == 3 " read with ftp + machine, id, passwd, and fname - " Construct execution string (four lines) which will be passed through filter -" call Decho("read via ftp+mipf (method #3)") - let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) - call s:SaveBufVars()|new|call s:RestoreBufVars() - let filtbuf= bufnr("%") - setlocal ff=unix - if exists("g:netrw_port") && g:netrw_port != "" - keepj put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline('.')) - else - keepj put ='open '.g:netrw_machine -" call Decho("filter input: ".getline('.')) - endif + " starpat=1: Explore *//pattern (current directory only search for files containing pattern) + " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) + " starpat=3: Explore */filepat (search in current directory for filenames matching filepat) + " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) + elseif a:indx <= 0 + " Nexplore, Pexplore, Explore: handle starpat +" call Decho("(Explore) case a:indx<=0: Nexplore, Pexplore, , starpat=".starpat." a:indx=".a:indx) + if !mapcheck("","n") && !mapcheck("","n") && exists("b:netrw_curdir") +" call Decho("(Explore) ..set up and maps") + let s:didstarstar= 1 + nnoremap :Pexplore + nnoremap :Nexplore + endif - if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid -" call Decho("filter input: ".getline('.')) - keepj put ='\"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('.')) - else - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('.')) + if has("path_extra") +" call Decho("(Explore) ..starpat=".starpat.": has +path_extra") + if !exists("w:netrw_explore_indx") + let w:netrw_explore_indx= 0 endif - if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" - keepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('.')) - endif - if exists("g:netrw_ftpextracmd") - put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('.')) - endif - keepj put ='get \"'.netrw_fname.'\" '.tmpfile -" call Decho("filter input: ".getline('.')) + let indx = a:indx +" call Decho("(Explore) ..starpat=".starpat.": set indx= [a:indx=".indx."]") - " perform ftp: - " -i : turns off interactive prompting from ftp - " -n unix : DON'T use <.netrc>, even though it exists - " -n win32: quit being obnoxious about password - norm! 1Gdd -" call Decho("executing: %!".g:netrw_ftp_cmd." -i -n") - exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n" - " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - if getline(1) !~ "^$" -" call Decho("error<".getline(1).">") - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,getline(1),5) + if indx == -1 + " Nexplore +" call Decho("(Explore) ..case Nexplore with starpat=".starpat.": (indx=".indx.")") + if !exists("w:netrw_explore_list") " sanity check + keepj call netrw#ErrorMsg(s:WARNING,"using Nexplore or improperly; see help for netrw-starstar",40) + sil! let @* = keepregstar + sil! let @+ = keepregstar + sil! let @/ = keepregslash +" call Dret("netrw#Explore") + return endif - endif - call s:SaveBufVars()|bd!|call s:RestoreBufVars() - let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) - let b:netrw_lastfile = choice + let indx= w:netrw_explore_indx + if indx < 0 | let indx= 0 | endif + if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif + let curfile= w:netrw_explore_list[indx] +" call Decho("(Explore) ....indx=".indx." curfile<".curfile.">") + while indx < w:netrw_explore_listlen && curfile == w:netrw_explore_list[indx] + let indx= indx + 1 +" call Decho("(Explore) ....indx=".indx." (Nexplore while loop)") + endwhile + if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif +" call Decho("(Explore) ....Nexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx) - "......................................... - " NetRead: (scp) NetRead Method #4 {{{3 - elseif b:netrw_method == 4 " read with scp -" call Decho("read via scp (method #4)") - if exists("g:netrw_port") && g:netrw_port != "" - let useport= " ".g:netrw_scpport." ".g:netrw_port - else - let useport= "" - endif -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) - exe s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1) - let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) - let b:netrw_lastfile = choice - - "......................................... - " NetRead: (http) NetRead Method #5 (wget) {{{3 - elseif b:netrw_method == 5 -" call Decho("read via http (method #5)") - if g:netrw_http_cmd == "" - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"neither the wget nor the fetch command is available",6) + elseif indx == -2 + " Pexplore +" call Decho("(Explore) case Pexplore with starpat=".starpat.": (indx=".indx.")") + if !exists("w:netrw_explore_list") " sanity check + keepj call netrw#ErrorMsg(s:WARNING,"using Pexplore or improperly; see help for netrw-starstar",41) + sil! let @* = keepregstar + sil! let @+ = keepregstar + sil! let @/ = keepregslash +" call Dret("netrw#Explore") + return endif -" call Dret("netrw#NetRead :4 getcwd<".getcwd().">") - return - endif + let indx= w:netrw_explore_indx + if indx < 0 | let indx= 0 | endif + if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif + let curfile= w:netrw_explore_list[indx] +" call Decho("(Explore) ....indx=".indx." curfile<".curfile.">") + while indx >= 0 && curfile == w:netrw_explore_list[indx] + let indx= indx - 1 +" call Decho("(Explore) ....indx=".indx." (Pexplore while loop)") + endwhile + if indx < 0 | let indx= 0 | endif +" call Decho("(Explore) ....Pexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx) - if match(b:netrw_fname,"#") == -1 || exists("g:netrw_http_xcmd") - " using g:netrw_http_cmd (usually elinks, links, curl, wget, or fetch) -" call Decho('using '.g:netrw_http_cmd.' (# not in b:netrw_fname<'.b:netrw_fname.">)") - if exists("g:netrw_http_xcmd") -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape("http://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".shellescape(tmpfile,1)) - exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape("http://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".shellescape(tmpfile,1) - else -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape("http://".g:netrw_machine.b:netrw_fname,1)) - exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape("http://".g:netrw_machine.b:netrw_fname,1) + else + " Explore -- initialize + " build list of files to Explore with Nexplore/Pexplore +" call Decho("(Explore) ..starpat=".starpat.": case Explore: initialize (indx=".indx.")") + keepj keepalt call s:NetrwClearExplore() + let w:netrw_explore_indx= 0 + if !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() endif - let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) +" call Decho("(Explore) ....starpat=".starpat.": b:netrw_curdir<".b:netrw_curdir.">") - else - " wget/curl/fetch plus a jump to an in-page marker (ie. http://abc/def.html#aMarker) -" call Decho(("wget/curl plus jump (# in b:netrw_fname<".b:netrw_fname.">)") - let netrw_html= substitute(b:netrw_fname,"#.*$","","") - let netrw_tag = substitute(b:netrw_fname,"^.*#","","") -" call Decho("netrw_html<".netrw_html.">") -" call Decho("netrw_tag <".netrw_tag.">") -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape("http://".g:netrw_machine.netrw_html,1)) - exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape("http://".g:netrw_machine.netrw_html,1) - let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) -" call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/') - exe 'norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\" - endif - let b:netrw_lastfile = choice - setlocal ro + " switch on starpat to build the w:netrw_explore_list of files + if starpat == 1 + " starpat=1: Explore *//pattern (current directory only search for files containing pattern) +" call Decho("(Explore) ..case starpat=".starpat.": build *//pattern list (curdir-only srch for files containing pattern) &hls=".&hls) +" call Decho("(Explore) ....pattern<".pattern.">") + try + exe "keepj noautocmd vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*" + catch /^Vim\%((\a\+)\)\=:E480/ + keepalt call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76) +" call Dret("netrw#Explore : unable to find pattern<".pattern.">") + return + endtry + let w:netrw_explore_list = s:NetrwExploreListUniq(map(getqflist(),'bufname(v:val.bufnr)')) + if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif - "......................................... - " NetRead: (dav) NetRead Method #6 {{{3 - elseif b:netrw_method == 6 -" call Decho("read via cadaver (method #6)") + elseif starpat == 2 + " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) +" call Decho("(Explore) ..case starpat=".starpat.": build **//pattern list (recursive descent files containing pattern)") +" call Decho("(Explore) ....pattern<".pattern.">") + try + exe "sil keepj noautocmd keepalt vimgrep /".pattern."/gj "."**/*" + catch /^Vim\%((\a\+)\)\=:E480/ + keepalt call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45) + if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif + sil! let @* = keepregstar + sil! let @+ = keepregstar + sil! let @/ = keepregslash +" call Dret("netrw#Explore : no files matched pattern") + return + endtry + let s:netrw_curdir = b:netrw_curdir + let w:netrw_explore_list = getqflist() + let w:netrw_explore_list = s:NetrwExploreListUniq(map(w:netrw_explore_list,'s:netrw_curdir."/".bufname(v:val.bufnr)')) + if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif - if !executable(g:netrw_dav_cmd) - call netrw#ErrorMsg(s:ERROR,g:netrw_dav_cmd." is not executable",73) -" call Dret("netrw#NetRead : ".g:netrw_dav_cmd." not executable") - return - endif - if g:netrw_dav_cmd =~ "curl" -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_dav_cmd." ".shellescape("dav://".g:netrw_machine.b:netrw_fname,1)." ".shellescape(tmpfile,1)) - exe s:netrw_silentxfer."!".g:netrw_dav_cmd." ".shellescape("dav://".g:netrw_machine.b:netrw_fname,1)." ".shellescape(tmpfile,1) - else - " Construct execution string (four lines) which will be passed through filter - let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) - new - setlocal ff=unix - if exists("g:netrw_port") && g:netrw_port != "" - keepj put ='open '.g:netrw_machine.' '.g:netrw_port - else - keepj put ='open '.g:netrw_machine - endif - keepj put ='user '.g:netrw_uid.' '.s:netrw_passwd - keepj put ='get '.netrw_fname.' '.tmpfile - keepj put ='quit' + elseif starpat == 3 + " starpat=3: Explore */filepat (search in current directory for filenames matching filepat) +" call Decho("(Explore) ..case starpat=".starpat.": build */filepat list (curdir-only srch filenames matching filepat) &hls=".&hls) + let filepat= substitute(dirname,'^\*/','','') + let filepat= substitute(filepat,'^[%#<]','\\&','') +" call Decho("(Explore) ....b:netrw_curdir<".b:netrw_curdir.">") +" call Decho("(Explore) ....filepat<".filepat.">") + let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".filepat),'\n')) + if &hls | let keepregslash= s:ExplorePatHls(filepat) | endif - " perform cadaver operation: - keepj norm! 1Gdd -" call Decho("executing: %!".g:netrw_dav_cmd) - exe s:netrw_silentxfer."%!".g:netrw_dav_cmd - bd! - endif - let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) - let b:netrw_lastfile = choice + elseif starpat == 4 + " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) +" call Decho("(Explore) ..case starpat=".starpat.": build **/filepat list (recursive descent srch filenames matching filepat) &hls=".&hls) + let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".dirname),'\n')) + if &hls | let keepregslash= s:ExplorePatHls(dirname) | endif + endif " switch on starpat to build w:netrw_explore_list - "......................................... - " NetRead: (rsync) NetRead Method #7 {{{3 - elseif b:netrw_method == 7 -" call Decho("read via rsync (method #7)") -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) - exe s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1) - let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) - let b:netrw_lastfile = choice + let w:netrw_explore_listlen = len(w:netrw_explore_list) +" call Decho("(Explore) ....w:netrw_explore_list<".string(w:netrw_explore_list).">") +" call Decho("(Explore) ....w:netrw_explore_listlen=".w:netrw_explore_listlen) - "......................................... - " NetRead: (fetch) NetRead Method #8 {{{3 - " fetch://[user@]host[:http]/path - elseif b:netrw_method == 8 -" call Decho("read via fetch (method #8)") - if g:netrw_fetch_cmd == "" - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"fetch command not available",7) + if w:netrw_explore_listlen == 0 || (w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/') + keepalt keepj call netrw#ErrorMsg(s:WARNING,"no files matched",42) + sil! let @* = keepregstar + sil! let @+ = keepregstar + sil! let @/ = keepregslash +" call Dret("netrw#Explore : no files matched") + return endif -" call Dret("NetRead") - endif - if exists("g:netrw_option") && g:netrw_option == ":http" - let netrw_option= "http" - else - let netrw_option= "ftp" - endif -" call Decho("read via fetch for ".netrw_option) + endif " if indx ... endif - if exists("g:netrw_uid") && g:netrw_uid != "" && exists("s:netrw_passwd") && s:netrw_passwd != "" -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".b:netrw_fname,1)) - exe s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".b:netrw_fname,1) - else -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_machine."/".b:netrw_fname,1)) - exe s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_machine."/".b:netrw_fname,1) + " NetrwStatusLine support - for exploring support + let w:netrw_explore_indx= indx +" call Decho("(Explore) ....w:netrw_explore_list<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen) + + " wrap the indx around, but issue a note + if indx >= w:netrw_explore_listlen || indx < 0 +" call Decho("(Explore) ....wrap indx (indx=".indx." listlen=".w:netrw_explore_listlen.")") + let indx = (indx < 0)? ( w:netrw_explore_listlen - 1 ) : 0 + let w:netrw_explore_indx= indx + keepalt keepj call netrw#ErrorMsg(s:NOTE,"no more files match Explore pattern",43) endif - let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) - let b:netrw_lastfile = choice - setlocal ro + exe "let dirfile= w:netrw_explore_list[".indx."]" +" call Decho("(Explore) ....dirfile=w:netrw_explore_list[indx=".indx."]= <".dirfile.">") + let newdir= substitute(dirfile,'/[^/]*$','','e') +" call Decho("(Explore) ....newdir<".newdir.">") - "......................................... - " NetRead: (sftp) NetRead Method #9 {{{3 - elseif b:netrw_method == 9 -" call Decho("read via sftp (method #9)") -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile) - exe s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile - let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) - let b:netrw_lastfile = choice +" call Decho("(Explore) ....calling LocalBrowseCheck(newdir<".newdir.">)") + call netrw#LocalBrowseCheck(newdir) + if !exists("w:netrw_liststyle") + let w:netrw_liststyle= g:netrw_liststyle + endif + if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:LONGLIST + keepalt keepj call search('^'.substitute(dirfile,"^.*/","","").'\>',"W") + else + keepalt keepj call search('\<'.substitute(dirfile,"^.*/","","").'\>',"w") + endif + let w:netrw_explore_mtchcnt = indx + 1 + let w:netrw_explore_bufnr = bufnr("%") + let w:netrw_explore_line = line(".") + keepalt keepj call s:SetupNetrwStatusLine('%f %h%m%r%=%9*%{NetrwStatusLine()}') +" call Decho("(Explore) ....explore: mtchcnt=".w:netrw_explore_mtchcnt." bufnr=".w:netrw_explore_bufnr." line#".w:netrw_explore_line) - "......................................... - " NetRead: Complain {{{3 else - call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",8) +" call Decho("(Explore) ..your vim does not have +path_extra") + if !exists("g:netrw_quiet") + keepalt keepj call netrw#ErrorMsg(s:WARNING,"your vim needs the +path_extra feature for Exploring with **!",44) + endif + sil! let @* = keepregstar + sil! let @+ = keepregstar + sil! let @/ = keepregslash +" call Dret("netrw#Explore : missing +path_extra") + return endif - endwhile - - " NetRead: cleanup {{{3 - if exists("b:netrw_method") -" call Decho("cleanup b:netrw_method and b:netrw_fname") - unlet b:netrw_method - unlet b:netrw_fname - endif - if s:FileReadable(tmpfile) && tmpfile !~ '.tar.bz2$' && tmpfile !~ '.tar.gz$' && tmpfile !~ '.zip' && tmpfile !~ '.tar' && readcmd != 't' && tmpfile !~ '.tar.xz$' && tmpfile !~ '.txz' -" call Decho("cleanup by deleting tmpfile<".tmpfile.">") - call s:NetrwDelete(tmpfile) - endif - call s:NetrwOptionRestore("w:") - -" call Dret("netrw#NetRead :5 getcwd<".getcwd().">") -endfun - -" ------------------------------------------------------------------------ -" netrw#NetWrite: responsible for writing a file over the net {{{2 -fun! netrw#NetWrite(...) range -" call Dfunc("netrw#NetWrite(a:0=".a:0.") ".g:loaded_netrw) - - " NetWrite: option handling {{{3 - let mod= 0 - call s:NetrwOptionSave("w:") - call s:NetrwSafeOptions() - - " NetWrite: Get Temporary Filename {{{3 - let tmpfile= s:GetTempfile("") - if tmpfile == "" -" call Dret("netrw#NetWrite : unable to get a tempfile!") - return - endif - if a:0 == 0 - let ichoice = 0 else - let ichoice = 1 +" call Decho("(Explore) ..default case: Explore newdir<".dirname.">") + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && dirname =~ '/' + sil! unlet w:netrw_treedict + sil! unlet w:netrw_treetop + endif + let newdir= dirname + if !exists("b:netrw_curdir") + keepj call netrw#LocalBrowseCheck(getcwd()) + else + keepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,newdir)) + endif endif - let curbufname= expand("%") -" call Decho("curbufname<".curbufname.">") - if &binary - " For binary writes, always write entire file. - " (line numbers don't really make sense for that). - " Also supports the writing of tar and zip files. -" call Decho("(write entire file) silent exe w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile)) - exe "silent keepj w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile) - elseif g:netrw_cygwin - " write (selected portion of) file to temporary - let cygtmpfile= substitute(tmpfile,'/cygdrive/\(.\)','\1:','') -" call Decho("(write selected portion) silent exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile)) - exe "sil keepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile) + " visual display of **/ **// */ Exploration files +" call Decho("(Explore) w:netrw_explore_indx=".(exists("w:netrw_explore_indx")? w:netrw_explore_indx : "doesn't exist")) +" call Decho("(Explore) b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "n/a").">") + if exists("w:netrw_explore_indx") && exists("b:netrw_curdir") +" call Decho("(Explore) s:explore_prvdir<".(exists("s:explore_prvdir")? s:explore_prvdir : "-doesn't exist-")) + if !exists("s:explore_prvdir") || s:explore_prvdir != b:netrw_curdir + " only update match list if current directory isn't the same as before +" call Decho("(Explore) only update match list if current directory not the same as before") + let s:explore_prvdir = b:netrw_curdir + let s:explore_match = "" + let dirlen = s:Strlen(b:netrw_curdir) + if b:netrw_curdir !~ '/$' + let dirlen= dirlen + 1 + endif + let prvfname= "" + for fname in w:netrw_explore_list +" call Decho("(Explore) fname<".fname.">") + if fname =~ '^'.b:netrw_curdir + if s:explore_match == "" + let s:explore_match= '\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>' + else + let s:explore_match= s:explore_match.'\|\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>' + endif + elseif fname !~ '^/' && fname != prvfname + if s:explore_match == "" + let s:explore_match= '\<'.escape(fname,g:netrw_markfileesc).'\>' + else + let s:explore_match= s:explore_match.'\|\<'.escape(fname,g:netrw_markfileesc).'\>' + endif + endif + let prvfname= fname + endfor +" call Decho("(Explore) explore_match<".s:explore_match.">") + exe "2match netrwMarkFile /".s:explore_match."/" + endif + echo "==Pexplore ==Nexplore" else - " write (selected portion of) file to temporary -" call Decho("(write selected portion) silent exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile)) - exe "sil keepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile) + 2match none + if exists("s:explore_match") | unlet s:explore_match | endif + if exists("s:explore_prvdir") | unlet s:explore_prvdir | endif + echo " " +" call Decho("(Explore) cleared explore match list") endif - if curbufname == "" - " if the file is [No Name], and one attempts to Nwrite it, the buffer takes - " on the temporary file's name. Deletion of the temporary file during - " cleanup then causes an error message. - 0file! + sil! let @* = keepregstar + sil! let @+ = keepregstar + sil! let @/ = keepregslash +" call Dret("netrw#Explore : @/<".@/.">") +endfun + +" --------------------------------------------------------------------- +" netrw#NetrwMakeTgt: make a target out of the directory name provided {{{2 +fun! netrw#NetrwMakeTgt(dname) +" call Dfunc("netrw#NetrwMakeTgt(dname<".a:dname.">)") + " simplify the target (eg. /abc/def/../ghi -> /abc/ghi) + let svpos = netrw#NetrwSavePosn() + let s:netrwmftgt_islocal= (a:dname !~ '^\a\+://') +" call Decho("s:netrwmftgt_islocal=".s:netrwmftgt_islocal) + if s:netrwmftgt_islocal + let netrwmftgt= simplify(a:dname) + else + let netrwmftgt= a:dname + endif + if exists("s:netrwmftgt") && netrwmftgt == s:netrwmftgt + " re-selected target, so just clear it + unlet s:netrwmftgt s:netrwmftgt_islocal + else + let s:netrwmftgt= netrwmftgt + endif + if g:netrw_fastbrowse <= 1 + call s:NetrwRefresh((b:netrw_curdir !~ '\a\+://'),b:netrw_curdir) endif + call netrw#NetrwRestorePosn(svpos) +" call Dret("netrw#NetrwMakeTgt") +endfun - " NetWrite: while choice loop: {{{3 - while ichoice <= a:0 +" --------------------------------------------------------------------- +" netrw#NetrwClean: remove netrw {{{2 +" supports :NetrwClean -- remove netrw from first directory on runtimepath +" :NetrwClean! -- remove netrw from all directories on runtimepath +fun! netrw#NetrwClean(sys) +" call Dfunc("netrw#NetrwClean(sys=".a:sys.")") - " Process arguments: {{{4 - " attempt to repeat with previous host-file-etc - if exists("b:netrw_lastfile") && a:0 == 0 -" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">") - let choice = b:netrw_lastfile - let ichoice= ichoice + 1 - else - exe "let choice= a:" . ichoice + if a:sys + let choice= confirm("Remove personal and system copies of netrw?","&Yes\n&No") + else + let choice= confirm("Remove personal copy of netrw?","&Yes\n&No") + endif +" call Decho("choice=".choice) + let diddel= 0 + let diddir= "" - " Reconstruct Choice if choice starts with '"' - if match(choice,"?") == 0 - echomsg 'NetWrite Usage:"' - echomsg ':Nwrite machine:path uses rcp' - echomsg ':Nwrite "machine path" uses ftp with <.netrc>' - echomsg ':Nwrite "machine id password path" uses ftp' - echomsg ':Nwrite dav://[user@]machine/path uses cadaver' - echomsg ':Nwrite fetch://[user@]machine/path uses fetch' - echomsg ':Nwrite ftp://machine[#port]/path uses ftp (autodetects <.netrc>)' - echomsg ':Nwrite rcp://machine/path uses rcp' - echomsg ':Nwrite rsync://[user@]machine/path uses rsync' - echomsg ':Nwrite scp://[user@]machine[[:#]port]/path uses scp' - echomsg ':Nwrite sftp://[user@]machine/path uses sftp' - sleep 4 - break + if choice == 1 + for dir in split(&rtp,',') + if filereadable(dir."/plugin/netrwPlugin.vim") +" call Decho("removing netrw-related files from ".dir) + if s:NetrwDelete(dir."/plugin/netrwPlugin.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/plugin/netrwPlugin.vim",55) |endif + if s:NetrwDelete(dir."/autoload/netrwFileHandlers.vim")|call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrwFileHandlers.vim",55)|endif + if s:NetrwDelete(dir."/autoload/netrwSettings.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrwSettings.vim",55) |endif + if s:NetrwDelete(dir."/autoload/netrw.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrw.vim",55) |endif + if s:NetrwDelete(dir."/syntax/netrw.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/syntax/netrw.vim",55) |endif + if s:NetrwDelete(dir."/syntax/netrwlist.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/syntax/netrwlist.vim",55) |endif + let diddir= dir + let diddel= diddel + 1 + if !a:sys|break|endif + endif + endfor + endif - elseif match(choice,"^\"") != -1 - if match(choice,"\"$") != -1 - " case "..." - let choice=strpart(choice,1,strlen(choice)-2) - else - " case "... ... ..." - let choice = strpart(choice,1,strlen(choice)-1) - let wholechoice = "" + echohl WarningMsg + if diddel == 0 + echomsg "netrw is either not installed or not removable" + elseif diddel == 1 + echomsg "removed one copy of netrw from <".diddir.">" + else + echomsg "removed ".diddel." copies of netrw" + endif + echohl None - while match(choice,"\"$") == -1 - let wholechoice= wholechoice . " " . choice - let ichoice = ichoice + 1 - if choice > a:0 - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",13) - endif -" call Dret("netrw#NetWrite") - return - endif - let choice= a:{ichoice} - endwhile - let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1) - endif - endif - endif - let ichoice= ichoice + 1 -" call Decho("choice<" . choice . "> ichoice=".ichoice) +" call Dret("netrw#NetrwClean") +endfun - " Determine method of write (ftp, rcp, etc) {{{4 - call s:NetrwMethod(choice) - if !exists("b:netrw_method") || b:netrw_method < 0 -" call Dfunc("netrw#NetWrite : unsupported method") - return - endif +" --------------------------------------------------------------------- +" netrw#Nread: {{{2 +fun! netrw#Nread(mode,fname) +" call Dfunc("netrw#Nread(mode=".a:mode." fname<".a:fname.">)") + call netrw#NetrwSavePosn() + call netrw#NetRead(a:mode,a:fname) + call netrw#NetrwRestorePosn() +" call Dret("netrw#Nread") +endfun - " ============= - " NetWrite: Perform Protocol-Based Write {{{3 - " ============================ - if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 - echo "(netrw) Processing your write request..." -" call Decho("(netrw) Processing your write request...") - endif +" ------------------------------------------------------------------------ +" netrw#NetrwObtain: {{{2 +" netrw#NetrwObtain(islocal,fname[,tgtdirectory]) +" islocal=0 obtain from remote source +" =1 obtain from local source +" fname : a filename or a list of filenames +" tgtdir : optional place where files are to go (not present, uses getcwd()) +fun! netrw#NetrwObtain(islocal,fname,...) +" call Dfunc("netrw#NetrwObtain(islocal=".a:islocal." fname<".((type(a:fname) == 1)? a:fname : string(a:fname)).">) a:0=".a:0) + " NetrwStatusLine support - for obtaining support - "......................................... - " NetWrite: (rcp) NetWrite Method #1 {{{3 - if b:netrw_method == 1 -" call Decho("write via rcp (method #1)") - if s:netrw_has_nt_rcp == 1 - if exists("g:netrw_uid") && ( g:netrw_uid != "" ) - let uid_machine = g:netrw_machine .'.'. g:netrw_uid - else - let uid_machine = g:netrw_machine .'.'. $USERNAME - endif + if type(a:fname) == 1 + let fnamelist= [ a:fname ] + elseif type(a:fname) == 3 + let fnamelist= a:fname + else + call netrw#ErrorMsg(s:ERROR,"attempting to use NetrwObtain on something not a filename or a list",62) +" call Dret("netrw#NetrwObtain") + return + endif +" call Decho("fnamelist<".string(fnamelist).">") + if a:0 > 0 + let tgtdir= a:1 + else + let tgtdir= getcwd() + endif +" call Decho("tgtdir<".tgtdir.">") + + if exists("b:netrw_islocal") && b:netrw_islocal + " obtain a file from local b:netrw_curdir to (local) tgtdir +" call Decho("obtain a file from local ".b:netrw_curdir." to ".tgtdir) + if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir + let topath= s:ComposePath(tgtdir,"") + if (has("win32") || has("win95") || has("win64") || has("win16")) + " transfer files one at time +" call Decho("transfer files one at a time") + for fname in fnamelist +" call Decho("system(".g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath).")") + call system(g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath)) + if v:shell_error != 0 + call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80) +" call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath)) + return + endif + endfor else - if exists("g:netrw_uid") && ( g:netrw_uid != "" ) - let uid_machine = g:netrw_uid .'@'. g:netrw_machine - else - let uid_machine = g:netrw_machine + " transfer files with one command +" call Decho("transfer files with one command") + let filelist= join(map(deepcopy(fnamelist),"shellescape(v:val)")) +" call Decho("system(".g:netrw_localcopycmd." ".filelist." ".shellescape(topath).")") + call system(g:netrw_localcopycmd." ".filelist." ".shellescape(topath)) + if v:shell_error != 0 + call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80) +" call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".filelist." ".shellescape(topath)) + return endif endif -" call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(tmpfile,1)." ".shellescape(uid_machine.":".b:netrw_fname,1)) - exe s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(tmpfile,1)." ".shellescape(uid_machine.":".b:netrw_fname,1) - let b:netrw_lastfile = choice - - "......................................... - " NetWrite: (ftp + <.netrc>) NetWrite Method #2 {{{3 - elseif b:netrw_method == 2 -" call Decho("write via ftp+.netrc (method #2)") - let netrw_fname = b:netrw_fname + elseif !exists("b:netrw_curdir") + call netrw#ErrorMsg(s:ERROR,"local browsing directory doesn't exist!",36) + else + call netrw#ErrorMsg(s:WARNING,"local browsing directory and current directory are identical",37) + endif - " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead - let bhkeep = &l:bh - let curbuf = bufnr("%") - setlocal bh=hide - enew + else + " obtain files from remote b:netrw_curdir to local tgtdir +" call Decho("obtain a file from remote ".b:netrw_curdir." to ".tgtdir) + if type(a:fname) == 1 + call s:SetupNetrwStatusLine('%f %h%m%r%=%9*Obtaining '.a:fname) + endif + call s:NetrwMethod(b:netrw_curdir) -" call Decho("filter input window#".winnr()) - setlocal ff=unix - keepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) - if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline("$")) - endif - call setline(line("$")+1,'put "'.tmpfile.'" "'.netrw_fname.'"') -" call Decho("filter input: ".getline("$")) + if b:netrw_method == 4 + " obtain file using scp +" call Decho("obtain via scp (method#4)") if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) - exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) + let useport= " ".g:netrw_scpport." ".g:netrw_port else -" call Decho("filter input window#".winnr()) -" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) - exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) + let useport= "" endif - " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - if getline(1) !~ "^$" - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,getline(1),14) - endif - let mod=1 + if b:netrw_fname =~ '/' + let path= substitute(b:netrw_fname,'^\(.*/\).\{-}$','\1','') + else + let path= "" endif + let filelist= join(map(deepcopy(fnamelist),'shellescape(g:netrw_machine.":".path.v:val,1)')) +" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1)) + exe s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1) - " remove enew buffer (quietly) - let filtbuf= bufnr("%") - exe curbuf."b!" - let &l:bh = bhkeep - exe filtbuf."bw!" + elseif b:netrw_method == 2 + " obtain file using ftp + .netrc +" call Decho("obtain via ftp+.netrc (method #2)") + call s:SaveBufVars()|sil keepjumps new|call s:RestoreBufVars() + let tmpbufnr= bufnr("%") + setl ff=unix + if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" + keepj put =g:netrw_ftpmode +" call Decho("filter input: ".getline('$')) + endif - let b:netrw_lastfile = choice + if exists("b:netrw_fname") && b:netrw_fname != "" + call setline(line("$")+1,'cd "'.b:netrw_fname.'"') +" call Decho("filter input: ".getline('$')) + endif - "......................................... - " NetWrite: (ftp + machine, id, passwd, filename) NetWrite Method #3 {{{3 - elseif b:netrw_method == 3 - " Construct execution string (three or more lines) which will be passed through filter -" call Decho("read via ftp+mipf (method #3)") - let netrw_fname = b:netrw_fname - let bhkeep = &l:bh + if exists("g:netrw_ftpextracmd") + keepj put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline('$')) + endif + for fname in fnamelist + call setline(line("$")+1,'get "'.fname.'"') +" call Decho("filter input: ".getline('$')) + endfor + if exists("g:netrw_port") && g:netrw_port != "" +" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) + exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) + else +" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) + exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) + endif + " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) + if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' + let debugkeep= &debug + setl debug=msg + call netrw#ErrorMsg(s:ERROR,getline(1),4) + let &debug= debugkeep + endif - " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead - let curbuf = bufnr("%") - setlocal bh=hide - enew - setlocal ff=unix + elseif b:netrw_method == 3 + " obtain with ftp + machine, id, passwd, and fname (ie. no .netrc) +" call Decho("obtain via ftp+mipf (method #3)") + call s:SaveBufVars()|sil keepjumps new|call s:RestoreBufVars() + let tmpbufnr= bufnr("%") + setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" keepj put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('$')) else keepj put ='open '.g:netrw_machine -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('$')) endif - if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid -" call Decho("filter input: ".getline('.')) - keepj put ='\"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('.')) - else - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('.')) + + if exists("g:netrw_uid") && g:netrw_uid != "" + if exists("g:netrw_ftp") && g:netrw_ftp == 1 + keepj put =g:netrw_uid +" call Decho("filter input: ".getline('$')) + if exists("s:netrw_passwd") && s:netrw_passwd != "" + keepj put ='\"'.s:netrw_passwd.'\"' + endif +" call Decho("filter input: ".getline('$')) + elseif exists("s:netrw_passwd") + keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' +" call Decho("filter input: ".getline('$')) + endif endif - keepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) + + if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" + keepj put =g:netrw_ftpmode +" call Decho("filter input: ".getline('$')) + endif + + if exists("b:netrw_fname") && b:netrw_fname != "" + keepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') +" call Decho("filter input: ".getline('$')) + endif + if exists("g:netrw_ftpextracmd") keepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline("$")) +" call Decho("filter input: ".getline('$')) endif - keepj put ='put \"'.tmpfile.'\" \"'.netrw_fname.'\"' -" call Decho("filter input: ".getline('.')) - " save choice/id/password for future use - let b:netrw_lastfile = choice + + if exists("g:netrw_ftpextracmd") + keepj put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline('$')) + endif + for fname in fnamelist + keepj call setline(line("$")+1,'get "'.fname.'"') + endfor +" call Decho("filter input: ".getline('$')) " perform ftp: " -i : turns off interactive prompting from ftp " -n unix : DON'T use <.netrc>, even though it exists " -n win32: quit being obnoxious about password keepj norm! 1Gdd -" call Decho("executing: %!".g:netrw_ftp_cmd." -i -n") - exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n" +" call Decho("executing: %!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) + exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,getline(1),15) +" call Decho("error<".getline(1).">") + if !exists("g:netrw_quiet") + keepj call netrw#ErrorMsg(s:ERROR,getline(1),5) endif - let mod=1 endif + elseif !exists("b:netrw_method") || b:netrw_method < 0 +" call Dfunc("netrw#NetrwObtain : unsupported method") + return + endif - " remove enew buffer (quietly) - let filtbuf= bufnr("%") - exe curbuf."b!" - let &l:bh= bhkeep - exe filtbuf."bw!" - - "......................................... - " NetWrite: (scp) NetWrite Method #4 {{{3 - elseif b:netrw_method == 4 -" call Decho("write via scp (method #4)") - if exists("g:netrw_port") && g:netrw_port != "" - let useport= " ".g:netrw_scpport." ".fnameescape(g:netrw_port) - else - let useport= "" - endif -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)) - exe s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1) - let b:netrw_lastfile = choice + " restore status line + if type(a:fname) == 1 && exists("s:netrw_users_stl") + keepj call s:SetupNetrwStatusLine(s:netrw_users_stl) + endif - "......................................... - " NetWrite: (http) NetWrite Method #5 {{{3 - elseif b:netrw_method == 5 -" call Decho("write via http (method #5)") - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"currently does not support writing using http:",16) - endif + endif - "......................................... - " NetWrite: (dav) NetWrite Method #6 (cadaver) {{{3 - elseif b:netrw_method == 6 -" call Decho("write via cadaver (method #6)") + " cleanup + if exists("tmpbufnr") + if bufnr("%") != tmpbufnr + exe tmpbufnr."bw!" + else + q! + endif + endif - " Construct execution string (four lines) which will be passed through filter - let netrw_fname = escape(b:netrw_fname,g:netrw_fname_escape) - let bhkeep = &l:bh +" call Dret("netrw#NetrwObtain") +endfun - " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead - let curbuf = bufnr("%") - setlocal bh=hide - enew +" --------------------------------------------------------------------- +" NetrwStatusLine: {{{2 +fun! NetrwStatusLine() - setlocal ff=unix - if exists("g:netrw_port") && g:netrw_port != "" - keepj put ='open '.g:netrw_machine.' '.g:netrw_port - else - keepj put ='open '.g:netrw_machine - endif - if exists("g:netrw_uid") && exists("s:netrw_passwd") - keepj put ='user '.g:netrw_uid.' '.s:netrw_passwd - endif - keepj put ='put '.tmpfile.' '.netrw_fname +" vvv NetrwStatusLine() debugging vvv +" let g:stlmsg="" +" if !exists("w:netrw_explore_bufnr") +" let g:stlmsg="!X" +" elseif w:netrw_explore_bufnr != bufnr("%") +" let g:stlmsg="explore_bufnr!=".bufnr("%") +" endif +" if !exists("w:netrw_explore_line") +" let g:stlmsg=" !X" +" elseif w:netrw_explore_line != line(".") +" let g:stlmsg=" explore_line!={line(.)<".line(".").">" +" endif +" if !exists("w:netrw_explore_list") +" let g:stlmsg=" !X" +" endif +" ^^^ NetrwStatusLine() debugging ^^^ - " perform cadaver operation: - keepj norm! 1Gdd -" call Decho("executing: %!".g:netrw_dav_cmd) - exe s:netrw_silentxfer."%!".g:netrw_dav_cmd + if !exists("w:netrw_explore_bufnr") || w:netrw_explore_bufnr != bufnr("%") || !exists("w:netrw_explore_line") || w:netrw_explore_line != line(".") || !exists("w:netrw_explore_list") + " restore user's status line + let &stl = s:netrw_users_stl + let &laststatus = s:netrw_users_ls + if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif + if exists("w:netrw_explore_line") |unlet w:netrw_explore_line |endif + return "" + else + return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen + endif +endfun - " remove enew buffer (quietly) - let filtbuf= bufnr("%") - exe curbuf."b!" - let &l:bh = bhkeep - exe filtbuf."bw!" +" --------------------------------------------------------------------- +" Netrw Transfer Functions: {{{1 +" =============================== - let b:netrw_lastfile = choice +" ------------------------------------------------------------------------ +" netrw#NetRead: responsible for reading a file over the net {{{2 +" mode: =0 read remote file and insert before current line +" =1 read remote file and insert after current line +" =2 replace with remote file +" =3 obtain file, but leave in temporary format +fun! netrw#NetRead(mode,...) +" call Dfunc("netrw#NetRead(mode=".a:mode.",...) a:0=".a:0." ".g:loaded_netrw.((a:0 > 0)? " a:1<".a:1.">" : "")) - "......................................... - " NetWrite: (rsync) NetWrite Method #7 {{{3 - elseif b:netrw_method == 7 -" call Decho("write via rsync (method #7)") -" call Decho("executing: !".g:netrw_rsync_cmd." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)) - exe s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1) - let b:netrw_lastfile = choice + " NetRead: save options {{{3 + call s:NetrwOptionSave("w:") + call s:NetrwSafeOptions() + call s:RestoreCursorline() - "......................................... - " NetWrite: (sftp) NetWrite Method #9 {{{3 - elseif b:netrw_method == 9 -" call Decho("read via sftp (method #9)") - let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) - if exists("g:netrw_uid") && ( g:netrw_uid != "" ) - let uid_machine = g:netrw_uid .'@'. g:netrw_machine - else - let uid_machine = g:netrw_machine - endif - - " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead - let bhkeep = &l:bh - let curbuf = bufnr("%") - setlocal bh=hide - enew - - setlocal ff=unix - call setline(1,'put "'.escape(tmpfile,'\').'" '.netrw_fname) -" call Decho("filter input: ".getline('.')) -" call Decho("executing: %!".g:netrw_sftp_cmd.' '.shellescape(uid_machine,1)) - exe s:netrw_silentxfer."%!".g:netrw_sftp_cmd.' '.shellescape(uid_machine,1) - let filtbuf= bufnr("%") - exe curbuf."b!" - let &l:bh = bhkeep - exe filtbuf."bw!" - let b:netrw_lastfile = choice - - "......................................... - " NetWrite: Complain {{{3 - else - call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",17) - endif - endwhile - - " NetWrite: Cleanup: {{{3 -" call Decho("cleanup") - if s:FileReadable(tmpfile) -" call Decho("tmpfile<".tmpfile."> readable, will now delete it") - call s:NetrwDelete(tmpfile) - endif - call s:NetrwOptionRestore("w:") - - if a:firstline == 1 && a:lastline == line("$") - " restore modifiability; usually equivalent to set nomod - let &mod= mod - endif - - " restore equalalways -" call Dret("netrw#NetWrite") -endfun - -" --------------------------------------------------------------------- -" netrw#NetSource: source a remotely hosted vim script {{{2 -" uses NetRead to get a copy of the file into a temporarily file, -" then sources that file, -" then removes that file. -fun! netrw#NetSource(...) -" call Dfunc("netrw#NetSource() a:0=".a:0) - if a:0 > 0 && a:1 == '?' - " give help - echomsg 'NetSource Usage:' - echomsg ':Nsource dav://machine[:port]/path uses cadaver' - echomsg ':Nsource fetch://machine/path uses fetch' - echomsg ':Nsource ftp://[user@]machine[:port]/path uses ftp autodetects <.netrc>' - echomsg ':Nsource http://[user@]machine/path uses http wget' - echomsg ':Nsource rcp://[user@]machine/path uses rcp' - echomsg ':Nsource rsync://machine[:port]/path uses rsync' - echomsg ':Nsource scp://[user@]machine[[:#]port]/path uses scp' - echomsg ':Nsource sftp://[user@]machine[[:#]port]/path uses sftp' - sleep 4 + " NetRead: interpret mode into a readcmd {{{3 + if a:mode == 0 " read remote file before current line + let readcmd = "0r" + elseif a:mode == 1 " read file after current line + let readcmd = "r" + elseif a:mode == 2 " replace with remote file + let readcmd = "%r" + elseif a:mode == 3 " skip read of file (leave as temporary) + let readcmd = "t" else - let i= 1 - while i <= a:0 - call netrw#NetRead(3,a:{i}) -" call Decho("(netrw#NetSource) s:netread_tmpfile<".s:netrw_tmpfile.">") - if s:FileReadable(s:netrw_tmpfile) -" call Decho("(netrw#NetSource) exe so ".fnameescape(s:netrw_tmpfile)) - exe "so ".fnameescape(s:netrw_tmpfile) -" call Decho("(netrw#NetSource) delete(".s:netrw_tmpfile.")") - call delete(s:netrw_tmpfile) - unlet s:netrw_tmpfile - else - call netrw#ErrorMsg(s:ERROR,"unable to source <".a:{i}.">!",48) - endif - let i= i + 1 - endwhile + exe a:mode + let readcmd = "r" endif -" call Dret("netrw#NetSource") -endfun - -" =========================================== -" s:NetrwGetFile: Function to read temporary file "tfile" with command "readcmd". {{{2 -" readcmd == %r : replace buffer with newly read file -" == 0r : read file at top of buffer -" == r : read file after current line -" == t : leave file in temporary form (ie. don't read into buffer) -fun! s:NetrwGetFile(readcmd, tfile, method) -" call Dfunc("NetrwGetFile(readcmd<".a:readcmd.">,tfile<".a:tfile."> method<".a:method.">)") + let ichoice = (a:0 == 0)? 0 : 1 +" call Decho("readcmd<".readcmd."> ichoice=".ichoice) - " readcmd=='t': simply do nothing - if a:readcmd == 't' -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) -" call Dret("NetrwGetFile : skip read of <".a:tfile.">") + " NetRead: get temporary filename {{{3 + let tmpfile= s:GetTempfile("") + if tmpfile == "" +" call Dret("netrw#NetRead : unable to get a tempfile!") return endif - " get name of remote filename (ie. url and all) - let rfile= bufname("%") -" call Decho("rfile<".rfile.">") - - if exists("*NetReadFixup") - " for the use of NetReadFixup (not otherwise used internally) - let line2= line("$") - endif - - if a:readcmd[0] == '%' - " get file into buffer -" call Decho("get file into buffer") + while ichoice <= a:0 - " rename the current buffer to the temp file (ie. tfile) - if g:netrw_cygwin - let tfile= substitute(a:tfile,'/cygdrive/\(.\)','\1:','') - else - let tfile= a:tfile - endif -" call Decho("exe sil! keepalt file ".fnameescape(tfile)) - exe "sil! keepalt file ".fnameescape(tfile) + " attempt to repeat with previous host-file-etc + if exists("b:netrw_lastfile") && a:0 == 0 +" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">") + let choice = b:netrw_lastfile + let ichoice= ichoice + 1 - " edit temporary file (ie. read the temporary file in) - if rfile =~ '\.zip$' -" call Decho("handling remote zip file with zip#Browse(tfile<".tfile.">)") - call zip#Browse(tfile) - elseif rfile =~ '\.tar$' -" call Decho("handling remote tar file with tar#Browse(tfile<".tfile.">)") - call tar#Browse(tfile) - elseif rfile =~ '\.tar\.gz$' -" call Decho("handling remote gzip-compressed tar file") - call tar#Browse(tfile) - elseif rfile =~ '\.tar\.bz2$' -" call Decho("handling remote bz2-compressed tar file") - call tar#Browse(tfile) - elseif rfile =~ '\.tar\.xz$' -" call Decho("handling remote xz-compressed tar file") - call tar#Browse(tfile) - elseif rfile =~ '\.txz$' -" call Decho("handling remote xz-compressed tar file (.txz)") - call tar#Browse(tfile) else -" call Decho("edit temporary file") - e! - endif - - " rename buffer back to remote filename -" call Decho("exe sil! keepalt file ".fnameescape(rfile)) - exe "sil! keepalt file ".fnameescape(rfile) - filetype detect -" call Dredir("renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">","ls!") - let line1 = 1 - let line2 = line("$") + exe "let choice= a:" . ichoice +" call Decho("no lastfile: choice<" . choice . ">") - elseif s:FileReadable(a:tfile) - " read file after current line -" call Decho("read file<".a:tfile."> after current line") - let curline = line(".") - let lastline= line("$") -" call Decho("exe<".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile)."> line#".curline) - exe a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile) - let line1= curline + 1 - let line2= line("$") - lastline + 1 + if match(choice,"?") == 0 + " give help + echomsg 'NetRead Usage:' + echomsg ':Nread machine:path uses rcp' + echomsg ':Nread "machine path" uses ftp with <.netrc>' + echomsg ':Nread "machine id password path" uses ftp' + echomsg ':Nread dav://machine[:port]/path uses cadaver' + echomsg ':Nread fetch://machine/path uses fetch' + echomsg ':Nread ftp://[user@]machine[:port]/path uses ftp autodetects <.netrc>' + echomsg ':Nread http://[user@]machine/path uses http wget' + echomsg ':Nread rcp://[user@]machine/path uses rcp' + echomsg ':Nread rsync://machine[:port]/path uses rsync' + echomsg ':Nread scp://[user@]machine[[:#]port]/path uses scp' + echomsg ':Nread sftp://[user@]machine[[:#]port]/path uses sftp' + sleep 4 + break - else - " not readable -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) -" call Decho("tfile<".a:tfile."> not readable") - call netrw#ErrorMsg(s:WARNING,"file <".a:tfile."> not readable",9) -" call Dret("NetrwGetFile : tfile<".a:tfile."> not readable") - return - endif + elseif match(choice,'^"') != -1 + " Reconstruct Choice if choice starts with '"' +" call Decho("reconstructing choice") + if match(choice,'"$') != -1 + " case "..." + let choice= strpart(choice,1,strlen(choice)-2) + else + " case "... ... ..." + let choice = strpart(choice,1,strlen(choice)-1) + let wholechoice = "" - " User-provided (ie. optional) fix-it-up command - if exists("*NetReadFixup") -" call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")") - call NetReadFixup(a:method, line1, line2) -" else " Decho -" call Decho("NetReadFixup() not called, doesn't exist (line1=".line1." line2=".line2.")") - endif + while match(choice,'"$') == -1 + let wholechoice = wholechoice . " " . choice + let ichoice = ichoice + 1 + if ichoice > a:0 + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",3) + endif +" call Dret("netrw#NetRead :2 getcwd<".getcwd().">") + return + endif + let choice= a:{ichoice} + endwhile + let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1) + endif + endif + endif - if has("gui") && has("menu") && has("gui_running") && &go =~ 'm' && g:netrw_menu - " update the Buffers menu - call s:UpdateBuffersMenu() - endif +" call Decho("choice<" . choice . ">") + let ichoice= ichoice + 1 -" call Decho("readcmd<".a:readcmd."> cmdarg<".v:cmdarg."> tfile<".a:tfile."> readable=".s:FileReadable(a:tfile)) + " NetRead: Determine method of read (ftp, rcp, etc) {{{3 + call s:NetrwMethod(choice) + if !exists("b:netrw_method") || b:netrw_method < 0 +" call Dfunc("netrw#NetRead : unsupported method") + return + endif + let tmpfile= s:GetTempfile(b:netrw_fname) " apply correct suffix - " make sure file is being displayed -" redraw! + " Check if NetrwBrowse() should be handling this request +" call Decho("checking if NetrwBrowse() should handle choice<".choice."> with netrw_list_cmd<".g:netrw_list_cmd.">") + if choice =~ "^.*[\/]$" && b:netrw_method != 5 && choice !~ '^https\=://' +" call Decho("yes, choice matches '^.*[\/]$'") + keepj call s:NetrwBrowse(0,choice) +" call Dret("netrw#NetRead :3 getcwd<".getcwd().">") + return + endif -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) -" call Dret("NetrwGetFile") -endfun + " ============ + " NetRead: Perform Protocol-Based Read {{{3 + " =========================== + if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 + echo "(netrw) Processing your read request..." + endif -" ------------------------------------------------------------------------ -" s:NetrwMethod: determine method of transfer {{{2 -" Input: -" choice = url [protocol:]//[userid@]hostname[:port]/[path-to-file] -" Output: -" b:netrw_method= 1: rcp -" 2: ftp + <.netrc> -" 3: ftp + machine, id, password, and [path]filename -" 4: scp -" 5: http (wget) -" 6: dav -" 7: rsync -" 8: fetch -" 9: sftp -" g:netrw_machine= hostname -" b:netrw_fname = filename -" g:netrw_port = optional port number (for ftp) -" g:netrw_choice = copy of input url (choice) -fun! s:NetrwMethod(choice) -" call Dfunc("NetrwMethod(a:choice<".a:choice.">)") - - " record current g:netrw_machine, if any - " curmachine used if protocol == ftp and no .netrc - if exists("g:netrw_machine") - let curmachine= g:netrw_machine -" call Decho("curmachine<".curmachine.">") + "......................................... + " NetRead: (rcp) NetRead Method #1 {{{3 + if b:netrw_method == 1 " read with rcp +" call Decho("read via rcp (method #1)") + " ER: nothing done with g:netrw_uid yet? + " ER: on Win2K" rcp machine[.user]:file tmpfile + " ER: if machine contains '.' adding .user is required (use $USERNAME) + " ER: the tmpfile is full path: rcp sees C:\... as host C + if s:netrw_has_nt_rcp == 1 + if exists("g:netrw_uid") && ( g:netrw_uid != "" ) + let uid_machine = g:netrw_machine .'.'. g:netrw_uid + else + " Any way needed it machine contains a '.' + let uid_machine = g:netrw_machine .'.'. $USERNAME + endif else - let curmachine= "N O T A HOST" + if exists("g:netrw_uid") && ( g:netrw_uid != "" ) + let uid_machine = g:netrw_uid .'@'. g:netrw_machine + else + let uid_machine = g:netrw_machine + endif endif +" call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) + exe s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1) + let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) + let b:netrw_lastfile = choice - " initialization - let b:netrw_method = 0 - let g:netrw_machine = "" - let b:netrw_fname = "" - let g:netrw_port = "" - let g:netrw_choice = a:choice - - " Patterns: - " mipf : a:machine a:id password filename Use ftp - " mf : a:machine filename Use ftp + <.netrc> or g:netrw_uid s:netrw_passwd - " ftpurm : ftp://[user@]host[[#:]port]/filename Use ftp + <.netrc> or g:netrw_uid s:netrw_passwd - " rcpurm : rcp://[user@]host/filename Use rcp - " rcphf : [user@]host:filename Use rcp - " scpurm : scp://[user@]host[[#:]port]/filename Use scp - " httpurm : http://[user@]host/filename Use wget - " davurm : dav[s]://host[:port]/path Use cadaver/curl - " rsyncurm : rsync://host[:port]/path Use rsync - " fetchurm : fetch://[user@]host[:http]/filename Use fetch (defaults to ftp, override for http) - " sftpurm : sftp://[user@]host/filename Use scp - let mipf = '^\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)$' - let mf = '^\(\S\+\)\s\+\(\S\+\)$' - let ftpurm = '^ftp://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\([#:]\d\+\)\=/\(.*\)$' - let rcpurm = '^rcp://\%(\([^/@]\{-}\)@\)\=\([^/]\{-}\)/\(.*\)$' - let rcphf = '^\(\(\h\w*\)@\)\=\(\h\w*\):\([^@]\+\)$' - let scpurm = '^scp://\([^/#:]\+\)\%([#:]\(\d\+\)\)\=/\(.*\)$' - let httpurm = '^http://\([^/]\{-}\)\(/.*\)\=$' - let davurm = '^davs\=://\([^/]\+\)/\(.*/\)\([-_.~[:alnum:]]\+\)$' - let rsyncurm = '^rsync://\([^/]\{-}\)/\(.*\)\=$' - let fetchurm = '^fetch://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\(:http\)\=/\(.*\)$' - let sftpurm = '^sftp://\([^/]\{-}\)/\(.*\)\=$' - -" call Decho("determine method:") - " Determine Method - " rcp://user@hostname/...path-to-file - if match(a:choice,rcpurm) == 0 -" call Decho("rcp://...") - let b:netrw_method = 1 - let userid = substitute(a:choice,rcpurm,'\1',"") - let g:netrw_machine = substitute(a:choice,rcpurm,'\2',"") - let b:netrw_fname = substitute(a:choice,rcpurm,'\3',"") - if userid != "" - let g:netrw_uid= userid - endif + "......................................... + " NetRead: (ftp + <.netrc>) NetRead Method #2 {{{3 + elseif b:netrw_method == 2 " read with ftp + <.netrc> +" call Decho("read via ftp+.netrc (method #2)") + let netrw_fname= b:netrw_fname + keepj call s:SaveBufVars()|new|keepj call s:RestoreBufVars() + let filtbuf= bufnr("%") + setl ff=unix + keepj put =g:netrw_ftpmode +" call Decho("filter input: ".getline(line("$"))) + if exists("g:netrw_ftpextracmd") + keepj put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline(line("$"))) + endif + call setline(line("$")+1,'get "'.netrw_fname.'" '.tmpfile) +" call Decho("filter input: ".getline(line("$"))) + if exists("g:netrw_port") && g:netrw_port != "" +" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) + exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) + else +" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) + exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) + endif + " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) + if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' + let debugkeep = &debug + setl debug=msg + keepj call netrw#ErrorMsg(s:ERROR,getline(1),4) + let &debug = debugkeep + endif + call s:SaveBufVars() + bd! + if bufname("%") == "" && getline("$") == "" && line('$') == 1 + " needed when one sources a file in a nolbl setting window via ftp + q! + endif + call s:RestoreBufVars() + let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) + let b:netrw_lastfile = choice - " scp://user@hostname/...path-to-file - elseif match(a:choice,scpurm) == 0 -" call Decho("scp://...") - let b:netrw_method = 4 - let g:netrw_machine = substitute(a:choice,scpurm,'\1',"") - let g:netrw_port = substitute(a:choice,scpurm,'\2',"") - let b:netrw_fname = substitute(a:choice,scpurm,'\3',"") + "......................................... + " NetRead: (ftp + machine,id,passwd,filename) NetRead Method #3 {{{3 + elseif b:netrw_method == 3 " read with ftp + machine, id, passwd, and fname + " Construct execution string (four lines) which will be passed through filter +" call Decho("read via ftp+mipf (method #3)") + let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) + keepj call s:SaveBufVars()|new|keepj call s:RestoreBufVars() + let filtbuf= bufnr("%") + setl ff=unix + if exists("g:netrw_port") && g:netrw_port != "" + keepj put ='open '.g:netrw_machine.' '.g:netrw_port +" call Decho("filter input: ".getline('.')) + else + keepj put ='open '.g:netrw_machine +" call Decho("filter input: ".getline('.')) + endif - " http://user@hostname/...path-to-file - elseif match(a:choice,httpurm) == 0 -" call Decho("http://...") - let b:netrw_method = 5 - let g:netrw_machine= substitute(a:choice,httpurm,'\1',"") - let b:netrw_fname = substitute(a:choice,httpurm,'\2',"") + if exists("g:netrw_uid") && g:netrw_uid != "" + if exists("g:netrw_ftp") && g:netrw_ftp == 1 + keepj put =g:netrw_uid +" call Decho("filter input: ".getline('.')) + if exists("s:netrw_passwd") + keepj put ='\"'.s:netrw_passwd.'\"' + endif +" call Decho("filter input: ".getline('.')) + elseif exists("s:netrw_passwd") + keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' +" call Decho("filter input: ".getline('.')) + endif + endif - " dav://hostname[:port]/..path-to-file.. - elseif match(a:choice,davurm) == 0 -" call Decho("dav://...") - let b:netrw_method= 6 - if a:choice =~ '^s' - let g:netrw_machine= 'https://'.substitute(a:choice,davurm,'\1/\2',"") - else - let g:netrw_machine= 'http://'.substitute(a:choice,davurm,'\1/\2',"") - endif - let b:netrw_fname = substitute(a:choice,davurm,'\3',"") + if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" + keepj put =g:netrw_ftpmode +" call Decho("filter input: ".getline('.')) + endif + if exists("g:netrw_ftpextracmd") + keepj put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline('.')) + endif + keepj put ='get \"'.netrw_fname.'\" '.tmpfile +" call Decho("filter input: ".getline('.')) - " rsync://user@hostname/...path-to-file - elseif match(a:choice,rsyncurm) == 0 -" call Decho("rsync://...") - let b:netrw_method = 7 - let g:netrw_machine= substitute(a:choice,rsyncurm,'\1',"") - let b:netrw_fname = substitute(a:choice,rsyncurm,'\2',"") + " perform ftp: + " -i : turns off interactive prompting from ftp + " -n unix : DON'T use <.netrc>, even though it exists + " -n win32: quit being obnoxious about password + keepj norm! 1Gdd +" call Decho("executing: %!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) + exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options + " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) + if getline(1) !~ "^$" +" call Decho("error<".getline(1).">") + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,getline(1),5) + endif + endif + call s:SaveBufVars()|bd!|call s:RestoreBufVars() + let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) + let b:netrw_lastfile = choice - " ftp://[user@]hostname[[:#]port]/...path-to-file - elseif match(a:choice,ftpurm) == 0 -" call Decho("ftp://...") - let userid = substitute(a:choice,ftpurm,'\2',"") - let g:netrw_machine= substitute(a:choice,ftpurm,'\3',"") - let g:netrw_port = substitute(a:choice,ftpurm,'\4',"") - let b:netrw_fname = substitute(a:choice,ftpurm,'\5',"") -" call Decho("g:netrw_machine<".g:netrw_machine.">") - if userid != "" - let g:netrw_uid= userid - endif - if exists("s:netrw_passwd") && curmachine != g:netrw_machine - " if there's a change in hostname, require password re-entry - unlet s:netrw_passwd - endif - if exists("g:netrw_uid") && exists("s:netrw_passwd") - let b:netrw_method = 3 - else - if s:FileReadable(expand("$HOME/.netrc")) && !g:netrw_ignorenetrc - let b:netrw_method= 2 + "......................................... + " NetRead: (scp) NetRead Method #4 {{{3 + elseif b:netrw_method == 4 " read with scp +" call Decho("read via scp (method #4)") + if exists("g:netrw_port") && g:netrw_port != "" + let useport= " ".g:netrw_scpport." ".g:netrw_port else - if !exists("g:netrw_uid") || g:netrw_uid == "" - call NetUserPass() - elseif !exists("s:netrw_passwd") || s:netrw_passwd == "" - call NetUserPass(g:netrw_uid) - " else just use current g:netrw_uid and s:netrw_passwd - endif - let b:netrw_method= 3 + let useport= "" endif - endif +" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) + exe s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1) + let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) + let b:netrw_lastfile = choice - elseif match(a:choice,fetchurm) == 0 -" call Decho("fetch://...") - let b:netrw_method = 8 - let g:netrw_userid = substitute(a:choice,fetchurm,'\2',"") - let g:netrw_machine= substitute(a:choice,fetchurm,'\3',"") - let b:netrw_option = substitute(a:choice,fetchurm,'\4',"") - let b:netrw_fname = substitute(a:choice,fetchurm,'\5',"") + "......................................... + " NetRead: (http) NetRead Method #5 (wget) {{{3 + elseif b:netrw_method == 5 +" call Decho("read via http (method #5)") + if g:netrw_http_cmd == "" + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"neither the wget nor the fetch command is available",6) + endif +" call Dret("netrw#NetRead :4 getcwd<".getcwd().">") + return + endif - " Issue an ftp : "machine id password [path/]filename" - elseif match(a:choice,mipf) == 0 -" call Decho("(ftp) host id pass file") - let b:netrw_method = 3 - let g:netrw_machine = substitute(a:choice,mipf,'\1',"") - let g:netrw_uid = substitute(a:choice,mipf,'\2',"") - let s:netrw_passwd = substitute(a:choice,mipf,'\3',"") - let b:netrw_fname = substitute(a:choice,mipf,'\4',"") + if match(b:netrw_fname,"#") == -1 || exists("g:netrw_http_xcmd") + " using g:netrw_http_cmd (usually elinks, links, curl, wget, or fetch) +" call Decho('using '.g:netrw_http_cmd.' (# not in b:netrw_fname<'.b:netrw_fname.">)") + if exists("g:netrw_http_xcmd") +" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape("http://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".shellescape(tmpfile,1)) + exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape("http://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".shellescape(tmpfile,1) + else +" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape("http://".g:netrw_machine.b:netrw_fname,1)) + exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape("http://".g:netrw_machine.b:netrw_fname,1) + endif + let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) - " Issue an ftp: "hostname [path/]filename" - elseif match(a:choice,mf) == 0 -" call Decho("(ftp) host file") - if exists("g:netrw_uid") && exists("s:netrw_passwd") - let b:netrw_method = 3 - let g:netrw_machine = substitute(a:choice,mf,'\1',"") - let b:netrw_fname = substitute(a:choice,mf,'\2',"") + else + " wget/curl/fetch plus a jump to an in-page marker (ie. http://abc/def.html#aMarker) +" call Decho("wget/curl plus jump (# in b:netrw_fname<".b:netrw_fname.">)") + let netrw_html= substitute(b:netrw_fname,"#.*$","","") + let netrw_tag = substitute(b:netrw_fname,"^.*#","","") +" call Decho("netrw_html<".netrw_html.">") +" call Decho("netrw_tag <".netrw_tag.">") +" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape("http://".g:netrw_machine.netrw_html,1)) + exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape("http://".g:netrw_machine.netrw_html,1) + let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) +" call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/') + exe 'keepj norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\" + endif + let b:netrw_lastfile = choice +" call Decho("(NetRead) setl ro") + setl ro - elseif s:FileReadable(expand("$HOME/.netrc")) - let b:netrw_method = 2 - let g:netrw_machine = substitute(a:choice,mf,'\1',"") - let b:netrw_fname = substitute(a:choice,mf,'\2',"") - endif + "......................................... + " NetRead: (dav) NetRead Method #6 {{{3 + elseif b:netrw_method == 6 +" call Decho("read via cadaver (method #6)") - " sftp://user@hostname/...path-to-file - elseif match(a:choice,sftpurm) == 0 -" call Decho("sftp://...") - let b:netrw_method = 9 - let g:netrw_machine= substitute(a:choice,sftpurm,'\1',"") - let b:netrw_fname = substitute(a:choice,sftpurm,'\2',"") + if !executable(g:netrw_dav_cmd) + call netrw#ErrorMsg(s:ERROR,g:netrw_dav_cmd." is not executable",73) +" call Dret("netrw#NetRead : ".g:netrw_dav_cmd." not executable") + return + endif + if g:netrw_dav_cmd =~ "curl" +" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_dav_cmd." ".shellescape("dav://".g:netrw_machine.b:netrw_fname,1)." ".shellescape(tmpfile,1)) + exe s:netrw_silentxfer."!".g:netrw_dav_cmd." ".shellescape("dav://".g:netrw_machine.b:netrw_fname,1)." ".shellescape(tmpfile,1) + else + " Construct execution string (four lines) which will be passed through filter + let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) + new + setl ff=unix + if exists("g:netrw_port") && g:netrw_port != "" + keepj put ='open '.g:netrw_machine.' '.g:netrw_port + else + keepj put ='open '.g:netrw_machine + endif + if exists("g:netrw_uid") && exists("s:netrw_passwd") && g:netrw_uid != "" + keepj put ='user '.g:netrw_uid.' '.s:netrw_passwd + endif + keepj put ='get '.netrw_fname.' '.tmpfile + keepj put ='quit' - " Issue an rcp: hostname:filename" (this one should be last) - elseif match(a:choice,rcphf) == 0 -" call Decho("(rcp) [user@]host:file) rcphf<".rcphf.">") - let b:netrw_method = 1 - let userid = substitute(a:choice,rcphf,'\2',"") - let g:netrw_machine = substitute(a:choice,rcphf,'\3',"") - let b:netrw_fname = substitute(a:choice,rcphf,'\4',"") -" call Decho('\1<'.substitute(a:choice,rcphf,'\1',"").">") -" call Decho('\2<'.substitute(a:choice,rcphf,'\2',"").">") -" call Decho('\3<'.substitute(a:choice,rcphf,'\3',"").">") -" call Decho('\4<'.substitute(a:choice,rcphf,'\4',"").">") - if userid != "" - let g:netrw_uid= userid - endif + " perform cadaver operation: + keepj norm! 1Gdd +" call Decho("executing: %!".g:netrw_dav_cmd) + exe s:netrw_silentxfer."%!".g:netrw_dav_cmd + bd! + endif + let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) + let b:netrw_lastfile = choice - else - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:WARNING,"cannot determine method (format: protocol://[user@]hostname[:port]/[path])",45) + "......................................... + " NetRead: (rsync) NetRead Method #7 {{{3 + elseif b:netrw_method == 7 +" call Decho("read via rsync (method #7)") +" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) + exe s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1) + let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) + let b:netrw_lastfile = choice + + "......................................... + " NetRead: (fetch) NetRead Method #8 {{{3 + " fetch://[user@]host[:http]/path + elseif b:netrw_method == 8 +" call Decho("read via fetch (method #8)") + if g:netrw_fetch_cmd == "" + if !exists("g:netrw_quiet") + keepj call netrw#ErrorMsg(s:ERROR,"fetch command not available",7) + endif +" call Dret("NetRead") + return + endif + if exists("g:netrw_option") && g:netrw_option == ":https\=" + let netrw_option= "http" + else + let netrw_option= "ftp" + endif +" call Decho("read via fetch for ".netrw_option) + + if exists("g:netrw_uid") && g:netrw_uid != "" && exists("s:netrw_passwd") && s:netrw_passwd != "" +" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".b:netrw_fname,1)) + exe s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".b:netrw_fname,1) + else +" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_machine."/".b:netrw_fname,1)) + exe s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_machine."/".b:netrw_fname,1) + endif + + let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) + let b:netrw_lastfile = choice +" call Decho("(NetRead) setl ro") + setl ro + + "......................................... + " NetRead: (sftp) NetRead Method #9 {{{3 + elseif b:netrw_method == 9 +" call Decho("read via sftp (method #9)") +" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile) + exe s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile + let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) + let b:netrw_lastfile = choice + + "......................................... + " NetRead: Complain {{{3 + else + call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",8) endif - let b:netrw_method = -1 - endif + endwhile - " remove any leading [:#] from port number - if g:netrw_port != "" - let g:netrw_port = substitute(g:netrw_port,'[#:]\+','','') + " NetRead: cleanup {{{3 + if exists("b:netrw_method") +" call Decho("cleanup b:netrw_method and b:netrw_fname") + unlet b:netrw_method + unlet b:netrw_fname + endif + if s:FileReadable(tmpfile) && tmpfile !~ '.tar.bz2$' && tmpfile !~ '.tar.gz$' && tmpfile !~ '.zip' && tmpfile !~ '.tar' && readcmd != 't' && tmpfile !~ '.tar.xz$' && tmpfile !~ '.txz' +" call Decho("cleanup by deleting tmpfile<".tmpfile.">") + keepj call s:NetrwDelete(tmpfile) endif + keepj call s:NetrwOptionRestore("w:") -" call Decho("a:choice <".a:choice.">") -" call Decho("b:netrw_method <".b:netrw_method.">") -" call Decho("g:netrw_machine<".g:netrw_machine.">") -" call Decho("g:netrw_port <".g:netrw_port.">") -" if exists("g:netrw_uid") "Decho -" call Decho("g:netrw_uid <".g:netrw_uid.">") -" endif "Decho -" if exists("s:netrw_passwd") "Decho -" call Decho("s:netrw_passwd <".s:netrw_passwd.">") -" endif "Decho -" call Decho("b:netrw_fname <".b:netrw_fname.">") -" call Dret("NetrwMethod : b:netrw_method=".b:netrw_method) +" call Dret("netrw#NetRead :5 getcwd<".getcwd().">") endfun " ------------------------------------------------------------------------ -" NetReadFixup: this sort of function is typically written by the user {{{2 -" to handle extra junk that their system's ftp dumps -" into the transfer. This function is provided as an -" example and as a fix for a Windows 95 problem: in my -" experience, win95's ftp always dumped four blank lines -" at the end of the transfer. -if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp - fun! NetReadFixup(method, line1, line2) -" call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")") +" netrw#NetWrite: responsible for writing a file over the net {{{2 +fun! netrw#NetWrite(...) range +" call Dfunc("netrw#NetWrite(a:0=".a:0.") ".g:loaded_netrw) - " sanity checks -- attempt to convert inputs to integers - let method = a:method + 0 - let line1 = a:line1 + 0 - let line2 = a:line2 + 0 - if type(method) != 0 || type(line1) != 0 || type(line2) != 0 || method < 0 || line1 <= 0 || line2 <= 0 -" call Dret("NetReadFixup") - return - endif + " NetWrite: option handling {{{3 + let mod= 0 + call s:NetrwOptionSave("w:") + call s:NetrwSafeOptions() - if method == 3 " ftp (no <.netrc>) - let fourblanklines= line2 - 3 - if fourblanklines >= line1 - exe "sil keepj ".fourblanklines.",".line2."g/^\s*$/d" - call histdel("/",-1) - endif - endif + " NetWrite: Get Temporary Filename {{{3 + let tmpfile= s:GetTempfile("") + if tmpfile == "" +" call Dret("netrw#NetWrite : unable to get a tempfile!") + return + endif -" call Dret("NetReadFixup") - endfun -endif + if a:0 == 0 + let ichoice = 0 + else + let ichoice = 1 + endif -" --------------------------------------------------------------------- -" NetUserPass: set username and password for subsequent ftp transfer {{{2 -" Usage: :call NetUserPass() -- will prompt for userid and password -" :call NetUserPass("uid") -- will prompt for password -" :call NetUserPass("uid","password") -- sets global userid and password -fun! NetUserPass(...) + let curbufname= expand("%") +" call Decho("curbufname<".curbufname.">") + if &binary + " For binary writes, always write entire file. + " (line numbers don't really make sense for that). + " Also supports the writing of tar and zip files. +" call Decho("(write entire file) sil exe w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile)) + exe "sil keepj w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile) + elseif g:netrw_cygwin + " write (selected portion of) file to temporary + let cygtmpfile= substitute(tmpfile,'/cygdrive/\(.\)','\1:','') +" call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile)) + exe "sil keepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile) + else + " write (selected portion of) file to temporary +" call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile)) + exe "sil keepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile) + endif - " get/set userid - if a:0 == 0 -" call Dfunc("NetUserPass(a:0<".a:0.">)") - if !exists("g:netrw_uid") || g:netrw_uid == "" - " via prompt - let g:netrw_uid= input('Enter username: ') + if curbufname == "" + " if the file is [No Name], and one attempts to Nwrite it, the buffer takes + " on the temporary file's name. Deletion of the temporary file during + " cleanup then causes an error message. + 0file! endif - else " from command line -" call Dfunc("NetUserPass(a:1<".a:1.">)") - let g:netrw_uid= a:1 - endif - " get password - if a:0 <= 1 " via prompt -" call Decho("a:0=".a:0." case <=1:") - let s:netrw_passwd= inputsecret("Enter Password: ") - else " from command line -" call Decho("a:0=".a:0." case >1: a:2<".a:2.">") - let s:netrw_passwd=a:2 - endif + " NetWrite: while choice loop: {{{3 + while ichoice <= a:0 -" call Dret("NetUserPass") -endfun + " Process arguments: {{{4 + " attempt to repeat with previous host-file-etc + if exists("b:netrw_lastfile") && a:0 == 0 +" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">") + let choice = b:netrw_lastfile + let ichoice= ichoice + 1 + else + exe "let choice= a:" . ichoice -" =========================================== -" Shared Browsing Support: {{{1 -" =========================================== + " Reconstruct Choice if choice starts with '"' + if match(choice,"?") == 0 + echomsg 'NetWrite Usage:"' + echomsg ':Nwrite machine:path uses rcp' + echomsg ':Nwrite "machine path" uses ftp with <.netrc>' + echomsg ':Nwrite "machine id password path" uses ftp' + echomsg ':Nwrite dav://[user@]machine/path uses cadaver' + echomsg ':Nwrite fetch://[user@]machine/path uses fetch' + echomsg ':Nwrite ftp://machine[#port]/path uses ftp (autodetects <.netrc>)' + echomsg ':Nwrite rcp://machine/path uses rcp' + echomsg ':Nwrite rsync://[user@]machine/path uses rsync' + echomsg ':Nwrite scp://[user@]machine[[:#]port]/path uses scp' + echomsg ':Nwrite sftp://[user@]machine/path uses sftp' + sleep 4 + break -" --------------------------------------------------------------------- -" s:BrowserMaps: {{{2 -fun! s:BrowserMaps(islocal) -" call Dfunc("s:BrowserMaps(islocal=".a:islocal.") b:netrw_curdir<".b:netrw_curdir.">") - if a:islocal -" call Decho("make local maps") - nnoremap :call netrw#LocalBrowseCheck(NetrwBrowseChgDir(1,NetrwGetWord())) - nnoremap - :exe "norm! 0"call netrw#LocalBrowseCheck(NetrwBrowseChgDir(1,'../')) - nnoremap a :call NetrwHide(1) - nnoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) - nnoremap mc :call NetrwMarkFileCopy(1) - nnoremap md :call NetrwMarkFileDiff(1) - nnoremap me :call NetrwMarkFileEdit(1) - nnoremap mf :call NetrwMarkFile(1,NetrwGetWord()) - nnoremap mg :call NetrwMarkFileGrep(1) - nnoremap mh :call NetrwMarkHideSfx(1) - nnoremap mm :call NetrwMarkFileMove(1) - nnoremap mp :call NetrwMarkFilePrint(1) - nnoremap mr :call NetrwMarkFileRegexp(1) - nnoremap ms :call NetrwMarkFileSource(1) - nnoremap mT :call NetrwMarkFileTag(1) - nnoremap mt :call NetrwMarkFileTgt(1) - nnoremap mu :call NetrwUnMarkFile(1) - nnoremap mx :call NetrwMarkFileExe(1) - nnoremap mz :call NetrwMarkFileCompress(1) - nnoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) - nnoremap gh :call NetrwHidden(1) - nnoremap gp :call NetrwChgPerm(1,b:netrw_curdir) - nnoremap c :exe "keepjumps lcd ".fnameescape(b:netrw_curdir) - nnoremap C :let g:netrw_chgwin= winnr() - nnoremap d :call NetrwMakeDir("") - nnoremap i :call NetrwListStyle(1) - nnoremap I :call NetrwBannerCtrl(1) - nnoremap o :call NetrwSplit(3) - nnoremap O :call NetrwObtain(1) - nnoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) - nnoremap P :call NetrwPrevWinOpen(1) - nnoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) - nnoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) - nnoremap qf :call NetrwFileInfo(1,NetrwGetWord()) - nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwRefresh(1,NetrwBrowseChgDir(1,'./')) - nnoremap s :call NetrwSortStyle(1) - nnoremap S :call NetSortSequence(1) - nnoremap t :call NetrwSplit(4) - nnoremap T :call NetrwSplit(4)norm! gT - nnoremap u :call NetrwBookHistHandler(4,expand("%")) - nnoremap U :call NetrwBookHistHandler(5,expand("%")) - nnoremap v :call NetrwSplit(5) - nnoremap x :call netrw#NetrwBrowseX(NetrwBrowseChgDir(1,NetrwGetWord(),0),0)" - nnoremap % :call NetrwOpenFile(1) - inoremap :call netrw#LocalBrowseCheck(NetrwBrowseChgDir(1,NetrwGetWord())) - inoremap - :exe "norm! 0"call netrw#LocalBrowseCheck(NetrwBrowseChgDir(1,'../')) - inoremap a :call NetrwHide(1) - inoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) - inoremap mc :call NetrwMarkFileCopy(1) - inoremap md :call NetrwMarkFileDiff(1) - inoremap me :call NetrwMarkFileEdit(1) - inoremap mf :call NetrwMarkFile(1,NetrwGetWord()) - inoremap mg :call NetrwMarkFileGrep(1) - inoremap mh :call NetrwMarkHideSfx(1) - inoremap mm :call NetrwMarkFileMove(1) - inoremap mp :call NetrwMarkFilePrint(1) - inoremap mr :call NetrwMarkFileRegexp(1) - inoremap ms :call NetrwMarkFileSource(1) - inoremap mT :call NetrwMarkFileTag(1) - inoremap mt :call NetrwMarkFileTgt(1) - inoremap mu :call NetrwUnMarkFile(1) - inoremap mx :call NetrwMarkFileExe(1) - inoremap mz :call NetrwMarkFileCompress(1) - inoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) - inoremap gh :call NetrwHidden(1) - inoremap gp :call NetrwChgPerm(1,b:netrw_curdir) - inoremap c :exe "keepjumps lcd ".fnameescape(b:netrw_curdir) - inoremap C :let g:netrw_chgwin= winnr() - inoremap d :call NetrwMakeDir("") - inoremap i :call NetrwListStyle(1) - inoremap I :call NetrwBannerCtrl(1) - inoremap o :call NetrwSplit(3) - inoremap O :call NetrwObtain(1) - inoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) - inoremap P :call NetrwPrevWinOpen(1) - inoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) - inoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) - inoremap qf :call NetrwFileInfo(1,NetrwGetWord()) - inoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwRefresh(1,NetrwBrowseChgDir(1,'./')) - inoremap s :call NetrwSortStyle(1) - inoremap S :call NetSortSequence(1) - inoremap t :call NetrwSplit(4) - inoremap T :call NetrwSplit(4)norm! gT - inoremap u :call NetrwBookHistHandler(4,expand("%")) - inoremap U :call NetrwBookHistHandler(5,expand("%")) - inoremap v :call NetrwSplit(5) - inoremap x :call netrw#NetrwBrowseX(NetrwBrowseChgDir(1,NetrwGetWord(),0),0)" - inoremap % :call NetrwOpenFile(1) - if !hasmapto('NetrwHideEdit') - nmap NetrwHideEdit - imap NetrwHideEdit - endif - nnoremap NetrwHideEdit :call NetrwHideEdit(1) - if !hasmapto('NetrwRefresh') - nmap NetrwRefresh - imap NetrwRefresh + elseif match(choice,"^\"") != -1 + if match(choice,"\"$") != -1 + " case "..." + let choice=strpart(choice,1,strlen(choice)-2) + else + " case "... ... ..." + let choice = strpart(choice,1,strlen(choice)-1) + let wholechoice = "" + + while match(choice,"\"$") == -1 + let wholechoice= wholechoice . " " . choice + let ichoice = ichoice + 1 + if choice > a:0 + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",13) + endif +" call Dret("netrw#NetWrite") + return + endif + let choice= a:{ichoice} + endwhile + let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1) + endif + endif endif - nnoremap NetrwRefresh :call NetrwRefresh(1,NetrwBrowseChgDir(1,'./')) - if s:didstarstar || !mapcheck("","n") - nnoremap :Nexplore - inoremap :Nexplore + let ichoice= ichoice + 1 +" call Decho("choice<" . choice . "> ichoice=".ichoice) + + " Determine method of write (ftp, rcp, etc) {{{4 + keepj call s:NetrwMethod(choice) + if !exists("b:netrw_method") || b:netrw_method < 0 +" call Dfunc("netrw#NetWrite : unsupported method") + return endif - if s:didstarstar || !mapcheck("","n") - nnoremap :Pexplore - inoremap :Pexplore + + " ============= + " NetWrite: Perform Protocol-Based Write {{{3 + " ============================ + if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 + echo "(netrw) Processing your write request..." +" call Decho("(netrw) Processing your write request...") endif - let mapsafecurdir = escape(b:netrw_curdir, s:netrw_map_escape) - if g:netrw_mousemaps == 1 - nnoremap :call NetrwLeftmouse(1) - nnoremap :call NetrwPrevWinOpen(1) - nnoremap :call NetrwMarkFile(1,NetrwGetWord()) - exe 'nnoremap :call NetrwLocalRm("'.mapsafecurdir.'")' - exe 'vnoremap :call NetrwLocalRm("'.mapsafecurdir.'")' - inoremap :call NetrwLeftmouse(1) - inoremap :call NetrwPrevWinOpen(1) - inoremap :call NetrwMarkFile(1,NetrwGetWord()) - exe 'inoremap :call NetrwLocalRm("'.mapsafecurdir.'")' + + "......................................... + " NetWrite: (rcp) NetWrite Method #1 {{{3 + if b:netrw_method == 1 +" call Decho("write via rcp (method #1)") + if s:netrw_has_nt_rcp == 1 + if exists("g:netrw_uid") && ( g:netrw_uid != "" ) + let uid_machine = g:netrw_machine .'.'. g:netrw_uid + else + let uid_machine = g:netrw_machine .'.'. $USERNAME + endif + else + if exists("g:netrw_uid") && ( g:netrw_uid != "" ) + let uid_machine = g:netrw_uid .'@'. g:netrw_machine + else + let uid_machine = g:netrw_machine + endif + endif +" call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(tmpfile,1)." ".shellescape(uid_machine.":".b:netrw_fname,1)) + exe s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(tmpfile,1)." ".shellescape(uid_machine.":".b:netrw_fname,1) + let b:netrw_lastfile = choice + + "......................................... + " NetWrite: (ftp + <.netrc>) NetWrite Method #2 {{{3 + elseif b:netrw_method == 2 +" call Decho("write via ftp+.netrc (method #2)") + let netrw_fname = b:netrw_fname + + " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead + let bhkeep = &l:bh + let curbuf = bufnr("%") + setl bh=hide + keepalt enew + +" call Decho("filter input window#".winnr()) + setl ff=unix + keepj put =g:netrw_ftpmode +" call Decho("filter input: ".getline('$')) + if exists("g:netrw_ftpextracmd") + keepj put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline("$")) + endif + keepj call setline(line("$")+1,'put "'.tmpfile.'" "'.netrw_fname.'"') +" call Decho("filter input: ".getline("$")) + if exists("g:netrw_port") && g:netrw_port != "" +" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) + exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) + else +" call Decho("filter input window#".winnr()) +" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) + exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) + endif + " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) + if getline(1) !~ "^$" + if !exists("g:netrw_quiet") + keepj call netrw#ErrorMsg(s:ERROR,getline(1),14) + endif + let mod=1 + endif + + " remove enew buffer (quietly) + let filtbuf= bufnr("%") + exe curbuf."b!" + let &l:bh = bhkeep + exe filtbuf."bw!" + + let b:netrw_lastfile = choice + + "......................................... + " NetWrite: (ftp + machine, id, passwd, filename) NetWrite Method #3 {{{3 + elseif b:netrw_method == 3 + " Construct execution string (three or more lines) which will be passed through filter +" call Decho("read via ftp+mipf (method #3)") + let netrw_fname = b:netrw_fname + let bhkeep = &l:bh + + " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead + let curbuf = bufnr("%") + setl bh=hide + keepalt enew + setl ff=unix + + if exists("g:netrw_port") && g:netrw_port != "" + keepj put ='open '.g:netrw_machine.' '.g:netrw_port +" call Decho("filter input: ".getline('.')) + else + keepj put ='open '.g:netrw_machine +" call Decho("filter input: ".getline('.')) + endif + if exists("g:netrw_uid") && g:netrw_uid != "" + if exists("g:netrw_ftp") && g:netrw_ftp == 1 + keepj put =g:netrw_uid +" call Decho("filter input: ".getline('.')) + if exists("s:netrw_passwd") && s:netrw_passwd != "" + keepj put ='\"'.s:netrw_passwd.'\"' + endif +" call Decho("filter input: ".getline('.')) + elseif exists("s:netrw_passwd") && s:netrw_passwd != "" + keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' +" call Decho("filter input: ".getline('.')) + endif + endif + keepj put =g:netrw_ftpmode +" call Decho("filter input: ".getline('$')) + if exists("g:netrw_ftpextracmd") + keepj put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline("$")) + endif + keepj put ='put \"'.tmpfile.'\" \"'.netrw_fname.'\"' +" call Decho("filter input: ".getline('.')) + " save choice/id/password for future use + let b:netrw_lastfile = choice + + " perform ftp: + " -i : turns off interactive prompting from ftp + " -n unix : DON'T use <.netrc>, even though it exists + " -n win32: quit being obnoxious about password + keepj norm! 1Gdd +" call Decho("executing: %!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) + exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options + " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) + if getline(1) !~ "^$" + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,getline(1),15) + endif + let mod=1 + endif + + " remove enew buffer (quietly) + let filtbuf= bufnr("%") + exe curbuf."b!" + let &l:bh= bhkeep + exe filtbuf."bw!" + + "......................................... + " NetWrite: (scp) NetWrite Method #4 {{{3 + elseif b:netrw_method == 4 +" call Decho("write via scp (method #4)") + if exists("g:netrw_port") && g:netrw_port != "" + let useport= " ".g:netrw_scpport." ".fnameescape(g:netrw_port) + else + let useport= "" + endif +" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)) + exe s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1) + let b:netrw_lastfile = choice + + "......................................... + " NetWrite: (http) NetWrite Method #5 {{{3 + elseif b:netrw_method == 5 +" call Decho("write via http (method #5)") + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"currently does not support writing using http:",16) + endif + + "......................................... + " NetWrite: (dav) NetWrite Method #6 (cadaver) {{{3 + elseif b:netrw_method == 6 +" call Decho("write via cadaver (method #6)") + + " Construct execution string (four lines) which will be passed through filter + let netrw_fname = escape(b:netrw_fname,g:netrw_fname_escape) + let bhkeep = &l:bh + + " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead + let curbuf = bufnr("%") + setl bh=hide + keepalt enew + + setl ff=unix + if exists("g:netrw_port") && g:netrw_port != "" + keepj put ='open '.g:netrw_machine.' '.g:netrw_port + else + keepj put ='open '.g:netrw_machine + endif + if exists("g:netrw_uid") && exists("s:netrw_passwd") && g:netrw_uid != "" + keepj put ='user '.g:netrw_uid.' '.s:netrw_passwd + endif + keepj put ='put '.tmpfile.' '.netrw_fname + + " perform cadaver operation: + keepj norm! 1Gdd +" call Decho("executing: %!".g:netrw_dav_cmd) + exe s:netrw_silentxfer."%!".g:netrw_dav_cmd + + " remove enew buffer (quietly) + let filtbuf= bufnr("%") + exe curbuf."b!" + let &l:bh = bhkeep + exe filtbuf."bw!" + + let b:netrw_lastfile = choice + + "......................................... + " NetWrite: (rsync) NetWrite Method #7 {{{3 + elseif b:netrw_method == 7 +" call Decho("write via rsync (method #7)") +" call Decho("executing: !".g:netrw_rsync_cmd." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)) + exe s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1) + let b:netrw_lastfile = choice + + "......................................... + " NetWrite: (sftp) NetWrite Method #9 {{{3 + elseif b:netrw_method == 9 +" call Decho("write via sftp (method #9)") + let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) + if exists("g:netrw_uid") && ( g:netrw_uid != "" ) + let uid_machine = g:netrw_uid .'@'. g:netrw_machine + else + let uid_machine = g:netrw_machine + endif + + " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead + let bhkeep = &l:bh + let curbuf = bufnr("%") + setl bh=hide + keepalt enew + + setl ff=unix + call setline(1,'put "'.escape(tmpfile,'\').'" '.netrw_fname) +" call Decho("filter input: ".getline('.')) +" call Decho("executing: %!".g:netrw_sftp_cmd.' '.shellescape(uid_machine,1)) + let sftpcmd= substitute(g:netrw_sftp_cmd,"%TEMPFILE%",escape(tmpfile,'\'),"g") + exe s:netrw_silentxfer."%!".sftpcmd.' '.shellescape(uid_machine,1) + let filtbuf= bufnr("%") + exe curbuf."b!" + let &l:bh = bhkeep + exe filtbuf."bw!" + let b:netrw_lastfile = choice + + "......................................... + " NetWrite: Complain {{{3 + else + call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",17) + let leavemod= 1 endif - exe 'nnoremap :call NetrwLocalRm("'.mapsafecurdir.'")' - exe 'nnoremap D :call NetrwLocalRm("'.mapsafecurdir.'")' - exe 'nnoremap R :call NetrwLocalRename("'.mapsafecurdir.'")' - exe 'nnoremap m :call NetrwMakeDir("")' - exe 'vnoremap :call NetrwLocalRm("'.mapsafecurdir.'")' - exe 'vnoremap D :call NetrwLocalRm("'.mapsafecurdir.'")' - exe 'vnoremap R :call NetrwLocalRename("'.mapsafecurdir.'")' - exe 'inoremap :call NetrwLocalRm("'.mapsafecurdir.'")' - exe 'inoremap D :call NetrwLocalRm("'.mapsafecurdir.'")' - exe 'inoremap R :call NetrwLocalRename("'.mapsafecurdir.'")' - exe 'inoremap m :call NetrwMakeDir("")' - nnoremap :he netrw-quickhelp + endwhile - else " remote -" call Decho("make remote maps") - call s:RemotePathAnalysis(b:netrw_curdir) - nnoremap :call NetrwBrowse(0,NetrwBrowseChgDir(0,NetrwGetWord())) - nnoremap :call NetrwRefresh(0,NetrwBrowseChgDir(0,'./')) - nnoremap - :exe "norm! 0"call NetrwBrowse(0,NetrwBrowseChgDir(0,'../')) - nnoremap a :call NetrwHide(0) - nnoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) - nnoremap mc :call NetrwMarkFileCopy(0) - nnoremap md :call NetrwMarkFileDiff(0) - nnoremap me :call NetrwMarkFileEdit(0) - nnoremap mf :call NetrwMarkFile(0,NetrwGetWord()) - nnoremap mg :call NetrwMarkFileGrep(0) - nnoremap mh :call NetrwMarkHideSfx(0) - nnoremap mm :call NetrwMarkFileMove(0) - nnoremap mp :call NetrwMarkFilePrint(0) - nnoremap mr :call NetrwMarkFileRegexp(0) - nnoremap ms :call NetrwMarkFileSource(0) - nnoremap mT :call NetrwMarkFileTag(0) - nnoremap mt :call NetrwMarkFileTgt(0) - nnoremap mu :call NetrwUnMarkFile(0) - nnoremap mx :call NetrwMarkFileExe(0) - nnoremap mz :call NetrwMarkFileCompress(0) - nnoremap gb :call NetrwBookHistHandler(1,b:netrw_cur) - nnoremap gh :call NetrwHidden(0) - nnoremap gp :call NetrwChgPerm(0,b:netrw_curdir) - nnoremap C :let g:netrw_chgwin= winnr() - nnoremap i :call NetrwListStyle(0) - nnoremap I :call NetrwBannerCtrl(1) - nnoremap o :call NetrwSplit(0) - nnoremap O :call NetrwObtain(0) - nnoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) - nnoremap P :call NetrwPrevWinOpen(0) - nnoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) - nnoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) - nnoremap qf :call NetrwFileInfo(0,NetrwGetWord()) - nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwBrowse(0,NetrwBrowseChgDir(0,'./')) - nnoremap s :call NetrwSortStyle(0) - nnoremap S :call NetSortSequence(0) - nnoremap t :call NetrwSplit(1) - nnoremap T :call NetrwSplit(1)norm! gT - nnoremap u :call NetrwBookHistHandler(4,b:netrw_curdir) - nnoremap U :call NetrwBookHistHandler(5,b:netrw_curdir) - nnoremap v :call NetrwSplit(2) - nnoremap x :call netrw#NetrwBrowseX(NetrwBrowseChgDir(0,NetrwGetWord()),1) - nnoremap % :call NetrwOpenFile(0) - inoremap :call NetrwBrowse(0,NetrwBrowseChgDir(0,NetrwGetWord())) - inoremap :call NetrwRefresh(0,NetrwBrowseChgDir(0,'./')) - inoremap - :exe "norm! 0"call NetrwBrowse(0,NetrwBrowseChgDir(0,'../')) - inoremap a :call NetrwHide(0) - inoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) - inoremap mc :call NetrwMarkFileCopy(0) - inoremap md :call NetrwMarkFileDiff(0) - inoremap me :call NetrwMarkFileEdit(0) - inoremap mf :call NetrwMarkFile(0,NetrwGetWord()) - inoremap mg :call NetrwMarkFileGrep(0) - inoremap mh :call NetrwMarkHideSfx(0) - inoremap mm :call NetrwMarkFileMove(0) - inoremap mp :call NetrwMarkFilePrint(0) - inoremap mr :call NetrwMarkFileRegexp(0) - inoremap ms :call NetrwMarkFileSource(0) - inoremap mT :call NetrwMarkFileTag(0) - inoremap mt :call NetrwMarkFileTgt(0) - inoremap mu :call NetrwUnMarkFile(0) - inoremap mx :call NetrwMarkFileExe(0) - inoremap mz :call NetrwMarkFileCompress(0) - inoremap gb :call NetrwBookHistHandler(1,b:netrw_cur) - inoremap gh :call NetrwHidden(0) - inoremap gp :call NetrwChgPerm(0,b:netrw_curdir) - inoremap C :let g:netrw_chgwin= winnr() - inoremap i :call NetrwListStyle(0) - inoremap I :call NetrwBannerCtrl(1) - inoremap o :call NetrwSplit(0) - inoremap O :call NetrwObtain(0) - inoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) - inoremap P :call NetrwPrevWinOpen(0) - inoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) - inoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) - inoremap qf :call NetrwFileInfo(0,NetrwGetWord()) - inoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwBrowse(0,NetrwBrowseChgDir(0,'./')) - inoremap s :call NetrwSortStyle(0) - inoremap S :call NetSortSequence(0) - inoremap t :call NetrwSplit(1) - inoremap T :call NetrwSplit(1)norm! gT - inoremap u :call NetrwBookHistHandler(4,b:netrw_curdir) - inoremap U :call NetrwBookHistHandler(5,b:netrw_curdir) - inoremap v :call NetrwSplit(2) - inoremap x :call netrw#NetrwBrowseX(NetrwBrowseChgDir(0,NetrwGetWord()),1) - inoremap % :call NetrwOpenFile(0) - if !hasmapto('NetrwHideEdit') - nmap NetrwHideEdit - imap NetrwHideEdit + " NetWrite: Cleanup: {{{3 +" call Decho("cleanup") + if s:FileReadable(tmpfile) +" call Decho("tmpfile<".tmpfile."> readable, will now delete it") + call s:NetrwDelete(tmpfile) + endif + call s:NetrwOptionRestore("w:") + + if a:firstline == 1 && a:lastline == line("$") + " restore modifiability; usually equivalent to set nomod + let &mod= mod +" call Decho("(NetWrite) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") + elseif !exists("leavemod") + " indicate that the buffer has not been modified since last written +" call Decho("(NetWrite) set nomod") + set nomod +" call Decho("(NetWrite) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") + endif + +" call Dret("netrw#NetWrite") +endfun + +" --------------------------------------------------------------------- +" netrw#NetSource: source a remotely hosted vim script {{{2 +" uses NetRead to get a copy of the file into a temporarily file, +" then sources that file, +" then removes that file. +fun! netrw#NetSource(...) +" call Dfunc("netrw#NetSource() a:0=".a:0) + if a:0 > 0 && a:1 == '?' + " give help + echomsg 'NetSource Usage:' + echomsg ':Nsource dav://machine[:port]/path uses cadaver' + echomsg ':Nsource fetch://machine/path uses fetch' + echomsg ':Nsource ftp://[user@]machine[:port]/path uses ftp autodetects <.netrc>' + echomsg ':Nsource http[s]://[user@]machine/path uses http wget' + echomsg ':Nsource rcp://[user@]machine/path uses rcp' + echomsg ':Nsource rsync://machine[:port]/path uses rsync' + echomsg ':Nsource scp://[user@]machine[[:#]port]/path uses scp' + echomsg ':Nsource sftp://[user@]machine[[:#]port]/path uses sftp' + sleep 4 + else + let i= 1 + while i <= a:0 + call netrw#NetRead(3,a:{i}) +" call Decho("(netrw#NetSource) s:netread_tmpfile<".s:netrw_tmpfile.">") + if s:FileReadable(s:netrw_tmpfile) +" call Decho("(netrw#NetSource) exe so ".fnameescape(s:netrw_tmpfile)) + exe "so ".fnameescape(s:netrw_tmpfile) +" call Decho("(netrw#NetSource) delete(".s:netrw_tmpfile.")") + call delete(s:netrw_tmpfile) + unlet s:netrw_tmpfile + else + call netrw#ErrorMsg(s:ERROR,"unable to source <".a:{i}.">!",48) + endif + let i= i + 1 + endwhile + endif +" call Dret("netrw#NetSource") +endfun + +" =========================================== +" s:NetrwGetFile: Function to read temporary file "tfile" with command "readcmd". {{{2 +" readcmd == %r : replace buffer with newly read file +" == 0r : read file at top of buffer +" == r : read file after current line +" == t : leave file in temporary form (ie. don't read into buffer) +fun! s:NetrwGetFile(readcmd, tfile, method) +" call Dfunc("NetrwGetFile(readcmd<".a:readcmd.">,tfile<".a:tfile."> method<".a:method.">)") + + " readcmd=='t': simply do nothing + if a:readcmd == 't' +" call Decho("(NetrwGetFile) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Dret("NetrwGetFile : skip read of <".a:tfile.">") + return + endif + + " get name of remote filename (ie. url and all) + let rfile= bufname("%") +" call Decho("rfile<".rfile.">") + + if exists("*NetReadFixup") + " for the use of NetReadFixup (not otherwise used internally) + let line2= line("$") + endif + + if a:readcmd[0] == '%' + " get file into buffer +" call Decho("get file into buffer") + + " rename the current buffer to the temp file (ie. tfile) + if g:netrw_cygwin + let tfile= substitute(a:tfile,'/cygdrive/\(.\)','\1:','') + else + let tfile= a:tfile endif - nnoremap NetrwHideEdit :call NetrwHideEdit(0) - if !hasmapto('NetrwRefresh') - nmap NetrwRefresh - imap NetrwRefresh +" call Decho("exe sil! keepalt file ".fnameescape(tfile)) + exe "sil! keepalt file ".fnameescape(tfile) + + " edit temporary file (ie. read the temporary file in) + if rfile =~ '\.zip$' +" call Decho("handling remote zip file with zip#Browse(tfile<".tfile.">)") + call zip#Browse(tfile) + elseif rfile =~ '\.tar$' +" call Decho("handling remote tar file with tar#Browse(tfile<".tfile.">)") + call tar#Browse(tfile) + elseif rfile =~ '\.tar\.gz$' +" call Decho("handling remote gzip-compressed tar file") + call tar#Browse(tfile) + elseif rfile =~ '\.tar\.bz2$' +" call Decho("handling remote bz2-compressed tar file") + call tar#Browse(tfile) + elseif rfile =~ '\.tar\.xz$' +" call Decho("handling remote xz-compressed tar file") + call tar#Browse(tfile) + elseif rfile =~ '\.txz$' +" call Decho("handling remote xz-compressed tar file (.txz)") + call tar#Browse(tfile) + else +" call Decho("edit temporary file") + e! endif - let mapsafepath = escape(s:path, s:netrw_map_escape) - let mapsafeusermach = escape(s:user.s:machine, s:netrw_map_escape) + " rename buffer back to remote filename +" call Decho("exe sil! keepalt file ".fnameescape(rfile)) + exe "sil! keepj keepalt file ".fnameescape(rfile) + + " Detect filetype of local version of remote file. + " Note that isk must not include a "/" for scripts.vim + " to process this detection correctly. +" call Decho("detect filetype of local version of remote file") + let iskkeep= &l:isk + setl isk-=/ + let &l:isk= iskkeep +" call Dredir("renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">","ls!") + let line1 = 1 + let line2 = line("$") - nnoremap NetrwRefresh :call NetrwRefresh(0,NetrwBrowseChgDir(0,'./')) - if g:netrw_mousemaps == 1 - nnoremap :call NetrwLeftmouse(0) - nnoremap :call NetrwPrevWinOpen(0) - nnoremap :call NetrwMarkFile(0,NetrwGetWord()) - exe 'nnoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'vnoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - inoremap :call NetrwLeftmouse(0) - inoremap :call NetrwPrevWinOpen(0) - inoremap :call NetrwMarkFile(0,NetrwGetWord()) - exe 'inoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - endif - exe 'nnoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'nnoremap d :call NetrwMakeDir("'.mapsafeusermach.'")' - exe 'nnoremap D :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'nnoremap R :call NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'vnoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'vnoremap D :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'vnoremap R :call NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'inoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'inoremap d :call NetrwMakeDir("'.mapsafeusermach.'")' - exe 'inoremap D :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'inoremap R :call NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")' - nnoremap :he netrw-quickhelp - inoremap :he netrw-quickhelp + elseif s:FileReadable(a:tfile) + " read file after current line +" call Decho("read file<".a:tfile."> after current line") + let curline = line(".") + let lastline= line("$") +" call Decho("exe<".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile)."> line#".curline) + exe "keepj ".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile) + let line1= curline + 1 + let line2= line("$") - lastline + 1 + + else + " not readable +" call Decho("(NetrwGetFile) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("tfile<".a:tfile."> not readable") + keepj call netrw#ErrorMsg(s:WARNING,"file <".a:tfile."> not readable",9) +" call Dret("NetrwGetFile : tfile<".a:tfile."> not readable") + return endif - call s:SetRexDir(a:islocal,b:netrw_curdir) -" call Dret("s:BrowserMaps") -endfun -" --------------------------------------------------------------------- -" s:ExplorePatHls: converts an Explore pattern into a regular expression search pattern {{{2 -fun! s:ExplorePatHls(pattern) -" call Dfunc("s:ExplorePatHls(pattern<".a:pattern.">)") - let repat= substitute(a:pattern,'^**/\{1,2}','','') -" call Decho("repat<".repat.">") - let repat= escape(repat,'][.\') -" call Decho("repat<".repat.">") - let repat= '\<'.substitute(repat,'\*','\\(\\S\\+ \\)*\\S\\+','g').'\>' -" call Dret("s:ExplorePatHls repat<".repat.">") - return repat + " User-provided (ie. optional) fix-it-up command + if exists("*NetReadFixup") +" call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")") + keepj call NetReadFixup(a:method, line1, line2) +" else " Decho +" call Decho("NetReadFixup() not called, doesn't exist (line1=".line1." line2=".line2.")") + endif + + if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu + " update the Buffers menu + keepj call s:UpdateBuffersMenu() + endif + +" call Decho("readcmd<".a:readcmd."> cmdarg<".v:cmdarg."> tfile<".a:tfile."> readable=".s:FileReadable(a:tfile)) + + " make sure file is being displayed +" redraw! + +" call Decho("(NetrwGetFile) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Dret("NetrwGetFile") endfun -" --------------------------------------------------------------------- -" s:NetrwBookHistHandler: {{{2 -" 0: (user: ) bookmark current directory -" 1: (user: ) change to the bookmarked directory -" 2: (user: ) list bookmarks -" 3: (browsing) record current directory history -" 4: (user: ) go up (previous) bookmark -" 5: (user: ) go down (next) bookmark -" 6: (user: ) delete bookmark -fun! s:NetrwBookHistHandler(chg,curdir) -" call Dfunc("s:NetrwBookHistHandler(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count." histcnt=".g:netrw_dirhist_cnt." histmax=".g:netrw_dirhistmax) +" ------------------------------------------------------------------------ +" s:NetrwMethod: determine method of transfer {{{2 +" Input: +" choice = url [protocol:]//[userid@]hostname[:port]/[path-to-file] +" Output: +" b:netrw_method= 1: rcp +" 2: ftp + <.netrc> +" 3: ftp + machine, id, password, and [path]filename +" 4: scp +" 5: http[s] (wget) +" 6: dav +" 7: rsync +" 8: fetch +" 9: sftp +" g:netrw_machine= hostname +" b:netrw_fname = filename +" g:netrw_port = optional port number (for ftp) +" g:netrw_choice = copy of input url (choice) +fun! s:NetrwMethod(choice) +" call Dfunc("NetrwMethod(a:choice<".a:choice.">)") - if a:chg == 0 - " bookmark the current directory -" call Decho("(user: ) bookmark the current directory") - if !exists("g:netrw_bookmarklist") - let g:netrw_bookmarklist= [] - endif - if index(g:netrw_bookmarklist,a:curdir) == -1 - " curdir not currently in g:netrw_bookmarklist, so include it - call add(g:netrw_bookmarklist,a:curdir) - call sort(g:netrw_bookmarklist) + " sanity check: choice should have at least three slashes in it + if strlen(substitute(a:choice,'[^/]','','g')) < 3 + call netrw#ErrorMsg(s:ERROR,"not a netrw-style url; netrw uses protocol://[user@]hostname[:port]/[path])",78) + let b:netrw_method = -1 +" call Dret("NetrwMethod : incorrect url format<".a:choice.">") + return endif - echo "bookmarked the current directory" - elseif a:chg == 1 - " change to the bookmarked directory -" call Decho("(user: <".v:count."mb>) change to the bookmarked directory") - if exists("g:netrw_bookmarklist[v:count-1]") - exe "e ".fnameescape(g:netrw_bookmarklist[v:count-1]) + " record current g:netrw_machine, if any + " curmachine used if protocol == ftp and no .netrc + if exists("g:netrw_machine") + let curmachine= g:netrw_machine +" call Decho("curmachine<".curmachine.">") else - echomsg "Sorry, bookmark#".v:count." doesn't exist!" + let curmachine= "N O T A HOST" endif - - elseif a:chg == 2 -" redraw! - let didwork= 0 - " list user's bookmarks -" call Decho("(user: ) list user's bookmarks") - if exists("g:netrw_bookmarklist") -" call Decho('list '.len(g:netrw_bookmarklist).' bookmarks') - let cnt= 1 - for bmd in g:netrw_bookmarklist -" call Decho("Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1]) - echo "Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1] - let didwork = 1 - let cnt = cnt + 1 - endfor + if exists("g:netrw_port") + let netrw_port= g:netrw_port endif - " list directory history - let cnt = g:netrw_dirhist_cnt - let first = 1 - let histcnt = 0 - while ( first || cnt != g:netrw_dirhist_cnt ) -" call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:netrw_dirhist_cnt) - let histcnt= histcnt + 1 - if exists("g:netrw_dirhist_{cnt}") -" call Decho("Netrw History#".histcnt.": ".g:netrw_dirhist_{cnt}) - echo "Netrw History#".histcnt.": ".g:netrw_dirhist_{cnt} - let didwork= 1 - endif - let first = 0 - let cnt = ( cnt - 1 ) % g:netrw_dirhistmax - if cnt < 0 - let cnt= cnt + g:netrw_dirhistmax - endif - endwhile - if didwork - call inputsave()|call input("Press to continue")|call inputrestore() + " insure that netrw_ftp_cmd starts off every method determination + " with the current g:netrw_ftp_cmd + let s:netrw_ftp_cmd= g:netrw_ftp_cmd + + " initialization + let b:netrw_method = 0 + let g:netrw_machine = "" + let b:netrw_fname = "" + let g:netrw_port = "" + let g:netrw_choice = a:choice + + " Patterns: + " mipf : a:machine a:id password filename Use ftp + " mf : a:machine filename Use ftp + <.netrc> or g:netrw_uid s:netrw_passwd + " ftpurm : ftp://[user@]host[[#:]port]/filename Use ftp + <.netrc> or g:netrw_uid s:netrw_passwd + " rcpurm : rcp://[user@]host/filename Use rcp + " rcphf : [user@]host:filename Use rcp + " scpurm : scp://[user@]host[[#:]port]/filename Use scp + " httpurm : http[s]://[user@]host/filename Use wget + " davurm : dav[s]://host[:port]/path Use cadaver/curl + " rsyncurm : rsync://host[:port]/path Use rsync + " fetchurm : fetch://[user@]host[:http]/filename Use fetch (defaults to ftp, override for http) + " sftpurm : sftp://[user@]host/filename Use scp + let mipf = '^\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)$' + let mf = '^\(\S\+\)\s\+\(\S\+\)$' +" let ftpurm = '^ftp://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\([#:]\d\+\)\=/\(.*\)$' +" let rcpurm = '^rcp://\%(\([^/@]\{-}\)@\)\=\([^/]\{-}\)/\(.*\)$' +" let fetchurm = '^fetch://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\(:http\)\=/\(.*\)$' + let ftpurm = '^ftp://\(\([^/]*\)@\)\=\([^/#:]\{-}\)\([#:]\d\+\)\=/\(.*\)$' + let rcpurm = '^rcp://\%(\([^/]*\)@\)\=\([^/]\{-}\)/\(.*\)$' + let rcphf = '^\(\(\h\w*\)@\)\=\(\h\w*\):\([^@]\+\)$' + let scpurm = '^scp://\([^/#:]\+\)\%([#:]\(\d\+\)\)\=/\(.*\)$' + let httpurm = '^https\=://\([^/]\{-}\)\(/.*\)\=$' + let davurm = '^davs\=://\([^/]\+\)/\(.*/\)\([-_.~[:alnum:]]\+\)$' + let rsyncurm = '^rsync://\([^/]\{-}\)/\(.*\)\=$' + let fetchurm = '^fetch://\(\([^/]*\)@\)\=\([^/#:]\{-}\)\(:http\)\=/\(.*\)$' + let sftpurm = '^sftp://\([^/]\{-}\)/\(.*\)\=$' + +" call Decho("determine method:") + " Determine Method + " Method#1: rcp://user@hostname/...path-to-file {{{3 + if match(a:choice,rcpurm) == 0 +" call Decho("rcp://...") + let b:netrw_method = 1 + let userid = substitute(a:choice,rcpurm,'\1',"") + let g:netrw_machine = substitute(a:choice,rcpurm,'\2',"") + let b:netrw_fname = substitute(a:choice,rcpurm,'\3',"") + if userid != "" + let g:netrw_uid= userid endif - elseif a:chg == 3 - " saves most recently visited directories (when they differ) -" call Decho("(browsing) record curdir history") - if !exists("g:netrw_dirhist_cnt") || !exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") || g:netrw_dirhist_{g:netrw_dirhist_cnt} != a:curdir - let g:netrw_dirhist_cnt = ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax - let g:netrw_dirhist_{g:netrw_dirhist_cnt} = a:curdir -" call Decho("save dirhist#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">") + " Method#4: scp://user@hostname/...path-to-file {{{3 + elseif match(a:choice,scpurm) == 0 +" call Decho("scp://...") + let b:netrw_method = 4 + let g:netrw_machine = substitute(a:choice,scpurm,'\1',"") + let g:netrw_port = substitute(a:choice,scpurm,'\2',"") + let b:netrw_fname = substitute(a:choice,scpurm,'\3',"") + + " Method#5: http[s]://user@hostname/...path-to-file {{{3 + elseif match(a:choice,httpurm) == 0 +" call Decho("http://...") + let b:netrw_method = 5 + let g:netrw_machine= substitute(a:choice,httpurm,'\1',"") + let b:netrw_fname = substitute(a:choice,httpurm,'\2',"") + + " Method#6: dav://hostname[:port]/..path-to-file.. {{{3 + elseif match(a:choice,davurm) == 0 +" call Decho("dav://...") + let b:netrw_method= 6 + if a:choice =~ 'davs:' + let g:netrw_machine= 'https://'.substitute(a:choice,davurm,'\1/\2',"") + else + let g:netrw_machine= 'http://'.substitute(a:choice,davurm,'\1/\2',"") endif + let b:netrw_fname = substitute(a:choice,davurm,'\3',"") - elseif a:chg == 4 - " u: change to the previous directory stored on the history list -" call Decho("(user: ) chg to prev dir from history") - let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - 1 ) % g:netrw_dirhistmax - if g:netrw_dirhist_cnt < 0 - let g:netrw_dirhist_cnt= g:netrw_dirhist_cnt + g:netrw_dirhistmax - endif - if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") -" call Decho("changedir u#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">") - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") - setlocal ma noro -" call Decho("setlocal ma noro") - keepj %d - setlocal nomod -" call Decho("setlocal nomod") - endif -" " call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt})) - exe "keepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) - else - let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax - echo "Sorry, no predecessor directory exists yet" + " Method#7: rsync://user@hostname/...path-to-file {{{3 + elseif match(a:choice,rsyncurm) == 0 +" call Decho("rsync://...") + let b:netrw_method = 7 + let g:netrw_machine= substitute(a:choice,rsyncurm,'\1',"") + let b:netrw_fname = substitute(a:choice,rsyncurm,'\2',"") + + " Methods 2,3: ftp://[user@]hostname[[:#]port]/...path-to-file {{{3 + elseif match(a:choice,ftpurm) == 0 +" call Decho("ftp://...") + let userid = substitute(a:choice,ftpurm,'\2',"") + let g:netrw_machine= substitute(a:choice,ftpurm,'\3',"") + let g:netrw_port = substitute(a:choice,ftpurm,'\4',"") + let b:netrw_fname = substitute(a:choice,ftpurm,'\5',"") +" call Decho("g:netrw_machine<".g:netrw_machine.">") + if userid != "" + let g:netrw_uid= userid endif - elseif a:chg == 5 - " U: change to the subsequent directory stored on the history list -" call Decho("(user: ) chg to next dir from history") - let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax - if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") -" call Decho("changedir U#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">") - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") - setlocal ma noro -" call Decho("setlocal ma noro") - keepj %d -" call Decho("removed all lines from buffer (%d)") - setlocal nomod -" call Decho("setlocal nomod") + if curmachine != g:netrw_machine + if exists("s:netwr_hup[".g:netrw_machine."]") + call NetUserPass("ftp:".g:netrw_machine) + elseif exists("s:netrw_passwd") + " if there's a change in hostname, require password re-entry + unlet s:netrw_passwd endif -" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt})) - exe "keepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) - else - let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - 1 ) % g:netrw_dirhistmax - if g:netrw_dirhist_cnt < 0 - let g:netrw_dirhist_cnt= g:netrw_dirhist_cnt + g:netrw_dirhistmax + if exists("netrw_port") + unlet netrw_port endif - echo "Sorry, no successor directory exists yet" - endif - - elseif a:chg == 6 - " delete the v:count'th bookmark -" call Decho("delete bookmark#".v:count."<".g:netrw_bookmarklist[v:count-1].">") - let savefile= s:NetrwHome()."/.netrwbook" - if filereadable(savefile) - call s:NetrwBookHistSave() " done here to merge bookmarks first - call delete(savefile) endif - call remove(g:netrw_bookmarklist,v:count-1) - endif - call s:NetrwBookmarkMenu() -" call Dret("s:NetrwBookHistHandler") -endfun -" --------------------------------------------------------------------- -" s:NetrwBookHistRead: this function reads bookmarks and history {{{2 -" Sister function: s:NetrwBookHistSave() -fun! s:NetrwBookHistRead() -" call Dfunc("s:NetrwBookHistRead()") - if !exists("s:netrw_initbookhist") - let home = s:NetrwHome() - let savefile= home."/.netrwbook" - if filereadable(savefile) -" call Decho("sourcing .netrwbook") - exe "so ".savefile - endif - let savefile= home."/.netrwhist" - if filereadable(savefile) -" call Decho("sourcing .netrwhist") - exe "so ".savefile + if exists("g:netrw_uid") && exists("s:netrw_passwd") + let b:netrw_method = 3 + else + let host= substitute(g:netrw_machine,'\..*$','','') + if exists("s:netrw_hup[host]") + call NetUserPass("ftp:".host) + + elseif (has("win32") || has("win95") || has("win64") || has("win16")) && s:netrw_ftp_cmd =~ '-[sS]:' +" call Decho("has -s: : s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">") +" call Decho(" g:netrw_ftp_cmd<".g:netrw_ftp_cmd.">") + if g:netrw_ftp_cmd =~ '-[sS]:\S*MACHINE\>' + let s:netrw_ftp_cmd= substitute(g:netrw_ftp_cmd,'\',g:netrw_machine,'') +" call Decho("s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">") + endif + let b:netrw_method= 2 + elseif s:FileReadable(expand("$HOME/.netrc")) && !g:netrw_ignorenetrc +" call Decho("using <".expand("$HOME/.netrc")."> (readable)") + let b:netrw_method= 2 + else + if !exists("g:netrw_uid") || g:netrw_uid == "" + call NetUserPass() + elseif !exists("s:netrw_passwd") || s:netrw_passwd == "" + call NetUserPass(g:netrw_uid) + " else just use current g:netrw_uid and s:netrw_passwd + endif + let b:netrw_method= 3 + endif endif - let s:netrw_initbookhist= 1 - au VimLeave * call s:NetrwBookHistSave() - endif -" call Dret("s:NetrwBookHistRead") -endfun -" --------------------------------------------------------------------- -" s:NetrwBookHistSave: this function saves bookmarks and history {{{2 -" Sister function: s:NetrwBookHistRead() -" I used to do this via viminfo but that appears to -" be unreliable for long-term storage -" COMBAK: does $HOME work under windows??? -fun! s:NetrwBookHistSave() -" call Dfunc("s:NetrwBookHistSave() dirhistmax=".g:netrw_dirhistmax) - let savefile= s:NetrwHome()."/.netrwhist" - 1split - call s:NetrwEnew() - setlocal cino= com= cpo-=aA fo=nroql2 tw=0 report=10000 noswf - setlocal nocin noai noci magic nospell nohid wig= noaw - setlocal ma noro write - if exists("&acd") | setlocal noacd | endif - silent %d + " Method#8: fetch {{{3 + elseif match(a:choice,fetchurm) == 0 +" call Decho("fetch://...") + let b:netrw_method = 8 + let g:netrw_userid = substitute(a:choice,fetchurm,'\2',"") + let g:netrw_machine= substitute(a:choice,fetchurm,'\3',"") + let b:netrw_option = substitute(a:choice,fetchurm,'\4',"") + let b:netrw_fname = substitute(a:choice,fetchurm,'\5',"") - " save .netrwhist -- no attempt to merge - silent! file .netrwhist - call setline(1,"let g:netrw_dirhistmax =".g:netrw_dirhistmax) - call setline(2,"let g:netrw_dirhist_cnt =".g:netrw_dirhist_cnt) - let lastline = line("$") - let cnt = 1 - while cnt <= g:netrw_dirhist_cnt - call setline((cnt+lastline),'let g:netrw_dirhist_'.cnt."='".g:netrw_dirhist_{cnt}."'") - let cnt= cnt + 1 - endwhile - exe "sil! w! ".savefile + " Method#3: Issue an ftp : "machine id password [path/]filename" {{{3 + elseif match(a:choice,mipf) == 0 +" call Decho("(ftp) host id pass file") + let b:netrw_method = 3 + let g:netrw_machine = substitute(a:choice,mipf,'\1',"") + let g:netrw_uid = substitute(a:choice,mipf,'\2',"") + let s:netrw_passwd = substitute(a:choice,mipf,'\3',"") + let b:netrw_fname = substitute(a:choice,mipf,'\4',"") + call NetUserPass(g:netrw_machine,g:netrw_uid,s:netrw_passwd) - sil keepj %d - if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] - " merge and write .netrwbook - let savefile= s:NetrwHome()."/.netrwbook" + " Method#3: Issue an ftp: "hostname [path/]filename" {{{3 + elseif match(a:choice,mf) == 0 +" call Decho("(ftp) host file") + if exists("g:netrw_uid") && exists("s:netrw_passwd") + let b:netrw_method = 3 + let g:netrw_machine = substitute(a:choice,mf,'\1',"") + let b:netrw_fname = substitute(a:choice,mf,'\2',"") - if filereadable(savefile) - let booklist= deepcopy(g:netrw_bookmarklist) - exe "sil keepj so ".savefile - for bdm in booklist - if index(g:netrw_bookmarklist,bdm) == -1 - call add(g:netrw_bookmarklist,bdm) - endif - endfor - call sort(g:netrw_bookmarklist) - exe "sil! w! ".savefile + elseif s:FileReadable(expand("$HOME/.netrc")) + let b:netrw_method = 2 + let g:netrw_machine = substitute(a:choice,mf,'\1',"") + let b:netrw_fname = substitute(a:choice,mf,'\2',"") endif - " construct and save .netrwbook - call setline(1,"let g:netrw_bookmarklist= ".string(g:netrw_bookmarklist)) - exe "sil! w! ".savefile - endif - let bgone= bufnr("%") - q! - exe bgone."bwipe!" - -" call Dret("s:NetrwBookHistSave") -endfun + " Method#9: sftp://user@hostname/...path-to-file {{{3 + elseif match(a:choice,sftpurm) == 0 +" call Decho("sftp://...") + let b:netrw_method = 9 + let g:netrw_machine= substitute(a:choice,sftpurm,'\1',"") + let b:netrw_fname = substitute(a:choice,sftpurm,'\2',"") -" --------------------------------------------------------------------- -" s:NetrwBrowse: This function uses the command in g:netrw_list_cmd to provide a {{{2 -" list of the contents of a local or remote directory. It is assumed that the -" g:netrw_list_cmd has a string, USEPORT HOSTNAME, that needs to be substituted -" with the requested remote hostname first. -fun! s:NetrwBrowse(islocal,dirname) - if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif -" call Dfunc("s:NetrwBrowse(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".w:netrw_liststyle." ".g:loaded_netrw." buf#".bufnr("%")."<".bufname("%")."> win#".winnr()) -" call Decho("tab#".tabpagenr()." win#".winnr()) -" call Dredir("ls!") - if !exists("s:netrw_initbookhist") - call s:NetrwBookHistRead() - endif + " Method#1: Issue an rcp: hostname:filename" (this one should be last) {{{3 + elseif match(a:choice,rcphf) == 0 +" call Decho("(rcp) [user@]host:file) rcphf<".rcphf.">") + let b:netrw_method = 1 + let userid = substitute(a:choice,rcphf,'\2',"") + let g:netrw_machine = substitute(a:choice,rcphf,'\3',"") + let b:netrw_fname = substitute(a:choice,rcphf,'\4',"") +" call Decho('\1<'.substitute(a:choice,rcphf,'\1',"").">") +" call Decho('\2<'.substitute(a:choice,rcphf,'\2',"").">") +" call Decho('\3<'.substitute(a:choice,rcphf,'\3',"").">") +" call Decho('\4<'.substitute(a:choice,rcphf,'\4',"").">") + if userid != "" + let g:netrw_uid= userid + endif - " simplify the dirname (especially for ".."s in dirnames) - if a:dirname !~ '^\a\+://' - let dirname= simplify(a:dirname) + " Cannot Determine Method {{{3 else - let dirname= a:dirname - endif - - if exists("s:netrw_skipbrowse") - unlet s:netrw_skipbrowse -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) -" call Dret("s:NetrwBrowse : s:netrw_skipbrowse=".s:netrw_skipbrowse) - return - endif - if !exists("*shellescape") - call netrw#ErrorMsg(s:ERROR,"netrw can't run -- your vim is missing shellescape()",69) -" call Dret("s:NetrwBrowse : missing shellescape()") - return - endif - if !exists("*fnameescape") - call netrw#ErrorMsg(s:ERROR,"netrw can't run -- your vim is missing fnameescape()",70) -" call Dret("s:NetrwBrowse : missing fnameescape()") - return + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:WARNING,"cannot determine method (format: protocol://[user@]hostname[:port]/[path])",45) + endif + let b:netrw_method = -1 endif + "}}}3 - call s:NetrwOptionSave("w:") - - " re-instate any marked files - if exists("s:netrwmarkfilelist_{bufnr('%')}") -" call Decho("clearing marked files") - exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" + if g:netrw_port != "" + " remove any leading [:#] from port number + let g:netrw_port = substitute(g:netrw_port,'[#:]\+','','') + elseif exists("netrw_port") + " retain port number as implicit for subsequent ftp operations + let g:netrw_port= netrw_port endif - if a:islocal && exists("w:netrw_acdkeep") && w:netrw_acdkeep -" call Decho("handle w:netrw_acdkeep:") -" call Decho("keepjumps lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")") - exe 'keepj lcd '.fnameescape(dirname) - call s:NetrwSafeOptions() -" call Decho("getcwd<".getcwd().">") - - elseif !a:islocal && dirname !~ '[\/]$' && dirname !~ '^"' - " looks like a regular file, attempt transfer -" call Decho("attempt transfer as regular file<".dirname.">") +" call Decho("a:choice <".a:choice.">") +" call Decho("b:netrw_method <".b:netrw_method.">") +" call Decho("g:netrw_machine<".g:netrw_machine.">") +" call Decho("g:netrw_port <".g:netrw_port.">") +" if exists("g:netrw_uid") "Decho +" call Decho("g:netrw_uid <".g:netrw_uid.">") +" endif "Decho +" if exists("s:netrw_passwd") "Decho +" call Decho("s:netrw_passwd <".s:netrw_passwd.">") +" endif "Decho +" call Decho("b:netrw_fname <".b:netrw_fname.">") +" call Dret("NetrwMethod : b:netrw_method=".b:netrw_method." g:netrw_port=".g:netrw_port) +endfun - " remove any filetype indicator from end of dirname, except for the {{{3 - " "this is a directory" indicator (/). - " There shouldn't be one of those here, anyway. - let path= substitute(dirname,'[*=@|]\r\=$','','e') -" call Decho("new path<".path.">") - call s:RemotePathAnalysis(dirname) +" ------------------------------------------------------------------------ +" NetReadFixup: this sort of function is typically written by the user {{{2 +" to handle extra junk that their system's ftp dumps +" into the transfer. This function is provided as an +" example and as a fix for a Windows 95 problem: in my +" experience, win95's ftp always dumped four blank lines +" at the end of the transfer. +if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp + fun! NetReadFixup(method, line1, line2) +" call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")") - " remote-read the requested file into current buffer {{{3 - keepj mark ' - call s:NetrwEnew(dirname) - call s:NetrwSafeOptions() - setlocal ma noro -" call Decho("setlocal ma noro") - let b:netrw_curdir= dirname -" call Decho("exe sil! keepalt file ".fnameescape(s:method."://".s:user.s:machine."/".s:path)." (bt=".&bt.")") - exe "sil! keepalt file ".fnameescape(s:method."://".s:user.s:machine."/".s:path) - exe "sil! keepalt doau BufReadPre ".fnameescape(s:fname) - silent call netrw#NetRead(2,s:method."://".s:user.s:machine."/".s:path) - if s:path !~ '.tar.bz2$' && s:path !~ '.tar.gz' && s:path !~ '.tar.xz' && s:path !~ '.txz' - " netrw.vim and tar.vim have already handled decompression of the tarball; avoiding gzip.vim error - exe "sil keepalt doau BufReadPost ".fnameescape(s:fname) + " sanity checks -- attempt to convert inputs to integers + let method = a:method + 0 + let line1 = a:line1 + 0 + let line2 = a:line2 + 0 + if type(method) != 0 || type(line1) != 0 || type(line2) != 0 || method < 0 || line1 <= 0 || line2 <= 0 +" call Dret("NetReadFixup") + return endif - " save certain window-oriented variables into buffer-oriented variables {{{3 - call s:SetBufWinVars() - call s:NetrwOptionRestore("w:") - setlocal ma nomod + if method == 3 " ftp (no <.netrc>) + let fourblanklines= line2 - 3 + if fourblanklines >= line1 + exe "sil keepj ".fourblanklines.",".line2."g/^\s*$/d" + call histdel("/",-1) + endif + endif -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) -" call Dret("s:NetrwBrowse : file<".s:fname.">") - return - endif +" call Dret("NetReadFixup") + endfun +endif - " use buffer-oriented WinVars if buffer ones exist but window ones don't {{{3 - call s:UseBufWinVars() +" --------------------------------------------------------------------- +" NetUserPass: set username and password for subsequent ftp transfer {{{2 +" Usage: :call NetUserPass() -- will prompt for userid and password +" :call NetUserPass("uid") -- will prompt for password +" :call NetUserPass("uid","password") -- sets global userid and password +" :call NetUserPass("ftp:host") -- looks up userid and password using hup dictionary +" :call NetUserPass("host","uid","password") -- sets hup dictionary with host, userid, password +fun! NetUserPass(...) - " set up some variables {{{3 - let b:netrw_browser_active = 1 - let dirname = dirname - let s:last_sort_by = g:netrw_sort_by +" call Dfunc("NetUserPass() a:0=".a:0) - " set up menu {{{3 - call s:NetrwMenu(1) + if !exists('s:netrw_hup') + let s:netrw_hup= {} + endif - " set up buffer {{{3 - let reusing= s:NetrwGetBuffer(a:islocal,dirname) - " maintain markfile highlighting - if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != "" -" call Decho("bufnr(%)=".bufnr('%')) -" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/") - exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" - else -" call Decho("2match none") - 2match none - endif - if reusing - call s:NetrwOptionRestore("w:") - setlocal noma nomod nowrap -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) -" call Dret("s:NetrwBrowse : re-using buffer") - return - endif + if a:0 == 0 + " case: no input arguments - " set b:netrw_curdir to the new directory name {{{3 -" call Decho("set b:netrw_curdir to the new directory name: (buf#".bufnr("%").")") - let b:netrw_curdir= dirname - if b:netrw_curdir =~ '[/\\]$' - let b:netrw_curdir= substitute(b:netrw_curdir,'[/\\]$','','e') - endif - if b:netrw_curdir == '' - if has("amiga") - " On the Amiga, the empty string connotes the current directory - let b:netrw_curdir= getcwd() - else - " under unix, when the root directory is encountered, the result - " from the preceding substitute is an empty string. - let b:netrw_curdir= '/' - endif + " change host and username if not previously entered; get new password + if !exists("g:netrw_machine") + let g:netrw_machine= input('Enter hostname: ') endif - if !a:islocal && b:netrw_curdir !~ '/$' - let b:netrw_curdir= b:netrw_curdir.'/' + if !exists("g:netrw_uid") || g:netrw_uid == "" + " get username (user-id) via prompt + let g:netrw_uid= input('Enter username: ') endif -" call Decho("b:netrw_curdir<".b:netrw_curdir.">") - - " ------------ - " (local only) {{{3 - " ------------ - if a:islocal -" call Decho("local only:") - - " Set up ShellCmdPost handling. Append current buffer to browselist - call s:LocalFastBrowser() + " get password via prompting + let s:netrw_passwd= inputsecret("Enter Password: ") - " handle g:netrw_keepdir: set vim's current directory to netrw's notion of the current directory {{{3 - if !g:netrw_keepdir -" call Decho("handle g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) -" call Decho("l:acd".(exists("&l:acd")? "=".&l:acd : " doesn't exist")) - if !exists("&l:acd") || !&l:acd -" call Decho('exe keepjumps lcd '.fnameescape(b:netrw_curdir)) - try - exe 'keepj lcd '.fnameescape(b:netrw_curdir) - catch /^Vim\%((\a\+)\)\=:E472/ - call netrw#ErrorMsg(s:ERROR,"unable to change directory to <".b:netrw_curdir."> (permissions?)",61) - if exists("w:netrw_prvdir") - let b:netrw_curdir= w:netrw_prvdir - else - call s:NetrwOptionRestore("w:") - setlocal noma nomod nowrap - let b:netrw_curdir= dirname -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) -" call Dret("s:NetrwBrowse : reusing buffer#".(exists("bufnum")? bufnum : 'N/A')."<".dirname."> getcwd<".getcwd().">") - return - endif - endtry - endif + " set up hup database + let host = substitute(g:netrw_machine,'\..*$','','') + if !exists('s:netrw_hup[host]') + let s:netrw_hup[host]= {} + endif + let s:netrw_hup[host].uid = g:netrw_uid + let s:netrw_hup[host].passwd = s:netrw_passwd + + elseif a:0 == 1 + " case: one input argument + + if a:1 =~ '^ftp:' + " get host from ftp:... url + " access userid and password from hup (host-user-passwd) dictionary + let host = substitute(a:1,'^ftp:','','') + let host = substitute(host,'\..*','','') + if exists("s:netrw_hup[host]") + let g:netrw_uid = s:netrw_hup[host].uid + let s:netrw_passwd = s:netrw_hup[host].passwd +" call Decho("get s:netrw_hup[".host."].uid <".s:netrw_hup[host].uid.">") +" call Decho("get s:netrw_hup[".host."].passwd<".s:netrw_hup[host].passwd.">") + else + let g:netrw_uid = input("Enter UserId: ") + let s:netrw_passwd = inputsecret("Enter Password: ") endif - " -------------------------------- - " remote handling: {{{3 - " -------------------------------- else -" call Decho("remote only:") - - " analyze dirname and g:netrw_list_cmd {{{4 -" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist")."> dirname<".dirname.">") - if dirname =~ "^NetrwTreeListing\>" - let dirname= b:netrw_curdir -" call Decho("(dirname was ".dirname.") dirname<".dirname.">") - elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") - let dirname= substitute(b:netrw_curdir,'\\','/','g') - if dirname !~ '/$' - let dirname= dirname.'/' - endif - let b:netrw_curdir = dirname -" call Decho("(liststyle is TREELIST) dirname<".dirname.">") + " case: one input argument, not an url. Using it as a new user-id. + if exists("g:netrw_machine") + let host= substitute(g:netrw_machine,'\..*$','','') else - let dirname = substitute(dirname,'\\','/','g') -" call Decho("(normal) dirname<".dirname.">") + let g:netrw_machine= input('Enter hostname: ') + endif + let g:netrw_uid = a:1 +" call Decho("set g:netrw_uid= <".g:netrw_uid.">") + if exists("g:netrw_passwd") + " ask for password if one not previously entered + let s:netrw_passwd= g:netrw_passwd + else + let s:netrw_passwd = inputsecret("Enter Password: ") endif + endif - let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$' - if dirname !~ dirpat - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"netrw doesn't understand your dirname<".dirname.">",20) - endif - call s:NetrwOptionRestore("w:") - setlocal noma nomod nowrap -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) -" call Dret("s:NetrwBrowse : badly formatted dirname<".dirname.">") - return +" call Decho("host<".host.">") + if exists("host") + if !exists('s:netrw_hup[host]') + let s:netrw_hup[host]= {} endif - let b:netrw_curdir= dirname -" call Decho("b:netrw_curdir<".b:netrw_curdir."> (remote)") - endif " (additional remote handling) + let s:netrw_hup[host].uid = g:netrw_uid + let s:netrw_hup[host].passwd = s:netrw_passwd + endif - " ----------------------- - " Directory Listing: {{{3 - " ----------------------- - call s:BrowserMaps(a:islocal) - call s:PerformListing(a:islocal) + elseif a:0 == 2 + let g:netrw_uid = a:1 + let s:netrw_passwd = a:2 - " The s:LocalBrowseShellCmdRefresh() function is called by an autocmd - " installed by s:LocalFastBrowser() when g:netrw_fastbrowse <= 1 (ie. slow, medium speed). - " However, s:NetrwBrowse() causes the ShellCmdPost event itself to fire once; setting - " the variable below avoids that second refresh of the screen. The s:LocalBrowseShellCmdRefresh() - " function gets called due to that autocmd; it notices that the following variable is set - " and skips the refresh and sets s:locbrowseshellcmd to zero. Oct 13, 2008 - let s:locbrowseshellcmd= 1 + elseif a:0 == 3 + " enter hostname, user-id, and password into the hup dictionary + let host = substitute(a:1,'^\a\+:','','') + let host = substitute(host,'\..*$','','') + if !exists('s:netrw_hup[host]') + let s:netrw_hup[host]= {} + endif + let s:netrw_hup[host].uid = a:2 + let s:netrw_hup[host].passwd = a:3 + let g:netrw_uid = s:netrw_hup[host].uid + let s:netrw_passwd = s:netrw_hup[host].passwd +" call Decho("set s:netrw_hup[".host."].uid <".s:netrw_hup[host].uid.">") +" call Decho("set s:netrw_hup[".host."].passwd<".s:netrw_hup[host].passwd.">") + endif -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) -" call Dret("s:NetrwBrowse : did PerformListing") - return +" call Dret("NetUserPass : uid<".g:netrw_uid."> passwd<".s:netrw_passwd.">") endfun +" =========================================== +" Shared Browsing Support: {{{1 +" =========================================== + " --------------------------------------------------------------------- -" s:NetrwFileInfo: supports qf (query for file information) {{{2 -fun! s:NetrwFileInfo(islocal,fname) -" call Dfunc("s:NetrwFileInfo(islocal=".a:islocal." fname<".a:fname.">)") - if a:islocal - if (has("unix") || has("macunix")) && executable("/bin/ls") - if exists("b:netrw_curdir") -" call Decho('using ls with b:netrw_curdir<'.b:netrw_curdir.'>') - if b:netrw_curdir =~ '/$' - echo system("/bin/ls -lsad ".shellescape(b:netrw_curdir.a:fname)) - else - echo system("/bin/ls -lsad ".shellescape(b:netrw_curdir."/".a:fname)) - endif - else -" call Decho('using ls '.a:fname." using cwd<".getcwd().">") - echo system("/bin/ls -lsad ".shellescape(a:fname)) - endif - else - " use vim functions to return information about file below cursor -" call Decho("using vim functions to query for file info") - if !isdirectory(a:fname) && !filereadable(a:fname) && a:fname =~ '[*@/]' - let fname= substitute(a:fname,".$","","") - else - let fname= a:fname +" s:NetrwMaps: {{{2 +fun! s:NetrwMaps(islocal) +" call Dfunc("s:NetrwMaps(islocal=".a:islocal.") b:netrw_curdir<".b:netrw_curdir.">") + + " set up Rexplore and [ 2-leftmouse-click -or- c-leftmouse ] +" call Decho("(NetrwMaps) set up Rexplore command") + com! Rexplore if exists("w:netrw_rexlocal")|call s:NetrwRexplore(w:netrw_rexlocal,exists("w:netrw_rexdir")? w:netrw_rexdir : ".")|else|call netrw#ErrorMsg(s:WARNING,"not a former netrw window",79)|endif + if g:netrw_mousemaps && g:netrw_retmap +" call Decho("(NetrwMaps) set up Rexplore 2-leftmouse") + if !hasmapto("NetrwReturn") + if maparg("<2-leftmouse>","n") == "" || maparg("<2-leftmouse>","n") =~ '^-$' +" call Decho("(NetrwMaps) making map for 2-leftmouse") + nmap <2-leftmouse> NetrwReturn + elseif maparg("","n") == "" +" call Decho("(NetrwMaps) making map for c-leftmouse") + nmap NetrwReturn endif - let t = getftime(fname) - let sz = getfsize(fname) - echo a:fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname)) -" call Decho(fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname))) endif - else - echo "sorry, \"qf\" not supported yet for remote files" + nno NetrwReturn :Rexplore +" call Decho("(NetrwMaps) made NetrwReturn map") endif -" call Dret("s:NetrwFileInfo") -endfun - -" --------------------------------------------------------------------- -" s:NetrwGetBuffer: {{{2 -" returns 0=cleared buffer -" 1=re-used buffer -fun! s:NetrwGetBuffer(islocal,dirname) -" call Dfunc("s:NetrwGetBuffer(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".g:netrw_liststyle) - let dirname= a:dirname - " re-use buffer if possible {{{3 -" call Decho("--re-use a buffer if possible--") - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST - " find NetrwTreeList buffer if there is one -" call Decho("find NetrwTreeList buffer if there is one") - if exists("w:netrw_treebufnr") && w:netrw_treebufnr > 0 -" call Decho(" re-use w:netrw_treebufnr=".w:netrw_treebufnr) - let eikeep= &ei - set ei=all - exe "sil! b ".w:netrw_treebufnr - let &ei= eikeep -" call Dret("s:NetrwGetBuffer : bufnum#".w:netrw_treebufnr."") - return + if a:islocal +" call Decho("(NetrwMaps) make local maps") + " local normal-mode maps + nnoremap a :call NetrwHide(1) + nnoremap % :call NetrwOpenFile(1) + nnoremap c :exe "keepjumps lcd ".fnameescape(b:netrw_curdir) + nnoremap C :let g:netrw_chgwin= winnr() + nnoremap :call netrw#LocalBrowseCheck(NetrwBrowseChgDir(1,NetrwGetWord())) + nnoremap d :call NetrwMakeDir("") + nnoremap - :exe "norm! 0"call netrw#LocalBrowseCheck(NetrwBrowseChgDir(1,'../')) + nnoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) + nnoremap gd :call NetrwForceChgDir(1,NetrwGetWord()) + nnoremap gf :call NetrwForceFile(1,NetrwGetWord()) + nnoremap gh :call NetrwHidden(1) + nnoremap gp :call NetrwChgPerm(1,b:netrw_curdir) + nnoremap I :call NetrwBannerCtrl(1) + nnoremap i :call NetrwListStyle(1) + nnoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) + nnoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) + nnoremap mc :call NetrwMarkFileCopy(1) + nnoremap md :call NetrwMarkFileDiff(1) + nnoremap me :call NetrwMarkFileEdit(1) + nnoremap mf :call NetrwMarkFile(1,NetrwGetWord()) + nnoremap mF :call NetrwUnmarkList(bufnr("%"),b:netrw_curdir) + nnoremap mg :call NetrwMarkFileGrep(1) + nnoremap mh :call NetrwMarkHideSfx(1) + nnoremap mm :call NetrwMarkFileMove(1) + nnoremap mp :call NetrwMarkFilePrint(1) + nnoremap mr :call NetrwMarkFileRegexp(1) + nnoremap ms :call NetrwMarkFileSource(1) + nnoremap mt :call NetrwMarkFileTgt(1) + nnoremap mT :call NetrwMarkFileTag(1) + nnoremap mu :call NetrwUnMarkFile(1) + nnoremap mx :call NetrwMarkFileExe(1) + nnoremap mX :call NetrwMarkFileVimCmd(1) + nnoremap mz :call NetrwMarkFileCompress(1) + nnoremap O :call NetrwObtain(1) + nnoremap o :call NetrwSplit(3) + nnoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) + nnoremap P :call NetrwPrevWinOpen(1) + nnoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) + nnoremap qf :call NetrwFileInfo(1,NetrwGetWord()) + nnoremap qF :call NetrwMarkFileQFEL(1,getqflist()) + nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwRefresh(1,NetrwBrowseChgDir(1,'./')) + nnoremap s :call NetrwSortStyle(1) + nnoremap S :call NetSortSequence(1) + nnoremap t :call NetrwSplit(4) + nnoremap Tb :call NetrwSetTgt('b',v:count1) + nnoremap Th :call NetrwSetTgt('h',v:count) + nnoremap u :call NetrwBookHistHandler(4,expand("%")) + nnoremap U :call NetrwBookHistHandler(5,expand("%")) + nnoremap v :call NetrwSplit(5) + nnoremap x :call netrw#NetrwBrowseX(NetrwBrowseChgDir(1,NetrwGetWord(),0),0)" + nnoremap X :call NetrwLocalExecute(expand(""))" + " local insert-mode maps + inoremap a :call NetrwHide(1) + inoremap c :exe "keepjumps lcd ".fnameescape(b:netrw_curdir) + inoremap C :let g:netrw_chgwin= winnr() + inoremap % :call NetrwOpenFile(1) + inoremap - :exe "norm! 0"call netrw#LocalBrowseCheck(NetrwBrowseChgDir(1,'../')) + inoremap :call netrw#LocalBrowseCheck(NetrwBrowseChgDir(1,NetrwGetWord())) + inoremap d :call NetrwMakeDir("") + inoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) + inoremap gh :call NetrwHidden(1) + inoremap gp :call NetrwChgPerm(1,b:netrw_curdir) + inoremap I :call NetrwBannerCtrl(1) + inoremap i :call NetrwListStyle(1) + inoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) + inoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) + inoremap mc :call NetrwMarkFileCopy(1) + inoremap md :call NetrwMarkFileDiff(1) + inoremap me :call NetrwMarkFileEdit(1) + inoremap mf :call NetrwMarkFile(1,NetrwGetWord()) + inoremap mg :call NetrwMarkFileGrep(1) + inoremap mh :call NetrwMarkHideSfx(1) + inoremap mm :call NetrwMarkFileMove(1) + inoremap mp :call NetrwMarkFilePrint(1) + inoremap mr :call NetrwMarkFileRegexp(1) + inoremap ms :call NetrwMarkFileSource(1) + inoremap mT :call NetrwMarkFileTag(1) + inoremap mt :call NetrwMarkFileTgt(1) + inoremap mu :call NetrwUnMarkFile(1) + inoremap mx :call NetrwMarkFileExe(1) + inoremap mX :call NetrwMarkFileVimCmd(1) + inoremap mz :call NetrwMarkFileCompress(1) + inoremap O :call NetrwObtain(1) + inoremap o :call NetrwSplit(3) + inoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) + inoremap P :call NetrwPrevWinOpen(1) + inoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) + inoremap qf :call NetrwFileInfo(1,NetrwGetWord()) + inoremap qF :call NetrwMarkFileQFEL(1,getqflist()) + inoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwRefresh(1,NetrwBrowseChgDir(1,'./')) + inoremap s :call NetrwSortStyle(1) + inoremap S :call NetSortSequence(1) + inoremap t :call NetrwSplit(4) + inoremap Tb :call NetrwSetTgt('b',v:count1) + inoremap Th :call NetrwSetTgt('h',v:count) + inoremap u :call NetrwBookHistHandler(4,expand("%")) + inoremap U :call NetrwBookHistHandler(5,expand("%")) + inoremap v :call NetrwSplit(5) + inoremap x :call netrw#NetrwBrowseX(NetrwBrowseChgDir(1,NetrwGetWord(),0),0)" + if !hasmapto('NetrwHideEdit') + nmap NetrwHideEdit + imap NetrwHideEdit endif - let bufnum= -1 -" call Decho(" liststyle=TREE but w:netrw_treebufnr doesn't exist") - - else - " find buffer number of buffer named precisely the same as dirname {{{3 -" call Decho("--find buffer numnber of buffer named precisely the same as dirname--") -" call Dredir("ls!") - - " get dirname and associated buffer number - let bufnum = bufnr(escape(dirname,'\')) -" call Decho(" find buffer<".dirname.">'s number ") -" call Decho(" bufnr(dirname<".escape(dirname,'\').">)=".bufnum) - - if bufnum < 0 && dirname !~ '/$' - " try appending a trailing / -" call Decho(" try appending a trailing / to dirname<".dirname.">") - let bufnum= bufnr(escape(dirname.'/','\')) - if bufnum > 0 - let dirname= dirname.'/' - endif + nnoremap NetrwHideEdit :call NetrwHideEdit(1) + if !hasmapto('NetrwRefresh') + nmap NetrwRefresh + imap NetrwRefresh endif - - if bufnum < 0 && dirname =~ '/$' - " try removing a trailing / -" call Decho(" try removing a trailing / from dirname<".dirname.">") - let bufnum= bufnr(escape(substitute(dirname,'/$','',''),'\')) - if bufnum > 0 - let dirname= substitute(dirname,'/$','','') - endif + nnoremap NetrwRefresh :call NetrwRefresh(1,NetrwBrowseChgDir(1,'./')) + if s:didstarstar || !mapcheck("","n") + nnoremap :Nexplore + inoremap :Nexplore endif - -" call Decho(" findbuf1: bufnum=bufnr('".dirname."')=".bufnum." bufname(".bufnum.")<".bufname(bufnum)."> (initial)") - " note: !~ was used just below, but that means using ../ to go back would match (ie. abc/def/ and abc/ matches) - if bufnum > 0 && bufname(bufnum) != dirname && bufname(bufnum) != '.' - " handle approximate matches -" call Decho(" handling approx match: bufnum#".bufnum."<".bufname(bufnum)."> approx-dirname<".dirname.">") - let ibuf = 1 - let buflast = bufnr("$") -" call Decho(" findbuf2: buflast=bufnr($)=".buflast) - while ibuf <= buflast - let bname= substitute(bufname(ibuf),'\\','/','g') - let bname= substitute(bname,'.\zs/$','','') -" call Decho(" findbuf3: while [ibuf=",ibuf."]<=[buflast=".buflast."]: dirname<".dirname."> bname=bufname(".ibuf.")<".bname.">") - if bname != '' && dirname =~ '/'.bname.'/\=$' && dirname !~ '^/' - " bname is not empty - " dirname ends with bname, - " dirname doesn't start with /, so its not a absolute path -" call Decho(" findbuf3a: passes test 1 : dirname<".dirname.'> =~ /'.bname.'/\=$ && dirname !~ ^/') - break - endif - if bname =~ '^'.dirname.'/\=$' - " bname begins with dirname -" call Decho(' findbuf3b: passes test 2 : bname<'.bname.'>=~^'.dirname.'/\=$') - break - endif - if dirname =~ '^'.bname.'/$' -" call Decho(' findbuf3c: passes test 3 : dirname<'.dirname.'>=~^'.bname.'/$') - break - endif - if bname != '' && dirname =~ '/'.bname.'$' && bname == bufname("%") && line("$") == 1 -" call Decho(' findbuf3d: passes test 4 : dirname<'.dirname.'>=~ /'.bname.'$') - break - endif - let ibuf= ibuf + 1 - endwhile - if ibuf > buflast - let bufnum= -1 - else - let bufnum= ibuf - endif -" call Decho(" findbuf4: bufnum=".bufnum." (ibuf=".ibuf." buflast=".buflast.")") + if s:didstarstar || !mapcheck("","n") + nnoremap :Pexplore + inoremap :Pexplore endif - endif - - " get enew buffer and name it -or- re-use buffer {{{3 - sil! keepj mark ' - if bufnum < 0 || !bufexists(bufnum) -" call Decho("--get enew buffer and name it (bufexists([bufnum=".bufnum."])=".bufexists(bufnum).")") - call s:NetrwEnew(dirname) -" call Decho(" got enew buffer#".bufnr("%")." (altbuf<".expand("#").">)") - " name the buffer - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST - " Got enew buffer; transform into a NetrwTreeListing -" call Decho("--transform enew buffer#".bufnr("%")." into a NetrwTreeListing --") - if !exists("s:netrw_treelistnum") - let s:netrw_treelistnum= 1 - else - let s:netrw_treelistnum= s:netrw_treelistnum + 1 - endif - let w:netrw_treebufnr= bufnr("%") -" call Decho(" exe sil! keepalt file NetrwTreeListing ".fnameescape(s:netrw_treelistnum)) - exe 'sil! keepalt file NetrwTreeListing\ '.fnameescape(s:netrw_treelistnum) - set bt=nofile noswf - nnoremap [ :silent call TreeListMove('[') - nnoremap ] :silent call TreeListMove(']') - nnoremap [[ :silent call TreeListMove('[') - nnoremap ]] :silent call TreeListMove(']') -" call Decho(" tree listing#".s:netrw_treelistnum." bufnr=".w:netrw_treebufnr) - else -" let v:errmsg= "" " Decho - let escdirname= fnameescape(dirname) -" call Decho(" errmsg<".v:errmsg."> bufnr(escdirname<".escdirname.">)=".bufnr(escdirname)." bufname()<".bufname(bufnr(escdirname)).">") -" call Decho(' exe sil! keepalt file '.escdirname) -" let v:errmsg= "" " Decho - exe 'sil! keepalt file '.escdirname -" call Decho(" errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">") + let mapsafecurdir = escape(b:netrw_curdir, s:netrw_map_escape) + if g:netrw_mousemaps == 1 + nmap NetrwLeftmouse + nno NetrwLeftmouse :call NetrwLeftmouse(1) + nmap NetrwRightdrag + nno NetrwRightdrag :call NetrwRightdrag(1) + nmap NetrwMiddlemouse + nno NetrwMiddlemouse :call NetrwPrevWinOpen(1) + nmap NetrwSLeftmouse + nno NetrwSLeftmouse :call NetrwMarkFile(1,NetrwGetWord()) + nmap <2-leftmouse> Netrw2Leftmouse + nmap Netrw2Leftmouse - + imap ILeftmouse + ino ILeftmouse :call NetrwLeftmouse(1) + imap IMiddlemouse + ino IMiddlemouse :call NetrwPrevWinOpen(1) + imap ISLeftmouse + ino ISLeftmouse :call NetrwMarkFile(1,NetrwGetWord()) + exe 'nnoremap :call NetrwLocalRm("'.mapsafecurdir.'")' + exe 'vnoremap :call NetrwLocalRm("'.mapsafecurdir.'")' + exe 'inoremap :call NetrwLocalRm("'.mapsafecurdir.'")' endif -" call Decho(" named enew buffer#".bufnr("%")."<".bufname("%").">") + exe 'nnoremap :call NetrwLocalRm("'.mapsafecurdir.'")' + exe 'nnoremap D :call NetrwLocalRm("'.mapsafecurdir.'")' + exe 'nnoremap R :call NetrwLocalRename("'.mapsafecurdir.'")' + exe 'nnoremap m :call NetrwMakeDir("")' + exe 'vnoremap :call NetrwLocalRm("'.mapsafecurdir.'")' + exe 'vnoremap D :call NetrwLocalRm("'.mapsafecurdir.'")' + exe 'vnoremap R :call NetrwLocalRename("'.mapsafecurdir.'")' + exe 'inoremap :call NetrwLocalRm("'.mapsafecurdir.'")' + exe 'inoremap D :call NetrwLocalRm("'.mapsafecurdir.'")' + exe 'inoremap R :call NetrwLocalRename("'.mapsafecurdir.'")' + exe 'inoremap m :call NetrwMakeDir("")' + nnoremap :he netrw-quickhelp - else " Re-use the buffer -" call Decho("--re-use buffer#".bufnum." (bufexists([bufnum=".bufnum."])=".bufexists(bufnum).")") - let eikeep= &ei - set ei=all - if getline(2) =~ '^" Netrw Directory Listing' -" call Decho(" re-use buffer#".bufnum."<".((bufnum > 0)? bufname(bufnum) : "")."> using: keepalt b ".bufnum) - exe "sil! keepalt b ".bufnum - else -" call Decho(" reusing buffer#".bufnum."<".((bufnum > 0)? bufname(bufnum) : "")."> using: b ".bufnum) - exe "sil! b ".bufnum - endif - if bufname("%") == '.' -" call Decho("exe sil! keepalt file ".fnameescape(getcwd())) - exe "sil! keepalt file ".fnameescape(getcwd()) + else " remote +" call Decho("(NetrwMaps) make remote maps") + call s:RemotePathAnalysis(b:netrw_curdir) + " remote normal-mode maps + nnoremap :call NetrwBrowse(0,NetrwBrowseChgDir(0,NetrwGetWord())) + nnoremap :call NetrwRefresh(0,NetrwBrowseChgDir(0,'./')) + nnoremap - :exe "norm! 0"call NetrwBrowse(0,NetrwBrowseChgDir(0,'../')) + nnoremap a :call NetrwHide(0) + nnoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) + nnoremap mc :call NetrwMarkFileCopy(0) + nnoremap md :call NetrwMarkFileDiff(0) + nnoremap me :call NetrwMarkFileEdit(0) + nnoremap mf :call NetrwMarkFile(0,NetrwGetWord()) + nnoremap mF :call NetrwUnmarkList(bufnr("%"),b:netrw_curdir) + nnoremap mg :call NetrwMarkFileGrep(0) + nnoremap mh :call NetrwMarkHideSfx(0) + nnoremap mm :call NetrwMarkFileMove(0) + nnoremap mp :call NetrwMarkFilePrint(0) + nnoremap mr :call NetrwMarkFileRegexp(0) + nnoremap ms :call NetrwMarkFileSource(0) + nnoremap mt :call NetrwMarkFileTgt(0) + nnoremap mT :call NetrwMarkFileTag(0) + nnoremap mu :call NetrwUnMarkFile(0) + nnoremap mx :call NetrwMarkFileExe(0) + nnoremap mX :call NetrwMarkFileVimCmd(0) + nnoremap mz :call NetrwMarkFileCompress(0) + nnoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) + nnoremap gd :call NetrwForceChgDir(0,NetrwGetWord()) + nnoremap gf :call NetrwForceFile(0,NetrwGetWord()) + nnoremap gh :call NetrwHidden(0) + nnoremap gp :call NetrwChgPerm(0,b:netrw_curdir) + nnoremap C :let g:netrw_chgwin= winnr() + nnoremap i :call NetrwListStyle(0) + nnoremap I :call NetrwBannerCtrl(1) + nnoremap o :call NetrwSplit(0) + nnoremap O :call NetrwObtain(0) + nnoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) + nnoremap P :call NetrwPrevWinOpen(0) + nnoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) + nnoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) + nnoremap qf :call NetrwFileInfo(0,NetrwGetWord()) + nnoremap qF :call NetrwMarkFileQFEL(0,getqflist()) + nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwBrowse(0,NetrwBrowseChgDir(0,'./')) + nnoremap s :call NetrwSortStyle(0) + nnoremap S :call NetSortSequence(0) + nnoremap t :call NetrwSplit(1) + nnoremap Tb :call NetrwSetTgt('b',v:count1) + nnoremap Th :call NetrwSetTgt('h',v:count) + nnoremap u :call NetrwBookHistHandler(4,b:netrw_curdir) + nnoremap U :call NetrwBookHistHandler(5,b:netrw_curdir) + nnoremap v :call NetrwSplit(2) + nnoremap x :call netrw#NetrwBrowseX(NetrwBrowseChgDir(0,NetrwGetWord()),1) + nnoremap % :call NetrwOpenFile(0) + " remote insert-mode maps + inoremap :call NetrwBrowse(0,NetrwBrowseChgDir(0,NetrwGetWord())) + inoremap :call NetrwRefresh(0,NetrwBrowseChgDir(0,'./')) + inoremap - :exe "norm! 0"call NetrwBrowse(0,NetrwBrowseChgDir(0,'../')) + inoremap a :call NetrwHide(0) + inoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) + inoremap mc :call NetrwMarkFileCopy(0) + inoremap md :call NetrwMarkFileDiff(0) + inoremap me :call NetrwMarkFileEdit(0) + inoremap mf :call NetrwMarkFile(0,NetrwGetWord()) + inoremap mg :call NetrwMarkFileGrep(0) + inoremap mh :call NetrwMarkHideSfx(0) + inoremap mm :call NetrwMarkFileMove(0) + inoremap mp :call NetrwMarkFilePrint(0) + inoremap mr :call NetrwMarkFileRegexp(0) + inoremap ms :call NetrwMarkFileSource(0) + inoremap mt :call NetrwMarkFileTgt(0) + inoremap mT :call NetrwMarkFileTag(0) + inoremap mu :call NetrwUnMarkFile(0) + inoremap mx :call NetrwMarkFileExe(0) + inoremap mX :call NetrwMarkFileVimCmd(0) + inoremap mz :call NetrwMarkFileCompress(0) + inoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) + inoremap gh :call NetrwHidden(0) + inoremap gp :call NetrwChgPerm(0,b:netrw_curdir) + inoremap C :let g:netrw_chgwin= winnr() + inoremap i :call NetrwListStyle(0) + inoremap I :call NetrwBannerCtrl(1) + inoremap o :call NetrwSplit(0) + inoremap O :call NetrwObtain(0) + inoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) + inoremap P :call NetrwPrevWinOpen(0) + inoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) + inoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) + inoremap qf :call NetrwFileInfo(0,NetrwGetWord()) + inoremap qF :call NetrwMarkFileQFEL(0,getqflist()) + inoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwBrowse(0,NetrwBrowseChgDir(0,'./')) + inoremap s :call NetrwSortStyle(0) + inoremap S :call NetSortSequence(0) + inoremap t :call NetrwSplit(1) + inoremap Tb :call NetrwSetTgt('b',v:count1) + inoremap Th :call NetrwSetTgt('h',v:count) + inoremap u :call NetrwBookHistHandler(4,b:netrw_curdir) + inoremap U :call NetrwBookHistHandler(5,b:netrw_curdir) + inoremap v :call NetrwSplit(2) + inoremap x :call netrw#NetrwBrowseX(NetrwBrowseChgDir(0,NetrwGetWord()),1) + inoremap % :call NetrwOpenFile(0) + if !hasmapto('NetrwHideEdit') + nmap NetrwHideEdit + imap NetrwHideEdit endif - let &ei= eikeep - if line("$") <= 1 - call s:NetrwListSettings(a:islocal) -" call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but its empty, so refresh it") - return 0 - elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST -" call Decho("--re-use tree listing--") -" call Decho(" clear buffer<".expand("%")."> with :%d") - sil keepj %d - call s:NetrwListSettings(a:islocal) -" call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but treelist mode always needs a refresh") - return 0 - else -" call Dret("s:NetrwGetBuffer 1 : buf#".bufnr("%")) - return 1 + nnoremap NetrwHideEdit :call NetrwHideEdit(0) + if !hasmapto('NetrwRefresh') + nmap NetrwRefresh + imap NetrwRefresh endif - endif - - " do netrw settings: make this buffer not-a-file, modifiable, not line-numbered, etc {{{3 - " fastbrowse Local Remote Hiding a buffer implies it may be re-used (fast) - " slow 0 D D Deleting a buffer implies it will not be re-used (slow) - " med 1 D H - " fast 2 H H -" call Decho("--do netrw settings: make this buffer#".bufnr("%")." not-a-file, modifiable, not line-numbered, etc--") - let fname= expand("%") - call s:NetrwListSettings(a:islocal) -" call Decho("exe sil! keepalt file ".fnameescape(fname)) - exe "sil! keepalt file ".fnameescape(fname) - - " delete all lines from buffer {{{3 -" call Decho("--delete all lines from buffer--") -" call Decho(" clear buffer<".expand("%")."> with :%d") - sil! keepalt keepj %d - -" call Dret("s:NetrwGetBuffer 0 : buf#".bufnr("%")) - return 0 -endfun - -" --------------------------------------------------------------------- -" s:NetrwGetcwd: get the current directory. {{{2 -" Change backslashes to forward slashes, if any. -" If doesc is true, escape certain troublesome characters -fun! s:NetrwGetcwd(doesc) -" call Dfunc("NetrwGetcwd(doesc=".a:doesc.")") - let curdir= substitute(getcwd(),'\\','/','ge') - if curdir !~ '[\/]$' - let curdir= curdir.'/' - endif - if a:doesc - let curdir= fnameescape(curdir) - endif -" call Dret("NetrwGetcwd <".curdir.">") - return curdir -endfun -" --------------------------------------------------------------------- -" s:NetrwGetWord: it gets the directory/file named under the cursor {{{2 -fun! s:NetrwGetWord() -" call Dfunc("s:NetrwGetWord() line#".line(".")." liststyle=".g:netrw_liststyle." virtcol=".virtcol(".")) - call s:UseBufWinVars() + let mapsafepath = escape(s:path, s:netrw_map_escape) + let mapsafeusermach = escape(s:user.s:machine, s:netrw_map_escape) - " insure that w:netrw_liststyle is set up - if !exists("w:netrw_liststyle") - if exists("g:netrw_liststyle") - let w:netrw_liststyle= g:netrw_liststyle - else - let w:netrw_liststyle= s:THINLIST + nnoremap NetrwRefresh :call NetrwRefresh(0,NetrwBrowseChgDir(0,'./')) + if g:netrw_mousemaps == 1 + nmap NetrwLeftmouse + nno NetrwLeftmouse :call NetrwLeftmouse(0) + nmap NetrwLeftdrag + nno NetrwLeftdrag :call NetrwLeftdrag(0) + nmap NetrwMiddlemouse + nno NetrwMiddlemouse :call NetrwPrevWinOpen(0) + nmap NetrwSLeftmouse + nno NetrwSLeftmouse :call NetrwMarkFile(0,NetrwGetWord()) + nmap <2-leftmouse> Netrw2Leftmouse + nmap Netrw2Leftmouse - + imap ILeftmouse + ino ILeftmouse :call NetrwLeftmouse(0) + imap IMiddlemouse + ino IMiddlemouse :call NetrwPrevWinOpen(0) + imap ISLeftmouse + ino ISLeftmouse :call NetrwMarkFile(0,NetrwGetWord()) + exe 'nnoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' + exe 'vnoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' + exe 'inoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' endif -" call Decho("w:netrw_liststyle=".w:netrw_liststyle) + exe 'nnoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' + exe 'nnoremap d :call NetrwMakeDir("'.mapsafeusermach.'")' + exe 'nnoremap D :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' + exe 'nnoremap R :call NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")' + exe 'vnoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' + exe 'vnoremap D :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' + exe 'vnoremap R :call NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")' + exe 'inoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' + exe 'inoremap d :call NetrwMakeDir("'.mapsafeusermach.'")' + exe 'inoremap D :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' + exe 'inoremap R :call NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")' + nnoremap :he netrw-quickhelp + inoremap :he netrw-quickhelp endif - if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt - " Active Banner support -" call Decho("active banner handling") - keepj norm! 0 - let dirname= "./" - let curline= getline('.') - - if curline =~ '"\s*Sorted by\s' - keepj norm s - let s:netrw_skipbrowse= 1 - echo 'Pressing "s" also works' + keepj call s:SetRexDir(a:islocal,b:netrw_curdir) - elseif curline =~ '"\s*Sort sequence:' - let s:netrw_skipbrowse= 1 - echo 'Press "S" to edit sorting sequence' +" call Dret("s:NetrwMaps") +endfun - elseif curline =~ '"\s*Quick Help:' - keepj norm ? - let s:netrw_skipbrowse= 1 - echo 'Pressing "?" also works' +" --------------------------------------------------------------------- +" s:ExplorePatHls: converts an Explore pattern into a regular expression search pattern {{{2 +fun! s:ExplorePatHls(pattern) +" call Dfunc("s:ExplorePatHls(pattern<".a:pattern.">)") + let repat= substitute(a:pattern,'^**/\{1,2}','','') +" call Decho("repat<".repat.">") + let repat= escape(repat,'][.\') +" call Decho("repat<".repat.">") + let repat= '\<'.substitute(repat,'\*','\\(\\S\\+ \\)*\\S\\+','g').'\>' +" call Dret("s:ExplorePatHls repat<".repat.">") + return repat +endfun - elseif curline =~ '"\s*\%(Hiding\|Showing\):' - keepj norm a - let s:netrw_skipbrowse= 1 - echo 'Pressing "a" also works' +" --------------------------------------------------------------------- +" s:NetrwBookHistHandler: {{{2 +" 0: (user: ) bookmark current directory +" 1: (user: ) change to the bookmarked directory +" 2: (user: ) list bookmarks +" 3: (browsing) record current directory history +" 4: (user: ) go up (previous) bookmark +" 5: (user: ) go down (next) bookmark +" 6: (user: ) delete bookmark +fun! s:NetrwBookHistHandler(chg,curdir) +" call Dfunc("s:NetrwBookHistHandler(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count." histcnt=".g:netrw_dirhist_cnt." histmax=".g:netrw_dirhistmax) + if !exists("g:netrw_dirhistmax") || g:netrw_dirhistmax <= 0 +" " call Dret("s:NetrwBookHistHandler - suppressed due to g:netrw_dirhistmax") + return + endif - elseif line("$") > w:netrw_bannercnt - exe 'sil keepj '.w:netrw_bannercnt + let ykeep= @@ + if a:chg == 0 + " bookmark the current directory +" call Decho("(user: ) bookmark the current directory") + if !exists("g:netrw_bookmarklist") + let g:netrw_bookmarklist= [] endif + if index(g:netrw_bookmarklist,a:curdir) == -1 + " curdir not currently in g:netrw_bookmarklist, so include it + call add(g:netrw_bookmarklist,a:curdir) + call sort(g:netrw_bookmarklist) + endif + echo "bookmarked the current directory" - elseif w:netrw_liststyle == s:THINLIST -" call Decho("thin column handling") - keepj norm! 0 - let dirname= getline('.') - - elseif w:netrw_liststyle == s:LONGLIST -" call Decho("long column handling") - keepj norm! 0 - let dirname= substitute(getline('.'),'^\(\%(\S\+ \)*\S\+\).\{-}$','\1','e') + elseif a:chg == 1 + " change to the bookmarked directory +" call Decho("(user: <".v:count."gb>) change to the bookmarked directory") + if exists("g:netrw_bookmarklist[v:count-1]") +" call Decho("(user: <".v:count."gb>) bookmarklist=".string(g:netrw_bookmarklist)) + exe "keepj e ".fnameescape(g:netrw_bookmarklist[v:count-1]) + else + echomsg "Sorry, bookmark#".v:count." doesn't exist!" + endif - elseif w:netrw_liststyle == s:TREELIST -" call Decho("treelist handling") - let dirname= substitute(getline('.'),'^\(| \)*','','e') + elseif a:chg == 2 +" redraw! + let didwork= 0 + " list user's bookmarks +" call Decho("(user: ) list user's bookmarks") + if exists("g:netrw_bookmarklist") +" call Decho('list '.len(g:netrw_bookmarklist).' bookmarks') + let cnt= 1 + for bmd in g:netrw_bookmarklist +" call Decho("Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1]) + echo printf("Netrw Bookmark#%-2d: %s",cnt,g:netrw_bookmarklist[cnt-1]) + let didwork = 1 + let cnt = cnt + 1 + endfor + endif - else -" call Decho("obtain word from wide listing") - let dirname= getline('.') + " list directory history + let cnt = g:netrw_dirhist_cnt + let first = 1 + let histcnt = 0 + if g:netrw_dirhistmax > 0 + while ( first || cnt != g:netrw_dirhist_cnt ) +" call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:netrw_dirhist_cnt) + if exists("g:netrw_dirhist_{cnt}") +" call Decho("Netrw History#".histcnt.": ".g:netrw_dirhist_{cnt}) + echo printf("Netrw History#%-2d: %s",histcnt,g:netrw_dirhist_{cnt}) + let didwork= 1 + endif + let histcnt = histcnt + 1 + let first = 0 + let cnt = ( cnt - 1 ) % g:netrw_dirhistmax + if cnt < 0 + let cnt= cnt + g:netrw_dirhistmax + endif + endwhile + else + let g:netrw_dirhist_cnt= 0 + endif + if didwork + call inputsave()|call input("Press to continue")|call inputrestore() + endif - if !exists("b:netrw_cpf") - let b:netrw_cpf= 0 - exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' - call histdel("/",-1) -" call Decho("computed cpf=".b:netrw_cpf) + elseif a:chg == 3 + " saves most recently visited directories (when they differ) +" call Decho("(browsing) record curdir history") + if !exists("g:netrw_dirhist_cnt") || !exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") || g:netrw_dirhist_{g:netrw_dirhist_cnt} != a:curdir + if g:netrw_dirhistmax > 0 + let g:netrw_dirhist_cnt = ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax + let g:netrw_dirhist_{g:netrw_dirhist_cnt} = a:curdir + endif +" call Decho("save dirhist#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">") endif -" call Decho("buf#".bufnr("%")."<".bufname("%").">") - let filestart = (virtcol(".")/b:netrw_cpf)*b:netrw_cpf -" call Decho("filestart= ([virtcol=".virtcol(".")."]/[b:netrw_cpf=".b:netrw_cpf."])*b:netrw_cpf=".filestart." bannercnt=".w:netrw_bannercnt) -" call Decho("1: dirname<".dirname.">") - if filestart == 0 - keepj norm! 0ma + elseif a:chg == 4 + " u: change to the previous directory stored on the history list +" call Decho("(user: ) chg to prev dir from history") + if g:netrw_dirhistmax > 0 + let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - v:count1 ) % g:netrw_dirhistmax + if g:netrw_dirhist_cnt < 0 + let g:netrw_dirhist_cnt= g:netrw_dirhist_cnt + g:netrw_dirhistmax + endif else - call cursor(line("."),filestart+1) - keepj norm! ma + let g:netrw_dirhist_cnt= 0 endif - let rega= @a - let eofname= filestart + b:netrw_cpf + 1 - if eofname <= col("$") - call cursor(line("."),filestart+b:netrw_cpf+1) - keepj norm! "ay`a + if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") +" call Decho("changedir u#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">") + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") + setl ma noro +" call Decho("(NetrwBookHistHandler) setl ma noro") + sil! keepj %d + setl nomod +" call Decho("(NetrwBookHistHandler) setl nomod") +" call Decho("(NetrwBookHistHandler) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") + endif +" " call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt})) + exe "keepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) else - keepj norm! "ay$ + if g:netrw_dirhistmax > 0 + let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt + v:count1 ) % g:netrw_dirhistmax + else + let g:netrw_dirhist_cnt= 0 + endif + echo "Sorry, no predecessor directory exists yet" endif - let dirname = @a - let @a = rega -" call Decho("2: dirname<".dirname.">") - let dirname= substitute(dirname,'\s\+$','','e') -" call Decho("3: dirname<".dirname.">") - endif - - " symlinks are indicated by a trailing "@". Remove it before further processing. - let dirname= substitute(dirname,"@$","","") - - " executables are indicated by a trailing "*". Remove it before further processing. - let dirname= substitute(dirname,"\*$","","") -" call Dret("s:NetrwGetWord <".dirname.">") - return dirname -endfun + elseif a:chg == 5 + " U: change to the subsequent directory stored on the history list +" call Decho("(user: ) chg to next dir from history") + if g:netrw_dirhistmax > 0 + let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax + if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") +" call Decho("changedir U#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">") + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") +" call Decho("(NetrwBookHistHandler) setl ma noro") + setl ma noro + sil! keepj %d +" call Decho("removed all lines from buffer (%d)") +" call Decho("(NetrwBookHistHandler) setl nomod") + setl nomod +" call Decho("(set nomod) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") + endif +" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt})) + exe "keepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) + else + let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - 1 ) % g:netrw_dirhistmax + if g:netrw_dirhist_cnt < 0 + let g:netrw_dirhist_cnt= g:netrw_dirhist_cnt + g:netrw_dirhistmax + endif + echo "Sorry, no successor directory exists yet" + endif + else + let g:netrw_dirhist_cnt= 0 + echo "Sorry, no successor directory exists yet (g:netrw_dirhistmax is ".g:netrw_dirhistmax.")" + endif -" --------------------------------------------------------------------- -" s:NetrwListSettings: make standard settings for a netrw listing {{{2 -fun! s:NetrwListSettings(islocal) -" call Dfunc("s:NetrwListSettings(islocal=".a:islocal.")") - let fname= bufname("%") -" call Decho("setlocal bt=nofile nobl ma nonu nowrap noro") - setlocal bt=nofile nobl ma nonu nowrap noro -" call Decho("exe sil! keepalt file ".fnameescape(fname)) - exe "sil! keepalt file ".fnameescape(fname) - if g:netrw_use_noswf - setlocal noswf - endif -" call Dredir("ls!") -" call Decho("exe setlocal ts=".g:netrw_maxfilenamelen) - exe "setlocal ts=".g:netrw_maxfilenamelen - setlocal isk+=.,~,- - if g:netrw_fastbrowse > a:islocal - setlocal bh=hide - else - setlocal bh=delete + elseif a:chg == 6 + " delete the v:count'th bookmark +" call Decho("delete bookmark#".v:count."<".g:netrw_bookmarklist[v:count-1].">") + let savefile= s:NetrwHome()."/.netrwbook" + if filereadable(savefile) +" call Decho("merge bookmarks (active and file)") + keepj call s:NetrwBookHistSave() " done here to merge bookmarks first +" call Decho("bookmark delete savefile<".savefile.">") + keepj call delete(savefile) + endif +" call Decho("remove g:netrw_bookmarklist[".(v:count-1)."]") + keepj call remove(g:netrw_bookmarklist,v:count-1) +" call Decho("resulting g:netrw_bookmarklist=".string(g:netrw_bookmarklist)) endif -" call Dret("s:NetrwListSettings") + call s:NetrwBookmarkMenu() + call s:NetrwTgtMenu() + let @@= ykeep +" call Dret("s:NetrwBookHistHandler") endfun " --------------------------------------------------------------------- -" s:NetrwListStyle: {{{2 -" islocal=0: remote browsing -" =1: local browsing -fun! s:NetrwListStyle(islocal) -" call Dfunc("NetrwListStyle(islocal=".a:islocal.") w:netrw_liststyle=".w:netrw_liststyle) - let fname = s:NetrwGetWord() - if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif - let w:netrw_liststyle = (w:netrw_liststyle + 1) % s:MAXLIST -" call Decho("fname<".fname.">") -" call Decho("chgd w:netrw_liststyle to ".w:netrw_liststyle) -" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">") - - if w:netrw_liststyle == s:THINLIST - " use one column listing -" call Decho("use one column list") - let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') - - elseif w:netrw_liststyle == s:LONGLIST - " use long list -" call Decho("use long list") - let g:netrw_list_cmd = g:netrw_list_cmd." -l" +" s:NetrwBookHistRead: this function reads bookmarks and history {{{2 +" Sister function: s:NetrwBookHistSave() +fun! s:NetrwBookHistRead() +" call Dfunc("s:NetrwBookHistRead()") + if !exists("g:netrw_dirhistmax") || g:netrw_dirhistmax <= 0 +" " call Dret("s:NetrwBookHistRead - suppressed due to g:netrw_dirhistmax") + return + endif + let ykeep= @@ + if !exists("s:netrw_initbookhist") + let home = s:NetrwHome() + let savefile= home."/.netrwbook" + if filereadable(savefile) +" call Decho("sourcing .netrwbook") + exe "keepalt keepj so ".savefile + endif + if g:netrw_dirhistmax > 0 + let savefile= home."/.netrwhist" + if filereadable(savefile) +" call Decho("sourcing .netrwhist") + exe "keepalt keepj so ".savefile + endif + let s:netrw_initbookhist= 1 + au VimLeave * call s:NetrwBookHistSave() + endif + endif + let @@= ykeep +" call Dret("s:NetrwBookHistRead") +endfun - elseif w:netrw_liststyle == s:WIDELIST - " give wide list -" call Decho("use wide list") - let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') +" --------------------------------------------------------------------- +" s:NetrwBookHistSave: this function saves bookmarks and history {{{2 +" Sister function: s:NetrwBookHistRead() +" I used to do this via viminfo but that appears to +" be unreliable for long-term storage +fun! s:NetrwBookHistSave() +" call Dfunc("s:NetrwBookHistSave() dirhistmax=".g:netrw_dirhistmax) + if !exists("g:netrw_dirhistmax") || g:netrw_dirhistmax <= 0 +" call Dret("s:NetrwBookHistSave : dirhistmax=".g:netrw_dirhistmax) + return + endif - elseif w:netrw_liststyle == s:TREELIST -" call Decho("use tree list") - let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') + let savefile= s:NetrwHome()."/.netrwhist" + 1split + call s:NetrwEnew() + setl cino= com= cpo-=a cpo-=A fo=nroql2 tw=0 report=10000 noswf + setl nocin noai noci magic nospell nohid wig= noaw + setl ma noro write + if exists("+acd") | setl noacd | endif + sil! keepj keepalt %d - else - call netrw#ErrorMsg(s:WARNING,"bad value for g:netrw_liststyle (=".w:netrw_liststyle.")",46) - let g:netrw_liststyle = s:THINLIST - let w:netrw_liststyle = g:netrw_liststyle - let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') - endif - setlocal ma noro -" call Decho("setlocal ma noro") + " save .netrwhist -- no attempt to merge + sil! keepalt file .netrwhist + call setline(1,"let g:netrw_dirhistmax =".g:netrw_dirhistmax) + call setline(2,"let g:netrw_dirhist_cnt =".g:netrw_dirhist_cnt) + let lastline = line("$") + let cnt = 1 + while cnt <= g:netrw_dirhist_cnt + call setline((cnt+lastline),'let g:netrw_dirhist_'.cnt."='".g:netrw_dirhist_{cnt}."'") + let cnt= cnt + 1 + endwhile + exe "sil! w! ".savefile - " clear buffer - this will cause NetrwBrowse/LocalBrowseCheck to do a refresh -" call Decho("clear buffer<".expand("%")."> with :%d") - sil! keepj %d - " following prevents tree listing buffer from being marked "modified" - setlocal nomod + sil keepj %d + if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] + " merge and write .netrwbook + let savefile= s:NetrwHome()."/.netrwbook" - " refresh the listing -" call Decho("refresh the listing") - let svpos= netrw#NetrwSavePosn() - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - call netrw#NetrwRestorePosn(svpos) - call s:NetrwCursorline() + if filereadable(savefile) + let booklist= deepcopy(g:netrw_bookmarklist) + exe "sil keepj keepalt so ".savefile + for bdm in booklist + if index(g:netrw_bookmarklist,bdm) == -1 + call add(g:netrw_bookmarklist,bdm) + endif + endfor + call sort(g:netrw_bookmarklist) + exe "sil! w! ".savefile + endif - " keep cursor on the filename - sil! keepj $ - let result= search('\%(^\%(|\+\s\)\=\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bc') -" call Decho("search result=".result." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'N/A')) - if result <= 0 && exists("w:netrw_bannercnt") - exe "sil! keepj ".w:netrw_bannercnt + " construct and save .netrwbook + call setline(1,"let g:netrw_bookmarklist= ".string(g:netrw_bookmarklist)) + exe "sil! w! ".savefile endif + let bgone= bufnr("%") + q! + exe "keepalt ".bgone."bwipe!" -" call Dret("NetrwListStyle".(exists("w:netrw_liststyle")? ' : w:netrw_liststyle='.w:netrw_liststyle : "")) +" call Dret("s:NetrwBookHistSave") endfun " --------------------------------------------------------------------- -" s:NetrwBannerCtrl: toggles the display of the banner {{{2 -fun! s:NetrwBannerCtrl(islocal) -" call Dfunc("s:NetrwBannerCtrl(islocal=".a:islocal.") g:netrw_banner=".g:netrw_banner) - - " toggle the banner (enable/suppress) - let g:netrw_banner= !g:netrw_banner +" s:NetrwBrowse: This function uses the command in g:netrw_list_cmd to provide a {{{2 +" list of the contents of a local or remote directory. It is assumed that the +" g:netrw_list_cmd has a string, USEPORT HOSTNAME, that needs to be substituted +" with the requested remote hostname first. +fun! s:NetrwBrowse(islocal,dirname) + if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif +" call Dfunc("s:NetrwBrowse(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".w:netrw_liststyle." ".g:loaded_netrw." buf#".bufnr("%")."<".bufname("%")."> win#".winnr()) +" call Decho("(NetrwBrowse) tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")." modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) + " s:NetrwBrowse: initialize history {{{3 + if !exists("s:netrw_initbookhist") + keepj call s:NetrwBookHistRead() + endif - " refresh the listing - let svpos= netrw#NetrwSavePosn() - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + " s:NetrwBrowse: simplify the dirname (especially for ".."s in dirnames) {{{3 + if a:dirname !~ '^\a\+://' + let dirname= simplify(a:dirname) + else + let dirname= a:dirname + endif - " keep cursor on the filename - let fname= s:NetrwGetWord() - sil keepj $ - let result= search('\%(^\%(|\+\s\)\=\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bc') -" call Decho("search result=".result." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'N/A')) - if result <= 0 && exists("w:netrw_bannercnt") - exe "keepj ".w:netrw_bannercnt + if exists("s:netrw_skipbrowse") + unlet s:netrw_skipbrowse +" call Decho("(NetrwBrowse) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Dret("s:NetrwBrowse : s:netrw_skipbrowse=".s:netrw_skipbrowse) + return endif -" call Dret("s:NetrwBannerCtrl : g:netrw_banner=".g:netrw_banner) -endfun -" --------------------------------------------------------------------- -" s:NetrwBookmarkMenu: Uses menu priorities {{{2 -" .2.[cnt] for bookmarks, and -" .3.[cnt] for history -" (see s:NetrwMenu()) -fun! s:NetrwBookmarkMenu() - if !exists("s:netrw_menucnt") + " s:NetrwBrowse: sanity checks: {{{3 + if !exists("*shellescape") + keepj call netrw#ErrorMsg(s:ERROR,"netrw can't run -- your vim is missing shellescape()",69) +" call Dret("s:NetrwBrowse : missing shellescape()") + return + endif + if !exists("*fnameescape") + keepj call netrw#ErrorMsg(s:ERROR,"netrw can't run -- your vim is missing fnameescape()",70) +" call Dret("s:NetrwBrowse : missing fnameescape()") return endif -" call Dfunc("NetrwBookmarkMenu() histcnt=".g:netrw_dirhist_cnt." menucnt=".s:netrw_menucnt) - " the following test assures that gvim is running, has menus available, and has menus enabled. - if has("gui") && has("menu") && has("gui_running") && &go =~ 'm' && g:netrw_menu - if exists("g:NetrwTopLvlMenu") -" call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)") - exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Bookmarks' - exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete' - endif - if !exists("s:netrw_initbookhist") - call s:NetrwBookHistRead() - endif + " s:NetrwBrowse: save options: {{{3 + call s:NetrwOptionSave("w:") - " show bookmarked places - if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] - let cnt= 1 - for bmd in g:netrw_bookmarklist -" call Decho('silent! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmark.'.bmd.' :e '.bmd) - let bmd= escape(bmd,g:netrw_menu_escape) + " s:NetrwBrowse: re-instate any marked files {{{3 + if exists("s:netrwmarkfilelist_{bufnr('%')}") +" call Decho("(NetrwBrowse) clearing marked files") + exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" + endif - " show bookmarks for goto menu - exe 'sil! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks.'.bmd.' :e '.bmd."\" + if a:islocal && exists("w:netrw_acdkeep") && w:netrw_acdkeep + " s:NetrwBrowse: set up "safe" options for local directory/file {{{3 +" call Decho("(NetrwBrowse) handle w:netrw_acdkeep:") +" call Decho("(NetrwBrowse) keepjumps lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")") + exe 'keepj lcd '.fnameescape(dirname) + call s:NetrwSafeOptions() +" call Decho("(NetrwBrowse) getcwd<".getcwd().">") - " show bookmarks for deletion menu - exe 'sil! menu '.g:NetrwMenuPriority.".8.2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete.'.bmd.' '.cnt."mB" - let cnt= cnt + 1 - endfor + elseif !a:islocal && dirname !~ '[\/]$' && dirname !~ '^"' + " s:NetrwBrowse: looks like a remote regular file, attempt transfer {{{3 +" call Decho("(NetrwBrowse) attempt transfer as regular file<".dirname.">") + + " remove any filetype indicator from end of dirname, except for the + " "this is a directory" indicator (/). + " There shouldn't be one of those here, anyway. + let path= substitute(dirname,'[*=@|]\r\=$','','e') +" call Decho("(NetrwBrowse) new path<".path.">") + call s:RemotePathAnalysis(dirname) + " s:NetrwBrowse: remote-read the requested file into current buffer {{{3 + keepj mark ' + call s:NetrwEnew(dirname) + call s:NetrwSafeOptions() + setl ma noro +" call Decho("(NetrwBrowse) setl ma noro") + let b:netrw_curdir = dirname + let url = s:method."://".s:user.s:machine.(s:port ? ":".s:port : "")."/".s:path +" call Decho("(NetrwBrowse) exe sil! keepalt file ".fnameescape(url)." (bt=".&bt.")") + exe "sil! keepj keepalt file ".fnameescape(url) + exe "sil! keepj keepalt doau BufReadPre ".fnameescape(s:fname) + sil call netrw#NetRead(2,url) + if s:path !~ '.tar.bz2$' && s:path !~ '.tar.gz' && s:path !~ '.tar.xz' && s:path !~ '.txz' + " netrw.vim and tar.vim have already handled decompression of the tarball; avoiding gzip.vim error + exe "sil keepj keepalt doau BufReadPost ".fnameescape(s:fname) endif - " show directory browsing history - let cnt = g:netrw_dirhist_cnt - let first = 1 - let histcnt = 0 - while ( first || cnt != g:netrw_dirhist_cnt ) - let histcnt = histcnt + 1 - let priority = g:netrw_dirhist_cnt + histcnt - if exists("g:netrw_dirhist_{cnt}") - let histdir= escape(g:netrw_dirhist_{cnt},g:netrw_menu_escape) -" call Decho('silent! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir) - exe 'sil! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir."\" - endif - let first = 0 - let cnt = ( cnt - 1 ) % g:netrw_dirhistmax - if cnt < 0 - let cnt= cnt + g:netrw_dirhistmax - endif - endwhile + " s:NetrwBrowse: save certain window-oriented variables into buffer-oriented variables {{{3 + call s:SetBufWinVars() + call s:NetrwOptionRestore("w:") +" call Decho("(NetrwBrowse) setl ma nomod") + setl ma nomod +" call Decho("(NetrwBrowse) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Dret("s:NetrwBrowse : file<".s:fname.">") + return endif -" call Dret("NetrwBookmarkMenu") -endfun -" --------------------------------------------------------------------- -" s:NetrwBrowseChgDir: constructs a new directory based on the current {{{2 -" directory and a new directory name. Also, if the -" "new directory name" is actually a file, -" NetrwBrowseChgDir() edits the file. -fun! s:NetrwBrowseChgDir(islocal,newdir,...) -" call Dfunc("s:NetrwBrowseChgDir(islocal=".a:islocal."> newdir<".a:newdir.">) a:0=".a:0." curpos<".string(getpos("."))."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "").">") + " use buffer-oriented WinVars if buffer variables exist but associated window variables don't {{{3 + call s:UseBufWinVars() - if !exists("b:netrw_curdir") - " Don't try to change-directory: this can happen, for example, when netrw#ErrorMsg has been called - " and the current window is the NetrwMessage window. -" call Decho("(NetrwBrowseChgDir) b:netrw_curdir doesn't exist!") -" call Decho("getcwd<".getcwd().">") -" call Dredir("ls!") -" call Dret("s:NetrwBrowseChgDir") - return - endif + " set up some variables {{{3 + let b:netrw_browser_active = 1 + let dirname = dirname + let s:last_sort_by = g:netrw_sort_by - call s:NetrwOptionSave("s:") - call s:NetrwSafeOptions() - let nbcd_curpos = netrw#NetrwSavePosn() - let s:nbcd_curpos_{bufnr('%')} = nbcd_curpos - if (has("win32") || has("win95") || has("win64") || has("win16")) - let dirname = substitute(b:netrw_curdir,'\\','/','ge') - else - let dirname= b:netrw_curdir - endif - let newdir = a:newdir - let dolockout = 0 + " set up menu {{{3 + keepj call s:NetrwMenu(1) - " set up o/s-dependent directory recognition pattern - if has("amiga") - let dirpat= '[\/:]$' + " get/set-up buffer {{{3 + let reusing= s:NetrwGetBuffer(a:islocal,dirname) + " maintain markfile highlighting + if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != "" +" call Decho("(NetrwBrowse) bufnr(%)=".bufnr('%')) +" call Decho("(NetrwBrowse) exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/") + exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" else - let dirpat= '[\/]$' +" call Decho("(NetrwBrowse) 2match none") + 2match none endif -" call Decho("dirname<".dirname."> dirpat<".dirpat.">") - - if dirname !~ dirpat - " apparently vim is "recognizing" that it is in a directory and - " is removing the trailing "/". Bad idea, so I put it back. - let dirname= dirname.'/' -" call Decho("adjusting dirname<".dirname.">") + if reusing && line("$") > 1 + call s:NetrwOptionRestore("w:") +" call Decho("(NetrwBrowse) setl noma nomod nowrap") + setl noma nomod nowrap +" call Decho("(NetrwBrowse) (set noma nomod nowrap) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Dret("s:NetrwBrowse : re-using buffer") + return endif - if newdir !~ dirpat - " ------------ - " edit a file: - " ------------ -" call Decho('case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">") - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") && newdir !~ '^\(/\|\a:\)' - let dirname= s:NetrwTreeDir() - if dirname =~ '/$' - let dirname= dirname.newdir - else - let dirname= s:NetrwTreeDir()."/".newdir - endif -" call Decho("dirname<".dirname.">") -" call Decho("tree listing") - elseif newdir =~ '^\(/\|\a:\)' - let dirname= newdir + " set b:netrw_curdir to the new directory name {{{3 +" call Decho("(NetrwBrowse) set b:netrw_curdir to the new directory name: (buf#".bufnr("%").")") + let b:netrw_curdir= dirname + if b:netrw_curdir =~ '[/\\]$' + let b:netrw_curdir= substitute(b:netrw_curdir,'[/\\]$','','e') + endif + if b:netrw_curdir == '' + if has("amiga") + " On the Amiga, the empty string connotes the current directory + let b:netrw_curdir= getcwd() else - let dirname= s:ComposePath(dirname,newdir) + " under unix, when the root directory is encountered, the result + " from the preceding substitute is an empty string. + let b:netrw_curdir= '/' endif -" call Decho("handling a file: dirname<".dirname."> (a:0=".a:0.")") - " this lets NetrwBrowseX avoid the edit - if a:0 < 1 -" call Decho("set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist")) - call s:NetrwOptionRestore("s:") - if !exists("s:didsplit") - if g:netrw_browse_split == 1 - new - if !&ea - wincmd _ - endif - elseif g:netrw_browse_split == 2 - rightb vert new - if !&ea - wincmd | - endif - elseif g:netrw_browse_split == 3 - tabnew - elseif g:netrw_browse_split == 4 - if s:NetrwPrevWinOpen(2) == 3 -" call Dret("s:NetrwBrowseChgDir") + endif + if !a:islocal && b:netrw_curdir !~ '/$' + let b:netrw_curdir= b:netrw_curdir.'/' + endif +" call Decho("(NetrwBrowse) b:netrw_curdir<".b:netrw_curdir.">") + + " ------------ + " (local only) {{{3 + " ------------ + if a:islocal +" call Decho("(NetrwBrowse) local only:") + + " Set up ShellCmdPost handling. Append current buffer to browselist + call s:LocalFastBrowser() + + " handle g:netrw_keepdir: set vim's current directory to netrw's notion of the current directory {{{3 + if !g:netrw_keepdir +" call Decho("(NetrwBrowse) handle g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) +" call Decho("(NetrwBrowse) l:acd".(exists("&l:acd")? "=".&l:acd : " doesn't exist")) + if !exists("&l:acd") || !&l:acd +" call Decho('exe keepjumps lcd '.fnameescape(b:netrw_curdir)) + try + exe 'keepj lcd '.fnameescape(b:netrw_curdir) + catch /^Vim\%((\a\+)\)\=:E472/ + call netrw#ErrorMsg(s:ERROR,"unable to change directory to <".b:netrw_curdir."> (permissions?)",61) + if exists("w:netrw_prvdir") + let b:netrw_curdir= w:netrw_prvdir + else + call s:NetrwOptionRestore("w:") +" call Decho("(NetrwBrowse) setl noma nomod nowrap") + setl noma nomod nowrap +" call Decho("(NetrwBrowse) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") + let b:netrw_curdir= dirname +" call Dret("s:NetrwBrowse : reusing buffer#".(exists("bufnum")? bufnum : 'N/A')."<".dirname."> getcwd<".getcwd().">") return endif - else - " handling a file, didn't split, so remove menu -" call Decho("handling a file+didn't split, so remove menu") - call s:NetrwMenu(0) - " optional change to window - if g:netrw_chgwin >= 1 - exe "keepjumps ".g:netrw_chgwin."wincmd w" - endif - endif + endtry endif + endif - " the point where netrw actually edits the (local) file - " if its local only: LocalBrowseCheck() doesn't edit a file, but NetrwBrowse() will - if a:islocal -" call Decho("edit local file: exe e! ".fnameescape(dirname)) - exe "e! ".fnameescape(dirname) - else -" call Decho("remote file: NetrwBrowse will edit it") - endif - let dolockout= 1 + " -------------------------------- + " remote handling: {{{3 + " -------------------------------- + else +" call Decho("(NetrwBrowse) remote only:") - " handle g:Netrw_funcref -- call external-to-netrw functions - " This code will handle g:Netrw_funcref as an individual function reference - " or as a list of function references. It will ignore anything that's not - " a function reference. See :help Funcref for information about function references. - if exists("g:Netrw_funcref") -" call Decho("handle optional Funcrefs") - if type(g:Netrw_funcref) == 2 -" call Decho("handling a g:Netrw_funcref") - call g:Netrw_funcref() - elseif type(g:Netrw_funcref) == 3 -" call Decho("handling a list of g:Netrw_funcrefs") - for Fncref in g:Netrw_funcref - if type(FncRef) == 2 - call FncRef() - endif - endfor - endif + " analyze dirname and g:netrw_list_cmd {{{3 +" call Decho("(NetrwBrowse) b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist")."> dirname<".dirname.">") + if dirname =~ "^NetrwTreeListing\>" + let dirname= b:netrw_curdir +" call Decho("(NetrwBrowse) (dirname was ) dirname<".dirname.">") + elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") + let dirname= substitute(b:netrw_curdir,'\\','/','g') + if dirname !~ '/$' + let dirname= dirname.'/' endif + let b:netrw_curdir = dirname +" call Decho("(NetrwBrowse) (liststyle is TREELIST) dirname<".dirname.">") + else + let dirname = substitute(dirname,'\\','/','g') +" call Decho("(NetrwBrowse) (normal) dirname<".dirname.">") endif - elseif newdir =~ '^/' - " --------------------------------- - " just go to the new directory spec - " --------------------------------- -" call Decho('case "just go to new directory spec": newdir<'.newdir.'>') - let dirname= newdir - call s:SetRexDir(a:islocal,dirname) - call s:NetrwOptionRestore("s:") + let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$' + if dirname !~ dirpat + if !exists("g:netrw_quiet") + keepj call netrw#ErrorMsg(s:ERROR,"netrw doesn't understand your dirname<".dirname.">",20) + endif + keepj call s:NetrwOptionRestore("w:") +" call Decho("(NetrwBrowse) setl noma nomod nowrap") + setl noma nomod nowrap +" call Decho("(NetrwBrowse) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Dret("s:NetrwBrowse : badly formatted dirname<".dirname.">") + return + endif + let b:netrw_curdir= dirname +" call Decho("(NetrwBrowse) b:netrw_curdir<".b:netrw_curdir."> (remote)") + endif " (additional remote handling) - elseif newdir == './' - " -------------------------- - " refresh the directory list - " -------------------------- -" call Decho('case "refresh directory listing": newdir == "./"') - call s:SetRexDir(a:islocal,dirname) + " ----------------------- + " Directory Listing: {{{3 + " ----------------------- + keepj call s:NetrwMaps(a:islocal) + keepj call s:PerformListing(a:islocal) + if v:version >= 700 && has("balloon_eval") && &beval == 0 && &l:bexpr == "" && !exists("g:netrw_nobeval") + let &l:bexpr= "netrw#NetrwBalloonHelp()" +" call Decho("(NetrwBrowse) set up balloon help: l:bexpr=".&l:bexpr) + set beval + endif + call s:NetrwOptionRestore("w:") - elseif newdir == '../' - " ------------------- - " go up one directory - " ------------------- -" call Decho('case "go up one directory": newdir == "../"') + " The s:LocalBrowseShellCmdRefresh() function is called by an autocmd + " installed by s:LocalFastBrowser() when g:netrw_fastbrowse <= 1 (ie. slow, medium speed). + " However, s:NetrwBrowse() causes the ShellCmdPost event itself to fire once; setting + " the variable below avoids that second refresh of the screen. The s:LocalBrowseShellCmdRefresh() + " function gets called due to that autocmd; it notices that the following variable is set + " and skips the refresh and sets s:locbrowseshellcmd to zero. Oct 13, 2008 + let s:locbrowseshellcmd= 1 - if w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") - " force a refresh -" call Decho("clear buffer<".expand("%")."> with :%d") - setlocal noro ma -" call Decho("setlocal noro ma") - keepj %d - endif +" call Decho("(NetrwBrowse) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Dret("s:NetrwBrowse : did PerformListing ft<".&ft.">") + return +endfun - if has("amiga") - " amiga -" call Decho('case "go up one directory": newdir == "../" and amiga') - if a:islocal - let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+$\)','\1','') - let dirname= substitute(dirname,'/$','','') +" --------------------------------------------------------------------- +" s:NetrwFileInfo: supports qf (query for file information) {{{2 +fun! s:NetrwFileInfo(islocal,fname) +" call Dfunc("s:NetrwFileInfo(islocal=".a:islocal." fname<".a:fname.">)") + let ykeep= @@ + if a:islocal + if (has("unix") || has("macunix")) && executable("/bin/ls") + if exists("b:netrw_curdir") +" call Decho('using ls with b:netrw_curdir<'.b:netrw_curdir.'>') + if b:netrw_curdir =~ '/$' + echo system("/bin/ls -lsad ".shellescape(b:netrw_curdir.a:fname)) + else + echo system("/bin/ls -lsad ".shellescape(b:netrw_curdir."/".a:fname)) + endif else - let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+/$\)','\1','') +" call Decho('using ls '.a:fname." using cwd<".getcwd().">") + echo system("/bin/ls -lsad ".shellescape(a:fname)) endif -" call Decho("amiga: dirname<".dirname."> (go up one dir)") - else - " unix or cygwin -" call Decho('case "go up one directory": newdir == "../" and unix or cygwin') - if a:islocal - let dirname= substitute(dirname,'^\(.*\)/\([^/]\+\)/$','\1','') - if dirname == "" - let dirname= '/' - endif + " use vim functions to return information about file below cursor +" call Decho("using vim functions to query for file info") + if !isdirectory(a:fname) && !filereadable(a:fname) && a:fname =~ '[*@/]' + let fname= substitute(a:fname,".$","","") else - let dirname= substitute(dirname,'^\(\a\+://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','') + let fname= a:fname endif -" call Decho("unix: dirname<".dirname."> (go up one dir)") + let t = getftime(fname) + let sz = getfsize(fname) + echo a:fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname)) +" call Decho(fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname))) endif - call s:SetRexDir(a:islocal,dirname) + else + echo "sorry, \"qf\" not supported yet for remote files" + endif + let @@= ykeep +" call Dret("s:NetrwFileInfo") +endfun - elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") -" call Decho('case liststyle is TREELIST and w:netrw_treedict exists') - " force a refresh (for TREELIST, wait for NetrwTreeDir() to force the refresh) - setlocal noro ma -" call Decho("setlocal noro ma") - if !(exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir")) -" call Decho("clear buffer<".expand("%")."> with :%d") - keepj %d +" --------------------------------------------------------------------- +" s:NetrwGetBuffer: {{{2 +" returns 0=cleared buffer +" 1=re-used buffer +fun! s:NetrwGetBuffer(islocal,dirname) +" call Dfunc("s:NetrwGetBuffer(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".g:netrw_liststyle) +" call Decho("(NetrwGetBuffer) modiable=".&mod." modifiable=".&ma." readonly=".&ro) + let dirname= a:dirname + + " re-use buffer if possible {{{3 +" call Decho("(NetrwGetBuffer) --re-use a buffer if possible--") + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST + " find NetrwTreeList buffer if there is one +" call Decho("(NetrwGetBuffer) case liststyle=treelist: find NetrwTreeList buffer if there is one") + if exists("w:netrw_treebufnr") && w:netrw_treebufnr > 0 +" call Decho("(NetrwGetBuffer) re-using w:netrw_treebufnr=".w:netrw_treebufnr) + setl mod + sil! keepj %d + let eikeep= &ei + set ei=all + exe "sil! keepalt b ".w:netrw_treebufnr + let &ei= eikeep +" call Dret("s:NetrwGetBuffer 0 : bufnum#".w:netrw_treebufnr."") + return 0 endif - let treedir = s:NetrwTreeDir() - let s:treecurpos = nbcd_curpos - let haskey= 0 -" call Decho("w:netrw_treedict<".string(w:netrw_treedict).">") + let bufnum= -1 +" call Decho("(NetrwGetBuffer) liststyle=TREE but w:netrw_treebufnr doesn't exist") - " search treedict for tree dir as-is - if has_key(w:netrw_treedict,treedir) -" call Decho('....searched for treedir<'.treedir.'> : found it!') - let haskey= 1 - else -" call Decho('....searched for treedir<'.treedir.'> : not found') + else + " find buffer number of buffer named precisely the same as dirname {{{3 +" call Decho("(NetrwGetBuffer) case listtyle not treelist: find buffer numnber of buffer named precisely the same as dirname--") + + " get dirname and associated buffer number + let bufnum = bufnr(escape(dirname,'\')) +" call Decho("(NetrwGetBuffer) find buffer<".dirname.">'s number ") +" call Decho("(NetrwGetBuffer) bufnr(dirname<".escape(dirname,'\').">)=".bufnum) + + if bufnum < 0 && dirname !~ '/$' + " try appending a trailing / +" call Decho("(NetrwGetBuffer) try appending a trailing / to dirname<".dirname.">") + let bufnum= bufnr(escape(dirname.'/','\')) + if bufnum > 0 + let dirname= dirname.'/' + endif endif - " search treedict for treedir with a / appended - if !haskey && treedir !~ '/$' - if has_key(w:netrw_treedict,treedir."/") - let treedir= treedir."/" -" call Decho('....searched.for treedir<'.treedir.'> found it!') - let haskey = 1 + if bufnum < 0 && dirname =~ '/$' + " try removing a trailing / +" call Decho("(NetrwGetBuffer) try removing a trailing / from dirname<".dirname.">") + let bufnum= bufnr(escape(substitute(dirname,'/$','',''),'\')) + if bufnum > 0 + let dirname= substitute(dirname,'/$','','') + endif + endif + +" call Decho("(NetrwGetBuffer) findbuf1: bufnum=bufnr('".dirname."')=".bufnum." bufname(".bufnum.")<".bufname(bufnum)."> (initial)") + " note: !~ was used just below, but that means using ../ to go back would match (ie. abc/def/ and abc/ matches) + if bufnum > 0 && bufname(bufnum) != dirname && bufname(bufnum) != '.' + " handle approximate matches +" call Decho("(NetrwGetBuffer) handling approx match: bufnum#".bufnum.">0 AND bufname<".bufname(bufnum).">!=dirname<".dirname."> AND bufname(".bufnum.")!='.'") + let ibuf = 1 + let buflast = bufnr("$") +" call Decho("(NetrwGetBuffer) findbuf2: buflast=bufnr($)=".buflast) + while ibuf <= buflast + let bname= substitute(bufname(ibuf),'\\','/','g') + let bname= substitute(bname,'.\zs/$','','') +" call Decho("(NetrwGetBuffer) findbuf3: while [ibuf=",ibuf."]<=[buflast=".buflast."]: dirname<".dirname."> bname=bufname(".ibuf.")<".bname.">") + if bname != '' && dirname =~ '/'.bname.'/\=$' && dirname !~ '^/' + " bname is not empty + " dirname ends with bname, + " dirname doesn't start with /, so its not a absolute path +" call Decho("(NetrwGetBuffer) findbuf3a: passes test 1 : dirname<".dirname.'> =~ /'.bname.'/\=$ && dirname !~ ^/') + break + endif + if bname =~ '^'.dirname.'/\=$' + " bname begins with dirname +" call Decho(' findbuf3b: passes test 2 : bname<'.bname.'>=~^'.dirname.'/\=$') + break + endif + if dirname =~ '^'.bname.'/$' +" call Decho(' findbuf3c: passes test 3 : dirname<'.dirname.'>=~^'.bname.'/$') + break + endif + if bname != '' && dirname =~ '/'.bname.'$' && bname == bufname("%") && line("$") == 1 +" call Decho(' findbuf3d: passes test 4 : dirname<'.dirname.'>=~ /'.bname.'$') + break + endif + let ibuf= ibuf + 1 + endwhile + if ibuf > buflast + let bufnum= -1 else -" call Decho('....searched for treedir<'.treedir.'/> : not found') + let bufnum= ibuf endif +" call Decho("(NetrwGetBuffer) findbuf4: bufnum=".bufnum." (ibuf=".ibuf." buflast=".buflast.")") endif + endif - " search treedict for treedir with any trailing / elided - if !haskey && treedir =~ '/$' - let treedir= substitute(treedir,'/$','','') - if has_key(w:netrw_treedict,treedir) -" call Decho('....searched.for treedir<'.treedir.'> found it!') - let haskey = 1 + " get enew buffer and name it -or- re-use buffer {{{3 +" call Decho("(NetrwGetBuffer) get enew buffer and name it OR re-use buffer") + sil! keepj keepalt mark ' + if bufnum < 0 || !bufexists(bufnum) +" call Decho("(NetrwGetBuffer) --get enew buffer and name it (bufnum#".bufnum."<0 OR bufexists(".bufnum.")=".bufexists(bufnum)."==0)") + call s:NetrwEnew(dirname) +" call Decho("(NetrwGetBuffer) got enew buffer#".bufnr("%")." (altbuf<".expand("#").">)") + " name the buffer + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST + " Got enew buffer; transform into a NetrwTreeListing +" call Decho("(NetrwGetBuffer) --transform enew buffer#".bufnr("%")." into a NetrwTreeListing --") + if !exists("s:netrw_treelistnum") + let s:netrw_treelistnum= 1 else -" call Decho('....searched for treedir<'.treedir.'> : not found') + let s:netrw_treelistnum= s:netrw_treelistnum + 1 endif + let w:netrw_treebufnr= bufnr("%") +" call Decho("(NetrwGetBuffer) exe sil! keepalt file NetrwTreeListing ".fnameescape(s:netrw_treelistnum)) + exe 'sil! keepalt file NetrwTreeListing\ '.fnameescape(s:netrw_treelistnum) + set bt=nofile noswf + nnoremap [ :sil call TreeListMove('[') + nnoremap ] :sil call TreeListMove(']') + nnoremap [[ :sil call TreeListMove('[') + nnoremap ]] :sil call TreeListMove(']') +" call Decho("(NetrwGetBuffer) tree listing#".s:netrw_treelistnum." bufnr=".w:netrw_treebufnr) + else +" let v:errmsg= "" " Decho + let escdirname= fnameescape(dirname) +" call Decho("(NetrwGetBuffer) errmsg<".v:errmsg."> bufnr(escdirname<".escdirname.">)=".bufnr(escdirname)." bufname()<".bufname(bufnr(escdirname)).">") +" call Decho(' exe sil! keepalt file '.escdirname) +" let v:errmsg= "" " Decho + exe 'sil! keepalt file '.escdirname +" call Decho("(NetrwGetBuffer) errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">") endif +" call Decho("(NetrwGetBuffer) named enew buffer#".bufnr("%")."<".bufname("%").">") - if haskey - " close tree listing for selected subdirectory -" call Decho("closing selected subdirectory<".dirname.">") - call remove(w:netrw_treedict,treedir) -" call Decho("removed entry<".treedir."> from treedict") -" call Decho("yielding treedict<".string(w:netrw_treedict).">") - let dirname= w:netrw_treetop + else " Re-use the buffer +" call Decho("(NetrwGetBuffer) --re-use buffer#".bufnum." (bufnum#".bufnum.">=0 AND bufexists(".bufnum.")=".bufexists(bufnum)."!=0)") + let eikeep= &ei + set ei=all + if getline(2) =~ '^" Netrw Directory Listing' +" call Decho("(NetrwGetBuffer) getline(2)<".getline(2).'> matches "Netrw Directory Listing" : using keepalt b '.bufnum) + exe "sil! keepalt b ".bufnum else - " go down one directory - let dirname= substitute(treedir,'/*$','/','') -" call Decho("go down one dir: treedir<".treedir.">") +" call Decho("(NetrwGetBuffer) getline(2)<".getline(2).'> does not match "Netrw Directory Listing" : using b '.bufnum) + exe "sil! keepalt b ".bufnum endif - call s:SetRexDir(a:islocal,dirname) - let s:treeforceredraw = 1 - - else - " go down one directory - let dirname= s:ComposePath(dirname,newdir) -" call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">") - call s:SetRexDir(a:islocal,dirname) - endif - - call s:NetrwOptionRestore("s:") - if dolockout -" call Decho("filewritable(dirname<".dirname.">)=".filewritable(dirname)) - if filewritable(dirname) -" call Decho("doing modification lockout settings: ma nomod noro") - setlocal ma nomod noro + if bufname("%") == '.' +" call Decho("(NetrwGetBuffer) exe sil! keepalt file ".fnameescape(getcwd())) + exe "sil! keepalt file ".fnameescape(getcwd()) + endif + let &ei= eikeep + if line("$") <= 1 + keepj call s:NetrwListSettings(a:islocal) +" call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but its empty, so refresh it") + return 0 + elseif g:netrw_fastbrowse == 0 || (a:islocal && g:netrw_fastbrowse == 1) + keepj call s:NetrwListSettings(a:islocal) + sil keepj %d +" call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but refreshing due to g:netrw_fastbrowse=".g:netrw_fastbrowse) + return 0 + elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST +" call Decho("(NetrwGetBuffer) --re-use tree listing--") +" call Decho("(NetrwGetBuffer) clear buffer<".expand("%")."> with :%d") + sil keepj %d + keepj call s:NetrwListSettings(a:islocal) +" call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but treelist mode always needs a refresh") + return 0 else -" call Decho("doing modification lockout settings: ma nomod ro") - setlocal ma nomod ro +" call Dret("s:NetrwGetBuffer 1 : buf#".bufnr("%")) + return 1 endif -" call Decho("setlocal ma nomod noro") endif -" call Dret("s:NetrwBrowseChgDir <".dirname."> : curpos<".string(getpos(".")).">") - return dirname + " do netrw settings: make this buffer not-a-file, modifiable, not line-numbered, etc {{{3 + " fastbrowse Local Remote Hiding a buffer implies it may be re-used (fast) + " slow 0 D D Deleting a buffer implies it will not be re-used (slow) + " med 1 D H + " fast 2 H H +" call Decho("(NetrwGetBuffer) --do netrw settings: make this buffer#".bufnr("%")." not-a-file, modifiable, not line-numbered, etc--") + let fname= expand("%") + keepj call s:NetrwListSettings(a:islocal) +" call Decho("(NetrwGetBuffer) exe sil! keepalt file ".fnameescape(fname)) + exe "sil! keepj keepalt file ".fnameescape(fname) + + " delete all lines from buffer {{{3 +" call Decho("(NetrwGetBuffer) --delete all lines from buffer--") +" call Decho("(NetrwGetBuffer) clear buffer<".expand("%")."> with :%d") + sil! keepalt keepj %d + +" call Dret("s:NetrwGetBuffer 0 : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) + return 0 endfun " --------------------------------------------------------------------- -" s:NetrwBrowseX: (implements "x") executes a special "viewer" script or program for the {{{2 -" given filename; typically this means given their extension. -" 0=local, 1=remote -fun! netrw#NetrwBrowseX(fname,remote) -" call Dfunc("NetrwBrowseX(fname<".a:fname."> remote=".a:remote.")") - - " special core dump handler - if a:fname =~ '/core\(\.\d\+\)\=$' - if exists("g:Netrw_corehandler") - if type(g:Netrw_corehandler) == 2 - " g:Netrw_corehandler is a function reference (see :help Funcref) -" call Decho("g:Netrw_corehandler is a funcref") - call g:Netrw_corehandler(a:fname) - elseif type(g:netrw_corehandler) == 3) - " g:Netrw_corehandler is a List of function references (see :help Funcref) -" call Decho("g:Netrw_corehandler is a List") - for Fncref in g:Netrw_corehandler - if type(FncRef) == 2 - call FncRef(a:fname) - endif - endfor - endif -" call Dret("NetrwBrowseX : coredump handler invoked") - return - endif +" s:NetrwGetcwd: get the current directory. {{{2 +" Change backslashes to forward slashes, if any. +" If doesc is true, escape certain troublesome characters +fun! s:NetrwGetcwd(doesc) +" call Dfunc("NetrwGetcwd(doesc=".a:doesc.")") + let curdir= substitute(getcwd(),'\\','/','ge') + if curdir !~ '[\/]$' + let curdir= curdir.'/' endif - - " set up the filename - " (lower case the extension, make a local copy of a remote file) - let exten= substitute(a:fname,'.*\.\(.\{-}\)','\1','e') - if has("win32") || has("win95") || has("win64") || has("win16") - let exten= substitute(exten,'^.*$','\L&\E','') + if a:doesc + let curdir= fnameescape(curdir) endif -" call Decho("exten<".exten.">") +" call Dret("NetrwGetcwd <".curdir.">") + return curdir +endfun - " seems kde systems often have gnome-open due to dependencies, even though - " gnome-open's subsidiary display tools are largely absent. Kde systems - " usually have "kdeinit" running, though... (tnx Mikolaj Machowski) - if !exists("s:haskdeinit") - if has("unix") - let s:haskdeinit= system("ps -e") =~ 'kdeinit' - if v:shell_error - let s:haskdeinit = 0 - endif +" --------------------------------------------------------------------- +" s:NetrwGetWord: it gets the directory/file named under the cursor {{{2 +fun! s:NetrwGetWord() +" call Dfunc("s:NetrwGetWord() line#".line(".")." liststyle=".g:netrw_liststyle." virtcol=".virtcol(".")) + call s:UseBufWinVars() + + " insure that w:netrw_liststyle is set up + if !exists("w:netrw_liststyle") + if exists("g:netrw_liststyle") + let w:netrw_liststyle= g:netrw_liststyle else - let s:haskdeinit= 0 + let w:netrw_liststyle= s:THINLIST endif -" call Decho("setting s:haskdeinit=".s:haskdeinit) +" call Decho("w:netrw_liststyle=".w:netrw_liststyle) endif - if a:remote == 1 - " create a local copy -" call Decho("a:remote=".a:remote.": create a local copy of <".a:fname.">") - setlocal bh=delete - call netrw#NetRead(3,a:fname) - " attempt to rename tempfile - let basename= substitute(a:fname,'^\(.*\)/\(.*\)\.\([^.]*\)$','\2','') - let newname= substitute(s:netrw_tmpfile,'^\(.*\)/\(.*\)\.\([^.]*\)$','\1/'.basename.'.\3','') -" call Decho("basename<".basename.">") -" call Decho("newname <".newname.">") - if rename(s:netrw_tmpfile,newname) == 0 - " renaming succeeded - let fname= newname - else - " renaming failed - let fname= s:netrw_tmpfile + if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt + " Active Banner support +" call Decho("active banner handling") + keepj norm! 0 + let dirname= "./" + let curline= getline('.') + + if curline =~ '"\s*Sorted by\s' + keepj norm s + let s:netrw_skipbrowse= 1 + echo 'Pressing "s" also works' + + elseif curline =~ '"\s*Sort sequence:' + let s:netrw_skipbrowse= 1 + echo 'Press "S" to edit sorting sequence' + + elseif curline =~ '"\s*Quick Help:' + keepj norm ? + let s:netrw_skipbrowse= 1 + echo 'Pressing "?" also works' + + elseif curline =~ '"\s*\%(Hiding\|Showing\):' + keepj norm a + let s:netrw_skipbrowse= 1 + echo 'Pressing "a" also works' + + elseif line("$") > w:netrw_bannercnt + exe 'sil keepj '.w:netrw_bannercnt endif + + elseif w:netrw_liststyle == s:THINLIST +" call Decho("thin column handling") + keepj norm! 0 + let dirname= getline('.') + + elseif w:netrw_liststyle == s:LONGLIST +" call Decho("long column handling") + keepj norm! 0 + let dirname= substitute(getline('.'),'^\(\%(\S\+ \)*\S\+\).\{-}$','\1','e') + + elseif w:netrw_liststyle == s:TREELIST +" call Decho("treelist handling") + let dirname= substitute(getline('.'),'^\(| \)*','','e') + else - let fname= a:fname - " special ~ handler for local - if fname =~ '^\~' && expand("$HOME") != "" -" call Decho('invoking special ~ handler') - let fname= substitute(fname,'^\~',expand("$HOME"),'') +" call Decho("obtain word from wide listing") + let dirname= getline('.') + + if !exists("b:netrw_cpf") + let b:netrw_cpf= 0 + exe 'sil keepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' + call histdel("/",-1) +" call Decho("computed cpf=".b:netrw_cpf) endif - endif -" call Decho("fname<".fname.">") -" call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten)) - " set up redirection - if &srr =~ "%s" - if (has("win32") || has("win95") || has("win64") || has("win16")) - let redir= substitute(&srr,"%s","nul","") +" call Decho("buf#".bufnr("%")."<".bufname("%").">") + let filestart = (virtcol(".")/b:netrw_cpf)*b:netrw_cpf +" call Decho("filestart= ([virtcol=".virtcol(".")."]/[b:netrw_cpf=".b:netrw_cpf."])*b:netrw_cpf=".filestart." bannercnt=".w:netrw_bannercnt) +" call Decho("1: dirname<".dirname.">") + if filestart == 0 + keepj norm! 0ma else - let redir= substitute(&srr,"%s","/dev/null","") + call cursor(line("."),filestart+1) + keepj norm! ma endif - elseif (has("win32") || has("win95") || has("win64") || has("win16")) - let redir= &srr . "nul" - else - let redir= &srr . "/dev/null" - endif -" call Decho("redir{".redir."} srr{".&srr."}") - - " extract any viewing options. Assumes that they're set apart by quotes. - if exists("g:netrw_browsex_viewer") -" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") - if g:netrw_browsex_viewer =~ '\s' - let viewer = substitute(g:netrw_browsex_viewer,'\s.*$','','') - let viewopt = substitute(g:netrw_browsex_viewer,'^\S\+\s*','','')." " - let oviewer = '' - let cnt = 1 - while !executable(viewer) && viewer != oviewer - let viewer = substitute(g:netrw_browsex_viewer,'^\(\(^\S\+\s\+\)\{'.cnt.'}\S\+\)\(.*\)$','\1','') - let viewopt = substitute(g:netrw_browsex_viewer,'^\(\(^\S\+\s\+\)\{'.cnt.'}\S\+\)\(.*\)$','\3','')." " - let cnt = cnt + 1 - let oviewer = viewer -" call Decho("!exe: viewer<".viewer."> viewopt<".viewopt.">") - endwhile + let rega= @a + let eofname= filestart + b:netrw_cpf + 1 + if eofname <= col("$") + call cursor(line("."),filestart+b:netrw_cpf+1) + keepj norm! "ay`a else - let viewer = g:netrw_browsex_viewer - let viewopt = "" + keepj norm! "ay$ endif -" call Decho("viewer<".viewer."> viewopt<".viewopt.">") + let dirname = @a + let @a = rega +" call Decho("2: dirname<".dirname.">") + let dirname= substitute(dirname,'\s\+$','','e') +" call Decho("3: dirname<".dirname.">") endif - " execute the file handler - if exists("g:netrw_browsex_viewer") && g:netrw_browsex_viewer == '-' -" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") - let ret= netrwFileHandlers#Invoke(exten,fname) + " symlinks are indicated by a trailing "@". Remove it before further processing. + let dirname= substitute(dirname,"@$","","") - elseif exists("g:netrw_browsex_viewer") && executable(viewer) -" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") -" call Decho("exe silent !".viewer." ".viewopt.shellescape(fname,1).redir) - exe "silent !".viewer." ".viewopt.shellescape(fname,1).redir - let ret= v:shell_error + " executables are indicated by a trailing "*". Remove it before further processing. + let dirname= substitute(dirname,"\*$","","") + +" call Dret("s:NetrwGetWord <".dirname.">") + return dirname +endfun + +" --------------------------------------------------------------------- +" s:NetrwListSettings: make standard settings for a netrw listing {{{2 +fun! s:NetrwListSettings(islocal) +" call Dfunc("s:NetrwListSettings(islocal=".a:islocal.")") + let fname= bufname("%") +" call Decho("(NetrwListSettings) setl bt=nofile nobl ma nonu nowrap noro") + setl bt=nofile nobl ma nonu nowrap noro +" call Decho("(NetrwListSettings) exe sil! keepalt file ".fnameescape(fname)) + exe "sil! keepalt file ".fnameescape(fname) + if g:netrw_use_noswf + setl noswf + endif +" call Decho("(NetrwListSettings) exe setl ts=".(g:netrw_maxfilenamelen+1)) + exe "setl ts=".(g:netrw_maxfilenamelen+1) + setl isk+=.,~,- + if g:netrw_fastbrowse > a:islocal + setl bh=hide + else + setl bh=delete + endif +" call Dret("s:NetrwListSettings") +endfun + +" --------------------------------------------------------------------- +" s:NetrwListStyle: {{{2 +" islocal=0: remote browsing +" =1: local browsing +fun! s:NetrwListStyle(islocal) +" call Dfunc("NetrwListStyle(islocal=".a:islocal.") w:netrw_liststyle=".w:netrw_liststyle) + let ykeep = @@ + let fname = s:NetrwGetWord() + if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif + let w:netrw_liststyle = (w:netrw_liststyle + 1) % s:MAXLIST +" call Decho("fname<".fname.">") +" call Decho("chgd w:netrw_liststyle to ".w:netrw_liststyle) +" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">") - elseif has("win32") || has("win64") - if executable("start") -" call Decho('exe silent !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)) - exe 'silent !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1) - elseif executable("rundll32") -" call Decho('exe silent !rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)) - exe 'silent !rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1) - else - call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74) - endif - call inputsave()|call input("Press to continue")|call inputrestore() - let ret= v:shell_error + if w:netrw_liststyle == s:THINLIST + " use one column listing +" call Decho("use one column list") + let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') - elseif has("unix") && executable("gnome-open") && !s:haskdeinit -" call Decho("exe silent !gnome-open ".shellescape(fname,1)." ".redir) - exe "sil !gnome-open ".shellescape(fname,1).redir - let ret= v:shell_error + elseif w:netrw_liststyle == s:LONGLIST + " use long list +" call Decho("use long list") + let g:netrw_list_cmd = g:netrw_list_cmd." -l" - elseif has("unix") && executable("kfmclient") && s:haskdeinit -" call Decho("exe silent !kfmclient exec ".shellescape(fname,1)." ".redir) - exe "sil !kfmclient exec ".shellescape(fname,1)." ".redir - let ret= v:shell_error + elseif w:netrw_liststyle == s:WIDELIST + " give wide list +" call Decho("use wide list") + let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') - elseif has("macunix") && executable("open") -" call Decho("exe silent !open ".shellescape(fname,1)." ".redir) - exe "sil !open ".shellescape(fname,1)." ".redir - let ret= v:shell_error + elseif w:netrw_liststyle == s:TREELIST +" call Decho("use tree list") + let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') else - " netrwFileHandlers#Invoke() always returns 0 - let ret= netrwFileHandlers#Invoke(exten,fname) - endif - - " if unsuccessful, attempt netrwFileHandlers#Invoke() - if ret - let ret= netrwFileHandlers#Invoke(exten,fname) + keepj call netrw#ErrorMsg(s:WARNING,"bad value for g:netrw_liststyle (=".w:netrw_liststyle.")",46) + let g:netrw_liststyle = s:THINLIST + let w:netrw_liststyle = g:netrw_liststyle + let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') endif + setl ma noro +" call Decho("setl ma noro") - " restoring redraw! after external file handlers - redraw! + " clear buffer - this will cause NetrwBrowse/LocalBrowseCheck to do a refresh +" call Decho("clear buffer<".expand("%")."> with :%d") + sil! keepj %d + " following prevents tree listing buffer from being marked "modified" +" call Decho("(NetrwListStyle) setl nomod") + setl nomod +" call Decho("(NetrwListStyle) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") - " cleanup: remove temporary file, - " delete current buffer if success with handler, - " return to prior buffer (directory listing) - " Feb 12, 2008: had to de-activiate removal of - " temporary file because it wasn't getting seen. -" if a:remote == 1 && fname != a:fname -" call Decho("deleting temporary file<".fname.">") -" call s:NetrwDelete(fname) -" endif + " refresh the listing +" call Decho("(NetrwListStyle) refresh the listing") + let svpos= netrw#NetrwSavePosn() + keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + keepj call netrw#NetrwRestorePosn(svpos) + keepj call s:NetrwCursor() - if a:remote == 1 - setlocal bh=delete bt=nofile - if g:netrw_use_noswf - setlocal noswf - endif - exe "keepj norm! \" -" redraw! + " keep cursor on the filename + sil! keepj $ + let result= search('\%(^\%(|\+\s\)\=\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bc') +" call Decho("search result=".result." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'N/A')) + if result <= 0 && exists("w:netrw_bannercnt") + exe "sil! keepj ".w:netrw_bannercnt endif + let @@= ykeep -" call Dret("NetrwBrowseX") +" call Dret("NetrwListStyle".(exists("w:netrw_liststyle")? ' : w:netrw_liststyle='.w:netrw_liststyle : "")) endfun " --------------------------------------------------------------------- -" s:NetrwChgPerm: (implements "gp") change file permission {{{2 -fun! s:NetrwChgPerm(islocal,curdir) -" call Dfunc("s:NetrwChgPerm(islocal=".a:islocal." curdir<".a:curdir.">)") - call inputsave() - let newperm= input("Enter new permission: ") - call inputrestore() - let chgperm= substitute(g:netrw_chgperm,'\',shellescape(expand("")),'') - let chgperm= substitute(chgperm,'\',shellescape(newperm),'') -" call Decho("chgperm<".chgperm.">") - call system(chgperm) - if v:shell_error != 0 - call netrw#ErrorMsg(1,"changing permission on file<".expand("")."> seems to have failed",75) - endif - if a:islocal - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - endif -" call Dret("s:NetrwChgPerm") -endfun +" s:NetrwBannerCtrl: toggles the display of the banner {{{2 +fun! s:NetrwBannerCtrl(islocal) +" call Dfunc("s:NetrwBannerCtrl(islocal=".a:islocal.") g:netrw_banner=".g:netrw_banner) -" --------------------------------------------------------------------- -" s:NetrwClearExplore: clear explore variables (if any) {{{2 -fun! s:NetrwClearExplore() -" call Dfunc("s:NetrwClearExplore()") - 2match none - if exists("s:explore_match") |unlet s:explore_match |endif - if exists("s:explore_indx") |unlet s:explore_indx |endif - if exists("s:netrw_explore_prvdir") |unlet s:netrw_explore_prvdir |endif - if exists("s:dirstarstar") |unlet s:dirstarstar |endif - if exists("s:explore_prvdir") |unlet s:explore_prvdir |endif - if exists("w:netrw_explore_indx") |unlet w:netrw_explore_indx |endif - if exists("w:netrw_explore_listlen")|unlet w:netrw_explore_listlen|endif - if exists("w:netrw_explore_list") |unlet w:netrw_explore_list |endif - if exists("w:netrw_explore_bufnr") |unlet w:netrw_explore_bufnr |endif -" redraw! - echo " " - echo " " -" call Dret("s:NetrwClearExplore") + let ykeep= @@ + " toggle the banner (enable/suppress) + let g:netrw_banner= !g:netrw_banner + + " refresh the listing + let svpos= netrw#NetrwSavePosn() + call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + + " keep cursor on the filename + let fname= s:NetrwGetWord() + sil keepj $ + let result= search('\%(^\%(|\+\s\)\=\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bc') +" call Decho("search result=".result." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'N/A')) + if result <= 0 && exists("w:netrw_bannercnt") + exe "keepj ".w:netrw_bannercnt + endif + let @@= ykeep +" call Dret("s:NetrwBannerCtrl : g:netrw_banner=".g:netrw_banner) endfun " --------------------------------------------------------------------- -" netrw#Explore: launch the local browser in the directory of the current file {{{2 -" indx: == -1: Nexplore -" == -2: Pexplore -" == +: this is overloaded: -" * If Nexplore/Pexplore is in use, then this refers to the -" indx'th item in the w:netrw_explore_list[] of items which -" matched the */pattern **/pattern *//pattern **//pattern -" * If Hexplore or Vexplore, then this will override -" g:netrw_winsize to specify the qty of rows or columns the -" newly split window should have. -" dosplit==0: the window will be split iff the current file has been modified -" dosplit==1: the window will be split before running the local browser -" style == 0: Explore style == 1: Explore! -" == 2: Hexplore style == 3: Hexplore! -" == 4: Vexplore style == 5: Vexplore! -" == 6: Texplore -fun! netrw#Explore(indx,dosplit,style,...) -" call Dfunc("netrw#Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.",a:1<".a:1.">) &modified=".&modified." a:0=".a:0) - if !exists("b:netrw_curdir") - let b:netrw_curdir= getcwd() -" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)") +" s:NetrwBookmarkMenu: Uses menu priorities {{{2 +" .2.[cnt] for bookmarks, and +" .3.[cnt] for history +" (see s:NetrwMenu()) +fun! s:NetrwBookmarkMenu() + if !exists("s:netrw_menucnt") + return endif - let curdir = simplify(b:netrw_curdir) - let curfiledir = substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e') -" call Decho("curdir<".curdir."> curfiledir<".curfiledir.">") - - " save registers - sil! let keepregstar = @* - sil! let keepregplus = @+ - sil! let keepregslash= @/ +" call Dfunc("NetrwBookmarkMenu() histcnt=".g:netrw_dirhist_cnt." menucnt=".s:netrw_menucnt) - " if dosplit or file has been modified - if a:dosplit || &modified || a:style == 6 -" call Decho("case dosplit=".a:dosplit." modified=".&modified." a:style=".a:style.": dosplit or file has been modified") - call s:SaveWinVars() - let winsize= g:netrw_winsize - if a:indx > 0 - let winsize= a:indx + " the following test assures that gvim is running, has menus available, and has menus enabled. + if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu + if exists("g:NetrwTopLvlMenu") +" call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)") + exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Bookmarks' + exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete' + endif + if !exists("s:netrw_initbookhist") + call s:NetrwBookHistRead() endif - if a:style == 0 " Explore, Sexplore -" call Decho("style=0: Explore or Sexplore") - exe winsize."wincmd s" + " show bookmarked places + if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] && g:netrw_dirhistmax > 0 + let cnt= 1 + for bmd in g:netrw_bookmarklist + let ebmd= escape(bmd,g:netrw_menu_escape) +" call Decho('sil! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmark.'.ebmd.' :e '.bmd) - elseif a:style == 1 "Explore!, Sexplore! -" call Decho("style=1: Explore! or Sexplore!") - exe winsize."wincmd v" + " show bookmarks for goto menu + exe 'sil! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks.'.ebmd.' :e '.bmd."\" - elseif a:style == 2 " Hexplore -" call Decho("style=2: Hexplore") - exe "bel ".winsize."wincmd s" + " show bookmarks for deletion menu + exe 'sil! menu '.g:NetrwMenuPriority.".8.2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete.'.ebmd.' '.cnt."mB" + let cnt= cnt + 1 + endfor - elseif a:style == 3 " Hexplore! -" call Decho("style=3: Hexplore!") - exe "abo ".winsize."wincmd s" + endif - elseif a:style == 4 " Vexplore -" call Decho("style=4: Vexplore") - exe "lefta ".winsize."wincmd v" + " show directory browsing history + if g:netrw_dirhistmax > 0 + let cnt = g:netrw_dirhist_cnt + let first = 1 + let histcnt = 0 + while ( first || cnt != g:netrw_dirhist_cnt ) + let histcnt = histcnt + 1 + let priority = g:netrw_dirhist_cnt + histcnt + if exists("g:netrw_dirhist_{cnt}") + let histdir= escape(g:netrw_dirhist_{cnt},g:netrw_menu_escape) +" call Decho('sil! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir) + exe 'sil! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir."\" + endif + let first = 0 + let cnt = ( cnt - 1 ) % g:netrw_dirhistmax + if cnt < 0 + let cnt= cnt + g:netrw_dirhistmax + endif + endwhile + endif - elseif a:style == 5 " Vexplore! -" call Decho("style=5: Vexplore!") - exe "rightb ".winsize."wincmd v" + endif +" call Dret("NetrwBookmarkMenu") +endfun - elseif a:style == 6 " Texplore - call s:SaveBufVars() -" call Decho("style = 6: Texplore") - tabnew - call s:RestoreBufVars() - endif - call s:RestoreWinVars() -" else " Decho -" call Decho("case a:dosplit=".a:dosplit." AND modified=".&modified." AND a:style=".a:style." is not 6") +" --------------------------------------------------------------------- +" s:NetrwBrowseChgDir: constructs a new directory based on the current {{{2 +" directory and a new directory name. Also, if the +" "new directory name" is actually a file, +" NetrwBrowseChgDir() edits the file. +fun! s:NetrwBrowseChgDir(islocal,newdir,...) +" call Dfunc("s:NetrwBrowseChgDir(islocal=".a:islocal."> newdir<".a:newdir.">) a:0=".a:0." curpos<".string(getpos("."))."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "").">") + + let ykeep= @@ + if !exists("b:netrw_curdir") + " Don't try to change-directory: this can happen, for example, when netrw#ErrorMsg has been called + " and the current window is the NetrwMessage window. + let @@= ykeep +" call Decho("(NetrwBrowseChgDir) b:netrw_curdir doesn't exist!") +" call Decho("(NetrwBrowseChgDir) getcwd<".getcwd().">") +" call Dret("s:NetrwBrowseChgDir") + return endif - keepj norm! 0 - if a:0 > 0 -" call Decho("case [a:0=".a:0."] > 0: a:1<".a:1.">") - if a:1 =~ '^\~' && (has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin)) -" call Decho("case a:1: ~ and unix or cygwin") - let dirname= simplify(substitute(a:1,'\~',expand("$HOME"),'')) -" call Decho("using dirname<".dirname."> (case: ~ && unix||cygwin)") - elseif a:1 == '.' -" call Decho("case a:1: .") - let dirname= simplify(exists("b:netrw_curdir")? b:netrw_curdir : getcwd()) - if dirname !~ '/$' - let dirname= dirname."/" - endif -" call Decho("using dirname<".dirname."> (case: ".(exists("b:netrw_curdir")? "b:netrw_curdir" : "getcwd()").")") - elseif a:1 =~ '\$' -" call Decho("case a:1: $") - let dirname= simplify(expand(a:1)) -" call Decho("using user-specified dirname<".dirname."> with $env-var") - elseif a:1 !~ '^\*/' -" call Decho("case a:1: other, not pattern or filepattern") - let dirname= simplify(a:1) -" call Decho("using user-specified dirname<".dirname.">") - else -" call Decho("case a:1: pattern or filepattern") - let dirname= a:1 - endif + " NetrwBrowseChgDir: save options and initialize {{{3 + keepj call s:NetrwOptionSave("s:") + keepj call s:NetrwSafeOptions() + let nbcd_curpos = netrw#NetrwSavePosn() + let s:nbcd_curpos_{bufnr('%')} = nbcd_curpos +" call Decho("(NetrwBrowseChgDir) setting s:nbcd_curpos_".bufnr('%')." to SavePosn") + if (has("win32") || has("win95") || has("win64") || has("win16")) + let dirname = substitute(b:netrw_curdir,'\\','/','ge') else - " clear explore -" call Decho("case a:0=".a:0.": clearing Explore list") - call s:NetrwClearExplore() -" call Dret("netrw#Explore : cleared list") - return + let dirname= b:netrw_curdir + endif + let newdir = a:newdir + let dolockout = 0 + + " set up o/s-dependent directory recognition pattern + if has("amiga") + let dirpat= '[\/:]$' + else + let dirpat= '[\/]$' endif +" call Decho("(NetrwBrowseChgDir) dirname<".dirname."> dirpat<".dirpat.">") -" call Decho("dirname<".dirname.">") - if dirname =~ '\.\./\=$' - let dirname= simplify(fnamemodify(dirname,':p:h')) - elseif dirname =~ '\.\.' || dirname == '.' - let dirname= simplify(fnamemodify(dirname,':p')) + if dirname !~ dirpat + " apparently vim is "recognizing" that it is in a directory and + " is removing the trailing "/". Bad idea, so let's put it back. + let dirname= dirname.'/' +" call Decho("(NetrwBrowseChgDir) adjusting dirname<".dirname.">") endif -" call Decho("dirname<".dirname."> (after simplify)") - if dirname =~ '/\*\*/' - " handle .../**/.../filepat -" call Decho("case Explore .../**/.../filepat") - let prefixdir= substitute(dirname,'^\(.\{-}\)\*\*.*$','\1','') - if prefixdir =~ '^/' || (prefixdir =~ '^\a:/' && (has("win32") || has("win95") || has("win64") || has("win16"))) - let b:netrw_curdir = prefixdir + if newdir !~ dirpat + " ------------------------------ + " NetrwBrowseChgDir: edit a file {{{3 + " ------------------------------ +" call Decho('(NetrwBrowseChgDir:edit-a-file) case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">") + + " save position for benefit of Rexplore + let s:rexposn_{bufnr("%")}= netrw#NetrwSavePosn() + +" call Decho("(NetrwBrowseChgDir:edit-a-file) setting s:rexposn_".bufnr("%")." to SavePosn") + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") && newdir !~ '^\(/\|\a:\)' + let dirname= s:NetrwTreeDir() + if dirname =~ '/$' + let dirname= dirname.newdir + else + let dirname= s:NetrwTreeDir()."/".newdir + endif +" call Decho("(NetrwBrowseChgDir:edit-a-file) dirname<".dirname.">") +" call Decho("(NetrwBrowseChgDir:edit-a-file) tree listing") + elseif newdir =~ '^\(/\|\a:\)' + let dirname= newdir else - let b:netrw_curdir= getcwd().'/'.prefixdir + let dirname= s:ComposePath(dirname,newdir) endif - let dirname= substitute(dirname,'^.\{-}\(\*\*/.*\)$','\1','') - let starpat= 4; -" call Decho("pwd<".getcwd()."> dirname<".dirname.">") -" call Decho("case Explore ../**/../filepat (starpat=".starpat.")") +" call Decho("(NetrwBrowseChgDir:edit-a-file) handling a file: dirname<".dirname."> (a:0=".a:0.")") + " this lets NetrwBrowseX avoid the edit + if a:0 < 1 +" call Decho("(NetrwBrowseChgDir:edit-a-file) set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist")) + keepj call s:NetrwOptionRestore("s:") + if !exists("s:didsplit") +" call Decho("(NetrwBrowseChgDir:edit-a-file) s:didsplit does not exist; g:netrw_browse_split=".g:netrw_browse_split." win#".winnr()) + if g:netrw_browse_split == 1 + " horizontally splitting the window first + keepalt new + if !&ea + keepalt wincmd _ + endif + elseif g:netrw_browse_split == 2 + " vertically splitting the window first + keepalt rightb vert new + if !&ea + keepalt wincmd | + endif + elseif g:netrw_browse_split == 3 + " open file in new tab + keepalt tabnew + elseif g:netrw_browse_split == 4 + " act like "P" (ie. open previous window) + if s:NetrwPrevWinOpen(2) == 3 + let @@= ykeep +" call Dret("s:NetrwBrowseChgDir") + return + endif + else + " handling a file, didn't split, so remove menu +" call Decho("(NetrwBrowseChgDir:edit-a-file) handling a file+didn't split, so remove menu") + call s:NetrwMenu(0) + " optional change to window + if g:netrw_chgwin >= 1 + exe "keepj keepalt ".g:netrw_chgwin."wincmd w" + endif + endif + endif - elseif dirname =~ '^\*//' - " starpat=1: Explore *//pattern (current directory only search for files containing pattern) -" call Decho("case Explore *//pattern") - let pattern= substitute(dirname,'^\*//\(.*\)$','\1','') - let starpat= 1 -" call Decho("Explore *//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">") - if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif + " the point where netrw actually edits the (local) file + " if its local only: LocalBrowseCheck() doesn't edit a file, but NetrwBrowse() will + if a:islocal +" call Decho("(NetrwBrowseChgDir:edit-a-file) edit local file: exe e! ".fnameescape(dirname)) + exe "keepj keepalt e! ".fnameescape(dirname) + call s:NetrwCursor() + else +" call Decho("(NetrwBrowseChgDir:edit-a-file) remote file: NetrwBrowse will edit it") + endif + let dolockout= 1 - elseif dirname =~ '^\*\*//' - " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) -" call Decho("case Explore **//pattern") - let pattern= substitute(dirname,'^\*\*//','','') - let starpat= 2 -" call Decho("Explore **//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">") + " handle g:Netrw_funcref -- call external-to-netrw functions + " This code will handle g:Netrw_funcref as an individual function reference + " or as a list of function references. It will ignore anything that's not + " a function reference. See :help Funcref for information about function references. + if exists("g:Netrw_funcref") +" call Decho("(NetrwBrowseChgDir:edit-a-file) handle optional Funcrefs") + if type(g:Netrw_funcref) == 2 +" call Decho("(NetrwBrowseChgDir:edit-a-file) handling a g:Netrw_funcref") + keepj call g:Netrw_funcref() + elseif type(g:Netrw_funcref) == 3 +" call Decho("(NetrwBrowseChgDir:edit-a-file) handling a list of g:Netrw_funcrefs") + for Fncref in g:Netrw_funcref + if type(FncRef) == 2 + keepj call FncRef() + endif + endfor + endif + endif + endif - elseif dirname =~ '^\*/' - " starpat=3: Explore */filepat (search in current directory for filenames matching filepat) - let starpat= 3 -" call Decho("case Explore */filepat (starpat=".starpat.")") + elseif newdir =~ '^/' + " ---------------------------------------------------- + " NetrwBrowseChgDir: just go to the new directory spec {{{3 + " ---------------------------------------------------- +" call Decho('(NetrwBrowseChgDir:goto-newdir) case "just go to new directory spec": newdir<'.newdir.'>') + let dirname = newdir + keepj call s:SetRexDir(a:islocal,dirname) + keepj call s:NetrwOptionRestore("s:") - elseif dirname=~ '^\*\*/' - " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) - let starpat= 4 -" call Decho("case Explore **/filepat (starpat=".starpat.")") + elseif newdir == './' + " --------------------------------------------- + " NetrwBrowseChgDir: refresh the directory list {{{3 + " --------------------------------------------- +" call Decho('(NetrwBrowseChgDir:refresh-dirlist) case "refresh directory listing": newdir == "./"') + keepj call s:SetRexDir(a:islocal,dirname) - else - let starpat= 0 -" call Decho("default case: starpat=".starpat) - endif + elseif newdir == '../' + " -------------------------------------- + " NetrwBrowseChgDir: go up one directory {{{3 + " -------------------------------------- +" call Decho('(NetrwBrowseChgDir:go-up) case "go up one directory": newdir == "../"') - if starpat == 0 && a:indx >= 0 - " [Explore Hexplore Vexplore Sexplore] [dirname] -" call Decho("case starpat==0 && a:indx=".a:indx.": dirname<".dirname."> Explore Hexplore Vexplore Sexplore") - if dirname == "" - let dirname= curfiledir -" call Decho("empty dirname, using current file's directory<".dirname.">") + if w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") + " force a refresh +" call Decho("(NetrwBrowseChgDir:go-up) clear buffer<".expand("%")."> with :%d") +" call Decho("(NetrwBrowseChgDir:go-up) setl noro ma") + setl noro ma + keepj %d endif - if dirname =~ '^scp:' || dirname =~ '^ftp:' -" call Decho("calling NetrwBrowse(0,dirname<".dirname.">)") - call s:NetrwBrowse(0,dirname) + + if has("amiga") + " amiga +" call Decho('(NetrwBrowseChgDir:go-up) case "go up one directory": newdir == "../" and amiga') + if a:islocal + let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+$\)','\1','') + let dirname= substitute(dirname,'/$','','') + else + let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+/$\)','\1','') + endif +" call Decho("(NetrwBrowseChgDir:go-up) amiga: dirname<".dirname."> (go up one dir)") + else - if dirname == ""|let dirname= getcwd()|endif -" call Decho("calling LocalBrowseCheck(dirname<".dirname.">)") - call netrw#LocalBrowseCheck(dirname) + " unix or cygwin +" call Decho('(NetrwBrowseChgDir:go-up) case "go up one directory": newdir == "../" and unix or cygwin') + if a:islocal + let dirname= substitute(dirname,'^\(.*\)/\([^/]\+\)/$','\1','') + if dirname == "" + let dirname= '/' + endif + else + let dirname= substitute(dirname,'^\(\a\+://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','') + endif +" call Decho("(NetrwBrowseChgDir:go-up) unix: dirname<".dirname."> (go up one dir)") endif + keepj call s:SetRexDir(a:islocal,dirname) -" call Decho("curdir<".curdir.">") - if has("win32") || has("win95") || has("win64") || has("win16") - keepj call search('\<'.substitute(curdir,'^.*[/\\]','','e').'\>','cW') - else - keepj call search('\<'.substitute(curdir,'^.*/','','e').'\>','cW') + elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") + " -------------------------------------- + " NetrwBrowseChgDir: Handle Tree Listing {{{3 + " -------------------------------------- +" call Decho('(NetrwBrowseChgDir:tree-list) case liststyle is TREELIST and w:netrw_treedict exists') + " force a refresh (for TREELIST, wait for NetrwTreeDir() to force the refresh) +" call Decho("(NetrwBrowseChgDir) (treelist) setl noro ma") + setl noro ma + if !(exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir")) +" call Decho("(NetrwBrowseChgDir) clear buffer<".expand("%")."> with :%d") + keepj %d endif + let treedir = s:NetrwTreeDir() + let s:treecurpos = nbcd_curpos + let haskey= 0 +" call Decho("(NetrwBrowseChgDir:tree-list) w:netrw_treedict<".string(w:netrw_treedict).">") - " starpat=1: Explore *//pattern (current directory only search for files containing pattern) - " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) - " starpat=3: Explore */filepat (search in current directory for filenames matching filepat) - " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) - elseif a:indx <= 0 - " Nexplore, Pexplore, Explore: handle starpat -" call Decho("case a:indx<=0: Nexplore, Pexplore, , starpat=".starpat." a:indx=".a:indx) - if !mapcheck("","n") && !mapcheck("","n") && exists("b:netrw_curdir") -" call Decho("set up and maps") - let s:didstarstar= 1 - nnoremap :Pexplore - nnoremap :Nexplore + " search treedict for tree dir as-is + if has_key(w:netrw_treedict,treedir) +" call Decho('(NetrwBrowseChgDir:tree-list) ....searched for treedir<'.treedir.'> : found it!') + let haskey= 1 + else +" call Decho('(NetrwBrowseChgDir:tree-list) ....searched for treedir<'.treedir.'> : not found') endif - if has("path_extra") -" call Decho("starpat=".starpat.": has +path_extra") - if !exists("w:netrw_explore_indx") - let w:netrw_explore_indx= 0 + " search treedict for treedir with a / appended + if !haskey && treedir !~ '/$' + if has_key(w:netrw_treedict,treedir."/") + let treedir= treedir."/" +" call Decho('(NetrwBrowseChgDir:tree-list) ....searched.for treedir<'.treedir.'> found it!') + let haskey = 1 + else +" call Decho('(NetrwBrowseChgDir:tree-list) ....searched for treedir<'.treedir.'/> : not found') endif + endif - let indx = a:indx -" call Decho("starpat=".starpat.": set indx= [a:indx=".indx."]") - - if indx == -1 - " Nexplore -" call Decho("case Nexplore with starpat=".starpat.": (indx=".indx.")") - if !exists("w:netrw_explore_list") " sanity check - call netrw#ErrorMsg(s:WARNING,"using Nexplore or improperly; see help for netrw-starstar",40) - sil! let @* = keepregstar - sil! let @+ = keepregstar - sil! let @/ = keepregslash -" call Dret("netrw#Explore") - return - endif - let indx= w:netrw_explore_indx - if indx < 0 | let indx= 0 | endif - if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif - let curfile= w:netrw_explore_list[indx] -" call Decho("indx=".indx." curfile<".curfile.">") - while indx < w:netrw_explore_listlen && curfile == w:netrw_explore_list[indx] - let indx= indx + 1 -" call Decho("indx=".indx." (Nexplore while loop)") - endwhile - if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif -" call Decho("Nexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx) - - elseif indx == -2 - " Pexplore -" call Decho("case Pexplore with starpat=".starpat.": (indx=".indx.")") - if !exists("w:netrw_explore_list") " sanity check - call netrw#ErrorMsg(s:WARNING,"using Pexplore or improperly; see help for netrw-starstar",41) - sil! let @* = keepregstar - sil! let @+ = keepregstar - sil! let @/ = keepregslash -" call Dret("netrw#Explore") - return - endif - let indx= w:netrw_explore_indx - if indx < 0 | let indx= 0 | endif - if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif - let curfile= w:netrw_explore_list[indx] -" call Decho("indx=".indx." curfile<".curfile.">") - while indx >= 0 && curfile == w:netrw_explore_list[indx] - let indx= indx - 1 -" call Decho("indx=".indx." (Pexplore while loop)") - endwhile - if indx < 0 | let indx= 0 | endif -" call Decho("Pexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx) - + " search treedict for treedir with any trailing / elided + if !haskey && treedir =~ '/$' + let treedir= substitute(treedir,'/$','','') + if has_key(w:netrw_treedict,treedir) +" call Decho('(NetrwBrowseChgDir:tree-list) ....searched.for treedir<'.treedir.'> found it!') + let haskey = 1 else - " Explore -- initialize - " build list of files to Explore with Nexplore/Pexplore -" call Decho("starpat=".starpat.": case Explore: initialize (indx=".indx.")") - call s:NetrwClearExplore() - let w:netrw_explore_indx= 0 - if !exists("b:netrw_curdir") - let b:netrw_curdir= getcwd() - endif -" call Decho("starpat=".starpat.": b:netrw_curdir<".b:netrw_curdir.">") - - " switch on starpat to build the w:netrw_explore_list of files - if starpat == 1 - " starpat=1: Explore *//pattern (current directory only search for files containing pattern) -" call Decho("starpat=".starpat.": build *//pattern list") -" call Decho("pattern<".pattern.">") - try - exe "keepj noautocmd vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*" - catch /^Vim\%((\a\+)\)\=:E480/ - call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76) -" call Dret("netrw#Explore : unable to find pattern<".pattern.">") - return - endtry - let w:netrw_explore_list = s:NetrwExploreListUniq(map(getqflist(),'bufname(v:val.bufnr)')) - if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif - - elseif starpat == 2 - " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) -" call Decho("starpat=".starpat.": build **//pattern list") - try - exe "sil keepj noautocmd vimgrep /".pattern."/gj "."**/*" - catch /^Vim\%((\a\+)\)\=:E480/ - call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45) - if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif - silent! let @* = keepregstar - silent! let @+ = keepregstar - silent! let @/ = keepregslash -" call Dret("netrw#Explore : no files matched pattern") - return - endtry - let s:netrw_curdir = b:netrw_curdir - let w:netrw_explore_list = getqflist() - let w:netrw_explore_list = s:NetrwExploreListUniq(map(w:netrw_explore_list,'s:netrw_curdir."/".bufname(v:val.bufnr)')) +" call Decho('(NetrwBrowseChgDir:tree-list) ....searched for treedir<'.treedir.'> : not found') + endif + endif - elseif starpat == 3 - " starpat=3: Explore */filepat (search in current directory for filenames matching filepat) -" call Decho("starpat=".starpat.": build */filepat list") - let filepat= substitute(dirname,'^\*/','','') - let filepat= substitute(filepat,'^[%#<]','\\&','') -" call Decho("b:netrw_curdir<".b:netrw_curdir.">") -" call Decho("filepat<".filepat.">") - let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".filepat),'\n')) - if &hls | let keepregslash= s:ExplorePatHls(filepat) | endif + if haskey + " close tree listing for selected subdirectory +" call Decho("(NetrwBrowseChgDir:tree-list) closing selected subdirectory<".dirname.">") + call remove(w:netrw_treedict,treedir) +" call Decho("(NetrwBrowseChgDir) removed entry<".treedir."> from treedict") +" call Decho("(NetrwBrowseChgDir) yielding treedict<".string(w:netrw_treedict).">") + let dirname= w:netrw_treetop + else + " go down one directory + let dirname= substitute(treedir,'/*$','/','') +" call Decho("(NetrwBrowseChgDir:tree-list) go down one dir: treedir<".treedir.">") + endif + keepj call s:SetRexDir(a:islocal,dirname) + let s:treeforceredraw = 1 - elseif starpat == 4 - " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) -" call Decho("starpat=".starpat.": build **/filepat list") - let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".dirname),'\n')) - if &hls | let keepregslash= s:ExplorePatHls(dirname) | endif - endif " switch on starpat to build w:netrw_explore_list + else + " ---------------------------------------- + " NetrwBrowseChgDir: Go down one directory {{{3 + " ---------------------------------------- + let dirname = s:ComposePath(dirname,newdir) +" call Decho("(NetrwBrowseChgDir:go-down) go down one dir: dirname<".dirname."> newdir<".newdir.">") + keepj call s:SetRexDir(a:islocal,dirname) + endif + + " -------------------------------------- + " NetrwBrowseChgDir: Restore and Cleanup {{{3 + " -------------------------------------- + keepj call s:NetrwOptionRestore("s:") + if dolockout +" call Decho("(NetrwBrowseChgDir:restore) filewritable(dirname<".dirname.">)=".filewritable(dirname)) + if filewritable(dirname) +" call Decho("(NetrwBrowseChgDir:restore) doing modification lockout settings: ma nomod noro") +" call Decho("(NetrwBrowseChgDir:restore) setl ma nomod noro") + setl ma nomod noro +" call Decho("(NetrwBrowseChgDir:restore) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") + else +" call Decho("(NetrwBrowseChgDir:restore) doing modification lockout settings: ma nomod ro") +" call Decho("(NetrwBrowseChgDir:restore) setl ma nomod noro") + setl ma nomod ro +" call Decho("(NetrwBrowseChgDir:restore) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") + endif + endif + let @@= ykeep - let w:netrw_explore_listlen = len(w:netrw_explore_list) -" call Decho("w:netrw_explore_list<".string(w:netrw_explore_list).">") -" call Decho("w:netrw_explore_listlen=".w:netrw_explore_listlen) +" call Dret("s:NetrwBrowseChgDir <".dirname."> : curpos<".string(getpos(".")).">") + return dirname +endfun - if w:netrw_explore_listlen == 0 || (w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/') - call netrw#ErrorMsg(s:WARNING,"no files matched",42) - sil! let @* = keepregstar - sil! let @+ = keepregstar - sil! let @/ = keepregslash -" call Dret("netrw#Explore : no files matched") - return - endif - endif " if indx ... endif +" --------------------------------------------------------------------- +" s:NetrwBrowseX: (implements "x") executes a special "viewer" script or program for the {{{2 +" given filename; typically this means given their extension. +" 0=local, 1=remote +fun! netrw#NetrwBrowseX(fname,remote) +" call Dfunc("NetrwBrowseX(fname<".a:fname."> remote=".a:remote.")") - " NetrwStatusLine support - for exploring support - let w:netrw_explore_indx= indx -" call Decho("w:netrw_explore_list<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen) + let ykeep = @@ + let screenposn = netrw#NetrwSavePosn() - " wrap the indx around, but issue a note - if indx >= w:netrw_explore_listlen || indx < 0 -" call Decho("wrap indx (indx=".indx." listlen=".w:netrw_explore_listlen.")") - let indx = (indx < 0)? ( w:netrw_explore_listlen - 1 ) : 0 - let w:netrw_explore_indx= indx - call netrw#ErrorMsg(s:NOTE,"no more files match Explore pattern",43) + " special core dump handler + if a:fname =~ '/core\(\.\d\+\)\=$' + if exists("g:Netrw_corehandler") + if type(g:Netrw_corehandler) == 2 + " g:Netrw_corehandler is a function reference (see :help Funcref) +" call Decho("g:Netrw_corehandler is a funcref") + call g:Netrw_corehandler(a:fname) + elseif type(g:Netrw_corehandler) == 3 + " g:Netrw_corehandler is a List of function references (see :help Funcref) +" call Decho("g:Netrw_corehandler is a List") + for Fncref in g:Netrw_corehandler + if type(FncRef) == 2 + call FncRef(a:fname) + endif + endfor endif + call netrw#NetrwRestorePosn(screenposn) + let @@= ykeep +" call Dret("NetrwBrowseX : coredump handler invoked") + return + endif + endif - exe "let dirfile= w:netrw_explore_list[".indx."]" -" call Decho("dirfile=w:netrw_explore_list[indx=".indx."]= <".dirfile.">") - let newdir= substitute(dirfile,'/[^/]*$','','e') -" call Decho("newdir<".newdir.">") + " set up the filename + " (lower case the extension, make a local copy of a remote file) + let exten= substitute(a:fname,'.*\.\(.\{-}\)','\1','e') + if has("win32") || has("win95") || has("win64") || has("win16") + let exten= substitute(exten,'^.*$','\L&\E','') + endif +" call Decho("exten<".exten.">") -" call Decho("calling LocalBrowseCheck(newdir<".newdir.">)") - call netrw#LocalBrowseCheck(newdir) - if !exists("w:netrw_liststyle") - let w:netrw_liststyle= g:netrw_liststyle - endif - if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:LONGLIST - keepj call search('^'.substitute(dirfile,"^.*/","","").'\>',"W") - else - keepj call search('\<'.substitute(dirfile,"^.*/","","").'\>',"w") + " seems kde systems often have gnome-open due to dependencies, even though + " gnome-open's subsidiary display tools are largely absent. Kde systems + " usually have "kdeinit" running, though... (tnx Mikolaj Machowski) + if !exists("s:haskdeinit") + if has("unix") && executable("ps") && !has("win32unix") + let s:haskdeinit= system("ps -e") =~ 'kdeinit' + if v:shell_error + let s:haskdeinit = 0 endif - let w:netrw_explore_mtchcnt = indx + 1 - let w:netrw_explore_bufnr = bufnr("%") - let w:netrw_explore_line = line(".") - call s:SetupNetrwStatusLine('%f %h%m%r%=%9*%{NetrwStatusLine()}') -" call Decho("explore: mtchcnt=".w:netrw_explore_mtchcnt." bufnr=".w:netrw_explore_bufnr." line#".w:netrw_explore_line) - else -" call Decho("your vim does not have +path_extra") - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:WARNING,"your vim needs the +path_extra feature for Exploring with **!",44) - endif - sil! let @* = keepregstar - sil! let @+ = keepregstar - sil! let @/ = keepregslash -" call Dret("netrw#Explore : missing +path_extra") - return + let s:haskdeinit= 0 endif +" call Decho("setting s:haskdeinit=".s:haskdeinit) + endif + if a:remote == 1 + " create a local copy +" call Decho("(remote) a:remote=".a:remote.": create a local copy of <".a:fname.">") + setl bh=delete + call netrw#NetRead(3,a:fname) + " attempt to rename tempfile + let basename= substitute(a:fname,'^\(.*\)/\(.*\)\.\([^.]*\)$','\2','') + let newname = substitute(s:netrw_tmpfile,'^\(.*\)/\(.*\)\.\([^.]*\)$','\1/'.basename.'.\3','') +" call Decho("basename<".basename.">") +" call Decho("newname <".newname.">") + if rename(s:netrw_tmpfile,newname) == 0 + " renaming succeeded + let fname= newname + else + " renaming failed + let fname= s:netrw_tmpfile + endif else -" call Decho("default case: Explore newdir<".dirname.">") - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && dirname =~ '/' - sil! unlet w:netrw_treedict - sil! unlet w:netrw_treetop +" call Decho("(local) a:remote=".a:remote.": handling local copy of <".a:fname.">") + let fname= a:fname + " special ~ handler for local + if fname =~ '^\~' && expand("$HOME") != "" +" call Decho('invoking special ~ handler') + let fname= substitute(fname,'^\~',expand("$HOME"),'') endif - let newdir= dirname - if !exists("b:netrw_curdir") - call netrw#LocalBrowseCheck(getcwd()) + endif +" call Decho("fname<".fname.">") +" call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten)) + + " set up redirection + if &srr =~ "%s" + if (has("win32") || has("win95") || has("win64") || has("win16")) + let redir= substitute(&srr,"%s","nul","") else - call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,newdir)) + let redir= substitute(&srr,"%s","/dev/null","") endif + elseif (has("win32") || has("win95") || has("win64") || has("win16")) + let redir= &srr . "nul" + else + let redir= &srr . "/dev/null" endif +" call Decho("set up redirection: redir{".redir."} srr{".&srr."}") - " visual display of **/ **// */ Exploration files -" call Decho("w:netrw_explore_indx=".(exists("w:netrw_explore_indx")? w:netrw_explore_indx : "doesn't exist")) -" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "n/a").">") - if exists("w:netrw_explore_indx") && exists("b:netrw_curdir") -" call Decho("s:explore_prvdir<".(exists("s:explore_prvdir")? s:explore_prvdir : "-doesn't exist-")) - if !exists("s:explore_prvdir") || s:explore_prvdir != b:netrw_curdir - " only update match list if current directory isn't the same as before -" call Decho("only update match list if current directory not the same as before") - let s:explore_prvdir = b:netrw_curdir - let s:explore_match = "" - let dirlen = s:Strlen(b:netrw_curdir) - if b:netrw_curdir !~ '/$' - let dirlen= dirlen + 1 - endif - let prvfname= "" - for fname in w:netrw_explore_list -" call Decho("fname<".fname.">") - if fname =~ '^'.b:netrw_curdir - if s:explore_match == "" - let s:explore_match= '\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>' - else - let s:explore_match= s:explore_match.'\|\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>' - endif - elseif fname !~ '^/' && fname != prvfname - if s:explore_match == "" - let s:explore_match= '\<'.escape(fname,g:netrw_markfileesc).'\>' - else - let s:explore_match= s:explore_match.'\|\<'.escape(fname,g:netrw_markfileesc).'\>' - endif - endif - let prvfname= fname - endfor -" call Decho("explore_match<".s:explore_match.">") - exe "2match netrwMarkFile /".s:explore_match."/" + " extract any viewing options. Assumes that they're set apart by quotes. +" call Decho("extract any viewing options") + if exists("g:netrw_browsex_viewer") +" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") + if g:netrw_browsex_viewer =~ '\s' + let viewer = substitute(g:netrw_browsex_viewer,'\s.*$','','') + let viewopt = substitute(g:netrw_browsex_viewer,'^\S\+\s*','','')." " + let oviewer = '' + let cnt = 1 + while !executable(viewer) && viewer != oviewer + let viewer = substitute(g:netrw_browsex_viewer,'^\(\(^\S\+\s\+\)\{'.cnt.'}\S\+\)\(.*\)$','\1','') + let viewopt = substitute(g:netrw_browsex_viewer,'^\(\(^\S\+\s\+\)\{'.cnt.'}\S\+\)\(.*\)$','\3','')." " + let cnt = cnt + 1 + let oviewer = viewer +" call Decho("!exe: viewer<".viewer."> viewopt<".viewopt.">") + endwhile + else + let viewer = g:netrw_browsex_viewer + let viewopt = "" endif - echo "==Pexplore ==Nexplore" +" call Decho("viewer<".viewer."> viewopt<".viewopt.">") + endif + + " execute the file handler +" call Decho("execute the file handler (if any)") + if exists("g:netrw_browsex_viewer") && g:netrw_browsex_viewer == '-' +" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") + let ret= netrwFileHandlers#Invoke(exten,fname) + + elseif exists("g:netrw_browsex_viewer") && executable(viewer) +" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") +" call Decho("exe sil !".viewer." ".viewopt.shellescape(fname,1).redir) + exe "sil !".viewer." ".viewopt.shellescape(fname,1).redir + let ret= v:shell_error + + elseif has("win32") || has("win64") +" call Decho("windows") + if executable("start") +" call Decho('exe sil !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)) + exe 'sil !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1) + elseif executable("rundll32") +" call Decho('exe sil !rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)) + exe 'sil !rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1) + else + call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74) + endif + call inputsave()|call input("Press to continue")|call inputrestore() + let ret= v:shell_error + + elseif has("win32unix") + let winfname= 'c:\cygwin'.substitute(fname,'/','\\','g') +" call Decho("cygwin: winfname<".shellescape(winfname,1).">") + if executable("start") +" call Decho('exe sil !start rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1)) + exe 'sil !start rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1) + elseif executable("rundll32") +" call Decho('exe sil !rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1)) + exe 'sil !rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1) + else + call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74) + endif + call inputsave()|call input("Press to continue")|call inputrestore() + let ret= v:shell_error + + elseif has("unix") && executable("xdg-open") && !s:haskdeinit +" call Decho("unix and xdg-open") +" call Decho("exe sil !xdg-open ".shellescape(fname,1)." ".redir) + exe "sil !xdg-open ".shellescape(fname,1).redir + let ret= v:shell_error + + elseif has("unix") && executable("kfmclient") && s:haskdeinit +" call Decho("unix and kfmclient") +" call Decho("exe sil !kfmclient exec ".shellescape(fname,1)." ".redir) + exe "sil !kfmclient exec ".shellescape(fname,1)." ".redir + let ret= v:shell_error + + elseif has("macunix") && executable("open") +" call Decho("macunix and open") +" call Decho("exe sil !open ".shellescape(fname,1)." ".redir) + exe "sil !open ".shellescape(fname,1)." ".redir + let ret= v:shell_error + else - 2match none - if exists("s:explore_match") | unlet s:explore_match | endif - if exists("s:explore_prvdir") | unlet s:explore_prvdir | endif - echo " " -" call Decho("cleared explore match list") + " netrwFileHandlers#Invoke() always returns 0 + let ret= netrwFileHandlers#Invoke(exten,fname) endif - sil! let @* = keepregstar - sil! let @+ = keepregstar - sil! let @/ = keepregslash -" call Dret("netrw#Explore : @/<".@/.">") + " if unsuccessful, attempt netrwFileHandlers#Invoke() + if ret + let ret= netrwFileHandlers#Invoke(exten,fname) + endif + + " restoring redraw! after external file handlers + redraw! + + " cleanup: remove temporary file, + " delete current buffer if success with handler, + " return to prior buffer (directory listing) + " Feb 12, 2008: had to de-activiate removal of + " temporary file because it wasn't getting seen. +" if a:remote == 1 && fname != a:fname +"" call Decho("deleting temporary file<".fname.">") +" call s:NetrwDelete(fname) +" endif + + if a:remote == 1 + setl bh=delete bt=nofile + if g:netrw_use_noswf + setl noswf + endif + exe "sil! keepj norm! \" +" redraw! + endif + call netrw#NetrwRestorePosn(screenposn) + let @@= ykeep + +" call Dret("NetrwBrowseX") +endfun + +" --------------------------------------------------------------------- +" s:NetrwChgPerm: (implements "gp") change file permission {{{2 +fun! s:NetrwChgPerm(islocal,curdir) +" call Dfunc("s:NetrwChgPerm(islocal=".a:islocal." curdir<".a:curdir.">)") + let ykeep = @@ + call inputsave() + let newperm= input("Enter new permission: ") + call inputrestore() + let chgperm= substitute(g:netrw_chgperm,'\',shellescape(expand("")),'') + let chgperm= substitute(chgperm,'\',shellescape(newperm),'') +" call Decho("chgperm<".chgperm.">") + call system(chgperm) + if v:shell_error != 0 + keepj call netrw#ErrorMsg(1,"changing permission on file<".expand("")."> seems to have failed",75) + endif + if a:islocal + keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + endif + let @@= ykeep +" call Dret("s:NetrwChgPerm") +endfun + +" --------------------------------------------------------------------- +" s:NetrwClearExplore: clear explore variables (if any) {{{2 +fun! s:NetrwClearExplore() +" call Dfunc("s:NetrwClearExplore()") + 2match none + if exists("s:explore_match") |unlet s:explore_match |endif + if exists("s:explore_indx") |unlet s:explore_indx |endif + if exists("s:netrw_explore_prvdir") |unlet s:netrw_explore_prvdir |endif + if exists("s:dirstarstar") |unlet s:dirstarstar |endif + if exists("s:explore_prvdir") |unlet s:explore_prvdir |endif + if exists("w:netrw_explore_indx") |unlet w:netrw_explore_indx |endif + if exists("w:netrw_explore_listlen")|unlet w:netrw_explore_listlen|endif + if exists("w:netrw_explore_list") |unlet w:netrw_explore_list |endif + if exists("w:netrw_explore_bufnr") |unlet w:netrw_explore_bufnr |endif +" redraw! + echo " " + echo " " +" call Dret("s:NetrwClearExplore") endfun " --------------------------------------------------------------------- " s:NetrwExploreListUniq: {{{2 fun! s:NetrwExploreListUniq(explist) -" call Dfunc("s:NetrwExploreListUniq(explist)") +" call Dfunc("s:NetrwExploreListUniq(explist<".string(a:explist).">)") " this assumes that the list is already sorted let newexplist= [] @@ -3939,11 +4845,53 @@ fun! s:NetrwExploreListUniq(explist) endif endfor -" call Dret("s:NetrwExploreListUniq") +" call Dret("s:NetrwExploreListUniq newexplist<".string(newexplist).">") return newexplist endfun " --------------------------------------------------------------------- +" s:NetrwForceChgDir: (gd support) Force treatment as a directory {{{2 +fun! s:NetrwForceChgDir(islocal,newdir) +" call Dfunc("s:NetrwForceChgDir(islocal=".a:islocal." newdir<".a:newdir.">)") + let ykeep= @@ + if a:newdir !~ '/$' + " ok, looks like force is needed to get directory-style treatment + if a:newdir =~ '@$' + let newdir= substitute(a:newdir,'@$','/','') + elseif a:newdir =~ '[*=|\\]$' + let newdir= substitute(a:newdir,'.$','/','') + else + let newdir= a:newdir.'/' + endif +" call Decho("adjusting newdir<".newdir."> due to gd") + else + " should already be getting treatment as a directory + let newdir= a:newdir + endif + let newdir= s:NetrwBrowseChgDir(a:islocal,newdir) + call s:NetrwBrowse(a:islocal,newdir) + let @@= ykeep +" call Dret("s:NetrwForceChgDir") +endfun + +" --------------------------------------------------------------------- +" s:NetrwForceFile: (gf support) Force treatment as a file {{{2 +fun! s:NetrwForceFile(islocal,newfile) +" call Dfunc("s:NetrwForceFile(islocal=".a:islocal." newdir<".a:newfile.">)") + if a:newfile =~ '[/@*=|\\]$' + let newfile= substitute(a:newfile,'.$','','') + else + let newfile= a:newfile + endif + if a:islocal + call s:NetrwBrowseChgDir(a:islocal,newfile) + else + call s:NetrwBrowse(a:islocal,s:NetrwBrowseChgDir(a:islocal,newfile)) + endif +" call Dret("s:NetrwForceFile") +endfun + +" --------------------------------------------------------------------- " s:NetrwHide: this function is invoked by the "a" map for browsing {{{2 " and switches the hiding mode. The actual hiding is done by " s:NetrwListHide(). @@ -3952,6 +4900,7 @@ endfun " 2: show hidden files only fun! s:NetrwHide(islocal) " call Dfunc("NetrwHide(islocal=".a:islocal.") g:netrw_hide=".g:netrw_hide) + let ykeep= @@ let svpos= netrw#NetrwSavePosn() if exists("s:netrwmarkfilelist_{bufnr('%')}") @@ -3960,7 +4909,7 @@ fun! s:NetrwHide(islocal) " hide the files in the markfile list for fname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("match(g:netrw_list_hide<".g:netrw_list_hide.'> fname<\<'.fname.'\>>)='.match(g:netrw_list_hide,'\<'.fname.'\>')." isk=".&isk) +" call Decho("match(g:netrw_list_hide<".g:netrw_list_hide.'> fname<\<'.fname.'\>>)='.match(g:netrw_list_hide,'\<'.fname.'\>')." l:isk=".&l:isk) if match(g:netrw_list_hide,'\<'.fname.'\>') != -1 " remove fname from hiding list let g:netrw_list_hide= substitute(g:netrw_list_hide,'..\<'.escape(fname,g:netrw_fname_escape).'\>..','','') @@ -3977,7 +4926,7 @@ fun! s:NetrwHide(islocal) " call Decho("hide: g:netrw_list_hide<".g:netrw_list_hide.">") endif endfor - call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) + keepj call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) let g:netrw_hide= 1 else @@ -3986,14 +4935,16 @@ fun! s:NetrwHide(islocal) let g:netrw_hide=(g:netrw_hide+1)%3 exe "keepj norm! 0" if g:netrw_hide && g:netrw_list_hide == "" - call netrw#ErrorMsg(s:WARNING,"your hiding list is empty!",49) + keepj call netrw#ErrorMsg(s:WARNING,"your hiding list is empty!",49) + let @@= ykeep " call Dret("NetrwHide") return endif endif - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - call netrw#NetrwRestorePosn(svpos) + keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + keepj call netrw#NetrwRestorePosn(svpos) + let @@= ykeep " call Dret("NetrwHide") endfun @@ -4001,6 +4952,7 @@ endfun " s:NetrwHidden: invoked by "gh" {{{2 fun! s:NetrwHidden(islocal) " call Dfunc("s:NetrwHidden()") + let ykeep= @@ " save current position let svpos= netrw#NetrwSavePosn() @@ -4014,8 +4966,9 @@ fun! s:NetrwHidden(islocal) endif " refresh screen and return to saved position - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - call netrw#NetrwRestorePosn(svpos) + keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + keepj call netrw#NetrwRestorePosn(svpos) + let @@= ykeep " call Dret("s:NetrwHidden") endfun @@ -4043,7 +4996,7 @@ fun! s:NetrwHome() endif endif " insure that the home directory exists - if !isdirectory(home) + if g:netrw_dirhistmax > 0 && !isdirectory(home) if exists("g:netrw_mkdir") call system(g:netrw_mkdir." ".shellescape(home)) else @@ -4057,11 +5010,18 @@ endfun " --------------------------------------------------------------------- " s:NetrwLeftmouse: handles the when in a netrw browsing window {{{2 fun! s:NetrwLeftmouse(islocal) + if exists("s:netrwdrag") + return + endif " call Dfunc("s:NetrwLeftmouse(islocal=".a:islocal.")") + let ykeep= @@ " check if the status bar was clicked on instead of a file/directory name + while getchar(0) != 0 + "clear the input stream + endwhile call feedkeys("\") - let c= getchar() + let c = getchar() let mouse_lnum = v:mouse_lnum let wlastline = line('w$') let lastline = line('$') @@ -4069,31 +5029,76 @@ fun! s:NetrwLeftmouse(islocal) " call Decho("v:mouse_col =".v:mouse_col." col=".col(".")." wincol =".wincol()." winwidth =".winwidth(0)) if mouse_lnum >= wlastline + 1 || v:mouse_win != winnr() " appears to be a status bar leftmouse click + let @@= ykeep " call Dret("s:NetrwLeftmouse : detected a status bar leftmouse click") return endif if v:mouse_col != col('.') + let @@= ykeep " call Dret("s:NetrwLeftmouse : detected a vertical separator bar leftmouse click") return endif if a:islocal if exists("b:netrw_curdir") - call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) + keepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) endif else if exists("b:netrw_curdir") - call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) + keepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) endif endif + let @@= ykeep " call Dret("s:NetrwLeftmouse") endfun " --------------------------------------------------------------------- +" s:NetrwRightdrag: {{{2 +"DechoTabOn +fun! s:NetrwRightdrag(islocal) +" call Dfunc("s:NetrwRightdrag(islocal=".a:islocal.")") + if !exists("s:netrwdrag") + let s:netrwdrag = winnr() + call s:NetrwMarkFile(a:islocal,s:NetrwGetWord()) + if a:islocal + nno :call NetrwRightrelease(1) + else + nno :call NetrwRightrelease(0) + endif + endif +" call Dret("s:NetrwRightdrag : s:netrwdrag=".s:netrwdrag." buf#".bufnr("%")) +endfun + +" --------------------------------------------------------------------- +" s:NetrwRightrelease: {{{2 +fun! s:NetrwRightrelease(islocal) +" call Dfunc("s:NetrwRightrelease(islocal=".a:islocal.") s:netrwdrag=".s:netrwdrag." buf#".bufnr("%")) + if exists("s:netrwdrag") + nunmap + let tgt = s:NetrwGetWord() +" call Decho("target#1: ".tgt) + if tgt =~ '/$' && tgt !~ '^\./$' + let tgt = b:netrw_curdir."/".tgt + else + let tgt= b:netrw_curdir + endif +" call Decho("target#2: ".tgt) + call netrw#NetrwMakeTgt(tgt) + let curwin= winnr() + exe s:netrwdrag."wincmd w" + call s:NetrwMarkFileMove(a:islocal) + exe curwin."wincmd w" + unlet s:netrwdrag + endif +" call Dret("s:NetrwRightrelease") +endfun + +" --------------------------------------------------------------------- " s:NetrwListHide: uses [range]g~...~d to delete files that match comma {{{2 " separated patterns given in g:netrw_list_hide fun! s:NetrwListHide() -" call Dfunc("NetrwListHide() hide=".g:netrw_hide." listhide<".g:netrw_list_hide.">") +" call Dfunc("NetrwListHide() g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">") + let ykeep= @@ " find a character not in the "hide" string to use as a separator for :g and :v commands " How-it-works: take the hiding command, convert it into a range. Duplicate @@ -4115,17 +5120,22 @@ fun! s:NetrwListHide() " Prune the list by hiding any files which match if g:netrw_hide == 1 " call Decho("hiding<".hide."> listhide<".listhide.">") - exe 'sil keepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d' + exe 'sil! keepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d' elseif g:netrw_hide == 2 " call Decho("showing<".hide."> listhide<".listhide.">") - exe 'sil keepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'s@^@ /-KEEP-/ @' + exe 'sil! keepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'s@^@ /-KEEP-/ @' endif endwhile if g:netrw_hide == 2 - exe 'sil keepj '.w:netrw_bannercnt.',$v@^ /-KEEP-/ @d' - exe 'sil keepj '.w:netrw_bannercnt.',$s@^\%( /-KEEP-/ \)\+@@e' + exe 'sil! keepj '.w:netrw_bannercnt.',$v@^ /-KEEP-/ @d' + exe 'sil! keepj '.w:netrw_bannercnt.',$s@^\%( /-KEEP-/ \)\+@@e' endif + " remove any blank lines that have somehow remained. + " This seems to happen under Windows. + exe 'sil! keepj 1,$g@^\s*$@d' + + let @@= ykeep " call Dret("NetrwListHide") endfun @@ -4134,6 +5144,7 @@ endfun fun! s:NetrwHideEdit(islocal) " call Dfunc("NetrwHideEdit(islocal=".a:islocal.")") + let ykeep= @@ " save current cursor position let svpos= netrw#NetrwSavePosn() @@ -4145,10 +5156,11 @@ fun! s:NetrwHideEdit(islocal) " call Decho("new g:netrw_list_hide<".g:netrw_list_hide.">") " refresh the listing - silent keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,"./")) + sil keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,"./")) " restore cursor position call netrw#NetrwRestorePosn(svpos) + let @@= ykeep " call Dret("NetrwHideEdit") endfun @@ -4158,6 +5170,7 @@ endfun fun! s:NetSortSequence(islocal) " call Dfunc("NetSortSequence(islocal=".a:islocal.")") + let ykeep= @@ let svpos= netrw#NetrwSavePosn() call inputsave() let newsortseq= input("Edit Sorting Sequence: ",g:netrw_sort_sequence) @@ -4165,8 +5178,9 @@ fun! s:NetSortSequence(islocal) " refresh the listing let g:netrw_sort_sequence= newsortseq - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - call netrw#NetrwRestorePosn(svpos) + keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + keepj call netrw#NetrwRestorePosn(svpos) + let @@= ykeep " call Dret("NetSortSequence") endfun @@ -4176,6 +5190,7 @@ endfun fun! s:NetrwMakeDir(usrhost) " call Dfunc("NetrwMakeDir(usrhost<".a:usrhost.">)") + let ykeep= @@ " get name of new directory from user. A bare will skip. " if its currently a directory, also request will be skipped, but with " a message. @@ -4185,6 +5200,7 @@ fun! s:NetrwMakeDir(usrhost) " call Decho("newdirname<".newdirname.">") if newdirname == "" + let @@= ykeep " call Dret("NetrwMakeDir : user aborted with bare ") return endif @@ -4198,15 +5214,17 @@ fun! s:NetrwMakeDir(usrhost) " call Decho("fullnewdir<".fullnewdir.">") if isdirectory(fullnewdir) if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a directory!",24) + keepj call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a directory!",24) endif + let @@= ykeep " call Dret("NetrwMakeDir : directory<".newdirname."> exists previously") return endif if s:FileReadable(fullnewdir) if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a file!",25) + keepj call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a file!",25) endif + let @@= ykeep " call Dret("NetrwMakeDir : file<".newdirname."> exists previously") return endif @@ -4219,8 +5237,14 @@ fun! s:NetrwMakeDir(usrhost) let netrw_origdir= s:NetrwGetcwd(1) exe 'keepj lcd '.fnameescape(b:netrw_curdir) " call Decho("netrw_origdir<".netrw_origdir.">: lcd b:netrw_curdir<".fnameescape(b:netrw_curdir).">") -" call Decho("exe silent! !".g:netrw_local_mkdir.' '.shellescape(newdirname,1)) - exe "sil! !".g:netrw_local_mkdir.' '.shellescape(newdirname,1) +" call Decho("exe sil! !".g:netrw_localmkdir.' '.shellescape(newdirname,1)) + exe "sil! !".g:netrw_localmkdir.' '.shellescape(newdirname,1) + if v:shell_error != 0 + let @@= ykeep + call netrw#ErrorMsg(s:ERROR,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",80) +" call Dret("NetrwMakeDir : failed: sil! !".g:netrw_localmkdir.' '.shellescape(newdirname,1)) + return + endif if !g:netrw_keepdir exe 'keepj lcd '.fnameescape(netrw_origdir) " call Decho("netrw_keepdir=".g:netrw_keepdir.": keepjumps lcd ".fnameescape(netrw_origdir)." getcwd<".getcwd().">") @@ -4243,26 +5267,31 @@ fun! s:NetrwMakeDir(usrhost) " call Decho("remote mkdir") let mkdircmd = s:MakeSshCmd(g:netrw_mkdir_cmd) let newdirname= substitute(b:netrw_curdir,'^\%(.\{-}/\)\{3}\(.*\)$','\1','').newdirname -" call Decho("exe silent! !".mkdircmd." ".shellescape(newdirname,1)) +" call Decho("exe sil! !".mkdircmd." ".shellescape(newdirname,1)) exe "sil! !".mkdircmd." ".shellescape(newdirname,1) if v:shell_error == 0 " refresh listing let svpos= netrw#NetrwSavePosn() - call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) - call netrw#NetrwRestorePosn(svpos) + keepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) + keepj call netrw#NetrwRestorePosn(svpos) elseif !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",27) + keepj call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",27) endif " redraw! elseif b:netrw_method == 2 - " COMBAK -- future work - call netrw#ErrorMsg(s:ERROR,"making directories via ftp not currently supported",68) + let svpos= netrw#NetrwSavePosn() + call s:NetrwRemoteFtpCmd("",g:netrw_remote_mkdir.' "'.newdirname.'"') + keepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) + keepj call netrw#NetrwRestorePosn(svpos) elseif b:netrw_method == 3 - " COMBAK -- future work - call netrw#ErrorMsg(s:ERROR,"making directories via ftp not currently supported",68) + let svpos= netrw#NetrwSavePosn() + call s:NetrwRemoteFtpCmd("",g:netrw_remote_mkdir.' "'.newdirname.'"') + keepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) + keepj call netrw#NetrwRestorePosn(svpos) endif + let @@= ykeep " call Dret("NetrwMakeDir") endfun @@ -4283,14 +5312,22 @@ endfun " " Creates a buffer version of islocal " b:netrw_islocal -" fun! s:NetrwMarkFile(islocal,fname) " call Dfunc("s:NetrwMarkFile(islocal=".a:islocal." fname<".a:fname.">)") + + " sanity check + if empty(a:fname) +" call Dret("s:NetrwMarkFile : emtpy fname") + return + endif + + let ykeep = @@ let curbufnr= bufnr("%") let curdir = b:netrw_curdir - let trailer = '[@=|\/\*]\=\>' + let trailer = '[@=|\/\*]\=\ze\%( \|\t\|$\)' + if exists("s:netrwmarkfilelist_{curbufnr}") - " markfile list exists + " markfile list pre-exists " call Decho("starting s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">") " call Decho("starting s:netrwmarkfilemtch_{curbufnr}<".s:netrwmarkfilemtch_{curbufnr}.">") let b:netrw_islocal= a:islocal @@ -4322,8 +5359,7 @@ fun! s:NetrwMarkFile(islocal,fname) endif let first= 0 endfor -" call Decho("ending s:netrwmarkfilelist_"curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">") -" call Decho("ending s:netrwmarkfilemtch_"curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">") +" call Decho("ending s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">") endif endif @@ -4377,7 +5413,8 @@ fun! s:NetrwMarkFile(islocal,fname) " call Decho("2match none") 2match none endif -" call Dret("s:NetrwMarkFile : netrwmarkfilelist_".curbufnr."<".(exists("s:netrwmarkfilelist_{curbufnr}")? string(s:netrwmarkfilelist_{curbufnr}) : " doesn't exist").">") + let @@= ykeep +" call Dret("s:NetrwMarkFile : s:netrwmarkfilelist_".curbufnr."<".(exists("s:netrwmarkfilelist_{curbufnr}")? string(s:netrwmarkfilelist_{curbufnr}) : " doesn't exist").">") endfun " --------------------------------------------------------------------- @@ -4394,34 +5431,44 @@ fun! s:NetrwMarkFileCompress(islocal) let curdir = b:netrw_curdir let curbufnr = bufnr("%") + " sanity check + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) +" call Dret("s:NetrwMarkFileCompress") + return + endif +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) + if exists("s:netrwmarkfilelist_{curbufnr}") && exists("g:netrw_compress") && exists("g:netrw_decompress") + + " for every filename in the marked list for fname in s:netrwmarkfilelist_{curbufnr} - " for every filename in the marked list - for sfx in sort(keys(g:netrw_decompress)) - if fname =~ '\'.sfx.'$' - " fname has a suffix indicating that its compressed; apply associated decompression routine - let exe= netrw#WinPath(g:netrw_decompress[sfx]) -" call Decho("fname<".fname."> is compressed so decompress with <".exe.">") - if a:islocal - if g:netrw_keepdir - let fname= shellescape(s:ComposePath(curdir,fname)) - endif - else - let fname= shellescape(b:netrw_curdir.fname,1) + let sfx= substitute(fname,'^.\{-}\(\.\a\+\)$','\1','') +" call Decho("extracted sfx<".sfx.">") + if exists("g:netrw_decompress['".sfx."']") + " fname has a suffix indicating that its compressed; apply associated decompression routine + let exe= g:netrw_decompress[sfx] +" call Decho("fname<".fname."> is compressed so decompress with <".exe.">") + let exe= netrw#WinPath(exe) + if a:islocal + if g:netrw_keepdir + let fname= shellescape(s:ComposePath(curdir,fname)) endif - if executable(exe) - if a:islocal - call system(exe." ".fname) - else - call s:RemoteSystem(exe." ".fname) - endif + else + let fname= shellescape(b:netrw_curdir.fname,1) + endif + if executable(exe) + if a:islocal + call system(exe." ".fname) else - call netrw#ErrorMsg(s:WARNING,"unable to apply<".exe."> to file<".fname.">",50) + keepj call s:RemoteSystem(exe." ".fname) endif - break + else + keepj call netrw#ErrorMsg(s:WARNING,"unable to apply<".exe."> to file<".fname.">",50) endif - unlet sfx - endfor + endif + unlet sfx + if exists("exe") unlet exe elseif a:islocal @@ -4429,12 +5476,13 @@ fun! s:NetrwMarkFileCompress(islocal) call system(netrw#WinPath(g:netrw_compress)." ".shellescape(s:ComposePath(b:netrw_curdir,fname))) else " fname not a compressed file, so compress it - call s:RemoteSystem(netrw#WinPath(g:netrw_compress)." ".shellescape(fname)) + keepj call s:RemoteSystem(netrw#WinPath(g:netrw_compress)." ".shellescape(fname)) endif - endfor + endfor " for every file in the marked list + call s:NetrwUnmarkList(curbufnr,curdir) - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - call netrw#NetrwRestorePosn(svpos) + keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + keepj call netrw#NetrwRestorePosn(svpos) endif " call Dret("s:NetrwMarkFileCompress") endfun @@ -4446,42 +5494,112 @@ endfun " directories. Uses the local-buffer marked file list. " Returns 1=success (used by NetrwMarkFileMove()) " 0=failure -fun! s:NetrwMarkFileCopy(islocal) -" call Dfunc("s:NetrwMarkFileCopy(islocal=".a:islocal.") target<".(exists("s:netrwmftgt")? s:netrwmftgt : '---').">") +fun! s:NetrwMarkFileCopy(islocal,...) +" call Dfunc("s:NetrwMarkFileCopy(islocal=".a:islocal.") target<".(exists("s:netrwmftgt")? s:netrwmftgt : '---')."> a:0=".a:0) - " sanity checks - if !exists("s:netrwmarkfilelist_{bufnr('%')}") || empty(s:netrwmarkfilelist_{bufnr('%')}) - call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) -" call Dret("s:NetrwMarkFileCopy 0") - return 0 + if !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() +" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)") endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".bufnr('%')."<".string(s:netrwmarkfilelist_{bufnr('%')})) + let curdir = b:netrw_curdir + let curbufnr = bufnr("%") + + " sanity check + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) +" call Dret("s:NetrwMarkFileCopy") + return + endif +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) + if !exists("s:netrwmftgt") - call netrw#ErrorMsg(2,"your marked file target is empty! (:help netrw-mt)",67) + keepj call netrw#ErrorMsg(s:ERROR,"your marked file target is empty! (:help netrw-mt)",67) " call Dret("s:NetrwMarkFileCopy 0") return 0 endif " call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">") - let curdir = b:netrw_curdir - let curbufnr = bufnr("%") if a:islocal && s:netrwmftgt_islocal " Copy marked files, local directory to local directory " call Decho("copy from local to local") - let args= join(map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),"shellescape(b:netrw_curdir.\"/\".v:val)")) -" call Decho("system(".g:netrw_localcopycmd." ".args." ".shellescape(s:netrwmftgt).")") - call system(netrw#WinPath(g:netrw_localcopycmd)." ".args." ".shellescape(s:netrwmftgt)) + if !executable(g:netrw_localcopycmd) && g:netrw_localcopycmd !~ '\ not executable on your system, aborting",91) +" call Dfunc("s:NetrwMarkFileMove : g:netrw_localcopycmd<".g:netrw_localcopycmd."> n/a!") + return + endif + + " copy marked files while within the same directory (ie. allow renaming) + if simplify(s:netrwmftgt) == simplify(b:netrw_curdir) + if len(s:netrwmarkfilelist_{bufnr('%')}) == 1 + " only one marked file + let args = shellescape(b:netrw_curdir."/".s:netrwmarkfilelist_{bufnr('%')}[0]) + let oldname = s:netrwmarkfilelist_{bufnr('%')}[0] + elseif a:0 == 1 + " this happens when the next case was used to recursively call s:NetrwMarkFileCopy() + let args = shellescape(b:netrw_curdir."/".a:1) + let oldname = a:1 + else + " copy multiple marked files inside the same directory + let s:recursive= 1 + for oldname in s:netrwmarkfilelist_{bufnr("%")} + let ret= s:NetrwMarkFileCopy(a:islocal,oldname) + if ret == 0 + break + endif + endfor + unlet s:recursive + call s:NetrwUnmarkList(curbufnr,curdir) +" call Dret("s:NetrwMarkFileCopy ".ret) + return ret + endif + + call inputsave() + let newname= input("Copy ".oldname." to : ",oldname,"file") + call inputrestore() + if newname == "" +" call Dret("s:NetrwMarkFileCopy 0") + return 0 + endif + let args= shellescape(oldname) + let tgt = shellescape(s:netrwmftgt.'/'.newname) + else + let args= join(map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),"shellescape(b:netrw_curdir.\"/\".v:val)")) + let tgt = shellescape(s:netrwmftgt) + endif + if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) + let args= substitute(args,'/','\\','g') + let tgt = substitute(tgt, '/','\\','g') + endif + if g:netrw_localcopycmd =~ '\s' + let copycmd = substitute(g:netrw_localcopycmd,'\s.*$','','') + let copycmdargs = substitute(g:netrw_localcopycmd,'^.\{-}\(\s.*\)$','\1','') + let copycmd = netrw#WinPath(copycmd).copycmdargs + else + let copycmd = netrw#WinPath(g:netrw_localcopycmd) + endif +" call Decho("args <".args.">") +" call Decho("tgt <".tgt.">") +" call Decho("copycmd<".copycmd.">") +" call Decho("system(".copycmd." ".args." ".tgt.")") + call system(copycmd." ".args." ".tgt) + if v:shell_error != 0 + call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localcopycmd<".g:netrw_localcopycmd.">; it doesn't work!",80) +" call Dret("s:NetrwMarkFileCopy 0 : failed: system(".g:netrw_localcopycmd." ".args." ".shellescape(s:netrwmftgt)) + return 0 + endif elseif a:islocal && !s:netrwmftgt_islocal " Copy marked files, local directory to remote directory " call Decho("copy from local to remote") - call s:NetrwUpload(s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt) + keepj call s:NetrwUpload(s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt) elseif !a:islocal && s:netrwmftgt_islocal + " Copy marked files, remote directory to local directory " call Decho("copy from remote to local") - call netrw#NetrwObtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt) + keepj call netrw#NetrwObtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt) elseif !a:islocal && !s:netrwmftgt_islocal + " Copy marked files, remote directory to remote directory " call Decho("copy from remote to remote") let curdir = getcwd() let tmpdir = s:GetTempfile("") @@ -4491,19 +5609,29 @@ fun! s:NetrwMarkFileCopy(islocal) if exists("*mkdir") call mkdir(tmpdir) else - exe "sil! !".g:netrw_local_mkdir.' '.shellescape(tmpdir,1) + exe "sil! !".g:netrw_localmkdir.' '.shellescape(tmpdir,1) + if v:shell_error != 0 + call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",80) +" call Dret("s:NetrwMarkFileCopy : failed: sil! !".g:netrw_localmkdir.' '.shellescape(tmpdir,1) ) + return + endif endif if isdirectory(tmpdir) exe "keepj lcd ".fnameescape(tmpdir) - call netrw#NetrwObtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},tmpdir) + keepj call netrw#NetrwObtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},tmpdir) let localfiles= map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),'substitute(v:val,"^.*/","","")') - call s:NetrwUpload(localfiles,s:netrwmftgt) + keepj call s:NetrwUpload(localfiles,s:netrwmftgt) if getcwd() == tmpdir for fname in s:netrwmarkfilelist_{bufnr('%')} - call s:NetrwDelete(fname) + keepj call s:NetrwDelete(fname) endfor exe "keepj lcd ".fnameescape(curdir) - exe "sil !".g:netrw_local_rmdir." ".shellescape(tmpdir,1) + exe "sil !".g:netrw_localrmdir." ".shellescape(tmpdir,1) + if v:shell_error != 0 + call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localrmdir<".g:netrw_localrmdir."> to something that works",80) +" call Dret("s:NetrwMarkFileCopy : failed: sil !".g:netrw_localrmdir." ".shellescape(tmpdir,1) ) + return + endif else exe "keepj lcd ".fnameescape(curdir) endif @@ -4513,20 +5641,21 @@ fun! s:NetrwMarkFileCopy(islocal) " ------- " cleanup " ------- -" call Decho("cleanup") - - " remove markings from local buffer - call s:NetrwUnmarkList(curbufnr,curdir) +" call Decho("cleanup") + if !exists("s:recursive") + " remove markings from local buffer + call s:NetrwUnmarkList(curbufnr,curdir) + endif " refresh buffers if !s:netrwmftgt_islocal call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt) endif if a:islocal - call s:NetrwRefreshDir(a:islocal,b:netrw_curdir) + keepj call s:NetrwRefreshDir(a:islocal,curdir) endif if g:netrw_fastbrowse <= 1 - call s:LocalBrowseShellCmdRefresh() + keepj call s:LocalBrowseShellCmdRefresh() endif " call Dret("s:NetrwMarkFileCopy 1") @@ -4542,7 +5671,15 @@ fun! s:NetrwMarkFileDiff(islocal) " call Dfunc("s:NetrwMarkFileDiff(islocal=".a:islocal.") b:netrw_curdir<".b:netrw_curdir.">") let curbufnr= bufnr("%") - if exists("s:netrwmarkfilelist_{curbufnr}") + " sanity check + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) +" call Dret("s:NetrwMarkFileDiff") + return + endif +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) + + if exists("s:netrwmarkfilelist_{."curbufnr}") let cnt = 0 let curdir = b:netrw_curdir for fname in s:netrwmarkfilelist @@ -4575,21 +5712,62 @@ fun! s:NetrwMarkFileEdit(islocal) let curdir = b:netrw_curdir let curbufnr = bufnr("%") + + " sanity check + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) +" call Dret("s:NetrwMarkFileEdit") + return + endif +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) + if exists("s:netrwmarkfilelist_{curbufnr}") call s:SetRexDir(a:islocal,curdir) let flist= join(map(deepcopy(s:netrwmarkfilelist), "fnameescape(v:val)")) " unmark markedfile list " call s:NetrwUnmarkList(curbufnr,curdir) call s:NetrwUnmarkAll() -" call Decho("exe silent args ".flist) - exe "silent args ".flist +" call Decho("exe sil args ".flist) + exe "sil args ".flist endif + echo "(use :bn, :bp to navigate files; :Rex to return)" " call Dret("s:NetrwMarkFileEdit") endfun " --------------------------------------------------------------------- -" s:NetrwMarkFileExe: (invoked by mx) execute arbitrary command on marked files, one at a time {{{2 +" s:NetrwMarkFileQFEL: convert a quickfix-error list into a marked file list {{{2 +fun! s:NetrwMarkFileQFEL(islocal,qfel) +" call Dfunc("s:NetrwMarkFileQFEL(islocal=".a:islocal.",qfel)") + call s:NetrwUnmarkAll() + let curbufnr= bufnr("%") + + if !empty(a:qfel) + for entry in a:qfel + let bufnmbr= entry["bufnr"] +" call Decho("bufname(".bufnmbr.")<".bufname(bufnmbr)."> line#".entry["lnum"]." text=".entry["text"]) + if !exists("s:netrwmarkfilelist_{curbufnr}") +" call Decho("case: no marked file list") + call s:NetrwMarkFile(a:islocal,bufname(bufnmbr)) + elseif index(s:netrwmarkfilelist_{curbufnr},bufname(bufnmbr)) == -1 + " s:NetrwMarkFile will remove duplicate entries from the marked file list. + " So, this test lets two or more hits on the same pattern to be ignored. +" call Decho("case: ".bufname(bufnmbr)." not currently in marked file list") + call s:NetrwMarkFile(a:islocal,bufname(bufnmbr)) + else +" call Decho("case: ".bufname(bufnmbr)." already in marked file list") + endif + endfor + echo "(use me to edit marked files)" + else + call netrw#ErrorMsg(s:WARNING,"can't convert quickfix error list; its empty!",92) + endif + +" call Dret("s:NetrwMarkFileQFEL") +endfun + +" --------------------------------------------------------------------- +" s:NetrwMarkFileExe: (invoked by mx) execute arbitrary system command on marked files, one at a time {{{2 " Uses the local marked-file list. fun! s:NetrwMarkFileExe(islocal) " call Dfunc("s:NetrwMarkFileExe(islocal=".a:islocal.")") @@ -4597,40 +5775,166 @@ fun! s:NetrwMarkFileExe(islocal) let curdir = b:netrw_curdir let curbufnr = bufnr("%") + " sanity check + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) +" call Dret("s:NetrwMarkFileExe") + return + endif +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) + if exists("s:netrwmarkfilelist_{curbufnr}") " get the command call inputsave() let cmd= input("Enter command: ","","file") call inputrestore() " call Decho("cmd<".cmd.">") + if cmd == "" +" " call Dret("s:NetrwMarkFileExe : early exit, empty command") + return + endif + + " apply command to marked files. Substitute: filename -> % + " If no %, then append a space and the filename to the command + for fname in s:netrwmarkfilelist_{curbufnr} + if a:islocal + if g:netrw_keepdir + let fname= shellescape(netrw#WinPath(s:ComposePath(curdir,fname))) + endif + else + let fname= shellescape(netrw#WinPath(b:netrw_curdir.fname)) + endif + if cmd =~ '%' + let xcmd= substitute(cmd,'%',fname,'g') + else + let xcmd= cmd.' '.fname + endif + if a:islocal +" call Decho("local: xcmd<".xcmd.">") + let ret= system(xcmd) + else +" call Decho("remote: xcmd<".xcmd.">") + let ret= s:RemoteSystem(xcmd) + endif + if v:shell_error < 0 + keepj call netrw#ErrorMsg(s:ERROR,"command<".xcmd."> failed, aborting",54) + break + else + echo ret + endif + endfor + + " unmark marked file list + call s:NetrwUnmarkList(curbufnr,curdir) + + " refresh the listing + keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + keepj call netrw#NetrwRestorePosn(svpos) + else + keepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) + endif + +" call Dret("s:NetrwMarkFileExe") +endfun + +" --------------------------------------------------------------------- +" s:NetrwMarkHideSfx: (invoked by mh) (un)hide files having same suffix +" as the marked file(s) (toggles suffix presence) +" Uses the local marked file list. +fun! s:NetrwMarkHideSfx(islocal) +" call Dfunc("s:NetrwMarkHideSfx(islocal=".a:islocal.")") + let svpos = netrw#NetrwSavePosn() + let curbufnr = bufnr("%") + + " s:netrwmarkfilelist_{curbufnr}: the List of marked files + if exists("s:netrwmarkfilelist_{curbufnr}") + + for fname in s:netrwmarkfilelist_{curbufnr} +" call Decho("s:NetrwMarkFileCopy: fname<".fname.">") + " construct suffix pattern + if fname =~ '\.' + let sfxpat= "^.*".substitute(fname,'^.*\(\.[^. ]\+\)$','\1','') + else + let sfxpat= '^\%(\%(\.\)\@!.\)*$' + endif + " determine if its in the hiding list or not + let inhidelist= 0 + if g:netrw_list_hide != "" + let itemnum = 0 + let hidelist= split(g:netrw_list_hide,',') + for hidepat in hidelist + if sfxpat == hidepat + let inhidelist= 1 + break + endif + let itemnum= itemnum + 1 + endfor + endif +" call Decho("fname<".fname."> inhidelist=".inhidelist." sfxpat<".sfxpat.">") + if inhidelist + " remove sfxpat from list + call remove(hidelist,itemnum) + let g:netrw_list_hide= join(hidelist,",") + elseif g:netrw_list_hide != "" + " append sfxpat to non-empty list + let g:netrw_list_hide= g:netrw_list_hide.",".sfxpat + else + " set hiding list to sfxpat + let g:netrw_list_hide= sfxpat + endif + endfor + + " refresh the listing + keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + keepj call netrw#NetrwRestorePosn(svpos) + else + keepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) + endif + +" call Dret("s:NetrwMarkHideSfx") +endfun + +" --------------------------------------------------------------------- +" s:NetrwMarkFileVimCmd: (invoked by mX) execute arbitrary vim command on marked files, one at a time {{{2 +" Uses the local marked-file list. +fun! s:NetrwMarkFileVimCmd(islocal) +" call Dfunc("s:NetrwMarkFileVimCmd(islocal=".a:islocal.")") + let svpos = netrw#NetrwSavePosn() + let curdir = b:netrw_curdir + let curbufnr = bufnr("%") + + " sanity check + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) +" call Dret("s:NetrwMarkFileVimCmd") + return + endif +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) + + if exists("s:netrwmarkfilelist_{curbufnr}") + " get the command + call inputsave() + let cmd= input("Enter vim command: ","","file") + call inputrestore() +" call Decho("cmd<".cmd.">") + if cmd == "" +" " call Dret("s:NetrwMarkFileVimCmd : early exit, empty command") + return + endif " apply command to marked files. Substitute: filename -> % " If no %, then append a space and the filename to the command for fname in s:netrwmarkfilelist_{curbufnr} +" call Decho("fname<".fname.">") if a:islocal - if g:netrw_keepdir - let fname= shellescape(netrw#WinPath(s:ComposePath(curdir,fname))) - endif - else - let fname= shellescape(netrw#WinPath(b:netrw_curdir.fname)) - endif - if cmd =~ '%' - let xcmd= substitute(cmd,'%',fname,'g') - else - let xcmd= cmd.' '.fname - endif - if a:islocal -" call Decho("local: xcmd<".xcmd.">") - let ret= system(xcmd) - else -" call Decho("remote: xcmd<".xcmd.">") - let ret= s:RemoteSystem(xcmd) - endif - if v:shell_error < 0 - call netrw#ErrorMsg(s:ERROR,"command<".xcmd."> failed, aborting",54) - break + 1split + exe "sil! keepalt e ".fnameescape(fname) +" call Decho("local<".fname.">: exe ".cmd) + exe cmd + exe "sil! keepalt wq!" else - echo ret +" call Decho("remote<".fname.">: exe ".cmd." : NOT SUPPORTED YET") + echo "sorry, \"mX\" not supported yet for remote files" endif endfor @@ -4638,13 +5942,13 @@ fun! s:NetrwMarkFileExe(islocal) call s:NetrwUnmarkList(curbufnr,curdir) " refresh the listing - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - call netrw#NetrwRestorePosn(svpos) + keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + keepj call netrw#NetrwRestorePosn(svpos) else - call netrw#ErrorMsg(s:ERROR,"no files marked!",59) + keepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) endif -" call Dret("s:NetrwMarkFileExe") +" call Dret("s:NetrwMarkFileVimCmd") endfun " --------------------------------------------------------------------- @@ -4695,10 +5999,10 @@ fun! s:NetrwMarkHideSfx(islocal) endfor " refresh the listing - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - call netrw#NetrwRestorePosn(svpos) + keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + keepj call netrw#NetrwRestorePosn(svpos) else - call netrw#ErrorMsg(s:ERROR,"no files marked!",59) + keepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) endif " call Dret("s:NetrwMarkHideSfx") @@ -4716,30 +6020,47 @@ fun! s:NetrwMarkFileGrep(islocal) " call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">") let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "fnameescape(v:val)")) call s:NetrwUnmarkAll() + else +" call Decho('no marked files, using "*"') + let netrwmarkfilelist= "*" + endif - " ask user for pattern - call inputsave() - let pat= input("Enter pattern: ","") - call inputrestore() - if pat !~ '^\s' - if pat !~ '^/' - let pat= '/'.pat.'/' - endif - let pat= " ".pat - endif + " ask user for pattern + call inputsave() + let pat= input("Enter pattern: ","") + call inputrestore() + let patbang = "" + if pat =~ '^!' + let patbang = "!" + let pat= strpart(pat,2) + endif + if pat =~ '^\i' + let pat = escape(pat,'/') + let pat = '/'.pat.'/' + else + let nonisi = pat[0] + endif - " use vimgrep for both local and remote -" call Decho("exe vimgrep".pat." ".netrwmarkfilelist) - try - exe "keepj noautocmd vimgrep".pat." ".netrwmarkfilelist - catch /^Vim\%((\a\+)\)\=:E480/ - call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76) -" call Dret("s:NetrwMarkFileGrep : unable to find pattern<".pattern.">") - return - endtry + " use vimgrep for both local and remote +" call Decho("exe vimgrep".patbang." ".pat." ".netrwmarkfilelist) + try + exe "keepj noautocmd vimgrep".patbang." ".pat." ".netrwmarkfilelist + catch /^Vim\%((\a\+)\)\=:E480/ + keepj call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pat.">",76) +" call Dret("s:NetrwMarkFileGrep : unable to find pattern<".pat.">") + return + endtry + echo "(use :cn, :cp to navigate, :Rex to return)" - 2match none - call netrw#NetrwRestorePosn(svpos) + 2match none + keepj call netrw#NetrwRestorePosn(svpos) + + if exists("nonisi") + " original, user-supplied pattern did not begin with a character from isident +" call Decho("looking for trailing nonisi<".nonisi."> followed by a j, gj, or jg") + if pat =~ nonisi.'j$\|'.nonisi.'gj$\|'.nonisi.'jg$' + call s:NetrwMarkFileQFEL(a:islocal,getqflist()) + endif endif " call Dret("s:NetrwMarkFileGrep") @@ -4756,14 +6077,15 @@ fun! s:NetrwMarkFileMove(islocal) let curbufnr = bufnr("%") " sanity check - if !exists("s:netrwmarkfilelist_{bufnr('%')}") || empty(s:netrwmarkfilelist_{bufnr('%')}) - call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) " call Dret("s:NetrwMarkFileMove") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".bufnr('%')."<".string(s:netrwmarkfilelist_{bufnr('%')})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) + if !exists("s:netrwmftgt") - call netrw#ErrorMsg(2,"your marked file target is empty! (:help netrw-mt)",67) + keepj call netrw#ErrorMsg(2,"your marked file target is empty! (:help netrw-mt)",67) " call Dret("s:NetrwMarkFileCopy 0") return 0 endif @@ -4773,25 +6095,47 @@ fun! s:NetrwMarkFileMove(islocal) " move: local -> local " call Decho("move from local to local") " call Decho("(s:NetrwMarkFileMove) local to local move") - if executable(g:netrw_localmovecmd) - for fname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("system(".g:netrw_localmovecmd." ".shellescape(fname)." ".shellescape(s:netrwmftgt).")") - let ret= system(g:netrw_localmovecmd." ".shellescape(fname)." ".shellescape(s:netrwmftgt)) - if v:shell_error < 0 - call netrw#ErrorMsg(s:ERROR,"command<".g:netrw_localmovecmd."> failed, aborting",54) - break - endif - endfor + if !executable(g:netrw_localmovecmd) && g:netrw_localmovecmd !~ '\ not executable on your system, aborting",90) +" call Dfunc("s:NetrwMarkFileMove : g:netrw_localmovecmd<".g:netrw_localmovecmd."> n/a!") + return + endif + let tgt = shellescape(s:netrwmftgt) +" call Decho("tgt<".tgt.">") + if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) + let tgt = substitute(tgt, '/','\\','g') +" call Decho("windows exception: tgt<".tgt.">") + if g:netrw_localmovecmd =~ '\s' + let movecmd = substitute(g:netrw_localmovecmd,'\s.*$','','') + let movecmdargs = substitute(g:netrw_localmovecmd,'^.\{-}\(\s.*\)$','\1','') + let movecmd = netrw#WinPath(movecmd).movecmdargs +" call Decho("windows exception: movecmd<".movecmd."> (#1: had a space)") + else + let movecmd = netrw#WinPath(movecmd) +" call Decho("windows exception: movecmd<".movecmd."> (#2: no space)") + endif else - call netrw#ErrorMsg(s:ERROR,"command<".g:netrw_localmovecmd."> is not executable!",57) + let movecmd = netrw#WinPath(g:netrw_localmovecmd) +" call Decho("movecmd<".movecmd."> (#3 linux or cygwin)") endif + for fname in s:netrwmarkfilelist_{bufnr("%")} +" call Decho("system(".movecmd." ".shellescape(fname)." ".tgt.")") + if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) + let fname= substitute(fname,'/','\\','g') + endif + let ret= system(g:netrw_localmovecmd." ".shellescape(fname)." ".tgt) + if v:shell_error != 0 + call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localmovecmd<".g:netrw_localmovecmd.">; it doesn't work!",54) + break + endif + endfor elseif a:islocal && !s:netrwmftgt_islocal " move: local -> remote " call Decho("move from local to remote") " call Decho("copy") let mflist= s:netrwmarkfilelist_{bufnr("%")} - call s:NetrwMarkFileCopy(a:islocal) + keepj call s:NetrwMarkFileCopy(a:islocal) " call Decho("remove") for fname in mflist let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') @@ -4804,7 +6148,7 @@ fun! s:NetrwMarkFileMove(islocal) " call Decho("move from remote to local") " call Decho("copy") let mflist= s:netrwmarkfilelist_{bufnr("%")} - call s:NetrwMarkFileCopy(a:islocal) + keepj call s:NetrwMarkFileCopy(a:islocal) " call Decho("remove") for fname in mflist let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') @@ -4817,7 +6161,7 @@ fun! s:NetrwMarkFileMove(islocal) " call Decho("move from remote to remote") " call Decho("copy") let mflist= s:netrwmarkfilelist_{bufnr("%")} - call s:NetrwMarkFileCopy(a:islocal) + keepj call s:NetrwMarkFileCopy(a:islocal) " call Decho("remove") for fname in mflist let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') @@ -4836,13 +6180,16 @@ fun! s:NetrwMarkFileMove(islocal) " refresh buffers if !s:netrwmftgt_islocal - call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt) +" call Decho("refresh netrwmftgt<".s:netrwmftgt.">") + keepj call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt) endif if a:islocal - call s:NetrwRefreshDir(a:islocal,b:netrw_curdir) +" call Decho("refresh b:netrw_curdir<".b:netrw_curdir.">") + keepj call s:NetrwRefreshDir(a:islocal,b:netrw_curdir) endif if g:netrw_fastbrowse <= 1 - call s:LocalBrowseShellCmdRefresh() +" call Decho("since g:netrw_fastbrowse=".g:netrw_fastbrowse.", perform shell cmd refresh") + keepj call s:LocalBrowseShellCmdRefresh() endif " call Dret("s:NetrwMarkFileMove") @@ -4854,6 +6201,14 @@ endfun fun! s:NetrwMarkFilePrint(islocal) " call Dfunc("s:NetrwMarkFilePrint(islocal=".a:islocal.")") let curbufnr= bufnr("%") + + " sanity check + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) +" call Dret("s:NetrwMarkFilePrint") + return + endif +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) if exists("s:netrwmarkfilelist_{curbufnr}") let netrwmarkfilelist = s:netrwmarkfilelist_{curbufnr} let curdir = b:netrw_curdir @@ -4868,8 +6223,8 @@ fun! s:NetrwMarkFilePrint(islocal) endif 1split " the autocmds will handle both local and remote files -" call Decho("exe silent e ".escape(fname,' ')) - exe "silent e ".fnameescape(fname) +" call Decho("exe sil e ".escape(fname,' ')) + exe "sil e ".fnameescape(fname) " call Decho("hardcopy") hardcopy q @@ -4882,7 +6237,7 @@ endfun " --------------------------------------------------------------------- " s:NetrwMarkFileRegexp: (invoked by mr) This function is used to mark {{{2 " files when given a regexp (for which a prompt is -" issued). +" issued) (matches to name of files). fun! s:NetrwMarkFileRegexp(islocal) " call Dfunc("s:NetrwMarkFileRegexp(islocal=".a:islocal.")") @@ -4894,15 +6249,15 @@ fun! s:NetrwMarkFileRegexp(islocal) if a:islocal " get the matching list of files using local glob() " call Decho("handle local regexp") - let dirname = escape(b:netrw_curdir,g:netrw_glob_escape) - let files = glob(s:ComposePath(dirname,regexp)) + let dirname = escape(b:netrw_curdir,g:netrw_glob_escape) + let files = glob(s:ComposePath(dirname,regexp)) " call Decho("files<".files.">") let filelist= split(files,"\n") " mark the list of files for fname in filelist " call Decho("fname<".fname.">") - call s:NetrwMarkFile(a:islocal,substitute(fname,'^.*/','','')) + keepj call s:NetrwMarkFile(a:islocal,substitute(fname,'^.*/','','')) endfor else @@ -4915,8 +6270,8 @@ fun! s:NetrwMarkFileRegexp(islocal) set ei=all ma " call Decho("set ei=all ma") 1split - call s:NetrwEnew() - call s:NetrwSafeOptions() + keepj call s:NetrwEnew() + keepj call s:NetrwSafeOptions() sil keepj norm! "ap keepj 2 let bannercnt= search('^" =====','W') @@ -4942,12 +6297,13 @@ fun! s:NetrwMarkFileRegexp(islocal) let filelist= getline(1,line("$")) q! for filename in filelist - call s:NetrwMarkFile(a:islocal,substitute(filename,'^.*/','','')) + keepj call s:NetrwMarkFile(a:islocal,substitute(filename,'^.*/','','')) endfor unlet filelist let @a = areg let &ei = eikeep endif + echo " (use me to edit marked files)" " call Dret("s:NetrwMarkFileRegexp") endfun @@ -4958,6 +6314,14 @@ endfun fun! s:NetrwMarkFileSource(islocal) " call Dfunc("s:NetrwMarkFileSource(islocal=".a:islocal.")") let curbufnr= bufnr("%") + + " sanity check + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) +" call Dret("s:NetrwMarkFileSource") + return + endif +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) if exists("s:netrwmarkfilelist_{curbufnr}") let netrwmarkfilelist = s:netrwmarkfilelist_{bufnr("%")} let curdir = b:netrw_curdir @@ -4988,6 +6352,14 @@ fun! s:NetrwMarkFileTag(islocal) let curdir = b:netrw_curdir let curbufnr = bufnr("%") + " sanity check + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) +" call Dret("s:NetrwMarkFileTag") + return + endif +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) + if exists("s:netrwmarkfilelist") " call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">") let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "shellescape(v:val,".!a:islocal.")")) @@ -5023,9 +6395,9 @@ endfun " --------------------------------------------------------------------- " s:NetrwMarkFileTgt: (invoked by mt) This function sets up a marked file target {{{2 " Sets up two variables, -" s:netrwmftgt : holds the target directory +" s:netrwmftgt : holds the target directory " s:netrwmftgt_islocal : 0=target directory is remote -" 1=target directory is local +" 1=target directory is local fun! s:NetrwMarkFileTgt(islocal) " call Dfunc("s:NetrwMarkFileTgt(islocal=".a:islocal.")") let svpos = netrw#NetrwSavePosn() @@ -5037,9 +6409,21 @@ fun! s:NetrwMarkFileTgt(islocal) " set up target if line(".") < w:netrw_bannercnt - " if cursor in banner region, use b:netrw_curdir for the target - let s:netrwmftgt= b:netrw_curdir -" call Decho("inbanner: s:netrwmftgt<".s:netrwmftgt.">") + " if cursor in banner region, use b:netrw_curdir for the target unless its already the target + if exists("s:netrwmftgt") && exists("s:netrwmftgt_islocal") && s:netrwmftgt == b:netrw_curdir +" call Decho("cursor in banner region, and target already is <".b:netrw_curdir.">: removing target") + unlet s:netrwmftgt s:netrwmftgt_islocal + if g:netrw_fastbrowse <= 1 + call s:LocalBrowseShellCmdRefresh() + endif + call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + call netrw#NetrwRestorePosn(svpos) +" call Dret("s:NetrwMarkFileTgt : removed target") + return + else + let s:netrwmftgt= b:netrw_curdir +" call Decho("inbanner: s:netrwmftgt<".s:netrwmftgt.">") + endif else " get word under cursor. @@ -5085,6 +6469,7 @@ endfun " s:NetrwOpenFile: query user for a filename and open it {{{2 fun! s:NetrwOpenFile(islocal) " call Dfunc("s:NetrwOpenFile(islocal=".a:islocal.")") + let ykeep= @@ call inputsave() let fname= input("Enter filename: ") call inputrestore() @@ -5108,11 +6493,14 @@ fun! s:NetrwOpenFile(islocal) else exe "e ".fnameescape(fname) endif + let @@= ykeep " call Dret("s:NetrwOpenFile") endfun " --------------------------------------------------------------------- " s:NetrwUnmarkList: delete local marked file lists and remove their contents from the global marked-file list {{{2 +" User access provided by the mapping. (see :help netrw-mu) +" Used by many MarkFile functions. fun! s:NetrwUnmarkList(curbufnr,curdir) " call Dfunc("s:NetrwUnmarkList(curbufnr=".a:curbufnr." curdir<".a:curdir.">)") @@ -5144,13 +6532,13 @@ fun! s:NetrwUnmarkAll() if exists("s:netrwmarkfilelist") unlet s:netrwmarkfilelist endif - silent call s:NetrwUnmarkAll2() + sil call s:NetrwUnmarkAll2() 2match none " call Dret("s:NetrwUnmarkAll") endfun " --------------------------------------------------------------------- -" s:NetrwUnmarkAll2: {{{2 +" s:NetrwUnmarkAll2: unmark all files from all buffers {{{2 fun! s:NetrwUnmarkAll2() " call Dfunc("s:NetrwUnmarkAll2()") redir => netrwmarkfilelist_let @@ -5184,315 +6572,130 @@ fun! s:NetrwUnMarkFile(islocal) 2match none endif -" call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - call netrw#NetrwRestorePosn(svpos) -" call Dret("s:NetrwUnMarkFile") -endfun - -" --------------------------------------------------------------------- -" s:NetrwMenu: generates the menu for gvim and netrw {{{2 -fun! s:NetrwMenu(domenu) - - if !exists("g:NetrwMenuPriority") - let g:NetrwMenuPriority= 80 - endif - - if has("menu") && has("gui_running") && &go =~ 'm' && g:netrw_menu -" call Dfunc("NetrwMenu(domenu=".a:domenu.")") - - if !exists("s:netrw_menu_enabled") && a:domenu -" call Decho("initialize menu") - let s:netrw_menu_enabled= 1 - exe 'sil! menu '.g:NetrwMenuPriority.'.1 '.g:NetrwTopLvlMenu.'Help ' - exe 'sil! menu '.g:NetrwMenuPriority.'.5 '.g:NetrwTopLvlMenu.'-Sep1- :' - exe 'sil! menu '.g:NetrwMenuPriority.'.6 '.g:NetrwTopLvlMenu.'Go\ Up\ Directory- -' - exe 'sil! menu '.g:NetrwMenuPriority.'.7 '.g:NetrwTopLvlMenu.'Apply\ Special\ Viewerx x' - exe 'sil! menu '.g:NetrwMenuPriority.'.8.1 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Current\ Directorymb mb' - exe 'sil! menu '.g:NetrwMenuPriority.'.8.4 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Prev\ Dir\ (History)u u' - exe 'sil! menu '.g:NetrwMenuPriority.'.8.5 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Next\ Dir\ (History)U U' - exe 'sil! menu '.g:NetrwMenuPriority.'.8.6 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Listqb qb' - exe 'sil! menu '.g:NetrwMenuPriority.'.9.1 '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ File\ Hiding\ List'." \'" - exe 'sil! menu '.g:NetrwMenuPriority.'.9.2 '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ Sorting\ SequenceS S' - exe 'sil! menu '.g:NetrwMenuPriority.'.9.3 '.g:NetrwTopLvlMenu.'Browsing\ Control.Quick\ Hide/Unhide\ Dot\ Files'."gh gh" - exe 'sil! menu '.g:NetrwMenuPriority.'.9.4 '.g:NetrwTopLvlMenu.'Browsing\ Control.Refresh\ Listing'." \" - exe 'sil! menu '.g:NetrwMenuPriority.'.9.5 '.g:NetrwTopLvlMenu.'Browsing\ Control.Settings/Options:NetrwSettings '.":NetrwSettings\" - exe 'sil! menu '.g:NetrwMenuPriority.'.10 '.g:NetrwTopLvlMenu.'Delete\ File/DirectoryD D' - exe 'sil! menu '.g:NetrwMenuPriority.'.11.1 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.Create\ New\ File% %' - exe 'sil! menu '.g:NetrwMenuPriority.'.11.1 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ Current\ Window '."\" - exe 'sil! menu '.g:NetrwMenuPriority.'.11.2 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.Preview\ File/Directoryp p' - exe 'sil! menu '.g:NetrwMenuPriority.'.11.3 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ Previous\ WindowP P' - exe 'sil! menu '.g:NetrwMenuPriority.'.11.4 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Windowo o' - exe 'sil! menu '.g:NetrwMenuPriority.'.11.5 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Vertical\ Windowv v' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.1 '.g:NetrwTopLvlMenu.'Explore.Directory\ Name :Explore ' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.2 '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (curdir\ only):Explore\ */ :Explore */' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.2 '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (+subdirs):Explore\ **/ :Explore **/' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.3 '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ String\ Pattern\ (curdir\ only):Explore\ *// :Explore *//' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ String\ Pattern\ (+subdirs):Explore\ **// :Explore **//' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Next\ Match:Nexplore :Nexplore' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Prev\ Match:Pexplore :Pexplore' - exe 'sil! menu '.g:NetrwMenuPriority.'.13 '.g:NetrwTopLvlMenu.'Make\ Subdirectoryd d' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.1 '.g:NetrwTopLvlMenu.'Marked\ Files.Mark\ Filemf mf' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.2 '.g:NetrwTopLvlMenu.'Marked\ Files.Mark\ Files\ by\ Regexpmr mr' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.3 '.g:NetrwTopLvlMenu.'Marked\ Files.Hide-Show-List\ Controla a' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.4 '.g:NetrwTopLvlMenu.'Marked\ Files.Copy\ To\ Targetmc mc' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.5 '.g:NetrwTopLvlMenu.'Marked\ Files.DeleteD D' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.6 '.g:NetrwTopLvlMenu.'Marked\ Files.Diffmd md' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.7 '.g:NetrwTopLvlMenu.'Marked\ Files.Editme me' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.8 '.g:NetrwTopLvlMenu.'Marked\ Files.Exe\ Cmdmx mx' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.9 '.g:NetrwTopLvlMenu.'Marked\ Files.Move\ To\ Targetmm mm' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.10 '.g:NetrwTopLvlMenu.'Marked\ Files.ObtainO O' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.11 '.g:NetrwTopLvlMenu.'Marked\ Files.Printmp mp' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.12 '.g:NetrwTopLvlMenu.'Marked\ Files.ReplaceR R' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.13 '.g:NetrwTopLvlMenu.'Marked\ Files.Set\ Targetmt mt' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.14 '.g:NetrwTopLvlMenu.'Marked\ Files.TagmT mT' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.15 '.g:NetrwTopLvlMenu.'Marked\ Files.Zip/Unzip/Compress/Uncompressmz mz' - exe 'sil! menu '.g:NetrwMenuPriority.'.15 '.g:NetrwTopLvlMenu.'Obtain\ FileO O' - exe 'sil! menu '.g:NetrwMenuPriority.'.16.1 '.g:NetrwTopLvlMenu.'Style.Listing\ Style\ (thin-long-wide-tree)i i' - exe 'sil! menu '.g:NetrwMenuPriority.'.16.2 '.g:NetrwTopLvlMenu.'Style.Normal-Hide-Showa a' - exe 'sil! menu '.g:NetrwMenuPriority.'.16.3 '.g:NetrwTopLvlMenu.'Style.Reverse\ Sorting\ Order'."r r" - exe 'sil! menu '.g:NetrwMenuPriority.'.16.4 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method\ (name-time-size)s s' - exe 'sil! menu '.g:NetrwMenuPriority.'.17 '.g:NetrwTopLvlMenu.'Rename\ File/DirectoryR R' - exe 'sil! menu '.g:NetrwMenuPriority.'.18 '.g:NetrwTopLvlMenu.'Set\ Current\ Directoryc c' - call s:NetrwBookmarkMenu() " provide some history! uses priorities 2,3, reserves 4, 8.2.x - let s:netrw_menucnt= 28 - - elseif !a:domenu - let s:netrwcnt = 0 - let curwin = winnr() - windo if getline(2) =~ "Netrw" | let s:netrwcnt= s:netrwcnt + 1 | endif - exe curwin."wincmd w" - - if s:netrwcnt <= 1 -" call Decho("clear menus") - exe 'sil! unmenu '.g:NetrwTopLvlMenu -" call Decho('exe silent! unmenu '.g:NetrwTopLvlMenu.'*') - sil! unlet s:netrw_menu_enabled - endif - endif -" call Dret("NetrwMenu") - endif - -endfun - -" --------------------------------------------------------------------- -" s:NetrwObtain: obtain file under cursor or from markfile list {{{2 -" Used by the O maps (as NetrwObtain()) -fun! s:NetrwObtain(islocal) -" call Dfunc("NetrwObtain(islocal=".a:islocal.")") - - if exists("s:netrwmarkfilelist_{bufnr('%')}") - let islocal= s:netrwmarkfilelist_{bufnr('%')}[1] !~ '^\a\+://' - call netrw#NetrwObtain(islocal,s:netrwmarkfilelist_{bufnr('%')}) - call s:NetrwUnmarkList(bufnr('%'),b:netrw_curdir) - else - call netrw#NetrwObtain(a:islocal,expand("")) - endif - -" call Dret("NetrwObtain") -endfun - -" --------------------------------------------------------------------- -" netrw#NetrwObtain: {{{2 -" netrw#NetrwObtain(islocal,fname[,tgtdirectory]) -" islocal=0 obtain from remote source -" =1 obtain from local source -" fname : a filename or a list of filenames -" tgtdir : optional place where files are to go (not present, uses getcwd()) -fun! netrw#NetrwObtain(islocal,fname,...) -" call Dfunc("netrw#NetrwObtain(islocal=".a:islocal." fname<".((type(a:fname) == 1)? a:fname : string(a:fname)).">) a:0=".a:0) - " NetrwStatusLine support - for obtaining support - - if type(a:fname) == 1 - let fnamelist= [ a:fname ] - elseif type(a:fname) == 3 - let fnamelist= a:fname - else - call netrw#ErrorMsg(s:ERROR,"attempting to use NetrwObtain on something not a filename or a list",62) -" call Dret("netrw#NetrwObtain") - return - endif -" call Decho("fnamelist<".string(fnamelist).">") - if a:0 > 0 - let tgtdir= a:1 - else - let tgtdir= getcwd() - endif -" call Decho("tgtdir<".tgtdir.">") - - if exists("b:netrw_islocal") && b:netrw_islocal - " obtain a file from local b:netrw_curdir to (local) tgtdir -" call Decho("obtain a file from local ".b:netrw_curdir." to ".tgtdir) - if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir - let topath= s:ComposePath(tgtdir,"") - if (has("win32") || has("win95") || has("win64") || has("win16")) - " transfer files one at time -" call Decho("transfer files one at a time") - for fname in fnamelist -" call Decho("system(".g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath).")") - call system(g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath)) - endfor - else - " transfer files with one command -" call Decho("transfer files with one command") - let filelist= join(map(deepcopy(fnamelist),"shellescape(v:val)")) -" call Decho("system(".g:netrw_localcopycmd." ".filelist." ".shellescape(topath).")") - call system(g:netrw_localcopycmd." ".filelist." ".shellescape(topath)) - endif - elseif !exists("b:netrw_curdir") - call netrw#ErrorMsg(s:ERROR,"local browsing directory doesn't exist!",36) - else - call netrw#ErrorMsg(s:WARNING,"local browsing directory and current directory are identical",37) - endif - - else - " obtain files from remote b:netrw_curdir to local tgtdir -" call Decho("obtain a file from remote ".b:netrw_curdir." to ".tgtdir) - if type(a:fname) == 1 - call s:SetupNetrwStatusLine('%f %h%m%r%=%9*Obtaining '.a:fname) - endif - call s:NetrwMethod(b:netrw_curdir) - - if b:netrw_method == 4 - " obtain file using scp -" call Decho("obtain via scp (method#4)") - if exists("g:netrw_port") && g:netrw_port != "" - let useport= " ".g:netrw_scpport." ".g:netrw_port - else - let useport= "" - endif - if b:netrw_fname =~ '/' - let path= substitute(b:netrw_fname,'^\(.*/\).\{-}$','\1','') - else - let path= "" - endif - let filelist= join(map(deepcopy(fnamelist),'shellescape(g:netrw_machine.":".path.v:val,1)')) -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1)) - exe s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1) - - elseif b:netrw_method == 2 - " obtain file using ftp + .netrc -" call Decho("obtain via ftp+.netrc (method #2)") - call s:SaveBufVars()|silent keepjumps new|call s:RestoreBufVars() - let tmpbufnr= bufnr("%") - setlocal ff=unix - if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" - keepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) - endif - - if exists("b:netrw_fname") && b:netrw_fname != "" - call setline(line("$")+1,'cd "'.b:netrw_fname.'"') -" call Decho("filter input: ".getline('$')) - endif - - if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) - endif - for fname in fnamelist - call setline(line("$")+1,'get "'.fname.'"') -" call Decho("filter input: ".getline('$')) - endfor - if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) - exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) - else -" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) - exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) - endif - " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' - let debugkeep= &debug - setlocal debug=msg - call netrw#ErrorMsg(s:ERROR,getline(1),4) - let &debug= debugkeep - endif - - elseif b:netrw_method == 3 - " obtain with ftp + machine, id, passwd, and fname (ie. no .netrc) -" call Decho("obtain via ftp+mipf (method #3)") - call s:SaveBufVars()|silent keepjumps new|call s:RestoreBufVars() - let tmpbufnr= bufnr("%") - setlocal ff=unix - - if exists("g:netrw_port") && g:netrw_port != "" - keepj put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline('$')) - else - keepj put ='open '.g:netrw_machine -" call Decho("filter input: ".getline('$')) - endif +" call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + call netrw#NetrwRestorePosn(svpos) +" call Dret("s:NetrwUnMarkFile") +endfun - if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid -" call Decho("filter input: ".getline('$')) - keepj put ='\"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('$')) - else - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('$')) - endif +" --------------------------------------------------------------------- +" s:NetrwMenu: generates the menu for gvim and netrw {{{2 +fun! s:NetrwMenu(domenu) - if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" - keepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) - endif + if !exists("g:NetrwMenuPriority") + let g:NetrwMenuPriority= 80 + endif - if exists("b:netrw_fname") && b:netrw_fname != "" - keepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') -" call Decho("filter input: ".getline('$')) - endif + if has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu +" call Dfunc("NetrwMenu(domenu=".a:domenu.")") - if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) - endif + if !exists("s:netrw_menu_enabled") && a:domenu +" call Decho("initialize menu") + let s:netrw_menu_enabled= 1 + exe 'sil! menu '.g:NetrwMenuPriority.'.1 '.g:NetrwTopLvlMenu.'Help ' + exe 'sil! menu '.g:NetrwMenuPriority.'.5 '.g:NetrwTopLvlMenu.'-Sep1- :' + exe 'sil! menu '.g:NetrwMenuPriority.'.6 '.g:NetrwTopLvlMenu.'Go\ Up\ Directory- -' + exe 'sil! menu '.g:NetrwMenuPriority.'.7 '.g:NetrwTopLvlMenu.'Apply\ Special\ Viewerx x' + if g:netrw_dirhistmax > 0 + exe 'sil! menu '.g:NetrwMenuPriority.'.8.1 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Current\ Directorymb mb' + exe 'sil! menu '.g:NetrwMenuPriority.'.8.4 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Prev\ Dir\ (History)u u' + exe 'sil! menu '.g:NetrwMenuPriority.'.8.5 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Next\ Dir\ (History)U U' + exe 'sil! menu '.g:NetrwMenuPriority.'.8.6 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Listqb qb' + else + exe 'sil! menu '.g:NetrwMenuPriority.'.8 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History :echo "(disabled)"'."\" + endif + exe 'sil! menu '.g:NetrwMenuPriority.'.9.1 '.g:NetrwTopLvlMenu.'Browsing\ Control.Horizontal\ Splito o' + exe 'sil! menu '.g:NetrwMenuPriority.'.9.2 '.g:NetrwTopLvlMenu.'Browsing\ Control.Vertical\ Splitv v' + exe 'sil! menu '.g:NetrwMenuPriority.'.9.3 '.g:NetrwTopLvlMenu.'Browsing\ Control.New\ Tabt t' + exe 'sil! menu '.g:NetrwMenuPriority.'.9.4 '.g:NetrwTopLvlMenu.'Browsing\ Control.Previewp p' + exe 'sil! menu '.g:NetrwMenuPriority.'.9.5 '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ File\ Hiding\ List'." \'" + exe 'sil! menu '.g:NetrwMenuPriority.'.9.6 '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ Sorting\ SequenceS S' + exe 'sil! menu '.g:NetrwMenuPriority.'.9.7 '.g:NetrwTopLvlMenu.'Browsing\ Control.Quick\ Hide/Unhide\ Dot\ Files'."gh gh" + exe 'sil! menu '.g:NetrwMenuPriority.'.9.8 '.g:NetrwTopLvlMenu.'Browsing\ Control.Refresh\ Listing'." \" + exe 'sil! menu '.g:NetrwMenuPriority.'.9.9 '.g:NetrwTopLvlMenu.'Browsing\ Control.Settings/Options:NetrwSettings '.":NetrwSettings\" + exe 'sil! menu '.g:NetrwMenuPriority.'.10 '.g:NetrwTopLvlMenu.'Delete\ File/DirectoryD D' + exe 'sil! menu '.g:NetrwMenuPriority.'.11.1 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.Create\ New\ File% %' + exe 'sil! menu '.g:NetrwMenuPriority.'.11.1 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ Current\ Window '."\" + exe 'sil! menu '.g:NetrwMenuPriority.'.11.2 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.Preview\ File/Directoryp p' + exe 'sil! menu '.g:NetrwMenuPriority.'.11.3 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ Previous\ WindowP P' + exe 'sil! menu '.g:NetrwMenuPriority.'.11.4 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Windowo o' + exe 'sil! menu '.g:NetrwMenuPriority.'.11.5 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Vertical\ Windowv v' + exe 'sil! menu '.g:NetrwMenuPriority.'.12.1 '.g:NetrwTopLvlMenu.'Explore.Directory\ Name :Explore ' + exe 'sil! menu '.g:NetrwMenuPriority.'.12.2 '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (curdir\ only):Explore\ */ :Explore */' + exe 'sil! menu '.g:NetrwMenuPriority.'.12.2 '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (+subdirs):Explore\ **/ :Explore **/' + exe 'sil! menu '.g:NetrwMenuPriority.'.12.3 '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ String\ Pattern\ (curdir\ only):Explore\ *// :Explore *//' + exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ String\ Pattern\ (+subdirs):Explore\ **// :Explore **//' + exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Next\ Match:Nexplore :Nexplore' + exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Prev\ Match:Pexplore :Pexplore' + exe 'sil! menu '.g:NetrwMenuPriority.'.13 '.g:NetrwTopLvlMenu.'Make\ Subdirectoryd d' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.1 '.g:NetrwTopLvlMenu.'Marked\ Files.Mark\ Filemf mf' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.2 '.g:NetrwTopLvlMenu.'Marked\ Files.Mark\ Files\ by\ Regexpmr mr' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.3 '.g:NetrwTopLvlMenu.'Marked\ Files.Hide-Show-List\ Controla a' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.4 '.g:NetrwTopLvlMenu.'Marked\ Files.Copy\ To\ Targetmc mc' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.5 '.g:NetrwTopLvlMenu.'Marked\ Files.DeleteD D' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.6 '.g:NetrwTopLvlMenu.'Marked\ Files.Diffmd md' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.7 '.g:NetrwTopLvlMenu.'Marked\ Files.Editme me' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.8 '.g:NetrwTopLvlMenu.'Marked\ Files.Exe\ Cmdmx mx' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.9 '.g:NetrwTopLvlMenu.'Marked\ Files.Move\ To\ Targetmm mm' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.10 '.g:NetrwTopLvlMenu.'Marked\ Files.ObtainO O' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.11 '.g:NetrwTopLvlMenu.'Marked\ Files.Printmp mp' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.12 '.g:NetrwTopLvlMenu.'Marked\ Files.ReplaceR R' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.13 '.g:NetrwTopLvlMenu.'Marked\ Files.Set\ Targetmt mt' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.14 '.g:NetrwTopLvlMenu.'Marked\ Files.TagmT mT' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.15 '.g:NetrwTopLvlMenu.'Marked\ Files.Zip/Unzip/Compress/Uncompressmz mz' + exe 'sil! menu '.g:NetrwMenuPriority.'.15 '.g:NetrwTopLvlMenu.'Obtain\ FileO O' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.1.1 '.g:NetrwTopLvlMenu.'Style.Listing.thini :let w:netrw_liststyle=0' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.1.1 '.g:NetrwTopLvlMenu.'Style.Listing.longi :let w:netrw_liststyle=1' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.1.1 '.g:NetrwTopLvlMenu.'Style.Listing.widei :let w:netrw_liststyle=2' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.1.1 '.g:NetrwTopLvlMenu.'Style.Listing.treei :let w:netrw_liststyle=3' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.2.1 '.g:NetrwTopLvlMenu.'Style.Normal-Hide-Show.Show\ Alla :let g:netrw_hide=0' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.2.3 '.g:NetrwTopLvlMenu.'Style.Normal-Hide-Show.Normala :let g:netrw_hide=1' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.2.2 '.g:NetrwTopLvlMenu.'Style.Normal-Hide-Show.Hidden\ Onlya :let g:netrw_hide=2' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.3 '.g:NetrwTopLvlMenu.'Style.Reverse\ Sorting\ Order'."r r" + exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.1 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Names :let g:netrw_sort_by="name"' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.2 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Times :let g:netrw_sort_by="time"' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.3 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Sizes :let g:netrw_sort_by="size"' + exe 'sil! menu '.g:NetrwMenuPriority.'.17 '.g:NetrwTopLvlMenu.'Rename\ File/DirectoryR R' + exe 'sil! menu '.g:NetrwMenuPriority.'.18 '.g:NetrwTopLvlMenu.'Set\ Current\ Directoryc c' + let s:netrw_menucnt= 28 + call s:NetrwBookmarkMenu() " provide some history! uses priorities 2,3, reserves 4, 8.2.x + call s:NetrwTgtMenu() " let bookmarks and history be easy targets - if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) - endif - for fname in fnamelist - keepj call setline(line("$")+1,'get "'.fname.'"') - endfor -" call Decho("filter input: ".getline('$')) + elseif !a:domenu + let s:netrwcnt = 0 + let curwin = winnr() + windo if getline(2) =~ "Netrw" | let s:netrwcnt= s:netrwcnt + 1 | endif + exe curwin."wincmd w" - " perform ftp: - " -i : turns off interactive prompting from ftp - " -n unix : DON'T use <.netrc>, even though it exists - " -n win32: quit being obnoxious about password - keepj norm! 1Gdd -" call Decho("executing: %!".g:netrw_ftp_cmd." -i -n") - exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n" - " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - if getline(1) !~ "^$" -" call Decho("error<".getline(1).">") - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,getline(1),5) - endif + if s:netrwcnt <= 1 +" call Decho("clear menus") + exe 'sil! unmenu '.g:NetrwTopLvlMenu +" call Decho('exe sil! unmenu '.g:NetrwTopLvlMenu.'*') + sil! unlet s:netrw_menu_enabled endif - elseif !exists("b:netrw_method") || b:netrw_method < 0 -" call Dfunc("netrw#NetrwObtain : unsupported method") - return endif +" call Dret("NetrwMenu") + return + endif - " restore status line - if type(a:fname) == 1 && exists("s:netrw_users_stl") - call s:SetupNetrwStatusLine(s:netrw_users_stl) - endif +endfun - endif +" --------------------------------------------------------------------- +" s:NetrwObtain: obtain file under cursor or from markfile list {{{2 +" Used by the O maps (as NetrwObtain()) +fun! s:NetrwObtain(islocal) +" call Dfunc("NetrwObtain(islocal=".a:islocal.")") - " cleanup - if exists("tmpbufnr") - if bufnr("%") != tmpbufnr - exe tmpbufnr."bw!" - else - q! - endif + let ykeep= @@ + if exists("s:netrwmarkfilelist_{bufnr('%')}") + let islocal= s:netrwmarkfilelist_{bufnr('%')}[1] !~ '^\a\+://' + call netrw#NetrwObtain(islocal,s:netrwmarkfilelist_{bufnr('%')}) + call s:NetrwUnmarkList(bufnr('%'),b:netrw_curdir) + else + call netrw#NetrwObtain(a:islocal,expand("")) endif + let @@= ykeep -" call Dret("netrw#NetrwObtain") +" call Dret("NetrwObtain") endfun " --------------------------------------------------------------------- @@ -5506,6 +6709,7 @@ endfun fun! s:NetrwPrevWinOpen(islocal) " call Dfunc("NetrwPrevWinOpen(islocal=".a:islocal.")") + let ykeep= @@ " grab a copy of the b:netrw_curdir to pass it along to newly split windows let curdir = b:netrw_curdir @@ -5520,19 +6724,21 @@ fun! s:NetrwPrevWinOpen(islocal) " if only one window, open a new one first " call Decho("only one window, so open a new one (g:netrw_alto=".g:netrw_alto.")") if g:netrw_preview -" call Decho("exe ".(g:netrw_alto? "top " : "bot ")."vert ".g:netrw_winsize."wincmd s") - exe (g:netrw_alto? "top " : "bot ")."vert ".g:netrw_winsize."wincmd s" + let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize +" call Decho("exe ".(g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s") + exe (g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s" else -" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s") - exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s" + let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize +" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s") + exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s" endif let didsplit = 1 else - call s:SaveBufVars() + keepj call s:SaveBufVars() " call Decho("wincmd p") wincmd p - call s:RestoreBufVars() + keepj call s:RestoreBufVars() " if the previous window's buffer has been changed (is modified), " and it doesn't appear in any other extant window, then ask the " user if s/he wants to abandon modifications therein. @@ -5554,7 +6760,7 @@ fun! s:NetrwPrevWinOpen(islocal) if choice == 1 " Yes -- write file & then browse let v:errmsg= "" - silent w + sil w if v:errmsg != "" call netrw#ErrorMsg(s:ERROR,"unable to write <".bufname.">!",30) if didsplit @@ -5562,14 +6768,17 @@ fun! s:NetrwPrevWinOpen(islocal) else wincmd p endif + let @@= ykeep " call Dret("NetrwPrevWinOpen ".choice." : unable to write <".bufname.">") return choice endif elseif choice == 2 " No -- don't worry about changed file, just browse anyway - setlocal nomod - call netrw#ErrorMsg(s:WARNING,bufname." changes to ".bufname." abandoned",31) +" call Decho("(NetrwPrevWinOpen) setl nomod") + setl nomod +" call Decho("(NetrwPrevWinOpen) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") + keepj call netrw#ErrorMsg(s:WARNING,bufname." changes to ".bufname." abandoned",31) wincmd p else @@ -5579,6 +6788,7 @@ fun! s:NetrwPrevWinOpen(islocal) else wincmd p endif + let @@= ykeep " call Dret("NetrwPrevWinOpen ".choice." : cancelled") return choice endif @@ -5595,6 +6805,7 @@ fun! s:NetrwPrevWinOpen(islocal) call s:NetrwBrowse(a:islocal,s:NetrwBrowseChgDir(a:islocal,curword)) endif endif + let @@= ykeep " call Dret("NetrwPrevWinOpen ".choice) return choice endfun @@ -5644,7 +6855,7 @@ fun! s:NetrwUpload(fname,tgt,...) " call Decho("handle uploading a list of files via scp") let curdir= getcwd() if a:tgt =~ '^scp:' - exe "keepjumps silent lcd ".fnameescape(fromdir) + exe "keepjumps sil lcd ".fnameescape(fromdir) let filelist= deepcopy(s:netrwmarkfilelist_{bufnr('%')}) let args = join(map(filelist,"shellescape(v:val, 1)")) if exists("g:netrw_port") && g:netrw_port != "" @@ -5656,7 +6867,7 @@ fun! s:NetrwUpload(fname,tgt,...) let tgt = substitute(a:tgt,'^scp://[^/]\+/\(.*\)$','\1','') " call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".args." ".shellescape(machine.":".tgt,1)) exe s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".args." ".shellescape(machine.":".tgt,1) - exe "keepjumps silent lcd ".fnameescape(curdir) + exe "keepjumps sil lcd ".fnameescape(curdir) elseif a:tgt =~ '^ftp:' call s:NetrwMethod(a:tgt) @@ -5678,6 +6889,9 @@ fun! s:NetrwUpload(fname,tgt,...) keepj call setline(line("$")+1,'lcd "'.fromdir.'"') " call Decho("filter input: ".getline('$')) + if tgtdir == "" + let tgtdir= '/' + endif keepj call setline(line("$")+1,'cd "'.tgtdir.'"') " call Decho("filter input: ".getline('$')) @@ -5687,12 +6901,12 @@ fun! s:NetrwUpload(fname,tgt,...) endfor if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("executing: ".s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) - exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) +" call Decho("executing: ".s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) + exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) else " call Decho("filter input window#".winnr()) -" call Decho("executing: ".s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) - exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) +" call Decho("executing: ".s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) + exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) endif " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) sil keepj g/Local directory now/d @@ -5706,9 +6920,9 @@ fun! s:NetrwUpload(fname,tgt,...) elseif b:netrw_method == 3 " upload with ftp + machine, id, passwd, and fname (ie. no .netrc) let netrw_fname= b:netrw_fname - call s:SaveBufVars()|silent keepjumps new|call s:RestoreBufVars() + keepj call s:SaveBufVars()|sil keepj new|keepj call s:RestoreBufVars() let tmpbufnr= bufnr("%") - setlocal ff=unix + setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" keepj put ='open '.g:netrw_machine.' '.g:netrw_port @@ -5718,14 +6932,18 @@ fun! s:NetrwUpload(fname,tgt,...) " call Decho("filter input: ".getline('$')) endif - if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid -" call Decho("filter input: ".getline('$')) - keepj call setline(line("$")+1,'"'.s:netrw_passwd.'"') -" call Decho("filter input: ".getline('$')) - else - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('$')) + if exists("g:netrw_uid") && g:netrw_uid != "" + if exists("g:netrw_ftp") && g:netrw_ftp == 1 + keepj put =g:netrw_uid +" call Decho("filter input: ".getline('$')) + if exists("s:netrw_passwd") + keepj call setline(line("$")+1,'"'.s:netrw_passwd.'"') + endif +" call Decho("filter input: ".getline('$')) + elseif exists("s:netrw_passwd") + keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' +" call Decho("filter input: ".getline('$')) + endif endif keepj call setline(line("$")+1,'lcd "'.fromdir.'"') @@ -5751,14 +6969,14 @@ fun! s:NetrwUpload(fname,tgt,...) " -n unix : DON'T use <.netrc>, even though it exists " -n win32: quit being obnoxious about password keepj norm! 1Gdd -" call Decho("executing: ".s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n") - exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n" +" call Decho("executing: ".s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) + exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) sil keepj g/Local directory now/d call histdel("/",-1) if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' let debugkeep= &debug - setlocal debug=msg + setl debug=msg call netrw#ErrorMsg(s:ERROR,getline(1),15) let &debug = debugkeep let mod = 1 @@ -5781,25 +6999,28 @@ endfun " s:NetrwPreview: {{{2 fun! s:NetrwPreview(path) range " call Dfunc("NetrwPreview(path<".a:path.">)") - call s:NetrwOptionSave("s:") - call s:NetrwSafeOptions() + let ykeep= @@ + keepj call s:NetrwOptionSave("s:") + keepj call s:NetrwSafeOptions() if has("quickfix") if !isdirectory(a:path) if g:netrw_preview && !g:netrw_alto - let pvhkeep= &pvh - let &pvh = winwidth(0) - g:netrw_winsize + let pvhkeep = &pvh + let winsz = (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize + let &pvh = winwidth(0) - winsz endif exe (g:netrw_alto? "top " : "bot ").(g:netrw_preview? "vert " : "")."pedit ".fnameescape(a:path) if exists("pvhkeep") let &pvh= pvhkeep endif elseif !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:WARNING,"sorry, cannot preview a directory such as <".a:path.">",38) + keepj call netrw#ErrorMsg(s:WARNING,"sorry, cannot preview a directory such as <".a:path.">",38) endif elseif !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:WARNING,"sorry, to preview your vim needs the quickfix feature compiled in",39) + keepj call netrw#ErrorMsg(s:WARNING,"sorry, to preview your vim needs the quickfix feature compiled in",39) endif - call s:NetrwOptionRestore("s:") + keepj call s:NetrwOptionRestore("s:") + let @@= ykeep " call Dret("NetrwPreview") endfun @@ -5808,18 +7029,21 @@ endfun fun! s:NetrwRefresh(islocal,dirname) " call Dfunc("NetrwRefresh(islocal<".a:islocal.">,dirname=".a:dirname.") hide=".g:netrw_hide." sortdir=".g:netrw_sort_direction) " at the current time (Mar 19, 2007) all calls to NetrwRefresh() call NetrwBrowseChgDir() first. - " NetrwBrowseChgDir() may clear the display; hence a NetrwSavePosn() may not work if its placed here. - " Also, NetrwBrowseChgDir() now does a NetrwSavePosn() itself. - setlocal ma noro -" call Decho("setlocal ma noro") + " (defunct) NetrwBrowseChgDir() may clear the display; hence a NetrwSavePosn() may not work if its placed here. + " (defunct) Also, NetrwBrowseChgDir() now does a NetrwSavePosn() itself. + setl ma noro +" call Decho("setl ma noro") " call Decho("clear buffer<".expand("%")."> with :%d") + let ykeep = @@ + let screenposn = netrw#NetrwSavePosn() +" call Decho("clearing buffer prior to refresh") sil! keepj %d if a:islocal - call netrw#LocalBrowseCheck(a:dirname) + keepj call netrw#LocalBrowseCheck(a:dirname) else - call s:NetrwBrowse(a:islocal,a:dirname) + keepj call s:NetrwBrowse(a:islocal,a:dirname) endif - call netrw#NetrwRestorePosn() + keepj call netrw#NetrwRestorePosn(screenposn) " restore file marks if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != "" @@ -5830,7 +7054,8 @@ fun! s:NetrwRefresh(islocal,dirname) 2match none endif -" redraw! +" restore + let @@= ykeep " call Dret("NetrwRefresh") endfun @@ -5839,7 +7064,7 @@ endfun " Called by NetrwMarkFileCopy() " Interfaces to s:NetrwRefresh() and s:LocalBrowseShellCmdRefresh() fun! s:NetrwRefreshDir(islocal,dirname) -" call Dfunc("s:NetrwRefreshDir(islocal=".a:islocal." dirname<".a:dirname.">) fastbrowse=".g:netrw_fastbrowse) +" call Dfunc("s:NetrwRefreshDir(islocal=".a:islocal." dirname<".a:dirname.">) g:netrw_fastbrowse=".g:netrw_fastbrowse) if g:netrw_fastbrowse == 0 " slowest mode (keep buffers refreshed, local or remote) " call Decho("slowest mode: keep buffers refreshed, local or remote") @@ -5851,18 +7076,18 @@ fun! s:NetrwRefreshDir(islocal,dirname) let curwin= winnr() " call Decho("refresh tgtwin#".tgtwin." (curwin#".curwin.")") exe tgtwin."wincmd w" - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) exe curwin."wincmd w" elseif bufnr(a:dirname) > 0 let bn= bufnr(a:dirname) " call Decho("bd bufnr(".a:dirname.")=".bn) - exe "silent bd ".bn + exe "sil bd ".bn endif elseif g:netrw_fastbrowse <= 1 " call Decho("medium-speed mode: refresh local buffers only") - call s:LocalBrowseShellCmdRefresh() + keepj call s:LocalBrowseShellCmdRefresh() endif " call Dret("s:NetrwRefreshDir") endfun @@ -5875,6 +7100,7 @@ endfun " front. An "*" pattern handles the default priority. fun! s:NetrwSetSort() " call Dfunc("SetSort() bannercnt=".w:netrw_bannercnt) + let ykeep= @@ if w:netrw_liststyle == s:LONGLIST let seqlist = substitute(g:netrw_sort_sequence,'\$','\\%(\t\\|\$\\)','ge') else @@ -5918,13 +7144,13 @@ fun! s:NetrwSetSort() " sometimes multiple sorting patterns will match the same file or directory. " The following substitute is intended to remove the excess matches. exe 'sil keepj '.w:netrw_bannercnt.',$g/^\d\{3}'.g:netrw_sepchr.'\d\{3}\//s/^\d\{3}'.g:netrw_sepchr.'\(\d\{3}\/\).\@=/\1/e' - call histdel("/",-1) + keepj call histdel("/",-1) endif let priority = priority + 1 endwhile if exists("starpriority") exe 'sil keepj '.w:netrw_bannercnt.',$v/^\d\{3}'.g:netrw_sepchr.'/s/^/'.starpriority.'/' - call histdel("/",-1) + keepj call histdel("/",-1) endif " Following line associated with priority -- items that satisfy a priority @@ -5934,22 +7160,54 @@ fun! s:NetrwSetSort() " priority prefixes need to be removed, but not directories that happen to " be just digits themselves. exe 'sil keepj '.w:netrw_bannercnt.',$s/^\(\d\{3}'.g:netrw_sepchr.'\)\%(\d\{3}'.g:netrw_sepchr.'\)\+\ze./\1/e' - call histdel("/",-1) + keepj call histdel("/",-1) + let @@= ykeep " call Dret("SetSort") endfun +" --------------------------------------------------------------------- +" s:NetrwSetTgt: sets the target to the specified choice index {{{2 +" Implements [count]Tb (bookhist) +" [count]Th (bookhist) +" See :help netrw-qb for how to make the choice. +fun! s:NetrwSetTgt(bookhist,choice) +" call Dfunc("s:NetrwSetTgt(bookhist<".a:bookhist."> choice#".a:choice.")") + + if a:bookhist == 'b' + " supports choosing a bookmark as a target using a qb-generated list + let choice= a:choice - 1 + if exists("g:netrw_bookmarklist[".choice."]") + call netrw#NetrwMakeTgt(g:netrw_bookmarklist[choice]) + else + echomsg "Sorry, bookmark#".a:choice." doesn't exist!" + endif + + elseif a:bookhist == 'h' + " supports choosing a history stack entry as a target using a qb-generated list + let choice= (a:choice % g:netrw_dirhistmax) + 1 + if exists("g:netrw_dirhist_".choice) + let histentry = g:netrw_dirhist_{choice} + call netrw#NetrwMakeTgt(histentry) + else + echomsg "Sorry, history#".a:choice." not available!" + endif + endif + +" call Dret("s:NetrwSetTgt") +endfun + " ===================================================================== " s:NetrwSortStyle: change sorting style (name - time - size) and refresh display {{{2 fun! s:NetrwSortStyle(islocal) " call Dfunc("s:NetrwSortStyle(islocal=".a:islocal.") netrw_sort_by<".g:netrw_sort_by.">") - call s:NetrwSaveWordPosn() + keepj call s:NetrwSaveWordPosn() let svpos= netrw#NetrwSavePosn() let g:netrw_sort_by= (g:netrw_sort_by =~ 'n')? 'time' : (g:netrw_sort_by =~ 't')? 'size' : 'name' keepj norm! 0 - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - call netrw#NetrwRestorePosn(svpos) + keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + keepj call netrw#NetrwRestorePosn(svpos) " call Dret("s:NetrwSortStyle : netrw_sort_by<".g:netrw_sort_by.">") endfun @@ -5965,15 +7223,17 @@ endfun fun! s:NetrwSplit(mode) " call Dfunc("s:NetrwSplit(mode=".a:mode.") alto=".g:netrw_alto." altv=".g:netrw_altv) + let ykeep= @@ call s:SaveWinVars() if a:mode == 0 " remote and o -" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s") - exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s" + let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize +" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s") + exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s" let s:didsplit= 1 - call s:RestoreWinVars() - call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) + keepj call s:RestoreWinVars() + keepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) unlet s:didsplit elseif a:mode == 1 @@ -5982,26 +7242,28 @@ fun! s:NetrwSplit(mode) " call Decho("tabnew") tabnew let s:didsplit= 1 - call s:RestoreWinVars() - call s:NetrwBrowse(0,newdir) + keepj call s:RestoreWinVars() + keepj call s:NetrwBrowse(0,newdir) unlet s:didsplit elseif a:mode == 2 " remote and v -" call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v") - exe (g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v" + let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize +" call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v") + exe (g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v" let s:didsplit= 1 - call s:RestoreWinVars() - call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) + keepj call s:RestoreWinVars() + keepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) unlet s:didsplit elseif a:mode == 3 " local and o -" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s") - exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s" + let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize +" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s") + exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s" let s:didsplit= 1 - call s:RestoreWinVars() - call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) + keepj call s:RestoreWinVars() + keepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) unlet s:didsplit elseif a:mode == 4 @@ -6012,57 +7274,76 @@ fun! s:NetrwSplit(mode) tabnew let b:netrw_curdir= netrw_curdir let s:didsplit= 1 - call s:RestoreWinVars() - call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,cursorword)) + keepj call s:RestoreWinVars() + keepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,cursorword)) unlet s:didsplit elseif a:mode == 5 " local and v -" call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v") - exe (g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v" + let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize +" call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v") + exe (g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v" let s:didsplit= 1 - call s:RestoreWinVars() - call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) + keepj call s:RestoreWinVars() + keepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) unlet s:didsplit else - call netrw#ErrorMsg(s:ERROR,"(NetrwSplit) unsupported mode=".a:mode,45) + keepj call netrw#ErrorMsg(s:ERROR,"(NetrwSplit) unsupported mode=".a:mode,45) endif + let @@= ykeep " call Dret("s:NetrwSplit") endfun " --------------------------------------------------------------------- -" NetrwStatusLine: {{{2 -fun! NetrwStatusLine() +" s:NetrwTgtMenu: {{{2 +fun! s:NetrwTgtMenu() + if !exists("s:netrw_menucnt") + return + endif +" call Dfunc("s:NetrwTgtMenu()") -" vvv NetrwStatusLine() debugging vvv -" let g:stlmsg="" -" if !exists("w:netrw_explore_bufnr") -" let g:stlmsg="!X" -" elseif w:netrw_explore_bufnr != bufnr("%") -" let g:stlmsg="explore_bufnr!=".bufnr("%") -" endif -" if !exists("w:netrw_explore_line") -" let g:stlmsg=" !X" -" elseif w:netrw_explore_line != line(".") -" let g:stlmsg=" explore_line!={line(.)<".line(".").">" -" endif -" if !exists("w:netrw_explore_list") -" let g:stlmsg=" !X" -" endif -" ^^^ NetrwStatusLine() debugging ^^^ + " the following test assures that gvim is running, has menus available, and has menus enabled. + if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu + if exists("g:NetrwTopLvlMenu") +" call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)") + exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Targets' + endif + if !exists("s:netrw_initbookhist") + call s:NetrwBookHistRead() + endif - if !exists("w:netrw_explore_bufnr") || w:netrw_explore_bufnr != bufnr("%") || !exists("w:netrw_explore_line") || w:netrw_explore_line != line(".") || !exists("w:netrw_explore_list") - " restore user's status line - let &stl = s:netrw_users_stl - let &laststatus = s:netrw_users_ls - if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif - if exists("w:netrw_explore_line") |unlet w:netrw_explore_line |endif - return "" - else - return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen + " target bookmarked places + if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] && g:netrw_dirhistmax > 0 +" call Decho("installing bookmarks as easy targets") + let cnt= 1 + for bmd in g:netrw_bookmarklist + let ebmd= escape(bmd,g:netrw_menu_escape) + " show bookmarks for goto menu +" call Decho("menu: Targets: ".bmd) + exe 'sil! menu '.g:NetrwMenuPriority.".19.1.".cnt." ".g:NetrwTopLvlMenu.'Targets.'.ebmd." :call netrw#NetrwMakeTgt('".bmd."')\" + let cnt= cnt + 1 + endfor + endif + + " target directory browsing history + if exists("g:netrw_dirhistmax") && g:netrw_dirhistmax > 0 +" call Decho("installing history as easy targets (histmax=".g:netrw_dirhistmax.")") + let histcnt = 1 + while histcnt <= g:netrw_dirhistmax + let priority = g:netrw_dirhist_cnt + histcnt + if exists("g:netrw_dirhist_{histcnt}") + let histentry = g:netrw_dirhist_{histcnt} + let ehistentry = escape(histentry,g:netrw_menu_escape) +" call Decho("menu: Targets: ".histentry) + exe 'sil! menu '.g:NetrwMenuPriority.".19.2.".priority." ".g:NetrwTopLvlMenu.'Targets.'.ehistentry." :call netrw#NetrwMakeTgt('".histentry."')\" + endif + let histcnt = histcnt + 1 + endwhile + endif endif +" call Dret("s:NetrwTgtMenu") endfun " --------------------------------------------------------------------- @@ -6072,12 +7353,12 @@ fun! s:NetrwTreeDir() " call Dfunc("NetrwTreeDir() curline#".line(".")."<".getline('.')."> b:netrw_curdir<".b:netrw_curdir."> tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%").">") let treedir= b:netrw_curdir -" call Decho("set initial treedir<".treedir.">") +" call Decho("(NetrwTreeDir) set initial treedir<".treedir.">") let s:treecurpos= netrw#NetrwSavePosn() if w:netrw_liststyle == s:TREELIST -" call Decho("w:netrrw_liststyle is TREELIST:") -" call Decho("line#".line(".")." getline(.)<".getline('.')."> treecurpos<".string(s:treecurpos).">") +" call Decho("(NetrwTreeDir) w:netrw_liststyle is TREELIST:") +" call Decho("(NetrwTreeDir) line#".line(".")." getline(.)<".getline('.')."> treecurpos<".string(s:treecurpos).">") " extract tree directory if on a line specifying a subdirectory (ie. ends with "/") if getline('.') =~ '/$' @@ -6085,13 +7366,13 @@ fun! s:NetrwTreeDir() else let treedir= "" endif -" call Decho("treedir<".treedir.">") +" call Decho("(NetrwTreeDir) treedir<".treedir.">") " detect user attempting to close treeroot if getline('.') !~ '|' && getline('.') != '..' " call Decho("user attempted to close treeroot") " now force a refresh -" call Decho("clear buffer<".expand("%")."> with :%d") +" call Decho("(NetrwTreeDir) clear buffer<".expand("%")."> with :%d") sil! keepj %d " call Dret("NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".string(s:treecurpos).">") return b:netrw_curdir @@ -6099,26 +7380,26 @@ fun! s:NetrwTreeDir() " elide all non-depth information let depth = substitute(getline('.'),'^\(\%(| \)*\)[^|].\{-}$','\1','e') -" call Decho("depth<".depth."> 1st subst (non-depth info removed)") +" call Decho("(NetrwTreeDir) depth<".depth."> 1st subst (non-depth info removed)") " elide first depth let depth = substitute(depth,'^| ','','') -" call Decho("depth<".depth."> 2nd subst (first depth removed)") +" call Decho("(NetrwTreeDir) depth<".depth."> 2nd subst (first depth removed)") " construct treedir by searching backwards at correct depth -" call Decho("constructing treedir<".treedir."> depth<".depth.">") +" call Decho("(NetrwTreeDir) constructing treedir<".treedir."> depth<".depth.">") while depth != "" && search('^'.depth.'[^|].\{-}/$','bW') let dirname= substitute(getline('.'),'^\(| \)*','','e') let treedir= dirname.treedir let depth = substitute(depth,'^| ','','') -" call Decho("constructing treedir<".treedir.">: dirname<".dirname."> while depth<".depth.">") +" call Decho("(NetrwTreeDir) constructing treedir<".treedir.">: dirname<".dirname."> while depth<".depth.">") endwhile if w:netrw_treetop =~ '/$' let treedir= w:netrw_treetop.treedir else let treedir= w:netrw_treetop.'/'.treedir endif -" call Decho("bufnr(.)=".bufnr("%")." line($)=".line("$")." line(.)=".line(".")) +" call Decho("(NetrwTreeDir) bufnr(.)=".bufnr("%")." line($)=".line("$")." line(.)=".line(".")) endif let treedir= substitute(treedir,'//$','/','') @@ -6132,7 +7413,7 @@ fun! s:NetrwTreeDisplay(dir,depth) " call Dfunc("NetrwTreeDisplay(dir<".a:dir."> depth<".a:depth.">)") " insure that there are no folds - setlocal nofen + setl nofen " install ../ and shortdir if a:depth == "" @@ -6167,10 +7448,10 @@ fun! s:NetrwTreeDisplay(dir,depth) " call Decho("dir<".dir."> entry<".entry."> direntry<".direntry.">") if entry =~ '/$' && has_key(w:netrw_treedict,direntry) " call Decho("<".direntry."> is a key in treedict - display subtree for it") - call s:NetrwTreeDisplay(direntry,depth) + keepj call s:NetrwTreeDisplay(direntry,depth) elseif entry =~ '/$' && has_key(w:netrw_treedict,direntry.'/') " call Decho("<".direntry."/> is a key in treedict - display subtree for it") - call s:NetrwTreeDisplay(direntry.'/',depth) + keepj call s:NetrwTreeDisplay(direntry.'/',depth) else " call Decho("<".entry."> is not a key in treedict (no subtree)") sil! keepj call setline(line("$")+1,depth.entry) @@ -6219,9 +7500,10 @@ fun! s:NetrwTreeListing(dirname) " call Decho("fname<".fname.">") " display from treetop on down - call s:NetrwTreeDisplay(w:netrw_treetop,"") + keepj call s:NetrwTreeDisplay(w:netrw_treetop,"") " call Dret("NetrwTreeListing : bufname<".expand("%").">") + return endif endfun @@ -6235,12 +7517,12 @@ fun! s:NetrwWideListing() " cpf: characters per filename " fpl: filenames per line " fpc: filenames per column - setlocal ma noro -" call Decho("setlocal ma noro") + setl ma noro +" call Decho("setl ma noro") let b:netrw_cpf= 0 if line("$") >= w:netrw_bannercnt exe 'sil keepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' - call histdel("/",-1) + keepj call histdel("/",-1) else " call Dret("NetrwWideListing") return @@ -6257,7 +7539,7 @@ fun! s:NetrwWideListing() " make wide display exe 'sil keepj '.w:netrw_bannercnt.',$s/^.*$/\=escape(printf("%-'.b:netrw_cpf.'s",submatch(0)),"\\")/' - call histdel("/",-1) + keepj call histdel("/",-1) let fpc = (line("$") - w:netrw_bannercnt + w:netrw_fpl)/w:netrw_fpl let newcolstart = w:netrw_bannercnt + fpc let newcolend = newcolstart + fpc - 1 @@ -6275,11 +7557,23 @@ fun! s:NetrwWideListing() exe "sil! keepj ".newcolstart.','.newcolend.'d' exe 'sil! keepj '.w:netrw_bannercnt endwhile - silent! let @*= keepregstar + sil! let @*= keepregstar exe "sil! keepj ".w:netrw_bannercnt.',$s/\s\+$//e' - call histdel("/",-1) - setlocal noma nomod ro + keepj call histdel("/",-1) + exe "nmap w /^\\\\|\\s\\s\\zs\\S/\" + exe "nmap b ?^\\\\|\\s\\s\\zs\\S?\" +" call Decho("NetrwWideListing) setl noma nomod ro") + setl noma nomod ro +" call Decho("(NetrwWideListing) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") " call Dret("NetrwWideListing") + return + else + if hasmapto("w","n") + sil! nunmap w + endif + if hasmapto("b","n") + sil! nunmap b + endif endif endfun @@ -6289,33 +7583,47 @@ endfun fun! s:PerformListing(islocal) " call Dfunc("s:PerformListing(islocal=".a:islocal.") bufnr(%)=".bufnr("%")."<".bufname("%").">") - call s:NetrwSafeOptions() - setlocal noro ma -" call Decho("setlocal noro ma") + " set up syntax highlighting {{{3 +" call Decho("(PerformListing) set up syntax highlighting") + if has("syntax") + if !exists("g:syntax_on") || !g:syntax_on +" call Decho("(PerformListing) but g:syntax_on".(exists("g:syntax_on")? "=".g:syntax_on : "")) + setl ft= + elseif &ft != "netrw" + setl ft=netrw + endif + endif + + keepj call s:NetrwSafeOptions() + set noro ma +" call Decho("(PerformListing) setl noro ma bh=".&bh) " if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 " Decho -" call Decho("(netrw) Processing your browsing request...") +" call Decho("(PerformListing) (netrw) Processing your browsing request...") " endif " Decho " call Decho('w:netrw_liststyle='.(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " force a refresh for tree listings -" call Decho("force refresh for treelisting: clear buffer<".expand("%")."> with :%d") +" call Decho("(PerformListing) force refresh for treelisting: clear buffer<".expand("%")."> with :%d") sil! keepj %d endif " save current directory on directory history list - call s:NetrwBookHistHandler(3,b:netrw_curdir) + keepj call s:NetrwBookHistHandler(3,b:netrw_curdir) " Set up the banner {{{3 if g:netrw_banner -" call Decho("set up banner") - keepj put ='\" ============================================================================' - keepj put ='\" Netrw Directory Listing (netrw '.g:loaded_netrw.')' - keepj put ='\" '.b:netrw_curdir - keepj 1d +" call Decho("(PerformListing) set up banner") + keepj call setline(1,'" ============================================================================') + keepj call setline(2,'" Netrw Directory Listing (netrw '.g:loaded_netrw.')') + if exists("g:netrw_bannerbackslash") && g:netrw_bannerbackslash + keepj call setline(3,'" '.substitute(b:netrw_curdir,'/','\\','g')) + else + keepj call setline(3,'" '.b:netrw_curdir) + endif let w:netrw_bannercnt= 3 - exe "sil! keepj ".w:netrw_bannercnt + keepj exe "sil! keepj ".w:netrw_bannercnt else keepj 1 let w:netrw_bannercnt= 1 @@ -6328,15 +7636,15 @@ fun! s:PerformListing(islocal) " Sorted by... {{{3 if g:netrw_banner -" call Decho("handle specified sorting: g:netrw_sort_by<".g:netrw_sort_by.">") +" call Decho("(PerformListing) handle specified sorting: g:netrw_sort_by<".g:netrw_sort_by.">") if g:netrw_sort_by =~ "^n" -" call Decho("directories will be sorted by name") +" call Decho("(PerformListing) directories will be sorted by name") " sorted by name keepj put ='\" Sorted by '.sortby keepj put ='\" Sort sequence: '.g:netrw_sort_sequence let w:netrw_bannercnt= w:netrw_bannercnt + 2 else -" call Decho("directories will be sorted by size or time") +" call Decho("(PerformListing) directories will be sorted by size or time") " sorted by size or date keepj put ='\" Sorted by '.sortby let w:netrw_bannercnt= w:netrw_bannercnt + 1 @@ -6347,7 +7655,7 @@ fun! s:PerformListing(islocal) " show copy/move target, if any if g:netrw_banner if exists("s:netrwmftgt") && exists("s:netrwmftgt_islocal") -" call Decho("show copy/move target<".s:netrwmftgt.">") +" call Decho("(PerformListing) show copy/move target<".s:netrwmftgt.">") keepj put ='' if s:netrwmftgt_islocal sil! keepj call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (local)') @@ -6356,14 +7664,14 @@ fun! s:PerformListing(islocal) endif let w:netrw_bannercnt= w:netrw_bannercnt + 1 else -" call Decho("s:netrwmftgt does not exist, don't make Copy/Move Tgt") +" call Decho("(PerformListing) s:netrwmftgt does not exist, don't make Copy/Move Tgt") endif exe "sil! keepj ".w:netrw_bannercnt endif " Hiding... -or- Showing... {{{3 if g:netrw_banner -" call Decho("handle hiding/showing (g:netrw_hide=".g:netrw_list_hide." g:netrw_list_hide<".g:netrw_list_hide.">)") +" call Decho("(PerformListing) handle hiding/showing (g:netrw_hide=".g:netrw_list_hide." g:netrw_list_hide<".g:netrw_list_hide.">)") if g:netrw_list_hide != "" && g:netrw_hide if g:netrw_hide == 1 keepj put ='\" Hiding: '.g:netrw_list_hide @@ -6382,43 +7690,38 @@ fun! s:PerformListing(islocal) if g:netrw_banner let w:netrw_bannercnt= w:netrw_bannercnt + 1 exe "sil! keepj ".w:netrw_bannercnt -" call Decho("bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$")) - endif - - " set up syntax highlighting {{{3 -" call Decho("set up syntax highlighting") - if has("syntax") - setf netrw - if !exists("g:syntax_on") || !g:syntax_on - setlocal ft= - endif +" call Decho("(PerformListing) w:netrw_bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$")) endif " get list of files -" call Decho("Get list of files - islocal=".a:islocal) +" call Decho("(PerformListing) Get list of files - islocal=".a:islocal) if a:islocal - call s:LocalListing() + keepj call s:LocalListing() else " remote - call s:NetrwRemoteListing() + keepj call s:NetrwRemoteListing() endif -" call Decho("g:netrw_banner=".g:netrw_banner." w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)") " manipulate the directory listing (hide, sort) {{{3 + if !exists("w:netrw_bannercnt") + let w:netrw_bannercnt= 0 + endif +" call Decho("(PerformListing) g:netrw_banner=".g:netrw_banner." w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)") + if !g:netrw_banner || line("$") >= w:netrw_bannercnt -" call Decho("manipulate directory listing (hide)") -" call Decho("g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">") +" call Decho("(PerformListing) manipulate directory listing (hide)") +" call Decho("(PerformListing) g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">") if g:netrw_hide && g:netrw_list_hide != "" - call s:NetrwListHide() + keepj call s:NetrwListHide() endif if !g:netrw_banner || line("$") >= w:netrw_bannercnt -" call Decho("manipulate directory listing (sort) : g:netrw_sort_by<".g:netrw_sort_by.">") +" call Decho("(PerformListing) manipulate directory listing (sort) : g:netrw_sort_by<".g:netrw_sort_by.">") if g:netrw_sort_by =~ "^n" " sort by name - call s:NetrwSetSort() + keepj call s:NetrwSetSort() if !g:netrw_banner || w:netrw_bannercnt < line("$") -" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")") +" call Decho("(PerformListing) g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")") if g:netrw_sort_direction =~ 'n' " normal direction sorting exe 'sil keepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options @@ -6428,22 +7731,22 @@ fun! s:PerformListing(islocal) endif endif " remove priority pattern prefix -" call Decho("remove priority pattern prefix") +" call Decho("(PerformListing) remove priority pattern prefix") exe 'sil! keepj '.w:netrw_bannercnt.',$s/^\d\{3}'.g:netrw_sepchr.'//e' - call histdel("/",-1) + keepj call histdel("/",-1) elseif a:islocal if !g:netrw_banner || w:netrw_bannercnt < line("$") -" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction) +" call Decho("(PerformListing) g:netrw_sort_direction=".g:netrw_sort_direction) if g:netrw_sort_direction =~ 'n' -" call Decho('exe silent keepjumps '.w:netrw_bannercnt.',$sort') +" call Decho('exe sil keepjumps '.w:netrw_bannercnt.',$sort') exe 'sil! keepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options else -" call Decho('exe silent keepjumps '.w:netrw_bannercnt.',$sort!') +" call Decho('exe sil keepjumps '.w:netrw_bannercnt.',$sort!') exe 'sil! keepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options endif exe 'sil! keepj '.w:netrw_bannercnt.',$s/^\d\{-}\///e' - call histdel("/",-1) + keepj call histdel("/",-1) endif endif @@ -6457,31 +7760,35 @@ fun! s:PerformListing(islocal) endif " convert to wide/tree listing {{{3 -" call Decho("modify display if wide/tree listing style") - call s:NetrwWideListing() - call s:NetrwTreeListing(b:netrw_curdir) +" call Decho("(PerformListing) modify display if wide/tree listing style") + keepj call s:NetrwWideListing() + keepj call s:NetrwTreeListing(b:netrw_curdir) if exists("w:netrw_bannercnt") && (line("$") > w:netrw_bannercnt || !g:netrw_banner) " place cursor on the top-left corner of the file listing -" call Decho("place cursor on top-left corner of file listing") +" call Decho("(PerformListing) place cursor on top-left corner of file listing") exe 'sil! keepj '.w:netrw_bannercnt sil! keepj norm! 0 endif " record previous current directory let w:netrw_prvdir= b:netrw_curdir -" call Decho("record netrw_prvdir<".w:netrw_prvdir.">") +" call Decho("(PerformListing) record netrw_prvdir<".w:netrw_prvdir.">") " save certain window-oriented variables into buffer-oriented variables {{{3 - call s:SetBufWinVars() - call s:NetrwOptionRestore("w:") + keepj call s:SetBufWinVars() + keepj call s:NetrwOptionRestore("w:") " set display to netrw display settings -" call Decho("set display to netrw display settings (noma nomod etc)") +" call Decho("(PerformListing) set display to netrw display settings (".g:netrw_bufsettings.")") exe "setl ".g:netrw_bufsettings + if g:netrw_liststyle == s:LONGLIST +" call Decho("(PerformListing) exe setl ts=".(g:netrw_maxfilenamelen+1)) + exe "setl ts=".(g:netrw_maxfilenamelen+1) + endif if exists("s:treecurpos") - call netrw#NetrwRestorePosn(s:treecurpos) + keepj call netrw#NetrwRestorePosn(s:treecurpos) unlet s:treecurpos endif @@ -6524,7 +7831,7 @@ fun! s:SetupNetrwStatusLine(statline) " insure that windows have a statusline " make sure statusline is displayed let &stl=a:statline - setlocal laststatus=2 + setl laststatus=2 " call Decho("stl=".&stl) redraw @@ -6541,10 +7848,18 @@ fun! s:NetrwRemoteListing() " call Dfunc("s:NetrwRemoteListing() b:netrw_curdir<".b:netrw_curdir.">)") call s:RemotePathAnalysis(b:netrw_curdir) +" call Decho("b:netrw_method#".(exists("b:netrw_method")? b:netrw_method : 'n/a')) +" call Decho("g:netrw_list_cmd<".(exists("g:netrw_list_cmd")? g:netrw_list_cmd : 'n/a').">") +" call Decho("ssh is ".(executable("ssh")? "" : "not ")."executable") +" call Decho("ftp is ".(executable("ftp")? "" : "not ")."executable") +" call Decho("sftp is ".(executable("sftp")? "" : "not ")."executable") " sanity check: if exists("b:netrw_method") && b:netrw_method =~ '[235]' -" call Decho("b:netrw_method=".b:netrw_method) + " b:netrw_method = 2: ftp+.netrc + " b:netrw_method = 3: ftp+machine,id,p/w,filename (ie. no .netrc) + " b:netrw_method = 5: wget (http) +" call Decho("b:netrw_method=".b:netrw_method." (for ".s:method.")") if !executable("ftp") if !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,"this system doesn't support remote directory listing via ftp",18) @@ -6554,30 +7869,31 @@ fun! s:NetrwRemoteListing() return endif - elseif !exists("g:netrw_list_cmd") || g:netrw_list_cmd == '' + elseif s:method == "scp" && (!exists("g:netrw_list_cmd") || g:netrw_list_cmd == '') +" call Decho("g:netrw_list_cmd<".(exists("g:netrw_list_cmd")? g:netrw_list_cmd : 'n/a').">") if !exists("g:netrw_quiet") - if g:netrw_list_cmd == "" - call netrw#ErrorMsg(s:ERROR,g:netrw_ssh_cmd." is not executable on your system",47) + if !exists("g:netrw_list_cmd") || g:netrw_list_cmd == "" + keepj call netrw#ErrorMsg(s:ERROR,"neither ssh nor ftp"." is executable on your system",47) else - call netrw#ErrorMsg(s:ERROR,"this system doesn't support remote directory listing via ".g:netrw_list_cmd,19) + keepj call netrw#ErrorMsg(s:ERROR,"this system doesn't support remote directory listing via ".g:netrw_list_cmd,19) endif endif - call s:NetrwOptionRestore("w:") + keepj call s:NetrwOptionRestore("w:") " call Dret("s:NetrwRemoteListing") return endif " (remote handling sanity check) if exists("b:netrw_method") -" call Decho("setting w:netrw_method<".b:netrw_method.">") +" call Decho("setting w:netrw_method to b:netrw_method<".b:netrw_method.">") let w:netrw_method= b:netrw_method endif if s:method == "ftp" - " use ftp to get remote file listing + " use ftp to get remote file listing {{{3 " call Decho("use ftp to get remote file listing") - let s:method = "ftp" - let listcmd = g:netrw_ftp_list_cmd + let s:method = "ftp" + let listcmd = g:netrw_ftp_list_cmd if g:netrw_sort_by =~ '^t' let listcmd= g:netrw_ftp_timelist_cmd elseif g:netrw_sort_by =~ '^s' @@ -6595,19 +7911,19 @@ fun! s:NetrwRemoteListing() " cleanup if g:netrw_ftp_browse_reject != "" exe "sil! keepalt keepj g/".g:netrw_ftp_browse_reject."/keepj d" - call histdel("/",-1) + keepj call histdel("/",-1) endif sil! keepj %s/\r$//e - call histdel("/",-1) + keepj call histdel("/",-1) - " if there's no ../ listed, then put ./ and ../ in + " if there's no ../ listed, then put ../ in let line1= line(".") exe "sil! keepj ".w:netrw_bannercnt - let line2= search('^\.\.\/\%(\s\|$\)','cnW') + let line2= search('\.\.\/\%(\s\|$\)','cnW') +" call Decho("search(".'\.\.\/\%(\s\|$\)'."','cnW')=".line2." w:netrw_bannercnt=".w:netrw_bannercnt) if line2 == 0 -" call Decho("netrw is putting ./ and ../ into listing") +" call Decho("netrw is putting ../ into listing") sil! keepj put='../' - sil! keepj put='./' endif exe "sil! keepj ".line1 sil! keepj norm! 0 @@ -6616,15 +7932,15 @@ fun! s:NetrwRemoteListing() if search('^\d\{2}-\d\{2}-\d\{2}\s','n') " M$ ftp site cleanup " call Decho("M$ ftp cleanup") exe 'sil! keepj '.w:netrw_bannercnt.',$s/^\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(\|\d\+\)\s\+//' - call histdel("/",-1) + keepj call histdel("/",-1) else " normal ftp cleanup " call Decho("normal ftp cleanup") exe 'sil! keepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e' exe "sil! keepj ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e' exe "sil! keepj ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e' - call histdel("/",-1) - call histdel("/",-1) - call histdel("/",-1) + keepj call histdel("/",-1) + keepj call histdel("/",-1) + keepj call histdel("/",-1) endif endif @@ -6634,35 +7950,35 @@ fun! s:NetrwRemoteListing() let listcmd= s:MakeSshCmd(g:netrw_list_cmd) " call Decho("listcmd<".listcmd."> (using g:netrw_list_cmd)") if g:netrw_scp_cmd =~ '^pscp' -" call Decho("1: exe silent r! ".shellescape(listcmd.s:path, 1)) +" call Decho("1: exe sil r! ".shellescape(listcmd.s:path, 1)) exe "sil! keepj r! ".listcmd.shellescape(s:path, 1) " remove rubbish and adjust listing format of 'pscp' to 'ssh ls -FLa' like sil! keepj g/^Listing directory/keepj d sil! keepj g/^d[-rwx][-rwx][-rwx]/keepj s+$+/+e sil! keepj g/^l[-rwx][-rwx][-rwx]/keepj s+$+@+e - call histdel("/",-1) - call histdel("/",-1) - call histdel("/",-1) + keepj call histdel("/",-1) + keepj call histdel("/",-1) + keepj call histdel("/",-1) if g:netrw_liststyle != s:LONGLIST sil! keepj g/^[dlsp-][-rwx][-rwx][-rwx]/keepj s/^.*\s\(\S\+\)$/\1/e - call histdel("/",-1) + keepj call histdel("/",-1) endif else if s:path == "" -" call Decho("2: exe silent r! ".listcmd) - exe "sil! keepalt r! ".listcmd +" call Decho("2: exe sil r! ".listcmd) + exe "sil! keepj keepalt r! ".listcmd else -" call Decho("3: exe silent r! ".listcmd.' '.shellescape(s:path,1)) - exe "sil! keepalt r! ".listcmd.' '.shellescape(s:path,1) +" call Decho("3: exe sil r! ".listcmd.' '.shellescape(fnameescape(s:path),1)) + exe "sil! keepj keepalt r! ".listcmd.' '.shellescape(fnameescape(s:path),1) " call Decho("listcmd<".listcmd."> path<".s:path.">") endif endif " cleanup if g:netrw_ftp_browse_reject != "" -" call Decho("(cleanup) exe silent! g/".g:netrw_ssh_browse_reject."/keepjumps d") +" call Decho("(cleanup) exe sil! g/".g:netrw_ssh_browse_reject."/keepjumps d") exe "sil! g/".g:netrw_ssh_browse_reject."/keepj d" - call histdel("/",-1) + keepj call histdel("/",-1) endif endif @@ -6676,13 +7992,12 @@ fun! s:NetrwRemoteListing() while getline('.') =~ g:netrw_ftp_browse_reject sil! keepj d endwhile - " if there's no ../ listed, then put ./ and ../ in + " if there's no ../ listed, then put ../ in let line1= line(".") sil! keepj 1 sil! keepj call search('^\.\.\/\%(\s\|$\)','W') let line2= line(".") if line2 == 0 - exe 'sil! keepj '.w:netrw_bannercnt."put='./'" if b:netrw_curdir != '/' exe 'sil! keepj '.w:netrw_bannercnt."put='../'" endif @@ -6699,9 +8014,9 @@ fun! s:NetrwRemoteListing() exe 'sil keepj '.w:netrw_bannercnt.',$s/ -> .*$//e' exe 'sil keepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2\t\1/e' exe 'sil keepj '.w:netrw_bannercnt - call histdel("/",-1) - call histdel("/",-1) - call histdel("/",-1) + keepj call histdel("/",-1) + keepj call histdel("/",-1) + keepj call histdel("/",-1) endif endif @@ -6741,7 +8056,7 @@ fun! s:NetrwRemoteRm(usrhost,path) range " remove multiple files and directories while ctr <= a:lastline - exe ctr + exe "keepj ".ctr let ok= s:NetrwRemoteRmFile(a:path,s:NetrwGetWord(),all) if ok =~ 'q\%[uit]' break @@ -6754,8 +8069,8 @@ fun! s:NetrwRemoteRm(usrhost,path) range " refresh the (remote) directory listing " call Decho("refresh remote directory listing") - call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) - call netrw#NetrwRestorePosn(svpos) + keepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) + keepj call netrw#NetrwRestorePosn(svpos) " call Dret("s:NetrwRemoteRm") endfun @@ -6802,7 +8117,7 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) let netrw_rm_cmd= s:MakeSshCmd(g:netrw_rm_cmd) " call Decho("netrw_rm_cmd<".netrw_rm_cmd.">") if !exists("b:netrw_curdir") - call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53) + keepj call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53) let ok="q" else let remotedir= substitute(b:netrw_curdir,'^.*//[^/]\+/\(.*\)$','\1','') @@ -6817,14 +8132,13 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) " call Decho("call system(".netrw_rm_cmd.")") let ret= system(netrw_rm_cmd) if ret != 0 - call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) + keepj call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) endif " call Decho("returned=".ret." errcode=".v:shell_error) endif endif elseif ok =~ 'q\%[uit]' " call Decho("ok==".ok) - break endif else @@ -6845,7 +8159,7 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) if all || ok =~ 'y\%[es]' || ok == "" if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) - call s:NetrwRemoteFtpCmd(a:path,"rmdir ".a:rmfile) + keepj call s:NetrwRemoteFtpCmd(a:path,"rmdir ".a:rmfile) else let rmfile = substitute(a:path.a:rmfile,'/$','','') let netrw_rmdir_cmd = s:MakeSshCmd(netrw#WinPath(g:netrw_rmdir_cmd)).' '.shellescape(netrw#WinPath(rmfile)) @@ -6861,13 +8175,13 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) " call Decho("returned=".ret." errcode=".v:shell_error) if v:shell_error != 0 && !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",22) + keepj call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",22) endif endif endif elseif ok =~ 'q\%[uit]' - break +" call Decho("ok==".ok) endif endif @@ -6881,18 +8195,27 @@ endfun " and reverse sorts will be requested of the server but not otherwise " enforced here. fun! s:NetrwRemoteFtpCmd(path,listcmd) -" call Dfunc("NetrwRemoteFtpCmd(path<".a:path."> listcmd<".a:listcmd.">) netrw_method=".w:netrw_method) -" call Decho("line($)=".line("$")." bannercnt=".w:netrw_bannercnt) +" call Dfunc("NetrwRemoteFtpCmd(path<".a:path."> listcmd<".a:listcmd.">) w:netrw_method=".(exists("w:netrw_method")? w:netrw_method : (exists("b:netrw_method")? b:netrw_method : "???"))) +" call Decho("line($)=".line("$")." w:netrw_bannercnt=".w:netrw_bannercnt) + if !exists("w:netrw_method") + if exists("b:netrw_method") + let w:netrw_method= b:netrw_method + else + call netrw#ErrorMsg(2,"(s:NetrwRemoteFtpCmd) internal netrw error",93) +" call Dret("NetrwRemoteFtpCmd") + return + endif + endif " because WinXX ftp uses unix style input let ffkeep= &ff - setlocal ma ff=unix noro -" call Decho("setlocal ma ff=unix noro") + setl ma ff=unix noro +" call Decho("setl ma ff=unix noro") " clear off any older non-banner lines " note that w:netrw_bannercnt indexes the line after the banner -" call Decho('exe silent! keepjumps '.w:netrw_bannercnt.",$d (clear off old non-banner lines)") - exe "silent! keepjumps ".w:netrw_bannercnt.",$d" +" call Decho('exe sil! keepjumps '.w:netrw_bannercnt.",$d (clear off old non-banner lines)") + exe "sil! keepjumps ".w:netrw_bannercnt.",$d" "......................................... if w:netrw_method == 2 || w:netrw_method == 5 @@ -6904,31 +8227,41 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) keepj put =g:netrw_ftpextracmd " call Decho("filter input: ".getline('.')) endif - call setline(line("$")+1,a:listcmd) + keepj call setline(line("$")+1,a:listcmd) " exe "keepjumps ".w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."))' if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) - exe s:netrw_silentxfer." keepjumps ".w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) +" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) + exe s:netrw_silentxfer." keepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) else -" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) - exe s:netrw_silentxfer." keepjumps ".w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) +" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) + exe s:netrw_silentxfer." keepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) endif "......................................... elseif w:netrw_method == 3 " ftp + machine,id,passwd,filename: Method #3 - setlocal ff=unix + setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" keepj put ='open '.g:netrw_machine.' '.g:netrw_port else keepj put ='open '.g:netrw_machine endif - if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid - keepj put ='\"'.s:netrw_passwd.'\"' - else - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' + " handle userid and password + let host= substitute(g:netrw_machine,'\..*$','','') +" call Decho("host<".host.">") + if exists("s:netrw_hup") && exists("s:netrw_hup[host]") + call NetUserPass("ftp:".host) + endif + if exists("g:netrw_uid") && g:netrw_uid != "" + if exists("g:netrw_ftp") && g:netrw_ftp == 1 + keepj put =g:netrw_uid + if exists("s:netrw_passwd") && s:netrw_passwd != "" + keepj put ='\"'.s:netrw_passwd.'\"' + endif + elseif exists("s:netrw_passwd") + keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' + endif endif if a:path != "" @@ -6945,28 +8278,28 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) " -n unix : DON'T use <.netrc>, even though it exists " -n win32: quit being obnoxious about password " exe w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."))' -" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i -n") - exe s:netrw_silentxfer.w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i -n" +" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) + exe s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." ".g:netrw_ftp_options "......................................... else - call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",23) + keepj call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",23) endif " cleanup for Windows if has("win32") || has("win95") || has("win64") || has("win16") sil! keepj %s/\r$//e - call histdel("/",-1) + keepj call histdel("/",-1) endif if a:listcmd == "dir" " infer directory/link based on the file permission string sil! keepj g/d\%([-r][-w][-x]\)\{3}/keepj s@$@/@ sil! keepj g/l\%([-r][-w][-x]\)\{3}/keepj s/$/@/ - call histdel("/",-1) - call histdel("/",-1) + keepj call histdel("/",-1) + keepj call histdel("/",-1) if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || w:netrw_liststyle == s:TREELIST exe "sil! keepj ".w:netrw_bannercnt.',$s/^\%(\S\+\s\+\)\{8}//e' - call histdel("/",-1) + keepj call histdel("/",-1) endif endif @@ -7015,7 +8348,7 @@ fun! s:NetrwRemoteRename(usrhost,path) range endif if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) - call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname) + keepj call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname) else let oldname= shellescape(a:path.oldname) let newname= shellescape(a:path.newname) @@ -7053,17 +8386,67 @@ fun! s:NetrwRemoteRename(usrhost,path) range endif " refresh the directory - call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) - call netrw#NetrwRestorePosn(svpos) + keepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) + keepj call netrw#NetrwRestorePosn(svpos) " call Dret("NetrwRemoteRename") endfun " --------------------------------------------------------------------- -" Local Directory Browsing Support: {{{1 -" ========================================== - -" --------------------------------------------------------------------- +" Local Directory Browsing Support: {{{1 +" ========================================== + +" --------------------------------------------------------------------- +" netrw#FileUrlRead: handles reading file://* files {{{2 +" Should accept: file://localhost/etc/fstab +" file:///etc/fstab +" file:///c:/WINDOWS/clock.avi +" file:///c|/WINDOWS/clock.avi +" file://localhost/c:/WINDOWS/clock.avi +" file://localhost/c|/WINDOWS/clock.avi +" file://c:/foo.txt +" file:///c:/foo.txt +" and %XX (where X is [0-9a-fA-F] is converted into a character with the given hexadecimal value +fun! netrw#FileUrlRead(fname) +" call Dfunc("netrw#FileUrlRead(fname<".a:fname.">)") + let fname = a:fname + if fname =~ '^file://localhost/' +" call Decho('converting file://localhost/ -to- file:///') + let fname= substitute(fname,'^file://localhost/','file:///','') +" call Decho("fname<".fname.">") + endif + if (has("win32") || has("win95") || has("win64") || has("win16")) + if fname =~ '^file:///\=\a[|:]/' +" call Decho('converting file:///\a|/ -to- file://\a:/') + let fname = substitute(fname,'^file:///\=\(\a\)[|:]/','file://\1:/','') +" call Decho("fname<".fname.">") + endif + endif + let fname2396 = netrw#RFC2396(fname) + let fname2396e= fnameescape(fname2396) + let plainfname= substitute(fname2396,'file://\(.*\)','\1',"") + if (has("win32") || has("win95") || has("win64") || has("win16")) +" call Decho("windows exception for plainfname") + if plainfname =~ '^/\+\a:' +" call Decho('removing leading "/"s') + let plainfname= substitute(plainfname,'^/\+\(\a:\)','\1','') + endif + endif +" call Decho("fname2396<".fname2396.">") +" call Decho("plainfname<".plainfname.">") + exe "sil doau BufReadPre ".fname2396e + exe 'keepj r '.plainfname + exe 'sil! bdelete '.plainfname + exe 'keepalt file! '.plainfname + keepj 1d +" call Decho("(FileUrlRead) setl nomod") + setl nomod +" call Decho("(FileUrlRead) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Dret("netrw#FileUrlRead") + exe "sil doau BufReadPost ".fname2396e +endfun + +" --------------------------------------------------------------------- " netrw#LocalBrowseCheck: {{{2 fun! netrw#LocalBrowseCheck(dirname) " unfortunate interaction -- split window debugging can't be @@ -7073,18 +8456,38 @@ fun! netrw#LocalBrowseCheck(dirname) " The &ft == "netrw" test was installed because the BufEnter event " would hit when re-entering netrw windows, creating unexpected " refreshes (and would do so in the middle of NetrwSaveOptions(), too) -" call Decho("netrw#LocalBrowseCheck: isdir<".a:dirname.">=".isdirectory(a:dirname).((exists("s:treeforceredraw")? " treeforceredraw" : ""))) +" call Decho("(LocalBrowseCheck) isdir<".a:dirname.">=".isdirectory(a:dirname).((exists("s:treeforceredraw")? " treeforceredraw" : ""))) +" call Dredir("LocalBrowseCheck","ls!")|redraw!|sleep 3 + let ykeep= @@ if isdirectory(a:dirname) -" call Decho(" ft<".&ft."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : " doesn't exist")."> dirname<".a:dirname.">"." line($)=".line("$")) - if &ft != "netrw" || (exists("b:netrw_curdir") && b:netrw_curdir != a:dirname) - silent! call s:NetrwBrowse(1,a:dirname) +" call Decho("(LocalBrowseCheck) is-directory ft<".&ft."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : " doesn't exist")."> dirname<".a:dirname.">"." line($)=".line("$")." ft<".&ft."> g:netrw_fastbrowse=".g:netrw_fastbrowse) + let svposn= netrw#NetrwSavePosn() + if &ft != "netrw" || (exists("b:netrw_curdir") && b:netrw_curdir != a:dirname) || g:netrw_fastbrowse <= 1 + sil! keepj keepalt call s:NetrwBrowse(1,a:dirname) + keepalt call netrw#NetrwRestorePosn(svposn) elseif &ft == "netrw" && line("$") == 1 - silent! call s:NetrwBrowse(1,a:dirname) + sil! keepj keepalt call s:NetrwBrowse(1,a:dirname) + keepalt call netrw#NetrwRestorePosn(svposn) elseif exists("s:treeforceredraw") unlet s:treeforceredraw - silent! call s:NetrwBrowse(1,a:dirname) + sil! keepj keepalt call s:NetrwBrowse(1,a:dirname) + keepalt call netrw#NetrwRestorePosn(svposn) endif endif + " following code wipes out currently unused netrw buffers + " IF g:netrw_fastbrowse is zero (ie. slow browsing selected) + " AND IF the listing style is not a tree listing + if exists("g:netrw_fastbrowse") && g:netrw_fastbrowse == 0 && g:netrw_liststyle != s:TREELIST + let ibuf = 1 + let buflast = bufnr("$") + while ibuf <= buflast + if bufwinnr(ibuf) == -1 && isdirectory(bufname(ibuf)) + exe "sil! keepalt ".ibuf."bw!" + endif + let ibuf= ibuf + 1 + endwhile + endif + let @@= ykeep " not a directory, ignore it endfun @@ -7092,101 +8495,68 @@ endfun " s:LocalListing: does the job of "ls" for local directories {{{2 fun! s:LocalListing() " call Dfunc("s:LocalListing()") -" call Decho("&ma=".&ma) -" call Decho("&mod=".&mod) -" call Decho("&ro=".&ro) -" call Decho("bufname(%)<".bufname("%").">") +" call Decho("(LocalListing) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("(LocalListing) tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) -" if exists("b:netrw_curdir") |call Decho('b:netrw_curdir<'.b:netrw_curdir.">") |else|call Decho("b:netrw_curdir doesn't exist") |endif -" if exists("g:netrw_sort_by")|call Decho('g:netrw_sort_by<'.g:netrw_sort_by.">")|else|call Decho("g:netrw_sort_by doesn't exist")|endif +" if exists("b:netrw_curdir") |call Decho('(LocalListing) b:netrw_curdir<'.b:netrw_curdir.">") |else|call Decho("(LocalListing) b:netrw_curdir doesn't exist") |endif +" if exists("g:netrw_sort_by")|call Decho('(LocalListing) g:netrw_sort_by<'.g:netrw_sort_by.">")|else|call Decho("(LocalListing) g:netrw_sort_by doesn't exist")|endif " get the list of files contained in the current directory - let dirname = escape(b:netrw_curdir,g:netrw_glob_escape) + let dirname = b:netrw_curdir let dirnamelen = s:Strlen(b:netrw_curdir) - let filelist = glob(s:ComposePath(dirname,"*")) -" call Decho("glob(dirname<".dirname."/*>)=".filelist) - if filelist != "" - let filelist= filelist."\n" - endif - let filelist= filelist.glob(s:ComposePath(dirname,".*")) -" call Decho("glob(dirname<".dirname."/.*>)=".filelist) - - " Coding choice: either elide ./ if present - " or include ./ if not present - if filelist =~ '[\\/]\.[\\/]\=\(\n\|$\)' - " elide /path/. from glob() entries if present -" call Decho("elide /path/. from glob entries if present") - let filelist = substitute(filelist,'\n','\t','g') - let filelist = substitute(filelist,'^[^\t]\+[/\\]\.\t','','') - let filelist = substitute(filelist,'[^\t]\+[/\\]\.$','','') - let filelist = substitute(filelist,'\t\zs[^\t]\+[/\\]\.\t','','') - let filelist = substitute(filelist,'\t','\n','g') - endif -" call Decho("filelist<".filelist.">") - if filelist !~ '[\\/]\.\.[\\/]\=\(\n\|$\)' + let filelist = glob(s:ComposePath(dirname,"*"),0,1) + let filelist = filelist + glob(s:ComposePath(dirname,".*"),0,1) +" call Decho("(LocalListing) filelist=".filelist) + + if g:netrw_cygwin == 0 && (has("win32") || has("win95") || has("win64") || has("win16")) +" call Decho("(LocalListing) filelist=".string(filelist)) + elseif index(filelist,'..') == -1 && b:netrw_curdir !~ '/' " include ../ in the glob() entry if its missing -" call Decho("forcibly tacking on ..") - let filelist= filelist."\n".s:ComposePath(b:netrw_curdir,"../") -" call Decho("filelist<".filelist.">") - endif - if b:netrw_curdir == '/' - " remove .. from filelist when current directory is root directory -" call Decho("remove .. from filelist") - let filelist= substitute(filelist,'/\.\.\n','','') - endif - " remove multiple contiguous newlines - let filelist= substitute(filelist,'\n\{2,}','\n','ge') - if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) - " change all \s to /s -" call Decho('change all \s to /s') - let filelist= substitute(filelist,'\','/','g') - else - " escape all \s to \\ -" call Decho('escape all \s to \\') - let filelist= substitute(filelist,'\','\\','g') +" call Decho("(LocalListing) forcibly including on \"..\"") + let filelist= filelist+[s:ComposePath(b:netrw_curdir,"../")] +" call Decho("(LocalListing) filelist=".string(filelist)) endif -" call Decho("(before while) dirname<".dirname.">") -" call Decho("(before while) dirnamelen<".dirnamelen.">") -" call Decho("(before while) filelist<".filelist.">") +" call Decho("(LocalListing) (before while) dirname<".dirname.">") +" call Decho("(LocalListing) (before while) dirnamelen<".dirnamelen.">") +" call Decho("(LocalListing) (before while) filelist=".string(filelist)) - while filelist != "" - if filelist =~ '\n' - let filename = substitute(filelist,'\n.*$','','e') - let filelist = substitute(filelist,'^.\{-}\n\(.*\)$','\1','e') - else - let filename = filelist - let filelist = "" - endif -" call Decho(" ") -" call Decho("(while) filelist<".filelist.">") -" call Decho("(while) filename<".filename.">") + if get(g:, 'netrw_dynamic_maxfilenamelen', 0) + let filelistcopy = map(deepcopy(filelist),'fnamemodify(v:val, ":t")') + let g:netrw_maxfilenamelen = max(map(filelistcopy,'len(v:val)')) + 1 +" call Decho("(LocalListing) dynamic_maxfilenamelen: filenames =".string(filelistcopy)) +" call Decho("(LocalListing) dynamic_maxfilenamelen: g:netrw_maxfilenamelen=".g:netrw_maxfilenamelen) + endif + + for filename in filelist +" call Decho("(LocalListing) ") +" call Decho("(LocalListing) (while) filename<".filename.">") if getftype(filename) == "link" " indicate a symbolic link -" call Decho("indicate <".filename."> is a symbolic link with trailing @") +" call Decho("(LocalListing) indicate <".filename."> is a symbolic link with trailing @") let pfile= filename."@" elseif getftype(filename) == "socket" " indicate a socket -" call Decho("indicate <".filename."> is a socket with trailing =") +" call Decho("(LocalListing) indicate <".filename."> is a socket with trailing =") let pfile= filename."=" elseif getftype(filename) == "fifo" " indicate a fifo -" call Decho("indicate <".filename."> is a fifo with trailing |") +" call Decho("(LocalListing) indicate <".filename."> is a fifo with trailing |") let pfile= filename."|" elseif isdirectory(filename) " indicate a directory -" call Decho("indicate <".filename."> is a directory with trailing /") +" call Decho("(LocalListing) indicate <".filename."> is a directory with trailing /") let pfile= filename."/" elseif exists("b:netrw_curdir") && b:netrw_curdir !~ '^.*://' && !isdirectory(filename) if (has("win32") || has("win95") || has("win64") || has("win16")) if filename =~ '\.[eE][xX][eE]$' || filename =~ '\.[cC][oO][mM]$' || filename =~ '\.[bB][aA][tT]$' " indicate an executable -" call Decho("indicate <".filename."> is executable with trailing *") +" call Decho("(LocalListing) indicate <".filename."> is executable with trailing *") let pfile= filename."*" else " normal file @@ -7194,7 +8564,7 @@ fun! s:LocalListing() endif elseif executable(filename) " indicate an executable -" call Decho("indicate <".filename."> is executable with trailing *") +" call Decho("(LocalListing) indicate <".filename."> is executable with trailing *") let pfile= filename."*" else " normal file @@ -7205,55 +8575,55 @@ fun! s:LocalListing() " normal file let pfile= filename endif -" call Decho("pfile<".pfile."> (after *@/ appending)") +" call Decho("(LocalListing) pfile<".pfile."> (after *@/ appending)") if pfile =~ '//$' let pfile= substitute(pfile,'//$','/','e') -" call Decho("change // to /: pfile<".pfile.">") +" call Decho("(LocalListing) change // to /: pfile<".pfile.">") endif let pfile= strpart(pfile,dirnamelen) let pfile= substitute(pfile,'^[/\\]','','e') -" call Decho("filename<".filename.">") -" call Decho("pfile <".pfile.">") +" call Decho("(LocalListing) filename<".filename.">") +" call Decho("(LocalListing) pfile <".pfile.">") if w:netrw_liststyle == s:LONGLIST let sz = getfsize(filename) let fsz = strpart(" ",1,15-strlen(sz)).sz let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(filename)) -" call Decho("sz=".sz." fsz=".fsz) +" call Decho("(LocalListing) sz=".sz." fsz=".fsz) endif if g:netrw_sort_by =~ "^t" " sort by time (handles time up to 1 quintillion seconds, US) -" call Decho("getftime(".filename.")=".getftime(filename)) +" call Decho("(LocalListing) getftime(".filename.")=".getftime(filename)) let t = getftime(filename) let ft = strpart("000000000000000000",1,18-strlen(t)).t -" call Decho("exe keepjumps put ='".ft.'/'.filename."'") +" call Decho("(LocalListing) exe keepjumps put ='".ft.'/'.filename."'") let ftpfile= ft.'/'.pfile sil! keepj put=ftpfile elseif g:netrw_sort_by =~ "^s" " sort by size (handles file sizes up to 1 quintillion bytes, US) -" call Decho("getfsize(".filename.")=".getfsize(filename)) +" call Decho("(LocalListing) getfsize(".filename.")=".getfsize(filename)) let sz = getfsize(filename) let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz -" call Decho("exe keepjumps put ='".fsz.'/'.filename."'") +" call Decho("(LocalListing) exe keepj put ='".fsz.'/'.filename."'") let fszpfile= fsz.'/'.pfile sil! keepj put =fszpfile else " sort by name -" call Decho("exe keepjumps put ='".pfile."'") +" call Decho("(LocalListing) exe keepjumps put ='".pfile."'") sil! keepj put=pfile endif - endwhile + endfor " cleanup any windows mess at end-of-line sil! keepj g/^$/d sil! keepj %s/\r$//e call histdel("/",-1) - exe "setlocal ts=".g:netrw_maxfilenamelen -" call Decho("setlocal ts=".g:netrw_maxfilenamelen) +" call Decho("(LocalListing) exe setl ts=".(g:netrw_maxfilenamelen+1)) + exe "setl ts=".(g:netrw_maxfilenamelen+1) " call Dret("s:LocalListing") endfun @@ -7284,47 +8654,214 @@ fun! s:LocalBrowseShellCmdRefresh() endif let itab = 1 let buftablist = [] + let ykeep = @@ while itab <= tabpagenr("$") let buftablist = buftablist + tabpagebuflist() let itab = itab + 1 tabn endwhile -" call Decho("buftablist".string(buftablist)) -" call Decho("s:netrw_browselist<".(exists("s:netrw_browselist")? string(s:netrw_browselist) : "").">") +" call Decho("(LocalBrowseShellCmdRefresh) buftablist".string(buftablist)) +" call Decho("(LocalBrowseShellCmdRefresh) s:netrw_browselist<".(exists("s:netrw_browselist")? string(s:netrw_browselist) : "").">") " GO through all buffers on netrw_browselist (ie. just local-netrw buffers): " | refresh any netrw window " | wipe out any non-displaying netrw buffer let curwin = winnr() let ibl = 0 for ibuf in s:netrw_browselist -" call Decho("bufwinnr(".ibuf.") index(buftablist,".ibuf.")=".index(buftablist,ibuf)) +" call Decho("(LocalBrowseShellCmdRefresh) bufwinnr(".ibuf.") index(buftablist,".ibuf.")=".index(buftablist,ibuf)) if bufwinnr(ibuf) == -1 && index(buftablist,ibuf) == -1 " wipe out any non-displaying netrw buffer -" call Decho("wiping buf#".ibuf,"<".bufname(ibuf).">") +" call Decho("(LocalBrowseShellCmdRefresh) wiping buf#".ibuf,"<".bufname(ibuf).">") exe "sil! bd ".fnameescape(ibuf) call remove(s:netrw_browselist,ibl) -" call Decho("browselist=".string(s:netrw_browselist)) +" call Decho("(LocalBrowseShellCmdRefresh) browselist=".string(s:netrw_browselist)) continue elseif index(tabpagebuflist(),ibuf) != -1 " refresh any netrw buffer -" call Decho("refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf)) +" call Decho("(LocalBrowseShellCmdRefresh) refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf)) exe bufwinnr(ibuf)."wincmd w" - call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) + keepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) endif let ibl= ibl + 1 endfor exe curwin."wincmd w" + let @@= ykeep " call Dret("LocalBrowseShellCmdRefresh") endfun " --------------------------------------------------------------------- +" s:LocalFastBrowser: handles setting up/taking down fast browsing for the local browser {{{2 +" +" g:netrw_ Directory Is +" fastbrowse Local Remote +" slow 0 D D D=Deleting a buffer implies it will not be re-used (slow) +" med 1 D H H=Hiding a buffer implies it may be re-used (fast) +" fast 2 H H +" +" Deleting a buffer means that it will be re-loaded when examined, hence "slow". +" Hiding a buffer means that it will be re-used when examined, hence "fast". +" (re-using a buffer may not be as accurate) +fun! s:LocalFastBrowser() +" call Dfunc("LocalFastBrowser() g:netrw_fastbrowse=".g:netrw_fastbrowse." s:netrw_browser_shellcmd ".(exists("s:netrw_browser_shellcmd")? "exists" : "does not exist")) + + " initialize browselist, a list of buffer numbers that the local browser has used + if !exists("s:netrw_browselist") +" call Decho("(LocalFastBrowser) initialize s:netrw_browselist") + let s:netrw_browselist= [] + endif + + " append current buffer to fastbrowse list + if empty(s:netrw_browselist) || bufnr("%") > s:netrw_browselist[-1] +" call Decho("(LocalFastBrowser) appendng current buffer to browselist") + call add(s:netrw_browselist,bufnr("%")) +" call Decho("(LocalFastBrowser) browselist=".string(s:netrw_browselist)) + endif + + " enable autocmd events to handle refreshing/removing local browser buffers + " If local browse buffer is currently showing: refresh it + " If local browse buffer is currently hidden : wipe it + " g:netrw_fastbrowse=0 : slow speed, never re-use directory listing + " =1 : medium speed, re-use directory listing for remote only + " =2 : fast speed, always re-use directory listing when possible + if !exists("s:netrw_browser_shellcmd") && g:netrw_fastbrowse <= 1 +" call Decho("(LocalFastBrowser) setting up local-browser shell command refresh") + let s:netrw_browser_shellcmd= 1 + augroup AuNetrwShellCmd + au! + if (has("win32") || has("win95") || has("win64") || has("win16")) +" call Decho("(LocalFastBrowser) autocmd: ShellCmdPost * call s:LocalBrowseShellCmdRefresh()") + au ShellCmdPost * call s:LocalBrowseShellCmdRefresh() + else + au ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh() +" call Decho("(LocalFastBrowser) autocmd: ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh()") + endif + augroup END + endif + + " user must have changed fastbrowse to its fast setting, so remove + " the associated autocmd events + if g:netrw_fastbrowse > 1 && exists("s:netrw_browser_shellcmd") +" call Decho("(LocalFastBrowser) remove AuNetrwShellCmd autcmd group") + unlet s:netrw_browser_shellcmd + augroup AuNetrwShellCmd + au! + augroup END + augroup! AuNetrwShellCmd + endif + +" call Dret("LocalFastBrowser : browselist<".string(s:netrw_browselist).">") +endfun + +" --------------------------------------------------------------------- +" s:NetrwLocalExecute: uses system() to execute command under cursor ("X" command support) {{{2 +fun! s:NetrwLocalExecute(cmd) +" call Dfunc("s:NetrwLocalExecute(cmd<".a:cmd.">)") + let ykeep= @@ + " sanity check + if !executable(a:cmd) + call netrw#ErrorMsg(s:ERROR,"the file<".a:cmd."> is not executable!",89) + let @@= ykeep +" call Dret("s:NetrwLocalExecute") + return + endif + + let optargs= input(":!".a:cmd,"","file") +" call Decho("optargs<".optargs.">") + let result= system(a:cmd.optargs) +" call Decho(result) + + " strip any ansi escape sequences off + let result = substitute(result,"\e\\[[0-9;]*m","","g") + + " show user the result(s) + echomsg result + let @@= ykeep + +" call Dret("s:NetrwLocalExecute") +endfun + +" --------------------------------------------------------------------- +" s:NetrwLocalRename: rename a remote file or directory {{{2 +fun! s:NetrwLocalRename(path) range +" call Dfunc("NetrwLocalRename(path<".a:path.">)") + + " preparation for removing multiple files/directories + let ykeep = @@ + let ctr = a:firstline + let svpos = netrw#NetrwSavePosn() + + " rename files given by the markfilelist + if exists("s:netrwmarkfilelist_{bufnr('%')}") + for oldname in s:netrwmarkfilelist_{bufnr("%")} +" call Decho("oldname<".oldname.">") + if exists("subfrom") + let newname= substitute(oldname,subfrom,subto,'') +" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">") + else + call inputsave() + let newname= input("Moving ".oldname." to : ",oldname) + call inputrestore() + if newname =~ '^s/' + let subfrom = substitute(newname,'^s/\([^/]*\)/.*/$','\1','') + let subto = substitute(newname,'^s/[^/]*/\(.*\)/$','\1','') +" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">") + let newname = substitute(oldname,subfrom,subto,'') + endif + endif + call rename(oldname,newname) + endfor + call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) + + else + + " attempt to rename files/directories + while ctr <= a:lastline + exe "keepj ".ctr + + " sanity checks + if line(".") < w:netrw_bannercnt + let ctr= ctr + 1 + continue + endif + let curword= s:NetrwGetWord() + if curword == "./" || curword == "../" + let ctr= ctr + 1 + continue + endif + + keepj norm! 0 + let oldname= s:ComposePath(a:path,curword) +" call Decho("oldname<".oldname.">") + + call inputsave() + let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e')) + call inputrestore() + + call rename(oldname,newname) +" call Decho("renaming <".oldname."> to <".newname.">") + + let ctr= ctr + 1 + endwhile + endif + + " refresh the directory +" call Decho("refresh the directory listing") + keepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) + keepj call netrw#NetrwRestorePosn(svpos) + let @@= ykeep + +" call Dret("NetrwLocalRename") +endfun + +" --------------------------------------------------------------------- " s:NetrwLocalRm: {{{2 fun! s:NetrwLocalRm(path) range " call Dfunc("s:NetrwLocalRm(path<".a:path.">)") " call Decho("firstline=".a:firstline." lastline=".a:lastline) " preparation for removing multiple files/directories + let ykeep = @@ let ret = 0 let all = 0 let svpos = netrw#NetrwSavePosn() @@ -7373,9 +8910,10 @@ fun! s:NetrwLocalRm(path) range " refresh the directory " call Decho("bufname<".bufname("%").">") if bufname("%") != "NetrwMessage" - call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) - call netrw#NetrwRestorePosn(svpos) + keepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) + keepj call netrw#NetrwRestorePosn(svpos) endif + let @@= ykeep " call Dret("s:NetrwLocalRm") endfun @@ -7397,280 +8935,95 @@ fun! s:NetrwLocalRmFile(path,fname,all) " call Decho("attempt to remove file<".rmfile.">") if !all echohl Statement - call inputsave() - let ok= input("Confirm deletion of file<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") - call inputrestore() - echohl NONE - if ok == "" - let ok="no" - endif -" call Decho("response: ok<".ok.">") - let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') -" call Decho("response: ok<".ok."> (after sub)") - if ok =~ 'a\%[ll]' - let all= 1 - endif - endif - - if all || ok =~ 'y\%[es]' || ok == "" - let ret= s:NetrwDelete(rmfile) -" call Decho("errcode=".v:shell_error." ret=".ret) - endif - - else - " attempt to remove directory - if !all - echohl Statement - call inputsave() - let ok= input("Confirm deletion of directory<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") - call inputrestore() - let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') - if ok == "" - let ok="no" - endif - if ok =~ 'a\%[ll]' - let all= 1 - endif - endif - let rmfile= substitute(rmfile,'[\/]$','','e') - - if all || ok =~ 'y\%[es]' || ok == "" -" call Decho("1st attempt: system(netrw#WinPath(".g:netrw_local_rmdir.') '.shellescape(rmfile).')') - call system(netrw#WinPath(g:netrw_local_rmdir).' '.shellescape(rmfile)) -" call Decho("v:shell_error=".v:shell_error) - - if v:shell_error != 0 -" call Decho("2nd attempt to remove directory<".rmfile.">") - let errcode= s:NetrwDelete(rmfile) -" call Decho("errcode=".errcode) - - if errcode != 0 - if has("unix") -" call Decho("3rd attempt to remove directory<".rmfile.">") - call system("rm ".shellescape(rmfile)) - if v:shell_error != 0 && !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",34) - let ok="no" - endif - elseif !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",35) - let ok="no" - endif - endif - endif - endif - endif - -" call Dret("s:NetrwLocalRmFile ".ok) - return ok -endfun - -" --------------------------------------------------------------------- -" s:NetrwLocalRename: rename a remote file or directory {{{2 -fun! s:NetrwLocalRename(path) range -" call Dfunc("NetrwLocalRename(path<".a:path.">)") - - " preparation for removing multiple files/directories - let ctr = a:firstline - let svpos= netrw#NetrwSavePosn() - - " rename files given by the markfilelist - if exists("s:netrwmarkfilelist_{bufnr('%')}") - for oldname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("oldname<".oldname.">") - if exists("subfrom") - let newname= substitute(oldname,subfrom,subto,'') -" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">") - else - call inputsave() - let newname= input("Moving ".oldname." to : ",oldname) - call inputrestore() - if newname =~ '^s/' - let subfrom = substitute(newname,'^s/\([^/]*\)/.*/$','\1','') - let subto = substitute(newname,'^s/[^/]*/\(.*\)/$','\1','') -" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">") - let newname = substitute(oldname,subfrom,subto,'') - endif - endif - call rename(oldname,newname) - endfor - call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) - - else - - " attempt to rename files/directories - while ctr <= a:lastline - exe "keepj ".ctr - - " sanity checks - if line(".") < w:netrw_bannercnt - let ctr= ctr + 1 - continue + call inputsave() + let ok= input("Confirm deletion of file<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") + call inputrestore() + echohl NONE + if ok == "" + let ok="no" endif - let curword= s:NetrwGetWord() - if curword == "./" || curword == "../" - let ctr= ctr + 1 - continue +" call Decho("response: ok<".ok.">") + let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') +" call Decho("response: ok<".ok."> (after sub)") + if ok =~ 'a\%[ll]' + let all= 1 endif + endif - keepj norm! 0 - let oldname= s:ComposePath(a:path,curword) -" call Decho("oldname<".oldname.">") + if all || ok =~ 'y\%[es]' || ok == "" + let ret= s:NetrwDelete(rmfile) +" call Decho("errcode=".v:shell_error." ret=".ret) + endif + else + " attempt to remove directory + if !all + echohl Statement call inputsave() - let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e')) + let ok= input("Confirm deletion of directory<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") call inputrestore() + let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') + if ok == "" + let ok="no" + endif + if ok =~ 'a\%[ll]' + let all= 1 + endif + endif + let rmfile= substitute(rmfile,'[\/]$','','e') - call rename(oldname,newname) -" call Decho("renaming <".oldname."> to <".newname.">") - - let ctr= ctr + 1 - endwhile - endif - - " refresh the directory -" call Decho("refresh the directory listing") - call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) - call netrw#NetrwRestorePosn(svpos) - -" call Dret("NetrwLocalRename") -endfun - -" --------------------------------------------------------------------- -" s:LocalFastBrowser: handles setting up/taking down fast browsing for the local browser {{{2 -" -" g:netrw_ Directory Is -" fastbrowse Local Remote -" slow 0 D D D=Deleting a buffer implies it will not be re-used (slow) -" med 1 D H H=Hiding a buffer implies it may be re-used (fast) -" fast 2 H H -" -" Deleting a buffer means that it will be re-loaded when examined, hence "slow". -" Hiding a buffer means that it will be re-used when examined, hence "fast". -" (re-using a buffer may not be as accurate) -fun! s:LocalFastBrowser() -" call Dfunc("LocalFastBrowser() g:netrw_fastbrowse=".g:netrw_fastbrowse) - - " initialize browselist, a list of buffer numbers that the local browser has used - if !exists("s:netrw_browselist") -" call Decho("initialize s:netrw_browselist") - let s:netrw_browselist= [] - endif + if all || ok =~ 'y\%[es]' || ok == "" +" call Decho("1st attempt: system(netrw#WinPath(".g:netrw_localrmdir.') '.shellescape(rmfile).')') + call system(netrw#WinPath(g:netrw_localrmdir).' '.shellescape(rmfile)) +" call Decho("v:shell_error=".v:shell_error) - " append current buffer to fastbrowse list - if empty(s:netrw_browselist) || bufnr("%") > s:netrw_browselist[-1] -" call Decho("appendng current buffer to browselist") - call add(s:netrw_browselist,bufnr("%")) -" call Decho("browselist=".string(s:netrw_browselist)) - endif + if v:shell_error != 0 +" call Decho("2nd attempt to remove directory<".rmfile.">") + let errcode= s:NetrwDelete(rmfile) +" call Decho("errcode=".errcode) - " enable autocmd events to handle refreshing/removing local browser buffers - " If local browse buffer is currently showing: refresh it - " If local browse buffer is currently hidden : wipe it - if !exists("s:netrw_browser_shellcmd") && g:netrw_fastbrowse <= 1 -" call Decho("setting up local-browser shell command refresh") - let s:netrw_browser_shellcmd= 1 - augroup AuNetrwShellCmd - au! - if (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("autocmd: ShellCmdPost * call s:LocalBrowseShellCmdRefresh()") - au ShellCmdPost * call s:LocalBrowseShellCmdRefresh() - else - au ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh() -" call Decho("autocmd: ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh()") + if errcode != 0 + if has("unix") +" call Decho("3rd attempt to remove directory<".rmfile.">") + call system("rm ".shellescape(rmfile)) + if v:shell_error != 0 && !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",34) + let ok="no" + endif + elseif !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",35) + let ok="no" + endif + endif endif - augroup END - endif - - " user must have changed fastbrowse to its fast setting, so remove - " the associated autocmd events - if g:netrw_fastbrowse > 1 && exists("s:netrw_browser_shellcmd") -" call Decho("remove AuNetrwShellCmd autcmd group") - unlet s:netrw_browser_shellcmd - augroup AuNetrwShellCmd - au! - augroup END - augroup! AuNetrwShellCmd + endif endif -" call Dret("LocalFastBrowser : browselist<".string(s:netrw_browselist).">") +" call Dret("s:NetrwLocalRmFile ".ok) + return ok endfun " --------------------------------------------------------------------- " Support Functions: {{{1 " --------------------------------------------------------------------- -" netrw#ErrorMsg: {{{2 -" 0=note = s:NOTE -" 1=warning = s:WARNING -" 2=error = s:ERROR -" Dec 03, 2009 : max errnum currently is 76 -fun! netrw#ErrorMsg(level,msg,errnum) -" call Dfunc("netrw#ErrorMsg(level=".a:level." msg<".a:msg."> errnum=".a:errnum.") g:netrw_use_errorwindow=".g:netrw_use_errorwindow) - - if a:level == 1 - let level= "**warning** (netrw) " - elseif a:level == 2 - let level= "**error** (netrw) " - else - let level= "**note** (netrw) " - endif -" call Decho("level=".level) - - if g:netrw_use_errorwindow - " (default) netrw creates a one-line window to show error/warning - " messages (reliably displayed) - - " record current window number for NetrwRestorePosn()'s benefit - let s:winBeforeErr= winnr() -" call Decho("s:winBeforeErr=".s:winBeforeErr) - - " getting messages out reliably is just plain difficult! - " This attempt splits the current window, creating a one line window. - if bufexists("NetrwMessage") && bufwinnr("NetrwMessage") > 0 -" call Decho("write to NetrwMessage buffer") - exe bufwinnr("NetrwMessage")."wincmd w" -" call Decho("setlocal ma noro") - setlocal ma noro - call setline(line("$")+1,level.a:msg) - keepj $ - else -" call Decho("create a NetrwMessage buffer window") - bo 1split - call s:NetrwEnew() - call s:NetrwSafeOptions() - setlocal bt=nofile - file NetrwMessage -" call Decho("setlocal ma noro") - setlocal ma noro - call setline(line("$"),level.a:msg) - endif -" call Decho("wrote msg<".level.a:msg."> to NetrwMessage win#".winnr()) - if &fo !~ '[ta]' - syn clear - syn match netrwMesgNote "^\*\*note\*\*" - syn match netrwMesgWarning "^\*\*warning\*\*" - syn match netrwMesgError "^\*\*error\*\*" - hi link netrwMesgWarning WarningMsg - hi link netrwMesgError Error - endif - setlocal noma ro bh=wipe - +" netrw#WinPath: tries to insure that the path is windows-acceptable, whether cygwin is used or not {{{2 +fun! netrw#WinPath(path) +" call Dfunc("netrw#WinPath(path<".a:path.">)") + if (!g:netrw_cygwin || &shell !~ '\%(\\|\\)\%(\.exe\)\=$') && (has("win32") || has("win95") || has("win64") || has("win16")) + " remove cygdrive prefix, if present + let path = substitute(a:path,'/cygdrive/\(.\)','\1:','') + " remove trailing slash (Win95) + let path = substitute(path, '\(\\\|/\)$', '', 'g') + " remove escaped spaces + let path = substitute(path, '\ ', ' ', 'g') + " convert slashes to backslashes + let path = substitute(path, '/', '\', 'g') else - " (optional) netrw will show messages using echomsg. Even if the - " message doesn't appear, at least it'll be recallable via :messages -" redraw! - if a:level == s:WARNING - echohl WarningMsg - elseif a:level == s:ERROR - echohl Error - endif - echomsg level.a:msg -" call Decho("echomsg ***netrw*** ".a:msg) - echohl None + let path= a:path endif - -" call Dret("netrw#ErrorMsg") +" call Dret("netrw#WinPath <".path.">") + return path endfun " --------------------------------------------------------------------- @@ -7680,16 +9033,18 @@ fun! netrw#NetrwRestorePosn(...) let eikeep= &ei set ei=all if expand("%") == "NetrwMessage" - exe s:winBeforeErr."wincmd w" + if exists("s:winBeforeErr") + exe s:winBeforeErr."wincmd w" + endif endif if a:0 > 0 - exe a:1 + exe "keepj ".a:1 endif " restore window if exists("w:netrw_winnr") -" call Decho("restore window: exe silent! ".w:netrw_winnr."wincmd w") +" call Decho("(NetrwRestorePosn) restore window: exe sil! ".w:netrw_winnr."wincmd w") exe "sil! ".w:netrw_winnr."wincmd w" endif if v:shell_error == 0 @@ -7700,29 +9055,29 @@ fun! netrw#NetrwRestorePosn(...) " restore top-of-screen line if exists("w:netrw_hline") -" call Decho("restore topofscreen: exe norm! ".w:netrw_hline."G0z") +" call Decho("(NetrwRestorePosn) restore topofscreen: exe keepj norm! ".w:netrw_hline."G0z") exe "keepj norm! ".w:netrw_hline."G0z\" endif " restore position if exists("w:netrw_line") && exists("w:netrw_col") -" call Decho("restore posn: exe norm! ".w:netrw_line."G0".w:netrw_col."|") +" call Decho("(NetrwRestorePosn) restore posn: exe keepj norm! ".w:netrw_line."G0".w:netrw_col."|") exe "keepj norm! ".w:netrw_line."G0".w:netrw_col."\" endif let &ei= eikeep -" call Dret("netrw#NetrwRestorePosn") +" call Dret("netrw#NetrwRestorePosn : line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()) endfun " --------------------------------------------------------------------- " netrw#NetrwSavePosn: saves position of cursor on screen {{{2 fun! netrw#NetrwSavePosn() -" call Dfunc("netrw#NetrwSavePosn()") +" call Dfunc("netrw#NetrwSavePosn() line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()) " Save current line and column let w:netrw_winnr= winnr() let w:netrw_line = line(".") let w:netrw_col = virtcol(".") -" call Decho("currently, win#".w:netrw_winnr." line#".w:netrw_line." col#".w:netrw_col) +" call Decho("(NetrwSavePosn) currently, win#".w:netrw_winnr." line#".w:netrw_line." col#".w:netrw_col) " Save top-of-screen line keepj norm! H0 @@ -7731,11 +9086,26 @@ fun! netrw#NetrwSavePosn() " set up string holding position parameters let ret = "let w:netrw_winnr=".w:netrw_winnr."|let w:netrw_line=".w:netrw_line."|let w:netrw_col=".w:netrw_col."|let w:netrw_hline=".w:netrw_hline - call netrw#NetrwRestorePosn() + keepj call netrw#NetrwRestorePosn() " call Dret("netrw#NetrwSavePosn : winnr=".w:netrw_winnr." line=".w:netrw_line." col=".w:netrw_col." hline=".w:netrw_hline) return ret endfun +" --------------------------------------------------------------------- +" netrw#NetrwAccess: intended to provide access to variable values for netrw's test suite {{{2 +" 0: marked file list of current buffer +" 1: marked file target +fun! netrw#NetrwAccess(ilist) + if a:ilist == 0 + if exists("s:netrwmarkfilelist_".bufnr('%')) + return s:netrwmarkfilelist_{bufnr('%')} + else + return "no-list-buf#".bufnr('%') + endif + elseif a:ilist == 1 + return s:netrwmftgt +endfun + " ------------------------------------------------------------------------ " netrw#RFC2396: converts %xx into characters {{{2 fun! netrw#RFC2396(fname) @@ -7750,7 +9120,7 @@ endfun fun! s:ComposePath(base,subdir) " call Dfunc("s:ComposePath(base<".a:base."> subdir<".a:subdir.">)") - if(has("amiga")) + if has("amiga") " call Decho("amiga") let ec = a:base[s:Strlen(a:base)-1] if ec != '/' && ec != ':' @@ -7835,8 +9205,8 @@ fun! s:GetTempfile(fname) " sanity check -- does the temporary file's directory exist? if !isdirectory(substitute(tmpfile,'[^/]\+$','','e')) -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) - call netrw#ErrorMsg(s:ERROR,"your <".substitute(tmpfile,'[^/]\+$','','e')."> directory is missing!",2) +" call Decho("(GetTempfile) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") + keepj call netrw#ErrorMsg(s:ERROR,"your <".substitute(tmpfile,'[^/]\+$','','e')."> directory is missing!",2) " call Dret("s:GetTempfile getcwd<".getcwd().">") return "" endif @@ -7883,7 +9253,7 @@ fun! s:GetTempfile(fname) endif endif -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) +" call Decho("(GetTempFile) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") " call Dret("s:GetTempfile <".tmpfile.">") return tmpfile endfun @@ -7918,7 +9288,7 @@ fun! s:NetrwBMShow() if bmshowfuncs != [] let bmshowfunc = substitute(bmshowfuncs[0],'^.*:\(call.*BMShow()\).*$','\1','') if bmshowfunc =~ '^call.*BMShow()' - exe "sil! ".bmshowfunc + exe "sil! keepj ".bmshowfunc endif endif endif @@ -7926,43 +9296,78 @@ fun! s:NetrwBMShow() endfun " --------------------------------------------------------------------- -" s:NetrwCursorline: {{{2 -fun! s:NetrwCursorline() +" s:NetrwCursor: responsible for setting cursorline/cursorcolumn based upon g:netrw_cursor {{{2 +fun! s:NetrwCursor() if !exists("w:netrw_liststyle") let w:netrw_liststyle= g:netrw_liststyle endif -" call Dfunc("s:NetrwCursorline() liststyle=".w:netrw_liststyle." g:netrw_cursorline=".g:netrw_cursorline." s:netrw_usercuc=".s:netrw_usercuc." s:netrw_usercul=".s:netrw_usercul) - " - if w:netrw_liststyle != s:WIDELIST - " thin-long-tree listings - if g:netrw_cursorline == 2 - setlocal cursorline - let &l:cursorcolumn= s:netrw_usercuc -" call Decho("setlocal cursorline (cursorcolumn is ".((s:netrw_usercuc)? "on" : "off").")") - elseif g:netrw_cursorline - setlocal cursorline -" call Decho("setlocal cursorline") +" call Dfunc("s:NetrwCursor() ft<".&ft."> liststyle=".w:netrw_liststyle." g:netrw_cursor=".g:netrw_cursor." s:netrw_usercuc=".s:netrw_usercuc." s:netrw_usercul=".s:netrw_usercul) + + if &ft != "netrw" + " if the current window isn't a netrw directory listing window, then use user cursorline/column + " settings. Affects when netrw is used to read/write a file using scp/ftp/etc. +" call Decho("case ft!=netrw: use user cul,cuc") + let &l:cursorline = s:netrw_usercul + let &l:cursorcolumn = s:netrw_usercuc + + elseif g:netrw_cursor == 4 + " all styles: cursorline, cursorcolumn +" call Decho("case g:netrw_cursor==4: setl cul cuc") + setl cursorline + setl cursorcolumn + + elseif g:netrw_cursor == 3 + " thin-long-tree: cursorline, user's cursorcolumn + " wide : cursorline, cursorcolumn + if w:netrw_liststyle == s:WIDELIST +" call Decho("case g:netrw_cursor==3 and wide: setl cul cuc") + setl cursorline + setl cursorcolumn + else +" call Decho("case g:netrw_cursor==3 and not wide: setl cul (use user's cuc)") + setl cursorline + let &l:cursorcolumn = s:netrw_usercuc + endif + + elseif g:netrw_cursor == 2 + " thin-long-tree: cursorline, user's cursorcolumn + " wide : cursorline, user's cursorcolumn +" call Decho("case g:netrw_cursor==2: setl cuc (use user's cul)") + let &l:cursorcolumn = s:netrw_usercuc + setl cursorline + + elseif g:netrw_cursor == 1 + " thin-long-tree: user's cursorline, user's cursorcolumn + " wide : cursorline, user's cursorcolumn + let &l:cursorcolumn = s:netrw_usercuc + if w:netrw_liststyle == s:WIDELIST +" call Decho("case g:netrw_cursor==2 and wide: setl cul (use user's cuc)") + set cursorline + else +" call Decho("case g:netrw_cursor==2 and not wide: (use user's cul,cuc)") + let &l:cursorline = s:netrw_usercul endif else - " wide listings - if g:netrw_cursorline == 2 - setlocal cursorline cursorcolumn -" call Decho("setlocal cursorline cursorcolumn") - elseif g:netrw_cursorline - let &l:cursorline= s:netrw_usercul -" call Decho("cursorline is ".((s:netrw_usercul)? "on" : "off").")") - endif + " all styles: user's cursorline, user's cursorcolumn +" call Decho("default: (use user's cul,cuc)") + let &l:cursorline = s:netrw_usercul + let &l:cursorcolumn = s:netrw_usercuc endif -" call Dret("s:NetrwCursorline : l:cursorline=".&l:cursorline." l:cursorcolumn=".&l:cursorcolumn) + +" call Dret("s:NetrwCursor : l:cursorline=".&l:cursorline." l:cursorcolumn=".&l:cursorcolumn) endfun " --------------------------------------------------------------------- " s:RestoreCursorline: restores cursorline/cursorcolumn to original user settings {{{2 fun! s:RestoreCursorline() -" call Dfunc("s:RestoreCursorline() currently, cul=".&l:cursorline." cuc=".&l:cursorcolumn." win#".winnr()." buf#".bufnr("%")) - let &l:cursorline = s:netrw_usercul - let &l:cursorcolumn = s:netrw_usercuc +" call Dfunc("s:RestoreCursorline() currently, cul=".&l:cursorline." cuc=".&l:cursorcolumn." win#".winnr()." buf#".bufnr("%")." mod=".&mod) + if exists("s:netrw_usercul") + let &l:cursorline = s:netrw_usercul + endif + if exists("s:netrw_usercuc") + let &l:cursorcolumn = s:netrw_usercuc + endif " call Dret("s:RestoreCursorline : restored cul=".&l:cursorline." cuc=".&l:cursorcolumn) endfun @@ -7978,7 +9383,7 @@ fun! s:NetrwDelete(path) if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) if exists("+shellslash") let sskeep= &shellslash - setlocal noshellslash + setl noshellslash let result = delete(path) let &shellslash = sskeep else @@ -7990,7 +9395,7 @@ fun! s:NetrwDelete(path) let result= delete(path) endif if result < 0 - call netrw#ErrorMsg(s:WARNING,"delete(".path.") failed!",71) + keepj call netrw#ErrorMsg(s:WARNING,"delete(".path.") failed!",71) endif " call Dret("s:NetrwDelete ".result) @@ -8022,13 +9427,13 @@ fun! s:NetrwEnew(...) if exists("b:netrw_option") |let netrw_option = b:netrw_option |endif if exists("b:netrw_prvdir") |let netrw_prvdir = b:netrw_prvdir |endif - call s:NetrwOptionRestore("w:") + keepj call s:NetrwOptionRestore("w:") " call Decho("generate a buffer with keepjumps keepalt enew!") let netrw_keepdiff= &l:diff keepj keepalt enew! let &l:diff= netrw_keepdiff " call Decho("bufnr($)=".bufnr("$")) - call s:NetrwOptionSave("w:") + keepj call s:NetrwOptionSave("w:") " copy function-local-variables to buffer variable equivalents " call Decho("copy function-local variables back to buffer netrw variables") @@ -8054,16 +9459,44 @@ fun! s:NetrwEnew(...) if b:netrw_curdir =~ '/$' if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST file NetrwTreeListing - set bt=nowrite noswf - nno [ :silent call TreeListMove('[') - nno ] :silent call TreeListMove(']') + set bt=nowrite noswf bh=hide + nno [ :sil call TreeListMove('[') + nno ] :sil call TreeListMove(']') else exe "sil! keepalt file ".fnameescape(b:netrw_curdir) endif endif endif -" call Dret("s:NetrwEnew : buf#".bufnr("%")."<".bufname("%")."> expand(%)<".expand("%")."> expand(#)<".expand("#").">") +" call Dret("s:NetrwEnew : buf#".bufnr("%")."<".bufname("%")."> expand(%)<".expand("%")."> expand(#)<".expand("#")."> bh=".&bh) +endfun + +" --------------------------------------------------------------------- +" s:NetrwInsureWinVars: insure that a netrw buffer has its w: variables in spite of a wincmd v or s {{{2 +fun! s:NetrwInsureWinVars() +" call Dfunc("s:NetrwInsureWinVars() win#".winnr()) + if !exists("w:netrw_liststyle") + let curbuf = bufnr("%") + let curwin = winnr() + let iwin = 1 + while iwin <= winnr("$") + exe iwin."wincmd w" + if winnr() != curwin && bufnr("%") == curbuf && exists("w:netrw_liststyle") + " looks like ctrl-w_s or ctrl-w_v was used to split a netrw buffer + let winvars= w: + break + endif + let iwin= iwin + 1 + endwhile + exe "keepalt ".curwin."wincmd w" + if exists("winvars") +" call Decho("copying w#".iwin." window variables to w#".curwin) + for k in keys(winvars) + let w:{k}= winvars[k] + endfor + endif + endif +" call Dret("s:NetrwInsureWinVars win#".winnr()) endfun " ------------------------------------------------------------------------ @@ -8080,7 +9513,7 @@ endfun " changed sorting, etc. Also see s:NetrwSaveWordPosn(). fun! s:NetrwRestoreWordPosn() " call Dfunc("NetrwRestoreWordPosn()") - silent! call search(s:netrw_saveword,'w') + sil! call search(s:netrw_saveword,'w') " call Dret("NetrwRestoreWordPosn") endfun @@ -8102,7 +9535,7 @@ endfun " --------------------------------------------------------------------- " s:RemotePathAnalysis: {{{2 fun! s:RemotePathAnalysis(dirname) -" call Dfunc("s:RemotePathAnalysis()") +" call Dfunc("s:RemotePathAnalysis(a:dirname<".a:dirname.">)") let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/:#]\+\)\%([:#]\(\d\+\)\)\=/\(.*\)$' let s:method = substitute(a:dirname,dirpat,'\1','') @@ -8131,9 +9564,9 @@ endfun fun! s:RemoteSystem(cmd) " call Dfunc("s:RemoteSystem(cmd<".a:cmd.">)") if !executable(g:netrw_ssh_cmd) - call netrw#ErrorMsg(s:ERROR,"g:netrw_ssh_cmd<".g:netrw_ssh_cmd."> is not executable!",52) + keepj call netrw#ErrorMsg(s:ERROR,"g:netrw_ssh_cmd<".g:netrw_ssh_cmd."> is not executable!",52) elseif !exists("b:netrw_curdir") - call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53) + keepj call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53) else let cmd = s:MakeSshCmd(g:netrw_ssh_cmd." USEPORT HOSTNAME") let remotedir= substitute(b:netrw_curdir,'^.*//[^/]\+/\(.*\)$','\1','') @@ -8183,15 +9616,28 @@ endfun " " s:nbcd_curpos_{bufnr('%')} is set up by s:NetrwBrowseChgDir() fun! s:NetrwRexplore(islocal,dirname) -" call Dfunc("s:NetrwRexplore(islocal=".a:islocal." dirname<".a:dirname.">)") - if a:islocal - call netrw#LocalBrowseCheck(a:dirname) + if exists("s:netrwdrag") + return + endif +" call Dfunc("s:NetrwRexplore() w:netrw_rexlocal=".w:netrw_rexlocal." w:netrw_rexdir<".w:netrw_rexdir.">") + if !exists("w:netrw_rexlocal") +" " call Dret("s:NetrwRexplore() w:netrw_rexlocal doesn't exist") + return + endif + if w:netrw_rexlocal + keepj call netrw#LocalBrowseCheck(w:netrw_rexdir) else - call s:NetrwBrowse(0,a:dirname) + keepj call s:NetrwBrowse(0,w:netrw_rexdir) endif - if exists("s:nbcd_curpos_{bufnr('%')}") - call netrw#NetrwRestorePosn(s:nbcd_curpos_{bufnr('%')}) - unlet s:nbcd_curpos_{bufnr('%')} + if exists("s:initbeval") + set beval + endif + if exists("s:rexposn_".bufnr("%")) +" call Decho("(NetrwRexplore) restore posn, then unlet s:rexposn_".bufnr('%')) + keepj call netrw#NetrwRestorePosn(s:rexposn_{bufnr('%')}) + unlet s:rexposn_{bufnr('%')} + else +" call Decho("(NetrwRexplore) s:rexposn_".bufnr('%')." doesn't exist") endif if exists("s:explore_match") exe "2match netrwMarkFile /".s:explore_match."/" @@ -8265,32 +9711,14 @@ endfun " s:SetRexDir: set directory for :Rexplore {{{2 fun! s:SetRexDir(islocal,dirname) " call Dfunc("s:SetRexDir(islocal=".a:islocal." dirname<".a:dirname.">)") - " set up Rex and leftmouse-double-click - if a:islocal - exe 'com! Rexplore call s:NetrwRexplore(1,"'.escape(a:dirname,'"\').'")' - if g:netrw_retmap - if !hasmapto("NetrwReturn") && maparg("<2-leftmouse>","n") == "" - nmap <2-leftmouse> NetrwReturn - endif - let dir = escape(a:dirname, s:netrw_map_escape) - exe 'nnoremap NetrwReturn :call NetrwRexplore(1,"'.dir.'")' - endif - else - exe 'com! Rexplore call s:NetrwRexplore(0,"'.escape(a:dirname,'"\').'")' - if g:netrw_retmap - if !hasmapto("NetrwReturn") && maparg("<2-leftmouse>","n") == "" - nmap <2-leftmouse> NetrwReturn - endif - let dir = escape(a:dirname, s:netrw_map_escape) - exe 'nnoremap NetrwReturn :call NetrwRexplore(0,"'.dir.'")' - endif - endif -" call Dret("s:SetRexDir") + let w:netrw_rexdir = a:dirname + let w:netrw_rexlocal = a:islocal +" call Dret("s:SetRexDir : win#".winnr()." ".(a:islocal? "local" : "remote")." dir: ".a:dirname) endfun " --------------------------------------------------------------------- " s:Strlen: this function returns the length of a string, even if its {{{2 -" using two-byte etc characters. +" using multiple-byte characters. " Solution from Nicolai Weibull, vim docs (:help strlen()), Tony Mechelynck, " and a bit from me. " if g:netrw_xstrlen is zero (default), then the builtin strlen() function is used. @@ -8317,6 +9745,7 @@ fun! s:Strlen(x) call setline(line("."),a:x) let ret= virtcol("$") - 1 keepj d + keepj norm! k let &mod= modkeep else @@ -8390,12 +9819,12 @@ endfun " Buffers.Refresh; hence, s:NetrwBMShow() utilizes a "cheat" to call that function anyway. fun! s:UpdateBuffersMenu() " call Dfunc("s:UpdateBuffersMenu()") - if has("gui") && has("menu") && has("gui_running") && &go =~ 'm' && g:netrw_menu + if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu try - silent emenu Buffers.Refresh\ menu + sil emenu Buffers.Refresh\ menu catch /^Vim\%((\a\+)\)\=:E/ let v:errmsg= "" - silent call s:NetrwBMShow() + sil keepj call s:NetrwBMShow() endtry endif " call Dret("s:UpdateBuffersMenu") @@ -8403,7 +9832,7 @@ endfun " --------------------------------------------------------------------- " s:UseBufWinVars: (used by NetrwBrowse() and LocalBrowseCheck() {{{2 -" Matching function to BufferWinVars() +" Matching function to s:SetBufWinVars() fun! s:UseBufWinVars() " call Dfunc("s:UseBufWinVars()") if exists("b:netrw_liststyle") && !exists("w:netrw_liststyle") |let w:netrw_liststyle = b:netrw_liststyle |endif @@ -8420,27 +9849,7 @@ fun! s:UseBufWinVars() endfun " --------------------------------------------------------------------- -" netrw#WinPath: tries to insure that the path is windows-acceptable, whether cygwin is used or not {{{2 -fun! netrw#WinPath(path) -" call Dfunc("netrw#WinPath(path<".a:path.">)") - if (!g:netrw_cygwin || &shell !~ '\%(\\|\\)\%(\.exe\)\=$') && (has("win32") || has("win95") || has("win64") || has("win16")) - " remove cygdrive prefix, if present - let path = substitute(a:path,'/cygdrive/\(.\)','\1:','') - " remove trailing slash (Win95) - let path = substitute(path, '\(\\\|/\)$', '', 'g') - " remove escaped spaces - let path = substitute(path, '\ ', ' ', 'g') - " convert slashes to backslashes - let path = substitute(path, '/', '\', 'g') - else - let path= a:path - endif -" call Dret("netrw#WinPath <".path.">") - return path -endfun - -" --------------------------------------------------------------------- -" Settings Restoration: {{{2 +" Settings Restoration: {{{1 let &cpo= s:keepcpo unlet s:keepcpo diff --git a/runtime/autoload/netrwFileHandlers.vim b/runtime/autoload/netrwFileHandlers.vim index 1515b00..ed31e29 100644 --- a/runtime/autoload/netrwFileHandlers.vim +++ b/runtime/autoload/netrwFileHandlers.vim @@ -1,9 +1,9 @@ " netrwFileHandlers: contains various extension-based file handlers for " netrw's browsers' x command ("eXecute launcher") -" Author: Charles E. Campbell, Jr. -" Date: Sep 30, 2008 -" Version: 10 -" Copyright: Copyright (C) 1999-2008 Charles E. Campbell, Jr. {{{1 +" Author: Charles E. Campbell +" Date: May 03, 2013 +" Version: 11b ASTRO-ONLY +" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1 " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright " notice is copied with it. Like anything else that's free, @@ -20,7 +20,7 @@ if exists("g:loaded_netrwFileHandlers") || &cp finish endif -let g:loaded_netrwFileHandlers= "v10" +let g:loaded_netrwFileHandlers= "v11b" if v:version < 702 echohl WarningMsg echo "***warning*** this version of netrwFileHandlers needs vim 7.2" @@ -34,10 +34,10 @@ set cpo&vim " netrwFileHandlers#Invoke: {{{1 fun! netrwFileHandlers#Invoke(exten,fname) " call Dfunc("netrwFileHandlers#Invoke(exten<".a:exten."> fname<".a:fname.">)") - let fname= a:fname + let exten= a:exten " list of supported special characters. Consider rcs,v --- that can be " supported with a NFH_rcsCOMMAv() handler - if a:fname =~ '[@:,$!=\-+%?;~]' + if exten =~ '[@:,$!=\-+%?;~]' let specials= { \ '@' : 'AT', \ ':' : 'COLON', @@ -51,20 +51,20 @@ fun! netrwFileHandlers#Invoke(exten,fname) \ '?' : 'QUESTION', \ ';' : 'SEMICOLON', \ '~' : 'TILDE'} - let fname= substitute(a:fname,'[@:,$!=\-+%?;~]','\=specials[submatch(0)]','ge') + let exten= substitute(a:exten,'[@:,$!=\-+%?;~]','\=specials[submatch(0)]','ge') " call Decho('fname<'.fname.'> done with dictionary') endif - if a:exten != "" && exists("*NFH_".a:exten) + if a:exten != "" && exists("*NFH_".exten) " support user NFH_*() functions " call Decho("let ret= netrwFileHandlers#NFH_".a:exten.'("'.fname.'")') - exe "let ret= NFH_".a:exten.'("'.fname.'")' - elseif a:exten != "" && exists("*s:NFH_".a:exten) + exe "let ret= NFH_".exten.'("'.a:fname.'")' + elseif a:exten != "" && exists("*s:NFH_".exten) " use builtin-NFH_*() functions " call Decho("let ret= netrwFileHandlers#NFH_".a:exten.'("'.fname.'")') - exe "let ret= s:NFH_".a:exten.'("'.fname.'")' + exe "let ret= s:NFH_".a:exten.'("'.a:fname.'")' endif - + " call Dret("netrwFileHandlers#Invoke 0 : ret=".ret) return 0 endfun @@ -356,6 +356,7 @@ fun! s:NFH_obj(obj) endfun let &cpo= s:keepcpo +unlet s:keepcpo " --------------------------------------------------------------------- " Modelines: {{{1 " vim: fdm=marker diff --git a/runtime/autoload/netrwSettings.vim b/runtime/autoload/netrwSettings.vim index 38f7299..ee43059 100644 --- a/runtime/autoload/netrwSettings.vim +++ b/runtime/autoload/netrwSettings.vim @@ -1,8 +1,8 @@ " netrwSettings.vim: makes netrw settings simpler -" Date: Sep 03, 2008 -" Maintainer: Charles E Campbell, Jr -" Version: 13 -" Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1 +" Date: May 03, 2013 +" Maintainer: Charles E Campbell +" Version: 14a ASTRO-ONLY +" Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1 " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright " notice is copied with it. Like anything else that's free, @@ -19,7 +19,7 @@ if exists("g:loaded_netrwSettings") || &cp finish endif -let g:loaded_netrwSettings = "v13" +let g:loaded_netrwSettings = "v14a" if v:version < 700 echohl WarningMsg echo "***warning*** this version of netrwSettings needs vim 7.0" @@ -63,7 +63,7 @@ fun! netrwSettings#NetrwSettings() endif put ='+ ---------------------------------------------' - put ='+ NetrwSettings: by Charles E. Campbell, Jr.' + put ='+ NetrwSettings: by Charles E. Campbell' put ='+ Press with cursor atop any line for help' put ='+ ---------------------------------------------' let s:netrw_settings_stop= line(".") @@ -88,6 +88,7 @@ fun! netrwSettings#NetrwSettings() put = 'let g:netrw_ftpmode = '.g:netrw_ftpmode put = 'let g:netrw_ignorenetrc = '.g:netrw_ignorenetrc put = 'let g:netrw_sshport = '.g:netrw_sshport + put = 'let g:netrw_silent = '.g:netrw_silent put = 'let g:netrw_use_nt_rcp = '.g:netrw_use_nt_rcp put = 'let g:netrw_win95ftp = '.g:netrw_win95ftp let s:netrw_xfer_stop= line(".") @@ -99,51 +100,81 @@ fun! netrwSettings#NetrwSettings() put ='+ Netrw Browser Control' put = 'let g:netrw_alto = '.g:netrw_alto put = 'let g:netrw_altv = '.g:netrw_altv + put = 'let g:netrw_banner = '.g:netrw_banner + if exists("g:netrw_bannerbackslash") + put = 'let g:netrw_bannerbackslash = '.g:netrw_bannerbackslash + else + put = '\" let g:netrw_bannerbackslash = (not defined)' + endif put = 'let g:netrw_browse_split = '.g:netrw_browse_split if exists("g:netrw_browsex_viewer") - put = 'let g:netrw_browsex_viewer = '.g:netrw_browsex_viewer + put = 'let g:netrw_browsex_viewer = '.g:netrw_browsex_viewer else - put = 'let g:netrw_browsex_viewer = (not defined)' + put = '\" let g:netrw_browsex_viewer = (not defined)' endif put = 'let g:netrw_compress = '.g:netrw_compress - put = 'let g:netrw_cursorline = '.g:netrw_cursorline + if exists("g:Netrw_corehandler") + put = 'let g:Netrw_corehandler = '.g:Netrw_corehandler + else + put = '\" let g:Netrw_corehandler = (not defined)' + endif + put = 'let g:netrw_ctags = '.g:netrw_ctags + put = 'let g:netrw_cursor = '.g:netrw_cursor let decompressline= line("$") - put ='let g:netrw_decompress...' + put = 'let g:netrw_decompress = '.string(g:netrw_decompress) + if exists("g:netrw_dynamic_maxfilenamelen") + put = 'let g:netrw_dynamic_maxfilenamelen='.g:netrw_dynamic_maxfilenamelen + else + put = '\" let g:netrw_dynamic_maxfilenamelen= (not defined)' + endif put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax + put = 'let g:netrw_errorlvl = '.g:netrw_errorlvl put = 'let g:netrw_fastbrowse = '.g:netrw_fastbrowse let fnameescline= line("$") - put = 'let g:netrw_fname_escape...' + put = 'let g:netrw_fname_escape = '.string(g:netrw_fname_escape) put = 'let g:netrw_ftp_browse_reject = '.g:netrw_ftp_browse_reject put = 'let g:netrw_ftp_list_cmd = '.g:netrw_ftp_list_cmd put = 'let g:netrw_ftp_sizelist_cmd = '.g:netrw_ftp_sizelist_cmd put = 'let g:netrw_ftp_timelist_cmd = '.g:netrw_ftp_timelist_cmd let globescline= line("$") - put ='let g:netrw_glob_escape...' + put = 'let g:netrw_glob_escape = '.string(g:netrw_glob_escape) put = 'let g:netrw_hide = '.g:netrw_hide + if exists("g:netrw_home") + put = 'let g:netrw_home = '.g:netrw_home + else + put = '\" let g:netrw_home = (not defined)' + endif put = 'let g:netrw_keepdir = '.g:netrw_keepdir put = 'let g:netrw_list_cmd = '.g:netrw_list_cmd put = 'let g:netrw_list_hide = '.g:netrw_list_hide put = 'let g:netrw_liststyle = '.g:netrw_liststyle put = 'let g:netrw_localcopycmd = '.g:netrw_localcopycmd - put = 'let g:netrw_local_mkdir = '.g:netrw_local_mkdir + put = 'let g:netrw_localmkdir = '.g:netrw_localmkdir put = 'let g:netrw_localmovecmd = '.g:netrw_localmovecmd - put = 'let g:netrw_local_rmdir = '.g:netrw_local_rmdir + put = 'let g:netrw_localrmdir = '.g:netrw_localrmdir put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen put = 'let g:netrw_menu = '.g:netrw_menu + put = 'let g:netrw_mousemaps = '.g:netrw_mousemaps put = 'let g:netrw_mkdir_cmd = '.g:netrw_mkdir_cmd + if exists("g:netrw_nobeval") + put = 'let g:netrw_nobeval = '.g:netrw_nobeval + else + put = '\" let g:netrw_nobeval = (not defined)' + endif + put = 'let g:netrw_remote_mkdir = '.g:netrw_remote_mkdir put = 'let g:netrw_preview = '.g:netrw_preview put = 'let g:netrw_rename_cmd = '.g:netrw_rename_cmd put = 'let g:netrw_retmap = '.g:netrw_retmap put = 'let g:netrw_rm_cmd = '.g:netrw_rm_cmd put = 'let g:netrw_rmdir_cmd = '.g:netrw_rmdir_cmd put = 'let g:netrw_rmf_cmd = '.g:netrw_rmf_cmd - put = 'let g:netrw_silent = '.g:netrw_silent put = 'let g:netrw_sort_by = '.g:netrw_sort_by put = 'let g:netrw_sort_direction = '.g:netrw_sort_direction put = 'let g:netrw_sort_options = '.g:netrw_sort_options put = 'let g:netrw_sort_sequence = '.g:netrw_sort_sequence put = 'let g:netrw_special_syntax = '.g:netrw_special_syntax put = 'let g:netrw_ssh_browse_reject = '.g:netrw_ssh_browse_reject + put = 'let g:netrw_ssh_cmd = '.g:netrw_ssh_cmd put = 'let g:netrw_scpport = '.g:netrw_scpport put = 'let g:netrw_sepchr = '.g:netrw_sepchr put = 'let g:netrw_sshport = '.g:netrw_sshport diff --git a/runtime/autoload/phpcomplete.vim b/runtime/autoload/phpcomplete.vim index e5d910e..0756555 100644 --- a/runtime/autoload/phpcomplete.vim +++ b/runtime/autoload/phpcomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: PHP " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) -" Last Change: 2006 May 9 +" Last Change: 2011 Dec 08 " " TODO: " - Class aware completion: @@ -650,6 +650,7 @@ function! phpcomplete#GetClassContents(file, name) " {{{ " this is the most efficient way. The other way " is to go through the looong string looking for " matching {} + let original_window = winnr() below 1new 0put =cfile call search('class\s\+'.a:name) @@ -667,6 +668,9 @@ function! phpcomplete#GetClassContents(file, name) " {{{ let classcontent = join(classc, "\n") bw! % + " go back to where we started + exe original_window.'wincmd w' + if extends_class != '' let classlocation = phpcomplete#GetClassLocation(extends_class) if filereadable(classlocation) diff --git a/runtime/autoload/rubycomplete.vim b/runtime/autoload/rubycomplete.vim index f89be52..e1064c8 100644 --- a/runtime/autoload/rubycomplete.vim +++ b/runtime/autoload/rubycomplete.vim @@ -1,9 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Last Change: 2009 Sep 28 -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site +" URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns " Maintainer Version: 0.8.1 " ---------------------------------------------------------------------------- @@ -12,16 +10,23 @@ " ---------------------------------------------------------------------------- " {{{ requirement checks + +function! s:ErrMsg(msg) + echohl ErrorMsg + echo a:msg + echohl None +endfunction + if !has('ruby') - s:ErrMsg( "Error: Rubycomplete requires vim compiled with +ruby" ) - s:ErrMsg( "Error: falling back to syntax completion" ) + call s:ErrMsg( "Error: Rubycomplete requires vim compiled with +ruby" ) + call s:ErrMsg( "Error: falling back to syntax completion" ) " lets fall back to syntax completion setlocal omnifunc=syntaxcomplete#Complete finish endif if version < 700 - s:ErrMsg( "Error: Required vim >= 7.0" ) + call s:ErrMsg( "Error: Required vim >= 7.0" ) finish endif " }}} requirement checks @@ -51,12 +56,6 @@ endif " {{{ vim-side support functions let s:rubycomplete_debug = 0 -function! s:ErrMsg(msg) - echohl ErrorMsg - echo a:msg - echohl None -endfunction - function! s:dprint(msg) if s:rubycomplete_debug == 1 echom a:msg @@ -133,7 +132,7 @@ function! s:GetRubyVarType(v) let stopline = 1 let vtp = '' let pos = getpos('.') - let sstr = '^\s*#\s*@var\s*'.a:v.'\>\s\+[^ \t]\+\s*$' + let sstr = '^\s*#\s*@var\s*'.escape(a:v, '*').'\>\s\+[^ \t]\+\s*$' let [lnum,lcol] = searchpos(sstr,'nb',stopline) if lnum != 0 && lcol != 0 call setpos('.',pos) @@ -275,7 +274,7 @@ class VimRubyCompletion pare = /^\s*class\s*(.*)\s*<\s*(.*)\s*\n/.match( classdef ) load_buffer_class( $2 ) if pare != nil && $2 != name # load parent class if needed - mixre = /.*\n\s*include\s*(.*)\s*\n/.match( classdef ) + mixre = /.*\n\s*(include|prepend)\s*(.*)\s*\n/.match( classdef ) load_buffer_module( $2 ) if mixre != nil && $2 != name # load mixins if needed begin @@ -364,6 +363,10 @@ class VimRubyCompletion print txt if @@debug end + def escape_vim_singlequote_string(str) + str.to_s.gsub(/'/,"\\'") + end + def get_buffer_entity_list( type ) # this will be a little expensive. loading_allowed = VIM::evaluate("exists('g:rubycomplete_buffer_loading') && g:rubycomplete_buffer_loading") @@ -526,9 +529,9 @@ class VimRubyCompletion end def clean_sel(sel, msg) - sel.delete_if { |x| x == nil } - sel.uniq! - sel.grep(/^#{Regexp.quote(msg)}/) if msg != nil + ret = sel.reject{|x|x.nil?}.uniq + ret = ret.grep(/^#{Regexp.quote(msg)}/) if msg != nil + ret end def get_rails_view_methods @@ -767,10 +770,10 @@ class VimRubyCompletion constants = clean_sel( constants, message ) valid = [] - valid += methods.collect { |m| { :name => m, :type => 'm' } } - valid += variables.collect { |v| { :name => v, :type => 'v' } } - valid += classes.collect { |c| { :name => c, :type => 't' } } - valid += constants.collect { |d| { :name => d, :type => 'd' } } + valid += methods.collect { |m| { :name => m.to_s, :type => 'm' } } + valid += variables.collect { |v| { :name => v.to_s, :type => 'v' } } + valid += classes.collect { |c| { :name => c.to_s, :type => 't' } } + valid += constants.collect { |d| { :name => d.to_s, :type => 'd' } } valid.sort! { |x,y| x[:name] <=> y[:name] } outp = "" @@ -779,7 +782,7 @@ class VimRubyCompletion rg.step(150) do |x| stpos = 0+x enpos = 150+x - valid[stpos..enpos].each { |c| outp += "{'word':'%s','item':'%s','kind':'%s'}," % [ c[:name], c[:name], c[:type] ] } + valid[stpos..enpos].each { |c| outp += "{'word':'%s','item':'%s','kind':'%s'}," % [ c[:name], c[:name], c[:type] ].map{|x|escape_vim_singlequote_string(x)} } outp.sub!(/,$/, '') VIM::command("call extend(g:rubycomplete_completions, [%s])" % outp) diff --git a/runtime/autoload/spellfile.vim b/runtime/autoload/spellfile.vim index 534acc6..e7fd1d8 100644 --- a/runtime/autoload/spellfile.vim +++ b/runtime/autoload/spellfile.vim @@ -1,6 +1,6 @@ " Vim script to download a missing spell file " Maintainer: Bram Moolenaar -" Last Change: 2008 Nov 29 +" Last Change: 2012 Jan 08 if !exists('g:spellfile_URL') " Prefer using http:// when netrw should be able to use it, since @@ -70,7 +70,7 @@ function! spellfile#LoadFile(lang) " Remember the buffer number, we check it below. new let newbufnr = winbufnr(0) - setlocal bin + setlocal bin fenc= echo 'Downloading ' . fname . '...' call spellfile#Nread(fname) if getline(2) !~ 'VIMspell' @@ -83,7 +83,7 @@ function! spellfile#LoadFile(lang) " Our buffer has vanished!? Open a new window. echomsg "download buffer disappeared, opening a new one" new - setlocal bin + setlocal bin fenc= else exe winnr . "wincmd w" endif @@ -120,6 +120,7 @@ function! spellfile#LoadFile(lang) else let dirname = escape(dirlist[dirchoice], ' ') endif + setlocal fenc= exe "write " . dirname . '/' . fname " Also download the .sug file, if the user wants to. diff --git a/runtime/autoload/sqlcomplete.vim b/runtime/autoload/sqlcomplete.vim index 5599c0d..9326c15 100644 --- a/runtime/autoload/sqlcomplete.vim +++ b/runtime/autoload/sqlcomplete.vim @@ -1,16 +1,63 @@ " Vim OMNI completion script for SQL " Language: SQL " Maintainer: David Fishburn -" Version: 10.0 -" Last Change: 2010 Jun 11 +" Version: 15.0 +" Last Change: 2013 May 13 +" Homepage: http://www.vim.org/scripts/script.php?script_id=1572 " Usage: For detailed help -" ":help sql.txt" -" or ":help ft-sql-omni" +" ":help sql.txt" +" or ":help ft-sql-omni" " or read $VIMRUNTIME/doc/sql.txt " History +" +" TODO +" - Jonas Enberg - if no table is found when using column completion +" look backwards to a FROM clause and find the first table +" and complete it. +" +" Version 15.0 (May 2013) +" - NF: Changed the SQL precached syntax items, omni_sql_precache_syntax_groups, +" to use regular expressions to pick up extended syntax group names. +" This requires an updated SyntaxComplete plugin version 13.0. +" If the required versions have not been installed, previous +" behaviour will not be impacted. +" +" Version 14.0 (Dec 2012) +" - BF: Added check for cpo +" +" Version 13.0 (Dec 2012) +" - NF: When completing column lists or drilling into a table +" and g:omni_sql_include_owner is enabled, the +" only the table name would be replaced with the column +" list instead of the table name and owner (if specified). +" - NF: When completing column lists using table aliases +" and g:omni_sql_include_owner is enabled, account +" for the owner name when looking up the table +" list instead of the table name and owner (if specified). +" - BF: When completing column lists or drilling into a table +" and g:omni_sql_include_owner is enabled, the +" column list could often not be found for the table. +" - BF: When OMNI popped up, possibly the wrong word +" would be replaced for column and column list options. +" +" Version 12.0 (Feb 2012) +" - Partial column name completion did not work when a table +" name or table alias was provided (Jonas Enberg). +" - Improved the handling of column completion. First we match any +" columns from a previous completion. If not matches are found, we +" consider the partial name to be a table or table alias for the +" query and attempt to match on it. +" +" Version 11.0 (Jan 2012) +" Added g:omni_sql_default_compl_type variable +" - You can specify which type of completion to default to +" when pressing . The entire list of available +" choices can be found in the calls to sqlcomplete#Map in: +" ftplugin/sql.vim +" " Version 10.0 -" Updated PreCacheSyntax() +" Updated PreCacheSyntax() " - Now returns a List of the syntax items it finds. " This allows other plugins / scripts to use this list for their own " purposes. In this case XPTemplate can use them for a Choose list. @@ -18,33 +65,33 @@ " warning if not. " - Verifies the parameters are the correct type and displays a " warning if not. -" Updated SQLCWarningMsg() +" Updated SQLCWarningMsg() " - Prepends warning message with SQLComplete so you know who issued " the warning. -" Updated SQLCErrorMsg() +" Updated SQLCErrorMsg() " - Prepends error message with SQLComplete so you know who issued " the error. -" -" Version 9.0 +" +" Version 9.0 (May 2010) " This change removes some of the support for tables with spaces in their -" names in order to simplify the regexes used to pull out query table +" names in order to simplify the regexes used to pull out query table " aliases for more robust table name and column name code completion. " Full support for "table names with spaces" can be added in again " after 7.3. " " Version 8.0 -" Incorrectly re-executed the g:ftplugin_sql_omni_key_right and g:ftplugin_sql_omni_key_left +" Incorrectly re-executed the g:ftplugin_sql_omni_key_right and g:ftplugin_sql_omni_key_left " when drilling in and out of a column list for a table. " -" Version 7.0 +" Version 7.0 (Jan 2010) " Better handling of object names " -" Version 6.0 +" Version 6.0 (Apr 2008) " Supports object names with spaces "my table name" " " Set completion with CTRL-X CTRL-O to autoloaded function. " This check is in place in case this script is -" sourced directly instead of using the autoload feature. +" sourced directly instead of using the autoload feature. if exists('&omnifunc') " Do not set the option if already set since this " results in an E117 warning. @@ -54,9 +101,11 @@ if exists('&omnifunc') endif if exists('g:loaded_sql_completion') - finish + finish endif -let g:loaded_sql_completion = 100 +let g:loaded_sql_completion = 150 +let s:keepcpo= &cpo +set cpo&vim " Maintains filename of dictionary let s:sql_file_table = "" @@ -69,17 +118,19 @@ let s:tbl_alias = [] let s:tbl_cols = [] let s:syn_list = [] let s:syn_value = [] - + " Used in conjunction with the syntaxcomplete plugin let s:save_inc = "" let s:save_exc = "" -if exists('g:omni_syntax_group_include_sql') - let s:save_inc = g:omni_syntax_group_include_sql +if !exists('g:omni_syntax_group_include_sql') + let g:omni_syntax_group_include_sql = '' endif -if exists('g:omni_syntax_group_exclude_sql') - let s:save_exc = g:omni_syntax_group_exclude_sql +if !exists('g:omni_syntax_group_exclude_sql') + let g:omni_syntax_group_exclude_sql = '' endif - +let s:save_inc = g:omni_syntax_group_include_sql +let s:save_exc = g:omni_syntax_group_exclude_sql + " Used with the column list let s:save_prev_table = "" @@ -90,12 +141,12 @@ endif " Default syntax items to precache if !exists('g:omni_sql_precache_syntax_groups') let g:omni_sql_precache_syntax_groups = [ - \ 'syntax', - \ 'sqlKeyword', - \ 'sqlFunction', - \ 'sqlOption', - \ 'sqlType', - \ 'sqlStatement' + \ 'syntax\w*', + \ 'sqlKeyword\w*', + \ 'sqlFunction\w*', + \ 'sqlOption\w*', + \ 'sqlType\w*', + \ 'sqlStatement\w*' \ ] endif " Set ignorecase to the ftplugin standard @@ -110,14 +161,25 @@ if !exists('g:omni_sql_include_owner') if g:loaded_dbext >= 300 " New to dbext 3.00, by default the table lists include the owner " name of the table. This is used when determining how much of - " whatever has been typed should be replaced as part of the + " whatever has been typed should be replaced as part of the " code replacement. let g:omni_sql_include_owner = 1 endif endif endif +" Default type of completion used when is pressed +if !exists('g:omni_sql_default_compl_type') + let g:omni_sql_default_compl_type = 'table' +endif " This function is used for the 'omnifunc' option. +" It is called twice by omni and it is responsible +" for returning the completion list of items. +" But it must also determine context of what to complete +" and what to "replace" with the completion. +" The a:base, is replaced directly with what the user +" chooses from the choices. +" The s:prepend provides context for the completion. function! sqlcomplete#Complete(findstart, base) " Default to table name completion @@ -126,6 +188,7 @@ function! sqlcomplete#Complete(findstart, base) if exists('b:sql_compl_type') let compl_type = b:sql_compl_type endif + let begindot = 0 " First pass through this function determines how much of the line should " be replaced by whatever is chosen from the completion list @@ -134,13 +197,12 @@ function! sqlcomplete#Complete(findstart, base) let line = getline('.') let start = col('.') - 1 let lastword = -1 - let begindot = 0 " Check if the first character is a ".", for column completion if line[start - 1] == '.' let begindot = 1 endif while start > 0 - " Additional code was required to handle objects which + " Additional code was required to handle objects which " can contain spaces like "my table name". if line[start - 1] !~ '\(\w\|\.\)' " If the previous character is not a period or word character @@ -150,7 +212,7 @@ function! sqlcomplete#Complete(findstart, base) elseif line[start - 1] =~ '\w' " If the previous character is word character continue back let start -= 1 - elseif line[start - 1] =~ '\.' && + elseif line[start - 1] =~ '\.' && \ compl_type =~ 'column\|table\|view\|procedure' " If the previous character is a period and we are completing " an object which can be specified with a period like this: @@ -160,7 +222,10 @@ function! sqlcomplete#Complete(findstart, base) " If lastword has already been set for column completion " break from the loop, since we do not also want to pickup " a table name if it was also supplied. - if lastword != -1 && compl_type == 'column' + " Unless g:omni_sql_include_owner == 1, then we can + " include the ownername. + if lastword != -1 && compl_type == 'column' + \ && g:omni_sql_include_owner == 0 break endif " If column completion was specified stop at the "." if @@ -171,8 +236,8 @@ function! sqlcomplete#Complete(findstart, base) endif " If omni_sql_include_owner = 0, do not include the table " name as part of the substitution, so break here - if lastword == -1 && - \ compl_type =~ 'table\|view\|procedure\column_csv' && + if lastword == -1 && + \ compl_type =~ '\<\(table\|view\|procedure\|column\|column_csv\)\>' && \ g:omni_sql_include_owner == 0 let lastword = start break @@ -202,7 +267,7 @@ function! sqlcomplete#Complete(findstart, base) let compl_list = [] " Default to table name completion - let compl_type = 'table' + let compl_type = g:omni_sql_default_compl_type " Allow maps to specify what type of object completion they want if exists('b:sql_compl_type') let compl_type = b:sql_compl_type @@ -216,7 +281,7 @@ function! sqlcomplete#Complete(findstart, base) if compl_type == 'table' || \ compl_type == 'procedure' || - \ compl_type == 'view' + \ compl_type == 'view' " This type of completion relies upon the dbext.vim plugin if s:SQLCCheck4dbext() == -1 @@ -254,7 +319,7 @@ function! sqlcomplete#Complete(findstart, base) if base == "" " The last time we displayed a column list we stored - " the table name. If the user selects a column list + " the table name. If the user selects a column list " without a table name of alias present, assume they want " the previous column list displayed. let base = s:save_prev_table @@ -269,20 +334,26 @@ function! sqlcomplete#Complete(findstart, base) let table = matchstr( base, '^\(.*\.\)\?\zs.*\ze\..*' ) let column = matchstr( base, '.*\.\zs.*' ) + if g:omni_sql_include_owner == 1 && owner == '' && table != '' && column != '' + let owner = table + let table = column + let column = '' + endif + " It is pretty well impossible to determine if the user " has entered: " owner.table " table.column_prefix - " So there are a couple of things we can do to mitigate + " So there are a couple of things we can do to mitigate " this issue. " 1. Check if the dbext plugin has the option turned " on to even allow owners " 2. Based on 1, if the user is showing a table list - " and the DrillIntoTable (using ) then + " and the DrillIntoTable (using ) then " this will be owner.table. In this case, we can - " check to see the table.column exists in the + " check to see the table.column exists in the " cached table list. If it does, then we have - " determined the user has actually chosen + " determined the user has actually chosen " owner.table, not table.column_prefix. let found = -1 if g:omni_sql_include_owner == 1 && owner == '' @@ -297,17 +368,46 @@ function! sqlcomplete#Complete(findstart, base) " If the user has indicated not to use table owners at all and " the base ends in a '.' we know they are not providing a column " name, so we can shift the items appropriately. - if found != -1 || (g:omni_sql_include_owner == 0 && base !~ '\.$') - let owner = table - let table = column - let column = '' - endif + " if found != -1 || (g:omni_sql_include_owner == 0 && base !~ '\.$') + " let owner = table + " let table = column + " let column = '' + " endif else + " If no "." was provided and the user asked for + " column level completion, first attempt the match + " on any previous column lists. If the user asked + " for a list of columns comma separated, continue as usual. + if compl_type == 'column' && s:save_prev_table != '' + " The last time we displayed a column list we stored + " the table name. If the user selects a column list + " without a table name of alias present, assume they want + " the previous column list displayed. + let table = s:save_prev_table + let list_type = '' + + let compl_list = s:SQLCGetColumns(table, list_type) + if ! empty(compl_list) + " If no column prefix has been provided and the table + " name was provided, append it to each of the items + " returned. + let compl_list = filter(deepcopy(compl_list), 'v:val=~"^'.base.'"' ) + + " If not empty, we have a match on columns + " return the list + if ! empty(compl_list) + return compl_list + endif + endif + endif + " Since no columns were found to match the base supplied + " assume the user is trying to complete the column list + " for a table (and or an alias to a table). let table = base endif " Get anything after the . and consider this the table name - " If an owner has been specified, then we must consider the + " If an owner has been specified, then we must consider the " base to be a partial column name " let base = matchstr( base, '^\(.*\.\)\?\zs.*' ) @@ -322,16 +422,25 @@ function! sqlcomplete#Complete(findstart, base) let list_type = 'csv' endif - let compl_list = s:SQLCGetColumns(table, list_type) + " If we are including the OWNER for the objects, then for + " table completion, if we have it, it should be included + " as there can be the same table names in a database yet + " with different owner names. + if g:omni_sql_include_owner == 1 && owner != '' && table != '' + let compl_list = s:SQLCGetColumns(owner.'.'.table, list_type) + else + let compl_list = s:SQLCGetColumns(table, list_type) + endif + if column != '' " If no column prefix has been provided and the table " name was provided, append it to each of the items " returned. - let compl_list = map(compl_list, "table.'.'.v:val") + let compl_list = map(compl_list, 'table.".".v:val') if owner != '' " If an owner has been provided append it to each of the " items returned. - let compl_list = map(compl_list, "owner.'.'.v:val") + let compl_list = map(compl_list, 'owner.".".v:val') endif else let base = '' @@ -345,11 +454,14 @@ function! sqlcomplete#Complete(findstart, base) endif elseif compl_type == 'resetCache' " Reset all cached items - let s:tbl_name = [] - let s:tbl_alias = [] - let s:tbl_cols = [] - let s:syn_list = [] - let s:syn_value = [] + let s:tbl_name = [] + let s:tbl_alias = [] + let s:tbl_cols = [] + let s:syn_list = [] + let s:syn_value = [] + let s:sql_file_table = "" + let s:sql_file_procedure = "" + let s:sql_file_view = "" let msg = "All SQL cached items have been removed." call s:SQLCWarningMsg(msg) @@ -361,22 +473,41 @@ function! sqlcomplete#Complete(findstart, base) if base != '' " Filter the list based on the first few characters the user entered. - " Check if the text matches at the beginning - " or + " Check if the text matches at the beginning + " \\(^.base.'\\) + " or " Match to a owner.table or alias.column type match + " ^\\(\\w\\+\\.\\)\\?'.base.'\\) " or " Handle names with spaces "my table name" + " "\\(^'.base.'\\|^\\(\\w\\+\\.\\)\\?'.base.'\\)"' + " let expr = 'v:val '.(g:omni_sql_ignorecase==1?'=~?':'=~#').' "\\(^'.base.'\\|^\\(\\w\\+\\.\\)\\?'.base.'\\)"' " let expr = 'v:val '.(g:omni_sql_ignorecase==1?'=~?':'=~#').' "\\(^'.base.'\\)"' " let expr = 'v:val '.(g:omni_sql_ignorecase==1?'=~?':'=~#').' "\\(^'.base.'\\|\\(\\.\\)\\?'.base.'\\)"' " let expr = 'v:val '.(g:omni_sql_ignorecase==1?'=~?':'=~#').' "\\(^'.base.'\\|\\([^.]*\\)\\?'.base.'\\)"' let compl_list = filter(deepcopy(compl_list), expr) + + if empty(compl_list) && compl_type == 'table' && base =~ '\.$' + " It is possible we could be looking for column name completion + " and the user simply hit C-X C-O to lets try it as well + " since we had no hits with the tables. + " If the base ends with a . it is hard to know if we are + " completing table names or column names. + let list_type = '' + + let compl_list = s:SQLCGetColumns(base, list_type) + endif endif if exists('b:sql_compl_savefunc') && b:sql_compl_savefunc != "" let &omnifunc = b:sql_compl_savefunc endif + if empty(compl_list) + call s:SQLCWarningMsg( 'Could not find type['.compl_type.'] using prepend[.'.s:prepended.'] base['.a:base.']' ) + endif + return compl_list endfunc @@ -384,7 +515,7 @@ function! sqlcomplete#PreCacheSyntax(...) let syn_group_arr = [] let syn_items = [] - if a:0 > 0 + if a:0 > 0 if type(a:1) != 3 call s:SQLCWarningMsg("Parameter is not a list. Example:['syntaxGroup1', 'syntaxGroup2']") return '' @@ -407,7 +538,7 @@ endfunction function! sqlcomplete#ResetCacheSyntax(...) let syn_group_arr = [] - if a:0 > 0 + if a:0 > 0 if type(a:1) != 3 call s:SQLCWarningMsg("Parameter is not a list. Example:['syntaxGroup1', 'syntaxGroup2']") return '' @@ -458,7 +589,7 @@ function! sqlcomplete#DrillIntoTable() " If the popup is not visible, simple perform the normal " key behaviour. " Must use exec since they key must be preceeded by "\" - " or feedkeys will simply push each character of the string + " or feedkeys will simply push each character of the string " rather than the "key press". exec 'call feedkeys("\'.g:ftplugin_sql_omni_key_right.'", "n")' endif @@ -475,7 +606,7 @@ function! sqlcomplete#DrillOutOfColumns() " If the popup is not visible, simple perform the normal " key behaviour. " Must use exec since they key must be preceeded by "\" - " or feedkeys will simply push each character of the string + " or feedkeys will simply push each character of the string " rather than the "key press". exec 'call feedkeys("\'.g:ftplugin_sql_omni_key_left.'", "n")' endif @@ -484,16 +615,16 @@ endfunction function! s:SQLCWarningMsg(msg) echohl WarningMsg - echomsg 'SQLComplete:'.a:msg + echomsg 'SQLComplete:'.a:msg echohl None endfunction - + function! s:SQLCErrorMsg(msg) echohl ErrorMsg - echomsg 'SQLComplete:'.a:msg + echomsg 'SQLComplete:'.a:msg echohl None endfunction - + function! s:SQLCGetSyntaxList(syn_group) let syn_group = a:syn_group let compl_list = [] @@ -504,19 +635,23 @@ function! s:SQLCGetSyntaxList(syn_group) " Return previously cached value let compl_list = s:syn_value[list_idx] else - " Request the syntax list items from the + let s:save_inc = g:omni_syntax_group_include_sql + let s:save_exc = g:omni_syntax_group_exclude_sql + let g:omni_syntax_group_include_sql = '' + let g:omni_syntax_group_exclude_sql = '' + + " Request the syntax list items from the " syntax completion plugin if syn_group == 'syntax' " Handle this special case. This allows the user " to indicate they want all the syntax items available, " so do not specify a specific include list. - let g:omni_syntax_group_include_sql = '' + let syn_value = syntaxcomplete#OmniSyntaxList() else " The user has specified a specific syntax group let g:omni_syntax_group_include_sql = syn_group + let syn_value = syntaxcomplete#OmniSyntaxList(syn_group) endif - let g:omni_syntax_group_exclude_sql = '' - let syn_value = syntaxcomplete#OmniSyntaxList() let g:omni_syntax_group_include_sql = s:save_inc let g:omni_syntax_group_exclude_sql = s:save_exc " Cache these values for later use @@ -552,7 +687,7 @@ function! s:SQLCAddAlias(table_name, table_alias, cols) let table_alias = a:table_alias let cols = a:cols - if g:omni_sql_use_tbl_alias != 'n' + if g:omni_sql_use_tbl_alias != 'n' if table_alias == '' if 'da' =~? g:omni_sql_use_tbl_alias if table_name =~ '_' @@ -562,13 +697,13 @@ function! s:SQLCAddAlias(table_name, table_alias, cols) setlocal iskeyword-=_ " Get the first letter of each word - " [[:alpha:]] is used instead of \w + " [[:alpha:]] is used instead of \w " to catch extended accented characters " - let table_alias = substitute( - \ table_name, - \ '\<[[:alpha:]]\+\>_\?', - \ '\=strpart(submatch(0), 0, 1)', + let table_alias = substitute( + \ table_name, + \ '\<[[:alpha:]]\+\>_\?', + \ '\=strpart(submatch(0), 0, 1)', \ 'g' \ ) " Restore original value @@ -596,7 +731,7 @@ function! s:SQLCAddAlias(table_name, table_alias, cols) return cols endfunction -function! s:SQLCGetObjectOwner(object) +function! s:SQLCGetObjectOwner(object) " The owner regex matches a word at the start of the string which is " followed by a dot, but doesn't include the dot in the result. " ^ - from beginning of line @@ -609,11 +744,29 @@ function! s:SQLCGetObjectOwner(object) " let owner = matchstr( a:object, '^\s*\zs.*\ze\.' ) let owner = matchstr( a:object, '^\("\|\[\)\?\zs\.\{-}\ze\("\|\]\)\?\.' ) return owner -endfunction +endfunction function! s:SQLCGetColumns(table_name, list_type) + if a:table_name =~ '\.' + " Check if the owner/creator has been specified + let owner = matchstr( a:table_name, '^\zs.*\ze\..*\..*' ) + let table = matchstr( a:table_name, '^\(.*\.\)\?\zs.*\ze\..*' ) + let column = matchstr( a:table_name, '.*\.\zs.*' ) + + if g:omni_sql_include_owner == 1 && owner == '' && table != '' && column != '' + let owner = table + let table = column + let column = '' + endif + else + let owner = '' + let table = matchstr(a:table_name, '^["\[\]a-zA-Z0-9_ ]\+\ze\.\?') + let column = '' + endif + " Check if the table name was provided as part of the column name - let table_name = matchstr(a:table_name, '^["\[\]a-zA-Z0-9_ ]\+\ze\.\?') + " let table_name = matchstr(a:table_name, '^["\[\]a-zA-Z0-9_ ]\+\ze\.\?') + let table_name = table let table_cols = [] let table_alias = '' let move_to_top = 1 @@ -636,7 +789,7 @@ function! s:SQLCGetColumns(table_name, list_type) if list_idx > -1 let table_cols = split(s:tbl_cols[list_idx], '\n') else - " Check if we have already cached the column list for this table + " Check if we have already cached the column list for this table " by its alias, assuming the table_name provided was actually " the alias for the table instead " select * @@ -654,7 +807,7 @@ function! s:SQLCGetColumns(table_name, list_type) " And the table ends in a "." or we are looking for a column list " if list_idx == -1 && (a:table_name =~ '\.' || b:sql_compl_type =~ 'column') " if list_idx == -1 && (a:table_name =~ '\.' || a:list_type =~ 'csv') - if list_idx == -1 + if list_idx == -1 let saveY = @y let saveSearch = @/ let saveWScan = &wrapscan @@ -665,7 +818,7 @@ function! s:SQLCGetColumns(table_name, list_type) setlocal nowrapscan " If . was entered, look at the word just before the . " We are looking for something like this: - " select * + " select * " from customer c " where c. " So when . is pressed, we need to find 'c' @@ -692,15 +845,15 @@ function! s:SQLCGetColumns(table_name, list_type) " if query =~? '^\c\(select\)' if query =~? '^\(select\|update\|delete\)' let found = 1 - " \(\(\<\w\+\>\)\.\)\? - + " \(\(\<\w\+\>\)\.\)\? - " '\c\(from\|join\|,\).\{-}' - Starting at the from clause (case insensitive) " '\zs\(\(\<\w\+\>\)\.\)\?' - Get the owner name (optional) - " '\<\w\+\>\ze' - Get the table name + " '\<\w\+\>\ze' - Get the table name " '\s\+\<'.table_name.'\>' - Followed by the alias " '\s*\.\@!.*' - Cannot be followed by a . " '\(\\|$\)' - Must be followed by a WHERE clause " '.*' - Exclude the rest of the line in the match - " let table_name_new = matchstr(@y, + " let table_name_new = matchstr(@y, " \ '\c\(from\|join\|,\).\{-}'. " \ '\zs\(\("\|\[\)\?.\{-}\("\|\]\)\.\)\?'. " \ '\("\|\[\)\?.\{-}\("\|\]\)\?\ze'. @@ -711,7 +864,16 @@ function! s:SQLCGetColumns(table_name, list_type) " \ '\(\\|$\)'. " \ '.*' " \ ) - let table_name_new = matchstr(@y, + " + " + " ''\c\(\\|\\|,\)\s*' - Starting at the from clause (case insensitive) + " '\zs\(\("\|\[\)\?\w\+\("\|\]\)\?\.\)\?' - Get the owner name (optional) + " '\("\|\[\)\?\w\+\("\|\]\)\?\ze' - Get the table name + " '\s\+\%(as\s\+\)\?\<'.matchstr(table_name, '.\{-}\ze\.\?$').'\>' - Followed by the alias + " '\s*\.\@!.*' - Cannot be followed by a . + " '\(\\|$\)' - Must be followed by a WHERE clause + " '.*' - Exclude the rest of the line in the match + let table_name_new = matchstr(@y, \ '\c\(\\|\\|,\)\s*'. \ '\zs\(\("\|\[\)\?\w\+\("\|\]\)\?\.\)\?'. \ '\("\|\[\)\?\w\+\("\|\]\)\?\ze'. @@ -725,7 +887,12 @@ function! s:SQLCGetColumns(table_name, list_type) if table_name_new != '' let table_alias = table_name - let table_name = matchstr( table_name_new, '^\(.*\.\)\?\zs.*\ze' ) + if g:omni_sql_include_owner == 1 + let table_name = matchstr( table_name_new, '^\zs\(.\{-}\.\)\?\(.\{-}\.\)\?.*\ze' ) + else + " let table_name = matchstr( table_name_new, '^\(.*\.\)\?\zs.*\ze' ) + let table_name = matchstr( table_name_new, '^\(.\{-}\.\)\?\zs\(.\{-}\.\)\?.*\ze' ) + endif let list_idx = index(s:tbl_name, table_name, 0, &ignorecase) if list_idx > -1 @@ -753,7 +920,7 @@ function! s:SQLCGetColumns(table_name, list_type) " Return to previous location call cursor(curline, curcol) - + if found == 0 if g:loaded_dbext > 300 exec 'DBSetOption use_tbl_alias='.saveSettingAlias @@ -762,12 +929,13 @@ function! s:SQLCGetColumns(table_name, list_type) " Not a SQL statement, do not display a list return [] endif - endif + endif if empty(table_cols) " Specify silent mode, no messages to the user (tbl, 1) " Specify do not comma separate (tbl, 1, 1) - let table_cols_str = DB_getListColumn(table_name, 1, 1) + " let table_cols_str = DB_getListColumn(table_name, 1, 1) + let table_cols_str = DB_getListColumn((owner!=''?owner.'.':'').table_name, 1, 1) if table_cols_str != "" let s:tbl_name = add( s:tbl_name, table_name ) @@ -793,3 +961,7 @@ function! s:SQLCGetColumns(table_name, list_type) return table_cols endfunction +" Restore: +let &cpo= s:keepcpo +unlet s:keepcpo +" vim: ts=4 fdm=marker diff --git a/runtime/autoload/syntaxcomplete.vim b/runtime/autoload/syntaxcomplete.vim index 7b96bfd..a18c3c3 100644 --- a/runtime/autoload/syntaxcomplete.vim +++ b/runtime/autoload/syntaxcomplete.vim @@ -1,38 +1,80 @@ " Vim completion script " Language: All languages, uses existing syntax highlighting rules " Maintainer: David Fishburn -" Version: 7.0 -" Last Change: 2010 Jul 29 -" Usage: For detailed help, ":help ft-syntax-omni" +" Version: 13.0 +" Last Change: 2013 May 14 +" Usage: For detailed help, ":help ft-syntax-omni" " History " +" Version 13.0 +" - Extended the option omni_syntax_group_include_{filetype} +" to accept a comma separated list of regex's rather than +" string. For example, for the javascript filetype you could +" use: +" let g:omni_syntax_group_include_javascript = 'javascript\w\+,jquery\w\+' +" - Some syntax files (perl.vim) use the match // syntax as a mechanism +" to identify keywords. This update attempts to parse the +" match syntax and pull out syntax items which are at least +" 3 words or more. +" +" Version 12.0 +" - It is possible to have '-' as part of iskeyword, when +" checking for character ranges, tighten up the regex. +" E688: More targets than List items. +" +" Version 11.0 +" - Corrected which characters required escaping during +" substitution calls. +" +" Version 10.0 +" - Cycle through all the character ranges specified in the +" iskeyword option and build a list of valid word separators. +" Prior to this change, only actual characters were used, +" where for example ASCII "45" == "-". If "45" were used +" in iskeyword the hyphen would not be picked up. +" This introduces a new option, since the character ranges +" specified could be multibyte: +" let g:omni_syntax_use_single_byte = 1 +" - This by default will only allow single byte ASCII +" characters to be added and an additional check to ensure +" the charater is printable (see documentation for isprint). +" +" Version 9.0 +" - Add the check for cpo. +" +" Version 8.0 +" - Updated SyntaxCSyntaxGroupItems() +" - Some additional syntax items were also allowed +" on nextgroup= lines which were ignored by default. +" Now these lines are processed independently. +" " Version 7.0 -" Updated syntaxcomplete#OmniSyntaxList() +" - Updated syntaxcomplete#OmniSyntaxList() " - Looking up the syntax groups defined from a syntax file -" looked for only 1 format of {filetype}GroupName, but some +" looked for only 1 format of {filetype}GroupName, but some " syntax writers use this format as well: " {b:current_syntax}GroupName -" OmniSyntaxList() will now check for both if the first +" - OmniSyntaxList() will now check for both if the first " method does not find a match. " " Version 6.0 -" Added syntaxcomplete#OmniSyntaxList() -" - Allows other plugins to use this for their own +" - Added syntaxcomplete#OmniSyntaxList() +" - Allows other plugins to use this for their own " purposes. " - It will return a List of all syntax items for the -" syntax group name passed in. -" - XPTemplate for SQL will use this function via the +" syntax group name passed in. +" - XPTemplate for SQL will use this function via the " sqlcomplete plugin to populate a Choose box. " " Version 5.0 -" Updated SyntaxCSyntaxGroupItems() +" - Updated SyntaxCSyntaxGroupItems() " - When processing a list of syntax groups, the final group " was missed in function SyntaxCSyntaxGroupItems. " " Set completion with CTRL-X CTRL-O to autoloaded function. " This check is in place in case this script is -" sourced directly instead of using the autoload feature. +" sourced directly instead of using the autoload feature. if exists('+omnifunc') " Do not set the option if already set since this " results in an E117 warning. @@ -42,9 +84,13 @@ if exists('+omnifunc') endif if exists('g:loaded_syntax_completion') - finish + finish endif -let g:loaded_syntax_completion = 70 +let g:loaded_syntax_completion = 130 + +" Turn on support for line continuations when creating the script +let s:cpo_save = &cpo +set cpo&vim " Set ignorecase to the ftplugin standard " This is the default setting, but if you define a buffer local @@ -61,6 +107,18 @@ if !exists('g:omni_syntax_use_iskeyword') let g:omni_syntax_use_iskeyword = 1 endif +" When using iskeyword, this setting controls whether the characters +" should be limited to single byte characters. +if !exists('g:omni_syntax_use_single_byte') + let g:omni_syntax_use_single_byte = 1 +endif + +" When using iskeyword, this setting controls whether the characters +" should be limited to single byte characters. +if !exists('g:omni_syntax_use_iskeyword_numeric') + let g:omni_syntax_use_iskeyword_numeric = 1 +endif + " Only display items in the completion window that are at least " this many characters in length. " This is the default setting, but if you define a buffer local @@ -71,8 +129,10 @@ endif " This script will build a completion list based on the syntax " elements defined by the files in $VIMRUNTIME/syntax. -let s:syn_remove_words = 'match,matchgroup=,contains,'. - \ 'links to,start=,end=,nextgroup=' +" let s:syn_remove_words = 'match,matchgroup=,contains,'. +let s:syn_remove_words = 'matchgroup=,contains,'. + \ 'links to,start=,end=' + " \ 'links to,start=,end=,nextgroup=' let s:cache_name = [] let s:cache_list = [] @@ -151,7 +211,7 @@ endfunc function! syntaxcomplete#OmniSyntaxList(...) if a:0 > 0 let parms = [] - if 3 == type(a:1) + if 3 == type(a:1) let parms = a:1 elseif 1 == type(a:1) let parms = split(a:1, ',') @@ -165,7 +225,7 @@ endfunc function! OmniSyntaxList(...) let list_parms = [] if a:0 > 0 - if 3 == type(a:1) + if 3 == type(a:1) let list_parms = a:1 elseif 1 == type(a:1) let list_parms = split(a:1, ',') @@ -201,18 +261,18 @@ function! OmniSyntaxList(...) let saveL = @l let filetype = substitute(&filetype, '\.', '_', 'g') - + if empty(list_parms) " Default the include group to include the requested syntax group let syntax_group_include_{filetype} = '' " Check if there are any overrides specified for this filetype if exists('g:omni_syntax_group_include_'.filetype) let syntax_group_include_{filetype} = - \ substitute( g:omni_syntax_group_include_{filetype},'\s\+','','g') + \ substitute( g:omni_syntax_group_include_{filetype},'\s\+','','g') let list_parms = split(g:omni_syntax_group_include_{filetype}, ',') if syntax_group_include_{filetype} =~ '\w' - let syntax_group_include_{filetype} = - \ substitute( syntax_group_include_{filetype}, + let syntax_group_include_{filetype} = + \ substitute( syntax_group_include_{filetype}, \ '\s*,\s*', '\\|', 'g' \ ) endif @@ -222,24 +282,34 @@ function! OmniSyntaxList(...) endif " Loop through all the syntax groupnames, and build a - " syntax file which contains these names. This can + " syntax file which contains these names. This can " work generically for any filetype that does not already " have a plugin defined. " This ASSUMES the syntax groupname BEGINS with the name - " of the filetype. From my casual viewing of the vim7\syntax + " of the filetype. From my casual viewing of the vim7\syntax " directory this is true for almost all syntax definitions. " As an example, the SQL syntax groups have this pattern: " sqlType " sqlOperators " sqlKeyword ... - redir @l - silent! exec 'syntax list '.join(list_parms) - redir END + if !empty(list_parms) && empty(substitute(join(list_parms), '[a-zA-Z ]', '', 'g')) + " If list_parms only includes word characters, use it to limit + " the syntax elements. + " If using regex syntax list will fail to find those items, so + " simply grab the who syntax list. + redir @l + silent! exec 'syntax list '.join(list_parms) + redir END + else + redir @l + silent! exec 'syntax list' + redir END + endif let syntax_full = "\n".@l let @l = saveL - if syntax_full =~ 'E28' + if syntax_full =~ 'E28' \ || syntax_full =~ 'E411' \ || syntax_full =~ 'E415' \ || syntax_full =~ 'No Syntax items' @@ -249,7 +319,7 @@ function! OmniSyntaxList(...) let filetype = substitute(&filetype, '\.', '_', 'g') let list_exclude_groups = [] - if a:0 > 0 + if a:0 > 0 " Do nothing since we have specific a specific list of groups else " Default the exclude group to nothing @@ -257,93 +327,178 @@ function! OmniSyntaxList(...) " Check if there are any overrides specified for this filetype if exists('g:omni_syntax_group_exclude_'.filetype) let syntax_group_exclude_{filetype} = - \ substitute( g:omni_syntax_group_exclude_{filetype},'\s\+','','g') + \ substitute( g:omni_syntax_group_exclude_{filetype},'\s\+','','g') let list_exclude_groups = split(g:omni_syntax_group_exclude_{filetype}, ',') - if syntax_group_exclude_{filetype} =~ '\w' - let syntax_group_exclude_{filetype} = - \ substitute( syntax_group_exclude_{filetype}, + if syntax_group_exclude_{filetype} =~ '\w' + let syntax_group_exclude_{filetype} = + \ substitute( syntax_group_exclude_{filetype}, \ '\s*,\s*', '\\|', 'g' \ ) endif endif endif - " Sometimes filetypes can be composite names, like c.doxygen - " Loop through each individual part looking for the syntax - " items specific to each individual filetype. + if empty(list_parms) + let list_parms = [&filetype.'\w\+'] + endif + let syn_list = '' - let ftindex = 0 - let ftindex = match(&filetype, '\w\+', ftindex) - - while ftindex > -1 - let ft_part_name = matchstr( &filetype, '\w\+', ftindex ) - - " Syntax rules can contain items for more than just the current - " filetype. They can contain additional items added by the user - " via autocmds or their vimrc. - " Some syntax files can be combined (html, php, jsp). - " We want only items that begin with the filetype we are interested in. - let next_group_regex = '\n' . - \ '\zs'.ft_part_name.'\w\+\ze'. - \ '\s\+xxx\s\+' - let index = 0 - let index = match(syntax_full, next_group_regex, index) - - if index == -1 && exists('b:current_syntax') && ft_part_name != b:current_syntax - " There appears to be two standards when writing syntax files. - " Either items begin as: - " syn keyword {filetype}Keyword values ... - " let b:current_syntax = "sql" - " let b:current_syntax = "sqlanywhere" - " Or - " syn keyword {syntax_filename}Keyword values ... - " let b:current_syntax = "mysql" - " So, we will make the format of finding the syntax group names - " a bit more flexible and look for both if the first fails to - " find a match. + let index = 0 + for group_regex in list_parms + " Sometimes filetypes can be composite names, like c.doxygen + " Loop through each individual part looking for the syntax + " items specific to each individual filetype. + " let ftindex = 0 + " let ftindex = match(syntax_full, group_regex, ftindex) + + " while ftindex > -1 + " let ft_part_name = matchstr( syntax_full, '\w\+', ftindex ) + + " Syntax rules can contain items for more than just the current + " filetype. They can contain additional items added by the user + " via autocmds or their vimrc. + " Some syntax files can be combined (html, php, jsp). + " We want only items that begin with the filetype we are interested in. let next_group_regex = '\n' . - \ '\zs'.b:current_syntax.'\w\+\ze'. - \ '\s\+xxx\s\+' - let index = 0 + \ '\zs'.group_regex.'\ze'. + \ '\s\+xxx\s\+' let index = match(syntax_full, next_group_regex, index) - endif - while index > -1 - let group_name = matchstr( syntax_full, '\w\+', index ) - - let get_syn_list = 1 - for exclude_group_name in list_exclude_groups - if '\<'.exclude_group_name.'\>' =~ '\<'.group_name.'\>' - let get_syn_list = 0 - endif - endfor - - " This code is no longer needed in version 6.0 since we have - " augmented the syntax list command to only retrieve the syntax - " groups we are interested in. - " - " if get_syn_list == 1 - " if syntax_group_include_{filetype} != '' - " if '\<'.syntax_group_include_{filetype}.'\>' !~ '\<'.group_name.'\>' - " let get_syn_list = 0 - " endif - " endif - " endif - - if get_syn_list == 1 - " Pass in the full syntax listing, plus the group name we - " are interested in. - let extra_syn_list = s:SyntaxCSyntaxGroupItems(group_name, syntax_full) - let syn_list = syn_list . extra_syn_list . "\n" + " For the matched group name, strip off any of the regex special + " characters and see if we get a match with the current syntax + if index == -1 && exists('b:current_syntax') && substitute(group_regex, '[^a-zA-Z ]\+.*', '', 'g') !~ '^'.b:current_syntax + " There appears to be two standards when writing syntax files. + " Either items begin as: + " syn keyword {filetype}Keyword values ... + " let b:current_syntax = "sql" + " let b:current_syntax = "sqlanywhere" + " Or + " syn keyword {syntax_filename}Keyword values ... + " let b:current_syntax = "mysql" + " So, we will make the format of finding the syntax group names + " a bit more flexible and look for both if the first fails to + " find a match. + let next_group_regex = '\n' . + \ '\zs'.b:current_syntax.'\w\+\ze'. + \ '\s\+xxx\s\+' + let index = 0 + let index = match(syntax_full, next_group_regex, index) endif - let index = index + strlen(group_name) - let index = match(syntax_full, next_group_regex, index) - endwhile + while index > -1 + let group_name = matchstr( syntax_full, '\w\+', index ) + + let get_syn_list = 1 + for exclude_group_name in list_exclude_groups + if '\<'.exclude_group_name.'\>' =~ '\<'.group_name.'\>' + let get_syn_list = 0 + endif + endfor + + " This code is no longer needed in version 6.0 since we have + " augmented the syntax list command to only retrieve the syntax + " groups we are interested in. + " + " if get_syn_list == 1 + " if syntax_group_include_{filetype} != '' + " if '\<'.syntax_group_include_{filetype}.'\>' !~ '\<'.group_name.'\>' + " let get_syn_list = 0 + " endif + " endif + " endif + + if get_syn_list == 1 + " Pass in the full syntax listing, plus the group name we + " are interested in. + let extra_syn_list = s:SyntaxCSyntaxGroupItems(group_name, syntax_full) + let syn_list = syn_list . extra_syn_list . "\n" + endif - let ftindex = ftindex + len(ft_part_name) - let ftindex = match( &filetype, '\w\+', ftindex ) - endwhile + let index = index + strlen(group_name) + let index = match(syntax_full, next_group_regex, index) + endwhile + + " let ftindex = ftindex + len(ft_part_name) + " let ftindex = match( syntax_full, group_regex, ftindex ) + " endwhile + endfor + +" " Sometimes filetypes can be composite names, like c.doxygen +" " Loop through each individual part looking for the syntax +" " items specific to each individual filetype. +" let syn_list = '' +" let ftindex = 0 +" let ftindex = match(&filetype, '\w\+', ftindex) + +" while ftindex > -1 +" let ft_part_name = matchstr( &filetype, '\w\+', ftindex ) + +" " Syntax rules can contain items for more than just the current +" " filetype. They can contain additional items added by the user +" " via autocmds or their vimrc. +" " Some syntax files can be combined (html, php, jsp). +" " We want only items that begin with the filetype we are interested in. +" let next_group_regex = '\n' . +" \ '\zs'.ft_part_name.'\w\+\ze'. +" \ '\s\+xxx\s\+' +" let index = 0 +" let index = match(syntax_full, next_group_regex, index) + +" if index == -1 && exists('b:current_syntax') && ft_part_name != b:current_syntax +" " There appears to be two standards when writing syntax files. +" " Either items begin as: +" " syn keyword {filetype}Keyword values ... +" " let b:current_syntax = "sql" +" " let b:current_syntax = "sqlanywhere" +" " Or +" " syn keyword {syntax_filename}Keyword values ... +" " let b:current_syntax = "mysql" +" " So, we will make the format of finding the syntax group names +" " a bit more flexible and look for both if the first fails to +" " find a match. +" let next_group_regex = '\n' . +" \ '\zs'.b:current_syntax.'\w\+\ze'. +" \ '\s\+xxx\s\+' +" let index = 0 +" let index = match(syntax_full, next_group_regex, index) +" endif + +" while index > -1 +" let group_name = matchstr( syntax_full, '\w\+', index ) + +" let get_syn_list = 1 +" for exclude_group_name in list_exclude_groups +" if '\<'.exclude_group_name.'\>' =~ '\<'.group_name.'\>' +" let get_syn_list = 0 +" endif +" endfor + +" " This code is no longer needed in version 6.0 since we have +" " augmented the syntax list command to only retrieve the syntax +" " groups we are interested in. +" " +" " if get_syn_list == 1 +" " if syntax_group_include_{filetype} != '' +" " if '\<'.syntax_group_include_{filetype}.'\>' !~ '\<'.group_name.'\>' +" " let get_syn_list = 0 +" " endif +" " endif +" " endif + +" if get_syn_list == 1 +" " Pass in the full syntax listing, plus the group name we +" " are interested in. +" let extra_syn_list = s:SyntaxCSyntaxGroupItems(group_name, syntax_full) +" let syn_list = syn_list . extra_syn_list . "\n" +" endif + +" let index = index + strlen(group_name) +" let index = match(syntax_full, next_group_regex, index) +" endwhile + +" let ftindex = ftindex + len(ft_part_name) +" let ftindex = match( &filetype, '\w\+', ftindex ) +" endwhile " Convert the string to a List and sort it. let compl_list = sort(split(syn_list)) @@ -385,7 +540,7 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full ) " \| - 2nd potential match " \%$ - matches end of the file or string " \) - end a group - let syntax_group = matchstr(a:syntax_full, + let syntax_group = matchstr(a:syntax_full, \ "\n".a:group_name.'\s\+xxx\s\+\zs.\{-}\ze\(\n\w\|\%$\)' \ ) @@ -395,26 +550,97 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full ) " We only want the words for the lines begining with " containedin, but there could be other items. - + " Tried to remove all lines that do not begin with contained " but this does not work in all cases since you can have " contained nextgroup=... " So this will strip off the ending of lines with known " keywords. - let syn_list = substitute( + let syn_list = substitute( \ syntax_group, '\<\('. \ substitute( \ escape(s:syn_remove_words, '\\/.*$^~[]') \ , ',', '\\|', 'g' \ ). \ '\).\{-}\%($\|'."\n".'\)' - \ , "\n", 'g' + \ , "\n", 'g' \ ) - " Now strip off the newline + blank space + contained - let syn_list = substitute( - \ syn_list, '\%(^\|\n\)\@<=\s*\<\(contained\)' - \ , "", 'g' + " Attempt to deal with lines using the match syntax + " javaScriptDocTags xxx match /@\(param\|argument\|requires\|file\)\>/ + " Though it can use any types of regex, so this plugin will attempt + " to restrict it + " 1. Only use \( or \%( constructs remove all else + " 2 Remove and []s + " 3. Account for match //constructs + " \%(\%(ms\|me\|hs\|he\|rs\|re\|lc\)\S\+\)\? + " 4. Hope for the best + " + " + let syn_list_old = syn_list + while syn_list =~ '\\s\+\/' + if syn_list =~ 'perlElseIfError' + let syn_list = syn_list + endif + " Check if the match has words at least 3 characters long + if syn_list =~ '\.\{-}\ze\\\@\ze.\{-}\\\@.\{-}\ze\/ ', "", 'g' ) + " let syn_list = substitute( syn_list, '\%(\\s\+\/' + " Problem removing the match / / tags + let syn_list = '' + endif + endwhile + + + " Now strip off the newline + blank space + contained. + " Also include lines with nextgroup=@someName skip_key_words syntax_element + " \ syn_list, '\%(^\|\n\)\@<=\s*\<\(contained\|nextgroup=\)' + " \ syn_list, '\%(^\|\n\)\@<=\s*\<\(contained\|nextgroup=[@a-zA-Z,]*\)' + let syn_list = substitute( + \ syn_list, '\<\(contained\|nextgroup=[@a-zA-Z,]*\)' + \ , "", 'g' + \ ) + + " This can leave lines like this + " =@vimMenuList skipwhite onoremenu + " Strip the special option keywords first + " :h :syn-skipwhite* + let syn_list = substitute( + \ syn_list, '\<\(skipwhite\|skipnl\|skipempty\)\>' + \ , "", 'g' + \ ) + + " Now remove the remainder of the nextgroup=@someName lines + let syn_list = substitute( + \ syn_list, '\%(^\|\n\)\@<=\s*\(@\w\+\)' + \ , "", 'g' \ ) if b:omni_syntax_use_iskeyword == 0 @@ -423,19 +649,74 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full ) " This will replace non-word characters with spaces. let syn_list = substitute( syn_list, '[^0-9A-Za-z_ ]', ' ', 'g' ) else - let accept_chars = ','.&iskeyword.',' - " Remove all character ranges - " let accept_chars = substitute(accept_chars, ',[^,]\+-[^,]\+,', ',', 'g') - let accept_chars = substitute(accept_chars, ',\@<=[^,]\+-[^,]\+,', '', 'g') - " Remove all numeric specifications - " let accept_chars = substitute(accept_chars, ',\d\{-},', ',', 'g') - let accept_chars = substitute(accept_chars, ',\@<=\d\{-},', '', 'g') - " Remove all commas - let accept_chars = substitute(accept_chars, ',', '', 'g') - " Escape special regex characters - let accept_chars = escape(accept_chars, '\\/.*$^~[]' ) - " Remove all characters that are not acceptable - let syn_list = substitute( syn_list, '[^0-9A-Za-z_ '.accept_chars.']', ' ', 'g' ) + if g:omni_syntax_use_iskeyword_numeric == 1 + " iskeyword can contain value like this + " 38,42,43,45,47-58,60-62,64-90,97-122,_,+,-,*,/,%,<,=,>,:,$,?,!,@-@,94 + " Numeric values convert to their ASCII equivalent using the + " nr2char() function. + " & 38 + " * 42 + " + 43 + " - 45 + " ^ 94 + " Iterate through all numeric specifications and convert those + " to their ascii equivalent ensuring the character is printable. + " If so, add it to the list. + let accepted_chars = '' + for item in split(&iskeyword, ',') + if item =~ '\d-\d' + " This is a character range (ie 47-58), + " cycle through each character within the range + let [b:start, b:end] = split(item, '-') + for range_item in range( b:start, b:end ) + if range_item <= 127 || g:omni_syntax_use_single_byte == 0 + if nr2char(range_item) =~ '\p' + let accepted_chars = accepted_chars . nr2char(range_item) + endif + endif + endfor + elseif item =~ '^\d\+$' + " Only numeric, translate to a character + if item < 127 || g:omni_syntax_use_single_byte == 0 + if nr2char(item) =~ '\p' + let accepted_chars = accepted_chars . nr2char(item) + endif + endif + else + if char2nr(item) < 127 || g:omni_syntax_use_single_byte == 0 + if item =~ '\p' + let accepted_chars = accepted_chars . item + endif + endif + endif + endfor + " Escape special regex characters + " Looks like the wrong chars are escaped. In a collection, + " :h /[] + " only `]', `\', `-' and `^' are special: + " let accepted_chars = escape(accepted_chars, '\\/.*$^~[]' ) + let accepted_chars = escape(accepted_chars, ']\-^' ) + " Remove all characters that are not acceptable + let syn_list = substitute( syn_list, '[^A-Za-z'.accepted_chars.']', ' ', 'g' ) + else + let accept_chars = ','.&iskeyword.',' + " Remove all character ranges + " let accept_chars = substitute(accept_chars, ',[^,]\+-[^,]\+,', ',', 'g') + let accept_chars = substitute(accept_chars, ',\@<=[^,]\+-[^,]\+,', '', 'g') + " Remove all numeric specifications + " let accept_chars = substitute(accept_chars, ',\d\{-},', ',', 'g') + let accept_chars = substitute(accept_chars, ',\@<=\d\{-},', '', 'g') + " Remove all commas + let accept_chars = substitute(accept_chars, ',', '', 'g') + " Escape special regex characters + " Looks like the wrong chars are escaped. In a collection, + " :h /[] + " only `]', `\', `-' and `^' are special: + " let accept_chars = escape(accept_chars, '\\/.*$^~[]' ) + let accept_chars = escape(accept_chars, ']\-^' ) + " Remove all characters that are not acceptable + let syn_list = substitute( syn_list, '[^0-9A-Za-z_'.accept_chars.']', ' ', 'g' ) + endif endif if b:omni_syntax_minimum_length > 0 @@ -448,3 +729,27 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full ) return syn_list endfunction + +function! OmniSyntaxShowChars(spec) + let result = [] + for item in split(a:spec, ',') + if len(item) > 1 + if item == '@-@' + call add(result, char2nr(item)) + else + call extend(result, call('range', split(item, '-'))) + endif + else + if item == '@' " assume this is [A-Za-z] + for [c1, c2] in [['A', 'Z'], ['a', 'z']] + call extend(result, range(char2nr(c1), char2nr(c2))) + endfor + else + call add(result, char2nr(item)) + endif + endif + endfor + return join(map(result, 'nr2char(v:val)'), ', ') +endfunction +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim index becb790..5e76870 100644 --- a/runtime/autoload/tar.vim +++ b/runtime/autoload/tar.vim @@ -1,13 +1,13 @@ " tar.vim: Handles browsing tarfiles " AUTOLOAD PORTION -" Date: Aug 09, 2010 -" Version: 26 -" Maintainer: Charles E Campbell, Jr +" Date: Apr 17, 2013 +" Version: 29 +" Maintainer: Charles E Campbell " License: Vim License (see vim's :help license) " " Contains many ideas from Michael Toren's " -" Copyright: Copyright (C) 2005-2009 Charles E. Campbell, Jr. {{{1 +" Copyright: Copyright (C) 2005-2011 Charles E. Campbell {{{1 " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright " notice is copied with it. Like anything else that's free, @@ -22,7 +22,7 @@ if &cp || exists("g:loaded_tar") finish endif -let g:loaded_tar= "v26" +let g:loaded_tar= "v29" if v:version < 702 echohl WarningMsg echo "***warning*** this version of tar needs vim 7.2" @@ -31,6 +31,7 @@ if v:version < 702 endif let s:keepcpo= &cpo set cpo&vim +"DechoTabOn "call Decho("loading autoload/tar.vim") " --------------------------------------------------------------------- @@ -47,6 +48,17 @@ endif if !exists("g:tar_writeoptions") let g:tar_writeoptions= "uf" endif +if !exists("g:netrw_cygwin") + if has("win32") || has("win95") || has("win64") || has("win16") + if &shell =~ '\%(\\|\\)\%(\.exe\)\=$' + let g:netrw_cygwin= 1 + else + let g:netrw_cygwin= 0 + endif + else + let g:netrw_cygwin= 0 + endif +endif if !exists("g:tar_copycmd") if !exists("g:netrw_localcopycmd") if has("win32") || has("win95") || has("win64") || has("win16") @@ -63,24 +75,13 @@ if !exists("g:tar_copycmd") endif let g:tar_copycmd= g:netrw_localcopycmd endif -if !exists("g:netrw_cygwin") - if has("win32") || has("win95") || has("win64") || has("win16") - if &shell =~ '\%(\\|\\)\%(\.exe\)\=$' - let g:netrw_cygwin= 1 - else - let g:netrw_cygwin= 0 - endif - else - let g:netrw_cygwin= 0 - endif -endif if !exists("g:tar_extractcmd") let g:tar_extractcmd= "tar -xf" endif " set up shell quoting character if !exists("g:tar_shq") - if exists("&shq") && &shq != "" + if exists("+shq") && exists("&shq") && &shq != "" let g:tar_shq= &shq elseif has("win32") || has("win95") || has("win64") || has("win16") if exists("g:netrw_cygwin") && g:netrw_cygwin @@ -142,38 +143,38 @@ fun! tar#Browse(tarfile) call setline(lastline+1,'" tar.vim version '.g:loaded_tar) call setline(lastline+2,'" Browsing tarfile '.a:tarfile) call setline(lastline+3,'" Select a file with cursor and press ENTER') - $put ='' - 0d - $ + keepj $put ='' + keepj sil! 0d + keepj $ let tarfile= a:tarfile - if has("win32") && executable("cygpath") + if has("win32unix") && executable("cygpath") " assuming cygwin let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e') endif let curlast= line("$") if tarfile =~# '\.\(gz\|tgz\)$' " call Decho("1: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") - exe "silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " + exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " elseif tarfile =~# '\.lrp' " call Decho("2: exe silent r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - ") - exe "silent r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - " - elseif tarfile =~# '\.bz2$' + exe "sil! r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - " + elseif tarfile =~# '\.\(bz2\|tbz\|tb2\)$' " call Decho("3: exe silent r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") - exe "silent r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " - elseif tarfile =~# '\.lzma$' + exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " + elseif tarfile =~# '\.\(lzma\|tlz\)$' " call Decho("3: exe silent r! lzma -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") - exe "silent r! lzma -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " + exe "sil! r! lzma -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " elseif tarfile =~# '\.\(xz\|txz\)$' " call Decho("3: exe silent r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") - exe "silent r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " + exe "sil! r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " else if tarfile =~ '^\s*-' " A file name starting with a dash is taken as an option. Prepend ./ to avoid that. let tarfile = substitute(tarfile, '-', './-', '') endif " call Decho("4: exe silent r! ".g:tar_cmd." -".g:tar_browseoptions." ".shellescape(tarfile,0)) - exe "silent r! ".g:tar_cmd." -".g:tar_browseoptions." ".shellescape(tarfile,1) + exe "sil! r! ".g:tar_cmd." -".g:tar_browseoptions." ".shellescape(tarfile,1) endif if v:shell_error != 0 redraw! @@ -184,12 +185,12 @@ fun! tar#Browse(tarfile) if line("$") == curlast || ( line("$") == (curlast + 1) && getline("$") =~ '\c\%(warning\|error\|inappropriate\|unrecognized\)') redraw! echohl WarningMsg | echo "***warning*** (tar#Browse) ".a:tarfile." doesn't appear to be a tar file" | echohl None - silent %d + keepj sil! %d let eikeep= &ei set ei=BufReadCmd,FileReadCmd exe "r ".fnameescape(a:tarfile) let &ei= eikeep - 1d + keepj sil! 1d " call Dret("tar#Browse : a:tarfile<".a:tarfile.">") return endif @@ -227,7 +228,7 @@ fun! s:TarBrowseSelect() " about to make a new window, need to use b:tarfile let tarfile= b:tarfile let curfile= expand("%") - if has("win32") && executable("cygpath") + if has("win32unix") && executable("cygpath") " assuming cygwin let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e') endif @@ -239,6 +240,8 @@ fun! s:TarBrowseSelect() let s:tblfile_{winnr()}= curfile call tar#Read("tarfile:".tarfile.'::'.fname,1) filetype detect + set nomod + exe 'com! -buffer -nargs=? -complete=file TarDiff :call tar#Diff(,"'.fnameescape(fname).'")' let &report= repkeep " call Dret("TarBrowseSelect : s:tblfile_".winnr()."<".s:tblfile_{winnr()}.">") @@ -252,7 +255,7 @@ fun! tar#Read(fname,mode) set report=10 let tarfile = substitute(a:fname,'tarfile:\(.\{-}\)::.*$','\1','') let fname = substitute(a:fname,'tarfile:.\{-}::\(.*\)$','\1','') - if has("win32") && executable("cygpath") + if has("win32unix") && executable("cygpath") " assuming cygwin let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e') endif @@ -286,19 +289,19 @@ fun! tar#Read(fname,mode) endif if tarfile =~# '\.bz2$' " call Decho("7: exe silent r! bzip2 -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) - exe "silent r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp + exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp elseif tarfile =~# '\.\(gz\|tgz\)$' " call Decho("5: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd.' -'.g:tar_readoptions.' - '.tar_secure.shellescape(fname,1)) - exe "silent r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp + exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp elseif tarfile =~# '\.lrp$' " call Decho("6: exe silent r! cat ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) - exe "silent r! cat -- ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp + exe "sil! r! cat -- ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp elseif tarfile =~# '\.lzma$' " call Decho("7: exe silent r! lzma -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) - exe "silent r! lzma -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp + exe "sil! r! lzma -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp elseif tarfile =~# '\.\(xz\|txz\)$' " call Decho("3: exe silent r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) - exe "silent r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp + exe "sil! r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp else if tarfile =~ '^\s*-' " A file name starting with a dash is taken as an option. Prepend ./ to avoid that. @@ -317,7 +320,7 @@ fun! tar#Read(fname,mode) exe "file tarfile::".fnameescape(fname) " cleanup - 0d + keepj sil! 0d set nomod let &report= repkeep @@ -425,7 +428,7 @@ fun! tar#Write(fname) if fname =~ '/' let dirpath = substitute(fname,'/[^/]\+$','','e') - if executable("cygpath") + if has("win32unix") && executable("cygpath") let dirpath = substitute(system("cygpath ".shellescape(dirpath, 0)),'\n','','e') endif call mkdir(dirpath,"p") @@ -445,7 +448,7 @@ fun! tar#Write(fname) let tar_secure= " " endif exe "w! ".fnameescape(fname) - if executable("cygpath") + if has("win32unix") && executable("cygpath") let tarfile = substitute(system("cygpath ".shellescape(tarfile,0)),'\n','','e') endif @@ -501,6 +504,30 @@ fun! tar#Write(fname) endfun " --------------------------------------------------------------------- +" tar#Diff: {{{2 +fun! tar#Diff(userfname,fname) +" call Dfunc("tar#Diff(userfname<".a:userfname."> fname<".a:fname.")") + let fname= a:fname + if a:userfname != "" + let fname= a:userfname + endif + if filereadable(fname) + " sets current file (from tarball) for diff'ing + " splits window vertically + " opens original file, sets it for diff'ing + " sets up b:tardiff_otherbuf variables so each buffer knows about the other (for closing purposes) + diffthis + wincmd v + exe "e ".fnameescape(fname) + diffthis + else + redraw! + echo "***warning*** unable to read file<".fname.">" + endif +" call Dret("tar#Diff") +endfun + +" --------------------------------------------------------------------- " s:Rmdir: {{{2 fun! s:Rmdir(fname) " call Dfunc("Rmdir(fname<".a:fname.">)") diff --git a/runtime/autoload/tohtml.vim b/runtime/autoload/tohtml.vim index c24d6ff..5cb23a6 100644 --- a/runtime/autoload/tohtml.vim +++ b/runtime/autoload/tohtml.vim @@ -1,6 +1,6 @@ " Vim autoload file for the tohtml plugin. " Maintainer: Ben Fritz -" Last Change: 2010 Aug 12 +" Last Change: 2013 Jun 19 " " Additional contributors: " @@ -11,12 +11,286 @@ " this file uses line continuations let s:cpo_sav = &cpo -set cpo-=C +set cpo&vim -func! tohtml#Convert2HTML(line1, line2) +" Automatically find charsets from all encodings supported natively by Vim. With +" the 8bit- and 2byte- prefixes, Vim can actually support more encodings than +" this. Let the user specify these however since they won't be supported on +" every system. +" +" Note, not all of Vim's supported encodings have a charset to use. +" +" Names in this list are from: +" http://www.iana.org/assignments/character-sets +" g:tohtml#encoding_to_charset: {{{ +let g:tohtml#encoding_to_charset = { + \ 'latin1' : 'ISO-8859-1', + \ 'iso-8859-2' : 'ISO-8859-2', + \ 'iso-8859-3' : 'ISO-8859-3', + \ 'iso-8859-4' : 'ISO-8859-4', + \ 'iso-8859-5' : 'ISO-8859-5', + \ 'iso-8859-6' : 'ISO-8859-6', + \ 'iso-8859-7' : 'ISO-8859-7', + \ 'iso-8859-8' : 'ISO-8859-8', + \ 'iso-8859-9' : 'ISO-8859-9', + \ 'iso-8859-10' : '', + \ 'iso-8859-13' : 'ISO-8859-13', + \ 'iso-8859-14' : '', + \ 'iso-8859-15' : 'ISO-8859-15', + \ 'koi8-r' : 'KOI8-R', + \ 'koi8-u' : 'KOI8-U', + \ 'macroman' : 'macintosh', + \ 'cp437' : '', + \ 'cp775' : '', + \ 'cp850' : '', + \ 'cp852' : '', + \ 'cp855' : '', + \ 'cp857' : '', + \ 'cp860' : '', + \ 'cp861' : '', + \ 'cp862' : '', + \ 'cp863' : '', + \ 'cp865' : '', + \ 'cp866' : 'IBM866', + \ 'cp869' : '', + \ 'cp874' : '', + \ 'cp1250' : 'windows-1250', + \ 'cp1251' : 'windows-1251', + \ 'cp1253' : 'windows-1253', + \ 'cp1254' : 'windows-1254', + \ 'cp1255' : 'windows-1255', + \ 'cp1256' : 'windows-1256', + \ 'cp1257' : 'windows-1257', + \ 'cp1258' : 'windows-1258', + \ 'euc-jp' : 'EUC-JP', + \ 'sjis' : 'Shift_JIS', + \ 'cp932' : 'Shift_JIS', + \ 'cp949' : '', + \ 'euc-kr' : 'EUC-KR', + \ 'cp936' : 'GBK', + \ 'euc-cn' : 'GB2312', + \ 'big5' : 'Big5', + \ 'cp950' : 'Big5', + \ 'utf-8' : 'UTF-8', + \ 'ucs-2' : 'UTF-8', + \ 'ucs-2le' : 'UTF-8', + \ 'utf-16' : 'UTF-8', + \ 'utf-16le' : 'UTF-8', + \ 'ucs-4' : 'UTF-8', + \ 'ucs-4le' : 'UTF-8', + \ } +lockvar g:tohtml#encoding_to_charset +" Notes: +" 1. All UCS/UTF are converted to UTF-8 because it is much better supported +" 2. Any blank spaces are there because Vim supports it but at least one major +" web browser does not according to http://wiki.whatwg.org/wiki/Web_Encodings. +" }}} + +" Only automatically find encodings supported natively by Vim, let the user +" specify the encoding if it's not natively supported. This function is only +" used when the user specifies the charset, they better know what they are +" doing! +" +" Names in this list are from: +" http://www.iana.org/assignments/character-sets +" g:tohtml#charset_to_encoding: {{{ +let g:tohtml#charset_to_encoding = { + \ 'iso_8859-1:1987' : 'latin1', + \ 'iso-ir-100' : 'latin1', + \ 'iso_8859-1' : 'latin1', + \ 'iso-8859-1' : 'latin1', + \ 'latin1' : 'latin1', + \ 'l1' : 'latin1', + \ 'ibm819' : 'latin1', + \ 'cp819' : 'latin1', + \ 'csisolatin1' : 'latin1', + \ 'iso_8859-2:1987' : 'iso-8859-2', + \ 'iso-ir-101' : 'iso-8859-2', + \ 'iso_8859-2' : 'iso-8859-2', + \ 'iso-8859-2' : 'iso-8859-2', + \ 'latin2' : 'iso-8859-2', + \ 'l2' : 'iso-8859-2', + \ 'csisolatin2' : 'iso-8859-2', + \ 'iso_8859-3:1988' : 'iso-8859-3', + \ 'iso-ir-109' : 'iso-8859-3', + \ 'iso_8859-3' : 'iso-8859-3', + \ 'iso-8859-3' : 'iso-8859-3', + \ 'latin3' : 'iso-8859-3', + \ 'l3' : 'iso-8859-3', + \ 'csisolatin3' : 'iso-8859-3', + \ 'iso_8859-4:1988' : 'iso-8859-4', + \ 'iso-ir-110' : 'iso-8859-4', + \ 'iso_8859-4' : 'iso-8859-4', + \ 'iso-8859-4' : 'iso-8859-4', + \ 'latin4' : 'iso-8859-4', + \ 'l4' : 'iso-8859-4', + \ 'csisolatin4' : 'iso-8859-4', + \ 'iso_8859-5:1988' : 'iso-8859-5', + \ 'iso-ir-144' : 'iso-8859-5', + \ 'iso_8859-5' : 'iso-8859-5', + \ 'iso-8859-5' : 'iso-8859-5', + \ 'cyrillic' : 'iso-8859-5', + \ 'csisolatincyrillic' : 'iso-8859-5', + \ 'iso_8859-6:1987' : 'iso-8859-6', + \ 'iso-ir-127' : 'iso-8859-6', + \ 'iso_8859-6' : 'iso-8859-6', + \ 'iso-8859-6' : 'iso-8859-6', + \ 'ecma-114' : 'iso-8859-6', + \ 'asmo-708' : 'iso-8859-6', + \ 'arabic' : 'iso-8859-6', + \ 'csisolatinarabic' : 'iso-8859-6', + \ 'iso_8859-7:1987' : 'iso-8859-7', + \ 'iso-ir-126' : 'iso-8859-7', + \ 'iso_8859-7' : 'iso-8859-7', + \ 'iso-8859-7' : 'iso-8859-7', + \ 'elot_928' : 'iso-8859-7', + \ 'ecma-118' : 'iso-8859-7', + \ 'greek' : 'iso-8859-7', + \ 'greek8' : 'iso-8859-7', + \ 'csisolatingreek' : 'iso-8859-7', + \ 'iso_8859-8:1988' : 'iso-8859-8', + \ 'iso-ir-138' : 'iso-8859-8', + \ 'iso_8859-8' : 'iso-8859-8', + \ 'iso-8859-8' : 'iso-8859-8', + \ 'hebrew' : 'iso-8859-8', + \ 'csisolatinhebrew' : 'iso-8859-8', + \ 'iso_8859-9:1989' : 'iso-8859-9', + \ 'iso-ir-148' : 'iso-8859-9', + \ 'iso_8859-9' : 'iso-8859-9', + \ 'iso-8859-9' : 'iso-8859-9', + \ 'latin5' : 'iso-8859-9', + \ 'l5' : 'iso-8859-9', + \ 'csisolatin5' : 'iso-8859-9', + \ 'iso-8859-10' : 'iso-8859-10', + \ 'iso-ir-157' : 'iso-8859-10', + \ 'l6' : 'iso-8859-10', + \ 'iso_8859-10:1992' : 'iso-8859-10', + \ 'csisolatin6' : 'iso-8859-10', + \ 'latin6' : 'iso-8859-10', + \ 'iso-8859-13' : 'iso-8859-13', + \ 'iso-8859-14' : 'iso-8859-14', + \ 'iso-ir-199' : 'iso-8859-14', + \ 'iso_8859-14:1998' : 'iso-8859-14', + \ 'iso_8859-14' : 'iso-8859-14', + \ 'latin8' : 'iso-8859-14', + \ 'iso-celtic' : 'iso-8859-14', + \ 'l8' : 'iso-8859-14', + \ 'iso-8859-15' : 'iso-8859-15', + \ 'iso_8859-15' : 'iso-8859-15', + \ 'latin-9' : 'iso-8859-15', + \ 'koi8-r' : 'koi8-r', + \ 'cskoi8r' : 'koi8-r', + \ 'koi8-u' : 'koi8-u', + \ 'macintosh' : 'macroman', + \ 'mac' : 'macroman', + \ 'csmacintosh' : 'macroman', + \ 'ibm437' : 'cp437', + \ 'cp437' : 'cp437', + \ '437' : 'cp437', + \ 'cspc8codepage437' : 'cp437', + \ 'ibm775' : 'cp775', + \ 'cp775' : 'cp775', + \ 'cspc775baltic' : 'cp775', + \ 'ibm850' : 'cp850', + \ 'cp850' : 'cp850', + \ '850' : 'cp850', + \ 'cspc850multilingual' : 'cp850', + \ 'ibm852' : 'cp852', + \ 'cp852' : 'cp852', + \ '852' : 'cp852', + \ 'cspcp852' : 'cp852', + \ 'ibm855' : 'cp855', + \ 'cp855' : 'cp855', + \ '855' : 'cp855', + \ 'csibm855' : 'cp855', + \ 'ibm857' : 'cp857', + \ 'cp857' : 'cp857', + \ '857' : 'cp857', + \ 'csibm857' : 'cp857', + \ 'ibm860' : 'cp860', + \ 'cp860' : 'cp860', + \ '860' : 'cp860', + \ 'csibm860' : 'cp860', + \ 'ibm861' : 'cp861', + \ 'cp861' : 'cp861', + \ '861' : 'cp861', + \ 'cp-is' : 'cp861', + \ 'csibm861' : 'cp861', + \ 'ibm862' : 'cp862', + \ 'cp862' : 'cp862', + \ '862' : 'cp862', + \ 'cspc862latinhebrew' : 'cp862', + \ 'ibm863' : 'cp863', + \ 'cp863' : 'cp863', + \ '863' : 'cp863', + \ 'csibm863' : 'cp863', + \ 'ibm865' : 'cp865', + \ 'cp865' : 'cp865', + \ '865' : 'cp865', + \ 'csibm865' : 'cp865', + \ 'ibm866' : 'cp866', + \ 'cp866' : 'cp866', + \ '866' : 'cp866', + \ 'csibm866' : 'cp866', + \ 'ibm869' : 'cp869', + \ 'cp869' : 'cp869', + \ '869' : 'cp869', + \ 'cp-gr' : 'cp869', + \ 'csibm869' : 'cp869', + \ 'windows-1250' : 'cp1250', + \ 'windows-1251' : 'cp1251', + \ 'windows-1253' : 'cp1253', + \ 'windows-1254' : 'cp1254', + \ 'windows-1255' : 'cp1255', + \ 'windows-1256' : 'cp1256', + \ 'windows-1257' : 'cp1257', + \ 'windows-1258' : 'cp1258', + \ 'extended_unix_code_packed_format_for_japanese' : 'euc-jp', + \ 'cseucpkdfmtjapanese' : 'euc-jp', + \ 'euc-jp' : 'euc-jp', + \ 'shift_jis' : 'sjis', + \ 'ms_kanji' : 'sjis', + \ 'sjis' : 'sjis', + \ 'csshiftjis' : 'sjis', + \ 'ibm-thai' : 'cp874', + \ 'csibmthai' : 'cp874', + \ 'ks_c_5601-1987' : 'cp949', + \ 'iso-ir-149' : 'cp949', + \ 'ks_c_5601-1989' : 'cp949', + \ 'ksc_5601' : 'cp949', + \ 'korean' : 'cp949', + \ 'csksc56011987' : 'cp949', + \ 'euc-kr' : 'euc-kr', + \ 'cseuckr' : 'euc-kr', + \ 'gbk' : 'cp936', + \ 'cp936' : 'cp936', + \ 'ms936' : 'cp936', + \ 'windows-936' : 'cp936', + \ 'gb_2312-80' : 'euc-cn', + \ 'iso-ir-58' : 'euc-cn', + \ 'chinese' : 'euc-cn', + \ 'csiso58gb231280' : 'euc-cn', + \ 'big5' : 'big5', + \ 'csbig5' : 'big5', + \ 'utf-8' : 'utf-8', + \ 'iso-10646-ucs-2' : 'ucs-2', + \ 'csunicode' : 'ucs-2', + \ 'utf-16' : 'utf-16', + \ 'utf-16be' : 'utf-16', + \ 'utf-16le' : 'utf-16le', + \ 'utf-32' : 'ucs-4', + \ 'utf-32be' : 'ucs-4', + \ 'utf-32le' : 'ucs-4le', + \ 'iso-10646-ucs-4' : 'ucs-4', + \ 'csucs4' : 'ucs-4' + \ } +lockvar g:tohtml#charset_to_encoding +"}}} + +func! tohtml#Convert2HTML(line1, line2) "{{{ let s:settings = tohtml#GetUserSettings() - if !&diff || s:settings.diff_one_file + if !&diff || s:settings.diff_one_file "{{{ if a:line2 >= a:line1 let g:html_start_line = a:line1 let g:html_end_line = a:line2 @@ -24,31 +298,51 @@ func! tohtml#Convert2HTML(line1, line2) let g:html_start_line = a:line2 let g:html_end_line = a:line1 endif - runtime syntax/2html.vim - else + runtime syntax/2html.vim "}}} + else "{{{ let win_list = [] let buf_list = [] windo | if &diff | call add(win_list, winbufnr(0)) | endif let s:settings.whole_filler = 1 let g:html_diff_win_num = 0 for window in win_list + " switch to the next buffer to convert exe ":" . bufwinnr(window) . "wincmd w" + + " figure out whether current charset and encoding will work, if not + " default to UTF-8 + if !exists('g:html_use_encoding') && + \ (((&l:fileencoding=='' || (&l:buftype!='' && &l:buftype!=?'help')) + \ && &encoding!=?s:settings.vim_encoding) + \ || &l:fileencoding!='' && &l:fileencoding!=?s:settings.vim_encoding) + echohl WarningMsg + echomsg "TOhtml: mismatched file encodings in Diff buffers, using UTF-8" + echohl None + let s:settings.vim_encoding = 'utf-8' + let s:settings.encoding = 'UTF-8' + endif + + " set up for diff-mode conversion let g:html_start_line = 1 let g:html_end_line = line('$') let g:html_diff_win_num += 1 + + " convert this file runtime syntax/2html.vim + + " remember the HTML buffer for later combination call add(buf_list, bufnr('%')) endfor unlet g:html_diff_win_num call tohtml#Diff2HTML(win_list, buf_list) - endif + endif "}}} unlet g:html_start_line unlet g:html_end_line unlet s:settings -endfunc +endfunc "}}} -func! tohtml#Diff2HTML(win_list, buf_list) +func! tohtml#Diff2HTML(win_list, buf_list) "{{{ let xml_line = "" let tag_close = '>' @@ -87,7 +381,7 @@ func! tohtml#Diff2HTML(win_list, buf_list) call add(html, '') " include encoding as close to the top as possible, but only if not already - " contained in XML information (to avoid haggling over content type) + " contained in XML information if s:settings.encoding != "" && !s:settings.use_xhtml call add(html, "') let body_line_num = len(html) - call add(html, '') - call add(html, '') + if !empty(s:settings.prevent_copy) + call add(html, "") + call add(html, "") + call add(html, "
0
") + call add(html, "
") + call add(html, "
") + else + call add(html, '') + endif + call add(html, "
") call add(html, '') for buf in a:win_list @@ -133,7 +440,8 @@ func! tohtml#Diff2HTML(win_list, buf_list) let s:body_end_line = getline('.') endif - " Grab the style information. Some of this will be duplicated... + " Grab the style information. Some of this will be duplicated so only insert + " it if it's not already there. {{{ 1 let style_start = search('^' - \ ]) - endif + \]) + endif "}}} endif let &paste = s:old_paste let &magic = s:old_magic -endfunc +endfunc "}}} " Gets a single user option and sets it in the passed-in Dict, or gives it the " default value if the option doesn't actually exist. -func! tohtml#GetOption(settings, option, default) +func! tohtml#GetOption(settings, option, default) "{{{ if exists('g:html_'.a:option) let a:settings[a:option] = g:html_{a:option} else let a:settings[a:option] = a:default endif -endfunc +endfunc "}}} " returns a Dict containing the values of all user options for 2html, including " default values for those not given an explicit value by the user. Discards the " html_ prefix of the option for nicer looking code. -func! tohtml#GetUserSettings() +func! tohtml#GetUserSettings() "{{{ if exists('s:settings') " just restore the known options if we've already retrieved them return s:settings @@ -289,21 +707,25 @@ func! tohtml#GetUserSettings() let g:html_use_xhtml = g:use_xhtml endif - " get current option settings with appropriate defaults - call tohtml#GetOption(user_settings, 'no_progress', !has("statusline") ) - call tohtml#GetOption(user_settings, 'diff_one_file', 0 ) - call tohtml#GetOption(user_settings, 'number_lines', &number ) - call tohtml#GetOption(user_settings, 'use_css', 1 ) - call tohtml#GetOption(user_settings, 'ignore_conceal', 0 ) - call tohtml#GetOption(user_settings, 'ignore_folding', 0 ) - call tohtml#GetOption(user_settings, 'dynamic_folds', 0 ) - call tohtml#GetOption(user_settings, 'no_foldcolumn', 0 ) - call tohtml#GetOption(user_settings, 'hover_unfold', 0 ) - call tohtml#GetOption(user_settings, 'no_pre', 0 ) - call tohtml#GetOption(user_settings, 'whole_filler', 0 ) - call tohtml#GetOption(user_settings, 'use_xhtml', 0 ) + " get current option settings with appropriate defaults {{{ + call tohtml#GetOption(user_settings, 'no_progress', !has("statusline") ) + call tohtml#GetOption(user_settings, 'diff_one_file', 0 ) + call tohtml#GetOption(user_settings, 'number_lines', &number ) + call tohtml#GetOption(user_settings, 'pre_wrap', &wrap ) + call tohtml#GetOption(user_settings, 'use_css', 1 ) + call tohtml#GetOption(user_settings, 'ignore_conceal', 0 ) + call tohtml#GetOption(user_settings, 'ignore_folding', 0 ) + call tohtml#GetOption(user_settings, 'dynamic_folds', 0 ) + call tohtml#GetOption(user_settings, 'no_foldcolumn', user_settings.ignore_folding) + call tohtml#GetOption(user_settings, 'hover_unfold', 0 ) + call tohtml#GetOption(user_settings, 'no_pre', 0 ) + call tohtml#GetOption(user_settings, 'no_invalid', 0 ) + call tohtml#GetOption(user_settings, 'whole_filler', 0 ) + call tohtml#GetOption(user_settings, 'use_xhtml', 0 ) + call tohtml#GetOption(user_settings, 'line_ids', user_settings.number_lines ) + " }}} - " override those settings that need it + " override those settings that need it {{{ " hover opening implies dynamic folding if user_settings.hover_unfold @@ -324,6 +746,8 @@ func! tohtml#GetUserSettings() " dynamic folding implies css if user_settings.dynamic_folds let user_settings.use_css = 1 + else + let user_settings.no_foldcolumn = 1 " won't do anything but for consistency and for the test suite endif " if we're not using CSS we cannot use a pre section because tags @@ -332,47 +756,168 @@ func! tohtml#GetUserSettings() let user_settings.no_pre = 1 endif - " Figure out proper MIME charset from the 'encoding' option. - if exists("g:html_use_encoding") + " pre_wrap doesn't do anything if not using pre or not using CSS + if user_settings.no_pre || !user_settings.use_css + let user_settings.pre_wrap=0 + endif + "}}} + + " set up expand_tabs option after all the overrides so we know the + " appropriate defaults {{{ + if user_settings.no_pre == 0 + call tohtml#GetOption(user_settings, + \ 'expand_tabs', + \ &expandtab || &ts != 8 || user_settings.number_lines || + \ (user_settings.dynamic_folds && !user_settings.no_foldcolumn)) + else + let user_settings.expand_tabs = 1 + endif + " }}} + + " textual options + if exists("g:html_use_encoding") "{{{ + " user specified the desired MIME charset, figure out proper + " 'fileencoding' from it or warn the user if we cannot let user_settings.encoding = g:html_use_encoding + let user_settings.vim_encoding = tohtml#EncodingFromCharset(g:html_use_encoding) + if user_settings.vim_encoding == '' + echohl WarningMsg + echomsg "TOhtml: file encoding for" + \ g:html_use_encoding + \ "unknown, please set 'fileencoding'" + echohl None + endif else - let vim_encoding = &encoding - if vim_encoding =~ '^8bit\|^2byte' - let vim_encoding = substitute(vim_encoding, '^8bit-\|^2byte-', '', '') + " Figure out proper MIME charset from 'fileencoding' if possible + if &l:fileencoding != '' + " If the buffer is not a "normal" type, the 'fileencoding' value may not + " be trusted; since the buffer should not be written the fileencoding is + " not intended to be used. + if &l:buftype=='' || &l:buftype==?'help' + let user_settings.vim_encoding = &l:fileencoding + call tohtml#CharsetFromEncoding(user_settings) + else + let user_settings.encoding = '' " trigger detection using &encoding + endif endif - if vim_encoding == 'latin1' - let user_settings.encoding = 'iso-8859-1' - elseif vim_encoding =~ "^cp12" - let user_settings.encoding = substitute(vim_encoding, 'cp', 'windows-', '') - elseif vim_encoding == 'sjis' || vim_encoding == 'cp932' - let user_settings.encoding = 'Shift_JIS' - elseif vim_encoding == 'big5' || vim_encoding == 'cp950' - let user_settings.encoding = "Big5" - elseif vim_encoding == 'euc-cn' - let user_settings.encoding = 'GB_2312-80' - elseif vim_encoding == 'euc-tw' - let user_settings.encoding = "" - elseif vim_encoding =~ '^euc\|^iso\|^koi' - let user_settings.encoding = substitute(vim_encoding, '.*', '\U\0', '') - elseif vim_encoding == 'cp949' - let user_settings.encoding = 'KS_C_5601-1987' - elseif vim_encoding == 'cp936' - let user_settings.encoding = 'GBK' - elseif vim_encoding =~ '^ucs\|^utf' + + " else from 'encoding' if possible + if &l:fileencoding == '' || user_settings.encoding == '' + let user_settings.vim_encoding = &encoding + call tohtml#CharsetFromEncoding(user_settings) + endif + + " else default to UTF-8 and warn user + if user_settings.encoding == '' + let user_settings.vim_encoding = 'utf-8' let user_settings.encoding = 'UTF-8' + echohl WarningMsg + echomsg "TOhtml: couldn't determine MIME charset, using UTF-8" + echohl None + endif + endif "}}} + + " Default to making nothing uncopyable, because we default to + " not-standards way of doing things, and also because Microsoft Word and + " others paste the elements anyway. + " + " html_prevent_copy only has an effect when using CSS. + " + " All options: + " f - fold column + " n - line numbers (also within fold text) + " t - fold text + " d - diff filler + " c - concealed text (reserved future) + " l - listchars (reserved possible future) + " s - signs (reserved possible future) + " + " Normal text is always selectable. + let user_settings.prevent_copy = "" + if user_settings.use_css + if exists("g:html_prevent_copy") + if user_settings.dynamic_folds && !user_settings.no_foldcolumn && g:html_prevent_copy =~# 'f' + let user_settings.prevent_copy .= 'f' + endif + if user_settings.number_lines && g:html_prevent_copy =~# 'n' + let user_settings.prevent_copy .= 'n' + endif + if &diff && g:html_prevent_copy =~# 'd' + let user_settings.prevent_copy .= 'd' + endif + if !user_settings.ignore_folding && g:html_prevent_copy =~# 't' + let user_settings.prevent_copy .= 't' + endif else - let user_settings.encoding = "" + let user_settings.prevent_copy = "" endif endif + if empty(user_settings.prevent_copy) + let user_settings.no_invalid = 0 + endif + + if exists('g:html_id_expr') + let user_settings.id_suffix = eval(g:html_id_expr) + if user_settings.id_suffix !~ '^[-_:.A-Za-z0-9]*$' + echohl WarningMsg + echomsg '2html: g:html_id_expr evaluated to invalid string for HTML id attributes' + echomsg '2html: Omitting user-specified suffix' + echohl None + sleep 3 + let user_settings.id_suffix="" + endif + else + let user_settings.id_suffix="" + endif " TODO: font return user_settings endif -endfunc +endfunc "}}} + +" get the proper HTML charset name from a Vim encoding option. +function! tohtml#CharsetFromEncoding(settings) "{{{ + let l:vim_encoding = a:settings.vim_encoding + if exists('g:html_charset_override') && has_key(g:html_charset_override, l:vim_encoding) + let a:settings.encoding = g:html_charset_override[l:vim_encoding] + else + if l:vim_encoding =~ '^8bit\|^2byte' + " 8bit- and 2byte- prefixes are to indicate encodings available on the + " system that Vim will convert with iconv(), look up just the encoding name, + " not Vim's prefix. + let l:vim_encoding = substitute(l:vim_encoding, '^8bit-\|^2byte-', '', '') + endif + if has_key(g:tohtml#encoding_to_charset, l:vim_encoding) + let a:settings.encoding = g:tohtml#encoding_to_charset[l:vim_encoding] + else + let a:settings.encoding = "" + endif + endif + if a:settings.encoding != "" + let l:vim_encoding = tohtml#EncodingFromCharset(a:settings.encoding) + if l:vim_encoding != "" + " if the Vim encoding to HTML encoding conversion is set up (by default or + " by the user) to convert to a different encoding, we need to also change + " the Vim encoding of the new buffer + let a:settings.vim_encoding = l:vim_encoding + endif + endif +endfun "}}} + +" Get the proper Vim encoding option setting from an HTML charset name. +function! tohtml#EncodingFromCharset(encoding) "{{{ + if exists('g:html_encoding_override') && has_key(g:html_encoding_override, a:encoding) + return g:html_encoding_override[a:encoding] + elseif has_key(g:tohtml#charset_to_encoding, tolower(a:encoding)) + return g:tohtml#charset_to_encoding[tolower(a:encoding)] + else + return "" + endif +endfun "}}} let &cpo = s:cpo_sav unlet s:cpo_sav " Make sure any patches will probably use consistent indent -" vim: ts=8 sw=2 sts=2 noet +" vim: ts=8 sw=2 sts=2 noet fdm=marker diff --git a/runtime/autoload/vimball.vim b/runtime/autoload/vimball.vim index 13e82ac..9a5a73c 100644 --- a/runtime/autoload/vimball.vim +++ b/runtime/autoload/vimball.vim @@ -1,9 +1,9 @@ " vimball.vim : construct a file containing both paths and files " Author: Charles E. Campbell, Jr. -" Date: Apr 12, 2010 -" Version: 31 +" Date: Jan 17, 2012 +" Version: 35 " GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim -" Copyright: (c) 2004-2009 by Charles E. Campbell, Jr. +" Copyright: (c) 2004-2011 by Charles E. Campbell, Jr. " The VIM LICENSE applies to Vimball.vim, and Vimball.txt " (see |copyright|) except use "Vimball" instead of "Vim". " No warranty, express or implied. @@ -14,7 +14,7 @@ if &cp || exists("g:loaded_vimball") finish endif -let g:loaded_vimball = "v31" +let g:loaded_vimball = "v35" if v:version < 702 echohl WarningMsg echo "***warning*** this version of vimball needs vim 7.2" @@ -67,10 +67,10 @@ endif " vimball#MkVimball: creates a vimball given a list of paths to files {{{2 " Input: " line1,line2: a range of lines containing paths to files to be included in the vimball -" writelevel : if true, force a write to filename.vba, even if it exists +" writelevel : if true, force a write to filename.vmb, even if it exists " (usually accomplished with :MkVimball! ... -" filename : base name of file to be created (ie. filename.vba) -" Output: a filename.vba using vimball format: +" filename : base name of file to be created (ie. filename.vmb) +" Output: a filename.vmb using vimball format: " path " filesize " [file] @@ -80,12 +80,12 @@ endif fun! vimball#MkVimball(line1,line2,writelevel,...) range " call Dfunc("MkVimball(line1=".a:line1." line2=".a:line2." writelevel=".a:writelevel." vimballname<".a:1.">) a:0=".a:0) if a:1 =~ '\.vim$' || a:1 =~ '\.txt$' - let vbname= substitute(a:1,'\.\a\{3}$','.vba','') + let vbname= substitute(a:1,'\.\a\{3}$','.vmb','') else let vbname= a:1 endif - if vbname !~ '\.vba$' - let vbname= vbname.'.vba' + if vbname !~ '\.vmb$' + let vbname= vbname.'.vmb' endif " call Decho("vbname<".vbname.">") if !a:writelevel && a:1 =~ '[\/]' @@ -134,7 +134,7 @@ fun! vimball#MkVimball(line1,line2,writelevel,...) range " create/switch to mkvimball tab if !exists("vbtabnr") tabnew - silent! file Vimball + sil! file Vimball let vbtabnr= tabpagenr() else exe "tabn ".vbtabnr @@ -195,8 +195,8 @@ fun! vimball#Vimball(really,...) " call Dfunc("vimball#Vimball(really=".a:really.") a:0=".a:0) if v:version < 701 || (v:version == 701 && !exists('*fnameescape')) - echoerr "your vim is missing the fnameescape() function" -" call Dret("vimball#Vimball : needs 7.1 with patch 299") + echoerr "your vim is missing the fnameescape() function (pls upgrade to vim 7.2 or later)" +" call Dret("vimball#Vimball : needs 7.1 with patch 299 or later") return endif @@ -214,13 +214,22 @@ fun! vimball#Vimball(really,...) " set up vimball tab " call Decho("setting up vimball tab") tabnew - silent! file Vimball + sil! file Vimball let vbtabnr= tabpagenr() let didhelp= "" " go to vim plugin home if a:0 > 0 + " let user specify the directory where the vimball is to be unpacked. + " If, however, the user did not specify a full path, set the home to be below the current directory let home= expand(a:1) + if has("win32") || has("win95") || has("win64") || has("win16") + if home !~ '^\a:[/\\]' + let home= getcwd().'/'.a:1 + endif + elseif home !~ '^/' + let home= getcwd().'/'.a:1 + endif else let home= vimball#VimballHome() endif @@ -254,11 +263,10 @@ fun! vimball#Vimball(really,...) while 1 < linenr && linenr < line("$") let fname = substitute(getline(linenr),'\t\[\[\[1$','','') let fname = substitute(fname,'\\','/','g') -" let fsize = getline(linenr+1)+0 let fsize = substitute(getline(linenr+1),'^\(\d\+\).\{-}$','\1','')+0 - let fenc = substitute(getline(linenr+1),'^\d\+\s*\(\S\+\)$','\1','') + let fenc = substitute(getline(linenr+1),'^\d\+\s*\(\S\{-}\)$','\1','') let filecnt = filecnt + 1 -" call Decho("fname<".fname."> fsize=".fsize." filecnt=".filecnt) +" call Decho("fname<".fname."> fsize=".fsize." filecnt=".filecnt. " fenc=".fenc) if a:really echomsg "extracted <".fname.">: ".fsize." lines" @@ -283,11 +291,14 @@ fun! vimball#Vimball(really,...) " call Decho("making directories if they don't exist yet (fname<".fname.">)") let fnamebuf= substitute(fname,'\\','/','g') let dirpath = substitute(home,'\\','/','g') +" call Decho("init: fnamebuf<".fnamebuf.">") +" call Decho("init: dirpath <".dirpath.">") while fnamebuf =~ '/' let dirname = dirpath."/".substitute(fnamebuf,'/.*$','','') let dirpath = dirname let fnamebuf = substitute(fnamebuf,'^.\{-}/\(.*\)$','\1','') " call Decho("dirname<".dirname.">") +" call Decho("dirpath<".dirpath.">") if !isdirectory(dirname) " call Decho("making <".dirname.">") if exists("g:vimball_mkdir") @@ -306,20 +317,22 @@ fun! vimball#Vimball(really,...) let linenr = linenr + 2 let lastline = linenr + fsize - 1 " call Decho("exe ".linenr.",".lastline."yank a") - exe "silent ".linenr.",".lastline."yank a" + " no point in handling a zero-length file + if lastline >= linenr + exe "silent ".linenr.",".lastline."yank a" - " copy "a" buffer into tab + " copy "a" buffer into tab " call Decho('copy "a buffer into tab#'.vbtabnr) - exe "tabn ".vbtabnr - setlocal ma - silent! %d - silent put a - 1 - silent d - - " write tab to file - if a:really - let fnamepath= home."/".fname + exe "tabn ".vbtabnr + setlocal ma + sil! %d + silent put a + 1 + sil! d + + " write tab to file + if a:really + let fnamepath= home."/".fname " call Decho("exe w! ".fnameescape(fnamepath)) if fenc != "" exe "silent w! ++enc=".fnameescape(fenc)." ".fnameescape(fnamepath) @@ -328,17 +341,18 @@ fun! vimball#Vimball(really,...) endif echo "wrote ".fnameescape(fnamepath) call s:RecordInVar(home,"call delete('".fnamepath."')") - endif + endif - " return to tab with vimball + " return to tab with vimball " call Decho("exe tabn ".curtabnr) - exe "tabn ".curtabnr + exe "tabn ".curtabnr - " set up help if its a doc/*.txt file + " set up help if its a doc/*.txt file " call Decho("didhelp<".didhelp."> fname<".fname.">") - if a:really && didhelp == "" && fname =~ 'doc/[^/]\+\.\(txt\|..x\)$' - let didhelp= substitute(fname,'^\(.*\") + endif endif " update for next file @@ -400,7 +414,9 @@ fun! vimball#RmVimball(...) let curfile= a:1 " call Decho("case a:0=".a:0.": curfile<".curfile.">") endif - if curfile =~ '\.vba$' + if curfile =~ '\.vmb$' + let curfile= substitute(curfile,'\.vmb','','') + elseif curfile =~ '\.vba$' let curfile= substitute(curfile,'\.vba','','') endif if a:0 >= 2 @@ -418,13 +434,17 @@ fun! vimball#RmVimball(...) " call Decho(".VimballRecord is readable") " call Decho("curfile<".curfile.">") keepalt keepjumps 1split - silent! keepalt keepjumps e .VimballRecord + sil! keepalt keepjumps e .VimballRecord let keepsrch= @/ " call Decho('search for ^\M'.curfile.'.\m: ') -" call Decho('search for ^\M'.curfile.'.\mvba: ') -" call Decho('search for ^\M'.curfile.'\m[-0-9.]*\.vba: ') +" call Decho('search for ^\M'.curfile.'.\m{vba|vmb}: ') +" call Decho('search for ^\M'.curfile.'\m[-0-9.]*\.{vba|vmb}: ') if search('^\M'.curfile."\m: ".'cw') let foundit= 1 + elseif search('^\M'.curfile.".\mvmb: ",'cw') + let foundit= 2 + elseif search('^\M'.curfile.'\m[-0-9.]*\.vmb: ','cw') + let foundit= 2 elseif search('^\M'.curfile.".\mvba: ",'cw') let foundit= 1 elseif search('^\M'.curfile.'\m[-0-9.]*\.vba: ','cw') @@ -433,25 +453,29 @@ fun! vimball#RmVimball(...) let foundit = 0 endif if foundit - let exestring = substitute(getline("."),'^\M'.curfile.'\m\S\{-}\.vba: ','','') + if foundit == 1 + let exestring = substitute(getline("."),'^\M'.curfile.'\m\S\{-}\.vba: ','','') + else + let exestring = substitute(getline("."),'^\M'.curfile.'\m\S\{-}\.vmb: ','','') + endif let s:VBRstring= substitute(exestring,'call delete(','','g') let s:VBRstring= substitute(s:VBRstring,"[')]",'','g') " call Decho("exe ".exestring) - silent! keepalt keepjumps exe exestring - silent! keepalt keepjumps d + sil! keepalt keepjumps exe exestring + sil! keepalt keepjumps d let exestring= strlen(substitute(exestring,'call delete(.\{-})|\=',"D","g")) " call Decho("exestring<".exestring.">") echomsg "removed ".exestring." files" else let s:VBRstring= '' - let curfile = substitute(curfile,'\.vba','','') + let curfile = substitute(curfile,'\.vmb','','') " call Decho("unable to find <".curfile."> in .VimballRecord") if !exists("s:ok_unablefind") call vimball#ShowMesg(s:WARNING,"(RmVimball) unable to find <".curfile."> in .VimballRecord") endif endif - silent! keepalt keepjumps g/^\s*$/d - silent! keepalt keepjumps wq! + sil! keepalt keepjumps g/^\s*$/d + sil! keepalt keepjumps wq! let @/= keepsrch endif call s:ChgDir(curdir) @@ -557,9 +581,19 @@ endfun fun! s:ChgDir(newdir) " call Dfunc("ChgDir(newdir<".a:newdir.">)") if (has("win32") || has("win95") || has("win64") || has("win16")) - exe 'silent cd '.fnameescape(substitute(a:newdir,'/','\\','g')) + try + exe 'silent cd '.fnameescape(substitute(a:newdir,'/','\\','g')) + catch /^Vim\%((\a\+)\)\=:E/ + call mkdir(fnameescape(substitute(a:newdir,'/','\\','g'))) + exe 'silent cd '.fnameescape(substitute(a:newdir,'/','\\','g')) + endtry else - exe 'silent cd '.fnameescape(a:newdir) + try + exe 'silent cd '.fnameescape(a:newdir) + catch /^Vim\%((\a\+)\)\=:E/ + call mkdir(fnameescape(a:newdir)) + exe 'silent cd '.fnameescape(a:newdir) + endtry endif " call Dret("ChgDir : curdir<".getcwd().">") endfun @@ -599,7 +633,7 @@ fun! s:RecordInFile(home) let cmd= expand("%:tr").": " " call Decho("cmd<".cmd.">") - silent! keepalt keepjumps e .VimballRecord + sil! keepalt keepjumps e .VimballRecord setlocal ma $ if exists("s:recordfile") && exists("s:recorddir") @@ -616,8 +650,8 @@ fun! s:RecordInFile(home) " put command into buffer, write .VimballRecord `file keepalt keepjumps put=cmd - silent! keepalt keepjumps g/^\s*$/d - silent! keepalt keepjumps wq! + sil! keepalt keepjumps g/^\s*$/d + sil! keepalt keepjumps wq! call s:ChgDir(curdir) if exists("s:recorddir") @@ -693,10 +727,11 @@ fun! vimball#SaveSettings() let s:repkeep = &report let s:vekeep = &ve let s:ffkeep = &l:ff + let s:swfkeep = &l:swf if exists("&acd") - setlocal ei=all ve=all noacd nofen noic report=999 nohid bt= ma lz pm= ff=unix + setlocal ei=all ve=all noacd nofen noic report=999 nohid bt= ma lz pm= ff=unix noswf else - setlocal ei=all ve=all nofen noic report=999 nohid bt= ma lz pm= ff=unix + setlocal ei=all ve=all nofen noic report=999 nohid bt= ma lz pm= ff=unix noswf endif " vimballs should be in unix format setlocal ff=unix @@ -732,6 +767,9 @@ fun! vimball#RestoreSettings() " call Dret("RestoreSettings") endfun +let &cpo = s:keepcpo +unlet s:keepcpo + " --------------------------------------------------------------------- " Modelines: {{{1 " vim: fdm=marker diff --git a/runtime/autoload/xmlcomplete.vim b/runtime/autoload/xmlcomplete.vim index 37f9bb4..4c1ac4f 100644 --- a/runtime/autoload/xmlcomplete.vim +++ b/runtime/autoload/xmlcomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: XML " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) -" Last Change: 2006 Aug 15 +" Last Change: 2013 Jun 29 " Version: 1.9 " " Changelog: @@ -475,12 +475,12 @@ function! s:InCommentAt(line, col) endfunction function! s:SetKeywords() - let g:IsKeywordBak=&iskeyword - let &iskeyword='33-255' + let s:IsKeywordBak=&l:iskeyword + let &l:iskeyword='33-255' endfunction function! s:RestoreKeywords() - let &iskeyword=g:IsKeywordBak + let &l:iskeyword=s:IsKeywordBak endfunction function! s:Push(el, sname) diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim index a55f1dc..687500e 100644 --- a/runtime/autoload/zip.vim +++ b/runtime/autoload/zip.vim @@ -1,10 +1,10 @@ " zip.vim: Handles browsing zipfiles " AUTOLOAD PORTION -" Date: Apr 12, 2010 -" Version: 23 -" Maintainer: Charles E Campbell, Jr +" Date: Jul 02, 2013 +" Version: 27 +" Maintainer: Charles E Campbell " License: Vim License (see vim's :help license) -" Copyright: Copyright (C) 2005-2008 Charles E. Campbell, Jr. {{{1 +" Copyright: Copyright (C) 2005-2013 Charles E. Campbell {{{1 " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright " notice is copied with it. Like anything else that's free, @@ -13,13 +13,14 @@ " this plugin, you agree that in no event will the copyright " holder be liable for any damages resulting from the use " of this software. +"redraw!|call DechoSep()|call inputsave()|call input("Press to continue")|call inputrestore() " --------------------------------------------------------------------- " Load Once: {{{1 if &cp || exists("g:loaded_zip") finish endif -let g:loaded_zip= "v23" +let g:loaded_zip= "v27" if v:version < 702 echohl WarningMsg echo "***warning*** this version of zip needs vim 7.2" @@ -28,6 +29,7 @@ if v:version < 702 endif let s:keepcpo= &cpo set cpo&vim +"DechoTabOn let s:zipfile_escape = ' ?&;\' let s:ERROR = 2 @@ -60,6 +62,16 @@ endif " zip#Browse: {{{2 fun! zip#Browse(zipfile) " call Dfunc("zip#Browse(zipfile<".a:zipfile.">)") + " sanity check: insure that the zipfile has "PK" as its first two letters + " (zipped files have a leading PK as a "magic cookie") + if !filereadable(a:zipfile) || readfile(a:zipfile, "", 1)[0] !~ '^PK' + exe "noautocmd e ".fnameescape(a:zipfile) +" call Dret("zip#Browse : not a zipfile<".a:zipfile.">") + return +" else " Decho +" call Decho("zip#Browse: a:zipfile<".a:zipfile."> passed PK test - its a zip file") + endif + let repkeep= &report set report=10 @@ -103,38 +115,26 @@ fun! zip#Browse(zipfile) set ft=tar " give header - let lastline= line("$") - call setline(lastline+1,'" zip.vim version '.g:loaded_zip) - call setline(lastline+2,'" Browsing zipfile '.a:zipfile) - call setline(lastline+3,'" Select a file with cursor and press ENTER') - $put ='' - 0d - $ + call append(0, ['" zip.vim version '.g:loaded_zip, + \ '" Browsing zipfile '.a:zipfile, + \ '" Select a file with cursor and press ENTER']) + keepj $ " call Decho("exe silent r! ".g:zip_unzipcmd." -l -- ".s:Escape(a:zipfile,1)) - exe "silent r! ".g:zip_unzipcmd." -l -- ".s:Escape(a:zipfile,1) + exe "keepj sil! r! ".g:zip_unzipcmd." -Z -1 -- ".s:Escape(a:zipfile,1) if v:shell_error != 0 redraw! echohl WarningMsg | echo "***warning*** (zip#Browse) ".fnameescape(a:zipfile)." is not a zip file" | echohl None " call inputsave()|call input("Press to continue")|call inputrestore() - silent %d + keepj sil! %d let eikeep= &ei set ei=BufReadCmd,FileReadCmd - exe "r ".fnameescape(a:zipfile) + exe "keepj r ".fnameescape(a:zipfile) let &ei= eikeep - 1d + keepj 1d " call Dret("zip#Browse") return endif -" call Decho("line 6: ".getline(6)) - let namecol= stridx(getline(6),'Name') + 1 -" call Decho("namecol=".namecol) - 4,$g/^\s*----/d - 4,$g/^\s*\a/d - $d - if namecol > 0 - exe 'silent 4,$s/^.*\%'.namecol.'c//' - endif setlocal noma nomod ro noremap :call ZipBrowseSelect() @@ -200,16 +200,28 @@ fun! zip#Read(fname,mode) else let zipfile = substitute(a:fname,'^.\{-}zipfile:\(.\{-}\)::[^\\].*$','\1','') let fname = substitute(a:fname,'^.\{-}zipfile:.\{-}::\([^\\].*\)$','\1','') - let fname = substitute(fname, '[', '[[]', 'g') + let fname = substitute(fname, '[', '[[]', 'g') endif " call Decho("zipfile<".zipfile.">") " call Decho("fname <".fname.">") -" call Decho("exe r! ".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fname,1)) - exe "silent r! ".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fname,1) + " the following code does much the same thing as + " exe "keepj sil! r! ".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1) + " but allows zipfile:... entries in quickfix lists + let temp = tempname() +" call Decho("using temp file<".temp.">") + let fn = expand('%:p') + exe "sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1).' > '.temp +" call Decho("exe sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1).' > '.temp) + sil exe 'keepalt file '.temp + sil keepj e! + sil exe 'keepalt file '.fnameescape(fn) + call delete(temp) + + filetype detect " cleanup - 0d + " keepj 0d " used to be needed for the ...r! ... method set nomod let &report= repkeep @@ -278,7 +290,7 @@ fun! zip#Write(fname) if fname =~ '/' let dirpath = substitute(fname,'/[^/]\+$','','e') - if executable("cygpath") + if has("win32unix") && executable("cygpath") let dirpath = substitute(system("cygpath ".s:Escape(dirpath,0)),'\n','','e') endif " call Decho("mkdir(dirpath<".dirpath.">,p)") @@ -290,7 +302,7 @@ fun! zip#Write(fname) " call Decho("zipfile<".zipfile."> fname<".fname.">") exe "w! ".fnameescape(fname) - if executable("cygpath") + if has("win32unix") && executable("cygpath") let zipfile = substitute(system("cygpath ".s:Escape(zipfile,0)),'\n','','e') endif diff --git a/runtime/colors/koehler.vim b/runtime/colors/koehler.vim index 6aaa244..a36f9f6 100644 --- a/runtime/colors/koehler.vim +++ b/runtime/colors/koehler.vim @@ -2,7 +2,7 @@ " vim: tw=0 ts=4 sw=4 " Vim color file " Maintainer: Ron Aaron -" Last Change: 2006 Dec 10 +" Last Change: 2013 May 23 hi clear set background=dark @@ -43,6 +43,8 @@ hi MatchParen term=reverse ctermfg=blue guibg=Blue hi TabLine term=bold,reverse cterm=bold ctermfg=lightblue ctermbg=white gui=bold guifg=blue guibg=white hi TabLineFill term=bold,reverse cterm=bold ctermfg=lightblue ctermbg=white gui=bold guifg=blue guibg=white hi TabLineSel term=reverse ctermfg=white ctermbg=lightblue guifg=white guibg=blue +hi Underlined term=underline cterm=bold,underline ctermfg=lightblue guifg=lightblue gui=bold,underline +hi Ignore ctermfg=black ctermbg=black guifg=black guibg=black hi link IncSearch Visual hi link String Constant hi link Character Constant diff --git a/runtime/colors/ron.vim b/runtime/colors/ron.vim index 45d6445..1e9caa3 100644 --- a/runtime/colors/ron.vim +++ b/runtime/colors/ron.vim @@ -2,7 +2,7 @@ " vim: tw=0 ts=4 sw=4 " Vim color file " Maintainer: Ron Aaron -" Last Change: 2003 May 02 +" Last Change: 2013 May 24 set background=dark hi clear @@ -11,7 +11,7 @@ if exists("syntax_on") endif let g:colors_name = "ron" hi Normal guifg=cyan guibg=black -hi NonText guifg=brown +hi NonText guifg=yellow guibg=#303030 hi comment guifg=green hi constant guifg=cyan gui=bold hi identifier guifg=cyan gui=NONE @@ -24,10 +24,11 @@ hi WarningMsg guifg=Black guibg=Green hi Error guibg=Red hi Todo guifg=Black guibg=orange hi Cursor guibg=#60a060 guifg=#00ff00 -hi Search guibg=lightslateblue +hi Search guibg=darkgray guifg=black gui=bold hi IncSearch gui=NONE guibg=steelblue hi LineNr guifg=darkgrey hi title guifg=darkgrey +hi ShowMarksHL ctermfg=cyan ctermbg=lightblue cterm=bold guifg=yellow guibg=black gui=bold hi StatusLineNC gui=NONE guifg=lightblue guibg=darkblue hi StatusLine gui=bold guifg=cyan guibg=blue hi label guifg=gold2 @@ -41,3 +42,4 @@ hi DiffDelete guibg=coral hi Folded guibg=gray30 hi FoldColumn guibg=gray30 guifg=white hi cIf0 guifg=gray +hi diffOnly guifg=red gui=bold diff --git a/runtime/compiler/checkstyle.vim b/runtime/compiler/checkstyle.vim index 74ab3e4..eac461b 100644 --- a/runtime/compiler/checkstyle.vim +++ b/runtime/compiler/checkstyle.vim @@ -1,8 +1,7 @@ " Vim compiler file " Compiler: Checkstyle -" Maintainer: Doug Kearns -" URL: http://gus.gscit.monash.edu.au/~djkea2/vim/compiler/checkstyle.vim -" Last Change: 2004 Nov 27 +" Maintainer: Doug Kearns +" Last Change: 2013 Jun 26 if exists("current_compiler") finish @@ -17,4 +16,4 @@ CompilerSet makeprg=java\ com.puppycrawl.tools.checkstyle.Main\ -f\ plain " sample error: WebTable.java:282: '+=' is not preceeded with whitespace. " WebTable.java:201:1: '{' should be on the previous line. -CompilerSet errorformat=%f:%l:\ %m,%f:%l:%v:\ %m,%-G%.%# +CompilerSet errorformat=%f:%l:%v:\ %m,%f:%l:\ %m,%-G%.%# diff --git a/runtime/compiler/cs.vim b/runtime/compiler/cs.vim index 5b75d6d..4cc1784 100644 --- a/runtime/compiler/cs.vim +++ b/runtime/compiler/cs.vim @@ -1,19 +1,26 @@ " Vim compiler file -" Compiler: ms C# -" Maintainer: Joseph H. Yao (hyao@sina.com) -" Last Change: 2004 Mar 27 +" Compiler: Microsoft Visual Studio C# +" Maintainer: Zhou YiChao (broken.zhou@gmail.com) +" Previous Maintainer: Joseph H. Yao (hyao@sina.com) +" Last Change: 2012 Apr 30 if exists("current_compiler") finish endif let current_compiler = "cs" +let s:keepcpo= &cpo +set cpo&vim if exists(":CompilerSet") != 2 " older Vim always used :setlocal command -nargs=* CompilerSet setlocal endif -" default errorformat CompilerSet errorformat& +CompilerSet errorformat+=%f(%l\\,%v):\ %t%*[^:]:\ %m, + \%trror%*[^:]:\ %m, + \%tarning%*[^:]:\ %m -" default make CompilerSet makeprg=csc\ % + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/compiler/decada.vim b/runtime/compiler/decada.vim index 8e267ec..0bf5487 100644 --- a/runtime/compiler/decada.vim +++ b/runtime/compiler/decada.vim @@ -15,11 +15,11 @@ " Help Page: compiler-decada "------------------------------------------------------------------------------ -if (exists("current_compiler") && - \ current_compiler == "decada") || - \ version < 700 +if (exists("current_compiler") && current_compiler == "decada") || version < 700 finish endif +let s:keepcpo= &cpo +set cpo&vim let current_compiler = "decada" @@ -44,6 +44,9 @@ endif execute "CompilerSet makeprg=" . escape (g:decada.Make_Command, ' ') execute "CompilerSet errorformat=" . escape (g:decada.Error_Format, ' ') +let &cpo = s:keepcpo +unlet s:keepcpo + finish " 1}}} "------------------------------------------------------------------------------ diff --git a/runtime/compiler/erlang.vim b/runtime/compiler/erlang.vim new file mode 100644 index 0000000..e177a27 --- /dev/null +++ b/runtime/compiler/erlang.vim @@ -0,0 +1,13 @@ +" Vim compiler file +" Compiler: Erlang +" Maintainer: Dmitry Vasiliev +" Last Change: 2012-02-13 + +if exists("current_compiler") + finish +endif +let current_compiler = "erlang" + +CompilerSet makeprg=erlc\ -Wall\ % + +CompilerSet errorformat=%f:%l:\ %m diff --git a/runtime/compiler/eruby.vim b/runtime/compiler/eruby.vim index 614fc17..45ad5ee 100644 --- a/runtime/compiler/eruby.vim +++ b/runtime/compiler/eruby.vim @@ -1,9 +1,7 @@ " Vim compiler file " Language: eRuby " Maintainer: Doug Kearns -" Last Change: 2008 Aug 1 -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site +" URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns if exists("current_compiler") diff --git a/runtime/compiler/g95.vim b/runtime/compiler/g95.vim new file mode 100644 index 0000000..ecb3212 --- /dev/null +++ b/runtime/compiler/g95.vim @@ -0,0 +1,28 @@ +" Compiler: G95 +" Maintainer: H Xu +" Version: 0.1.3 +" Last Change: 2012 Apr 30 +" Homepage: http://www.vim.org/scripts/script.php?script_id=3492 +" https://bitbucket.org/xuhdev/compiler-g95.vim +" License: Same as Vim + +if exists('current_compiler') + finish +endif +let current_compiler = 'g95' +let s:keepcpo= &cpo +set cpo&vim + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal +endif + +CompilerSet errorformat= + \%AIn\ file\ %f:%l, + \%-C%p1, + \%-Z%trror:\ %m, + \%-Z%tarning\ (%n):\ %m, + \%-C%.%# + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/compiler/gcc.vim b/runtime/compiler/gcc.vim index 776bdee..987a3a6 100644 --- a/runtime/compiler/gcc.vim +++ b/runtime/compiler/gcc.vim @@ -1,7 +1,7 @@ " Vim compiler file " Compiler: GNU C Compiler " Maintainer: Nikolai Weibull -" Latest Revision: 2010-05-30 +" Latest Revision: 2010-10-14 if exists("current_compiler") finish @@ -9,7 +9,7 @@ endif let current_compiler = "gcc" let s:cpo_save = &cpo -set cpo-=C +set cpo&vim CompilerSet errorformat= \%*[^\"]\"%f\"%*\\D%l:%c:\ %m, @@ -18,10 +18,10 @@ CompilerSet errorformat= \\"%f\"%*\\D%l:\ %m, \%-G%f:%l:\ %trror:\ (Each\ undeclared\ identifier\ is\ reported\ only\ once, \%-G%f:%l:\ %trror:\ for\ each\ function\ it\ appears\ in.), - \%f:%l:%c:\ %terror:\ %m, + \%f:%l:%c:\ %trror:\ %m, \%f:%l:%c:\ %tarning:\ %m, \%f:%l:%c:\ %m, - \%f:%l:\ %terror:\ %m, + \%f:%l:\ %trror:\ %m, \%f:%l:\ %tarning:\ %m, \%f:%l:\ %m, \\"%f\"\\,\ line\ %l%*\\D%c%*[^\ ]\ %m, diff --git a/runtime/compiler/gfortran.vim b/runtime/compiler/gfortran.vim new file mode 100644 index 0000000..1e4e5cf --- /dev/null +++ b/runtime/compiler/gfortran.vim @@ -0,0 +1,27 @@ +" Compiler: GNU Fortran Compiler +" Maintainer: H Xu +" Version: 0.1.3 +" Last Change: 2012 Apr 30 +" Homepage: http://www.vim.org/scripts/script.php?script_id=3496 +" https://bitbucket.org/xuhdev/compiler-gfortran.vim +" License: Same as Vim + +if exists('current_compiler') + finish +endif +let current_compiler = 'gfortran' +let s:keepcpo= &cpo +set cpo&vim + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal +endif + +CompilerSet errorformat= + \%A%f:%l.%c:, + \%-Z%trror:\ %m, + \%-Z%tarning:\ %m, + \%-C%.%# + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/compiler/gnat.vim b/runtime/compiler/gnat.vim index d7ec55b..3ad1eb4 100644 --- a/runtime/compiler/gnat.vim +++ b/runtime/compiler/gnat.vim @@ -17,11 +17,11 @@ " Help Page: compiler-gnat "------------------------------------------------------------------------------ -if (exists("current_compiler") && - \ current_compiler == "gnat") || - \ version < 700 +if (exists("current_compiler")&& current_compiler == "gnat") || version < 700 finish endif +let s:keepcpo= &cpo +set cpo&vim let current_compiler = "gnat" @@ -62,6 +62,9 @@ endif execute "CompilerSet makeprg=" . escape (g:gnat.Get_Command('Make'), ' ') execute "CompilerSet errorformat=" . escape (g:gnat.Error_Format, ' ') +let &cpo = s:keepcpo +unlet s:keepcpo + finish " 1}}} "------------------------------------------------------------------------------ diff --git a/runtime/compiler/haml.vim b/runtime/compiler/haml.vim new file mode 100644 index 0000000..b06a672 --- /dev/null +++ b/runtime/compiler/haml.vim @@ -0,0 +1,28 @@ +" Vim compiler file +" Compiler: Haml +" Maintainer: Tim Pope +" Last Change: 2013 May 30 + +if exists("current_compiler") + finish +endif +let current_compiler = "haml" + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal +endif + +let s:cpo_save = &cpo +set cpo-=C + +CompilerSet makeprg=haml\ -c + +CompilerSet errorformat= + \Haml\ %trror\ on\ line\ %l:\ %m, + \Syntax\ %trror\ on\ line\ %l:\ %m, + \%-G%.%# + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim:set sw=2 sts=2: diff --git a/runtime/compiler/hp_acc.vim b/runtime/compiler/hp_acc.vim index 685bd5b..15d5ce5 100644 --- a/runtime/compiler/hp_acc.vim +++ b/runtime/compiler/hp_acc.vim @@ -2,7 +2,7 @@ " Compiler: HP aCC " Maintainer: Matthias Ulrich " URL: http://www.subhome.de/vim/hp_acc.vim -" Last Change: 2005 Nov 19 +" Last Change: 2012 Apr 30 " " aCC --version says: "HP ANSI C++ B3910B A.03.13" " This compiler has been tested on: @@ -19,6 +19,8 @@ if exists("current_compiler") finish endif let current_compiler = "hp_acc" +let s:keepcpo= &cpo +set cpo&vim if exists(":CompilerSet") != 2 " older Vim always used :setlocal command -nargs=* CompilerSet setlocal @@ -30,4 +32,7 @@ CompilerSet errorformat=%A%trror\ %n\:\ \"%f\"\\,\ line\ %l\ \#\ %m, \%Z\ \ \ \ %p^%.%#, \%-C%.%# +let &cpo = s:keepcpo +unlet s:keepcpo + " vim:ts=8:sw=4:cindent diff --git a/runtime/compiler/ifort.vim b/runtime/compiler/ifort.vim new file mode 100644 index 0000000..3a60d0c --- /dev/null +++ b/runtime/compiler/ifort.vim @@ -0,0 +1,27 @@ +" Compiler: Intel Fortran Compiler +" Maintainer: H Xu +" Version: 0.1.1 +" Last Change: 2012 Apr 30 +" Homepage: http://www.vim.org/scripts/script.php?script_id=3497 +" https://bitbucket.org/xuhdev/compiler-ifort.vim +" License: Same as Vim + +if exists('current_compiler') + finish +endif +let current_compiler = 'ifort' +let s:keepcpo= &cpo +set cpo&vim + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal +endif + +CompilerSet errorformat= + \%A%f(%l):\ %trror\ \#%n:\ %m, + \%A%f(%l):\ %tarning\ \#%n:\ %m, + \%-Z%p^, + \%-G%.%# + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/compiler/intel.vim b/runtime/compiler/intel.vim index 9183826..254d13b 100644 --- a/runtime/compiler/intel.vim +++ b/runtime/compiler/intel.vim @@ -1,12 +1,14 @@ " Vim compiler file " Compiler: Intel C++ 7.1 " Maintainer: David Harrison -" Last Change: 2004 May 16 +" Last Change: 2012 Apr 30 if exists("current_compiler") finish endif let current_compiler = "intel" +let s:keepcpo= &cpo +set cpo&vim if exists(":CompilerSet") != 2 " older Vim always used :setlocal command -nargs=* CompilerSet setlocal @@ -19,3 +21,6 @@ CompilerSet errorformat=%E%f(%l):\ error:\ %m, \%-Z\ \ %p^, \%-G\\s%#, \%-G%.%# + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/compiler/irix5_c.vim b/runtime/compiler/irix5_c.vim index 87bb9e1..f440e74 100644 --- a/runtime/compiler/irix5_c.vim +++ b/runtime/compiler/irix5_c.vim @@ -1,12 +1,14 @@ " Vim compiler file " Compiler: SGI IRIX 5.3 cc " Maintainer: David Harrison -" Last Change: 2004 Mar 27 +" Last Change: 2012 Apr 30 if exists("current_compiler") finish endif let current_compiler = "irix5_c" +let s:keepcpo= &cpo +set cpo&vim if exists(":CompilerSet") != 2 " older Vim always used :setlocal command -nargs=* CompilerSet setlocal @@ -19,3 +21,6 @@ CompilerSet errorformat=\%Ecfe:\ Error:\ %f\\,\ line\ %l:\ %m, \%-Z\ %p^, \-G\\s%#, \%-G%.%# + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/compiler/irix5_cpp.vim b/runtime/compiler/irix5_cpp.vim index f505768..0112dc1 100644 --- a/runtime/compiler/irix5_cpp.vim +++ b/runtime/compiler/irix5_cpp.vim @@ -1,12 +1,14 @@ " Vim compiler file " Compiler: SGI IRIX 5.3 CC or NCC " Maintainer: David Harrison -" Last Change: 2004 Mar 27 +" Last Change: 2012 Apr 30 if exists("current_compiler") finish endif let current_compiler = "irix5_cpp" +let s:keepcpo= &cpo +set cpo&vim if exists(":CompilerSet") != 2 " older Vim always used :setlocal command -nargs=* CompilerSet setlocal @@ -19,3 +21,6 @@ CompilerSet errorformat=%E\"%f\"\\,\ line\ %l:\ error(%n):\ , \%-Z\ \ %p%^, \%+C\ %\\{10}%.%#, \%-G%.%# + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/compiler/javac.vim b/runtime/compiler/javac.vim index 234e28b..a50bdca 100644 --- a/runtime/compiler/javac.vim +++ b/runtime/compiler/javac.vim @@ -1,8 +1,7 @@ " Vim compiler file -" Compiler: javac -" Maintainer: Doug Kearns -" URL: http://gus.gscit.monash.edu.au/~djkea2/vim/compiler/javac.vim -" Last Change: 2004 Nov 27 +" Compiler: javac +" Maintainer: Doug Kearns +" Last Change: 2004 Nov 27 if exists("current_compiler") finish diff --git a/runtime/compiler/mcs.vim b/runtime/compiler/mcs.vim index d85da7d..c606586 100644 --- a/runtime/compiler/mcs.vim +++ b/runtime/compiler/mcs.vim @@ -1,7 +1,8 @@ " Vim compiler file " Compiler: Mono C# Compiler " Maintainer: Jarek Sobiecki -" Latest Revision: 2006-06-18 +" Last Updated By: Peter Collingbourne +" Latest Revision: 2012 Jul 19 if exists("current_compiler") finish @@ -12,13 +13,18 @@ let s:cpo_save = &cpo set cpo-=C setlocal errorformat= + \%D%.%#Project\ \"%f/%[%^/\"]%#\"%.%#, + \%X%.%#Done\ building\ project\ \"%f/%[%^/\"]%#\"%.%#, + \%-G%\\s%.%#, + \%E%f(%l):\ error\ CS%n:%m, + \%W%f(%l):\ warning\ CS%n:%m, \%E%f(%l\\,%c):\ error\ CS%n:%m, \%W%f(%l\\,%c):\ warning\ CS%n:%m, \%E%>syntax\ error\\,%m,%Z%f(%l\\,%c):\ error\ CS%n:%m, \%D%*\\a[%*\\d]:\ Entering\ directory\ `%f', \%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f', \%DMaking\ %*\\a\ in\ %f, - \%G-%.%# + \%-G%.%# let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/compiler/mips_c.vim b/runtime/compiler/mips_c.vim index b57eac0..a0ebfe7 100644 --- a/runtime/compiler/mips_c.vim +++ b/runtime/compiler/mips_c.vim @@ -1,12 +1,14 @@ " Vim compiler file " Compiler: SGI IRIX 6.5 MIPS C (cc) " Maintainer: David Harrison -" Last Change: 2004 Mar 27 +" Last Change: 2012 Apr 30 if exists("current_compiler") finish endif let current_compiler = "mips_c" +let s:keepcpo= &cpo +set cpo&vim if exists(":CompilerSet") != 2 " older Vim always used :setlocal command -nargs=* CompilerSet setlocal @@ -19,3 +21,6 @@ CompilerSet errorformat=%Ecc\-%n\ %.%#:\ ERROR\ File\ =\ %f\%\\,\ Line\ =\ %l, \%-Z\ \ %p^, \%-G\\s%#, \%-G%.%# + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/compiler/mipspro_c89.vim b/runtime/compiler/mipspro_c89.vim index 258a800..20eb70d 100644 --- a/runtime/compiler/mipspro_c89.vim +++ b/runtime/compiler/mipspro_c89.vim @@ -1,12 +1,14 @@ " Vim compiler file " Compiler: SGI IRIX 6.5 MIPSPro C (c89) " Maintainer: David Harrison -" Last Change: 2004 Mar 27 +" Last Change: 2012 Apr 30 if exists("current_compiler") finish endif let current_compiler = "mipspro_c89" +let s:keepcpo= &cpo +set cpo&vim if exists(":CompilerSet") != 2 " older Vim always used :setlocal command -nargs=* CompilerSet setlocal @@ -20,3 +22,6 @@ CompilerSet errorformat=%Ecc\-%n\ %.%#:\ ERROR\ File\ =\ %f\%\\,\ Line\ =\ %l, \%+C\ \ %m, \%-G\\s%#, \%-G%.%# + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/compiler/mipspro_cpp.vim b/runtime/compiler/mipspro_cpp.vim index 1f6074a..2f43af8 100644 --- a/runtime/compiler/mipspro_cpp.vim +++ b/runtime/compiler/mipspro_cpp.vim @@ -1,12 +1,14 @@ " Vim compiler file " Compiler: SGI IRIX 6.5 MIPSPro C++ (CC) " Maintainer: David Harrison -" Last Change: 2004 Mar 27 +" Last Change: 2012 Apr 30 if exists("current_compiler") finish endif let current_compiler = "mipspro_cpp" +let s:keepcpo= &cpo +set cpo&vim if exists(":CompilerSet") != 2 " older Vim always used :setlocal command -nargs=* CompilerSet setlocal @@ -19,3 +21,6 @@ CompilerSet errorformat=%Ecc\-%n\ %.%#:\ ERROR\ File\ =\ %f\%\\,\ Line\ =\ %l, \%-Z\ \ %p^, \%-G\\s%#, \%-G%.%# + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/compiler/msbuild.vim b/runtime/compiler/msbuild.vim new file mode 100644 index 0000000..3652ca0 --- /dev/null +++ b/runtime/compiler/msbuild.vim @@ -0,0 +1,21 @@ +" Vim compiler file +" Compiler: Microsoft Visual Studio C# +" Maintainer: Chiel ten Brinke (ctje92@gmail.com) +" Last Change: 2013 May 13 + +if exists("current_compiler") + finish +endif +let current_compiler = "msbuild" +let s:keepcpo= &cpo +set cpo&vim + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal +endif + +CompilerSet errorformat=\ %#%f(%l\\\,%c):\ %m +CompilerSet makeprg=msbuild\ /nologo\ /v:q\ /property:GenerateFullPaths=true + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/compiler/ocaml.vim b/runtime/compiler/ocaml.vim new file mode 100644 index 0000000..da15bce --- /dev/null +++ b/runtime/compiler/ocaml.vim @@ -0,0 +1,44 @@ +" Vim Compiler File +" Compiler: ocaml +" Maintainer: See ftplugin/ocaml.vim (?) +" Last Change: June 2013 by Marc Weber +" +" Marc Weber's comments: +" Setting makeprg doesn't make sense, because there is ocamlc, ocamlopt, +" ocamake and whatnot. So which one to use? +" +" This error format was moved from ftplugin/ocaml.vim to this file, +" because ftplugin is the wrong file to set an error format +" and the error format itself is annoying because it joins many lines in this +" error case: +" +" Error: The implementation foo.ml does not match the interface foo.cmi: +" Modules do not match case. +" +" So having it here makes people opt-in + + +if exists("current_compiler") + finish +endif +let current_compiler = "ocaml" + +let s:cpo_save = &cpo +set cpo&vim + +CompilerSet errorformat = + \%EFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%*\\d:, + \%EFile\ \"%f\"\\,\ line\ %l\\,\ character\ %c:%m, + \%+EReference\ to\ unbound\ regexp\ name\ %m, + \%Eocamlyacc:\ e\ -\ line\ %l\ of\ \"%f\"\\,\ %m, + \%Wocamlyacc:\ w\ -\ %m, + \%-Zmake%.%#, + \%C%m, + \%D%*\\a[%*\\d]:\ Entering\ directory\ `%f', + \%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f', + \%D%*\\a:\ Entering\ directory\ `%f', + \%X%*\\a:\ Leaving\ directory\ `%f', + \%DMaking\ %*\\a\ in\ %f + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/compiler/php.vim b/runtime/compiler/php.vim index 2f4f032..92f93b8 100644 --- a/runtime/compiler/php.vim +++ b/runtime/compiler/php.vim @@ -1,8 +1,7 @@ " Vim compiler file -" Compiler: PHP -" Maintainer: Doug Kearns -" URL: http://gus.gscit.monash.edu.au/~djkea2/vim/compiler/php.vim -" Last Change: 2004 Nov 27 +" Compiler: PHP CLI +" Maintainer: Doug Kearns +" Last Change: 2013 Jun 25 if exists("current_compiler") finish @@ -17,12 +16,11 @@ let s:cpo_save = &cpo set cpo-=C CompilerSet makeprg=php\ -lq - -CompilerSet errorformat=%EParse\ error:\ %m\ in\ %f\ on\ line\ %l, - \%WNotice:\ %m\ in\ %f\ on\ line\ %l, - \%EParse\ error:\ %m\ in\ %f\ on\ line\ %l, - \%WNotice:\ %m\ in\ %f\ on\ line\ %l, - \%-G%.%# +CompilerSet errorformat=%E%.%#Parse\ error:\ %m\ in\ %f\ on\ line\ %l, + \%W%.%#Notice:\ %m\ in\ %f\ on\ line\ %l, + \%E%.%#Parse\ error:\ %m\ in\ %f\ on\ line\ %l, + \%W%.%#Notice:\ %m\ in\ %f\ on\ line\ %l, + \%-G%.%# let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/compiler/rake.vim b/runtime/compiler/rake.vim new file mode 100644 index 0000000..3bd9da0 --- /dev/null +++ b/runtime/compiler/rake.vim @@ -0,0 +1,35 @@ +" Vim compiler file +" Language: Rake +" Maintainer: Tim Pope +" URL: https://github.com/vim-ruby/vim-ruby +" Release Coordinator: Doug Kearns + +if exists("current_compiler") + finish +endif +let current_compiler = "rake" + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal +endif + +let s:cpo_save = &cpo +set cpo-=C + +CompilerSet makeprg=rake + +CompilerSet errorformat= + \%D(in\ %f), + \%\\s%#from\ %f:%l:%m, + \%\\s%#from\ %f:%l:, + \%\\s%##\ %f:%l:%m, + \%\\s%##\ %f:%l, + \%\\s%#[%f:%l:\ %#%m, + \%\\s%#%f:%l:\ %#%m, + \%\\s%#%f:%l:, + \%m\ [%f:%l]: + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: nowrap sw=2 sts=2 ts=8: diff --git a/runtime/compiler/rspec.vim b/runtime/compiler/rspec.vim index f46527e..7c340ba 100644 --- a/runtime/compiler/rspec.vim +++ b/runtime/compiler/rspec.vim @@ -1,9 +1,7 @@ " Vim compiler file " Language: RSpec " Maintainer: Tim Pope -" Last Change: 2009 Dec 22 -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site +" URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns if exists("current_compiler") @@ -18,21 +16,15 @@ endif let s:cpo_save = &cpo set cpo-=C -CompilerSet makeprg=spec +CompilerSet makeprg=rspec CompilerSet errorformat= - \%+W'%.%#'\ FAILED, - \%+I'%.%#'\ FIXED, - \%-Cexpected:%.%#, - \%-C\ \ \ \ \ got:%.%#, + \%f:%l:\ %tarning:\ %m, \%E%.%#:in\ `load':\ %f:%l:%m, - \%C%f:%l:, - \%W%f:%l:\ warning:\ %m, - \%E%f:%l:in\ %*[^:]:\ %m, - \%E%f:%l:\ %m, - \%-Z%\tfrom\ %f:%l, - \%-Z%p^%.%#, - \%-C%.%#, + \%E%f:%l:in\ `%*[^']':\ %m, + \%-Z\ \ \ \ \ \#\ %f:%l:%.%#, + \%E\ \ %\\d%\\+)%.%#, + \%C\ \ \ \ \ %m, \%-G%.%# let &cpo = s:cpo_save diff --git a/runtime/compiler/rst.vim b/runtime/compiler/rst.vim index 07c7d41..15d2d79 100644 --- a/runtime/compiler/rst.vim +++ b/runtime/compiler/rst.vim @@ -9,7 +9,7 @@ endif let current_compiler = "rst" let s:cpo_save = &cpo -set cpo-=C +set cpo&vim setlocal errorformat= \%f:%l:\ (%tEBUG/0)\ %m, diff --git a/runtime/compiler/ruby.vim b/runtime/compiler/ruby.vim index 9499ce1..dcf7a40 100644 --- a/runtime/compiler/ruby.vim +++ b/runtime/compiler/ruby.vim @@ -1,33 +1,10 @@ " Vim compiler file " Language: Ruby " Function: Syntax check and/or error reporting -" Maintainer: Tim Hammerquist -" Last Change: 2008 Aug 1 -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site +" Maintainer: Tim Pope +" URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns " ---------------------------------------------------------------------------- -" -" Changelog: -" 0.2: script saves and restores 'cpoptions' value to prevent problems with -" line continuations -" 0.1: initial release -" -" Contributors: -" Hugh Sasse -" Doug Kearns -" -" Todo: -" match error type %m -" -" Comments: -" I know this file isn't perfect. If you have any questions, suggestions, -" patches, etc., please don't hesitate to let me know. -" -" This is my first experience with 'errorformat' and compiler plugins and -" I welcome any input from more experienced (or clearer-thinking) -" individuals. -" ---------------------------------------------------------------------------- if exists("current_compiler") finish diff --git a/runtime/compiler/rubyunit.vim b/runtime/compiler/rubyunit.vim index 524c205..93a0c8e 100644 --- a/runtime/compiler/rubyunit.vim +++ b/runtime/compiler/rubyunit.vim @@ -1,9 +1,7 @@ " Vim compiler file " Language: Test::Unit - Ruby Unit Testing Framework " Maintainer: Doug Kearns -" Last Change: 2008 Aug 1 -" URL: http://vim-ruby.rubyforge.org -" Anon CVS: See above site +" URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns if exists("current_compiler") diff --git a/runtime/compiler/sass.vim b/runtime/compiler/sass.vim new file mode 100644 index 0000000..376a52b --- /dev/null +++ b/runtime/compiler/sass.vim @@ -0,0 +1,30 @@ +" Vim compiler file +" Compiler: Sass +" Maintainer: Tim Pope +" Last Change: 2013 May 30 + +if exists("current_compiler") + finish +endif +let current_compiler = "sass" + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal +endif + +let s:cpo_save = &cpo +set cpo-=C + +CompilerSet makeprg=sass\ -c + +CompilerSet errorformat= + \%f:%l:%m\ (Sass::Syntax%trror), + \%ESyntax\ %trror:%m, + \%C%\\s%\\+on\ line\ %l\ of\ %f, + \%Z%.%#, + \%-G%.%# + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim:set sw=2 sts=2: diff --git a/runtime/compiler/se.vim b/runtime/compiler/se.vim index fbfa62d..38fd10c 100644 --- a/runtime/compiler/se.vim +++ b/runtime/compiler/se.vim @@ -1,8 +1,7 @@ " Vim compiler file -" Compiler: se (SmartEiffel Compiler) -" Maintainer: Doug Kearns -" URL: http://gus.gscit.monash.edu.au/~djkea2/vim/compiler/se.vim -" Last Change: 2004 Nov 27 +" Compiler: se (Liberty Eiffel Compiler) +" Maintainer: Doug Kearns +" Last Change: 2013 Jun 29 if exists("current_compiler") finish @@ -16,12 +15,15 @@ endif let s:cpo_save = &cpo set cpo-=C -CompilerSet makeprg=compile\ % +CompilerSet makeprg=se\ c CompilerSet errorformat=%W******\ Warning:\ %m, \%E******\ Fatal\ Error:\ %m, \%E******\ Error:\ %m, - \%CLine\ %l\ column\ %c\ in\ %\\w%\\+\ (%f)\ :, + \%ZLine\ %l\ column\ %c\ in\ %.%#\ (%f)\ %\\=:, + \%ZLine\ %l\ columns\ %c\\,\ %\\d%\\+\ %.%#\ (%f)\ %\\=:, + \%+C%*[^\ ]%.%#, + \%-GThe\ source\ lines\ involved, \%-G%.%# let &cpo = s:cpo_save diff --git a/runtime/compiler/tcl.vim b/runtime/compiler/tcl.vim index 8bd6de6..81af185 100644 --- a/runtime/compiler/tcl.vim +++ b/runtime/compiler/tcl.vim @@ -1,7 +1,6 @@ " Vim compiler file " Compiler: tcl -" Maintainer: Doug Kearns -" URL: http://gus.gscit.monash.edu.au/~djkea2/vim/compiler/tcl.vim +" Maintainer: Doug Kearns " Last Change: 2004 Nov 27 if exists("current_compiler") diff --git a/runtime/compiler/tex.vim b/runtime/compiler/tex.vim index 5828a91..e43be8d 100644 --- a/runtime/compiler/tex.vim +++ b/runtime/compiler/tex.vim @@ -1,11 +1,13 @@ " Vim compiler file " Compiler: TeX " Maintainer: Artem Chuprina -" Last Change: 2004 Mar 27 +" Last Change: 2012 Apr 30 if exists("current_compiler") finish endif +let s:keepcpo= &cpo +set cpo&vim if exists(":CompilerSet") != 2 " older Vim always used :setlocal command -nargs=* CompilerSet setlocal @@ -30,9 +32,6 @@ else let current_compiler = 'make' endif -let s:cpo_save = &cpo -set cpo-=C - " Value errorformat are taken from vim help, see :help errorformat-LaTeX, with " addition from Srinath Avadhanula CompilerSet errorformat=%E!\ LaTeX\ %trror:\ %m, @@ -64,5 +63,5 @@ CompilerSet errorformat=%E!\ LaTeX\ %trror:\ %m, \%+Q%*[^()])%r, \%+Q[%\\d%*[^()])%r -let &cpo = s:cpo_save -unlet s:cpo_save +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/compiler/tidy.vim b/runtime/compiler/tidy.vim index 52bc526..56baee2 100644 --- a/runtime/compiler/tidy.vim +++ b/runtime/compiler/tidy.vim @@ -1,11 +1,7 @@ " Vim compiler file " Compiler: HTML Tidy -" Maintainer: Doug Kearns -" URL: http://gus.gscit.monash.edu.au/~djkea2/vim/compiler/tidy.vim -" Last Change: 2004 Nov 27 - -" NOTE: set 'tidy_compiler_040800' if you are using the 4th August 2000 release -" of HTML Tidy. +" Maintainer: Doug Kearns +" Last Change: 2013 Jul 7 if exists("current_compiler") finish @@ -16,13 +12,7 @@ if exists(":CompilerSet") != 2 " older Vim always used :setlocal command -nargs=* CompilerSet setlocal endif -" this is needed to work around a bug in the 04/08/00 release of tidy which -" failed to set the filename if the -quiet option was used -if exists("tidy_compiler_040800") - CompilerSet makeprg=tidy\ -errors\ --gnu-emacs\ yes\ % -else - CompilerSet makeprg=tidy\ -quiet\ -errors\ --gnu-emacs\ yes\ % -endif +CompilerSet makeprg=tidy\ -quiet\ -errors\ --gnu-emacs\ yes\ % " sample warning: foo.html:8:1: Warning: inserting missing 'foobar' element " sample error: foo.html:9:2: Error: is not recognized! diff --git a/runtime/compiler/xbuild.vim b/runtime/compiler/xbuild.vim new file mode 100644 index 0000000..b508a46 --- /dev/null +++ b/runtime/compiler/xbuild.vim @@ -0,0 +1,22 @@ +" Vim compiler file +" Compiler: Mono C# +" Maintainer: Chiel ten Brinke (ctje92@gmail.com) +" Last Change: 2013 May 13 + +if exists("current_compiler") + finish +endif + +let current_compiler = "xbuild" +let s:keepcpo= &cpo +set cpo&vim + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal +endif + +CompilerSet errorformat=\ %#%f(%l\\\,%c):\ %m +CompilerSet makeprg=xbuild\ /nologo\ /v:q\ /property:GenerateFullPaths=true + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/compiler/xmllint.vim b/runtime/compiler/xmllint.vim index 8fde4e1..96cfa55 100644 --- a/runtime/compiler/xmllint.vim +++ b/runtime/compiler/xmllint.vim @@ -1,8 +1,7 @@ " Vim compiler file " Compiler: xmllint -" Maintainer: Doug Kearns -" URL: http://gus.gscit.monash.edu.au/~djkea2/vim/compiler/xmllint.vim -" Last Change: 2004 Nov 27 +" Maintainer: Doug Kearns +" Last Change: 2013 Jul 8 if exists("current_compiler") finish @@ -16,12 +15,10 @@ endif let s:cpo_save = &cpo set cpo-=C -CompilerSet makeprg=xmllint\ --valid\ --noout\ +CompilerSet makeprg=xmllint\ --valid\ --noout -CompilerSet errorformat=%E%f:%l:\ error:\ %m, - \%W%f:%l:\ warning:\ %m, - \%E%f:%l:\ validity\ error:\ %m, - \%W%f:%l:\ validity\ warning:\ %m, +CompilerSet errorformat=%+E%f:%l:\ %.%#\ error\ :\ %m, + \%+W%f:%l:\ %.%#\ warning\ :\ %m, \%-Z%p^, \%-G%.%# diff --git a/runtime/doc/arabic.txt b/runtime/doc/arabic.txt index 7a4bfaa..2f0be51 100644 --- a/runtime/doc/arabic.txt +++ b/runtime/doc/arabic.txt @@ -1,4 +1,4 @@ -*arabic.txt* For Vim version 7.3. Last change: 2005 Mar 29 +*arabic.txt* For Vim version 7.4. Last change: 2010 Nov 13 VIM REFERENCE MANUAL by Nadim Shaikli @@ -146,7 +146,7 @@ o Enable Arabic settings [short-cut] :set arabic < The two above noted possible invocations are the preferred manner - in which users are instructed to proceed. Baring an enabled 'termbidi' + in which users are instructed to proceed. Barring an enabled 'termbidi' setting, both command options: 1. set the appropriate keymap diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index c129e3f..3384051 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1,4 +1,4 @@ -*autocmd.txt* For Vim version 7.3. Last change: 2010 Jul 22 +*autocmd.txt* For Vim version 7.4. Last change: 2013 Aug 04 VIM REFERENCE MANUAL by Bram Moolenaar @@ -33,7 +33,7 @@ files matching *.c. You can also use autocommands to implement advanced features, such as editing compressed files (see |gzip-example|). The usual place to put autocommands is in your .vimrc or .exrc file. - *E203* *E204* *E143* + *E203* *E204* *E143* *E855* WARNING: Using autocommands is very powerful, and may lead to unexpected side effects. Be careful not to destroy your text. - It's a good idea to do some testing on an expendable copy of a file first. @@ -263,8 +263,10 @@ Name triggered by ~ Startup and exit |VimEnter| after doing all the startup stuff |GUIEnter| after starting the GUI successfully +|GUIFailed| after starting the GUI failed |TermResponse| after the terminal response to |t_RV| is received +|QuitPre| when using `:quit`, before deciding whether to quit |VimLeavePre| before exiting Vim, before writing the viminfo file |VimLeave| before exiting Vim, after writing the viminfo file @@ -299,6 +301,8 @@ Name triggered by ~ |InsertEnter| starting Insert mode |InsertChange| when typing while in Insert or Replace mode |InsertLeave| when leaving Insert mode +|InsertCharPre| when a character was typed in Insert mode, before + inserting it |ColorScheme| after loading a color scheme @@ -310,6 +314,7 @@ Name triggered by ~ |SessionLoadPost| after loading a session file |MenuPopup| just before showing the popup menu +|CompleteDone| after Insert mode completion is done |User| to be used in combination with ":doautocmd" @@ -383,6 +388,10 @@ BufRead or BufReadPost When starting to edit a new buffer, after This does NOT work for ":r file". Not used when the file doesn't exist. Also used after successfully recovering a file. + Also triggered for the filetypedetect group + when executing ":filetype detect" and when + writing an unnamed buffer in a way that the + buffer gets a name. *BufReadCmd* BufReadCmd Before starting to edit a new buffer. Should read the file into the buffer. |Cmd-event| @@ -446,6 +455,9 @@ BufWriteCmd Before writing the whole buffer to a file. 'modified' if successful, unless '+' is in 'cpo' and writing to another file |cpo-+|. The buffer contents should not be changed. + When the command resets 'modified' the undo + information is adjusted to mark older undo + states as 'modified', like |:write| does. |Cmd-event| *BufWritePost* BufWritePost After writing the whole buffer to a file @@ -469,6 +481,11 @@ CmdwinLeave Before leaving the command-line window. *ColorScheme* ColorScheme After loading a color scheme. |:colorscheme| + *CompleteDone* +CompleteDone After Insert mode completion is done. Either + when something was completed or abandoning + completion. |ins-completion| + *CursorHold* CursorHold When the user doesn't press a key for the time specified with 'updatetime'. Not re-triggered @@ -496,16 +513,18 @@ CursorHold When the user doesn't press a key for the time CursorHoldI Just like CursorHold, but in Insert mode. *CursorMoved* -CursorMoved After the cursor was moved in Normal mode. - Also when the text of the cursor line has been - changed, e.g., with "x", "rx" or "p". +CursorMoved After the cursor was moved in Normal or Visual + mode. Also when the text of the cursor line + has been changed, e.g., with "x", "rx" or "p". Not triggered when there is typeahead or when an operator is pending. For an example see |match-parens|. - Careful: Don't do anything that the user does - not expect or that is slow. + Careful: This is triggered very often, don't + do anything that the user does not expect or + that is slow. *CursorMovedI* CursorMovedI After the cursor was moved in Insert mode. + Not triggered when the popup menu is visible. Otherwise the same as CursorMoved. *EncodingChanged* EncodingChanged Fires off after the 'encoding' option has been @@ -657,12 +676,26 @@ InsertChange When typing while in Insert or indicates the new mode. Be careful not to move the cursor or do anything else that the user does not expect. + *InsertCharPre* +InsertCharPre When a character is typed in Insert mode, + before inserting the char. + The |v:char| variable indicates the char typed + and can be changed during the event to insert + a different character. When |v:char| is set + to more than one character this text is + inserted literally. + It is not allowed to change the text |textlock|. + The event is not triggered when 'paste' is + set. *InsertEnter* InsertEnter Just before starting Insert mode. Also for Replace mode and Virtual Replace mode. The |v:insertmode| variable indicates the mode. - Be careful not to move the cursor or do - anything else that the user does not expect. + Be careful not to do anything else that the + user does not expect. + The cursor is restored afterwards. If you do + not want that set |v:char| to a non-empty + string. *InsertLeave* InsertLeave When leaving Insert mode. Also when using CTRL-O |i_CTRL-O|. But not for |i_CTRL-C|. @@ -682,7 +715,10 @@ MenuPopup Just before showing the popup menu (under the QuickFixCmdPre Before a quickfix command is run (|:make|, |:lmake|, |:grep|, |:lgrep|, |:grepadd|, |:lgrepadd|, |:vimgrep|, |:lvimgrep|, - |:vimgrepadd|, |:lvimgrepadd|, |:cscope|). + |:vimgrepadd|, |:lvimgrepadd|, |:cscope|, + |:cfile|, |:cgetfile|, |:caddfile|, |:lfile|, + |:lgetfile|, |:laddfile|, |:helpgrep|, + |:lhelpgrep|). The pattern is matched against the command being run. When |:grep| is used but 'grepprg' is set to "internal" it still matches "grep". @@ -693,7 +729,16 @@ QuickFixCmdPre Before a quickfix command is run (|:make|, *QuickFixCmdPost* QuickFixCmdPost Like QuickFixCmdPre, but after a quickfix command is run, before jumping to the first - location. See |QuickFixCmdPost-example|. + location. For |:cfile| and |:lfile| commands + it is run after error file is read and before + moving to the first error. + See |QuickFixCmdPost-example|. + *QuitPre* +QuitPre When using `:quit`, `:wq` or `:qall`, before + deciding whether it closes the current window + or quits Vim. Can be used to close any + non-essential window if the current window is + the last ordinary window. *RemoteReply* RemoteReply When a reply from a Vim that functions as server was received |server2client()|. The @@ -786,13 +831,31 @@ TermChanged After the value of 'term' has changed. Useful TermResponse After the response to |t_RV| is received from the terminal. The value of |v:termresponse| can be used to do things depending on the - terminal version. + terminal version. Note that this event may be + triggered halfway executing another event, + especially if file I/O, a shell command or + anything else that takes time is involved. + *TextChanged* +TextChanged After a change was made to the text in the + current buffer in Normal mode. That is when + |b:changedtick| has changed. + Not triggered when there is typeahead or when + an operator is pending. + Careful: This is triggered very often, don't + do anything that the user does not expect or + that is slow. + *TextChangedI* +TextChangedI After a change was made to the text in the + current buffer in Insert mode. + Not triggered when the popup menu is visible. + Otherwise the same as TextChanged. *User* User Never executed automatically. To be used for autocommands that are only executed with ":doautocmd". *UserGettingBored* -UserGettingBored When the user hits CTRL-C. Just kidding! :-) +UserGettingBored When the user presses the same key 42 times. + Just kidding! :-) *VimEnter* VimEnter After doing all the startup stuff, including loading .vimrc files, executing the "-c cmd" @@ -889,7 +952,8 @@ the autocommand is executed. This is different from the command! *file-pattern* The pattern is interpreted like mostly used in file names: - * matches any sequence of characters + * matches any sequence of characters; Unusual: includes path + separators ? matches any single character \? matches a '?' . matches a '.' @@ -898,6 +962,9 @@ The pattern is interpreted like mostly used in file names: \, matches a ',' { } like \( \) in a |pattern| , inside { }: like \| in a |pattern| + \} literal } + \{ literal { + \\\{n,m\} like \{n,m} in a |pattern| \ special meaning like in a |pattern| [ch] matches 'c' or 'h' [^ch] match any character but 'c' and 'h' @@ -1032,7 +1099,7 @@ Note that the 'eventignore' option applies here too. Events listed in this option will not cause any commands to be executed. *:do* *:doau* *:doautocmd* *E217* -:do[autocmd] [group] {event} [fname] +:do[autocmd] [] [group] {event} [fname] Apply the autocommands matching [fname] (default: current file name) for {event} to the current buffer. You can use this when the current file name does not @@ -1041,8 +1108,8 @@ option will not cause any commands to be executed. It's possible to use this inside an autocommand too, so you can base the autocommands for one extension on another extension. Example: > - :au Bufenter *.cpp so ~/.vimrc_cpp - :au Bufenter *.cpp doau BufEnter x.c + :au BufEnter *.cpp so ~/.vimrc_cpp + :au BufEnter *.cpp doau BufEnter x.c < Be careful to avoid endless loops. See |autocmd-nested|. @@ -1051,14 +1118,17 @@ option will not cause any commands to be executed. argument is included, Vim executes only the matching autocommands for that group. Note: if you use an undefined group name, Vim gives you an error message. - + ** After applying the autocommands the modelines are processed, so that their settings overrule the settings from autocommands, like what happens when - editing a file. + editing a file. This is skipped when the + argument is present. You probably want to use + for events that are not used when loading + a buffer, such as |User|. *:doautoa* *:doautoall* -:doautoa[ll] [group] {event} [fname] +:doautoa[ll] [] [group] {event} [fname] Like ":doautocmd", but apply the autocommands to each loaded buffer. Note that [fname] is used to select the autocommands, not the buffers to which they are diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 19528ed..819bb04 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -1,4 +1,4 @@ -*change.txt* For Vim version 7.3. Last change: 2010 Jul 29 +*change.txt* For Vim version 7.4. Last change: 2013 Jul 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -71,24 +71,37 @@ For inserting text see |insert.txt|. "D" deletes the highlighted text plus all text until the end of the line. {not in Vi} - *:d* *:de* *:del* *:delete* + *:d* *:de* *:del* *:delete* *:dl* *:dp* :[range]d[elete] [x] Delete [range] lines (default: current line) [into register x]. + Note these weird abbreviations: + :dl delete and list + :dell idem + :delel idem + :deletl idem + :deletel idem + :dp delete and print + :dep idem + :delp idem + :delep idem + :deletp idem + :deletep idem :[range]d[elete] [x] {count} Delete {count} lines, starting with [range] (default: current line |cmdline-ranges|) [into register x]. -These commands delete text. You can repeat them with the "." command -(except ":d") and undo them. Use Visual mode to delete blocks of text. See +These commands delete text. You can repeat them with the `.` command +(except `:d`) and undo them. Use Visual mode to delete blocks of text. See |registers| for an explanation of registers. An exception for the d{motion} command: If the motion is not linewise, the start and end of the motion are not in the same line, and there are only blanks before the start and after the end of the motion, the delete becomes linewise. This means that the delete also removes the line of blanks that you -might expect to remain. +might expect to remain. Use the |o_v| operator to force the motion to be +characterwise. Trying to delete an empty region of text (e.g., "d0" in the first column) is an error when 'cpoptions' includes the 'E' flag. @@ -131,7 +144,7 @@ gJ Join [count] lines, with a minimum of two lines. See |ex-flags| for [flags]. These commands delete the between lines. This has the effect of joining -multiple lines into one line. You can repeat these commands (except ":j") and +multiple lines into one line. You can repeat these commands (except `:j`) and undo them. These commands, except "gJ", insert one space in place of the unless @@ -259,6 +272,12 @@ r{char} Replace the character under the cursor with {char}. . CTRL-V replaces with a . {Vi: CTRL-V still replaces with a line break, cannot replace something with a } + + If {char} is CTRL-E or CTRL-Y the character from the + line below or above is used, just like with |i_CTRL-E| + and |i_CTRL-Y|. This also works with a count, thus + `10r` copies 10 characters from the line below. + If you give a [count], Vim replaces [count] characters with [count] {char}s. When {char} is a or , however, Vim inserts only one : "5r" replaces @@ -464,9 +483,9 @@ much as possible to make the indent. You can use ">><<" to replace an indent made out of spaces with the same indent made out of s (and a few spaces if necessary). If the 'expandtab' option is on, Vim uses only spaces. Then you can use ">><<" to replace s in the indent by spaces (or use -":retab!"). +`:retab!`). -To move a line several 'shiftwidth's, use Visual mode or the ":" commands. +To move a line several 'shiftwidth's, use Visual mode or the `:` commands. For example: > Vjj4> move three lines 4 indents to the right :<<< move current line 3 indents to the left @@ -486,7 +505,7 @@ Examples of filters are "sort", which sorts lines alphabetically, and works like a filter; not all versions do). The 'shell' option specifies the shell Vim uses to execute the filter command (See also the 'shelltype' option). You can repeat filter commands with ".". Vim does not recognize a -comment (starting with '"') after the ":!" command. +comment (starting with '"') after the `:!` command. *!* !{motion}{filter} Filter {motion} text lines through the external @@ -522,11 +541,11 @@ comment (starting with '"') after the ":!" command. ={motion} Filter {motion} lines through the external program given with the 'equalprg' option. When the 'equalprg' option is empty (this is the default), use the - internal formatting function |C-indenting|. But when - 'indentexpr' is not empty, it will be used instead - |indent-expression|. When Vim was compiled without - internal formatting then the "indent" program is used - as a last resort. + internal formatting function |C-indenting| and + |'lisp'|. But when 'indentexpr' is not empty, it will + be used instead |indent-expression|. When Vim was + compiled without internal formatting then the "indent" + program is used as a last resort. *==* == Filter [count] lines like with ={motion}. @@ -573,34 +592,37 @@ For other systems the tmpnam() library function is used. Repeat last :substitute with same search pattern and substitute string, but without the same flags. You may add [flags], see |:s_flags|. - Note that after ":substitute" the '&' flag can't be + Note that after `:substitute` the '&' flag can't be used, it's recognized as a pattern separator. - The space between ":substitute" and the 'c', 'g' and + The space between `:substitute` and the 'c', 'g' and 'r' flags isn't required, but in scripts it's a good idea to keep it to avoid confusion. :[range]~[&][flags] [count] *:~* Repeat last substitute with same substitute string but with last used search pattern. This is like - ":&r". See |:s_flags| for [flags]. + `:&r`. See |:s_flags| for [flags]. *&* -& Synonym for ":s" (repeat last substitute). Note +& Synonym for `:s` (repeat last substitute). Note that the flags are not remembered, thus it might - actually work differently. You can use ":&&" to keep + actually work differently. You can use `:&&` to keep the flags. *g&* -g& Synonym for ":%s//~/&" (repeat last substitute on all - lines with the same flags). +g& Synonym for `:%s//~/&` (repeat last substitute with + last search pattern on all lines with the same flags). + For example, when you first do a substitution with + `:s/pattern/repl/flags` and then `/search` for + something else, `g&` will do `:%s/search/repl/flags`. Mnemonic: global substitute. {not in Vi} *:snomagic* *:sno* -:[range]sno[magic] ... Same as ":substitute", but always use 'nomagic'. +:[range]sno[magic] ... Same as `:substitute`, but always use 'nomagic'. {not in Vi} *:smagic* *:sm* -:[range]sm[agic] ... Same as ":substitute", but always use 'magic'. +:[range]sm[agic] ... Same as `:substitute`, but always use 'magic'. {not in Vi} *:s_flags* @@ -610,7 +632,7 @@ The flags that you can use for the substitute commands: command. Examples: > :&& :s/this/that/& -< Note that ":s" and ":&" don't keep the flags. +< Note that `:s` and `:&` don't keep the flags. {not in Vi} [c] Confirm each substitution. Vim highlights the matching string (with @@ -659,6 +681,8 @@ The flags that you can use for the substitute commands: [n] Report the number of matches, do not actually substitute. The [c] flag is ignored. The matches are reported as if 'report' is zero. Useful to |count-items|. + If \= |sub-replace-expression| is used, the expression will be + evaluated in the |sandbox| at every match. [p] Print the line containing the last substitute. @@ -666,14 +690,14 @@ The flags that you can use for the substitute commands: [l] Like [p] but print the text like |:list|. -[r] Only useful in combination with ":&" or ":s" without arguments. ":&r" - works the same way as ":~": When the search pattern is empty, use the +[r] Only useful in combination with `:&` or `:s` without arguments. `:&r` + works the same way as `:~`: When the search pattern is empty, use the previously used search pattern instead of the search pattern from the - last substitute or ":global". If the last command that did a search - was a substitute or ":global", there is no effect. If the last + last substitute or `:global`. If the last command that did a search + was a substitute or `:global`, there is no effect. If the last command was a search command such as "/", use the pattern from that command. - For ":s" with an argument this already happens: > + For `:s` with an argument this already happens: > :s/blue/red/ /green :s//red/ or :~ or :&r @@ -690,8 +714,9 @@ reason is that the flags can only be found by skipping the pattern, and in order to skip the pattern the "magicness" must be known. Catch 22! If the {pattern} for the substitute command is empty, the command uses the -pattern from the last substitute or ":global" command. With the [r] flag, the -command uses the pattern from the last substitute, ":global", or search +pattern from the last substitute or `:global` command. If there is none, but +there is a previous search pattern, that one is used. With the [r] flag, the +command uses the pattern from the last substitute, `:global`, or search command. If the {string} is omitted the substitute is done as if it's empty. Thus the @@ -716,11 +741,13 @@ Otherwise it works on whole lines anyway. *sub-replace-special* *:s\=* When the {string} starts with "\=" it is evaluated as an expression, see -|sub-replace-expression|. You can use that for any special characters. +|sub-replace-expression|. You can use that for complex replacement or special +characters. + Otherwise these characters in {string} have a special meaning: *:s%* When {string} is equal to "%" and '/' is included with the 'cpoptions' option, -then the {string} of the previous substitute command is used. |cpo-/| +then the {string} of the previous substitute command is used, see |cpo-/| magic nomagic action ~ & \& replaced with the whole matched pattern *s/\&* @@ -755,12 +782,25 @@ magic nomagic action ~ \x where x is any character not mentioned above: Reserved for future expansion +The special meaning is also used inside the third argument {sub} of +the |substitute()| function with the following exceptions: + - A % inserts a percent literally without regard to 'cpoptions'. + - magic is always set without regard to 'magic'. + - A ~ inserts a tilde literally. + - and \r inserts a carriage-return (CTRL-M). + - \ does not have a special meaning. it's just one of \x. + Examples: > :s/a\|b/xxx\0xxx/g modifies "a b" to "xxxaxxx xxxbxxx" :s/\([abc]\)\([efg]\)/\2\1/g modifies "af fa bg" to "fa fa gb" :s/abcde/abc^Mde/ modifies "abcde" to "abc", "de" (two lines) :s/$/\^M/ modifies "abcde" to "abcde^M" :s/\w\+/\u\0/g modifies "bla bla" to "Bla Bla" + :s/\w\+/\L\u/g modifies "BLA bla" to "Bla Bla" + +Note: "\L\u" can be used to capitalize the first letter of a word. This is +not compatible with Vi and older versions of Vim, where the "\u" would cancel +out the "\L". Same for "\U\l". Note: In previous versions CTRL-V was handled in a special way. Since this is not Vi compatible, this was removed. Use a backslash instead. @@ -786,17 +826,19 @@ either the first or second pattern in parentheses did not match, so either Substitute with an expression *sub-replace-expression* *sub-replace-\=* When the substitute string starts with "\=" the remainder is interpreted as an -expression. This does not work recursively: a substitute() function inside +expression. This does not work recursively: a |substitute()| function inside the expression cannot use "\=" for the substitute string. The special meaning for characters as mentioned at |sub-replace-special| does -not apply except for "", "\" and "\\". Thus in the result of the -expression you need to use two backslashes to get one, put a backslash before a - you want to insert, and use a without a backslash where you want to -break the line. +not apply except for "". A character is used as a line break, you +can get one with a double-quote string: "\n". Prepend a backslash to get a +real character (which will be a NUL in the file). -For convenience a character is also used as a line break. Prepend a -backslash to get a real character (which will be a NUL in the file). +The "\=" notation can also be used inside the third argument {sub} of +|substitute()| function. In this case, the special meaning for characters as +mentioned at |sub-replace-special| does not apply at all. Especially, and + are interpreted not as a line break but as a carriage-return and a +new-line respectively. When the result is a |List| then the items are joined with separating line breaks. Thus each item becomes a line, except that they can contain line @@ -834,7 +876,7 @@ This replaces each 'E' character with a euro sign. Read more in ||. 4.4 Changing tabs *change-tabs* - *:ret* *:retab* + *:ret* *:retab* *:retab!* :[range]ret[ab][!] [new_tabstop] Replace all sequences of white-space containing a with new strings of white-space using the new @@ -853,7 +895,7 @@ This replaces each 'E' character with a euro sign. Read more in ||. Careful: This command modifies any characters inside of strings in a C program. Use "\t" to avoid this (that's a good habit anyway). - ":retab!" may also change a sequence of spaces by + `:retab!` may also change a sequence of spaces by characters, which can mess up a printf(). {not in Vi} Not available when |+ex_extra| feature was disabled at @@ -916,8 +958,10 @@ inside of strings can change! Also see 'softtabstop' option. > {Visual}["x]Y Yank the highlighted lines [into register x] (for {Visual} see |Visual-mode|). {not in Vi} - *:y* *:yank* -:[range]y[ank] [x] Yank [range] lines [into register x]. + *:y* *:yank* *E850* +:[range]y[ank] [x] Yank [range] lines [into register x]. Yanking to the + "* or "+ registers is possible only when the + |+clipboard| feature is included. :[range]y[ank] [x] {count} Yank {count} lines, starting with last line number @@ -961,8 +1005,12 @@ inside of strings can change! Also see 'softtabstop' option. > current line). This always works |linewise|, thus this command can be used to put a yanked block as new lines. - The cursor is left on the first non-blank in the last - new line. + If no register is specified, it depends on the 'cb' + option: If 'cb' contains "unnamedplus", paste from the + + register |quoteplus|. Otherwise, if 'cb' contains + "unnamed", paste from the * register |quotestar|. + Otherwise, paste from the unnamed register + |quote_quote|. The register can also be '=' followed by an optional expression. The expression continues until the end of the command. You need to escape the '|' and '"' @@ -1167,7 +1215,7 @@ nothing is returned. {not in Vi} 9. Last search pattern register "/ *quote_/* *quote/* Contains the most recent search-pattern. This is used for "n" and 'hlsearch'. -It is writable with ":let", you can change it to have 'hlsearch' highlight +It is writable with `:let`, you can change it to have 'hlsearch' highlight other matches without actually searching. You can't yank or delete into this register. The search direction is available in |v:searchforward|. Note that the valued is restored when returning from a function @@ -1175,12 +1223,12 @@ Note that the valued is restored when returning from a function {not in Vi} *@/* -You can write to a register with a ":let" command |:let-@|. Example: > +You can write to a register with a `:let` command |:let-@|. Example: > :let @/ = "the" If you use a put command without specifying a register, Vim uses the register that was last filled (this is also the contents of the unnamed register). If -you are confused, use the ":dis" command to find out what Vim will put (this +you are confused, use the `:dis` command to find out what Vim will put (this command displays all named and numbered registers; the unnamed register is labelled '"'). @@ -1387,16 +1435,19 @@ before typing anything else on the new line. This will replace the middle-comment leader with the end-comment leader and apply any specified alignment, leaving just " */". There is no need to hit BackSpace first. +When there is a match with a middle part, but there also is a maching end part +which is longer, the end part is used. This makes a C style comment work +without requiring the middle part to end with a space. Here is an example of alignment flags at work to make a comment stand out -(kind of looks like a 1 too). Consider comment string > - sr:/***,m:**,ex2:******/ - - /*** - **<--right aligned from "r" flag - ** -offset 2 spaces from the "2" flag--->** - ******/ +(kind of looks like a 1 too). Consider comment string: > + :set comments=sr:/***,m:**,ex-2:******/ +< + /*** ~ + **<--right aligned from "r" flag ~ + ** ~ +offset 2 spaces for the "-2" flag--->** ~ + ******/ ~ In this case, the first comment was typed, then return was pressed 4 times, then "/" was pressed to end the comment. @@ -1414,8 +1465,8 @@ Reindenting using a different method like |gq| or |=| will not consult alignment flags either. The same behaviour can be defined in those other formatting options. One consideration is that 'cindent' has additional options for context based indenting of comments but cannot replicate many three piece -indent alignments. However, 'indentexpr' is has the ability to work better -with three piece comments. +indent alignments. However, 'indentexpr' has the ability to work better with +three piece comments. Other examples: > "b:*" Includes lines starting with "*", but not if the "*" is @@ -1473,6 +1524,7 @@ n When formatting text, recognize numbered lists. This actually uses first line of a paragraph second line of the same paragraph third line. +< This also works inside comments, ignoring the comment leader. v Vi-compatible auto-wrapping in insert mode: Only break a line at a blank that you have entered during the current insert command. (Note: this is not 100% Vi compatible. Vi has some "unexpected features" or @@ -1493,6 +1545,12 @@ B When joining lines, don't insert a space between two multi-byte characters. Overruled by the 'M' flag. 1 Don't break a line after a one-letter word. It's broken before it instead (if possible). +j Where it makes sense, remove a comment leader when joining lines. For + example, joining: + int i; // the index ~ + // in the list ~ + Becomes: + int i; // the index in the list ~ With 't' and 'c' you can specify when Vim performs auto-wrapping: @@ -1536,7 +1594,7 @@ Some examples: :set fo=tcrq < -Automatic formatting *auto-format* +Automatic formatting *auto-format* *autoformat* When the 'a' flag is present in 'formatoptions' text is formatted automatically when inserting text or deleting text. This works nice for @@ -1645,7 +1703,7 @@ found here: |sort()|. last search pattern is used. This allows trying out a pattern first. -Note that using ":sort" with ":global" doesn't sort the matching lines, it's +Note that using `:sort` with `:global` doesn't sort the matching lines, it's quite useless. The details about sorting depend on the library function used. There is no diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index a072c6c..36a71cf 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -1,4 +1,4 @@ -*cmdline.txt* For Vim version 7.3. Last change: 2010 May 07 +*cmdline.txt* For Vim version 7.4. Last change: 2013 Mar 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -83,9 +83,9 @@ CTRL-V Insert next non-digit literally. Up to three digits form the CTRL-Q Same as CTRL-V. But with some terminals it is used for control flow, it doesn't work then. - *c_* + *c_* *c_Left* cursor left - *c_* + *c_* *c_Right* cursor right *c_* or *c_* @@ -93,18 +93,18 @@ CTRL-Q Same as CTRL-V. But with some terminals it is used for *c_* or *c_* cursor one WORD right -CTRL-B or *c_CTRL-B* *c_* +CTRL-B or *c_CTRL-B* *c_* *c_Home* cursor to beginning of command-line -CTRL-E or *c_CTRL-E* *c_* +CTRL-E or *c_CTRL-E* *c_* *c_End* cursor to end of command-line *c_* Move the cursor to the position of the mouse click. -CTRL-H *c_* *c_CTRL-H* +CTRL-H *c_* *c_CTRL-H* *c_BS* Delete the character in front of the cursor (see |:fixdel| if your key does not do what you want). - *c_* + *c_* *c_Del* Delete the character under the cursor (at end of line: character before the cursor) (see |:fixdel| if your key does not do what you want). @@ -118,7 +118,7 @@ CTRL-U Remove all characters between the cursor position and preferred behavior, add the following to your .vimrc: > :cnoremap < - *c_* + *c_* *c_Insert* Toggle between insert and overstrike. {not in Vi} {char1} {char2} or *c_digraph* @@ -217,16 +217,16 @@ CTRL-\ e {expr} *c_CTRL-\_e* :return cmd :endfunc < This doesn't work recursively, thus not when already editing - an expression. + an expression. But it is possible to use in a mapping. *c_CTRL-Y* CTRL-Y When there is a modeless selection, copy the selection into the clipboard. |modeless-selection| If there is no selection CTRL-Y is inserted as a character. -CTRL-J *c_CTRL-J* *c_* *c_* +CTRL-J *c_CTRL-J* *c_* *c_* *c_CR* or start entered command - *c_* + *c_* *c_Esc* When typed and 'x' not present in 'cpoptions', quit Command-line mode without executing. In macros or when 'x' present in 'cpoptions', start entered command. @@ -235,12 +235,12 @@ CTRL-J *c_CTRL-J* *c_* *c_* *c_CTRL-C* CTRL-C quit command-line without executing - *c_* + *c_* *c_Up* recall older command-line from history, whose beginning matches the current command-line (see below). {not available when compiled without the |+cmdline_hist| feature} - *c_* + *c_* *c_Down* recall more recent command-line from history, whose beginning matches the current command-line (see below). {not available when compiled without the |+cmdline_hist| @@ -330,12 +330,12 @@ terminals) :his[tory] [{name}] [{first}][, [{last}]] List the contents of history {name} which can be: - c[md] or : command-line history - s[earch] or / search string history - e[xpr] or = expression register history - i[nput] or @ input line history - d[ebug] or > debug command history - a[ll] all of the above + c[md] or : command-line history + s[earch] or / or ? search string history + e[xpr] or = expression register history + i[nput] or @ input line history + d[ebug] or > debug command history + a[ll] all of the above {not in Vi} If the numbers {first} and/or {last} are given, the respective @@ -372,10 +372,10 @@ word before the cursor. This is available for: - Mappings: Only after a ":map" or similar command. - Variable and function names: Only after a ":if", ":call" or similar command. -When Vim was compiled with the |+cmdline_compl| feature disabled, only file -names, directories and help items can be completed. The number of help item -matches is limited (currently to 300) to avoid a long delay when there are -very many matches. +When Vim was compiled without the |+cmdline_compl| feature only file names, +directories and help items can be completed. The number of help item matches +is limited (currently to 300) to avoid a long delay when there are very many +matches. These are the commands that can be used: @@ -423,7 +423,10 @@ CTRL-L A match is done on the pattern in front of the cursor. If The 'wildchar' option defaults to (CTRL-E when in Vi compatible mode; in a previous version was used). In the pattern standard wildcards '*' and -'?' are accepted. '*' matches any string, '?' matches exactly one character. +'?' are accepted when matching file names. '*' matches any string, '?' +matches exactly one character. + +The 'wildignorecase' option can be set to ignore case in filenames. If you like tcsh's autolist completion, you can use this mapping: :cnoremap X @@ -711,10 +714,15 @@ three lines: > Visual Mode and Range *v_:* {Visual}: Starts a command-line with the Visual selected lines as a - range. The code ":'<,'>" is used for this range, which makes + range. The code `:'<,'>` is used for this range, which makes it possible to select a similar line from the command-line history for repeating a command on different Visually selected lines. + When Visual mode was already ended, a short way to use the + Visual area for a range is `:*`. This requires that "*" does + not appear in 'cpo', see |cpo-star|. Otherwise you will have + to type `:'<,'>` + ============================================================================== 5. Ex command-line flags *ex-flags* @@ -781,30 +789,34 @@ it, no matter how many backslashes. *:* *:* *:* ** *:* ** *:* ** *:* ** *:* ** - *E495* *E496* *E497* *E498* *E499* *E500* + ** *E495* *E496* *E497* *E499* *E500* Note: these are typed literally, they are not special keys! is replaced with the word under the cursor (like |star|) is replaced with the WORD under the cursor (see |WORD|) is replaced with the path name under the cursor (like what |gf| uses) - when executing autocommands, is replaced with the file name - for a file read or write - when executing autocommands, is replaced with the currently + When executing autocommands, is replaced with the file name + for a file read or write. + When executing autocommands, is replaced with the currently effective buffer number (for ":r file" and ":so file" it is the current buffer, the file being read/sourced is not in a buffer). - when executing autocommands, is replaced with the match for + When executing autocommands, is replaced with the match for which this autocommand was executed. It differs from only when the file name isn't used to match with (for FileType, Syntax and SpellFileMissing events). - when executing a ":source" command, is replaced with the - file name of the sourced file; - when executing a function, is replaced with + When executing a ":source" command, is replaced with the + file name of the sourced file. *E498* + When executing a function, is replaced with "function {function-name}"; function call nesting is indicated like this: "function {function-name1}..{function-name2}". Note that filename-modifiers are useless when is used inside a function. + When executing a ":source" command, is replaced with the + line number. *E842* + When executing a function it's the line number relative to + the start of the function. *filename-modifiers* *:_%:* *::8* *::p* *::.* *::~* *::h* *::t* *::r* *::e* *::s* *::gs* @@ -819,10 +831,11 @@ These modifiers can be given, in this order: the home directory. If the name is a directory a path separator is added at the end. For a file name that does not exist and does not have an absolute path the result is - unpredictable. + unpredictable. On MS-Windows an 8.3 filename is expanded to + the long name. :8 Converts the path to 8.3 short format (currently only on - win32). Will act on as much of a path that is an existing - path. + MS-Windows). Will act on as much of a path that is an + existing path. :~ Reduce file name to be relative to the home directory, if possible. File name is unmodified if it is not below the home directory. @@ -860,7 +873,7 @@ These modifiers can be given, in this order: After this, the previous modifiers can be used again. For example ":p", to make a full path after the substitution. :gs?pat?sub? - Substitute all occurrences of "path" with "sub". Otherwise + Substitute all occurrences of "pat" with "sub". Otherwise this works like ":s". Examples, when the file name is "src/version.c", current dir @@ -951,7 +964,7 @@ for the file "$home" in the root directory. A few examples: \\$home file "\\", followed by expanded $home ============================================================================== -6. Command-line window *cmdline-window* *cmdwin* +7. Command-line window *cmdline-window* *cmdwin* *command-line-window* In the command-line window the command line can be edited just like editing text in any window. It is a special kind of window, because you cannot leave diff --git a/runtime/doc/debug.txt b/runtime/doc/debug.txt index 015c4e7..3226fa4 100644 --- a/runtime/doc/debug.txt +++ b/runtime/doc/debug.txt @@ -1,4 +1,4 @@ -*debug.txt* For Vim version 7.3. Last change: 2010 Jul 20 +*debug.txt* For Vim version 7.4. Last change: 2012 Feb 11 VIM REFERENCE MANUAL by Bram Moolenaar @@ -15,14 +15,15 @@ For debugging Vim scripts, functions, etc. see |debug-scripts| ============================================================================== -1. Location of a crash, using gcc and gdb *debug-gcc* +1. Location of a crash, using gcc and gdb *debug-gcc* *gdb* When Vim crashes in one of the test files, and you are using gcc for compilation, here is what you can do to find out exactly where Vim crashes. This also applies when using the MingW tools. -1. Compile Vim with the "-g" option (there is a line in the Makefile for this, - which you can uncomment). +1. Compile Vim with the "-g" option (there is a line in the src/Makefile for + this, which you can uncomment). Also make sure "strip" is disabled (do not + install it, or use the line "STRIP = /bin/true"). 2. Execute these commands (replace "11" with the test that fails): > cd testdir @@ -67,7 +68,7 @@ If the Windows version of Vim crashes in a reproducible manner, you can take some steps to provide a useful bug report. -GENERIC ~ +3.1 GENERIC ~ You must obtain the debugger symbols (PDB) file for your executable: gvim.pdb for gvim.exe, or vim.pdb for vim.exe. The PDB should be available from the @@ -89,7 +90,7 @@ a Vim executable compiled with the Borland compiler; gdb (see above *debug-vs2005* -2.2 Debugging Vim crashes with Visual Studio 2005/Visual C++ 2005 Express ~ +3.2 Debugging Vim crashes with Visual Studio 2005/Visual C++ 2005 Express ~ First launch vim.exe or gvim.exe and then launch Visual Studio. (If you don't have Visual Studio, follow the instructions at |get-ms-debuggers| to obtain a @@ -123,7 +124,7 @@ installed as a just-in-time debugger. Use WinDbg, |debug-windbg|, if you need to save minidumps or you want a just-in-time (postmortem) debugger. *debug-windbg* -2.3 Debugging Vim crashes with WinDbg ~ +3.3 Debugging Vim crashes with WinDbg ~ See |get-ms-debuggers| to obtain a copy of WinDbg. @@ -149,7 +150,7 @@ To save a minidump, type the following at the WinDbg command line: > .dump vim.dmp < *debug-minidump* -2.4 Opening a Minidump ~ +3.4 Opening a Minidump ~ If you have a minidump file, you can open it in Visual Studio or in WinDbg. @@ -161,7 +162,7 @@ In WinDbg: choose Open Crash Dump on the File menu. Follow the instructions in |debug-windbg| to set the Symbol File Path. *get-ms-debuggers* -2.5 Obtaining Microsoft Debugging Tools ~ +3.5 Obtaining Microsoft Debugging Tools ~ The Debugging Tools for Windows (including WinDbg) can be downloaded from http://www.microsoft.com/whdc/devtools/debugging/default.mspx diff --git a/runtime/doc/debugger.txt b/runtime/doc/debugger.txt index d80eee6..df7116b 100644 --- a/runtime/doc/debugger.txt +++ b/runtime/doc/debugger.txt @@ -1,4 +1,4 @@ -*debugger.txt* For Vim version 7.3. Last change: 2005 Mar 29 +*debugger.txt* For Vim version 7.4. Last change: 2005 Mar 29 VIM REFERENCE MANUAL by Gordon Prieur diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt index 7cfdd5b..757a45b 100644 --- a/runtime/doc/develop.txt +++ b/runtime/doc/develop.txt @@ -1,4 +1,4 @@ -*develop.txt* For Vim version 7.3. Last change: 2008 Dec 17 +*develop.txt* For Vim version 7.4. Last change: 2013 Apr 27 VIM REFERENCE MANUAL by Bram Moolenaar @@ -20,6 +20,7 @@ code. Vim is open source software. Everybody is encouraged to contribute to help improving Vim. For sending patches a context diff "diff -c" is preferred. Also see http://www.vim.org/tips/tip.php?tip_id=618. +Also see http://vim.wikia.com/wiki/How_to_make_and_submit_a_patch. ============================================================================== 1. Design goals *design-goals* @@ -232,6 +233,17 @@ time shadows global declaration new C++ reserved keyword try Borland C++ doesn't like it to be used as a variable. +clear Mac curses.h +echo Mac curses.h +instr Mac curses.h +meta Mac curses.h +newwin Mac curses.h +nl Mac curses.h +overwrite Mac curses.h +refresh Mac curses.h +scroll Mac curses.h +typeahead Mac curses.h + basename() GNU string function dirname() GNU string function get_env_value() Linux system function diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt index 1d62e54..ddf8aac 100644 --- a/runtime/doc/diff.txt +++ b/runtime/doc/diff.txt @@ -1,4 +1,4 @@ -*diff.txt* For Vim version 7.3. Last change: 2010 Jul 31 +*diff.txt* For Vim version 7.4. Last change: 2013 Jul 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -86,16 +86,16 @@ diff mode. You could use a construct like this: > While already in Vim you can start diff mode in three ways. *E98* -:diffsplit {filename} *:diffs* *:diffsplit* +:diffs[plit] {filename} *:diffs* *:diffsplit* Open a new window on the file {filename}. The options are set as for "vimdiff" for the current and the newly opened window. Also see 'diffexpr'. *:difft* *:diffthis* -:diffthis Make the current window part of the diff windows. This sets +:difft[his] Make the current window part of the diff windows. This sets the options like for "vimdiff". -:diffpatch {patchfile} *E816* *:diffp* *:diffpatch* +:diffp[atch] {patchfile} *E816* *:diffp* *:diffpatch* Use the current buffer, patch it with the diff found in {patchfile} and open a buffer on the result. The options are set as for "vimdiff". @@ -123,14 +123,14 @@ Since the option values are remembered with the buffer, you can edit another file for a moment and come back to the same file and be in diff mode again. *:diffo* *:diffoff* -:diffoff Switch off diff mode for the current window. +:diffo[ff] Switch off diff mode for the current window. -:diffoff! Switch off diff mode for the current window and in all windows +:diffo[ff]! Switch off diff mode for the current window and in all windows in the current tab page where 'diff' is set. -The ":diffoff" command resets the relevant options to their default value. -This may be different from what the values were before diff mode was started, -the old values are not remembered. +The ":diffoff" command resets the relevant options to the values they had when +using |:diffsplit|, |:diffpatch| , |:diffthis|. or starting Vim in diff mode. +Otherwise they are set to their default value: 'diff' off 'scrollbind' off @@ -167,8 +167,8 @@ in diff mode in one window and "normal" in another window. It is also possible to view the changes you have made to a buffer since the file was loaded. Since Vim doesn't allow having two buffers for the same file, you need another buffer. This command is useful: > - command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis - \ | wincmd p | diffthis + command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ + \ | diffthis | wincmd p | diffthis (this is in |vimrc_example.vim|). Use ":DiffOrig" to see the differences between the current buffer and the file it was loaded from. @@ -178,7 +178,7 @@ buffer. If you don't want a buffer to remain used for the diff do ":set nodiff" before hiding it. *:diffu* *:diffupdate* -:diffu[pdate] Update the diff highlighting and folds. +:diffu[pdate][!] Update the diff highlighting and folds. Vim attempts to keep the differences updated when you make changes to the text. This mostly takes care of inserted and deleted lines. Changes within a @@ -187,6 +187,9 @@ To force the differences to be updated use: > :diffupdate +If the ! is included Vim will check if the file was changed externally and +needs to be reloaded. It will prompt for each changed file, like `:checktime` +was used. Vim will show filler lines for lines that are missing in one window but are present in another. These lines were inserted in another file or deleted in @@ -217,7 +220,7 @@ The diffs are highlighted with these groups: that parts in the middle that are still the same are highlighted anyway. Only "iwhite" of 'diffopt' is used here. -|hl-DiffDelete| DiffDelete Deleted lines. Also called filler lines, +|hl-DiffDelete| DiffDelete Deleted lines. Also called filler lines, because they don't really exist in this buffer. @@ -261,10 +264,12 @@ that the buffers will be equal within the specified range. *do* do Same as ":diffget" without argument or range. The "o" stands for "obtain" ("dg" can't be used, it could be the start of - "dgg"!). + "dgg"!). Note: this doesn't work in Visual mode. *dp* dp Same as ":diffput" without argument or range. + Note: this doesn't work in Visual mode. + When no [range] is given, the diff at the cursor position or just above it is affected. When [range] is used, Vim tries to only put or get the specified @@ -328,7 +333,7 @@ diff. This example explains the format that Vim expects: > The "1a2" item appends the line "bbb". The "4d4" item deletes the line "111". -The '7c7" item replaces the line "GGG" with "ggg". +The "7c7" item replaces the line "GGG" with "ggg". When 'diffexpr' is not empty, Vim evaluates it to obtain a diff file in the format mentioned. These variables are set to the file names used: @@ -371,9 +376,9 @@ get an error message. Possible causes: If it's not clear what the problem is set the 'verbose' option to one or more to see more messages. -The self-installing Vim includes a diff program. If you don't have it you -might want to download a diff.exe. For example from -http://jlb.twu.net/code/unixkit.php. +The self-installing Vim for MS-Windows includes a diff program. If you don't +have it you might want to download a diff.exe. For example from +http://gnuwin32.sourceforge.net/packages/diffutils.htm. USING PATCHES *diff-patchexpr* diff --git a/runtime/doc/digraph.txt b/runtime/doc/digraph.txt index 9faecee..ac84091 100644 --- a/runtime/doc/digraph.txt +++ b/runtime/doc/digraph.txt @@ -1,4 +1,4 @@ -*digraph.txt* For Vim version 7.3. Last change: 2010 Apr 11 +*digraph.txt* For Vim version 7.4. Last change: 2011 Jan 15 VIM REFERENCE MANUAL by Bram Moolenaar @@ -40,7 +40,7 @@ Vim is normally compiled with the |+digraphs| feature. If the feature is disabled, the ":digraph" command will display an error message. Example of the output of ":digraphs": > - TH Þ 222 ss ß 223 a! à 224 a' á 225 a> â 226 a? ã 227 a: ä 228 + TH Þ 222 ss ß 223 a! à 224 a' á 225 a> â 226 a? ã 227 a: ä 228 The first two characters in each column are the characters you have to type to enter the digraph. @@ -156,7 +156,7 @@ a standard meaning: Five 5 Hiragana Six 6 Katakana -Example: a: is ä and o: is ö +Example: a: is ä and o: is ö These are the RFC1345 digraphs for the one-byte characters. See the output of ":digraphs" for the others. The characters above 255 are only available when @@ -251,100 +251,1233 @@ $ DO 0x24 36 DOLLAR SIGN ~^ PM 0x9e 158 PRIVACY MESSAGE (PM) ~_ AC 0x9f 159 APPLICATION PROGRAM COMMAND (APC) | NS 0xa0 160 NO-BREAK SPACE -¡ !I 0xa1 161 INVERTED EXCLAMATION MARK -¢ Ct 0xa2 162 CENT SIGN -£ Pd 0xa3 163 POUND SIGN -¤ Cu 0xa4 164 CURRENCY SIGN -¥ Ye 0xa5 165 YEN SIGN -¦ BB 0xa6 166 BROKEN BAR -§ SE 0xa7 167 SECTION SIGN -¨ ': 0xa8 168 DIAERESIS -© Co 0xa9 169 COPYRIGHT SIGN -ª -a 0xaa 170 FEMININE ORDINAL INDICATOR -« << 0xab 171 LEFT-POINTING DOUBLE ANGLE QUOTATION MARK -¬ NO 0xac 172 NOT SIGN -­ -- 0xad 173 SOFT HYPHEN -® Rg 0xae 174 REGISTERED SIGN -¯ 'm 0xaf 175 MACRON -° DG 0xb0 176 DEGREE SIGN -± +- 0xb1 177 PLUS-MINUS SIGN -² 2S 0xb2 178 SUPERSCRIPT TWO -³ 3S 0xb3 179 SUPERSCRIPT THREE -´ '' 0xb4 180 ACUTE ACCENT -µ My 0xb5 181 MICRO SIGN -¶ PI 0xb6 182 PILCROW SIGN -· .M 0xb7 183 MIDDLE DOT -¸ ', 0xb8 184 CEDILLA -¹ 1S 0xb9 185 SUPERSCRIPT ONE -º -o 0xba 186 MASCULINE ORDINAL INDICATOR -» >> 0xbb 187 RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK -¼ 14 0xbc 188 VULGAR FRACTION ONE QUARTER -½ 12 0xbd 189 VULGAR FRACTION ONE HALF -¾ 34 0xbe 190 VULGAR FRACTION THREE QUARTERS -¿ ?I 0xbf 191 INVERTED QUESTION MARK -À A! 0xc0 192 LATIN CAPITAL LETTER A WITH GRAVE -Á A' 0xc1 193 LATIN CAPITAL LETTER A WITH ACUTE - A> 0xc2 194 LATIN CAPITAL LETTER A WITH CIRCUMFLEX -à A? 0xc3 195 LATIN CAPITAL LETTER A WITH TILDE -Ä A: 0xc4 196 LATIN CAPITAL LETTER A WITH DIAERESIS -Å AA 0xc5 197 LATIN CAPITAL LETTER A WITH RING ABOVE -Æ AE 0xc6 198 LATIN CAPITAL LETTER AE -Ç C, 0xc7 199 LATIN CAPITAL LETTER C WITH CEDILLA -È E! 0xc8 200 LATIN CAPITAL LETTER E WITH GRAVE -É E' 0xc9 201 LATIN CAPITAL LETTER E WITH ACUTE -Ê E> 0xca 202 LATIN CAPITAL LETTER E WITH CIRCUMFLEX -Ë E: 0xcb 203 LATIN CAPITAL LETTER E WITH DIAERESIS -Ì I! 0xcc 204 LATIN CAPITAL LETTER I WITH GRAVE -Í I' 0xcd 205 LATIN CAPITAL LETTER I WITH ACUTE -Î I> 0xce 206 LATIN CAPITAL LETTER I WITH CIRCUMFLEX -Ï I: 0xcf 207 LATIN CAPITAL LETTER I WITH DIAERESIS -Ð D- 0xd0 208 LATIN CAPITAL LETTER ETH (Icelandic) -Ñ N? 0xd1 209 LATIN CAPITAL LETTER N WITH TILDE -Ò O! 0xd2 210 LATIN CAPITAL LETTER O WITH GRAVE -Ó O' 0xd3 211 LATIN CAPITAL LETTER O WITH ACUTE -Ô O> 0xd4 212 LATIN CAPITAL LETTER O WITH CIRCUMFLEX -Õ O? 0xd5 213 LATIN CAPITAL LETTER O WITH TILDE -Ö O: 0xd6 214 LATIN CAPITAL LETTER O WITH DIAERESIS -× *X 0xd7 215 MULTIPLICATION SIGN -Ø O/ 0xd8 216 LATIN CAPITAL LETTER O WITH STROKE -Ù U! 0xd9 217 LATIN CAPITAL LETTER U WITH GRAVE -Ú U' 0xda 218 LATIN CAPITAL LETTER U WITH ACUTE -Û U> 0xdb 219 LATIN CAPITAL LETTER U WITH CIRCUMFLEX -Ü U: 0xdc 220 LATIN CAPITAL LETTER U WITH DIAERESIS -Ý Y' 0xdd 221 LATIN CAPITAL LETTER Y WITH ACUTE -Þ TH 0xde 222 LATIN CAPITAL LETTER THORN (Icelandic) -ß ss 0xdf 223 LATIN SMALL LETTER SHARP S (German) -à a! 0xe0 224 LATIN SMALL LETTER A WITH GRAVE -á a' 0xe1 225 LATIN SMALL LETTER A WITH ACUTE -â a> 0xe2 226 LATIN SMALL LETTER A WITH CIRCUMFLEX -ã a? 0xe3 227 LATIN SMALL LETTER A WITH TILDE -ä a: 0xe4 228 LATIN SMALL LETTER A WITH DIAERESIS -å aa 0xe5 229 LATIN SMALL LETTER A WITH RING ABOVE -æ ae 0xe6 230 LATIN SMALL LETTER AE -ç c, 0xe7 231 LATIN SMALL LETTER C WITH CEDILLA -è e! 0xe8 232 LATIN SMALL LETTER E WITH GRAVE -é e' 0xe9 233 LATIN SMALL LETTER E WITH ACUTE -ê e> 0xea 234 LATIN SMALL LETTER E WITH CIRCUMFLEX -ë e: 0xeb 235 LATIN SMALL LETTER E WITH DIAERESIS -ì i! 0xec 236 LATIN SMALL LETTER I WITH GRAVE -í i' 0xed 237 LATIN SMALL LETTER I WITH ACUTE -î i> 0xee 238 LATIN SMALL LETTER I WITH CIRCUMFLEX -ï i: 0xef 239 LATIN SMALL LETTER I WITH DIAERESIS -ð d- 0xf0 240 LATIN SMALL LETTER ETH (Icelandic) -ñ n? 0xf1 241 LATIN SMALL LETTER N WITH TILDE -ò o! 0xf2 242 LATIN SMALL LETTER O WITH GRAVE -ó o' 0xf3 243 LATIN SMALL LETTER O WITH ACUTE -ô o> 0xf4 244 LATIN SMALL LETTER O WITH CIRCUMFLEX -õ o? 0xf5 245 LATIN SMALL LETTER O WITH TILDE -ö o: 0xf6 246 LATIN SMALL LETTER O WITH DIAERESIS -÷ -: 0xf7 247 DIVISION SIGN -ø o/ 0xf8 248 LATIN SMALL LETTER O WITH STROKE -ù u! 0xf9 249 LATIN SMALL LETTER U WITH GRAVE -ú u' 0xfa 250 LATIN SMALL LETTER U WITH ACUTE -û u> 0xfb 251 LATIN SMALL LETTER U WITH CIRCUMFLEX -ü u: 0xfc 252 LATIN SMALL LETTER U WITH DIAERESIS -ý y' 0xfd 253 LATIN SMALL LETTER Y WITH ACUTE -þ th 0xfe 254 LATIN SMALL LETTER THORN (Icelandic) -ÿ y: 0xff 255 LATIN SMALL LETTER Y WITH DIAERESIS +¡ !I 0xa1 161 INVERTED EXCLAMATION MARK +¢ Ct 0xa2 162 CENT SIGN +£ Pd 0xa3 163 POUND SIGN +¤ Cu 0xa4 164 CURRENCY SIGN +Â¥ Ye 0xa5 165 YEN SIGN +¦ BB 0xa6 166 BROKEN BAR +§ SE 0xa7 167 SECTION SIGN +¨ ': 0xa8 168 DIAERESIS +© Co 0xa9 169 COPYRIGHT SIGN +ª -a 0xaa 170 FEMININE ORDINAL INDICATOR +« << 0xab 171 LEFT-POINTING DOUBLE ANGLE QUOTATION MARK +¬ NO 0xac 172 NOT SIGN +­ -- 0xad 173 SOFT HYPHEN +® Rg 0xae 174 REGISTERED SIGN +¯ 'm 0xaf 175 MACRON +° DG 0xb0 176 DEGREE SIGN +± +- 0xb1 177 PLUS-MINUS SIGN +² 2S 0xb2 178 SUPERSCRIPT TWO +³ 3S 0xb3 179 SUPERSCRIPT THREE +´ '' 0xb4 180 ACUTE ACCENT +µ My 0xb5 181 MICRO SIGN +¶ PI 0xb6 182 PILCROW SIGN +· .M 0xb7 183 MIDDLE DOT +¸ ', 0xb8 184 CEDILLA +¹ 1S 0xb9 185 SUPERSCRIPT ONE +º -o 0xba 186 MASCULINE ORDINAL INDICATOR +» >> 0xbb 187 RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK +¼ 14 0xbc 188 VULGAR FRACTION ONE QUARTER +½ 12 0xbd 189 VULGAR FRACTION ONE HALF +¾ 34 0xbe 190 VULGAR FRACTION THREE QUARTERS +¿ ?I 0xbf 191 INVERTED QUESTION MARK +À A! 0xc0 192 LATIN CAPITAL LETTER A WITH GRAVE +Á A' 0xc1 193 LATIN CAPITAL LETTER A WITH ACUTE + A> 0xc2 194 LATIN CAPITAL LETTER A WITH CIRCUMFLEX +à A? 0xc3 195 LATIN CAPITAL LETTER A WITH TILDE +Ä A: 0xc4 196 LATIN CAPITAL LETTER A WITH DIAERESIS +Å AA 0xc5 197 LATIN CAPITAL LETTER A WITH RING ABOVE +Æ AE 0xc6 198 LATIN CAPITAL LETTER AE +Ç C, 0xc7 199 LATIN CAPITAL LETTER C WITH CEDILLA +È E! 0xc8 200 LATIN CAPITAL LETTER E WITH GRAVE +É E' 0xc9 201 LATIN CAPITAL LETTER E WITH ACUTE +Ê E> 0xca 202 LATIN CAPITAL LETTER E WITH CIRCUMFLEX +Ë E: 0xcb 203 LATIN CAPITAL LETTER E WITH DIAERESIS +Ì I! 0xcc 204 LATIN CAPITAL LETTER I WITH GRAVE +Í I' 0xcd 205 LATIN CAPITAL LETTER I WITH ACUTE +Î I> 0xce 206 LATIN CAPITAL LETTER I WITH CIRCUMFLEX +Ï I: 0xcf 207 LATIN CAPITAL LETTER I WITH DIAERESIS +Ð D- 0xd0 208 LATIN CAPITAL LETTER ETH (Icelandic) +Ñ N? 0xd1 209 LATIN CAPITAL LETTER N WITH TILDE +Ò O! 0xd2 210 LATIN CAPITAL LETTER O WITH GRAVE +Ó O' 0xd3 211 LATIN CAPITAL LETTER O WITH ACUTE +Ô O> 0xd4 212 LATIN CAPITAL LETTER O WITH CIRCUMFLEX +Õ O? 0xd5 213 LATIN CAPITAL LETTER O WITH TILDE +Ö O: 0xd6 214 LATIN CAPITAL LETTER O WITH DIAERESIS +× *X 0xd7 215 MULTIPLICATION SIGN +Ø O/ 0xd8 216 LATIN CAPITAL LETTER O WITH STROKE +Ù U! 0xd9 217 LATIN CAPITAL LETTER U WITH GRAVE +Ú U' 0xda 218 LATIN CAPITAL LETTER U WITH ACUTE +Û U> 0xdb 219 LATIN CAPITAL LETTER U WITH CIRCUMFLEX +Ü U: 0xdc 220 LATIN CAPITAL LETTER U WITH DIAERESIS +Ý Y' 0xdd 221 LATIN CAPITAL LETTER Y WITH ACUTE +Þ TH 0xde 222 LATIN CAPITAL LETTER THORN (Icelandic) +ß ss 0xdf 223 LATIN SMALL LETTER SHARP S (German) +à a! 0xe0 224 LATIN SMALL LETTER A WITH GRAVE +á a' 0xe1 225 LATIN SMALL LETTER A WITH ACUTE +â a> 0xe2 226 LATIN SMALL LETTER A WITH CIRCUMFLEX +ã a? 0xe3 227 LATIN SMALL LETTER A WITH TILDE +ä a: 0xe4 228 LATIN SMALL LETTER A WITH DIAERESIS +Ã¥ aa 0xe5 229 LATIN SMALL LETTER A WITH RING ABOVE +æ ae 0xe6 230 LATIN SMALL LETTER AE +ç c, 0xe7 231 LATIN SMALL LETTER C WITH CEDILLA +è e! 0xe8 232 LATIN SMALL LETTER E WITH GRAVE +é e' 0xe9 233 LATIN SMALL LETTER E WITH ACUTE +ê e> 0xea 234 LATIN SMALL LETTER E WITH CIRCUMFLEX +ë e: 0xeb 235 LATIN SMALL LETTER E WITH DIAERESIS +ì i! 0xec 236 LATIN SMALL LETTER I WITH GRAVE +í i' 0xed 237 LATIN SMALL LETTER I WITH ACUTE +î i> 0xee 238 LATIN SMALL LETTER I WITH CIRCUMFLEX +ï i: 0xef 239 LATIN SMALL LETTER I WITH DIAERESIS +ð d- 0xf0 240 LATIN SMALL LETTER ETH (Icelandic) +ñ n? 0xf1 241 LATIN SMALL LETTER N WITH TILDE +ò o! 0xf2 242 LATIN SMALL LETTER O WITH GRAVE +ó o' 0xf3 243 LATIN SMALL LETTER O WITH ACUTE +ô o> 0xf4 244 LATIN SMALL LETTER O WITH CIRCUMFLEX +õ o? 0xf5 245 LATIN SMALL LETTER O WITH TILDE +ö o: 0xf6 246 LATIN SMALL LETTER O WITH DIAERESIS +÷ -: 0xf7 247 DIVISION SIGN +ø o/ 0xf8 248 LATIN SMALL LETTER O WITH STROKE +ù u! 0xf9 249 LATIN SMALL LETTER U WITH GRAVE +ú u' 0xfa 250 LATIN SMALL LETTER U WITH ACUTE +û u> 0xfb 251 LATIN SMALL LETTER U WITH CIRCUMFLEX +ü u: 0xfc 252 LATIN SMALL LETTER U WITH DIAERESIS +ý y' 0xfd 253 LATIN SMALL LETTER Y WITH ACUTE +þ th 0xfe 254 LATIN SMALL LETTER THORN (Icelandic) +ÿ y: 0xff 255 LATIN SMALL LETTER Y WITH DIAERESIS + +If your Vim is compiled with |multibyte| support and you are using a multibyte +'encoding', Vim provides this enhanced set of additional digraphs: + + *digraph-table-mbyte* +char digraph hex dec official name ~ +Ā A- 0100 0256 LATIN CAPITAL LETTER A WITH MACRON +ā a- 0101 0257 LATIN SMALL LETTER A WITH MACRON +Ă A( 0102 0258 LATIN CAPITAL LETTER A WITH BREVE +ă a( 0103 0259 LATIN SMALL LETTER A WITH BREVE +Ą A; 0104 0260 LATIN CAPITAL LETTER A WITH OGONEK +ą a; 0105 0261 LATIN SMALL LETTER A WITH OGONEK +Ć C' 0106 0262 LATIN CAPITAL LETTER C WITH ACUTE +ć c' 0107 0263 LATIN SMALL LETTER C WITH ACUTE +Ĉ C> 0108 0264 LATIN CAPITAL LETTER C WITH CIRCUMFLEX +ĉ c> 0109 0265 LATIN SMALL LETTER C WITH CIRCUMFLEX +Ċ C. 010A 0266 LATIN CAPITAL LETTER C WITH DOT ABOVE +ċ c. 010B 0267 LATIN SMALL LETTER C WITH DOT ABOVE +Č C< 010C 0268 LATIN CAPITAL LETTER C WITH CARON +č c< 010D 0269 LATIN SMALL LETTER C WITH CARON +Ď D< 010E 0270 LATIN CAPITAL LETTER D WITH CARON +ď d< 010F 0271 LATIN SMALL LETTER D WITH CARON +Đ D/ 0110 0272 LATIN CAPITAL LETTER D WITH STROKE +đ d/ 0111 0273 LATIN SMALL LETTER D WITH STROKE +Ē E- 0112 0274 LATIN CAPITAL LETTER E WITH MACRON +ē e- 0113 0275 LATIN SMALL LETTER E WITH MACRON +Ĕ E( 0114 0276 LATIN CAPITAL LETTER E WITH BREVE +ĕ e( 0115 0277 LATIN SMALL LETTER E WITH BREVE +Ė E. 0116 0278 LATIN CAPITAL LETTER E WITH DOT ABOVE +ė e. 0117 0279 LATIN SMALL LETTER E WITH DOT ABOVE +Ę E; 0118 0280 LATIN CAPITAL LETTER E WITH OGONEK +ę e; 0119 0281 LATIN SMALL LETTER E WITH OGONEK +Ě E< 011A 0282 LATIN CAPITAL LETTER E WITH CARON +ě e< 011B 0283 LATIN SMALL LETTER E WITH CARON +Ĝ G> 011C 0284 LATIN CAPITAL LETTER G WITH CIRCUMFLEX +ĝ g> 011D 0285 LATIN SMALL LETTER G WITH CIRCUMFLEX +Ğ G( 011E 0286 LATIN CAPITAL LETTER G WITH BREVE +ğ g( 011F 0287 LATIN SMALL LETTER G WITH BREVE +Ä  G. 0120 0288 LATIN CAPITAL LETTER G WITH DOT ABOVE +Ä¡ g. 0121 0289 LATIN SMALL LETTER G WITH DOT ABOVE +Ä¢ G, 0122 0290 LATIN CAPITAL LETTER G WITH CEDILLA +Ä£ g, 0123 0291 LATIN SMALL LETTER G WITH CEDILLA +Ĥ H> 0124 0292 LATIN CAPITAL LETTER H WITH CIRCUMFLEX +Ä¥ h> 0125 0293 LATIN SMALL LETTER H WITH CIRCUMFLEX +Ħ H/ 0126 0294 LATIN CAPITAL LETTER H WITH STROKE +ħ h/ 0127 0295 LATIN SMALL LETTER H WITH STROKE +Ĩ I? 0128 0296 LATIN CAPITAL LETTER I WITH TILDE +Ä© i? 0129 0297 LATIN SMALL LETTER I WITH TILDE +Ī I- 012A 0298 LATIN CAPITAL LETTER I WITH MACRON +Ä« i- 012B 0299 LATIN SMALL LETTER I WITH MACRON +Ĭ I( 012C 0300 LATIN CAPITAL LETTER I WITH BREVE +Ä­ i( 012D 0301 LATIN SMALL LETTER I WITH BREVE +Ä® I; 012E 0302 LATIN CAPITAL LETTER I WITH OGONEK +į i; 012F 0303 LATIN SMALL LETTER I WITH OGONEK +Ä° I. 0130 0304 LATIN CAPITAL LETTER I WITH DOT ABOVE +ı i. 0131 0305 LATIN SMALL LETTER DOTLESS I +IJ IJ 0132 0306 LATIN CAPITAL LIGATURE IJ +ij ij 0133 0307 LATIN SMALL LIGATURE IJ +Ä´ J> 0134 0308 LATIN CAPITAL LETTER J WITH CIRCUMFLEX +ĵ j> 0135 0309 LATIN SMALL LETTER J WITH CIRCUMFLEX +Ķ K, 0136 0310 LATIN CAPITAL LETTER K WITH CEDILLA +Ä· k, 0137 0311 LATIN SMALL LETTER K WITH CEDILLA +ĸ kk 0138 0312 LATIN SMALL LETTER KRA +Ĺ L' 0139 0313 LATIN CAPITAL LETTER L WITH ACUTE +ĺ l' 013A 0314 LATIN SMALL LETTER L WITH ACUTE +Ä» L, 013B 0315 LATIN CAPITAL LETTER L WITH CEDILLA +ļ l, 013C 0316 LATIN SMALL LETTER L WITH CEDILLA +Ľ L< 013D 0317 LATIN CAPITAL LETTER L WITH CARON +ľ l< 013E 0318 LATIN SMALL LETTER L WITH CARON +Ä¿ L. 013F 0319 LATIN CAPITAL LETTER L WITH MIDDLE DOT +ŀ l. 0140 0320 LATIN SMALL LETTER L WITH MIDDLE DOT +Ł L/ 0141 0321 LATIN CAPITAL LETTER L WITH STROKE +ł l/ 0142 0322 LATIN SMALL LETTER L WITH STROKE +Ń N' 0143 0323 LATIN CAPITAL LETTER N WITH ACUTE ` +ń n' 0144 0324 LATIN SMALL LETTER N WITH ACUTE ` +Ņ N, 0145 0325 LATIN CAPITAL LETTER N WITH CEDILLA ` +ņ n, 0146 0326 LATIN SMALL LETTER N WITH CEDILLA ` +Ň N< 0147 0327 LATIN CAPITAL LETTER N WITH CARON ` +ň n< 0148 0328 LATIN SMALL LETTER N WITH CARON ` +ʼn 'n 0149 0329 LATIN SMALL LETTER N PRECEDED BY APOSTROPHE ` +Ŋ NG 014A 0330 LATIN CAPITAL LETTER ENG +ŋ ng 014B 0331 LATIN SMALL LETTER ENG +Ō O- 014C 0332 LATIN CAPITAL LETTER O WITH MACRON +ō o- 014D 0333 LATIN SMALL LETTER O WITH MACRON +Ŏ O( 014E 0334 LATIN CAPITAL LETTER O WITH BREVE +ŏ o( 014F 0335 LATIN SMALL LETTER O WITH BREVE +Ő O" 0150 0336 LATIN CAPITAL LETTER O WITH DOUBLE ACUTE +ő o" 0151 0337 LATIN SMALL LETTER O WITH DOUBLE ACUTE +Œ OE 0152 0338 LATIN CAPITAL LIGATURE OE +œ oe 0153 0339 LATIN SMALL LIGATURE OE +Ŕ R' 0154 0340 LATIN CAPITAL LETTER R WITH ACUTE +ŕ r' 0155 0341 LATIN SMALL LETTER R WITH ACUTE +Ŗ R, 0156 0342 LATIN CAPITAL LETTER R WITH CEDILLA +ŗ r, 0157 0343 LATIN SMALL LETTER R WITH CEDILLA +Ř R< 0158 0344 LATIN CAPITAL LETTER R WITH CARON +ř r< 0159 0345 LATIN SMALL LETTER R WITH CARON +Ś S' 015A 0346 LATIN CAPITAL LETTER S WITH ACUTE +ś s' 015B 0347 LATIN SMALL LETTER S WITH ACUTE +Ŝ S> 015C 0348 LATIN CAPITAL LETTER S WITH CIRCUMFLEX +ŝ s> 015D 0349 LATIN SMALL LETTER S WITH CIRCUMFLEX +Ş S, 015E 0350 LATIN CAPITAL LETTER S WITH CEDILLA +ş s, 015F 0351 LATIN SMALL LETTER S WITH CEDILLA +Å  S< 0160 0352 LATIN CAPITAL LETTER S WITH CARON +Å¡ s< 0161 0353 LATIN SMALL LETTER S WITH CARON +Å¢ T, 0162 0354 LATIN CAPITAL LETTER T WITH CEDILLA +Å£ t, 0163 0355 LATIN SMALL LETTER T WITH CEDILLA +Ť T< 0164 0356 LATIN CAPITAL LETTER T WITH CARON +Å¥ t< 0165 0357 LATIN SMALL LETTER T WITH CARON +Ŧ T/ 0166 0358 LATIN CAPITAL LETTER T WITH STROKE +ŧ t/ 0167 0359 LATIN SMALL LETTER T WITH STROKE +Ũ U? 0168 0360 LATIN CAPITAL LETTER U WITH TILDE +Å© u? 0169 0361 LATIN SMALL LETTER U WITH TILDE +Ū U- 016A 0362 LATIN CAPITAL LETTER U WITH MACRON +Å« u- 016B 0363 LATIN SMALL LETTER U WITH MACRON +Ŭ U( 016C 0364 LATIN CAPITAL LETTER U WITH BREVE +Å­ u( 016D 0365 LATIN SMALL LETTER U WITH BREVE +Å® U0 016E 0366 LATIN CAPITAL LETTER U WITH RING ABOVE +ů u0 016F 0367 LATIN SMALL LETTER U WITH RING ABOVE +Å° U" 0170 0368 LATIN CAPITAL LETTER U WITH DOUBLE ACUTE +ű u" 0171 0369 LATIN SMALL LETTER U WITH DOUBLE ACUTE +Ų U; 0172 0370 LATIN CAPITAL LETTER U WITH OGONEK +ų u; 0173 0371 LATIN SMALL LETTER U WITH OGONEK +Å´ W> 0174 0372 LATIN CAPITAL LETTER W WITH CIRCUMFLEX +ŵ w> 0175 0373 LATIN SMALL LETTER W WITH CIRCUMFLEX +Ŷ Y> 0176 0374 LATIN CAPITAL LETTER Y WITH CIRCUMFLEX +Å· y> 0177 0375 LATIN SMALL LETTER Y WITH CIRCUMFLEX +Ÿ Y: 0178 0376 LATIN CAPITAL LETTER Y WITH DIAERESIS +Ź Z' 0179 0377 LATIN CAPITAL LETTER Z WITH ACUTE +ź z' 017A 0378 LATIN SMALL LETTER Z WITH ACUTE +Å» Z. 017B 0379 LATIN CAPITAL LETTER Z WITH DOT ABOVE +ż z. 017C 0380 LATIN SMALL LETTER Z WITH DOT ABOVE +Ž Z< 017D 0381 LATIN CAPITAL LETTER Z WITH CARON +ž z< 017E 0382 LATIN SMALL LETTER Z WITH CARON +Æ  O9 01A0 0416 LATIN CAPITAL LETTER O WITH HORN +Æ¡ o9 01A1 0417 LATIN SMALL LETTER O WITH HORN +Æ¢ OI 01A2 0418 LATIN CAPITAL LETTER OI +Æ£ oi 01A3 0419 LATIN SMALL LETTER OI +Ʀ yr 01A6 0422 LATIN LETTER YR +Ư U9 01AF 0431 LATIN CAPITAL LETTER U WITH HORN +Æ° u9 01B0 0432 LATIN SMALL LETTER U WITH HORN +Ƶ Z/ 01B5 0437 LATIN CAPITAL LETTER Z WITH STROKE +ƶ z/ 01B6 0438 LATIN SMALL LETTER Z WITH STROKE +Æ· ED 01B7 0439 LATIN CAPITAL LETTER EZH +Ǎ A< 01CD 0461 LATIN CAPITAL LETTER A WITH CARON +ǎ a< 01CE 0462 LATIN SMALL LETTER A WITH CARON +Ǐ I< 01CF 0463 LATIN CAPITAL LETTER I WITH CARON +ǐ i< 01D0 0464 LATIN SMALL LETTER I WITH CARON +Ǒ O< 01D1 0465 LATIN CAPITAL LETTER O WITH CARON +ǒ o< 01D2 0466 LATIN SMALL LETTER O WITH CARON +Ǔ U< 01D3 0467 LATIN CAPITAL LETTER U WITH CARON +ǔ u< 01D4 0468 LATIN SMALL LETTER U WITH CARON +Ǟ A1 01DE 0478 LATIN CAPITAL LETTER A WITH DIAERESIS AND MACRON +ǟ a1 01DF 0479 LATIN SMALL LETTER A WITH DIAERESIS AND MACRON +Ç  A7 01E0 0480 LATIN CAPITAL LETTER A WITH DOT ABOVE AND MACRON +Ç¡ a7 01E1 0481 LATIN SMALL LETTER A WITH DOT ABOVE AND MACRON +Ç¢ A3 01E2 0482 LATIN CAPITAL LETTER AE WITH MACRON +Ç£ a3 01E3 0483 LATIN SMALL LETTER AE WITH MACRON +Ǥ G/ 01E4 0484 LATIN CAPITAL LETTER G WITH STROKE +Ç¥ g/ 01E5 0485 LATIN SMALL LETTER G WITH STROKE +Ǧ G< 01E6 0486 LATIN CAPITAL LETTER G WITH CARON +ǧ g< 01E7 0487 LATIN SMALL LETTER G WITH CARON +Ǩ K< 01E8 0488 LATIN CAPITAL LETTER K WITH CARON +Ç© k< 01E9 0489 LATIN SMALL LETTER K WITH CARON +Ǫ O; 01EA 0490 LATIN CAPITAL LETTER O WITH OGONEK +Ç« o; 01EB 0491 LATIN SMALL LETTER O WITH OGONEK +Ǭ O1 01EC 0492 LATIN CAPITAL LETTER O WITH OGONEK AND MACRON +Ç­ o1 01ED 0493 LATIN SMALL LETTER O WITH OGONEK AND MACRON +Ç® EZ 01EE 0494 LATIN CAPITAL LETTER EZH WITH CARON +ǯ ez 01EF 0495 LATIN SMALL LETTER EZH WITH CARON +Ç° j< 01F0 0496 LATIN SMALL LETTER J WITH CARON +Ç´ G' 01F4 0500 LATIN CAPITAL LETTER G WITH ACUTE +ǵ g' 01F5 0501 LATIN SMALL LETTER G WITH ACUTE +Ê¿ ;S 02BF 0703 MODIFIER LETTER LEFT HALF RING +ˇ '< 02C7 0711 CARON +˘ '( 02D8 0728 BREVE +˙ '. 02D9 0729 DOT ABOVE +˚ '0 02DA 0730 RING ABOVE +˛ '; 02DB 0731 OGONEK +˝ '" 02DD 0733 DOUBLE ACUTE ACCENT +Ά A% 0386 0902 GREEK CAPITAL LETTER ALPHA WITH TONOS +Έ E% 0388 0904 GREEK CAPITAL LETTER EPSILON WITH TONOS +Ή Y% 0389 0905 GREEK CAPITAL LETTER ETA WITH TONOS +Ί I% 038A 0906 GREEK CAPITAL LETTER IOTA WITH TONOS +Ό O% 038C 0908 GREEK CAPITAL LETTER OMICRON WITH TONOS +Ύ U% 038E 0910 GREEK CAPITAL LETTER UPSILON WITH TONOS +Ώ W% 038F 0911 GREEK CAPITAL LETTER OMEGA WITH TONOS +ΐ i3 0390 0912 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS +Α A* 0391 0913 GREEK CAPITAL LETTER ALPHA +Β B* 0392 0914 GREEK CAPITAL LETTER BETA +Γ G* 0393 0915 GREEK CAPITAL LETTER GAMMA +Δ D* 0394 0916 GREEK CAPITAL LETTER DELTA +Ε E* 0395 0917 GREEK CAPITAL LETTER EPSILON +Ζ Z* 0396 0918 GREEK CAPITAL LETTER ZETA +Η Y* 0397 0919 GREEK CAPITAL LETTER ETA +Θ H* 0398 0920 GREEK CAPITAL LETTER THETA +Ι I* 0399 0921 GREEK CAPITAL LETTER IOTA +Κ K* 039A 0922 GREEK CAPITAL LETTER KAPPA +Λ L* 039B 0923 GREEK CAPITAL LETTER LAMDA +Μ M* 039C 0924 GREEK CAPITAL LETTER MU +Ν N* 039D 0925 GREEK CAPITAL LETTER NU +Ξ C* 039E 0926 GREEK CAPITAL LETTER XI +Ο O* 039F 0927 GREEK CAPITAL LETTER OMICRON +Π P* 03A0 0928 GREEK CAPITAL LETTER PI +Ρ R* 03A1 0929 GREEK CAPITAL LETTER RHO +Σ S* 03A3 0931 GREEK CAPITAL LETTER SIGMA +Τ T* 03A4 0932 GREEK CAPITAL LETTER TAU +Î¥ U* 03A5 0933 GREEK CAPITAL LETTER UPSILON +Φ F* 03A6 0934 GREEK CAPITAL LETTER PHI +Χ X* 03A7 0935 GREEK CAPITAL LETTER CHI +Ψ Q* 03A8 0936 GREEK CAPITAL LETTER PSI +Ω W* 03A9 0937 GREEK CAPITAL LETTER OMEGA +Ϊ J* 03AA 0938 GREEK CAPITAL LETTER IOTA WITH DIALYTIKA +Ϋ V* 03AB 0939 GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA +ά a% 03AC 0940 GREEK SMALL LETTER ALPHA WITH TONOS +έ e% 03AD 0941 GREEK SMALL LETTER EPSILON WITH TONOS +ή y% 03AE 0942 GREEK SMALL LETTER ETA WITH TONOS +ί i% 03AF 0943 GREEK SMALL LETTER IOTA WITH TONOS +ΰ u3 03B0 0944 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS +α a* 03B1 0945 GREEK SMALL LETTER ALPHA +β b* 03B2 0946 GREEK SMALL LETTER BETA +γ g* 03B3 0947 GREEK SMALL LETTER GAMMA +δ d* 03B4 0948 GREEK SMALL LETTER DELTA +ε e* 03B5 0949 GREEK SMALL LETTER EPSILON +ζ z* 03B6 0950 GREEK SMALL LETTER ZETA +η y* 03B7 0951 GREEK SMALL LETTER ETA +θ h* 03B8 0952 GREEK SMALL LETTER THETA +ι i* 03B9 0953 GREEK SMALL LETTER IOTA +κ k* 03BA 0954 GREEK SMALL LETTER KAPPA +λ l* 03BB 0955 GREEK SMALL LETTER LAMDA +μ m* 03BC 0956 GREEK SMALL LETTER MU +ν n* 03BD 0957 GREEK SMALL LETTER NU +ξ c* 03BE 0958 GREEK SMALL LETTER XI +ο o* 03BF 0959 GREEK SMALL LETTER OMICRON +π p* 03C0 0960 GREEK SMALL LETTER PI +ρ r* 03C1 0961 GREEK SMALL LETTER RHO +ς *s 03C2 0962 GREEK SMALL LETTER FINAL SIGMA +σ s* 03C3 0963 GREEK SMALL LETTER SIGMA +τ t* 03C4 0964 GREEK SMALL LETTER TAU +υ u* 03C5 0965 GREEK SMALL LETTER UPSILON +φ f* 03C6 0966 GREEK SMALL LETTER PHI +χ x* 03C7 0967 GREEK SMALL LETTER CHI +ψ q* 03C8 0968 GREEK SMALL LETTER PSI +ω w* 03C9 0969 GREEK SMALL LETTER OMEGA +ϊ j* 03CA 0970 GREEK SMALL LETTER IOTA WITH DIALYTIKA +ϋ v* 03CB 0971 GREEK SMALL LETTER UPSILON WITH DIALYTIKA +ό o% 03CC 0972 GREEK SMALL LETTER OMICRON WITH TONOS +ύ u% 03CD 0973 GREEK SMALL LETTER UPSILON WITH TONOS +ώ w% 03CE 0974 GREEK SMALL LETTER OMEGA WITH TONOS +Ϙ 'G 03D8 0984 GREEK LETTER ARCHAIC KOPPA +ϙ ,G 03D9 0985 GREEK SMALL LETTER ARCHAIC KOPPA +Ϛ T3 03DA 0986 GREEK LETTER STIGMA +ϛ t3 03DB 0987 GREEK SMALL LETTER STIGMA +Ϝ M3 03DC 0988 GREEK LETTER DIGAMMA +ϝ m3 03DD 0989 GREEK SMALL LETTER DIGAMMA +Ϟ K3 03DE 0990 GREEK LETTER KOPPA +ϟ k3 03DF 0991 GREEK SMALL LETTER KOPPA +Ï  P3 03E0 0992 GREEK LETTER SAMPI +Ï¡ p3 03E1 0993 GREEK SMALL LETTER SAMPI +Ï´ '% 03F4 1012 GREEK CAPITAL THETA SYMBOL +ϵ j3 03F5 1013 GREEK LUNATE EPSILON SYMBOL +Ё IO 0401 1025 CYRILLIC CAPITAL LETTER IO +Ђ D% 0402 1026 CYRILLIC CAPITAL LETTER DJE +Ѓ G% 0403 1027 CYRILLIC CAPITAL LETTER GJE +Є IE 0404 1028 CYRILLIC CAPITAL LETTER UKRAINIAN IE +Ѕ DS 0405 1029 CYRILLIC CAPITAL LETTER DZE +І II 0406 1030 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I +Ї YI 0407 1031 CYRILLIC CAPITAL LETTER YI +Ј J% 0408 1032 CYRILLIC CAPITAL LETTER JE +Љ LJ 0409 1033 CYRILLIC CAPITAL LETTER LJE +Њ NJ 040A 1034 CYRILLIC CAPITAL LETTER NJE +Ћ Ts 040B 1035 CYRILLIC CAPITAL LETTER TSHE +Ќ KJ 040C 1036 CYRILLIC CAPITAL LETTER KJE +Ў V% 040E 1038 CYRILLIC CAPITAL LETTER SHORT U +Џ DZ 040F 1039 CYRILLIC CAPITAL LETTER DZHE +А A= 0410 1040 CYRILLIC CAPITAL LETTER A +Б B= 0411 1041 CYRILLIC CAPITAL LETTER BE +В V= 0412 1042 CYRILLIC CAPITAL LETTER VE +Г G= 0413 1043 CYRILLIC CAPITAL LETTER GHE +Д D= 0414 1044 CYRILLIC CAPITAL LETTER DE +Е E= 0415 1045 CYRILLIC CAPITAL LETTER IE +Ж Z% 0416 1046 CYRILLIC CAPITAL LETTER ZHE +З Z= 0417 1047 CYRILLIC CAPITAL LETTER ZE +И I= 0418 1048 CYRILLIC CAPITAL LETTER I +Й J= 0419 1049 CYRILLIC CAPITAL LETTER SHORT I +К K= 041A 1050 CYRILLIC CAPITAL LETTER KA +Л L= 041B 1051 CYRILLIC CAPITAL LETTER EL +М M= 041C 1052 CYRILLIC CAPITAL LETTER EM +Н N= 041D 1053 CYRILLIC CAPITAL LETTER EN +О O= 041E 1054 CYRILLIC CAPITAL LETTER O +П P= 041F 1055 CYRILLIC CAPITAL LETTER PE +Р R= 0420 1056 CYRILLIC CAPITAL LETTER ER +С S= 0421 1057 CYRILLIC CAPITAL LETTER ES +Т T= 0422 1058 CYRILLIC CAPITAL LETTER TE +У U= 0423 1059 CYRILLIC CAPITAL LETTER U +Ф F= 0424 1060 CYRILLIC CAPITAL LETTER EF +Ð¥ H= 0425 1061 CYRILLIC CAPITAL LETTER HA +Ц C= 0426 1062 CYRILLIC CAPITAL LETTER TSE +Ч C% 0427 1063 CYRILLIC CAPITAL LETTER CHE +Ш S% 0428 1064 CYRILLIC CAPITAL LETTER SHA +Щ Sc 0429 1065 CYRILLIC CAPITAL LETTER SHCHA +Ъ =" 042A 1066 CYRILLIC CAPITAL LETTER HARD SIGN +Ы Y= 042B 1067 CYRILLIC CAPITAL LETTER YERU +Ь %" 042C 1068 CYRILLIC CAPITAL LETTER SOFT SIGN +Э JE 042D 1069 CYRILLIC CAPITAL LETTER E +Ю JU 042E 1070 CYRILLIC CAPITAL LETTER YU +Я JA 042F 1071 CYRILLIC CAPITAL LETTER YA +а a= 0430 1072 CYRILLIC SMALL LETTER A +б b= 0431 1073 CYRILLIC SMALL LETTER BE +в v= 0432 1074 CYRILLIC SMALL LETTER VE +г g= 0433 1075 CYRILLIC SMALL LETTER GHE +д d= 0434 1076 CYRILLIC SMALL LETTER DE +е e= 0435 1077 CYRILLIC SMALL LETTER IE +ж z% 0436 1078 CYRILLIC SMALL LETTER ZHE +з z= 0437 1079 CYRILLIC SMALL LETTER ZE +и i= 0438 1080 CYRILLIC SMALL LETTER I +й j= 0439 1081 CYRILLIC SMALL LETTER SHORT I +к k= 043A 1082 CYRILLIC SMALL LETTER KA +л l= 043B 1083 CYRILLIC SMALL LETTER EL +м m= 043C 1084 CYRILLIC SMALL LETTER EM +н n= 043D 1085 CYRILLIC SMALL LETTER EN +о o= 043E 1086 CYRILLIC SMALL LETTER O +п p= 043F 1087 CYRILLIC SMALL LETTER PE +р r= 0440 1088 CYRILLIC SMALL LETTER ER +с s= 0441 1089 CYRILLIC SMALL LETTER ES +т t= 0442 1090 CYRILLIC SMALL LETTER TE +у u= 0443 1091 CYRILLIC SMALL LETTER U +ф f= 0444 1092 CYRILLIC SMALL LETTER EF +х h= 0445 1093 CYRILLIC SMALL LETTER HA +ц c= 0446 1094 CYRILLIC SMALL LETTER TSE +ч c% 0447 1095 CYRILLIC SMALL LETTER CHE +ш s% 0448 1096 CYRILLIC SMALL LETTER SHA +щ sc 0449 1097 CYRILLIC SMALL LETTER SHCHA +ъ =' 044A 1098 CYRILLIC SMALL LETTER HARD SIGN +ы y= 044B 1099 CYRILLIC SMALL LETTER YERU +ь %' 044C 1100 CYRILLIC SMALL LETTER SOFT SIGN +э je 044D 1101 CYRILLIC SMALL LETTER E +ю ju 044E 1102 CYRILLIC SMALL LETTER YU +я ja 044F 1103 CYRILLIC SMALL LETTER YA +ё io 0451 1105 CYRILLIC SMALL LETTER IO +ђ d% 0452 1106 CYRILLIC SMALL LETTER DJE +ѓ g% 0453 1107 CYRILLIC SMALL LETTER GJE +є ie 0454 1108 CYRILLIC SMALL LETTER UKRAINIAN IE +ѕ ds 0455 1109 CYRILLIC SMALL LETTER DZE +і ii 0456 1110 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I +ї yi 0457 1111 CYRILLIC SMALL LETTER YI +ј j% 0458 1112 CYRILLIC SMALL LETTER JE +љ lj 0459 1113 CYRILLIC SMALL LETTER LJE +њ nj 045A 1114 CYRILLIC SMALL LETTER NJE +ћ ts 045B 1115 CYRILLIC SMALL LETTER TSHE +ќ kj 045C 1116 CYRILLIC SMALL LETTER KJE +ў v% 045E 1118 CYRILLIC SMALL LETTER SHORT U +џ dz 045F 1119 CYRILLIC SMALL LETTER DZHE +Ñ¢ Y3 0462 1122 CYRILLIC CAPITAL LETTER YAT +Ñ£ y3 0463 1123 CYRILLIC SMALL LETTER YAT +Ѫ O3 046A 1130 CYRILLIC CAPITAL LETTER BIG YUS +Ñ« o3 046B 1131 CYRILLIC SMALL LETTER BIG YUS +Ѳ F3 0472 1138 CYRILLIC CAPITAL LETTER FITA +ѳ f3 0473 1139 CYRILLIC SMALL LETTER FITA +Ñ´ V3 0474 1140 CYRILLIC CAPITAL LETTER IZHITSA +ѵ v3 0475 1141 CYRILLIC SMALL LETTER IZHITSA +Ҁ C3 0480 1152 CYRILLIC CAPITAL LETTER KOPPA +ҁ c3 0481 1153 CYRILLIC SMALL LETTER KOPPA +Ґ G3 0490 1168 CYRILLIC CAPITAL LETTER GHE WITH UPTURN +ґ g3 0491 1169 CYRILLIC SMALL LETTER GHE WITH UPTURN +א A+ 05D0 1488 HEBREW LETTER ALEF +ב B+ 05D1 1489 HEBREW LETTER BET +ג G+ 05D2 1490 HEBREW LETTER GIMEL +ד D+ 05D3 1491 HEBREW LETTER DALET +ה H+ 05D4 1492 HEBREW LETTER HE +ו W+ 05D5 1493 HEBREW LETTER VAV +ז Z+ 05D6 1494 HEBREW LETTER ZAYIN +ח X+ 05D7 1495 HEBREW LETTER HET +ט Tj 05D8 1496 HEBREW LETTER TET +י J+ 05D9 1497 HEBREW LETTER YOD +ך K% 05DA 1498 HEBREW LETTER FINAL KAF +כ K+ 05DB 1499 HEBREW LETTER KAF +ל L+ 05DC 1500 HEBREW LETTER LAMED +ם M% 05DD 1501 HEBREW LETTER FINAL MEM +מ M+ 05DE 1502 HEBREW LETTER MEM +ן N% 05DF 1503 HEBREW LETTER FINAL NUN ` +×  N+ 05E0 1504 HEBREW LETTER NUN ` +ס S+ 05E1 1505 HEBREW LETTER SAMEKH +×¢ E+ 05E2 1506 HEBREW LETTER AYIN +×£ P% 05E3 1507 HEBREW LETTER FINAL PE +פ P+ 05E4 1508 HEBREW LETTER PE +×¥ Zj 05E5 1509 HEBREW LETTER FINAL TSADI +צ ZJ 05E6 1510 HEBREW LETTER TSADI +ק Q+ 05E7 1511 HEBREW LETTER QOF +ר R+ 05E8 1512 HEBREW LETTER RESH +ש Sh 05E9 1513 HEBREW LETTER SHIN +ת T+ 05EA 1514 HEBREW LETTER TAV +، ,+ 060C 1548 ARABIC COMMA +؛ ;+ 061B 1563 ARABIC SEMICOLON +؟ ?+ 061F 1567 ARABIC QUESTION MARK +Ø¡ H' 0621 1569 ARABIC LETTER HAMZA +Ø¢ aM 0622 1570 ARABIC LETTER ALEF WITH MADDA ABOVE +Ø£ aH 0623 1571 ARABIC LETTER ALEF WITH HAMZA ABOVE +ؤ wH 0624 1572 ARABIC LETTER WAW WITH HAMZA ABOVE +Ø¥ ah 0625 1573 ARABIC LETTER ALEF WITH HAMZA BELOW +ئ yH 0626 1574 ARABIC LETTER YEH WITH HAMZA ABOVE +ا a+ 0627 1575 ARABIC LETTER ALEF +ب b+ 0628 1576 ARABIC LETTER BEH +Ø© tm 0629 1577 ARABIC LETTER TEH MARBUTA +ت t+ 062A 1578 ARABIC LETTER TEH +Ø« tk 062B 1579 ARABIC LETTER THEH +ج g+ 062C 1580 ARABIC LETTER JEEM +Ø­ hk 062D 1581 ARABIC LETTER HAH +Ø® x+ 062E 1582 ARABIC LETTER KHAH +د d+ 062F 1583 ARABIC LETTER DAL +Ø° dk 0630 1584 ARABIC LETTER THAL +ر r+ 0631 1585 ARABIC LETTER REH +ز z+ 0632 1586 ARABIC LETTER ZAIN +س s+ 0633 1587 ARABIC LETTER SEEN +Ø´ sn 0634 1588 ARABIC LETTER SHEEN +ص c+ 0635 1589 ARABIC LETTER SAD +ض dd 0636 1590 ARABIC LETTER DAD +Ø· tj 0637 1591 ARABIC LETTER TAH +ظ zH 0638 1592 ARABIC LETTER ZAH +ع e+ 0639 1593 ARABIC LETTER AIN +غ i+ 063A 1594 ARABIC LETTER GHAIN +ـ ++ 0640 1600 ARABIC TATWEEL +ف f+ 0641 1601 ARABIC LETTER FEH +ق q+ 0642 1602 ARABIC LETTER QAF +ك k+ 0643 1603 ARABIC LETTER KAF +ل l+ 0644 1604 ARABIC LETTER LAM +م m+ 0645 1605 ARABIC LETTER MEEM +ن n+ 0646 1606 ARABIC LETTER NOON +ه h+ 0647 1607 ARABIC LETTER HEH +و w+ 0648 1608 ARABIC LETTER WAW +ى j+ 0649 1609 ARABIC LETTER ALEF MAKSURA +ي y+ 064A 1610 ARABIC LETTER YEH +ً :+ 064B 1611 ARABIC FATHATAN +ٌ "+ 064C 1612 ARABIC DAMMATAN +ٍ =+ 064D 1613 ARABIC KASRATAN +َ /+ 064E 1614 ARABIC FATHA +ُ '+ 064F 1615 ARABIC DAMMA +ِ 1+ 0650 1616 ARABIC KASRA +ّ 3+ 0651 1617 ARABIC SHADDA +ْ 0+ 0652 1618 ARABIC SUKUN +Ù° aS 0670 1648 ARABIC LETTER SUPERSCRIPT ALEF +Ù¾ p+ 067E 1662 ARABIC LETTER PEH +Ú¤ v+ 06A4 1700 ARABIC LETTER VEH +Ú¯ gf 06AF 1711 ARABIC LETTER GAF +Û° 0a 06F0 1776 EXTENDED ARABIC-INDIC DIGIT ZERO +Û± 1a 06F1 1777 EXTENDED ARABIC-INDIC DIGIT ONE +Û² 2a 06F2 1778 EXTENDED ARABIC-INDIC DIGIT TWO +Û³ 3a 06F3 1779 EXTENDED ARABIC-INDIC DIGIT THREE +Û´ 4a 06F4 1780 EXTENDED ARABIC-INDIC DIGIT FOUR +Ûµ 5a 06F5 1781 EXTENDED ARABIC-INDIC DIGIT FIVE +Û¶ 6a 06F6 1782 EXTENDED ARABIC-INDIC DIGIT SIX +Û· 7a 06F7 1783 EXTENDED ARABIC-INDIC DIGIT SEVEN +Û¸ 8a 06F8 1784 EXTENDED ARABIC-INDIC DIGIT EIGHT +Û¹ 9a 06F9 1785 EXTENDED ARABIC-INDIC DIGIT NINE +Ḃ B. 1E02 7682 LATIN CAPITAL LETTER B WITH DOT ABOVE +ḃ b. 1E03 7683 LATIN SMALL LETTER B WITH DOT ABOVE +Ḇ B_ 1E06 7686 LATIN CAPITAL LETTER B WITH LINE BELOW +ḇ b_ 1E07 7687 LATIN SMALL LETTER B WITH LINE BELOW +Ḋ D. 1E0A 7690 LATIN CAPITAL LETTER D WITH DOT ABOVE +ḋ d. 1E0B 7691 LATIN SMALL LETTER D WITH DOT ABOVE +Ḏ D_ 1E0E 7694 LATIN CAPITAL LETTER D WITH LINE BELOW +ḏ d_ 1E0F 7695 LATIN SMALL LETTER D WITH LINE BELOW +Ḑ D, 1E10 7696 LATIN CAPITAL LETTER D WITH CEDILLA +ḑ d, 1E11 7697 LATIN SMALL LETTER D WITH CEDILLA +Ḟ F. 1E1E 7710 LATIN CAPITAL LETTER F WITH DOT ABOVE +ḟ f. 1E1F 7711 LATIN SMALL LETTER F WITH DOT ABOVE +Ḡ G- 1E20 7712 LATIN CAPITAL LETTER G WITH MACRON +ḡ g- 1E21 7713 LATIN SMALL LETTER G WITH MACRON +Ḣ H. 1E22 7714 LATIN CAPITAL LETTER H WITH DOT ABOVE +ḣ h. 1E23 7715 LATIN SMALL LETTER H WITH DOT ABOVE +Ḧ H: 1E26 7718 LATIN CAPITAL LETTER H WITH DIAERESIS +ḧ h: 1E27 7719 LATIN SMALL LETTER H WITH DIAERESIS +Ḩ H, 1E28 7720 LATIN CAPITAL LETTER H WITH CEDILLA +ḩ h, 1E29 7721 LATIN SMALL LETTER H WITH CEDILLA +Ḱ K' 1E30 7728 LATIN CAPITAL LETTER K WITH ACUTE +ḱ k' 1E31 7729 LATIN SMALL LETTER K WITH ACUTE +Ḵ K_ 1E34 7732 LATIN CAPITAL LETTER K WITH LINE BELOW +ḵ k_ 1E35 7733 LATIN SMALL LETTER K WITH LINE BELOW +Ḻ L_ 1E3A 7738 LATIN CAPITAL LETTER L WITH LINE BELOW +ḻ l_ 1E3B 7739 LATIN SMALL LETTER L WITH LINE BELOW +Ḿ M' 1E3E 7742 LATIN CAPITAL LETTER M WITH ACUTE +ḿ m' 1E3F 7743 LATIN SMALL LETTER M WITH ACUTE +Ṁ M. 1E40 7744 LATIN CAPITAL LETTER M WITH DOT ABOVE +ṁ m. 1E41 7745 LATIN SMALL LETTER M WITH DOT ABOVE +Ṅ N. 1E44 7748 LATIN CAPITAL LETTER N WITH DOT ABOVE ` +ṅ n. 1E45 7749 LATIN SMALL LETTER N WITH DOT ABOVE ` +Ṉ N_ 1E48 7752 LATIN CAPITAL LETTER N WITH LINE BELOW ` +ṉ n_ 1E49 7753 LATIN SMALL LETTER N WITH LINE BELOW ` +Ṕ P' 1E54 7764 LATIN CAPITAL LETTER P WITH ACUTE +ṕ p' 1E55 7765 LATIN SMALL LETTER P WITH ACUTE +Ṗ P. 1E56 7766 LATIN CAPITAL LETTER P WITH DOT ABOVE +ṗ p. 1E57 7767 LATIN SMALL LETTER P WITH DOT ABOVE +Ṙ R. 1E58 7768 LATIN CAPITAL LETTER R WITH DOT ABOVE +ṙ r. 1E59 7769 LATIN SMALL LETTER R WITH DOT ABOVE +Ṟ R_ 1E5E 7774 LATIN CAPITAL LETTER R WITH LINE BELOW +ṟ r_ 1E5F 7775 LATIN SMALL LETTER R WITH LINE BELOW +á¹  S. 1E60 7776 LATIN CAPITAL LETTER S WITH DOT ABOVE +ṡ s. 1E61 7777 LATIN SMALL LETTER S WITH DOT ABOVE +Ṫ T. 1E6A 7786 LATIN CAPITAL LETTER T WITH DOT ABOVE +ṫ t. 1E6B 7787 LATIN SMALL LETTER T WITH DOT ABOVE +á¹® T_ 1E6E 7790 LATIN CAPITAL LETTER T WITH LINE BELOW +ṯ t_ 1E6F 7791 LATIN SMALL LETTER T WITH LINE BELOW +á¹¼ V? 1E7C 7804 LATIN CAPITAL LETTER V WITH TILDE +á¹½ v? 1E7D 7805 LATIN SMALL LETTER V WITH TILDE +Ẁ W! 1E80 7808 LATIN CAPITAL LETTER W WITH GRAVE +ẁ w! 1E81 7809 LATIN SMALL LETTER W WITH GRAVE +Ẃ W' 1E82 7810 LATIN CAPITAL LETTER W WITH ACUTE +ẃ w' 1E83 7811 LATIN SMALL LETTER W WITH ACUTE +Ẅ W: 1E84 7812 LATIN CAPITAL LETTER W WITH DIAERESIS +ẅ w: 1E85 7813 LATIN SMALL LETTER W WITH DIAERESIS +Ẇ W. 1E86 7814 LATIN CAPITAL LETTER W WITH DOT ABOVE +ẇ w. 1E87 7815 LATIN SMALL LETTER W WITH DOT ABOVE +Ẋ X. 1E8A 7818 LATIN CAPITAL LETTER X WITH DOT ABOVE +ẋ x. 1E8B 7819 LATIN SMALL LETTER X WITH DOT ABOVE +Ẍ X: 1E8C 7820 LATIN CAPITAL LETTER X WITH DIAERESIS +ẍ x: 1E8D 7821 LATIN SMALL LETTER X WITH DIAERESIS +Ẏ Y. 1E8E 7822 LATIN CAPITAL LETTER Y WITH DOT ABOVE +ẏ y. 1E8F 7823 LATIN SMALL LETTER Y WITH DOT ABOVE +Ẑ Z> 1E90 7824 LATIN CAPITAL LETTER Z WITH CIRCUMFLEX +ẑ z> 1E91 7825 LATIN SMALL LETTER Z WITH CIRCUMFLEX +Ẕ Z_ 1E94 7828 LATIN CAPITAL LETTER Z WITH LINE BELOW +ẕ z_ 1E95 7829 LATIN SMALL LETTER Z WITH LINE BELOW +ẖ h_ 1E96 7830 LATIN SMALL LETTER H WITH LINE BELOW +ẗ t: 1E97 7831 LATIN SMALL LETTER T WITH DIAERESIS +ẘ w0 1E98 7832 LATIN SMALL LETTER W WITH RING ABOVE +ẙ y0 1E99 7833 LATIN SMALL LETTER Y WITH RING ABOVE +Ả A2 1EA2 7842 LATIN CAPITAL LETTER A WITH HOOK ABOVE +ả a2 1EA3 7843 LATIN SMALL LETTER A WITH HOOK ABOVE +Ẻ E2 1EBA 7866 LATIN CAPITAL LETTER E WITH HOOK ABOVE +ẻ e2 1EBB 7867 LATIN SMALL LETTER E WITH HOOK ABOVE +Ẽ E? 1EBC 7868 LATIN CAPITAL LETTER E WITH TILDE +ẽ e? 1EBD 7869 LATIN SMALL LETTER E WITH TILDE +Ỉ I2 1EC8 7880 LATIN CAPITAL LETTER I WITH HOOK ABOVE +ỉ i2 1EC9 7881 LATIN SMALL LETTER I WITH HOOK ABOVE +Ỏ O2 1ECE 7886 LATIN CAPITAL LETTER O WITH HOOK ABOVE +ỏ o2 1ECF 7887 LATIN SMALL LETTER O WITH HOOK ABOVE +Ủ U2 1EE6 7910 LATIN CAPITAL LETTER U WITH HOOK ABOVE +ủ u2 1EE7 7911 LATIN SMALL LETTER U WITH HOOK ABOVE +Ỳ Y! 1EF2 7922 LATIN CAPITAL LETTER Y WITH GRAVE +ỳ y! 1EF3 7923 LATIN SMALL LETTER Y WITH GRAVE +Ỷ Y2 1EF6 7926 LATIN CAPITAL LETTER Y WITH HOOK ABOVE +á»· y2 1EF7 7927 LATIN SMALL LETTER Y WITH HOOK ABOVE +Ỹ Y? 1EF8 7928 LATIN CAPITAL LETTER Y WITH TILDE +ỹ y? 1EF9 7929 LATIN SMALL LETTER Y WITH TILDE +ἀ ;' 1F00 7936 GREEK SMALL LETTER ALPHA WITH PSILI +ἁ ,' 1F01 7937 GREEK SMALL LETTER ALPHA WITH DASIA +ἂ ;! 1F02 7938 GREEK SMALL LETTER ALPHA WITH PSILI AND VARIA +ἃ ,! 1F03 7939 GREEK SMALL LETTER ALPHA WITH DASIA AND VARIA +ἄ ?; 1F04 7940 GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA +ἅ ?, 1F05 7941 GREEK SMALL LETTER ALPHA WITH DASIA AND OXIA +ἆ !: 1F06 7942 GREEK SMALL LETTER ALPHA WITH PSILI AND PERISPOMENI +ἇ ?: 1F07 7943 GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI +  1N 2002 8194 EN SPACE +  1M 2003 8195 EM SPACE +  3M 2004 8196 THREE-PER-EM SPACE +  4M 2005 8197 FOUR-PER-EM SPACE +  6M 2006 8198 SIX-PER-EM SPACE +  1T 2009 8201 THIN SPACE +  1H 200A 8202 HAIR SPACE +‐ -1 2010 8208 HYPHEN +– -N 2013 8211 EN DASH ` +— -M 2014 8212 EM DASH +― -3 2015 8213 HORIZONTAL BAR +‖ !2 2016 8214 DOUBLE VERTICAL LINE +‗ =2 2017 8215 DOUBLE LOW LINE +‘ '6 2018 8216 LEFT SINGLE QUOTATION MARK +’ '9 2019 8217 RIGHT SINGLE QUOTATION MARK +‚ .9 201A 8218 SINGLE LOW-9 QUOTATION MARK +‛ 9' 201B 8219 SINGLE HIGH-REVERSED-9 QUOTATION MARK +“ "6 201C 8220 LEFT DOUBLE QUOTATION MARK +” "9 201D 8221 RIGHT DOUBLE QUOTATION MARK +„ :9 201E 8222 DOUBLE LOW-9 QUOTATION MARK +‟ 9" 201F 8223 DOUBLE HIGH-REVERSED-9 QUOTATION MARK +† /- 2020 8224 DAGGER +‡ /= 2021 8225 DOUBLE DAGGER +‥ .. 2025 8229 TWO DOT LEADER +‰ %0 2030 8240 PER MILLE SIGN +′ 1' 2032 8242 PRIME +″ 2' 2033 8243 DOUBLE PRIME +‴ 3' 2034 8244 TRIPLE PRIME +‵ 1" 2035 8245 REVERSED PRIME +‶ 2" 2036 8246 REVERSED DOUBLE PRIME +‷ 3" 2037 8247 REVERSED TRIPLE PRIME +‸ Ca 2038 8248 CARET +‹ <1 2039 8249 SINGLE LEFT-POINTING ANGLE QUOTATION MARK +› >1 203A 8250 SINGLE RIGHT-POINTING ANGLE QUOTATION MARK +※ :X 203B 8251 REFERENCE MARK +‾ '- 203E 8254 OVERLINE +⁄ /f 2044 8260 FRACTION SLASH +⁰ 0S 2070 8304 SUPERSCRIPT ZERO +⁴ 4S 2074 8308 SUPERSCRIPT FOUR +⁵ 5S 2075 8309 SUPERSCRIPT FIVE +⁶ 6S 2076 8310 SUPERSCRIPT SIX +⁷ 7S 2077 8311 SUPERSCRIPT SEVEN +⁸ 8S 2078 8312 SUPERSCRIPT EIGHT +⁹ 9S 2079 8313 SUPERSCRIPT NINE +⁺ +S 207A 8314 SUPERSCRIPT PLUS SIGN +⁻ -S 207B 8315 SUPERSCRIPT MINUS +⁼ =S 207C 8316 SUPERSCRIPT EQUALS SIGN +⁽ (S 207D 8317 SUPERSCRIPT LEFT PARENTHESIS +⁾ )S 207E 8318 SUPERSCRIPT RIGHT PARENTHESIS +ⁿ nS 207F 8319 SUPERSCRIPT LATIN SMALL LETTER N ` +₀ 0s 2080 8320 SUBSCRIPT ZERO +₁ 1s 2081 8321 SUBSCRIPT ONE +₂ 2s 2082 8322 SUBSCRIPT TWO +₃ 3s 2083 8323 SUBSCRIPT THREE +₄ 4s 2084 8324 SUBSCRIPT FOUR +₅ 5s 2085 8325 SUBSCRIPT FIVE +₆ 6s 2086 8326 SUBSCRIPT SIX +₇ 7s 2087 8327 SUBSCRIPT SEVEN +₈ 8s 2088 8328 SUBSCRIPT EIGHT +₉ 9s 2089 8329 SUBSCRIPT NINE +₊ +s 208A 8330 SUBSCRIPT PLUS SIGN +₋ -s 208B 8331 SUBSCRIPT MINUS +₌ =s 208C 8332 SUBSCRIPT EQUALS SIGN +₍ (s 208D 8333 SUBSCRIPT LEFT PARENTHESIS +₎ )s 208E 8334 SUBSCRIPT RIGHT PARENTHESIS +₤ Li 20A4 8356 LIRA SIGN +₧ Pt 20A7 8359 PESETA SIGN +₩ W= 20A9 8361 WON SIGN +€ Eu 20AC 8364 EURO SIGN +℃ oC 2103 8451 DEGREE CELSIUS +℅ co 2105 8453 CARE OF +℉ oF 2109 8457 DEGREE FAHRENHEIT +№ N0 2116 8470 NUMERO SIGN +℗ PO 2117 8471 SOUND RECORDING COPYRIGHT +℞ Rx 211E 8478 PRESCRIPTION TAKE +℠ SM 2120 8480 SERVICE MARK +™ TM 2122 8482 TRADE MARK SIGN +Ω Om 2126 8486 OHM SIGN +Å AO 212B 8491 ANGSTROM SIGN +⅓ 13 2153 8531 VULGAR FRACTION ONE THIRD +⅔ 23 2154 8532 VULGAR FRACTION TWO THIRDS +⅕ 15 2155 8533 VULGAR FRACTION ONE FIFTH +⅖ 25 2156 8534 VULGAR FRACTION TWO FIFTHS +⅗ 35 2157 8535 VULGAR FRACTION THREE FIFTHS +⅘ 45 2158 8536 VULGAR FRACTION FOUR FIFTHS +⅙ 16 2159 8537 VULGAR FRACTION ONE SIXTH +⅚ 56 215A 8538 VULGAR FRACTION FIVE SIXTHS +⅛ 18 215B 8539 VULGAR FRACTION ONE EIGHTH +⅜ 38 215C 8540 VULGAR FRACTION THREE EIGHTHS +⅝ 58 215D 8541 VULGAR FRACTION FIVE EIGHTHS +⅞ 78 215E 8542 VULGAR FRACTION SEVEN EIGHTHS +Ⅰ 1R 2160 8544 ROMAN NUMERAL ONE +Ⅱ 2R 2161 8545 ROMAN NUMERAL TWO +Ⅲ 3R 2162 8546 ROMAN NUMERAL THREE +Ⅳ 4R 2163 8547 ROMAN NUMERAL FOUR +Ⅴ 5R 2164 8548 ROMAN NUMERAL FIVE +Ⅵ 6R 2165 8549 ROMAN NUMERAL SIX +Ⅶ 7R 2166 8550 ROMAN NUMERAL SEVEN +Ⅷ 8R 2167 8551 ROMAN NUMERAL EIGHT +Ⅸ 9R 2168 8552 ROMAN NUMERAL NINE +Ⅹ aR 2169 8553 ROMAN NUMERAL TEN +Ⅺ bR 216A 8554 ROMAN NUMERAL ELEVEN +Ⅻ cR 216B 8555 ROMAN NUMERAL TWELVE +ⅰ 1r 2170 8560 SMALL ROMAN NUMERAL ONE +ⅱ 2r 2171 8561 SMALL ROMAN NUMERAL TWO +ⅲ 3r 2172 8562 SMALL ROMAN NUMERAL THREE +ⅳ 4r 2173 8563 SMALL ROMAN NUMERAL FOUR +ⅴ 5r 2174 8564 SMALL ROMAN NUMERAL FIVE +ⅵ 6r 2175 8565 SMALL ROMAN NUMERAL SIX +ⅶ 7r 2176 8566 SMALL ROMAN NUMERAL SEVEN +ⅷ 8r 2177 8567 SMALL ROMAN NUMERAL EIGHT +ⅸ 9r 2178 8568 SMALL ROMAN NUMERAL NINE +ⅹ ar 2179 8569 SMALL ROMAN NUMERAL TEN +ⅺ br 217A 8570 SMALL ROMAN NUMERAL ELEVEN +ⅻ cr 217B 8571 SMALL ROMAN NUMERAL TWELVE +← <- 2190 8592 LEFTWARDS ARROW +↑ -! 2191 8593 UPWARDS ARROW +→ -> 2192 8594 RIGHTWARDS ARROW +↓ -v 2193 8595 DOWNWARDS ARROW +↔ <> 2194 8596 LEFT RIGHT ARROW +↕ UD 2195 8597 UP DOWN ARROW +⇐ <= 21D0 8656 LEFTWARDS DOUBLE ARROW +⇒ => 21D2 8658 RIGHTWARDS DOUBLE ARROW +⇔ == 21D4 8660 LEFT RIGHT DOUBLE ARROW +∀ FA 2200 8704 FOR ALL +∂ dP 2202 8706 PARTIAL DIFFERENTIAL +∃ TE 2203 8707 THERE EXISTS +∅ /0 2205 8709 EMPTY SET +∆ DE 2206 8710 INCREMENT +∇ NB 2207 8711 NABLA +∈ (- 2208 8712 ELEMENT OF +∋ -) 220B 8715 CONTAINS AS MEMBER +∏ *P 220F 8719 N-ARY PRODUCT ` +∑ +Z 2211 8721 N-ARY SUMMATION ` +− -2 2212 8722 MINUS SIGN +∓ -+ 2213 8723 MINUS-OR-PLUS SIGN +∗ *- 2217 8727 ASTERISK OPERATOR +∘ Ob 2218 8728 RING OPERATOR +∙ Sb 2219 8729 BULLET OPERATOR +√ RT 221A 8730 SQUARE ROOT +∝ 0( 221D 8733 PROPORTIONAL TO +∞ 00 221E 8734 INFINITY +∟ -L 221F 8735 RIGHT ANGLE +∠ -V 2220 8736 ANGLE +∥ PP 2225 8741 PARALLEL TO +∧ AN 2227 8743 LOGICAL AND +∨ OR 2228 8744 LOGICAL OR +∩ (U 2229 8745 INTERSECTION +∪ )U 222A 8746 UNION +∫ In 222B 8747 INTEGRAL +∬ DI 222C 8748 DOUBLE INTEGRAL +∮ Io 222E 8750 CONTOUR INTEGRAL +∴ .: 2234 8756 THEREFORE +∵ :. 2235 8757 BECAUSE +∶ :R 2236 8758 RATIO +∷ :: 2237 8759 PROPORTION +∼ ?1 223C 8764 TILDE OPERATOR +∾ CG 223E 8766 INVERTED LAZY S +≃ ?- 2243 8771 ASYMPTOTICALLY EQUAL TO +≅ ?= 2245 8773 APPROXIMATELY EQUAL TO +≈ ?2 2248 8776 ALMOST EQUAL TO +≌ =? 224C 8780 ALL EQUAL TO +≓ HI 2253 8787 IMAGE OF OR APPROXIMATELY EQUAL TO +≠ != 2260 8800 NOT EQUAL TO +≡ =3 2261 8801 IDENTICAL TO +≤ =< 2264 8804 LESS-THAN OR EQUAL TO +≥ >= 2265 8805 GREATER-THAN OR EQUAL TO +≪ <* 226A 8810 MUCH LESS-THAN +≫ *> 226B 8811 MUCH GREATER-THAN +≮ !< 226E 8814 NOT LESS-THAN +≯ !> 226F 8815 NOT GREATER-THAN +⊂ (C 2282 8834 SUBSET OF +⊃ )C 2283 8835 SUPERSET OF +⊆ (_ 2286 8838 SUBSET OF OR EQUAL TO +⊇ )_ 2287 8839 SUPERSET OF OR EQUAL TO +⊙ 0. 2299 8857 CIRCLED DOT OPERATOR +⊚ 02 229A 8858 CIRCLED RING OPERATOR +⊥ -T 22A5 8869 UP TACK +⋅ .P 22C5 8901 DOT OPERATOR +⋮ :3 22EE 8942 VERTICAL ELLIPSIS +⋯ .3 22EF 8943 MIDLINE HORIZONTAL ELLIPSIS +⌂ Eh 2302 8962 HOUSE +⌈ <7 2308 8968 LEFT CEILING +⌉ >7 2309 8969 RIGHT CEILING +⌊ 7< 230A 8970 LEFT FLOOR +⌋ 7> 230B 8971 RIGHT FLOOR +⌐ NI 2310 8976 REVERSED NOT SIGN +⌒ (A 2312 8978 ARC +⌕ TR 2315 8981 TELEPHONE RECORDER +⌠ Iu 2320 8992 TOP HALF INTEGRAL +⌡ Il 2321 8993 BOTTOM HALF INTEGRAL +〈 232A 9002 RIGHT-POINTING ANGLE BRACKET +␣ Vs 2423 9251 OPEN BOX +⑀ 1h 2440 9280 OCR HOOK +⑁ 3h 2441 9281 OCR CHAIR +⑂ 2h 2442 9282 OCR FORK +⑃ 4h 2443 9283 OCR INVERTED FORK +⑆ 1j 2446 9286 OCR BRANCH BANK IDENTIFICATION +⑇ 2j 2447 9287 OCR AMOUNT OF CHECK +⑈ 3j 2448 9288 OCR DASH +⑉ 4j 2449 9289 OCR CUSTOMER ACCOUNT NUMBER +⒈ 1. 2488 9352 DIGIT ONE FULL STOP +⒉ 2. 2489 9353 DIGIT TWO FULL STOP +⒊ 3. 248A 9354 DIGIT THREE FULL STOP +⒋ 4. 248B 9355 DIGIT FOUR FULL STOP +⒌ 5. 248C 9356 DIGIT FIVE FULL STOP +⒍ 6. 248D 9357 DIGIT SIX FULL STOP +⒎ 7. 248E 9358 DIGIT SEVEN FULL STOP +⒏ 8. 248F 9359 DIGIT EIGHT FULL STOP +⒐ 9. 2490 9360 DIGIT NINE FULL STOP +─ hh 2500 9472 BOX DRAWINGS LIGHT HORIZONTAL +━ HH 2501 9473 BOX DRAWINGS HEAVY HORIZONTAL +│ vv 2502 9474 BOX DRAWINGS LIGHT VERTICAL +┃ VV 2503 9475 BOX DRAWINGS HEAVY VERTICAL +┄ 3- 2504 9476 BOX DRAWINGS LIGHT TRIPLE DASH HORIZONTAL +┅ 3_ 2505 9477 BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL +┆ 3! 2506 9478 BOX DRAWINGS LIGHT TRIPLE DASH VERTICAL +┇ 3/ 2507 9479 BOX DRAWINGS HEAVY TRIPLE DASH VERTICAL +┈ 4- 2508 9480 BOX DRAWINGS LIGHT QUADRUPLE DASH HORIZONTAL +┉ 4_ 2509 9481 BOX DRAWINGS HEAVY QUADRUPLE DASH HORIZONTAL +┊ 4! 250A 9482 BOX DRAWINGS LIGHT QUADRUPLE DASH VERTICAL +┋ 4/ 250B 9483 BOX DRAWINGS HEAVY QUADRUPLE DASH VERTICAL +┌ dr 250C 9484 BOX DRAWINGS LIGHT DOWN AND RIGHT +┍ dR 250D 9485 BOX DRAWINGS DOWN LIGHT AND RIGHT HEAVY +┎ Dr 250E 9486 BOX DRAWINGS DOWN HEAVY AND RIGHT LIGHT +┏ DR 250F 9487 BOX DRAWINGS HEAVY DOWN AND RIGHT +┐ dl 2510 9488 BOX DRAWINGS LIGHT DOWN AND LEFT +┑ dL 2511 9489 BOX DRAWINGS DOWN LIGHT AND LEFT HEAVY +┒ Dl 2512 9490 BOX DRAWINGS DOWN HEAVY AND LEFT LIGHT +┓ LD 2513 9491 BOX DRAWINGS HEAVY DOWN AND LEFT +└ ur 2514 9492 BOX DRAWINGS LIGHT UP AND RIGHT +┕ uR 2515 9493 BOX DRAWINGS UP LIGHT AND RIGHT HEAVY +┖ Ur 2516 9494 BOX DRAWINGS UP HEAVY AND RIGHT LIGHT +┗ UR 2517 9495 BOX DRAWINGS HEAVY UP AND RIGHT +┘ ul 2518 9496 BOX DRAWINGS LIGHT UP AND LEFT +┙ uL 2519 9497 BOX DRAWINGS UP LIGHT AND LEFT HEAVY +┚ Ul 251A 9498 BOX DRAWINGS UP HEAVY AND LEFT LIGHT +┛ UL 251B 9499 BOX DRAWINGS HEAVY UP AND LEFT +├ vr 251C 9500 BOX DRAWINGS LIGHT VERTICAL AND RIGHT +┝ vR 251D 9501 BOX DRAWINGS VERTICAL LIGHT AND RIGHT HEAVY +┠ Vr 2520 9504 BOX DRAWINGS VERTICAL HEAVY AND RIGHT LIGHT +┣ VR 2523 9507 BOX DRAWINGS HEAVY VERTICAL AND RIGHT +┤ vl 2524 9508 BOX DRAWINGS LIGHT VERTICAL AND LEFT +┥ vL 2525 9509 BOX DRAWINGS VERTICAL LIGHT AND LEFT HEAVY +┨ Vl 2528 9512 BOX DRAWINGS VERTICAL HEAVY AND LEFT LIGHT +┫ VL 252B 9515 BOX DRAWINGS HEAVY VERTICAL AND LEFT +┬ dh 252C 9516 BOX DRAWINGS LIGHT DOWN AND HORIZONTAL +┯ dH 252F 9519 BOX DRAWINGS DOWN LIGHT AND HORIZONTAL HEAVY +┰ Dh 2530 9520 BOX DRAWINGS DOWN HEAVY AND HORIZONTAL LIGHT +┳ DH 2533 9523 BOX DRAWINGS HEAVY DOWN AND HORIZONTAL +┴ uh 2534 9524 BOX DRAWINGS LIGHT UP AND HORIZONTAL +┷ uH 2537 9527 BOX DRAWINGS UP LIGHT AND HORIZONTAL HEAVY +┸ Uh 2538 9528 BOX DRAWINGS UP HEAVY AND HORIZONTAL LIGHT +┻ UH 253B 9531 BOX DRAWINGS HEAVY UP AND HORIZONTAL +┼ vh 253C 9532 BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL +┿ vH 253F 9535 BOX DRAWINGS VERTICAL LIGHT AND HORIZONTAL HEAVY +╂ Vh 2542 9538 BOX DRAWINGS VERTICAL HEAVY AND HORIZONTAL LIGHT +╋ VH 254B 9547 BOX DRAWINGS HEAVY VERTICAL AND HORIZONTAL +╱ FD 2571 9585 BOX DRAWINGS LIGHT DIAGONAL UPPER RIGHT TO LOWER LEFT +╲ BD 2572 9586 BOX DRAWINGS LIGHT DIAGONAL UPPER LEFT TO LOWER RIGHT +▀ TB 2580 9600 UPPER HALF BLOCK +▄ LB 2584 9604 LOWER HALF BLOCK +█ FB 2588 9608 FULL BLOCK +▌ lB 258C 9612 LEFT HALF BLOCK +▐ RB 2590 9616 RIGHT HALF BLOCK +░ .S 2591 9617 LIGHT SHADE +▒ :S 2592 9618 MEDIUM SHADE +▓ ?S 2593 9619 DARK SHADE +■ fS 25A0 9632 BLACK SQUARE +□ OS 25A1 9633 WHITE SQUARE +▢ RO 25A2 9634 WHITE SQUARE WITH ROUNDED CORNERS +▣ Rr 25A3 9635 WHITE SQUARE CONTAINING BLACK SMALL SQUARE +▤ RF 25A4 9636 SQUARE WITH HORIZONTAL FILL +▥ RY 25A5 9637 SQUARE WITH VERTICAL FILL +▦ RH 25A6 9638 SQUARE WITH ORTHOGONAL CROSSHATCH FILL +▧ RZ 25A7 9639 SQUARE WITH UPPER LEFT TO LOWER RIGHT FILL +▨ RK 25A8 9640 SQUARE WITH UPPER RIGHT TO LOWER LEFT FILL +▩ RX 25A9 9641 SQUARE WITH DIAGONAL CROSSHATCH FILL +▪ sB 25AA 9642 BLACK SMALL SQUARE +▬ SR 25AC 9644 BLACK RECTANGLE +▭ Or 25AD 9645 WHITE RECTANGLE +▲ UT 25B2 9650 BLACK UP-POINTING TRIANGLE +△ uT 25B3 9651 WHITE UP-POINTING TRIANGLE +▶ PR 25B6 9654 BLACK RIGHT-POINTING TRIANGLE +▷ Tr 25B7 9655 WHITE RIGHT-POINTING TRIANGLE +▼ Dt 25BC 9660 BLACK DOWN-POINTING TRIANGLE +▽ dT 25BD 9661 WHITE DOWN-POINTING TRIANGLE +◀ PL 25C0 9664 BLACK LEFT-POINTING TRIANGLE +◁ Tl 25C1 9665 WHITE LEFT-POINTING TRIANGLE +◆ Db 25C6 9670 BLACK DIAMOND +◇ Dw 25C7 9671 WHITE DIAMOND +◊ LZ 25CA 9674 LOZENGE +○ 0m 25CB 9675 WHITE CIRCLE +◎ 0o 25CE 9678 BULLSEYE +● 0M 25CF 9679 BLACK CIRCLE +◐ 0L 25D0 9680 CIRCLE WITH LEFT HALF BLACK +◑ 0R 25D1 9681 CIRCLE WITH RIGHT HALF BLACK +◘ Sn 25D8 9688 INVERSE BULLET +◙ Ic 25D9 9689 INVERSE WHITE CIRCLE +◢ Fd 25E2 9698 BLACK LOWER RIGHT TRIANGLE +◣ Bd 25E3 9699 BLACK LOWER LEFT TRIANGLE +★ *2 2605 9733 BLACK STAR +☆ *1 2606 9734 WHITE STAR +☜ H 261E 9758 WHITE RIGHT POINTING INDEX +☺ 0u 263A 9786 WHITE SMILING FACE +☻ 0U 263B 9787 BLACK SMILING FACE +☼ SU 263C 9788 WHITE SUN WITH RAYS +♀ Fm 2640 9792 FEMALE SIGN +♂ Ml 2642 9794 MALE SIGN +♠ cS 2660 9824 BLACK SPADE SUIT +♡ cH 2661 9825 WHITE HEART SUIT +♢ cD 2662 9826 WHITE DIAMOND SUIT +♣ cC 2663 9827 BLACK CLUB SUIT +♩ Md 2669 9833 QUARTER NOTE ` +♪ M8 266A 9834 EIGHTH NOTE ` +♫ M2 266B 9835 BEAMED EIGHTH NOTES +♭ Mb 266D 9837 MUSIC FLAT SIGN +♮ Mx 266E 9838 MUSIC NATURAL SIGN +♯ MX 266F 9839 MUSIC SHARP SIGN +✓ OK 2713 10003 CHECK MARK +✗ XX 2717 10007 BALLOT X +✠ -X 2720 10016 MALTESE CROSS +  IS 3000 12288 IDEOGRAPHIC SPACE +、 ,_ 3001 12289 IDEOGRAPHIC COMMA +。 ._ 3002 12290 IDEOGRAPHIC FULL STOP +〃 +" 3003 12291 DITTO MARK +〄 +_ 3004 12292 JAPANESE INDUSTRIAL STANDARD SYMBOL +々 *_ 3005 12293 IDEOGRAPHIC ITERATION MARK +〆 ;_ 3006 12294 IDEOGRAPHIC CLOSING MARK +〇 0_ 3007 12295 IDEOGRAPHIC NUMBER ZERO +《 <+ 300A 12298 LEFT DOUBLE ANGLE BRACKET +》 >+ 300B 12299 RIGHT DOUBLE ANGLE BRACKET +「 <' 300C 12300 LEFT CORNER BRACKET +」 >' 300D 12301 RIGHT CORNER BRACKET +『 <" 300E 12302 LEFT WHITE CORNER BRACKET +』 >" 300F 12303 RIGHT WHITE CORNER BRACKET +【 (" 3010 12304 LEFT BLACK LENTICULAR BRACKET +】 )" 3011 12305 RIGHT BLACK LENTICULAR BRACKET +〒 =T 3012 12306 POSTAL MARK +〓 =_ 3013 12307 GETA MARK +〔 (' 3014 12308 LEFT TORTOISE SHELL BRACKET +〕 )' 3015 12309 RIGHT TORTOISE SHELL BRACKET +〖 (I 3016 12310 LEFT WHITE LENTICULAR BRACKET +〗 )I 3017 12311 RIGHT WHITE LENTICULAR BRACKET +〜 -? 301C 12316 WAVE DASH +ぁ A5 3041 12353 HIRAGANA LETTER SMALL A +あ a5 3042 12354 HIRAGANA LETTER A +ぃ I5 3043 12355 HIRAGANA LETTER SMALL I +い i5 3044 12356 HIRAGANA LETTER I +ぅ U5 3045 12357 HIRAGANA LETTER SMALL U +う u5 3046 12358 HIRAGANA LETTER U +ぇ E5 3047 12359 HIRAGANA LETTER SMALL E +え e5 3048 12360 HIRAGANA LETTER E +ぉ O5 3049 12361 HIRAGANA LETTER SMALL O +お o5 304A 12362 HIRAGANA LETTER O +か ka 304B 12363 HIRAGANA LETTER KA +が ga 304C 12364 HIRAGANA LETTER GA +き ki 304D 12365 HIRAGANA LETTER KI +ぎ gi 304E 12366 HIRAGANA LETTER GI +く ku 304F 12367 HIRAGANA LETTER KU +ぐ gu 3050 12368 HIRAGANA LETTER GU +け ke 3051 12369 HIRAGANA LETTER KE +げ ge 3052 12370 HIRAGANA LETTER GE +こ ko 3053 12371 HIRAGANA LETTER KO +ご go 3054 12372 HIRAGANA LETTER GO +さ sa 3055 12373 HIRAGANA LETTER SA +ざ za 3056 12374 HIRAGANA LETTER ZA +し si 3057 12375 HIRAGANA LETTER SI +じ zi 3058 12376 HIRAGANA LETTER ZI +す su 3059 12377 HIRAGANA LETTER SU +ず zu 305A 12378 HIRAGANA LETTER ZU +せ se 305B 12379 HIRAGANA LETTER SE +ぜ ze 305C 12380 HIRAGANA LETTER ZE +そ so 305D 12381 HIRAGANA LETTER SO +ぞ zo 305E 12382 HIRAGANA LETTER ZO +た ta 305F 12383 HIRAGANA LETTER TA +だ da 3060 12384 HIRAGANA LETTER DA +ち ti 3061 12385 HIRAGANA LETTER TI +ぢ di 3062 12386 HIRAGANA LETTER DI +っ tU 3063 12387 HIRAGANA LETTER SMALL TU +つ tu 3064 12388 HIRAGANA LETTER TU +づ du 3065 12389 HIRAGANA LETTER DU +て te 3066 12390 HIRAGANA LETTER TE +で de 3067 12391 HIRAGANA LETTER DE +と to 3068 12392 HIRAGANA LETTER TO +ど do 3069 12393 HIRAGANA LETTER DO +な na 306A 12394 HIRAGANA LETTER NA +に ni 306B 12395 HIRAGANA LETTER NI +ぬ nu 306C 12396 HIRAGANA LETTER NU +ね ne 306D 12397 HIRAGANA LETTER NE +の no 306E 12398 HIRAGANA LETTER NO +は ha 306F 12399 HIRAGANA LETTER HA +ば ba 3070 12400 HIRAGANA LETTER BA +ぱ pa 3071 12401 HIRAGANA LETTER PA +ひ hi 3072 12402 HIRAGANA LETTER HI +び bi 3073 12403 HIRAGANA LETTER BI +ぴ pi 3074 12404 HIRAGANA LETTER PI +ふ hu 3075 12405 HIRAGANA LETTER HU +ぶ bu 3076 12406 HIRAGANA LETTER BU +ぷ pu 3077 12407 HIRAGANA LETTER PU +へ he 3078 12408 HIRAGANA LETTER HE +べ be 3079 12409 HIRAGANA LETTER BE +ぺ pe 307A 12410 HIRAGANA LETTER PE +ほ ho 307B 12411 HIRAGANA LETTER HO +ぼ bo 307C 12412 HIRAGANA LETTER BO +ぽ po 307D 12413 HIRAGANA LETTER PO +ま ma 307E 12414 HIRAGANA LETTER MA +み mi 307F 12415 HIRAGANA LETTER MI +む mu 3080 12416 HIRAGANA LETTER MU +め me 3081 12417 HIRAGANA LETTER ME +も mo 3082 12418 HIRAGANA LETTER MO +ゃ yA 3083 12419 HIRAGANA LETTER SMALL YA +や ya 3084 12420 HIRAGANA LETTER YA +ゅ yU 3085 12421 HIRAGANA LETTER SMALL YU +ゆ yu 3086 12422 HIRAGANA LETTER YU +ょ yO 3087 12423 HIRAGANA LETTER SMALL YO +よ yo 3088 12424 HIRAGANA LETTER YO +ら ra 3089 12425 HIRAGANA LETTER RA +り ri 308A 12426 HIRAGANA LETTER RI +る ru 308B 12427 HIRAGANA LETTER RU +れ re 308C 12428 HIRAGANA LETTER RE +ろ ro 308D 12429 HIRAGANA LETTER RO +ゎ wA 308E 12430 HIRAGANA LETTER SMALL WA +わ wa 308F 12431 HIRAGANA LETTER WA +ゐ wi 3090 12432 HIRAGANA LETTER WI +ゑ we 3091 12433 HIRAGANA LETTER WE +を wo 3092 12434 HIRAGANA LETTER WO +ん n5 3093 12435 HIRAGANA LETTER N ` +ゔ vu 3094 12436 HIRAGANA LETTER VU +゛ "5 309B 12443 KATAKANA-HIRAGANA VOICED SOUND MARK +゜ 05 309C 12444 KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK +ゝ *5 309D 12445 HIRAGANA ITERATION MARK +ゞ +5 309E 12446 HIRAGANA VOICED ITERATION MARK +ァ a6 30A1 12449 KATAKANA LETTER SMALL A +ア A6 30A2 12450 KATAKANA LETTER A +ィ i6 30A3 12451 KATAKANA LETTER SMALL I +イ I6 30A4 12452 KATAKANA LETTER I +ゥ u6 30A5 12453 KATAKANA LETTER SMALL U +ウ U6 30A6 12454 KATAKANA LETTER U +ェ e6 30A7 12455 KATAKANA LETTER SMALL E +エ E6 30A8 12456 KATAKANA LETTER E +ォ o6 30A9 12457 KATAKANA LETTER SMALL O +オ O6 30AA 12458 KATAKANA LETTER O +カ Ka 30AB 12459 KATAKANA LETTER KA +ガ Ga 30AC 12460 KATAKANA LETTER GA +キ Ki 30AD 12461 KATAKANA LETTER KI +ギ Gi 30AE 12462 KATAKANA LETTER GI +ク Ku 30AF 12463 KATAKANA LETTER KU +グ Gu 30B0 12464 KATAKANA LETTER GU +ケ Ke 30B1 12465 KATAKANA LETTER KE +ゲ Ge 30B2 12466 KATAKANA LETTER GE +コ Ko 30B3 12467 KATAKANA LETTER KO +ゴ Go 30B4 12468 KATAKANA LETTER GO +サ Sa 30B5 12469 KATAKANA LETTER SA +ザ Za 30B6 12470 KATAKANA LETTER ZA +シ Si 30B7 12471 KATAKANA LETTER SI +ジ Zi 30B8 12472 KATAKANA LETTER ZI +ス Su 30B9 12473 KATAKANA LETTER SU +ズ Zu 30BA 12474 KATAKANA LETTER ZU +セ Se 30BB 12475 KATAKANA LETTER SE +ゼ Ze 30BC 12476 KATAKANA LETTER ZE +ソ So 30BD 12477 KATAKANA LETTER SO +ゾ Zo 30BE 12478 KATAKANA LETTER ZO +タ Ta 30BF 12479 KATAKANA LETTER TA +ダ Da 30C0 12480 KATAKANA LETTER DA +チ Ti 30C1 12481 KATAKANA LETTER TI +ヂ Di 30C2 12482 KATAKANA LETTER DI +ッ TU 30C3 12483 KATAKANA LETTER SMALL TU +ツ Tu 30C4 12484 KATAKANA LETTER TU +ヅ Du 30C5 12485 KATAKANA LETTER DU +テ Te 30C6 12486 KATAKANA LETTER TE +デ De 30C7 12487 KATAKANA LETTER DE +ト To 30C8 12488 KATAKANA LETTER TO +ド Do 30C9 12489 KATAKANA LETTER DO +ナ Na 30CA 12490 KATAKANA LETTER NA +ニ Ni 30CB 12491 KATAKANA LETTER NI +ヌ Nu 30CC 12492 KATAKANA LETTER NU +ネ Ne 30CD 12493 KATAKANA LETTER NE +ノ No 30CE 12494 KATAKANA LETTER NO +ハ Ha 30CF 12495 KATAKANA LETTER HA +バ Ba 30D0 12496 KATAKANA LETTER BA +パ Pa 30D1 12497 KATAKANA LETTER PA +ヒ Hi 30D2 12498 KATAKANA LETTER HI +ビ Bi 30D3 12499 KATAKANA LETTER BI +ピ Pi 30D4 12500 KATAKANA LETTER PI +フ Hu 30D5 12501 KATAKANA LETTER HU +ブ Bu 30D6 12502 KATAKANA LETTER BU +プ Pu 30D7 12503 KATAKANA LETTER PU +ヘ He 30D8 12504 KATAKANA LETTER HE +ベ Be 30D9 12505 KATAKANA LETTER BE +ペ Pe 30DA 12506 KATAKANA LETTER PE +ホ Ho 30DB 12507 KATAKANA LETTER HO +ボ Bo 30DC 12508 KATAKANA LETTER BO +ポ Po 30DD 12509 KATAKANA LETTER PO +マ Ma 30DE 12510 KATAKANA LETTER MA +ミ Mi 30DF 12511 KATAKANA LETTER MI +ム Mu 30E0 12512 KATAKANA LETTER MU +メ Me 30E1 12513 KATAKANA LETTER ME +モ Mo 30E2 12514 KATAKANA LETTER MO +ャ YA 30E3 12515 KATAKANA LETTER SMALL YA +ヤ Ya 30E4 12516 KATAKANA LETTER YA +ュ YU 30E5 12517 KATAKANA LETTER SMALL YU +ユ Yu 30E6 12518 KATAKANA LETTER YU +ョ YO 30E7 12519 KATAKANA LETTER SMALL YO +ヨ Yo 30E8 12520 KATAKANA LETTER YO +ラ Ra 30E9 12521 KATAKANA LETTER RA +リ Ri 30EA 12522 KATAKANA LETTER RI +ル Ru 30EB 12523 KATAKANA LETTER RU +レ Re 30EC 12524 KATAKANA LETTER RE +ロ Ro 30ED 12525 KATAKANA LETTER RO +ヮ WA 30EE 12526 KATAKANA LETTER SMALL WA +ワ Wa 30EF 12527 KATAKANA LETTER WA +ヰ Wi 30F0 12528 KATAKANA LETTER WI +ヱ We 30F1 12529 KATAKANA LETTER WE +ヲ Wo 30F2 12530 KATAKANA LETTER WO +ン N6 30F3 12531 KATAKANA LETTER N ` +ヴ Vu 30F4 12532 KATAKANA LETTER VU +ヵ KA 30F5 12533 KATAKANA LETTER SMALL KA +ヶ KE 30F6 12534 KATAKANA LETTER SMALL KE +ヷ Va 30F7 12535 KATAKANA LETTER VA +ヸ Vi 30F8 12536 KATAKANA LETTER VI +ヹ Ve 30F9 12537 KATAKANA LETTER VE +ヺ Vo 30FA 12538 KATAKANA LETTER VO +・ .6 30FB 12539 KATAKANA MIDDLE DOT +ー -6 30FC 12540 KATAKANA-HIRAGANA PROLONGED SOUND MARK +ヽ *6 30FD 12541 KATAKANA ITERATION MARK +ヾ +6 30FE 12542 KATAKANA VOICED ITERATION MARK +ㄅ b4 3105 12549 BOPOMOFO LETTER B +ㄆ p4 3106 12550 BOPOMOFO LETTER P +ㄇ m4 3107 12551 BOPOMOFO LETTER M +ㄈ f4 3108 12552 BOPOMOFO LETTER F +ㄉ d4 3109 12553 BOPOMOFO LETTER D +ㄊ t4 310A 12554 BOPOMOFO LETTER T +ㄋ n4 310B 12555 BOPOMOFO LETTER N ` +ㄌ l4 310C 12556 BOPOMOFO LETTER L +ㄍ g4 310D 12557 BOPOMOFO LETTER G +ㄎ k4 310E 12558 BOPOMOFO LETTER K +ㄏ h4 310F 12559 BOPOMOFO LETTER H +ㄐ j4 3110 12560 BOPOMOFO LETTER J +ㄑ q4 3111 12561 BOPOMOFO LETTER Q +ㄒ x4 3112 12562 BOPOMOFO LETTER X +ㄓ zh 3113 12563 BOPOMOFO LETTER ZH +ㄔ ch 3114 12564 BOPOMOFO LETTER CH +ㄕ sh 3115 12565 BOPOMOFO LETTER SH +ㄖ r4 3116 12566 BOPOMOFO LETTER R +ㄗ z4 3117 12567 BOPOMOFO LETTER Z +ㄘ c4 3118 12568 BOPOMOFO LETTER C +ㄙ s4 3119 12569 BOPOMOFO LETTER S +ㄚ a4 311A 12570 BOPOMOFO LETTER A +ㄛ o4 311B 12571 BOPOMOFO LETTER O +ㄜ e4 311C 12572 BOPOMOFO LETTER E +ㄞ ai 311E 12574 BOPOMOFO LETTER AI +ㄟ ei 311F 12575 BOPOMOFO LETTER EI +ㄠ au 3120 12576 BOPOMOFO LETTER AU +ㄡ ou 3121 12577 BOPOMOFO LETTER OU +ㄢ an 3122 12578 BOPOMOFO LETTER AN +ㄣ en 3123 12579 BOPOMOFO LETTER EN +ㄤ aN 3124 12580 BOPOMOFO LETTER ANG +ㄥ eN 3125 12581 BOPOMOFO LETTER ENG +ㄦ er 3126 12582 BOPOMOFO LETTER ER +ㄧ i4 3127 12583 BOPOMOFO LETTER I +ㄨ u4 3128 12584 BOPOMOFO LETTER U +ㄩ iu 3129 12585 BOPOMOFO LETTER IU +ㄪ v4 312A 12586 BOPOMOFO LETTER V +ㄫ nG 312B 12587 BOPOMOFO LETTER NG +ㄬ gn 312C 12588 BOPOMOFO LETTER GN +㈠ 1c 3220 12832 PARENTHESIZED IDEOGRAPH ONE +㈡ 2c 3221 12833 PARENTHESIZED IDEOGRAPH TWO +㈢ 3c 3222 12834 PARENTHESIZED IDEOGRAPH THREE +㈣ 4c 3223 12835 PARENTHESIZED IDEOGRAPH FOUR +㈤ 5c 3224 12836 PARENTHESIZED IDEOGRAPH FIVE +㈥ 6c 3225 12837 PARENTHESIZED IDEOGRAPH SIX +㈦ 7c 3226 12838 PARENTHESIZED IDEOGRAPH SEVEN +㈧ 8c 3227 12839 PARENTHESIZED IDEOGRAPH EIGHT +㈨ 9c 3228 12840 PARENTHESIZED IDEOGRAPH NINE +ff ff FB00 64256 LATIN SMALL LIGATURE FF +fi fi FB01 64257 LATIN SMALL LIGATURE FI +fl fl FB02 64258 LATIN SMALL LIGATURE FL +ſt ft FB05 64261 LATIN SMALL LIGATURE LONG S T +st st FB06 64262 LATIN SMALL LIGATURE ST vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 84800aa..6cafa7f 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1,4 +1,4 @@ -*editing.txt* For Vim version 7.3. Last change: 2010 Jul 28 +*editing.txt* For Vim version 7.4. Last change: 2013 Aug 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -185,12 +185,13 @@ If you want to automatically save the changes without asking, switch on the that does not work for all commands. If you want to keep the changed buffer without saving it, switch on the -'hidden' option. See |hidden-buffer|. +'hidden' option. See |hidden-buffer|. Some commands work like this even when +'hidden' is not set, check the help for the command. ============================================================================== 2. Editing a file *edit-a-file* - *:e* *:edit* + *:e* *:edit* *reload* :e[dit] [++opt] [+cmd] Edit the current file. This is useful to re-edit the current file, when it has been changed outside of Vim. This fails when changes have been made to the current @@ -199,7 +200,7 @@ If you want to keep the changed buffer without saving it, switch on the Also see |++opt| and |+cmd|. {Vi: no ++opt} - *:edit!* + *:edit!* *discard* :e[dit]! [++opt] [+cmd] Edit the current file always. Discard any changes to the current buffer. This is useful if you want to @@ -276,10 +277,11 @@ If you want to keep the changed buffer without saving it, switch on the 'readonly' option for this buffer. {not in Vi} *CTRL-^* *CTRL-6* -CTRL-^ Edit the alternate file (equivalent to ":e #"). - Mostly the alternate file is the previously edited - file. This is a quick way to toggle between two - files. +CTRL-^ Edit the alternate file. Mostly the alternate file is + the previously edited file. This is a quick way to + toggle between two files. It is equivalent to ":e #", + except that it also works when there is no file name. + If the 'autowrite' or 'autowriteall' option is on and the buffer was changed, write it. Mostly the ^ character is positioned on the 6 key, @@ -376,8 +378,9 @@ command that accepts more than one file name (like ":next file1 file2") embedded spaces must be escaped with a backslash. *wildcard* *wildcards* -Wildcards in {file} are expanded. Which wildcards are supported depends on -the system. These are the common ones: +Wildcards in {file} are expanded, but as with file completion, 'wildignore' +and 'suffixes' apply. Which wildcards are supported depends on the system. +These are the common ones: ? matches one character * matches anything, including nothing ** matches anything, including nothing, recurses into directories @@ -391,7 +394,7 @@ is to use "path\[[]abc]". Then the file "path[abc]" literally. *starstar-wildcard* Expanding "**" is possible on Unix, Win32, Mac OS/X and a few other systems. This allows searching a directory tree. This goes up to 100 directories deep. -Note there are some commands where this works slightly different, see +Note there are some commands where this works slightly differently, see |file-searching|. Example: > :n **/*.txt @@ -421,9 +424,11 @@ You can have the backticks expanded as a Vim expression, instead of an external command, by using the syntax `={expr}` e.g.: > :e `=tempname()` The expression can contain just about anything, thus this can also be used to -avoid the special meaning of '"', '|', '%' and '#'. Names are to be separated -with line breaks. When the result is a |List| then each item is used as a -name. Line breaks also separate names. +avoid the special meaning of '"', '|', '%' and '#'. However, 'wildignore' +does apply like to other wildcards. +If the expression returns a string then names are to be separated with line +breaks. When the result is a |List| then each item is used as a name. Line +breaks also separate names. *++opt* *[++opt]* The [++opt] argument can be used to force the value of 'fileformat', @@ -984,6 +989,11 @@ explanation of when the copy is made and when the file is renamed. If the creation of a backup file fails, the write is not done. If you want to write anyway add a '!' to the command. + *write-permissions* +When writing a new file the permissions are read-write. For unix the mask is +0666 with additionally umask applied. When writing a file that was read Vim +will preserve the permissions, but clear the s-bit. + *write-readonly* When the 'cpoptions' option contains 'W', Vim will refuse to overwrite a readonly file. When 'W' is not present, ":w!" will overwrite a readonly file, @@ -1060,6 +1070,7 @@ The names can be in upper- or lowercase. If there are other tab pages and quitting the last window in the current tab page the current tab page is closed |tab-page|. + Triggers the |QuitPre| autocommand event. :conf[irm] q[uit] Quit, but give prompt when changes have been made, or the last file in the argument list has not been @@ -1153,8 +1164,10 @@ MULTIPLE WINDOWS AND BUFFERS *window-exit* *:confirm* *:conf* :conf[irm] {command} Execute {command}, and use a dialog when an operation has to be confirmed. Can be used on the - ":q", ":qa" and ":w" commands (the latter to over-ride - a read-only setting). + |:q|, |:qa| and |:w| commands (the latter to override + a read-only setting), and any other command that can + fail in such a way, such as |:only|, |:buffer|, + |:bdelete|, etc. Examples: > :confirm w foo @@ -1207,13 +1220,13 @@ For versions of Vim where browsing is not supported, the command is executed unmodified. *browsefilter* -For MS Windows, you can modify the filters that are used in the browse dialog. -By setting the g:browsefilter or b:browsefilter variables, you can change the -filters globally or locally to the buffer. The variable is set to a string in -the format "{filter label}\t{pattern};{pattern}\n" where {filter label} is the -text that appears in the "Files of Type" comboBox, and {pattern} is the -pattern which filters the filenames. Several patterns can be given, separated -by ';'. +For MS Windows and GTK, you can modify the filters that are used in the browse +dialog. By setting the g:browsefilter or b:browsefilter variables, you can +change the filters globally or locally to the buffer. The variable is set to +a string in the format "{filter label}\t{pattern};{pattern}\n" where {filter +label} is the text that appears in the "Files of Type" comboBox, and {pattern} +is the pattern which filters the filenames. Several patterns can be given, +separated by ';'. For Motif the same format is used, but only the very first pattern is actually used (Motif only offers one pattern, but you can edit it). @@ -1221,7 +1234,7 @@ used (Motif only offers one pattern, but you can edit it). For example, to have only Vim files in the dialog, you could use the following command: > - let g:browsefilter="Vim Scripts\t*.vim\nVim Startup Files\t*vimrc\n" + let g:browsefilter = "Vim Scripts\t*.vim\nVim Startup Files\t*vimrc\n" You can override the filter setting on a per-buffer basis by setting the b:browsefilter variable. You would most likely set b:browsefilter in a @@ -1231,6 +1244,13 @@ difficult to start editing a file of a different type. To overcome this, you may want to add "All Files\t*.*\n" as the final filter, so that the user can still access any desired file. +To avoid setting browsefilter when Vim does not actually support it, you can +use has("browsefilter"): > + + if has("browsefilter") + let g:browsefilter = "whatever" + endif + ============================================================================== 7. The current directory *current-directory* @@ -1340,7 +1360,7 @@ Vim is able to write files encrypted, and read them back. The encrypted text cannot be read without the right key. {only available when compiled with the |+cryptv| feature} *E833* -The text in the swap file and the undo file is also encrypted. +The text in the swap file and the undo file is also encrypted. *E843* Note: The text in memory is not encrypted. A system administrator may be able to see your text while you are editing it. When filtering text with @@ -1382,6 +1402,8 @@ To set the default method, used for new files, use one of these in your |vimrc| file: > set cm=zip set cm=blowfish +The message given for reading and writing a file will show "[crypted]" when +using zip, "[blowfish]" when using blowfish. When writing an undo file, the same key and method will be used for the text in the undo file. |persistent-undo|. @@ -1431,13 +1453,15 @@ Notes: history, showing the 'key' value in a viminfo file. - There is never 100% safety. The encryption in Vim has not been tested for robustness. -- The algorithm used is breakable. A 4 character key in about one hour, a 6 - character key in one day (on a Pentium 133 PC). This requires that you know - some text that must appear in the file. An expert can break it for any key. - When the text has been decrypted, this also means that the key can be - revealed, and other files encrypted with the same key can be decrypted. -- Pkzip uses the same encryption, and US Govt has no objection to its export. - Pkzip's public file APPNOTE.TXT describes this algorithm in detail. +- The algorithm used for 'cryptmethod' "zip" is breakable. A 4 character key + in about one hour, a 6 character key in one day (on a Pentium 133 PC). This + requires that you know some text that must appear in the file. An expert + can break it for any key. When the text has been decrypted, this also means + that the key can be revealed, and other files encrypted with the same key + can be decrypted. +- Pkzip uses the same encryption as 'cryptmethod' "zip", and US Govt has no + objection to its export. Pkzip's public file APPNOTE.TXT describes this + algorithm in detail. - Vim originates from the Netherlands. That is where the sources come from. Thus the encryption code is not exported from the USA. @@ -1629,6 +1653,6 @@ There are three different types of searching: Note that completion for ":find", ":sfind", and ":tabfind" commands do not currently work with 'path' items that contain a url or use the double star - (/usr/**2) or upward search (;) notations. > + with depth limiter (/usr/**2) or upward search (;) notations. vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 5403551..743aec1 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.3. Last change: 2010 Aug 15 +*eval.txt* For Vim version 7.4. Last change: 2013 Aug 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -39,7 +39,7 @@ done, the features in this document are not available. See |+eval| and *E712* There are six types of variables: -Number A 32 bit signed number. |expr-number| *Number* +Number A 32 or 64 bit signed number. |expr-number| *Number* Examples: -123 0x10 0177 Float A floating point number. |floating-point-format| *Float* @@ -63,21 +63,21 @@ The Number and String types are converted automatically, depending on how they are used. Conversion from a Number to a String is by making the ASCII representation of -the Number. Examples: > - Number 123 --> String "123" - Number 0 --> String "0" - Number -1 --> String "-1" +the Number. Examples: + Number 123 --> String "123" ~ + Number 0 --> String "0" ~ + Number -1 --> String "-1" ~ *octal* Conversion from a String to a Number is done by converting the first digits to a number. Hexadecimal "0xf9" and Octal "017" numbers are recognized. If -the String doesn't start with digits, the result is zero. Examples: > - String "456" --> Number 456 - String "6bar" --> Number 6 - String "foo" --> Number 0 - String "0xf1" --> Number 241 - String "0100" --> Number 64 - String "-8" --> Number -8 - String "+8" --> Number 0 +the String doesn't start with digits, the result is zero. Examples: + String "456" --> Number 456 ~ + String "6bar" --> Number 6 ~ + String "foo" --> Number 0 ~ + String "0xf1" --> Number 241 ~ + String "0100" --> Number 64 ~ + String "-8" --> Number -8 ~ + String "+8" --> Number 0 ~ To force conversion from String to Number, add zero to it: > :echo "0100" + 0 @@ -91,8 +91,8 @@ For boolean operators Numbers are used. Zero is FALSE, non-zero is TRUE. Note that in the command > :if "foo" "foo" is converted to 0, which means FALSE. To test for a non-empty string, -use strlen(): > - :if strlen("foo") +use empty(): > + :if !empty("foo") < *E745* *E728* *E703* *E729* *E730* *E731* List, Dictionary and Funcref types are not automatically converted. @@ -503,7 +503,7 @@ This removes all entries from "dict" with a value not matching 'x'. Dictionary function ~ - *Dictionary-function* *self* *E725* + *Dictionary-function* *self* *E725* *E862* When a function is defined with the "dict" attribute it can be used in a special way with a dictionary. Example: > :function Mylen() dict @@ -615,7 +615,6 @@ Expression syntax summary, from least to most significant: - expr7 unary minus + expr7 unary plus - |expr8| expr8[expr1] byte of a String or item of a |List| expr8[expr1 : expr1] substring of a String or sublist of a |List| expr8.name entry in a |Dictionary| @@ -721,7 +720,8 @@ if it evaluates to true. *expr-<#* *expr-<=#* *expr-=~#* *expr-!~#* *expr-==?* *expr-!=?* *expr->?* *expr->=?* *expr- : unlet s:[k] :endfor < - *buffer-variable* *b:var* + *buffer-variable* *b:var* *b:* A variable name that is preceded with "b:" is local to the current buffer. Thus you can have several "b:foo" variables, one for each buffer. This kind of variable is deleted when the buffer is wiped out or deleted with |:bdelete|. One local buffer variable is predefined: - *b:changedtick-variable* *changetick* + *b:changedtick* *changetick* b:changedtick The total number of changes to the current buffer. It is incremented for each change. An undo command is also a change in this case. This can be used to perform an action only when @@ -1163,21 +1167,21 @@ b:changedtick The total number of changes to the current buffer. It is : call My_Update() :endif < - *window-variable* *w:var* + *window-variable* *w:var* *w:* A variable name that is preceded with "w:" is local to the current window. It is deleted when the window is closed. - *tabpage-variable* *t:var* + *tabpage-variable* *t:var* *t:* A variable name that is preceded with "t:" is local to the current tab page, It is deleted when the tab page is closed. {not available when compiled without the |+windows| feature} - *global-variable* *g:var* + *global-variable* *g:var* *g:* Inside functions global variables are accessed with "g:". Omitting this will access a variable local to a function. But "g:" can also be used in any other place if you like. - *local-variable* *l:var* + *local-variable* *l:var* *l:* Inside functions local variables are accessed without prepending anything. But you can also prepend "l:" if you like. However, without prepending "l:" you may run into reserved variable names. For example "count". By itself it @@ -1260,7 +1264,7 @@ Note that this means that filetype plugins don't get a different set of script variables for each buffer. Use local buffer variables instead |b:var|. -Predefined Vim variables: *vim-variable* *v:var* +Predefined Vim variables: *vim-variable* *v:var* *v:* *v:beval_col* *beval_col-variable* v:beval_col The number of the column, over which the mouse pointer is. @@ -1286,11 +1290,14 @@ v:beval_text The text under or after the mouse pointer. Usually a word as *v:beval_winnr* *beval_winnr-variable* v:beval_winnr The number of the window, over which the mouse pointer is. Only - valid while evaluating the 'balloonexpr' option. + valid while evaluating the 'balloonexpr' option. The first + window has number zero (unlike most other places where a + window gets a number). *v:char* *char-variable* v:char Argument for evaluating 'formatexpr' and used for the typed character when using in an abbreviation |:map-|. + It is also used by the |InsertCharPre| and |InsertEnter| events. *v:charconvert_from* *charconvert_from-variable* v:charconvert_from @@ -1537,13 +1544,19 @@ v:profiling Normally zero. Set to one after using ":profile start". *v:progname* *progname-variable* v:progname Contains the name (with path removed) with which Vim was - invoked. Allows you to do special initialisations for "view", - "evim" etc., or any other name you might symlink to Vim. + invoked. Allows you to do special initialisations for |view|, + |evim| etc., or any other name you might symlink to Vim. Read-only. *v:register* *register-variable* -v:register The name of the register supplied to the last normal mode - command. Empty if none were supplied. |getreg()| |setreg()| +v:register The name of the register in effect for the current normal mode + command (regardless of whether that command actually used a + register). Or for the currently executing normal mode mapping + (use this in custom commands that take a register). + If none is supplied it is the default register '"', unless + 'clipboard' contains "unnamed" or "unnamedplus", then it is + '*' or '+'. + Also see |getreg()| and |setreg()| *v:scrollstart* *scrollstart-variable* v:scrollstart String describing the script or function that caused the @@ -1657,6 +1670,15 @@ v:version Version number of Vim: Major version number times 100 plus *v:warningmsg* *warningmsg-variable* v:warningmsg Last given warning message. It's allowed to set this variable. + *v:windowid* *windowid-variable* +v:windowid When any X11 based GUI is running or when running in a + terminal and Vim connects to the X server (|-X|) this will be + set to the window ID. + When an MS-Windows GUI is running this will be set to the + window handle. + Otherwise the value is zero. + Note: for windows inside Vim use |winnr()|. + ============================================================================== 4. Builtin Functions *functions* @@ -1669,6 +1691,7 @@ USAGE RESULT DESCRIPTION ~ abs( {expr}) Float or Number absolute value of {expr} acos( {expr}) Float arc cosine of {expr} add( {list}, {item}) List append {item} to |List| {list} +and( {expr}, {expr}) Number bitwise AND append( {lnum}, {string}) Number append {string} below line {lnum} append( {lnum}, {list}) Number append lines {list} below line {lnum} argc() Number number of files in the argument list @@ -1693,7 +1716,7 @@ call( {func}, {arglist} [, {dict}]) any call {func} with arguments {arglist} ceil( {expr}) Float round {expr} up changenr() Number current change number -char2nr( {expr}) Number ASCII value of first char in {expr} +char2nr( {expr}[, {utf8}]) Number ASCII/UTF8 value of first char in {expr} cindent( {lnum}) Number C indent for line {lnum} clearmatches() none clear all matches col( {expr}) Number column nr of cursor or mark @@ -1726,7 +1749,8 @@ exists( {expr}) Number TRUE if {expr} exists extend( {expr1}, {expr2} [, {expr3}]) List/Dict insert items of {expr2} into {expr1} exp( {expr}) Float exponential of {expr} -expand( {expr} [, {flag}]) String expand special keywords in {expr} +expand( {expr} [, {nosuf} [, {list}]]) + any expand special keywords in {expr} feedkeys( {string} [, {mode}]) Number add key sequence to typeahead buffer filereadable( {file}) Number TRUE if {file} is a readable file filewritable( {file}) Number TRUE if {file} is a writable file @@ -1748,12 +1772,13 @@ foldtext( ) String line displayed for closed fold foldtextresult( {lnum}) String text for closed fold at {lnum} foreground( ) Number bring the Vim window to the foreground function( {name}) Funcref reference to function {name} -garbagecollect( [at_exit]) none free memory, breaking cyclic references +garbagecollect( [{atexit}]) none free memory, breaking cyclic references get( {list}, {idx} [, {def}]) any get item {idx} from {list} or {def} get( {dict}, {key} [, {def}]) any get item {key} from {dict} or {def} getbufline( {expr}, {lnum} [, {end}]) List lines {lnum} to {end} of buffer {expr} -getbufvar( {expr}, {varname}) any variable {varname} in buffer {expr} +getbufvar( {expr}, {varname} [, {def}]) + any variable {varname} in buffer {expr} getchar( [expr]) Number get one character from the user getcharmod( ) Number modifiers for the last typed character getcmdline() String return the current command-line @@ -1774,13 +1799,16 @@ getpos( {expr}) List position of cursor, mark, etc. getqflist() List list of quickfix items getreg( [{regname} [, 1]]) String contents of register getregtype( [{regname}]) String type of register -gettabvar( {nr}, {varname}) any variable {varname} in tab {nr} -gettabwinvar( {tabnr}, {winnr}, {name}) +gettabvar( {nr}, {varname} [, {def}]) + any variable {varname} in tab {nr} or {def} +gettabwinvar( {tabnr}, {winnr}, {name} [, {def}]) any {name} in {winnr} in tab page {tabnr} getwinposx() Number X coord in pixels of GUI Vim window getwinposy() Number Y coord in pixels of GUI Vim window -getwinvar( {nr}, {varname}) any variable {varname} in window {nr} -glob( {expr} [, {flag}]) String expand file wildcards in {expr} +getwinvar( {nr}, {varname} [, {def}]) + any variable {varname} in window {nr} +glob( {expr} [, {nosuf} [, {list}]]) + any expand file wildcards in {expr} globpath( {path}, {expr} [, {flag}]) String do glob({expr}) for all dirs in {path} has( {feature}) Number TRUE if feature {feature} supported @@ -1807,6 +1835,7 @@ inputrestore() Number restore typeahead inputsave() Number save and clear typeahead inputsecret( {prompt} [, {text}]) String like input() but hiding the text insert( {list}, {item} [, {idx}]) List insert {item} in {list} [before {idx}] +invert( {expr}) Number bitwise invert isdirectory( {directory}) Number TRUE if {directory} is a directory islocked( {expr}) Number TRUE if {expr} is locked items( {dict}) List key-value pairs in {dict} @@ -1821,9 +1850,11 @@ lispindent( {lnum}) Number Lisp indent for line {lnum} localtime() Number current time log( {expr}) Float natural logarithm (base e) of {expr} log10( {expr}) Float logarithm of Float {expr} to base 10 +luaeval( {expr}[, {expr}]) any evaluate |Lua| expression map( {expr}, {string}) List/Dict change each item in {expr} to {expr} -maparg( {name}[, {mode} [, {abbr}]]) - String rhs of mapping {name} in mode {mode} +maparg( {name}[, {mode} [, {abbr} [, {dict}]]]) + String or Dict + rhs of mapping {name} in mode {mode} mapcheck( {name}[, {mode} [, {abbr}]]) String check for mappings matching {name} match( {expr}, {pat}[, {start}[, {count}]]) @@ -1845,12 +1876,15 @@ mkdir( {name} [, {path} [, {prot}]]) mode( [expr]) String current editing mode mzeval( {expr}) any evaluate |MzScheme| expression nextnonblank( {lnum}) Number line nr of non-blank line >= {lnum} -nr2char( {expr}) String single char with ASCII value {expr} +nr2char( {expr}[, {utf8}]) String single char with ASCII/UTF8 value {expr} +or( {expr}, {expr}) Number bitwise OR pathshorten( {expr}) String shorten directory names in a path pow( {x}, {y}) Float {x} to the power of {y} prevnonblank( {lnum}) Number line nr of non-blank line <= {lnum} printf( {fmt}, {expr1}...) String format text pumvisible() Number whether popup menu is visible +pyeval( {expr}) any evaluate |Python| expression +py3eval( {expr}) any evaluate |python3| expression range( {expr} [, {max} [, {stride}]]) List items from {expr} to {max} readfile( {fname} [, {binary} [, {max}]]) @@ -1872,6 +1906,10 @@ repeat( {expr}, {count}) String repeat {expr} {count} times resolve( {filename}) String get filename a shortcut points to reverse( {list}) List reverse {list} in-place round( {expr}) Float round off {expr} +screenattr( {row}, {col}) Number attribute at screen position +screenchar( {row}, {col}) Number character at screen position +screencol() Number current cursor column +screenrow() Number current cursor row search( {pattern} [, {flags} [, {stopline} [, {timeout}]]]) Number search for {pattern} searchdecl( {name} [, {global} [, {thisblock}]]) @@ -1898,20 +1936,23 @@ settabvar( {nr}, {varname}, {val}) set {varname} in tab page {nr} to {val} settabwinvar( {tabnr}, {winnr}, {varname}, {val}) set {varname} in window {winnr} in tab page {tabnr} to {val} setwinvar( {nr}, {varname}, {val}) set {varname} in window {nr} to {val} +sha256( {string}) String SHA256 checksum of {string} shellescape( {string} [, {special}]) String escape {string} for use as shell command argument +shiftwidth() Number effective value of 'shiftwidth' simplify( {filename}) String simplify filename as much as possible sin( {expr}) Float sine of {expr} sinh( {expr}) Float hyperbolic sine of {expr} -sort( {list} [, {func}]) List sort {list}, using {func} to compare +sort( {list} [, {func} [, {dict}]]) + List sort {list}, using {func} to compare soundfold( {word}) String sound-fold {word} spellbadword() String badly spelled word at cursor spellsuggest( {word} [, {max} [, {capital}]]) List spelling suggestions split( {expr} [, {pat} [, {keepempty}]]) List make |List| from {pat} separated {expr} -sqrt( {expr} Float squar root of {expr} +sqrt( {expr}) Float square root of {expr} str2float( {expr}) Float convert String to Float str2nr( {expr} [, {base}]) Number convert String to Number strchars( {expr}) Number character length of the String {expr} @@ -1927,13 +1968,14 @@ strridx( {haystack}, {needle} [, {start}]) Number last index of {needle} in {haystack} strtrans( {expr}) String translate string to make it printable strwidth( {expr}) Number display cell length of the String {expr} -submatch( {nr}) String specific match in ":substitute" +submatch( {nr}) String specific match in ":s" or substitute() substitute( {expr}, {pat}, {sub}, {flags}) String all {pat} in {expr} replaced with {sub} synID( {lnum}, {col}, {trans}) Number syntax ID at {lnum} and {col} synIDattr( {synID}, {what} [, {mode}]) String attribute {what} of syntax ID {synID} synIDtrans( {synID}) Number translated syntax ID of {synID} +synconcealed( {lnum}, {col}) List info about concealing synstack( {lnum}, {col}) List stack of syntax IDs at {lnum} and {col} system( {expr} [, {input}]) String output of shell command/filter {expr} tabpagebuflist( [{arg}]) List list of buffer numbers in tab page @@ -1949,13 +1991,14 @@ tolower( {expr}) String the String {expr} switched to lowercase toupper( {expr}) String the String {expr} switched to uppercase tr( {src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr} to chars in {tostr} -trunc( {expr} Float truncate Float {expr} +trunc( {expr}) Float truncate Float {expr} type( {name}) Number type of variable {name} undofile( {name}) String undo file name for {name} undotree() List undo file tree values( {dict}) List values in {dict} virtcol( {expr}) Number screen column of cursor or mark visualmode( [expr]) String last visual mode used +wildmenumode() Number whether 'wildmenu' mode is active winbufnr( {nr}) Number buffer number of window {nr} wincol() Number window column of the cursor winheight( {nr}) Number height of window {nr} @@ -1967,6 +2010,7 @@ winsaveview() Dict save view of current window winwidth( {nr}) Number width of window {nr} writefile( {list}, {fname} [, {binary}]) Number write list of lines to file {fname} +xor( {expr}, {expr}) Number bitwise XOR abs({expr}) *abs()* Return the absolute value of {expr}. When {expr} evaluates to @@ -2006,6 +2050,13 @@ add({list}, {expr}) *add()* Use |insert()| to add an item at another position. +and({expr}, {expr}) *and()* + Bitwise AND on the two arguments. The arguments are converted + to a number. A List, Dict or Float argument causes an error. + Example: > + :let flag = and(bits, 0x80) + + append({lnum}, {expr}) *append()* When {expr} is a |List|: Append each item of the |List| as a text line below line {lnum} in the current buffer. @@ -2250,14 +2301,17 @@ changenr() *changenr()* redo it is the number of the redone change. After undo it is one less than the number of the undone change. -char2nr({expr}) *char2nr()* +char2nr({expr}[, {utf8}]) *char2nr()* Return number value of the first char in {expr}. Examples: > char2nr(" ") returns 32 char2nr("ABC") returns 65 -< The current 'encoding' is used. Example for "utf-8": > +< When {utf8} is omitted or zero, the current 'encoding' is used. + Example for "utf-8": > char2nr("á") returns 225 char2nr("á"[0]) returns 195 -< |nr2char()| does the opposite. +< With {utf8} set to 1, always treat as utf-8 characters. + A combining character is a separate character. + |nr2char()| does the opposite. cindent({lnum}) *cindent()* Get the amount of indent for line {lnum} according the C @@ -2277,7 +2331,7 @@ col({expr}) The result is a Number, which is the byte index of the column position given with {expr}. The accepted positions are: . the cursor position $ the end of the cursor line (the result is the - number of characters in the cursor line plus one) + number of bytes in the cursor line plus one) 'x position of mark x (if the mark is not set, 0 is returned) Additionally {expr} can be [lnum, col]: a |List| with the line @@ -2531,6 +2585,8 @@ delete({fname}) *delete()* which is 0 if the file was deleted successfully, and non-zero when the deletion failed. Use |remove()| to delete an item from a |List|. + To delete a line from the buffer use |:delete|. Use |:exe| + when the line number is in a variable. *did_filetype()* did_filetype() Returns non-zero when autocommands are being executed and the @@ -2708,16 +2764,19 @@ exp({expr}) *exp()* {only available when compiled with the |+float| feature} -expand({expr} [, {flag}]) *expand()* +expand({expr} [, {nosuf} [, {list}]]) *expand()* Expand wildcards and the following special keywords in {expr}. - The result is a String. + 'wildignorecase' applies. - When there are several matches, they are separated by - characters. [Note: in version 5.0 a space was used, which - caused problems when a file name contains a space] + If {list} is given and it is non-zero, a List will be returned. + Otherwise the result is a String and when there are several + matches, they are separated by characters. [Note: in + version 5.0 a space was used, which caused problems when a + file name contains a space] If the expansion fails, the result is an empty string. A name - for a non-existing file is not included. + for a non-existing file is not included, unless {expr} does + not start with '%', '#' or '<', see below. When {expr} starts with '%', '#' or '<', the expansion is done like for the |cmdline-special| variables with their associated @@ -2731,6 +2790,7 @@ expand({expr} [, {flag}]) *expand()* autocmd buffer number (as a String!) autocmd matched name sourced script file name + sourced script file line number word under the cursor WORD under the cursor the {clientid} of the last received @@ -2767,10 +2827,10 @@ expand({expr} [, {flag}]) *expand()* When {expr} does not start with '%', '#' or '<', it is expanded like a file name is expanded on the command line. 'suffixes' and 'wildignore' are used, unless the optional - {flag} argument is given and it is non-zero. Names for - non-existing files are included. The "**" item can be used to - search in a directory tree. For example, to find all "README" - files in the current directory and below: > + {nosuf} argument is given and it is non-zero. + Names for non-existing files are included. The "**" item can + be used to search in a directory tree. For example, to find + all "README" files in the current directory and below: > :echo expand("**/README") < Expand() can also be used to expand variables and environment @@ -3043,7 +3103,7 @@ function({name}) *function()* *E700* {name} can be a user defined function or an internal function. -garbagecollect([at_exit]) *garbagecollect()* +garbagecollect([{atexit}]) *garbagecollect()* Cleanup unused |Lists| and |Dictionaries| that have circular references. There is hardly ever a need to invoke this function, as it is automatically done when Vim runs out of @@ -3053,7 +3113,7 @@ garbagecollect([at_exit]) *garbagecollect()* This is useful if you have deleted a very big |List| and/or |Dictionary| with circular references in a script that runs for a long time. - When the optional "at_exit" argument is one, garbage + When the optional {atexit} argument is one, garbage collection will also be done when exiting Vim, if it wasn't done before. This is useful when checking for memory leaks. @@ -3091,7 +3151,7 @@ getbufline({expr}, {lnum} [, {end}]) Example: > :let lines = getbufline(bufnr("myfile"), 1, "$") -getbufvar({expr}, {varname}) *getbufvar()* +getbufvar({expr}, {varname} [, {def}]) *getbufvar()* The result is the value of option or local buffer variable {varname} in buffer {expr}. Note that the name without "b:" must be used. @@ -3101,8 +3161,8 @@ getbufvar({expr}, {varname}) *getbufvar()* doesn't work for a global variable, window-local variable or window-local option. For the use of {expr}, see |bufname()| above. - When the buffer or variable doesn't exist an empty string is - returned, there is no error message. + When the buffer or variable doesn't exist {def} or an empty + string is returned, there is no error message. Examples: > :let bufmodified = getbufvar(1, "&mod") :echo "todo myvar = " . getbufvar("todo", "myvar") @@ -3129,6 +3189,8 @@ getchar([expr]) *getchar()* one-byte character it is the character itself as a number. Use nr2char() to convert it to a String. + Use getcharmod() to obtain any additional modifiers. + When the user clicks a mouse button, the mouse event will be returned. The position can then be found in |v:mouse_col|, |v:mouse_lnum| and |v:mouse_win|. This example positions the @@ -3167,10 +3229,11 @@ getcharmod() *getcharmod()* 2 shift 4 control 8 alt (meta) - 16 mouse double click - 32 mouse triple click - 64 mouse quadruple click - 128 Macintosh only: command + 16 meta (when it's different from ALT) + 32 mouse double click + 64 mouse triple click + 96 mouse quadruple click (== 32 + 64) + 128 command (Macintosh only) Only the modifiers that have not been included in the character itself are obtained. Thus Shift-a results in "A" without a modifier. @@ -3187,7 +3250,8 @@ getcmdpos() *getcmdpos()* Return the position of the cursor in the command line as a byte count. The first column is 1. Only works when editing the command line, thus requires use of - |c_CTRL-\_e| or |c_CTRL-R_=|. Returns 0 otherwise. + |c_CTRL-\_e| or |c_CTRL-R_=| or an expression mapping. + Returns 0 otherwise. Also see |getcmdtype()|, |setcmdpos()| and |getcmdline()|. getcmdtype() *getcmdtype()* @@ -3200,8 +3264,8 @@ getcmdtype() *getcmdtype()* @ |input()| command - |:insert| or |:append| command Only works when editing the command line, thus requires use of - |c_CTRL-\_e| or |c_CTRL-R_=|. Returns an empty string - otherwise. + |c_CTRL-\_e| or |c_CTRL-R_=| or an expression mapping. + Returns an empty string otherwise. Also see |getcmdpos()|, |setcmdpos()| and |getcmdline()|. *getcwd()* @@ -3239,8 +3303,9 @@ getfperm({fname}) *getfperm()* "rwx" flags represent, in turn, the permissions of the owner of the file, the group the file belongs to, and other users. If a user does not have a given permission the flag for this - is replaced with the string "-". Example: > + is replaced with the string "-". Examples: > :echo getfperm("/etc/passwd") + :echo getfperm(expand("~/.vimrc")) < This will hopefully (from a security point of view) display the string "rw-r--r--" or even "rw-------". @@ -3374,26 +3439,30 @@ getregtype([{regname}]) *getregtype()* is one character with value 0x16. If {regname} is not specified, |v:register| is used. -gettabvar({tabnr}, {varname}) *gettabvar()* +gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()* Get the value of a tab-local variable {varname} in tab page {tabnr}. |t:var| Tabs are numbered starting with one. Note that the name without "t:" must be used. + When the tab or variable doesn't exist {def} or an empty + string is returned, there is no error message. -gettabwinvar({tabnr}, {winnr}, {varname}) *gettabwinvar()* +gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()* Get the value of window-local variable {varname} in window {winnr} in tab page {tabnr}. When {varname} starts with "&" get the value of a window-local option. + When {varname} is empty a dictionary with all window-local + variables is returned. + Note that {varname} must be the name without "w:". Tabs are numbered starting with one. For the current tabpage use |getwinvar()|. When {winnr} is zero the current window is used. This also works for a global option, buffer-local option and window-local option, but it doesn't work for a global variable or buffer-local variable. - When {varname} is empty a dictionary with all window-local - variables is returned. - Note that {varname} must be the name without "w:". + When the tab, window or variable doesn't exist {def} or an + empty string is returned, there is no error message. Examples: > :let list_is_on = gettabwinvar(1, 2, '&list') :echo "myvar = " . gettabwinvar(3, 1, 'myvar') @@ -3408,24 +3477,31 @@ getwinposy() The result is a Number, which is the Y coordinate in pixels of the top of the GUI Vim window. The result will be -1 if the information is not available. -getwinvar({winnr}, {varname}) *getwinvar()* +getwinvar({winnr}, {varname} [, {def}]) *getwinvar()* Like |gettabwinvar()| for the current tabpage. Examples: > :let list_is_on = getwinvar(2, '&list') :echo "myvar = " . getwinvar(1, 'myvar') < -glob({expr} [, {flag}]) *glob()* +glob({expr} [, {nosuf} [, {list}]]) *glob()* Expand the file wildcards in {expr}. See |wildcards| for the use of special characters. - The result is a String. - When there are several matches, they are separated by - characters. - Unless the optional {flag} argument is given and is non-zero, + + Unless the optional {nosuf} argument is given and is non-zero, the 'suffixes' and 'wildignore' options apply: Names matching one of the patterns in 'wildignore' will be skipped and 'suffixes' affect the ordering of matches. - If the expansion fails, the result is an empty string. - A name for a non-existing file is not included. + 'wildignorecase' always applies. + + When {list} is present and it is non-zero the result is a List + with all matching files. The advantage of using a List is, + you also get filenames containing newlines correctly. + Otherwise the result is a String and when there are several + matches, they are separated by characters. + + If the expansion fails, the result is an empty String or List. + A name for a non-existing file is not included. A symbolic + link is only included if it points to an existing file. For most systems backticks can be used to get files names from any external command. Example: > @@ -3511,6 +3587,9 @@ histadd({history}, {item}) *histadd()* "search" or "/" search pattern history "expr" or "=" typed expression history "input" or "@" input line history + "debug" or ">" debug command history + The {history} string does not need to be the whole name, one + character is sufficient. If {item} does already exist in the history, it will be shifted to become the newest entry. The result is a Number: 1 if the operation was successful, @@ -3694,10 +3773,10 @@ inputdialog({prompt} [, {text} [, {cancelreturn}]]) *inputdialog()* Like |input()|, but when the GUI is running and text dialogs are supported, a dialog window pops up to input the text. Example: > - :let n = inputdialog("value for shiftwidth", &sw) - :if n != "" - : let &sw = n - :endif + :let n = inputdialog("value for shiftwidth", shiftwidth()) + :if n != "" + : let &sw = n + :endif < When the dialog is cancelled {cancelreturn} is returned. When omitted an empty string is returned. Hitting works like pressing the OK button. Hitting @@ -3759,6 +3838,11 @@ insert({list}, {item} [, {idx}]) *insert()* Note that when {item} is a |List| it is inserted as a single item. Use |extend()| to concatenate |Lists|. +invert({expr}) *invert()* + Bitwise invert. The argument is converted to a number. A + List, Dict or Float argument causes an error. Example: > + :let bits = invert(bits) + isdirectory({directory}) *isdirectory()* The result is a Number, which is non-zero when a directory with the name {directory} exists. If {directory} doesn't @@ -3897,11 +3981,12 @@ line2byte({lnum}) *line2byte()* Return the byte count from the start of the buffer for line {lnum}. This includes the end-of-line character, depending on the 'fileformat' option for the current buffer. The first - line returns 1. + line returns 1. 'encoding' matters, 'fileencoding' is ignored. This can also be used to get the byte count for the line just below the last line: > line2byte(line("$") + 1) -< This is the file size plus one. +< This is the buffer size plus one. If 'fileencoding' is empty + it is the file size plus one. When {lnum} is invalid, or the |+byte_offset| feature has been disabled at compile time, -1 is returned. Also see |byte2line()|, |go| and |:goto|. @@ -3941,6 +4026,20 @@ log10({expr}) *log10()* < -2.0 {only available when compiled with the |+float| feature} +luaeval({expr}[, {expr}]) *luaeval()* + Evaluate Lua expression {expr} and return its result converted + to Vim data structures. Second {expr} may hold additional + argument accessible as _A inside first {expr}. + Strings are returned as they are. + Boolean objects are converted to numbers. + Numbers are converted to |Float| values if vim was compiled + with |+float| and to numbers otherwise. + Dictionaries and lists obtained by vim.eval() are returned + as-is. + Other objects are returned as zero without any errors. + See |lua-luaeval| for more details. + {only available when compiled with the |+lua| feature} + map({expr}, {string}) *map()* {expr} must be a |List| or a |Dictionary|. Replace each item in {expr} with the result of evaluating @@ -3959,30 +4058,58 @@ map({expr}, {string}) *map()* The operation is done in-place. If you want a |List| or |Dictionary| to remain unmodified make a copy first: > - :let tlist = map(copy(mylist), ' & . "\t"') + :let tlist = map(copy(mylist), ' v:val . "\t"') < Returns {expr}, the |List| or |Dictionary| that was filtered. When an error is encountered while evaluating {string} no further items in {expr} are processed. -maparg({name}[, {mode} [, {abbr}]]) *maparg()* - Return the rhs of mapping {name} in mode {mode}. When there - is no mapping for {name}, an empty String is returned. +maparg({name}[, {mode} [, {abbr} [, {dict}]]]) *maparg()* + When {dict} is omitted or zero: Return the rhs of mapping + {name} in mode {mode}. The returned String has special + characters translated like in the output of the ":map" command + listing. + + When there is no mapping for {name}, an empty String is + returned. + + The {name} can have special key names, like in the ":map" + command. + {mode} can be one of these strings: "n" Normal - "v" Visual + "v" Visual (including Select) "o" Operator-pending "i" Insert "c" Cmd-line + "s" Select + "x" Visual "l" langmap |language-mapping| "" Normal, Visual and Operator-pending When {mode} is omitted, the modes for "" are used. + When {abbr} is there and it is non-zero use abbreviations instead of mappings. - The {name} can have special key names, like in the ":map" - command. The returned String has special characters - translated like in the output of the ":map" command listing. + + When {dict} is there and it is non-zero return a dictionary + containing all the information of the mapping with the + following items: + "lhs" The {lhs} of the mapping. + "rhs" The {rhs} of the mapping as typed. + "silent" 1 for a |:map-silent| mapping, else 0. + "noremap" 1 if the {rhs} of the mapping is not remappable. + "expr" 1 for an expression mapping (|:map-|). + "buffer" 1 for a buffer local mapping (|:map-local|). + "mode" Modes for which the mapping is defined. In + addition to the modes mentioned above, these + characters will be used: + " " Normal, Visual and Operator-pending + "!" Insert and Commandline mode + (|mapmode-ic|) + "sid" The script local ID, used for mappings + (||). + The mappings local to the current buffer are checked first, then the global mappings. This function can be used to map a key even when it's already @@ -4031,6 +4158,7 @@ match({expr}, {pat}[, {start}[, {count}]]) *match()* {pat} matches. A match at the first character or |List| item returns zero. If there is no match -1 is returned. + For getting submatches see |matchlist()|. Example: > :echo match("testing", "ing") " results in 4 :echo match([1, 'x'], '\a') " results in 1 @@ -4236,7 +4364,7 @@ mode([expr]) Return a string that indicates the current mode. mzeval({expr}) *mzeval()* Evaluate MzScheme expression {expr} and return its result - convert to Vim data structures. + converted to Vim data structures. Numbers and strings are returned as they are. Pairs (including lists and improper lists) and vectors are returned as Vim |Lists|. @@ -4259,14 +4387,16 @@ nextnonblank({lnum}) *nextnonblank()* below it, zero is returned. See also |prevnonblank()|. -nr2char({expr}) *nr2char()* +nr2char({expr}[, {utf8}]) *nr2char()* Return a string with a single character, which has the number value {expr}. Examples: > nr2char(64) returns "@" nr2char(32) returns " " -< The current 'encoding' is used. Example for "utf-8": > +< When {utf8} is omitted or zero, the current 'encoding' is used. + Example for "utf-8": > nr2char(300) returns I with bow character -< Note that a NUL character in the file is specified with +< With {utf8} set to 1, always return utf-8 characters. + Note that a NUL character in the file is specified with nr2char(10), because NULs are represented with newline characters. nr2char(0) is a real NUL and terminates the string, thus results in an empty string. @@ -4295,6 +4425,13 @@ getpos({expr}) Get the position for {expr}. For possible values of {expr} call setpos('.', save_cursor) < Also see |setpos()|. +or({expr}, {expr}) *or()* + Bitwise OR on the two arguments. The arguments are converted + to a number. A List, Dict or Float argument causes an error. + Example: > + :let bits = or(bits, 0x80) + + pathshorten({expr}) *pathshorten()* Shorten directory names in the path {expr} and return the result. The tail, the file name, is kept as-is. The other @@ -4334,6 +4471,7 @@ printf({fmt}, {expr1} ...) *printf()* Often used items are: %s string + %6S string right-aligned in 6 display cells %6s string right-aligned in 6 bytes %.9s string truncated to 9 bytes %c single byte @@ -4448,6 +4586,10 @@ printf({fmt}, {expr1} ...) *printf()* s The text of the String argument is used. If a precision is specified, no more bytes than the number specified are used. + S The text of the String argument is used. If a + precision is specified, no more display cells than the + number specified are used. Without the |+multi_byte| + feature works just like 's'. *printf-f* *E807* f The Float argument is converted into a string of the @@ -4500,6 +4642,29 @@ pumvisible() *pumvisible()* This can be used to avoid some things that would remove the popup menu. + *E860* +py3eval({expr}) *py3eval()* + Evaluate Python expression {expr} and return its result + converted to Vim data structures. + Numbers and strings are returned as they are (strings are + copied though, unicode strings are additionally converted to + 'encoding'). + Lists are represented as Vim |List| type. + Dictionaries are represented as Vim |Dictionary| type with + keys converted to strings. + {only available when compiled with the |+python3| feature} + + *E858* *E859* +pyeval({expr}) *pyeval()* + Evaluate Python expression {expr} and return its result + converted to Vim data structures. + Numbers and strings are returned as they are (strings are + copied though). + Lists are represented as Vim |List| type. + Dictionaries are represented as Vim |Dictionary| type, + non-string keys result in error. + {only available when compiled with the |+python| feature} + *E726* *E727* range({expr} [, {max} [, {stride}]]) *range()* Returns a |List| with Numbers: @@ -4727,12 +4892,50 @@ round({expr}) *round()* echo round(-4.5) < -5.0 {only available when compiled with the |+float| feature} - - + +screenattr(row, col) *screenattr()* + Like screenchar(), but return the attribute. This is a rather + arbitrary number that can only be used to compare to the + attribute at other positions. + +screenchar(row, col) *screenchar()* + The result is a Number, which is the character at position + [row, col] on the screen. This works for every possible + screen position, also status lines, window separators and the + command line. The top left position is row one, column one + The character excludes composing characters. For double-byte + encodings it may only be the first byte. + This is mainly to be used for testing. + Returns -1 when row or col is out of range. + +screencol() *screencol()* + The result is a Number, which is the current screen column of + the cursor. The leftmost column has number 1. + This function is mainly used for testing. + + Note: Always returns the current screen column, thus if used + in a command (e.g. ":echo screencol()") it will return the + column inside the command line, which is 1 when the command is + executed. To get the cursor position in the file use one of + the following mappings: > + nnoremap GG ":echom ".screencol()."\n" + nnoremap GG :echom screencol() +< +screenrow() *screenrow()* + The result is a Number, which is the current screen row of the + cursor. The top line has number one. + This function is mainly used for testing. + + Note: Same restrictions as with |screencol()|. + search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()* Search for regexp pattern {pattern}. The search starts at the cursor position (you can use |cursor()| to set it). + When a match has been found its line number is returned. + If there is no match a 0 is returned and the cursor doesn't + move. No error message is given. + {flags} is a String, which can contain these character flags: 'b' search backward instead of forward 'c' accept a match at the cursor position @@ -4760,15 +4963,12 @@ search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()* A zero value is equal to not giving the argument. When the {timeout} argument is given the search stops when - more than this many milli seconds have passed. Thus when + more than this many milliseconds have passed. Thus when {timeout} is 500 the search stops after half a second. The value must not be negative. A zero value is like not giving the argument. {only available when compiled with the |+reltime| feature} - If there is no match a 0 is returned and the cursor doesn't - move. No error message is given. - When a match has been found its line number is returned. *search()-sub-match* With the 'p' flag the returned value is one more than the first sub-match in \(\). One if none of them matched but the @@ -4987,7 +5187,8 @@ setcmdpos({pos}) *setcmdpos()* line. setline({lnum}, {text}) *setline()* - Set line {lnum} of the current buffer to {text}. + Set line {lnum} of the current buffer to {text}. To insert + lines use |append()|. {lnum} is used like with |getline()|. When {lnum} is just below the last line the {text} will be added as a new line. @@ -4998,7 +5199,7 @@ setline({lnum}, {text}) *setline()* will be set to the items in the list. Example: > :call setline(5, ['aaa', 'bbb', 'ccc']) < This is equivalent to: > - :for [n, l] in [[5, 6, 7], ['aaa', 'bbb', 'ccc']] + :for [n, l] in [[5, 'aaa'], [6, 'bbb'], [7, 'ccc']] : call setline(n, l) :endfor < Note: The '[ and '] marks are not set. @@ -5112,8 +5313,9 @@ setreg({regname}, {value} [,{options}]) If {options} contains no register settings, then the default is to use character mode unless {value} ends in a . - Setting the '=' register is not possible. - Returns zero for success, non-zero for failure. + Setting the '=' register is not possible, but you can use > + :let @= = var_expr +< Returns zero for success, non-zero for failure. Examples: > :call setreg(v:register, @*) @@ -5136,8 +5338,6 @@ settabvar({tabnr}, {varname}, {val}) *settabvar()* |t:var| Note that the variable name without "t:" must be used. Tabs are numbered starting with one. - Vim briefly goes to the tab page {tabnr}, this may trigger - TabLeave and TabEnter autocommands. This function is not available in the |sandbox|. settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()* @@ -5150,8 +5350,6 @@ settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()* doesn't work for a global or local buffer variable. For a local buffer option the global value is unchanged. Note that the variable name without "w:" must be used. - Vim briefly goes to the tab page {tabnr}, this may trigger - TabLeave and TabEnter autocommands. Examples: > :call settabwinvar(1, 1, "&list", 0) :call settabwinvar(3, 2, "myvar", "foobar") @@ -5163,6 +5361,11 @@ setwinvar({nr}, {varname}, {val}) *setwinvar()* :call setwinvar(1, "&list", 0) :call setwinvar(2, "myvar", "foobar") +sha256({string}) *sha256()* + Returns a String with 64 hex charactes, which is the SHA256 + checksum of {string}. + {only available when compiled with the |+cryptv| feature} + shellescape({string} [, {special}]) *shellescape()* Escape {string} for use as a shell command argument. On MS-Windows and MS-DOS, when 'shellslash' is not set, it @@ -5189,6 +5392,23 @@ shellescape({string} [, {special}]) *shellescape()* :call system("chmod +w -- " . shellescape(expand("%"))) +shiftwidth() *shiftwidth()* + Returns the effective value of 'shiftwidth'. This is the + 'shiftwidth' value unless it is zero, in which case it is the + 'tabstop' value. To be backwards compatible in indent + plugins, use this: > + if exists('*shiftwidth') + func s:sw() + return shiftwidth() + endfunc + else + func s:sw() + return &sw + endfunc + endif +< And then use s:sw() instead of &sw. + + simplify({filename}) *simplify()* Simplify the file name as much as possible without changing the meaning. Shortcuts (on MS-Windows) or symbolic links (on @@ -5228,7 +5448,7 @@ sinh({expr}) *sinh()* {only available when compiled with the |+float| feature} -sort({list} [, {func}]) *sort()* *E702* +sort({list} [, {func} [, {dict}]]) *sort()* *E702* Sort the items in {list} in-place. Returns {list}. If you want a list to remain unmodified make a copy first: > :let sortedlist = sort(copy(mylist)) @@ -5236,6 +5456,8 @@ sort({list} [, {func}]) *sort()* *E702* Numbers sort after Strings, |Lists| after Numbers. For sorting text in the current buffer use |:sort|. When {func} is given and it is one then case is ignored. + {dict} is for functions with the "dict" attribute. It will be + used to set the local variable "self". |Dictionary-function| When {func} is a |Funcref| or a function name, this function is called to compare items. The function is invoked with two items as argument and must return zero if they are equal, 1 or @@ -5316,7 +5538,8 @@ split({expr} [, {pattern} [, {keepempty}]]) *split()* empty each white-separated sequence of characters becomes an item. Otherwise the string is split where {pattern} matches, - removing the matched characters. + removing the matched characters. 'ignorecase' is not used + here, add \c to ignore case. |/\c| When the first or last item is empty it is omitted, unless the {keepempty} argument is given and it's non-zero. Other empty items are kept when {pattern} matches at least one @@ -5416,8 +5639,8 @@ stridx({haystack}, {needle} [, {start}]) *stridx()* {haystack} of the first occurrence of the String {needle}. If {start} is specified, the search starts at index {start}. This can be used to find a second match: > - :let comma1 = stridx(line, ",") - :let comma2 = stridx(line, ",", comma1 + 1) + :let colon1 = stridx(line, ":") + :let colon2 = stridx(line, ":", colon1 + 1) < The search is done case-sensitive. For pattern searches use |match()|. -1 is returned if the {needle} does not occur in {haystack}. @@ -5507,9 +5730,11 @@ strwidth({expr}) *strwidth()* Also see |strlen()|, |strdisplaywidth()| and |strchars()|. submatch({nr}) *submatch()* - Only for an expression in a |:substitute| command. Returns - the {nr}'th submatch of the matched text. When {nr} is 0 - the whole matched text is returned. + Only for an expression in a |:substitute| command or + substitute() function. + Returns the {nr}'th submatch of the matched text. When {nr} + is 0 the whole matched text is returned. + Also see |sub-replace-expression|. Example: > :s/\d\+/\=submatch(0) + 1/ < This finds the first number in the line and adds one to it. @@ -5517,26 +5742,37 @@ submatch({nr}) *submatch()* substitute({expr}, {pat}, {sub}, {flags}) *substitute()* The result is a String, which is a copy of {expr}, in which - the first match of {pat} is replaced with {sub}. This works - like the ":substitute" command (without any flags). But the - matching with {pat} is always done like the 'magic' option is - set and 'cpoptions' is empty (to make scripts portable). - 'ignorecase' is still relevant. 'smartcase' is not used. - See |string-match| for how {pat} is used. - And a "~" in {sub} is not replaced with the previous {sub}. + the first match of {pat} is replaced with {sub}. + When {flags} is "g", all matches of {pat} in {expr} are + replaced. Otherwise {flags} should be "". + + This works like the ":substitute" command (without any flags). + But the matching with {pat} is always done like the 'magic' + option is set and 'cpoptions' is empty (to make scripts + portable). 'ignorecase' is still relevant, use |/\c| or |/\C| + if you want to ignore or match case and ignore 'ignorecase'. + 'smartcase' is not used. See |string-match| for how {pat} is + used. + + A "~" in {sub} is not replaced with the previous {sub}. Note that some codes in {sub} have a special meaning |sub-replace-special|. For example, to replace something with "\n" (two characters), use "\\\\n" or '\\n'. + When {pat} does not match in {expr}, {expr} is returned unmodified. - When {flags} is "g", all matches of {pat} in {expr} are - replaced. Otherwise {flags} should be "". + Example: > :let &path = substitute(&path, ",\\=[^,]*$", "", "") < This removes the last component of the 'path' option. > :echo substitute("testing", ".*", "\\U\\0", "") < results in "TESTING". + When {sub} starts with "\=", the remainder is interpreted as + an expression. See |sub-replace-expression|. Example: > + :echo substitute(s, '%\(\x\x\)', + \ '\=nr2char("0x" . submatch(1))', 'g') + synID({lnum}, {col}, {trans}) *synID()* The result is a Number, which is the syntax ID at the position {lnum} and {col} in the current window. @@ -5558,20 +5794,6 @@ synID({lnum}, {col}, {trans}) *synID()* :echo synIDattr(synID(line("."), col("."), 1), "name") < -synconcealed({lnum}, {col}) *synconcealed()* - The result is a List. The first item in the list is 0 if the - character at the position {lnum} and {col} is not part of a - concealable region, 1 if it is. The second item in the list is - a string. If the first item is 1, the second item contains the - text which will be displayed in place of the concealed text, - depending on the current setting of 'conceallevel'. The third - and final item in the list is a unique number representing the - specific syntax region matched. This allows detection of the - beginning of a new concealable region if there are two - consecutive regions with the same replacement character. - For an example use see $VIMRUNTIME/syntax/2html.vim . - - synIDattr({synID}, {what} [, {mode}]) *synIDattr()* The result is a String, which is the {what} attribute of syntax ID {synID}. This can be used to obtain information @@ -5612,6 +5834,20 @@ synIDtrans({synID}) *synIDtrans()* highlight the character. Highlight links given with ":highlight link" are followed. +synconcealed({lnum}, {col}) *synconcealed()* + The result is a List. The first item in the list is 0 if the + character at the position {lnum} and {col} is not part of a + concealable region, 1 if it is. The second item in the list is + a string. If the first item is 1, the second item contains the + text which will be displayed in place of the concealed text, + depending on the current setting of 'conceallevel'. The third + and final item in the list is a unique number representing the + specific syntax region matched. This allows detection of the + beginning of a new concealable region if there are two + consecutive regions with the same replacement character. + For an example use see $VIMRUNTIME/syntax/2html.vim . + + synstack({lnum}, {col}) *synstack()* Return a |List|, which is the stack of syntax items at the position {lnum} and {col} in the current window. Each item in @@ -5648,6 +5884,9 @@ system({expr} [, {input}]) *system()* *E677* < To make the result more system-independent, the shell output is filtered to replace with for Macintosh, and with for DOS-like systems. + To avoid the string being truncated at a NUL, all NUL + characters are replaced with SOH (0x01). + The command executed is constructed using several options: 'shell' 'shellcmdflag' 'shellxquote' {expr} 'shellredir' {tmp} 'shellxquote' ({tmp} is an automatically generated file name). @@ -5674,9 +5913,9 @@ tabpagebuflist([{arg}]) *tabpagebuflist()* omitted the current tab page is used. When {arg} is invalid the number zero is returned. To get a list of all buffers in all tabs use this: > - tablist = [] + let buflist = [] for i in range(tabpagenr('$')) - call extend(tablist, tabpagebuflist(i + 1)) + call extend(buflist, tabpagebuflist(i + 1)) endfor < Note that a buffer may appear in more than one window. @@ -5737,8 +5976,9 @@ taglist({expr}) *taglist()* If there are no matching tags, then an empty list is returned. To get an exact tag match, the anchors '^' and '$' should be - used in {expr}. Refer to |tag-regexp| for more information - about the tag search regular expression pattern. + used in {expr}. This also make the function work faster. + Refer to |tag-regexp| for more information about the tag + search regular expression pattern. Refer to |'tags'| for information about how the tags file is located by Vim. Refer to |tags-file-format| for the format of @@ -5839,6 +6079,8 @@ undofile({name}) *undofile()* the undo file exists. {name} is always expanded to the full path, since that is what is used internally. + If {name} is empty undofile() returns an empty string, since a + buffer without a file name will not write an undo file. Useful in combination with |:wundo| and |:rundo|. When compiled without the +persistent_undo option this always returns an empty string. @@ -5898,13 +6140,13 @@ virtcol({expr}) *virtcol()* would be of unlimited width. When there is a at the position, the returned Number will be the column at the end of the . For example, for a in column 1, with 'ts' - set to 8, it returns 8. + set to 8, it returns 8. |conceal| is ignored. For the byte position use |col()|. For the use of {expr} see |col()|. When 'virtualedit' is used {expr} can be [lnum, col, off], where "off" is the offset in screen columns from the start of the character. E.g., a position within a or after the last - character. + character. When "off" is omitted zero is used. When Virtual editing is active in the current mode, a position beyond the end of the line can be returned. |'virtualedit'| The accepted positions are: @@ -5947,6 +6189,18 @@ visualmode([expr]) *visualmode()* Dictionary or Float is not a Number or String, thus does not cause the mode to be cleared. +wildmenumode() *wildmenumode()* + Returns non-zero when the wildmenu is active and zero + otherwise. See 'wildmenu' and 'wildmode'. + This can be used in mappings to handle the 'wildcharm' option + gracefully. (Makes only sense with |mapmode-c| mappings). + + For example to make work like in wildmode, use: > + :cnoremap wildmenumode() ? "\\" : "\" +< + (Note, this needs the 'wildcharm' option set appropriately). + + *winbufnr()* winbufnr({nr}) The result is a Number, which is the number of the buffer associated with window {nr}. When {nr} is zero, the number of @@ -5979,8 +6233,9 @@ winline() The result is a Number, which is the screen line of the cursor winnr([{arg}]) The result is a Number, which is the number of the current window. The top window has number 1. When the optional argument is "$", the number of the - last window is returned (the window count). - When the optional argument is "#", the number of the last + last window is returned (the window count). > + let window_count = winnr('$') +< When the optional argument is "#", the number of the last accessed window is returned (where |CTRL-W_p| goes to). If there is no previous window or it is in another tab page 0 is returned. @@ -6056,8 +6311,16 @@ writefile({list}, {fname} [, {binary}]) To copy a file byte for byte: > :let fl = readfile("foo", "b") :call writefile(fl, "foocopy", "b") + + +xor({expr}, {expr}) *xor()* + Bitwise XOR on the two arguments. The arguments are converted + to a number. A List, Dict or Float argument causes an error. + Example: > + :let bits = xor(bits, 0x80) < + *feature-list* There are three types of features: 1. Features that are only supported when they have been enabled when Vim @@ -6084,6 +6347,7 @@ balloon_multiline GUI supports multiline balloons. beos BeOS version of Vim. browse Compiled with |:browse| support, and browse() will work. +browsefilter Compiled with support for |browsefilter|. builtin_terms Compiled with some builtin terminals. byte_offset Compiled with support for 'o' in 'statusline' cindent Compiled with 'cindent' support. @@ -6093,17 +6357,17 @@ cmdline_compl Compiled with |cmdline-completion| support. cmdline_hist Compiled with |cmdline-history| support. cmdline_info Compiled with 'showcmd' and 'ruler' support. comments Compiled with |'comments'| support. +compatible Compiled to be very Vi compatible. cryptv Compiled with encryption support |encryption|. cscope Compiled with |cscope| support. -compatible Compiled to be very Vi compatible. debug Compiled with "DEBUG" defined. dialog_con Compiled with console dialog support. dialog_gui Compiled with GUI dialog support. diff Compiled with |vimdiff| and 'diff' support. digraphs Compiled with support for digraphs. dnd Compiled with support for the "~ register |quote_~|. -dos32 32 bits DOS (DJGPP) version of Vim. dos16 16 bits DOS version of Vim. +dos32 32 bits DOS (DJGPP) version of Vim. ebcdic Compiled on a machine with ebcdic character set. emacs_tags Compiled with support for Emacs tags. eval Compiled with expression evaluation support. Always @@ -6126,15 +6390,15 @@ fork Compiled to use fork()/exec() instead of system(). gettext Compiled with message translation |multi-lang| gui Compiled with GUI enabled. gui_athena Compiled with Athena GUI. +gui_gnome Compiled with Gnome support (gui_gtk is also defined). gui_gtk Compiled with GTK+ GUI (any version). gui_gtk2 Compiled with GTK+ 2 GUI (gui_gtk is also defined). -gui_gnome Compiled with Gnome support (gui_gtk is also defined). gui_mac Compiled with Macintosh GUI. gui_motif Compiled with Motif GUI. gui_photon Compiled with Photon GUI. +gui_running Vim is running in the GUI, or it will start soon. gui_win32 Compiled with MS Windows Win32 GUI. gui_win32s idem, and Win32s system being used (Windows 3.1) -gui_running Vim is running in the GUI, or it will start soon. hangul_input Compiled with Hangul input support. |hangul| iconv Can use iconv() for conversion. insert_expand Compiled with support for CTRL-X expansion commands in @@ -6156,30 +6420,32 @@ menu Compiled with support for |:menu|. mksession Compiled with support for |:mksession|. modify_fname Compiled with file name modifiers. |filename-modifiers| mouse Compiled with support mouse. -mouseshape Compiled with support for 'mouseshape'. mouse_dec Compiled with support for Dec terminal mouse. mouse_gpm Compiled with support for gpm (Linux console mouse) mouse_netterm Compiled with support for netterm mouse. mouse_pterm Compiled with support for qnx pterm mouse. mouse_sysmouse Compiled with support for sysmouse (*BSD console mouse) +mouse_sgr Compiled with support for sgr mouse. +mouse_urxvt Compiled with support for urxvt mouse. mouse_xterm Compiled with support for xterm mouse. +mouseshape Compiled with support for 'mouseshape'. multi_byte Compiled with support for 'encoding' multi_byte_encoding 'encoding' is set to a multi-byte encoding. multi_byte_ime Compiled with support for IME input method. multi_lang Compiled with support for multiple languages. mzscheme Compiled with MzScheme interface |mzscheme|. -netbeans_intg Compiled with support for |netbeans|. netbeans_enabled Compiled with support for |netbeans| and connected. +netbeans_intg Compiled with support for |netbeans|. ole Compiled with OLE automation support for Win32. os2 OS/2 version of Vim. -osfiletype Compiled with support for osfiletypes |+osfiletype| path_extra Compiled with up/downwards search in 'path' and 'tags' perl Compiled with Perl interface. persistent_undo Compiled with support for persistent undo history. postscript Compiled with PostScript file printing. printer Compiled with |:hardcopy| support. profile Compiled with |:profile| support. -python Compiled with Python interface. +python Compiled with Python 2.x interface. |has-python| +python3 Compiled with Python 3.x interface. |has-python| qnx QNX version of Vim. quickfix Compiled with |quickfix| support. reltime Compiled with |reltime()| support. @@ -6190,11 +6456,11 @@ showcmd Compiled with 'showcmd' support. signs Compiled with |:sign| support. smartindent Compiled with 'smartindent' support. sniff Compiled with SNiFF interface support. +spell Compiled with spell checking support |spell|. startuptime Compiled with |--startuptime| support. statusline Compiled with support for 'statusline', 'rulerformat' and special formats of 'titlestring' and 'iconstring'. sun_workshop Compiled with support for Sun |workshop|. -spell Compiled with spell checking support |spell|. syntax Compiled with syntax highlighting support |syntax|. syntax_items There are active syntax highlighting items for the current buffer. @@ -6215,9 +6481,9 @@ title Compiled with window title support |'title'|. toolbar Compiled with support for |gui-toolbar|. unix Unix version of Vim. user_commands User-defined commands. -viminfo Compiled with viminfo support. -vim_starting True while initial source'ing takes place. vertsplit Compiled with vertically split windows |:vsplit|. +vim_starting True while initial source'ing takes place. |startup| +viminfo Compiled with viminfo support. virtualedit Compiled with 'virtualedit' option. visual Compiled with Visual mode. visualextra Compiled with extra Visual mode commands. @@ -6226,16 +6492,18 @@ vms VMS version of Vim. vreplace Compiled with |gR| and |gr| commands. wildignore Compiled with 'wildignore' option. wildmenu Compiled with 'wildmenu' option. -windows Compiled with support for more than one window. -winaltkeys Compiled with 'winaltkeys' option. win16 Win16 version of Vim (MS-Windows 3.1). -win32 Win32 version of Vim (MS-Windows 95/98/ME/NT/2000/XP). -win64 Win64 version of Vim (MS-Windows 64 bit). +win32 Win32 version of Vim (MS-Windows 95 and later, 32 or + 64 bits) win32unix Win32 version of Vim, using Unix files (Cygwin) +win64 Win64 version of Vim (MS-Windows 64 bit). win95 Win32 version for MS-Windows 95/98/ME. +winaltkeys Compiled with 'winaltkeys' option. +windows Compiled with support for more than one window. writebackup Compiled with 'writebackup' default on. xfontset Compiled with X fontset support |xfontset|. xim Compiled with X input method support |xim|. +xpm_w32 Compiled with pixmap support for Win32. xsmp Compiled with X session management support. xsmp_interact Compiled with interactive X session management support. xterm_clipboard Compiled with support for xterm clipboard. @@ -6308,7 +6576,7 @@ last defined. Example: > < See |:verbose-cmd| for more information. - *E124* *E125* + *E124* *E125* *E853* :fu[nction][!] {name}([arguments]) [range] [abort] [dict] Define a new function by the name {name}. The name must be made of alphanumeric characters and '_', and @@ -6338,6 +6606,8 @@ See |:verbose-cmd| for more information. is excluded, ":{range}call" will call the function for each line in the range, with the cursor on the start of each line. See |function-range-example|. + The cursor is still moved to the first line of the + range, as is the case with all Ex commands. When the [abort] argument is added, the function will abort as soon as an error is detected. @@ -6569,9 +6839,9 @@ Hint: If you distribute a bunch of scripts you can pack them together with the ============================================================================== 6. Curly braces names *curly-braces-names* -Wherever you can use a variable, you can use a "curly braces name" variable. -This is a regular variable name with one or more expressions wrapped in braces -{} like this: > +In most places where you can use a variable, you can use a "curly braces name" +variable. This is a regular variable name with one or more expressions +wrapped in braces {} like this: > my_{adjective}_variable When Vim encounters this, it evaluates the expression inside the braces, puts @@ -6607,6 +6877,11 @@ Example: > This would call the function "my_func_whizz(parameter)". +This does NOT work: > + :let i = 3 + :let @{i} = '' " error + :echo @{i} " error + ============================================================================== 7. Commands *expression-commands* @@ -6741,7 +7016,8 @@ This would call the function "my_func_whizz(parameter)". :let [{name}, ..., ; {lastname}] -= {expr1} Like above, but append/add/subtract the value for each |List| item. - *E106* + + *E121* :let {var-name} .. List the value of variable {var-name}. Multiple variable names may be given. Special names recognized here: *E738* @@ -7027,7 +7303,9 @@ This would call the function "my_func_whizz(parameter)". is terminated. Example: > :try | throw "oops" | catch /^oo/ | echo "caught" | endtry -< +< Note that "catch" may need to be on a separate line + for when an error causes the parsing to skip the whole + line and not see the "|" that separates the commands. *:ec* *:echo* :ec[ho] {expr1} .. Echoes each {expr1}, with a space in between. The diff --git a/runtime/doc/evim-fr.1 b/runtime/doc/evim-fr.1 index 792c1bc..898ed70 100644 --- a/runtime/doc/evim-fr.1 +++ b/runtime/doc/evim-fr.1 @@ -1,4 +1,4 @@ -.TH EVIM 1 "16 février 2002 February 16" +.TH EVIM 1 "16 février 2002" .SH NAME evim \- « Easy Vim », édite un fichier avec Vim sans utiliser les modes .SH SYNOPSIS @@ -54,3 +54,4 @@ Voir le menu Aide/Remerciements ou ":help credits" dans .SH TRADUCTION Cette page de manuel a été traduite David Blanchet. 2005-03-26. +Mise à jour 2013-05-10, Dominique Pellé diff --git a/runtime/doc/evim-fr.UTF-8.1 b/runtime/doc/evim-fr.UTF-8.1 index 9594161..2b38e66 100644 --- a/runtime/doc/evim-fr.UTF-8.1 +++ b/runtime/doc/evim-fr.UTF-8.1 @@ -1,4 +1,4 @@ -.TH EVIM 1 "16 février 2002 February 16" +.TH EVIM 1 "16 février 2002" .SH NAME evim \- « Easy Vim », édite un fichier avec Vim sans utiliser les modes .SH SYNOPSIS @@ -54,3 +54,4 @@ Voir le menu Aide/Remerciements ou ":help credits" dans .SH TRADUCTION Cette page de manuel a été traduite David Blanchet. 2005-03-26. +Mise à jour 2013-05-10, Dominique Pellé diff --git a/runtime/doc/evim-ja.UTF-8.1 b/runtime/doc/evim-ja.UTF-8.1 new file mode 100644 index 0000000..1b7a657 --- /dev/null +++ b/runtime/doc/evim-ja.UTF-8.1 @@ -0,0 +1,51 @@ +.TH EVIM 1 "2002 February 16" +.SH 名前 +evim \- easy Vim, モードレスエディタ Vim +.SH 書式 +.br +.B evim +[options] [file ..] +.br +.B eview +.SH 説明 +.B eVim +は +.B Vim +を起動して、モードレスエディタとして動作するためのオプションを設定します。 +Vim の動作が point-and-click エディタのような動作になります。 +MS-Windows のメモ帳のような動作です。 +.B eVim +は常に GUI で起動し、メニューとツールバーを表示します。 +.PP +どうしても Vim の操作に馴染めない場合に使ってください。 +編集効率は下がります。 +.PP +.B eview +は同様に、読み込み専用モードで起動します。evim \-R と同じです。 +.PP +引数や Vim についての詳細は vim(1) を参照してください。 +.PP +オプション 'insertmode' が設定され、テキストを直接、入力できるようになりま +す。 +.br +コピーとペーストのキー操作が MS-Windows と同じになるように、マップが設定され +ます。 +CTRL-X が切り取り、CTRL-C がコピー、CTRL-V がペーストです。 +標準の CTRL-V の操作は CTRL-Q に割り当てられます。 +.SH オプション +vim(1) を参照してください。 +.SH ファイル +.TP 15 +/usr/local/lib/vim/evim.vim +eVim の初期化スクリプト。 +.SH 別名 +evim は "gumbies のための Vim" とも呼ばれています。 +evim を使っているあなたはきっと、頭にハンカチをかぶっているのです。 +(訳注: gumbies は Monty Python に登場するおもしろ集団。ハンカチをかぶっ +ている。) +.SH 関連項目 +vim(1) +.SH 著者 +.B Vim +のほとんどの機能は Bram Moolenaar が開発し、多くの人が協力しました。 +メニューの Help/Credits を参照してください。 diff --git a/runtime/doc/farsi.txt b/runtime/doc/farsi.txt index a24a2dc..77ec419 100644 --- a/runtime/doc/farsi.txt +++ b/runtime/doc/farsi.txt @@ -1,4 +1,4 @@ -*farsi.txt* For Vim version 7.3. Last change: 2010 Aug 07 +*farsi.txt* For Vim version 7.4. Last change: 2010 Aug 07 VIM REFERENCE MANUAL by Mortaza Ghassab Shiran diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index c76adfc..1cee25b 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -1,4 +1,4 @@ -*filetype.txt* For Vim version 7.3. Last change: 2008 Jul 15 +*filetype.txt* For Vim version 7.4. Last change: 2013 May 25 VIM REFERENCE MANUAL by Bram Moolenaar @@ -270,6 +270,9 @@ directories! *autocmd-osfiletypes* +NOTE: this code is currently disabled, as the RISC OS implementation was +removed. In the future this will use the 'filetype' option. + On operating systems which support storing a file type with the file, you can specify that an autocommand should only be executed if the file is of a certain type. @@ -296,8 +299,6 @@ must both match): > This will match files of type "&fff" whose names start with "diff". -Note that osfiletype checking is skipped if Vim is compiled without the -|+osfiletype| feature. *plugin-details* The "plugin" directory can be in any of the directories in the 'runtimepath' @@ -602,7 +603,7 @@ Since the text for this plugin is rather long it has been put in a separate file: |ft_sql.txt|. -TEX *ft-tex-plugin* +TEX *ft-tex-plugin* *g:tex_flavor* If the first line of a *.tex file has the form > %& diff --git a/runtime/doc/fold.txt b/runtime/doc/fold.txt index 24a8dcb..240d912 100644 --- a/runtime/doc/fold.txt +++ b/runtime/doc/fold.txt @@ -1,4 +1,4 @@ -*fold.txt* For Vim version 7.3. Last change: 2010 May 13 +*fold.txt* For Vim version 7.4. Last change: 2010 May 13 VIM REFERENCE MANUAL by Bram Moolenaar @@ -60,7 +60,7 @@ level form a fold, with the lines with a higher level forming a nested fold. The nesting of folds is limited with 'foldnestmax'. Some lines are ignored and get the fold level of the line above or below it, -whatever is the lowest. These are empty or white lines and lines starting +whichever is lower. These are empty or white lines and lines starting with a character in 'foldignore'. White space is skipped before checking for characters in 'foldignore'. For C use "#" to ignore preprocessor lines. diff --git a/runtime/doc/ft_ada.txt b/runtime/doc/ft_ada.txt index 54c6b3f..dcab23c 100644 --- a/runtime/doc/ft_ada.txt +++ b/runtime/doc/ft_ada.txt @@ -1,4 +1,4 @@ -*ft_ada.txt* For Vim version 7.3. Last change: 2010 Jul 20 +*ft_ada.txt* For Vim version 7.4. Last change: 2010 Jul 20 ADA FILE TYPE PLUG-INS REFERENCE MANUAL~ @@ -6,20 +6,20 @@ ADA *ada.vim* 1. Syntax Highlighting |ft-ada-syntax| -2. Plug-in |ft-ada-plugin| +2. File type Plug-in |ft-ada-plugin| 3. Omni Completion |ft-ada-omni| 3.1 Omni Completion with "gnat xref" |gnat-xref| 3.2 Omni Completion with "ctags" |ada-ctags| 4. Compiler Support |ada-compiler| 4.1 GNAT |compiler-gnat| - 4.1 Dec Ada |compiler-decada| + 4.2 Dec Ada |compiler-decada| 5. References |ada-reference| 5.1 Options |ft-ada-options| - 5.2 Functions |ft-ada-functions| - 5.3 Commands |ft-ada-commands| - 5.4 Variables |ft-ada-variables| - 5.5 Constants |ft-ada-constants| -8. Extra Plug-ins |ada-extra-plugins| + 5.2 Commands |ft-ada-commands| + 5.3 Variables |ft-ada-variables| + 5.4 Constants |ft-ada-constants| + 5.5 Functions |ft-ada-functions| +6. Extra Plug-ins |ada-extra-plugins| ============================================================================== 1. Syntax Highlighting ~ @@ -139,7 +139,7 @@ The Ada parser for Exuberant Ctags is fairly new - don't expect complete support yet. ============================================================================== -4. Compiler Support ~ +4. Compiler Support ~ *ada-compiler* The Ada mode supports more than one Ada compiler and will automatically load the @@ -367,7 +367,7 @@ false when the variable is undefined. The value to which the variable is set makes no difference. ------------------------------------------------------------------------------ -5.3 Commands ~ +5.2 Commands ~ *ft-ada-commands* :AdaRainbow *:AdaRainbow* @@ -445,7 +445,7 @@ g:ada#Ctags_Kinds dictionary of lists for Ctags generates. ------------------------------------------------------------------------------ -5.2 Functions ~ +5.5 Functions ~ *ft-ada-functions* ada#Word([{line}, {col}]) *ada#Word()* @@ -479,7 +479,7 @@ gnat#New () ============================================================================== -8. Extra Plugins ~ +6. Extra Plugins ~ *ada-extra-plugins* You can optionally install the following extra plug-ins. They work well with diff --git a/runtime/doc/ft_sql.txt b/runtime/doc/ft_sql.txt index 1360a03..72ea3ed 100644 --- a/runtime/doc/ft_sql.txt +++ b/runtime/doc/ft_sql.txt @@ -1,4 +1,4 @@ -*ft_sql.txt* For Vim version 7.3. Last change: 2010 Jul 20 +*ft_sql.txt* For Vim version 7.4. Last change: 2013 May 15 by David Fishburn @@ -349,6 +349,7 @@ may not work properly on all platforms: > The static maps (which are based on the syntax highlight groups) follow this format: > imap k :call sqlcomplete#Map('sqlKeyword') + imap k :call sqlcomplete#Map('sqlKeyword\w*') This command breaks down as: > imap - Create an insert map @@ -369,6 +370,9 @@ This command breaks down as: > command while editing a SQL file. 'sqlKeyword' - Display the items for the sqlKeyword highlight group + 'sqlKeyword\w*' - A second option available with Vim 7.4 which + uses a regular expression to determine which + syntax groups to use ) - Execute the :let command - Trigger the standard omni completion key stroke. Passing in 'sqlKeyword' instructs the SQL @@ -435,7 +439,7 @@ the space bar): of columns, you can press , this will replace the column list with the list of tables. - This allows you to quickly drill down into a - table to view it's columns and back again. + table to view its columns and back again. - and can be also be chosen via your |.vimrc| > let g:ftplugin_sql_omni_key_right = '' @@ -645,7 +649,7 @@ your |vimrc|: > - When completing tables, procedure or views and using dbext.vim 3.00 or higher the list of objects will also include the owner name. When completing these objects and omni_sql_include_owner is enabled - the owner name will be be replaced. > + the owner name will be replaced. > omni_sql_precache_syntax_groups < - Default: diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt index f9bbf78..1ae5495 100644 --- a/runtime/doc/gui.txt +++ b/runtime/doc/gui.txt @@ -1,4 +1,4 @@ -*gui.txt* For Vim version 7.3. Last change: 2010 May 14 +*gui.txt* For Vim version 7.4. Last change: 2013 Jun 12 VIM REFERENCE MANUAL by Bram Moolenaar @@ -93,10 +93,16 @@ and initialize other things that you may want to set up differently from the terminal version. Recommended place for your personal GUI initializations: - Unix $HOME/.gvimrc - OS/2 $HOME/.gvimrc or $VIM/.gvimrc - MS-DOS and Win32 $HOME/_gvimrc or $VIM/_gvimrc - Amiga s:.gvimrc or $VIM/.gvimrc + Unix $HOME/.gvimrc or $HOME/.vim/gvimrc + OS/2 $HOME/.gvimrc, $HOME/vimfiles/gvimrc + or $VIM/.gvimrc + MS-DOS and Win32 $HOME/_gvimrc, $HOME/vimfiles/gvimrc + or $VIM/_gvimrc + Amiga s:.gvimrc, home:.gvimrc, home:vimfiles:gvimrc + or $VIM/.gvimrc + +The personal initialization files are searched in the order specified above +and only the first one that is found is read. There are a number of options which only have meaning in the GUI version of Vim. These are 'guicursor', 'guifont', 'guipty' and 'guioptions'. They are @@ -147,6 +153,15 @@ task bar with the 'guiheadroom' option. If you are running the X Window System, you can get information about the window Vim is running in with this command: > :!xwininfo -id $WINDOWID +< + *gui-IME* *iBus* +Input methods for international characters in X that rely on the XIM +framework, most notably iBus, have been known to produce undesirable results +in gVim. These may include an inability to enter spaces, or long delays +between typing a character and it being recognized by the application. + +One workaround that has been successful, for unknown reasons, is to prevent +gvim from forking into the background by starting it with the |-f| argument. ============================================================================== 2. Scrollbars *gui-scrollbars* @@ -156,26 +171,26 @@ configure which ones appear with the 'guioptions' option. The interface looks like this (with ":set guioptions=mlrb"): - +------------------------------+ - | File Edit Help | <- Menu bar (m) - +-+--------------------------+-+ - |^| |^| - |#| Text area. |#| - | | | | - |v|__________________________|v| - Normal status line -> |-+ File.c 5,2 +-| - between Vim windows |^|""""""""""""""""""""""""""|^| - | | | | - | | Another file buffer. | | - | | | | - |#| |#| - Left scrollbar (l) -> |#| |#| <- Right - |#| |#| scrollbar (r) - | | | | - |v| |v| - +-+--------------------------+-+ - | |< #### >| | <- Bottom - +-+--------------------------+-+ scrollbar (b) + +------------------------------+ ` + | File Edit Help | <- Menu bar (m) ` + +-+--------------------------+-+ ` + |^| |^| ` + |#| Text area. |#| ` + | | | | ` + |v|__________________________|v| ` + Normal status line -> |-+ File.c 5,2 +-| ` + between Vim windows |^|""""""""""""""""""""""""""|^| ` + | | | | ` + | | Another file buffer. | | ` + | | | | ` + |#| |#| ` + Left scrollbar (l) -> |#| |#| <- Right ` + |#| |#| scrollbar (r) ` + | | | | ` + |v| |v| ` + +-+--------------------------+-+ ` + | |< #### >| | <- Bottom ` + +-+--------------------------+-+ scrollbar (b) ` Any of the scrollbar or menu components may be turned off by not putting the appropriate letter in the 'guioptions' string. The bottom scrollbar is diff --git a/runtime/doc/gui_w16.txt b/runtime/doc/gui_w16.txt index a98f0d0..fa84b05 100644 --- a/runtime/doc/gui_w16.txt +++ b/runtime/doc/gui_w16.txt @@ -1,4 +1,4 @@ -*gui_w16.txt* For Vim version 7.3. Last change: 2005 Mar 29 +*gui_w16.txt* For Vim version 7.4. Last change: 2005 Mar 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -16,7 +16,7 @@ Vim's Graphical User Interface *gui-w16* *win16-gui* Other relevant documentation: |gui.txt| For generic items of the GUI. -|os_msdos.txt| For items common to DOS and Windows. +|os_msdos.txt| For items common to DOS and Windows. |gui_w32.txt| Some items here are also applicable to the Win16 version. {Vi does not have a Windows GUI} diff --git a/runtime/doc/gui_w32.txt b/runtime/doc/gui_w32.txt index d71e90e..fbe3f35 100644 --- a/runtime/doc/gui_w32.txt +++ b/runtime/doc/gui_w32.txt @@ -1,4 +1,4 @@ -*gui_w32.txt* For Vim version 7.3. Last change: 2007 Aug 30 +*gui_w32.txt* For Vim version 7.4. Last change: 2012 Aug 04 VIM REFERENCE MANUAL by Bram Moolenaar @@ -17,7 +17,7 @@ Vim's Win32 Graphical User Interface *gui-w32* *win32-gui* Other relevant documentation: |gui.txt| For generic items of the GUI. -|os_win32.txt| For Win32 specific items. +|os_win32.txt| For Win32 specific items. {Vi does not have a Windows GUI} @@ -137,6 +137,9 @@ options: And if there already is a gvim running: "Edit with existing gvim" -- edit the file with the running gvim +The "edit with existing Vim" entries can be disabled by adding an entry in the +registry under HKLM\Software\Vim\Gvim, named DisableEditWithExisting, and with +any value. *install-registry* You can add the "Edit with Vim" menu entry in an easy way by using the "install.exe" program. It will add several registry entries for you. @@ -293,7 +296,9 @@ Normally, Vim waits for a command to complete before continuing (this makes sense for most shell commands which produce output for Vim to use). If you want Vim to start a program and return immediately, you can use the following syntax on W95 & NT: > - :!start {command} + :!start [/min] {command} +The optional "/min" causes the window to be minimized. + On Win32s, you will have to go to another window instead. Don't forget that you must tell Windows 3.1x to keep executing a DOS command in the background while you switch back to Vim. @@ -484,4 +489,16 @@ to: And add gvim to the list of applications. This problem only appears to happen with the Intellimouse driver 2.2 and when "Universal Scrolling" is turned on. + +XPM support *w32-xpm-support* + +Gvim can be build on MS-Windows with support for XPM files. |+xpm_w32| +See the Make_mvc.mak file for instructions, search for XPM. + +To try out if XPM support works do this: > + :help + :exe 'sign define vimxpm icon=' . $VIMRUNTIME . '\\vim16x16.xpm' + :exe 'sign place 1 line=1 name=vimxpm file=' . expand('%:p') +< + vim:tw=78:sw=4:ts=8:ft=help:norl: diff --git a/runtime/doc/gui_x11.txt b/runtime/doc/gui_x11.txt index 6d16500..5a47765 100644 --- a/runtime/doc/gui_x11.txt +++ b/runtime/doc/gui_x11.txt @@ -1,4 +1,4 @@ -*gui_x11.txt* For Vim version 7.3. Last change: 2010 Jul 20 +*gui_x11.txt* For Vim version 7.4. Last change: 2011 Sep 14 VIM REFERENCE MANUAL by Bram Moolenaar @@ -53,6 +53,8 @@ When using "gvim -f" and then ":gui", Vim will run in the foreground. The ":gui -b". "gvim --nofork" does the same as "gvim -f". + *E851* *E852* +When starting the GUI fails Vim will try to continue running in the terminal. If you want the GUI to run in the foreground always, include the 'f' flag in 'guioptions'. |-f|. diff --git a/runtime/doc/hangulin.txt b/runtime/doc/hangulin.txt index fac0c87..79ebff1 100644 --- a/runtime/doc/hangulin.txt +++ b/runtime/doc/hangulin.txt @@ -1,4 +1,4 @@ -*hangulin.txt* For Vim version 7.3. Last change: 2009 Jun 24 +*hangulin.txt* For Vim version 7.4. Last change: 2009 Jun 24 VIM REFERENCE MANUAL by Chi-Deok Hwang and Sung-Hyun Nam diff --git a/runtime/doc/hebrew.txt b/runtime/doc/hebrew.txt index 589d12c..b36c968 100644 --- a/runtime/doc/hebrew.txt +++ b/runtime/doc/hebrew.txt @@ -1,4 +1,4 @@ -*hebrew.txt* For Vim version 7.3. Last change: 2007 Jun 14 +*hebrew.txt* For Vim version 7.4. Last change: 2007 Jun 14 VIM REFERENCE MANUAL by Ron Aaron (and Avner Lottem) @@ -93,7 +93,7 @@ Details This is also the keymap when 'keymap=hebrew' is set. The advantage of 'keymap' is that it works properly when using UTF8, e.g. it inserts the correct characters; 'hkmap' does not. The 'keymap' keyboard can also - insert niqud and te`amim. To see what those mappings are,look at the + insert niqud and te`amim. To see what those mappings are, look at the keymap file 'hebrew.vim' etc. diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt index 4860eb2..f13a529 100644 --- a/runtime/doc/help.txt +++ b/runtime/doc/help.txt @@ -1,4 +1,4 @@ -*help.txt* For Vim version 7.3. Last change: 2010 Jul 20 +*help.txt* For Vim version 7.4. Last change: 2012 Dec 06 VIM - main help file k @@ -195,12 +195,12 @@ Remarks about specific systems ~ *standard-plugin-list* Standard plugins ~ |pi_getscript.txt| Downloading latest version of Vim scripts -|pi_gzip.txt| Reading and writing compressed files -|pi_netrw.txt| Reading and writing files over a network -|pi_paren.txt| Highlight matching parens -|pi_tar.txt| Tar file explorer +|pi_gzip.txt| Reading and writing compressed files +|pi_netrw.txt| Reading and writing files over a network +|pi_paren.txt| Highlight matching parens +|pi_tar.txt| Tar file explorer |pi_vimball.txt| Create a self-installing Vim script -|pi_zip.txt| Zip archive explorer +|pi_zip.txt| Zip archive explorer LOCAL ADDITIONS: *local-additions* diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt index 0ba0bbf..87f095e 100644 --- a/runtime/doc/helphelp.txt +++ b/runtime/doc/helphelp.txt @@ -1,4 +1,4 @@ -*helphelp.txt* For Vim version 7.3. Last change: 2010 Jul 29 +*helphelp.txt* For Vim version 7.4. Last change: 2012 Nov 28 VIM REFERENCE MANUAL by Bram Moolenaar @@ -7,7 +7,7 @@ Help on help files *helphelp* 1. Help commands |online-help| -2. Translating help files |help-translated| +2. Translated help files |help-translated| 3. Writing help files |help-writing| ============================================================================== @@ -188,17 +188,18 @@ command: > Only for backwards compatibility. It now executes the ToolBar.FindHelp menu entry instead of using a builtin dialog. {only when compiled with |+GUI_GTK|} -< {not in Vi} + {not in Vi} *:helpt* *:helptags* *E154* *E150* *E151* *E152* *E153* *E670* :helpt[ags] [++t] {dir} Generate the help tags file(s) for directory {dir}. - All "*.txt" and "*.??x" files in the directory are - scanned for a help tag definition in between stars. - The "*.??x" files are for translated docs, they - generate the "tags-??" file, see |help-translated|. - The generated tags files are sorted. + All "*.txt" and "*.??x" files in the directory and + sub-directories are scanned for a help tag definition + in between stars. The "*.??x" files are for + translated docs, they generate the "tags-??" file, see + |help-translated|. The generated tags files are + sorted. When there are duplicates an error message is given. An existing tags file is silently overwritten. The optional "++t" argument forces adding the @@ -218,11 +219,12 @@ files. Vim will search for all help in "doc" directories in 'runtimepath'. This is only available when compiled with the |+multi_lang| feature. At this moment translations are available for: - Chinese - multiple authors - French - translated by David Blanchet - Italian - translated by Antonio Colombo - Polish - translated by Mikolaj Machowski - Russian - translated by Vassily Ragosin + Chinese - multiple authors + French - translated by David Blanchet + Italian - translated by Antonio Colombo + Japanese - multiple authors + Polish - translated by Mikolaj Machowski + Russian - translated by Vassily Ragosin See the Vim website to find them: http://www.vim.org/translations.php A set of translated help files consists of these files: diff --git a/runtime/doc/howto.txt b/runtime/doc/howto.txt index 44bf7ef..03ae3db 100644 --- a/runtime/doc/howto.txt +++ b/runtime/doc/howto.txt @@ -1,4 +1,4 @@ -*howto.txt* For Vim version 7.3. Last change: 2006 Apr 02 +*howto.txt* For Vim version 7.4. Last change: 2006 Apr 02 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/if_cscop.txt b/runtime/doc/if_cscop.txt index 092f5f4..d8dc48f 100644 --- a/runtime/doc/if_cscop.txt +++ b/runtime/doc/if_cscop.txt @@ -1,4 +1,4 @@ -*if_cscop.txt* For Vim version 7.3. Last change: 2009 Mar 18 +*if_cscop.txt* For Vim version 7.4. Last change: 2011 Jun 12 VIM REFERENCE MANUAL by Andy Kahn @@ -112,8 +112,7 @@ The available subcommands are: :cscope add /projects/vim/cscope.out /usr/local/vim :cscope add cscope.out /usr/local/vim -C < - *cscope-find* *cs-find* - *E565* *E567* + *cscope-find* *cs-find* *E567* find : Query cscope. All cscope query options are available except option #5 ("Change this grep pattern"). @@ -198,7 +197,7 @@ The available subcommands are: USAGE :cs help - *E260* *E261* + *E261* kill : Kill a cscope connection (or kill all cscope connections). USAGE :cs kill {num|partial_name} @@ -265,13 +264,23 @@ seems to be useful: > :set cscopequickfix=s-,c-,d-,i-,t-,e- < *cscopetag* *cst* -If 'cscopetag' set, the commands ":tag" and CTRL-] as well as "vim -t" will -always use |:cstag| instead of the default :tag behavior. Effectively, by -setting 'cst', you will always search your cscope databases as well as your -tag files. The default is off. Examples: > +If 'cscopetag' is set, the commands ":tag" and CTRL-] as well as "vim -t" +will always use |:cstag| instead of the default :tag behavior. Effectively, +by setting 'cst', you will always search your cscope databases as well as +your tag files. The default is off. Examples: > :set cst :set nocst < + *cscoperelative* *csre* +If 'cscoperelative' is set, then in absence of a prefix given to cscope +(prefix is the argument of -P option of cscope), basename of cscope.out +location (usually the project root directory) will be used as the prefix +to construct an absolute path. The default is off. Note: This option is +only effective when cscope (cscopeprg) is initialized without a prefix +path (-P). Examples: > + :set csre + :set nocsre +< *cscopetagorder* *csto* The value of 'csto' determines the order in which |:cstag| performs a search. If 'csto' is set to zero, cscope database(s) are searched first, followed diff --git a/runtime/doc/if_lua.txt b/runtime/doc/if_lua.txt index 6514822..8d9383c 100644 --- a/runtime/doc/if_lua.txt +++ b/runtime/doc/if_lua.txt @@ -1,4 +1,4 @@ -*if_lua.txt* For Vim version 7.3. Last change: 2010 Jul 22 +*if_lua.txt* For Vim version 7.4. Last change: 2012 Jun 29 VIM REFERENCE MANUAL by Luis Carvalho @@ -8,8 +8,12 @@ The Lua Interface to Vim *lua* *Lua* 1. Commands |lua-commands| 2. The vim module |lua-vim| -3. Buffer userdata |lua-buffer| -4. Window userdata |lua-window| +3. List userdata |lua-list| +4. Dict userdata |lua-dict| +5. Funcref userdata |lua-funcref| +6. Buffer userdata |lua-buffer| +7. Window userdata |lua-window| +8. The luaeval function |lua-luaeval| {Vi does not have any of these commands} @@ -56,13 +60,14 @@ Example: < *:luado* -:[range]luado {body} Execute Lua function "function (line) {body} end" for - each line in the [range], with the function argument - being set to the text of each line in turn, without a - trailing . If the value returned by the function - is a string it becomes the text of the line in the - current turn. The default for [range] is the whole - file: "1,$". {not in Vi} +:[range]luado {body} Execute Lua function "function (line, linenr) {body} + end" for each line in the [range], with the function + argument being set to the text of each line in turn, + without a trailing , and the current line number. + If the value returned by the function is a string it + becomes the text of the line in the current turn. The + default for [range] is the whole file: "1,$". + {not in Vi} Examples: > @@ -88,11 +93,9 @@ Examples: All these commands execute a Lua chunk from either the command line (:lua and :luado) or a file (:luafile) with the given line [range]. Similarly to the Lua interpreter, each chunk has its own scope and so only global variables are -shared between command calls. Lua default libraries "table", "string", "math", -and "package" are available, "io" and "debug" are not, and "os" is restricted -to functions "date", "clock", "time", "difftime", and "getenv". In addition, -Lua "print" function has its output redirected to the Vim message area, with -arguments separated by a white space instead of a tab. +shared between command calls. All Lua default libraries are available. In +addition, Lua "print" function has its output redirected to the Vim message +area, with arguments separated by a white space instead of a tab. Lua uses the "vim" module (see |lua-vim|) to issue commands to Vim and manage buffers (|lua-buffer|) and windows (|lua-window|). However, @@ -108,9 +111,31 @@ input range are stored in "vim.firstline" and "vim.lastline" respectively. The module also includes routines for buffer, window, and current line queries, Vim evaluation and command execution, and others. - vim.isbuffer(value) Returns 'true' (boolean, not string) if - "value" is a buffer userdata and 'false' - otherwise (see |lua-buffer|). + vim.list([arg]) Returns an empty list or, if "arg" is a Lua + table with numeric keys 1, ..., n (a + "sequence"), returns a list l such that l[i] = + arg[i] for i = 1, ..., n (see |List|). + Non-numeric keys are not used to initialize + the list. See also |lua-eval| for conversion + rules. Example: > + :lua t = {math.pi, false, say = 'hi'} + :echo luaeval('vim.list(t)') + :" [3.141593, 0], 'say' is ignored +< + vim.dict([arg]) Returns an empty dictionary or, if "arg" is a + Lua table, returns a dict d such that d[k] = + arg[k] for all string keys k in "arg" (see + |Dictionary|). Number keys are converted to + strings. Keys that are not strings are not + used to initialize the dictionary. See also + |lua-eval| for conversion rules. Example: > + :lua t = {math.pi, false, say = 'hi'} + :echo luaeval('vim.dict(t)') + :" {'say': 'hi'}, numeric keys ignored +< + vim.funcref({name}) Returns a Funcref to function {name} (see + |Funcref|). It is equivalent to Vim's + "function". vim.buffer([arg]) If "arg" is a number, returns buffer with number "arg" in the buffer list or, if "arg" @@ -121,16 +146,21 @@ Vim evaluation and command execution, and others. 'true' returns the first buffer in the buffer list or else the current buffer. - vim.iswindow(value) Returns 'true' (boolean, not string) if - "value" is a window userdata and - 'false' otherwise (see |lua-window|). - vim.window([arg]) If "arg" is a number, returns window with number "arg" or 'nil' (nil value, not string) if not found. Otherwise, if "toboolean(arg)" is 'true' returns the first window or else the current window. + vim.type({arg}) Returns the type of {arg}. It is equivalent to + Lua's "type" function, but returns "list", + "dict", "funcref", "buffer", or "window" if + {arg} is a list, dictionary, funcref, buffer, + or window, respectively. Examples: > + :lua l = vim.list() + :lua print(type(l), vim.type(l)) + :" userdata list +< vim.command({cmd}) Executes the vim (ex-mode) command {cmd}. Examples: > :lua vim.command"set tw=60" @@ -141,7 +171,7 @@ Vim evaluation and command execution, and others. Vim strings and numbers are directly converted to Lua strings and numbers respectively. Vim lists and dictionaries are converted to Lua - tables (lists become integer-keyed tables). + userdata (see |lua-list| and |lua-dict|). Examples: > :lua tw = vim.eval"&tw" :lua print(vim.eval"{'a': 'one'}".a) @@ -157,7 +187,105 @@ Vim evaluation and command execution, and others. ============================================================================== -3. Buffer userdata *lua-buffer* +3. List userdata *lua-list* + +List userdata represent vim lists, and the interface tries to follow closely +Vim's syntax for lists. Since lists are objects, changes in list references in +Lua are reflected in Vim and vice-versa. A list "l" has the following +properties and methods: + +Properties +---------- + o "#l" is the number of items in list "l", equivalent to "len(l)" + in Vim. + o "l[k]" returns the k-th item in "l"; "l" is zero-indexed, as in Vim. + To modify the k-th item, simply do "l[k] = newitem"; in + particular, "l[k] = nil" removes the k-th item from "l". + o "l()" returns an iterator for "l". + +Methods +------- + o "l:add(item)" appends "item" to the end of "l". + o "l:insert(item[, pos])" inserts "item" at (optional) + position "pos" in the list. The default value for "pos" is 0. + +Examples: +> + :let l = [1, 'item'] + :lua l = vim.eval('l') -- same 'l' + :lua l:add(vim.list()) + :lua l[0] = math.pi + :echo l[0] " 3.141593 + :lua l[0] = nil -- remove first item + :lua l:insert(true, 1) + :lua print(l, #l, l[0], l[1], l[-1]) + :lua for item in l() do print(item) end +< + +============================================================================== +4. Dict userdata *lua-dict* + +Similarly to list userdata, dict userdata represent vim dictionaries; since +dictionaries are also objects, references are kept between Lua and Vim. A dict +"d" has the following properties: + +Properties +---------- + o "#d" is the number of items in dict "d", equivalent to "len(d)" + in Vim. + o "d.key" or "d['key']" returns the value at entry "key" in "d". + To modify the entry at this key, simply do "d.key = newvalue"; in + particular, "d.key = nil" removes the entry from "d". + o "d()" returns an iterator for "d" and is equivalent to "items(d)" in + Vim. + +Examples: +> + :let d = {'n':10} + :lua d = vim.eval('d') -- same 'd' + :lua print(d, d.n, #d) + :let d.self = d + :lua for k, v in d() do print(d, k, v) end + :lua d.x = math.pi + :lua d.self = nil -- remove entry + :echo d +< + +============================================================================== +5. Funcref userdata *lua-funcref* + +Funcref userdata represent funcref variables in Vim. Funcrefs that were +defined with a "dict" attribute need to be obtained as a dictionary key +in order to have "self" properly assigned to the dictionary (see examples +below.) A funcref "f" has the following properties: + +Properties +---------- + o "#f" is the name of the function referenced by "f" + o "f(...)" calls the function referenced by "f" (with arguments) + +Examples: +> + :function I(x) + : return a:x + : endfunction + :let R = function('I') + :lua i1 = vim.funcref('I') + :lua i2 = vim.eval('R') + :lua print(#i1, #i2) -- both 'I' + :lua print(i1, i2, #i2(i1) == #i1(i2)) + :function Mylen() dict + : return len(self.data) + : endfunction + :let mydict = {'data': [0, 1, 2, 3]} + :lua d = vim.eval('mydict'); d.len = vim.funcref('Mylen') + :echo mydict.len() + :lua l = d.len -- assign d as 'self' + :lua print(l()) +< + +============================================================================== +6. Buffer userdata *lua-buffer* Buffer userdata represent vim buffers. A buffer userdata "b" has the following properties and methods: @@ -209,7 +337,7 @@ Examples: < ============================================================================== -4. Window userdata *lua-window* +7. Window userdata *lua-window* Window objects represent vim windows. A window userdata "w" has the following properties and methods: @@ -241,4 +369,35 @@ Examples: < ============================================================================== - vim:tw=78:ts=8:ft=help:norl: +8. The luaeval function *lua-luaeval* *lua-eval* + +The (dual) equivalent of "vim.eval" for passing Lua values to Vim is +"luaeval". "luaeval" takes an expression string and an optional argument and +returns the result of the expression. It is semantically equivalent in Lua to: +> + local chunkheader = "local _A = select(1, ...) return " + function luaeval (expstr, arg) + local chunk = assert(loadstring(chunkheader .. expstr, "luaeval")) + return chunk(arg) -- return typval + end +< +Note that "_A" receives the argument to "luaeval". Lua numbers, strings, and +list, dict, and funcref userdata are converted to their Vim respective types, +while Lua booleans are converted to numbers. An error is thrown if conversion +of any of the remaining Lua types, including userdata other than lists, dicts, +and funcrefs, is attempted. + +Examples: > + + :echo luaeval('math.pi') + :lua a = vim.list():add('newlist') + :let a = luaeval('a') + :echo a[0] " 'newlist' + :function Rand(x,y) " random uniform between x and y + : return luaeval('(_A.y-_A.x)*math.random()+_A.x', {'x':a:x,'y':a:y}) + : endfunction + :echo Rand(1,10) + + +============================================================================== + vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/if_mzsch.txt b/runtime/doc/if_mzsch.txt index 52440b6..b42570a 100644 --- a/runtime/doc/if_mzsch.txt +++ b/runtime/doc/if_mzsch.txt @@ -1,4 +1,4 @@ -*if_mzsch.txt* For Vim version 7.3. Last change: 2010 Feb 11 +*if_mzsch.txt* For Vim version 7.4. Last change: 2012 Dec 17 VIM REFERENCE MANUAL by Sergey Khorev @@ -11,7 +11,8 @@ The MzScheme Interface to Vim *mzscheme* *MzScheme* 3. Threads |mzscheme-threads| 4. Vim access from MzScheme |mzscheme-vim| 5. mzeval() Vim function |mzscheme-mzeval| -6. Dynamic loading |mzscheme-dynamic| +6. Using Function references |mzscheme-funcref| +7. Dynamic loading |mzscheme-dynamic| {Vi does not have any of these commands} @@ -21,10 +22,17 @@ The MzScheme interface is available only if Vim was compiled with the Based on the work of Brent Fulgham. Dynamic loading added by Sergey Khorev -For downloading MzScheme and other info: - http://www.plt-scheme.org/software/mzscheme/ +MzScheme and PLT Scheme names have been rebranded as Racket. For more +information please check http://racket-lang.org -Note: On FreeBSD you should use the "drscheme" port. +Futures and places of Racket version 5.x up to and including 5.3.1 do not +work correctly with processes created by Vim. +The simplest solution is to build Racket on your own with these features +disabled: > + ./configure --disable-futures --disable-places --prefix=your-install-prefix + +To speed up the process, you might also want to use --disable-gracket and +--disable-docs ============================================================================== 1. Commands *mzscheme-commands* @@ -155,8 +163,11 @@ Common (eval {expr-string}) Evaluate the vim expression into respective MzScheme object: |Lists| are represented as Scheme lists, - |Dictionaries| as hash tables. - NOTE the name clashes with MzScheme eval + |Dictionaries| as hash tables, + |Funcref|s as functions (see also + |mzscheme-funcref|) + NOTE the name clashes with MzScheme eval, + use module qualifiers to overcome this. (range-start) Start/End of the range passed with (range-end) the Scheme command. (beep) beep @@ -237,7 +248,23 @@ To facilitate bi-directional interface, you can use |mzeval()| function to evaluate MzScheme expressions and pass their values to VimL. ============================================================================== -6. Dynamic loading *mzscheme-dynamic* *E815* +6. Using Function references *mzscheme-funcref* + +MzScheme interface allows use of |Funcref|s so you can call Vim functions +directly from Scheme. For instance: > + function! MyAdd2(arg) + return a:arg + 2 + endfunction + mz (define f2 (vim-eval "function(\"MyAdd2\")")) + mz (f2 7) +< or : > + :mz (define indent (vim-eval "function('indent')")) + " return Vim indent for line 12 + :mz (indent 12) +< + +============================================================================== +7. Dynamic loading *mzscheme-dynamic* *E815* On MS-Windows the MzScheme libraries can be loaded dynamically. The |:version| output then includes |+mzscheme/dyn|. diff --git a/runtime/doc/if_ole.txt b/runtime/doc/if_ole.txt index 198c761..7d77b66 100644 --- a/runtime/doc/if_ole.txt +++ b/runtime/doc/if_ole.txt @@ -1,4 +1,4 @@ -*if_ole.txt* For Vim version 7.3. Last change: 2008 Aug 16 +*if_ole.txt* For Vim version 7.4. Last change: 2008 Aug 16 VIM REFERENCE MANUAL by Paul Moore diff --git a/runtime/doc/if_perl.txt b/runtime/doc/if_perl.txt index ba7466b..95c607b 100644 --- a/runtime/doc/if_perl.txt +++ b/runtime/doc/if_perl.txt @@ -1,4 +1,4 @@ -*if_perl.txt* For Vim version 7.3. Last change: 2010 Jul 21 +*if_perl.txt* For Vim version 7.4. Last change: 2012 Oct 25 VIM REFERENCE MANUAL by Sven Verdoolaege @@ -44,15 +44,17 @@ The Perl patches for Vim were made by: Sven Verdoolaege Matt Gerassimof -Perl for MS-Windows can be found at: -http://www.perl.com/CPAN/ports/nt/Standard/x86/ +Perl for MS-Windows can be found at: http://www.perl.com/ +The ActiveState one should work. ============================================================================== 3. Using the Perl interface *perl-using* *:perl* *:pe* :pe[rl] {cmd} Execute Perl command {cmd}. The current package - is "main". + is "main". Simple example to test if `:perl` is + working: > + :perl VIM::Msg("Hello") :pe[rl] << {endpattern} {script} @@ -173,7 +175,8 @@ VIM::Windows([{wn}...]) With no arguments, returns a list of all the windows VIM::DoCommand({cmd}) Executes Ex command {cmd}. *perl-Eval* -VIM::Eval({expr}) Evaluates {expr} and returns (success, val). +VIM::Eval({expr}) Evaluates {expr} and returns (success, value) in list + context or just value in scalar context. success=1 indicates that val contains the value of {expr}; success=0 indicates a failure to evaluate the expression. '@x' returns the contents of register diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt index d324239..889101b 100644 --- a/runtime/doc/if_pyth.txt +++ b/runtime/doc/if_pyth.txt @@ -1,4 +1,4 @@ -*if_pyth.txt* For Vim version 7.3. Last change: 2010 Aug 13 +*if_pyth.txt* For Vim version 7.4. Last change: 2013 Jul 10 VIM REFERENCE MANUAL by Paul Moore @@ -6,13 +6,16 @@ The Python Interface to Vim *python* *Python* -1. Commands |python-commands| -2. The vim module |python-vim| -3. Buffer objects |python-buffer| -4. Range objects |python-range| -5. Window objects |python-window| -6. Dynamic loading |python-dynamic| -7. Python 3 |python3| +1. Commands |python-commands| +2. The vim module |python-vim| +3. Buffer objects |python-buffer| +4. Range objects |python-range| +5. Window objects |python-window| +6. Tab page objects |python-tabpage| +7. vim.bindeval objects |python-bindeval-objects| +8. pyeval(), py3eval() Vim functions |python-pyeval| +9. Dynamic loading |python-dynamic| +10. Python 3 |python3| {Vi does not have any of these commands} @@ -20,13 +23,16 @@ The Python 2.x interface is available only when Vim was compiled with the |+python| feature. The Python 3 interface is available only when Vim was compiled with the |+python3| feature. +Both can be available at the same time, but read |python-2-and-3|. ============================================================================== 1. Commands *python-commands* *:python* *:py* *E205* *E263* *E264* :[range]py[thon] {stmt} - Execute Python statement {stmt}. + Execute Python statement {stmt}. A simple check if + the `:python` command is working: > + :python print "Hello" :[range]py[thon] << {endmarker} {script} @@ -51,9 +57,25 @@ Example: > EOF endfunction < -Note: Python is very sensitive to the indenting. Also make sure the "class" -line and "EOF" do not have any indent. - +Note: Python is very sensitive to the indenting. Make sure the "class" line +and "EOF" do not have any indent. + + *:pydo* +:[range]pydo {body} Execute Python function "def _vim_pydo(line, linenr): + {body}" for each line in the [range], with the + function arguments being set to the text of each line + in turn, without a trailing , and the current + line number. The function should return a string or + None. If a string is returned, it becomes the text of + the line in the current turn. The default for [range] + is the whole file: "1,$". + {not in Vi} + +Examples: +> + :pydo return "%s\t%d" % (line[::-1], len(line)) + :pydo if line: return "%4d: %s" % (linenr, line) +< *:pyfile* *:pyf* :[range]pyf[ile] {file} Execute the Python script in {file}. The whole @@ -150,7 +172,27 @@ vim.eval(str) *python-eval* [{'cmd': '/^eval_expr(arg, nextcmd)$/', 'static': 0, 'name': 'eval_expr', 'kind': 'f', 'filename': './src/eval.c'}] +vim.bindeval(str) *python-bindeval* + Like |python-eval|, but returns special objects described in + |python-bindeval-objects|. These python objects let you modify (|List| + or |Dictionary|) or call (|Funcref|) vim objects. + +vim.strwidth(str) *python-strwidth* + Like |strwidth()|: returns number of display cells str occupies, tab + is counted as one cell. + +vim.foreach_rtp(callable) *python-foreach_rtp* + Call the given callable for each path in 'runtimepath' until either + callable returns something but None, the exception is raised or there + are no longer paths. If stopped in case callable returned non-None, + vim.foreach_rtp function returns the value returned by callable. +vim.chdir(*args, **kwargs) *python-chdir* +vim.fchdir(*args, **kwargs) *python-fchdir* + Run os.chdir or os.fchdir, then all appropriate vim stuff. + Note: you should not use these functions directly, use os.chdir and + os.fchdir instead. Behavior of vim.fchdir is undefined in case + os.fchdir does not exist. Error object of the "vim" module @@ -170,12 +212,12 @@ Constants of the "vim" module to which the variables referred. vim.buffers *python-buffers* - A sequence object providing access to the list of vim buffers. The + A mapping object providing access to the list of vim buffers. The object supports the following operations: > :py b = vim.buffers[i] # Indexing (read-only) :py b in vim.buffers # Membership test :py n = len(vim.buffers) # Number of elements - :py for b in vim.buffers: # Sequential access + :py for b in vim.buffers: # Iterating over buffer list < vim.windows *python-windows* A sequence object providing access to the list of vim windows. The @@ -184,13 +226,28 @@ vim.windows *python-windows* :py w in vim.windows # Membership test :py n = len(vim.windows) # Number of elements :py for w in vim.windows: # Sequential access +< Note: vim.windows object always accesses current tab page. + |python-tabpage|.windows objects are bound to parent |python-tabpage| + object and always use windows from that tab page (or throw vim.error + in case tab page was deleted). You can keep a reference to both + without keeping a reference to vim module object or |python-tabpage|, + they will not lose their properties in this case. + +vim.tabpages *python-tabpages* + A sequence object providing access to the list of vim tab pages. The + object supports the following operations: > + :py t = vim.tabpages[i] # Indexing (read-only) + :py t in vim.tabpages # Membership test + :py n = len(vim.tabpages) # Number of elements + :py for t in vim.tabpages: # Sequential access < vim.current *python-current* An object providing access (via specific attributes) to various "current" objects available in vim: vim.current.line The current line (RW) String - vim.current.buffer The current buffer (RO) Buffer - vim.current.window The current window (RO) Window + vim.current.buffer The current buffer (RW) Buffer + vim.current.window The current window (RW) Window + vim.current.tabpage The current tab page (RW) TabPage vim.current.range The current line range (RO) Range The last case deserves a little explanation. When the :python or @@ -198,6 +255,42 @@ vim.current *python-current* "current range". A range is a bit like a buffer, but with all access restricted to a subset of lines. See |python-range| for more details. + Note: When assigning to vim.current.{buffer,window,tabpage} it expects + valid |python-buffer|, |python-window| or |python-tabpage| objects + respectively. Assigning triggers normal (with |autocommand|s) + switching to given buffer, window or tab page. It is the only way to + switch UI objects in python: you can't assign to + |python-tabpage|.window attribute. To switch without triggering + autocommands use > + py << EOF + saved_eventignore = vim.options['eventignore'] + vim.options['eventignore'] = 'all' + try: + vim.current.buffer = vim.buffers[2] # Switch to buffer 2 + finally: + vim.options['eventignore'] = saved_eventignore + EOF +< +vim.vars *python-vars* +vim.vvars *python-vvars* + Dictionary-like objects holding dictionaries with global (|g:|) and + vim (|v:|) variables respectively. Identical to `vim.bindeval("g:")`, + but faster. + +vim.options *python-options* + Object partly supporting mapping protocol (supports setting and + getting items) providing a read-write access to global options. + Note: unlike |:set| this provides access only to global options. You + cannot use this object to obtain or set local options' values or + access local-only options in any fashion. Raises KeyError if no global + option with such name exists (i.e. does not raise KeyError for + |global-local| options and global only options, but does for window- + and buffer-local ones). Use |python-buffer| objects to access to + buffer-local options and |python-window| objects to access to + window-local options. + + Type of this object is available via "Options" attribute of vim + module. Output from Python *python-output* Vim displays all Python code output in the Vim message area. Normal @@ -214,6 +307,88 @@ Output from Python *python-output* supported, and may cause the program to crash. This should probably be fixed. + *python2-directory* *python3-directory* *pythonx-directory* +Python 'runtimepath' handling *python-special-path* + +In python vim.VIM_SPECIAL_PATH special directory is used as a replacement for +the list of paths found in 'runtimepath': with this directory in sys.path and +vim.path_hooks in sys.path_hooks python will try to load module from +{rtp}/python2 (or python3) and {rtp}/pythonx (for both python versions) for +each {rtp} found in 'runtimepath'. + +Implementation is similar to the following, but written in C: > + + from imp import find_module, load_module + import vim + import sys + + class VimModuleLoader(object): + def __init__(self, module): + self.module = module + + def load_module(self, fullname, path=None): + return self.module + + def _find_module(fullname, oldtail, path): + idx = oldtail.find('.') + if idx > 0: + name = oldtail[:idx] + tail = oldtail[idx+1:] + fmr = find_module(name, path) + module = load_module(fullname[:-len(oldtail)] + name, *fmr) + return _find_module(fullname, tail, module.__path__) + else: + fmr = find_module(fullname, path) + return load_module(fullname, *fmr) + + # It uses vim module itself in place of VimPathFinder class: it does not + # matter for python which object has find_module function attached to as + # an attribute. + class VimPathFinder(object): + @classmethod + def find_module(cls, fullname, path=None): + try: + return VimModuleLoader(_find_module(fullname, fullname, path or vim._get_paths())) + except ImportError: + return None + + @classmethod + def load_module(cls, fullname, path=None): + return _find_module(fullname, fullname, path or vim._get_paths()) + + def hook(path): + if path == vim.VIM_SPECIAL_PATH: + return VimPathFinder + else: + raise ImportError + + sys.path_hooks.append(hook) + +vim.VIM_SPECIAL_PATH *python-VIM_SPECIAL_PATH* + String constant used in conjunction with vim path hook. If path hook + installed by vim is requested to handle anything but path equal to + vim.VIM_SPECIAL_PATH constant it raises ImportError. In the only other + case it uses special loader. + + Note: you must not use value of this constant directly, always use + vim.VIM_SPECIAL_PATH object. + +vim.find_module(...) *python-find_module* +vim.path_hook(path) *python-path_hook* + Methods or objects used to implement path loading as described above. + You should not be using any of these directly except for vim.path_hook + in case you need to do something with sys.meta_path. It is not + guaranteed that any of the objects will exist in the future vim + versions. + +vim._get_paths *python-_get_paths* + Methods returning a list of paths which will be searched for by path + hook. You should not rely on this method being present in future + versions, but can use it for debugging. + + It returns a list of {rtp}/python2 (or {rtp}/python3) and + {rtp}/pythonx directories for each {rtp} in 'runtimepath'. + ============================================================================== 3. Buffer objects *python-buffer* @@ -222,8 +397,9 @@ Buffer objects represent vim buffers. You can obtain them in a number of ways: - from indexing vim.buffers (|python-buffers|) - from the "buffer" attribute of a window (|python-window|) -Buffer objects have one read-only attribute - name - the full file name for -the buffer. They also have three methods (append, mark, and range; see below). +Buffer objects have two read-only attributes - name - the full file name for +the buffer, and number - the buffer number. They also have three methods +(append, mark, and range; see below). You can also treat buffer objects as sequence objects. In this context, they act as if they were lists (yes, they are mutable) of strings, with each @@ -238,6 +414,24 @@ Buffer indexes start at zero, as is normal in Python. This differs from vim line numbers, which start from 1. This is particularly relevant when dealing with marks (see below) which use vim line numbers. +The buffer object attributes are: + b.vars Dictionary-like object used to access + |buffer-variable|s. + b.options Mapping object (supports item getting, setting and + deleting) that provides access to buffer-local options + and buffer-local values of |global-local| options. Use + |python-window|.options if option is window-local, + this object will raise KeyError. If option is + |global-local| and local value is missing getting it + will return None. + b.name String, RW. Contains buffer name (full path). + Note: when assigning to b.name |BufFilePre| and + |BufFilePost| autocommands are launched. + b.number Buffer number. Can be used as |python-buffers| key. + Read-only. + b.valid True or False. Buffer object becomes invalid when + corresponding buffer is wiped out. + The buffer object methods are: b.append(str) Append a line to the buffer b.append(str, nr) Idem, below line "nr" @@ -256,6 +450,8 @@ Note that when adding a line it must not contain a line break character '\n'. A trailing '\n' is allowed and ignored, so that you can do: > :py b.append(f.readlines()) +Buffer object type is available using "Buffer" attribute of vim module. + Examples (assume b is the current buffer) > :py print b.name # write the buffer file name :py b[0] = "hello!!!" # replace the top line @@ -267,6 +463,9 @@ Examples (assume b is the current buffer) > :py n = len(b) # number of lines :py (row,col) = b.mark('a') # named mark :py r = b.range(1,5) # a sub-range of the buffer + :py b.vars["foo"] = "bar" # assign b:foo variable + :py b.options["ff"] = "dos" # set fileformat + :py del b.options["ar"] # same as :set autoread< ============================================================================== 4. Range objects *python-range* @@ -294,6 +493,8 @@ The range object methods are: for Python's built-in list objects. r.append(list, nr) Idem, after line "nr" +Range object type is available using "Range" attribute of vim module. + Example (assume r is the current range): # Send all lines in a range to the default printer vim.command("%d,%dhardcopy!" % (r.start+1,r.end+1)) @@ -304,6 +505,8 @@ Example (assume r is the current range): Window objects represent vim windows. You can obtain them in a number of ways: - via vim.current.window (|python-current|) - from indexing vim.windows (|python-windows|) + - from indexing "windows" attribute of a tab page (|python-tabpage|) + - from the "window" attribute of a tab page (|python-tabpage|) You can manipulate window objects only through their attributes. They have no methods, and no sequence or other interface. @@ -314,11 +517,167 @@ Window attributes are: This is a tuple, (row,col). height (read-write) The window height, in rows width (read-write) The window width, in columns + vars (read-only) The window |w:| variables. Attribute is + unassignable, but you can change window + variables this way + options (read-only) The window-local options. Attribute is + unassignable, but you can change window + options this way. Provides access only to + window-local options, for buffer-local use + |python-buffer| and for global ones use + |python-options|. If option is |global-local| + and local value is missing getting it will + return None. + number (read-only) Window number. The first window has number 1. + This is zero in case it cannot be determined + (e.g. when the window object belongs to other + tab page). + row, col (read-only) On-screen window position in display cells. + First position is zero. + tabpage (read-only) Window tab page. + valid (read-write) True or False. Window object becomes invalid + when corresponding window is closed. + The height attribute is writable only if the screen is split horizontally. The width attribute is writable only if the screen is split vertically. +Window object type is available using "Window" attribute of vim module. + ============================================================================== -6. Dynamic loading *python-dynamic* +6. Tab page objects *python-tabpage* + +Tab page objects represent vim tab pages. You can obtain them in a number of +ways: + - via vim.current.tabpage (|python-current|) + - from indexing vim.tabpages (|python-tabpages|) + +You can use this object to access tab page windows. They have no methods and +no sequence or other interfaces. + +Tab page attributes are: + number The tab page number like the one returned by + |tabpagenr()|. + windows Like |python-windows|, but for current tab page. + vars The tab page |t:| variables. + window Current tabpage window. + valid True or False. Tab page object becomes invalid when + corresponding tab page is closed. + +TabPage object type is available using "TabPage" attribute of vim module. + +============================================================================== +7. vim.bindeval objects *python-bindeval-objects* + +vim.Dictionary object *python-Dictionary* + Dictionary-like object providing access to vim |Dictionary| type. + Attributes: + Attribute Description ~ + locked One of *python-.locked* + Value Description ~ + zero Variable is not locked + vim.VAR_LOCKED Variable is locked, but can be unlocked + vim.VAR_FIXED Variable is locked and can't be unlocked + Read-write. You can unlock locked variable by assigning + `True` or `False` to this attribute. No recursive locking + is supported. + scope One of + Value Description ~ + zero Dictionary is not a scope one + vim.VAR_DEF_SCOPE |g:| or |l:| dictionary + vim.VAR_SCOPE Other scope dictionary, + see |internal-variables| + Methods (note: methods do not support keyword arguments): + Method Description ~ + keys() Returns a list with dictionary keys. + values() Returns a list with dictionary values. + items() Returns a list of 2-tuples with dictionary contents. + update(iterable), update(dictionary), update(**kwargs) + Adds keys to dictionary. + get(key[, default=None]) + Obtain key from dictionary, returning the default if it is + not present. + pop(key[, default]) + Remove specified key from dictionary and return + corresponding value. If key is not found and default is + given returns the default, otherwise raises KeyError. + popitem() + Remove random key from dictionary and return (key, value) + pair. + has_key(key) + Check whether dictionary contains specified key, similar + to `key in dict`. + + __new__(), __new__(iterable), __new__(dictionary), __new__(update) + You can use `vim.Dictionary()` to create new vim + dictionaries. `d=vim.Dictionary(arg)` is the same as + `d=vim.bindeval('{}');d.update(arg)`. Without arguments + constructs empty dictionary. + + Examples: > + d = vim.Dictionary(food="bar") # Constructor + d['a'] = 'b' # Item assignment + print d['a'] # getting item + d.update({'c': 'd'}) # .update(dictionary) + d.update(e='f') # .update(**kwargs) + d.update((('g', 'h'), ('i', 'j'))) # .update(iterable) + for key in d.keys(): # .keys() + for val in d.values(): # .values() + for key, val in d.items(): # .items() + print isinstance(d, vim.Dictionary) # True + for key in d: # Iteration over keys + class Dict(vim.Dictionary): # Subclassing +< + Note: when iterating over keys you should not modify dictionary. + +vim.List object *python-List* + Sequence-like object providing access to vim |List| type. + Supports `.locked` attribute, see |python-.locked|. Also supports the + following methods: + Method Description ~ + extend(item) Add items to the list. + + __new__(), __new__(iterable) + You can use `vim.List()` to create new vim lists. + `l=vim.List(iterable)` is the same as + `l=vim.bindeval('[]');l.extend(iterable)`. Without + arguments constructs empty list. + Examples: > + l = vim.List("abc") # Constructor, result: ['a', 'b', 'c'] + l.extend(['abc', 'def']) # .extend() method + print l[1:] # slicing + l[:0] = ['ghi', 'jkl'] # slice assignment + print l[0] # getting item + l[0] = 'mno' # assignment + for i in l: # iteration + print isinstance(l, vim.List) # True + class List(vim.List): # Subclassing + +vim.Function object *python-Function* + Function-like object, acting like vim |Funcref| object. Supports `.name` + attribute and is callable. Accepts special keyword argument `self`, see + |Dictionary-function|. You can also use `vim.Function(name)` constructor, + it is the same as `vim.bindeval('function(%s)'%json.dumps(name))`. + + Examples: > + f = vim.Function('tr') # Constructor + print f('abc', 'a', 'b') # Calls tr('abc', 'a', 'b') + vim.command(''' + function DictFun() dict + return self + endfunction + ''') + f = vim.bindeval('function("DictFun")') + print f(self={}) # Like call('DictFun', [], {}) + print isinstance(f, vim.Function) # True + +============================================================================== +8. pyeval() and py3eval() Vim functions *python-pyeval* + +To facilitate bi-directional interface, you can use |pyeval()| and |py3eval()| +functions to evaluate Python expressions and pass their values to VimL. + +============================================================================== +9. Dynamic loading *python-dynamic* On MS-Windows the Python library can be loaded dynamically. The |:version| output then includes |+python/dyn|. @@ -335,12 +694,17 @@ Currently the name is "python24.dll". That is for Python 2.4. To know for sure edit "gvim.exe" and search for "python\d*.dll\c". ============================================================================== -7. Python 3 *python3* +10. Python 3 *python3* *:py3* *:python3* -The |:py3| and |:python3| commands work similar to |:python|. - *:py3file* -The |:py3file| command works similar to |:pyfile|. +The `:py3` and `:python3` commands work similar to `:python`. A simple check +if the `:py3` command is working: > + :py3 print("Hello") +< *:py3file* +The `:py3file` command works similar to `:pyfile`. + *:py3do* *E863* +The `:py3do` command works similar to `:pydo`. + Vim can be built in four ways (:version output): 1. No Python support (-python, -python3) @@ -348,14 +712,14 @@ Vim can be built in four ways (:version output): 3. Python 3 support only (-python, +python3 or +python3/dyn) 4. Python 2 and 3 support (+python/dyn, +python3/dyn) -Some more details on the special case 4: +Some more details on the special case 4: *python-2-and-3* When Python 2 and Python 3 are both supported they must be loaded dynamically. When doing this on Linux/Unix systems and importing global symbols, this leads to a crash when the second Python version is used. So either global symbols are loaded but only one Python version is activated, or no global symbols are -loaded. The latter makes Python's "import" fail on libaries that expect the +loaded. The latter makes Python's "import" fail on libraries that expect the symbols to be provided by Vim. *E836* *E837* Vim's configuration script makes a guess for all libraries based on one @@ -377,6 +741,23 @@ To work around such problems there are these options: 3. You undefine PY_NO_RTLD_GLOBAL in auto/config.h after configuration. This may crash Vim though. + *E880* +Raising SystemExit exception in python isn't endorsed way to quit vim, use: > + :py vim.command("qall!") +< + + *has-python* +You can test what Python version is available with: > + if has('python') + echo 'there is Python 2.x' + elseif has('python3') + echo 'there is Python 3.x' + endif + +Note however, that when Python 2 and 3 are both available and loaded +dynamically, these has() calls will try to load them. If only one can be +loaded at a time, just checking if Python 2 or 3 are available will prevent +the other one from being available. ============================================================================== vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/if_ruby.txt b/runtime/doc/if_ruby.txt index 161911a..0a32d87 100644 --- a/runtime/doc/if_ruby.txt +++ b/runtime/doc/if_ruby.txt @@ -1,4 +1,4 @@ -*if_ruby.txt* For Vim version 7.3. Last change: 2010 Jul 20 +*if_ruby.txt* For Vim version 7.4. Last change: 2012 Aug 02 VIM REFERENCE MANUAL by Shugo Maeda @@ -25,7 +25,8 @@ downloading Ruby there. 1. Commands *ruby-commands* *:ruby* *:rub* -:rub[y] {cmd} Execute Ruby command {cmd}. +:rub[y] {cmd} Execute Ruby command {cmd}. A command to try it out: > + :ruby print "Hello" :rub[y] << {endpattern} {script} @@ -187,12 +188,12 @@ $curbuf The current buffer object. ============================================================================== 6. Dynamic loading *ruby-dynamic* -On MS-Windows the Ruby library can be loaded dynamically. The |:version| -output then includes |+ruby/dyn|. +On MS-Windows and Unix the Ruby library can be loaded dynamically. The +|:version| output then includes |+ruby/dyn|. -This means that Vim will search for the Ruby DLL file only when needed. When -you don't use the Ruby interface you don't need it, thus you can use Vim -without this DLL file. +This means that Vim will search for the Ruby DLL file or shared library only +when needed. When you don't use the Ruby interface you don't need it, thus +you can use Vim even though this library file is not on your system. You need to install the right version of Ruby for this to work. You can find the package to download from: @@ -208,6 +209,8 @@ for sure edit "gvim.exe" and search for "ruby\d*.dll\c". If you want to build Vim with Ruby 1.9.1, you need to edit the config.h file and comment-out the check for _MSC_VER. +You may also need to rename the include directory name to match the version, +strangely for Ruby 1.9.3 the directory is called 1.9.1. ============================================================================== vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/if_sniff.txt b/runtime/doc/if_sniff.txt index 1af1c58..a3d5208 100644 --- a/runtime/doc/if_sniff.txt +++ b/runtime/doc/if_sniff.txt @@ -1,4 +1,4 @@ -*if_sniff.txt* For Vim version 7.3. Last change: 2005 Mar 29 +*if_sniff.txt* For Vim version 7.4. Last change: 2005 Mar 29 VIM REFERENCE MANUAL diff --git a/runtime/doc/if_tcl.txt b/runtime/doc/if_tcl.txt index e7c2556..d6726a3 100644 --- a/runtime/doc/if_tcl.txt +++ b/runtime/doc/if_tcl.txt @@ -1,4 +1,4 @@ -*if_tcl.txt* For Vim version 7.3. Last change: 2008 Aug 16 +*if_tcl.txt* For Vim version 7.4. Last change: 2012 Aug 02 VIM REFERENCE MANUAL by Ingo Wilken @@ -27,7 +27,9 @@ comments, ideas etc to 1. Commands *tcl-ex-commands* *E571* *E572* *:tcl* *:tc* -:tc[l] {cmd} Execute Tcl command {cmd}. +:tc[l] {cmd} Execute Tcl command {cmd}. A simple check if `:tcl` + is working: > + :tcl puts "Hello" :[range]tc[l] << {endmarker} {script} diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt index 85370f9..74e0804 100644 --- a/runtime/doc/indent.txt +++ b/runtime/doc/indent.txt @@ -1,4 +1,4 @@ -*indent.txt* For Vim version 7.3. Last change: 2010 Jul 30 +*indent.txt* For Vim version 7.4. Last change: 2013 Aug 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -128,13 +128,20 @@ have changed the indent by typing , , or in the indent or used CTRL-T or CTRL-D. *cinoptions-values* -The 'cinoptions' option sets how Vim performs indentation. In the list below, +The 'cinoptions' option sets how Vim performs indentation. The value after +the option character can be one of these (N is any number): + N indent N spaces + -N indent N spaces to the left + Ns N times 'shiftwidth' spaces + -Ns N times 'shiftwidth' spaces to the left + +In the list below, "N" represents a number of your choice (the number can be negative). When there is an 's' after the number, Vim multiplies the number by 'shiftwidth': "1s" is 'shiftwidth', "2s" is two times 'shiftwidth', etc. You can use a -decimal point, too: "-0.5s" is minus half a 'shiftwidth'. The examples below -assume a 'shiftwidth' of 4. - +decimal point, too: "-0.5s" is minus half a 'shiftwidth'. +The examples below assume a 'shiftwidth' of 4. + *cino->* >N Amount added for "normal" indent. Used after a line that should increase the indent (lines starting with "if", an opening brace, etc.). (default 'shiftwidth'). @@ -145,6 +152,7 @@ assume a 'shiftwidth' of 4. foo; foo; foo; } } } < + *cino-e* eN Add N to the prevailing indent inside a set of braces if the opening brace at the End of the line (more precise: is not the first character in a line). This is useful if you want a @@ -160,6 +168,7 @@ assume a 'shiftwidth' of 4. bar; bar; bar; } } } < + *cino-n* nN Add N to the prevailing indent for a statement after an "if", "while", etc., if it is NOT inside a set of braces. This is useful if you want a different indent when there is no '{' @@ -174,6 +183,7 @@ assume a 'shiftwidth' of 4. bar; bar; bar; } } } < + *cino-f* fN Place the first opening brace of a function or other block in column N. This applies only for an opening brace that is not inside other braces and is at the start of the line. What comes @@ -184,6 +194,7 @@ assume a 'shiftwidth' of 4. { { { int foo; int foo; int foo; < + *cino-{* {N Place opening braces N characters from the prevailing indent. This applies only for opening braces that are inside other braces. (default 0). @@ -193,6 +204,7 @@ assume a 'shiftwidth' of 4. { { { foo; foo; foo; < + *cino-}* }N Place closing braces N characters from the matching opening brace. (default 0). @@ -202,6 +214,7 @@ assume a 'shiftwidth' of 4. foo; foo; foo; } } } < + *cino-^* ^N Add N to the prevailing indent inside a set of braces if the opening brace is in column 0. This can specify a different indent for whole of a function (some may like to set it to a @@ -216,6 +229,7 @@ assume a 'shiftwidth' of 4. } } } } } } < + *cino-L* LN Controls placement of jump labels. If N is negative, the label will be placed at column 1. If N is non-negative, the indent of the label will be the prevailing indent minus N. (default -1). @@ -229,6 +243,7 @@ assume a 'shiftwidth' of 4. } } } } } } < + *cino-:* :N Place case labels N characters from the indent of the switch(). (default 'shiftwidth'). @@ -240,6 +255,7 @@ assume a 'shiftwidth' of 4. default: default: } } < + *cino-=* =N Place statements occurring after a case label N characters from the indent of the label. (default 'shiftwidth'). @@ -247,6 +263,7 @@ assume a 'shiftwidth' of 4. case 11: case 11: a = a + 1; a = a + 1; b = b + 1; < + *cino-l* lN If N != 0 Vim will align with a case label instead of the statement after it in the same line. @@ -256,8 +273,10 @@ assume a 'shiftwidth' of 4. break; break; } } < + *cino-b* bN If N != 0 Vim will align a final "break" with the case label, so that case..break looks like a sort of block. (default: 0). + When using 1, consider adding "0=break" to 'cinkeys'. cino= cino=b1 > switch (x) switch(x) @@ -271,6 +290,7 @@ assume a 'shiftwidth' of 4. break; break; } } < + *cino-g* gN Place C++ scope declarations N characters from the indent of the block they are in. (default 'shiftwidth'). A scope declaration can be "public:", "protected:" or "private:". @@ -282,6 +302,7 @@ assume a 'shiftwidth' of 4. private: private: } } < + *cino-h* hN Place statements occurring after a C++ scope declaration N characters from the indent of the label. (default 'shiftwidth'). @@ -290,6 +311,21 @@ assume a 'shiftwidth' of 4. public: public: a = a + 1; a = a + 1; b = b + 1; < + *cino-N* + NN Indent inside C++ namespace N characters extra compared to a + normal block. (default 0). + + cino= cino=N-s > + namespace { namespace { + void function(); void function(); + } } + + namespace my namespace my + { { + void function(); void function(); + } } +< + *cino-p* pN Parameter declarations for K&R-style function declarations will be indented N characters from the margin. (default 'shiftwidth'). @@ -299,6 +335,7 @@ assume a 'shiftwidth' of 4. int a; int a; int a; char b; char b; char b; < + *cino-t* tN Indent a function return type declaration N characters from the margin. (default 'shiftwidth'). @@ -306,6 +343,7 @@ assume a 'shiftwidth' of 4. int int int func() func() func() < + *cino-i* iN Indent C++ base class declarations and constructor initializations, if they start in a new line (otherwise they are aligned at the right side of the ':'). @@ -319,13 +357,18 @@ assume a 'shiftwidth' of 4. BaseClass(3) BaseClass(3) {} {} < - +N Indent a continuation line (a line that spills onto the next) N - additional characters. (default 'shiftwidth'). + *cino-+* + +N Indent a continuation line (a line that spills onto the next) + inside a function N additional characters. (default + 'shiftwidth'). + Outside of a function, when the previous line ended in a + backslash, the 2 * N is used. cino= cino=+10 > a = b + 9 * a = b + 9 * c; c; < + *cino-c* cN Indent comment lines after the comment opener, when there is no other text with which to align, N characters from the comment opener. (default 3). See also |format-comments|. @@ -335,6 +378,7 @@ assume a 'shiftwidth' of 4. text. text. */ */ < + *cino-C* CN When N is non-zero, indent comment lines by the amount specified with the c flag above even if there is other text behind the comment opener. (default 0). @@ -345,12 +389,14 @@ assume a 'shiftwidth' of 4. ********/ ********/ < (Example uses ":set comments& comments-=s1:/* comments^=s0:/*") + *cino-/* /N Indent comment lines N characters extra. (default 0). cino= cino=/4 > a = b; a = b; /* comment */ /* comment */ c = d; c = d; < + *cino-(* (N When in unclosed parentheses, indent N characters from the line with the unclosed parentheses. Add a 'shiftwidth' for every unclosed parentheses. When N is 0 or the unclosed parentheses @@ -366,6 +412,7 @@ assume a 'shiftwidth' of 4. (c2 || c3)) (c2 || c3)) { { < + *cino-u* uN Same as (N, but for one level deeper. (default 'shiftwidth'). cino= cino=u2 > @@ -373,6 +420,7 @@ assume a 'shiftwidth' of 4. && (c22345 && (c22345 || c3)) || c3)) < + *cino-U* UN When N is non-zero, do not ignore the indenting specified by ( or u in case that the unclosed parentheses is the first non-white character in its line. (default 0). @@ -384,6 +432,7 @@ assume a 'shiftwidth' of 4. c3 c3 ) && c4; ) && c4; < + *cino-w* wN When in unclosed parentheses and N is non-zero and either using "(0" or "u0", respectively, or using "U0" and the unclosed parentheses is the first non-white character in its line, line @@ -396,6 +445,7 @@ assume a 'shiftwidth' of 4. || c3)) || c3)) foo; foo; < + *cino-W* WN When in unclosed parentheses and N is non-zero and either using "(0" or "u0", respectively and the unclosed parentheses is the last non-white character in its line and it is not the @@ -410,6 +460,23 @@ assume a 'shiftwidth' of 4. a_short_line(argument, a_short_line(argument, argument); argument); < + *cino-k* + kN When in unclosed parentheses which follow "if", "for" or + "while" and N is non-zero, overrides the behaviour defined by + "(N": causes the indent to be N characters relative to the outer + context (i.e. the line where "if", "for" or "while" is). Has + no effect on deeper levels of nesting. Affects flags like "wN" + only for the "if", "for" and "while" conditions. If 0, defaults + to behaviour defined by the "(N" flag. (default: 0). + + cino=(0 cino=(0,ks > + if (condition1 if (condition1 + && condition2) && condition2) + action(); action(); + function(argument1 function(argument1 + && argument2); && argument2); +< + *cino-m* mN When N is non-zero, line up a line starting with a closing parentheses with the first character of the line with the matching opening parentheses. (default 0). @@ -424,6 +491,7 @@ assume a 'shiftwidth' of 4. ) ) foo; foo; < + *cino-M* MN When N is non-zero, line up a line starting with a closing parentheses with the first character of the previous line. (default 0). @@ -433,10 +501,11 @@ assume a 'shiftwidth' of 4. cond2 cond2 ) ) < - *java-cinoptions* *java-indenting* - jN Indent java anonymous classes correctly. The value 'N' is - currently unused but must be non-zero (e.g. 'j1'). 'j1' will - indent for example the following code snippet correctly: > + *java-cinoptions* *java-indenting* *cino-j* + jN Indent Java anonymous classes correctly. Also works well for + Javascript. The value 'N' is currently unused but must be + non-zero (e.g. 'j1'). 'j1' will indent for example the + following code snippet correctly: > object.add(new ChangeListener() { public void stateChanged(ChangeEvent e) { @@ -444,10 +513,11 @@ assume a 'shiftwidth' of 4. } }); < - *javascript-cinoptions* *javascript-indenting* + *javascript-cinoptions* *javascript-indenting* *cino-J* JN Indent JavaScript object declarations correctly by not confusing them with labels. The value 'N' is currently unused but must be - non-zero (e.g. 'J1'). > + non-zero (e.g. 'J1'). If you enable this you probably also want + to set |cino-j|. > var bar = { foo: { @@ -462,23 +532,28 @@ assume a 'shiftwidth' of 4. } } < + *cino-)* )N Vim searches for unclosed parentheses at most N lines away. This limits the time needed to search for parentheses. (default 20 lines). + *cino-star* *N Vim searches for unclosed comments at most N lines away. This limits the time needed to search for the start of a comment. + If your /* */ comments stop indenting after N lines this is the + value you will want to change. (default 70 lines). + *cino-#* #N When N is non-zero recognize shell/Perl comments, starting with - '#'. Default N is zero: don't recognizes '#' comments. Note + '#'. Default N is zero: don't recognize '#' comments. Note that lines starting with # will still be seen as preprocessor lines. The defaults, spelled out in full, are: - cinoptions=>s,e0,n0,f0,{0,}0,^0,L-1,:s,=s,l0,b0,gs,hs,ps,ts,is,+s, - c3,C0,/0,(2s,us,U0,w0,W0,m0,j0,J0,)20,*70,#0 + cinoptions=>s,e0,n0,f0,{0,}0,^0,L-1,:s,=s,l0,b0,gs,hs,N0,ps,ts,is,+s, + c3,C0,/0,(2s,us,U0,w0,W0,k0,m0,j0,J0,)20,*70,#0 Vim puts a line in column 1 if: - It starts with '#' (preprocessor directives), if 'cinkeys' contains '#'. @@ -502,15 +577,117 @@ $VIMRUNTIME/indent directory for examples. REMARKS ABOUT SPECIFIC INDENT FILES ~ +CLOJURE *ft-clojure-indent* *clojure-indent* + +Clojure indentation differs somewhat from traditional Lisps, due in part to +the use of square and curly brackets, and otherwise by community convention. +These conventions are not always universally followed, so the Clojure indent +script offers a few configurable options, listed below. + +If the current vim does not include searchpairpos(), the indent script falls +back to normal 'lisp' indenting, and the following options are ignored. + + *g:clojure_maxlines* + +Set maximum scan distance of searchpairpos(). Larger values trade performance +for correctness when dealing with very long forms. A value of 0 will scan +without limits. +> + " Default + let g:clojure_maxlines = 100 +< + + *g:clojure_fuzzy_indent* + *g:clojure_fuzzy_indent_patterns* + *g:clojure_fuzzy_indent_blacklist* + +The 'lispwords' option is a list of comma-separated words that mark special +forms whose subforms must be indented with two spaces. + +For example: +> + (defn bad [] + "Incorrect indentation") + + (defn good [] + "Correct indentation") +< +If you would like to specify 'lispwords' with a |pattern| instead, you can use +the fuzzy indent feature: +> + " Default + let g:clojure_fuzzy_indent = 1 + let g:clojure_fuzzy_indent_patterns = ['^with', '^def', '^let'] + let g:clojure_fuzzy_indent_blacklist = + \ ['-fn$', '\v^with-%(meta|out-str|loading-context)$'] + + " Legacy comma-delimited string version; the list format above is + " recommended. Note that patterns are implicitly anchored with ^ and $ + let g:clojure_fuzzy_indent_patterns = 'with.*,def.*,let.*' +< +|g:clojure_fuzzy_indent_patterns| and |g:clojure_fuzzy_indent_blacklist| are +|Lists| of patterns that will be matched against the unquoted, unqualified +symbol at the head of a list. This means that a pattern like "^foo" will match +all these candidates: "foobar", "my.ns/foobar", and "#'foobar". + +Each candidate word is tested for special treatment in this order: + + 1. Return true if word is literally in 'lispwords' + 2. Return false if word matches a pattern in + |g:clojure_fuzzy_indent_blacklist| + 3. Return true if word matches a pattern in + |g:clojure_fuzzy_indent_patterns| + 4. Return false and indent normally otherwise + + *g:clojure_special_indent_words* + +Some forms in Clojure are indented so that every subform is indented only two +spaces, regardless of 'lispwords'. If you have a custom construct that should +be indented in this idiosyncratic fashion, you can add your symbols to the +default list below. +> + " Default + let g:clojure_special_indent_words = + \ 'deftype,defrecord,reify,proxy,extend-type,extend-protocol,letfn' +< + + *g:clojure_align_multiline_strings* + +Align subsequent lines in multiline strings to the column after the opening +quote, instead of the same column. + +For example: +> + (def default + "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut + enim ad minim veniam, quis nostrud exercitation ullamco laboris + nisi ut aliquip ex ea commodo consequat.") + + (def aligned + "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut + enim ad minim veniam, quis nostrud exercitation ullamco laboris + nisi ut aliquip ex ea commodo consequat.") +< +This option is off by default. +> + " Default + let g:clojure_align_multiline_strings = 0 +< + + FORTRAN *ft-fortran-indent* -Block if, select case, and where constructs are indented. Comments, labelled -statements and continuation lines are indented if the Fortran is in free -source form, whereas they are not indented if the Fortran is in fixed source -form because of the left margin requirements. Hence manual indent corrections -will be necessary for labelled statements and continuation lines when fixed -source form is being used. For further discussion of the method used for the -detection of source format see |ft-fortran-syntax|. +Block if, select case, where, and forall constructs are indented. So are +type, interface, associate, block, and enum constructs. The indenting of +subroutines, functions, modules, and program blocks is optional. Comments, +labelled statements and continuation lines are indented if the Fortran is in +free source form, whereas they are not indented if the Fortran is in fixed +source form because of the left margin requirements. Hence manual indent +corrections will be necessary for labelled statements and continuation lines +when fixed source form is being used. For further discussion of the method +used for the detection of source format see |ft-fortran-syntax|. Do loops ~ All do loops are left unindented by default. Do loops can be unstructured in @@ -537,6 +714,64 @@ autocommand such as > to get do loops indented in .f90 files and left alone in Fortran files with other extensions such as .for. +Program units ~ +The indenting of program units (subroutines, functions, modules, and program +blocks) is enabled by default but can be suppressed if a lighter, screen-width +preserving indent style is desired. To suppress the indenting of program +units for all fortran files set the global fortran_indent_less variable in +your .vimrc as follows > + + let fortran_indent_less=1 + +A finer level of suppression can be achieved by setting the corresponding +buffer-local variable as follows > + + let b:fortran_indent_less=1 + + +HTML *ft-html-indent* *html-indent* *html-indenting* + +This is about variables you can set in your vimrc to customize HTML indenting. + +You can set the indent for the first line after ', 'nWb') - \ && 0 < searchpair(js, '', '', 'nW') - " we're inside javascript - if getline(lnum) !~ js && getline(a:lnum) != '' - if restore_ic == 0 - setlocal noic +func! s:CSSIndent() "{{{ + " adopted $VIMRUNTIME/indent/css.vim + if getline(v:lnum) =~ '^\s*[*}]' + return cindent(v:lnum) + endif + let minline = b:indent.blocklnr + let pnum = s:css_prevnoncomment(v:lnum - 1, minline) + if pnum <= minline + " < is to catch errors + " indent for first content line after comments + return eval(s:css1indent) + endif + let ind = indent(pnum) + s:css_countbraces(pnum, 1) * s:ShiftWidth() + let pline = getline(pnum) + if pline =~ '}\s*$' + let ind -= (s:css_countbraces(pnum, 0) - (pline =~ '^\s*}')) * s:ShiftWidth() + endif + return ind +endfunc "}}} +func! s:css_prevnoncomment(lnum, stopline) "{{{ + " caller starts from a line a:lnum-1 that is not a comment + let lnum = prevnonblank(a:lnum) + let ccol = match(getline(lnum), '\*/') + if ccol < 0 + return lnum + endif + call cursor(lnum, ccol+1) + let lnum = search('/\*', 'bW', a:stopline) + if indent(".") == virtcol(".")-1 + return prevnonblank(lnum-1) + else + return lnum + endif +endfunc "}}} +func! s:css_countbraces(lnum, count_open) "{{{ + let brs = substitute(getline(a:lnum),'[''"].\{-}[''"]\|/\*.\{-}\*/\|/\*.*$\|[^{}]','','g') + let n_open = 0 + let n_close = 0 + for brace in split(brs, '\zs') + if brace == "{" + let n_open += 1 + elseif brace == "}" + if n_open > 0 + let n_open -= 1 + else + let n_close += 1 endif - return cindent(a:lnum) endif + endfor + return a:count_open ? n_open : n_close +endfunc "}}} + +"}}} +func! s:Alien5() "{{{ + " + return -1 +endfunc "}}} + +func! HtmlIndent() "{{{ + let s:curline = tolower(getline(v:lnum)) + let indentunit = s:ShiftWidth() + + let s:newstate = {} + let s:newstate.lnum = v:lnum + + " does the line start with a closing tag? + let swendtag = match(s:curline, '^\s*= 0 + + if prevnonblank(v:lnum-1) == b:indent.lnum && s:usestate + " use state (continue from previous line) + else + " start over (know nothing) + let b:indent = s:FreshState(v:lnum) endif - if getline(lnum) =~ '\c' - " line before the current line a:lnum contains - " a closing . --> search for line before - " starting
 to restore the indent.
-	let preline = prevnonblank(search('\c
', 'bW') - 1)
-	if preline > 0
-	    if restore_ic == 0
-	      setlocal noic
+    if b:indent.block >= 2
+	" within block
+	let endtag = s:endtags[b:indent.block-2]
+	let blockend = stridx(s:curline, endtag)
+	if blockend >= 0
+	    " block ends here
+	    let s:newstate.block = 0
+	    " calc indent for REST OF LINE (may start more blocks):
+	    let s:curline = strpart(s:curline, blockend+strlen(endtag))
+	    call s:CountITags()
+	    if swendtag && b:indent.block != 5
+		let indent = b:indent.blocktagind + s:curind * indentunit
+		let s:newstate.baseindent = indent + s:nextrel * indentunit
+	    else
+		let indent = s:Alien{b:indent.block}()
+		let s:newstate.baseindent = b:indent.blocktagind + s:nextrel * indentunit
 	    endif
-	    return indent(preline)
+	    call extend(b:indent, s:newstate, "force")
+	    return indent
+	else
+	    " block continues
+	    " indent this line with alien method
+	    let indent = s:Alien{b:indent.block}()
+	    call extend(b:indent, s:newstate, "force")
+	    return indent
 	endif
+    else
+	" not within a block - within usual html
+	" if < 2 then always 0
+	let s:newstate.block = b:indent.block
+	call s:CountITags()
+	if swendtag
+	    let indent = b:indent.baseindent + s:curind * indentunit
+	    let s:newstate.baseindent = indent + s:nextrel * indentunit
+	else
+	    let indent = b:indent.baseindent
+	    let s:newstate.baseindent = indent + (s:curind + s:nextrel) * indentunit
+	endif
+	call extend(b:indent, s:newstate, "force")
+	return indent
     endif
 
-    let ind = HtmlIndentSum(lnum, -1)
-    let ind = ind + HtmlIndentSum(a:lnum, 0)
+endfunc "}}}
 
-    if restore_ic == 0
-	setlocal noic
-    endif
+" check user settings (first time), clear cpo, Modeline: {{{1
+
+" DEBUG:
+com! -nargs=* IndHtmlLocal 
 
-    return indent(lnum) + (&sw * ind)
-endfun
+call HtmlIndent_CheckUserSettings()
 
 let &cpo = s:cpo_save
 unlet s:cpo_save
 
-" [-- EOF /indent/html.vim --]
+" vim:set fdm=marker ts=8:
diff --git a/runtime/indent/idlang.vim b/runtime/indent/idlang.vim
index 97c31ad..b4c6ae6 100644
--- a/runtime/indent/idlang.vim
+++ b/runtime/indent/idlang.vim
@@ -1,6 +1,6 @@
 " IDL (Interactive Data Language) indent file.
 " Language: IDL (ft=idlang)
-" Last change:	2002 Sep 23
+" Last change:	2012 May 18
 " Maintainer: Aleksandar Jelenak 
 
 " Only load this indent file when no other was loaded.
@@ -9,8 +9,7 @@ if exists("b:did_indent")
 endif
 let b:did_indent = 1
 
-setlocal indentkeys=o,O,0=endif,0=ENDIF,0=endelse,0=ENDELSE,0=endwhile,
-		    \0=ENDWHILE,0=endfor,0=ENDFOR,0=endrep,0=ENDREP
+setlocal indentkeys=o,O,0=endif,0=ENDIF,0=endelse,0=ENDELSE,0=endwhile,0=ENDWHILE,0=endfor,0=ENDFOR,0=endrep,0=ENDREP
 
 setlocal indentexpr=GetIdlangIndent(v:lnum)
 
diff --git a/runtime/indent/java.vim b/runtime/indent/java.vim
index facbdbf..e0aec0f 100644
--- a/runtime/indent/java.vim
+++ b/runtime/indent/java.vim
@@ -1,7 +1,12 @@
 " Vim indent file
 " Language:	Java
-" Maintainer:	Toby Allsopp  (resigned)
-" Last Change:	2005 Mar 28
+" Previous Maintainer: Toby Allsopp 
+" Current Maintainer: Hong Xu 
+" Last Change:	2012 May 18
+" Version: 1.0
+" License: Same as Vim.
+" Copyright (c) 2012 Hong Xu
+" Before 2012, this file is maintained by Toby Allsopp.
 
 " Only load this indent file when no other was loaded.
 if exists("b:did_indent")
@@ -24,6 +29,8 @@ let b:undo_indent = "set cin< cino< indentkeys< indentexpr<"
 if exists("*GetJavaIndent")
   finish
 endif
+let s:keepcpo= &cpo
+set cpo&vim
 
 function! SkipJavaBlanksAndComments(startline)
   let lnum = a:startline
@@ -60,6 +67,13 @@ function GetJavaIndent()
 
   " find start of previous line, in case it was a continuation line
   let lnum = SkipJavaBlanksAndComments(v:lnum - 1)
+
+  " If the previous line starts with '@', we should have the same indent as
+  " the previous one
+  if getline(lnum) =~ '^\s*@\S\+\s*$'
+    return indent(lnum)
+  endif
+
   let prev = lnum
   while prev > 1
     let next_prev = SkipJavaBlanksAndComments(prev - 1)
@@ -127,4 +141,7 @@ function GetJavaIndent()
   return theIndent
 endfunction
 
+let &cpo = s:keepcpo
+unlet s:keepcpo
+
 " vi: sw=2 et
diff --git a/runtime/indent/liquid.vim b/runtime/indent/liquid.vim
index 08341b0..01e7223 100644
--- a/runtime/indent/liquid.vim
+++ b/runtime/indent/liquid.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:     Liquid
 " Maintainer:   Tim Pope 
-" Last Change:	2010 May 21
+" Last Change:	2013 May 30
 
 if exists('b:did_indent')
   finish
@@ -54,9 +54,8 @@ function! GetLiquidIndent(...)
   let line  = substitute(line,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','')
   let line .= matchstr(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+')
   let cline = substitute(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','')
-  let ind += &sw * s:count(line,'{%\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|tablerow\|capture\)\>')
+  let ind += &sw * s:count(line,'{%\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>')
   let ind -= &sw * s:count(line,'{%\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>')
-  let ind += &sw * s:count(line,'{%\s*\%(elsif\|else\|when\|empty\)\>')
   let ind -= &sw * s:count(cline,'{%\s*\%(elsif\|else\|when\|empty\)\>')
   let ind -= &sw * s:count(cline,'{%\s*end\w*$')
   return ind
diff --git a/runtime/indent/lisp.vim b/runtime/indent/lisp.vim
index 9f404ae..b0c4eed 100644
--- a/runtime/indent/lisp.vim
+++ b/runtime/indent/lisp.vim
@@ -1,8 +1,8 @@
 " Vim indent file
 " Language:	Lisp
 " Maintainer:    Sergey Khorev 
-" URL:		 http://iamphet.nm.ru/vim
-" Last Change:	2005 May 19
+" URL:		 http://sites.google.com/site/khorser/opensource/vim
+" Last Change:	2012 Jan 10
 
 " Only load this indent file when no other was loaded.
 if exists("b:did_indent")
diff --git a/runtime/indent/mp.vim b/runtime/indent/mp.vim
index 1aea4f8..a118eb8 100644
--- a/runtime/indent/mp.vim
+++ b/runtime/indent/mp.vim
@@ -1,7 +1,7 @@
 " MetaPost indent file
 " Language:	MetaPost
 " Maintainer:	Eugene Minkovskii 
-" Last Change:	2003 Nov 21
+" Last Change:	2012 May 18
 " Version: 0.1
 " ==========================================================================
 
@@ -56,6 +56,8 @@ setlocal indentkeys+=;,<:>,=if,=for,=def,=end,=else,=fi
 if exists("*GetMetaPostIndent")
   finish
 endif
+let s:keepcpo= &cpo
+set cpo&vim
 
 " Auxiliary Definitions: {{{1
 function! MetaNextNonblankNoncomment(pos)
@@ -203,4 +205,7 @@ function! GetMetaPostIndent()
 endfunction
 "
 
+let &cpo = s:keepcpo
+unlet s:keepcpo
+
 " vim:sw=2:fdm=marker
diff --git a/runtime/indent/ocaml.vim b/runtime/indent/ocaml.vim
index 5c267af..3bd65c6 100644
--- a/runtime/indent/ocaml.vim
+++ b/runtime/indent/ocaml.vim
@@ -1,12 +1,16 @@
 " Vim indent file
 " Language:     OCaml
-" Maintainers:	Jean-Francois Yuen   
-"		Mike Leary	     
-"		Markus Mottl	     
-" URL:		http://www.ocaml.info/vim/indent/ocaml.vim
-" Last Change:  2005 Jun 25 - Fixed multiple bugs due to 'else\nreturn ind' working
-"		2005 May 09 - Added an option to not indent OCaml-indents specially (MM)
-"		2005 Apr 11 - Fixed an indentation bug concerning "let" (MM)
+" Maintainers:  Jean-Francois Yuen   
+"               Mike Leary           
+"               Markus Mottl         
+" URL:          http://www.ocaml.info/vim/indent/ocaml.vim
+" Last Change:  2013 Jun 29
+"               2005 Jun 25 - Fixed multiple bugs due to 'else\nreturn ind' working
+"               2005 May 09 - Added an option to not indent OCaml-indents specially (MM)
+"               2013 June   - commented textwidth (Marc Weber)
+"
+" Marc Weber's comment: This file may contain a lot of (very custom) stuff
+" which eventually should be moved somewhere else ..
 
 " Only load this indent file when no other was loaded.
 if exists("b:did_indent")
@@ -19,7 +23,9 @@ setlocal indentexpr=GetOCamlIndent()
 setlocal indentkeys+=0=and,0=class,0=constraint,0=done,0=else,0=end,0=exception,0=external,0=if,0=in,0=include,0=inherit,0=initializer,0=let,0=method,0=open,0=then,0=type,0=val,0=with,0;;,0>\],0\|\],0>},0\|,0},0\],0)
 setlocal nolisp
 setlocal nosmartindent
-setlocal textwidth=80
+
+" At least Marc Weber and Markus Mottl do not like this:
+" setlocal textwidth=80
 
 " Comment formatting
 if !exists("no_ocaml_comments")
@@ -44,7 +50,7 @@ let s:obj = '^\s*\(constraint\|inherit\|initializer\|method\|val\)\>\|\<\(object
 let s:type = '^\s*\%(class\|let\|type\)\>.*='
 
 " Skipping pattern, for comments
-function s:GetLineWithoutFullComment(lnum)
+function! s:GetLineWithoutFullComment(lnum)
  let lnum = prevnonblank(a:lnum - 1)
  let lline = substitute(getline(lnum), '(\*.*\*)\s*$', '', '')
  while lline =~ '^\s*$' && lnum > 0
@@ -55,7 +61,7 @@ function s:GetLineWithoutFullComment(lnum)
 endfunction
 
 " Indent for ';;' to match multiple 'let'
-function s:GetInd(lnum, pat, lim)
+function! s:GetInd(lnum, pat, lim)
  let llet = search(a:pat, 'bW')
  let old = indent(a:lnum)
  while llet > 0
@@ -70,18 +76,18 @@ function s:GetInd(lnum, pat, lim)
 endfunction
 
 " Indent pairs
-function s:FindPair(pstart, pmid, pend)
+function! s:FindPair(pstart, pmid, pend)
  call search(a:pend, 'bW')
  return indent(searchpair(a:pstart, a:pmid, a:pend, 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"'))
 endfunction
 
 " Indent 'let'
-function s:FindLet(pstart, pmid, pend)
+function! s:FindLet(pstart, pmid, pend)
  call search(a:pend, 'bW')
  return indent(searchpair(a:pstart, a:pmid, a:pend, 'bWn', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment" || getline(".") =~ "^\\s*let\\>.*=.*\\
 " Created:     2004 Jul 13
-" Last Change: 2005 Jul 05
+" Last Change: 2011 Apr 01
+"
+" This is version 2.0, a complete rewrite.
+"
+" For further documentation, see http://psy.swansea.ac.uk/staff/carter/vim/
 
 
 if exists("b:did_indent")
@@ -38,7 +42,15 @@ function! s:GetPrevNonCommentLineNum( line_num )
 endfunction
 
 
+function! s:PurifyCode( line_num )
+	" Strip any trailing comments and whitespace
+	let pureline = 'TODO'
+	return pureline
+endfunction
+
+
 function! GetPascalIndent( line_num )
+
 	" Line 0 always goes at column 0
 	if a:line_num == 0
 		return 0
@@ -46,128 +58,171 @@ function! GetPascalIndent( line_num )
 
 	let this_codeline = getline( a:line_num )
 
-	" If in the middle of a three-part comment
+
+	" SAME INDENT
+
+	" Middle of a three-part comment
 	if this_codeline =~ '^\s*\*'
-		return indent( a:line_num )
+		return indent( a:line_num - 1)
 	endif
 
-	let prev_codeline_num = s:GetPrevNonCommentLineNum( a:line_num )
-	let prev_codeline = getline( prev_codeline_num )
-	let indnt = indent( prev_codeline_num )
 
-	" Compiler directives should always go in column zero.
-	if this_codeline =~ '^\s*{\(\$IFDEF\|\$ELSE\|\$ENDIF\)'
+	" COLUMN 1 ALWAYS
+
+	" Last line of the program
+	if this_codeline =~ '^\s*end\.'
 		return 0
 	endif
 
-	" These items have nothing before or after (not even a comment), and
-	" go on column 0. Make sure that the ^\s* is followed by \( to make
-	" ORs work properly, and not include the start of line (this must
-	" always appear).
-	" The bracketed expression with the underline is a routine
-	" separator. This is one case where we do indent comment lines.
-	if this_codeline =~ '^\s*\((\*\ _\+\ \*)\|\<\(const\|var\)\>\)$'
+	" Compiler directives, allowing "(*" and "{"
+	"if this_codeline =~ '^\s*\({\|(\*\)$\(IFDEF\|IFNDEF\|ELSE\|ENDIF\)'
+	if this_codeline =~ '^\s*\({\|(\*\)\$'
 		return 0
 	endif
 
-	" These items may have text after them, and go on column 0 (in most
-	" cases). The problem is that "function" and "procedure" keywords
-	" should be indented if within a class declaration.
-	if this_codeline =~ '^\s*\<\(program\|type\|uses\|procedure\|function\)\>'
+	" section headers
+	if this_codeline =~ '^\s*\(program\|procedure\|function\|type\)\>'
 		return 0
 	endif
 
-	" BEGIN
-	" If the begin does not come after "if", "for", or "else", then it
-	" goes in column 0
-	if this_codeline =~ '^\s*begin\>' && prev_codeline !~ '^\s*\<\(if\|for\|else\)\>'
+	" Subroutine separators, lines ending with "const" or "var"
+	if this_codeline =~ '^\s*\((\*\ _\+\ \*)\|\(const\|var\)\)$'
 		return 0
 	endif
 
-	" These keywords are indented once only.
-	if this_codeline =~ '^\s*\<\(private\)\>'
-		return &shiftwidth
-	endif
 
-	" If the PREVIOUS LINE contained these items, the current line is
-	" always indented once.
-	if prev_codeline =~ '^\s*\<\(type\|uses\)\>'
-		return &shiftwidth
-	endif
+	" OTHERWISE, WE NEED TO LOOK FURTHER BACK...
 
-	" These keywords are indented once only. Possibly surrounded by
-	" other chars.
-	if this_codeline =~ '^.\+\<\(object\|record\)\>'
-		return &shiftwidth
+	let prev_codeline_num = s:GetPrevNonCommentLineNum( a:line_num )
+	let prev_codeline = getline( prev_codeline_num )
+	let indnt = indent( prev_codeline_num )
+
+
+	" INCREASE INDENT
+
+	" If the PREVIOUS LINE ended in these items, always indent
+	if prev_codeline =~ '\<\(type\|const\|var\)$'
+		return indnt + &shiftwidth
 	endif
 
-	" If the previous line was indenting...
-	if prev_codeline =~ '^\s*\<\(for\|if\|case\|else\|end\ else\)\>'
-		" then indent.
-		let indnt = indnt + &shiftwidth
-		" BUT... if this is the start of a multistatement block then we
-		" need to align the begin with the previous line.
-		if this_codeline =~ '^\s*begin\>'
-			return indnt - &shiftwidth
+	if prev_codeline =~ '\'
+			return indnt + &shiftwidth
+		else
+			return indnt
 		endif
+	endif
 
-		" We also need to keep the indentation level constant if the
-		" whole if-then statement was on one line.
-		if prev_codeline =~ '\.\+'
-			let indnt = indnt - &shiftwidth
+	if prev_codeline =~ '\<\(begin\|record\)$'
+		if this_codeline !~ '^\s*end\>'
+			return indnt + &shiftwidth
+		else
+			return indnt
 		endif
 	endif
 
-	" PREVIOUS-LINE BEGIN
-	" If the previous line was an indenting keyword then indent once...
-	if prev_codeline =~ '^\s*\<\(const\|var\|begin\|repeat\|private\)\>'
-		" But only if this is another var in a list.
-		if this_codeline !~ '^\s*var\>'
+	" If the PREVIOUS LINE ended with these items, indent if not
+	" followed by "begin"
+	if prev_codeline =~ '\<\(\|else\|then\|do\)$' || prev_codeline =~ ':$'
+		if this_codeline !~ '^\s*begin\>'
 			return indnt + &shiftwidth
+		else
+			" If it does start with "begin" then keep the same indent
+			"return indnt + &shiftwidth
+			return indnt
 		endif
 	endif
 
-	" PREVIOUS-LINE BEGIN
-	" Indent code after a case statement begin
-	if prev_codeline =~ '\:\ begin\>'
+	" Inside a parameter list (i.e. a "(" without a ")"). ???? Considers
+	" only the line before the current one. TODO: Get it working for
+	" parameter lists longer than two lines.
+	if prev_codeline =~ '([^)]\+$'
 		return indnt + &shiftwidth
 	endif
 
-	" These words may have text before them on the line (hence the .*)
-	" but are followed by nothing. Always indent once only.
-	if prev_codeline =~ '^\(.*\|\s*\)\<\(object\|record\)\>$'
-		return indnt + &shiftwidth
+
+	" DECREASE INDENT
+
+	" Lines starting with "else", but not following line ending with
+	" "end".
+	if this_codeline =~ '^\s*else\>' && prev_codeline !~ '\'
+	" Lines starting with "until" or "end". This rule must be overridden
+	" by the one for "end" after a single-statement branch/loop. In
+	" other words that rule should come before this one.
+	if this_codeline =~ '^\s*\(end\|until\)\>'
 		return indnt - &shiftwidth
 	endif
 
-	" If we have opened a bracket and it continues over one line,
-	" then indent once.
-	"
-	" RE = an opening bracket followed by any amount of anything other
-	" than a closing bracket and then the end-of-line.
-	"
-	" If we didn't include the end of line, this RE would match even
-	" closed brackets, since it would match everything up to the closing
-	" bracket.
-	"
-	" This test isn't clever enough to handle brackets inside strings or
-	" comments.
-	if prev_codeline =~ '([^*]\=[^)]*$'
+
+	" MISCELLANEOUS THINGS TO CATCH
+
+	" Most "begin"s will have been handled by now. Any remaining
+	" "begin"s on their own line should go in column 1.
+	if this_codeline =~ '^\s*begin$'
+		return 0
+	endif
+
+
+" ____________________________________________________________________
+" Object/Borland Pascal/Delphi Extensions
+"
+" Note that extended-pascal is handled here, unless it is simpler to
+" handle them in the standard-pascal section above.
+
+
+	" COLUMN 1 ALWAYS
+
+	" section headers at start of line.
+	if this_codeline =~ '^\s*\(interface\|implementation\|uses\|unit\)\>'
+		return 0
+	endif
+
+
+	" INDENT ONCE
+
+	" If the PREVIOUS LINE ended in these items, always indent.
+	if prev_codeline =~ '^\s*\(unit\|uses\|try\|except\|finally\|private\|protected\|public\|published\)$'
 		return indnt + &shiftwidth
 	endif
 
+	" ???? Indent "procedure" and "functions" if they appear within an
+	" class/object definition. But that means overriding standard-pascal
+	" rule where these words always go in column 1.
+
+
+	" UNINDENT ONCE
+
+	if this_codeline =~ '^\s*\(except\|finally\)$'
+		return indnt - &shiftwidth
+	endif
+
+	if this_codeline =~ '^\s*\(private\|protected\|public\|published\)$'
+		return indnt - &shiftwidth
+	endif
+
+
+" ____________________________________________________________________
+
+	" If nothing changed, return same indent.
 	return indnt
 endfunction
 
diff --git a/runtime/indent/perl.vim b/runtime/indent/perl.vim
index 1fbc4de..fc4b6a3 100644
--- a/runtime/indent/perl.vim
+++ b/runtime/indent/perl.vim
@@ -1,8 +1,9 @@
 " Vim indent file
-" Language:     Perl 5
-" Author:       Andy Lester 
-" URL:          http://github.com/petdance/vim-perl/tree/master
-" Last Change:  June 3, 2009
+" Language:      Perl 5
+" Maintainer:    vim-perl 
+" Homepage:      http://github.com/vim-perl/vim-perl
+" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
+" Last Change:   2013-07-24
 
 " Suggestions and improvements by :
 "   Aaron J. Sherman (use syntax for hints)
@@ -11,9 +12,9 @@
 " TODO things that are not or not properly indented (yet) :
 " - Continued statements
 "     print "foo",
-"	"bar";
+"       "bar";
 "     print "foo"
-"	if bar();
+"       if bar();
 " - Multiline regular expressions (m//x)
 " (The following probably needs modifying the perl syntax file)
 " - qw() lists
@@ -34,15 +35,10 @@ if !b:indent_use_syntax
     setlocal indentkeys+=0=EO
 endif
 
-" Only define the function once.
-if exists("*GetPerlIndent")
-    finish
-endif
-
 let s:cpo_save = &cpo
 set cpo-=C
 
-function GetPerlIndent()
+function! GetPerlIndent()
 
     " Get the line to be indented
     let cline = getline(v:lnum)
@@ -52,7 +48,7 @@ function GetPerlIndent()
         return 0
     endif
 
-    " Don't reindent coments on first column
+    " Don't reindent comments on first column
     if cline =~ '^#.'
         return 0
     endif
@@ -124,7 +120,12 @@ function GetPerlIndent()
     " Indent blocks enclosed by {}, (), or []
     if b:indent_use_syntax
         " Find a real opening brace
-        let bracepos = match(line, '[(){}\[\]]', matchend(line, '^\s*[)}\]]'))
+        " NOTE: Unlike Perl character classes, we do NOT need to escape the
+        " closing brackets with a backslash.  Doing so just puts a backslash
+        " in the character class and causes sorrow.  Instead, put the closing
+        " bracket as the first character in the class.
+        let braceclass = '[][(){}]'
+        let bracepos = match(line, braceclass, matchend(line, '^\s*[])}]'))
         while bracepos != -1
             let synid = synIDattr(synID(lnum, bracepos + 1, 0), "name")
             " If the brace is highlighted in one of those groups, indent it.
@@ -132,8 +133,9 @@ function GetPerlIndent()
             if synid == ""
                         \ || synid == "perlMatchStartEnd"
                         \ || synid == "perlHereDoc"
+                        \ || synid == "perlBraces"
                         \ || synid =~ "^perlFiledescStatement"
-                        \ || synid =~ '^perl\(Sub\|Block\)Fold'
+                        \ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
                 let brace = strpart(line, bracepos, 1)
                 if brace == '(' || brace == '{' || brace == '['
                     let ind = ind + &sw
@@ -141,22 +143,23 @@ function GetPerlIndent()
                     let ind = ind - &sw
                 endif
             endif
-            let bracepos = match(line, '[(){}\[\]]', bracepos + 1)
+            let bracepos = match(line, braceclass, bracepos + 1)
         endwhile
-        let bracepos = matchend(cline, '^\s*[)}\]]')
+        let bracepos = matchend(cline, '^\s*[])}]')
         if bracepos != -1
             let synid = synIDattr(synID(v:lnum, bracepos, 0), "name")
             if synid == ""
                         \ || synid == "perlMatchStartEnd"
-                        \ || synid =~ '^perl\(Sub\|Block\)Fold'
+                        \ || synid == "perlBraces"
+                        \ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
                 let ind = ind - &sw
             endif
         endif
     else
-        if line =~ '[{\[(]\s*\(#[^)}\]]*\)\=$'
+        if line =~ '[{[(]\s*\(#[^])}]*\)\=$'
             let ind = ind + &sw
         endif
-        if cline =~ '^\s*[)}\]]'
+        if cline =~ '^\s*[])}]'
             let ind = ind - &sw
         endif
     endif
diff --git a/runtime/indent/perl6.vim b/runtime/indent/perl6.vim
index 75159e3..ff2a579 100644
--- a/runtime/indent/perl6.vim
+++ b/runtime/indent/perl6.vim
@@ -1,12 +1,13 @@
 " Vim indent file
-" Language:     Perl 6
-" Maintainer:   Andy Lester 
-" URL:          http://github.com/petdance/vim-perl/tree/master
-" Last Change:  2009-07-04
-" Contributors: Andy Lester 
-"               Hinrik Örn Sigurðsson 
+" Language:      Perl 6
+" Maintainer:    vim-perl 
+" Homepage:      http://github.com/vim-perl/vim-perl
+" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
+" Last Change:   2013-07-21
+" Contributors:  Andy Lester 
+"                Hinrik Örn Sigurðsson 
 "
-" Adapted from Perl indent file by Rafael Garcia-Suarez 
+" Adapted from indent/perl.vim by Rafael Garcia-Suarez 
 
 " Suggestions and improvements by :
 "   Aaron J. Sherman (use syntax for hints)
@@ -46,15 +47,10 @@ if !b:indent_use_syntax
     setlocal indentkeys+=0=EO
 endif
 
-" Only define the function once.
-if exists("*GetPerl6Indent")
-    finish
-endif
-
 let s:cpo_save = &cpo
 set cpo-=C
 
-function GetPerl6Indent()
+function! GetPerl6Indent()
 
     " Get the line to be indented
     let cline = getline(v:lnum)
diff --git a/runtime/indent/php.vim b/runtime/indent/php.vim
index bc196ed..4902b9e 100644
--- a/runtime/indent/php.vim
+++ b/runtime/indent/php.vim
@@ -2,21 +2,23 @@
 " Language:	PHP
 " Author:	John Wellesz 
 " URL:		http://www.2072productions.com/vim/indent/php.vim
-" Last Change:	2010 Jully 26th
-" Newsletter:	http://www.2072productions.com/?to=php-indent-for-vim-newsletter.php
-" Version:	1.33
+" Home:		https://github.com/2072/PHP-Indenting-for-VIm
+" Last Change:	2013 August 7th
+" Version:	1.39
 "
 "
-"  If you find a bug, please report it on GitHub:
-"	http://github.com/2072/PHP-Indenting-for-VIm/issues
-"  with an example of code that breaks the algorithm.
+"	Type :help php-indent for available options
 "
+"	A fully commented version of this file is available on github
 "
-"	Thanks a lot for using this script.
 "
+"  If you find a bug, please open a ticket on github.org
+"  ( https://github.com/2072/PHP-Indenting-for-VIm/issues ) with an example of
+"  code that breaks the algorithm.
 "
+
 " NOTE: This script must be used with PHP syntax ON and with the php syntax
-"	script by Lutz Eymers (http://www.ipdienste.net/data/php.vim ) or with the
+"	script by Lutz Eymers (http://www.isp.de/data/php.vim ) or with the
 "	script by Peter Hodge (http://www.vim.org/scripts/script.php?script_id=1571 )
 "	the later is bunbdled by default with Vim 7.
 "
@@ -26,7 +28,7 @@
 "	script will automatically put HereDoc end identifiers at col 1 if
 "	they are followed by a ';').
 "
-"
+
 " NOTE: If you are editing files in Unix file format and that (by accident)
 "	there are '\r' before new lines, this script won't be able to proceed
 "	correctly and will make many mistakes because it won't be able to match
@@ -38,8 +40,6 @@
 "	or simply 'let' the option PHP_removeCRwhenUnix to 1 and the script will
 "	silently remove them when VIM load this script (at each bufread).
 "
-" Options: See :help php-indent for available options.
-
 
 if exists("b:did_indent")
     finish
@@ -50,12 +50,19 @@ let b:did_indent = 1
 let php_sync_method = 0
 
 
+
 if exists("PHP_default_indenting")
     let b:PHP_default_indenting = PHP_default_indenting * &sw
 else
     let b:PHP_default_indenting = 0
 endif
 
+if exists("PHP_outdentSLComments")
+    let b:PHP_outdentSLComments = PHP_outdentSLComments * &sw
+else
+    let b:PHP_outdentSLComments = 0
+endif
+
 if exists("PHP_BracesAtCodeLevel")
     let b:PHP_BracesAtCodeLevel = PHP_BracesAtCodeLevel
 else
@@ -116,13 +123,20 @@ endif
 
 if exists("*GetPhpIndent")
     call ResetPhpOptions()
-    finish
+    finish " XXX -- comment this line for easy dev
 endif
 
 let s:endline= '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$'
 let s:PHP_startindenttag = '\)\@!\|]*>\%(.*<\/script>\)\@!'
 
 
+function! DebugPrintReturn(scriptLine)
+
+    echo "debug:" . a:scriptLine
+    call getchar()
+
+endfunction
+
 function! GetLastRealCodeLNum(startline) " {{{
 
     let lnum = a:startline
@@ -189,8 +203,6 @@ function! GetLastRealCodeLNum(startline) " {{{
 	let b:InPHPcode_and_script = 0
     endif
 
-
-
     return lnum
 endfunction " }}}
 
@@ -198,11 +210,11 @@ function! Skippmatch2()
 
     let line = getline(".")
 
-   if line =~ '\%(".*\)\@<=/\*\%(.*"\)\@=' || line =~ '\%(\%(//\|#\).*\)\@<=/\*'
-       return 1
-   else
-       return 0
-   endif
+    if line =~ "\\([\"']\\).*/\\*.*\\1" || line =~ '\%(//\|#\).*/\*'
+        return 1
+    else
+        return 0
+    endif
 endfun
 
 function! Skippmatch()	" {{{
@@ -291,7 +303,7 @@ function! FindTheSwitchIndent (lnum) " {{{
 
 endfunction "}}}
 
-
+let s:SynPHPMatchGroups = {'phpParent':1, 'Delimiter':1, 'Define':1, 'Storageclass':1, 'StorageClass':1, 'Structure':1, 'Exception':1}
 function! IslinePHP (lnum, tofind) " {{{
     let cline = getline(a:lnum)
 
@@ -307,14 +319,14 @@ function! IslinePHP (lnum, tofind) " {{{
 
     let synname = synIDattr(synID(a:lnum, coltotest, 0), "name")
 
-    if synname =~ '^php' || synname=="Delimiter" || synname =~? '^javaScript'
+    if get(s:SynPHPMatchGroups, synname) || synname =~ '^php' ||  synname =~? '^javaScript'
 	return synname
     else
 	return ""
     endif
 endfunction " }}}
 
-let s:notPhpHereDoc = '\%(break\|return\|continue\|exit\|else\)'
+let s:notPhpHereDoc = '\%(break\|return\|continue\|exit\|die\|else\)'
 let s:blockstart = '\%(\%(\%(}\s*\)\=else\%(\s\+\)\=\)\=if\>\|else\>\|while\>\|switch\>\|case\>\|default\>\|for\%(each\)\=\>\|declare\>\|class\>\|interface\>\|abstract\>\|try\>\|catch\>\)'
 
 let s:autoresetoptions = 0
@@ -361,14 +373,12 @@ function! GetPhpIndent()
     if !b:PHP_indentinghuge && b:PHP_lastindented > b:PHP_indentbeforelast
 	if b:PHP_indentbeforelast
 	    let b:PHP_indentinghuge = 1
-	    echom 'Large indenting detected, speed optimizations engaged (v1.33)'
 	endif
 	let b:PHP_indentbeforelast = b:PHP_lastindented
     endif
 
     if b:InPHPcode_checked && prevnonblank(v:lnum - 1) != b:PHP_lastindented
 	if b:PHP_indentinghuge
-	    echom 'Large indenting deactivated'
 	    let b:PHP_indentinghuge = 0
 	    let b:PHP_CurrentIndentLevel = b:PHP_default_indenting
 	endif
@@ -425,7 +435,7 @@ function! GetPhpIndent()
 	else
 	    let b:InPHPcode = 0
 	    let b:UserIsTypingComment = 0
-	    let b:InPHPcode_tofind = '\)\@!\|'
+	    let b:InPHPcode_tofind = s:PHP_startindenttag
 	endif
     endif "!b:InPHPcode_checked }}}
 
@@ -493,7 +503,9 @@ function! GetPhpIndent()
     endif
 
     " Indent successive // or # comment the same way the first is {{{
+    let addSpecial = 0
     if cline =~ '^\s*\%(//\|#\|/\*.*\*/\s*$\)'
+	let addSpecial = b:PHP_outdentSLComments
 	if b:PHP_LastIndentedWasComment == 1
 	    return indent(real_PHP_lastindented)
 	endif
@@ -550,7 +562,7 @@ function! GetPhpIndent()
     endif
 
     if lnum == 0
-	return b:PHP_default_indenting
+	return b:PHP_default_indenting + addSpecial
     endif
 
 
@@ -577,17 +589,17 @@ function! GetPhpIndent()
     endif
 
 
-    if last_line =~ '[;}]'.endline && last_line !~ '^)' && last_line !~# s:defaultORcase
+    if last_line =~ '[;}]'.endline && last_line !~ '^[)\]]' && last_line !~# s:defaultORcase
 	if ind==b:PHP_default_indenting
-	    return b:PHP_default_indenting
+	    return b:PHP_default_indenting + addSpecial
 	elseif b:PHP_indentinghuge && ind==b:PHP_CurrentIndentLevel && cline !~# '^\s*\%(else\|\%(case\|default\).*:\|[})];\=\)' && last_line !~# '^\s*\%(\%(}\s*\)\=else\)' && getline(GetLastRealCodeLNum(lnum - 1))=~';'.endline
-	    return b:PHP_CurrentIndentLevel
+	    return b:PHP_CurrentIndentLevel + addSpecial
 	endif
     endif
 
     let LastLineClosed = 0
 
-    let terminated = '\%(;\%(\s*?>\)\=\|<<<''\=\a\w*''\=$\|^\s*}\)'.endline
+    let terminated = '\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\)'.endline
 
     let unstated   = '\%(^\s*'.s:blockstart.'.*)\|\%(//.*\)\@\)'.endline
 
@@ -618,19 +630,23 @@ function! GetPhpIndent()
 	endwhile
 
     elseif last_line =~# unstated && cline !~ '^\s*);\='.endline
-	let ind = ind + &sw
-	return ind
+	let ind = ind + &sw " we indent one level further when the preceding line is not stated
+	return ind + addSpecial
 
-    elseif (ind != b:PHP_default_indenting || last_line =~ '^)' ) && last_line =~ terminated
+    elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated " Added || last_line =~ '^)' on 2007-12-30 (array indenting problem broke other things)
 	let previous_line = last_line
 	let last_line_num = lnum
 	let LastLineClosed = 1
 
 	while 1
-	    if previous_line =~ '^\s*}'
-		let last_line_num = FindOpenBracket(last_line_num)
+	    if previous_line =~ '^\s*}\|;\s*}'.endline " XXX
+
+		call cursor(last_line_num, 1)
+		call search('}\|;\s*}'.endline, 'W')
+		let oldLastLine = last_line_num
+		let last_line_num = searchpair('{', '', '}', 'bW', 'Skippmatch()')
 
-		if getline(last_line_num) =~ '^\s*{'
+		if oldLastLine == last_line_num || getline(last_line_num) =~ '^\s*{'
 		    let last_line_num = GetLastRealCodeLNum(last_line_num - 1)
 		endif
 
@@ -674,7 +690,7 @@ function! GetPhpIndent()
 	    let ind = indent(last_match)
 	    let b:PHP_CurrentIndentLevel = b:PHP_default_indenting
 
-	    return ind
+	    return ind + addSpecial
 	endif
     endif
 
@@ -693,7 +709,7 @@ function! GetPhpIndent()
     if !LastLineClosed
 
 
-	if last_line =~# '[{(]'.endline || last_line =~? '\h\w*\s*(.*,$' && AntepenultimateLine !~ '[,(]'.endline
+	if last_line =~# '[{(\[]'.endline || last_line =~? '\h\w*\s*(.*,$' && AntepenultimateLine !~ '[,(]'.endline
 
 	    if !b:PHP_BracesAtCodeLevel || last_line !~# '^\s*{'
 		let ind = ind + &sw
@@ -702,7 +718,7 @@ function! GetPhpIndent()
 	    if b:PHP_BracesAtCodeLevel || b:PHP_vintage_case_default_indent == 1
 		let b:PHP_CurrentIndentLevel = ind
 
-		return ind
+		return ind + addSpecial
 	    endif
 
 	elseif last_line =~ '\S\+\s*),'.endline
@@ -712,22 +728,21 @@ function! GetPhpIndent()
 	    if openedparent != lnum
 		let ind = indent(openedparent)
 	    endif
-	
+
 	elseif last_line =~ '^\s*'.s:blockstart
 	    let ind = ind + &sw
 
 
-
-	elseif AntepenultimateLine =~ '\%(;\%(\s*?>\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|{\)'.endline . '\|' . s:defaultORcase
+	elseif AntepenultimateLine =~ '\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|{\)'.endline . '\|' . s:defaultORcase
 	    let ind = ind + &sw
 	endif
 
     endif
 
-    if cline =~  '^\s*);\='
+    if cline =~  '^\s*[)\]];\='
 	let ind = ind - &sw
     endif
 
     let b:PHP_CurrentIndentLevel = ind
-    return ind
+    return ind + addSpecial
 endfunction
diff --git a/runtime/indent/python.vim b/runtime/indent/python.vim
index 0c04e81..4ce3c23 100644
--- a/runtime/indent/python.vim
+++ b/runtime/indent/python.vim
@@ -2,7 +2,7 @@
 " Language:		Python
 " Maintainer:		Bram Moolenaar 
 " Original Author:	David Bustos 
-" Last Change:		2006 Jun 18
+" Last Change:		2013 Jul 9
 
 " Only load this indent file when no other was loaded.
 if exists("b:did_indent")
@@ -21,6 +21,8 @@ setlocal indentkeys+=<:>,=elif,=except
 if exists("*GetPythonIndent")
   finish
 endif
+let s:keepcpo= &cpo
+set cpo&vim
 
 " Come here when loading the script the first time.
 
@@ -34,7 +36,7 @@ function GetPythonIndent(lnum)
     if a:lnum > 1 && getline(a:lnum - 2) =~ '\\$'
       return indent(a:lnum - 1)
     endif
-    return indent(a:lnum - 1) + (exists("g:pyindent_continue") ? eval(g:pyindent_continue) : (&sw * 2))
+    return indent(a:lnum - 1) + (exists("g:pyindent_continue") ? eval(g:pyindent_continue) : (shiftwidth() * 2))
   endif
 
   " If the start of the line is in a string don't change the indent.
@@ -59,7 +61,7 @@ function GetPythonIndent(lnum)
   let parlnum = searchpair('(\|{\|\[', '', ')\|}\|\]', 'nbW',
 	  \ "line('.') < " . (plnum - s:maxoff) . " ? dummy :"
 	  \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
-	  \ . " =~ '\\(Comment\\|String\\)$'")
+	  \ . " =~ '\\(Comment\\|Todo\\|String\\)$'")
   if parlnum > 0
     let plindent = indent(parlnum)
     let plnumstart = parlnum
@@ -78,18 +80,18 @@ function GetPythonIndent(lnum)
   let p = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW',
 	  \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :"
 	  \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
-	  \ . " =~ '\\(Comment\\|String\\)$'")
+	  \ . " =~ '\\(Comment\\|Todo\\|String\\)$'")
   if p > 0
     if p == plnum
       " When the start is inside parenthesis, only indent one 'shiftwidth'.
       let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW',
 	  \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :"
 	  \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
-	  \ . " =~ '\\(Comment\\|String\\)$'")
+	  \ . " =~ '\\(Comment\\|Todo\\|String\\)$'")
       if pp > 0
-	return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : &sw)
+	return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth())
       endif
-      return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (&sw * 2))
+      return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (shiftwidth() * 2))
     endif
     if plnumstart == p
       return indent(plnum)
@@ -106,12 +108,12 @@ function GetPythonIndent(lnum)
     " If the last character in the line is a comment, do a binary search for
     " the start of the comment.  synID() is slow, a linear search would take
     " too long on a long line.
-    if synIDattr(synID(plnum, pline_len, 1), "name") =~ "Comment$"
+    if synIDattr(synID(plnum, pline_len, 1), "name") =~ "\\(Comment\\|Todo\\)$"
       let min = 1
       let max = pline_len
       while min < max
 	let col = (min + max) / 2
-	if synIDattr(synID(plnum, col, 1), "name") =~ "Comment$"
+	if synIDattr(synID(plnum, col, 1), "name") =~ "\\(Comment\\|Todo\\)$"
 	  let max = col
 	else
 	  let min = col + 1
@@ -132,15 +134,15 @@ function GetPythonIndent(lnum)
 
   " If the previous line ended with a colon, indent this line
   if pline =~ ':\s*$'
-    return plindent + &sw
+    return plindent + shiftwidth()
   endif
 
   " If the previous line was a stop-execution statement...
   if getline(plnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\)\>'
     " See if the user has already dedented
-    if indent(a:lnum) > indent(plnum) - &sw
+    if indent(a:lnum) > indent(plnum) - shiftwidth()
       " If not, recommend one dedent
-      return indent(plnum) - &sw
+      return indent(plnum) - shiftwidth()
     endif
     " Otherwise, trust the user
     return -1
@@ -171,11 +173,11 @@ function GetPythonIndent(lnum)
     endif
 
     " Or the user has already dedented
-    if indent(a:lnum) <= plindent - &sw
+    if indent(a:lnum) <= plindent - shiftwidth()
       return -1
     endif
 
-    return plindent - &sw
+    return plindent - shiftwidth()
   endif
 
   " When after a () construct we probably want to go back to the start line.
@@ -190,4 +192,7 @@ function GetPythonIndent(lnum)
 
 endfunction
 
+let &cpo = s:keepcpo
+unlet s:keepcpo
+
 " vim:sw=2
diff --git a/runtime/indent/r.vim b/runtime/indent/r.vim
new file mode 100644
index 0000000..82bdc8b
--- /dev/null
+++ b/runtime/indent/r.vim
@@ -0,0 +1,492 @@
+" Vim indent file
+" Language:	R
+" Author:	Jakson Alves de Aquino 
+" Last Change:	Fri Feb 15, 2013  08:11PM
+
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+    finish
+endif
+let b:did_indent = 1
+
+setlocal indentkeys=0{,0},:,!^F,o,O,e
+setlocal indentexpr=GetRIndent()
+
+" Only define the function once.
+if exists("*GetRIndent")
+    finish
+endif
+
+" Options to make the indentation more similar to Emacs/ESS:
+if !exists("g:r_indent_align_args")
+    let g:r_indent_align_args = 1
+endif
+if !exists("g:r_indent_ess_comments")
+    let g:r_indent_ess_comments = 0
+endif
+if !exists("g:r_indent_comment_column")
+    let g:r_indent_comment_column = 40
+endif
+if ! exists("g:r_indent_ess_compatible")
+    let g:r_indent_ess_compatible = 0
+endif
+
+function s:RDelete_quotes(line)
+    let i = 0
+    let j = 0
+    let line1 = ""
+    let llen = strlen(a:line)
+    while i < llen
+        if a:line[i] == '"'
+            let i += 1
+            let line1 = line1 . 's'
+            while !(a:line[i] == '"' && ((i > 1 && a:line[i-1] == '\' && a:line[i-2] == '\') || a:line[i-1] != '\')) && i < llen
+                let i += 1
+            endwhile
+            if a:line[i] == '"'
+                let i += 1
+            endif
+        else
+            if a:line[i] == "'"
+                let i += 1
+                let line1 = line1 . 's'
+                while !(a:line[i] == "'" && ((i > 1 && a:line[i-1] == '\' && a:line[i-2] == '\') || a:line[i-1] != '\')) && i < llen
+                    let i += 1
+                endwhile
+                if a:line[i] == "'"
+                    let i += 1
+                endif
+            else
+                if a:line[i] == "`"
+                    let i += 1
+                    let line1 = line1 . 's'
+                    while a:line[i] != "`" && i < llen
+                        let i += 1
+                    endwhile
+                    if a:line[i] == "`"
+                        let i += 1
+                    endif
+                endif
+            endif
+        endif
+        if i == llen
+            break
+        endif
+        let line1 = line1 . a:line[i]
+        let j += 1
+        let i += 1
+    endwhile
+    return line1
+endfunction
+
+" Convert foo(bar()) int foo()
+function s:RDelete_parens(line)
+    if s:Get_paren_balance(a:line, "(", ")") != 0
+        return a:line
+    endif
+    let i = 0
+    let j = 0
+    let line1 = ""
+    let llen = strlen(a:line)
+    while i < llen
+        let line1 = line1 . a:line[i]
+        if a:line[i] == '('
+            let nop = 1
+            while nop > 0 && i < llen
+                let i += 1
+                if a:line[i] == ')'
+                    let nop -= 1
+                else
+                    if a:line[i] == '('
+                        let nop += 1 
+                    endif
+                endif
+            endwhile
+            let line1 = line1 . a:line[i]
+        endif
+        let i += 1
+    endwhile
+    return line1
+endfunction
+
+function! s:Get_paren_balance(line, o, c)
+    let line2 = substitute(a:line, a:o, "", "g")
+    let openp = strlen(a:line) - strlen(line2)
+    let line3 = substitute(line2, a:c, "", "g")
+    let closep = strlen(line2) - strlen(line3)
+    return openp - closep
+endfunction
+
+function! s:Get_matching_brace(linenr, o, c, delbrace)
+    let line = SanitizeRLine(getline(a:linenr))
+    if a:delbrace == 1
+        let line = substitute(line, '{$', "", "")
+    endif
+    let pb = s:Get_paren_balance(line, a:o, a:c)
+    let i = a:linenr
+    while pb != 0 && i > 1
+        let i -= 1
+        let pb += s:Get_paren_balance(SanitizeRLine(getline(i)), a:o, a:c)
+    endwhile
+    return i
+endfunction
+
+" This function is buggy because there 'if's without 'else'
+" It must be rewritten relying more on indentation
+function! s:Get_matching_if(linenr, delif)
+"    let filenm = expand("%")
+"    call writefile([filenm], "/tmp/matching_if_" . a:linenr)
+    let line = SanitizeRLine(getline(a:linenr))
+    if a:delif
+        let line = substitute(line, "if", "", "g")
+    endif
+    let elsenr = 0
+    let i = a:linenr
+    let ifhere = 0
+    while i > 0
+        let line2 = substitute(line, '\', "xxx", "g")
+        let elsenr += strlen(line) - strlen(line2)
+        if line =~ '.*\s*if\s*()' || line =~ '.*\s*if\s*()'
+            let elsenr -= 1
+            if elsenr == 0
+                let ifhere = i
+                break
+            endif
+        endif
+        let i -= 1
+        let line = SanitizeRLine(getline(i))
+    endwhile
+    if ifhere
+        return ifhere
+    else
+        return a:linenr
+    endif
+endfunction
+
+function! s:Get_last_paren_idx(line, o, c, pb)
+    let blc = a:pb
+    let line = substitute(a:line, '\t', s:curtabstop, "g")
+    let theidx = -1
+    let llen = strlen(line)
+    let idx = 0
+    while idx < llen
+        if line[idx] == a:o
+            let blc -= 1
+            if blc == 0
+                let theidx = idx
+            endif
+        else
+            if line[idx] == a:c
+                let blc += 1
+            endif
+        endif
+        let idx += 1
+    endwhile
+    return theidx + 1
+endfunction
+
+" Get previous relevant line. Search back until getting a line that isn't
+" comment or blank
+function s:Get_prev_line(lineno)
+    let lnum = a:lineno - 1
+    let data = getline( lnum )
+    while lnum > 0 && (data =~ '^\s*#' || data =~ '^\s*$')
+        let lnum = lnum - 1
+        let data = getline( lnum )
+    endwhile
+    return lnum
+endfunction
+
+" This function is also used by r-plugin/common_global.vim
+" Delete from '#' to the end of the line, unless the '#' is inside a string.
+function SanitizeRLine(line)
+    let newline = s:RDelete_quotes(a:line)
+    let newline = s:RDelete_parens(newline)
+    let newline = substitute(newline, '#.*', "", "")
+    let newline = substitute(newline, '\s*$', "", "")
+    return newline
+endfunction
+
+function GetRIndent()
+
+    let clnum = line(".")    " current line
+
+    let cline = getline(clnum)
+    if cline =~ '^\s*#'
+        if g:r_indent_ess_comments == 1
+            if cline =~ '^\s*###'
+                return 0
+            endif
+            if cline !~ '^\s*##'
+                return g:r_indent_comment_column
+            endif
+        endif
+    endif
+
+    let cline = SanitizeRLine(cline)
+
+    if cline =~ '^\s*}' || cline =~ '^\s*}\s*)$'
+        let indline = s:Get_matching_brace(clnum, '{', '}', 1)
+        if indline > 0 && indline != clnum
+            let iline = SanitizeRLine(getline(indline))
+            if s:Get_paren_balance(iline, "(", ")") == 0 || iline =~ '(\s*{$'
+                return indent(indline)
+            else
+                let indline = s:Get_matching_brace(indline, '(', ')', 1)
+                return indent(indline)
+            endif
+        endif
+    endif
+
+    " Find the first non blank line above the current line
+    let lnum = s:Get_prev_line(clnum)
+    " Hit the start of the file, use zero indent.
+    if lnum == 0
+        return 0
+    endif
+
+    let line = SanitizeRLine(getline(lnum))
+
+    if &filetype == "rhelp"
+        if cline =~ '^\\dontshow{' || cline =~ '^\\dontrun{' || cline =~ '^\\donttest{' || cline =~ '^\\testonly{'
+            return 0
+        endif
+        if line =~ '^\\examples{' || line =~ '^\\usage{' || line =~ '^\\dontshow{' || line =~ '^\\dontrun{' || line =~ '^\\donttest{' || line =~ '^\\testonly{'
+            return 0
+        endif
+        if line =~ '^\\method{.*}{.*}(.*'
+            let line = substitute(line, '^\\method{\(.*\)}{.*}', '\1', "")
+        endif
+    endif
+
+    if cline =~ '^\s*{'
+        if g:r_indent_ess_compatible && line =~ ')$'
+            let nlnum = lnum
+            let nline = line
+            while s:Get_paren_balance(nline, '(', ')') < 0
+                let nlnum = s:Get_prev_line(nlnum)
+                let nline = SanitizeRLine(getline(nlnum)) . nline
+            endwhile
+            if nline =~ '^\s*function\s*(' && indent(nlnum) == &sw
+                return 0
+            endif
+        endif
+        if s:Get_paren_balance(line, "(", ")") == 0
+            return indent(lnum)
+        endif
+    endif
+
+    " line is an incomplete command:
+    if line =~ '\<\(if\|while\|for\|function\)\s*()$' || line =~ '\]$' || cline =~ '^\s*[,&|\-\*+<>]')
+            return indent(lnum)
+        endif
+
+        if pb > 0
+            if &filetype == "rhelp"
+                let ind = s:Get_last_paren_idx(line, '(', ')', pb)
+            else
+                let ind = s:Get_last_paren_idx(getline(lnum), '(', ')', pb)
+            endif
+            return ind
+        endif
+
+        if pb < 0 && line =~ '.*[,&|\-\*+<>]$'
+            let lnum = s:Get_prev_line(lnum)
+            while pb < 1 && lnum > 0
+                let line = SanitizeRLine(getline(lnum))
+                let line = substitute(line, '\t', s:curtabstop, "g")
+                let ind = strlen(line)
+                while ind > 0
+                    if line[ind] == ')'
+                        let pb -= 1
+                    else
+                        if line[ind] == '('
+                            let pb += 1
+                        endif
+                    endif
+                    if pb == 1
+                        return ind + 1
+                    endif
+                    let ind -= 1
+                endwhile
+                let lnum -= 1
+            endwhile
+            return 0
+        endif
+
+        if bb > 0
+            let ind = s:Get_last_paren_idx(getline(lnum), '[', ']', bb)
+            return ind
+        endif
+    endif
+
+    let post_block = 0
+    if line =~ '}$'
+        let lnum = s:Get_matching_brace(lnum, '{', '}', 0)
+        let line = SanitizeRLine(getline(lnum))
+        if lnum > 0 && line =~ '^\s*{'
+            let lnum = s:Get_prev_line(lnum)
+            let line = SanitizeRLine(getline(lnum))
+        endif
+        let pb = s:Get_paren_balance(line, '(', ')')
+        let post_block = 1
+    endif
+
+    let post_fun = 0
+    if pb < 0 && line !~ ')\s*[,&|\-\*+<>]$'
+        let post_fun = 1
+        while pb < 0 && lnum > 0
+            let lnum -= 1
+            let linepiece = SanitizeRLine(getline(lnum))
+            let pb += s:Get_paren_balance(linepiece, "(", ")")
+            let line = linepiece . line
+        endwhile
+        if line =~ '{$' && post_block == 0
+            return indent(lnum) + &sw
+        endif
+
+        " Now we can do some tests again
+        if cline =~ '^\s*{'
+            return indent(lnum)
+        endif
+        if post_block == 0
+            let newl = SanitizeRLine(line)
+            if newl =~ '\<\(if\|while\|for\|function\)\s*()$' || newl =~ '\ 0
+            let lnum -= 1
+            let linepiece = SanitizeRLine(getline(lnum))
+            let bb += s:Get_paren_balance(linepiece, "[", "]")
+            let line = linepiece . line
+        endwhile
+        let line = s:RDelete_parens(line)
+    endif
+
+    let plnum = s:Get_prev_line(lnum)
+    let ppost_else = 0
+    if plnum > 0
+        let pline = SanitizeRLine(getline(plnum))
+        let ppost_block = 0
+        if pline =~ '}$'
+            let ppost_block = 1
+            let plnum = s:Get_matching_brace(plnum, '{', '}', 0)
+            let pline = SanitizeRLine(getline(plnum))
+            if pline =~ '^\s*{$' && plnum > 0
+                let plnum = s:Get_prev_line(plnum)
+                let pline = SanitizeRLine(getline(plnum))
+            endif
+        endif
+
+        if pline =~ 'else$'
+            let ppost_else = 1
+            let plnum = s:Get_matching_if(plnum, 0)
+            let pline = SanitizeRLine(getline(plnum))
+        endif
+
+        if pline =~ '^\s*else\s*if\s*('
+            let pplnum = s:Get_prev_line(plnum)
+            let ppline = SanitizeRLine(getline(pplnum))
+            while ppline =~ '^\s*else\s*if\s*(' || ppline =~ '^\s*if\s*()\s*\S$'
+                let plnum = pplnum
+                let pline = ppline
+                let pplnum = s:Get_prev_line(plnum)
+                let ppline = SanitizeRLine(getline(pplnum))
+            endwhile
+            while ppline =~ '\<\(if\|while\|for\|function\)\s*()$' || ppline =~ '\ 0
+                let plnum -= 1
+                let linepiece = SanitizeRLine(getline(plnum))
+                let ppb += s:Get_paren_balance(linepiece, "(", ")")
+                let pline = linepiece . pline
+            endwhile
+            let pline = s:RDelete_parens(pline)
+        endif
+    endif
+
+    let ind = indent(lnum)
+    let pind = indent(plnum)
+
+    if g:r_indent_align_args == 0 && pb != 0
+        let ind += pb * &sw
+        return ind
+    endif
+
+    if g:r_indent_align_args == 0 && bb != 0
+        let ind += bb * &sw
+        return ind
+    endif
+
+    if ind == pind || (ind == (pind  + &sw) && pline =~ '{$' && ppost_else == 0)
+        return ind
+    endif
+
+    let pline = getline(plnum)
+    let pbb = s:Get_paren_balance(pline, '[', ']')
+
+    while pind < ind && plnum > 0 && ppb == 0 && pbb == 0
+        let ind = pind
+        let plnum = s:Get_prev_line(plnum)
+        let pline = getline(plnum)
+        let ppb = s:Get_paren_balance(pline, '(', ')')
+        let pbb = s:Get_paren_balance(pline, '[', ']')
+        while pline =~ '^\s*else'
+            let plnum = s:Get_matching_if(plnum, 1)
+            let pline = getline(plnum)
+            let ppb = s:Get_paren_balance(pline, '(', ')')
+            let pbb = s:Get_paren_balance(pline, '[', ']')
+        endwhile
+        let pind = indent(plnum)
+        if ind == (pind  + &sw) && pline =~ '{$'
+            return ind
+        endif
+    endwhile
+
+    return ind
+
+endfunction
+
+" vim: sw=4
diff --git a/runtime/indent/rst.vim b/runtime/indent/rst.vim
index f936c9b..80d3308 100644
--- a/runtime/indent/rst.vim
+++ b/runtime/indent/rst.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:         reStructuredText Documentation Format
 " Maintainer:       Nikolai Weibull 
-" Latest Revision:  2006-12-20
+" Latest Revision:  2011-08-03
 
 if exists("b:did_indent")
   finish
@@ -16,6 +16,9 @@ if exists("*GetRSTIndent")
   finish
 endif
 
+let s:itemization_pattern = '^\s*[-*+]\s'
+let s:enumeration_pattern = '^\s*\%(\d\+\|#\)\.\s\+'
+
 function GetRSTIndent()
   let lnum = prevnonblank(v:lnum - 1)
   if lnum == 0
@@ -25,27 +28,30 @@ function GetRSTIndent()
   let ind = indent(lnum)
   let line = getline(lnum)
 
-  if line =~ '^\s*[-*+]\s'
-    let ind = ind + 2
-  elseif line =~ '^\s*\d\+.\s'
-    let ind = ind + matchend(substitute(line, '^\s*', '', ''), '\d\+.\s\+')
+  if line =~ s:itemization_pattern
+    let ind += 2
+  elseif line =~ s:enumeration_pattern
+    let ind += matchend(line, s:enumeration_pattern)
   endif
 
   let line = getline(v:lnum - 1)
 
+  " Indent :FIELD: lines.  Don’t match if there is no text after the field or
+  " if the text ends with a sent-ender.
+   if line =~ '^:.\+:\s\{-1,\}\S.\+[^.!?:]$'
+     return matchend(line, '^:.\{-1,}:\s\+')
+   endif
+
   if line =~ '^\s*$'
     execute lnum
-    call search('^\s*\%([-*+]\s\|\d\+.\s\|\.\.\|$\)', 'bW')
+    call search('^\s*\%([-*+]\s\|\%(\d\+\|#\)\.\s\|\.\.\|$\)', 'bW')
     let line = getline('.')
-    if line =~ '^\s*[-*+]'
-      let ind = ind - 2
-    elseif line =~ '^\s*\d\+\.\s'
-      let ind = ind - matchend(substitute(line, '^\s*', '', ''),
-            \ '\d\+\.\s\+')
+    if line =~ s:itemization_pattern
+      let ind -= 2
+    elseif line =~ s:enumeration_pattern
+      let ind -= matchend(line, s:enumeration_pattern)
     elseif line =~ '^\s*\.\.'
-      let ind = ind - 3
-    else
-      let ind = ind
+      let ind -= 3
     endif
   endif
 
diff --git a/runtime/indent/ruby.vim b/runtime/indent/ruby.vim
index 04d1301..095b3a4 100644
--- a/runtime/indent/ruby.vim
+++ b/runtime/indent/ruby.vim
@@ -1,9 +1,7 @@
 " Vim indent file
 " Language:		Ruby
 " Maintainer:		Nikolai Weibull 
-" Last Change:		2009 Dec 17
-" URL:			http://vim-ruby.rubyforge.org
-" Anon CVS:		See above site
+" URL:			https://github.com/vim-ruby/vim-ruby
 " Release Coordinator:	Doug Kearns 
 
 " 0. Initialization {{{1
@@ -18,9 +16,9 @@ let b:did_indent = 1
 setlocal nosmartindent
 
 " Now, set up our indentation expression and keys that trigger it.
-setlocal indentexpr=GetRubyIndent()
+setlocal indentexpr=GetRubyIndent(v:lnum)
 setlocal indentkeys=0{,0},0),0],!^F,o,O,e
-setlocal indentkeys+==end,=elsif,=when,=ensure,=rescue,==begin,==end
+setlocal indentkeys+==end,=else,=elsif,=when,=ensure,=rescue,==begin,==end
 
 " Only define the function once.
 if exists("*GetRubyIndent")
@@ -33,8 +31,9 @@ set cpo&vim
 " 1. Variables {{{1
 " ============
 
-" Regex of syntax group names that are or delimit string or are comments.
-let s:syng_strcom = '\'
 
 " Regex of syntax group names that are strings.
@@ -43,7 +42,7 @@ let s:syng_string =
 
 " Regex of syntax group names that are strings or documentation.
 let s:syng_stringdoc =
-  \'\'
+      \'\'
 
 " Expression used to check whether we should skip a match with searchpair().
 let s:skip_expr =
@@ -52,45 +51,60 @@ let s:skip_expr =
 " Regex used for words that, at the start of a line, add a level of indent.
 let s:ruby_indent_keywords = '^\s*\zs\<\%(module\|class\|def\|if\|for' .
       \ '\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure' .
-      \ '\|rescue\)\>' .
-      \ '\|\%([*+/,=-]\|<<\|>>\|:\s\)\s*\zs' .
-      \    '\<\%(if\|for\|while\|until\|case\|unless\|begin\)\>'
+      \ '\|rescue\):\@!\>' .
+      \ '\|\%([=,*/%+-]\|<<\|>>\|:\s\)\s*\zs' .
+      \    '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>'
 
 " Regex used for words that, at the start of a line, remove a level of indent.
 let s:ruby_deindent_keywords =
-      \ '^\s*\zs\<\%(ensure\|else\|rescue\|elsif\|when\|end\)\>'
+      \ '^\s*\zs\<\%(ensure\|else\|rescue\|elsif\|when\|end\):\@!\>'
 
 " Regex that defines the start-match for the 'end' keyword.
 "let s:end_start_regex = '\%(^\|[^.]\)\<\%(module\|class\|def\|if\|for\|while\|until\|case\|unless\|begin\|do\)\>'
 " TODO: the do here should be restricted somewhat (only at end of line)?
-let s:end_start_regex = '^\s*\zs\<\%(module\|class\|def\|if\|for' .
-      \ '\|while\|until\|case\|unless\|begin\)\>' .
-      \ '\|\%([*+/,=-]\|<<\|>>\|:\s\)\s*\zs' .
-      \    '\<\%(if\|for\|while\|until\|case\|unless\|begin\)\>' .
-      \ '\|\'
+let s:end_start_regex =
+      \ '\C\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' .
+      \ '\<\%(module\|class\|def\|if\|for\|while\|until\|case\|unless\|begin\):\@!\>' .
+      \ '\|\%(^\|[^.:@$]\)\@<=\'
 
 " Regex that defines the middle-match for the 'end' keyword.
-let s:end_middle_regex = '\<\%(ensure\|else\|\%(\%(^\|;\)\s*\)\@<=\\|when\|elsif\)\>'
+let s:end_middle_regex = '\<\%(ensure\|else\|\%(\%(^\|;\)\s*\)\@<=\\|when\|elsif\):\@!\>'
 
 " Regex that defines the end-match for the 'end' keyword.
-let s:end_end_regex = '\%(^\|[^.:@$]\)\@<=\'
+let s:end_end_regex = '\%(^\|[^.:@$]\)\@<=\'
 
 " Expression used for searchpair() call for finding match for 'end' keyword.
 let s:end_skip_expr = s:skip_expr .
       \ ' || (expand("") == "do"' .
-      \ ' && getline(".") =~ "^\\s*\\<\\(while\\|until\\|for\\)\\>")'
+      \ ' && getline(".") =~ "^\\s*\\<\\(while\\|until\\|for\\):\\@!\\>")'
 
 " Regex that defines continuation lines, not including (, {, or [.
-let s:continuation_regex = '\%([\\*+/.,:]\|\%(<%\)\@\|{\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=\s*\%(#.*\)\=$'
+      \ '\%(\\|%\@ 0
     " If we have a continuation line, or we're in a string, use line as MSL.
     " Otherwise, terminate search as we have found our MSL already.
     let line = getline(lnum)
-    let col = match(line, s:continuation_regex2) + 1
-    if (col > 0 && !s:IsInStringOrComment(lnum, col))
-	  \ || s:IsInString(lnum, strlen(line))
+
+    if s:Match(lnum, s:splat_regex)
+      " If the above line looks like the "*" of a splat, use the current one's
+      " indentation.
+      "
+      " Example:
+      "   Hash[*
+      "     method_call do
+      "       something
+      "
+      return msl
+    elseif s:Match(line, s:non_bracket_continuation_regex) &&
+          \ s:Match(msl, s:non_bracket_continuation_regex)
+      " If the current line is a non-bracket continuation and so is the
+      " previous one, keep its indent and continue looking for an MSL.
+      "
+      " Example:
+      "   method_call one,
+      "     two,
+      "     three
+      "
       let msl = lnum
+    elseif s:Match(lnum, s:non_bracket_continuation_regex) &&
+          \ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
+      " If the current line is a bracket continuation or a block-starter, but
+      " the previous is a non-bracket one, respect the previous' indentation,
+      " and stop here.
+      "
+      " Example:
+      "   method_call one,
+      "     two {
+      "     three
+      "
+      return lnum
+    elseif s:Match(lnum, s:bracket_continuation_regex) &&
+          \ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
+      " If both lines are bracket continuations (the current may also be a
+      " block-starter), use the current one's and stop here
+      "
+      " Example:
+      "   method_call(
+      "     other_method_call(
+      "       foo
+      return msl
+    elseif s:Match(lnum, s:block_regex) &&
+          \ !s:Match(msl, s:continuation_regex) &&
+          \ !s:Match(msl, s:block_continuation_regex)
+      " If the previous line is a block-starter and the current one is
+      " mostly ordinary, use the current one as the MSL.
+      "
+      " Example:
+      "   method_call do
+      "     something
+      "     something_else
+      return msl
     else
-      break
+      let col = match(line, s:continuation_regex) + 1
+      if (col > 0 && !s:IsInStringOrComment(lnum, col))
+            \ || s:IsInString(lnum, strlen(line))
+        let msl = lnum
+      else
+        break
+      endif
     endif
+
+    let msl_body = getline(msl)
     let lnum = s:PrevNonBlankNonString(lnum - 1)
   endwhile
   return msl
 endfunction
 
 " Check if line 'lnum' has more opening brackets than closing ones.
-function s:LineHasOpeningBrackets(lnum)
-  let open_0 = 0
-  let open_2 = 0
-  let open_4 = 0
+function s:ExtraBrackets(lnum)
+  let opening = {'parentheses': [], 'braces': [], 'brackets': []}
+  let closing = {'parentheses': [], 'braces': [], 'brackets': []}
+
   let line = getline(a:lnum)
-  let pos = match(line, '[][(){}]', 0)
+  let pos  = match(line, '[][(){}]', 0)
+
+  " Save any encountered opening brackets, and remove them once a matching
+  " closing one has been found. If a closing bracket shows up that doesn't
+  " close anything, save it for later.
   while pos != -1
     if !s:IsInStringOrComment(a:lnum, pos + 1)
-      let idx = stridx('(){}[]', line[pos])
-      if idx % 2 == 0
-	let open_{idx} = open_{idx} + 1
-      else
-	let open_{idx - 1} = open_{idx - 1} - 1
+      if line[pos] == '('
+        call add(opening.parentheses, {'type': '(', 'pos': pos})
+      elseif line[pos] == ')'
+        if empty(opening.parentheses)
+          call add(closing.parentheses, {'type': ')', 'pos': pos})
+        else
+          let opening.parentheses = opening.parentheses[0:-2]
+        endif
+      elseif line[pos] == '{'
+        call add(opening.braces, {'type': '{', 'pos': pos})
+      elseif line[pos] == '}'
+        if empty(opening.braces)
+          call add(closing.braces, {'type': '}', 'pos': pos})
+        else
+          let opening.braces = opening.braces[0:-2]
+        endif
+      elseif line[pos] == '['
+        call add(opening.brackets, {'type': '[', 'pos': pos})
+      elseif line[pos] == ']'
+        if empty(opening.brackets)
+          call add(closing.brackets, {'type': ']', 'pos': pos})
+        else
+          let opening.brackets = opening.brackets[0:-2]
+        endif
       endif
     endif
+
     let pos = match(line, '[][(){}]', pos + 1)
   endwhile
-  return (open_0 > 0) . (open_2 > 0) . (open_4 > 0)
+
+  " Find the rightmost brackets, since they're the ones that are important in
+  " both opening and closing cases
+  let rightmost_opening = {'type': '(', 'pos': -1}
+  let rightmost_closing = {'type': ')', 'pos': -1}
+
+  for opening in opening.parentheses + opening.braces + opening.brackets
+    if opening.pos > rightmost_opening.pos
+      let rightmost_opening = opening
+    endif
+  endfor
+
+  for closing in closing.parentheses + closing.braces + closing.brackets
+    if closing.pos > rightmost_closing.pos
+      let rightmost_closing = closing
+    endif
+  endfor
+
+  return [rightmost_opening, rightmost_closing]
 endfunction
 
 function s:Match(lnum, regex)
@@ -195,32 +316,35 @@ endfunction
 " 3. GetRubyIndent Function {{{1
 " =========================
 
-function GetRubyIndent()
+function GetRubyIndent(...)
   " 3.1. Setup {{{2
   " ----------
 
-  " Set up variables for restoring position in file.  Could use v:lnum here.
+  " For the current line, use the first argument if given, else v:lnum
+  let clnum = a:0 ? a:1 : v:lnum
+
+  " Set up variables for restoring position in file.  Could use clnum here.
   let vcol = col('.')
 
   " 3.2. Work on the current line {{{2
   " -----------------------------
 
   " Get the current line.
-  let line = getline(v:lnum)
+  let line = getline(clnum)
   let ind = -1
 
   " If we got a closing bracket on an empty line, find its match and indent
   " according to it.  For parentheses we indent to its column - 1, for the
   " others we indent to the containing line's MSL's level.  Return -1 if fail.
   let col = matchend(line, '^\s*[]})]')
-  if col > 0 && !s:IsInStringOrComment(v:lnum, col)
-    call cursor(v:lnum, col)
+  if col > 0 && !s:IsInStringOrComment(clnum, col)
+    call cursor(clnum, col)
     let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2)
     if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0
       if line[col-1]==')' && col('.') != col('$') - 1
-	let ind = virtcol('.')-1
+        let ind = virtcol('.') - 1
       else
-	let ind = indent(s:GetMSL(line('.')))
+        let ind = indent(s:GetMSL(line('.')))
       endif
     endif
     return ind
@@ -233,35 +357,47 @@ function GetRubyIndent()
 
   " If we have a deindenting keyword, find its match and indent to its level.
   " TODO: this is messy
-  if s:Match(v:lnum, s:ruby_deindent_keywords)
-    call cursor(v:lnum, 1)
+  if s:Match(clnum, s:ruby_deindent_keywords)
+    call cursor(clnum, 1)
     if searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW',
-	    \ s:end_skip_expr) > 0
-      let line = getline('.')
+          \ s:end_skip_expr) > 0
+      let msl  = s:GetMSL(line('.'))
+      let line = getline(line('.'))
+
       if strpart(line, 0, col('.') - 1) =~ '=\s*$' &&
-       \ strpart(line, col('.') - 1, 2) !~ 'do'
-	let ind = virtcol('.') - 1
+            \ strpart(line, col('.') - 1, 2) !~ 'do'
+        let ind = virtcol('.') - 1
+      elseif getline(msl) =~ '=\s*\(#.*\)\=$'
+        let ind = indent(line('.'))
       else
-	let ind = indent('.')
+        let ind = indent(msl)
       endif
     endif
     return ind
   endif
 
   " If we are in a multi-line string or line-comment, don't do anything to it.
-  if s:IsInStringOrDocumentation(v:lnum, matchend(line, '^\s*') + 1)
+  if s:IsInStringOrDocumentation(clnum, matchend(line, '^\s*') + 1)
     return indent('.')
   endif
 
+  " If we are at the closing delimiter of a "<<" heredoc-style string, set the
+  " indent to 0.
+  if line =~ '^\k\+\s*$'
+        \ && s:IsInStringDelimiter(clnum, 1)
+        \ && search('\V<<'.line, 'nbW') > 0
+    return 0
+  endif
+
   " 3.3. Work on the previous line. {{{2
   " -------------------------------
 
   " Find a non-blank, non-multi-line string line above the current line.
-  let lnum = s:PrevNonBlankNonString(v:lnum - 1)
+  let lnum = s:PrevNonBlankNonString(clnum - 1)
 
   " If the line is empty and inside a string, use the previous line.
-  if line =~ '^\s*$' && lnum != prevnonblank(v:lnum - 1)
-    return indent(prevnonblank(v:lnum))
+  if line =~ '^\s*$' && lnum != prevnonblank(clnum - 1)
+    return indent(prevnonblank(clnum))
   endif
 
   " At the start of the file use zero indent.
@@ -269,7 +405,7 @@ function GetRubyIndent()
     return 0
   endif
 
-  " Set up variables for current line.
+  " Set up variables for the previous line.
   let line = getline(lnum)
   let ind = indent(lnum)
 
@@ -278,20 +414,42 @@ function GetRubyIndent()
     return indent(s:GetMSL(lnum)) + &sw
   endif
 
-  " If the previous line contained an opening bracket, and we are still in it,
-  " add indent depending on the bracket type.
-  if line =~ '[[({]'
-    let counts = s:LineHasOpeningBrackets(lnum)
-    if counts[0] == '1' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
-      if col('.') + 1 == col('$')
-	return ind + &sw
+  " If the previous line ended with the "*" of a splat, add a level of indent
+  if line =~ s:splat_regex
+    return indent(lnum) + &sw
+  endif
+
+  " If the previous line contained unclosed opening brackets and we are still
+  " in them, find the rightmost one and add indent depending on the bracket
+  " type.
+  "
+  " If it contained hanging closing brackets, find the rightmost one, find its
+  " match and indent according to that.
+  if line =~ '[[({]' || line =~ '[])}]\s*\%(#.*\)\=$'
+    let [opening, closing] = s:ExtraBrackets(lnum)
+
+    if opening.pos != -1
+      if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
+        if col('.') + 1 == col('$')
+          return ind + &sw
+        else
+          return virtcol('.')
+        endif
       else
-	return virtcol('.')
+        let nonspace = matchend(line, '\S', opening.pos + 1) - 1
+        return nonspace > 0 ? nonspace : ind + &sw
+      endif
+    elseif closing.pos != -1
+      call cursor(lnum, closing.pos + 1)
+      normal! %
+
+      if s:Match(line('.'), s:ruby_indent_keywords)
+        return indent('.') + &sw
+      else
+        return indent('.')
       endif
-    elseif counts[1] == '1' || counts[2] == '1'
-      return ind + &sw
     else
-      call cursor(v:lnum, vcol)
+      call cursor(clnum, vcol)
     end
   endif
 
@@ -301,12 +459,12 @@ function GetRubyIndent()
   if col > 0
     call cursor(lnum, col)
     if searchpair(s:end_start_regex, '', s:end_end_regex, 'bW',
-		\ s:end_skip_expr) > 0
+          \ s:end_skip_expr) > 0
       let n = line('.')
       let ind = indent('.')
       let msl = s:GetMSL(n)
       if msl != n
-	let ind = indent(msl)
+        let ind = indent(msl)
       end
       return ind
     endif
@@ -316,7 +474,6 @@ function GetRubyIndent()
   if col > 0
     call cursor(lnum, col)
     let ind = virtcol('.') - 1 + &sw
-"    let ind = indent(lnum) + &sw
     " TODO: make this better (we need to count them) (or, if a searchpair
     " fails, we know that something is lacking an end and thus we indent a
     " level
@@ -336,7 +493,7 @@ function GetRubyIndent()
   " If the previous line wasn't a MSL and is continuation return its indent.
   " TODO: the || s:IsInString() thing worries me a bit.
   if p_lnum != lnum
-    if s:Match(p_lnum,s:continuation_regex)||s:IsInString(p_lnum,strlen(line))
+    if s:Match(p_lnum, s:non_bracket_continuation_regex) || s:IsInString(p_lnum,strlen(line))
       return ind
     endif
   endif
@@ -356,13 +513,15 @@ function GetRubyIndent()
     return ind
   endif
 
-  " If the previous line ended with [*+/.-=], indent one extra level.
-  if s:Match(lnum, s:continuation_regex)
+  " If the previous line ended with [*+/.,-=], but wasn't a block ending or a
+  " closing bracket, indent one extra level.
+  if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\([\])}]\|end\)')
     if lnum == p_lnum
       let ind = msl_ind + &sw
     else
       let ind = msl_ind
     endif
+    return ind
   endif
 
   " }}}2
@@ -375,4 +534,4 @@ endfunction
 let &cpo = s:cpo_save
 unlet s:cpo_save
 
-" vim:set sw=2 sts=2 ts=8 noet:
+" vim:set sw=2 sts=2 ts=8 et:
diff --git a/runtime/indent/sass.vim b/runtime/indent/sass.vim
index 4622f00..b6e2e66 100644
--- a/runtime/indent/sass.vim
+++ b/runtime/indent/sass.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	Sass
 " Maintainer:	Tim Pope 
-" Last Change:	2010 May 21
+" Last Change:	2013 May 30
 
 if exists("b:did_indent")
   finish
@@ -17,7 +17,8 @@ if exists("*GetSassIndent")
   finish
 endif
 
-let s:property = '^\s*:\|^\s*[[:alnum:]-]\+\%(:\|\s*=\)'
+let s:property = '^\s*:\|^\s*[[:alnum:]#{}-]\+\%(:\|\s*=\)'
+let s:extend = '^\s*\%(@extend\|@include\|+\)'
 
 function! GetSassIndent()
   let lnum = prevnonblank(v:lnum-1)
@@ -27,7 +28,7 @@ function! GetSassIndent()
   let line = substitute(line,'^\s\+','','')
   let indent = indent(lnum)
   let cindent = indent(v:lnum)
-  if line !~ s:property && cline =~ s:property
+  if line !~ s:property && line !~ s:extend && cline =~ s:property
     return indent + &sw
   "elseif line =~ s:property && cline !~ s:property
     "return indent - &sw
diff --git a/runtime/indent/sdl.vim b/runtime/indent/sdl.vim
index 9dde2c3..ba03f2d 100644
--- a/runtime/indent/sdl.vim
+++ b/runtime/indent/sdl.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	SDL
-" Maintainer:	Michael Piefel 
-" Last Change:	2001 Sep 17
+" Maintainer:	Michael Piefel 
+" Last Change:	10 December 2011
 
 " Shamelessly stolen from the Vim-Script indent file
 
@@ -19,7 +19,8 @@ if exists("*GetSDLIndent")
 "  finish
 endif
 
-set cpo-=C
+let s:cpo_save = &cpo
+set cpo&vim
 
 function! GetSDLIndent()
   " Find a non-blank line above the current line.
@@ -72,7 +73,7 @@ function! GetSDLIndent()
 
   " Systems and packages are always in column 0
   if getline(v:lnum) =~? '^\s*\(\(end\)\=system\|\(end\)\=package\)'
-    return 0;
+    return 0
   endif
 
   " Put each end* where the corresponding begin was
@@ -86,4 +87,7 @@ function! GetSDLIndent()
   return ind
 endfunction
 
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
 " vim:sw=2
diff --git a/runtime/indent/sqlanywhere.vim b/runtime/indent/sqlanywhere.vim
index fdafb62..d11c54b 100644
--- a/runtime/indent/sqlanywhere.vim
+++ b/runtime/indent/sqlanywhere.vim
@@ -1,8 +1,8 @@
 " Vim indent file
 " Language:    SQL
-" Maintainer:  David Fishburn 
-" Last Change: Mon Apr 02 2007 9:13:47 AM
-" Version:     1.5
+" Maintainer:  David Fishburn 
+" Last Change: 2012 Dec 06
+" Version:     3.0
 " Download:    http://vim.sourceforge.net/script.php?script_id=495
 
 " Notes:
@@ -18,6 +18,17 @@
 " Known Issues:
 "    The Oracle MERGE statement does not have an end tag associated with
 "    it, this can leave the indent hanging to the right one too many.
+"
+" History:
+"    3.0 (Dec 2012)
+"        Added cpo check
+"
+"    2.0
+"        Added the FOR keyword to SQLBlockStart to handle (Alec Tica):
+"            for i in 1..100 loop
+"              |<-- I expect to have indentation here
+"            end loop;
+"
 
 " Only load this indent file when no other was loaded.
 if exists("b:did_indent")
@@ -48,14 +59,16 @@ setlocal indentexpr=GetSQLIndent()
 if exists("*GetSQLIndent")
     finish
 endif
+let s:keepcpo= &cpo
+set cpo&vim
 
 " List of all the statements that start a new block.
 " These are typically words that start a line.
 " IS is excluded, since it is difficult to determine when the
 " ending block is (especially for procedures/functions).
 let s:SQLBlockStart = '^\s*\%('.
-            \ 'if\|else\|elseif\|elsif\|'.
-                \ 'while\|loop\|do\|'.
+                \ 'if\|else\|elseif\|elsif\|'.
+                \ 'while\|loop\|do\|for\|'.
                 \ 'begin\|'.
                 \ 'case\|when\|merge\|exception'.
                 \ '\)\>'
@@ -64,7 +77,7 @@ let s:SQLBlockEnd = '^\s*\(end\)\>'
 " The indent level is also based on unmatched paranethesis
 " If a line has an extra "(" increase the indent
 " If a line has an extra ")" decrease the indent
-function s:CountUnbalancedParan( line, paran_to_check )
+function! s:CountUnbalancedParan( line, paran_to_check )
     let l = a:line
     let lp = substitute(l, '[^(]', '', 'g')
     let l = a:line
@@ -86,7 +99,7 @@ function s:CountUnbalancedParan( line, paran_to_check )
 endfunction
 
 " Unindent commands based on previous indent level
-function s:CheckToIgnoreRightParan( prev_lnum, num_levels )
+function! s:CheckToIgnoreRightParan( prev_lnum, num_levels )
     let lnum = a:prev_lnum
     let line = getline(lnum)
     let ends = 0
@@ -149,7 +162,7 @@ endfunction
 "         something;
 "    WHEN ...
 " Should return indent level of exception.
-function s:GetStmtStarterIndent( keyword, curr_lnum )
+function! s:GetStmtStarterIndent( keyword, curr_lnum )
     let lnum  = a:curr_lnum
 
     " Default - reduce indent by 1
@@ -191,7 +204,7 @@ endfunction
 
 
 " Check if the line is a comment
-function s:IsLineComment(lnum)
+function! s:IsLineComment(lnum)
     let rc = synIDattr(
                 \ synID(a:lnum,
                 \     match(getline(a:lnum), '\S')+1, 0)
@@ -203,7 +216,7 @@ endfunction
 
 
 " Check if the column is a comment
-function s:IsColComment(lnum, cnum)
+function! s:IsColComment(lnum, cnum)
     let rc = synIDattr(synID(a:lnum, a:cnum, 0), "name")
                 \           =~? "comment"
 
@@ -213,7 +226,7 @@ endfunction
 
 " Instead of returning a column position, return
 " an appropriate value as a factor of shiftwidth.
-function s:ModuloIndent(ind)
+function! s:ModuloIndent(ind)
     let ind = a:ind
 
     if ind > 0
@@ -229,7 +242,7 @@ endfunction
 
 
 " Find correct indent of a new line based upon the previous line
-function GetSQLIndent()
+function! GetSQLIndent()
     let lnum = v:lnum
     let ind = indent(lnum)
 
@@ -240,35 +253,27 @@ function GetSQLIndent()
     "     return ind
     " endif
 
-    " while 1
-        " Get previous non-blank line
-        let prevlnum = prevnonblank(lnum - 1)
-        if prevlnum <= 0
-            return ind
-        endif
+    " Get previous non-blank line
+    let prevlnum = prevnonblank(lnum - 1)
+    if prevlnum <= 0
+        return ind
+    endif
 
-        if s:IsLineComment(prevlnum) == 1
-            if getline(v:lnum) =~ '^\s*\*'
-                let ind = s:ModuloIndent(indent(prevlnum))
-                return ind + 1
-            endif
-            " If the previous line is a comment, then return -1
-            " to tell Vim to use the formatoptions setting to determine
-            " the indent to use
-            " But only if the next line is blank.  This would be true if
-            " the user is typing, but it would not be true if the user
-            " is reindenting the file
-            if getline(v:lnum) =~ '^\s*$'
-                return -1
-            endif
+    if s:IsLineComment(prevlnum) == 1
+        if getline(v:lnum) =~ '^\s*\*'
+            let ind = s:ModuloIndent(indent(prevlnum))
+            return ind + 1
         endif
-
-    "     let prevline = getline(prevlnum)
-    "     if prevline !~ '^\s*$'
-    "         " echom 'previous non blank - break: ' . prevline
-    "         break
-    "     endif
-    " endwhile
+        " If the previous line is a comment, then return -1
+        " to tell Vim to use the formatoptions setting to determine
+        " the indent to use
+        " But only if the next line is blank.  This would be true if
+        " the user is typing, but it would not be true if the user
+        " is reindenting the file
+        if getline(v:lnum) =~ '^\s*$'
+            return -1
+        endif
+    endif
 
     " echom 'PREVIOUS INDENT: ' . indent(prevlnum) . '  LINE: ' . getline(prevlnum)
 
@@ -382,4 +387,7 @@ function GetSQLIndent()
     return s:ModuloIndent(ind)
 endfunction
 
-" vim:sw=4:
+"  Restore:
+let &cpo= s:keepcpo
+unlet s:keepcpo
+" vim: ts=4 fdm=marker sw=4
diff --git a/runtime/indent/tcsh.vim b/runtime/indent/tcsh.vim
index cd18f06..59a9d56 100644
--- a/runtime/indent/tcsh.vim
+++ b/runtime/indent/tcsh.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:		C-shell (tcsh)
-" Maintainer:		Gautam Iyer 
-" Last Modified:	Sat 16 Jun 2007 04:27:45 PM PDT
+" Maintainer:		GI , where a='gi1242+vim', b='gmail', c='com'
+" Last Modified:	Sat 10 Dec 2011 09:23:00 AM EST
 
 " Only load this indent file when no other was loaded.
 if exists("b:did_indent")
@@ -18,8 +18,6 @@ if exists("*TcshGetIndent")
     finish
 endif
 
-set cpoptions-=C
-
 function TcshGetIndent()
     " Find a non-blank line above the current line.
     let lnum = prevnonblank(v:lnum - 1)
diff --git a/runtime/indent/tex.vim b/runtime/indent/tex.vim
new file mode 100644
index 0000000..7e3a351
--- /dev/null
+++ b/runtime/indent/tex.vim
@@ -0,0 +1,295 @@
+" Vim indent file
+" Language:     LaTeX
+" Maintainer:   YiChao Zhou 
+" Created:      Sat, 16 Feb 2002 16:50:19 +0100
+" Last Change:	2012 Mar 18 19:19:50
+" Version: 0.7
+"   Please email me if you found something we can do.  Bug report and
+"   feature request is welcome.
+
+" Last Update:  {{{
+"               25th Sep 2002, by LH :
+"               (*) better support for the option
+"               (*) use some regex instead of several '||'.
+"               Oct 9th, 2003, by JT:
+"               (*) don't change indentation of lines starting with '%'
+"               2005/06/15, Moshe Kaminsky 
+"               (*) New variables:
+"                   g:tex_items, g:tex_itemize_env, g:tex_noindent_env
+"               2011/3/6, by Zhou YiChao 
+"               (*) Don't change indentation of lines starting with '%'
+"                   I don't see any code with '%' and it doesn't work properly
+"                   so I add some code.
+"               (*) New features: Add smartindent-like indent for "{}" and  "[]".
+"               (*) New variables: g:tex_indent_brace
+"               2011/9/25, by Zhou Yichao 
+"               (*) Bug fix: smartindent-like indent for "[]"
+"               (*) New features: Align with "&".
+"               (*) New variable: g:tex_indent_and.
+"               2011/10/23 by Zhou Yichao 
+"               (*) Bug fix: improve the smartindent-like indent for "{}" and
+"               "[]".
+"               2012/02/27 by Zhou Yichao 
+"               (*) Bug fix: support default folding marker.
+"               (*) Indent with "&" is not very handy.  Make it not enable by
+"               default.
+"               2012/03/06 by Zhou Yichao 
+"               (*) Modify "&" behavior and make it default again.  Now "&"
+"               won't align when there are more then one "&" in the previous
+"               line.
+"               (*) Add indent "\left(" and "\right)"
+"               (*) Trust user when in "verbatim" and "lstlisting"
+"               2012/03/11 by Zhou Yichao 
+"               (*) Modify "&" so that only indent when current line start with
+"               "&".
+"               2012/03/12 by Zhou Yichao 
+"               (*) Modify indentkeys.
+"               2012/03/18 by Zhou Yichao 
+"               (*) Add &cpo
+"               2013/05/02 by Zhou Yichao 
+"               (*) Fix problem about GetTeXIndent checker. Thank Albert Netymk
+"                   for reporting this.
+" }}}
+
+" Document: {{{
+"
+" To set the following options (ok, currently it's just one), add a line like
+"   let g:tex_indent_items = 1
+" to your ~/.vimrc.
+"
+" * g:tex_indent_brace
+"
+"   If this variable is unset or non-zero, it will use smartindent-like style
+"   for "{}" and "[]"
+"   
+" * g:tex_indent_items
+"
+"   If this variable is set, item-environments are indented like Emacs does
+"   it, i.e., continuation lines are indented with a shiftwidth.
+"   
+"   NOTE: I've already set the variable below; delete the corresponding line
+"   if you don't like this behaviour.
+"
+"   Per default, it is unset.
+"   
+"              set                                unset
+"   ----------------------------------------------------------------
+"       \begin{itemize}                      \begin{itemize}  
+"         \item blablabla                      \item blablabla
+"           bla bla bla                        bla bla bla  
+"         \item blablabla                      \item blablabla
+"           bla bla bla                        bla bla bla  
+"       \end{itemize}                        \end{itemize}    
+"
+"
+" * g:tex_items
+"
+"   A list of tokens to be considered as commands for the beginning of an item 
+"   command. The tokens should be separated with '\|'. The initial '\' should 
+"   be escaped. The default is '\\bibitem\|\\item'.
+"
+" * g:tex_itemize_env
+" 
+"   A list of environment names, separated with '\|', where the items (item 
+"   commands matching g:tex_items) may appear. The default is 
+"   'itemize\|description\|enumerate\|thebibliography'.
+"
+" * g:tex_noindent_env
+"
+"   A list of environment names. separated with '\|', where no indentation is 
+"   required. The default is 'document\|verbatim'.
+"
+" * g:tex_indent_and
+"
+"   If this variable is unset or zero, vim will try to align the line with first
+"   "&". This is pretty useful when you use environment like table or align.
+"   Note that this feature need to search back some line, so vim may become
+"   a little slow.
+"
+" }}} 
+
+" Only define the function once
+if exists("b:did_indent")
+    finish
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+" Define global variable {{{
+
+let b:did_indent = 1
+
+if !exists("g:tex_indent_items")
+    let g:tex_indent_items = 1
+endif
+if !exists("g:tex_indent_brace")
+    let g:tex_indent_brace = 1
+endif
+if !exists("g:tex_indent_and")
+    let g:tex_indent_and = 1
+endif
+if g:tex_indent_items
+    if !exists("g:tex_itemize_env")
+        let g:tex_itemize_env = 'itemize\|description\|enumerate\|thebibliography'
+    endif
+    if !exists('g:tex_items')
+        let g:tex_items = '\\bibitem\|\\item' 
+    endif
+else
+    let g:tex_items = ''
+endif
+
+if !exists("g:tex_indent_paretheses")
+    let g:tex_indent_paretheses = 1
+endif
+
+if !exists("g:tex_noindent_env")
+    let g:tex_noindent_env = 'document\|verbatim\|lstlisting'
+endif "}}}
+
+" VIM Setting " {{{
+setlocal autoindent
+setlocal nosmartindent
+setlocal indentexpr=GetTeXIndent()
+setlocal indentkeys&
+exec 'setlocal indentkeys+=[,(,{,),},],\&' . substitute(g:tex_items, '^\|\(\\|\)', ',=', 'g')
+let g:tex_items = '^\s*' . substitute(g:tex_items, '^\(\^\\s\*\)*', '', '')
+" }}}
+
+function! GetTeXIndent() " {{{
+    " Find a non-blank line above the current line.
+    let lnum = prevnonblank(v:lnum - 1)
+
+    " Comment line is not what we need.
+    while lnum != 0 && getline(lnum) =~ '^\s*%'
+        let lnum = prevnonblank(lnum - 1)
+    endwhile
+
+    " At the start of the file use zero indent.
+    if lnum == 0
+        return 0 
+    endif
+
+    let line = substitute(getline(lnum), '%.*', ' ','g')     " last line
+    let cline = substitute(getline(v:lnum), '%.*', ' ', 'g') " current line
+
+    "  We are in verbatim, so do what our user what.
+    if synIDattr(synID(v:lnum, indent(v:lnum), 1), "name") == "texZone"
+        if empty(cline)
+            return indent(lnum)
+        else
+            return indent(v:lnum)
+        end
+    endif
+    
+    " You want to align with "&"
+    if g:tex_indent_and
+        " Align only when current line start with "&"
+        if line =~ '&.*\\\\' && cline =~ '^\s*&'
+            return indent(v:lnum) + stridx(line, "&") - stridx(cline, "&")
+        endif
+
+        " set line & lnum to the line which doesn't contain "&"
+        while lnum != 0 && (stridx(line, "&") != -1 || line =~ '^\s*%')
+            let lnum = prevnonblank(lnum - 1)
+            let line = getline(lnum)
+        endwhile
+    endif
+
+
+    if lnum == 0
+        return 0 
+    endif
+
+    let ind = indent(lnum)
+
+    " New code for comment: retain the indent of current line
+    if cline =~ '^\s*%'
+        return indent(v:lnum)
+    endif
+
+    " Add a 'shiftwidth' after beginning of environments.
+    " Don't add it for \begin{document} and \begin{verbatim}
+    ""if line =~ '^\s*\\begin{\(.*\)}'  && line !~ 'verbatim' 
+    " LH modification : \begin does not always start a line
+    " ZYC modification : \end after \begin won't cause wrong indent anymore
+    if line =~ '\\begin{.*}' && line !~ g:tex_noindent_env
+        let ind = ind + &sw
+
+        if g:tex_indent_items
+            " Add another sw for item-environments
+            if line =~ g:tex_itemize_env
+                let ind = ind + &sw
+            endif
+        endif
+    endif
+
+    " Subtract a 'shiftwidth' when an environment ends
+    if cline =~ '\\end{.*}' && cline !~ g:tex_noindent_env
+
+        if g:tex_indent_items
+            " Remove another sw for item-environments
+            if cline =~ g:tex_itemize_env
+                let ind = ind - &sw
+            endif
+        endif
+
+        let ind = ind - &sw
+    endif
+
+    if g:tex_indent_brace
+        let sum1 = 0
+        for i in range(0, strlen(line)-1)
+            if line[i] == "}" || line[i] == "]" ||
+                        \ strpart(line, i, 7) == '\right)'
+                let sum1 = max([0, sum1-1])
+            endif
+            if line[i] == "{" || line[i] == "[" ||
+                        \ strpart(line, i, 6) == '\left('
+                let sum1 += 1
+            endif
+        endfor
+
+        let sum2 = 0
+        for i in reverse(range(0, strlen(cline)-1))
+            if cline[i] == "{" || cline[i] == "[" ||
+                        \ strpart(cline, i, 6) == '\left('
+                let sum2 = max([0, sum2-1])
+            endif
+            if cline[i] == "}" || cline[i] == "]" ||
+                        \ strpart(cline, i, 7) == '\right)'
+                let sum2 += 1
+            endif
+        endfor
+
+        let ind += (sum1 - sum2) * &sw
+    endif
+
+    if g:tex_indent_paretheses
+    endif
+
+    " Special treatment for 'item'
+    " ----------------------------
+
+    if g:tex_indent_items
+
+        " '\item' or '\bibitem' itself:
+        if cline =~ g:tex_items
+            let ind = ind - &sw
+        endif
+
+        " lines following to '\item' are intented once again:
+        if line =~ g:tex_items
+            let ind = ind + &sw
+        endif
+
+    endif
+
+    return ind
+endfunction "}}}
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: set sw=4 textwidth=80:
diff --git a/runtime/indent/treetop.vim b/runtime/indent/treetop.vim
new file mode 100644
index 0000000..a2af78b
--- /dev/null
+++ b/runtime/indent/treetop.vim
@@ -0,0 +1,38 @@
+" Vim indent file
+" Language:         Treetop
+" Maintainer:       Nikolai Weibull 
+" Latest Revision:  2011-03-14
+
+if exists("b:did_indent")
+  finish
+endif
+let b:did_indent = 1
+
+setlocal indentexpr=GetTreetopIndent()
+setlocal indentkeys=0{,0},!^F,o,O,=end
+setlocal nosmartindent
+
+if exists("*GetTreetopIndent")
+  finish
+endif
+
+function GetTreetopIndent()
+  let pnum = prevnonblank(v:lnum - 1)
+  if pnum == 0
+    return 0
+  endif
+
+  let ind = indent(pnum)
+  let line = getline(pnum)
+
+  if line =~ '^\s*\%(grammar\|module\|rule\)\>'
+    let ind += &sw
+  endif
+
+  let line = getline(v:lnum)
+  if line =~ '^\s*end\>'
+    let ind -= &sw
+  end
+
+  retur ind
+endfunction
diff --git a/runtime/indent/verilog.vim b/runtime/indent/verilog.vim
index 74c8c5f..ecca462 100644
--- a/runtime/indent/verilog.vim
+++ b/runtime/indent/verilog.vim
@@ -1,6 +1,6 @@
 " Language:     Verilog HDL
 " Maintainer:	Chih-Tsun Huang 
-" Last Change:	Wed Oct 31 16:13:11 CST 2001
+" Last Change:	2011 Dec 10 by Thilo Six
 " URL:		http://larc.ee.nthu.edu.tw/~cthuang/vim/indent/verilog.vim
 "
 " Credits:
@@ -30,7 +30,8 @@ if exists("*GetVerilogIndent")
   finish
 endif
 
-set cpo-=C
+let s:cpo_save = &cpo
+set cpo&vim
 
 function GetVerilogIndent()
 
@@ -216,4 +217,7 @@ function GetVerilogIndent()
   return ind
 endfunction
 
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
 " vim:sw=2
diff --git a/runtime/indent/vhdl.vim b/runtime/indent/vhdl.vim
index 717857f..3e847b9 100644
--- a/runtime/indent/vhdl.vim
+++ b/runtime/indent/vhdl.vim
@@ -1,8 +1,8 @@
 " VHDL indent ('93 syntax)
 " Language:    VHDL
 " Maintainer:  Gerald Lai 
-" Version:     1.56
-" Last Change: 2010 Jun 29
+" Version:     1.58
+" Last Change: 2011 Sep 27
 " URL:         http://www.vim.org/scripts/script.php?script_id=1450
 
 " only load this indent file when no other was loaded
@@ -95,7 +95,7 @@ function GetVHDLindent()
 
   " ****************************************************************************************
   " indent:   align generic variables & port names
-  " keywords: "generic", "map", "port" + "(", provided current line is part of mapping
+  " keywords: "procedure" + name, "generic", "map", "port" + "(", provided current line is part of mapping
   " where:    anywhere in previous 2 lines
   " find following previous non-comment line
   let pn = prevnonblank(prevn - 1)
@@ -104,7 +104,7 @@ function GetVHDLindent()
     let pn = prevnonblank(pn - 1)
     let ps = getline(pn)
   endwhile
-  if (curs =~ '^\s*)' || curs =~? '^\s*\%(\<\%(generic\|map\|port\)\>.*\)\@\s*\S\+\|:[^=]\@=\s*\%(\%(in\|out\|inout\|buffer\|linkage\)\>\|\w\+\s\+:=\)\)') && (prevs =~? s:NC.'\<\%(generic\|map\|port\)\s*(\%(\s*\w\)\=' || (ps =~? s:NC.'\<\%(generic\|map\|port\)'.s:ES && prevs =~ '^\s*('))
+  if (curs =~ '^\s*)' || curs =~? '^\s*\%(\<\%(procedure\|generic\|map\|port\)\>.*\)\@\s*\S\+\|:[^=]\@=\s*\%(\%(in\|out\|inout\|buffer\|linkage\)\>\|\w\+\s\+:=\)\)') && (prevs =~? s:NC.'\<\%(procedure\s\+\S\+\|generic\|map\|port\)\s*(\%(\s*\w\)\=' || (ps =~? s:NC.'\<\%(procedure\|generic\|map\|port\)'.s:ES && prevs =~ '^\s*('))
     " align closing ")" with opening "("
     if curs =~ '^\s*)'
       return ind2 + stridx(prevs_noi, '(')
@@ -160,12 +160,12 @@ function GetVHDLindent()
         " make sure one of these is true
         " keywords: variable + "<=" without ";" ending
         " where:    start of previous non-comment line
-        " keywords: "generic", "map", "port"
+        " keywords: "procedure", "generic", "map", "port"
         " where:    anywhere in previous non-comment line
         " keyword:  "("
         " where:    start of previous non-comment line
         if m < 3 && ps !~? '^\s*\S\+\s*<=[^;]*'.s:ES
-          if ps =~? s:NC.'\<\%(generic\|map\|port\)\>' || ps =~ '^\s*('
+          if ps =~? s:NC.'\<\%(procedure\|generic\|map\|port\)\>' || ps =~ '^\s*('
             let ind = t
           endif
           break
@@ -207,14 +207,26 @@ function GetVHDLindent()
   " keyword:  "begin"
   " where:    anywhere in current line
   if curs =~? s:NC.'\'
-    let ind = ind - &sw
     " find previous opening statement of
     " keywords: "architecture", "block", "entity", "function", "generate", "procedure", "process"
     let s2 = s:NC.s:NE.'\<\%(architecture\|block\|entity\|function\|generate\|procedure\|process\)\>'
-    if (curs !~? s2.'.*'.s:NC.'\.*'.s:ES && prevs =~? s2) || m == 1
-      let ind = ind + &sw
+
+    let pn = prevnonblank(curn - 1)
+    let ps = getline(pn)
+    while pn > 0 && (ps =~ '^\s*--' || ps !~? s2)
+      let pn = prevnonblank(pn - 1)
+      let ps = getline(pn)
+
+      if (ps =~? s:NC.'\')
+        return indent(pn) - &sw
+      endif
+    endwhile
+
+    if (pn == 0)
+      return ind - &sw
+    else
+      return indent(pn)
     endif
-    return ind
   endif
 
   " indent:   +sw if previous line is previous opening statement
@@ -319,8 +331,13 @@ function GetVHDLindent()
   " indent:   -sw
   " keywords: "else", "elsif", "end" + "block", "for", "function", "generate", "if", "loop", "procedure", "process", "record", "units"
   " where:    start of current line
-  if curs =~? '^\s*\%(else\|elsif\|end\s\+\%(block\|for\|function\|generate\|if\|loop\|procedure\|process\|record\|units\)\)\>'
-    return ind - &sw
+  let s5 = 'block\|for\|function\|generate\|if\|loop\|procedure\|process\|record\|units'
+  if curs =~? '^\s*\%(else\|elsif\|end\s\+\%('.s5.'\)\)\>'
+    if prevs =~? '^\s*\%(elsif\|'.s5.'\)'
+      return ind
+    else
+      return ind - &sw
+    endif
   endif
 
   " indent:   backtrace previous non-comment lines
@@ -395,9 +412,9 @@ function GetVHDLindent()
 
   " ****************************************************************************************
   " indent:   maintain indent of previous opening statement
-  " keywords: without "generic", "map", "port" + ":" but not ":=" + "in", "out", "inout", "buffer", "linkage", variable & ":="
+  " keywords: without "procedure", "generic", "map", "port" + ":" but not ":=" + "in", "out", "inout", "buffer", "linkage", variable & ":="
   " where:    start of current line
-  if curs =~? '^\s*\%(\<\%(generic\|map\|port\)\>.*\)\@\|\w\+\s\+:=\)'
+  if curs =~? '^\s*\%(\<\%(procedure\|generic\|map\|port\)\>.*\)\@\|\w\+\s\+:=\)'
     return ind2
   endif
 
diff --git a/runtime/indent/vim.vim b/runtime/indent/vim.vim
index 0a6dbc1..8c21573 100644
--- a/runtime/indent/vim.vim
+++ b/runtime/indent/vim.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	Vim script
 " Maintainer:	Bram Moolenaar 
-" Last Change:	2005 Jul 06
+" Last Change:	2012 Aug 02
 
 " Only load this indent file when no other was loaded.
 if exists("b:did_indent")
@@ -12,12 +12,26 @@ let b:did_indent = 1
 setlocal indentexpr=GetVimIndent()
 setlocal indentkeys+==end,=else,=cat,=fina,=END,0\\
 
+let b:undo_indent = "setl indentkeys< indentexpr<"
+
 " Only define the function once.
 if exists("*GetVimIndent")
   finish
 endif
+let s:keepcpo= &cpo
+set cpo&vim
 
 function GetVimIndent()
+  let ignorecase_save = &ignorecase
+  try
+    let &ignorecase = 0
+    return GetVimIndentIntern()
+  finally
+    let &ignorecase = ignorecase_save
+  endtry
+endfunc
+
+function GetVimIndentIntern()
   " Find a non-blank line above the current line.
   let lnum = prevnonblank(v:lnum - 1)
 
@@ -44,10 +58,18 @@ function GetVimIndent()
     else
       let ind = ind + &sw * 3
     endif
-  elseif getline(lnum) =~ '\(^\||\)\s*\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\%[lly]\|fu\%[nction]\|el\%[seif]\)\>'
-    let ind = ind + &sw
   elseif getline(lnum) =~ '^\s*aug\%[roup]' && getline(lnum) !~ '^\s*aug\%[roup]\s*!\=\s\+END'
     let ind = ind + &sw
+  else
+    let line = getline(lnum)
+    let i = match(line, '\(^\||\)\s*\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\%[lly]\|fu\%[nction]\|el\%[seif]\)\>')
+    if i >= 0
+      let ind += &sw
+      if strpart(line, i, 1) == '|' && has('syntax_items')
+            \ && synIDattr(synID(lnum, i, 1), "name") =~ '\(Comment\|String\)$'
+        let ind -= &sw
+      endif
+    endif
   endif
 
   " If the previous line contains an "end" after a pipe, but not in an ":au"
@@ -71,4 +93,7 @@ function GetVimIndent()
   return ind
 endfunction
 
+let &cpo = s:keepcpo
+unlet s:keepcpo
+
 " vim:sw=2
diff --git a/runtime/indent/xinetd.vim b/runtime/indent/xinetd.vim
index f7a5341..c812723 100644
--- a/runtime/indent/xinetd.vim
+++ b/runtime/indent/xinetd.vim
@@ -15,6 +15,8 @@ setlocal nosmartindent
 if exists("*GetXinetdIndent")
   finish
 endif
+let s:keepcpo= &cpo
+set cpo&vim
 
 function s:count_braces(lnum, count_open)
   let n_open = 0
@@ -48,3 +50,6 @@ function GetXinetdIndent()
   return indent(pnum) + s:count_braces(pnum, 1) * &sw
         \ - s:count_braces(v:lnum, 0) * &sw
 endfunction
+
+let &cpo = s:keepcpo
+unlet s:keepcpo
diff --git a/runtime/indent/xml.vim b/runtime/indent/xml.vim
index 4ac35b6..dbe5be5 100644
--- a/runtime/indent/xml.vim
+++ b/runtime/indent/xml.vim
@@ -1,6 +1,6 @@
 " Language:	xml
 " Maintainer:	Johannes Zellner 
-" Last Change:	2009-05-26 00:17:25
+" Last Change:	2012 Jul 25
 " Notes:	1) does not indent pure non-xml code (e.g. embedded scripts)
 "		2) will be confused by unbalanced tags in comments
 "		or CDATA sections.
@@ -12,13 +12,13 @@ if exists("b:did_indent")
     finish
 endif
 let b:did_indent = 1
+let s:keepcpo= &cpo
+set cpo&vim
 
 " [-- local settings (must come before aborting the script) --]
 setlocal indentexpr=XmlIndentGet(v:lnum,1)
 setlocal indentkeys=o,O,*,<>>,<<>,/,{,}
 
-set cpo-=C
-
 if !exists('b:xml_indent_open')
     let b:xml_indent_open = '.\{-}<\a'
     " pre tag, e.g. 
@@ -31,8 +31,16 @@ if !exists('b:xml_indent_close') " let b:xml_indent_close = '.\{-}XmlIndentWithPattern(line, pat) let s = substitute('x'.a:line, a:pat, "\1", 'g') @@ -93,4 +101,7 @@ fun! XmlIndentGet(lnum, use_syntax_check) return ind endfun +let &cpo = s:keepcpo +unlet s:keepcpo + " vim:ts=8 diff --git a/runtime/indent/yaml.vim b/runtime/indent/yaml.vim new file mode 100644 index 0000000..1d03715 --- /dev/null +++ b/runtime/indent/yaml.vim @@ -0,0 +1,132 @@ +" Vim indent file +" Language: YAML +" Maintainer: Nikolai Pavlov + +" Only load this indent file when no other was loaded. +if exists('b:did_indent') + finish +endif + +let s:save_cpo = &cpo +set cpo&vim + +let b:did_indent = 1 + +setlocal indentexpr=GetYAMLIndent(v:lnum) +setlocal indentkeys=!^F,o,O,0#,0},0],<:>,- +setlocal nosmartindent + +let b:undo_indent = 'setlocal indentexpr< indentkeys< smartindent<' + +" Only define the function once. +if exists('*GetYAMLIndent') + finish +endif + +if exists('*shiftwidth') + let s:shiftwidth = function('shiftwidth') +else + function s:shiftwidth() + return &shiftwidth + endfunction +endif + +function s:FindPrevLessIndentedLine(lnum, ...) + let prevlnum = prevnonblank(a:lnum-1) + let curindent = a:0 ? a:1 : indent(a:lnum) + while prevlnum + \&& indent(prevlnum) >= curindent + \&& getline(prevlnum) !~# '^\s*#' + let prevlnum = prevnonblank(prevlnum-1) + endwhile + return prevlnum +endfunction + +function s:FindPrevLEIndentedLineMatchingRegex(lnum, regex) + let plilnum = s:FindPrevLessIndentedLine(a:lnum, indent(a:lnum)+1) + while plilnum && getline(plilnum) !~# a:regex + let plilnum = s:FindPrevLessIndentedLine(plilnum) + endwhile + return plilnum +endfunction + +let s:mapkeyregex='\v^\s*%(\''%([^'']|'''')*\'''. + \ '|\"%([^"\\]|\\.)*\"'. + \ '|%(%(\:\ )@!.)*)\:%(\ |$)' +let s:liststartregex='\v^\s*%(\-%(\ |$))' + +function GetYAMLIndent(lnum) + if a:lnum == 1 || !prevnonblank(a:lnum-1) + return 0 + endif + + let prevlnum = prevnonblank(a:lnum-1) + let previndent = indent(prevlnum) + + let line = getline(a:lnum) + if line =~# '^\s*#' && getline(a:lnum-1) =~# '^\s*#' + " Comment blocks should have identical indent + return previndent + elseif line =~# '^\s*[\]}]' + " Lines containing only closing braces should have previous indent + return indent(s:FindPrevLessIndentedLine(a:lnum)) + endif + + " Ignore comment lines when calculating indent + while getline(prevlnum) =~# '^\s*#' + let prevlnum = prevnonblank(prevlnum-1) + if !prevlnum + return previndent + endif + endwhile + + let prevline = getline(prevlnum) + let previndent = indent(prevlnum) + + " Any examples below assume that shiftwidth=2 + if prevline =~# '\v[{[:]$|[:-]\ [|>][+\-]?%(\s+\#.*|\s*)$' + " Mapping key: + " nested mapping: ... + " + " - { + " key: [ + " list value + " ] + " } + " + " - |- + " Block scalar without indentation indicator + return previndent+s:shiftwidth() + elseif prevline =~# '\v[:-]\ [|>]%(\d+[+\-]?|[+\-]?\d+)%(\#.*|\s*)$' + " - |+2 + " block scalar with indentation indicator + "#^^ indent+2, not indent+shiftwidth + return previndent + str2nr(matchstr(prevline, + \'\v([:-]\ [|>])@<=[+\-]?\d+%([+\-]?%(\s+\#.*|\s*)$)@=')) + elseif prevline =~# '\v\"%([^"\\]|\\.)*\\$' + " "Multiline string \ + " with escaped end" + let qidx = match(prevline, '\v\"%([^"\\]|\\.)*\\') + return virtcol([prevlnum, qidx+1]) + elseif line =~# s:liststartregex + " List line should have indent equal to previous list line unless it was + " caught by one of the previous rules + return indent(s:FindPrevLEIndentedLineMatchingRegex(a:lnum, + \ s:liststartregex)) + elseif line =~# s:mapkeyregex + " Same for line containing mapping key + return indent(s:FindPrevLEIndentedLineMatchingRegex(a:lnum, + \ s:mapkeyregex)) + elseif prevline =~# '^\s*- ' + " - List with + " multiline scalar + return previndent+2 + elseif prevline =~# s:mapkeyregex + " Mapping with: value + " that is multiline scalar + return previndent+s:shiftwidth() + endif + return previndent +endfunction + +let &cpo = s:save_cpo diff --git a/runtime/indent/zimbu.vim b/runtime/indent/zimbu.vim new file mode 100644 index 0000000..9565b10 --- /dev/null +++ b/runtime/indent/zimbu.vim @@ -0,0 +1,128 @@ +" Vim indent file +" Language: Zimbu +" Maintainer: Bram Moolenaar +" Last Change: 2012 Sep 08 + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal ai nolisp nocin +setlocal indentexpr=GetZimbuIndent(v:lnum) +setlocal indentkeys=0{,0},!^F,o,O,0=ELSE,0=ELSEIF,0=CASE,0=DEFAULT,0=FINALLY + +" We impose recommended defaults: no Tabs, 'shiftwidth' = 2 +setlocal sw=2 et + +let b:undo_indent = "setl et< sw< ai< indentkeys< indentexpr=" + +" Only define the function once. +if exists("*GetZimbuIndent") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +" Come here when loading the script the first time. + +let s:maxoff = 50 " maximum number of lines to look backwards for () + +func GetZimbuIndent(lnum) + let prevLnum = prevnonblank(a:lnum - 1) + if prevLnum == 0 + " This is the first non-empty line, use zero indent. + return 0 + endif + + " Taken from Python indenting: + " If the previous line is inside parenthesis, use the indent of the starting + " line. + " Trick: use the non-existing "dummy" variable to break out of the loop when + " going too far back. + call cursor(prevLnum, 1) + let parlnum = searchpair('(\|{\|\[', '', ')\|}\|\]', 'nbW', + \ "line('.') < " . (prevLnum - s:maxoff) . " ? dummy :" + \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" + \ . " =~ '\\(Comment\\|String\\|Char\\)$'") + if parlnum > 0 + let plindent = indent(parlnum) + let plnumstart = parlnum + else + let plindent = indent(prevLnum) + let plnumstart = prevLnum + endif + + + " When inside parenthesis: If at the first line below the parenthesis add + " two 'shiftwidth', otherwise same as previous line. + " i = (a + " + b + " + c) + call cursor(a:lnum, 1) + let p = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', + \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" + \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" + \ . " =~ '\\(Comment\\|String\\|Char\\)$'") + if p > 0 + if p == prevLnum + " When the start is inside parenthesis, only indent one 'shiftwidth'. + let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', + \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" + \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" + \ . " =~ '\\(Comment\\|String\\|Char\\)$'") + if pp > 0 + return indent(prevLnum) + &sw + endif + return indent(prevLnum) + &sw * 2 + endif + if plnumstart == p + return indent(prevLnum) + endif + return plindent + endif + + let prevline = getline(prevLnum) + let thisline = getline(a:lnum) + + " If this line is not a comment and the previous one is then move the + " previous line further back. + if thisline !~ '^\s*#' + while prevline =~ '^\s*#' + let prevLnum = prevnonblank(prevLnum - 1) + if prevLnum == 0 + " Only comment lines before this, no indent + return 0 + endif + let prevline = getline(prevLnum) + let plindent = indent(prevLnum) + endwhile + endif + + if prevline =~ '^\s*\(IF\|\|ELSEIF\|ELSE\|GENERATE_IF\|\|GENERATE_ELSEIF\|GENERATE_ELSE\|WHILE\|REPEAT\|TRY\|CATCH\|FINALLY\|FOR\|DO\|SWITCH\|CASE\|DEFAULT\|FUNC\|VIRTUAL\|ABSTRACT\|DEFINE\|REPLACE\|FINAL\|PROC\|MAIN\|NEW\|ENUM\|CLASS\|INTERFACE\|BITS\|MODULE\|SHARED\)\>' + let plindent += &sw + endif + if thisline =~ '^\s*\(}\|ELSEIF\>\|ELSE\>\|CATCH\|FINALLY\|GENERATE_ELSEIF\>\|GENERATE_ELSE\>\|UNTIL\>\)' + let plindent -= &sw + endif + if thisline =~ '^\s*\(CASE\>\|DEFAULT\>\)' && prevline !~ '^\s*SWITCH\>' + let plindent -= &sw + endif + + " line up continued comment that started after some code + " String something # comment comment + " # comment + if a:lnum == prevLnum + 1 && thisline =~ '^\s*#' && prevline !~ '^\s*#' + let n = match(prevline, '#') + if n > 1 + let plindent = n + endif + endif + + return plindent +endfunc + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/keymap/belarusian-jcuken.vim b/runtime/keymap/belarusian-jcuken.vim new file mode 100644 index 0000000..73c84aa --- /dev/null +++ b/runtime/keymap/belarusian-jcuken.vim @@ -0,0 +1,87 @@ +" Vim Keymap file for Belarusian characters, layout 'jcuken', classical variant +" Useful mainly with UTF-8, but may work with other encodings. + +" Derived From: russian-jcuken.vim +" Maintainer: Aliaksei Nestserau +" Last Changed: 2012 Jul 23 + +" All characters are given literally, conversion to another encoding (e.g., +" UTF-8) should work. +scriptencoding utf-8 + +let b:keymap_name = "by" + +loadkeymap +~ Ё CYRILLIC CAPITAL LETTER IO +` ё CYRILLIC SMALL LETTER IO +F А CYRILLIC CAPITAL LETTER A +< Б CYRILLIC CAPITAL LETTER BE +D В CYRILLIC CAPITAL LETTER VE +U Г CYRILLIC CAPITAL LETTER GHE +L Д CYRILLIC CAPITAL LETTER DE +T Е CYRILLIC CAPITAL LETTER IE +: Ж CYRILLIC CAPITAL LETTER ZHE +P З CYRILLIC CAPITAL LETTER ZE +B І CYRILLIC CAPITAL LETTER I +Q Й CYRILLIC CAPITAL LETTER SHORT I +R К CYRILLIC CAPITAL LETTER KA +K Л CYRILLIC CAPITAL LETTER EL +V М CYRILLIC CAPITAL LETTER EM +Y Н CYRILLIC CAPITAL LETTER EN +J О CYRILLIC CAPITAL LETTER O +G П CYRILLIC CAPITAL LETTER PE +H Р CYRILLIC CAPITAL LETTER ER +C С CYRILLIC CAPITAL LETTER ES +N Т CYRILLIC CAPITAL LETTER TE +E У CYRILLIC CAPITAL LETTER U +A Ф CYRILLIC CAPITAL LETTER EF +{ Ð¥ CYRILLIC CAPITAL LETTER HA +W Ц CYRILLIC CAPITAL LETTER TSE +X Ч CYRILLIC CAPITAL LETTER CHE +I Ш CYRILLIC CAPITAL LETTER SHA +O Ў CYRILLIC CAPITAL LETTER ASYLLABIC U +} ' APOSTROPHE +S Ы CYRILLIC CAPITAL LETTER YERU +M Ь CYRILLIC CAPITAL LETTER SOFT SIGN +\" Э CYRILLIC CAPITAL LETTER E +> Ю CYRILLIC CAPITAL LETTER YU +Z Я CYRILLIC CAPITAL LETTER YA +f а CYRILLIC SMALL LETTER A +, б CYRILLIC SMALL LETTER BE +d в CYRILLIC SMALL LETTER VE +u г CYRILLIC SMALL LETTER GHE +l д CYRILLIC SMALL LETTER DE +t е CYRILLIC SMALL LETTER IE +; ж CYRILLIC SMALL LETTER ZHE +p з CYRILLIC SMALL LETTER ZE +b і CYRILLIC SMALL LETTER I +q й CYRILLIC SMALL LETTER SHORT I +r к CYRILLIC SMALL LETTER KA +k л CYRILLIC SMALL LETTER EL +v м CYRILLIC SMALL LETTER EM +y н CYRILLIC SMALL LETTER EN +j о CYRILLIC SMALL LETTER O +g п CYRILLIC SMALL LETTER PE +h р CYRILLIC SMALL LETTER ER +c с CYRILLIC SMALL LETTER ES +n т CYRILLIC SMALL LETTER TE +e у CYRILLIC SMALL LETTER U +a ф CYRILLIC SMALL LETTER EF +[ х CYRILLIC SMALL LETTER HA +w ц CYRILLIC SMALL LETTER TSE +x ч CYRILLIC SMALL LETTER CHE +i ш CYRILLIC SMALL LETTER SHA +o ў CYRILLIC SMALL LETTER ASYLLABIC U +] ' APOSTROPHE +s ы CYRILLIC SMALL LETTER YERU +m ь CYRILLIC SMALL LETTER SOFT SIGN +' э CYRILLIC SMALL LETTER E +. ю CYRILLIC SMALL LETTER YU +z я CYRILLIC SMALL LETTER YA +@ " +# ' +$ * +% : +^ , +& . +* ; diff --git a/runtime/lang/menu_af_af.latin1.vim b/runtime/lang/menu_af_af.latin1.vim index b32e8e9..46331e7 100644 --- a/runtime/lang/menu_af_af.latin1.vim +++ b/runtime/lang/menu_af_af.latin1.vim @@ -1,12 +1,14 @@ " Menu Translations: Afrikaas " Maintainer: Danie Roux -" Last Change: 2003 Mar 30 +" Last Change: 2012 May 01 " Quit when menu translations have already been done. if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim " The translations below are in latin1, but they work for cp1252 and " iso-8859-15 without conversion as well. @@ -150,3 +152,6 @@ menutrans o&ff\ (this\ file) &Af\ (die\ le menutrans Co&lor\ test Toets\ die\ &kleure menutrans &Highlight\ test Toets\ die\ verligting menutrans &Convert\ to\ HTML Verwissel\ na\ HTML + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_ca_es.latin1.vim b/runtime/lang/menu_ca_es.latin1.vim index c78e173..1d77dc9 100644 --- a/runtime/lang/menu_ca_es.latin1.vim +++ b/runtime/lang/menu_ca_es.latin1.vim @@ -9,6 +9,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim " The translations below are in latin1, but they work for cp1252, " iso-8859-15 without conversion as well. @@ -311,3 +313,5 @@ menutrans Config Configuraci menutrans Set\ '&syntax'\ only Només\ el\ ressalt\ de\ sintaxi menutrans Set\ '&filetype'\ too Carrega\ també\ els\ plugins +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_chinese_gb.936.vim b/runtime/lang/menu_chinese_gb.936.vim index 193826b..e636a42 100644 --- a/runtime/lang/menu_chinese_gb.936.vim +++ b/runtime/lang/menu_chinese_gb.936.vim @@ -9,6 +9,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding cp936 @@ -261,3 +263,6 @@ menutrans &Highlight\ test menutrans &Convert\ to\ HTML ת»»³É\ HTML(&C) menutrans Set\ '&syntax'\ only ½öÉ趨\ 'syntax'(&S) menutrans Set\ '&filetype'\ too Ò²É趨\ 'filetype'(&F) + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_chinese_taiwan.950.vim b/runtime/lang/menu_chinese_taiwan.950.vim index 60dc2a7..7631e3e 100644 --- a/runtime/lang/menu_chinese_taiwan.950.vim +++ b/runtime/lang/menu_chinese_taiwan.950.vim @@ -1,6 +1,6 @@ " Menu Translations: Traditional Chinese " Translated By: Hung-Te Lin -" Last Change: 2005/01/28 02:51:38 +" Last Change: 2012 May 01 " {{{ Quit when menu translations have already been done. if exists("did_menu_trans") @@ -8,6 +8,8 @@ if exists("did_menu_trans") endif let did_menu_trans = 1 " }}} +let s:keepcpo= &cpo +set cpo&vim scriptencoding cp950 @@ -282,4 +284,7 @@ if has("toolbar") endif " }}} +let &cpo = s:keepcpo +unlet s:keepcpo + " vim:foldmethod=marker:nowrap:foldcolumn=2:foldlevel=1 diff --git a/runtime/lang/menu_cs_cz.iso_8859-2.vim b/runtime/lang/menu_cs_cz.iso_8859-2.vim index a5bc82e..410d548 100644 --- a/runtime/lang/menu_cs_cz.iso_8859-2.vim +++ b/runtime/lang/menu_cs_cz.iso_8859-2.vim @@ -1,30 +1,38 @@ -" Menu Translations: Czech for ISO-8859-2 -" Maintainer: Jiri Brezina -" vim:set foldmethod=marker: -" $Revision: 1.3 $ -" $Date: 2005/12/19 22:08:24 $ +" Menu Translations: Czech (ISO-8859-2) +" Maintainer: Jiri Sedlak +" Previous maintainer: Jiri Brezina +" Based on: menu.vim (2012-10-21) " Quit when menu translations have already been done. if exists("did_menu_trans") - finish + finish endif + let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim -scriptencoding ISO-8859-2 +scriptencoding iso-8859-2 " {{{ File menu menutrans &File &Soubor menutrans &Open\.\.\.:e &Otevøít\.\.\.:e menutrans Sp&lit-Open\.\.\.:sp Otevøít\ v\ no&vém\ oknì\.\.\.:sp +menutrans Open\ Tab\.\.\.:tabnew Otevøít\ tab\.\.\.:tabnew menutrans &New:enew &Nový:enew menutrans &Close:close &Zavøít:close menutrans &Save:w &Ulo¾it:w menutrans Save\ &As\.\.\.:sav Ulo¾it\ &jako\.\.\.:sav -menutrans Split\ &Diff\ with\.\.\. Rozdìlit\ okno\ -\ &Diff\.\.\. -menutrans Split\ Patched\ &By\.\.\. Rozdìlit\ okno\ -\ &Patch\.\.\. -menutrans &Print &Tisk -menutrans Sa&ve-Exit:wqa U&lo¾it\ -\ Konec:wqa -menutrans E&xit:qa &Konec:qa +if has("printer") || has("unix") + menutrans &Print &Tisk +endif +menutrans Sa&ve-Exit:wqa U&lo¾it\ a\ ukonèit:wqa +menutrans E&xit:qa &Ukonèit:qa + +if has("diff") + menutrans Split\ &Diff\ with\.\.\. Rozdìlit\ okno\ -\ &Diff\.\.\. + menutrans Split\ Patched\ &By\.\.\. Rozdìlit\ okno\ -\ &Patch\.\.\. +endif " }}} " {{{ Edit menu @@ -37,24 +45,32 @@ menutrans &Copy"+y &Kop menutrans &Paste"+gP V&lo¾it"+gP menutrans Put\ &Before[p Vlo¾it\ &pøed[p menutrans Put\ &After]p Vlo¾i&t\ za]p -menutrans &Deletex &Smazatx +if has("win32") || has("win16") + menutrans &Deletex &Smazatx +endif menutrans &Select\ AllggVG Vy&brat\ v¹eggVG -menutrans &Find\.\.\. &Hledat\.\.\. -menutrans Find\ and\ Rep&lace\.\.\. &Nahradit\.\.\. -menutrans Options\.\.\. Volb&y\.\.\. +if has("win32") || has("win16") || has("gui_gtk") || has("gui_kde") || has("gui_motif") + menutrans &Find\.\.\. &Hledat\.\.\. + menutrans Find\ and\ Rep&lace\.\.\. &Nahradit\.\.\. +else + menutrans Find/ &Hledat/ + menutrans Find\ and\ Rep&lace:%s &Nahradit:%s + menutrans Find\ and\ Rep&lace:s &Nahradit:s +endif menutrans Settings\ &Window Nastav&ení\ okna - " {{{2 Edit -1 +" {{{2 Edit -1 +menutrans Startup\ &Settings Poèáteèní\ &nastavení menutrans &Global\ Settings &Globální\ nastavení menutrans Toggle\ Pattern\ &Highlight:set\ hls! &Pøepnout\ zvýraznìní\ vzoru:set\ hls! menutrans Toggle\ &Ignore-case:set\ ic! Pøepnout\ ignorování\ &VERZÁLEK:set\ ic! menutrans Toggle\ &Showmatch:set\ sm! Pøepnout\ &Showmatch\ \{\(\[\])\}:set\ sm! menutrans &Context\ lines Zobrazit\ konte&xt\ kurzoru menutrans &Virtual\ Edit Virtuální\ p&ozice\ kurzoru - menutrans Never Nikdy - menutrans Block\ Selection Výbìr\ Bloku - menutrans Insert\ mode Insert\ mód - menutrans Block\ and\ Insert Blok\ a\ Insert - menutrans Always V¾dycky +menutrans Never Nikdy +menutrans Block\ Selection Výbìr\ Bloku +menutrans Insert\ mode Insert\ mód +menutrans Block\ and\ Insert Blok\ a\ Insert +menutrans Always V¾dycky menutrans Toggle\ Insert\ &Mode:set\ im! Pøepnout\ Insert\ mó&d:set\ im! menutrans Toggle\ Vi\ C&ompatible:set\ cp! Pøepnout\ kompatibilní\ re¾im\ s\ 'vi':set\ cp! menutrans Search\ &Path\.\.\. Nastavit\ &cestu\ k\ prohledávání\.\.\. @@ -63,9 +79,10 @@ menutrans Toggle\ &Toolbar P menutrans Toggle\ &Bottom\ Scrollbar Pø&epnout\ dolní\ rolovací\ li¹tu menutrans Toggle\ &Left\ Scrollbar Pøepnout\ &levou\ rolovací\ li¹tu menutrans Toggle\ &Right\ Scrollbar Pøepnout\ p&ravou\ rolovací\ li¹tu - " {{{2 Edit -2 +" {{{2 Edit -2 menutrans F&ile\ Settings Nastavení\ so&uboru menutrans Toggle\ Line\ &Numbering:set\ nu! Pøepnout\ èíslování\ øá&dkù:set\ nu! +menutrans Toggle\ relati&ve\ Line\ Numbering:set\ rnu! Pøepnout\ relativní\ èíslování\ øá&dkù:set\ rnu! menutrans Toggle\ &List\ Mode:set\ list! Pøepnout\ &List\ mód:set\ list! menutrans Toggle\ Line\ &Wrap:set\ wrap! Pøepnout\ zala&mování\ øádkù:set\ wrap! menutrans Toggle\ W&rap\ at\ word:set\ lbr! Pøepnout\ zl&om\ ve\ slovì:set\ lbr! @@ -76,10 +93,12 @@ menutrans &Shiftwidth Nastav&it\ menutrans Soft\ &Tabstop Nastavit\ Soft\ &Tabstop menutrans Te&xt\ Width\.\.\. ©íøka\ te&xtu\.\.\. menutrans &File\ Format\.\.\. &Formát\ souboru\.\.\. - " {{{2 Edit -3 +" {{{2 Edit -3 menutrans C&olor\ Scheme Barevné\ s&chéma menutrans &Keymap Klávesová\ m&apa -menutrans Select\ Fo&nt\.\.\. Vybrat\ pís&mo\.\.\. +if has("win32") || has("win16") || has("gui_motif") || has("gui_gtk") || has("gui_kde") || has("gui_photon") || has("gui_mac") + menutrans Select\ Fo&nt\.\.\. Vybrat\ pís&mo\.\.\. +endif " }}}1 " {{{ Programming menu @@ -88,46 +107,52 @@ menutrans &Jump\ to\ this\ tagg^] &Sko menutrans Jump\ &back^T Skoèit\ &zpìt^T menutrans Build\ &Tags\ File &Vytvoøit\ soubor\ tagù -menutrans &Spelling &Kontrola\ pravopisu -menutrans &Spell\ Check\ On Kontrola\ pravopisu\ &zapnuta -menutrans Spell\ Check\ &Off Kontrola\ pravopisu\ &vypnuta -menutrans To\ Next\ error]s &Dal¹í\ chyba]s -menutrans To\ Previous\ error[s &Pøedchozí\ chyba[s -menutrans Suggest\ Correctionsz? &Návrh\ opravz? -menutrans Repeat\ correction:spellrepall Zopakovat\ &opravu:spellrepall -menutrans Set\ language\ to\ "en" Nastav\ jazyk\ na\ "en" -menutrans Set\ language\ to\ "en_au" Nastav\ jazyk\ na\ "en_au" -menutrans Set\ language\ to\ "en_ca" Nastav\ jazyk\ na\ "en_ca" -menutrans Set\ language\ to\ "en_gb" Nastav\ jazyk\ na\ "en_gb" -menutrans Set\ language\ to\ "en_nz" Nastav\ jazyk\ na\ "en_nz" -menutrans Set\ language\ to\ "en_us" Nastav\ jazyk\ na\ "en_us" -menutrans Set\ language\ to\ "cz" Nastav\ jazyk\ na\ "cz" -menutrans Set\ language\ to\ "cs_cz" Nastav\ jazyk\ na\ "cs_cz" -menutrans &Find\ More\ Languages Nalézt\ dal¹í\ &jazyky +if has("spell") + menutrans &Spelling &Kontrola\ pravopisu + menutrans &Spell\ Check\ On &Zapnout\ kontrolu\ pravopisu + menutrans Spell\ Check\ &Off &Vypnout \kontrolu\ pravopisu + menutrans To\ &Next\ error]s &Dal¹í\ chyba]s + menutrans To\ &Previous\ error[s &Pøedchozí\ chyba[s + menutrans Suggest\ &Correctionsz= &Navrhnout\ opravyz= + menutrans &Repeat\ correction:spellrepall Zopakovat\ &opravu:spellrepall + menutrans Set\ language\ to\ "en" Nastavit\ jazyk\ na\ "en" + menutrans Set\ language\ to\ "en_au" Nastavit\ jazyk\ na\ "en_au" + menutrans Set\ language\ to\ "en_ca" Nastavit\ jazyk\ na\ "en_ca" + menutrans Set\ language\ to\ "en_gb" Nastavit\ jazyk\ na\ "en_gb" + menutrans Set\ language\ to\ "en_nz" Nastavit\ jazyk\ na\ "en_nz" + menutrans Set\ language\ to\ "en_us" Nastavit\ jazyk\ na\ "en_us" + menutrans &Find\ More\ Languages Nalézt\ dal¹í\ &jazyky + let g:menutrans_set_lang_to = "Nastavit jazyk na" +endif + +if has("Folding") + menutrans &Folding &Skládání + menutrans &Enable/Disable\ foldszi &Ano/Nezi + menutrans &View\ Cursor\ Linezv Zobrazit\ øádek\ &kurzoruzv + menutrans Vie&w\ Cursor\ Line\ onlyzMzx Zobrazit\ &pouze\ øádek\ kurzoru\ zMzx + menutrans C&lose\ more\ foldszm Slo¾it\ &jednu\ úroveò\ skladùzm + menutrans &Close\ all\ foldszM Slo¾it\ v¹echny\ skladyzM + menutrans O&pen\ more\ foldszr Pøidat\ jednu\ úroveò\ skladùzr + menutrans &Open\ all\ foldszR &Otevøít\ v¹echny\ skladyzR + menutrans Fold\ Met&hod &Metoda\ skládání + menutrans M&anual &Ruènì + menutrans I&ndent &Odsazení + menutrans E&xpression &Výraz + menutrans S&yntax &Syntaxe + menutrans &Diff &Rozdíly + menutrans Ma&rker &Znaèky + menutrans Create\ &Foldzf Vytvoøit\ &skladzf + menutrans &Delete\ Foldzd Vymazat\ skla&dzd + menutrans Delete\ &All\ FoldszD Vymazat\ v¹echny\ skladyzD + menutrans Fold\ col&umn\ width Sloupec\ zob&razení\ skladù +endif -menutrans &Folding &Foldy -menutrans &Enable/Disable\ foldszi &Ano/Nezi -menutrans &View\ Cursor\ Linezv &Zobrazit\ øádek\ kurzoruzv -menutrans Vie&w\ Cursor\ Line\ onlyzMzx Zo&brazit\ pouze\ øádek\ kurzoru\ zMzx -menutrans C&lose\ more\ foldszm &Vyjmout\ jednu\ úroveò\ foldùzm -menutrans &Close\ all\ foldszM Zavøí&t\ v¹echny\ foldyzM -menutrans O&pen\ more\ foldszr Pøidat\ jedn&u\ úroveò\ foldùzr -menutrans &Open\ all\ foldszR &Otevøít\ v¹echny\ foldyzR -menutrans Fold\ Met&hod Metoda\ &skládání - "menutrans M&anual &Ruènì - "menutrans I&ndent &Odsazení - "menutrans E&xpression &Výraz - "menutrans S&yntax &Syntax - "menutrans &Diff &Diff - "menutrans Ma&rker Ma&rker -menutrans Create\ &Foldzf Vytvoøit\ &foldzf -menutrans &Delete\ Foldzd Vymazat\ fol&dzd -menutrans Delete\ &All\ FoldszD V&ymazat\ v¹echny\ foldyzD -menutrans Fold\ col&umn\ width Sloupec\ zob&razení\ foldù +if has("diff") + menutrans &Update &Obnovit + menutrans &Get\ Block &Sejmout\ Blok + menutrans &Put\ Block &Vlo¾it\ Blok +endif -menutrans &Update &Obnovit -menutrans &Get\ Block &Sejmout\ Blok -menutrans &Put\ Block &Vlo¾it\ Blok menutrans &Make:make &Make:make menutrans &List\ Errors:cl Výpis\ &chyb:cl menutrans L&ist\ Messages:cl! Výp&is\ zpráv:cl! @@ -140,7 +165,7 @@ menutrans SeT\ Compiler Nas&taven menutrans &Update:cwin O&bnovit:cwin menutrans &Open:copen &Otevøít:copen menutrans &Close:cclose &Zavøít:cclose -menutrans &Set\ Compiler N&astavit\ kompilátor +menutrans Se&T\ Compiler N&astavit\ kompilátor menutrans &Convert\ to\ HEX:%!xxd Pøevést\ do\ ¹estnáctkového\ formát&u:%!xxd menutrans Conve&rt\ back:%!xxd\ -r Pø&evést\ zpìt:%!xxd\ -r @@ -168,7 +193,6 @@ menutrans &Delete Z&ru menutrans &Alternate &Zmìnit menutrans &Next &Dal¹í menutrans &Previous &Pøedchozí -menutrans [No\ File] [®ádný\ soubor] " }}} " {{{ Menu Window @@ -219,6 +243,8 @@ menutrans &Paste &Vlo menutrans &Delete &Smazat menutrans Select\ Blockwise Vybrat\ blokovì menutrans Select\ &Word Vybrat\ &slovo +menutrans Select\ Pa&ragraph Vybrat\ &odstavec +menutrans Select\ &Sentence Vybrat\ vì&tu menutrans Select\ &Line Vybrat\ &øádek menutrans Select\ &Block Vybrat\ &blok menutrans Select\ &All Vybrat\ &v¹e @@ -226,39 +252,57 @@ menutrans Select\ &All Vybrat\ &v " {{{ The GUI toolbar if has("toolbar") - if exists("*Do_toolbar_tmenu") - delfun Do_toolbar_tmenu - endif - fun Do_toolbar_tmenu() - tmenu ToolBar.Open Otevøít soubor - tmenu ToolBar.Save Ulo¾it soubor - tmenu ToolBar.SaveAll Ulo¾it v¹echny soubory - tmenu ToolBar.Print Tisk - tmenu ToolBar.Undo Zpìt - tmenu ToolBar.Redo Zru¹it vrácení - tmenu ToolBar.Cut Vyøíznout - tmenu ToolBar.Copy Kopírovat - tmenu ToolBar.Paste Vlo¾it - tmenu ToolBar.Find Hledat... - tmenu ToolBar.FindNext Hledat dal¹í - tmenu ToolBar.FindPrev Hledat pøedchozí - tmenu ToolBar.Replace Nahradit... - if 0 " disabled; These are in the Windows menu - tmenu ToolBar.New Nové okno - tmenu ToolBar.WinSplit Rozdìlit okno - tmenu ToolBar.WinMax Maximalizovat okno - tmenu ToolBar.WinMin Minimalizovat okno - tmenu ToolBar.WinClose Zavøít okno - endif - tmenu ToolBar.LoadSesn Naèíst sezení - tmenu ToolBar.SaveSesn Ulo¾it sezení - tmenu ToolBar.RunScript Spustit skript - tmenu ToolBar.Make Spustit make - tmenu ToolBar.Shell Spustit shell - tmenu ToolBar.RunCtags Spustit ctags - tmenu ToolBar.TagJump Skoèit na tag pod kurzorem - tmenu ToolBar.Help Nápovìda - tmenu ToolBar.FindHelp Hledat nápovìdu k... - endfun + if exists("*Do_toolbar_tmenu") + delfun Do_toolbar_tmenu + endif + fun Do_toolbar_tmenu() + tmenu ToolBar.Open Otevøít soubor + tmenu ToolBar.Save Ulo¾it soubor + tmenu ToolBar.SaveAll Ulo¾it v¹echny soubory + if has("printer") || has("unix") + tmenu ToolBar.Print Tisk + endif + tmenu ToolBar.Undo Zpìt + tmenu ToolBar.Redo Zru¹it vrácení + tmenu ToolBar.Cut Vyøíznout + tmenu ToolBar.Copy Kopírovat + tmenu ToolBar.Paste Vlo¾it + tmenu ToolBar.Find Hledat... + tmenu ToolBar.FindNext Hledat dal¹í + tmenu ToolBar.FindPrev Hledat pøedchozí + tmenu ToolBar.Replace Nahradit... + if 0 " disabled; These are in the Windows menu + tmenu ToolBar.New Nové okno + tmenu ToolBar.WinSplit Rozdìlit okno + tmenu ToolBar.WinMax Maximalizovat okno + tmenu ToolBar.WinMin Minimalizovat okno + tmenu ToolBar.WinClose Zavøít okno + endif + tmenu ToolBar.LoadSesn Naèíst sezení + tmenu ToolBar.SaveSesn Ulo¾it sezení + tmenu ToolBar.RunScript Spustit skript + tmenu ToolBar.Make Spustit make + tmenu ToolBar.Shell Spustit shell + tmenu ToolBar.RunCtags Spustit ctags + tmenu ToolBar.TagJump Skoèit na tag pod kurzorem + tmenu ToolBar.Help Nápovìda + tmenu ToolBar.FindHelp Hledat nápovìdu k... + endfun endif " }}} + +" {{{ DIALOG TEXTS +let g:menutrans_no_file = "[®ádný soubor]" +let g:menutrans_help_dialog = "Zadejte hledaný pøíkaz nebo slovo:\n\n\tPøidejte i_ pro pøíkazy vkládacího re¾imu (napø. i_CTRL-X)\n\tPøidejte c_ pro pøíkazy pøíkazové øádky (napø. c_)\n\tPøidejte ' pro jméno volby (napø. 'shiftwidth')" +let g:menutrans_path_dialog = "Zadejte cesty pro vyhledávání souborù. Jednotlivé cesty oddìlte èárkou" +let g:menutrans_tags_dialog = "Zadejte jména souborù s tagy. Jména oddìlte èárkami." +let g:menutrans_textwidth_dialog = "Zadejte délku øádku (0 pro zakázání formátování):" +let g:menutrans_fileformat_dialog = "Vyberte typ konce øádkù" +" }}}" + +let &cpo = s:keepcpo +unlet s:keepcpo + + + +" vim:set foldmethod=marker expandtab tabstop=3 shiftwidth=3: diff --git a/runtime/lang/menu_cs_cz.latin1.vim b/runtime/lang/menu_cs_cz.latin1.vim index efb28a0..3bf608d 100644 --- a/runtime/lang/menu_cs_cz.latin1.vim +++ b/runtime/lang/menu_cs_cz.latin1.vim @@ -1,3 +1,3 @@ " Menu Translations: Czech -source :p:h/menu_czech_czech_republic.1252.vim +source :p:h/menu_czech_czech_republic.ascii.vim diff --git a/runtime/lang/menu_cs_cz.utf-8.vim b/runtime/lang/menu_cs_cz.utf-8.vim new file mode 100644 index 0000000..91a8ecc --- /dev/null +++ b/runtime/lang/menu_cs_cz.utf-8.vim @@ -0,0 +1,308 @@ +" Menu Translations: Czech (UTF-8) +" Maintainer: Jiri Sedlak +" Previous maintainer: Jiri Brezina +" Based on: menu.vim (2012-10-21) + +" Quit when menu translations have already been done. +if exists("did_menu_trans") + finish +endif + +let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim + +scriptencoding utf-8 + +" {{{ File menu +menutrans &File &Soubor +menutrans &Open\.\.\.:e &Otevřít\.\.\.:e +menutrans Sp&lit-Open\.\.\.:sp Otevřít\ v\ no&vém\ okně\.\.\.:sp +menutrans Open\ Tab\.\.\.:tabnew Otevřít\ tab\.\.\.:tabnew +menutrans &New:enew &Nový:enew +menutrans &Close:close &Zavřít:close +menutrans &Save:w &Uložit:w +menutrans Save\ &As\.\.\.:sav Uložit\ &jako\.\.\.:sav +if has("printer") || has("unix") + menutrans &Print &Tisk +endif +menutrans Sa&ve-Exit:wqa U&ložit\ a\ ukončit:wqa +menutrans E&xit:qa &Ukončit:qa + +if has("diff") + menutrans Split\ &Diff\ with\.\.\. Rozdělit\ okno\ -\ &Diff\.\.\. + menutrans Split\ Patched\ &By\.\.\. Rozdělit\ okno\ -\ &Patch\.\.\. +endif +" }}} + +" {{{ Edit menu +menutrans &Edit Úpr&avy +menutrans &Undou &Zpětu +menutrans &Redo^R Z&ruÅ¡it\ vrácení^R +menutrans Rep&eat\. &Opakovat\. +menutrans Cu&t"+x &Vyříznout"+x +menutrans &Copy"+y &Kopírovat"+y +menutrans &Paste"+gP V&ložit"+gP +menutrans Put\ &Before[p Vložit\ &před[p +menutrans Put\ &After]p Vloži&t\ za]p +if has("win32") || has("win16") + menutrans &Deletex &Smazatx +endif +menutrans &Select\ AllggVG Vy&brat\ vÅ¡eggVG +if has("win32") || has("win16") || has("gui_gtk") || has("gui_kde") || has("gui_motif") + menutrans &Find\.\.\. &Hledat\.\.\. + menutrans Find\ and\ Rep&lace\.\.\. &Nahradit\.\.\. +else + menutrans Find/ &Hledat/ + menutrans Find\ and\ Rep&lace:%s &Nahradit:%s + menutrans Find\ and\ Rep&lace:s &Nahradit:s +endif +menutrans Settings\ &Window Nastav&ení\ okna +" {{{2 Edit -1 +menutrans Startup\ &Settings Počáteční\ &nastavení +menutrans &Global\ Settings &Globální\ nastavení +menutrans Toggle\ Pattern\ &Highlight:set\ hls! &Přepnout\ zvýraznění\ vzoru:set\ hls! +menutrans Toggle\ &Ignore-case:set\ ic! Přepnout\ ignorování\ &VERZÁLEK:set\ ic! +menutrans Toggle\ &Showmatch:set\ sm! Přepnout\ &Showmatch\ \{\(\[\])\}:set\ sm! +menutrans &Context\ lines Zobrazit\ konte&xt\ kurzoru +menutrans &Virtual\ Edit Virtuální\ p&ozice\ kurzoru +menutrans Never Nikdy +menutrans Block\ Selection Výběr\ Bloku +menutrans Insert\ mode Insert\ mód +menutrans Block\ and\ Insert Blok\ a\ Insert +menutrans Always Vždycky +menutrans Toggle\ Insert\ &Mode:set\ im! Přepnout\ Insert\ mó&d:set\ im! +menutrans Toggle\ Vi\ C&ompatible:set\ cp! Přepnout\ kompatibilní\ režim\ s\ 'vi':set\ cp! +menutrans Search\ &Path\.\.\. Nastavit\ &cestu\ k\ prohledávání\.\.\. +menutrans Ta&g\ Files\.\.\. Ta&g\ soubory\.\.\. +menutrans Toggle\ &Toolbar Přepnout\ &Toolbar +menutrans Toggle\ &Bottom\ Scrollbar Př&epnout\ dolní\ rolovací\ liÅ¡tu +menutrans Toggle\ &Left\ Scrollbar Přepnout\ &levou\ rolovací\ liÅ¡tu +menutrans Toggle\ &Right\ Scrollbar Přepnout\ p&ravou\ rolovací\ liÅ¡tu +" {{{2 Edit -2 +menutrans F&ile\ Settings Nastavení\ so&uboru +menutrans Toggle\ Line\ &Numbering:set\ nu! Přepnout\ číslování\ řá&dků:set\ nu! +menutrans Toggle\ relati&ve\ Line\ Numbering:set\ rnu! Přepnout\ relativní\ číslování\ řá&dků:set\ rnu! +menutrans Toggle\ &List\ Mode:set\ list! Přepnout\ &List\ mód:set\ list! +menutrans Toggle\ Line\ &Wrap:set\ wrap! Přepnout\ zala&mování\ řádků:set\ wrap! +menutrans Toggle\ W&rap\ at\ word:set\ lbr! Přepnout\ zl&om\ ve\ slově:set\ lbr! +menutrans Toggle\ &expand-tab:set\ et! Přepnout\ &expand-tab:set\ et! +menutrans Toggle\ &auto-indent:set\ ai! Přepnout\ &auto-indent:set\ ai! +menutrans Toggle\ &C-indenting:set\ cin! Přepnout\ &C-indenting:set\ cin! +menutrans &Shiftwidth Nastav&it\ šířku\ od&sazení +menutrans Soft\ &Tabstop Nastavit\ Soft\ &Tabstop +menutrans Te&xt\ Width\.\.\. Šířka\ te&xtu\.\.\. +menutrans &File\ Format\.\.\. &Formát\ souboru\.\.\. +" {{{2 Edit -3 +menutrans C&olor\ Scheme Barevné\ s&chéma +menutrans &Keymap Klávesová\ m&apa +if has("win32") || has("win16") || has("gui_motif") || has("gui_gtk") || has("gui_kde") || has("gui_photon") || has("gui_mac") + menutrans Select\ Fo&nt\.\.\. Vybrat\ pís&mo\.\.\. +endif +" }}}1 + +" {{{ Programming menu +menutrans &Tools Nást&roje +menutrans &Jump\ to\ this\ tagg^] &Skočit\ na\ tagg^] +menutrans Jump\ &back^T Skočit\ &zpět^T +menutrans Build\ &Tags\ File &Vytvořit\ soubor\ tagů + +if has("spell") + menutrans &Spelling &Kontrola\ pravopisu + menutrans &Spell\ Check\ On &Zapnout\ kontrolu\ pravopisu + menutrans Spell\ Check\ &Off &Vypnout \kontrolu\ pravopisu + menutrans To\ &Next\ error]s &Další\ chyba]s + menutrans To\ &Previous\ error[s &Předchozí\ chyba[s + menutrans Suggest\ &Correctionsz= &Navrhnout\ opravyz= + menutrans &Repeat\ correction:spellrepall Zopakovat\ &opravu:spellrepall + menutrans Set\ language\ to\ "en" Nastavit\ jazyk\ na\ "en" + menutrans Set\ language\ to\ "en_au" Nastavit\ jazyk\ na\ "en_au" + menutrans Set\ language\ to\ "en_ca" Nastavit\ jazyk\ na\ "en_ca" + menutrans Set\ language\ to\ "en_gb" Nastavit\ jazyk\ na\ "en_gb" + menutrans Set\ language\ to\ "en_nz" Nastavit\ jazyk\ na\ "en_nz" + menutrans Set\ language\ to\ "en_us" Nastavit\ jazyk\ na\ "en_us" + menutrans &Find\ More\ Languages Nalézt\ další\ &jazyky + let g:menutrans_set_lang_to = "Nastavit jazyk na" +endif + +if has("Folding") + menutrans &Folding &Skládání + menutrans &Enable/Disable\ foldszi &Ano/Nezi + menutrans &View\ Cursor\ Linezv Zobrazit\ řádek\ &kurzoruzv + menutrans Vie&w\ Cursor\ Line\ onlyzMzx Zobrazit\ &pouze\ řádek\ kurzoru\ zMzx + menutrans C&lose\ more\ foldszm Složit\ &jednu\ úroveň\ skladůzm + menutrans &Close\ all\ foldszM Složit\ vÅ¡echny\ skladyzM + menutrans O&pen\ more\ foldszr Přidat\ jednu\ úroveň\ skladůzr + menutrans &Open\ all\ foldszR &Otevřít\ vÅ¡echny\ skladyzR + menutrans Fold\ Met&hod &Metoda\ skládání + menutrans M&anual &Ručně + menutrans I&ndent &Odsazení + menutrans E&xpression &Výraz + menutrans S&yntax &Syntaxe + menutrans &Diff &Rozdíly + menutrans Ma&rker &Značky + menutrans Create\ &Foldzf Vytvořit\ &skladzf + menutrans &Delete\ Foldzd Vymazat\ skla&dzd + menutrans Delete\ &All\ FoldszD Vymazat\ vÅ¡echny\ skladyzD + menutrans Fold\ col&umn\ width Sloupec\ zob&razení\ skladů +endif + +if has("diff") + menutrans &Update &Obnovit + menutrans &Get\ Block &Sejmout\ Blok + menutrans &Put\ Block &Vložit\ Blok +endif + +menutrans &Make:make &Make:make +menutrans &List\ Errors:cl Výpis\ &chyb:cl +menutrans L&ist\ Messages:cl! Výp&is\ zpráv:cl! +menutrans &Next\ Error:cn Další\ ch&yba:cn +menutrans &Previous\ Error:cp &Předchozí\ chyba:cp +menutrans &Older\ List:cold Sta&rší\ seznam:cold +menutrans N&ewer\ List:cnew N&ovější\ seznam:cnew +menutrans Error\ &Window Chybové\ o&kno +menutrans SeT\ Compiler Nas&tavení\ kompilátoru +menutrans &Update:cwin O&bnovit:cwin +menutrans &Open:copen &Otevřít:copen +menutrans &Close:cclose &Zavřít:cclose +menutrans Se&T\ Compiler N&astavit\ kompilátor + +menutrans &Convert\ to\ HEX:%!xxd Převést\ do\ Å¡estnáctkového\ formát&u:%!xxd +menutrans Conve&rt\ back:%!xxd\ -r Př&evést\ zpět:%!xxd\ -r +" }}} + +" {{{ Syntax menu +menutrans &Syntax Synta&xe +menutrans Set\ '&syntax'\ only Nastavit\ pouze\ 'synta&x' +menutrans Set\ '&filetype'\ too Nastavit\ také\ '&filetype' +menutrans &Off &Vypnout +menutrans &Manual &Ručně +menutrans A&utomatic A&utomaticky +menutrans on/off\ for\ &This\ file &Přepnout\ (pro\ tento\ soubor) +menutrans o&ff\ (this\ file) vyp&nout\ (pro\ tento\ soubor) +menutrans Co&lor\ test Test\ &barev +menutrans &Highlight\ test &Test\ zvýrazňování +menutrans &Convert\ to\ HTML Převést\ &do\ HTML +menutrans &Show\ filetypes\ in\ menu &Zobrazit\ výběr\ možností +" }}} + +" {{{ Menu Buffers +menutrans &Buffers &Buffery +menutrans &Refresh\ menu &Obnovit\ menu +menutrans &Delete Z&ruÅ¡it +menutrans &Alternate &Změnit +menutrans &Next &Další +menutrans &Previous &Předchozí +" }}} + +" {{{ Menu Window +menutrans &Window &Okna +menutrans &New^Wn &Nové^Wn +menutrans S&plit^Ws &Rozdělit^Ws +menutrans Sp&lit\ To\ #^W^^ Ro&zdělit\ na\ #^W^^ +menutrans Split\ &Vertically^Wv Rozdělit\ &vertikálně^Wv +menutrans Split\ File\ E&xplorer Rozdělit\ -\ File\ E&xplorer +menutrans Move\ &To &Přesun +menutrans &Top^WK &Nahoru^WK +menutrans &Bottom^WJ &Dolu^WJ +menutrans &Left\ side^WH &Vlevo^WH +menutrans &Right\ side^WL Vp&ravo^WL + +menutrans &Close^Wc Zavří&t^Wc +menutrans Close\ &Other(s)^Wo Zavřít\ &ostatní^Wo +menutrans Ne&xt^Ww &Další^Ww +menutrans P&revious^WW &Předchozí^WW +menutrans &Equal\ Size^W= &Stejná\ výška^W= +menutrans &Max\ Height^W_ Maximální\ výš&ka^W_ +menutrans M&in\ Height^W1_ M&inimální\ výška^W1_ +menutrans Max\ &Width^W\| &Maximální\ šířka^W\| +menutrans Min\ Widt&h^W1\| Minimální\ šířk&a^W1\| +menutrans Rotate\ &Up^WR Rotovat\ na&horu^WR +menutrans Rotate\ &Down^Wr Rotovat\ &dolů^Wr + +" {{{ Help menu +menutrans &Help &Nápověda +menutrans &Overview &Přehled +menutrans &User\ Manual &Uživatelský\ Manuál +menutrans &How-to\ links Ho&wto +menutrans &GUI &Grafické\ rozhraní +menutrans &Credits &Autoři +menutrans Co&pying &Licenční\ politika +menutrans &Sponsor/Register Sponzorování/&Registrace +menutrans &Find\.\.\. &Hledat\.\.\. +menutrans O&rphans O&siřelé\ děti +menutrans &Version &Verze +menutrans &About &O\ aplikaci +" }}} + +" {{{ The popup menu +menutrans &Undo &Zpět +menutrans Cu&t &Vyříznout +menutrans &Copy &Kopírovat +menutrans &Paste &Vložit +menutrans &Delete &Smazat +menutrans Select\ Blockwise Vybrat\ blokově +menutrans Select\ &Word Vybrat\ &slovo +menutrans Select\ Pa&ragraph Vybrat\ &odstavec +menutrans Select\ &Sentence Vybrat\ vě&tu +menutrans Select\ &Line Vybrat\ &řádek +menutrans Select\ &Block Vybrat\ &blok +menutrans Select\ &All Vybrat\ &vÅ¡e +" }}} + +" {{{ The GUI toolbar +if has("toolbar") + if exists("*Do_toolbar_tmenu") + delfun Do_toolbar_tmenu + endif + fun Do_toolbar_tmenu() + tmenu ToolBar.Open Otevřít soubor + tmenu ToolBar.Save Uložit soubor + tmenu ToolBar.SaveAll Uložit vÅ¡echny soubory + if has("printer") || has("unix") + tmenu ToolBar.Print Tisk + endif + tmenu ToolBar.Undo Zpět + tmenu ToolBar.Redo ZruÅ¡it vrácení + tmenu ToolBar.Cut Vyříznout + tmenu ToolBar.Copy Kopírovat + tmenu ToolBar.Paste Vložit + tmenu ToolBar.Find Hledat... + tmenu ToolBar.FindNext Hledat další + tmenu ToolBar.FindPrev Hledat předchozí + tmenu ToolBar.Replace Nahradit... + if 0 " disabled; These are in the Windows menu + tmenu ToolBar.New Nové okno + tmenu ToolBar.WinSplit Rozdělit okno + tmenu ToolBar.WinMax Maximalizovat okno + tmenu ToolBar.WinMin Minimalizovat okno + tmenu ToolBar.WinClose Zavřít okno + endif + tmenu ToolBar.LoadSesn Načíst sezení + tmenu ToolBar.SaveSesn Uložit sezení + tmenu ToolBar.RunScript Spustit skript + tmenu ToolBar.Make Spustit make + tmenu ToolBar.Shell Spustit shell + tmenu ToolBar.RunCtags Spustit ctags + tmenu ToolBar.TagJump Skočit na tag pod kurzorem + tmenu ToolBar.Help Nápověda + tmenu ToolBar.FindHelp Hledat nápovědu k... + endfun +endif +" }}} + +" {{{ DIALOG TEXTS +let g:menutrans_no_file = "[Žádný soubor]" +let g:menutrans_help_dialog = "Zadejte hledaný příkaz nebo slovo:\n\n\tPřidejte i_ pro příkazy vkládacího režimu (např. i_CTRL-X)\n\tPřidejte c_ pro příkazy příkazové řádky (např. c_)\n\tPřidejte ' pro jméno volby (např. 'shiftwidth')" +let g:menutrans_path_dialog = "Zadejte cesty pro vyhledávání souborů. Jednotlivé cesty oddělte čárkou" +let g:menutrans_tags_dialog = "Zadejte jména souborů s tagy. Jména oddělte čárkami." +let g:menutrans_textwidth_dialog = "Zadejte délku řádku (0 pro zakázání formátování):" +let g:menutrans_fileformat_dialog = "Vyberte typ konce řádků" +" }}}" + +let &cpo = s:keepcpo +unlet s:keepcpo + + + +" vim:set foldmethod=marker expandtab tabstop=3 shiftwidth=3: diff --git a/runtime/lang/menu_czech_czech_republic.1250.vim b/runtime/lang/menu_czech_czech_republic.1250.vim index 4f21e89..f9c85d0 100644 --- a/runtime/lang/menu_czech_czech_republic.1250.vim +++ b/runtime/lang/menu_czech_czech_republic.1250.vim @@ -1,14 +1,16 @@ -" Menu Translations: Czech for MS-Windows -" Maintainer: Jiri Brezina -" vim:set foldmethod=marker: -" $Revision: 1.3 $ -" $Date: 2005/12/19 22:13:30 $ +" Menu Translations: Czech (CP1250) +" Maintainer: Jiri Sedlak +" Previous maintainer: Jiri Brezina +" Based on: menu.vim (2012-10-21) " Quit when menu translations have already been done. if exists("did_menu_trans") - finish + finish endif + let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding cp1250 @@ -16,15 +18,21 @@ scriptencoding cp1250 menutrans &File &Soubor menutrans &Open\.\.\.:e &Otevøít\.\.\.:e menutrans Sp&lit-Open\.\.\.:sp Otevøít\ v\ no&vém\ oknì\.\.\.:sp +menutrans Open\ Tab\.\.\.:tabnew Otevøít\ tab\.\.\.:tabnew menutrans &New:enew &Nový:enew menutrans &Close:close &Zavøít:close menutrans &Save:w &Uložit:w menutrans Save\ &As\.\.\.:sav Uložit\ &jako\.\.\.:sav -menutrans Split\ &Diff\ with\.\.\. Rozdìlit\ okno\ -\ &Diff\.\.\. -menutrans Split\ Patched\ &By\.\.\. Rozdìlit\ okno\ -\ &Patch\.\.\. -menutrans &Print &Tisk -menutrans Sa&ve-Exit:wqa U&ložit\ -\ Konec:wqa -menutrans E&xit:qa &Konec:qa +if has("printer") || has("unix") + menutrans &Print &Tisk +endif +menutrans Sa&ve-Exit:wqa U&ložit\ a\ ukonèit:wqa +menutrans E&xit:qa &Ukonèit:qa + +if has("diff") + menutrans Split\ &Diff\ with\.\.\. Rozdìlit\ okno\ -\ &Diff\.\.\. + menutrans Split\ Patched\ &By\.\.\. Rozdìlit\ okno\ -\ &Patch\.\.\. +endif " }}} " {{{ Edit menu @@ -37,24 +45,32 @@ menutrans &Copy"+y &Kop menutrans &Paste"+gP V&ložit"+gP menutrans Put\ &Before[p Vložit\ &pøed[p menutrans Put\ &After]p Vloži&t\ za]p -menutrans &Deletex &Smazatx +if has("win32") || has("win16") + menutrans &Deletex &Smazatx +endif menutrans &Select\ AllggVG Vy&brat\ všeggVG -menutrans &Find\.\.\. &Hledat\.\.\. -menutrans Find\ and\ Rep&lace\.\.\. &Nahradit\.\.\. -menutrans Options\.\.\. Volb&y\.\.\. +if has("win32") || has("win16") || has("gui_gtk") || has("gui_kde") || has("gui_motif") + menutrans &Find\.\.\. &Hledat\.\.\. + menutrans Find\ and\ Rep&lace\.\.\. &Nahradit\.\.\. +else + menutrans Find/ &Hledat/ + menutrans Find\ and\ Rep&lace:%s &Nahradit:%s + menutrans Find\ and\ Rep&lace:s &Nahradit:s +endif menutrans Settings\ &Window Nastav&ení\ okna - " {{{2 Edit -1 +" {{{2 Edit -1 +menutrans Startup\ &Settings Poèáteèní\ &nastavení menutrans &Global\ Settings &Globální\ nastavení menutrans Toggle\ Pattern\ &Highlight:set\ hls! &Pøepnout\ zvýraznìní\ vzoru:set\ hls! menutrans Toggle\ &Ignore-case:set\ ic! Pøepnout\ ignorování\ &VERZÁLEK:set\ ic! menutrans Toggle\ &Showmatch:set\ sm! Pøepnout\ &Showmatch\ \{\(\[\])\}:set\ sm! menutrans &Context\ lines Zobrazit\ konte&xt\ kurzoru menutrans &Virtual\ Edit Virtuální\ p&ozice\ kurzoru - menutrans Never Nikdy - menutrans Block\ Selection Výbìr\ Bloku - menutrans Insert\ mode Insert\ mód - menutrans Block\ and\ Insert Blok\ a\ Insert - menutrans Always Vždycky +menutrans Never Nikdy +menutrans Block\ Selection Výbìr\ Bloku +menutrans Insert\ mode Insert\ mód +menutrans Block\ and\ Insert Blok\ a\ Insert +menutrans Always Vždycky menutrans Toggle\ Insert\ &Mode:set\ im! Pøepnout\ Insert\ mó&d:set\ im! menutrans Toggle\ Vi\ C&ompatible:set\ cp! Pøepnout\ kompatibilní\ režim\ s\ 'vi':set\ cp! menutrans Search\ &Path\.\.\. Nastavit\ &cestu\ k\ prohledávání\.\.\. @@ -63,9 +79,10 @@ menutrans Toggle\ &Toolbar P menutrans Toggle\ &Bottom\ Scrollbar Pø&epnout\ dolní\ rolovací\ lištu menutrans Toggle\ &Left\ Scrollbar Pøepnout\ &levou\ rolovací\ lištu menutrans Toggle\ &Right\ Scrollbar Pøepnout\ p&ravou\ rolovací\ lištu - " {{{2 Edit -2 +" {{{2 Edit -2 menutrans F&ile\ Settings Nastavení\ so&uboru menutrans Toggle\ Line\ &Numbering:set\ nu! Pøepnout\ èíslování\ øá&dkù:set\ nu! +menutrans Toggle\ relati&ve\ Line\ Numbering:set\ rnu! Pøepnout\ relativní\ èíslování\ øá&dkù:set\ rnu! menutrans Toggle\ &List\ Mode:set\ list! Pøepnout\ &List\ mód:set\ list! menutrans Toggle\ Line\ &Wrap:set\ wrap! Pøepnout\ zala&mování\ øádkù:set\ wrap! menutrans Toggle\ W&rap\ at\ word:set\ lbr! Pøepnout\ zl&om\ ve\ slovì:set\ lbr! @@ -76,10 +93,12 @@ menutrans &Shiftwidth Nastav&it\ menutrans Soft\ &Tabstop Nastavit\ Soft\ &Tabstop menutrans Te&xt\ Width\.\.\. Šíøka\ te&xtu\.\.\. menutrans &File\ Format\.\.\. &Formát\ souboru\.\.\. - " {{{2 Edit -3 +" {{{2 Edit -3 menutrans C&olor\ Scheme Barevné\ s&chéma menutrans &Keymap Klávesová\ m&apa -menutrans Select\ Fo&nt\.\.\. Vybrat\ pís&mo\.\.\. +if has("win32") || has("win16") || has("gui_motif") || has("gui_gtk") || has("gui_kde") || has("gui_photon") || has("gui_mac") + menutrans Select\ Fo&nt\.\.\. Vybrat\ pís&mo\.\.\. +endif " }}}1 " {{{ Programming menu @@ -88,46 +107,52 @@ menutrans &Jump\ to\ this\ tagg^] &Sko menutrans Jump\ &back^T Skoèit\ &zpìt^T menutrans Build\ &Tags\ File &Vytvoøit\ soubor\ tagù -menutrans &Spelling &Kontrola\ pravopisu -menutrans &Spell\ Check\ On Kontrola\ pravopisu\ &zapnuta -menutrans Spell\ Check\ &Off Kontrola\ pravopisu\ &vypnuta -menutrans To\ Next\ error]s &Další\ chyba]s -menutrans To\ Previous\ error[s &Pøedchozí\ chyba[s -menutrans Suggest\ Correctionsz? &Návrh\ opravz? -menutrans Repeat\ correction:spellrepall Zopakovat\ &opravu:spellrepall -menutrans Set\ language\ to\ "en" Nastav\ jazyk\ na\ "en" -menutrans Set\ language\ to\ "en_au" Nastav\ jazyk\ na\ "en_au" -menutrans Set\ language\ to\ "en_ca" Nastav\ jazyk\ na\ "en_ca" -menutrans Set\ language\ to\ "en_gb" Nastav\ jazyk\ na\ "en_gb" -menutrans Set\ language\ to\ "en_nz" Nastav\ jazyk\ na\ "en_nz" -menutrans Set\ language\ to\ "en_us" Nastav\ jazyk\ na\ "en_us" -menutrans Set\ language\ to\ "cz" Nastav\ jazyk\ na\ "cz" -menutrans Set\ language\ to\ "cs_cz" Nastav\ jazyk\ na\ "cs_cz" -menutrans &Find\ More\ Languages Nalézt\ další\ &jazyky +if has("spell") + menutrans &Spelling &Kontrola\ pravopisu + menutrans &Spell\ Check\ On &Zapnout\ kontrolu\ pravopisu + menutrans Spell\ Check\ &Off &Vypnout \kontrolu\ pravopisu + menutrans To\ &Next\ error]s &Další\ chyba]s + menutrans To\ &Previous\ error[s &Pøedchozí\ chyba[s + menutrans Suggest\ &Correctionsz= &Navrhnout\ opravyz= + menutrans &Repeat\ correction:spellrepall Zopakovat\ &opravu:spellrepall + menutrans Set\ language\ to\ "en" Nastavit\ jazyk\ na\ "en" + menutrans Set\ language\ to\ "en_au" Nastavit\ jazyk\ na\ "en_au" + menutrans Set\ language\ to\ "en_ca" Nastavit\ jazyk\ na\ "en_ca" + menutrans Set\ language\ to\ "en_gb" Nastavit\ jazyk\ na\ "en_gb" + menutrans Set\ language\ to\ "en_nz" Nastavit\ jazyk\ na\ "en_nz" + menutrans Set\ language\ to\ "en_us" Nastavit\ jazyk\ na\ "en_us" + menutrans &Find\ More\ Languages Nalézt\ další\ &jazyky + let g:menutrans_set_lang_to = "Nastavit jazyk na" +endif + +if has("Folding") + menutrans &Folding &Skládání + menutrans &Enable/Disable\ foldszi &Ano/Nezi + menutrans &View\ Cursor\ Linezv Zobrazit\ øádek\ &kurzoruzv + menutrans Vie&w\ Cursor\ Line\ onlyzMzx Zobrazit\ &pouze\ øádek\ kurzoru\ zMzx + menutrans C&lose\ more\ foldszm Složit\ &jednu\ úroveò\ skladùzm + menutrans &Close\ all\ foldszM Složit\ všechny\ skladyzM + menutrans O&pen\ more\ foldszr Pøidat\ jednu\ úroveò\ skladùzr + menutrans &Open\ all\ foldszR &Otevøít\ všechny\ skladyzR + menutrans Fold\ Met&hod &Metoda\ skládání + menutrans M&anual &Ruènì + menutrans I&ndent &Odsazení + menutrans E&xpression &Výraz + menutrans S&yntax &Syntaxe + menutrans &Diff &Rozdíly + menutrans Ma&rker &Znaèky + menutrans Create\ &Foldzf Vytvoøit\ &skladzf + menutrans &Delete\ Foldzd Vymazat\ skla&dzd + menutrans Delete\ &All\ FoldszD Vymazat\ všechny\ skladyzD + menutrans Fold\ col&umn\ width Sloupec\ zob&razení\ skladù +endif -menutrans &Folding &Foldy -menutrans &Enable/Disable\ foldszi &Ano/Nezi -menutrans &View\ Cursor\ Linezv &Zobrazit\ øádek\ kurzoruzv -menutrans Vie&w\ Cursor\ Line\ onlyzMzx Zo&brazit\ pouze\ øádek\ kurzoru\ zMzx -menutrans C&lose\ more\ foldszm &Vyjmout\ jednu\ úroveò\ foldùzm -menutrans &Close\ all\ foldszM Zavøí&t\ všechny\ foldyzM -menutrans O&pen\ more\ foldszr Pøidat\ jedn&u\ úroveò\ foldùzr -menutrans &Open\ all\ foldszR &Otevøít\ všechny\ foldyzR -menutrans Fold\ Met&hod Metoda\ &skládání - "menutrans M&anual &Ruènì - "menutrans I&ndent &Odsazení - "menutrans E&xpression &Výraz - "menutrans S&yntax &Syntax - "menutrans &Diff &Diff - "menutrans Ma&rker Ma&rker -menutrans Create\ &Foldzf Vytvoøit\ &foldzf -menutrans &Delete\ Foldzd Vymazat\ fol&dzd -menutrans Delete\ &All\ FoldszD V&ymazat\ všechny\ foldyzD -menutrans Fold\ col&umn\ width Sloupec\ zob&razení\ foldù +if has("diff") + menutrans &Update &Obnovit + menutrans &Get\ Block &Sejmout\ Blok + menutrans &Put\ Block &Vložit\ Blok +endif -menutrans &Update &Obnovit -menutrans &Get\ Block &Sejmout\ Blok -menutrans &Put\ Block &Vložit\ Blok menutrans &Make:make &Make:make menutrans &List\ Errors:cl Výpis\ &chyb:cl menutrans L&ist\ Messages:cl! Výp&is\ zpráv:cl! @@ -140,7 +165,7 @@ menutrans SeT\ Compiler Nas&taven menutrans &Update:cwin O&bnovit:cwin menutrans &Open:copen &Otevøít:copen menutrans &Close:cclose &Zavøít:cclose -menutrans &Set\ Compiler N&astavit\ kompilátor +menutrans Se&T\ Compiler N&astavit\ kompilátor menutrans &Convert\ to\ HEX:%!xxd Pøevést\ do\ šestnáctkového\ formát&u:%!xxd menutrans Conve&rt\ back:%!xxd\ -r Pø&evést\ zpìt:%!xxd\ -r @@ -168,7 +193,6 @@ menutrans &Delete Z&ru menutrans &Alternate &Zmìnit menutrans &Next &Další menutrans &Previous &Pøedchozí -menutrans [No\ File] [Žádný\ soubor] " }}} " {{{ Menu Window @@ -219,6 +243,8 @@ menutrans &Paste &Vlo menutrans &Delete &Smazat menutrans Select\ Blockwise Vybrat\ blokovì menutrans Select\ &Word Vybrat\ &slovo +menutrans Select\ Pa&ragraph Vybrat\ &odstavec +menutrans Select\ &Sentence Vybrat\ vì&tu menutrans Select\ &Line Vybrat\ &øádek menutrans Select\ &Block Vybrat\ &blok menutrans Select\ &All Vybrat\ &vše @@ -226,39 +252,57 @@ menutrans Select\ &All Vybrat\ &v " {{{ The GUI toolbar if has("toolbar") - if exists("*Do_toolbar_tmenu") - delfun Do_toolbar_tmenu - endif - fun Do_toolbar_tmenu() - tmenu ToolBar.Open Otevøít soubor - tmenu ToolBar.Save Uložit soubor - tmenu ToolBar.SaveAll Uložit všechny soubory - tmenu ToolBar.Print Tisk - tmenu ToolBar.Undo Zpìt - tmenu ToolBar.Redo Zrušit vrácení - tmenu ToolBar.Cut Vyøíznout - tmenu ToolBar.Copy Kopírovat - tmenu ToolBar.Paste Vložit - tmenu ToolBar.Find Hledat... - tmenu ToolBar.FindNext Hledat další - tmenu ToolBar.FindPrev Hledat pøedchozí - tmenu ToolBar.Replace Nahradit... - if 0 " disabled; These are in the Windows menu - tmenu ToolBar.New Nové okno - tmenu ToolBar.WinSplit Rozdìlit okno - tmenu ToolBar.WinMax Maximalizovat okno - tmenu ToolBar.WinMin Minimalizovat okno - tmenu ToolBar.WinClose Zavøít okno - endif - tmenu ToolBar.LoadSesn Naèíst sezení - tmenu ToolBar.SaveSesn Uložit sezení - tmenu ToolBar.RunScript Spustit skript - tmenu ToolBar.Make Spustit make - tmenu ToolBar.Shell Spustit shell - tmenu ToolBar.RunCtags Spustit ctags - tmenu ToolBar.TagJump Skoèit na tag pod kurzorem - tmenu ToolBar.Help Nápovìda - tmenu ToolBar.FindHelp Hledat nápovìdu k... - endfun + if exists("*Do_toolbar_tmenu") + delfun Do_toolbar_tmenu + endif + fun Do_toolbar_tmenu() + tmenu ToolBar.Open Otevøít soubor + tmenu ToolBar.Save Uložit soubor + tmenu ToolBar.SaveAll Uložit všechny soubory + if has("printer") || has("unix") + tmenu ToolBar.Print Tisk + endif + tmenu ToolBar.Undo Zpìt + tmenu ToolBar.Redo Zrušit vrácení + tmenu ToolBar.Cut Vyøíznout + tmenu ToolBar.Copy Kopírovat + tmenu ToolBar.Paste Vložit + tmenu ToolBar.Find Hledat... + tmenu ToolBar.FindNext Hledat další + tmenu ToolBar.FindPrev Hledat pøedchozí + tmenu ToolBar.Replace Nahradit... + if 0 " disabled; These are in the Windows menu + tmenu ToolBar.New Nové okno + tmenu ToolBar.WinSplit Rozdìlit okno + tmenu ToolBar.WinMax Maximalizovat okno + tmenu ToolBar.WinMin Minimalizovat okno + tmenu ToolBar.WinClose Zavøít okno + endif + tmenu ToolBar.LoadSesn Naèíst sezení + tmenu ToolBar.SaveSesn Uložit sezení + tmenu ToolBar.RunScript Spustit skript + tmenu ToolBar.Make Spustit make + tmenu ToolBar.Shell Spustit shell + tmenu ToolBar.RunCtags Spustit ctags + tmenu ToolBar.TagJump Skoèit na tag pod kurzorem + tmenu ToolBar.Help Nápovìda + tmenu ToolBar.FindHelp Hledat nápovìdu k... + endfun endif " }}} + +" {{{ DIALOG TEXTS +let g:menutrans_no_file = "[Žádný soubor]" +let g:menutrans_help_dialog = "Zadejte hledaný pøíkaz nebo slovo:\n\n\tPøidejte i_ pro pøíkazy vkládacího režimu (napø. i_CTRL-X)\n\tPøidejte c_ pro pøíkazy pøíkazové øádky (napø. c_)\n\tPøidejte ' pro jméno volby (napø. 'shiftwidth')" +let g:menutrans_path_dialog = "Zadejte cesty pro vyhledávání souborù. Jednotlivé cesty oddìlte èárkou" +let g:menutrans_tags_dialog = "Zadejte jména souborù s tagy. Jména oddìlte èárkami." +let g:menutrans_textwidth_dialog = "Zadejte délku øádku (0 pro zakázání formátování):" +let g:menutrans_fileformat_dialog = "Vyberte typ konce øádkù" +" }}}" + +let &cpo = s:keepcpo +unlet s:keepcpo + + + +" vim:set foldmethod=marker expandtab tabstop=3 shiftwidth=3: diff --git a/runtime/lang/menu_czech_czech_republic.ascii.vim b/runtime/lang/menu_czech_czech_republic.ascii.vim index f2faec9..1c4fb3e 100644 --- a/runtime/lang/menu_czech_czech_republic.ascii.vim +++ b/runtime/lang/menu_czech_czech_republic.ascii.vim @@ -1,30 +1,38 @@ -" Menu Translations: Czech for systems without localization -" Maintainer: Jiri Brezina -" vim:set foldmethod=marker: -" $Revision: 1.3 $ -" $Date: 2005/12/19 22:06:56 $ +" Menu Translations: Czech (latin1 - w/o diacritics) +" Maintainer: Jiri Sedlak +" Previous maintainer: Jiri Brezina +" Based on: menu.vim (2012-10-21) " Quit when menu translations have already been done. if exists("did_menu_trans") - finish + finish endif -let did_menu_trans = 1 +let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim +scriptencoding latin1 " {{{ File menu menutrans &File &Soubor menutrans &Open\.\.\.:e &Otevrit\.\.\.:e menutrans Sp&lit-Open\.\.\.:sp Otevrit\ v\ no&vem\ okne\.\.\.:sp +menutrans Open\ Tab\.\.\.:tabnew Otevrit\ tab\.\.\.:tabnew menutrans &New:enew &Novy:enew menutrans &Close:close &Zavrit:close menutrans &Save:w &Ulozit:w menutrans Save\ &As\.\.\.:sav Ulozit\ &jako\.\.\.:sav -menutrans Split\ &Diff\ with\.\.\. Rozdelit\ okno\ -\ &Diff\.\.\. -menutrans Split\ Patched\ &By\.\.\. Rozdelit\ okno\ -\ &Patch\.\.\. -menutrans &Print &Tisk -menutrans Sa&ve-Exit:wqa U&lozit\ -\ Konec:wqa -menutrans E&xit:qa &Konec:qa +if has("printer") || has("unix") + menutrans &Print &Tisk +endif +menutrans Sa&ve-Exit:wqa U&lozit\ a\ ukoncit:wqa +menutrans E&xit:qa &Ukoncit:qa + +if has("diff") + menutrans Split\ &Diff\ with\.\.\. Rozdelit\ okno\ -\ &Diff\.\.\. + menutrans Split\ Patched\ &By\.\.\. Rozdelit\ okno\ -\ &Patch\.\.\. +endif " }}} " {{{ Edit menu @@ -37,24 +45,32 @@ menutrans &Copy"+y &Kopirovat"+y menutrans &Paste"+gP V&lozit"+gP menutrans Put\ &Before[p Vlozit\ &pred[p menutrans Put\ &After]p Vlozi&t\ za]p -menutrans &Deletex &Smazatx +if has("win32") || has("win16") + menutrans &Deletex &Smazatx +endif menutrans &Select\ AllggVG Vy&brat\ vseggVG -menutrans &Find\.\.\. &Hledat\.\.\. -menutrans Find\ and\ Rep&lace\.\.\. &Nahradit\.\.\. -menutrans Options\.\.\. Volb&y\.\.\. +if has("win32") || has("win16") || has("gui_gtk") || has("gui_kde") || has("gui_motif") + menutrans &Find\.\.\. &Hledat\.\.\. + menutrans Find\ and\ Rep&lace\.\.\. &Nahradit\.\.\. +else + menutrans Find/ &Hledat/ + menutrans Find\ and\ Rep&lace:%s &Nahradit:%s + menutrans Find\ and\ Rep&lace:s &Nahradit:s +endif menutrans Settings\ &Window Nastav&eni\ okna - " {{{2 Edit -1 +" {{{2 Edit -1 +menutrans Startup\ &Settings Pocatecni\ &nastaveni menutrans &Global\ Settings &Globalni\ nastaveni menutrans Toggle\ Pattern\ &Highlight:set\ hls! &Prepnout\ zvyrazneni\ vzoru:set\ hls! menutrans Toggle\ &Ignore-case:set\ ic! Prepnout\ ignorovani\ &VERZALEK:set\ ic! menutrans Toggle\ &Showmatch:set\ sm! Prepnout\ &Showmatch\ \{\(\[\])\}:set\ sm! menutrans &Context\ lines Zobrazit\ konte&xt\ kurzoru menutrans &Virtual\ Edit Virtualni\ p&ozice\ kurzoru - menutrans Never Nikdy - menutrans Block\ Selection Vyber\ Bloku - menutrans Insert\ mode Insert\ mod - menutrans Block\ and\ Insert Blok\ a\ Insert - menutrans Always Vzdycky +menutrans Never Nikdy +menutrans Block\ Selection Vyber\ Bloku +menutrans Insert\ mode Insert\ mod +menutrans Block\ and\ Insert Blok\ a\ Insert +menutrans Always Vzdycky menutrans Toggle\ Insert\ &Mode:set\ im! Prepnout\ Insert\ mo&d:set\ im! menutrans Toggle\ Vi\ C&ompatible:set\ cp! Prepnout\ kompatibilni\ rezim\ s\ 'vi':set\ cp! menutrans Search\ &Path\.\.\. Nastavit\ &cestu\ k\ prohledavani\.\.\. @@ -63,9 +79,10 @@ menutrans Toggle\ &Toolbar Prepnout\ &Toolbar menutrans Toggle\ &Bottom\ Scrollbar Pr&epnout\ dolni\ rolovaci\ listu menutrans Toggle\ &Left\ Scrollbar Prepnout\ &levou\ rolovaci\ listu menutrans Toggle\ &Right\ Scrollbar Prepnout\ p&ravou\ rolovaci\ listu - " {{{2 Edit -2 +" {{{2 Edit -2 menutrans F&ile\ Settings Nastaveni\ so&uboru menutrans Toggle\ Line\ &Numbering:set\ nu! Prepnout\ cislovani\ ra&dku:set\ nu! +menutrans Toggle\ relati&ve\ Line\ Numbering:set\ rnu! Prepnout\ relativni\ cislovani\ ra&dku:set\ rnu! menutrans Toggle\ &List\ Mode:set\ list! Prepnout\ &List\ mod:set\ list! menutrans Toggle\ Line\ &Wrap:set\ wrap! Prepnout\ zala&movani\ radku:set\ wrap! menutrans Toggle\ W&rap\ at\ word:set\ lbr! Prepnout\ zl&om\ ve\ slove:set\ lbr! @@ -76,10 +93,12 @@ menutrans &Shiftwidth Nastav&it\ sirku\ od&sazeni menutrans Soft\ &Tabstop Nastavit\ Soft\ &Tabstop menutrans Te&xt\ Width\.\.\. Sirka\ te&xtu\.\.\. menutrans &File\ Format\.\.\. &Format\ souboru\.\.\. - " {{{2 Edit -3 +" {{{2 Edit -3 menutrans C&olor\ Scheme Barevne\ s&chema menutrans &Keymap Klavesova\ m&apa -menutrans Select\ Fo&nt\.\.\. Vybrat\ pis&mo\.\.\. +if has("win32") || has("win16") || has("gui_motif") || has("gui_gtk") || has("gui_kde") || has("gui_photon") || has("gui_mac") + menutrans Select\ Fo&nt\.\.\. Vybrat\ pis&mo\.\.\. +endif " }}}1 " {{{ Programming menu @@ -88,46 +107,52 @@ menutrans &Jump\ to\ this\ tagg^] &Skocit\ na\ tagg^] menutrans Jump\ &back^T Skocit\ &zpet^T menutrans Build\ &Tags\ File &Vytvorit\ soubor\ tagu -menutrans &Spelling &Kontrola\ pravopisu -menutrans &Spell\ Check\ On Kontrola\ pravopisu\ &zapnuta -menutrans Spell\ Check\ &Off Kontrola\ pravopisu\ &vypnuta -menutrans To\ Next\ error]s &Dalsi\ chyba]s -menutrans To\ Previous\ error[s &Predchozi\ chyba[s -menutrans Suggest\ Correctionsz? &Navrh\ opravz? -menutrans Repeat\ correction:spellrepall Zopakovat\ &opravu:spellrepall -menutrans Set\ language\ to\ "en" Nastav\ jazyk\ na\ "en" -menutrans Set\ language\ to\ "en_au" Nastav\ jazyk\ na\ "en_au" -menutrans Set\ language\ to\ "en_ca" Nastav\ jazyk\ na\ "en_ca" -menutrans Set\ language\ to\ "en_gb" Nastav\ jazyk\ na\ "en_gb" -menutrans Set\ language\ to\ "en_nz" Nastav\ jazyk\ na\ "en_nz" -menutrans Set\ language\ to\ "en_us" Nastav\ jazyk\ na\ "en_us" -menutrans Set\ language\ to\ "cz" Nastav\ jazyk\ na\ "cz" -menutrans Set\ language\ to\ "cs_cz" Nastav\ jazyk\ na\ "cs_cz" -menutrans &Find\ More\ Languages Nalezt\ dalsi\ &jazyky +if has("spell") + menutrans &Spelling &Kontrola\ pravopisu + menutrans &Spell\ Check\ On &Zapnout\ kontrolu\ pravopisu + menutrans Spell\ Check\ &Off &Vypnout \kontrolu\ pravopisu + menutrans To\ &Next\ error]s &Dalsi\ chyba]s + menutrans To\ &Previous\ error[s &Predchozi\ chyba[s + menutrans Suggest\ &Correctionsz= &Navrhnout\ opravyz= + menutrans &Repeat\ correction:spellrepall Zopakovat\ &opravu:spellrepall + menutrans Set\ language\ to\ "en" Nastavit\ jazyk\ na\ "en" + menutrans Set\ language\ to\ "en_au" Nastavit\ jazyk\ na\ "en_au" + menutrans Set\ language\ to\ "en_ca" Nastavit\ jazyk\ na\ "en_ca" + menutrans Set\ language\ to\ "en_gb" Nastavit\ jazyk\ na\ "en_gb" + menutrans Set\ language\ to\ "en_nz" Nastavit\ jazyk\ na\ "en_nz" + menutrans Set\ language\ to\ "en_us" Nastavit\ jazyk\ na\ "en_us" + menutrans &Find\ More\ Languages Nalezt\ dalsi\ &jazyky + let g:menutrans_set_lang_to = "Nastavit jazyk na" +endif -menutrans &Folding &Foldy -menutrans &Enable/Disable\ foldszi &Ano/Nezi -menutrans &View\ Cursor\ Linezv &Zobrazit\ radek\ kurzoruzv -menutrans Vie&w\ Cursor\ Line\ onlyzMzx Zo&brazit\ pouze\ radek\ kurzoru\ zMzx -menutrans C&lose\ more\ foldszm &Vyjmout\ jednu\ uroven\ folduzm -menutrans &Close\ all\ foldszM Zavri&t\ vsechny\ foldyzM -menutrans O&pen\ more\ foldszr Pridat\ jedn&u\ uroven\ folduzr -menutrans &Open\ all\ foldszR &Otevrit\ vsechny\ foldyzR -menutrans Fold\ Met&hod Metoda\ &skladani - "menutrans M&anual &Rucne - "menutrans I&ndent &Odsazeni - "menutrans E&xpression &Vyraz - "menutrans S&yntax &Syntax - "menutrans &Diff &Diff - "menutrans Ma&rker Ma&rker -menutrans Create\ &Foldzf Vytvorit\ &foldzf -menutrans &Delete\ Foldzd Vymazat\ fol&dzd -menutrans Delete\ &All\ FoldszD V&ymazat\ vsechny\ foldyzD -menutrans Fold\ col&umn\ width Sloupec\ zob&razeni\ foldu +if has("Folding") + menutrans &Folding &Skladani + menutrans &Enable/Disable\ foldszi &Ano/Nezi + menutrans &View\ Cursor\ Linezv Zobrazit\ radek\ &kurzoruzv + menutrans Vie&w\ Cursor\ Line\ onlyzMzx Zobrazit\ &pouze\ radek\ kurzoru\ zMzx + menutrans C&lose\ more\ foldszm Slozit\ &jednu\ uroven\ skladuzm + menutrans &Close\ all\ foldszM Slozit\ vsechny\ skladyzM + menutrans O&pen\ more\ foldszr Pridat\ jednu\ uroven\ skladuzr + menutrans &Open\ all\ foldszR &Otevrit\ vsechny\ skladyzR + menutrans Fold\ Met&hod &Metoda\ skladani + menutrans M&anual &Rucne + menutrans I&ndent &Odsazeni + menutrans E&xpression &Vyraz + menutrans S&yntax &Syntaxe + menutrans &Diff &Rozdily + menutrans Ma&rker &Znacky + menutrans Create\ &Foldzf Vytvorit\ &skladzf + menutrans &Delete\ Foldzd Vymazat\ skla&dzd + menutrans Delete\ &All\ FoldszD Vymazat\ vsechny\ skladyzD + menutrans Fold\ col&umn\ width Sloupec\ zob&razeni\ skladu +endif + +if has("diff") + menutrans &Update &Obnovit + menutrans &Get\ Block &Sejmout\ Blok + menutrans &Put\ Block &Vlozit\ Blok +endif -menutrans &Update &Obnovit -menutrans &Get\ Block &Sejmout\ Blok -menutrans &Put\ Block &Vlozit\ Blok menutrans &Make:make &Make:make menutrans &List\ Errors:cl Vypis\ &chyb:cl menutrans L&ist\ Messages:cl! Vyp&is\ zprav:cl! @@ -140,7 +165,7 @@ menutrans SeT\ Compiler Nas&taveni\ kompilatoru menutrans &Update:cwin O&bnovit:cwin menutrans &Open:copen &Otevrit:copen menutrans &Close:cclose &Zavrit:cclose -menutrans &Set\ Compiler N&astavit\ kompilator +menutrans Se&T\ Compiler N&astavit\ kompilator menutrans &Convert\ to\ HEX:%!xxd Prevest\ do\ sestnactkoveho\ format&u:%!xxd menutrans Conve&rt\ back:%!xxd\ -r Pr&evest\ zpet:%!xxd\ -r @@ -168,7 +193,6 @@ menutrans &Delete Z&rusit menutrans &Alternate &Zmenit menutrans &Next &Dalsi menutrans &Previous &Predchozi -menutrans [No\ File] [Zadny\ soubor] " }}} " {{{ Menu Window @@ -219,6 +243,8 @@ menutrans &Paste &Vlozit menutrans &Delete &Smazat menutrans Select\ Blockwise Vybrat\ blokove menutrans Select\ &Word Vybrat\ &slovo +menutrans Select\ Pa&ragraph Vybrat\ &odstavec +menutrans Select\ &Sentence Vybrat\ ve&tu menutrans Select\ &Line Vybrat\ &radek menutrans Select\ &Block Vybrat\ &blok menutrans Select\ &All Vybrat\ &vse @@ -226,39 +252,57 @@ menutrans Select\ &All Vybrat\ &vse " {{{ The GUI toolbar if has("toolbar") - if exists("*Do_toolbar_tmenu") - delfun Do_toolbar_tmenu - endif - fun Do_toolbar_tmenu() - tmenu ToolBar.Open Otevrit soubor - tmenu ToolBar.Save Ulozit soubor - tmenu ToolBar.SaveAll Ulozit vsechny soubory - tmenu ToolBar.Print Tisk - tmenu ToolBar.Undo Zpet - tmenu ToolBar.Redo Zrusit vraceni - tmenu ToolBar.Cut Vyriznout - tmenu ToolBar.Copy Kopirovat - tmenu ToolBar.Paste Vlozit - tmenu ToolBar.Find Hledat... - tmenu ToolBar.FindNext Hledat dalsi - tmenu ToolBar.FindPrev Hledat predchozi - tmenu ToolBar.Replace Nahradit... - if 0 " disabled; These are in the Windows menu - tmenu ToolBar.New Nove okno - tmenu ToolBar.WinSplit Rozdelit okno - tmenu ToolBar.WinMax Maximalizovat okno - tmenu ToolBar.WinMin Minimalizovat okno - tmenu ToolBar.WinClose Zavrit okno - endif - tmenu ToolBar.LoadSesn Nacist sezeni - tmenu ToolBar.SaveSesn Ulozit sezeni - tmenu ToolBar.RunScript Spustit skript - tmenu ToolBar.Make Spustit make - tmenu ToolBar.Shell Spustit shell - tmenu ToolBar.RunCtags Spustit ctags - tmenu ToolBar.TagJump Skocit na tag pod kurzorem - tmenu ToolBar.Help Napoveda - tmenu ToolBar.FindHelp Hledat napovedu k... - endfun + if exists("*Do_toolbar_tmenu") + delfun Do_toolbar_tmenu + endif + fun Do_toolbar_tmenu() + tmenu ToolBar.Open Otevrit soubor + tmenu ToolBar.Save Ulozit soubor + tmenu ToolBar.SaveAll Ulozit vsechny soubory + if has("printer") || has("unix") + tmenu ToolBar.Print Tisk + endif + tmenu ToolBar.Undo Zpet + tmenu ToolBar.Redo Zrusit vraceni + tmenu ToolBar.Cut Vyriznout + tmenu ToolBar.Copy Kopirovat + tmenu ToolBar.Paste Vlozit + tmenu ToolBar.Find Hledat... + tmenu ToolBar.FindNext Hledat dalsi + tmenu ToolBar.FindPrev Hledat predchozi + tmenu ToolBar.Replace Nahradit... + if 0 " disabled; These are in the Windows menu + tmenu ToolBar.New Nove okno + tmenu ToolBar.WinSplit Rozdelit okno + tmenu ToolBar.WinMax Maximalizovat okno + tmenu ToolBar.WinMin Minimalizovat okno + tmenu ToolBar.WinClose Zavrit okno + endif + tmenu ToolBar.LoadSesn Nacist sezeni + tmenu ToolBar.SaveSesn Ulozit sezeni + tmenu ToolBar.RunScript Spustit skript + tmenu ToolBar.Make Spustit make + tmenu ToolBar.Shell Spustit shell + tmenu ToolBar.RunCtags Spustit ctags + tmenu ToolBar.TagJump Skocit na tag pod kurzorem + tmenu ToolBar.Help Napoveda + tmenu ToolBar.FindHelp Hledat napovedu k... + endfun endif " }}} + +" {{{ DIALOG TEXTS +let g:menutrans_no_file = "[Zadny soubor]" +let g:menutrans_help_dialog = "Zadejte hledany prikaz nebo slovo:\n\n\tPridejte i_ pro prikazy vkladaciho rezimu (napr. i_CTRL-X)\n\tPridejte c_ pro prikazy prikazove radky (napr. c_)\n\tPridejte ' pro jmeno volby (napr. 'shiftwidth')" +let g:menutrans_path_dialog = "Zadejte cesty pro vyhledavani souboru. Jednotlive cesty oddelte carkou" +let g:menutrans_tags_dialog = "Zadejte jmena souboru s tagy. Jmena oddelte carkami." +let g:menutrans_textwidth_dialog = "Zadejte delku radku (0 pro zakazani formatovani):" +let g:menutrans_fileformat_dialog = "Vyberte typ konce radku" +" }}}" + +let &cpo = s:keepcpo +unlet s:keepcpo + + + +" vim:set foldmethod=marker expandtab tabstop=3 shiftwidth=3: diff --git a/runtime/lang/menu_de_de.latin1.vim b/runtime/lang/menu_de_de.latin1.vim index 6bfc072..70feb74 100644 --- a/runtime/lang/menu_de_de.latin1.vim +++ b/runtime/lang/menu_de_de.latin1.vim @@ -10,6 +10,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim " The translations below are in latin1, but they work for cp1252 and " iso-8859-15 without conversion as well. @@ -302,3 +304,6 @@ let g:menutrans_tags_dialog = "Geben Sie die Namen der 'tag'-Dateien ein.\nTrenn let g:menutrans_textwidth_dialog = "Geben Sie eine neue Text-Breite ein (oder 0, um die Formatierung abzuschalten)" let g:menutrans_fileformat_dialog = "Wählen Sie ein Datei-Format aus" " }}} + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_eo.utf-8.vim b/runtime/lang/menu_eo.utf-8.vim index 761ae0b..7e363f9 100644 --- a/runtime/lang/menu_eo.utf-8.vim +++ b/runtime/lang/menu_eo.utf-8.vim @@ -1,12 +1,14 @@ " Menu Translations: Esperanto " Maintainer: Dominique PELLE -" Last Change: 2008 Mar 01 +" Last Change: 2012 May 01 " " Quit when menu translations have already been done. if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding utf-8 @@ -455,3 +457,6 @@ menutrans &Off M&alŝaltita menutrans Co&lor\ test Testo\ de\ &koloroj menutrans &Highlight\ test Testo\ de\ &emfazo menutrans &Convert\ to\ HTML Konverti\ al\ &HTML + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_es_es.latin1.vim b/runtime/lang/menu_es_es.latin1.vim index b943e23..97f38a7 100644 --- a/runtime/lang/menu_es_es.latin1.vim +++ b/runtime/lang/menu_es_es.latin1.vim @@ -2,7 +2,7 @@ " Previous translator: Alejandro López-Valencia " Last translator: Omar Campagne Polaino " Version: 7.2.245 -" Last Change: 2009 Sep 03 +" Last Change: 2012 May 01 " " Quit when menu translations have already been done. @@ -10,6 +10,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim " The translations below are in latin1, but they work for cp1252, " iso-8859-15 without conversion as well. @@ -316,3 +318,6 @@ menutrans &Convert\ to\ HTML &Convertir\ a\ HTML " Find Help dialog text let g:menutrans_help_dialog = "Introduzca un nombre de comando o palabra para obtener ayuda;\n\nAnteponga i_ para comandos de entrada (e.g.: i_CTRL-X)\nAnteponga c_ para comandos de la línea de comandos (e.g.: c_)\nAnteponga ` para un nombre de opción (e.g.: `shiftwidth`)" + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_fi_fi.latin1.vim b/runtime/lang/menu_fi_fi.latin1.vim index 1f1f507..6a2c1e9 100644 --- a/runtime/lang/menu_fi_fi.latin1.vim +++ b/runtime/lang/menu_fi_fi.latin1.vim @@ -1,12 +1,14 @@ " Menu Translations: Finnish " Maintainer: Flammie Pirinen -" Last Change: 2007 Sep 04 +" Last Change: 2012 May 01 " Quit when menu translations have already been done. if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim " Translations should be in latin1, if it requires latin9 or even unicode, " change this: @@ -470,4 +472,7 @@ fun! Do_toolbar_tmenu() tmenu ToolBar.FindHelp Etsi ohjeesta endfun +let &cpo = s:keepcpo +unlet s:keepcpo + " vim: set fileencoding=latin1 diff --git a/runtime/lang/menu_fr_fr.latin1.vim b/runtime/lang/menu_fr_fr.latin1.vim index e8881bd..c4b63c7 100644 --- a/runtime/lang/menu_fr_fr.latin1.vim +++ b/runtime/lang/menu_fr_fr.latin1.vim @@ -2,13 +2,15 @@ " Maintainer: Adrien Beau " First Version: Francois Thunus " Last Modification: David Blanchet -" Last Change: 2006 Apr 30 +" Last Change: 2012 May 01 " Quit when menu translations have already been done. if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim " The translations below are in latin1, but they work for cp1252 and " iso-8859-15 without conversion as well. @@ -466,3 +468,6 @@ menutrans &Off &Off menutrans Co&lor\ test Tester\ les\ co&uleurs menutrans &Highlight\ test Tester\ les\ g&roupes\ de\ surbrillance menutrans &Convert\ to\ HTML Con&vertir\ en\ HTML + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_hu_hu.iso_8859-2.vim b/runtime/lang/menu_hu_hu.iso_8859-2.vim index d3fafce..c7821d2 100644 --- a/runtime/lang/menu_hu_hu.iso_8859-2.vim +++ b/runtime/lang/menu_hu_hu.iso_8859-2.vim @@ -1,7 +1,7 @@ " Menu Translations: Hungarian (Magyar) " Original Translation: Zoltán Árpádffy " Maintained By: Kontra Gergely -" Last Change: 2003 May 31 +" Last Change: 2012 May 01 " I'm working on defining (unaccented) hotkeys for everything. " I want to remove y and z hotkeys, because on the hungarian keymap they're at " a differrent place. @@ -27,6 +27,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding iso-8859-2 @@ -256,3 +258,6 @@ let g:menutrans_path_dialog = " let g:menutrans_tags_dialog = "Írd be a tag fájl lehetséges elérési útjait, vesszõvel elválasztva" let g:menutrans_textwidth_dialog = "Írd be a szöveg szélességét (0 = formázás kikapcsolva)" let g:menutrans_fileformat_dialog = "Válaszd ki a fájl formátumát" + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_hu_hu.utf-8.vim b/runtime/lang/menu_hu_hu.utf-8.vim index 83a4dca..f3adf91 100644 --- a/runtime/lang/menu_hu_hu.utf-8.vim +++ b/runtime/lang/menu_hu_hu.utf-8.vim @@ -1,7 +1,7 @@ " Menu Translations: Hungarian (Magyar) " Original Translation: Zoltán Árpádffy " Maintained By: Kontra Gergely -" Last Change: 2004 Jun 10 +" Last Change: 2012 May 01 " " This file was converted from menu_hu_hu.iso_8859-2.vim. See there for " remarks. @@ -11,6 +11,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding utf-8 @@ -240,3 +242,6 @@ let g:menutrans_path_dialog = "Írd be a keresett fájl lehetséges elérési ú let g:menutrans_tags_dialog = "Írd be a tag fájl lehetséges elérési útjait, vesszővel elválasztva" let g:menutrans_textwidth_dialog = "Írd be a szöveg szélességét (0 = formázás kikapcsolva)" let g:menutrans_fileformat_dialog = "Válaszd ki a fájl formátumát" + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_it_it.latin1.vim b/runtime/lang/menu_it_it.latin1.vim index 5a87bf0..092136b 100644 --- a/runtime/lang/menu_it_it.latin1.vim +++ b/runtime/lang/menu_it_it.latin1.vim @@ -2,13 +2,15 @@ " Maintainer: Antonio Colombo " Vlad Sandrini " Luciano Montanaro -" Last Change: 2010 Ago 13 +" Last Change: 2012 May 01 " Quit when menu translations have already been done. if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding iso-8859-1 @@ -348,4 +350,7 @@ endif endfun endif +let &cpo = s:keepcpo +unlet s:keepcpo + " vim: set sw=2 : diff --git a/runtime/lang/menu_ja.cp932.vim b/runtime/lang/menu_ja.cp932.vim index c761b08..50856d5 100644 --- a/runtime/lang/menu_ja.cp932.vim +++ b/runtime/lang/menu_ja.cp932.vim @@ -1,5 +1,8 @@ " Menu Translations: Japanese (for Windows) -" Translated By: MURAOKA Taro -" Last Change: 29-Apr-2004. +" Translated By: MURAOKA Taro +" Last Change: 15-Jun-2012. +" +" Copyright (C) 2004,12 MURAOKA Taro +" THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. source :p:h/menu_japanese_japan.932.vim diff --git a/runtime/lang/menu_ja.euc-jp.vim b/runtime/lang/menu_ja.euc-jp.vim index 0861315..0eff4d9 100644 --- a/runtime/lang/menu_ja.euc-jp.vim +++ b/runtime/lang/menu_ja.euc-jp.vim @@ -1,6 +1,9 @@ " Menu Translations: Japanese (for UNIX) -" Translated By: Muraoka Taro -" Last Change: 08:50:47 25-Mar-2001. +" Translated By: MURAOKA Taro +" Last Change: 15-Jun-2012. +" +" Copyright (C) 2004,12 MURAOKA Taro +" THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. " eucjp is the same as euc-jp. Source the other one from here. source :p:h/menu_ja_jp.euc-jp.vim diff --git a/runtime/lang/menu_ja.eucjp.vim b/runtime/lang/menu_ja.eucjp.vim index 0861315..0eff4d9 100644 --- a/runtime/lang/menu_ja.eucjp.vim +++ b/runtime/lang/menu_ja.eucjp.vim @@ -1,6 +1,9 @@ " Menu Translations: Japanese (for UNIX) -" Translated By: Muraoka Taro -" Last Change: 08:50:47 25-Mar-2001. +" Translated By: MURAOKA Taro +" Last Change: 15-Jun-2012. +" +" Copyright (C) 2004,12 MURAOKA Taro +" THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. " eucjp is the same as euc-jp. Source the other one from here. source :p:h/menu_ja_jp.euc-jp.vim diff --git a/runtime/lang/menu_ja.ujis.vim b/runtime/lang/menu_ja.ujis.vim index 49248fc..e74ff80 100644 --- a/runtime/lang/menu_ja.ujis.vim +++ b/runtime/lang/menu_ja.ujis.vim @@ -1,6 +1,9 @@ " Menu Translations: Japanese (for UNIX) -" Translated By: Muraoka Taro -" Last Change: 08:50:47 25-Mar-2001. +" Translated By: MURAOKA Taro +" Last Change: 15-Jun-2012. +" +" Copyright (C) 2004,12 MURAOKA Taro +" THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. " ujis is the same as euc-jp. Source the other one from here. source :p:h/menu_ja_jp.euc-jp.vim diff --git a/runtime/lang/menu_ja_jp.cp932.vim b/runtime/lang/menu_ja_jp.cp932.vim index c761b08..50856d5 100644 --- a/runtime/lang/menu_ja_jp.cp932.vim +++ b/runtime/lang/menu_ja_jp.cp932.vim @@ -1,5 +1,8 @@ " Menu Translations: Japanese (for Windows) -" Translated By: MURAOKA Taro -" Last Change: 29-Apr-2004. +" Translated By: MURAOKA Taro +" Last Change: 15-Jun-2012. +" +" Copyright (C) 2004,12 MURAOKA Taro +" THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. source :p:h/menu_japanese_japan.932.vim diff --git a/runtime/lang/menu_ja_jp.euc-jp.vim b/runtime/lang/menu_ja_jp.euc-jp.vim index f231857..ba622a6 100644 --- a/runtime/lang/menu_ja_jp.euc-jp.vim +++ b/runtime/lang/menu_ja_jp.euc-jp.vim @@ -1,14 +1,19 @@ " vi:set ts=8 sts=8 sw=8 tw=0: " " Menu Translations: Japanese (EUC-JP) -" Translated By: MURAOKA Taro -" Last Change: 18-Apr-2006. +" Translated By: MURAOKA Taro +" Last Change: 12-May-2013. +" +" Copyright (C) 2001-13 MURAOKA Taro +" THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. " Quit when menu translations have already been done. if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding euc-jp @@ -99,6 +104,8 @@ let g:menutrans_tags_dialog = " menutrans F&ile\ Settings ¥Õ¥¡¥¤¥ëÀßÄê(&I) menutrans Toggle\ Line\ &Numbering:set\ nu! \ ¹ÔÈÖ¹æɽ¼¨ÀÚÂØ(&N):set\ nu! +menutrans Toggle\ relati&ve\ Line\ Numbering:set\ rnu! + \ ÁêÂйÔÈÖ¹æɽ¼¨ÀÚÂØ(&V):set\ rnu! menutrans Toggle\ &List\ Mode:set\ list! \ ¥ê¥¹¥È¥â¡¼¥ÉÀÚÂØ(&L):set\ list! menutrans Toggle\ Line\ &Wrap:set\ wrap! @@ -149,7 +156,7 @@ menutrans Se&T\ Compiler " Tools.Spelling Menu menutrans &Spelling ¥¹¥Ú¥ê¥ó¥°(&S) menutrans &Spell\ Check\ On ¥¹¥Ú¥ë¥Á¥§¥Ã¥¯Í­¸ú(&S) -menutrans Spell\ Check\ &Off ¥¹¥Ú¥ë¥Á¥§¥Ã¥¯Í­¸ú(&O) +menutrans Spell\ Check\ &Off ¥¹¥Ú¥ë¥Á¥§¥Ã¥¯Ìµ¸ú(&O) menutrans To\ &Next\ error]s ¼¡¤Î¥¨¥é¡¼(&N)]s menutrans To\ &Previous\ error[s Á°¤Î¥¨¥é¡¼(&P)[s menutrans Suggest\ &Correctionsz= ½¤Àµ¸õÊä(&C)z= @@ -234,6 +241,8 @@ menutrans &Paste Ž menutrans &Delete ºï½ü(&D) menutrans Select\ Blockwise ¶ë·Á¥Ö¥í¥Ã¥¯ÁªÂò menutrans Select\ &Word ñ¸ìÁªÂò(&W) +menutrans Select\ &Sentence ʸÁªÂò(&S) +menutrans Select\ Pa&ragraph ÃÊÍîÁªÂò(&R) menutrans Select\ &Line ¹ÔÁªÂò(&L) menutrans Select\ &Block ¥Ö¥í¥Ã¥¯ÁªÂò(&B) menutrans Select\ &All ¤¹¤Ù¤ÆÁªÂò(&A) @@ -290,49 +299,8 @@ menutrans Co&lor\ test menutrans &Highlight\ test ¥Ï¥¤¥é¥¤¥È¥Æ¥¹¥È(&H) menutrans &Convert\ to\ HTML HTML¤Ø¥³¥ó¥Ð¡¼¥È(&C) -" Japanese specific menu -" À®ÈݤÏiconv¼¡Â衢ɬ¤º¤·¤â»ØÄꤷ¤¿¥¨¥ó¥³¡¼¥É¤Ë¤Ê¤ë¤ï¤±¤Ç¤Ï¤Ê¤¤¤³¤È¤ËÃí°Õ -if has('iconv') - " iconv¤Î¥Ð¡¼¥¸¥ç¥óȽÄê - let support_jisx0213 = (iconv("\x87\x64\x87\x6a", 'cp932', 'euc-jisx0213') ==# "\xad\xc5\xad\xcb") ? 1 : 0 - " - " Æɤ߹þ¤ß - an 10.395 &File.-SEPICONV- - an 10.396.100.100 &File.¥¨¥ó¥³¡¼¥É»ØÄê(&E)\.\.\..³«¤¯(&O)\.\.\..SJIS(&S)fenc=cp932 :browse confirm e ++enc=cp932 - if !support_jisx0213 - an 10.396.100.110 &File.¥¨¥ó¥³¡¼¥É»ØÄê(&E)\.\.\..³«¤¯(&O)\.\.\..EUC(&E)fenc=euc-jp :browse confirm e ++enc=euc-jp - an 10.396.100.120 &File.¥¨¥ó¥³¡¼¥É»ØÄê(&E)\.\.\..³«¤¯(&O)\.\.\..JIS(&J)fenc=iso-2022-jp :browse confirm e ++enc=iso-2022-jp - else - an 10.396.100.110 &File.¥¨¥ó¥³¡¼¥É»ØÄê(&E)\.\.\..³«¤¯(&O)\.\.\..EUC(&E)fenc=euc-jisx0213 :browse confirm e ++enc=euc-jisx0213 - an 10.396.100.120 &File.¥¨¥ó¥³¡¼¥É»ØÄê(&E)\.\.\..³«¤¯(&O)\.\.\..JIS(&J)fenc=iso-2022-jp-3 :browse confirm e ++enc=iso-2022-jp-3 - endif - an 10.396.100.130 &File.¥¨¥ó¥³¡¼¥É»ØÄê(&E)\.\.\..³«¤¯(&O)\.\.\..UTF-8(&8)fenc=utf-8 :browse confirm e ++enc=utf-8 - - " ºÆÆɹþ - an 10.396.110.100 &File.¥¨¥ó¥³¡¼¥É»ØÄê(&E)\.\.\..ºÆÆɹþ(&R)\.\.\..SJIS(&S)fenc=cp932 :e ++enc=cp932 - if !support_jisx0213 - an 10.396.110.110 &File.¥¨¥ó¥³¡¼¥É»ØÄê(&E)\.\.\..ºÆÆɹþ(&R)\.\.\..EUC(&E)fenc=euc-jp :e ++enc=euc-jp - an 10.396.110.120 &File.¥¨¥ó¥³¡¼¥É»ØÄê(&E)\.\.\..ºÆÆɹþ(&R)\.\.\..JIS(&J)fenc=iso-2022-jp :e ++enc=iso-2022-jp - else - an 10.396.110.110 &File.¥¨¥ó¥³¡¼¥É»ØÄê(&E)\.\.\..ºÆÆɹþ(&R)\.\.\..EUC(&E)fenc=euc-jisx0213 :e ++enc=euc-jisx0213 - an 10.396.110.120 &File.¥¨¥ó¥³¡¼¥É»ØÄê(&E)\.\.\..ºÆÆɹþ(&R)\.\.\..JIS(&J)fenc=iso-2022-jp-3 :e ++enc=iso-2022-jp-3 - endif - an 10.396.110.130 &File.¥¨¥ó¥³¡¼¥É»ØÄê(&E)\.\.\..ºÆÆɹþ(&R)\.\.\..UTF-8(&8)fenc=utf-8 :e ++enc=utf-8 - - " Êݸ - an 10.396.115 &File.¥¨¥ó¥³¡¼¥É»ØÄê(&E)\.\.\..-SEP1- - an 10.396.120.100 &File.¥¨¥ó¥³¡¼¥É»ØÄê(&E)\.\.\..Êݸ(&S)\.\.\..SJIS(&S)fenc=cp932 :set fenc=cp932 \| w - if !support_jisx0213 - an 10.396.120.110 &File.¥¨¥ó¥³¡¼¥É»ØÄê(&E)\.\.\..Êݸ(&S)\.\.\..EUC(&E)fenc=euc-jp :set fenc=euc-jp \| w - an 10.396.120.120 &File.¥¨¥ó¥³¡¼¥É»ØÄê(&E)\.\.\..Êݸ(&S)\.\.\..JIS(&J)fenc=iso-2022-jp :set fenc=iso-2022-jp \| w - else - an 10.396.120.110 &File.¥¨¥ó¥³¡¼¥É»ØÄê(&E)\.\.\..Êݸ(&S)\.\.\..EUC(&E)fenc=euc-jisx0213 :set fenc=euc-jisx0213 \| w - an 10.396.120.120 &File.¥¨¥ó¥³¡¼¥É»ØÄê(&E)\.\.\..Êݸ(&S)\.\.\..JIS(&J)fenc=iso-2022-jp-3 :set fenc=iso-2022-jp-3 \| w - endif - an 10.396.120.130 &File.¥¨¥ó¥³¡¼¥É»ØÄê(&E)\.\.\..Êݸ(&S)\.\.\..UTF-8(&8)fenc=utf-8 :set fenc=utf-8 \| w -endif +let &cpo = s:keepcpo +unlet s:keepcpo " filler to avoid the line above being recognized as a modeline " filler -" filler -" filler diff --git a/runtime/lang/menu_ja_jp.eucjp.vim b/runtime/lang/menu_ja_jp.eucjp.vim index 0861315..0eff4d9 100644 --- a/runtime/lang/menu_ja_jp.eucjp.vim +++ b/runtime/lang/menu_ja_jp.eucjp.vim @@ -1,6 +1,9 @@ " Menu Translations: Japanese (for UNIX) -" Translated By: Muraoka Taro -" Last Change: 08:50:47 25-Mar-2001. +" Translated By: MURAOKA Taro +" Last Change: 15-Jun-2012. +" +" Copyright (C) 2004,12 MURAOKA Taro +" THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. " eucjp is the same as euc-jp. Source the other one from here. source :p:h/menu_ja_jp.euc-jp.vim diff --git a/runtime/lang/menu_ja_jp.ujis.vim b/runtime/lang/menu_ja_jp.ujis.vim index 49248fc..e74ff80 100644 --- a/runtime/lang/menu_ja_jp.ujis.vim +++ b/runtime/lang/menu_ja_jp.ujis.vim @@ -1,6 +1,9 @@ " Menu Translations: Japanese (for UNIX) -" Translated By: Muraoka Taro -" Last Change: 08:50:47 25-Mar-2001. +" Translated By: MURAOKA Taro +" Last Change: 15-Jun-2012. +" +" Copyright (C) 2004,12 MURAOKA Taro +" THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. " ujis is the same as euc-jp. Source the other one from here. source :p:h/menu_ja_jp.euc-jp.vim diff --git a/runtime/lang/menu_ja_jp.utf-8.vim b/runtime/lang/menu_ja_jp.utf-8.vim index b231005..7c3431d 100644 --- a/runtime/lang/menu_ja_jp.utf-8.vim +++ b/runtime/lang/menu_ja_jp.utf-8.vim @@ -1,14 +1,19 @@ " vi:set ts=8 sts=8 sw=8 tw=0: " " Menu Translations: Japanese (UTF-8) -" Translated By: MURAOKA Taro -" Last Change: 18-Apr-2006. +" Translated By: MURAOKA Taro +" Last Change: 12-May-2013. +" +" Copyright (C) 2001-13 MURAOKA Taro +" THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. " Quit when menu translations have already been done. if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding utf-8 @@ -99,6 +104,8 @@ let g:menutrans_tags_dialog = "タグファイルの名前を入力してくだ menutrans F&ile\ Settings ファイル設定(&I) menutrans Toggle\ Line\ &Numbering:set\ nu! \ 行番号表示切替(&N):set\ nu! +menutrans Toggle\ relati&ve\ Line\ Numbering:set\ rnu! + \ 相対行番号表示切替(&V):set\ rnu! menutrans Toggle\ &List\ Mode:set\ list! \ リストモード切替(&L):set\ list! menutrans Toggle\ Line\ &Wrap:set\ wrap! @@ -149,7 +156,7 @@ menutrans Se&T\ Compiler コンパイラ設定(&T) " Tools.Spelling Menu menutrans &Spelling スペリング(&S) menutrans &Spell\ Check\ On スペルチェック有効(&S) -menutrans Spell\ Check\ &Off スペルチェック有効(&O) +menutrans Spell\ Check\ &Off スペルチェック無効(&O) menutrans To\ &Next\ error]s 次のエラー(&N)]s menutrans To\ &Previous\ error[s 前のエラー(&P)[s menutrans Suggest\ &Correctionsz= 修正候補(&C)z= @@ -234,6 +241,8 @@ menutrans &Paste 貼り付け(&P) menutrans &Delete 削除(&D) menutrans Select\ Blockwise 矩形ブロック選択 menutrans Select\ &Word 単語選択(&W) +menutrans Select\ &Sentence 文選択(&S) +menutrans Select\ Pa&ragraph 段落選択(&R) menutrans Select\ &Line 行選択(&L) menutrans Select\ &Block ブロック選択(&B) menutrans Select\ &All すべて選択(&A) @@ -290,49 +299,8 @@ menutrans Co&lor\ test カラーテスト(&L) menutrans &Highlight\ test ハイライトテスト(&H) menutrans &Convert\ to\ HTML HTMLへコンバート(&C) -" Japanese specific menu -" 成否はiconv次第、必ずしも指定したエンコードになるわけではないことに注意 -if has('iconv') - " iconvのバージョン判定 - let support_jisx0213 = (iconv("\x87\x64\x87\x6a", 'cp932', 'euc-jisx0213') ==# "\xad\xc5\xad\xcb") ? 1 : 0 - " - " 読み込み - an 10.395 &File.-SEPICONV- - an 10.396.100.100 &File.エンコード指定(&E)\.\.\..開く(&O)\.\.\..SJIS(&S)fenc=cp932 :browse confirm e ++enc=cp932 - if !support_jisx0213 - an 10.396.100.110 &File.エンコード指定(&E)\.\.\..開く(&O)\.\.\..EUC(&E)fenc=euc-jp :browse confirm e ++enc=euc-jp - an 10.396.100.120 &File.エンコード指定(&E)\.\.\..開く(&O)\.\.\..JIS(&J)fenc=iso-2022-jp :browse confirm e ++enc=iso-2022-jp - else - an 10.396.100.110 &File.エンコード指定(&E)\.\.\..開く(&O)\.\.\..EUC(&E)fenc=euc-jisx0213 :browse confirm e ++enc=euc-jisx0213 - an 10.396.100.120 &File.エンコード指定(&E)\.\.\..開く(&O)\.\.\..JIS(&J)fenc=iso-2022-jp-3 :browse confirm e ++enc=iso-2022-jp-3 - endif - an 10.396.100.130 &File.エンコード指定(&E)\.\.\..開く(&O)\.\.\..UTF-8(&8)fenc=utf-8 :browse confirm e ++enc=utf-8 - - " 再読込 - an 10.396.110.100 &File.エンコード指定(&E)\.\.\..再読込(&R)\.\.\..SJIS(&S)fenc=cp932 :e ++enc=cp932 - if !support_jisx0213 - an 10.396.110.110 &File.エンコード指定(&E)\.\.\..再読込(&R)\.\.\..EUC(&E)fenc=euc-jp :e ++enc=euc-jp - an 10.396.110.120 &File.エンコード指定(&E)\.\.\..再読込(&R)\.\.\..JIS(&J)fenc=iso-2022-jp :e ++enc=iso-2022-jp - else - an 10.396.110.110 &File.エンコード指定(&E)\.\.\..再読込(&R)\.\.\..EUC(&E)fenc=euc-jisx0213 :e ++enc=euc-jisx0213 - an 10.396.110.120 &File.エンコード指定(&E)\.\.\..再読込(&R)\.\.\..JIS(&J)fenc=iso-2022-jp-3 :e ++enc=iso-2022-jp-3 - endif - an 10.396.110.130 &File.エンコード指定(&E)\.\.\..再読込(&R)\.\.\..UTF-8(&8)fenc=utf-8 :e ++enc=utf-8 - - " 保存 - an 10.396.115 &File.エンコード指定(&E)\.\.\..-SEP1- - an 10.396.120.100 &File.エンコード指定(&E)\.\.\..保存(&S)\.\.\..SJIS(&S)fenc=cp932 :set fenc=cp932 \| w - if !support_jisx0213 - an 10.396.120.110 &File.エンコード指定(&E)\.\.\..保存(&S)\.\.\..EUC(&E)fenc=euc-jp :set fenc=euc-jp \| w - an 10.396.120.120 &File.エンコード指定(&E)\.\.\..保存(&S)\.\.\..JIS(&J)fenc=iso-2022-jp :set fenc=iso-2022-jp \| w - else - an 10.396.120.110 &File.エンコード指定(&E)\.\.\..保存(&S)\.\.\..EUC(&E)fenc=euc-jisx0213 :set fenc=euc-jisx0213 \| w - an 10.396.120.120 &File.エンコード指定(&E)\.\.\..保存(&S)\.\.\..JIS(&J)fenc=iso-2022-jp-3 :set fenc=iso-2022-jp-3 \| w - endif - an 10.396.120.130 &File.エンコード指定(&E)\.\.\..保存(&S)\.\.\..UTF-8(&8)fenc=utf-8 :set fenc=utf-8 \| w -endif +let &cpo = s:keepcpo +unlet s:keepcpo " filler to avoid the line above being recognized as a modeline " filler -" filler -" filler diff --git a/runtime/lang/menu_japanese_japan.932.vim b/runtime/lang/menu_japanese_japan.932.vim index 09976a9..7b775cb 100644 --- a/runtime/lang/menu_japanese_japan.932.vim +++ b/runtime/lang/menu_japanese_japan.932.vim @@ -1,14 +1,19 @@ " vi:set ts=8 sts=8 sw=8 tw=0: " " Menu Translations: Japanese (CP932) -" Translated By: MURAOKA Taro -" Last Change: 18-Apr-2006. +" Translated By: MURAOKA Taro +" Last Change: 12-May-2013. +" +" Copyright (C) 2001-13 MURAOKA Taro +" THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. " Quit when menu translations have already been done. if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding cp932 @@ -99,6 +104,8 @@ let g:menutrans_tags_dialog = " menutrans F&ile\ Settings ƒtƒ@ƒCƒ‹Ý’è(&I) menutrans Toggle\ Line\ &Numbering:set\ nu! \ s”ԍ†•\Ž¦Ø‘Ö(&N):set\ nu! +menutrans Toggle\ relati&ve\ Line\ Numbering:set\ rnu! + \ ‘Š‘΍s”ԍ†•\Ž¦Ø‘Ö(&V):set\ rnu! menutrans Toggle\ &List\ Mode:set\ list! \ ƒŠƒXƒgƒ‚[ƒhØ‘Ö(&L):set\ list! menutrans Toggle\ Line\ &Wrap:set\ wrap! @@ -149,7 +156,7 @@ menutrans Se&T\ Compiler " Tools.Spelling Menu menutrans &Spelling ƒXƒyƒŠƒ“ƒO(&S) menutrans &Spell\ Check\ On ƒXƒyƒ‹ƒ`ƒFƒbƒN—LŒø(&S) -menutrans Spell\ Check\ &Off ƒXƒyƒ‹ƒ`ƒFƒbƒN—LŒø(&O) +menutrans Spell\ Check\ &Off ƒXƒyƒ‹ƒ`ƒFƒbƒN–³Œø(&O) menutrans To\ &Next\ error]s ŽŸ‚̃Gƒ‰[(&N)]s menutrans To\ &Previous\ error[s ‘O‚̃Gƒ‰[(&P)[s menutrans Suggest\ &Correctionsz= C³Œó•â(&C)z= @@ -234,6 +241,8 @@ menutrans &Paste menutrans &Delete íœ(&D) menutrans Select\ Blockwise ‹éŒ`ƒuƒƒbƒN‘I‘ð menutrans Select\ &Word ’PŒê‘I‘ð(&W) +menutrans Select\ &Sentence •¶‘I‘ð(&S) +menutrans Select\ Pa&ragraph ’i—Ž‘I‘ð(&R) menutrans Select\ &Line s‘I‘ð(&L) menutrans Select\ &Block ƒuƒƒbƒN‘I‘ð(&B) menutrans Select\ &All ‚·‚ׂđI‘ð(&A) @@ -290,49 +299,8 @@ menutrans Co&lor\ test menutrans &Highlight\ test ƒnƒCƒ‰ƒCƒgƒeƒXƒg(&H) menutrans &Convert\ to\ HTML HTML‚ÖƒRƒ“ƒo[ƒg(&C) -" Japanese specific menu -" ¬”Û‚ÍiconvŽŸ‘æA•K‚¸‚µ‚àŽw’肵‚½ƒGƒ“ƒR[ƒh‚É‚È‚é‚킯‚Å‚Í‚È‚¢‚±‚Æ‚É’ˆÓ -if has('iconv') - " iconv‚̃o[ƒWƒ‡ƒ“”»’è - let support_jisx0213 = (iconv("\x87\x64\x87\x6a", 'cp932', 'euc-jisx0213') ==# "\xad\xc5\xad\xcb") ? 1 : 0 - " - " “ǂݍž‚Ý - an 10.395 &File.-SEPICONV- - an 10.396.100.100 &File.ƒGƒ“ƒR[ƒhŽw’è(&E)\.\.\..ŠJ‚­(&O)\.\.\..SJIS(&S)fenc=cp932 :browse confirm e ++enc=cp932 - if !support_jisx0213 - an 10.396.100.110 &File.ƒGƒ“ƒR[ƒhŽw’è(&E)\.\.\..ŠJ‚­(&O)\.\.\..EUC(&E)fenc=euc-jp :browse confirm e ++enc=euc-jp - an 10.396.100.120 &File.ƒGƒ“ƒR[ƒhŽw’è(&E)\.\.\..ŠJ‚­(&O)\.\.\..JIS(&J)fenc=iso-2022-jp :browse confirm e ++enc=iso-2022-jp - else - an 10.396.100.110 &File.ƒGƒ“ƒR[ƒhŽw’è(&E)\.\.\..ŠJ‚­(&O)\.\.\..EUC(&E)fenc=euc-jisx0213 :browse confirm e ++enc=euc-jisx0213 - an 10.396.100.120 &File.ƒGƒ“ƒR[ƒhŽw’è(&E)\.\.\..ŠJ‚­(&O)\.\.\..JIS(&J)fenc=iso-2022-jp-3 :browse confirm e ++enc=iso-2022-jp-3 - endif - an 10.396.100.130 &File.ƒGƒ“ƒR[ƒhŽw’è(&E)\.\.\..ŠJ‚­(&O)\.\.\..UTF-8(&8)fenc=utf-8 :browse confirm e ++enc=utf-8 - - " Ä“Ǎž - an 10.396.110.100 &File.ƒGƒ“ƒR[ƒhŽw’è(&E)\.\.\..Ä“Ǎž(&R)\.\.\..SJIS(&S)fenc=cp932 :e ++enc=cp932 - if !support_jisx0213 - an 10.396.110.110 &File.ƒGƒ“ƒR[ƒhŽw’è(&E)\.\.\..Ä“Ǎž(&R)\.\.\..EUC(&E)fenc=euc-jp :e ++enc=euc-jp - an 10.396.110.120 &File.ƒGƒ“ƒR[ƒhŽw’è(&E)\.\.\..Ä“Ǎž(&R)\.\.\..JIS(&J)fenc=iso-2022-jp :e ++enc=iso-2022-jp - else - an 10.396.110.110 &File.ƒGƒ“ƒR[ƒhŽw’è(&E)\.\.\..Ä“Ǎž(&R)\.\.\..EUC(&E)fenc=euc-jisx0213 :e ++enc=euc-jisx0213 - an 10.396.110.120 &File.ƒGƒ“ƒR[ƒhŽw’è(&E)\.\.\..Ä“Ǎž(&R)\.\.\..JIS(&J)fenc=iso-2022-jp-3 :e ++enc=iso-2022-jp-3 - endif - an 10.396.110.130 &File.ƒGƒ“ƒR[ƒhŽw’è(&E)\.\.\..Ä“Ǎž(&R)\.\.\..UTF-8(&8)fenc=utf-8 :e ++enc=utf-8 - - " •Û‘¶ - an 10.396.115 &File.ƒGƒ“ƒR[ƒhŽw’è(&E)\.\.\..-SEP1- - an 10.396.120.100 &File.ƒGƒ“ƒR[ƒhŽw’è(&E)\.\.\..•Û‘¶(&S)\.\.\..SJIS(&S)fenc=cp932 :set fenc=cp932 \| w - if !support_jisx0213 - an 10.396.120.110 &File.ƒGƒ“ƒR[ƒhŽw’è(&E)\.\.\..•Û‘¶(&S)\.\.\..EUC(&E)fenc=euc-jp :set fenc=euc-jp \| w - an 10.396.120.120 &File.ƒGƒ“ƒR[ƒhŽw’è(&E)\.\.\..•Û‘¶(&S)\.\.\..JIS(&J)fenc=iso-2022-jp :set fenc=iso-2022-jp \| w - else - an 10.396.120.110 &File.ƒGƒ“ƒR[ƒhŽw’è(&E)\.\.\..•Û‘¶(&S)\.\.\..EUC(&E)fenc=euc-jisx0213 :set fenc=euc-jisx0213 \| w - an 10.396.120.120 &File.ƒGƒ“ƒR[ƒhŽw’è(&E)\.\.\..•Û‘¶(&S)\.\.\..JIS(&J)fenc=iso-2022-jp-3 :set fenc=iso-2022-jp-3 \| w - endif - an 10.396.120.130 &File.ƒGƒ“ƒR[ƒhŽw’è(&E)\.\.\..•Û‘¶(&S)\.\.\..UTF-8(&8)fenc=utf-8 :set fenc=utf-8 \| w -endif +let &cpo = s:keepcpo +unlet s:keepcpo " filler to avoid the line above being recognized as a modeline " filler -" filler -" filler diff --git a/runtime/lang/menu_ko_kr.euckr.vim b/runtime/lang/menu_ko_kr.euckr.vim index 11809cf..3816384 100644 --- a/runtime/lang/menu_ko_kr.euckr.vim +++ b/runtime/lang/menu_ko_kr.euckr.vim @@ -1,12 +1,14 @@ " Menu Translations: Korean " Maintainer: SungHyun Nam -" Last Change: 2010 Feb 18 +" Last Change: 2012 May 01 " Quit when menu translations have already been done. if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding euc-kr @@ -42,7 +44,7 @@ menutrans E&xit:qa " Edit menu menutrans &Edit ÆíÁý(&E) menutrans &Undou Ãë¼Ò(&U)u -menutrans &Redo^R ´Ù½Ã ½ÇÇà(&R)^R +menutrans &Redo^R ´Ù½Ã\ ½ÇÇà(&R)^R menutrans Rep&eat\. µÇÇ®ÀÌ(&e)\. menutrans Cu&t"+x ÀÚ¸£±â(&t)"+x menutrans &Copy"+y º¹»ç(&C)"+y @@ -63,7 +65,7 @@ menutrans Toggle\ &Ignore-case:set\ ic! menutrans Toggle\ &Showmatch:set\ sm! Showmatch\ Åä±Û(&S):set\ sm! menutrans &Context\ lines ÄÜÅؽºÆ®\ ÁÙ(&C) menutrans &Virtual\ Edit °¡»ó\ ÆíÁý(&V) -menutrans Never »ç¿ë ¾È ÇÔ +menutrans Never »ç¿ë\ ¾È\ ÇÔ menutrans Block\ Selection ºí·°\ °í¸£±â menutrans Insert\ mode »ðÀÔ\ ¸ðµå menutrans Block\ and\ Insert ºí·°°ú\ »ðÀÔ @@ -92,7 +94,7 @@ menutrans Toggle\ &auto-indent:set\ ai! menutrans Toggle\ &C-indenting:set\ cin! C-Àε§ÆÃ\ Åä±Û(&C):set\ cin! " other options -menutrans &Shiftwidth ½¬ÇÁÆ® ³Êºñ(&S) +menutrans &Shiftwidth ½¬ÇÁÆ®\ ³Êºñ(&S) menutrans Soft\ &Tabstop ¼ÒÇÁÆ®\ ÅǽºÅé(&T) menutrans Te&xt\ Width\.\.\. ÅؽºÆ®\ ³Êºñ(&x)\.\.\. menutrans &File\ Format\.\.\. ÆÄÀÏ\ Çü½Ä(&F)\.\.\. @@ -125,12 +127,12 @@ menutrans &Find\ More\ Languages " Tools.Fold Menu menutrans &Folding Á¢±â(&F) " open close folds -menutrans &Enable/Disable\ foldszi Á¢´Â\ ±â´É\ »ç¿ë\ Åä±Û(&E)zi +menutrans &Enable/Disable\ foldszi Á¢±â\ »ç¿ë\ Åä±Û(&E)zi menutrans &View\ Cursor\ Linezv Ä¿¼­\ ÁÙ\ º¸±â(&V)zv menutrans Vie&w\ Cursor\ Line\ onlyzMzx Ä¿¼­\ ÁÙ¸¸\ º¸±â(&w)zMzx menutrans C&lose\ more\ foldszm ´õ\ ¸¹Àº\ Á¢±â\ ´Ý±â(&l)zm -menutrans &Close\ all\ foldszM Á¢Èù\ ºÎºÐ\ ¸ðµÎ\ Á¢±â(&C)zM -menutrans O&pen\ more\ foldszr ´õ ¸¹Àº\ Á¢±â\ ¿­±â(&p)zr +menutrans &Close\ all\ foldszM ¸ðµç\ Á¢±â\ ´Ý±â(&C)zM +menutrans O&pen\ more\ foldszr ´õ\ ¸¹Àº\ Á¢±â\ ¿­±â(&p)zr menutrans &Open\ all\ foldszR Á¢Èù\ ºÎºÐ\ ¸ðµÎ\ Æì±â(&O)zR " fold method menutrans Fold\ Met&hod Á¢´Â\ ¹æ¹ý(&h) @@ -141,11 +143,11 @@ menutrans S&yntax "menutrans &Diff &Diff menutrans Ma&rker ²¿¸®Ç¥(&r) " create and delete folds -menutrans Create\ &Foldzf »õ·Î Á¢±â(&F)zf -menutrans &Delete\ Foldzd ¿ÏÀüÈ÷ Æì±â(&D)zd -menutrans Delete\ &All\ FoldszD ¸ðµÎ\ Æì±â(&A)zD +menutrans Create\ &Foldzf Á¢±â\ »ý¼º(&F)zf +menutrans &Delete\ Foldzd Á¢±â\ »èÁ¦(&D)zd +menutrans Delete\ &All\ FoldszD ¸ðµç\ Á¢±â\ »èÁ¦(&A)zD " moving around in folds -menutrans Fold\ column\ &width Á¢À»\ Ä­\ ³Êºñ(&w) +menutrans Fold\ column\ &width Á¢±â\ Ä÷³\ ³Êºñ(&w) "menutrans &Diff &Diff menutrans &Update °»½Å(&U) @@ -259,3 +261,5 @@ menutrans Co&lor\ test menutrans &Highlight\ test Highlight\ ½ÃÇè(&H) menutrans &Convert\ to\ HTML HTML·Î\ º¯È¯(&C) +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_ko_kr.utf-8.vim b/runtime/lang/menu_ko_kr.utf-8.vim index ef46173..d036853 100644 --- a/runtime/lang/menu_ko_kr.utf-8.vim +++ b/runtime/lang/menu_ko_kr.utf-8.vim @@ -1,12 +1,14 @@ " Menu Translations: Korean " Maintainer: SungHyun Nam -" Last Change: 2010 Feb 18 +" Last Change: 2012 May 01 " Quit when menu translations have already been done. if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding utf-8 @@ -42,7 +44,7 @@ menutrans E&xit:qa 끝내기(&x):qa " Edit menu menutrans &Edit 편집(&E) menutrans &Undou 취소(&U)u -menutrans &Redo^R 다시 실행(&R)^R +menutrans &Redo^R 다시\ 실행(&R)^R menutrans Rep&eat\. 되풀이(&e)\. menutrans Cu&t"+x 자르기(&t)"+x menutrans &Copy"+y 복사(&C)"+y @@ -63,7 +65,7 @@ menutrans Toggle\ &Ignore-case:set\ ic! 대소문자\ 구분\ 토글(&I):set\ sm! Showmatch\ 토글(&S):set\ sm! menutrans &Context\ lines 콘텍스트\ 줄(&C) menutrans &Virtual\ Edit 가상\ 편집(&V) -menutrans Never 사용 안 함 +menutrans Never 사용\ 안\ 함 menutrans Block\ Selection 블럭\ 고르기 menutrans Insert\ mode 삽입\ 모드 menutrans Block\ and\ Insert 블럭과\ 삽입 @@ -92,7 +94,7 @@ menutrans Toggle\ &auto-indent:set\ ai! 자동인덴트\ 토글(&a):se menutrans Toggle\ &C-indenting:set\ cin! C-인덴팅\ 토글(&C):set\ cin! " other options -menutrans &Shiftwidth 쉬프트 너비(&S) +menutrans &Shiftwidth 쉬프트\ 너비(&S) menutrans Soft\ &Tabstop 소프트\ 탭스톱(&T) menutrans Te&xt\ Width\.\.\. 텍스트\ 너비(&x)\.\.\. menutrans &File\ Format\.\.\. 파일\ 형식(&F)\.\.\. @@ -125,12 +127,12 @@ menutrans &Find\ More\ Languages 다른\ 언어\ 찾기(&F) " Tools.Fold Menu menutrans &Folding 접기(&F) " open close folds -menutrans &Enable/Disable\ foldszi 접는\ 기능\ 사용\ 토글(&E)zi +menutrans &Enable/Disable\ foldszi 접기\ 사용\ 토글(&E)zi menutrans &View\ Cursor\ Linezv 커서\ 줄\ 보기(&V)zv menutrans Vie&w\ Cursor\ Line\ onlyzMzx 커서\ 줄만\ 보기(&w)zMzx menutrans C&lose\ more\ foldszm 더\ 많은\ 접기\ 닫기(&l)zm -menutrans &Close\ all\ foldszM 접힌\ 부분\ 모두\ 접기(&C)zM -menutrans O&pen\ more\ foldszr 더 많은\ 접기\ 열기(&p)zr +menutrans &Close\ all\ foldszM 모든\ 접기\ 닫기(&C)zM +menutrans O&pen\ more\ foldszr 더\ 많은\ 접기\ 열기(&p)zr menutrans &Open\ all\ foldszR 접힌\ 부분\ 모두\ 펴기(&O)zR " fold method menutrans Fold\ Met&hod 접는\ 방법(&h) @@ -141,11 +143,11 @@ menutrans S&yntax 신택스(&y) "menutrans &Diff &Diff menutrans Ma&rker 꼬리표(&r) " create and delete folds -menutrans Create\ &Foldzf 새로 접기(&F)zf -menutrans &Delete\ Foldzd 완전히 펴기(&D)zd -menutrans Delete\ &All\ FoldszD 모두\ 펴기(&A)zD +menutrans Create\ &Foldzf 접기\ 생성(&F)zf +menutrans &Delete\ Foldzd 접기\ 삭제(&D)zd +menutrans Delete\ &All\ FoldszD 모든\ 접기\ 삭제(&A)zD " moving around in folds -menutrans Fold\ column\ &width 접을\ 칸\ 너비(&w) +menutrans Fold\ column\ &width 접기\ 컬럼\ 너비(&w) "menutrans &Diff &Diff menutrans &Update 갱신(&U) @@ -259,3 +261,5 @@ menutrans Co&lor\ test 색\ 시험(&l) menutrans &Highlight\ test Highlight\ 시험(&H) menutrans &Convert\ to\ HTML HTML로\ 변환(&C) +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_nl_nl.latin1.vim b/runtime/lang/menu_nl_nl.latin1.vim index d7f75f2..e1d4506 100644 --- a/runtime/lang/menu_nl_nl.latin1.vim +++ b/runtime/lang/menu_nl_nl.latin1.vim @@ -1,12 +1,14 @@ " Menu Translations: Nederlands " Maintainer: Bram Moolenaar -" Last Change: 2004 May 05 +" Last Change: 2012 May 01 " Quit when menu translations have already been done. if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim " The translations below are in latin1, but they work for cp1252 and " iso-8859-15 without conversion as well. @@ -238,3 +240,6 @@ let g:menutrans_path_dialog = "Typ het zoekpad voor bestanden.\nGebruik commas t let g:menutrans_tags_dialog = "Typ namen van tag bestanden.\nGebruik commas tussen de namen." let g:menutrans_textwidth_dialog = "Typ de nieuwe tekst breedte (0 om formatteren uit the schakelen): " let g:menutrans_fileformat_dialog = "Selecteer formaat voor het schrijven van het bestand" + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_no_no.latin1.vim b/runtime/lang/menu_no_no.latin1.vim index f27b05c..a64e343 100644 --- a/runtime/lang/menu_no_no.latin1.vim +++ b/runtime/lang/menu_no_no.latin1.vim @@ -1,6 +1,6 @@ " Menu Translations: Norwegian / Norsk (Bokmål) " Maintainer: Øyvind A. Holm -" Last Change: 2004-05-16 20:00:52 +0200 +" Last Change: 2012 May 01 " menu_no_no.latin1.vim 289 2004-05-16 18:00:52Z sunny " Quit when menu translations have already been done. @@ -8,6 +8,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim " The translations below are in ISO-8859-1, but they work for ISO-8859-15 and " CP1252 without conversion as well. @@ -229,5 +231,8 @@ endif let g:menutrans_textwidth_dialog = "Velg ny tekstbredde (0 for å forhindre formatering): " let g:menutrans_fileformat_dialog = "Velg filformat som filen skal lagres med" +let &cpo = s:keepcpo +unlet s:keepcpo + " vim: set ts=8 sw=8 : " vim600: set fdm=indent : diff --git a/runtime/lang/menu_pl_pl.iso_8859-2.vim b/runtime/lang/menu_pl_pl.iso_8859-2.vim index 021e1a7..7bb7294 100644 --- a/runtime/lang/menu_pl_pl.iso_8859-2.vim +++ b/runtime/lang/menu_pl_pl.iso_8859-2.vim @@ -8,6 +8,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding iso-8859-2 @@ -285,3 +287,6 @@ let g:menutrans_tags_dialog = "Podaj nazwy plik let g:menutrans_textwidth_dialog = "Wprowad¼ now± szeroko¶æ tekstu (0 wy³±cza przewijanie): " let g:menutrans_fileformat_dialog = "Wybierz format w którym ten plik ma byæ zapisany" let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\n&Anuluj" + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_pl_pl.utf-8.vim b/runtime/lang/menu_pl_pl.utf-8.vim index 1d347dc..871b4fa 100644 --- a/runtime/lang/menu_pl_pl.utf-8.vim +++ b/runtime/lang/menu_pl_pl.utf-8.vim @@ -8,6 +8,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding utf-8 @@ -285,3 +287,6 @@ let g:menutrans_tags_dialog = "Podaj nazwy plików tagów.\nProszę rozdzielać let g:menutrans_textwidth_dialog = "Wprowadź nową szerokość tekstu (0 wyłącza przewijanie): " let g:menutrans_fileformat_dialog = "Wybierz format w którym ten plik ma być zapisany" let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\n&Anuluj" + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_polish_poland.1250.vim b/runtime/lang/menu_polish_poland.1250.vim index 398b18d..9dde00d 100644 --- a/runtime/lang/menu_polish_poland.1250.vim +++ b/runtime/lang/menu_polish_poland.1250.vim @@ -8,6 +8,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding cp1250 @@ -285,3 +287,6 @@ let g:menutrans_tags_dialog = "Podaj nazwy plik let g:menutrans_textwidth_dialog = "WprowadŸ now¹ szerokoœæ tekstu (0 wy³¹cza przewijanie): " let g:menutrans_fileformat_dialog = "Wybierz format w którym ten plik ma byæ zapisany" let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\n&Anuluj" + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_pt_br.vim b/runtime/lang/menu_pt_br.vim index 28a62b7..f4980ef 100644 --- a/runtime/lang/menu_pt_br.vim +++ b/runtime/lang/menu_pt_br.vim @@ -1,6 +1,6 @@ " Menu Translations: Português do Brasil " Maintainer: José de Paula -" Last Change: 2006-09-19 02:30:00-03:00 +" Last Change: 2012 May 01 " " Quit when menu translations have already been done. @@ -8,6 +8,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim " Translations in latin1 (ISO-8859-1), and should work in " latin9 (ISO-8859-15) @@ -283,3 +285,6 @@ menutrans &Convert\ to\ HTML &Converter\ para\ HTML " Find Help dialog text let g:menutrans_help_dialog = "Digite um comando ou palavra para obter ajuda;\n\nAnteponha i_ para comandos de entrada (ex.: i_CTRL-X)\nAnteponha c_ para comandos da linha de comandos (ex.: c_)\nAnteponha ` para um nome de opção (ex.: `shiftwidth`)" + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_pt_pt.vim b/runtime/lang/menu_pt_pt.vim index 28b9726..783be0b 100644 --- a/runtime/lang/menu_pt_pt.vim +++ b/runtime/lang/menu_pt_pt.vim @@ -7,6 +7,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim " Translations in latin1 (ISO-8859-1), and should work in " latin9 (ISO-8859-15) @@ -262,3 +264,6 @@ menutrans &Convert\ to\ HTML &Converter\ para\ HTML " Find Help dialog text let g:menutrans_help_dialog = "Digite um comando ou palavra para obter ajuda;\n\nAnteponha i_ para comandos de entrada (ex.: i_CTRL-X)\nAnteponha c_ para comandos da linha de comandos (ex.: c_)\nAnteponha ` para um nome de opção (ex.: `shiftwidth`)" + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_ru_ru.koi8-r.vim b/runtime/lang/menu_ru_ru.koi8-r.vim index 37cd935..e66b728 100644 --- a/runtime/lang/menu_ru_ru.koi8-r.vim +++ b/runtime/lang/menu_ru_ru.koi8-r.vim @@ -1,9 +1,10 @@ " Menu Translations: Russian -" Maintainer: vassily ragosin -" Last Change: 26 Apr 2004 +" Maintainer: Sergey Alyoshin +" Previous Maintainer: vassily ragosin +" Last Change: 29 May 2013 " URL: cvs://cvs.sf.net:/cvsroot/ruvim/extras/menu/menu_ru_ru.vim " -" $Id: menu_ru_ru.koi8-r.vim,v 1.2 2004/06/16 11:19:21 vimboss Exp $ +" $Id: menu_ru_ru.vim,v 1.1 2004/06/13 16:09:10 vimboss Exp $ " " Adopted for RuVim project by Vassily Ragosin. " First translation: Tim Alexeevsky , @@ -16,6 +17,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding koi8-r @@ -48,6 +51,7 @@ menutrans &About & " File menu menutrans &Open\.\.\.:e &ïÔËÒÙÔØ\.\.\.:e menutrans Sp&lit-Open\.\.\.:sp ðÏ&ÄÅÌÉÔØ\ ÏËÎÏ\.\.\.:sp +menutrans Open\ Tab\.\.\.:tabnew ïÔËÒÙÔØ\ ×&ËÌÁÄËÕ\.\.\.:tabnew menutrans &New:enew &îÏ×ÙÊ:enew menutrans &Close:close &úÁËÒÙÔØ:close "-------------------- @@ -75,51 +79,57 @@ menutrans Put\ &After]p menutrans &Deletex &õÄÁÌÉÔØx menutrans &Select\ AllggVG ÷&ÙÄÅÌÉÔØ\ ×Ó£ggVG "-------------------- +" Athena GUI only +menutrans &Find/ &ðÏÉÓË/ +menutrans Find\ and\ Rep&lace:%s ðÏÉÓË\ É\ &ÚÁÍÅÎÁ:%s +" End Athena GUI only menutrans &Find\.\.\./ &ðÏÉÓË\.\.\./ menutrans Find\ and\ Rep&lace\.\.\. ðÏÉÓË\ É\ &ÚÁÍÅÎÁ\.\.\. menutrans Find\ and\ Rep&lace\.\.\.:%s ðÏÉÓË\ É\ &ÚÁÍÅÎÁ\.\.\.:%s -menutrans Find\ and\ Rep&lace\.\.\.:s ðÏÉÓË\ É\ &ÚÁÍÅÎÁ\.\.\.:s +menutrans Find\ and\ Rep&lace\.\.\.:s ðÏÉÓË\ É\ &ÚÁÍÅÎÁ\.\.\.:s "-------------------- menutrans Settings\ &Window ïËÎÏ\ ÎÁÓÔÒÏÊËÉ\ &ÏÐÃÉÊ +menutrans Startup\ &Settings îÁÓÔÒÏÊËÉ\ ÚÁÐÕÓ&ËÁ menutrans &Global\ Settings &çÌÏÂÁÌØÎÙÅ\ ÎÁÓÔÒÏÊËÉ menutrans F&ile\ Settings îÁÓÔÒÏÊËÉ\ &ÆÁÊÌÏ× menutrans C&olor\ Scheme &ã×ÅÔÏ×ÁÑ\ ÓÈÅÍÁ menutrans &Keymap òÁÓËÌÁÄËÁ\ ËÌ&Á×ÉÁÔÕÒÙ menutrans Select\ Fo&nt\.\.\. ÷ÙÂÏÒ\ &ÛÒÉÆÔÁ\.\.\. ">>>----------------- Edit/Global settings -menutrans Toggle\ Pattern\ &Highlight:set\ hls! ðÏÄÓ×ÅÔËÁ\ &ÎÁÊÄÅÎÎÙÈ\ ÓÏÏÔ×ÅÔÓÔ×ÉÊ:set\ hls! -menutrans Toggle\ &Ignore-case:set\ ic! &òÅÇÉÓÔÒÏÎÅÚÁ×ÉÓÉÍÙÊ\ ÐÏÉÓË:set\ ic! -menutrans Toggle\ &Showmatch:set\ sm! ðÏËÁÚÙ×ÁÔØ\ ÐÁÒÎÙÅ\ &ÜÌÅÍÅÎÔÙ:set\ sm! -menutrans &Context\ lines óÔÒ&ÏË\ ×ÏËÒÕÇ\ ËÕÒÓÏÒÁ -menutrans &Virtual\ Edit ÷ÉÒ&ÔÕÁÌØÎÏÅ\ ÒÅÄÁËÔÉÒÏ×ÁÎÉÅ -menutrans Toggle\ Insert\ &Mode:set\ im! òÅÖÉÍ\ &÷ÓÔÁ×ËÉ:set\ im! -menutrans Toggle\ Vi\ C&ompatible:set\ cp! &óÏ×ÍÅÓÔÉÍÏÓÔØ\ Ó\ Vi:set\ cp! -menutrans Search\ &Path\.\.\. &ðÕÔØ\ ÄÌÑ\ ÐÏÉÓËÁ\ ÆÁÊÌÏ×\.\.\. -menutrans Ta&g\ Files\.\.\. æÁÊÌÙ\ &ÍÅÔÏË\.\.\. -" -menutrans Toggle\ &Toolbar &éÎÓÔÒÕÍÅÎÔÁÌØÎÁÑ\ ÐÁÎÅÌØ -menutrans Toggle\ &Bottom\ Scrollbar ðÏÌÏÓÁ\ ÐÒÏËÒÕÔËÉ\ ×ÎÉ&ÚÕ -menutrans Toggle\ &Left\ Scrollbar ðÏÌÏÓÁ\ ÐÒÏËÒÕÔËÉ\ Ó&ÌÅ×Á -menutrans Toggle\ &Right\ Scrollbar ðÏÌÏÓÁ\ ÐÒÏËÒÕÔËÉ\ ÓÐÒ&Á×Á +menutrans Toggle\ Pattern\ &Highlight:set\ hls! ðÏÄÓ×ÅÔËÁ\ &ÎÁÊÄÅÎÎÙÈ\ ÓÏÏÔ×ÅÔÓÔ×ÉÊ:set\ hls! +menutrans Toggle\ &Ignore-case:set\ ic! &òÅÇÉÓÔÒÏÎÅÚÁ×ÉÓÉÍÙÊ\ ÐÏÉÓË:set\ ic! +menutrans Toggle\ &Showmatch:set\ sm! ðÏËÁÚÙ×ÁÔØ\ ÐÁÒÎÙÅ\ &ÜÌÅÍÅÎÔÙ:set\ sm! +menutrans &Context\ lines óÔÒ&ÏË\ ×ÏËÒÕÇ\ ËÕÒÓÏÒÁ +menutrans &Virtual\ Edit ÷ÉÒ&ÔÕÁÌØÎÏÅ\ ÒÅÄÁËÔÉÒÏ×ÁÎÉÅ +menutrans Toggle\ Insert\ &Mode:set\ im! òÅÖÉÍ\ &÷ÓÔÁ×ËÉ:set\ im! +menutrans Toggle\ Vi\ C&ompatible:set\ cp! &óÏ×ÍÅÓÔÉÍÏÓÔØ\ Ó\ Vi:set\ cp! +menutrans Search\ &Path\.\.\. &ðÕÔØ\ ÄÌÑ\ ÐÏÉÓËÁ\ ÆÁÊÌÏ×\.\.\. +menutrans Ta&g\ Files\.\.\. æÁÊÌÙ\ &ÍÅÔÏË\.\.\. +" +menutrans Toggle\ &Toolbar &éÎÓÔÒÕÍÅÎÔÁÌØÎÁÑ\ ÐÁÎÅÌØ +menutrans Toggle\ &Bottom\ Scrollbar ðÏÌÏÓÁ\ ÐÒÏËÒÕÔËÉ\ ×ÎÉ&ÚÕ +menutrans Toggle\ &Left\ Scrollbar ðÏÌÏÓÁ\ ÐÒÏËÒÕÔËÉ\ Ó&ÌÅ×Á +menutrans Toggle\ &Right\ Scrollbar ðÏÌÏÓÁ\ ÐÒÏËÒÕÔËÉ\ ÓÐÒ&Á×Á ">>>->>>------------- Edit/Global settings/Virtual edit -menutrans Never ÷ÙËÌÀÞÅÎÏ -menutrans Block\ Selection ðÒÉ\ ×ÙÄÅÌÅÎÉÉ\ ÂÌÏËÁ -menutrans Insert\ mode ÷\ ÒÅÖÉÍÅ\ ÷ÓÔÁ×ËÉ -menutrans Block\ and\ Insert ðÒÉ\ ×ÙÄÅÌÅÎÉÉ\ ÂÌÏËÁ\ É\ ×\ ÒÅÖÉÍÅ\ ÷ÓÔÁ×ËÉ -menutrans Always ÷ËÌÀÞÅÎÏ\ ×ÓÅÇÄÁ +menutrans Never ÷ÙËÌÀÞÅÎÏ +menutrans Block\ Selection ðÒÉ\ ×ÙÄÅÌÅÎÉÉ\ ÂÌÏËÁ +menutrans Insert\ mode ÷\ ÒÅÖÉÍÅ\ ÷ÓÔÁ×ËÉ +menutrans Block\ and\ Insert ðÒÉ\ ×ÙÄÅÌÅÎÉÉ\ ÂÌÏËÁ\ É\ ×\ ÒÅÖÉÍÅ\ ÷ÓÔÁ×ËÉ +menutrans Always ÷ËÌÀÞÅÎÏ\ ×ÓÅÇÄÁ ">>>----------------- Edit/File settings -menutrans Toggle\ Line\ &Numbering:set\ nu! &îÕÍÅÒÁÃÉÑ\ ÓÔÒÏË:set\ nu! -menutrans Toggle\ &List\ Mode:set\ list! ïÔÏÂÒÁ&ÖÅÎÉÅ\ ÎÅ×ÉÄÉÍÙÈ\ ÓÉÍ×ÏÌÏ×:set\ list! -menutrans Toggle\ Line\ &Wrap:set\ wrap! &ðÅÒÅÎÏÓ\ ÄÌÉÎÎÙÈ\ ÓÔÒÏË:set\ wrap! -menutrans Toggle\ W&rap\ at\ word:set\ lbr! ðÅÒÅÎÏÓ\ &ÃÅÌÙÈ\ ÓÌÏ×:set\ lbr! -menutrans Toggle\ &expand-tab:set\ et! ðÒÏ&ÂÅÌÙ\ ×ÍÅÓÔÏ\ ÔÁÂÕÌÑÃÉÉ:set\ et! -menutrans Toggle\ &auto-indent:set\ ai! á×ÔÏÍÁÔÉÞÅÓËÏÅ\ ÆÏÒÍÁÔÉÒÏ×ÁÎÉÅ\ &ÏÔÓÔÕÐÏ×:set\ ai! -menutrans Toggle\ &C-indenting:set\ cin! æÏÒÍÁÔÉÒÏ×ÁÎÉÅ\ ÏÔÓÔÕÐÏ×\ ×\ &ÓÔÉÌÅ\ C:set\ cin! +menutrans Toggle\ Line\ &Numbering:set\ nu! &îÕÍÅÒÁÃÉÑ\ ÓÔÒÏË:set\ nu! +menutrans Toggle\ relati&ve\ Line\ Numbering:set\ rnu! ïÔÎÏÓÉÔÅ&ÌØÎÁÑ\ ÎÕÍÅÒÁÃÉÑ\ ÓÔÒÏË:set\ nru! +menutrans Toggle\ &List\ Mode:set\ list! ïÔÏÂÒÁ&ÖÅÎÉÅ\ ÎÅ×ÉÄÉÍÙÈ\ ÓÉÍ×ÏÌÏ×:set\ list! +menutrans Toggle\ Line\ &Wrap:set\ wrap! &ðÅÒÅÎÏÓ\ ÄÌÉÎÎÙÈ\ ÓÔÒÏË:set\ wrap! +menutrans Toggle\ W&rap\ at\ word:set\ lbr! ðÅÒÅÎÏÓ\ &ÃÅÌÙÈ\ ÓÌÏ×:set\ lbr! +menutrans Toggle\ &expand-tab:set\ et! ðÒÏ&ÂÅÌÙ\ ×ÍÅÓÔÏ\ ÔÁÂÕÌÑÃÉÉ:set\ et! +menutrans Toggle\ &auto-indent:set\ ai! á×ÔÏÍÁÔÉÞÅÓËÏÅ\ ÆÏÒÍÁÔÉÒÏ×ÁÎÉÅ\ &ÏÔÓÔÕÐÏ×:set\ ai! +menutrans Toggle\ &C-indenting:set\ cin! æÏÒÍÁÔÉÒÏ×ÁÎÉÅ\ ÏÔÓÔÕÐÏ×\ ×\ &ÓÔÉÌÅ\ C:set\ cin! ">>>--- -menutrans &Shiftwidth ÷ÅÌÉ&ÞÉÎÁ\ ÏÔÓÔÕÐÁ -menutrans Soft\ &Tabstop ûÉÒÉÎÁ\ &ÔÁÂÕÌÑÃÉÉ -menutrans Te&xt\ Width\.\.\. &ûÉÒÉÎÁ\ ÔÅËÓÔÁ\.\.\. -menutrans &File\ Format\.\.\. &æÏÒÍÁÔ\ ÆÁÊÌÁ\.\.\. +menutrans &Shiftwidth ÷ÅÌÉ&ÞÉÎÁ\ ÏÔÓÔÕÐÁ +menutrans Soft\ &Tabstop ûÉÒÉÎÁ\ &ÔÁÂÕÌÑÃÉÉ +menutrans Te&xt\ Width\.\.\. &ûÉÒÉÎÁ\ ÔÅËÓÔÁ\.\.\. +menutrans &File\ Format\.\.\. &æÏÒÍÁÔ\ ÆÁÊÌÁ\.\.\. " " " @@ -129,6 +139,7 @@ menutrans Jump\ &back^T & menutrans Build\ &Tags\ File óÏÚÄÁÔØ\ &ÆÁÊÌ\ ÍÅÔÏË "------------------- menutrans &Folding òÁÂÏÔÁ\ ÓÏ\ &ÓËÌÁÄËÁÍÉ +menutrans &Spelling ðÒ&Á×ÏÐÉÓÁÎÉÅ menutrans &Diff &ïÔÌÉÞÉÑ\ (diff) "------------------- menutrans &Make:make ëÏ&ÍÐÉÌÑÃÉÑ:make @@ -139,10 +150,26 @@ menutrans &Previous\ Error:cp menutrans &Older\ List:cold âÏÌÅÅ\ ÓÔÁÒ&ÙÊ\ ÓÐÉÓÏË\ ÏÛÉÂÏË:cold menutrans N&ewer\ List:cnew âÏÌÅÅ\ Ó×Å&ÖÉÊ\ ÓÐÉÓÏË\ ÏÛÉÂÏË:cnew menutrans Error\ &Window ïË&ÎÏ\ ÏÛÉÂÏË -menutrans &Set\ Compiler ÷ÙÂÏÒ\ &ËÏÍÐÉÌÑÔÏÒÁ +menutrans Se&T\ Compiler ÷ÙÂÏÒ\ &ËÏÍÐÉÌÑÔÏÒÁ "------------------- menutrans &Convert\ to\ HEX:%!xxd ð&ÅÒÅ×ÅÓÔÉ\ ×\ HEX:%!xxd menutrans Conve&rt\ back:%!xxd\ -r ðÅÒÅ×ÅÓÔÉ\ É&Ú\ HEX:%!xxd\ -r +">>>---------------- Tools/Spelling +menutrans &Spell\ Check\ On &÷ËÌ\ ÐÒÏ×ÅÒËÕ\ ÐÒÁ×ÏÐÉÓÁÎÉÑ +menutrans Spell\ Check\ &Off ÷Ù&ËÌ\ ÐÒÏ×ÅÒËÕ\ ÐÒÁ×ÏÐÉÓÁÎÉÑ +menutrans To\ &Next\ error]s &óÌÅÄÕÀÝÁÑ\ ÏÛÉÂËÁ +menutrans To\ &Previous\ error[s &ðÒÅÄÙÄÕÝÁÑ\ ÏÛÉÂËÁ +menutrans Suggest\ &Correctionsz= ðÒÅÄÌÏÖÉÔØ\ ÉÓÐ&ÒÁ×ÌÅÎÉÑ +menutrans &Repeat\ correction:spellrepall ðÏ×&ÔÏÒÉÔØ\ ÉÓÐÒÁ×ÌÅÎÉÅ\ ÄÌÑ\ ×ÓÅÈ +"------------------- +menutrans Set\ language\ to\ "en" õÓÔÁÎÏ×ÉÔØ\ ÑÚÙË\ "en" +menutrans Set\ language\ to\ "en_au" õÓÔÁÎÏ×ÉÔØ\ ÑÚÙË\ "en_au" +menutrans Set\ language\ to\ "en_ca" õÓÔÁÎÏ×ÉÔØ\ ÑÚÙË\ "en_ca" +menutrans Set\ language\ to\ "en_gb" õÓÔÁÎÏ×ÉÔØ\ ÑÚÙË\ "en_gb" +menutrans Set\ language\ to\ "en_nz" õÓÔÁÎÏ×ÉÔØ\ ÑÚÙË\ "en_nz" +menutrans Set\ language\ to\ "en_us" õÓÔÁÎÏ×ÉÔØ\ ÑÚÙË\ "en_us" +menutrans &Find\ More\ Languages &îÁÊÔÉ\ ÂÏÌØÛÅ\ ÑÚÙËÏ× +let g:menutrans_set_lang_to = 'õÓÔÁÎÏ×ÉÔØ ÑÚÙË' ">>>---------------- Folds menutrans &Enable/Disable\ foldszi ÷ËÌ/×ÙËÌ\ &ÓËÌÁÄËÉzi menutrans &View\ Cursor\ Linezv ïÔËÒÙÔØ\ ÓÔÒÏËÕ\ Ó\ &ËÕÒÓÏÒÏÍzv @@ -217,7 +244,7 @@ menutrans M&in\ Height^W1_ menutrans Max\ &Width^W\| íÁËÓÉÍÁÌØÎÁÑ\ &ÛÉÒÉÎÁ^W\| menutrans Min\ Widt&h^W1\| íÉÎÉÍÁÌ&ØÎÁÑ\ ÛÉÒÉÎÁ^W1\| ">>>----------------- Window/Move To -menutrans &Top^WK îÁ&×ÅÒÈ^WK +menutrans &Top^WK ÷&×ÅÒÈ^WK menutrans &Bottom^WJ ÷&ÎÉÚ^WJ menutrans &Left\ side^WH ÷&ÌÅ×Ï^WH menutrans &Right\ side^WL ÷&ÐÒÁ×Ï^WL @@ -294,3 +321,6 @@ let g:menutrans_fileformat_dialog = " let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\nï&ÔÍÅÎÁ" " let menutrans_no_file = "[îÅÔ ÆÁÊÌÁ]" + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_ru_ru.vim b/runtime/lang/menu_ru_ru.vim index b726152..6961608 100644 --- a/runtime/lang/menu_ru_ru.vim +++ b/runtime/lang/menu_ru_ru.vim @@ -1,6 +1,7 @@ " Menu Translations: Russian -" Maintainer: vassily ragosin -" Last Change: 26 Apr 2004 +" Maintainer: Sergey Alyoshin +" Previous Maintainer: vassily ragosin +" Last Change: 29 May 2013 " URL: cvs://cvs.sf.net:/cvsroot/ruvim/extras/menu/menu_ru_ru.vim " " $Id: menu_ru_ru.vim,v 1.1 2004/06/13 16:09:10 vimboss Exp $ @@ -16,6 +17,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding utf-8 @@ -48,6 +51,7 @@ menutrans &About &Заставка " File menu menutrans &Open\.\.\.:e &Открыть\.\.\.:e menutrans Sp&lit-Open\.\.\.:sp По&делить\ окно\.\.\.:sp +menutrans Open\ Tab\.\.\.:tabnew Открыть\ в&кладку\.\.\.:tabnew menutrans &New:enew &Новый:enew menutrans &Close:close &Закрыть:close "-------------------- @@ -75,51 +79,57 @@ menutrans Put\ &After]p Вклеить\ по&сле]p menutrans &Deletex &Удалитьx menutrans &Select\ AllggVG В&ыделить\ всёggVG "-------------------- +" Athena GUI only +menutrans &Find/ &Поиск/ +menutrans Find\ and\ Rep&lace:%s Поиск\ и\ &замена:%s +" End Athena GUI only menutrans &Find\.\.\./ &Поиск\.\.\./ -menutrans Find\ and\ Rep&lace\.\.\. Поиск\ и\ &замена\.\.\. -menutrans Find\ and\ Rep&lace\.\.\.:%s Поиск\ и\ &замена\.\.\.:%s -menutrans Find\ and\ Rep&lace\.\.\.:s Поиск\ и\ &замена\.\.\.:s +menutrans Find\ and\ Rep&lace\.\.\. Поиск\ и\ &замена\.\.\. +menutrans Find\ and\ Rep&lace\.\.\.:%s Поиск\ и\ &замена\.\.\.:%s +menutrans Find\ and\ Rep&lace\.\.\.:s Поиск\ и\ &замена\.\.\.:s "-------------------- menutrans Settings\ &Window Окно\ настройки\ &опций +menutrans Startup\ &Settings Настройки\ запус&ка menutrans &Global\ Settings &Глобальные\ настройки menutrans F&ile\ Settings Настройки\ &файлов menutrans C&olor\ Scheme &Цветовая\ схема menutrans &Keymap Раскладка\ кл&авиатуры menutrans Select\ Fo&nt\.\.\. Выбор\ &шрифта\.\.\. ">>>----------------- Edit/Global settings -menutrans Toggle\ Pattern\ &Highlight:set\ hls! Подсветка\ &найденных\ соответствий:set\ hls! -menutrans Toggle\ &Ignore-case:set\ ic! &Регистронезависимый\ поиск:set\ ic! -menutrans Toggle\ &Showmatch:set\ sm! Показывать\ парные\ &элементы:set\ sm! -menutrans &Context\ lines Стр&ок\ вокруг\ курсора -menutrans &Virtual\ Edit Вир&туальное\ редактирование -menutrans Toggle\ Insert\ &Mode:set\ im! Режим\ &Вставки:set\ im! -menutrans Toggle\ Vi\ C&ompatible:set\ cp! &Совместимость\ с\ Vi:set\ cp! -menutrans Search\ &Path\.\.\. &Путь\ для\ поиска\ файлов\.\.\. -menutrans Ta&g\ Files\.\.\. Файлы\ &меток\.\.\. -" -menutrans Toggle\ &Toolbar &Инструментальная\ панель -menutrans Toggle\ &Bottom\ Scrollbar Полоса\ прокрутки\ вни&зу -menutrans Toggle\ &Left\ Scrollbar Полоса\ прокрутки\ с&лева -menutrans Toggle\ &Right\ Scrollbar Полоса\ прокрутки\ спр&ава +menutrans Toggle\ Pattern\ &Highlight:set\ hls! Подсветка\ &найденных\ соответствий:set\ hls! +menutrans Toggle\ &Ignore-case:set\ ic! &Регистронезависимый\ поиск:set\ ic! +menutrans Toggle\ &Showmatch:set\ sm! Показывать\ парные\ &элементы:set\ sm! +menutrans &Context\ lines Стр&ок\ вокруг\ курсора +menutrans &Virtual\ Edit Вир&туальное\ редактирование +menutrans Toggle\ Insert\ &Mode:set\ im! Режим\ &Вставки:set\ im! +menutrans Toggle\ Vi\ C&ompatible:set\ cp! &Совместимость\ с\ Vi:set\ cp! +menutrans Search\ &Path\.\.\. &Путь\ для\ поиска\ файлов\.\.\. +menutrans Ta&g\ Files\.\.\. Файлы\ &меток\.\.\. +" +menutrans Toggle\ &Toolbar &Инструментальная\ панель +menutrans Toggle\ &Bottom\ Scrollbar Полоса\ прокрутки\ вни&зу +menutrans Toggle\ &Left\ Scrollbar Полоса\ прокрутки\ с&лева +menutrans Toggle\ &Right\ Scrollbar Полоса\ прокрутки\ спр&ава ">>>->>>------------- Edit/Global settings/Virtual edit -menutrans Never Выключено -menutrans Block\ Selection При\ выделении\ блока -menutrans Insert\ mode В\ режиме\ Вставки -menutrans Block\ and\ Insert При\ выделении\ блока\ и\ в\ режиме\ Вставки -menutrans Always Включено\ всегда +menutrans Never Выключено +menutrans Block\ Selection При\ выделении\ блока +menutrans Insert\ mode В\ режиме\ Вставки +menutrans Block\ and\ Insert При\ выделении\ блока\ и\ в\ режиме\ Вставки +menutrans Always Включено\ всегда ">>>----------------- Edit/File settings -menutrans Toggle\ Line\ &Numbering:set\ nu! &Нумерация\ строк:set\ nu! -menutrans Toggle\ &List\ Mode:set\ list! Отобра&жение\ невидимых\ символов:set\ list! -menutrans Toggle\ Line\ &Wrap:set\ wrap! &Перенос\ длинных\ строк:set\ wrap! -menutrans Toggle\ W&rap\ at\ word:set\ lbr! Перенос\ &целых\ слов:set\ lbr! -menutrans Toggle\ &expand-tab:set\ et! Про&белы\ вместо\ табуляции:set\ et! -menutrans Toggle\ &auto-indent:set\ ai! Автоматическое\ форматирование\ &отступов:set\ ai! -menutrans Toggle\ &C-indenting:set\ cin! Форматирование\ отступов\ в\ &стиле\ C:set\ cin! +menutrans Toggle\ Line\ &Numbering:set\ nu! &Нумерация\ строк:set\ nu! +menutrans Toggle\ relati&ve\ Line\ Numbering:set\ rnu! Относите&льная\ нумерация\ строк:set\ nru! +menutrans Toggle\ &List\ Mode:set\ list! Отобра&жение\ невидимых\ символов:set\ list! +menutrans Toggle\ Line\ &Wrap:set\ wrap! &Перенос\ длинных\ строк:set\ wrap! +menutrans Toggle\ W&rap\ at\ word:set\ lbr! Перенос\ &целых\ слов:set\ lbr! +menutrans Toggle\ &expand-tab:set\ et! Про&белы\ вместо\ табуляции:set\ et! +menutrans Toggle\ &auto-indent:set\ ai! Автоматическое\ форматирование\ &отступов:set\ ai! +menutrans Toggle\ &C-indenting:set\ cin! Форматирование\ отступов\ в\ &стиле\ C:set\ cin! ">>>--- -menutrans &Shiftwidth Вели&чина\ отступа -menutrans Soft\ &Tabstop Ширина\ &табуляции -menutrans Te&xt\ Width\.\.\. &Ширина\ текста\.\.\. -menutrans &File\ Format\.\.\. &Формат\ файла\.\.\. +menutrans &Shiftwidth Вели&чина\ отступа +menutrans Soft\ &Tabstop Ширина\ &табуляции +menutrans Te&xt\ Width\.\.\. &Ширина\ текста\.\.\. +menutrans &File\ Format\.\.\. &Формат\ файла\.\.\. " " " @@ -129,6 +139,7 @@ menutrans Jump\ &back^T &Вернуться\ назад^T menutrans Build\ &Tags\ File Создать\ &файл\ меток "------------------- menutrans &Folding Работа\ со\ &складками +menutrans &Spelling Пр&авописание menutrans &Diff &Отличия\ (diff) "------------------- menutrans &Make:make Ко&мпиляция:make @@ -139,10 +150,26 @@ menutrans &Previous\ Error:cp П&редыдущая\ ошибка:cp menutrans &Older\ List:cold Более\ стар&ый\ список\ ошибок:cold menutrans N&ewer\ List:cnew Более\ све&жий\ список\ ошибок:cnew menutrans Error\ &Window Ок&но\ ошибок -menutrans &Set\ Compiler Выбор\ &компилятора +menutrans Se&T\ Compiler Выбор\ &компилятора "------------------- menutrans &Convert\ to\ HEX:%!xxd П&еревести\ в\ HEX:%!xxd menutrans Conve&rt\ back:%!xxd\ -r Перевести\ и&з\ HEX:%!xxd\ -r +">>>---------------- Tools/Spelling +menutrans &Spell\ Check\ On &Вкл\ проверку\ правописания +menutrans Spell\ Check\ &Off Вы&кл\ проверку\ правописания +menutrans To\ &Next\ error]s &Следующая\ ошибка +menutrans To\ &Previous\ error[s &Предыдущая\ ошибка +menutrans Suggest\ &Correctionsz= Предложить\ исп&равления +menutrans &Repeat\ correction:spellrepall Пов&торить\ исправление\ для\ всех +"------------------- +menutrans Set\ language\ to\ "en" Установить\ язык\ "en" +menutrans Set\ language\ to\ "en_au" Установить\ язык\ "en_au" +menutrans Set\ language\ to\ "en_ca" Установить\ язык\ "en_ca" +menutrans Set\ language\ to\ "en_gb" Установить\ язык\ "en_gb" +menutrans Set\ language\ to\ "en_nz" Установить\ язык\ "en_nz" +menutrans Set\ language\ to\ "en_us" Установить\ язык\ "en_us" +menutrans &Find\ More\ Languages &Найти\ больше\ языков +let g:menutrans_set_lang_to = 'Установить язык' ">>>---------------- Folds menutrans &Enable/Disable\ foldszi Вкл/выкл\ &складкиzi menutrans &View\ Cursor\ Linezv Открыть\ строку\ с\ &курсоромzv @@ -217,7 +244,7 @@ menutrans M&in\ Height^W1_ Минимальная\ высо&та^W1 menutrans Max\ &Width^W\| Максимальная\ &ширина^W\| menutrans Min\ Widt&h^W1\| Минимал&ьная\ ширина^W1\| ">>>----------------- Window/Move To -menutrans &Top^WK На&верх^WK +menutrans &Top^WK В&верх^WK menutrans &Bottom^WJ В&низ^WJ menutrans &Left\ side^WH В&лево^WH menutrans &Right\ side^WL В&право^WL @@ -294,3 +321,6 @@ let g:menutrans_fileformat_dialog = "Выберите формат файла." let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\nО&тмена" " let menutrans_no_file = "[Нет файла]" + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_sk_sk.iso_8859-2.vim b/runtime/lang/menu_sk_sk.iso_8859-2.vim index bace7d2..69de4e7 100644 --- a/runtime/lang/menu_sk_sk.iso_8859-2.vim +++ b/runtime/lang/menu_sk_sk.iso_8859-2.vim @@ -1,12 +1,14 @@ " Menu Translations: Slovak " Translated By: Martin Lacko -" Last Change: 2003 Mar 30 +" Last Change: 2012 May 01 " Quit when menu translations have already been done. if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding iso-8859-2 @@ -230,3 +232,6 @@ menutrans on/off\ for\ &This\ file Zapn menutrans Co&lor\ test Test\ &farieb menutrans &Highlight\ test &Test\ zvýrazòovania menutrans &Convert\ to\ HTML &Previes»\ do\ HTML + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_sl_si.cp1250.vim b/runtime/lang/menu_sl_si.cp1250.vim index 23f668c..8999b15 100644 --- a/runtime/lang/menu_sl_si.cp1250.vim +++ b/runtime/lang/menu_sl_si.cp1250.vim @@ -11,6 +11,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding cp1250 @@ -292,3 +294,6 @@ let g:menutrans_textwidth_dialog = "Vnesite novo let g:menutrans_fileformat_dialog = "Izberite format datoteke" let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\n&Preklièi" " }}} + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_sl_si.latin2.vim b/runtime/lang/menu_sl_si.latin2.vim index 57d6c89..fd50387 100644 --- a/runtime/lang/menu_sl_si.latin2.vim +++ b/runtime/lang/menu_sl_si.latin2.vim @@ -11,6 +11,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding latin2 @@ -292,3 +294,6 @@ let g:menutrans_textwidth_dialog = "Vnesite novo let g:menutrans_fileformat_dialog = "Izberite format datoteke" let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\n&Preklièi" " }}} + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_sl_si.utf-8.vim b/runtime/lang/menu_sl_si.utf-8.vim index 306e449..7043e62 100644 --- a/runtime/lang/menu_sl_si.utf-8.vim +++ b/runtime/lang/menu_sl_si.utf-8.vim @@ -11,6 +11,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding utf-8 @@ -292,3 +294,6 @@ let g:menutrans_textwidth_dialog = "Vnesite novo Å¡irino besedila (ali 0 za izkl let g:menutrans_fileformat_dialog = "Izberite format datoteke" let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\n&Prekliči" " }}} + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_slovak_slovak_republic.1250.vim b/runtime/lang/menu_slovak_slovak_republic.1250.vim index 1df513d..cfc6078 100644 --- a/runtime/lang/menu_slovak_slovak_republic.1250.vim +++ b/runtime/lang/menu_slovak_slovak_republic.1250.vim @@ -1,12 +1,14 @@ " Menu Translations: Slovak " Translated By: Martin Lacko -" Last Change: 2006 Jun 17 +" Last Change: 2012 May 01 " Quit when menu translations have already been done. if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding cp1250 @@ -230,3 +232,6 @@ menutrans on/off\ for\ &This\ file Zapn menutrans Co&lor\ test Test\ &farieb menutrans &Highlight\ test &Test\ zvýrazòovania menutrans &Convert\ to\ HTML &Previes\ do\ HTML + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_sr_rs.ascii.vim b/runtime/lang/menu_sr_rs.ascii.vim index 14a9026..8a12dad 100644 --- a/runtime/lang/menu_sr_rs.ascii.vim +++ b/runtime/lang/menu_sr_rs.ascii.vim @@ -7,6 +7,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim " Help menu menutrans &Help Pomo&c @@ -256,3 +258,6 @@ let g:menutrans_textwidth_dialog = "Unesite novu sirinu teksta (0 sprecava prelo let g:menutrans_fileformat_dialog = "Izaberite vrstu datoteke" let menutrans_no_file = "[Nema datoteke]" + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_sr_rs.iso_8859-2.vim b/runtime/lang/menu_sr_rs.iso_8859-2.vim index 992124c..f4b8c68 100644 --- a/runtime/lang/menu_sr_rs.iso_8859-2.vim +++ b/runtime/lang/menu_sr_rs.iso_8859-2.vim @@ -7,6 +7,9 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim + scriptencoding iso8859-2 " Help menu @@ -257,3 +260,6 @@ let g:menutrans_textwidth_dialog = "Unesite novu let g:menutrans_fileformat_dialog = "Izaberite vrstu datoteke" let menutrans_no_file = "[Nema datoteke]" + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_sr_rs.iso_8859-5.vim b/runtime/lang/menu_sr_rs.iso_8859-5.vim index e4d322d..dd3b436 100644 --- a/runtime/lang/menu_sr_rs.iso_8859-5.vim +++ b/runtime/lang/menu_sr_rs.iso_8859-5.vim @@ -7,6 +7,9 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim + scriptencoding iso8859-5 " Help menu @@ -257,3 +260,6 @@ let g:menutrans_textwidth_dialog = " let g:menutrans_fileformat_dialog = "¸×ÐÑÕàØâÕ Òàáâã ÔÐâÞâÕÚÕ" let menutrans_no_file = "[½ÕÜÐ ÔÐâÞâÕÚÕ]" + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_sr_rs.utf-8.vim b/runtime/lang/menu_sr_rs.utf-8.vim index 85f1491..b9e536d 100644 --- a/runtime/lang/menu_sr_rs.utf-8.vim +++ b/runtime/lang/menu_sr_rs.utf-8.vim @@ -7,6 +7,9 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim + scriptencoding utf-8 " Help menu @@ -258,4 +261,7 @@ let g:menutrans_fileformat_dialog = "Изаберите врсту датоте let menutrans_no_file = "[Нема датотеке]" +let &cpo = s:keepcpo +unlet s:keepcpo + " vim: tw=0 keymap=serbian diff --git a/runtime/lang/menu_sv_se.latin1.vim b/runtime/lang/menu_sv_se.latin1.vim index 8935e0d..2e37485 100644 --- a/runtime/lang/menu_sv_se.latin1.vim +++ b/runtime/lang/menu_sv_se.latin1.vim @@ -1,12 +1,14 @@ " Menu Translations: Swedish " Maintainer: Johan Svedberg -" Last Change: 2006 Apr 13 +" Last Change: 2012 May 01 " Quit when menu translations have already been done. if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim " The translations below are in latin1, but they work for cp1252 and " iso-8859-15 without conversion as well. @@ -248,3 +250,6 @@ let g:menutrans_path_dialog = "Skriv in s let g:menutrans_tags_dialog = "Skriv in namn på taggfiler.\nSeparera namn med komma." let g:menutrans_textwidth_dialog = "Välj ny textbredd (0 för att förhindra formatering): " let g:menutrans_fileformat_dialog = "Välj filformat som filen ska sparas med" + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_uk_ua.cp1251.vim b/runtime/lang/menu_uk_ua.cp1251.vim index a517ecd..2e751c8 100644 --- a/runtime/lang/menu_uk_ua.cp1251.vim +++ b/runtime/lang/menu_uk_ua.cp1251.vim @@ -12,6 +12,9 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim + scriptencoding cp1251 " Help menu @@ -244,3 +247,5 @@ let g:menutrans_tags_dialog = " let g:menutrans_textwidth_dialog = "Âêàæ³òü íîâó øèðèíó òåêñòó (0 äëÿ â³äì³íè ôîìàòóâàííÿ)" let g:menutrans_fileformat_dialog = "Âèáåð³òü ôîðìàò ôàéëó" +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_uk_ua.koi8-u.vim b/runtime/lang/menu_uk_ua.koi8-u.vim index 6284145..c44700e 100644 --- a/runtime/lang/menu_uk_ua.koi8-u.vim +++ b/runtime/lang/menu_uk_ua.koi8-u.vim @@ -12,6 +12,9 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim + scriptencoding koi8-u " Help menu @@ -244,3 +247,5 @@ let g:menutrans_tags_dialog = " let g:menutrans_textwidth_dialog = "÷ËÁÖ¦ÔØ ÎÏ×Õ ÛÉÒÉÎÕ ÔÅËÓÔÕ (0 ÄÌÑ ×¦ÄͦÎÉ ÆÏÍÁÔÕ×ÁÎÎÑ)" let g:menutrans_fileformat_dialog = "÷ÉÂÅÒ¦ÔØ ÆÏÒÍÁÔ ÆÁÊÌÕ" +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_vi_vn.vim b/runtime/lang/menu_vi_vn.vim index 4b2b21f..9fbd2c6 100644 --- a/runtime/lang/menu_vi_vn.vim +++ b/runtime/lang/menu_vi_vn.vim @@ -14,6 +14,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding utf-8 @@ -327,3 +329,6 @@ let g:menutrans_fileformat_dialog = "Hãy chọn định dạng tập tin." let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\n&Hủy bỏ" " let menutrans_no_file = "[không có tập tin]" + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_zh_cn.gb2312.vim b/runtime/lang/menu_zh_cn.gb2312.vim index 3ec825c..a12d94d 100644 --- a/runtime/lang/menu_zh_cn.gb2312.vim +++ b/runtime/lang/menu_zh_cn.gb2312.vim @@ -9,6 +9,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim " This causes trouble for a broken iconv (symptom: last character is always " ??). Without this it works fine anyway, because gbk/cp936 is a superset of @@ -264,3 +266,6 @@ menutrans &Highlight\ test menutrans &Convert\ to\ HTML ת»»³É\ HTML(&C) menutrans Set\ '&syntax'\ only ½öÉ趨\ 'syntax'(&S) menutrans Set\ '&filetype'\ too Ò²É趨\ 'filetype'(&F) + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_zh_cn.utf-8.vim b/runtime/lang/menu_zh_cn.utf-8.vim index 04f192f..956363d 100644 --- a/runtime/lang/menu_zh_cn.utf-8.vim +++ b/runtime/lang/menu_zh_cn.utf-8.vim @@ -9,6 +9,8 @@ if exists("did_menu_trans") finish endif let did_menu_trans = 1 +let s:keepcpo= &cpo +set cpo&vim scriptencoding utf-8 @@ -261,3 +263,6 @@ menutrans &Highlight\ test 高亮测试(&H) menutrans &Convert\ to\ HTML 转换成\ HTML(&C) menutrans Set\ '&syntax'\ only 仅设定\ 'syntax'(&S) menutrans Set\ '&filetype'\ too 也设定\ 'filetype'(&F) + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/lang/menu_zh_tw.utf-8.vim b/runtime/lang/menu_zh_tw.utf-8.vim index 97c56a3..7bef83c 100644 --- a/runtime/lang/menu_zh_tw.utf-8.vim +++ b/runtime/lang/menu_zh_tw.utf-8.vim @@ -1,6 +1,6 @@ " Menu Translations: Traditional Chinese " Translated By: Hung-Te Lin -" Last Change: 2005/01/28 02:51:38 +" Last Change: 2012 May 01 " {{{ Quit when menu translations have already been done. if exists("did_menu_trans") @@ -9,6 +9,9 @@ endif let did_menu_trans = 1 " }}} +let s:keepcpo= &cpo +set cpo&vim + scriptencoding utf-8 " {{{ Help menu: complete @@ -282,4 +285,7 @@ if has("toolbar") endif " }}} +let &cpo = s:keepcpo +unlet s:keepcpo + " vim:foldmethod=marker:nowrap:foldcolumn=2:foldlevel=1 diff --git a/runtime/macros/editexisting.vim b/runtime/macros/editexisting.vim index 07c55f6..c18f225 100644 --- a/runtime/macros/editexisting.vim +++ b/runtime/macros/editexisting.vim @@ -1,6 +1,6 @@ " Vim Plugin: Edit the file with an existing Vim if possible " Maintainer: Bram Moolenaar -" Last Change: 2008 May 29 +" Last Change: 2013 Feb 24 " This is a plugin, drop it in your (Unix) ~/.vim/plugin or (Win32) " $VIM/vimfiles/plugin directory. Or make a symbolic link, so that you @@ -98,7 +98,7 @@ func! EditExisting(fname, command) " Make this tab page the current one and find the window number. exe 'tabnext ' . (i + 1) let winnr = bufwinnr(a:fname) - break; + break endif endfor endif diff --git a/runtime/macros/justify.vim b/runtime/macros/justify.vim index aa4a9ca..4ef3bf9 100644 --- a/runtime/macros/justify.vim +++ b/runtime/macros/justify.vim @@ -1,4 +1,4 @@ -" Function to left and rigt align text. +" Function to left and right align text. " " Written by: Preben "Peppe" Guldberg " Created: 980806 14:13 (or around that time anyway) @@ -256,18 +256,17 @@ function! Justify(...) range let str = substitute(str, '\s\+$', '', '') let str = substitute(str, '^\s\+', '', '') let str = substitute(str, '\s\+', ' ', 'g') - " Use substitute() hack to get strlen in characters instead of bytes - let str_n = strlen(substitute(str, '.', 'x', 'g')) + let str_n = strdisplaywidth(str) " Possible addition of space after punctuation if exists("join_str") let str = substitute(str, join_str, '\1 ', 'g') endif - let join_n = strlen(substitute(str, '.', 'x', 'g')) - str_n + let join_n = strdisplaywidth(str) - str_n " Can extraspaces be added? " Note that str_n may be less than strlen(str) [joinspaces above] - if strlen(substitute(str, '.', 'x', 'g')) < tw - indent_n && str_n > 0 + if strdisplaywidth(str) <= tw - indent_n && str_n > 0 " How many spaces should be added let s_add = tw - str_n - indent_n - join_n let s_nr = strlen(substitute(str, '\S', '', 'g') ) - join_n diff --git a/runtime/macros/less.bat b/runtime/macros/less.bat new file mode 100644 index 0000000..bbe619b --- /dev/null +++ b/runtime/macros/less.bat @@ -0,0 +1,10 @@ +@echo off +rem batch file to start Vim with less.vim. +rem Read stdin if no arguments were given. +rem Written by Ken Takata. + +if "%1"=="" ( + vim --cmd "let no_plugin_maps = 1" -c "runtime! macros/less.vim" - +) else ( + vim --cmd "let no_plugin_maps = 1" -c "runtime! macros/less.vim" %* +) diff --git a/runtime/macros/less.sh b/runtime/macros/less.sh index 484c714..e29958f 100755 --- a/runtime/macros/less.sh +++ b/runtime/macros/less.sh @@ -1,16 +1,24 @@ #!/bin/sh # Shell script to start Vim with less.vim. -# Read stdin if no arguments were given. +# Read stdin if no arguments were given and stdin was redirected. if test -t 1; then - if test $# = 0; then - vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' - + if test $# = 0; then + if test -t 0; then + echo "Missing filename" 1>&2 + exit + fi + vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' - else - vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' "$@" + vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' "$@" fi else # Output is not a terminal, cat arguments or stdin if test $# = 0; then + if test -t 0; then + echo "Missing filename" 1>&2 + exit + fi cat else cat "$@" diff --git a/runtime/macros/less.vim b/runtime/macros/less.vim index 959a5d7..6ae5ebc 100644 --- a/runtime/macros/less.vim +++ b/runtime/macros/less.vim @@ -1,6 +1,6 @@ " Vim script to work like "less" " Maintainer: Bram Moolenaar -" Last Change: 2006 Dec 05 +" Last Change: 2012 May 18 " Avoid loading this file twice, allow the user to define his own script. if exists("loaded_less") @@ -92,7 +92,8 @@ map fun! s:NextPage() if line(".") == line("$") if argidx() + 1 >= argc() - quit + " Don't quit at the end of the last file + return endif next 1 diff --git a/runtime/macros/matchit.vim b/runtime/macros/matchit.vim index 549c26c..74c1a1e 100644 --- a/runtime/macros/matchit.vim +++ b/runtime/macros/matchit.vim @@ -131,7 +131,7 @@ function! s:Match_wrapper(word, forward, mode) range " let default = substitute(escape(&mps, '[$^.*~\\/?]'), '[,:]\+', " \ '\\|', 'g').'\|\/\*\|\*\/\|#if\>\|#ifdef\>\|#else\>\|#elif\>\|#endif\>' let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") . - \ '\/\*:\*\/,#if\%(def\)\=:#else\>:#elif\>:#endif\>' + \ '\/\*:\*\/,#\s*if\%(def\)\=:#\s*else\>:#\s*elif\>:#\s*endif\>' " s:all = pattern with all the keywords let match_words = match_words . (strlen(match_words) ? "," : "") . default if match_words !~ s:notslash . '\\\d' @@ -649,7 +649,7 @@ fun! s:MultiMatch(spflag, mode) " s:all regexp based on s:pat and the default groups " This part is copied and slightly modified from s:Match_wrapper(). let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") . - \ '\/\*:\*\/,#if\%(def\)\=:#else\>:#elif\>:#endif\>' + \ '\/\*:\*\/,#\s*if\%(def\)\=:#\s*else\>:#\s*elif\>:#\s*endif\>' " Allow b:match_words = "GetVimMatchWords()" . if b:match_words =~ ":" let match_words = b:match_words @@ -808,5 +808,6 @@ fun! s:ParseSkip(str) endfun let &cpo = s:save_cpo +unlet s:save_cpo " vim:sts=2:sw=2: diff --git a/runtime/makemenu.vim b/runtime/makemenu.vim index c4d8bc2..b78fdfd 100644 --- a/runtime/makemenu.vim +++ b/runtime/makemenu.vim @@ -1,6 +1,6 @@ " Script to define the syntax menu in synmenu.vim " Maintainer: Bram Moolenaar -" Last Change: 2010 Aug 04 +" Last Change: 2013 Jul 28 " This is used by "make menu" in the src directory. edit :p:h/synmenu.vim @@ -66,9 +66,11 @@ SynMenu AB.ANTLR:antlr SynMenu AB.Apache\ config:apache SynMenu AB.Apache-style\ config:apachestyle SynMenu AB.Applix\ ELF:elf +SynMenu AB.APT\ config:aptconf SynMenu AB.Arc\ Macro\ Language:aml SynMenu AB.Arch\ inventory:arch SynMenu AB.ART:art +SynMenu AB.Ascii\ Doc:asciidoc SynMenu AB.ASP\ with\ VBScript:aspvbs SynMenu AB.ASP\ with\ Perl:aspperl SynMenu AB.Assembly.680x0:asm68k @@ -128,6 +130,7 @@ SynMenu C.ChordPro:chordpro SynMenu C.Clean:clean SynMenu C.Clever:cl SynMenu C.Clipper:clipper +SynMenu C.Clojure:clojure SynMenu C.Cmake:cmake SynMenu C.Cmusrc:cmusrc SynMenu C.Cobol:cobol @@ -139,6 +142,7 @@ SynMenu C.Config.Configure\.in:config SynMenu C.Config.Generic\ Config\ file:conf SynMenu C.CRM114:crm SynMenu C.Crontab:crontab +SynMenu C.CSDL:csdl SynMenu C.CSP:csp SynMenu C.Ctrl-H:ctrlh SynMenu C.Cucumber:cucumber @@ -164,6 +168,7 @@ SynMenu DE.Digital\ Command\ Lang:dcl SynMenu DE.Dircolors:dircolors SynMenu DE.Django\ template:django SynMenu DE.DNS/BIND\ zone:bindzone +SynMenu DE.Dnsmasq\ config:dnsmasq SynMenu DE.DocBook.auto-detect:docbk SynMenu DE.DocBook.SGML:docbksgml SynMenu DE.DocBook.XML:docbkxml @@ -177,6 +182,7 @@ SynMenu DE.DSSSL:dsl SynMenu DE.DTD:dtd SynMenu DE.DTML\ (Zope):dtml SynMenu DE.DTrace:dtrace +SynMenu DE.Dts/dtsi:dts SynMenu DE.Dylan.Dylan:dylan SynMenu DE.Dylan.Dylan\ interface:dylanintr SynMenu DE.Dylan.Dylan\ lid:dylanlid @@ -197,6 +203,7 @@ SynMenu DE.Exim\ conf:exim SynMenu DE.Expect:expect SynMenu DE.Exports:exports +SynMenu FG.Falcon:falcon SynMenu FG.Fantom:fan SynMenu FG.Fetchmail:fetchmail SynMenu FG.FlexWiki:flexwiki @@ -220,9 +227,12 @@ SynMenu FG.Git.Commit:gitcommit SynMenu FG.Git.Config:gitconfig SynMenu FG.Git.Rebase:gitrebase SynMenu FG.Git.Send\ Email:gitsendemail +SynMenu FG.Gitolite:gitolite SynMenu FG.Gkrellmrc:gkrellmrc +SynMenu FG.Gnash:gnash SynMenu FG.GP:gp SynMenu FG.GPG:gpg +SynMenu FG.Grof:gprof SynMenu FG.Group\ file:group SynMenu FG.Grub:grub SynMenu FG.GNU\ Server\ Pages:gsp @@ -243,6 +253,7 @@ SynMenu HIJK.HASTE\ preproc:hastepreproc SynMenu HIJK.Hercules:hercules SynMenu HIJK.Hex\ dump.XXD:xxd SynMenu HIJK.Hex\ dump.Intel\ MCS51:hex +SynMenu HIJK.Hg\ commit:hgcommit SynMenu HIJK.HTML.HTML:html SynMenu HIJK.HTML.HTML\ with\ M4:htmlm4 SynMenu HIJK.HTML.HTML\ with\ Ruby\ (eRuby):eruby @@ -251,6 +262,7 @@ SynMenu HIJK.HTML.Django\ HTML\ template:htmldjango SynMenu HIJK.HTML.HTML/OS:htmlos SynMenu HIJK.HTML.XHTML:xhtml SynMenu HIJK.Host\.conf:hostconf +SynMenu HIJK.Hosts\ access:hostsaccess SynMenu HIJK.Hyper\ Builder:hb SynMenu HIJK.Icewm\ menu:icemenu SynMenu HIJK.Icon:icon @@ -262,6 +274,11 @@ SynMenu HIJK.Informix\ 4GL:fgl SynMenu HIJK.Initng:initng SynMenu HIJK.Inittab:inittab SynMenu HIJK.Inno\ setup:iss +SynMenu HIJK.Innovation\ Data\ Processing.Upstream\ dat:upstreamdat +SynMenu HIJK.Innovation\ Data\ Processing.Upstream\ log:upstreamlog +SynMenu HIJK.Innovation\ Data\ Processing.Upstream\ Install\ log:upstreaminstalllog +SynMenu HIJK.Innovation\ Data\ Processing.Usserver\ log:usserverlog +SynMenu HIJK.Innovation\ Data\ Processing.USW2KAgt\ log:usw2kagtlog SynMenu HIJK.InstallShield\ script:ishd SynMenu HIJK.Interactive\ Data\ Lang:idlang SynMenu HIJK.IPfilter:ipfilter @@ -275,6 +292,7 @@ SynMenu HIJK.Java.Java\ Properties:jproperties SynMenu HIJK.JavaScript:javascript SynMenu HIJK.Jess:jess SynMenu HIJK.Jgraph:jgraph +SynMenu HIJK.Jovial:jovial SynMenu HIJK.Kconfig:kconfig SynMenu HIJK.KDE\ script:kscript SynMenu HIJK.Kimwitu++:kwt @@ -314,6 +332,7 @@ SynMenu M.MaGic\ Point:mgp SynMenu M.Mail:mail SynMenu M.Mail\ aliases:mailaliases SynMenu M.Mailcap:mailcap +SynMenu M.Mallard:mallard SynMenu M.Makefile:make SynMenu M.MakeIndex:ist SynMenu M.Man\ page:man @@ -355,6 +374,7 @@ SynMenu NO.Nanorc:nanorc SynMenu NO.Nastran\ input/DMAP:nastran SynMenu NO.Natural:natural SynMenu NO.Netrc:netrc +SynMenu NO.Ninja:ninja SynMenu NO.Novell\ NCF\ batch:ncf SynMenu NO.Not\ Quite\ C\ (LEGO):nqc SynMenu NO.Nroff:nroff @@ -381,6 +401,9 @@ SynMenu PQ.Perl.Perl:perl SynMenu PQ.Perl.Perl\ 6:perl6 SynMenu PQ.Perl.Perl\ POD:pod SynMenu PQ.Perl.Perl\ XS:xs +SynMenu PQ.Perl.Template\ toolkit:tt2 +SynMenu PQ.Perl.Template\ toolkit\ Html:tt2html +SynMenu PQ.Perl.Template\ toolkit\ JS:tt2js SynMenu PQ.PHP.PHP\ 3-4:php SynMenu PQ.PHP.Phtml\ (PHP\ 2):phtml SynMenu PQ.Pike:pike @@ -388,6 +411,7 @@ SynMenu PQ.Pine\ RC:pine SynMenu PQ.Pinfo\ RC:pinfo SynMenu PQ.PL/M:plm SynMenu PQ.PL/SQL:plsql +SynMenu PQ.Pli:pli SynMenu PQ.PLP:plp SynMenu PQ.PO\ (GNU\ gettext):po SynMenu PQ.Postfix\ main\ config:pfmain @@ -404,6 +428,7 @@ SynMenu PQ.Product\ Spec\ File:psf SynMenu PQ.Progress:progress SynMenu PQ.Prolog:prolog SynMenu PQ.ProMeLa:promela +SynMenu PQ.Proto:proto SynMenu PQ.Protocols:protocols SynMenu PQ.Purify\ log:purifylog SynMenu PQ.Pyrex:pyrex @@ -421,6 +446,8 @@ SynMenu R.RCS.RCS\ log\ output:rcslog SynMenu R.RCS.RCS\ file:rcs SynMenu R.Readline\ config:readline SynMenu R.Rebol:rebol +SynMenu R.ReDIF:redif +SynMenu R.Relax\ NG:rng SynMenu R.Remind:remind SynMenu R.Relax\ NG\ compact:rnc SynMenu R.Renderman.Renderman\ Shader\ Lang:sl @@ -494,6 +521,7 @@ SynMenu Sn-Sy.Spyce:spyce SynMenu Sn-Sy.Speedup:spup SynMenu Sn-Sy.Splint:splint SynMenu Sn-Sy.Squid\ config:squid +SynMenu Sn-Sy.SQL.SAP\ HANA:sqlhana SynMenu Sn-Sy.SQL.ESQL-C:esqlc SynMenu Sn-Sy.SQL.MySQL:mysql SynMenu Sn-Sy.SQL.PL/SQL:plsql @@ -523,6 +551,7 @@ SynMenu T.Tags:tags SynMenu T.TAK.TAK\ compare:takcmp SynMenu T.TAK.TAK\ input:tak SynMenu T.TAK.TAK\ output:takout +SynMenu T.Tar\ listing:tar SynMenu T.Task\ data:taskdata SynMenu T.Task\ 42\ edit:taskedit SynMenu T.Tcl/Tk:tcl @@ -532,6 +561,7 @@ SynMenu T.Termcap/Printcap:ptcap SynMenu T.Terminfo:terminfo SynMenu T.TeX.TeX/LaTeX:tex SynMenu T.TeX.plain\ TeX:plaintex +SynMenu T.TeX.Initex:initex SynMenu T.TeX.ConTeXt:context SynMenu T.TeX.TeX\ configuration:texmf SynMenu T.TeX.Texinfo:texinfo @@ -540,6 +570,7 @@ SynMenu T.Tidy\ configuration:tidy SynMenu T.Tilde:tilde SynMenu T.TPP:tpp SynMenu T.Trasys\ input:trasys +SynMenu T.Treetop:treetop SynMenu T.Trustees:trustees SynMenu T.TSS.Command\ Line:tsscl SynMenu T.TSS.Geometry:tssgm @@ -551,6 +582,7 @@ SynMenu UV.Udev\ rules:udevrules SynMenu UV.UIT/UIL:uil SynMenu UV.UnrealScript:uc SynMenu UV.Updatedb\.conf:updatedb +SynMenu UV.Upstart:upstart SynMenu UV.Valgrind:valgrind SynMenu UV.Vera:vera SynMenu UV.Verilog-AMS\ HDL:verilogams @@ -594,6 +626,7 @@ SynMenu WXYZ.Xslt:xslt SynMenu WXYZ.XFree86\ Config:xf86conf SynMenu WXYZ.YAML:yaml SynMenu WXYZ.Yacc:yacc +SynMenu WXYZ.Zimbu:zimbu call append(s:lnum, "") diff --git a/runtime/menu.vim b/runtime/menu.vim index 2cbd55c..f4ff9dc 100644 --- a/runtime/menu.vim +++ b/runtime/menu.vim @@ -2,7 +2,7 @@ " You can also use this as a start for your own set of menus. " " Maintainer: Bram Moolenaar -" Last Change: 2009 Feb 26 +" Last Change: 2013 May 17 " Note that ":an" (short for ":anoremenu") is often used to make a menu work " in all modes and avoid side effects from mappings defined by the user. @@ -101,7 +101,7 @@ an 10.320 &File.Sp&lit-Open\.\.\.:sp :browse sp an 10.320 &File.Open\ Tab\.\.\.:tabnew :browse tabnew an 10.325 &File.&New:enew :confirm enew an 10.330 &File.&Close:close - \ :if winheight(2) < 0 + \ :if winheight(2) < 0 && tabpagewinnr(2) == 0 \ confirm enew \ else \ confirm close @@ -132,7 +132,7 @@ an 10.610 &File.Sa&ve-Exit:wqa :confirm wqa an 10.620 &File.E&xit:qa :confirm qa func! SelectAll() - exe "norm gg" . (&slm == "" ? "VG" : "gH\G") + exe "norm! gg" . (&slm == "" ? "VG" : "gH\G") endfunc func! s:FnameEscape(fname) @@ -308,8 +308,10 @@ fun! s:TextWidth() endif let n = inputdialog(g:menutrans_textwidth_dialog, &tw) if n != "" - " remove leading zeros to avoid it being used as an octal number - let &tw = substitute(n, "^0*", "", "") + " Remove leading zeros to avoid it being used as an octal number. + " But keep a zero by itself. + let tw = substitute(n, "^0*", "", "") + let &tw = tw == '' ? 0 : tw endif endfun @@ -434,6 +436,10 @@ if has("spell") let enc = &enc endif + if !exists("g:menutrans_set_lang_to") + let g:menutrans_set_lang_to = 'Set language to' + endif + let found = 0 let s = globpath(&rtp, "spell/*." . enc . ".spl") if s != "" @@ -441,8 +447,9 @@ if has("spell") for f in split(s, "\n") let nm = substitute(f, '.*spell[/\\]\(..\)\.[^/\\]*\.spl', '\1', "") if nm != "en" && nm !~ '/' + let _nm = nm let found += 1 - let menuname = '&Tools.&Spelling.Set\ language\ to\ "' . nm . '"' + let menuname = '&Tools.&Spelling.' . escape(g:menutrans_set_lang_to, "\\. \t|") . '\ "' . nm . '"' exe 'an 40.335.' . n . ' ' . menuname . ' :set spl=' . nm . ' spell' let s:undo_spellang += ['aun ' . menuname] endif @@ -452,7 +459,7 @@ if has("spell") if found == 0 echomsg "Could not find other spell files" elseif found == 1 - echomsg "Found spell file " . nm + echomsg "Found spell file " . _nm else echomsg "Found " . found . " more spell files" endif diff --git a/runtime/mswin.vim b/runtime/mswin.vim index 1ceef84..ca280d2 100644 --- a/runtime/mswin.vim +++ b/runtime/mswin.vim @@ -1,7 +1,7 @@ " Set options and add mapping such that Vim behaves a lot like MS-Windows " " Maintainer: Bram Moolenaar -" Last change: 2006 Apr 02 +" Last change: 2012 Jul 25 " bail out if this isn't wanted (mrsvim.vim uses this). if exists("g:skip_loading_mswin") && g:skip_loading_mswin @@ -42,9 +42,10 @@ cmap + " Visual mode without the +virtualedit feature. They are pasted as if they " were characterwise instead. " Uses the paste.vim autoload script. +" Use CTRL-G u to have CTRL-Z only undo the paste. -exe 'inoremap " - \]) + \ "if ('onhashchange' in window) {", + \ " window.onhashchange = JumpToLine;", + \ "}" + \ ]) +endif + +" Small text columns like the foldcolumn and line number column need a weird +" hack to work around Webkit's and (in versions prior to 9) IE's lack of support +" for the 'ch' unit without messing up Opera, which also doesn't support it but +" works anyway. +" +" The problem is that without the 'ch' unit, it is not possible to specify a +" size of an in terms of character widths. Only Opera seems to do the +" "sensible" thing and make the sized to fit exactly as many characters +" as specified by its "size" attribute, but the spec actually says "at least +" wide enough to fit 'size' characters", so the other browsers are technically +" correct as well. +" +" Anyway, this leads to two diffculties: +" 1. The foldcolumn is made up of multiple elements side-by-side with +" different sizes, each of which has their own extra padding added. Thus, a +" column made up of one item of size 1 and another of size 2 would not +" necessarily be equal in size to another line's foldcolumn with a single +" item of size 3. +" 2. The extra padding added to the elements adds up to make the +" foldcolumn and line number column too wide, especially in Webkit +" browsers. +" +" So, the full workaround is: +" 1. Define a default size in em, equal to the number of characters in the +" input element, in case javascript is disabled and the browser does not +" support the 'ch' unit. Unfortunately this makes Opera no longer work +" properly without javascript. 1em per character is much too wide but it +" looks better in webkit browsers than unaligned columns. +" 2. Insert the following javascript to run at page load, which checks for the +" width of a single character (in an extraneous page element inserted +" before the page title, and set to hidden) and compares it to the width of +" another extra element with only one character. If the width +" matches, the script does nothing more, but if not, it will figure out the +" fraction of an em unit which would correspond with a ch unit if there +" were one, and set the containing element (
 or 
) to a class with +" pre-defined rules which is closest to that fraction of an em. Rules are +" defined from 0.05 em to 1em per ch. +if !empty(s:settings.prevent_copy) + call extend(s:lines, [ + \ '', + \ '/* simulate a "ch" unit by asking the browser how big a zero character is */', + \ 'function FixCharWidth() {', + \ ' /* get the hidden element which gives the width of a single character */', + \ ' var goodWidth = document.getElementById("oneCharWidth").clientWidth;', + \ ' /* get all input elements, we''ll filter on class later */', + \ ' var inputTags = document.getElementsByTagName("input");', + \ ' var ratio = 5;', + \ ' var inputWidth = document.getElementById("oneInputWidth").clientWidth;', + \ ' var emWidth = document.getElementById("oneEmWidth").clientWidth;', + \ ' if (inputWidth > goodWidth) {', + \ ' while (ratio < 100*goodWidth/emWidth && ratio < 100) {', + \ ' ratio += 5;', + \ ' }', + \ ' document.getElementById("vimCodeElement'.s:settings.id_suffix.'").className = "em"+ratio;', + \ ' }', + \ '}' + \ ]) endif +" insert script closing tag +call extend(s:lines, [ + \ '', + \ s:settings.use_xhtml ? '//]]>' : '-->', + \ "" + \ ]) + +call extend(s:lines, [""]) +if !empty(s:settings.prevent_copy) + call extend(s:lines, + \ ["", + \ "", + \ "
0
", + \ "
", + \ "
" + \ ]) +else + call extend(s:lines, [""]) +endif if s:settings.no_pre - call extend(s:lines, ["", ""]) + " if we're not using CSS we use a font tag which can't have a div inside + if s:settings.use_css + call extend(s:lines, ["
"]) + endif else - call extend(s:lines, ["", "", "
"])
+  call extend(s:lines, ["
"])
 endif
 
 exe s:orgwin . "wincmd w"
 
-" List of all id's
-let s:idlist = []
+" caches of style data
+" initialize to include line numbers if using them
+if s:settings.number_lines
+  let s:stylelist = { s:LINENR_ID : ".LineNr { " . s:CSS1( s:LINENR_ID ) . "}" }
+else
+  let s:stylelist = {}
+endif
+let s:diffstylelist = {
+      \   s:DIFF_A_ID : ".DiffAdd { " . s:CSS1( s:DIFF_A_ID ) . "}",
+      \   s:DIFF_C_ID : ".DiffChange { " . s:CSS1( s:DIFF_C_ID ) . "}",
+      \   s:DIFF_D_ID : ".DiffDelete { " . s:CSS1( s:DIFF_D_ID ) . "}",
+      \   s:DIFF_T_ID : ".DiffText { " . s:CSS1( s:DIFF_T_ID ) . "}"
+      \ }
 
 " set up progress bar in the status line
 if !s:settings.no_progress
@@ -545,9 +1109,6 @@ if s:settings.dynamic_folds
       " level, so subtract 2 from index of first non-dash after the dashes
       " in order to get the fold level of the current fold
       let s:level = match(foldtextresult(s:lnum), '+-*\zs[^-]') - 2
-      if s:level+1 > s:foldcolumn
-	let s:foldcolumn = s:level+1
-      endif
       " store fold info for later use
       let s:newfold = {'firstline': s:lnum, 'lastline': foldclosedend(s:lnum), 'level': s:level,'type': "closed-fold"}
       call add(s:allfolds, s:newfold)
@@ -577,9 +1138,6 @@ if s:settings.dynamic_folds
       " level, so subtract 2 from index of first non-dash after the dashes
       " in order to get the fold level of the current fold
       let s:level = match(foldtextresult(s:lnum), '+-*\zs[^-]') - 2
-      if s:level+1 > s:foldcolumn
-	let s:foldcolumn = s:level+1
-      endif
       let s:newfold = {'firstline': s:lnum, 'lastline': foldclosedend(s:lnum), 'level': s:level,'type': "closed-fold"}
       " only add the fold if we don't already have it
       if empty(s:allfolds) || index(s:allfolds, s:newfold) == -1
@@ -609,6 +1167,74 @@ if s:settings.dynamic_folds
 
   " close all folds again so we can get the fold text as we go
   silent! %foldclose!
+
+  " Go through and remove folds we don't need to (or cannot) process in the
+  " current conversion range
+  "
+  " If a fold is removed which contains other folds, which are included, we need
+  " to adjust the level of the included folds as used by the conversion logic
+  " (avoiding special cases is good)
+  "
+  " Note any time we remove a fold, either all of the included folds are in it,
+  " or none of them, because we only remove a fold if neither its start nor its
+  " end are within the conversion range.
+  let leveladjust = 0
+  for afold in s:allfolds
+    let removed = 0
+    if exists("g:html_start_line") && exists("g:html_end_line")
+      if afold.firstline < g:html_start_line
+	if afold.lastline <= g:html_end_line && afold.lastline >= g:html_start_line
+	  " if a fold starts before the range to convert but stops within the
+	  " range, we need to include it. Make it start on the first converted
+	  " line.
+	  let afold.firstline = g:html_start_line
+	else
+	  " if the fold lies outside the range or the start and stop enclose
+	  " the entire range, don't bother parsing it
+	  call remove(s:allfolds, index(s:allfolds, afold))
+	  let removed = 1
+	  if afold.lastline > g:html_end_line
+	    let leveladjust += 1
+	  endif
+	endif
+      elseif afold.firstline > g:html_end_line
+	" If the entire fold lies outside the range we need to remove it.
+	call remove(s:allfolds, index(s:allfolds, afold))
+	let removed = 1
+      endif
+    elseif exists("g:html_start_line")
+      if afold.firstline < g:html_start_line
+	" if there is no last line, but there is a first line, the end of the
+	" fold will always lie within the region of interest, so keep it
+	let afold.firstline = g:html_start_line
+      endif
+    elseif exists("g:html_end_line")
+      " if there is no first line we default to the first line in the buffer so
+      " the fold start will always be included if the fold itself is included.
+      " If however the entire fold lies outside the range we need to remove it.
+      if afold.firstline > g:html_end_line
+	call remove(s:allfolds, index(s:allfolds, afold))
+	let removed = 1
+      endif
+    endif
+    if !removed
+      let afold.level -= leveladjust
+      if afold.level+1 > s:foldcolumn
+	let s:foldcolumn = afold.level+1
+      endif
+    endif
+  endfor
+
+  " if we've removed folds containing the conversion range from processing,
+  " getting foldtext as we go won't know to open the removed folds, so the
+  " foldtext would be wrong; open them now.
+  "
+  " Note that only when a start and an end line is specified will a fold
+  " containing the current range ever be removed.
+  while leveladjust > 0
+    exe g:html_start_line."foldopen"
+    let leveladjust -= 1
+  endwhile
 endif
 
 " Now loop over all lines in the original text to convert to html.
@@ -656,6 +1282,13 @@ endif
 
 let s:foldId = 0
 
+if !s:settings.expand_tabs
+  " If keeping tabs, add them to printable characters so we keep them when
+  " formatting text (strtrans() doesn't replace printable chars)
+  let s:old_isprint = &isprint
+  setlocal isprint+=9
+endif
+
 while s:lnum <= s:end
 
   " If there are filler lines for diff mode, show these above the line.
@@ -672,15 +1305,22 @@ while s:lnum <= s:end
 
       if !s:settings.no_pre
 	" HTML line wrapping is off--go ahead and fill to the margin
+	" TODO: what about when CSS wrapping is turned on?
 	let s:new = s:new . repeat(s:difffillchar, &columns - strlen(s:new) - s:margin)
       else
 	let s:new = s:new . repeat(s:difffillchar, 3)
       endif
 
-      let s:new = s:HtmlFormat(s:new, "DiffDelete", "")
+      let s:new = s:HtmlFormat_d(s:new, s:DIFF_D_ID, 0)
       if s:settings.number_lines
-	" Indent if line numbering is on; must be after escaping.
-	let s:new = repeat(s:LeadingSpace, s:margin) . s:new
+	" Indent if line numbering is on. Indent gets style of line number
+	" column.
+	let s:new = s:HtmlFormat_n(repeat(' ', s:margin), s:LINENR_ID, 0, 0) . s:new
+      endif
+      if s:settings.dynamic_folds && !s:settings.no_foldcolumn && s:foldcolumn > 0
+	" Indent for foldcolumn if there is one. Assume it's empty, there should
+	" not be a fold for deleted lines in diff mode.
+	let s:new = s:FoldColumn_fill() . s:new
       endif
       call add(s:lines, s:new.s:HtmlEndline)
 
@@ -693,8 +1333,6 @@ while s:lnum <= s:end
   " Start the line with the line number.
   if s:settings.number_lines
     let s:numcol = repeat(' ', s:margin - 1 - strlen(s:lnum)) . s:lnum . ' '
-  else
-    let s:numcol = ""
   endif
 
   let s:new = ""
@@ -702,14 +1340,14 @@ while s:lnum <= s:end
   if has('folding') && !s:settings.ignore_folding && foldclosed(s:lnum) > -1 && !s:settings.dynamic_folds
     "
     " This is the beginning of a folded block (with no dynamic folding)
-    "
-    let s:new = s:numcol . foldtextresult(s:lnum)
+    let s:new = foldtextresult(s:lnum)
     if !s:settings.no_pre
       " HTML line wrapping is off--go ahead and fill to the margin
       let s:new = s:new . repeat(s:foldfillchar, &columns - strlen(s:new))
     endif
 
-    let s:new = s:HtmlFormat(s:new, "Folded", "")
+    " put numcol in a separate group for sake of unselectable text
+    let s:new = (s:settings.number_lines ? s:HtmlFormat_n(s:numcol, s:FOLDED_ID, 0, s:lnum): "") . s:HtmlFormat_t(s:new, s:FOLDED_ID, 0)
 
     " Skip to the end of the fold
     let s:new_lnum = foldclosedend(s:lnum)
@@ -734,13 +1372,13 @@ while s:lnum <= s:end
 	call remove(s:foldstack, 0)
       endwhile
 
-      " Now insert an opening any new folds that start on this line
+      " Now insert an opening for any new folds that start on this line
       let s:firstfold = 1
       while !empty(s:allfolds) && get(s:allfolds,0).firstline == s:lnum
 	let s:foldId = s:foldId + 1
 	let s:new .= ""
+	let s:new .= "fold".s:foldId.s:settings.id_suffix."' class='".s:allfolds[0].type."'>"
 
 
 	" Unless disabled, add a fold column for the opening line of a fold.
@@ -751,38 +1389,46 @@ while s:lnum <= s:end
 	if !s:settings.no_foldcolumn
 	  " add fold column that can open the new fold
 	  if s:allfolds[0].level > 1 && s:firstfold
-	    let s:new = s:new . ""
-	    let s:new = s:new . repeat('|', s:allfolds[0].level - 1) . ""
+	    let s:new = s:new . s:FoldColumn_build('|', s:allfolds[0].level - 1, 0, "",
+		  \ 'toggle-open FoldColumn','javascript:toggleFold("fold'.s:foldstack[0].id.s:settings.id_suffix.'");')
 	  endif
-	  let s:new = s:new . "+"
-	  let s:new = s:new . ""
+	  let s:new = s:new . s:FoldColumn_build(" ", 1, s:foldcolumn - s:allfolds[0].level - 1, "",
+		\ 'toggle-open FoldColumn'. (get(s:allfolds, 1, {'firstline': 0}).firstline == s:lnum ?" toggle-filler" :""),
+		\ 'javascript:toggleFold("fold'.s:foldId.s:settings.id_suffix.'");')
 
 	  " add fold column that can close the new fold
-	  let s:new = s:new . ""
-	  if s:firstfold
-	    let s:new = s:new . repeat('|', s:allfolds[0].level - 1)
-	  endif
-	  let s:new = s:new . "-"
-	  " only add spaces if we aren't opening another fold on the same line
+	  " only add extra blank space if we aren't opening another fold on the
+	  " same line
 	  if get(s:allfolds, 1, {'firstline': 0}).firstline != s:lnum
-	    let s:new = s:new . repeat(" ", s:foldcolumn - s:allfolds[0].level)
+	    let s:extra_space = s:foldcolumn - s:allfolds[0].level
+	  else
+	    let s:extra_space = 0
+	  endif
+	  if s:firstfold
+	    " the first fold in a line has '|' characters from folds opened in
+	    " previous lines, before the '-' for this fold
+	    let s:new .= s:FoldColumn_build('|', s:allfolds[0].level - 1, s:extra_space, '-',
+		  \ 'toggle-closed FoldColumn', 'javascript:toggleFold("fold'.s:foldId.s:settings.id_suffix.'");')
+	  else
+	    " any subsequent folds in the line only add a single '-'
+	    let s:new = s:new . s:FoldColumn_build("-", 1, s:extra_space, "",
+		  \ 'toggle-closed FoldColumn', 'javascript:toggleFold("fold'.s:foldId.s:settings.id_suffix.'");')
 	  endif
-	  let s:new = s:new . ""
 	  let s:firstfold = 0
 	endif
 
-	" add fold text, moving the span ending to the next line so collapsing
-	" of folds works correctly
-	let s:new = s:new . substitute(s:HtmlFormat(s:numcol . foldtextresult(s:lnum), "Folded", ""), '', s:HtmlEndline.'\n\0', '')
+	" Add fold text, moving the span ending to the next line so collapsing
+	" of folds works correctly.
+	" Put numcol in a separate group for sake of unselectable text.
+	let s:new = s:new . (s:settings.number_lines ? s:HtmlFormat_n(s:numcol, s:FOLDED_ID, 0, 0) : "") . substitute(s:HtmlFormat_t(foldtextresult(s:lnum), s:FOLDED_ID, 0), '', s:HtmlEndline.'\n\0', '')
 	let s:new = s:new . ""
 
 	" open the fold now that we have the fold text to allow retrieval of
@@ -802,14 +1448,13 @@ while s:lnum <= s:end
 	  " add the empty foldcolumn for unfolded lines if there is a fold
 	  " column at all
 	  if s:foldcolumn > 0
-	    let s:new = s:new . s:HtmlFormat(repeat(' ', s:foldcolumn), "FoldColumn", "")
+	    let s:new = s:new . s:FoldColumn_fill()
 	  endif
 	else
 	  " add the fold column for folds not on the opening line
 	  if get(s:foldstack, 0).firstline < s:lnum
-	    let s:new = s:new . ""
-	    let s:new = s:new . repeat('|', s:foldstack[0].level)
-	    let s:new = s:new . repeat(' ', s:foldcolumn - s:foldstack[0].level) . ""
+	    let s:new = s:new . s:FoldColumn_build('|', s:foldstack[0].level, s:foldcolumn - s:foldstack[0].level, "",
+		  \ 'FoldColumn', 'javascript:toggleFold("fold'.s:foldstack[0].id.s:settings.id_suffix.'");')
 	  endif
 	endif
       endif
@@ -817,8 +1462,9 @@ while s:lnum <= s:end
 
     " Now continue with the unfolded line text
     if s:settings.number_lines
-      " TODO: why not use the real highlight name here?
-      let s:new = s:new . s:HtmlFormat(s:numcol, "lnr", "")
+      let s:new = s:new . s:HtmlFormat_n(s:numcol, s:LINENR_ID, 0, s:lnum)
+    elseif s:settings.line_ids
+      let s:new = s:new . s:HtmlFormat_n("", s:LINENR_ID, 0, s:lnum)
     endif
 
     " Get the diff attribute, if any.
@@ -832,7 +1478,6 @@ while s:lnum <= s:end
 
     " most of the time we won't use the diff_id, initialize to zero
     let s:diff_id = 0
-    let s:diff_id_name = ""
 
     while s:col <= s:len || (s:col == 1 && s:diffattr)
       let s:startcol = s:col " The start column for processing text
@@ -871,47 +1516,45 @@ while s:lnum <= s:end
       endif
 
       if s:settings.ignore_conceal || !s:concealinfo[0]
-	" Expand tabs
+	" Expand tabs if needed
 	let s:expandedtab = strpart(s:line, s:startcol - 1, s:col - s:startcol)
-	let s:offset = 0
-	let s:idx = stridx(s:expandedtab, "\t")
-	while s:idx >= 0
-	  if has("multi_byte_encoding")
-	    if s:startcol + s:idx == 1
-	      let s:i = &ts
-	    else
-	      if s:idx == 0
-		let s:prevc = matchstr(s:line, '.\%' . (s:startcol + s:idx + s:offset) . 'c')
+	if s:settings.expand_tabs
+	  let s:offset = 0
+	  let s:idx = stridx(s:expandedtab, "\t")
+	  while s:idx >= 0
+	    if has("multi_byte_encoding")
+	      if s:startcol + s:idx == 1
+		let s:i = &ts
 	      else
-		let s:prevc = matchstr(s:expandedtab, '.\%' . (s:idx + 1) . 'c')
+		if s:idx == 0
+		  let s:prevc = matchstr(s:line, '.\%' . (s:startcol + s:idx + s:offset) . 'c')
+		else
+		  let s:prevc = matchstr(s:expandedtab, '.\%' . (s:idx + 1) . 'c')
+		endif
+		let s:vcol = virtcol([s:lnum, s:startcol + s:idx + s:offset - len(s:prevc)])
+		let s:i = &ts - (s:vcol % &ts)
 	      endif
-	      let s:vcol = virtcol([s:lnum, s:startcol + s:idx + s:offset - len(s:prevc)])
-	      let s:i = &ts - (s:vcol % &ts)
+	      let s:offset -= s:i - 1
+	    else
+	      let s:i = &ts - ((s:idx + s:startcol - 1) % &ts)
 	    endif
-	    let s:offset -= s:i - 1
-	  else
-	    let s:i = &ts - ((s:idx + s:startcol - 1) % &ts)
-	  endif
-	  let s:expandedtab = substitute(s:expandedtab, '\t', repeat(' ', s:i), '')
-	  let s:idx = stridx(s:expandedtab, "\t")
-	endwhile
+	    let s:expandedtab = substitute(s:expandedtab, '\t', repeat(' ', s:i), '')
+	    let s:idx = stridx(s:expandedtab, "\t")
+	  endwhile
+	end
 
 	" get the highlight group name to use
 	let s:id = synIDtrans(s:id)
-	let s:id_name = synIDattr(s:id, "name", s:whatterm)
-	if s:diff_id
-	  let s:diff_id_name = synIDattr(s:diff_id, "name", s:whatterm)
-	endif
       else
 	" use Conceal highlighting for concealed text
-	let s:id_name = 'Conceal'
+	let s:id = s:CONCEAL_ID
 	let s:expandedtab = s:concealinfo[1]
       endif
 
-      " Output the text with the same synID, with class set to {s:id_name},
-      " unless it has been concealed completely.
+      " Output the text with the same synID, with class set to the highlight ID
+      " name, unless it has been concealed completely.
       if strlen(s:expandedtab) > 0
-	let s:new = s:new . s:HtmlFormat(s:expandedtab,  s:id_name, s:diff_id_name)
+	let s:new = s:new . s:HtmlFormat(s:expandedtab,  s:id, s:diff_id, "", 0)
       endif
     endwhile
   endif
@@ -936,9 +1579,9 @@ if s:settings.dynamic_folds
   endwhile
 
   " add fold column to the style list if not already there
-  let s:id = hlID('FoldColumn')
-  if index(s:idlist, s:id) == -1
-    call insert(s:idlist, s:id)
+  let s:id = s:FOLD_C_ID
+  if !has_key(s:stylelist, s:id)
+    let s:stylelist[s:id] = '.FoldColumn { ' . s:CSS1(s:id) . '}'
   endif
 endif
 
@@ -947,7 +1590,7 @@ if s:settings.no_pre
     " Close off the font tag that encapsulates the whole 
     call extend(s:lines, ["", "", ""])
   else
-    call extend(s:lines, ["", ""])
+    call extend(s:lines, ["
", "", ""]) endif else call extend(s:lines, ["
", "", ""]) @@ -957,91 +1600,119 @@ exe s:newwin . "wincmd w" call setline(1, s:lines) unlet s:lines +" Mangle modelines so Vim doesn't try to use HTML text as a modeline if editing +" this file in the future; need to do this after generating all the text in case +" the modeline text has different highlight groups which all turn out to be +" stripped from the final output. +%s!\v(%(^|\s+)%([Vv]i%(m%([<=>]?\d+)?)?|ex)):!\1\:!ge + +" The generated HTML is admittedly ugly and takes a LONG time to fold. +" Make sure the user doesn't do syntax folding when loading a generated file, +" using a modeline. +call append(line('$'), "") + " Now, when we finally know which, we define the colors and styles if s:settings.use_css 1;/